Skip to content

Commit 199fe45

Browse files
committed
Upgrade AvalynxLightbox to version 1.0.2
Bumped version references to 1.0.2. Added german README (README.de.md), improved code coverage with Istanbul, introduced GitHub Actions for tests, and updated Jest configuration. Enhanced `.gitignore` and refined lightbox packaging for better usability.
1 parent 1a48def commit 199fe45

10 files changed

Lines changed: 244 additions & 30 deletions

File tree

.github/workflows/tests.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Use Node.js 20.x
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '20'
21+
cache: 'npm'
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Run tests with coverage
27+
run: npm test -- --coverage
28+
29+
- name: Upload coverage to Codecov
30+
uses: codecov/codecov-action@v4
31+
with:
32+
files: ./coverage/lcov.info
33+
flags: unittests
34+
fail_ci_if_error: true
35+
env:
36+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/.idea/
2-
/node_modules/
32
/ai.txt
4-
/package-lock.json
3+
/coverage/
4+
/node_modules/

README.de.md

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# AvalynxLightbox
2+
3+
[![npm version](https://img.shields.io/npm/v/avalynx-lightbox)](https://www.npmjs.com/package/avalynx-lightbox)
4+
[![npm downloads](https://img.shields.io/npm/dt/avalynx-lightbox)](https://www.npmjs.com/package/avalynx-lightbox)
5+
[![jsDelivr](https://img.shields.io/jsdelivr/npm/hm/avalynx-lightbox)](https://www.jsdelivr.com/package/npm/avalynx-lightbox)
6+
[![License](https://img.shields.io/npm/l/avalynx-lightbox)](LICENSE)
7+
[![Tests](https://github.com/avalynx/avalynx-lightbox/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/avalynx/avalynx-lightbox/actions/workflows/tests.yml)
8+
[![codecov](https://codecov.io/gh/avalynx/avalynx-lightbox/branch/main/graph/badge.svg)](https://codecov.io/gh/avalynx/avalynx-lightbox)
9+
[![GitHub stars](https://img.shields.io/github/stars/avalynx/avalynx-lightbox?style=flat&logo=github)](https://github.com/avalynx/avalynx-lightbox)
10+
11+
AvalynxLightbox ist eine einfache, leichtgewichtige und benutzerfreundliche Lightbox-Bibliothek, die auf Bootstrap 5.3+ basiert und keine weiteren Framework-Abhängigkeiten benötigt. Sie ermöglicht die Anzeige von Bildern in einem Lightbox-Format mit anpassbaren Optionen, ideal für die Integration in moderne Webanwendungen.
12+
13+
## Funktionen
14+
15+
- **Bootstrap-Integration**: Entwickelt für die nahtlose Integration mit Bootstrap >= 5.3.
16+
- **Anpassbare Optionen**: Konfiguriere das Verhalten der Lightbox, einschließlich Schließfunktion, Deckkraft, Z-Index und mehr.
17+
- **Schließbare Lightbox**: Ermöglicht es Benutzern optional, die Lightbox über eine Schaltfläche oder durch Klicken außerhalb des Bildes zu schließen.
18+
- **Callback-Unterstützung**: Lege benutzerdefinierte Aktionen fest, wenn die Lightbox geschlossen wird.
19+
- **Leichtgewichtig**: Keine zusätzlichen Abhängigkeiten außer Bootstrap 5.3+.
20+
21+
## Beispiel
22+
23+
Hier ist ein einfaches Beispiel für die Verwendung von AvalynxLightbox in deinem Projekt:
24+
25+
* [Übersicht](https://avalynx-lightbox.jbs-newmedia.de/examples/index.html)
26+
* [Lightbox anzeigen](https://avalynx-lightbox.jbs-newmedia.de/examples/show-lightbox.html)
27+
28+
## Installation
29+
30+
Um AvalynxLightbox in deinem Projekt zu verwenden, kannst du es direkt in deine HTML-Datei einbinden. Stelle sicher, dass Bootstrap 5.3 oder höher in deinem Projekt enthalten ist, damit AvalynxLightbox korrekt funktioniert.
31+
32+
Zuerst Bootstrap einbinden:
33+
34+
```html
35+
<!-- Bootstrap -->
36+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3/dist/css/bootstrap.min.css" rel="stylesheet">
37+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3/dist/js/bootstrap.bundle.min.js"></script>
38+
```
39+
40+
Dann AvalynxLightbox einbinden:
41+
42+
```html
43+
<script src="pfad/zu/avalynx-lightbox.js"></script>
44+
```
45+
46+
Ersetze `pfad/zu/avalynx-lightbox.js` durch den tatsächlichen Pfad zu den Dateien in deinem Projekt.
47+
48+
## Installation via jsDelivr ([Link](https://cdn.jsdelivr.net/npm/avalynx-lightbox/))
49+
50+
AvalynxLightbox ist auch über [jsDelivr](https://www.jsdelivr.com/) verfügbar. Du kannst es wie folgt in dein Projekt einbinden:
51+
52+
```html
53+
<script src="https://cdn.jsdelivr.net/npm/avalynx-lightbox@1.0.2/dist/js/avalynx-lightbox.js"></script>
54+
```
55+
56+
Stelle sicher, dass du auch Bootstrap JS/CSS in dein Projekt einbindest, um eine korrekte Anzeige von AvalynxLightbox zu gewährleisten.
57+
58+
59+
## Installation via NPM ([Link](https://www.npmjs.com/package/avalynx-lightbox))
60+
61+
AvalynxLightbox ist auch als NPM-Paket verfügbar. Du kannst es mit dem folgenden Befehl zu deinem Projekt hinzufügen:
62+
63+
```bash
64+
npm install avalynx-lightbox
65+
```
66+
67+
Nach der Installation kannst du AvalynxLightbox wie folgt in deine JavaScript-Datei importieren:
68+
69+
```javascript
70+
import { AvalynxLightbox } from 'avalynx-lightbox';
71+
```
72+
73+
Stelle sicher, dass du auch Bootstrap JS/CSS in dein Projekt einbindest, um eine korrekte Anzeige von AvalynxLightbox zu gewährleisten.
74+
75+
## Installation via Symfony AssetMapper
76+
77+
```bash
78+
php bin/console importmap:require avalynx-lightbox
79+
```
80+
81+
Nach der Installation kannst du AvalynxLightbox wie folgt in deine JavaScript-Datei importieren:
82+
83+
```javascript
84+
import { AvalynxLightbox } from 'avalynx-lightbox';
85+
```
86+
87+
Stelle sicher, dass du auch Bootstrap JS/CSS in dein Projekt einbindest, um eine korrekte Anzeige von AvalynxLightbox zu gewährleisten.
88+
89+
## Installation via Symfony AssetComposer
90+
91+
Weitere Informationen zum Symfony AssetComposer Bundle findest du [hier](https://github.com/jbsnewmedia/asset-composer-bundle).
92+
93+
```twig
94+
{% do addAssetComposer('avalynx/avalynx-lightbox/dist/js/avalynx-lightbox.js') %}
95+
```
96+
97+
Stelle sicher, dass du auch Bootstrap JS/CSS in dein Projekt einbindest, um eine korrekte Anzeige von AvalynxLightbox zu gewährleisten.
98+
99+
## Installation via Composer ([Link](https://packagist.org/packages/avalynx/avalynx-lightbox))
100+
101+
AvalynxLightbox ist auch als Composer-Paket verfügbar. Du kannst es mit dem folgenden Befehl zu deinem Projekt hinzufügen:
102+
103+
```bash
104+
composer require avalynx/avalynx-lightbox
105+
```
106+
107+
Nach der Installation kannst du AvalynxLightbox wie folgt in deine HTML-Datei einbinden:
108+
109+
```html
110+
<script src="vendor/avalynx/avalynx-lightbox/dist/js/avalynx-lightbox.js"></script>
111+
```
112+
113+
Stelle sicher, dass du auch Bootstrap JS/CSS in dein Projekt einbindest, um eine korrekte Anzeige von AvalynxLightbox zu gewährleisten.
114+
115+
## Verwendung
116+
117+
Um eine Lightbox zu erstellen, instanziiere einfach ein neues `AvalynxLightbox`-Objekt mit den gewünschten Optionen:
118+
119+
```javascript
120+
new AvalynxLightbox('.avalynx-lightbox', {
121+
closeable: true,
122+
closeOnClickOutside: true,
123+
opacity: 80,
124+
zIndex: 1500,
125+
onClose: () => console.log('Lightbox geschlossen')
126+
}, {
127+
closeButtonLabel: 'Schließen'
128+
});
129+
130+
```
131+
132+
## Optionen
133+
134+
AvalynxLightbox unterstützt die folgenden Optionen zur Anpassung:
135+
136+
- `selector`: (string) CSS-Selektor für die Bilder, die in der Lightbox angezeigt werden sollen (Standard: `'.avalynx-lightbox'`).
137+
- `options`:
138+
- `closeable`: (boolean) Erlaubt Benutzern das Schließen der Lightbox (Standard: `true`).
139+
- `closeOnClickOutside`: (boolean) Schließt die Lightbox, wenn der Benutzer außerhalb des Bildes klickt (Standard: `true`).
140+
- `onClose`: (function) Eine Callback-Funktion, die ausgeführt wird, wenn die Lightbox geschlossen wird (Standard: `null`).
141+
- `opacity`: (number) Hintergrund-Deckkraft (0-100) (Standard: `80`).
142+
- `zIndex`: (number) Der Z-Index für die Lightbox (Standard: `1500`).
143+
- `language`:
144+
- `closeButtonLabel`: (string) Das aria-label für die Schließen-Schaltfläche (Standard: `'Schließen'`).
145+
146+
## Mitwirken
147+
148+
Beiträge sind willkommen! Wenn du etwas beitragen möchtest, fork bitte das Repository und sende einen Pull Request mit deinen Änderungen oder Verbesserungen. Wir suchen Beiträge in den folgenden Bereichen:
149+
150+
- Fehlerbehebungen (Bug fixes)
151+
- Funktionserweiterungen
152+
- Dokumentationsverbesserungen
153+
154+
Bevor du deinen Pull Request einreichst, stelle bitte sicher, dass deine Änderungen gut dokumentiert sind und dem bestehenden Codestil des Projekts entsprechen.
155+
156+
## Lizenz
157+
158+
AvalynxLightbox ist quelloffene Software, die unter der [MIT-Lizenz](LICENSE) lizenziert ist.
159+
160+
## Kontakt
161+
162+
Wenn du Fragen, Funktionswünsche oder Probleme hast, öffne bitte ein Issue in unserem [GitHub-Repository](https://github.com/avalynx/avalynx-lightbox/issues) oder sende einen Pull Request.
163+
164+
Vielen Dank, dass du AvalynxLightbox für dein Projekt in Betracht ziehst!

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
# AvalynxLightbox
22

3+
[![npm version](https://img.shields.io/npm/v/avalynx-lightbox)](https://www.npmjs.com/package/avalynx-lightbox)
4+
[![npm downloads](https://img.shields.io/npm/dt/avalynx-lightbox)](https://www.npmjs.com/package/avalynx-lightbox)
5+
[![jsDelivr](https://img.shields.io/jsdelivr/npm/hm/avalynx-lightbox)](https://www.jsdelivr.com/package/npm/avalynx-lightbox)
6+
[![License](https://img.shields.io/npm/l/avalynx-lightbox)](LICENSE)
7+
[![Tests](https://github.com/avalynx/avalynx-lightbox/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/avalynx/avalynx-lightbox/actions/workflows/tests.yml)
8+
[![codecov](https://codecov.io/gh/avalynx/avalynx-lightbox/branch/main/graph/badge.svg)](https://codecov.io/gh/avalynx/avalynx-lightbox)
9+
[![GitHub stars](https://img.shields.io/github/stars/avalynx/avalynx-lightbox?style=flat&logo=github)](https://github.com/avalynx/avalynx-lightbox)
10+
311
AvalynxLightbox is a simple, lightweight, and easy-to-use lightbox library, built on Bootstrap 5.3+ without any framework dependencies. It allows you to display images in a lightbox format with customizable options, perfect for integrating into modern web applications.
412

513
## Features
614

7-
- **Bootstrap-Based**: Integrates seamlessly with Bootstrap (version 5.3 or higher).
15+
- **Bootstrap Integration**: Designed for seamless integration with Bootstrap >= 5.3.
816
- **Customizable Options**: Configure lightbox behavior, including close functionality, opacity, z-index, and more.
917
- **Closeable Lightbox**: Optionally allow users to close the lightbox with a button or by clicking outside the image.
1018
- **Callback Support**: Set custom actions when the lightbox is closed.
@@ -42,7 +50,7 @@ Replace `path/to/avalynx-lightbox.js` with the actual path to the files in your
4250
AvalynxLightbox is also available via [jsDelivr](https://www.jsdelivr.com/). You can include it in your project like this:
4351

4452
```html
45-
<script src="https://cdn.jsdelivr.net/npm/avalynx-lightbox@1.0.1/dist/js/avalynx-lightbox.js"></script>
53+
<script src="https://cdn.jsdelivr.net/npm/avalynx-lightbox@1.0.2/dist/js/avalynx-lightbox.js"></script>
4654
```
4755

4856
Make sure to also include Bootstrap's JS/CSS in your project to ensure AvalynxLightbox displays correctly.

dist/js/avalynx-lightbox.esm.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* AvalynxLightbox is a simple, lightweight, and easy-to-use lightbox library. Based on Bootstrap >=5.3 without any framework dependencies.
55
*
6-
* @version 1.0.1
6+
* @version 1.0.2
77
* @license MIT
88
* @author https://github.com/avalynx/avalynx-lightbox/graphs/contributors
99
* @website https://github.com/avalynx/
@@ -32,13 +32,10 @@ export class AvalynxLightbox {
3232
if (!selector.startsWith('.') && !selector.startsWith('#')) {
3333
selector = '.' + selector;
3434
}
35-
3635
this.selector = selector;
37-
3836
if (options === null || typeof options !== 'object') {
3937
options = {};
4038
}
41-
4239
this.options = {
4340
closeable: options.closeable !== undefined ? options.closeable : true,
4441
closeOnClickOutside: options.closeOnClickOutside !== undefined ? options.closeOnClickOutside : true,
@@ -47,16 +44,13 @@ export class AvalynxLightbox {
4744
zIndex: options.zIndex || 1500,
4845
...options
4946
};
50-
5147
if (language === null || typeof language !== 'object') {
5248
language = {};
5349
}
54-
5550
this.language = {
5651
closeButtonLabel: language.closeButtonLabel || 'Close',
5752
...language
5853
};
59-
6054
this.setupClickListener();
6155
}
6256

@@ -139,4 +133,9 @@ export class AvalynxLightbox {
139133
this.options.onClose();
140134
}
141135
}
142-
}
136+
}
137+
138+
/* istanbul ignore next */
139+
if (typeof module !== 'undefined' && module.exports) {
140+
module.exports = AvalynxLightbox;
141+
}

dist/js/avalynx-lightbox.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* AvalynxLightbox is a simple, lightweight, and easy-to-use lightbox library. Based on Bootstrap >=5.3 without any framework dependencies.
55
*
6-
* @version 1.0.1
6+
* @version 1.0.2
77
* @license MIT
88
* @author https://github.com/avalynx/avalynx-lightbox/graphs/contributors
99
* @website https://github.com/avalynx/
@@ -30,13 +30,10 @@ class AvalynxLightbox {
3030
if (!selector.startsWith('.') && !selector.startsWith('#')) {
3131
selector = '.' + selector;
3232
}
33-
3433
this.selector = selector;
35-
3634
if (options === null || typeof options !== 'object') {
3735
options = {};
3836
}
39-
4037
this.options = {
4138
closeable: options.closeable !== undefined ? options.closeable : true,
4239
closeOnClickOutside: options.closeOnClickOutside !== undefined ? options.closeOnClickOutside : true,
@@ -45,16 +42,13 @@ class AvalynxLightbox {
4542
zIndex: options.zIndex || 1500,
4643
...options
4744
};
48-
4945
if (language === null || typeof language !== 'object') {
5046
language = {};
5147
}
52-
5348
this.language = {
5449
closeButtonLabel: language.closeButtonLabel || 'Close',
5550
...language
5651
};
57-
5852
this.setupClickListener();
5953
}
6054

@@ -139,6 +133,7 @@ class AvalynxLightbox {
139133
}
140134
}
141135

136+
/* istanbul ignore next */
142137
if (typeof module !== 'undefined' && module.exports) {
143138
module.exports = AvalynxLightbox;
144139
}

examples/show-lightbox.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.9/build/styles/stackoverflow-light.min.css" id="hljsTheme">
1717
<script>hljs.highlightAll();</script>
1818

19-
<!-- AvalynxLightbox 1.0.1 -->
20-
<script src="https://cdn.jsdelivr.net/npm/avalynx-lightbox@1.0.1/dist/js/avalynx-lightbox.min.js"></script>
19+
<!-- AvalynxLightbox -->
20+
<script src="../src/js/avalynx-lightbox.js"></script>
2121

2222
<!-- Example helper -->
2323
<link href="./css/helper.css" rel="stylesheet">

jest.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,15 @@ module.exports = {
88
transform: {
99
"^.+\\.js$": "babel-jest"
1010
},
11+
collectCoverage: true,
12+
collectCoverageFrom: ["src/**/*.js"],
13+
coverageReporters: ["text", "lcov", "html"],
14+
coverageThreshold: {
15+
global: {
16+
branches: 100,
17+
functions: 100,
18+
lines: 100,
19+
statements: 100
20+
}
21+
}
1122
};

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "avalynx-lightbox",
33
"title": "AvalynxLightbox",
44
"description": "AvalynxLightbox is a simple, lightweight, and easy-to-use lightbox library. Based on Bootstrap >=5.3 without any framework dependencies.",
5-
"version": "1.0.1",
5+
"version": "1.0.2",
66
"license": "MIT",
77
"main": "dist/js/avalynx-lightbox.js",
88
"module": "dist/js/avalynx-lightbox.esm.js",
@@ -40,12 +40,12 @@
4040
"bootstrap": ">=5.3"
4141
},
4242
"devDependencies": {
43-
"@babel/core": "^7",
44-
"@babel/preset-env": "^7",
45-
"babel-jest": "^29",
46-
"jest": "^29",
47-
"jest-environment-jsdom": "^29",
48-
"shelljs": "^0",
49-
"shx": "^0"
43+
"@babel/core": "^7.29.0",
44+
"@babel/preset-env": "^7.29.0",
45+
"babel-jest": "^30.2.0",
46+
"jest": "^30.2.0",
47+
"jest-environment-jsdom": "^30.2.0",
48+
"shelljs": "^0.10.0",
49+
"shx": "^0.4.0"
5050
}
5151
}

0 commit comments

Comments
 (0)