@vistagenic/vista 0.2.5 → 0.2.7

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.
@@ -0,0 +1,562 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDevErrorOverlayBootstrapSource = getDevErrorOverlayBootstrapSource;
4
+ /**
5
+ * Returns a JS snippet that installs the Vista dev error overlay.
6
+ * It supports Next.js-style error pagination and indicator restore.
7
+ */
8
+ function getDevErrorOverlayBootstrapSource() {
9
+ return String.raw `
10
+ (function installVistaDevErrorOverlay() {
11
+ if (typeof window === 'undefined' || typeof document === 'undefined') return;
12
+ if (window.__VISTA_DEV_ERROR_OVERLAY__) return;
13
+
14
+ var STYLE_ID = '__vista-dev-error-overlay-style';
15
+ var ROOT_ID = '__vista-dev-error-overlay';
16
+ var root = null;
17
+ var messageNode = null;
18
+ var titleNode = null;
19
+ var metaNode = null;
20
+ var filesWrapNode = null;
21
+ var filesNode = null;
22
+ var hintsWrapNode = null;
23
+ var hintsNode = null;
24
+ var copyButton = null;
25
+ var minimizeButton = null;
26
+ var reloadButton = null;
27
+ var paginationNode = null;
28
+ var prevButton = null;
29
+ var nextButton = null;
30
+ var countNode = null;
31
+ var listenersBound = false;
32
+ var state = {
33
+ open: false,
34
+ minimized: false,
35
+ entries: [],
36
+ activeIndex: 0,
37
+ };
38
+
39
+ function getIndicator() {
40
+ return window.__VISTA_DEVTOOLS_INDICATOR__;
41
+ }
42
+
43
+ function pad2(value) {
44
+ return value < 10 ? '0' + value : String(value);
45
+ }
46
+
47
+ function formatTime(date) {
48
+ return pad2(date.getHours()) + ':' + pad2(date.getMinutes()) + ':' + pad2(date.getSeconds());
49
+ }
50
+
51
+ function escapeHtml(value) {
52
+ return String(value || '')
53
+ .replace(/&/g, '&amp;')
54
+ .replace(/</g, '&lt;')
55
+ .replace(/>/g, '&gt;')
56
+ .replace(/"/g, '&quot;')
57
+ .replace(/'/g, '&#039;');
58
+ }
59
+
60
+ function highlightLine(line) {
61
+ var escaped = escapeHtml(line);
62
+ if (/^\s*\^+/.test(line)) {
63
+ return '<span class="vista-ov-tok-caret">' + escaped + '</span>';
64
+ }
65
+ if (/^\s*at\s+/.test(line)) {
66
+ return '<span class="vista-ov-tok-stack">' + escaped + '</span>';
67
+ }
68
+
69
+ var numbered = escaped.match(/^(\s*\d+)(\s*\|)(.*)$/);
70
+ if (numbered) {
71
+ escaped =
72
+ '<span class="vista-ov-tok-line">' + numbered[1] + '</span>' + numbered[2] + numbered[3];
73
+ }
74
+
75
+ escaped = escaped.replace(
76
+ /((?:[A-Za-z]:)?[\\/\w.@%:-]+\.(?:tsx?|jsx?|mjs|cjs|css|json|mdx?)(?::\d+(?::\d+)?)?)/g,
77
+ '<span class="vista-ov-tok-path">$1</span>'
78
+ );
79
+ escaped = escaped.replace(
80
+ /(&quot;[^&]+&quot;|&#039;[^&]+&#039;)/g,
81
+ '<span class="vista-ov-tok-string">$1</span>'
82
+ );
83
+ escaped = escaped.replace(
84
+ /(TypeError:|ReferenceError:|SyntaxError:|Error:|Cannot find module|Module not found|Build Error|Runtime Error|Hydration Error)/g,
85
+ '<span class="vista-ov-tok-error">$1</span>'
86
+ );
87
+ return escaped;
88
+ }
89
+
90
+ function colorizeBlock(value) {
91
+ return String(value || '')
92
+ .split(/\r?\n/)
93
+ .map(function (line) {
94
+ return highlightLine(line);
95
+ })
96
+ .join('\n');
97
+ }
98
+
99
+ function createStyle() {
100
+ if (document.getElementById(STYLE_ID)) return;
101
+ var style = document.createElement('style');
102
+ style.id = STYLE_ID;
103
+ style.textContent = [
104
+ '#' + ROOT_ID + '{position:fixed;inset:0;z-index:2147482500;display:flex;align-items:center;justify-content:center;padding:26px;}',
105
+ '#' + ROOT_ID + '[hidden]{display:none;}',
106
+ '#' + ROOT_ID + ' .vista-ov-backdrop{position:absolute;inset:0;background:radial-gradient(circle at top, rgba(255,90,60,0.22), rgba(7,8,11,0.93) 42%);backdrop-filter:blur(5px);}',
107
+ '#' + ROOT_ID + ' .vista-ov-panel{position:relative;width:min(980px,100%);max-height:min(86vh,860px);display:flex;flex-direction:column;overflow:hidden;border-radius:15px;border:1px solid rgba(255,255,255,0.14);background:linear-gradient(180deg, rgba(25,27,32,0.97), rgba(10,12,15,0.98));box-shadow:0 32px 90px rgba(0,0,0,0.54);color:#e8ebf1;font-family:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;animation:vista-ov-in 170ms ease;}',
108
+ '#' + ROOT_ID + ' .vista-ov-header{display:flex;justify-content:space-between;gap:14px;align-items:flex-start;padding:15px 17px;border-bottom:1px solid rgba(255,255,255,0.12);background:linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0));}',
109
+ '#' + ROOT_ID + ' .vista-ov-head-left{min-width:0;display:flex;flex-direction:column;gap:8px;}',
110
+ '#' + ROOT_ID + ' .vista-ov-top{display:flex;align-items:center;gap:10px;}',
111
+ '#' + ROOT_ID + ' .vista-ov-badge{display:inline-flex;align-items:center;gap:7px;height:24px;padding:0 10px;border-radius:999px;border:1px solid rgba(248,113,113,0.5);background:rgba(248,113,113,0.14);font-size:11px;font-weight:700;letter-spacing:0.07em;text-transform:uppercase;color:#fecaca;white-space:nowrap;}',
112
+ '#' + ROOT_ID + ' .vista-ov-badge-dot{width:7px;height:7px;border-radius:999px;background:#f87171;box-shadow:0 0 0 3px rgba(248,113,113,0.24);}',
113
+ '#' + ROOT_ID + ' .vista-ov-pagination{display:inline-flex;align-items:center;gap:6px;padding:2px 3px;border-radius:999px;border:1px solid rgba(255,255,255,0.18);background:rgba(255,255,255,0.04);}',
114
+ '#' + ROOT_ID + ' .vista-ov-page-btn{width:22px;height:22px;display:inline-flex;align-items:center;justify-content:center;border:none;border-radius:999px;background:rgba(255,255,255,0.13);color:#f8fafc;font-size:11px;line-height:1;cursor:pointer;}',
115
+ '#' + ROOT_ID + ' .vista-ov-page-btn:disabled{opacity:0.35;cursor:not-allowed;}',
116
+ '#' + ROOT_ID + ' .vista-ov-page-btn:not(:disabled):hover{background:rgba(255,255,255,0.22);}',
117
+ '#' + ROOT_ID + ' .vista-ov-page-count{font-size:11px;font-weight:630;color:rgba(241,245,249,0.95);min-width:56px;text-align:center;font-variant-numeric:tabular-nums;}',
118
+ '#' + ROOT_ID + ' .vista-ov-title{margin:0;font-size:18px;line-height:1.33;font-weight:640;letter-spacing:0.01em;color:#f8fafc;word-break:break-word;}',
119
+ '#' + ROOT_ID + ' .vista-ov-meta{margin:0;font-size:12px;color:rgba(226,232,240,0.72);}',
120
+ '#' + ROOT_ID + ' .vista-ov-controls{display:flex;gap:8px;align-items:center;}',
121
+ '#' + ROOT_ID + ' .vista-ov-btn{width:30px;height:30px;padding:0;border-radius:9px;border:1px solid rgba(255,255,255,0.22);background:rgba(255,255,255,0.04);color:#e2e8f0;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:all 120ms ease;}',
122
+ '#' + ROOT_ID + ' .vista-ov-btn:hover{background:rgba(255,255,255,0.12);border-color:rgba(255,255,255,0.38);}',
123
+ '#' + ROOT_ID + ' .vista-ov-btn svg{width:14px;height:14px;display:block;}',
124
+ '#' + ROOT_ID + ' .vista-ov-btn:focus-visible{outline:2px solid rgba(255,255,255,0.68);outline-offset:2px;}',
125
+ '#' + ROOT_ID + ' .vista-ov-btn[data-variant="warn"]{border-color:rgba(248,113,113,0.48);color:#fecaca;background:rgba(248,113,113,0.1);}',
126
+ '#' + ROOT_ID + ' .vista-ov-body{padding:16px 17px 17px;overflow:auto;display:grid;grid-template-columns:1fr;gap:11px;}',
127
+ '#' + ROOT_ID + ' .vista-ov-section{border:1px solid rgba(255,255,255,0.11);border-radius:11px;background:rgba(255,255,255,0.03);padding:12px 12px;}',
128
+ '#' + ROOT_ID + ' .vista-ov-section-title{margin:0 0 8px;font-size:11px;letter-spacing:0.08em;text-transform:uppercase;font-weight:700;color:rgba(226,232,240,0.76);}',
129
+ '#' + ROOT_ID + ' .vista-ov-list{margin:0;padding-left:18px;display:grid;gap:6px;color:#e2e8f0;font-size:13px;line-height:1.44;}',
130
+ '#' + ROOT_ID + ' .vista-ov-list code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;background:rgba(255,255,255,0.06);padding:1px 5px;border-radius:5px;border:1px solid rgba(255,255,255,0.16);}',
131
+ '#' + ROOT_ID + ' .vista-ov-pre{margin:0;font-size:12.5px;line-height:1.58;color:#f1f5f9;white-space:pre-wrap;word-break:break-word;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;}',
132
+ '#' + ROOT_ID + ' .vista-ov-tok-error{color:#fca5a5;font-weight:640;}',
133
+ '#' + ROOT_ID + ' .vista-ov-tok-path{color:#93c5fd;}',
134
+ '#' + ROOT_ID + ' .vista-ov-tok-string{color:#86efac;}',
135
+ '#' + ROOT_ID + ' .vista-ov-tok-stack{color:#cbd5e1;}',
136
+ '#' + ROOT_ID + ' .vista-ov-tok-line{color:#fbbf24;}',
137
+ '#' + ROOT_ID + ' .vista-ov-tok-caret{color:#f87171;font-weight:700;}',
138
+ '@keyframes vista-ov-in{from{opacity:0;transform:translateY(6px) scale(0.99);}to{opacity:1;transform:translateY(0) scale(1);}}',
139
+ '@media (max-width: 860px){',
140
+ ' #' + ROOT_ID + '{padding:12px;}',
141
+ ' #' + ROOT_ID + ' .vista-ov-header{flex-direction:column;}',
142
+ ' #' + ROOT_ID + ' .vista-ov-controls{width:100%;justify-content:flex-end;}',
143
+ ' #' + ROOT_ID + ' .vista-ov-title{font-size:16px;}',
144
+ '}',
145
+ ].join('');
146
+ document.head.appendChild(style);
147
+ }
148
+
149
+ function ensureMounted() {
150
+ createStyle();
151
+ if (!root) {
152
+ root = document.getElementById(ROOT_ID);
153
+ }
154
+ if (!root) {
155
+ root = document.createElement('div');
156
+ root.id = ROOT_ID;
157
+ root.hidden = true;
158
+ root.innerHTML = [
159
+ '<div class="vista-ov-backdrop"></div>',
160
+ '<section class="vista-ov-panel" role="dialog" aria-modal="true" aria-label="Vista build error overlay">',
161
+ ' <header class="vista-ov-header">',
162
+ ' <div class="vista-ov-head-left">',
163
+ ' <div class="vista-ov-top">',
164
+ ' <span class="vista-ov-badge"><span class="vista-ov-badge-dot"></span>Build Error</span>',
165
+ ' <div class="vista-ov-pagination" data-vista-pagination hidden>',
166
+ ' <button type="button" class="vista-ov-page-btn" data-vista-prev aria-label="Previous error">&lt;</button>',
167
+ ' <span class="vista-ov-page-count" data-vista-count>1 / 1</span>',
168
+ ' <button type="button" class="vista-ov-page-btn" data-vista-next aria-label="Next error">&gt;</button>',
169
+ ' </div>',
170
+ ' </div>',
171
+ ' <h2 class="vista-ov-title" data-vista-ov-title>Build Error</h2>',
172
+ ' <p class="vista-ov-meta" data-vista-ov-meta></p>',
173
+ ' </div>',
174
+ ' <div class="vista-ov-controls">',
175
+ ' <button type="button" class="vista-ov-btn" data-vista-copy aria-label="Copy error">',
176
+ ' <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>',
177
+ ' </button>',
178
+ ' <button type="button" class="vista-ov-btn" data-vista-minimize aria-label="Minimize">',
179
+ ' <svg viewBox="0 0 24 24" fill="none" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M5 12H19" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>',
180
+ ' </button>',
181
+ ' <button type="button" class="vista-ov-btn" data-vista-reload aria-label="Reload">',
182
+ ' <svg viewBox="0 0 24 24" fill="none" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"><path d="M20 11A8 8 0 1 0 12 20" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><path d="M20 4V11H13" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',
183
+ ' </button>',
184
+ ' </div>',
185
+ ' </header>',
186
+ ' <div class="vista-ov-body">',
187
+ ' <section class="vista-ov-section" data-vista-hints-wrap hidden>',
188
+ ' <h3 class="vista-ov-section-title">Insights</h3>',
189
+ ' <ul class="vista-ov-list" data-vista-hints></ul>',
190
+ ' </section>',
191
+ ' <section class="vista-ov-section" data-vista-files-wrap hidden>',
192
+ ' <h3 class="vista-ov-section-title">Possible Files</h3>',
193
+ ' <ul class="vista-ov-list" data-vista-files></ul>',
194
+ ' </section>',
195
+ ' <section class="vista-ov-section">',
196
+ ' <h3 class="vista-ov-section-title">Message</h3>',
197
+ ' <pre class="vista-ov-pre" data-vista-message></pre>',
198
+ ' </section>',
199
+ ' </div>',
200
+ '</section>',
201
+ ].join('');
202
+ document.body.appendChild(root);
203
+ } else if (!root.isConnected && document.body) {
204
+ document.body.appendChild(root);
205
+ }
206
+
207
+ var backdrop = root.querySelector('.vista-ov-backdrop');
208
+ messageNode = root.querySelector('[data-vista-message]');
209
+ titleNode = root.querySelector('[data-vista-ov-title]');
210
+ metaNode = root.querySelector('[data-vista-ov-meta]');
211
+ filesWrapNode = root.querySelector('[data-vista-files-wrap]');
212
+ filesNode = root.querySelector('[data-vista-files]');
213
+ hintsWrapNode = root.querySelector('[data-vista-hints-wrap]');
214
+ hintsNode = root.querySelector('[data-vista-hints]');
215
+ copyButton = root.querySelector('[data-vista-copy]');
216
+ minimizeButton = root.querySelector('[data-vista-minimize]');
217
+ reloadButton = root.querySelector('[data-vista-reload]');
218
+ paginationNode = root.querySelector('[data-vista-pagination]');
219
+ prevButton = root.querySelector('[data-vista-prev]');
220
+ nextButton = root.querySelector('[data-vista-next]');
221
+ countNode = root.querySelector('[data-vista-count]');
222
+
223
+ if (listenersBound) return;
224
+ listenersBound = true;
225
+
226
+ if (copyButton) {
227
+ copyButton.addEventListener('click', function () {
228
+ copyCurrentMessage();
229
+ });
230
+ }
231
+ if (minimizeButton) {
232
+ minimizeButton.addEventListener('click', function () {
233
+ minimize();
234
+ });
235
+ }
236
+ if (reloadButton) {
237
+ reloadButton.addEventListener('click', function () {
238
+ reloadPage();
239
+ });
240
+ }
241
+ if (prevButton) {
242
+ prevButton.addEventListener('click', function () {
243
+ moveActiveIndex(-1);
244
+ });
245
+ }
246
+ if (nextButton) {
247
+ nextButton.addEventListener('click', function () {
248
+ moveActiveIndex(1);
249
+ });
250
+ }
251
+ if (backdrop) {
252
+ backdrop.addEventListener('click', function () {
253
+ minimize();
254
+ });
255
+ }
256
+ if (root) {
257
+ root.addEventListener('keydown', function (event) {
258
+ if (event.key === 'ArrowLeft') {
259
+ moveActiveIndex(-1);
260
+ } else if (event.key === 'ArrowRight') {
261
+ moveActiveIndex(1);
262
+ } else if (event.key === 'Escape') {
263
+ minimize();
264
+ }
265
+ });
266
+ }
267
+ }
268
+
269
+ function normalizeMessages(input) {
270
+ if (Array.isArray(input)) {
271
+ return input
272
+ .map(function (entry) {
273
+ return typeof entry === 'string' ? entry : String(entry || '');
274
+ })
275
+ .filter(function (entry) {
276
+ return entry.trim().length > 0;
277
+ });
278
+ }
279
+
280
+ if (input && typeof input === 'object' && Array.isArray(input.errors)) {
281
+ return normalizeMessages(input.errors);
282
+ }
283
+
284
+ var raw = typeof input === 'string' ? input : String(input || '');
285
+ if (raw.trim().length === 0) {
286
+ return [];
287
+ }
288
+
289
+ var splitByWebpack = raw.split(/\n(?=ERROR in\s)/g).filter(function (entry) {
290
+ return entry.trim().length > 0;
291
+ });
292
+ if (splitByWebpack.length > 1) {
293
+ return splitByWebpack;
294
+ }
295
+ return [raw];
296
+ }
297
+
298
+ function parseMessage(input) {
299
+ var raw = typeof input === 'string' ? input : String(input || 'Unknown build error.');
300
+ var lines = raw.split(/\r?\n/);
301
+ var trimmedLines = [];
302
+ for (var i = 0; i < lines.length; i += 1) {
303
+ var entry = lines[i] ? lines[i].trim() : '';
304
+ if (entry.length > 0) {
305
+ trimmedLines.push(entry);
306
+ }
307
+ }
308
+
309
+ var title = trimmedLines.length ? trimmedLines[0] : 'Build Error';
310
+ if (title.length > 140) {
311
+ title = title.slice(0, 137) + '...';
312
+ }
313
+
314
+ var files = [];
315
+ var filePattern = /(?:[A-Za-z]:)?[\\/\w.@-]+\.(?:tsx?|jsx?|mjs|cjs|css|json|mdx?)(?::\d+(?::\d+)?)?/;
316
+ for (var fileIdx = 0; fileIdx < lines.length; fileIdx += 1) {
317
+ var maybeFile = lines[fileIdx].match(filePattern);
318
+ if (!maybeFile) continue;
319
+ var normalized = maybeFile[0].replace(/\\/g, '/');
320
+ if (files.indexOf(normalized) === -1) {
321
+ files.push(normalized);
322
+ }
323
+ if (files.length >= 5) break;
324
+ }
325
+
326
+ var hints = [];
327
+ if (/['"]use client['"]/.test(raw)) {
328
+ hints.push("Client hook detected in a Server Component. Add 'use client' to the top of that file.");
329
+ }
330
+ if (/Cannot find module/i.test(raw) || /Module not found/i.test(raw)) {
331
+ hints.push('A module import failed to resolve. Check the import path or install the missing package.');
332
+ }
333
+ if (/Unexpected token/i.test(raw) || /SyntaxError/i.test(raw)) {
334
+ hints.push('A syntax issue is blocking compilation. Start from the first highlighted file and fix parsing errors.');
335
+ }
336
+ if (/Type error/i.test(raw) || /TS\d{3,5}/i.test(raw)) {
337
+ hints.push('TypeScript validation failed. Fix the first type error first to reduce cascading issues.');
338
+ }
339
+ if (/Structure Validation Failed/i.test(raw)) {
340
+ hints.push('App structure rules failed. Verify route files, layout/page naming, and required conventions.');
341
+ }
342
+ if (hints.length === 0 && files.length > 0) {
343
+ hints.push('Start with the first file above, then re-run after each fix.');
344
+ }
345
+ if (hints.length === 0) {
346
+ hints.push('Resolve the top-most failure first, then reload to see remaining issues.');
347
+ }
348
+
349
+ return {
350
+ raw: raw,
351
+ title: title,
352
+ files: files,
353
+ hints: hints,
354
+ timestamp: new Date(),
355
+ };
356
+ }
357
+
358
+ function fillList(node, values, wrapNode) {
359
+ if (!node || !wrapNode) return;
360
+ while (node.firstChild) node.removeChild(node.firstChild);
361
+ if (!values || values.length === 0) {
362
+ wrapNode.hidden = true;
363
+ return;
364
+ }
365
+ for (var i = 0; i < values.length; i += 1) {
366
+ var item = document.createElement('li');
367
+ var code = document.createElement('code');
368
+ code.textContent = values[i];
369
+ item.appendChild(code);
370
+ node.appendChild(item);
371
+ }
372
+ wrapNode.hidden = false;
373
+ }
374
+
375
+ function fillHints(node, values, wrapNode) {
376
+ if (!node || !wrapNode) return;
377
+ while (node.firstChild) node.removeChild(node.firstChild);
378
+ if (!values || values.length === 0) {
379
+ wrapNode.hidden = true;
380
+ return;
381
+ }
382
+ for (var i = 0; i < values.length; i += 1) {
383
+ var item = document.createElement('li');
384
+ item.textContent = values[i];
385
+ node.appendChild(item);
386
+ }
387
+ wrapNode.hidden = false;
388
+ }
389
+
390
+ function currentEntry() {
391
+ if (!state.entries || state.entries.length === 0) return null;
392
+ var index = state.activeIndex;
393
+ if (index < 0) index = 0;
394
+ if (index > state.entries.length - 1) index = state.entries.length - 1;
395
+ return state.entries[index];
396
+ }
397
+
398
+ function updatePagination() {
399
+ var total = state.entries.length;
400
+ var current = total === 0 ? 0 : state.activeIndex + 1;
401
+ if (countNode) {
402
+ countNode.textContent = current + ' / ' + (total || 1);
403
+ }
404
+ if (paginationNode) {
405
+ paginationNode.hidden = total <= 1;
406
+ }
407
+ if (prevButton) {
408
+ prevButton.disabled = state.activeIndex <= 0;
409
+ }
410
+ if (nextButton) {
411
+ nextButton.disabled = state.activeIndex >= total - 1;
412
+ }
413
+ }
414
+
415
+ function renderCurrent() {
416
+ var parsed = currentEntry();
417
+ if (!parsed || !root) return;
418
+ if (titleNode) titleNode.textContent = parsed.title || 'Build Error';
419
+ if (metaNode) {
420
+ metaNode.textContent =
421
+ 'Vista Dev Overlay | ' +
422
+ formatTime(parsed.timestamp) +
423
+ ' | ' +
424
+ (state.activeIndex + 1) +
425
+ ' of ' +
426
+ state.entries.length;
427
+ }
428
+ if (messageNode) messageNode.innerHTML = colorizeBlock(parsed.raw);
429
+ fillList(filesNode, parsed.files, filesWrapNode);
430
+ fillHints(hintsNode, parsed.hints, hintsWrapNode);
431
+ updatePagination();
432
+ }
433
+
434
+ function moveActiveIndex(offset) {
435
+ if (!state.entries || state.entries.length <= 1) return;
436
+ var next = state.activeIndex + offset;
437
+ if (next < 0 || next >= state.entries.length) return;
438
+ state.activeIndex = next;
439
+ renderCurrent();
440
+ }
441
+
442
+ function copyCurrentMessage() {
443
+ var entry = currentEntry();
444
+ if (!entry) return;
445
+ var text = entry.raw;
446
+ if (navigator && navigator.clipboard && navigator.clipboard.writeText) {
447
+ navigator.clipboard.writeText(text).catch(function () {});
448
+ return;
449
+ }
450
+ var textarea = document.createElement('textarea');
451
+ textarea.value = text;
452
+ textarea.style.position = 'fixed';
453
+ textarea.style.opacity = '0';
454
+ textarea.style.pointerEvents = 'none';
455
+ document.body.appendChild(textarea);
456
+ textarea.focus();
457
+ textarea.select();
458
+ try {
459
+ document.execCommand('copy');
460
+ } catch (e) {}
461
+ document.body.removeChild(textarea);
462
+ }
463
+
464
+ function reloadPage() {
465
+ if (typeof window === 'undefined') return;
466
+ window.location.reload();
467
+ }
468
+
469
+ function openFromState() {
470
+ ensureMounted();
471
+ if (!state.entries || state.entries.length === 0) return false;
472
+ state.open = true;
473
+ state.minimized = false;
474
+ renderCurrent();
475
+ if (root) root.hidden = false;
476
+ var indicator = getIndicator();
477
+ if (indicator && typeof indicator.clearError === 'function') {
478
+ indicator.clearError();
479
+ }
480
+ return true;
481
+ }
482
+
483
+ function show(input) {
484
+ ensureMounted();
485
+ var messages = normalizeMessages(input);
486
+ if (messages.length === 0) {
487
+ return;
488
+ }
489
+ state.entries = messages.map(function (message) {
490
+ return parseMessage(message);
491
+ });
492
+ state.activeIndex = 0;
493
+ openFromState();
494
+ }
495
+
496
+ function capture(input) {
497
+ ensureMounted();
498
+ var messages = normalizeMessages(input);
499
+ if (messages.length === 0) {
500
+ return;
501
+ }
502
+ state.entries = messages.map(function (message) {
503
+ return parseMessage(message);
504
+ });
505
+ state.activeIndex = 0;
506
+ state.open = false;
507
+ state.minimized = true;
508
+ if (root) root.hidden = true;
509
+ var entry = currentEntry();
510
+ var indicator = getIndicator();
511
+ if (indicator && typeof indicator.setError === 'function') {
512
+ indicator.setError(entry ? entry.title || 'Build error' : 'Build error', state.entries.length);
513
+ }
514
+ }
515
+
516
+ function minimize() {
517
+ var entry = currentEntry();
518
+ if (!entry) return false;
519
+ ensureMounted();
520
+ state.open = false;
521
+ state.minimized = true;
522
+ if (root) root.hidden = true;
523
+ var indicator = getIndicator();
524
+ if (indicator && typeof indicator.setError === 'function') {
525
+ indicator.setError(entry.title || 'Build error', state.entries.length);
526
+ }
527
+ return true;
528
+ }
529
+
530
+ function clear() {
531
+ state.open = false;
532
+ state.minimized = false;
533
+ state.entries = [];
534
+ state.activeIndex = 0;
535
+ if (root) root.hidden = true;
536
+ var indicator = getIndicator();
537
+ if (indicator && typeof indicator.clearError === 'function') {
538
+ indicator.clearError();
539
+ }
540
+ }
541
+
542
+ function restoreFromIndicator() {
543
+ if (!state.minimized || !state.entries || state.entries.length === 0) return false;
544
+ return openFromState();
545
+ }
546
+
547
+ window.__VISTA_DEV_ERROR_OVERLAY__ = {
548
+ show: show,
549
+ capture: capture,
550
+ minimize: minimize,
551
+ clear: clear,
552
+ restoreFromIndicator: restoreFromIndicator,
553
+ isOpen: function () {
554
+ return state.open;
555
+ },
556
+ hasError: function () {
557
+ return state.entries && state.entries.length > 0;
558
+ },
559
+ };
560
+ })();
561
+ `;
562
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Returns a plain JS snippet that installs a floating Vista devtools indicator
3
+ * in development builds. The snippet is injected into generated client entries.
4
+ */
5
+ export declare function getDevToolsIndicatorBootstrapSource(bootSessionId: string): string;