flicker-alerts 1.0.5 → 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.
Files changed (3) hide show
  1. package/index.d.ts +1 -2
  2. package/index.js +43 -42
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -9,5 +9,4 @@ declare module 'flicker-alerts' {
9
9
  export default class FlickerAlerts {
10
10
  static showAlert(options: AlertOptions): void;
11
11
  }
12
- }
13
-
12
+ }
package/index.js CHANGED
@@ -1,56 +1,55 @@
1
1
  const FlickerAlerts = {
2
2
  showAlert: function ({ type, title, message, timer = 3000 }) {
3
- // Verifique se está no ambiente do navegador (client-side)
4
- if (typeof document === 'undefined') {
5
- return; // Evita erros no servidor ou no ambiente sem DOM
6
- }
3
+ // Verifique se está no ambiente do navegador (client-side)
4
+ if (typeof document === 'undefined') {
5
+ return; // Evita erros no servidor ou no ambiente sem DOM
6
+ }
7
7
 
8
- // Criação do alerta
9
- const alertBox = document.createElement('div');
10
- alertBox.className = `alert-custom alert-${type}`;
8
+ // Criação do alerta
9
+ const alertBox = document.createElement('div');
10
+ alertBox.className = `alert-custom alert-${type}`;
11
11
 
12
- // Ícone
13
- const icon = document.createElement('div');
14
- icon.className = 'icon';
15
- const iconClass = {
16
- success: 'fa-check',
17
- info: 'fa-info',
18
- warning: 'fa-exclamation',
19
- danger: 'fa-times'
20
- }[type];
21
- icon.innerHTML = `<i class="fas ${iconClass}"></i>`;
22
- alertBox.appendChild(icon);
12
+ // Ícone
13
+ const icon = document.createElement('div');
14
+ icon.className = 'icon';
15
+ const iconClass = {
16
+ success: 'fa-check',
17
+ info: 'fa-info',
18
+ warning: 'fa-exclamation',
19
+ danger: 'fa-times'
20
+ }[type];
21
+ icon.innerHTML = `<i class="fas ${iconClass}"></i>`;
22
+ alertBox.appendChild(icon);
23
23
 
24
- // Conteúdo
25
- const content = document.createElement('div');
26
- content.innerHTML = `<strong>${title}</strong><div>${message}</div>`;
27
- alertBox.appendChild(content);
24
+ // Conteúdo
25
+ const content = document.createElement('div');
26
+ content.innerHTML = `<strong>${title}</strong><div>${message}</div>`;
27
+ alertBox.appendChild(content);
28
28
 
29
- // Botão de fechamento
30
- const closeButton = document.createElement('div');
31
- closeButton.className = 'close';
32
- closeButton.innerHTML = '<i class="fas fa-times"></i>';
33
- closeButton.onclick = () => alertBox.remove();
34
- alertBox.appendChild(closeButton);
29
+ // Botão de fechamento
30
+ const closeButton = document.createElement('div');
31
+ closeButton.className = 'close';
32
+ closeButton.innerHTML = '<i class="fas fa-times"></i>';
33
+ closeButton.onclick = () => alertBox.remove();
34
+ alertBox.appendChild(closeButton);
35
35
 
36
- // Barra de progresso
37
- const progressBar = document.createElement('div');
38
- progressBar.className = `progress-bar progress-bar-${type}`;
39
- alertBox.appendChild(progressBar);
36
+ // Barra de progresso
37
+ const progressBar = document.createElement('div');
38
+ progressBar.className = `progress-bar progress-bar-${type}`;
39
+ alertBox.appendChild(progressBar);
40
40
 
41
- // Adicionar ao container
42
- const container = document.getElementById('alerts-container');
43
- if (container) {
44
- container.appendChild(alertBox);
45
- }
41
+ // Adicionar ao container
42
+ const container = document.getElementById('alerts-container');
43
+ if (container) {
44
+ container.appendChild(alertBox);
45
+ }
46
46
 
47
- // Remoção automática
48
- setTimeout(() => alertBox.remove(), timer);
47
+ // Remoção automática
48
+ setTimeout(() => alertBox.remove(), timer);
49
49
  }
50
- };
50
+ };
51
51
 
52
- // Exportação
53
- export default FlickerAlerts;
52
+
54
53
 
55
54
  // Botões de teste
56
55
  document.getElementById('success-btn').addEventListener('click', () => {
@@ -68,3 +67,5 @@ document.getElementById('warning-btn').addEventListener('click', () => {
68
67
  document.getElementById('error-btn').addEventListener('click', () => {
69
68
  FlickerAlerts.showAlert({ type: 'danger', title: 'Erro', message: 'Ocorreu um erro inesperado!' });
70
69
  });
70
+ // Exportação
71
+ export default FlickerAlerts;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flicker-alerts",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Biblioteca para alertas animados",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",