vatts 1.0.0 → 1.0.1-alpha.1
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.
|
@@ -168,5 +168,5 @@ function ErrorPage() {
|
|
|
168
168
|
alignItems: 'center',
|
|
169
169
|
fontSize: 11,
|
|
170
170
|
color: 'rgba(255,255,255,0.2)'
|
|
171
|
-
}, children: [(0, jsx_runtime_1.jsx)("span", { children: "Vatts Server" }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center', gap: 6 }, children: [(0, jsx_runtime_1.jsxs)("svg", { width: "10", height: "10", viewBox: "0 0 24 24", fill: "none", stroke: "#f87171", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" }), (0, jsx_runtime_1.jsx)("line", { x1: "12", y1: "9", x2: "12", y2: "13" }), (0, jsx_runtime_1.jsx)("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })] }), (0, jsx_runtime_1.jsx)("span", { style: { color: '#f87171' }, children: "Not Found" })] })] })] }), (0, jsx_runtime_1.jsxs)("a", { href: "https://npmjs.com/package/vatts", target: "_blank", rel: "noopener noreferrer", style: brandStyle, onMouseEnter: (e) => e.currentTarget.style.opacity = '1', onMouseLeave: (e) => e.currentTarget.style.opacity = '0.4', children: [(0, jsx_runtime_1.jsx)("img", { src: "https://
|
|
171
|
+
}, children: [(0, jsx_runtime_1.jsx)("span", { children: "Vatts Server" }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center', gap: 6 }, children: [(0, jsx_runtime_1.jsxs)("svg", { width: "10", height: "10", viewBox: "0 0 24 24", fill: "none", stroke: "#f87171", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)("path", { d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" }), (0, jsx_runtime_1.jsx)("line", { x1: "12", y1: "9", x2: "12", y2: "13" }), (0, jsx_runtime_1.jsx)("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })] }), (0, jsx_runtime_1.jsx)("span", { style: { color: '#f87171' }, children: "Not Found" })] })] })] }), (0, jsx_runtime_1.jsxs)("a", { href: "https://npmjs.com/package/vatts", target: "_blank", rel: "noopener noreferrer", style: brandStyle, onMouseEnter: (e) => e.currentTarget.style.opacity = '1', onMouseLeave: (e) => e.currentTarget.style.opacity = '0.4', children: [(0, jsx_runtime_1.jsx)("img", { src: "https://camo.githubusercontent.com/fb660fcaf57546d725dfeef3f081277f4bcefd83e8959f964985de44a7931064/68747470733a2f2f76617474732e6d6672617a2e6f76682f6c6f676f2d762e706e67", alt: "Vatts Logo", style: { width: 20, height: 20 } }), (0, jsx_runtime_1.jsxs)("span", { style: { fontSize: 13, fontWeight: 600, color: primaryColor }, children: ["Vatts", (0, jsx_runtime_1.jsx)("span", { style: { color: "white" }, children: ".js" })] })] })] })] }));
|
|
172
172
|
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = DevIndicator;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
function DevIndicator({ hasBuildError = false, onClickBuildError, }) {
|
|
7
|
+
const [isVisible, setIsVisible] = (0, react_1.useState)(true);
|
|
8
|
+
const [hotState, setHotState] = (0, react_1.useState)('idle');
|
|
9
|
+
(0, react_1.useEffect)(() => {
|
|
10
|
+
const handler = (ev) => {
|
|
11
|
+
const detail = ev?.detail;
|
|
12
|
+
if (!detail || !detail.state)
|
|
13
|
+
return;
|
|
14
|
+
if (detail.state === 'reloading') {
|
|
15
|
+
setHotState('reloading');
|
|
16
|
+
}
|
|
17
|
+
if (detail.state === 'idle') {
|
|
18
|
+
setHotState('idle');
|
|
19
|
+
}
|
|
20
|
+
// Em casos de full reload, pode ficar como reloading até recarregar a página
|
|
21
|
+
if (detail.state === 'full-reload') {
|
|
22
|
+
setHotState('reloading');
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
window.addEventListener('vatts:hotreload', handler);
|
|
26
|
+
return () => window.removeEventListener('vatts:hotreload', handler);
|
|
27
|
+
}, []);
|
|
28
|
+
if (!isVisible)
|
|
29
|
+
return null;
|
|
30
|
+
const isReloading = hotState === 'reloading';
|
|
31
|
+
const isError = !!hasBuildError;
|
|
32
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("style", { children: `
|
|
33
|
+
@keyframes vatts-pulse {
|
|
34
|
+
0% { opacity: 0.4; }
|
|
35
|
+
50% { opacity: 1; }
|
|
36
|
+
100% { opacity: 0.4; }
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@keyframes vatts-spin {
|
|
40
|
+
0% { transform: rotate(0deg); }
|
|
41
|
+
100% { transform: rotate(360deg); }
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.vatts-dev-badge {
|
|
45
|
+
position: fixed;
|
|
46
|
+
bottom: 20px;
|
|
47
|
+
right: 20px;
|
|
48
|
+
z-index: 999999;
|
|
49
|
+
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
gap: 12px;
|
|
53
|
+
padding: 8px 14px;
|
|
54
|
+
background: rgba(15, 15, 20, 0.8);
|
|
55
|
+
backdrop-filter: blur(12px);
|
|
56
|
+
-webkit-backdrop-filter: blur(12px);
|
|
57
|
+
|
|
58
|
+
border-radius: 10px;
|
|
59
|
+
color: #fff;
|
|
60
|
+
font-family: 'Inter', ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
61
|
+
font-size: 12px;
|
|
62
|
+
font-weight: 600;
|
|
63
|
+
letter-spacing: 0.05em;
|
|
64
|
+
|
|
65
|
+
border: 1px solid rgba(255, 107, 53, 0.1);
|
|
66
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
|
|
67
|
+
transition: all 0.2s ease;
|
|
68
|
+
cursor: default;
|
|
69
|
+
user-select: none;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.vatts-dev-badge.clickable {
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.vatts-dev-badge:hover {
|
|
77
|
+
/* COR ALTERADA: Hover com brilho laranja */
|
|
78
|
+
border-color: rgba(255, 107, 53, 0.5);
|
|
79
|
+
transform: translateY(-2px);
|
|
80
|
+
box-shadow: 0 10px 40px rgba(255, 107, 53, 0.15);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* Mantemos as cores semânticas (Verde = OK, Vermelho = Erro) pois são padrões de status */
|
|
84
|
+
.vatts-status-dot {
|
|
85
|
+
width: 8px;
|
|
86
|
+
height: 8px;
|
|
87
|
+
background: #10b981; /* Verde esmeralda */
|
|
88
|
+
border-radius: 50%;
|
|
89
|
+
box-shadow: 0 0 10px #10b981;
|
|
90
|
+
animation: vatts-pulse 2s infinite ease-in-out;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.vatts-status-dot.reloading {
|
|
94
|
+
background: #f59e0b; /* Amber */
|
|
95
|
+
box-shadow: 0 0 10px #f59e0b;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.vatts-status-dot.error {
|
|
99
|
+
background: #ef4444; /* Red */
|
|
100
|
+
box-shadow: 0 0 12px #ef4444;
|
|
101
|
+
animation: vatts-pulse 1.2s infinite ease-in-out;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.vatts-spinner {
|
|
105
|
+
width: 10px;
|
|
106
|
+
height: 10px;
|
|
107
|
+
border-radius: 50%;
|
|
108
|
+
border: 2px solid rgba(255,255,255,0.25);
|
|
109
|
+
border-top-color: rgba(255,255,255,0.85);
|
|
110
|
+
animation: vatts-spin 0.8s linear infinite;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.vatts-logo {
|
|
114
|
+
/* COR ALTERADA: Gradiente da Logo para Vermelho/Laranja */
|
|
115
|
+
background: linear-gradient(135deg, #ff6b35, #e85d04);
|
|
116
|
+
-webkit-background-clip: text;
|
|
117
|
+
-webkit-text-fill-color: transparent;
|
|
118
|
+
font-weight: 800;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.vatts-error-pill {
|
|
122
|
+
margin-left: 6px;
|
|
123
|
+
padding: 2px 6px;
|
|
124
|
+
border-radius: 999px;
|
|
125
|
+
background: rgba(239, 68, 68, 0.18);
|
|
126
|
+
border: 1px solid rgba(239, 68, 68, 0.35);
|
|
127
|
+
color: rgba(255,255,255,0.9);
|
|
128
|
+
font-size: 10px;
|
|
129
|
+
font-weight: 800;
|
|
130
|
+
letter-spacing: 0.08em;
|
|
131
|
+
text-transform: uppercase;
|
|
132
|
+
}
|
|
133
|
+
` }), (0, jsx_runtime_1.jsxs)("div", { className: `vatts-dev-badge${isError ? ' clickable' : ''}`, title: isError ? 'Build com erro — clique para ver detalhes' : undefined, onClick: () => {
|
|
134
|
+
if (isError) {
|
|
135
|
+
onClickBuildError?.();
|
|
136
|
+
}
|
|
137
|
+
}, children: [isReloading ? ((0, jsx_runtime_1.jsx)("div", { className: "vatts-spinner" })) : ((0, jsx_runtime_1.jsx)("div", { className: `vatts-status-dot${isReloading ? ' reloading' : ''}${isError ? ' error' : ''}` })), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { className: "vatts-logo", children: "VATTS.JS" }), isError ? (0, jsx_runtime_1.jsx)("span", { className: "vatts-error-pill", children: "ERROR" }) : null] }), (0, jsx_runtime_1.jsx)("button", { onClick: (e) => {
|
|
138
|
+
e.stopPropagation();
|
|
139
|
+
setIsVisible(false);
|
|
140
|
+
}, style: {
|
|
141
|
+
background: 'none',
|
|
142
|
+
border: 'none',
|
|
143
|
+
color: 'rgba(255,255,255,0.3)',
|
|
144
|
+
cursor: 'pointer',
|
|
145
|
+
fontSize: '14px',
|
|
146
|
+
padding: '0 0 0 4px',
|
|
147
|
+
marginLeft: '4px'
|
|
148
|
+
}, title: "Fechar", children: "\u00D7" })] })] }));
|
|
149
|
+
}
|
|
@@ -32,8 +32,10 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
35
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.DevIndicator = DevIndicator;
|
|
37
39
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
40
|
/*
|
|
39
41
|
* This file is part of the Vatts.js Project.
|
|
@@ -55,6 +57,7 @@ const react_1 = __importStar(require("react"));
|
|
|
55
57
|
const client_1 = require("react-dom/client");
|
|
56
58
|
const clientRouter_1 = require("./clientRouter");
|
|
57
59
|
const ErrorModal_1 = require("./ErrorModal");
|
|
60
|
+
const DevIndicator_1 = __importDefault(require("./DevIndicator"));
|
|
58
61
|
function App({ componentMap, routes, initialComponentPath, initialParams, layoutComponent }) {
|
|
59
62
|
// Estado que guarda o componente a ser renderizado atualmente
|
|
60
63
|
const [hmrTimestamp, setHmrTimestamp] = (0, react_1.useState)(Date.now());
|
|
@@ -110,7 +113,8 @@ function App({ componentMap, routes, initialComponentPath, initialParams, layout
|
|
|
110
113
|
if (match) {
|
|
111
114
|
return {
|
|
112
115
|
componentPath: route.componentPath,
|
|
113
|
-
params: match.groups || {}
|
|
116
|
+
params: match.groups || {},
|
|
117
|
+
metadata: route.metadata
|
|
114
118
|
};
|
|
115
119
|
}
|
|
116
120
|
}
|
|
@@ -195,6 +199,12 @@ function App({ componentMap, routes, initialComponentPath, initialParams, layout
|
|
|
195
199
|
if (match) {
|
|
196
200
|
setCurrentPageComponent(() => componentMap[match.componentPath]);
|
|
197
201
|
setParams(match.params);
|
|
202
|
+
// setar titulo
|
|
203
|
+
if (match.metadata) {
|
|
204
|
+
if (match.metadata?.title != null) {
|
|
205
|
+
window.document.title = match.metadata?.title;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
198
208
|
}
|
|
199
209
|
else {
|
|
200
210
|
// Se não encontrou rota, define como null para mostrar 404
|
|
@@ -240,155 +250,7 @@ function App({ componentMap, routes, initialComponentPath, initialParams, layout
|
|
|
240
250
|
? react_1.default.createElement(layoutComponent, { children: PageContent })
|
|
241
251
|
: (0, jsx_runtime_1.jsx)("div", { children: PageContent });
|
|
242
252
|
}
|
|
243
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [resolvedContent, process.env.NODE_ENV !== 'production' && ((0, jsx_runtime_1.jsx)(
|
|
244
|
-
}
|
|
245
|
-
function DevIndicator({ hasBuildError = false, onClickBuildError, }) {
|
|
246
|
-
const [isVisible, setIsVisible] = (0, react_1.useState)(true);
|
|
247
|
-
const [hotState, setHotState] = (0, react_1.useState)('idle');
|
|
248
|
-
(0, react_1.useEffect)(() => {
|
|
249
|
-
const handler = (ev) => {
|
|
250
|
-
const detail = ev?.detail;
|
|
251
|
-
if (!detail || !detail.state)
|
|
252
|
-
return;
|
|
253
|
-
if (detail.state === 'reloading') {
|
|
254
|
-
setHotState('reloading');
|
|
255
|
-
}
|
|
256
|
-
if (detail.state === 'idle') {
|
|
257
|
-
setHotState('idle');
|
|
258
|
-
}
|
|
259
|
-
// Em casos de full reload, pode ficar como reloading até recarregar a página
|
|
260
|
-
if (detail.state === 'full-reload') {
|
|
261
|
-
setHotState('reloading');
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
window.addEventListener('vatts:hotreload', handler);
|
|
265
|
-
return () => window.removeEventListener('vatts:hotreload', handler);
|
|
266
|
-
}, []);
|
|
267
|
-
if (!isVisible)
|
|
268
|
-
return null;
|
|
269
|
-
const isReloading = hotState === 'reloading';
|
|
270
|
-
const isError = !!hasBuildError;
|
|
271
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("style", { children: `
|
|
272
|
-
@keyframes vatts-pulse {
|
|
273
|
-
0% { opacity: 0.4; }
|
|
274
|
-
50% { opacity: 1; }
|
|
275
|
-
100% { opacity: 0.4; }
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
@keyframes vatts-spin {
|
|
279
|
-
0% { transform: rotate(0deg); }
|
|
280
|
-
100% { transform: rotate(360deg); }
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
.vatts-dev-badge {
|
|
284
|
-
/* AQUI ESTÁ O QUE SEGURA ELE NA TELA: */
|
|
285
|
-
position: sticky;
|
|
286
|
-
bottom: 20px;
|
|
287
|
-
/* float e margens para forçar a direita no modo sticky */
|
|
288
|
-
float: right;
|
|
289
|
-
margin-right: 20px;
|
|
290
|
-
z-index: 999999;
|
|
291
|
-
|
|
292
|
-
display: flex;
|
|
293
|
-
align-items: center;
|
|
294
|
-
gap: 12px;
|
|
295
|
-
padding: 8px 14px;
|
|
296
|
-
background: rgba(15, 15, 20, 0.8);
|
|
297
|
-
backdrop-filter: blur(12px);
|
|
298
|
-
-webkit-backdrop-filter: blur(12px);
|
|
299
|
-
|
|
300
|
-
border-radius: 10px;
|
|
301
|
-
color: #fff;
|
|
302
|
-
font-family: 'Inter', ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
303
|
-
font-size: 12px;
|
|
304
|
-
font-weight: 600;
|
|
305
|
-
letter-spacing: 0.05em;
|
|
306
|
-
|
|
307
|
-
/* COR ALTERADA: Borda sutil laranja no badge */
|
|
308
|
-
border: 1px solid rgba(255, 107, 53, 0.1);
|
|
309
|
-
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
|
|
310
|
-
transition: all 0.2s ease;
|
|
311
|
-
cursor: default;
|
|
312
|
-
user-select: none;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
.vatts-dev-badge.clickable {
|
|
316
|
-
cursor: pointer;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
.vatts-dev-badge:hover {
|
|
320
|
-
/* COR ALTERADA: Hover com brilho laranja */
|
|
321
|
-
border-color: rgba(255, 107, 53, 0.5);
|
|
322
|
-
transform: translateY(-2px);
|
|
323
|
-
box-shadow: 0 10px 40px rgba(255, 107, 53, 0.15);
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
/* Mantemos as cores semânticas (Verde = OK, Vermelho = Erro) pois são padrões de status */
|
|
327
|
-
.vatts-status-dot {
|
|
328
|
-
width: 8px;
|
|
329
|
-
height: 8px;
|
|
330
|
-
background: #10b981; /* Verde esmeralda */
|
|
331
|
-
border-radius: 50%;
|
|
332
|
-
box-shadow: 0 0 10px #10b981;
|
|
333
|
-
animation: vatts-pulse 2s infinite ease-in-out;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
.vatts-status-dot.reloading {
|
|
337
|
-
background: #f59e0b; /* Amber */
|
|
338
|
-
box-shadow: 0 0 10px #f59e0b;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
.vatts-status-dot.error {
|
|
342
|
-
background: #ef4444; /* Red */
|
|
343
|
-
box-shadow: 0 0 12px #ef4444;
|
|
344
|
-
animation: vatts-pulse 1.2s infinite ease-in-out;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
.vatts-spinner {
|
|
348
|
-
width: 10px;
|
|
349
|
-
height: 10px;
|
|
350
|
-
border-radius: 50%;
|
|
351
|
-
border: 2px solid rgba(255,255,255,0.25);
|
|
352
|
-
border-top-color: rgba(255,255,255,0.85);
|
|
353
|
-
animation: vatts-spin 0.8s linear infinite;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
.vatts-logo {
|
|
357
|
-
/* COR ALTERADA: Gradiente da Logo para Vermelho/Laranja */
|
|
358
|
-
background: linear-gradient(135deg, #ff6b35, #e85d04);
|
|
359
|
-
-webkit-background-clip: text;
|
|
360
|
-
-webkit-text-fill-color: transparent;
|
|
361
|
-
font-weight: 800;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
.vatts-error-pill {
|
|
365
|
-
margin-left: 6px;
|
|
366
|
-
padding: 2px 6px;
|
|
367
|
-
border-radius: 999px;
|
|
368
|
-
background: rgba(239, 68, 68, 0.18);
|
|
369
|
-
border: 1px solid rgba(239, 68, 68, 0.35);
|
|
370
|
-
color: rgba(255,255,255,0.9);
|
|
371
|
-
font-size: 10px;
|
|
372
|
-
font-weight: 800;
|
|
373
|
-
letter-spacing: 0.08em;
|
|
374
|
-
text-transform: uppercase;
|
|
375
|
-
}
|
|
376
|
-
` }), (0, jsx_runtime_1.jsxs)("div", { className: `vatts-dev-badge${isError ? ' clickable' : ''}`, title: isError ? 'Build com erro — clique para ver detalhes' : undefined, onClick: () => {
|
|
377
|
-
if (isError) {
|
|
378
|
-
onClickBuildError?.();
|
|
379
|
-
}
|
|
380
|
-
}, children: [isReloading ? ((0, jsx_runtime_1.jsx)("div", { className: "vatts-spinner" })) : ((0, jsx_runtime_1.jsx)("div", { className: `vatts-status-dot${isReloading ? ' reloading' : ''}${isError ? ' error' : ''}` })), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { className: "vatts-logo", children: "VATTS.JS" }), isError ? (0, jsx_runtime_1.jsx)("span", { className: "vatts-error-pill", children: "ERROR" }) : null] }), (0, jsx_runtime_1.jsx)("button", { onClick: (e) => {
|
|
381
|
-
e.stopPropagation();
|
|
382
|
-
setIsVisible(false);
|
|
383
|
-
}, style: {
|
|
384
|
-
background: 'none',
|
|
385
|
-
border: 'none',
|
|
386
|
-
color: 'rgba(255,255,255,0.3)',
|
|
387
|
-
cursor: 'pointer',
|
|
388
|
-
fontSize: '14px',
|
|
389
|
-
padding: '0 0 0 4px',
|
|
390
|
-
marginLeft: '4px'
|
|
391
|
-
}, title: "Fechar", children: "\u00D7" })] })] }));
|
|
253
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [resolvedContent, process.env.NODE_ENV !== 'production' && ((0, jsx_runtime_1.jsx)(DevIndicator_1.default, { hasBuildError: !!buildError, onClickBuildError: () => setIsErrorOpen(true) })), (0, jsx_runtime_1.jsx)(ErrorModal_1.ErrorModal, { error: buildError, isOpen: isErrorOpen, onClose: () => setIsErrorOpen(false), onCopy: copyBuildError })] }));
|
|
392
254
|
}
|
|
393
255
|
// --- Inicialização do Cliente (CSR - Client-Side Rendering) ---
|
|
394
256
|
function deobfuscateData(obfuscated) {
|
|
@@ -402,7 +264,7 @@ function deobfuscateData(obfuscated) {
|
|
|
402
264
|
return JSON.parse(jsonStr);
|
|
403
265
|
}
|
|
404
266
|
catch (error) {
|
|
405
|
-
console.error('[
|
|
267
|
+
console.error('[Watts] Failed to decode data:', error);
|
|
406
268
|
return null;
|
|
407
269
|
}
|
|
408
270
|
}
|
|
@@ -411,17 +273,17 @@ function initializeClient() {
|
|
|
411
273
|
// Lê os dados do atributo data-h
|
|
412
274
|
const dataElement = document.getElementById('__vatts_data__');
|
|
413
275
|
if (!dataElement) {
|
|
414
|
-
console.error('[
|
|
276
|
+
console.error('[Watts] Initial data script not found (#__vatts_data__).');
|
|
415
277
|
return;
|
|
416
278
|
}
|
|
417
279
|
const obfuscated = dataElement.getAttribute('data-h');
|
|
418
280
|
if (!obfuscated) {
|
|
419
|
-
console.error('[
|
|
281
|
+
console.error('[Watts] Data attribute not found.');
|
|
420
282
|
return;
|
|
421
283
|
}
|
|
422
284
|
const initialData = deobfuscateData(obfuscated);
|
|
423
285
|
if (!initialData) {
|
|
424
|
-
console.error('[
|
|
286
|
+
console.error('[Vatts] Failed to parse initial data.');
|
|
425
287
|
return;
|
|
426
288
|
}
|
|
427
289
|
// Cria o mapa de componentes dinamicamente a partir dos módulos carregados
|
|
@@ -443,7 +305,7 @@ function initializeClient() {
|
|
|
443
305
|
root.render((0, jsx_runtime_1.jsx)(App, { componentMap: componentMap, routes: initialData.routes, initialComponentPath: initialData.initialComponentPath, initialParams: initialData.initialParams, layoutComponent: window.__HWEB_LAYOUT__ }));
|
|
444
306
|
}
|
|
445
307
|
catch (error) {
|
|
446
|
-
console.error('[
|
|
308
|
+
console.error('[Watts] Critical Error rendering application:', error);
|
|
447
309
|
// Exibe erro na tela caso algo crítico falhe
|
|
448
310
|
if (typeof document !== 'undefined') {
|
|
449
311
|
document.body.innerHTML = `
|
package/dist/renderer.js
CHANGED
|
@@ -142,9 +142,20 @@ async function render({ req, route, params, allRoutes }) {
|
|
|
142
142
|
const routeMetadata = await Promise.resolve(generateMetadata(params, req));
|
|
143
143
|
metadata = { ...metadata, ...routeMetadata };
|
|
144
144
|
}
|
|
145
|
+
const results = await Promise.all(allRoutes.map(async (r) => {
|
|
146
|
+
let routeMeta = {};
|
|
147
|
+
if (r.generateMetadata) {
|
|
148
|
+
routeMeta = await r.generateMetadata(params, req);
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
pattern: r.pattern,
|
|
152
|
+
componentPath: r.componentPath,
|
|
153
|
+
metadata: routeMeta,
|
|
154
|
+
};
|
|
155
|
+
}));
|
|
145
156
|
// Prepara os dados para injetar na janela do navegador
|
|
146
157
|
const initialData = {
|
|
147
|
-
routes:
|
|
158
|
+
routes: results,
|
|
148
159
|
initialComponentPath: route.componentPath,
|
|
149
160
|
initialParams: params,
|
|
150
161
|
};
|
|
@@ -456,7 +467,7 @@ function getBuildingHTML() {
|
|
|
456
467
|
<div class="content">
|
|
457
468
|
<div class="logo-wrapper">
|
|
458
469
|
<div class="logo-glow"></div>
|
|
459
|
-
<img src="https://
|
|
470
|
+
<img src="https://camo.githubusercontent.com/fb660fcaf57546d725dfeef3f081277f4bcefd83e8959f964985de44a7931064/68747470733a2f2f76617474732e6d6672617a2e6f76682f6c6f676f2d762e706e67" alt="Vatts Logo">
|
|
460
471
|
</div>
|
|
461
472
|
|
|
462
473
|
<h1>Vatts<span>.js</span></h1>
|
|
@@ -475,10 +486,10 @@ function getBuildingHTML() {
|
|
|
475
486
|
</div>
|
|
476
487
|
|
|
477
488
|
<div class="card-footer">
|
|
478
|
-
<span>
|
|
489
|
+
<span>Building...</span>
|
|
479
490
|
<div class="status-active">
|
|
480
491
|
<div class="dot"></div>
|
|
481
|
-
|
|
492
|
+
v${require("../package.json").version}
|
|
482
493
|
</div>
|
|
483
494
|
</div>
|
|
484
495
|
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vatts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1-alpha.1",
|
|
4
4
|
"description": "Vatts.js is a high-level framework for building web applications with ease and speed. It provides a robust set of tools and features to streamline development and enhance productivity.",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"author": "itsmuzin",
|