flicker-alerts 1.0.44 → 1.0.45

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 +7 -26
  2. package/index.js +18 -9
  3. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- // Declaração do módulo 'flicker-alerts'
2
1
  declare module 'flicker-alerts' {
3
2
  // Definição das opções para os alertas
4
3
  interface AlertOptions {
@@ -18,30 +17,12 @@ declare module 'flicker-alerts' {
18
17
  onCancel?: () => void; // Função executada no botão de cancelamento
19
18
  }
20
19
 
21
- // Classe principal para a biblioteca FlickerAlerts
22
- export default class FlickerAlerts {
23
- // Método estático para mostrar um alerta
24
- static showAlert(options: AlertOptions): void;
20
+ // Exportação do objeto com os métodos
21
+ export const FlickerAlerts: {
22
+ showAlert(options: AlertOptions): void;
23
+ };
25
24
 
26
- // Método estático para mostrar um modal
27
- static showModal(options: ModalOptions): void;
28
- }
29
- }
30
-
31
- // Declaração do módulo 'flicker-modal'
32
- declare module 'flicker-modal' {
33
- // Definição das opções para os modais
34
- interface ModalOptions {
35
- type: 'warning' | 'delete' ; // Tipos de modais disponíveis
36
- title: string;
37
- message: string;
38
- onConfirm?: () => void; // Função executada no botão de confirmação
39
- onCancel?: () => void; // Função executada no botão de cancelamento
40
- }
41
-
42
- // Classe principal para a biblioteca FlickerModal
43
- export default class FlickerModal {
44
- // Método estático para mostrar um modal
45
- static showModal(options: ModalOptions): void;
46
- }
25
+ export const FlickerModals: {
26
+ showModal(options: ModalOptions): void;
27
+ };
47
28
  }
package/index.js CHANGED
@@ -1,4 +1,6 @@
1
- // Definição do FlickerAlerts
1
+
2
+
3
+
2
4
  const FlickerAlerts = {
3
5
  showAlert: function ({ type, title, message, timer = 3000, position = 'top-right' }) {
4
6
  if (typeof window !== 'undefined' && typeof document !== 'undefined') {
@@ -34,8 +36,9 @@ const FlickerAlerts = {
34
36
  // Divisor
35
37
  const divider = document.createElement('div');
36
38
  divider.className = 'divider';
39
+ console.log(`Created divider for ${type}`); // Para depuração
37
40
  alertBox.appendChild(divider);
38
-
41
+
39
42
  // Conteúdo
40
43
  const content = document.createElement('div');
41
44
  content.innerHTML = `<div class="title">${title}</div><div class="message">${message}</div>`;
@@ -72,7 +75,10 @@ const FlickerAlerts = {
72
75
  },
73
76
  };
74
77
 
75
- // Botões de teste
78
+
79
+
80
+
81
+ // Botões de teste - Eles podem ser removidos se não forem necessários
76
82
  if (typeof document !== 'undefined') {
77
83
  document.getElementById('success-btn')?.addEventListener('click', () => {
78
84
  FlickerAlerts.showAlert({ type: 'success', title: 'Sucesso!', message: 'Essa mensagem é personalizável.' });
@@ -91,9 +97,12 @@ if (typeof document !== 'undefined') {
91
97
  });
92
98
  }
93
99
 
94
- // Definição do FlickerModals
100
+ // Exportação
101
+
102
+
103
+
95
104
  const FlickerModals = {
96
- showModal: function ({ type, title, message, onConfirm, onCancel }) {
105
+ showModal: function ({ type, title, message, onConfirm, onCancel }) {
97
106
  if (typeof window !== 'undefined' && typeof document !== 'undefined') {
98
107
  let container = document.getElementById('modals-container');
99
108
  if (!container) {
@@ -186,7 +195,7 @@ const FlickerModals = {
186
195
  // Remove o modal após o tempo especificado
187
196
  const timeoutId = setTimeout(() => {
188
197
  removeModal();
189
- }, 5000);
198
+ }, timer);
190
199
 
191
200
  // Função para remover o modal
192
201
  function removeModal() {
@@ -198,7 +207,7 @@ const FlickerModals = {
198
207
  }
199
208
  };
200
209
 
201
- // Botões de teste para modais
210
+ // Botões de teste - Eles podem ser removidos se não forem necessários
202
211
  if (typeof document !== 'undefined') {
203
212
  document.getElementById('modal-warning-btn')?.addEventListener('click', () => {
204
213
  FlickerModals.showModal({
@@ -221,5 +230,5 @@ if (typeof document !== 'undefined') {
221
230
  });
222
231
  }
223
232
 
224
- // Exportação nomeada para ambos os objetos
225
- export { FlickerAlerts, FlickerModals };
233
+
234
+ export { FlickerAlerts, FlickerModals };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flicker-alerts",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
4
4
  "description": "Biblioteca para alertas animados",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -16,6 +16,6 @@
16
16
  "author": "https://www.linkedin.com/in/bruno-carneiro-9a51aa190/",
17
17
  "license": "MIT",
18
18
  "dependencies": {
19
- "flicker-alerts": "^1.0.44"
19
+ "flicker-alerts": "^1.0.45"
20
20
  }
21
21
  }