flicker-alerts 1.0.17 → 1.0.19
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/package.json +4 -4
- package/{README.md → readme.md} +11 -0
- package/{index.js → src/index.js} +3 -0
- package/index.html +0 -246
- /package/{index.d.ts → src/index.d.ts} +0 -0
- /package/{style.css → src/style.css} +0 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "flicker-alerts",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.19",
|
4
4
|
"description": "Biblioteca para alertas animados",
|
5
5
|
"main": "index.js",
|
6
6
|
"types": "index.d.ts",
|
@@ -13,9 +13,9 @@
|
|
13
13
|
"javascript",
|
14
14
|
"notificações"
|
15
15
|
],
|
16
|
-
"author": "",
|
17
|
-
"license": "MIT",
|
16
|
+
"author": "https://www.linkedin.com/in/bruno-carneiro-9a51aa190/",
|
17
|
+
"license": "MIT",
|
18
18
|
"dependencies": {
|
19
|
-
"flicker-alerts": "^1.0.
|
19
|
+
"flicker-alerts": "^1.0.19"
|
20
20
|
}
|
21
21
|
}
|
package/{README.md → readme.md}
RENAMED
@@ -40,6 +40,9 @@ export class AppComponent {
|
|
40
40
|
type: 'success',
|
41
41
|
title: 'Sucesso',
|
42
42
|
message: 'Operação concluída com sucesso!'
|
43
|
+
position: 'top-righ'
|
44
|
+
// Em 'position', você pode escolher entre: 'top-right', 'top-left', 'bottom-right', 'bottom-left', 'center', 'top-center' ou 'bottom-center';
|
45
|
+
|
43
46
|
});
|
44
47
|
}
|
45
48
|
|
@@ -48,6 +51,8 @@ export class AppComponent {
|
|
48
51
|
type: 'info',
|
49
52
|
title: 'Informação',
|
50
53
|
message: 'Aqui está uma informação importante.'
|
54
|
+
position: 'top-righ'
|
55
|
+
// Em 'position', você pode escolher entre: 'top-right', 'top-left', 'bottom-right', 'bottom-left', 'center', 'top-center' ou 'bottom-center';
|
51
56
|
});
|
52
57
|
}
|
53
58
|
|
@@ -56,6 +61,8 @@ export class AppComponent {
|
|
56
61
|
type: 'warning',
|
57
62
|
title: 'Alerta',
|
58
63
|
message: 'Por favor, preste atenção nisso!'
|
64
|
+
position: 'top-righ'
|
65
|
+
// Em 'position', você pode escolher entre: 'top-right', 'top-left', 'bottom-right', 'bottom-left', 'center', 'top-center' ou 'bottom-center';
|
59
66
|
});
|
60
67
|
}
|
61
68
|
|
@@ -64,6 +71,8 @@ export class AppComponent {
|
|
64
71
|
type: 'danger',
|
65
72
|
title: 'Erro',
|
66
73
|
message: 'Ocorreu um erro inesperado!'
|
74
|
+
position: 'top-righ'
|
75
|
+
// Em 'position', você pode escolher entre: 'top-right', 'top-left', 'bottom-right', 'bottom-left', 'center', 'top-center' ou 'bottom-center';
|
67
76
|
});
|
68
77
|
}
|
69
78
|
}
|
@@ -96,6 +105,8 @@ function App() {
|
|
96
105
|
type: 'success',
|
97
106
|
title: 'Sucesso',
|
98
107
|
message: 'Operação concluída com sucesso!'
|
108
|
+
position: 'top-righ'
|
109
|
+
// Em 'position', você pode escolher entre: 'top-right', 'top-left', 'bottom-right', 'bottom-left', 'center', 'top-center' ou 'bottom-center';
|
99
110
|
});
|
100
111
|
};
|
101
112
|
}
|
@@ -1,3 +1,6 @@
|
|
1
|
+
import './src/style.css'; // Certifique-se de usar o caminho certo aqui
|
2
|
+
|
3
|
+
|
1
4
|
const FlickerAlerts = {
|
2
5
|
showAlert: function ({ type, title, message, timer = 3000, position = 'top-right' }) {
|
3
6
|
// Verifique se está no ambiente do navegador (client-side) antes de tentar manipular o DOM
|
package/index.html
DELETED
@@ -1,246 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="pt-BR">
|
3
|
-
<head>
|
4
|
-
<meta charset="UTF-8" />
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
6
|
-
<title>FlickerAlerts</title>
|
7
|
-
<link
|
8
|
-
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"
|
9
|
-
rel="stylesheet"
|
10
|
-
/>
|
11
|
-
<link
|
12
|
-
rel="stylesheet"
|
13
|
-
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
|
14
|
-
/>
|
15
|
-
<link rel="stylesheet" href="style.css" />
|
16
|
-
<style>
|
17
|
-
/* Estilo para os botões */
|
18
|
-
.btn {
|
19
|
-
font-size: 14px;
|
20
|
-
padding: 8px 16px;
|
21
|
-
border-radius: 8px;
|
22
|
-
width: 100%;
|
23
|
-
/* Botões ocupam 100% do espaço das colunas */
|
24
|
-
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
25
|
-
}
|
26
|
-
|
27
|
-
.btn:hover {
|
28
|
-
transform: scale(1.05);
|
29
|
-
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
|
30
|
-
}
|
31
|
-
|
32
|
-
/* Botões específicos */
|
33
|
-
.btn-success {
|
34
|
-
background-color: #28a745;
|
35
|
-
color: white;
|
36
|
-
}
|
37
|
-
|
38
|
-
.btn-info {
|
39
|
-
background-color: #17a2b8;
|
40
|
-
color: white;
|
41
|
-
}
|
42
|
-
|
43
|
-
.btn-warning {
|
44
|
-
background-color: #ffc107;
|
45
|
-
color: black;
|
46
|
-
}
|
47
|
-
|
48
|
-
.btn-danger {
|
49
|
-
background-color: #dc3545;
|
50
|
-
color: white;
|
51
|
-
}
|
52
|
-
|
53
|
-
.container {
|
54
|
-
display: flex;
|
55
|
-
flex-direction: column;
|
56
|
-
align-items: center;
|
57
|
-
gap: 20px;
|
58
|
-
margin-top: 30px;
|
59
|
-
}
|
60
|
-
|
61
|
-
/* Área da documentação */
|
62
|
-
.doc-section {
|
63
|
-
margin-top: 30px;
|
64
|
-
width: 100%;
|
65
|
-
max-width: 800px;
|
66
|
-
}
|
67
|
-
|
68
|
-
.doc-section h3 {
|
69
|
-
margin-bottom: 10px;
|
70
|
-
font-size: 22px;
|
71
|
-
text-align: center;
|
72
|
-
}
|
73
|
-
|
74
|
-
.doc-section p {
|
75
|
-
font-size: 16px;
|
76
|
-
line-height: 1.5;
|
77
|
-
}
|
78
|
-
|
79
|
-
.doc-section pre {
|
80
|
-
background-color: #1e1e1e;
|
81
|
-
/* Fundo escuro estilo VSCode */
|
82
|
-
color: #dcdcdc;
|
83
|
-
/* Texto claro */
|
84
|
-
padding: 10px;
|
85
|
-
border-radius: 4px;
|
86
|
-
font-size: 14px;
|
87
|
-
overflow-x: auto;
|
88
|
-
border: 1px solid #333;
|
89
|
-
/* Bordas discretas */
|
90
|
-
font-family: "Courier New", Courier, monospace;
|
91
|
-
/* Fonte monoespaçada */
|
92
|
-
}
|
93
|
-
|
94
|
-
.doc-section ul {
|
95
|
-
padding-left: 20px;
|
96
|
-
}
|
97
|
-
|
98
|
-
.doc-section li {
|
99
|
-
margin-bottom: 10px;
|
100
|
-
}
|
101
|
-
|
102
|
-
/* Ajustes para os botões */
|
103
|
-
.row {
|
104
|
-
display: flex;
|
105
|
-
justify-content: center;
|
106
|
-
gap: 10px;
|
107
|
-
}
|
108
|
-
|
109
|
-
.col {
|
110
|
-
flex: 1 1 100%;
|
111
|
-
max-width: 200px;
|
112
|
-
/* Limita o tamanho dos botões */
|
113
|
-
}
|
114
|
-
</style>
|
115
|
-
</head>
|
116
|
-
|
117
|
-
<body>
|
118
|
-
<div class="container">
|
119
|
-
<h1>FlickerAlerts</h1>
|
120
|
-
|
121
|
-
<!-- Linha com botões -->
|
122
|
-
<div class="row">
|
123
|
-
<div class="col">
|
124
|
-
<button class="btn btn-success" id="success-btn">
|
125
|
-
Mostrar Sucesso
|
126
|
-
</button>
|
127
|
-
</div>
|
128
|
-
<div class="col">
|
129
|
-
<button class="btn btn-info" id="info-btn">Mostrar Info</button>
|
130
|
-
</div>
|
131
|
-
<div class="col">
|
132
|
-
<button class="btn btn-warning" id="warning-btn">
|
133
|
-
Mostrar Alerta
|
134
|
-
</button>
|
135
|
-
</div>
|
136
|
-
<div class="col">
|
137
|
-
<button class="btn btn-danger" id="error-btn">Mostrar Erro</button>
|
138
|
-
</div>
|
139
|
-
</div>
|
140
|
-
|
141
|
-
<!-- Área para exibir alertas no canto superior direito -->
|
142
|
-
<div id="alerts-container" class="top-right"></div>
|
143
|
-
|
144
|
-
<!-- Documentação -->
|
145
|
-
<div class="doc-section">
|
146
|
-
<h3>Documentação de Uso</h3>
|
147
|
-
<p>
|
148
|
-
<strong>FlickerAlerts</strong> é uma biblioteca simples para criar
|
149
|
-
alertas animados de sucesso, erro, aviso e informações. Eles podem ser
|
150
|
-
exibidos automaticamente ou ser fechados manualmente pelo usuário.
|
151
|
-
</p>
|
152
|
-
|
153
|
-
<h4>Instalação</h4>
|
154
|
-
<p>Instale via <code>npm</code>:</p>
|
155
|
-
<pre><code>npm install flicker-alerts</code></pre>
|
156
|
-
|
157
|
-
<h4>Uso</h4>
|
158
|
-
<p>
|
159
|
-
Após a instalação, a biblioteca será importada no seu código, e você
|
160
|
-
não precisará mais incluir o arquivo <code>script</code> diretamente
|
161
|
-
no HTML. Em vez disso, você utilizará a função
|
162
|
-
<code>showAlert</code> em seus componentes.
|
163
|
-
</p>
|
164
|
-
|
165
|
-
<h4>Uso no Angular</h4>
|
166
|
-
<p>
|
167
|
-
Com o <code>FlickerAlerts</code> instalado, importe-o no seu
|
168
|
-
componente Angular e utilize-o conforme mostrado abaixo:
|
169
|
-
</p>
|
170
|
-
<pre><code>import FlickerAlerts from 'flicker-alerts';
|
171
|
-
|
172
|
-
export class AppComponent {
|
173
|
-
showSuccessAlert() {
|
174
|
-
FlickerAlerts.showAlert({
|
175
|
-
type: 'success',
|
176
|
-
title: 'Sucesso',
|
177
|
-
message: 'Operação concluída com sucesso!'
|
178
|
-
});
|
179
|
-
}
|
180
|
-
|
181
|
-
showInfoAlert() {
|
182
|
-
FlickerAlerts.showAlert({
|
183
|
-
type: 'info',
|
184
|
-
title: 'Informação',
|
185
|
-
message: 'Aqui está uma informação importante.'
|
186
|
-
});
|
187
|
-
}
|
188
|
-
|
189
|
-
showWarningAlert() {
|
190
|
-
FlickerAlerts.showAlert({
|
191
|
-
type: 'warning',
|
192
|
-
title: 'Alerta',
|
193
|
-
message: 'Por favor, preste atenção nisso!'
|
194
|
-
});
|
195
|
-
}
|
196
|
-
|
197
|
-
showErrorAlert() {
|
198
|
-
FlickerAlerts.showAlert({
|
199
|
-
type: 'danger',
|
200
|
-
title: 'Erro',
|
201
|
-
message: 'Ocorreu um erro inesperado!'
|
202
|
-
});
|
203
|
-
}
|
204
|
-
|
205
|
-
}
|
206
|
-
</code>
|
207
|
-
|
208
|
-
</pre>
|
209
|
-
<p>
|
210
|
-
Caso o estilo da biblioteca não esteja sendo aplicado corretamente, adicione o caminho do CSS no
|
211
|
-
arquivo <code>angular.json</code>:
|
212
|
-
"styles": [
|
213
|
-
"node_modules/flicker-alerts/style.css"
|
214
|
-
]
|
215
|
-
|
216
|
-
</p>
|
217
|
-
<h4>Uso no React</h4>
|
218
|
-
<p>
|
219
|
-
Com o <code>FlickerAlerts</code> instalado, você pode usá-lo no seu
|
220
|
-
componente React assim:
|
221
|
-
</p>
|
222
|
-
<pre><code>import FlickerAlerts from 'flicker-alerts';
|
223
|
-
|
224
|
-
function App() {
|
225
|
-
const showSuccessAlert = () => {
|
226
|
-
FlickerAlerts.showAlert({
|
227
|
-
type: 'success',
|
228
|
-
title: 'Sucesso',
|
229
|
-
message: 'Operação concluída com sucesso!'
|
230
|
-
});
|
231
|
-
};
|
232
|
-
|
233
|
-
|
234
|
-
}</code></pre>
|
235
|
-
|
236
|
-
<p>
|
237
|
-
No React, basta importar o CSS diretamente no arquivo principal, como
|
238
|
-
<code>index.js</code> ou <code>App.js</code>:
|
239
|
-
import 'flicker-alerts/style.css';
|
240
|
-
</p>
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
<script src="index.js" type="module"></script>
|
245
|
-
</body>
|
246
|
-
</html>
|
File without changes
|
File without changes
|