vatts 1.2.0-alpha.1 → 1.2.0-test.0

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 (47) hide show
  1. package/dist/adapters/express.js +5 -1
  2. package/dist/adapters/factory.js +58 -21
  3. package/dist/adapters/fastify.js +5 -1
  4. package/dist/adapters/native.js +5 -1
  5. package/dist/api/console.js +25 -17
  6. package/dist/api/framework.js +22 -15
  7. package/dist/api/http.js +7 -2
  8. package/dist/builder.js +19 -10
  9. package/dist/client/clientRouter.js +6 -2
  10. package/dist/client/rpc.js +7 -4
  11. package/dist/env/env.js +18 -11
  12. package/dist/global/global.d.ts +177 -122
  13. package/dist/helpers.js +108 -67
  14. package/dist/hotReload.d.ts +6 -0
  15. package/dist/hotReload.js +179 -31
  16. package/dist/index.js +159 -115
  17. package/dist/loaders.js +29 -13
  18. package/dist/react/BuildingPage.d.ts +2 -1
  19. package/dist/react/BuildingPage.js +47 -4
  20. package/dist/react/DefaultNotFound.d.ts +2 -1
  21. package/dist/react/DefaultNotFound.js +92 -17
  22. package/dist/react/DevIndicator.js +66 -23
  23. package/dist/react/ErrorModal.js +91 -40
  24. package/dist/react/Link.d.ts +2 -2
  25. package/dist/react/Link.js +27 -5
  26. package/dist/react/client.js +16 -5
  27. package/dist/react/entry.client.js +70 -30
  28. package/dist/react/image/Image.js +8 -3
  29. package/dist/react/renderer-react.js +53 -25
  30. package/dist/renderer.d.ts +4 -0
  31. package/dist/renderer.js +13 -5
  32. package/dist/router.js +82 -63
  33. package/dist/rpc/annotations.js +7 -3
  34. package/dist/rpc/server.js +21 -15
  35. package/dist/rpc/types.js +4 -1
  36. package/dist/types/framework.js +2 -1
  37. package/dist/types.js +2 -1
  38. package/dist/vue/App.vue +34 -37
  39. package/dist/vue/BuildingPage.vue +118 -102
  40. package/dist/vue/ErrorModal.vue +19 -37
  41. package/dist/vue/Link.vue +8 -7
  42. package/dist/vue/client.js +16 -6
  43. package/dist/vue/entry.client.js +8 -3
  44. package/dist/vue/image/Image.vue +25 -19
  45. package/dist/vue/renderer.vue.js +80 -26
  46. package/package.json +25 -12
  47. package/dist/global/global.js +0 -17
package/dist/loaders.js CHANGED
@@ -101,6 +101,8 @@ function registerLoaders(options = {}) {
101
101
  throw new Error('Para carregar arquivos .vue no servidor, você precisa instalar "vue" e "esbuild".');
102
102
  }
103
103
  const source = fs.readFileSync(filename, 'utf8');
