vatts 2.2.6 → 2.3.0-canary

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 (63) hide show
  1. package/dist/builder.js +54 -17
  2. package/dist/frameworks/FrontCore.d.ts +34 -0
  3. package/dist/frameworks/FrontCore.js +128 -0
  4. package/dist/{vue → frameworks/builds}/vue.build.js +1 -1
  5. package/dist/frameworks/react/client.d.ts +8 -0
  6. package/dist/{react → frameworks/react}/client.js +14 -14
  7. package/dist/{react → frameworks/react/components}/Link.js +2 -2
  8. package/dist/frameworks/react/entry.client.d.ts +14 -0
  9. package/dist/frameworks/react/entry.client.js +211 -0
  10. package/dist/frameworks/react/react-elements.d.ts +10 -0
  11. package/dist/{react → frameworks/renderers}/renderer-react.d.ts +2 -2
  12. package/dist/{react → frameworks/renderers}/renderer-react.js +34 -67
  13. package/dist/{vue → frameworks/renderers}/renderer.vue.d.ts +2 -2
  14. package/dist/frameworks/renderers/renderer.vue.js +193 -0
  15. package/dist/frameworks/themes/BuildingPage.d.ts +1 -0
  16. package/dist/frameworks/themes/BuildingPage.js +312 -0
  17. package/dist/frameworks/themes/DefaultNotFound.d.ts +1 -0
  18. package/dist/frameworks/themes/DefaultNotFound.js +330 -0
  19. package/dist/frameworks/themes/ErrorModal.d.ts +1 -0
  20. package/dist/frameworks/themes/ErrorModal.js +345 -0
  21. package/dist/frameworks/themes/ServerError.d.ts +1 -0
  22. package/dist/frameworks/themes/ServerError.js +401 -0
  23. package/dist/frameworks/themes/VattsDevBadge.d.ts +1 -0
  24. package/dist/frameworks/themes/VattsDevBadge.js +232 -0
  25. package/dist/frameworks/vue/App.vue +149 -0
  26. package/dist/frameworks/vue/client.d.ts +9 -0
  27. package/dist/{vue → frameworks/vue}/client.js +13 -11
  28. package/dist/{vue → frameworks/vue/components}/Link.vue +1 -1
  29. package/dist/frameworks/vue/entry.client.js +75 -0
  30. package/dist/global/global.d.ts +1 -2
  31. package/dist/index.js +12 -1
  32. package/dist/renderer.js +2 -2
  33. package/package.json +10 -26
  34. package/dist/react/BuildingPage.d.ts +0 -2
  35. package/dist/react/BuildingPage.js +0 -270
  36. package/dist/react/DefaultNotFound.d.ts +0 -2
  37. package/dist/react/DefaultNotFound.js +0 -248
  38. package/dist/react/DevIndicator.d.ts +0 -5
  39. package/dist/react/DevIndicator.js +0 -203
  40. package/dist/react/ErrorModal.d.ts +0 -20
  41. package/dist/react/ErrorModal.js +0 -266
  42. package/dist/react/client.d.ts +0 -8
  43. package/dist/react/entry.client.d.ts +0 -6
  44. package/dist/react/entry.client.js +0 -325
  45. package/dist/react/server-error.d.ts +0 -8
  46. package/dist/react/server-error.js +0 -346
  47. package/dist/vue/App.vue +0 -199
  48. package/dist/vue/BuildingPage.vue +0 -281
  49. package/dist/vue/DefaultNotFound.vue +0 -329
  50. package/dist/vue/DevIndicator.vue +0 -226
  51. package/dist/vue/ErrorModal.vue +0 -317
  52. package/dist/vue/client.d.ts +0 -9
  53. package/dist/vue/entry.client.js +0 -110
  54. package/dist/vue/renderer.vue.js +0 -387
  55. package/dist/vue/server-error.vue +0 -351
  56. /package/dist/{react → frameworks/builds}/react.build.d.ts +0 -0
  57. /package/dist/{react → frameworks/builds}/react.build.js +0 -0
  58. /package/dist/{vue → frameworks/builds}/vue.build.d.ts +0 -0
  59. /package/dist/{react → frameworks/react/components}/Link.d.ts +0 -0
  60. /package/dist/{react → frameworks/react/components}/image/Image.d.ts +0 -0
  61. /package/dist/{react → frameworks/react/components}/image/Image.js +0 -0
  62. /package/dist/{vue → frameworks/vue/components}/image/Image.vue +0 -0
  63. /package/dist/{vue → frameworks/vue}/entry.client.d.ts +0 -0
