vatts 2.2.5 → 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 (64) hide show
  1. package/README.md +3 -3
  2. package/dist/builder.js +54 -17
  3. package/dist/frameworks/FrontCore.d.ts +34 -0
  4. package/dist/frameworks/FrontCore.js +128 -0
  5. package/dist/{vue → frameworks/builds}/vue.build.js +1 -1
  6. package/dist/frameworks/react/client.d.ts +8 -0
  7. package/dist/{react → frameworks/react}/client.js +14 -14
  8. package/dist/{react → frameworks/react/components}/Link.js +2 -2
  9. package/dist/frameworks/react/entry.client.d.ts +14 -0
  10. package/dist/frameworks/react/entry.client.js +211 -0
  11. package/dist/frameworks/react/react-elements.d.ts +10 -0
  12. package/dist/{react → frameworks/renderers}/renderer-react.d.ts +2 -2
  13. package/dist/{react → frameworks/renderers}/renderer-react.js +34 -68
  14. package/dist/{vue → frameworks/renderers}/renderer.vue.d.ts +2 -2
  15. package/dist/frameworks/renderers/renderer.vue.js +193 -0
  16. package/dist/frameworks/themes/BuildingPage.d.ts +1 -0
  17. package/dist/frameworks/themes/BuildingPage.js +312 -0
  18. package/dist/frameworks/themes/DefaultNotFound.d.ts +1 -0
  19. package/dist/frameworks/themes/DefaultNotFound.js +330 -0
  20. package/dist/frameworks/themes/ErrorModal.d.ts +1 -0
  21. package/dist/frameworks/themes/ErrorModal.js +345 -0
  22. package/dist/frameworks/themes/ServerError.d.ts +1 -0
  23. package/dist/frameworks/themes/ServerError.js +401 -0
  24. package/dist/frameworks/themes/VattsDevBadge.d.ts +1 -0
  25. package/dist/frameworks/themes/VattsDevBadge.js +232 -0
  26. package/dist/frameworks/vue/App.vue +149 -0
  27. package/dist/frameworks/vue/client.d.ts +9 -0
  28. package/dist/{vue → frameworks/vue}/client.js +13 -11
  29. package/dist/{vue → frameworks/vue/components}/Link.vue +1 -1
  30. package/dist/frameworks/vue/entry.client.js +75 -0
  31. package/dist/global/global.d.ts +1 -2
  32. package/dist/index.js +12 -1
  33. package/dist/renderer.js +2 -2
  34. package/package.json +10 -26
  35. package/dist/react/BuildingPage.d.ts +0 -2
  36. package/dist/react/BuildingPage.js +0 -270
  37. package/dist/react/DefaultNotFound.d.ts +0 -2
  38. package/dist/react/DefaultNotFound.js +0 -248
  39. package/dist/react/DevIndicator.d.ts +0 -5
  40. package/dist/react/DevIndicator.js +0 -203
  41. package/dist/react/ErrorModal.d.ts +0 -20
  42. package/dist/react/ErrorModal.js +0 -266
  43. package/dist/react/client.d.ts +0 -8
  44. package/dist/react/entry.client.d.ts +0 -6
  45. package/dist/react/entry.client.js +0 -325
  46. package/dist/react/server-error.d.ts +0 -8
  47. package/dist/react/server-error.js +0 -346
  48. package/dist/vue/App.vue +0 -199
  49. package/dist/vue/BuildingPage.vue +0 -281
  50. package/dist/vue/DefaultNotFound.vue +0 -329
  51. package/dist/vue/DevIndicator.vue +0 -226
  52. package/dist/vue/ErrorModal.vue +0 -317
  53. package/dist/vue/client.d.ts +0 -9
  54. package/dist/vue/entry.client.js +0 -110
  55. package/dist/vue/renderer.vue.js +0 -387
  56. package/dist/vue/server-error.vue +0 -351
  57. /package/dist/{react → frameworks/builds}/react.build.d.ts +0 -0
  58. /package/dist/{react → frameworks/builds}/react.build.js +0 -0
  59. /package/dist/{vue → frameworks/builds}/vue.build.d.ts +0 -0
  60. /package/dist/{react → frameworks/react/components}/Link.d.ts +0 -0
  61. /package/dist/{react → frameworks/react/components}/image/Image.d.ts +0 -0
  62. /package/dist/{react → frameworks/react/components}/image/Image.js +0 -0
  63. /package/dist/{vue → frameworks/vue/components}/image/Image.vue +0 -0
  64. /package/dist/{vue → frameworks/vue}/entry.client.d.ts +0 -0
