flicker-alerts 1.0.42 → 1.0.44

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