avalynx-alert 1.0.2 → 1.0.4

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/README.md CHANGED
@@ -47,8 +47,8 @@ Replace `path/to/avalynx-alert.js` and `path/to/avalynx-alert.css` with the actu
47
47
  AvalynxAlert is also available via [jsDelivr](https://www.jsdelivr.com/). You can include it in your project like this:
48
48
 
49
49
  ```html
50
- <link href="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.2/dist/css/avalynx-alert.css" rel="stylesheet">
51
- <script src="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.2/dist/js/avalynx-alert.js"></script>
50
+ <link href="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.4/dist/css/avalynx-alert.css" rel="stylesheet">
51
+ <script src="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.4/dist/js/avalynx-alert.js"></script>
52
52
  ```
53
53
 
54
54
  Make sure to also include Bootstrap's JS/CSS in your project to ensure AvalynxAlert displays correctly.
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * A simple alert system for web applications. Based on Bootstrap >=5.3 without any framework dependencies.
5
5
  *
6
- * @version 1.0.2
6
+ * @version 1.0.4
7
7
  * @license MIT
8
8
  * @author https://github.com/avalynx/avalynx-alert/graphs/contributors
9
9
  * @website https://github.com/avalynx/
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * A simple alert system for web applications. Based on Bootstrap >=5.3 without any framework dependencies.
5
5
  *
6
- * @version 1.0.2
6
+ * @version 1.0.4
7
7
  * @license MIT
8
8
  * @author https://github.com/avalynx/avalynx-alert/graphs/contributors
9
9
  * @website https://github.com/avalynx/
@@ -22,8 +22,13 @@
22
22
  *
23
23
  */
24
24
 
25
+ import * as bootstrap from 'bootstrap';
26
+
25
27
  export class AvalynxAlert {
26
28
  constructor(message, type, options = {}) {
29
+ if (options === null || typeof options !== 'object') {
30
+ options = {};
31
+ }
27
32
  this.message = message;
28
33
  this.type = type;
29
34
  this.options = {
@@ -105,7 +110,6 @@ export class AvalynxAlert {
105
110
  alert.classList.add('p-0');
106
111
  alert.classList.add('overflow-hidden');
107
112
  alert.classList.add('avalynx-alert');
108
- alert.role = 'alert';
109
113
  alert.innerHTML = `<div class="alert-content">${this.message}`;
110
114
  if (this.options.closeable) {
111
115
  alert.innerHTML += `<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>`;
@@ -114,6 +118,7 @@ export class AvalynxAlert {
114
118
  if (this.options.autoClose) {
115
119
  alert.innerHTML += `<div class="alert-timer" style="height: 5px; width: 0;"></div>`;
116
120
  }
121
+ alert.setAttribute('role', 'alert');
117
122
 
118
123
  document.getElementById('avalynx-alert-container-' + this.options.position).appendChild(alert);
119
124
 
@@ -138,4 +143,4 @@ export class AvalynxAlert {
138
143
  }, this.options.duration);
139
144
  }
140
145
  }
141
- }
146
+ }
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * A simple alert system for web applications. Based on Bootstrap >=5.3 without any framework dependencies.
5
5
  *
6
- * @version 1.0.2
6
+ * @version 1.0.4
7
7
  * @license MIT
8
8
  * @author https://github.com/avalynx/avalynx-alert/graphs/contributors
9
9
  * @website https://github.com/avalynx/
@@ -24,6 +24,9 @@
24
24
 
25
25
  class AvalynxAlert {
26
26
  constructor(message, type, options = {}) {
27
+ if (options === null || typeof options !== 'object') {
28
+ options = {};
29
+ }
27
30
  this.message = message;
28
31
  this.type = type;
29
32
  this.options = {
@@ -105,7 +108,6 @@ class AvalynxAlert {
105
108
  alert.classList.add('p-0');
106
109
  alert.classList.add('overflow-hidden');
107
110
  alert.classList.add('avalynx-alert');
108
- alert.role = 'alert';
109
111
  alert.innerHTML = `<div class="alert-content">${this.message}`;
110
112
  if (this.options.closeable) {
111
113
  alert.innerHTML += `<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>`;
@@ -114,6 +116,7 @@ class AvalynxAlert {
114
116
  if (this.options.autoClose) {
115
117
  alert.innerHTML += `<div class="alert-timer" style="height: 5px; width: 0;"></div>`;
116
118
  }
119
+ alert.setAttribute('role', 'alert');
117
120
 
118
121
  document.getElementById('avalynx-alert-container-' + this.options.position).appendChild(alert);
119
122
 
@@ -139,3 +142,7 @@ class AvalynxAlert {
139
142
  }
140
143
  }
141
144
  }
145
+
146
+ if (typeof module !== 'undefined' && module.exports) {
147
+ module.exports = AvalynxAlert;
148
+ }
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.2",
5
+ "version": "1.0.4",
6
6
  "license": "MIT",
7
7
  "main": "dist/js/avalynx-alert.js",
8
8
  "module": "dist/js/avalynx-alert.esm.js",