104
+ // Variável para armazenar o código final para fins de debug
105
+ let finalEsm = '';
104
106
  try {
105
107
  // 1. Parse do SFC
106
108
  const { descriptor, errors } = sfcCompiler.parse(source, {
@@ -120,10 +122,16 @@ function registerLoaders(options = {}) {
120
122
  isProd: false,
121
123
  inlineTemplate: false
122
124
  });
123
- // Truque: Substitui "export default" por uma variável local para podermos
124
- // anexar a função render antes de exportar tudo no final.
125
- // Isso é necessário pois estamos criando um arquivo único virtual.
126
- scriptContent = compiledScript.content.replace('export default', 'const _sfc_main =');
125
+ // FIX: Uso de Regex para ser mais flexível com espaços
126
+ // Ex: aceita "export default" e "export default"
127
+ if (compiledScript.content.match(/export\s+default/)) {
128
+ scriptContent = compiledScript.content.replace(/export\s+default/, 'const _sfc_main =');
129
+ }
130
+ else {
131
+ // Fallback: Se não achou export default, assume que o script apenas roda side-effects ou define variáveis,
132
+ // mas precisamos garantir que _sfc_main exista.
133
+ scriptContent = compiledScript.content + '\nconst _sfc_main = {};';
134
+ }
127
135
  bindings = compiledScript.bindings;
128
136
  }
129
137
  catch (e) {
@@ -132,7 +140,6 @@ function registerLoaders(options = {}) {
132
140
  }
133
141
  }
134
142
  // 3. Compilação do Template para SSR
135
- // Isso gera a função `ssrRender` necessária para o @vue/server-renderer
136
143
  let templateContent = '';
137
144
  if (descriptor.template) {
138
145
  try {
@@ -140,11 +147,10 @@ function registerLoaders(options = {}) {
140
147
  source: descriptor.template.content,
141
148
  filename: filename,
142
149
  id: filename,
143
- ssr: true, // IMPORTANTE: Gera código otimizado para servidor (string concatenation)
150
+ ssr: true,
144
151
  compilerOptions: {
145
- bindingMetadata: bindings // Otimiza bindings baseados no script setup
152
+ bindingMetadata: bindings
146
153
  },
147
- // CORREÇÃO: Passa as variáveis CSS detectadas no parse para o compilador de template
148
154
  ssrCssVars: descriptor.cssVars || []
149
155
  });
150
156
  templateContent = templateResult.code;
@@ -154,27 +160,29 @@ function registerLoaders(options = {}) {
154
160
  }
155
161
  }
156
162
  // 4. Montagem do Código Final (ESM Virtual)
157
- // Combinamos o script compilado com o template compilado e unimos as partes.
158
- const finalEsm = `
163
+ finalEsm = `
159
164
  ${scriptContent}
160
165
  ${templateContent}
161
166
 
162
167
  // Anexa a função de renderização SSR ao componente principal
168
+ // Usa verificação de tipo segura para evitar ReferenceError na checagem
163
169
  if (typeof _sfc_main !== 'undefined') {
164
170
  if (typeof ssrRender !== 'undefined') {
165
171
  _sfc_main.ssrRender = ssrRender;
166
172
  }
167
- // Fallback para renderização cliente/hidratação se necessário (opcional no server)
168
173
  if (typeof render !== 'undefined') {
169
174
  _sfc_main.render = render;
170
175
  }
176
+ } else {
177
+ // Safety net: Se _sfc_main não foi definido acima, define agora para não quebrar o export abaixo
178
+ var _sfc_main = {};
171
179
  }
172
180
 
173
181
  export default _sfc_main;
174
182
  `;
175
183
  // 5. Transformação final para CommonJS (Node.js) via Esbuild
176
184
  const result = esbuild.transformSync(finalEsm, {
177
- loader: 'ts', // Suporta TS e JS
185
+ loader: 'ts',
178
186
  format: 'cjs',
179
187
  target: 'node16',
180
188
  sourcefile: filename
@@ -183,7 +191,15 @@ function registerLoaders(options = {}) {
183
191
  module._compile(result.code, filename);
184
192
  }
185
193
  catch (err) {
186
- console.error(`Falha fatal ao carregar .vue: ${filename}`);
194
+ console.error(`\n--- Vatts Loader Debug ---`);
195
+ console.error(`Falha fatal ao carregar: ${filename}`);
196
+ console.error(`Erro original: ${err.message}`);
197
+ // Mostra um snippet do código gerado para facilitar a correção
198
+ if (finalEsm) {
199
+ console.error(`\n[DEBUG] Código gerado (Snippet):`);
200
+ console.error(finalEsm.split('\n').slice(0, 30).join('\n') + '\n...');
201
+ }
202
+ console.error(`--------------------------\n`);
187
203
  throw err;
188
204
  }
189
205
  };
@@ -1 +1,2 @@
1
- export default function BuildingScreen(): import("react/jsx-runtime").JSX.Element;
1
+ import React from "react";
2
+ export default function BuildingScreen(): React.JSX.Element;
@@ -1,5 +1,11 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export default function BuildingScreen() {
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = BuildingScreen;
7
+ const react_1 = __importDefault(require("react"));
8
+ function BuildingScreen() {
3
9
  let version = "1.0.0";
4
10
  try {
5
11
  version = require("../package.json").version;
@@ -198,9 +204,46 @@ export default function BuildingScreen() {
198
204
  to { transform: rotate(360deg); }
199
205
  }
200
206
  `;
201
- return (_jsxs("html", { lang: "en", children: [_jsxs("head", { children: [_jsx("meta", { charSet: "UTF-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1.0" }), _jsx("title", { children: "Vatts.js | Building..." }), _jsx("link", { rel: "preconnect", href: "https://fonts.googleapis.com" }), _jsx("link", { rel: "preconnect", href: "https://fonts.gstatic.com", crossOrigin: "" }), _jsx("link", { href: "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700;900&family=JetBrains+Mono:wght@400;500&display=swap", rel: "stylesheet" }), _jsx("style", { dangerouslySetInnerHTML: { __html: styles } })] }), _jsxs("body", { children: [_jsx("div", { className: "container", children: _jsxs("div", { className: "build-card", children: [_jsx("div", { className: "neon-line" }), _jsxs("div", { className: "content", children: [_jsxs("div", { className: "logo-wrapper", children: [_jsx("div", { className: "logo-glow" }), _jsx("img", { src: "https://raw.githubusercontent.com/mfrazlab/vatts.js/master/docs/public/logo.png", alt: "Vatts Logo" })] }), _jsxs("h1", { children: ["Vatts", _jsx("span", { children: ".js" })] }), _jsx("p", { children: "Building your masterpiece..." }), _jsxs("div", { className: "terminal-box", children: [_jsxs("div", { className: "term-line", children: [_jsx("div", { className: "term-spinner" }), _jsxs("span", { className: "file-name", children: ["Compiling ", _jsx("span", { className: "accent", children: "src/vatts.ts" }), "..."] })] }), _jsxs("div", { className: "term-line", style: { opacity: 0.5 }, children: [_jsx("span", { children: "\u2713" }), _jsx("span", { className: "file-name", children: "Optimizing assets" })] })] })] }), _jsxs("div", { className: "card-footer", children: [_jsx("span", { children: "Building..." }), _jsxs("div", { className: "status-active", children: [_jsx("div", { className: "dot" }), "v", version] })] })] }) }), _jsx("script", { dangerouslySetInnerHTML: { __html: `
207
+ return (react_1.default.createElement("html", { lang: "en" },
208
+ react_1.default.createElement("head", null,
209
+ react_1.default.createElement("meta", { charSet: "UTF-8" }),
210
+ react_1.default.createElement("meta", { name: "viewport", content: "width=device-width, initial-scale=1.0" }),
211
+ react_1.default.createElement("title", null, "Vatts.js | Building..."),
212
+ react_1.default.createElement("link", { rel: "preconnect", href: "https://fonts.googleapis.com" }),
213
+ react_1.default.createElement("link", { rel: "preconnect", href: "https://fonts.gstatic.com", crossOrigin: "" }),
214
+ 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" }),
215
+ react_1.default.createElement("style", { dangerouslySetInnerHTML: { __html: styles } })),
216
+ react_1.default.createElement("body", null,
217
+ react_1.default.createElement("div", { className: "container" },
218
+ react_1.default.createElement("div", { className: "build-card" },
219
+ react_1.default.createElement("div", { className: "neon-line" }),
220
+ react_1.default.createElement("div", { className: "content" },
221
+ react_1.default.createElement("div", { className: "logo-wrapper" },
222
+ react_1.default.createElement("div", { className: "logo-glow" }),
223
+ react_1.default.createElement("img", { src: "https://raw.githubusercontent.com/mfrazlab/vatts.js/master/docs/public/logo.png", alt: "Vatts Logo" })),
224
+ react_1.default.createElement("h1", null,
225
+ "Vatts",
226
+ react_1.default.createElement("span", null, ".js")),
227
+ react_1.default.createElement("p", null, "Building your application..."),
228
+ react_1.default.createElement("div", { className: "terminal-box" },
229
+ react_1.default.createElement("div", { className: "term-line" },
230
+ react_1.default.createElement("div", { className: "term-spinner" }),
231
+ react_1.default.createElement("span", { className: "file-name" },
232
+ "Compiling ",
233
+ react_1.default.createElement("span", { className: "accent" }, "src/vatts.ts"),
234
+ "...")),
235
+ react_1.default.createElement("div", { className: "term-line", style: { opacity: 0.5 } },
236
+ react_1.default.createElement("span", null, "\u2713"),
237
+ react_1.default.createElement("span", { className: "file-name" }, "Optimizing assets")))),
238
+ react_1.default.createElement("div", { className: "card-footer" },
239
+ react_1.default.createElement("span", null, "Building..."),
240
+ react_1.default.createElement("div", { className: "status-active" },
241
+ react_1.default.createElement("div", { className: "dot" }),
242
+ "v",
243
+ version)))),
244
+ react_1.default.createElement("script", { dangerouslySetInnerHTML: { __html: `
202
245
  setTimeout(() => {
203
246
  window.location.reload();
204
247
  }, 2500);
205
- ` } })] })] }));
248
+ ` } }))));
206
249
  }
@@ -1 +1,2 @@
1
- export default function ErrorPage(): import("react/jsx-runtime").JSX.Element;
1
+ import React from 'react';
2
+ export default function ErrorPage(): React.JSX.Element;
@@ -1,4 +1,39 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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 = ErrorPage;
2
37
  /*
3
38
  * This file is part of the Vatts.js Project.
4
39
  * Copyright (c) 2026 itsmuzin
@@ -15,12 +50,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
50
  * See the License for the specific language governing permissions and
16
51
  * limitations under the License.
17
52
  */
18
- import { useState, useEffect } from 'react';
19
- export default function ErrorPage() {
20
- const [path, setPath] = useState('/');
21
- const [hoverHome, setHoverHome] = useState(false);
22
- const [hoverRetry, setHoverRetry] = useState(false);
23
- useEffect(() => {
53
+ const react_1 = __importStar(require("react"));
54
+ function ErrorPage() {
55
+ const [path, setPath] = (0, react_1.useState)('/');
56
+ const [hoverHome, setHoverHome] = (0, react_1.useState)(false);
57
+ const [hoverRetry, setHoverRetry] = (0, react_1.useState)(false);
58
+ (0, react_1.useEffect)(() => {
24
59
  if (typeof window !== 'undefined') {
25
60
  setPath(window.location.pathname);
26
61
  }
@@ -154,14 +189,54 @@ export default function ErrorPage() {
154
189
  textDecoration: 'none',
155
190
  color: '#fff',
156
191
  };
157
- return (_jsxs("div", { children: [_jsx("style", { dangerouslySetInnerHTML: { __html: globalStyles } }), _jsxs("div", { style: containerStyle, children: [_jsxs("div", { style: cardStyle, children: [_jsx("div", { style: neonLine }), _jsxs("div", { style: contentStyle, children: [_jsx("div", { style: codeStyle, children: "404" }), _jsxs("div", { style: terminalBoxStyle, children: [_jsxs("div", { style: { display: 'flex', gap: 6, marginBottom: 8, opacity: 0.3 }, children: [_jsx("div", { style: { width: 8, height: 8, borderRadius: '50%', background: '#fff' } }), _jsx("div", { style: { width: 8, height: 8, borderRadius: '50%', background: '#fff' } }), _jsx("div", { style: { width: 8, height: 8, borderRadius: '50%', background: '#fff' } })] }), _jsxs("div", { children: [_jsx("span", { style: { color: '#64748b' }, children: "GET" }), ' ', _jsx("span", { style: { color: '#fff' }, children: path })] }), _jsx("div", { style: { marginTop: 4, color: '#475569' }, children: _jsx("span", { children: "Error: Route not found" }) })] }), _jsxs("div", { style: { display: 'flex', gap: 12, width: '100%' }, children: [_jsxs("a", { href: "/", onMouseEnter: () => setHoverHome(true), onMouseLeave: () => setHoverHome(false), style: { ...getBtnStyle('primary', hoverHome), flex: 1, justifyContent: 'center' }, children: [_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("path", { d: "M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" }), _jsx("polyline", { points: "9 22 9 12 15 12 15 22" })] }), "Back Home"] }), _jsxs("button", { onClick: () => window.location.reload(), onMouseEnter: () => setHoverRetry(true), onMouseLeave: () => setHoverRetry(false), style: { ...getBtnStyle('secondary', hoverRetry), flex: 1, justifyContent: 'center' }, children: [_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("path", { d: "M21 2v6h-6" }), _jsx("path", { d: "M3 12a9 9 0 0 1 15-6.7L21 8" }), _jsx("path", { d: "M3 22v-6h6" }), _jsx("path", { d: "M21 12a9 9 0 0 1-15 6.7L3 16" })] }), "Retry"] })] })] }), _jsxs("div", { style: {
158
- padding: '12px 32px',
159
- background: 'rgba(255,255,255,0.02)',
160
- borderTop: '1px solid rgba(255,255,255,0.05)',
161
- display: 'flex',
162
- justifyContent: 'space-between',
163
- alignItems: 'center',
164
- fontSize: 11,
165
- color: 'rgba(255,255,255,0.3)'
166
- }, children: [_jsx("span", { children: "Vatts Server" }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 6 }, children: [_jsx("div", { style: { width: 6, height: 6, borderRadius: '50%', background: '#475569' } }), _jsx("span", { style: { color: '#94a3b8' }, children: "Not Found" })] })] })] }), _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: [_jsx("img", { src: "https://raw.githubusercontent.com/mfrazlab/vatts.js/master/docs/public/logo.png", alt: "Vatts Logo", style: { width: 20, height: 20, filter: 'grayscale(1) brightness(2)' } }), _jsxs("span", { style: { fontSize: 13, fontWeight: 600, color: '#fff' }, children: ["Vatts", _jsx("span", { style: { color: "#64748b" }, children: ".js" })] })] })] })] }));
192
+ return (react_1.default.createElement("div", null,
193
+ react_1.default.createElement("style", { dangerouslySetInnerHTML: { __html: globalStyles } }),
194
+ react_1.default.createElement("div", { style: containerStyle },
195
+ react_1.default.createElement("div", { style: cardStyle },
196
+ react_1.default.createElement("div", { style: neonLine }),
197
+ react_1.default.createElement("div", { style: contentStyle },
198
+ react_1.default.createElement("div", { style: codeStyle }, "404"),
199
+ react_1.default.createElement("div", { style: terminalBoxStyle },
200
+ react_1.default.createElement("div", { style: { display: 'flex', gap: 6, marginBottom: 8, opacity: 0.3 } },
201
+ react_1.default.createElement("div", { style: { width: 8, height: 8, borderRadius: '50%', background: '#fff' } }),
202
+ react_1.default.createElement("div", { style: { width: 8, height: 8, borderRadius: '50%', background: '#fff' } }),
203
+ react_1.default.createElement("div", { style: { width: 8, height: 8, borderRadius: '50%', background: '#fff' } })),
204
+ react_1.default.createElement("div", null,
205
+ react_1.default.createElement("span", { style: { color: '#64748b' } }, "GET"),
206
+ ' ',
207
+ react_1.default.createElement("span", { style: { color: '#fff' } }, path)),
208
+ react_1.default.createElement("div", { style: { marginTop: 4, color: '#475569' } },
209
+ react_1.default.createElement("span", null, "Error: Route not found"))),
210
+ react_1.default.createElement("div", { style: { display: 'flex', gap: 12, width: '100%' } },
211
+ react_1.default.createElement("a", { href: "/", onMouseEnter: () => setHoverHome(true), onMouseLeave: () => setHoverHome(false), style: { ...getBtnStyle('primary', hoverHome), flex: 1, justifyContent: 'center' } },
212
+ react_1.default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
213
+ react_1.default.createElement("path", { d: "M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" }),
214
+ react_1.default.createElement("polyline", { points: "9 22 9 12 15 12 15 22" })),
215
+ "Back Home"),
216
+ react_1.default.createElement("button", { onClick: () => window.location.reload(), onMouseEnter: () => setHoverRetry(true), onMouseLeave: () => setHoverRetry(false), style: { ...getBtnStyle('secondary', hoverRetry), flex: 1, justifyContent: 'center' } },
217
+ react_1.default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
218
+ react_1.default.createElement("path", { d: "M21 2v6h-6" }),
219
+ react_1.default.createElement("path", { d: "M3 12a9 9 0 0 1 15-6.7L21 8" }),
220
+ react_1.default.createElement("path", { d: "M3 22v-6h6" }),
221
+ react_1.default.createElement("path", { d: "M21 12a9 9 0 0 1-15 6.7L3 16" })),
222
+ "Retry"))),
223
+ react_1.default.createElement("div", { style: {
224
+ padding: '12px 32px',
225
+ background: 'rgba(255,255,255,0.02)',
226
+ borderTop: '1px solid rgba(255,255,255,0.05)',
227
+ display: 'flex',
228
+ justifyContent: 'space-between',
229
+ alignItems: 'center',
230
+ fontSize: 11,
231
+ color: 'rgba(255,255,255,0.3)'
232
+ } },
233
+ react_1.default.createElement("span", null, "Vatts Server"),
234
+ react_1.default.createElement("div", { style: { display: 'flex', alignItems: 'center', gap: 6 } },
235
+ react_1.default.createElement("div", { style: { width: 6, height: 6, borderRadius: '50%', background: '#475569' } }),
236
+ react_1.default.createElement("span", { style: { color: '#94a3b8' } }, "Not Found")))),
237
+ react_1.default.createElement("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' },
238
+ react_1.default.createElement("img", { src: "https://raw.githubusercontent.com/mfrazlab/vatts.js/master/docs/public/logo.png", alt: "Vatts Logo", style: { width: 20, height: 20, filter: 'grayscale(1) brightness(2)' } }),
239
+ react_1.default.createElement("span", { style: { fontSize: 13, fontWeight: 600, color: '#fff' } },
240
+ "Vatts",
241
+ react_1.default.createElement("span", { style: { color: "#64748b" } }, ".js"))))));
167
242
  }
