avalynx-alert 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.de.md +170 -0
- package/README.md +16 -6
- package/dist/css/avalynx-alert.css +2 -2
- package/dist/js/avalynx-alert.esm.js +37 -31
- package/dist/js/avalynx-alert.js +32 -30
- package/package.json +9 -9
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2024 Juergen Schwind an the
|
|
3
|
+
Copyright (c) 2024 Juergen Schwind an the AvalynxAlert Authors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.de.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# AvalynxAlert
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/avalynx-alert)
|
|
4
|
+
[](https://www.npmjs.com/package/avalynx-alert)
|
|
5
|
+
[](https://www.jsdelivr.com/package/npm/avalynx-alert)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://github.com/avalynx/avalynx-alert/actions/workflows/tests.yml)
|
|
8
|
+
[](https://codecov.io/gh/avalynx/avalynx-alert)
|
|
9
|
+
[](https://github.com/avalynx/avalynx-alert)
|
|
10
|
+
|
|
11
|
+
AvalynxAlert ist ein leichtgewichtiges, eigenständiges Benachrichtigungssystem für Web-Anwendungen. Es nutzt Bootstrap (ab Version 5.3) und bietet anpassbare Alerts, die flexibel auf dem Bildschirm positioniert werden können.
|
|
12
|
+
|
|
13
|
+
## Funktionen
|
|
14
|
+
|
|
15
|
+
- **Verschiedene Alert-Typen**: `primary`, `secondary`, `success`, `danger`, `warning`, `info`, `light`, `dark`.
|
|
16
|
+
- **Flexible Positionierung**: `top-left`, `top-center`, `top-right`, `bottom-left`, `bottom-center`, `bottom-right`.
|
|
17
|
+
- **Steuerbare Dauer**: Anzeigezeit in Millisekunden konfigurierbar.
|
|
18
|
+
- **Schließbar**: Optional kann ein Schließen-Button angezeigt werden.
|
|
19
|
+
- **Automatisches Schließen**: Alerts können nach Ablauf der Dauer automatisch ausgeblendet werden.
|
|
20
|
+
- **Einfache API**: Schlanke Verwendung ohne Framework-Abhängigkeiten.
|
|
21
|
+
|
|
22
|
+
## Beispiele
|
|
23
|
+
|
|
24
|
+
Hier ist ein einfaches Beispiel für die Verwendung von AvalynxAlert in Ihrem Projekt:
|
|
25
|
+
|
|
26
|
+
* [Übersicht](https://avalynx-alert.jbs-newmedia.de/examples/index.html)
|
|
27
|
+
* [Einfacher Alert](https://avalynx-alert.jbs-newmedia.de/examples/simple-alert.html)
|
|
28
|
+
* [Zufällige Alerts](https://avalynx-alert.jbs-newmedia.de/examples/random-alerts.html)
|
|
29
|
+
* [Callback bei Schließen](https://avalynx-alert.jbs-newmedia.de/examples/callback-onclose.html)
|
|
30
|
+
* [Zufällige Alerts alle 3 Sekunden](https://avalynx-alert.jbs-newmedia.de/examples/random-alerts-every-3s.html)
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
Um AvalynxAlert in Ihrem Projekt zu verwenden, können Sie es direkt in Ihre HTML-Datei einbinden. Stellen Sie sicher, dass Bootstrap 5.3 oder höher in Ihrem Projekt enthalten ist, damit AvalynxAlert korrekt funktioniert.
|
|
35
|
+
|
|
36
|
+
Zuerst Bootstrap einbinden:
|
|
37
|
+
|
|
38
|
+
```html
|
|
39
|
+
<!-- Bootstrap -->
|
|
40
|
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
41
|
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Dann AvalynxAlert einbinden:
|
|
45
|
+
|
|
46
|
+
```html
|
|
47
|
+
<link href="pfad/zu/avalynx-alert.css" rel="stylesheet">
|
|
48
|
+
<script src="pfad/zu/avalynx-alert.js"></script>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Ersetzen Sie `pfad/zu/avalynx-alert.*` durch den tatsächlichen Pfad zu den Dateien in Ihrem Projekt.
|
|
52
|
+
|
|
53
|
+
## Installation über jsDelivr ([Link](https://cdn.jsdelivr.net/npm/avalynx-alert/))
|
|
54
|
+
|
|
55
|
+
AvalynxAlert ist auch über [jsDelivr](https://www.jsdelivr.com/) verfügbar. Sie können es wie folgt in Ihr Projekt einbinden:
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<link href="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.6/dist/css/avalynx-alert.css" rel="stylesheet">
|
|
59
|
+
<script src="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.6/dist/js/avalynx-alert.js"></script>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Stellen Sie sicher, dass Sie auch Bootstrap JS/CSS in Ihr Projekt einbinden, um eine korrekte Anzeige von AvalynxAlert zu gewährleisten.
|
|
63
|
+
|
|
64
|
+
## Installation über NPM ([Link](https://www.npmjs.com/package/avalynx-alert))
|
|
65
|
+
|
|
66
|
+
AvalynxAlert ist auch als NPM-Paket verfügbar. Sie können es mit dem folgenden Befehl zu Ihrem Projekt hinzufügen:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm install avalynx-alert
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Nach der Installation können Sie AvalynxAlert wie folgt in Ihre JavaScript-Datei importieren:
|
|
73
|
+
|
|
74
|
+
```javascript
|
|
75
|
+
import { AvalynxAlert } from 'avalynx-alert';
|
|
76
|
+
import 'avalynx-alert/dist/css/avalynx-alert.css';
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Stellen Sie sicher, dass Sie auch Bootstrap JS/CSS in Ihr Projekt einbinden, um eine korrekte Anzeige von AvalynxAlert zu gewährleisten.
|
|
80
|
+
|
|
81
|
+
## Installation über Symfony AssetMapper
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
php bin/console importmap:require avalynx-alert
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Nach der Installation können Sie AvalynxAlert wie folgt in Ihre JavaScript-Datei importieren:
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
import { AvalynxAlert } from 'avalynx-alert';
|
|
91
|
+
import 'avalynx-alert/dist/css/avalynx-alert.css';
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Stellen Sie sicher, dass Sie auch Bootstrap JS/CSS in Ihr Projekt einbinden, um eine korrekte Anzeige von AvalynxAlert zu gewährleisten.
|
|
95
|
+
|
|
96
|
+
## Installation über Symfony AssetComposer
|
|
97
|
+
|
|
98
|
+
Weitere Informationen zum Symfony AssetComposer Bundle finden Sie [hier](https://github.com/jbsnewmedia/asset-composer-bundle).
|
|
99
|
+
|
|
100
|
+
```twig
|
|
101
|
+
{% do addAssetComposer('avalynx/avalynx-alert/dist/css/avalynx-alert.css') %}
|
|
102
|
+
{% do addAssetComposer('avalynx/avalynx-alert/dist/js/avalynx-alert.js') %}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Stellen Sie sicher, dass Sie auch Bootstrap JS/CSS in Ihr Projekt einbinden, um eine korrekte Anzeige von AvalynxAlert zu gewährleisten.
|
|
106
|
+
|
|
107
|
+
## Installation über Composer ([Link](https://packagist.org/packages/avalynx/avalynx-alert))
|
|
108
|
+
|
|
109
|
+
AvalynxAlert ist auch als Composer-Paket verfügbar. Sie können es mit dem folgenden Befehl zu Ihrem Projekt hinzufügen:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
composer require avalynx/avalynx-alert
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Nach der Installation können Sie AvalynxAlert wie folgt in Ihre HTML-Datei einbinden:
|
|
116
|
+
|
|
117
|
+
```html
|
|
118
|
+
<link href="vendor/avalynx/avalynx-alert/dist/css/avalynx-alert.css" rel="stylesheet">
|
|
119
|
+
<script src="vendor/avalynx/avalynx-alert/dist/js/avalynx-alert.js"></script>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Stellen Sie sicher, dass Sie auch Bootstrap JS/CSS in Ihr Projekt einbinden, um eine korrekte Anzeige von AvalynxAlert zu gewährleisten.
|
|
123
|
+
|
|
124
|
+
## Verwendung
|
|
125
|
+
|
|
126
|
+
Einen Alert erzeugen Sie, indem Sie ein neues `AvalynxAlert`-Objekt mit den gewünschten Optionen instanziieren:
|
|
127
|
+
|
|
128
|
+
```javascript
|
|
129
|
+
new AvalynxAlert('Ihre Nachricht', 'success', {
|
|
130
|
+
duration: 5000,
|
|
131
|
+
position: 'top-right',
|
|
132
|
+
closeable: true,
|
|
133
|
+
autoClose: true,
|
|
134
|
+
width: '400px'
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Optionen
|
|
139
|
+
|
|
140
|
+
AvalynxAlert ermöglicht die folgenden Optionen zur Anpassung:
|
|
141
|
+
|
|
142
|
+
- `message`: (string) Die anzuzeigende Nachricht (Standard: `''`).
|
|
143
|
+
- `type`: (string) Der Typ des Alerts. Einer von (`primary`, `secondary`, `success`, `danger`, `warning`, `info`, `light`, `dark`) (Standard: `'info'`).
|
|
144
|
+
- `options`: Ein Objekt, das die folgenden Schlüssel enthält:
|
|
145
|
+
- `duration`: (number) Anzeigezeit in Millisekunden (Standard: `5000`).
|
|
146
|
+
- `position`: (string) Position des Alerts auf dem Bildschirm. Einer von `top-left`, `top-center`, `top-right`, `bottom-left`, `bottom-center`, `bottom-right` (Standard: `'top-center'`).
|
|
147
|
+
- `closeable`: (boolean) Ob der Nutzer den Alert schließen kann (Standard: `true`).
|
|
148
|
+
- `autoClose`: (boolean) Ob der Alert nach Ablauf automatisch geschlossen wird (Standard: `true`).
|
|
149
|
+
- `width`: (string) Breite des Alerts (Standard: `'400px'`).
|
|
150
|
+
- `onClose`: (function) Eine Callback-Funktion, die beim Schließen ausgeführt wird (Standard: `null`).
|
|
151
|
+
|
|
152
|
+
## Beitragen
|
|
153
|
+
|
|
154
|
+
Beiträge sind willkommen! Wenn Sie etwas beitragen möchten, forken Sie bitte das Repository und senden Sie einen Pull-Request mit Ihren Änderungen oder Verbesserungen. Wir suchen Beiträge in den folgenden Bereichen:
|
|
155
|
+
|
|
156
|
+
- Fehlerbehebungen (Bug fixes)
|
|
157
|
+
- Funktionserweiterungen
|
|
158
|
+
- Dokumentationsverbesserungen
|
|
159
|
+
|
|
160
|
+
Bevor Sie Ihren Pull-Request einreichen, stellen Sie bitte sicher, dass Ihre Änderungen gut dokumentiert sind und dem bestehenden Codestil des Projekts entsprechen.
|
|
161
|
+
|
|
162
|
+
## Lizenz
|
|
163
|
+
|
|
164
|
+
AvalynxAlert ist quelloffene Software, die unter der [MIT-Lizenz](LICENSE) lizenziert ist.
|
|
165
|
+
|
|
166
|
+
## Kontakt
|
|
167
|
+
|
|
168
|
+
Wenn Sie Fragen, Funktionswünsche oder Probleme haben, eröffnen Sie bitte ein Issue in unserem [GitHub-Repository](https://github.com/avalynx/avalynx-alert/issues) oder reichen Sie einen Pull-Request ein.
|
|
169
|
+
|
|
170
|
+
Vielen Dank, dass Sie AvalynxAlert für Ihr Projekt in Betracht ziehen!
|
package/README.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# AvalynxAlert
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/avalynx-alert)
|
|
4
|
+
[](https://www.npmjs.com/package/avalynx-alert)
|
|
5
|
+
[](https://packagist.org/packages/avalynx/avalynx-alert)
|
|
6
|
+
[](https://packagist.org/packages/avalynx/avalynx-alert)
|
|
7
|
+
[](https://www.jsdelivr.com/package/npm/avalynx-alert)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
[](https://github.com/avalynx/avalynx-alert/actions/workflows/tests.yml)
|
|
10
|
+
[](https://codecov.io/gh/avalynx/avalynx-alert)
|
|
11
|
+
[](https://github.com/avalynx/avalynx-alert)
|
|
12
|
+
|
|
3
13
|
AvalynxAlert is a lightweight, dependency-free alert system designed for web applications. It leverages Bootstrap (version 5.3 or higher) to provide a seamless integration with your project, offering a range of customizable alerts that can be positioned anywhere on the screen.
|
|
4
14
|
|
|
5
15
|
## Features
|
|
@@ -11,7 +21,7 @@ AvalynxAlert is a lightweight, dependency-free alert system designed for web app
|
|
|
11
21
|
- **AutoClose Functionality**: Alerts can automatically disappear after a certain period.
|
|
12
22
|
- **Easy to Use**: Simple API for creating and managing alerts within your web applications.
|
|
13
23
|
|
|
14
|
-
##
|
|
24
|
+
## Examples
|
|
15
25
|
|
|
16
26
|
Here's a simple example of how to use AvalynxAlert in your project:
|
|
17
27
|
|
|
@@ -47,8 +57,8 @@ Replace `path/to/avalynx-alert.js` and `path/to/avalynx-alert.css` with the actu
|
|
|
47
57
|
AvalynxAlert is also available via [jsDelivr](https://www.jsdelivr.com/). You can include it in your project like this:
|
|
48
58
|
|
|
49
59
|
```html
|
|
50
|
-
<link href="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.
|
|
51
|
-
<script src="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.
|
|
60
|
+
<link href="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.6/dist/css/avalynx-alert.css" rel="stylesheet">
|
|
61
|
+
<script src="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.6/dist/js/avalynx-alert.js"></script>
|
|
52
62
|
```
|
|
53
63
|
|
|
54
64
|
Make sure to also include Bootstrap's JS/CSS in your project to ensure AvalynxAlert displays correctly.
|
|
@@ -65,7 +75,7 @@ After installing, you can import AvalynxAlert into your JavaScript file like thi
|
|
|
65
75
|
|
|
66
76
|
```javascript
|
|
67
77
|
import { AvalynxAlert } from 'avalynx-alert';
|
|
68
|
-
import 'avalynx-alert/dist/css/avalynx-alert.
|
|
78
|
+
import 'avalynx-alert/dist/css/avalynx-alert.css';
|
|
69
79
|
```
|
|
70
80
|
|
|
71
81
|
Make sure to also include Bootstrap's JS/CSS in your project to ensure AvalynxAlert displays correctly.
|
|
@@ -80,7 +90,7 @@ After installing, you can import AvalynxAlert into your JavaScript file like thi
|
|
|
80
90
|
|
|
81
91
|
```javascript
|
|
82
92
|
import { AvalynxAlert } from 'avalynx-alert';
|
|
83
|
-
import 'avalynx-alert/dist/css/avalynx-alert.
|
|
93
|
+
import 'avalynx-alert/dist/css/avalynx-alert.css';
|
|
84
94
|
```
|
|
85
95
|
|
|
86
96
|
Make sure to also include Bootstrap's JS/CSS in your project to ensure AvalynxAlert displays correctly.
|
|
@@ -135,7 +145,7 @@ AvalynxAlert allows the following options for customization:
|
|
|
135
145
|
- `type`: (string) The type of alert. One of (`primary`, `secondary`, `success`, `danger`, `warning`, `info`, `light`, `dark`) (default: `'info'`).
|
|
136
146
|
- `options`: An object containing the following keys:
|
|
137
147
|
- `duration`: (number) Duration in milliseconds for the alert to be displayed (default: `5000`).
|
|
138
|
-
- `position`: (string) Position of the alert on the screen. One of `top-left`, `top-center`, `top-right`, `bottom-left`, `bottom-center`, `bottom-right` (default: `'top-
|
|
148
|
+
- `position`: (string) Position of the alert on the screen. One of `top-left`, `top-center`, `top-right`, `bottom-left`, `bottom-center`, `bottom-right` (default: `'top-center'`).
|
|
139
149
|
- `closeable`: (boolean) Whether the alert can be closed by the user (default: `true`).
|
|
140
150
|
- `autoClose`: (boolean) Whether the alert will close automatically after the duration (default: `true`).
|
|
141
151
|
- `width`: (string) The width of the alert (default: `400px`).
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AvalynxAlert
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* AvalynxAlert is a simple alert system for web applications. Based on Bootstrap >=5.3 without any framework dependencies.
|
|
5
5
|
*
|
|
6
|
-
* @version 1.0.
|
|
6
|
+
* @version 1.0.6
|
|
7
7
|
* @license MIT
|
|
8
8
|
* @author https://github.com/avalynx/avalynx-alert/graphs/contributors
|
|
9
9
|
* @website https://github.com/avalynx/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AvalynxAlert
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* AvalynxAlert is a simple alert system for web applications. Based on Bootstrap >=5.3 without any framework dependencies.
|
|
5
5
|
*
|
|
6
|
-
* @version 1.0.
|
|
6
|
+
* @version 1.0.6
|
|
7
7
|
* @license MIT
|
|
8
8
|
* @author https://github.com/avalynx/avalynx-alert/graphs/contributors
|
|
9
9
|
* @website https://github.com/avalynx/
|
|
@@ -26,11 +26,11 @@ import * as bootstrap from 'bootstrap';
|
|
|
26
26
|
|
|
27
27
|
export class AvalynxAlert {
|
|
28
28
|
constructor(message, type, options = {}) {
|
|
29
|
+
this.message = message;
|
|
30
|
+
this.type = type;
|
|
29
31
|
if (options === null || typeof options !== 'object') {
|
|
30
32
|
options = {};
|
|
31
33
|
}
|
|
32
|
-
this.message = message;
|
|
33
|
-
this.type = type;
|
|
34
34
|
this.options = {
|
|
35
35
|
duration: options.duration || 5000,
|
|
36
36
|
position: options.position || 'top-center',
|
|
@@ -65,32 +65,33 @@ export class AvalynxAlert {
|
|
|
65
65
|
container.style.zIndex = '1000';
|
|
66
66
|
container.classList.add('container-fluid');
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
68
|
+
container.style.position = 'fixed';
|
|
69
|
+
switch (this.options.position) {
|
|
70
|
+
case 'top-left':
|
|
71
|
+
container.style.top = '10px';
|
|
72
|
+
container.style.left = '0px';
|
|
73
|
+
break;
|
|
74
|
+
case 'top-center':
|
|
75
|
+
container.style.top = '10px';
|
|
76
|
+
container.style.left = '50%';
|
|
77
|
+
container.style.transform = 'translateX(-50%)';
|
|
78
|
+
break;
|
|
79
|
+
case 'top-right':
|
|
80
|
+
container.style.top = '10px';
|
|
81
|
+
container.style.right = '0px';
|
|
82
|
+
break;
|
|
83
|
+
case 'bottom-left':
|
|
84
|
+
container.style.bottom = '10px';
|
|
85
|
+
container.style.left = '0px';
|
|
86
|
+
break;
|
|
87
|
+
case 'bottom-center':
|
|
88
|
+
container.style.bottom = '10px';
|
|
89
|
+
container.style.left = '50%';
|
|
90
|
+
container.style.transform = 'translateX(-50%)';
|
|
91
|
+
break;
|
|
92
|
+
default:
|
|
93
|
+
container.style.bottom = '10px';
|
|
94
|
+
container.style.right = '0px';
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
document.body.appendChild(container);
|
|
@@ -143,4 +144,9 @@ export class AvalynxAlert {
|
|
|
143
144
|
}, this.options.duration);
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
|
-
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* istanbul ignore next */
|
|
150
|
+
if (typeof module !== 'undefined' && module.exports) {
|
|
151
|
+
module.exports = AvalynxAlert;
|
|
152
|
+
}
|
package/dist/js/avalynx-alert.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AvalynxAlert
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* AvalynxAlert is a simple alert system for web applications. Based on Bootstrap >=5.3 without any framework dependencies.
|
|
5
5
|
*
|
|
6
|
-
* @version 1.0.
|
|
6
|
+
* @version 1.0.6
|
|
7
7
|
* @license MIT
|
|
8
8
|
* @author https://github.com/avalynx/avalynx-alert/graphs/contributors
|
|
9
9
|
* @website https://github.com/avalynx/
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
|
|
25
25
|
class AvalynxAlert {
|
|
26
26
|
constructor(message, type, options = {}) {
|
|
27
|
+
this.message = message;
|
|
28
|
+
this.type = type;
|
|
27
29
|
if (options === null || typeof options !== 'object') {
|
|
28
30
|
options = {};
|
|
29
31
|
}
|
|
30
|
-
this.message = message;
|
|
31
|
-
this.type = type;
|
|
32
32
|
this.options = {
|
|
33
33
|
duration: options.duration || 5000,
|
|
34
34
|
position: options.position || 'top-center',
|
|
@@ -63,32 +63,33 @@ class AvalynxAlert {
|
|
|
63
63
|
container.style.zIndex = '1000';
|
|
64
64
|
container.classList.add('container-fluid');
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
66
|
+
container.style.position = 'fixed';
|
|
67
|
+
switch (this.options.position) {
|
|
68
|
+
case 'top-left':
|
|
69
|
+
container.style.top = '10px';
|
|
70
|
+
container.style.left = '0px';
|
|
71
|
+
break;
|
|
72
|
+
case 'top-center':
|
|
73
|
+
container.style.top = '10px';
|
|
74
|
+
container.style.left = '50%';
|
|
75
|
+
container.style.transform = 'translateX(-50%)';
|
|
76
|
+
break;
|
|
77
|
+
case 'top-right':
|
|
78
|
+
container.style.top = '10px';
|
|
79
|
+
container.style.right = '0px';
|
|
80
|
+
break;
|
|
81
|
+
case 'bottom-left':
|
|
82
|
+
container.style.bottom = '10px';
|
|
83
|
+
container.style.left = '0px';
|
|
84
|
+
break;
|
|
85
|
+
case 'bottom-center':
|
|
86
|
+
container.style.bottom = '10px';
|
|
87
|
+
container.style.left = '50%';
|
|
88
|
+
container.style.transform = 'translateX(-50%)';
|
|
89
|
+
break;
|
|
90
|
+
default:
|
|
91
|
+
container.style.bottom = '10px';
|
|
92
|
+
container.style.right = '0px';
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
document.body.appendChild(container);
|
|
@@ -143,6 +144,7 @@ class AvalynxAlert {
|
|
|
143
144
|
}
|
|
144
145
|
}
|
|
145
146
|
|
|
147
|
+
/* istanbul ignore next */
|
|
146
148
|
if (typeof module !== 'undefined' && module.exports) {
|
|
147
149
|
module.exports = AvalynxAlert;
|
|
148
150
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "avalynx-alert",
|
|
3
3
|
"title": "AvalynxAlert",
|
|
4
4
|
"description": "AvalynxAlert is a simple alert system for web applications. Based on Bootstrap >=5.3 without any framework dependencies.",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.6",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/js/avalynx-alert.js",
|
|
8
8
|
"module": "dist/js/avalynx-alert.esm.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"package.json"
|
|
26
26
|
],
|
|
27
27
|
"author": {
|
|
28
|
-
"name": "Juergen Schwind an the
|
|
28
|
+
"name": "Juergen Schwind an the AvalynxAlert Authors",
|
|
29
29
|
"url": "https://github.com/avalynx/avalynx-alert/graphs/contributors"
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://github.com/avalynx/",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"bootstrap": ">=5.3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@babel/core": "^7",
|
|
48
|
-
"@babel/preset-env": "^7",
|
|
49
|
-
"babel-jest": "^
|
|
50
|
-
"jest": "^
|
|
51
|
-
"jest-environment-jsdom": "^
|
|
52
|
-
"shelljs": "^0",
|
|
53
|
-
"shx": "^0"
|
|
47
|
+
"@babel/core": "^7.29.0",
|
|
48
|
+
"@babel/preset-env": "^7.29.0",
|
|
49
|
+
"babel-jest": "^30.2.0",
|
|
50
|
+
"jest": "^30.2.0",
|
|
51
|
+
"jest-environment-jsdom": "^30.2.0",
|
|
52
|
+
"shelljs": "^0.10.0",
|
|
53
|
+
"shx": "^0.4.0"
|
|
54
54
|
}
|
|
55
55
|
}
|