@@ -1,317 +0,0 @@
1
- <!--
2
- This file is part of the Vatts.js Project.
3
- Copyright (c) 2026 mfraz
4
-
5
- Licensed under the Apache License, Version 2.0 (the "License");
6
- you may not use this file except in compliance with the License.
7
- You may obtain a copy of the License at
8
-
9
- http://www.apache.org/licenses/LICENSE-2.0
10
-
11
- Unless required by applicable law or agreed to in writing, software
12
- distributed under the License is distributed on an "AS IS" BASIS,
13
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- See the License for the specific language governing permissions and
15
- limitations under the License.
16
- -->
17
- <template>
18
- <Teleport to="body">
19
- <!-- Overlay -->
20
- <div v-if="shouldRender" :style="overlayStyle" @mousedown="close">
21
- <!-- Modal Card -->
22
- <div :style="cardStyle" @mousedown.stop>
23
-
24
- <!-- Neon Line -->
25
- <div :style="neonLineStyle"></div>
26
-
27
- <!-- Header -->
28
- <div :style="headerStyle">
29
- <div style="display: flex; align-items: center; gap: 12px">
30
- <span :style="errorBadgeStyle">ERROR</span>
31
- <span v-if="error?.plugin" :style="pluginBadgeStyle">{{ error.plugin }}</span>
32
- </div>
33
-
34
- <div style="display: flex; gap: 8px">
35
- <button
36
- v-if="hasCopyListener"
37
- @click="copy"
38
- @mouseenter="isHoveringCopy = true"
39
- @mouseleave="isHoveringCopy = false"
40
- :style="copyButtonStyle"
41
- >
42
- Copy Log
43
- </button>
44
- <button
45
- @click="close"
46
- @mouseenter="isHoveringClose = true"
47
- @mouseleave="isHoveringClose = false"
48
- :style="closeButtonStyle"
49
- >
50
- Close
51
- </button>
52
- </div>
53
- </div>
54
-
55
- <!-- Terminal Content -->
56
- <div :style="terminalContentStyle">
57
- <span v-for="(part, i) in parsedMessage" :key="'msg-'+i" :style="{ color: part.color || 'inherit' }">
58
- {{ part.text }}
59
- </span>
60
- <div v-if="parsedStack.length" :style="stackContainerStyle">
61
- <span v-for="(part, i) in parsedStack" :key="'stack-'+i" :style="{ color: part.color || 'inherit' }">
62
- {{ part.text }}
63
- </span>
64
- </div>
65
- </div>
66
-
67
- <!-- Footer -->
68
- <div :style="footerStyle">
69
- <span>vatts-cli</span>
70
- <span style="color: #64748b; fontWeight: 500">Watching for changes...</span>
71
- </div>
72
- </div>
73
- </div>
74
- </Teleport>
75
- </template>
76
-
77
- <script setup>
78
- import { ref, computed, watch, onMounted, onUnmounted, useAttrs } from 'vue';
79
-
80
- // --- Props e Emits ---
81
- const props = defineProps({
82
- error: Object,
83
- isOpen: Boolean
84
- });
85
-
86
- const emit = defineEmits(['close', 'copy']);
87
-
88
- // Verifica se o pai (App.vue) passou um listener para @copy
89
- const attrs = useAttrs();
90
- const hasCopyListener = computed(() => !!attrs.onCopy);
91
-
92
- // --- Estado ---
93
- const visible = ref(false);
94
- const shouldRender = ref(false); // Controla a montagem/desmontagem do DOM
95
- const isHoveringClose = ref(false);
96
- const isHoveringCopy = ref(false);
97
-
98
- // --- Lógica de Parser ANSI ---
99
- const ANSI_COLORS = {
100
- '30': '#475569',
101
- '31': '#ef4444',
102
- '32': '#ffffff',
103
- '33': '#94a3b8',
104
- '34': '#cbd5e1',
105
- '35': '#e2e8f0',
106
- '36': '#ffffff',
107
- '37': '#ffffff',
108
- '90': '#64748b',
109
- };
110
-
111
- function parseAnsi(text) {
112
- if (!text) return [];
113
- const regex = /\u001b\[(\d+)(?:;\d+)*m/g;
114
- const result = [];
115
- let lastIndex = 0;
116
- let match;
117
- let currentColor = null;
118
-
119
- while ((match = regex.exec(text)) !== null) {
120
- const rawText = text.slice(lastIndex, match.index);
121
- if (rawText) {
122
- result.push({ text: rawText, color: currentColor });
123
- }
124
-
125
- const code = match[1];
126
- if (code === '39' || code === '0') {
127
- currentColor = null;
128
- } else if (ANSI_COLORS[code]) {
129
- currentColor = ANSI_COLORS[code];
130
- }
131
-
132
- lastIndex = regex.lastIndex;
133
- }
134
-
135
- const remaining = text.slice(lastIndex);
136
- if (remaining) {
137
- result.push({ text: remaining, color: currentColor });
138
- }
139
-
140
- return result;
141
- }
142
-
143
- const parsedMessage = computed(() => parseAnsi(props.error?.message || ''));
144
- const parsedStack = computed(() => {
145
- if (!props.error?.stack) return [];
146
- return parseAnsi(`\n\nStack Trace:\n${props.error.stack}`);
147
- });
148
-
149
- // --- Lifecycle e Watchers (Animações) ---
150
- watch(() => props.isOpen, (newVal) => {
151
- if (newVal) {
152
- document.body.style.overflow = 'hidden';
153
- shouldRender.value = true;
154
- // Pequeno delay para garantir que o elemento exista antes da transição de opacidade
155
- setTimeout(() => { visible.value = true; }, 10);
156
- } else {
157
- document.body.style.overflow = '';
158
- visible.value = false;
159
- // Aguarda a transição de saída (300ms) para desmontar do DOM
160
- setTimeout(() => { shouldRender.value = false; }, 300);
161
- }
162
- }, { immediate: true });
163
-
164
- // Listener para tecla ESC
165
- const onKey = (e) => {
166
- if (e.key === 'Escape' && props.isOpen) emit('close');
167
- };
168
-
169
- onMounted(() => {
170
- if (props.isOpen) document.body.style.overflow = 'hidden';
171
- window.addEventListener('keydown', onKey);
172
- });
173
-
174
- onUnmounted(() => {
175
- document.body.style.overflow = '';
176
- window.removeEventListener('keydown', onKey);
177
- });
178
-
179
- // --- Ações ---
180
- const close = () => emit('close');
181
- const copy = () => emit('copy');
182
-
183
- // --- Estilos ---
184
- const overlayStyle = computed(() => ({
185
- position: 'fixed',
186
- top: 0,
187
- left: 0,
188
- width: '100vw',
189
- height: '100vh',
190
- zIndex: 2147483647,
191
- background: visible.value ? 'rgba(0, 0, 0, 0.95)' : 'rgba(0, 0, 0, 0)',
192
- backdropFilter: 'blur(12px)',
193
- WebkitBackdropFilter: 'blur(12px)',
194
- display: 'flex',
195
- alignItems: 'center',
196
- justifyContent: 'center',
197
- padding: '24px',
198
- transition: 'all 0.3s ease',
199
- opacity: visible.value ? 1 : 0,
200
- boxSizing: 'border-box',
201
- }));
202
-
203
- const cardStyle = computed(() => ({
204
- width: '100%',
205
- maxWidth: '1080px',
206
- maxHeight: '90vh',
207
- display: 'flex',
208
- flexDirection: 'column',
209
- background: '#0a0a0a',
210
- boxShadow: `0 0 0 1px rgba(255, 255, 255, 0.1), 0 50px 100px -20px rgba(0, 0, 0, 1)`,
211
- borderRadius: '16px',
212
- overflow: 'hidden',
213
- transform: visible.value ? 'scale(1) translateY(0)' : 'scale(0.98) translateY(10px)',
214
- transition: 'transform 0.4s cubic-bezier(0.16, 1, 0.3, 1)',
215
- position: 'relative',
216
- }));
217
-
218
- const neonLineStyle = {
219
- height: '1px',
220
- width: '100%',
221
- background: `linear-gradient(90deg, transparent, #334155, #ffffff, #334155, transparent)`,
222
- boxShadow: `0 0 15px rgba(255, 255, 255, 0.05)`,
223
- };
224
-
225
- const headerStyle = {
226
- padding: '16px 24px',
227
- display: 'flex',
228
- justifyContent: 'space-between',
229
- alignItems: 'center',
230
- borderBottom: '1px solid rgba(255,255,255,0.06)',
231
- background: 'rgba(255,255,255,0.01)'
232
- };
233
-
234
- const errorBadgeStyle = {
235
- fontSize: '11px',
236
- fontWeight: 900,
237
- color: '#ffffff',
238
- background: '#ef4444',
239
- padding: '2px 8px',
240
- borderRadius: '4px',
241
- letterSpacing: '0.05em'
242
- };
243
-
244
- const pluginBadgeStyle = {
245
- fontSize: '11px',
246
- color: '#64748b',
247
- background: 'rgba(255, 255, 255, 0.03)',
248
- padding: '2px 8px',
249
- borderRadius: '4px',
250
- fontFamily: 'monospace',
251
- border: '1px solid rgba(255, 255, 255, 0.05)'
252
- };
253
-
254
- const terminalContentStyle = {
255
- padding: '24px',
256
- overflow: 'auto',
257
- flex: 1,
258
- fontFamily: '"JetBrains Mono", monospace',
259
- fontSize: '13px',
260
- lineHeight: 1.6,
261
- color: '#e2e8f0',
262
- whiteSpace: 'pre-wrap',
263
- wordBreak: 'break-word',
264
- };
265
-
266
- const stackContainerStyle = {
267
- marginTop: '24px',
268
- opacity: 0.4,
269
- borderTop: '1px dashed rgba(255,255,255,0.1)',
270
- paddingTop: '16px'
271
- };
272
-
273
- const footerStyle = {
274
- padding: '10px 24px',
275
- background: 'rgba(255,255,255,0.01)',
276
- borderTop: '1px solid rgba(255,255,255,0.03)',
277
- display: 'flex',
278
- justifyContent: 'space-between',
279
- fontSize: '11px',
280
- color: 'rgba(255,255,255,0.3)',
281
- fontFamily: 'Inter, sans-serif'
282
- };
283
-
284
- const getBtnStyle = (kind, hovering) => {
285
- const base = {
286
- padding: '8px 16px',
287
- borderRadius: '8px',
288
- fontSize: '11px',
289
- fontWeight: 700,
290
- cursor: 'pointer',
291
- transition: 'all 0.2s ease',
292
- textTransform: 'uppercase',
293
- letterSpacing: '0.05em',
294
- border: 'none',
295
- outline: 'none',
296
- fontFamily: 'Inter, system-ui, sans-serif'
297
- };
298
- if (kind === 'primary') {
299
- return {
300
- ...base,
301
- background: hovering ? '#ffffff' : '#f1f5f9',
302
- color: '#000000',
303
- boxShadow: hovering ? `0 0 15px rgba(255, 255, 255, 0.2)` : 'none',
304
- };
305
- }
306
- return {
307
- ...base,
308
- background: hovering ? 'rgba(255, 255, 255, 0.08)' : 'transparent',
309
- color: hovering ? '#fff' : 'rgba(255, 255, 255, 0.4)',
310
- border: '1px solid transparent',
311
- borderColor: hovering ? 'rgba(255, 255, 255, 0.1)' : 'transparent',
312
- };
313
- };
314
-
315
- const copyButtonStyle = computed(() => getBtnStyle('secondary', isHoveringCopy.value));
316
- const closeButtonStyle = computed(() => getBtnStyle('primary', isHoveringClose.value));
317
- </script>
@@ -1,9 +0,0 @@
1
- import Link from "./Link.vue";
2
- export { Link };
3
- export { RouteConfig, Metadata } from "../types";
4
- export { router } from '../client/clientRouter';
5
- export { requireDynamic } from '../client/requireDynamic';
6
- export { importServer } from '../client/rpc';
7
- export { importPhpServer } from '../client/rpcPhp';
8
- export { default as Image } from "./image/Image.vue";
9
- export { default as VattsImage } from "./image/Image.vue";
@@ -1,110 +0,0 @@
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
- /*
7
- * This file is part of the Vatts.js Project.
8
- * Copyright (c) 2026 mfraz
9
- *
10
- * Licensed under the Apache License, Version 2.0 (the "License");
11
- * you may not use this file except in compliance with the License.
12
- * You may obtain a copy of the License at
13
- *
14
- * http://www.apache.org/licenses/LICENSE-2.0
15
- *
16
- * Unless required by applicable law or agreed to in writing, software
17
- * distributed under the License is distributed on an "AS IS" BASIS,
18
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
- * See the License for the specific language governing permissions and
20
- * limitations under the License.
21
- */
22
- const vue_1 = require("vue");
23
- const App_vue_1 = __importDefault(require("./App.vue"));
24
- // --- Inicialização do Cliente (CSR - Client-Side Rendering) ---
25
- function deobfuscateData(obfuscated) {
26
- try {
27
- const parts = obfuscated.split('.');
28
- const base64 = parts.length > 1 ? parts[1] : parts[0];
29
- const jsonStr = atob(base64);
30
- return JSON.parse(jsonStr);
31
- }
32
- catch (error) {
33
- console.error('[Vatts] Failed to decode data:', error);
34
- return null;
35
- }
36
- }
37
- function initializeClient() {
38
- try {
39
- const dataElement = document.getElementById('__vatts_data__');
40
- if (!dataElement) {
41
- console.error('[Vatts] Initial data script not found (#__vatts_data__).');
42
- return;
43
- }
44
- const obfuscated = dataElement.getAttribute('data-h');
45
- if (!obfuscated) {
46
- console.error('[Vatts] Data attribute not found.');
47
- return;
48
- }
49
- const initialData = deobfuscateData(obfuscated);
50
- if (!initialData) {
51
- console.error('[Vatts] Failed to parse initial data.');
52
- return;
53
- }
54
- const componentMap = {};
55
- if (window.__VATTS_COMPONENTS__) {
56
- Object.assign(componentMap, window.__VATTS_COMPONENTS__);
57
- }
58
- else {
59
- console.warn('[Vatts] No components found in window.__VATTS_COMPONENTS__');
60
- }
61
- const container = document.getElementById('root');
62
- if (!container) {
63
- console.error('[Vatts] Container #root not found.');
64
- return;
65
- }
66
- // --- CORREÇÃO DO HOT RELOAD (Vue Version) ---
67
- if (window.__VATTS_APP__) {
68
- try {
69
- // Desmonta a instância anterior do Vue
70
- window.__VATTS_APP__.unmount();
71
- container.innerHTML = '';
72
- }
73
- catch (e) {
74
- console.warn('[Vatts] Warning during unmount:', e);
75
- }
76
- }
77
- // Cria a instância do Vue
78
- const app = (0, vue_1.createApp)(App_vue_1.default, {
79
- componentMap,
80
- routes: initialData.routes,
81
- initialComponentPath: initialData.initialComponentPath,
82
- initialParams: initialData.initialParams,
83
- layoutComponent: window.__VATTS_LAYOUT__
84
- });
85
- // Salva a referência globalmente
86
- window.__VATTS_APP__ = app;
87
- // Monta no elemento #root
88
- app.mount(container);
89
- }
90
- catch (error) {
91
- console.error('[Vatts] Critical Error rendering application:', error);
92
- if (typeof document !== 'undefined') {
93
- document.body.innerHTML = `
94
- <div style="font-family: monospace; padding: 20px; color: #ff4444; background: #1a1a1a; min-height: 100vh;">
95
- <h1>Vatts Client Error (Vue)</h1>
96
- <p>A critical error occurred while initializing the application.</p>
97
- <pre style="background: #000; padding: 15px; border-radius: 5px; overflow: auto;">${error?.message || error}</pre>
98
- <pre style="color: #666; font-size: 12px; margin-top: 10px;">${error?.stack || ''}</pre>
99
- </div>
100
- `;
101
- }
102
- }
103
- }
104
- // Executa quando o DOM estiver pronto
105
- if (document.readyState === 'loading') {
106
- document.addEventListener('DOMContentLoaded', initializeClient);
107
- }
108
- else {
109
- setTimeout(initializeClient, 0);
110
- }