@vistagenic/vista 0.2.16 → 0.3.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.
- package/bin/vista.js +184 -177
- package/dist/ai/agent.d.ts +37 -0
- package/dist/ai/agent.js +385 -0
- package/dist/ai/embeddings.d.ts +11 -0
- package/dist/ai/embeddings.js +71 -0
- package/dist/ai/index.d.ts +10 -0
- package/dist/ai/index.js +26 -0
- package/dist/ai/memory.d.ts +16 -0
- package/dist/ai/memory.js +39 -0
- package/dist/ai/observability.d.ts +21 -0
- package/dist/ai/observability.js +69 -0
- package/dist/ai/providers/anthropic.d.ts +2 -0
- package/dist/ai/providers/anthropic.js +190 -0
- package/dist/ai/providers/base.d.ts +7 -0
- package/dist/ai/providers/base.js +85 -0
- package/dist/ai/providers/gemini.d.ts +2 -0
- package/dist/ai/providers/gemini.js +194 -0
- package/dist/ai/providers/index.d.ts +5 -0
- package/dist/ai/providers/index.js +21 -0
- package/dist/ai/providers/mock.d.ts +8 -0
- package/dist/ai/providers/mock.js +77 -0
- package/dist/ai/providers/openai.d.ts +2 -0
- package/dist/ai/providers/openai.js +211 -0
- package/dist/ai/rag.d.ts +35 -0
- package/dist/ai/rag.js +110 -0
- package/dist/ai/react/index.d.ts +1 -0
- package/dist/ai/react/index.js +17 -0
- package/dist/ai/react/react-server.d.ts +1 -0
- package/dist/ai/react/react-server.js +17 -0
- package/dist/ai/react/use-agent.d.ts +23 -0
- package/dist/ai/react/use-agent.js +138 -0
- package/dist/ai/stream.d.ts +24 -0
- package/dist/ai/stream.js +109 -0
- package/dist/ai/tool.d.ts +11 -0
- package/dist/ai/tool.js +47 -0
- package/dist/ai/types.d.ts +117 -0
- package/dist/ai/types.js +5 -0
- package/dist/auth/core.d.ts +140 -0
- package/dist/auth/core.js +165 -0
- package/dist/auth/index.d.ts +20 -8
- package/dist/auth/index.js +369 -16
- package/dist/auth/react-server.d.ts +1 -0
- package/dist/auth/react-server.js +10 -0
- package/dist/auth/react.d.ts +18 -0
- package/dist/auth/react.js +71 -0
- package/dist/bin/build-rsc.js +602 -604
- package/dist/bin/build.js +389 -388
- package/dist/bin/deploy-output.d.ts +2 -7
- package/dist/bin/deploy-output.js +3 -76
- package/dist/bin/deploy.d.ts +7 -0
- package/dist/bin/deploy.js +102 -0
- package/dist/bin/dev-error-overlay-snippet.js +552 -552
- package/dist/bin/devtools-indicator-snippet.js +387 -387
- package/dist/bin/generate.js +510 -248
- package/dist/build/manifest.d.ts +169 -139
- package/dist/build/manifest.js +423 -367
- package/dist/build/rsc/client-manifest.d.ts +62 -52
- package/dist/build/rsc/client-manifest.js +295 -193
- package/dist/build/rsc/client-reference-plugin.d.ts +37 -37
- package/dist/build/rsc/client-reference-plugin.js +160 -160
- package/dist/build/rsc/native-scanner.d.ts +135 -123
- package/dist/build/rsc/native-scanner.js +203 -170
- package/dist/build/rsc/react-client-reference-manifest.d.ts +28 -22
- package/dist/build/rsc/react-client-reference-manifest.js +240 -219
- package/dist/build/rsc/rsc-renderer.d.ts +99 -99
- package/dist/build/rsc/rsc-renderer.js +263 -263
- package/dist/build/rsc/server-component-loader.d.ts +19 -19
- package/dist/build/rsc/server-component-loader.js +91 -91
- package/dist/build/rsc/server-manifest.d.ts +17 -0
- package/dist/build/rsc/server-manifest.js +20 -0
- package/dist/build/standalone.js +337 -334
- package/dist/build/webpack/plugins/vista-flight-plugin.js +5 -5
- package/dist/client/dynamic.react-server.d.ts +2 -0
- package/dist/client/dynamic.react-server.js +23 -0
- package/dist/client/link.react-server.d.ts +2 -0
- package/dist/client/link.react-server.js +11 -0
- package/dist/client/navigation.react-server.d.ts +1 -0
- package/dist/client/navigation.react-server.js +17 -0
- package/dist/client/router.react-server.d.ts +1 -0
- package/dist/client/router.react-server.js +17 -0
- package/dist/client/rsc-router.react-server.d.ts +1 -0
- package/dist/client/rsc-router.react-server.js +17 -0
- package/dist/client/script.react-server.d.ts +2 -0
- package/dist/client/script.react-server.js +23 -0
- package/dist/components/client-island.d.ts +34 -34
- package/dist/components/client-island.js +75 -75
- package/dist/config.d.ts +17 -0
- package/dist/config.js +60 -1
- package/dist/deploy/adapters/cloudflare.d.ts +2 -0
- package/dist/deploy/adapters/cloudflare.js +124 -0
- package/dist/deploy/adapters/docker.d.ts +2 -0
- package/dist/deploy/adapters/docker.js +112 -0
- package/dist/deploy/adapters/index.d.ts +15 -0
- package/dist/deploy/adapters/index.js +24 -0
- package/dist/deploy/adapters/netlify.d.ts +2 -0
- package/dist/deploy/adapters/netlify.js +115 -0
- package/dist/deploy/adapters/render.d.ts +2 -0
- package/dist/deploy/adapters/render.js +95 -0
- package/dist/deploy/adapters/vercel.d.ts +7 -0
- package/dist/deploy/adapters/vercel.js +164 -0
- package/dist/deploy/cli-runner.d.ts +8 -0
- package/dist/deploy/cli-runner.js +58 -0
- package/dist/deploy/detect.d.ts +6 -0
- package/dist/deploy/detect.js +77 -0
- package/dist/deploy/index.d.ts +24 -0
- package/dist/deploy/index.js +112 -0
- package/dist/deploy/preflight.d.ts +8 -0
- package/dist/deploy/preflight.js +80 -0
- package/dist/deploy/types.d.ts +48 -0
- package/dist/deploy/types.js +2 -0
- package/dist/deploy/utils.d.ts +18 -0
- package/dist/deploy/utils.js +70 -0
- package/dist/dev-error.js +667 -667
- package/dist/index.d.ts +23 -21
- package/dist/index.js +61 -57
- package/dist/server/cookie-parse.d.ts +4 -0
- package/dist/server/cookie-parse.js +14 -0
- package/dist/server/engine.js +6 -19
- package/dist/server/index.d.ts +109 -102
- package/dist/server/index.js +315 -286
- package/dist/server/middleware-runner.d.ts +125 -57
- package/dist/server/middleware-runner.js +615 -218
- package/dist/server/middleware-security.d.ts +36 -0
- package/dist/server/middleware-security.js +183 -0
- package/dist/server/module-compile-hook.js +695 -662
- package/dist/server/route-handler-registry.d.ts +65 -0
- package/dist/server/route-handler-registry.js +195 -0
- package/dist/server/route-patterns.d.ts +67 -0
- package/dist/server/route-patterns.js +186 -0
- package/dist/server/rsc-engine.js +73 -80
- package/dist/server/rsc-module-system.d.ts +33 -33
- package/dist/server/rsc-module-system.js +87 -87
- package/dist/server/rsc-upstream.js +892 -888
- package/dist/server/static-generator.js +10 -10
- package/dist/server/typed-api-runtime.d.ts +18 -0
- package/dist/server/typed-api-runtime.js +635 -507
- package/dist/server/vista-import-map.js +134 -123
- package/dist/stack/index.d.ts +34 -32
- package/dist/stack/index.js +49 -45
- package/dist/stack/server/caller.d.ts +13 -0
- package/dist/stack/server/caller.js +42 -0
- package/dist/stack/server/executor.d.ts +40 -36
- package/dist/stack/server/executor.js +222 -174
- package/dist/stack/server/index.d.ts +11 -10
- package/dist/stack/server/index.js +24 -23
- package/dist/stack/server/procedure.d.ts +20 -18
- package/dist/stack/server/procedure.js +66 -58
- package/dist/stack/server/types.d.ts +113 -100
- package/dist/theme/react-server.d.ts +10 -0
- package/dist/theme/react-server.js +16 -0
- package/package.json +178 -153
- package/LICENSE +0 -21
package/dist/dev-error.js
CHANGED
|
@@ -18,317 +18,317 @@ const constants_1 = require("./constants");
|
|
|
18
18
|
// ============================================================================
|
|
19
19
|
// Styles + runtime helpers
|
|
20
20
|
// ============================================================================
|
|
21
|
-
const OVERLAY_STYLES = `
|
|
22
|
-
* { box-sizing: border-box; }
|
|
23
|
-
html, body {
|
|
24
|
-
margin: 0;
|
|
25
|
-
min-height: 100%;
|
|
26
|
-
background: #0c0d10;
|
|
27
|
-
color: #e8ebf1;
|
|
28
|
-
font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
29
|
-
}
|
|
30
|
-
body {
|
|
31
|
-
line-height: 1.45;
|
|
32
|
-
}
|
|
33
|
-
.vista-error-page-root {
|
|
34
|
-
min-height: 100vh;
|
|
35
|
-
position: relative;
|
|
36
|
-
display: flex;
|
|
37
|
-
align-items: center;
|
|
38
|
-
justify-content: center;
|
|
39
|
-
padding: 24px;
|
|
40
|
-
overflow: hidden;
|
|
41
|
-
}
|
|
42
|
-
.vista-error-page-root[data-embedded='true'] {
|
|
43
|
-
position: fixed;
|
|
44
|
-
inset: 0;
|
|
45
|
-
z-index: 2147483646;
|
|
46
|
-
}
|
|
47
|
-
.vista-error-backdrop {
|
|
48
|
-
position: absolute;
|
|
49
|
-
inset: 0;
|
|
50
|
-
background: radial-gradient(circle at top, rgba(255, 89, 60, 0.22), rgba(10, 11, 15, 0.94) 44%);
|
|
51
|
-
backdrop-filter: blur(5px);
|
|
52
|
-
}
|
|
53
|
-
.vista-error-panel {
|
|
54
|
-
position: relative;
|
|
55
|
-
width: min(980px, 100%);
|
|
56
|
-
max-height: min(86vh, 860px);
|
|
57
|
-
display: flex;
|
|
58
|
-
flex-direction: column;
|
|
59
|
-
border-radius: 16px;
|
|
60
|
-
overflow: hidden;
|
|
61
|
-
border: 1px solid rgba(255, 255, 255, 0.14);
|
|
62
|
-
background: linear-gradient(180deg, rgba(24, 27, 33, 0.97), rgba(9, 11, 15, 0.98));
|
|
63
|
-
box-shadow: 0 34px 92px rgba(0, 0, 0, 0.54);
|
|
64
|
-
animation: vista-overlay-in 170ms ease;
|
|
65
|
-
}
|
|
66
|
-
.vista-error-header {
|
|
67
|
-
display: flex;
|
|
68
|
-
justify-content: space-between;
|
|
69
|
-
align-items: flex-start;
|
|
70
|
-
gap: 14px;
|
|
71
|
-
padding: 15px 17px;
|
|
72
|
-
border-bottom: 1px solid rgba(255, 255, 255, 0.12);
|
|
73
|
-
background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
|
|
74
|
-
}
|
|
75
|
-
.vista-error-head-left {
|
|
76
|
-
min-width: 0;
|
|
77
|
-
display: flex;
|
|
78
|
-
flex-direction: column;
|
|
79
|
-
gap: 8px;
|
|
80
|
-
}
|
|
81
|
-
.vista-error-top-row {
|
|
82
|
-
display: flex;
|
|
83
|
-
align-items: center;
|
|
84
|
-
gap: 10px;
|
|
85
|
-
}
|
|
86
|
-
.vista-error-badge {
|
|
87
|
-
display: inline-flex;
|
|
88
|
-
align-items: center;
|
|
89
|
-
gap: 7px;
|
|
90
|
-
height: 24px;
|
|
91
|
-
padding: 0 10px;
|
|
92
|
-
border-radius: 999px;
|
|
93
|
-
border: 1px solid rgba(248, 113, 113, 0.48);
|
|
94
|
-
background: rgba(248, 113, 113, 0.14);
|
|
95
|
-
color: #fecaca;
|
|
96
|
-
font-size: 11px;
|
|
97
|
-
font-weight: 700;
|
|
98
|
-
letter-spacing: 0.07em;
|
|
99
|
-
text-transform: uppercase;
|
|
100
|
-
white-space: nowrap;
|
|
101
|
-
}
|
|
102
|
-
.vista-error-badge-dot {
|
|
103
|
-
width: 7px;
|
|
104
|
-
height: 7px;
|
|
105
|
-
border-radius: 999px;
|
|
106
|
-
background: #f87171;
|
|
107
|
-
box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.24);
|
|
108
|
-
}
|
|
109
|
-
.vista-error-pagination {
|
|
110
|
-
display: inline-flex;
|
|
111
|
-
align-items: center;
|
|
112
|
-
gap: 6px;
|
|
113
|
-
padding: 2px 3px;
|
|
114
|
-
border-radius: 999px;
|
|
115
|
-
border: 1px solid rgba(255, 255, 255, 0.18);
|
|
116
|
-
background: rgba(255, 255, 255, 0.04);
|
|
117
|
-
}
|
|
118
|
-
.vista-error-page-btn {
|
|
119
|
-
width: 22px;
|
|
120
|
-
height: 22px;
|
|
121
|
-
display: inline-flex;
|
|
122
|
-
align-items: center;
|
|
123
|
-
justify-content: center;
|
|
124
|
-
border: none;
|
|
125
|
-
border-radius: 999px;
|
|
126
|
-
background: rgba(255, 255, 255, 0.13);
|
|
127
|
-
color: #f8fafc;
|
|
128
|
-
font-size: 11px;
|
|
129
|
-
line-height: 1;
|
|
130
|
-
cursor: pointer;
|
|
131
|
-
}
|
|
132
|
-
.vista-error-page-btn:disabled {
|
|
133
|
-
opacity: 0.35;
|
|
134
|
-
cursor: not-allowed;
|
|
135
|
-
}
|
|
136
|
-
.vista-error-page-btn:not(:disabled):hover {
|
|
137
|
-
background: rgba(255, 255, 255, 0.24);
|
|
138
|
-
}
|
|
139
|
-
.vista-error-page-count {
|
|
140
|
-
min-width: 56px;
|
|
141
|
-
text-align: center;
|
|
142
|
-
font-size: 11px;
|
|
143
|
-
font-weight: 630;
|
|
144
|
-
color: rgba(241, 245, 249, 0.95);
|
|
145
|
-
font-variant-numeric: tabular-nums;
|
|
146
|
-
}
|
|
147
|
-
.vista-error-title {
|
|
148
|
-
margin: 0;
|
|
149
|
-
font-size: 18px;
|
|
150
|
-
line-height: 1.32;
|
|
151
|
-
font-weight: 640;
|
|
152
|
-
color: #f8fafc;
|
|
153
|
-
letter-spacing: 0.01em;
|
|
154
|
-
word-break: break-word;
|
|
155
|
-
}
|
|
156
|
-
.vista-error-meta {
|
|
157
|
-
margin: 0;
|
|
158
|
-
font-size: 12px;
|
|
159
|
-
color: rgba(226, 232, 240, 0.72);
|
|
160
|
-
}
|
|
161
|
-
.vista-error-controls {
|
|
162
|
-
display: flex;
|
|
163
|
-
align-items: center;
|
|
164
|
-
gap: 8px;
|
|
165
|
-
}
|
|
166
|
-
.vista-error-btn {
|
|
167
|
-
width: 30px;
|
|
168
|
-
height: 30px;
|
|
169
|
-
padding: 0;
|
|
170
|
-
border-radius: 9px;
|
|
171
|
-
border: 1px solid rgba(255, 255, 255, 0.22);
|
|
172
|
-
background: rgba(255, 255, 255, 0.04);
|
|
173
|
-
color: #e2e8f0;
|
|
174
|
-
display: inline-flex;
|
|
175
|
-
align-items: center;
|
|
176
|
-
justify-content: center;
|
|
177
|
-
cursor: pointer;
|
|
178
|
-
transition: all 120ms ease;
|
|
179
|
-
}
|
|
180
|
-
.vista-error-btn:hover {
|
|
181
|
-
background: rgba(255, 255, 255, 0.12);
|
|
182
|
-
border-color: rgba(255, 255, 255, 0.38);
|
|
183
|
-
}
|
|
184
|
-
.vista-error-btn svg {
|
|
185
|
-
width: 14px;
|
|
186
|
-
height: 14px;
|
|
187
|
-
display: block;
|
|
188
|
-
}
|
|
189
|
-
.vista-error-btn:focus-visible,
|
|
190
|
-
.vista-error-page-btn:focus-visible,
|
|
191
|
-
.vista-error-location:focus-visible {
|
|
192
|
-
outline: 2px solid rgba(255, 255, 255, 0.7);
|
|
193
|
-
outline-offset: 2px;
|
|
194
|
-
}
|
|
195
|
-
.vista-error-body {
|
|
196
|
-
padding: 16px 17px 17px;
|
|
197
|
-
overflow: auto;
|
|
198
|
-
display: grid;
|
|
199
|
-
grid-template-columns: 1fr;
|
|
200
|
-
gap: 11px;
|
|
201
|
-
}
|
|
202
|
-
.vista-error-card {
|
|
203
|
-
border: 1px solid rgba(255, 255, 255, 0.11);
|
|
204
|
-
border-radius: 11px;
|
|
205
|
-
background: rgba(255, 255, 255, 0.03);
|
|
206
|
-
padding: 12px;
|
|
207
|
-
}
|
|
208
|
-
.vista-error-card-title {
|
|
209
|
-
margin: 0 0 8px;
|
|
210
|
-
font-size: 11px;
|
|
211
|
-
letter-spacing: 0.08em;
|
|
212
|
-
text-transform: uppercase;
|
|
213
|
-
font-weight: 700;
|
|
214
|
-
color: rgba(226, 232, 240, 0.76);
|
|
215
|
-
}
|
|
216
|
-
.vista-error-pre {
|
|
217
|
-
margin: 0;
|
|
218
|
-
white-space: pre-wrap;
|
|
219
|
-
word-break: break-word;
|
|
220
|
-
font-size: 12.5px;
|
|
221
|
-
line-height: 1.58;
|
|
222
|
-
color: #f1f5f9;
|
|
223
|
-
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
224
|
-
}
|
|
225
|
-
.vista-error-tok-error { color: #fca5a5; font-weight: 640; }
|
|
226
|
-
.vista-error-tok-path { color: #93c5fd; }
|
|
227
|
-
.vista-error-tok-string { color: #86efac; }
|
|
228
|
-
.vista-error-tok-stack { color: #cbd5e1; }
|
|
229
|
-
.vista-error-tok-line { color: #fbbf24; }
|
|
230
|
-
.vista-error-tok-caret { color: #f87171; font-weight: 700; }
|
|
231
|
-
.vista-error-location {
|
|
232
|
-
width: 100%;
|
|
233
|
-
display: inline-flex;
|
|
234
|
-
align-items: center;
|
|
235
|
-
justify-content: flex-start;
|
|
236
|
-
border: 1px solid rgba(255, 255, 255, 0.16);
|
|
237
|
-
background: rgba(255, 255, 255, 0.04);
|
|
238
|
-
color: #93c5fd;
|
|
239
|
-
border-radius: 8px;
|
|
240
|
-
padding: 8px 10px;
|
|
241
|
-
font-size: 12px;
|
|
242
|
-
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
243
|
-
cursor: pointer;
|
|
244
|
-
}
|
|
245
|
-
.vista-error-location:hover {
|
|
246
|
-
background: rgba(255, 255, 255, 0.1);
|
|
247
|
-
}
|
|
248
|
-
.vista-error-page-root[data-minimized='true'] .vista-error-backdrop,
|
|
249
|
-
.vista-error-page-root[data-minimized='true'] .vista-error-panel {
|
|
250
|
-
display: none;
|
|
251
|
-
}
|
|
252
|
-
.vista-error-minimized-trigger {
|
|
253
|
-
position: fixed;
|
|
254
|
-
left: 28px;
|
|
255
|
-
bottom: 22px;
|
|
256
|
-
z-index: 2147483647;
|
|
257
|
-
height: 40px;
|
|
258
|
-
border-radius: 999px;
|
|
259
|
-
border: 1px solid rgba(248, 113, 113, 0.9);
|
|
260
|
-
background: rgba(53, 11, 16, 0.95);
|
|
261
|
-
color: #fecaca;
|
|
262
|
-
box-shadow: 0 10px 24px rgba(248, 113, 113, 0.24);
|
|
263
|
-
display: inline-flex;
|
|
264
|
-
align-items: center;
|
|
265
|
-
gap: 6px;
|
|
266
|
-
padding: 0 10px;
|
|
267
|
-
cursor: pointer;
|
|
268
|
-
}
|
|
269
|
-
.vista-error-minimized-trigger[hidden] {
|
|
270
|
-
display: none;
|
|
271
|
-
}
|
|
272
|
-
.vista-error-minimized-logo {
|
|
273
|
-
width: 14px;
|
|
274
|
-
height: 14px;
|
|
275
|
-
display: block;
|
|
276
|
-
}
|
|
277
|
-
.vista-error-minimized-close {
|
|
278
|
-
font-size: 12px;
|
|
279
|
-
line-height: 1;
|
|
280
|
-
color: #fca5a5;
|
|
281
|
-
}
|
|
282
|
-
.vista-error-minimized-count {
|
|
283
|
-
font-size: 11px;
|
|
284
|
-
font-weight: 670;
|
|
285
|
-
font-variant-numeric: tabular-nums;
|
|
286
|
-
}
|
|
287
|
-
@keyframes vista-overlay-in {
|
|
288
|
-
from { opacity: 0; transform: translateY(6px) scale(0.99); }
|
|
289
|
-
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
290
|
-
}
|
|
291
|
-
@media (max-width: 860px) {
|
|
292
|
-
.vista-error-page-root { padding: 12px; }
|
|
293
|
-
.vista-error-header { flex-direction: column; }
|
|
294
|
-
.vista-error-controls { width: 100%; justify-content: flex-end; }
|
|
295
|
-
.vista-error-title { font-size: 16px; }
|
|
296
|
-
.vista-error-minimized-trigger { left: 16px; bottom: 14px; }
|
|
297
|
-
}
|
|
21
|
+
const OVERLAY_STYLES = `
|
|
22
|
+
* { box-sizing: border-box; }
|
|
23
|
+
html, body {
|
|
24
|
+
margin: 0;
|
|
25
|
+
min-height: 100%;
|
|
26
|
+
background: #0c0d10;
|
|
27
|
+
color: #e8ebf1;
|
|
28
|
+
font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
29
|
+
}
|
|
30
|
+
body {
|
|
31
|
+
line-height: 1.45;
|
|
32
|
+
}
|
|
33
|
+
.vista-error-page-root {
|
|
34
|
+
min-height: 100vh;
|
|
35
|
+
position: relative;
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
padding: 24px;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
}
|
|
42
|
+
.vista-error-page-root[data-embedded='true'] {
|
|
43
|
+
position: fixed;
|
|
44
|
+
inset: 0;
|
|
45
|
+
z-index: 2147483646;
|
|
46
|
+
}
|
|
47
|
+
.vista-error-backdrop {
|
|
48
|
+
position: absolute;
|
|
49
|
+
inset: 0;
|
|
50
|
+
background: radial-gradient(circle at top, rgba(255, 89, 60, 0.22), rgba(10, 11, 15, 0.94) 44%);
|
|
51
|
+
backdrop-filter: blur(5px);
|
|
52
|
+
}
|
|
53
|
+
.vista-error-panel {
|
|
54
|
+
position: relative;
|
|
55
|
+
width: min(980px, 100%);
|
|
56
|
+
max-height: min(86vh, 860px);
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
border-radius: 16px;
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
border: 1px solid rgba(255, 255, 255, 0.14);
|
|
62
|
+
background: linear-gradient(180deg, rgba(24, 27, 33, 0.97), rgba(9, 11, 15, 0.98));
|
|
63
|
+
box-shadow: 0 34px 92px rgba(0, 0, 0, 0.54);
|
|
64
|
+
animation: vista-overlay-in 170ms ease;
|
|
65
|
+
}
|
|
66
|
+
.vista-error-header {
|
|
67
|
+
display: flex;
|
|
68
|
+
justify-content: space-between;
|
|
69
|
+
align-items: flex-start;
|
|
70
|
+
gap: 14px;
|
|
71
|
+
padding: 15px 17px;
|
|
72
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.12);
|
|
73
|
+
background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
|
|
74
|
+
}
|
|
75
|
+
.vista-error-head-left {
|
|
76
|
+
min-width: 0;
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
gap: 8px;
|
|
80
|
+
}
|
|
81
|
+
.vista-error-top-row {
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
gap: 10px;
|
|
85
|
+
}
|
|
86
|
+
.vista-error-badge {
|
|
87
|
+
display: inline-flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
gap: 7px;
|
|
90
|
+
height: 24px;
|
|
91
|
+
padding: 0 10px;
|
|
92
|
+
border-radius: 999px;
|
|
93
|
+
border: 1px solid rgba(248, 113, 113, 0.48);
|
|
94
|
+
background: rgba(248, 113, 113, 0.14);
|
|
95
|
+
color: #fecaca;
|
|
96
|
+
font-size: 11px;
|
|
97
|
+
font-weight: 700;
|
|
98
|
+
letter-spacing: 0.07em;
|
|
99
|
+
text-transform: uppercase;
|
|
100
|
+
white-space: nowrap;
|
|
101
|
+
}
|
|
102
|
+
.vista-error-badge-dot {
|
|
103
|
+
width: 7px;
|
|
104
|
+
height: 7px;
|
|
105
|
+
border-radius: 999px;
|
|
106
|
+
background: #f87171;
|
|
107
|
+
box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.24);
|
|
108
|
+
}
|
|
109
|
+
.vista-error-pagination {
|
|
110
|
+
display: inline-flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
gap: 6px;
|
|
113
|
+
padding: 2px 3px;
|
|
114
|
+
border-radius: 999px;
|
|
115
|
+
border: 1px solid rgba(255, 255, 255, 0.18);
|
|
116
|
+
background: rgba(255, 255, 255, 0.04);
|
|
117
|
+
}
|
|
118
|
+
.vista-error-page-btn {
|
|
119
|
+
width: 22px;
|
|
120
|
+
height: 22px;
|
|
121
|
+
display: inline-flex;
|
|
122
|
+
align-items: center;
|
|
123
|
+
justify-content: center;
|
|
124
|
+
border: none;
|
|
125
|
+
border-radius: 999px;
|
|
126
|
+
background: rgba(255, 255, 255, 0.13);
|
|
127
|
+
color: #f8fafc;
|
|
128
|
+
font-size: 11px;
|
|
129
|
+
line-height: 1;
|
|
130
|
+
cursor: pointer;
|
|
131
|
+
}
|
|
132
|
+
.vista-error-page-btn:disabled {
|
|
133
|
+
opacity: 0.35;
|
|
134
|
+
cursor: not-allowed;
|
|
135
|
+
}
|
|
136
|
+
.vista-error-page-btn:not(:disabled):hover {
|
|
137
|
+
background: rgba(255, 255, 255, 0.24);
|
|
138
|
+
}
|
|
139
|
+
.vista-error-page-count {
|
|
140
|
+
min-width: 56px;
|
|
141
|
+
text-align: center;
|
|
142
|
+
font-size: 11px;
|
|
143
|
+
font-weight: 630;
|
|
144
|
+
color: rgba(241, 245, 249, 0.95);
|
|
145
|
+
font-variant-numeric: tabular-nums;
|
|
146
|
+
}
|
|
147
|
+
.vista-error-title {
|
|
148
|
+
margin: 0;
|
|
149
|
+
font-size: 18px;
|
|
150
|
+
line-height: 1.32;
|
|
151
|
+
font-weight: 640;
|
|
152
|
+
color: #f8fafc;
|
|
153
|
+
letter-spacing: 0.01em;
|
|
154
|
+
word-break: break-word;
|
|
155
|
+
}
|
|
156
|
+
.vista-error-meta {
|
|
157
|
+
margin: 0;
|
|
158
|
+
font-size: 12px;
|
|
159
|
+
color: rgba(226, 232, 240, 0.72);
|
|
160
|
+
}
|
|
161
|
+
.vista-error-controls {
|
|
162
|
+
display: flex;
|
|
163
|
+
align-items: center;
|
|
164
|
+
gap: 8px;
|
|
165
|
+
}
|
|
166
|
+
.vista-error-btn {
|
|
167
|
+
width: 30px;
|
|
168
|
+
height: 30px;
|
|
169
|
+
padding: 0;
|
|
170
|
+
border-radius: 9px;
|
|
171
|
+
border: 1px solid rgba(255, 255, 255, 0.22);
|
|
172
|
+
background: rgba(255, 255, 255, 0.04);
|
|
173
|
+
color: #e2e8f0;
|
|
174
|
+
display: inline-flex;
|
|
175
|
+
align-items: center;
|
|
176
|
+
justify-content: center;
|
|
177
|
+
cursor: pointer;
|
|
178
|
+
transition: all 120ms ease;
|
|
179
|
+
}
|
|
180
|
+
.vista-error-btn:hover {
|
|
181
|
+
background: rgba(255, 255, 255, 0.12);
|
|
182
|
+
border-color: rgba(255, 255, 255, 0.38);
|
|
183
|
+
}
|
|
184
|
+
.vista-error-btn svg {
|
|
185
|
+
width: 14px;
|
|
186
|
+
height: 14px;
|
|
187
|
+
display: block;
|
|
188
|
+
}
|
|
189
|
+
.vista-error-btn:focus-visible,
|
|
190
|
+
.vista-error-page-btn:focus-visible,
|
|
191
|
+
.vista-error-location:focus-visible {
|
|
192
|
+
outline: 2px solid rgba(255, 255, 255, 0.7);
|
|
193
|
+
outline-offset: 2px;
|
|
194
|
+
}
|
|
195
|
+
.vista-error-body {
|
|
196
|
+
padding: 16px 17px 17px;
|
|
197
|
+
overflow: auto;
|
|
198
|
+
display: grid;
|
|
199
|
+
grid-template-columns: 1fr;
|
|
200
|
+
gap: 11px;
|
|
201
|
+
}
|
|
202
|
+
.vista-error-card {
|
|
203
|
+
border: 1px solid rgba(255, 255, 255, 0.11);
|
|
204
|
+
border-radius: 11px;
|
|
205
|
+
background: rgba(255, 255, 255, 0.03);
|
|
206
|
+
padding: 12px;
|
|
207
|
+
}
|
|
208
|
+
.vista-error-card-title {
|
|
209
|
+
margin: 0 0 8px;
|
|
210
|
+
font-size: 11px;
|
|
211
|
+
letter-spacing: 0.08em;
|
|
212
|
+
text-transform: uppercase;
|
|
213
|
+
font-weight: 700;
|
|
214
|
+
color: rgba(226, 232, 240, 0.76);
|
|
215
|
+
}
|
|
216
|
+
.vista-error-pre {
|
|
217
|
+
margin: 0;
|
|
218
|
+
white-space: pre-wrap;
|
|
219
|
+
word-break: break-word;
|
|
220
|
+
font-size: 12.5px;
|
|
221
|
+
line-height: 1.58;
|
|
222
|
+
color: #f1f5f9;
|
|
223
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
224
|
+
}
|
|
225
|
+
.vista-error-tok-error { color: #fca5a5; font-weight: 640; }
|
|
226
|
+
.vista-error-tok-path { color: #93c5fd; }
|
|
227
|
+
.vista-error-tok-string { color: #86efac; }
|
|
228
|
+
.vista-error-tok-stack { color: #cbd5e1; }
|
|
229
|
+
.vista-error-tok-line { color: #fbbf24; }
|
|
230
|
+
.vista-error-tok-caret { color: #f87171; font-weight: 700; }
|
|
231
|
+
.vista-error-location {
|
|
232
|
+
width: 100%;
|
|
233
|
+
display: inline-flex;
|
|
234
|
+
align-items: center;
|
|
235
|
+
justify-content: flex-start;
|
|
236
|
+
border: 1px solid rgba(255, 255, 255, 0.16);
|
|
237
|
+
background: rgba(255, 255, 255, 0.04);
|
|
238
|
+
color: #93c5fd;
|
|
239
|
+
border-radius: 8px;
|
|
240
|
+
padding: 8px 10px;
|
|
241
|
+
font-size: 12px;
|
|
242
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
243
|
+
cursor: pointer;
|
|
244
|
+
}
|
|
245
|
+
.vista-error-location:hover {
|
|
246
|
+
background: rgba(255, 255, 255, 0.1);
|
|
247
|
+
}
|
|
248
|
+
.vista-error-page-root[data-minimized='true'] .vista-error-backdrop,
|
|
249
|
+
.vista-error-page-root[data-minimized='true'] .vista-error-panel {
|
|
250
|
+
display: none;
|
|
251
|
+
}
|
|
252
|
+
.vista-error-minimized-trigger {
|
|
253
|
+
position: fixed;
|
|
254
|
+
left: 28px;
|
|
255
|
+
bottom: 22px;
|
|
256
|
+
z-index: 2147483647;
|
|
257
|
+
height: 40px;
|
|
258
|
+
border-radius: 999px;
|
|
259
|
+
border: 1px solid rgba(248, 113, 113, 0.9);
|
|
260
|
+
background: rgba(53, 11, 16, 0.95);
|
|
261
|
+
color: #fecaca;
|
|
262
|
+
box-shadow: 0 10px 24px rgba(248, 113, 113, 0.24);
|
|
263
|
+
display: inline-flex;
|
|
264
|
+
align-items: center;
|
|
265
|
+
gap: 6px;
|
|
266
|
+
padding: 0 10px;
|
|
267
|
+
cursor: pointer;
|
|
268
|
+
}
|
|
269
|
+
.vista-error-minimized-trigger[hidden] {
|
|
270
|
+
display: none;
|
|
271
|
+
}
|
|
272
|
+
.vista-error-minimized-logo {
|
|
273
|
+
width: 14px;
|
|
274
|
+
height: 14px;
|
|
275
|
+
display: block;
|
|
276
|
+
}
|
|
277
|
+
.vista-error-minimized-close {
|
|
278
|
+
font-size: 12px;
|
|
279
|
+
line-height: 1;
|
|
280
|
+
color: #fca5a5;
|
|
281
|
+
}
|
|
282
|
+
.vista-error-minimized-count {
|
|
283
|
+
font-size: 11px;
|
|
284
|
+
font-weight: 670;
|
|
285
|
+
font-variant-numeric: tabular-nums;
|
|
286
|
+
}
|
|
287
|
+
@keyframes vista-overlay-in {
|
|
288
|
+
from { opacity: 0; transform: translateY(6px) scale(0.99); }
|
|
289
|
+
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
290
|
+
}
|
|
291
|
+
@media (max-width: 860px) {
|
|
292
|
+
.vista-error-page-root { padding: 12px; }
|
|
293
|
+
.vista-error-header { flex-direction: column; }
|
|
294
|
+
.vista-error-controls { width: 100%; justify-content: flex-end; }
|
|
295
|
+
.vista-error-title { font-size: 16px; }
|
|
296
|
+
.vista-error-minimized-trigger { left: 16px; bottom: 14px; }
|
|
297
|
+
}
|
|
298
298
|
`;
|
|
299
|
-
const OVERLAY_SCRIPT = `
|
|
300
|
-
function vistaReload() {
|
|
301
|
-
window.location.reload();
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
function vistaOpenInEditor(file, line, column) {
|
|
305
|
-
if (!file) return;
|
|
306
|
-
var normalized = String(file).replace(/\\\\/g, '/');
|
|
307
|
-
var lineNum = Number(line || 1);
|
|
308
|
-
var colNum = Number(column || 1);
|
|
309
|
-
window.location.href = 'vscode://file/' + normalized + ':' + lineNum + ':' + colNum;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
function vistaCopyText(value) {
|
|
313
|
-
var text = String(value || '');
|
|
314
|
-
if (!text) return;
|
|
315
|
-
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
316
|
-
navigator.clipboard.writeText(text).catch(function () {});
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
var textarea = document.createElement('textarea');
|
|
320
|
-
textarea.value = text;
|
|
321
|
-
textarea.style.position = 'fixed';
|
|
322
|
-
textarea.style.opacity = '0';
|
|
323
|
-
textarea.style.pointerEvents = 'none';
|
|
324
|
-
document.body.appendChild(textarea);
|
|
325
|
-
textarea.focus();
|
|
326
|
-
textarea.select();
|
|
327
|
-
try {
|
|
328
|
-
document.execCommand('copy');
|
|
329
|
-
} catch (e) {}
|
|
330
|
-
document.body.removeChild(textarea);
|
|
331
|
-
}
|
|
299
|
+
const OVERLAY_SCRIPT = `
|
|
300
|
+
function vistaReload() {
|
|
301
|
+
window.location.reload();
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function vistaOpenInEditor(file, line, column) {
|
|
305
|
+
if (!file) return;
|
|
306
|
+
var normalized = String(file).replace(/\\\\/g, '/');
|
|
307
|
+
var lineNum = Number(line || 1);
|
|
308
|
+
var colNum = Number(column || 1);
|
|
309
|
+
window.location.href = 'vscode://file/' + normalized + ':' + lineNum + ':' + colNum;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function vistaCopyText(value) {
|
|
313
|
+
var text = String(value || '');
|
|
314
|
+
if (!text) return;
|
|
315
|
+
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
316
|
+
navigator.clipboard.writeText(text).catch(function () {});
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
var textarea = document.createElement('textarea');
|
|
320
|
+
textarea.value = text;
|
|
321
|
+
textarea.style.position = 'fixed';
|
|
322
|
+
textarea.style.opacity = '0';
|
|
323
|
+
textarea.style.pointerEvents = 'none';
|
|
324
|
+
document.body.appendChild(textarea);
|
|
325
|
+
textarea.focus();
|
|
326
|
+
textarea.select();
|
|
327
|
+
try {
|
|
328
|
+
document.execCommand('copy');
|
|
329
|
+
} catch (e) {}
|
|
330
|
+
document.body.removeChild(textarea);
|
|
331
|
+
}
|
|
332
332
|
`;
|
|
333
333
|
// ============================================================================
|
|
334
334
|
// Helpers
|
|
@@ -494,363 +494,363 @@ function renderErrorHTML(errors) {
|
|
|
494
494
|
const firstCodeHtml = colorizeBlockHtml(firstCode);
|
|
495
495
|
const firstStackHtml = colorizeBlockHtml(firstStack);
|
|
496
496
|
const serializedErrors = escapeForInlineScript(JSON.stringify(normalizedErrors));
|
|
497
|
-
return `<!DOCTYPE html>
|
|
498
|
-
<html lang="en">
|
|
499
|
-
<head>
|
|
500
|
-
<meta charset="utf-8" />
|
|
501
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
502
|
-
<title>Error - Vista</title>
|
|
503
|
-
<style>${OVERLAY_STYLES}</style>
|
|
504
|
-
<script>${OVERLAY_SCRIPT}</script>
|
|
505
|
-
<script>
|
|
506
|
-
// Vista live-reload: auto-refresh error overlay when files change.
|
|
507
|
-
(function() {
|
|
508
|
-
function connect() {
|
|
509
|
-
var es = new EventSource('${constants_1.SSE_ENDPOINT}');
|
|
510
|
-
es.onmessage = function(e) {
|
|
511
|
-
if (e.data && e.data !== 'connected') {
|
|
512
|
-
window.location.reload();
|
|
513
|
-
}
|
|
514
|
-
};
|
|
515
|
-
es.onerror = function() {
|
|
516
|
-
es.close();
|
|
517
|
-
setTimeout(connect, 1500);
|
|
518
|
-
};
|
|
519
|
-
}
|
|
520
|
-
connect();
|
|
521
|
-
})();
|
|
522
|
-
|
|
523
|
-
(function() {
|
|
524
|
-
var errors = ${serializedErrors};
|
|
525
|
-
if (!Array.isArray(errors) || errors.length === 0) {
|
|
526
|
-
errors = [{ type: 'runtime', message: 'Unknown Error' }];
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
var state = { index: 0, errors: errors };
|
|
530
|
-
var typeNode;
|
|
531
|
-
var titleNode;
|
|
532
|
-
var metaNode;
|
|
533
|
-
var messageNode;
|
|
534
|
-
var locationWrap;
|
|
535
|
-
var locationText;
|
|
536
|
-
var locationButton;
|
|
537
|
-
var codeWrap;
|
|
538
|
-
var codeNode;
|
|
539
|
-
var stackWrap;
|
|
540
|
-
var stackNode;
|
|
541
|
-
var paginationNode;
|
|
542
|
-
var countNode;
|
|
543
|
-
var prevButton;
|
|
544
|
-
var nextButton;
|
|
545
|
-
var copyButton;
|
|
546
|
-
var rootNode;
|
|
547
|
-
var panelNode;
|
|
548
|
-
var backdropNode;
|
|
549
|
-
var minimizedTrigger;
|
|
550
|
-
var minimizedCount;
|
|
551
|
-
|
|
552
|
-
function getLabel(type) {
|
|
553
|
-
if (type === 'build') return 'Build Error';
|
|
554
|
-
if (type === 'hydration') return 'Hydration Error';
|
|
555
|
-
return 'Runtime Error';
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
function getTitle(message, fallback) {
|
|
559
|
-
var lines = String(message || '')
|
|
560
|
-
.split(/\\r?\\n/)
|
|
561
|
-
.map(function(line) { return line.trim(); })
|
|
562
|
-
.filter(function(line) { return line.length > 0; });
|
|
563
|
-
var title = lines.length ? lines[0] : fallback;
|
|
564
|
-
return title.length > 140 ? title.slice(0, 137) + '...' : title;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
function pad2(value) {
|
|
568
|
-
return value < 10 ? '0' + value : String(value);
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
function formatTimeNow() {
|
|
572
|
-
var now = new Date();
|
|
573
|
-
return pad2(now.getHours()) + ':' + pad2(now.getMinutes()) + ':' + pad2(now.getSeconds());
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
function currentError() {
|
|
577
|
-
if (!state.errors || state.errors.length === 0) return null;
|
|
578
|
-
var idx = state.index;
|
|
579
|
-
if (idx < 0) idx = 0;
|
|
580
|
-
if (idx > state.errors.length - 1) idx = state.errors.length - 1;
|
|
581
|
-
return state.errors[idx];
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
function formatLocation(error) {
|
|
585
|
-
if (!error || !error.file) return '';
|
|
586
|
-
var file = String(error.file).replace(/\\\\/g, '/');
|
|
587
|
-
var line = Number(error.line || 0);
|
|
588
|
-
var column = Number(error.column || 0);
|
|
589
|
-
if (!line) return file;
|
|
590
|
-
return file + ':' + line + (column ? ':' + column : '');
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
function escapeHtml(value) {
|
|
594
|
-
return String(value || '')
|
|
595
|
-
.replace(/&/g, '&')
|
|
596
|
-
.replace(/</g, '<')
|
|
597
|
-
.replace(/>/g, '>')
|
|
598
|
-
.replace(/\"/g, '"')
|
|
599
|
-
.replace(/'/g, ''');
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
function colorizeLine(line) {
|
|
603
|
-
var escaped = escapeHtml(line);
|
|
604
|
-
|
|
605
|
-
if (/^\\s*\\^+/.test(line)) {
|
|
606
|
-
return '<span class=\"vista-error-tok-caret\">' + escaped + '</span>';
|
|
607
|
-
}
|
|
608
|
-
if (/^\\s*at\\s+/.test(line)) {
|
|
609
|
-
return '<span class=\"vista-error-tok-stack\">' + escaped + '</span>';
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
var numbered = escaped.match(/^(\\s*\\d+)(\\s*\\|)(.*)$/);
|
|
613
|
-
if (numbered) {
|
|
614
|
-
escaped =
|
|
615
|
-
'<span class=\"vista-error-tok-line\">' + numbered[1] + '</span>' + numbered[2] + numbered[3];
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
escaped = escaped.replace(
|
|
619
|
-
/((?:[A-Za-z]:)?[\\\\/\\w.@%:-]+\\.(?:tsx?|jsx?|mjs|cjs|css|json|mdx?)(?::\\d+(?::\\d+)?)?)/g,
|
|
620
|
-
'<span class=\"vista-error-tok-path\">$1</span>'
|
|
621
|
-
);
|
|
622
|
-
escaped = escaped.replace(
|
|
623
|
-
/("[^&]+"|'[^&]+')/g,
|
|
624
|
-
'<span class=\"vista-error-tok-string\">$1</span>'
|
|
625
|
-
);
|
|
626
|
-
escaped = escaped.replace(
|
|
627
|
-
/(TypeError:|ReferenceError:|SyntaxError:|Error:|Cannot find module|Module not found|Build Error|Runtime Error|Hydration Error)/g,
|
|
628
|
-
'<span class=\"vista-error-tok-error\">$1</span>'
|
|
629
|
-
);
|
|
630
|
-
return escaped;
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
function colorizeBlock(value) {
|
|
634
|
-
return String(value || '')
|
|
635
|
-
.split(/\\r?\\n/)
|
|
636
|
-
.map(function(line) {
|
|
637
|
-
return colorizeLine(line);
|
|
638
|
-
})
|
|
639
|
-
.join('\\n');
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
function minimizeOverlay() {
|
|
643
|
-
if (!rootNode) return;
|
|
644
|
-
rootNode.setAttribute('data-minimized', 'true');
|
|
645
|
-
if (minimizedTrigger) minimizedTrigger.hidden = false;
|
|
646
|
-
var indicator = window.__VISTA_DEVTOOLS_INDICATOR__;
|
|
647
|
-
if (indicator && typeof indicator.setError === 'function') {
|
|
648
|
-
indicator.setError('runtime-error', state.errors.length);
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
function restoreOverlay() {
|
|
653
|
-
if (!rootNode) return;
|
|
654
|
-
rootNode.removeAttribute('data-minimized');
|
|
655
|
-
if (minimizedTrigger) minimizedTrigger.hidden = true;
|
|
656
|
-
var indicator = window.__VISTA_DEVTOOLS_INDICATOR__;
|
|
657
|
-
if (indicator && typeof indicator.clearError === 'function') {
|
|
658
|
-
indicator.clearError();
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
function render() {
|
|
663
|
-
var error = currentError();
|
|
664
|
-
if (!error) return;
|
|
665
|
-
|
|
666
|
-
var label = getLabel(error.type);
|
|
667
|
-
var message = typeof error.message === 'string' ? error.message : String(error.message || 'Unknown Error');
|
|
668
|
-
var title = getTitle(message, label);
|
|
669
|
-
var location = formatLocation(error);
|
|
670
|
-
var codeFrame = typeof error.codeFrame === 'string' ? error.codeFrame : '';
|
|
671
|
-
var stack = typeof error.stack === 'string' ? error.stack.trim() : '';
|
|
672
|
-
|
|
673
|
-
if (typeNode) typeNode.textContent = label;
|
|
674
|
-
if (titleNode) titleNode.textContent = title;
|
|
675
|
-
if (metaNode) {
|
|
676
|
-
metaNode.textContent =
|
|
677
|
-
'Vista Dev Overlay | ' + formatTimeNow() + ' | ' + (state.index + 1) + ' of ' + state.errors.length;
|
|
678
|
-
}
|
|
679
|
-
if (messageNode) messageNode.innerHTML = colorizeBlock(message);
|
|
680
|
-
|
|
681
|
-
if (locationWrap) locationWrap.hidden = location.length === 0;
|
|
682
|
-
if (locationText) locationText.textContent = location;
|
|
683
|
-
|
|
684
|
-
if (codeWrap) codeWrap.hidden = codeFrame.trim().length === 0;
|
|
685
|
-
if (codeNode) codeNode.innerHTML = colorizeBlock(codeFrame);
|
|
686
|
-
|
|
687
|
-
if (stackWrap) stackWrap.hidden = stack.length === 0;
|
|
688
|
-
if (stackNode) stackNode.innerHTML = colorizeBlock(stack);
|
|
689
|
-
|
|
690
|
-
if (paginationNode) paginationNode.hidden = state.errors.length <= 1;
|
|
691
|
-
if (countNode) countNode.textContent = (state.index + 1) + ' / ' + state.errors.length;
|
|
692
|
-
if (prevButton) prevButton.disabled = state.index <= 0;
|
|
693
|
-
if (nextButton) nextButton.disabled = state.index >= state.errors.length - 1;
|
|
694
|
-
if (minimizedCount) minimizedCount.textContent = String(state.errors.length);
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
function changeIndex(offset) {
|
|
698
|
-
var next = state.index + offset;
|
|
699
|
-
if (next < 0 || next > state.errors.length - 1) return;
|
|
700
|
-
state.index = next;
|
|
701
|
-
render();
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
function bind() {
|
|
705
|
-
rootNode = document.querySelector('[data-vista-error-root]');
|
|
706
|
-
panelNode = document.querySelector('[data-vista-error-panel]');
|
|
707
|
-
backdropNode = document.querySelector('[data-vista-error-backdrop]');
|
|
708
|
-
typeNode = document.querySelector('[data-vista-error-type]');
|
|
709
|
-
titleNode = document.querySelector('[data-vista-error-title]');
|
|
710
|
-
metaNode = document.querySelector('[data-vista-error-meta]');
|
|
711
|
-
messageNode = document.querySelector('[data-vista-error-message]');
|
|
712
|
-
locationWrap = document.querySelector('[data-vista-location-wrap]');
|
|
713
|
-
locationText = document.querySelector('[data-vista-location-text]');
|
|
714
|
-
locationButton = document.querySelector('[data-vista-location-trigger]');
|
|
715
|
-
codeWrap = document.querySelector('[data-vista-code-wrap]');
|
|
716
|
-
codeNode = document.querySelector('[data-vista-code]');
|
|
717
|
-
stackWrap = document.querySelector('[data-vista-stack-wrap]');
|
|
718
|
-
stackNode = document.querySelector('[data-vista-stack]');
|
|
719
|
-
paginationNode = document.querySelector('[data-vista-pagination]');
|
|
720
|
-
countNode = document.querySelector('[data-vista-count]');
|
|
721
|
-
prevButton = document.querySelector('[data-vista-prev-btn]');
|
|
722
|
-
nextButton = document.querySelector('[data-vista-next-btn]');
|
|
723
|
-
copyButton = document.querySelector('[data-vista-copy-btn]');
|
|
724
|
-
minimizedTrigger = document.querySelector('[data-vista-minimized-trigger]');
|
|
725
|
-
minimizedCount = document.querySelector('[data-vista-minimized-count]');
|
|
726
|
-
|
|
727
|
-
if (prevButton) {
|
|
728
|
-
prevButton.addEventListener('click', function() { changeIndex(-1); });
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
if (nextButton) {
|
|
732
|
-
nextButton.addEventListener('click', function() { changeIndex(1); });
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
if (copyButton) {
|
|
736
|
-
copyButton.addEventListener('click', function() {
|
|
737
|
-
var error = currentError();
|
|
738
|
-
if (!error) return;
|
|
739
|
-
var label = getLabel(error.type);
|
|
740
|
-
var message = typeof error.message === 'string' ? error.message : String(error.message || 'Unknown Error');
|
|
741
|
-
var text = label + '\\n\\n' + message;
|
|
742
|
-
var location = formatLocation(error);
|
|
743
|
-
if (location) text += '\\n\\nFile: ' + location;
|
|
744
|
-
if (error.codeFrame) text += '\\n\\nCode Frame:\\n' + error.codeFrame;
|
|
745
|
-
if (error.stack) text += '\\n\\nStack Trace:\\n' + error.stack;
|
|
746
|
-
vistaCopyText(text);
|
|
747
|
-
});
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
if (locationButton) {
|
|
751
|
-
locationButton.addEventListener('click', function() {
|
|
752
|
-
var error = currentError();
|
|
753
|
-
if (!error || !error.file) return;
|
|
754
|
-
vistaOpenInEditor(error.file, Number(error.line || 1), Number(error.column || 1));
|
|
755
|
-
});
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
if (backdropNode) {
|
|
759
|
-
backdropNode.addEventListener('click', function() {
|
|
760
|
-
minimizeOverlay();
|
|
761
|
-
});
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
if (panelNode) {
|
|
765
|
-
panelNode.addEventListener('click', function(event) {
|
|
766
|
-
event.stopPropagation();
|
|
767
|
-
});
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
if (minimizedTrigger) {
|
|
771
|
-
minimizedTrigger.addEventListener('click', function() {
|
|
772
|
-
restoreOverlay();
|
|
773
|
-
});
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
document.addEventListener('keydown', function(event) {
|
|
777
|
-
if (event.key === 'ArrowLeft') {
|
|
778
|
-
changeIndex(-1);
|
|
779
|
-
} else if (event.key === 'ArrowRight') {
|
|
780
|
-
changeIndex(1);
|
|
781
|
-
} else if (event.key === 'Escape') {
|
|
782
|
-
minimizeOverlay();
|
|
783
|
-
}
|
|
784
|
-
});
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
document.addEventListener('DOMContentLoaded', function() {
|
|
788
|
-
bind();
|
|
789
|
-
render();
|
|
790
|
-
});
|
|
791
|
-
})();
|
|
792
|
-
</script>
|
|
793
|
-
</head>
|
|
794
|
-
<body>
|
|
795
|
-
<div class="vista-error-page-root" data-vista-error-root>
|
|
796
|
-
<div class="vista-error-backdrop" data-vista-error-backdrop></div>
|
|
797
|
-
<section class="vista-error-panel" data-vista-error-panel role="dialog" aria-label="Vista Error Overlay" aria-modal="true">
|
|
798
|
-
<header class="vista-error-header">
|
|
799
|
-
<div class="vista-error-head-left">
|
|
800
|
-
<div class="vista-error-top-row">
|
|
801
|
-
<span class="vista-error-badge" data-vista-error-type>
|
|
802
|
-
<span class="vista-error-badge-dot"></span>${escapeHtml(firstLabel)}
|
|
803
|
-
</span>
|
|
804
|
-
<div class="vista-error-pagination" data-vista-pagination${normalizedErrors.length <= 1 ? ' hidden' : ''}>
|
|
805
|
-
<button type="button" class="vista-error-page-btn" data-vista-prev-btn aria-label="Previous error"><</button>
|
|
806
|
-
<span class="vista-error-page-count" data-vista-count>1 / ${normalizedErrors.length}</span>
|
|
807
|
-
<button type="button" class="vista-error-page-btn" data-vista-next-btn aria-label="Next error">></button>
|
|
808
|
-
</div>
|
|
809
|
-
</div>
|
|
810
|
-
<h2 class="vista-error-title" data-vista-error-title>${escapeHtml(firstTitle)}</h2>
|
|
811
|
-
<p class="vista-error-meta" data-vista-error-meta>Vista Dev Overlay</p>
|
|
812
|
-
</div>
|
|
813
|
-
<div class="vista-error-controls">
|
|
814
|
-
<button type="button" class="vista-error-btn" data-vista-copy-btn aria-label="Copy error">
|
|
815
|
-
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><rect x="9" y="9" width="10" height="10" rx="2" stroke="currentColor" stroke-width="2"/><rect x="5" y="5" width="10" height="10" rx="2" stroke="currentColor" stroke-width="2"/></svg>
|
|
816
|
-
</button>
|
|
817
|
-
<button type="button" class="vista-error-btn" onclick="vistaReload()" aria-label="Reload page">
|
|
818
|
-
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M20 12a8 8 0 1 1-2.34-5.66" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><path d="M20 4V10H14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
|
819
|
-
</button>
|
|
820
|
-
</div>
|
|
821
|
-
</header>
|
|
822
|
-
|
|
823
|
-
<div class="vista-error-body">
|
|
824
|
-
<section class="vista-error-card" data-vista-location-wrap${firstLocation ? '' : ' hidden'}>
|
|
825
|
-
<h3 class="vista-error-card-title">Location</h3>
|
|
826
|
-
<button type="button" class="vista-error-location" data-vista-location-trigger>
|
|
827
|
-
<span data-vista-location-text>${escapeHtml(firstLocation)}</span>
|
|
828
|
-
</button>
|
|
829
|
-
</section>
|
|
830
|
-
|
|
831
|
-
<section class="vista-error-card">
|
|
832
|
-
<h3 class="vista-error-card-title">Message</h3>
|
|
833
|
-
<pre class="vista-error-pre" data-vista-error-message>${firstMessageHtml}</pre>
|
|
834
|
-
</section>
|
|
835
|
-
|
|
836
|
-
<section class="vista-error-card" data-vista-code-wrap${firstCode ? '' : ' hidden'}>
|
|
837
|
-
<h3 class="vista-error-card-title">Code Frame</h3>
|
|
838
|
-
<pre class="vista-error-pre" data-vista-code>${firstCodeHtml}</pre>
|
|
839
|
-
</section>
|
|
840
|
-
|
|
841
|
-
<section class="vista-error-card" data-vista-stack-wrap${firstStack ? '' : ' hidden'}>
|
|
842
|
-
<h3 class="vista-error-card-title">Stack Trace</h3>
|
|
843
|
-
<pre class="vista-error-pre" data-vista-stack>${firstStackHtml}</pre>
|
|
844
|
-
</section>
|
|
845
|
-
</div>
|
|
846
|
-
</section>
|
|
847
|
-
<button type="button" class="vista-error-minimized-trigger" data-vista-minimized-trigger hidden aria-label="Reopen error overlay">
|
|
848
|
-
<svg class="vista-error-minimized-logo" viewBox="0 0 168 177" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M81.872 176.988L-2.01405e-06 -2.68173e-06H30.5816L83.5576 121.604L136.774 -2.68173e-06H167.115L85.484 176.988H81.872Z" fill="white"/></svg>
|
|
849
|
-
<span class="vista-error-minimized-close">×</span>
|
|
850
|
-
<span class="vista-error-minimized-count" data-vista-minimized-count>${normalizedErrors.length}</span>
|
|
851
|
-
</button>
|
|
852
|
-
</div>
|
|
853
|
-
</body>
|
|
497
|
+
return `<!DOCTYPE html>
|
|
498
|
+
<html lang="en">
|
|
499
|
+
<head>
|
|
500
|
+
<meta charset="utf-8" />
|
|
501
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
502
|
+
<title>Error - Vista</title>
|
|
503
|
+
<style>${OVERLAY_STYLES}</style>
|
|
504
|
+
<script>${OVERLAY_SCRIPT}</script>
|
|
505
|
+
<script>
|
|
506
|
+
// Vista live-reload: auto-refresh error overlay when files change.
|
|
507
|
+
(function() {
|
|
508
|
+
function connect() {
|
|
509
|
+
var es = new EventSource('${constants_1.SSE_ENDPOINT}');
|
|
510
|
+
es.onmessage = function(e) {
|
|
511
|
+
if (e.data && e.data !== 'connected') {
|
|
512
|
+
window.location.reload();
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
es.onerror = function() {
|
|
516
|
+
es.close();
|
|
517
|
+
setTimeout(connect, 1500);
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
connect();
|
|
521
|
+
})();
|
|
522
|
+
|
|
523
|
+
(function() {
|
|
524
|
+
var errors = ${serializedErrors};
|
|
525
|
+
if (!Array.isArray(errors) || errors.length === 0) {
|
|
526
|
+
errors = [{ type: 'runtime', message: 'Unknown Error' }];
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
var state = { index: 0, errors: errors };
|
|
530
|
+
var typeNode;
|
|
531
|
+
var titleNode;
|
|
532
|
+
var metaNode;
|
|
533
|
+
var messageNode;
|
|
534
|
+
var locationWrap;
|
|
535
|
+
var locationText;
|
|
536
|
+
var locationButton;
|
|
537
|
+
var codeWrap;
|
|
538
|
+
var codeNode;
|
|
539
|
+
var stackWrap;
|
|
540
|
+
var stackNode;
|
|
541
|
+
var paginationNode;
|
|
542
|
+
var countNode;
|
|
543
|
+
var prevButton;
|
|
544
|
+
var nextButton;
|
|
545
|
+
var copyButton;
|
|
546
|
+
var rootNode;
|
|
547
|
+
var panelNode;
|
|
548
|
+
var backdropNode;
|
|
549
|
+
var minimizedTrigger;
|
|
550
|
+
var minimizedCount;
|
|
551
|
+
|
|
552
|
+
function getLabel(type) {
|
|
553
|
+
if (type === 'build') return 'Build Error';
|
|
554
|
+
if (type === 'hydration') return 'Hydration Error';
|
|
555
|
+
return 'Runtime Error';
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
function getTitle(message, fallback) {
|
|
559
|
+
var lines = String(message || '')
|
|
560
|
+
.split(/\\r?\\n/)
|
|
561
|
+
.map(function(line) { return line.trim(); })
|
|
562
|
+
.filter(function(line) { return line.length > 0; });
|
|
563
|
+
var title = lines.length ? lines[0] : fallback;
|
|
564
|
+
return title.length > 140 ? title.slice(0, 137) + '...' : title;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
function pad2(value) {
|
|
568
|
+
return value < 10 ? '0' + value : String(value);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
function formatTimeNow() {
|
|
572
|
+
var now = new Date();
|
|
573
|
+
return pad2(now.getHours()) + ':' + pad2(now.getMinutes()) + ':' + pad2(now.getSeconds());
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
function currentError() {
|
|
577
|
+
if (!state.errors || state.errors.length === 0) return null;
|
|
578
|
+
var idx = state.index;
|
|
579
|
+
if (idx < 0) idx = 0;
|
|
580
|
+
if (idx > state.errors.length - 1) idx = state.errors.length - 1;
|
|
581
|
+
return state.errors[idx];
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
function formatLocation(error) {
|
|
585
|
+
if (!error || !error.file) return '';
|
|
586
|
+
var file = String(error.file).replace(/\\\\/g, '/');
|
|
587
|
+
var line = Number(error.line || 0);
|
|
588
|
+
var column = Number(error.column || 0);
|
|
589
|
+
if (!line) return file;
|
|
590
|
+
return file + ':' + line + (column ? ':' + column : '');
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
function escapeHtml(value) {
|
|
594
|
+
return String(value || '')
|
|
595
|
+
.replace(/&/g, '&')
|
|
596
|
+
.replace(/</g, '<')
|
|
597
|
+
.replace(/>/g, '>')
|
|
598
|
+
.replace(/\"/g, '"')
|
|
599
|
+
.replace(/'/g, ''');
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function colorizeLine(line) {
|
|
603
|
+
var escaped = escapeHtml(line);
|
|
604
|
+
|
|
605
|
+
if (/^\\s*\\^+/.test(line)) {
|
|
606
|
+
return '<span class=\"vista-error-tok-caret\">' + escaped + '</span>';
|
|
607
|
+
}
|
|
608
|
+
if (/^\\s*at\\s+/.test(line)) {
|
|
609
|
+
return '<span class=\"vista-error-tok-stack\">' + escaped + '</span>';
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
var numbered = escaped.match(/^(\\s*\\d+)(\\s*\\|)(.*)$/);
|
|
613
|
+
if (numbered) {
|
|
614
|
+
escaped =
|
|
615
|
+
'<span class=\"vista-error-tok-line\">' + numbered[1] + '</span>' + numbered[2] + numbered[3];
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
escaped = escaped.replace(
|
|
619
|
+
/((?:[A-Za-z]:)?[\\\\/\\w.@%:-]+\\.(?:tsx?|jsx?|mjs|cjs|css|json|mdx?)(?::\\d+(?::\\d+)?)?)/g,
|
|
620
|
+
'<span class=\"vista-error-tok-path\">$1</span>'
|
|
621
|
+
);
|
|
622
|
+
escaped = escaped.replace(
|
|
623
|
+
/("[^&]+"|'[^&]+')/g,
|
|
624
|
+
'<span class=\"vista-error-tok-string\">$1</span>'
|
|
625
|
+
);
|
|
626
|
+
escaped = escaped.replace(
|
|
627
|
+
/(TypeError:|ReferenceError:|SyntaxError:|Error:|Cannot find module|Module not found|Build Error|Runtime Error|Hydration Error)/g,
|
|
628
|
+
'<span class=\"vista-error-tok-error\">$1</span>'
|
|
629
|
+
);
|
|
630
|
+
return escaped;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
function colorizeBlock(value) {
|
|
634
|
+
return String(value || '')
|
|
635
|
+
.split(/\\r?\\n/)
|
|
636
|
+
.map(function(line) {
|
|
637
|
+
return colorizeLine(line);
|
|
638
|
+
})
|
|
639
|
+
.join('\\n');
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
function minimizeOverlay() {
|
|
643
|
+
if (!rootNode) return;
|
|
644
|
+
rootNode.setAttribute('data-minimized', 'true');
|
|
645
|
+
if (minimizedTrigger) minimizedTrigger.hidden = false;
|
|
646
|
+
var indicator = window.__VISTA_DEVTOOLS_INDICATOR__;
|
|
647
|
+
if (indicator && typeof indicator.setError === 'function') {
|
|
648
|
+
indicator.setError('runtime-error', state.errors.length);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
function restoreOverlay() {
|
|
653
|
+
if (!rootNode) return;
|
|
654
|
+
rootNode.removeAttribute('data-minimized');
|
|
655
|
+
if (minimizedTrigger) minimizedTrigger.hidden = true;
|
|
656
|
+
var indicator = window.__VISTA_DEVTOOLS_INDICATOR__;
|
|
657
|
+
if (indicator && typeof indicator.clearError === 'function') {
|
|
658
|
+
indicator.clearError();
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
function render() {
|
|
663
|
+
var error = currentError();
|
|
664
|
+
if (!error) return;
|
|
665
|
+
|
|
666
|
+
var label = getLabel(error.type);
|
|
667
|
+
var message = typeof error.message === 'string' ? error.message : String(error.message || 'Unknown Error');
|
|
668
|
+
var title = getTitle(message, label);
|
|
669
|
+
var location = formatLocation(error);
|
|
670
|
+
var codeFrame = typeof error.codeFrame === 'string' ? error.codeFrame : '';
|
|
671
|
+
var stack = typeof error.stack === 'string' ? error.stack.trim() : '';
|
|
672
|
+
|
|
673
|
+
if (typeNode) typeNode.textContent = label;
|
|
674
|
+
if (titleNode) titleNode.textContent = title;
|
|
675
|
+
if (metaNode) {
|
|
676
|
+
metaNode.textContent =
|
|
677
|
+
'Vista Dev Overlay | ' + formatTimeNow() + ' | ' + (state.index + 1) + ' of ' + state.errors.length;
|
|
678
|
+
}
|
|
679
|
+
if (messageNode) messageNode.innerHTML = colorizeBlock(message);
|
|
680
|
+
|
|
681
|
+
if (locationWrap) locationWrap.hidden = location.length === 0;
|
|
682
|
+
if (locationText) locationText.textContent = location;
|
|
683
|
+
|
|
684
|
+
if (codeWrap) codeWrap.hidden = codeFrame.trim().length === 0;
|
|
685
|
+
if (codeNode) codeNode.innerHTML = colorizeBlock(codeFrame);
|
|
686
|
+
|
|
687
|
+
if (stackWrap) stackWrap.hidden = stack.length === 0;
|
|
688
|
+
if (stackNode) stackNode.innerHTML = colorizeBlock(stack);
|
|
689
|
+
|
|
690
|
+
if (paginationNode) paginationNode.hidden = state.errors.length <= 1;
|
|
691
|
+
if (countNode) countNode.textContent = (state.index + 1) + ' / ' + state.errors.length;
|
|
692
|
+
if (prevButton) prevButton.disabled = state.index <= 0;
|
|
693
|
+
if (nextButton) nextButton.disabled = state.index >= state.errors.length - 1;
|
|
694
|
+
if (minimizedCount) minimizedCount.textContent = String(state.errors.length);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
function changeIndex(offset) {
|
|
698
|
+
var next = state.index + offset;
|
|
699
|
+
if (next < 0 || next > state.errors.length - 1) return;
|
|
700
|
+
state.index = next;
|
|
701
|
+
render();
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
function bind() {
|
|
705
|
+
rootNode = document.querySelector('[data-vista-error-root]');
|
|
706
|
+
panelNode = document.querySelector('[data-vista-error-panel]');
|
|
707
|
+
backdropNode = document.querySelector('[data-vista-error-backdrop]');
|
|
708
|
+
typeNode = document.querySelector('[data-vista-error-type]');
|
|
709
|
+
titleNode = document.querySelector('[data-vista-error-title]');
|
|
710
|
+
metaNode = document.querySelector('[data-vista-error-meta]');
|
|
711
|
+
messageNode = document.querySelector('[data-vista-error-message]');
|
|
712
|
+
locationWrap = document.querySelector('[data-vista-location-wrap]');
|
|
713
|
+
locationText = document.querySelector('[data-vista-location-text]');
|
|
714
|
+
locationButton = document.querySelector('[data-vista-location-trigger]');
|
|
715
|
+
codeWrap = document.querySelector('[data-vista-code-wrap]');
|
|
716
|
+
codeNode = document.querySelector('[data-vista-code]');
|
|
717
|
+
stackWrap = document.querySelector('[data-vista-stack-wrap]');
|
|
718
|
+
stackNode = document.querySelector('[data-vista-stack]');
|
|
719
|
+
paginationNode = document.querySelector('[data-vista-pagination]');
|
|
720
|
+
countNode = document.querySelector('[data-vista-count]');
|
|
721
|
+
prevButton = document.querySelector('[data-vista-prev-btn]');
|
|
722
|
+
nextButton = document.querySelector('[data-vista-next-btn]');
|
|
723
|
+
copyButton = document.querySelector('[data-vista-copy-btn]');
|
|
724
|
+
minimizedTrigger = document.querySelector('[data-vista-minimized-trigger]');
|
|
725
|
+
minimizedCount = document.querySelector('[data-vista-minimized-count]');
|
|
726
|
+
|
|
727
|
+
if (prevButton) {
|
|
728
|
+
prevButton.addEventListener('click', function() { changeIndex(-1); });
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
if (nextButton) {
|
|
732
|
+
nextButton.addEventListener('click', function() { changeIndex(1); });
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
if (copyButton) {
|
|
736
|
+
copyButton.addEventListener('click', function() {
|
|
737
|
+
var error = currentError();
|
|
738
|
+
if (!error) return;
|
|
739
|
+
var label = getLabel(error.type);
|
|
740
|
+
var message = typeof error.message === 'string' ? error.message : String(error.message || 'Unknown Error');
|
|
741
|
+
var text = label + '\\n\\n' + message;
|
|
742
|
+
var location = formatLocation(error);
|
|
743
|
+
if (location) text += '\\n\\nFile: ' + location;
|
|
744
|
+
if (error.codeFrame) text += '\\n\\nCode Frame:\\n' + error.codeFrame;
|
|
745
|
+
if (error.stack) text += '\\n\\nStack Trace:\\n' + error.stack;
|
|
746
|
+
vistaCopyText(text);
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
if (locationButton) {
|
|
751
|
+
locationButton.addEventListener('click', function() {
|
|
752
|
+
var error = currentError();
|
|
753
|
+
if (!error || !error.file) return;
|
|
754
|
+
vistaOpenInEditor(error.file, Number(error.line || 1), Number(error.column || 1));
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
if (backdropNode) {
|
|
759
|
+
backdropNode.addEventListener('click', function() {
|
|
760
|
+
minimizeOverlay();
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
if (panelNode) {
|
|
765
|
+
panelNode.addEventListener('click', function(event) {
|
|
766
|
+
event.stopPropagation();
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
if (minimizedTrigger) {
|
|
771
|
+
minimizedTrigger.addEventListener('click', function() {
|
|
772
|
+
restoreOverlay();
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
document.addEventListener('keydown', function(event) {
|
|
777
|
+
if (event.key === 'ArrowLeft') {
|
|
778
|
+
changeIndex(-1);
|
|
779
|
+
} else if (event.key === 'ArrowRight') {
|
|
780
|
+
changeIndex(1);
|
|
781
|
+
} else if (event.key === 'Escape') {
|
|
782
|
+
minimizeOverlay();
|
|
783
|
+
}
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
788
|
+
bind();
|
|
789
|
+
render();
|
|
790
|
+
});
|
|
791
|
+
})();
|
|
792
|
+
</script>
|
|
793
|
+
</head>
|
|
794
|
+
<body>
|
|
795
|
+
<div class="vista-error-page-root" data-vista-error-root>
|
|
796
|
+
<div class="vista-error-backdrop" data-vista-error-backdrop></div>
|
|
797
|
+
<section class="vista-error-panel" data-vista-error-panel role="dialog" aria-label="Vista Error Overlay" aria-modal="true">
|
|
798
|
+
<header class="vista-error-header">
|
|
799
|
+
<div class="vista-error-head-left">
|
|
800
|
+
<div class="vista-error-top-row">
|
|
801
|
+
<span class="vista-error-badge" data-vista-error-type>
|
|
802
|
+
<span class="vista-error-badge-dot"></span>${escapeHtml(firstLabel)}
|
|
803
|
+
</span>
|
|
804
|
+
<div class="vista-error-pagination" data-vista-pagination${normalizedErrors.length <= 1 ? ' hidden' : ''}>
|
|
805
|
+
<button type="button" class="vista-error-page-btn" data-vista-prev-btn aria-label="Previous error"><</button>
|
|
806
|
+
<span class="vista-error-page-count" data-vista-count>1 / ${normalizedErrors.length}</span>
|
|
807
|
+
<button type="button" class="vista-error-page-btn" data-vista-next-btn aria-label="Next error">></button>
|
|
808
|
+
</div>
|
|
809
|
+
</div>
|
|
810
|
+
<h2 class="vista-error-title" data-vista-error-title>${escapeHtml(firstTitle)}</h2>
|
|
811
|
+
<p class="vista-error-meta" data-vista-error-meta>Vista Dev Overlay</p>
|
|
812
|
+
</div>
|
|
813
|
+
<div class="vista-error-controls">
|
|
814
|
+
<button type="button" class="vista-error-btn" data-vista-copy-btn aria-label="Copy error">
|
|
815
|
+
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><rect x="9" y="9" width="10" height="10" rx="2" stroke="currentColor" stroke-width="2"/><rect x="5" y="5" width="10" height="10" rx="2" stroke="currentColor" stroke-width="2"/></svg>
|
|
816
|
+
</button>
|
|
817
|
+
<button type="button" class="vista-error-btn" onclick="vistaReload()" aria-label="Reload page">
|
|
818
|
+
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M20 12a8 8 0 1 1-2.34-5.66" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><path d="M20 4V10H14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
|
819
|
+
</button>
|
|
820
|
+
</div>
|
|
821
|
+
</header>
|
|
822
|
+
|
|
823
|
+
<div class="vista-error-body">
|
|
824
|
+
<section class="vista-error-card" data-vista-location-wrap${firstLocation ? '' : ' hidden'}>
|
|
825
|
+
<h3 class="vista-error-card-title">Location</h3>
|
|
826
|
+
<button type="button" class="vista-error-location" data-vista-location-trigger>
|
|
827
|
+
<span data-vista-location-text>${escapeHtml(firstLocation)}</span>
|
|
828
|
+
</button>
|
|
829
|
+
</section>
|
|
830
|
+
|
|
831
|
+
<section class="vista-error-card">
|
|
832
|
+
<h3 class="vista-error-card-title">Message</h3>
|
|
833
|
+
<pre class="vista-error-pre" data-vista-error-message>${firstMessageHtml}</pre>
|
|
834
|
+
</section>
|
|
835
|
+
|
|
836
|
+
<section class="vista-error-card" data-vista-code-wrap${firstCode ? '' : ' hidden'}>
|
|
837
|
+
<h3 class="vista-error-card-title">Code Frame</h3>
|
|
838
|
+
<pre class="vista-error-pre" data-vista-code>${firstCodeHtml}</pre>
|
|
839
|
+
</section>
|
|
840
|
+
|
|
841
|
+
<section class="vista-error-card" data-vista-stack-wrap${firstStack ? '' : ' hidden'}>
|
|
842
|
+
<h3 class="vista-error-card-title">Stack Trace</h3>
|
|
843
|
+
<pre class="vista-error-pre" data-vista-stack>${firstStackHtml}</pre>
|
|
844
|
+
</section>
|
|
845
|
+
</div>
|
|
846
|
+
</section>
|
|
847
|
+
<button type="button" class="vista-error-minimized-trigger" data-vista-minimized-trigger hidden aria-label="Reopen error overlay">
|
|
848
|
+
<svg class="vista-error-minimized-logo" viewBox="0 0 168 177" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M81.872 176.988L-2.01405e-06 -2.68173e-06H30.5816L83.5576 121.604L136.774 -2.68173e-06H167.115L85.484 176.988H81.872Z" fill="white"/></svg>
|
|
849
|
+
<span class="vista-error-minimized-close">×</span>
|
|
850
|
+
<span class="vista-error-minimized-count" data-vista-minimized-count>${normalizedErrors.length}</span>
|
|
851
|
+
</button>
|
|
852
|
+
</div>
|
|
853
|
+
</body>
|
|
854
854
|
</html>`;
|
|
855
855
|
}
|
|
856
856
|
// ============================================================================
|