@@ -0,0 +1,345 @@
1
+ "use strict";
2
+ /*
3
+ * This file is part of the Vatts.js Project.
4
+ * Copyright (c) 2026 mfraz
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ class VattsErrorModal extends HTMLElement {
20
+ constructor() {
21
+ super();
22
+ this._error = null;
23
+ this._isOpen = false;
24
+ this.handleKeyDown = this.handleKeyDown.bind(this);
25
+ this.closeModal = this.closeModal.bind(this);
26
+ this.copyLog = this.copyLog.bind(this);
27
+ }
28
+ set error(val) {
29
+ this._error = val;
30
+ this.render();
31
+ }
32
+ get error() {
33
+ return this._error;
34
+ }
35
+ set isOpen(val) {
36
+ this._isOpen = val;
37
+ if (val) {
38
+ document.body.style.overflow = 'hidden';
39
+ window.addEventListener('keydown', this.handleKeyDown);
40
+ }
41
+ else {
42
+ document.body.style.overflow = '';
43
+ window.removeEventListener('keydown', this.handleKeyDown);
44
+ }
45
+ this.render();
46
+ }
47
+ get isOpen() {
48
+ return this._isOpen;
49
+ }
50
+ handleKeyDown(e) {
51
+ if (e.key === 'Escape' && this._isOpen) {
52
+ this.closeModal();
53
+ }
54
+ }
55
+ closeModal() {
56
+ this.dispatchEvent(new CustomEvent('close-modal', { bubbles: true, composed: true }));
57
+ }
58
+ copyLog() {
59
+ this.dispatchEvent(new CustomEvent('copy-log', { bubbles: true, composed: true }));
60
+ }
61
+ parseAnsi(text) {
62
+ if (!text)
63
+ return '';
64
+ const ANSI_COLORS = {
65
+ '30': '#71717a', '31': '#ef4444', '32': '#22c55e',
66
+ '33': '#eab308', '34': '#3b82f6', '35': '#d946ef',
67
+ '36': '#06b6d4', '37': '#f4f4f5', '90': '#52525b',
68
+ };
69
+ const regex = /\u001b\[(\d+)(?:;\d+)*m/g;
70
+ let result = '';
71
+ let lastIndex = 0;
72
+ let match;
73
+ let currentColor = null;
74
+ while ((match = regex.exec(text)) !== null) {
75
+ const rawText = text.slice(lastIndex, match.index);
76
+ if (rawText) {
77
+ result += currentColor ? `<span style="color: ${currentColor}">${this.escapeHtml(rawText)}</span>` : this.escapeHtml(rawText);
78
+ }
79
+ const code = match[1];
80
+ if (code === '39' || code === '0') {
81
+ currentColor = null;
82
+ }
83
+ else if (ANSI_COLORS[code]) {
84
+ currentColor = ANSI_COLORS[code];
85
+ }
86
+ lastIndex = regex.lastIndex;
87
+ }
88
+ const remaining = text.slice(lastIndex);
89
+ if (remaining) {
90
+ result += currentColor ? `<span style="color: ${currentColor}">${this.escapeHtml(remaining)}</span>` : this.escapeHtml(remaining);
91
+ }
92
+ return result;
93
+ }
94
+ escapeHtml(unsafe) {
95
+ return unsafe
96
+ .replace(/&/g, "&amp;")
97
+ .replace(/</g, "&lt;")
98
+ .replace(/>/g, "&gt;")
99
+ .replace(/"/g, "&quot;")
100
+ .replace(/'/g, "&#039;");
101
+ }
102
+ render() {
103
+ if (!this._isOpen || !this._error) {
104
+ this.innerHTML = '';
105
+ return;
106
+ }
107
+ const rawOutput = this._error.message || '';
108
+ const stackOutput = this._error.stack ? `\n\nStack Trace:\n${this._error.stack}` : '';
109
+ const parsedMessage = this.parseAnsi(rawOutput);
110
+ const parsedStack = this.parseAnsi(stackOutput);
111
+ this.innerHTML = `
112
+ <style>
113
+ .vatts-modal-overlay {
114
+ position: fixed;
115
+ top: 0; left: 0;
116
+ width: 100vw; height: 100vh;
117
+ z-index: 2147483647;
118
+ background: rgba(0, 0, 0, 0.85);
119
+ backdrop-filter: blur(8px);
120
+ -webkit-backdrop-filter: blur(8px);
121
+ display: flex;
122
+ align-items: center;
123
+ justify-content: center;
124
+ padding: 24px;
125
+ box-sizing: border-box;
126
+ animation: fadeIn 0.2s ease-out;
127
+ }
128
+
129
+ @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
130
+ @keyframes scaleUp { from { transform: scale(0.98) translateY(10px); } to { transform: scale(1) translateY(0); } }
131
+
132
+ /* BORDA FAKE DE 3PX COM GRADIENTE ESCURO */
133
+ .vatts-card-wrapper {
134
+ width: 100%;
135
+ max-width: 960px;
136
+ max-height: 90vh; /* Controla o tamanho máximo para não vazar a tela */
137
+ padding: 3px;
138
+ border-radius: 16px;
139
+ background: linear-gradient(135deg, rgb(24, 24, 27), rgb(39, 39, 42), transparent);
140
+ display: flex;
141
+ flex-direction: column;
142
+ animation: scaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
143
+ }
144
+
145
+ /* CARD PRINCIPAL SEM BORDAS E SEM SHADOWS */
146
+ .vatts-modal-card {
147
+ background: #0a0a0c;
148
+ border-radius: 13px;
149
+ display: flex;
150
+ flex-direction: column;
151
+ flex: 1;
152
+ min-height: 0; /* Essencial para o scroll interno funcionar */
153
+ overflow: hidden;
154
+ border: none;
155
+ box-shadow: none;
156
+ }
157
+
158
+ .vatts-modal-header {
159
+ padding: 24px 32px;
160
+ display: flex;
161
+ justify-content: space-between;
162
+ align-items: center;
163
+ border-bottom: 1px solid rgba(255, 255, 255, 0.03);
164
+ }
165
+
166
+ .vatts-header-left {
167
+ display: flex;
168
+ align-items: center;
169
+ gap: 16px;
170
+ }
171
+
172
+ .vatts-badge-error {
173
+ font-size: 12px;
174
+ font-weight: 900;
175
+ color: #ffffff;
176
+ background: #ef4444;
177
+ padding: 4px 10px;
178
+ border-radius: 6px;
179
+ letter-spacing: 0.05em;
180
+ }
181
+
182
+ .vatts-badge-plugin {
183
+ font-size: 12px;
184
+ color: #a1a1aa;
185
+ background: #18181b;
186
+ padding: 4px 10px;
187
+ border-radius: 6px;
188
+ font-family: 'JetBrains Mono', monospace;
189
+ }
190
+
191
+ /* ÁREA DO TERMINAL COMPLETAMENTE REFEITA PARA VISIBILIDADE */
192
+ .vatts-terminal-container {
193
+ flex: 1;
194
+ min-height: 0;
195
+ padding: 0 32px 32px 32px;
196
+ overflow-y: auto;
197
+ display: flex;
198
+ flex-direction: column;
199
+ }
200
+
201
+ /* Custom Scrollbar pro Terminal */
202
+ .vatts-terminal-container::-webkit-scrollbar {
203
+ width: 10px;
204
+ }
205
+ .vatts-terminal-container::-webkit-scrollbar-track {
206
+ background: transparent;
207
+ }
208
+ .vatts-terminal-container::-webkit-scrollbar-thumb {
209
+ background: #27272a;
210
+ border-radius: 10px;
211
+ border: 3px solid #0a0a0c; /* Borda da mesma cor do fundo para dar espaçamento */
212
+ }
213
+ .vatts-terminal-container::-webkit-scrollbar-thumb:hover {
214
+ background: #3f3f46;
215
+ }
216
+
217
+ .vatts-terminal {
218
+ background: #050505;
219
+ border-radius: 8px;
220
+ padding: 24px;
221
+ margin-top: 24px;
222
+ font-family: "JetBrains Mono", monospace;
223
+ font-size: 13px;
224
+ line-height: 1.6;
225
+ color: #f4f4f5;
226
+ white-space: pre-wrap;
227
+ word-break: break-word;
228
+ flex: 1;
229
+ }
230
+
231
+ .vatts-stack {
232
+ margin-top: 24px;
233
+ padding-top: 24px;
234
+ border-top: 1px dashed rgba(255, 255, 255, 0.1);
235
+ color: #a1a1aa;
236
+ }
237
+
238
+ .vatts-footer {
239
+ padding: 16px 32px;
240
+ background: transparent;
241
+ display: flex;
242
+ justify-content: space-between;
243
+ align-items: center;
244
+ border-top: 1px solid rgba(255, 255, 255, 0.03);
245
+ font-size: 12px;
246
+ color: #71717a;
247
+ font-family: 'Inter', sans-serif;
248
+ }
249
+
250
+ .vatts-btn-group {
251
+ display: flex;
252
+ gap: 12px;
253
+ }
254
+
255
+ .vatts-btn {
256
+ display: flex;
257
+ align-items: center;
258
+ justify-content: center;
259
+ gap: 8px;
260
+ padding: 10px 20px;
261
+ border-radius: 8px;
262
+ font-size: 12px;
263
+ font-weight: 600;
264
+ cursor: pointer;
265
+ transition: all 0.2s ease;
266
+ border: none;
267
+ outline: none;
268
+ font-family: 'Inter', system-ui, sans-serif;
269
+ }
270
+
271
+ .vatts-btn-primary {
272
+ background: #ffffff;
273
+ color: #000000;
274
+ }
275
+ .vatts-btn-primary:hover {
276
+ opacity: 0.85;
277
+ transform: translateY(-1px);
278
+ }
279
+
280
+ .vatts-btn-secondary {
281
+ background: #18181b;
282
+ color: #ffffff;
283
+ }
284
+ .vatts-btn-secondary:hover {
285
+ background: #27272a;
286
+ }
287
+ </style>
288
+
289
+ <div class="vatts-modal-overlay" id="vatts-overlay">
290
+ <div class="vatts-card-wrapper" id="vatts-card-wrapper">
291
+ <div class="vatts-modal-card" id="vatts-card">
292
+
293
+ <div class="vatts-modal-header">
294
+ <div class="vatts-header-left">
295
+ <span class="vatts-badge-error">BUILD ERROR</span>
296
+ ${this._error.plugin ? `<span class="vatts-badge-plugin">${this._error.plugin}</span>` : ''}
297
+ </div>
298
+
299
+ <div class="vatts-btn-group">
300
+ <button class="vatts-btn vatts-btn-secondary" id="vatts-copy-btn">
301
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>
302
+ Copy Log
303
+ </button>
304
+ <button class="vatts-btn vatts-btn-primary" id="vatts-close-btn">
305
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
306
+ Close
307
+ </button>
308
+ </div>
309
+ </div>
310
+
311
+ <div class="vatts-terminal-container">
312
+ <div class="vatts-terminal">
313
+ ${parsedMessage}
314
+ ${parsedStack ? `<div class="vatts-stack">${parsedStack}</div>` : ''}
315
+ </div>
316
+ </div>
317
+
318
+ <div class="vatts-footer">
319
+ <div style="display: flex; align-items: center; gap: 8px;">
320
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 2v6h-6"></path><path d="M3 12a9 9 0 0 1 15-6.7L21 8"></path><path d="M3 22v-6h6"></path><path d="M21 12a9 9 0 0 1-15 6.7L3 16"></path></svg>
321
+ <span>vatts-cli</span>
322
+ </div>
323
+ <span>Waiting for file changes to rebuild...</span>
324
+ </div>
325
+ </div>
326
+ </div>
327
+ </div>
328
+ `;
329
+ const overlay = this.querySelector('#vatts-overlay');
330
+ const cardWrapper = this.querySelector('#vatts-card-wrapper');
331
+ const closeBtn = this.querySelector('#vatts-close-btn');
332
+ const copyBtn = this.querySelector('#vatts-copy-btn');
333
+ if (overlay)
334
+ overlay.addEventListener('mousedown', this.closeModal);
335
+ if (cardWrapper)
336
+ cardWrapper.addEventListener('mousedown', (e) => e.stopPropagation());
337
+ if (closeBtn)
338
+ closeBtn.addEventListener('click', this.closeModal);
339
+ if (copyBtn)
340
+ copyBtn.addEventListener('click', this.copyLog);
341
+ }
342
+ }
343
+ if (typeof window !== 'undefined' && !customElements.get('vatts-error-modal')) {
344
+ customElements.define('vatts-error-modal', VattsErrorModal);
345
+ }
@@ -0,0 +1 @@
1
+ export function getServerErrorHtml(options?: {}): string;