flicker-alerts 1.0.32 → 1.0.34

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 +13 -16
  2. package/index.js +3 -13
  3. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -1,28 +1,25 @@
1
1
  declare module 'flicker-alerts' {
2
- // Definição das opções para os alertas
3
- interface AlertOptions {
2
+ export interface AlertOptions {
4
3
  type: 'success' | 'info' | 'warning' | 'danger';
5
4
  title: string;
6
5
  message: string;
7
- duration?: number; // Duração opcional do alerta
8
- position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'center' | 'top-center' | 'bottom-center'; // Posições possíveis do alerta
6
+ timer?: number;
7
+ position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'center' | 'top-center' | 'bottom-center';
9
8
  }
10
9
 
11
- // Definição das opções para os modais
12
- interface ModalOptions {
13
- type: 'warning' | 'danger' | 'info' | 'success'; // Tipos de modais disponíveis
10
+ export interface ModalOptions {
11
+ type: 'warning' | 'delete';
14
12
  title: string;
15
13
  message: string;
16
- onConfirm?: () => void; // Função executada no botão de confirmação
17
- onCancel?: () => void; // Função executada no botão de cancelamento
14
+ onConfirm?: () => void;
15
+ onCancel?: () => void;
16
+ timer?: number;
18
17
  }
19
18
 
20
- // Classe principal para a biblioteca FlickerAlerts
21
- export default class FlickerAlerts {
22
- // Método estático para mostrar um alerta
23
- static showAlert(options: AlertOptions): void;
19
+ const FlickerAlerts: {
20
+ showAlert(options: AlertOptions): void;
21
+ showModal(options: ModalOptions): void;
22
+ };
24
23
 
25
- // Método estático para mostrar um modal
26
- static showModal(options: ModalOptions): void;
27
- }
24
+ export default FlickerAlerts;
28
25
  }
package/index.js CHANGED
@@ -1,6 +1,3 @@
1
-
2
-
3
-
4
1
  const FlickerAlerts = {
5
2
  showAlert: function ({ type, title, message, timer = 3000, position = 'top-right' }) {
6
3
  if (typeof window !== 'undefined' && typeof document !== 'undefined') {
@@ -38,7 +35,7 @@ const FlickerAlerts = {
38
35
  divider.className = 'divider';
39
36
  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,9 +72,6 @@ const FlickerAlerts = {
75
72
  },
76
73
  };
77
74
 
78
-
79
-
80
-
81
75
  // Botões de teste - Eles podem ser removidos se não forem necessários
82
76
  if (typeof document !== 'undefined') {
83
77
  document.getElementById('success-btn')?.addEventListener('click', () => {
@@ -97,12 +91,8 @@ if (typeof document !== 'undefined') {
97
91
  });
98
92
  }
99
93
 
100
- // Exportação
101
- export default FlickerAlerts;
102
-
103
-
104
94
  const FlickerModals = {
105
- showModal: function ({ type, title, message, onConfirm, onCancel }) {
95
+ showModal: function ({ type, title, message, timer = 3000, onConfirm, onCancel }) {
106
96
  if (typeof window !== 'undefined' && typeof document !== 'undefined') {
107
97
  let container = document.getElementById('modals-container');
108
98
  if (!container) {
@@ -230,4 +220,4 @@ if (typeof document !== 'undefined') {
230
220
  });
231
221
  }
232
222
 
233
-
223
+ export default FlickerAlerts;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flicker-alerts",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
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.32"
19
+ "flicker-alerts": "^1.0.34"
20
20
  }
21
21
  }