vatts 2.2.6 → 2.3.0-canary.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.
Files changed (70) hide show
  1. package/LICENSE +12 -12
  2. package/README.md +65 -65
  3. package/dist/builder.js +79 -42
  4. package/dist/frameworks/FrontCore.d.ts +34 -0
  5. package/dist/frameworks/FrontCore.js +128 -0
  6. package/dist/{vue → frameworks/builds}/vue.build.js +1 -1
  7. package/dist/frameworks/react/client.d.ts +8 -0
  8. package/dist/{react → frameworks/react}/client.js +14 -14
  9. package/dist/{react → frameworks/react/components}/Link.js +2 -2
  10. package/dist/frameworks/react/entry.client.d.ts +14 -0
  11. package/dist/frameworks/react/entry.client.js +211 -0
  12. package/dist/frameworks/react/react-elements.d.ts +10 -0
  13. package/dist/{react → frameworks/renderers}/renderer-react.d.ts +2 -2
  14. package/dist/{react → frameworks/renderers}/renderer-react.js +53 -86
  15. package/dist/{vue → frameworks/renderers}/renderer.vue.d.ts +2 -2
  16. package/dist/frameworks/renderers/renderer.vue.js +193 -0
  17. package/dist/frameworks/themes/BuildingPage.d.ts +1 -0
  18. package/dist/frameworks/themes/BuildingPage.js +312 -0
  19. package/dist/frameworks/themes/DefaultNotFound.d.ts +1 -0
  20. package/dist/frameworks/themes/DefaultNotFound.js +330 -0
  21. package/dist/frameworks/themes/ErrorModal.d.ts +1 -0
  22. package/dist/frameworks/themes/ErrorModal.js +345 -0
  23. package/dist/frameworks/themes/ServerError.d.ts +1 -0
  24. package/dist/frameworks/themes/ServerError.js +401 -0
  25. package/dist/frameworks/themes/VattsDevBadge.d.ts +1 -0
  26. package/dist/frameworks/themes/VattsDevBadge.js +232 -0
  27. package/dist/frameworks/vue/App.vue +149 -0
  28. package/dist/frameworks/vue/client.d.ts +9 -0
  29. package/dist/{vue → frameworks/vue}/client.js +13 -11
  30. package/dist/{vue → frameworks/vue/components}/Link.vue +38 -38
  31. package/dist/{vue → frameworks/vue/components}/image/Image.vue +128 -128
  32. package/dist/frameworks/vue/entry.client.js +75 -0
  33. package/dist/global/global.d.ts +179 -180
  34. package/dist/hotReload.js +77 -77
  35. package/dist/index.js +12 -1
  36. package/dist/loaders.js +15 -15
  37. package/dist/renderer.js +2 -2
  38. package/dist/renderers/common.js +3 -3
  39. package/dist/utils/core-go.js +2 -2
  40. package/dist/utils/utils.js +5 -5
  41. package/package.json +10 -26
  42. package/dist/react/BuildingPage.d.ts +0 -2
  43. package/dist/react/BuildingPage.js +0 -270
  44. package/dist/react/DefaultNotFound.d.ts +0 -2
  45. package/dist/react/DefaultNotFound.js +0 -248
  46. package/dist/react/DevIndicator.d.ts +0 -5
  47. package/dist/react/DevIndicator.js +0 -203
  48. package/dist/react/ErrorModal.d.ts +0 -20
  49. package/dist/react/ErrorModal.js +0 -266
  50. package/dist/react/client.d.ts +0 -8
  51. package/dist/react/entry.client.d.ts +0 -6
  52. package/dist/react/entry.client.js +0 -325
  53. package/dist/react/server-error.d.ts +0 -8
  54. package/dist/react/server-error.js +0 -346
  55. package/dist/vue/App.vue +0 -199
  56. package/dist/vue/BuildingPage.vue +0 -281
  57. package/dist/vue/DefaultNotFound.vue +0 -329
  58. package/dist/vue/DevIndicator.vue +0 -226
  59. package/dist/vue/ErrorModal.vue +0 -317
  60. package/dist/vue/client.d.ts +0 -9
  61. package/dist/vue/entry.client.js +0 -110
  62. package/dist/vue/renderer.vue.js +0 -387
  63. package/dist/vue/server-error.vue +0 -351
  64. /package/dist/{react → frameworks/builds}/react.build.d.ts +0 -0
  65. /package/dist/{react → frameworks/builds}/react.build.js +0 -0
  66. /package/dist/{vue → frameworks/builds}/vue.build.d.ts +0 -0
  67. /package/dist/{react → frameworks/react/components}/Link.d.ts +0 -0
  68. /package/dist/{react → frameworks/react/components}/image/Image.d.ts +0 -0
  69. /package/dist/{react → frameworks/react/components}/image/Image.js +0 -0
  70. /package/dist/{vue → frameworks/vue}/entry.client.d.ts +0 -0