@@ -1,11 +1,46 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useEffect, useState } from "react";
3
- import { createPortal } from "react-dom";
4
- export default function DevIndicator({ hasBuildError = false, onClickBuildError, }) {
5
- const [isVisible, setIsVisible] = useState(true);
6
- const [hotState, setHotState] = useState('idle');
7
- const [mounted, setMounted] = useState(false);
8
- useEffect(() => {
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 = DevIndicator;
37
+ const react_1 = __importStar(require("react"));
38
+ const react_dom_1 = require("react-dom");
39
+ function DevIndicator({ hasBuildError = false, onClickBuildError, }) {
40
+ const [isVisible, setIsVisible] = (0, react_1.useState)(true);
41
+ const [hotState, setHotState] = (0, react_1.useState)('idle');
42
+ const [mounted, setMounted] = (0, react_1.useState)(false);
43
+ (0, react_1.useEffect)(() => {
9
44
  setMounted(true);
10
45
  const handler = (ev) => {
11
46
  const detail = ev?.detail;
@@ -26,7 +61,8 @@ export default function DevIndicator({ hasBuildError = false, onClickBuildError,
26
61
  const isReloading = hotState === 'reloading';
27
62
  const isError = !!hasBuildError;
28
63
  // Criamos o elemento via Portal para injetar no final do <body>
29
- return createPortal(_jsxs(_Fragment, { children: [_jsx("style", { children: `
64
+ return (0, react_dom_1.createPortal)(react_1.default.createElement(react_1.default.Fragment, null,
65
+ react_1.default.createElement("style", null, `
30
66
  @keyframes vatts-pulse {
31
67
  0% { opacity: 0.4; }
32
68
  50% { opacity: 1; }
@@ -127,18 +163,25 @@ export default function DevIndicator({ hasBuildError = false, onClickBuildError,
127
163
  font-size: 9px;
128
164
  font-weight: 900;
129
165
  }
130
- ` }), _jsxs("div", { className: `vatts-dev-badge${isError ? ' clickable' : ''}`, onClick: () => isError && onClickBuildError?.(), children: [isReloading ? (_jsx("div", { className: "vatts-spinner" })) : (_jsx("div", { className: `vatts-status-dot${isReloading ? ' reloading' : ''}${isError ? ' error' : ''}` })), _jsxs("div", { className: "vatts-logo", children: ["VATTS", _jsx("span", { children: ".JS" }), isError && _jsx("span", { className: "vatts-error-pill", children: "ERROR" })] }), _jsx("button", { onClick: (e) => {
131
- e.stopPropagation();
132
- setIsVisible(false);
133
- }, style: {
134
- background: 'none',
135
- border: 'none',
136
- color: 'rgba(255,255,255,0.2)',
137
- cursor: 'pointer',
138
- fontSize: '16px',
139
- padding: '0 0 0 4px',
140
- marginLeft: '4px',
141
- display: 'flex',
142
- alignItems: 'center'
143
- }, children: "\u00D7" })] })] }), document.body);
166
+ `),
167
+ react_1.default.createElement("div", { className: `vatts-dev-badge${isError ? ' clickable' : ''}`, onClick: () => isError && onClickBuildError?.() },
168
+ isReloading ? (react_1.default.createElement("div", { className: "vatts-spinner" })) : (react_1.default.createElement("div", { className: `vatts-status-dot${isReloading ? ' reloading' : ''}${isError ? ' error' : ''}` })),
169
+ react_1.default.createElement("div", { className: "vatts-logo" },
170
+ "VATTS",
171
+ react_1.default.createElement("span", null, ".JS"),
172
+ isError && react_1.default.createElement("span", { className: "vatts-error-pill" }, "ERROR")),
173
+ react_1.default.createElement("button", { onClick: (e) => {
174
+ e.stopPropagation();
175
+ setIsVisible(false);
176
+ }, style: {
177
+ background: 'none',
178
+ border: 'none',
179
+ color: 'rgba(255,255,255,0.2)',
180
+ cursor: 'pointer',
181
+ fontSize: '16px',
182
+ padding: '0 0 0 4px',
183
+ marginLeft: '4px',
184
+ display: 'flex',
185
+ alignItems: 'center'
186
+ } }, "\u00D7"))), document.body);
144
187
  }
@@ -1,4 +1,39 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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.ErrorModal = ErrorModal;
2
37
  /*
3
38
  * This file is part of the Vatts.js Project.
4
39
  * Copyright (c) 2026 itsmuzin
@@ -15,8 +50,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
50
  * See the License for the specific language governing permissions and
16
51
  * limitations under the License.
17
52
  */
18
- import { useEffect, useState, useMemo } from 'react';
19
- import { createPortal } from 'react-dom';
53
+ const react_1 = __importStar(require("react"));
54
+ const react_dom_1 = require("react-dom");
20
55
  // --- ANSI PARSER LOGIC (Monochrome Adjusted) ---
21
56
  const ANSI_COLORS = {
22
57
  '30': '#475569',
@@ -30,7 +65,7 @@ const ANSI_COLORS = {
30
65
  '90': '#64748b',
31
66
  };
32
67
  function AnsiText({ text }) {
33
- const parts = useMemo(() => {
68
+ const parts = (0, react_1.useMemo)(() => {
34
69
  const regex = /\u001b\[(\d+)(?:;\d+)*m/g;
35
70
  const result = [];
36
71
  let lastIndex = 0;
@@ -56,23 +91,23 @@ function AnsiText({ text }) {
56
91
  }
57
92
  return result;
58
93
  }, [text]);
59
- return (_jsx("span", { children: parts.map((part, i) => (_jsx("span", { style: { color: part.color || 'inherit' }, children: part.text }, i))) }));
94
+ return (react_1.default.createElement("span", null, parts.map((part, i) => (react_1.default.createElement("span", { key: i, style: { color: part.color || 'inherit' } }, part.text)))));
60
95
  }
61
96
  // --- MAIN MODAL ---
62
- export function ErrorModal({ error, isOpen, onClose, onCopy, }) {
63
- const [visible, setVisible] = useState(false);
64
- const [isHoveringClose, setIsHoveringClose] = useState(false);
65
- const [isHoveringCopy, setIsHoveringCopy] = useState(false);
66
- const [mounted, setMounted] = useState(false);
97
+ function ErrorModal({ error, isOpen, onClose, onCopy, }) {
98
+ const [visible, setVisible] = (0, react_1.useState)(false);
99
+ const [isHoveringClose, setIsHoveringClose] = (0, react_1.useState)(false);
100
+ const [isHoveringCopy, setIsHoveringCopy] = (0, react_1.useState)(false);
101
+ const [mounted, setMounted] = (0, react_1.useState)(false);
67
102
  // Paleta Next.js
68
103
  const primaryColor = '#ffffff';
69
104
  const primaryRgb = '255, 255, 255';
70
105
  const borderColor = 'rgba(255, 255, 255, 0.1)';
71
- useEffect(() => {
106
+ (0, react_1.useEffect)(() => {
72
107
  setMounted(true);
73
108
  return () => setMounted(false);
74
109
  }, []);
75
- useEffect(() => {
110
+ (0, react_1.useEffect)(() => {
76
111
  if (isOpen) {
77
112
  document.body.style.overflow = 'hidden';
78
113
  setTimeout(() => setVisible(true), 10);
@@ -83,7 +118,7 @@ export function ErrorModal({ error, isOpen, onClose, onCopy, }) {
83
118
  }
84
119
  return () => { document.body.style.overflow = ''; };
85
120
  }, [isOpen]);
86
- useEffect(() => {
121
+ (0, react_1.useEffect)(() => {
87
122
  if (!isOpen)
88
123
  return;
89
124
  const onKey = (e) => {
@@ -185,31 +220,47 @@ export function ErrorModal({ error, isOpen, onClose, onCopy, }) {
185
220
  borderColor: hovering ? 'rgba(255, 255, 255, 0.1)' : 'transparent',
186
221
  };
187
222
  };
188
- const modalContent = (_jsx("div", { style: overlayStyle, onMouseDown: onClose, children: _jsxs("div", { style: cardStyle, onMouseDown: (e) => e.stopPropagation(), children: [_jsx("div", { style: neonLine }), _jsxs("div", { style: headerStyle, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 12 }, children: [_jsx("span", { style: {
189
- fontSize: 11,
190
- fontWeight: 900,
191
- color: '#ffffff',
192
- background: '#ef4444',
193
- padding: '2px 8px',
194
- borderRadius: 4,
195
- letterSpacing: '0.05em'
196
- }, children: "ERROR" }), error.plugin && (_jsx("span", { style: {
197
- fontSize: 11,
198
- color: '#64748b',
199
- background: 'rgba(255, 255, 255, 0.03)',
200
- padding: '2px 8px',
201
- borderRadius: 4,
202
- fontFamily: 'monospace',
203
- border: '1px solid rgba(255, 255, 255, 0.05)'
204
- }, children: error.plugin }))] }), _jsxs("div", { style: { display: 'flex', gap: 8 }, children: [onCopy && (_jsx("button", { onClick: onCopy, onMouseEnter: () => setIsHoveringCopy(true), onMouseLeave: () => setIsHoveringCopy(false), style: getBtnStyle('secondary', isHoveringCopy), children: "Copy Log" })), _jsx("button", { onClick: onClose, onMouseEnter: () => setIsHoveringClose(true), onMouseLeave: () => setIsHoveringClose(false), style: getBtnStyle('primary', isHoveringClose), children: "Close" })] })] }), _jsxs("div", { style: terminalContent, children: [_jsx(AnsiText, { text: rawOutput }), stackOutput && (_jsx("div", { style: { marginTop: 24, opacity: 0.4, borderTop: '1px dashed rgba(255,255,255,0.1)', paddingTop: 16 }, children: _jsx(AnsiText, { text: stackOutput }) }))] }), _jsxs("div", { style: {
205
- padding: '10px 24px',
206
- background: 'rgba(255,255,255,0.01)',
207
- borderTop: '1px solid rgba(255,255,255,0.03)',
208
- display: 'flex',
209
- justifyContent: 'space-between',
210
- fontSize: 11,
211
- color: 'rgba(255,255,255,0.3)',
212
- fontFamily: 'Inter, sans-serif'
213
- }, children: [_jsx("span", { children: "vatts-cli" }), _jsx("span", { style: { color: '#64748b', fontWeight: 500 }, children: "Watching for changes..." })] })] }) }));
214
- return createPortal(modalContent, document.body);
223
+ const modalContent = (react_1.default.createElement("div", { style: overlayStyle, onMouseDown: onClose },
224
+ react_1.default.createElement("div", { style: cardStyle, onMouseDown: (e) => e.stopPropagation() },
225
+ react_1.default.createElement("div", { style: neonLine }),
226
+ react_1.default.createElement("div", { style: headerStyle },
227
+ react_1.default.createElement("div", { style: { display: 'flex', alignItems: 'center', gap: 12 } },
228
+ react_1.default.createElement("span", { style: {
229
+ fontSize: 11,
230
+ fontWeight: 900,
231
+ color: '#ffffff',
232
+ background: '#ef4444',
233
+ padding: '2px 8px',
234
+ borderRadius: 4,
235
+ letterSpacing: '0.05em'
236
+ } }, "ERROR"),
237
+ error.plugin && (react_1.default.createElement("span", { style: {
238
+ fontSize: 11,
239
+ color: '#64748b',
240
+ background: 'rgba(255, 255, 255, 0.03)',
241
+ padding: '2px 8px',
242
+ borderRadius: 4,
243
+ fontFamily: 'monospace',
244
+ border: '1px solid rgba(255, 255, 255, 0.05)'
245
+ } }, error.plugin))),
246
+ react_1.default.createElement("div", { style: { display: 'flex', gap: 8 } },
247
+ onCopy && (react_1.default.createElement("button", { onClick: onCopy, onMouseEnter: () => setIsHoveringCopy(true), onMouseLeave: () => setIsHoveringCopy(false), style: getBtnStyle('secondary', isHoveringCopy) }, "Copy Log")),
248
+ react_1.default.createElement("button", { onClick: onClose, onMouseEnter: () => setIsHoveringClose(true), onMouseLeave: () => setIsHoveringClose(false), style: getBtnStyle('primary', isHoveringClose) }, "Close"))),
249
+ react_1.default.createElement("div", { style: terminalContent },
250
+ react_1.default.createElement(AnsiText, { text: rawOutput }),
251
+ stackOutput && (react_1.default.createElement("div", { style: { marginTop: 24, opacity: 0.4, borderTop: '1px dashed rgba(255,255,255,0.1)', paddingTop: 16 } },
252
+ react_1.default.createElement(AnsiText, { text: stackOutput })))),
253
+ react_1.default.createElement("div", { style: {
254
+ padding: '10px 24px',
255
+ background: 'rgba(255,255,255,0.01)',
256
+ borderTop: '1px solid rgba(255,255,255,0.03)',
257
+ display: 'flex',
258
+ justifyContent: 'space-between',
259
+ fontSize: 11,
260
+ color: 'rgba(255,255,255,0.3)',
261
+ fontFamily: 'Inter, sans-serif'
262
+ } },
263
+ react_1.default.createElement("span", null, "vatts-cli"),
264
+ react_1.default.createElement("span", { style: { color: '#64748b', fontWeight: 500 } }, "Watching for changes...")))));
265
+ return (0, react_dom_1.createPortal)(modalContent, document.body);
215
266
  }
@@ -1,7 +1,7 @@
1
- import { type AnchorHTMLAttributes, type ReactNode } from 'react';
1
+ import React, { type AnchorHTMLAttributes, type ReactNode } from 'react';
2
2
  interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
3
3
  href: string;
4
4
  children: ReactNode;
5
5
  }
6
- export declare function Link({ href, children, ...props }: LinkProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function Link({ href, children, ...props }: LinkProps): React.JSX.Element;
7
7
  export {};