@@ -1,325 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- /*
40
- * This file is part of the Vatts.js Project.
41
- * Copyright (c) 2026 mfraz
42
- *
43
- * Licensed under the Apache License, Version 2.0 (the "License");
44
- * you may not use this file except in compliance with the License.
45
- * You may obtain a copy of the License at
46
- *
47
- * http://www.apache.org/licenses/LICENSE-2.0
48
- *
49
- * Unless required by applicable law or agreed to in writing, software
50
- * distributed under the License is distributed on an "AS IS" BASIS,
51
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
52
- * See the License for the specific language governing permissions and
53
- * limitations under the License.
54
- */
55
- const react_1 = __importStar(require("react"));
56
- const client_1 = require("react-dom/client");
57
- const clientRouter_1 = require("../client/clientRouter");
58
- const ErrorModal_1 = require("./ErrorModal");
59
- const DevIndicator_1 = __importDefault(require("./DevIndicator"));
60
- function App({ componentMap, routes, initialComponentPath, initialParams, layoutComponent }) {
61
- // Estado que guarda o componente a ser renderizado atualmente
62
- const [hmrTimestamp, setHmrTimestamp] = (0, react_1.useState)(Date.now());
63
- const pendingHmrReadyRef = (0, react_1.useRef)(null);
64
- // Estado de erro de build recebido pelo hot-reload (via eventos globais)
65
- const [buildError, setBuildError] = (0, react_1.useState)(() => {
66
- const initialError = window.__VATTS_BUILD_ERROR__ || null;
67
- if (initialError)
68
- console.warn('[Vatts Frontend] ⚠️ Erro de build inicial detectado:', initialError);
69
- return initialError;
70
- });
71
- const [isErrorOpen, setIsErrorOpen] = (0, react_1.useState)(() => !!window.__VATTS_BUILD_ERROR__);
72
- (0, react_1.useEffect)(() => {
73
- const onErr = (ev) => {
74
- const e = ev?.detail;
75
- console.error('[Vatts Frontend] 🛑 Erro de build (vatts:build-error):', e);
76
- setBuildError(e || null);
77
- setIsErrorOpen(true);
78
- window.__VATTS_HAD_BUILD_ERROR__ = true;
79
- };
80
- const onOk = () => {
81
- const hadError = window.__VATTS_HAD_BUILD_ERROR__;
82
- setBuildError(null);
83
- setIsErrorOpen(false);
84
- if (hadError) {
85
- window.__VATTS_HAD_BUILD_ERROR__ = false;
86
- console.log('[Vatts Frontend] 🔄 Erro foi corrigido! Sincronizando dados de rotas com servidor...');
87
- setTimeout(() => {
88
- window.location.reload();
89
- }, 300);
90
- }
91
- };
92
- window.addEventListener('vatts:build-error', onErr);
93
- window.addEventListener('vatts:build-ok', onOk);
94
- return () => {
95
- window.removeEventListener('vatts:build-error', onErr);
96
- window.removeEventListener('vatts:build-ok', onOk);
97
- };
98
- }, []);
99
- (0, react_1.useEffect)(() => {
100
- const pending = pendingHmrReadyRef.current;
101
- if (!pending)
102
- return;
103
- window.dispatchEvent(new CustomEvent('vatts:hmr-ready', { detail: pending }));
104
- pendingHmrReadyRef.current = null;
105
- }, [hmrTimestamp]);
106
- const copyBuildError = (0, react_1.useCallback)(async () => {
107
- try {
108
- if (!buildError)
109
- return;
110
- const payload = JSON.stringify(buildError, null, 2);
111
- await navigator.clipboard.writeText(payload);
112
- }
113
- catch {
114
- console.error('[Vatts Frontend] ❌ Falha ao copiar o erro.');
115
- }
116
- }, [buildError]);
117
- // Helper para encontrar rota baseado no path
118
- const findRouteForPath = (0, react_1.useCallback)((path) => {
119
- for (const route of routes) {
120
- const regexPattern = route.pattern
121
- .replace(/\[\[\.\.\.(\w+)\]\]/g, '(?<$1>.+)?')
122
- .replace(/\[\.\.\.(\w+)\]/g, '(?<$1>.+)')
123
- .replace(/\/\[\[(\w+)\]\]/g, '(?:/(?<$1>[^/]+))?')
124
- .replace(/\[\[(\w+)\]\]/g, '(?<$1>[^/]+)?')
125
- .replace(/\[(\w+)\]/g, '(?<$1>[^/]+)');
126
- const regex = new RegExp(`^${regexPattern}/?$`);
127
- const match = path.match(regex);
128
- if (match) {
129
- return {
130
- componentPath: route.componentPath,
131
- params: match.groups || {},
132
- metadata: route.metadata
133
- };
134
- }
135
- }
136
- return null;
137
- }, [routes]);
138
- // Inicializa o componente e params baseado na URL ATUAL (não no initialComponentPath)
139
- const [CurrentPageComponent, setCurrentPageComponent] = (0, react_1.useState)(() => {
140
- const currentPath = window.location.pathname.replace("index.html", '');
141
- const match = findRouteForPath(currentPath);
142
- if (match) {
143
- return componentMap[match.componentPath];
144
- }
145
- return null;
146
- });
147
- const [params, setParams] = (0, react_1.useState)(() => {
148
- const currentPath = window.location.pathname.replace("index.html", '');
149
- const match = findRouteForPath(currentPath);
150
- return match ? match.params : {};
151
- });
152
- // HMR: Escuta eventos de hot reload
153
- (0, react_1.useEffect)(() => {
154
- window.__HWEB_HMR__ = true;
155
- const handleHMRUpdate = async (event) => {
156
- const { file, timestamp } = event.detail;
157
- const fileName = file ? file.split('/').pop()?.split('\\').pop() : 'unknown';
158
- try {
159
- const fileLower = (file || '').toLowerCase();
160
- const isPageFile = fileLower.includes('page.tsx') || fileLower.includes('page.jsx') ||
161
- fileLower.includes('page.ts') || fileLower.includes('page.js') ||
162
- fileLower.includes('page.vue');
163
- if (isPageFile) {
164
- console.log('[Vatts Frontend] 📄 Page file HMR detected, reloading to sync route data...');
165
- setTimeout(() => {
166
- window.location.reload();
167
- }, 300);
168
- return;
169
- }
170
- console.log(`[Vatts Frontend] ⚡ HMR Update Triggered: ${fileName}`);
171
- setHmrTimestamp(timestamp);
172
- pendingHmrReadyRef.current = { file: file || null, timestamp };
173
- }
174
- catch (error) {
175
- console.error('[Vatts Frontend] ❌ HMR Error:', error);
176
- }
177
- };
178
- window.addEventListener('hmr:component-update', handleHMRUpdate);
179
- return () => {
180
- window.removeEventListener('hmr:component-update', handleHMRUpdate);
181
- };
182
- }, []);
183
- const updateRoute = (0, react_1.useCallback)(() => {
184
- const currentPath = clientRouter_1.router.pathname.replace("index.html", '');
185
- const match = findRouteForPath(currentPath);
186
- if (match) {
187
- setCurrentPageComponent(() => componentMap[match.componentPath]);
188
- setParams(match.params);
189
- if (match.metadata && match.metadata?.title != null) {
190
- try {
191
- // Corrige o encoding quebrado pelo atob (converte Frazão -> Frazão)
192
- window.document.title = decodeURIComponent(escape(match.metadata.title));
193
- }
194
- catch (e) {
195
- // Fallback seguro caso a string já venha normalizada por algum motivo
196
- window.document.title = match.metadata.title;
197
- }
198
- }
199
- }
200
- else {
201
- console.warn(`[Vatts Frontend] ⚠️ Rota não encontrada (404): ${currentPath}`);
202
- setCurrentPageComponent(null);
203
- setParams({});
204
- }
205
- }, [clientRouter_1.router.pathname, findRouteForPath, componentMap]);
206
- // Ouve os eventos de "voltar" e "avançar" do navegador
207
- (0, react_1.useEffect)(() => {
208
- const handlePopState = () => {
209
- updateRoute();
210
- };
211
- window.addEventListener('popstate', handlePopState);
212
- const unsubscribe = clientRouter_1.router.subscribe(updateRoute);
213
- return () => {
214
- window.removeEventListener('popstate', handlePopState);
215
- unsubscribe();
216
- };
217
- }, [updateRoute]);
218
- let resolvedContent;
219
- if (!CurrentPageComponent || initialComponentPath === '__404__') {
220
- const NotFoundComponent = window.__VATTS_NOT_FOUND__;
221
- if (NotFoundComponent) {
222
- const NotFoundContent = react_1.default.createElement(NotFoundComponent, null);
223
- const hasLayout = typeof layoutComponent === "function";
224
- resolvedContent = hasLayout
225
- ? react_1.default.createElement(layoutComponent, { children: NotFoundContent })
226
- : NotFoundContent;
227
- }
228
- else {
229
- const DefaultNotFound = window.__VATTS_DEFAULT_NOT_FOUND__;
230
- const NotFoundContent = react_1.default.createElement(DefaultNotFound, null);
231
- const hasLayout = typeof layoutComponent === "function";
232
- resolvedContent = hasLayout
233
- ? react_1.default.createElement(layoutComponent, { children: NotFoundContent })
234
- : NotFoundContent;
235
- }
236
- }
237
- else {
238
- const PageContent = react_1.default.createElement(CurrentPageComponent, { key: `page-${hmrTimestamp}`, params: params });
239
- const hasLayout = typeof layoutComponent === "function";
240
- resolvedContent = hasLayout
241
- ? react_1.default.createElement(layoutComponent, { children: PageContent })
242
- : react_1.default.createElement("div", null, PageContent);
243
- }
244
- return (react_1.default.createElement(react_1.default.Fragment, null,
245
- resolvedContent,
246
- process.env.NODE_ENV !== 'production' ? (react_1.default.createElement(DevIndicator_1.default, { hasBuildError: !!buildError, onClickBuildError: () => setIsErrorOpen(true) })) : null,
247
- react_1.default.createElement(ErrorModal_1.ErrorModal, { error: buildError, isOpen: isErrorOpen, onClose: () => setIsErrorOpen(false), onCopy: copyBuildError })));
248
- }
249
- // --- Inicialização do Cliente (CSR - Client-Side Rendering) ---
250
- function deobfuscateData(obfuscated) {
251
- try {
252
- const parts = obfuscated.split('.');
253
- const base64 = parts.length > 1 ? parts[1] : parts[0];
254
- const jsonStr = atob(base64);
255
- return JSON.parse(jsonStr);
256
- }
257
- catch (error) {
258
- console.error('[Vatts Frontend] ❌ Failed to decode data:', error);
259
- return null;
260
- }
261
- }
262
- function initializeClient() {
263
- try {
264
- const dataElement = document.getElementById('__vatts_data__');
265
- if (!dataElement) {
266
- console.error('[Vatts Frontend] ❌ Initial data script not found (#__vatts_data__).');
267
- return;
268
- }
269
- const obfuscated = dataElement.getAttribute('data-h');
270
- if (!obfuscated) {
271
- console.error('[Vatts Frontend] ❌ Data attribute not found.');
272
- return;
273
- }
274
- const initialData = deobfuscateData(obfuscated);
275
- if (!initialData) {
276
- console.error('[Vatts Frontend] ❌ Failed to parse initial data.');
277
- return;
278
- }
279
- const componentMap = {};
280
- if (window.__VATTS_COMPONENTS__) {
281
- Object.assign(componentMap, window.__VATTS_COMPONENTS__);
282
- }
283
- else {
284
- console.warn('[Vatts Frontend] ⚠️ No components found in window.__VATTS_COMPONENTS__');
285
- }
286
- const container = document.getElementById('root');
287
- if (!container) {
288
- console.error('[Vatts Frontend] ❌ Container #root not found.');
289
- return;
290
- }
291
- if (window.__VATTS_ROOT__) {
292
- console.log('[Vatts Frontend] ♻️ HMR detectado: Limpando a root do React...');
293
- try {
294
- window.__VATTS_ROOT__.unmount();
295
- container.innerHTML = '';
296
- }
297
- catch (e) {
298
- console.warn('[Vatts Frontend] ⚠️ Warning during unmount:', e);
299
- }
300
- }
301
- const root = (0, client_1.createRoot)(container);
302
- window.__VATTS_ROOT__ = root;
303
- root.render(react_1.default.createElement(App, { componentMap: componentMap, routes: initialData.routes, initialComponentPath: initialData.initialComponentPath, initialParams: initialData.initialParams, layoutComponent: window.__VATTS_LAYOUT__ }));
304
- }
305
- catch (error) {
306
- console.error('[Vatts Frontend] ❌ Critical Error rendering application:', error);
307
- if (typeof document !== 'undefined') {
308
- document.body.innerHTML = `
309
- <div style="font-family: monospace; padding: 20px; color: #ff4444; background: #1a1a1a; min-height: 100vh;">
310
- <h1>Vatts Client Error</h1>
311
- <p>A critical error occurred while initializing the application.</p>
312
- <pre style="background: #000; padding: 15px; border-radius: 5px; overflow: auto;">${error?.message || error}</pre>
313
- <pre style="color: #666; font-size: 12px; margin-top: 10px;">${error?.stack || ''}</pre>
314
- </div>
315
- `;
316
- }
317
- }
318
- }
319
- // Executa quando o DOM estiver pronto
320
- if (document.readyState === 'loading') {
321
- document.addEventListener('DOMContentLoaded', initializeClient);
322
- }
323
- else {
324
- setTimeout(initializeClient, 0);
325
- }
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- export interface ServerErrorProps {
3
- title?: string;
4
- error?: unknown;
5
- hint?: string;
6
- requestUrl?: string;
7
- }
8
- export default function ServerError({ title, error, hint, requestUrl, }: ServerErrorProps): React.JSX.Element;
@@ -1,346 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.default = ServerError;
37
- const react_1 = __importStar(require("react"));
38
- function formatUnknownError(error) {
39
- if (!error)
40
- return { message: 'Erro desconhecido no SSR.' };
41
- if (error instanceof Error) {
42
- return { message: error.message || String(error), stack: error.stack };
43
- }
44
- if (typeof error === 'string') {
45
- return { message: error };
46
- }
47
- try {
48
- return { message: JSON.stringify(error, null, 2) };
49
- }
50
- catch {
51
- return { message: String(error) };
52
- }
53
- }
54
- // Styles definidos como string para facilitar o uso sem arquivos CSS externos
55
- const styles = `
56
- .ssr-error-wrapper {
57
- /* PALETA: React Theme (Igual ao BuildingScreen) */
58
- --react-cyan: #61DAFB;
59
- --react-dark: #20232a;
60
- --bg-solid: #000000;
61
- --card-bg: #0a0a0a;
62
- --text-main: #ffffff;
63
- --text-muted: #8ea9c7; /* Azulado acinzentado */
64
- --error-red: #ff5f56; /* Mantido vermelho para indicar ERRO crítico */
65
-
66
- font-family: 'Inter', system-ui, sans-serif;
67
- position: fixed;
68
- top: 0;
69
- left: 0;
70
- width: 100vw;
71
- height: 100vh;
72
- background-color: var(--bg-solid);
73
- color: var(--text-main);
74
- overflow: hidden;
75
- z-index: 9999;
76
- box-sizing: border-box;
77
- }
78
-
79
- .ssr-error-wrapper .container {
80
- display: flex;
81
- flex-direction: column;
82
- justify-content: center;
83
- align-items: center;
84
- width: 100%;
85
- height: 100%;
86
- padding: 20px;
87
- box-sizing: border-box;
88
- }
89
-
90
- .ssr-error-wrapper .card {
91
- width: 100%;
92
- max-width: 900px;
93
- max-height: 90vh;
94
- display: flex;
95
- flex-direction: column;
96
- background: var(--card-bg);
97
- /* Borda sutil ciano */
98
- box-shadow: 0 0 0 1px rgba(97, 218, 251, 0.1), 0 40px 80px -20px rgba(0, 0, 0, 0.9);
99
- border-radius: 20px;
100
- overflow: hidden;
101
- position: relative;
102
- }
103
-
104
- .ssr-error-wrapper .neon-line {
105
- height: 1px;
106
- width: 100%;
107
- /* Gradiente Azul/Ciano */
108
- background: linear-gradient(90deg, transparent, var(--react-dark), var(--react-cyan), var(--react-dark), transparent);
109
- box-shadow: 0 0 15px rgba(97, 218, 251, 0.2);
110
- flex-shrink: 0;
111
- }
112
-
113
- .ssr-error-wrapper .content {
114
- padding: 32px 40px;
115
- display: flex;
116
- flex-direction: column;
117
- flex: 1;
118
- overflow: hidden;
119
- }
120
-
121
- .ssr-error-wrapper h1 {
122
- margin: 0 0 24px 0;
123
- font-size: 1.8rem;
124
- font-weight: 800;
125
- letter-spacing: -0.03em;
126
- /* Gradiente Texto: Branco para Cyan */
127
- background: linear-gradient(180deg, #ffffff 0%, var(--react-cyan) 100%);
128
- -webkit-background-clip: text;
129
- -webkit-text-fill-color: transparent;
130
- display: flex;
131
- align-items: center;
132
- gap: 12px;
133
- }
134
-
135
- .ssr-error-wrapper .icon {
136
- -webkit-text-fill-color: initial;
137
- font-size: 1.5rem;
138
- }
139
-
140
- .ssr-error-wrapper .meta-info {
141
- margin-bottom: 24px;
142
- display: flex;
143
- flex-direction: column;
144
- gap: 8px;
145
- }
146
-
147
- .ssr-error-wrapper .meta-row {
148
- display: flex;
149
- align-items: baseline;
150
- gap: 10px;
151
- font-size: 0.9rem;
152
- }
153
-
154
- .ssr-error-wrapper .meta-label {
155
- color: var(--react-cyan); /* Label agora é Ciano */
156
- font-weight: 700;
157
- font-size: 0.75rem;
158
- letter-spacing: 0.05em;
159
- opacity: 0.8;
160
- }
161
-
162
- .ssr-error-wrapper .meta-value {
163
- color: var(--text-muted);
164
- font-family: 'JetBrains Mono', monospace;
165
- font-size: 0.85rem;
166
- word-break: break-all;
167
- }
168
-
169
- .ssr-error-wrapper .meta-value.accent {
170
- color: var(--react-cyan);
171
- }
172
-
173
- .ssr-error-wrapper .terminal-box {
174
- background: rgba(10, 10, 10, 0.8);
175
- /* Borda e fundo sutilmente azulados */
176
- border: 1px solid rgba(97, 218, 251, 0.15);
177
- border-radius: 12px;
178
- display: flex;
179
- flex-direction: column;
180
- flex: 1;
181
- overflow: hidden;
182
- font-family: 'JetBrains Mono', monospace;
183
- }
184
-
185
- .ssr-error-wrapper .terminal-header {
186
- background: rgba(97, 218, 251, 0.05);
187
- padding: 12px 16px;
188
- border-bottom: 1px solid rgba(97, 218, 251, 0.1);
189
- display: flex;
190
- align-items: center;
191
- gap: 12px;
192
- }
193
-
194
- .ssr-error-wrapper .dots {
195
- display: flex;
196
- gap: 6px;
197
- }
198
-
199
- .ssr-error-wrapper .dot {
200
- width: 10px;
201
- height: 10px;
202
- border-radius: 50%;
203
- }
204
- .ssr-error-wrapper .dot.red { background: #ff5f56; }
205
- .ssr-error-wrapper .dot.yellow { background: #ffbd2e; }
206
- .ssr-error-wrapper .dot.green { background: #27c93f; }
207
-
208
- .ssr-error-wrapper .terminal-title {
209
- font-size: 0.75rem;
210
- color: rgba(255,255,255,0.3);
211
- }
212
-
213
- .ssr-error-wrapper .terminal-body {
214
- padding: 20px;
215
- overflow-y: auto;
216
- color: #e0e0e0;
217
- font-size: 0.85rem;
218
- line-height: 1.6;
219
- }
220
-
221
- .ssr-error-wrapper .log-entry.error {
222
- color: #ff8b8b; /* Vermelho claro para erro */
223
- font-weight: 600;
224
- margin-bottom: 16px;
225
- }
226
-
227
- .ssr-error-wrapper .arrow {
228
- color: var(--react-cyan);
229
- margin-right: 8px;
230
- }
231
-
232
- .ssr-error-wrapper .separator {
233
- height: 1px;
234
- background: rgba(255,255,255,0.1);
235
- margin: 16px 0;
236
- width: 100%;
237
- }
238
-
239
- .ssr-error-wrapper .stack-trace {
240
- color: rgba(142, 169, 199, 0.6); /* Azulado mudo */
241
- white-space: pre-wrap;
242
- font-size: 0.75rem;
243
- line-height: 1.5;
244
- }
245
-
246
- .ssr-error-wrapper .custom-scroll::-webkit-scrollbar {
247
- width: 8px;
248
- }
249
- .ssr-error-wrapper .custom-scroll::-webkit-scrollbar-track {
250
- background: transparent;
251
- }
252
- .ssr-error-wrapper .custom-scroll::-webkit-scrollbar-thumb {
253
- background: rgba(97, 218, 251, 0.2);
254
- border-radius: 4px;
255
- }
256
- .ssr-error-wrapper .custom-scroll::-webkit-scrollbar-thumb:hover {
257
- background: rgba(97, 218, 251, 0.4);
258
- }
259
-
260
- .ssr-error-wrapper .card-footer {
261
- padding: 16px 40px;
262
- background: rgba(97, 218, 251, 0.02);
263
- border-top: 1px solid rgba(97, 218, 251, 0.05);
264
- display: flex;
265
- justify-content: space-between;
266
- align-items: center;
267
- font-size: 11px;
268
- box-sizing: border-box;
269
- }
270
-
271
- .ssr-error-wrapper .footer-hint {
272
- color: rgba(255, 255, 255, 0.3);
273
- }
274
-
275
- .ssr-error-wrapper .status-error {
276
- display: flex;
277
- align-items: center;
278
- gap: 8px;
279
- color: var(--error-red);
280
- font-weight: 600;
281
- text-transform: uppercase;
282
- letter-spacing: 0.05em;
283
- }
284
-
285
- .ssr-error-wrapper .status-dot {
286
- width: 6px;
287
- height: 6px;
288
- background-color: var(--error-red);
289
- border-radius: 50%;
290
- box-shadow: 0 0 8px var(--error-red);
291
- }
292
-
293
- .ssr-error-wrapper .brand-link {
294
- margin-top: 24px;
295
- opacity: 0.4;
296
- }
297
-
298
- .ssr-error-wrapper .brand-text {
299
- font-family: 'Inter', sans-serif;
300
- font-size: 14px;
301
- font-weight: 600;
302
- color: #fff;
303
- }
304
-
305
- .ssr-error-wrapper .brand-highlight {
306
- color: var(--react-cyan);
307
- }
308
- `;
309
- function ServerError({ title = 'SSR Error', error, hint, requestUrl, }) {
310
- const { message, stack } = (0, react_1.useMemo)(() => formatUnknownError(error), [error]);
311
- return (react_1.default.createElement(react_1.default.Fragment, null,
312
- react_1.default.createElement("style", null, styles),
313
- react_1.default.createElement("link", { href: "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700;900&family=JetBrains+Mono:wght@400;500&display=swap", rel: "stylesheet" }),
314
- react_1.default.createElement("div", { className: "ssr-error-wrapper" },
315
- react_1.default.createElement("div", { className: "container" },
316
- react_1.default.createElement("div", { className: "card" },
317
- react_1.default.createElement("div", { className: "neon-line" }),
318
- react_1.default.createElement("div", { className: "content" },
319
- react_1.default.createElement("h1", null, title),
320
- (requestUrl || hint) && (react_1.default.createElement("div", { className: "meta-info" },
321
- requestUrl && (react_1.default.createElement("div", { className: "meta-row" },
322
- react_1.default.createElement("span", { className: "meta-label" }, "REQUEST URL:"),
323
- react_1.default.createElement("code", { className: "meta-value" }, requestUrl))),
324
- hint && (react_1.default.createElement("div", { className: "meta-row" },
325
- react_1.default.createElement("span", { className: "meta-label" }, "HINT:"),
326
- react_1.default.createElement("span", { className: "meta-value accent" }, hint))))),
327
- react_1.default.createElement("div", { className: "terminal-box" },
328
- react_1.default.createElement("div", { className: "terminal-header" },
329
- react_1.default.createElement("div", { className: "dots" },
330
- react_1.default.createElement("div", { className: "dot red" }),
331
- react_1.default.createElement("div", { className: "dot yellow" }),
332
- react_1.default.createElement("div", { className: "dot green" })),
333
- react_1.default.createElement("span", { className: "terminal-title" }, "SSR Exception Log")),
334
- react_1.default.createElement("div", { className: "terminal-body custom-scroll" },
335
- react_1.default.createElement("div", { className: "log-entry error" },
336
- react_1.default.createElement("span", { className: "arrow" }, '>'),
337
- " ",
338
- message),
339
- stack && (react_1.default.createElement(react_1.default.Fragment, null,
340
- react_1.default.createElement("div", { className: "separator" }),
341
- react_1.default.createElement("div", { className: "stack-trace" }, stack)))))),
342
- react_1.default.createElement("div", { className: "card-footer" },
343
- react_1.default.createElement("div", { className: "status-error" },
344
- react_1.default.createElement("div", { className: "status-dot" }),
345
- react_1.default.createElement("span", null, "Render Failed"))))))));
346
- }