@nuxt/nitro-server-nightly 4.3.0-29442149.b56ec45a → 4.3.0-29442822.8b75e462
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/dist/index.mjs +1 -1
- package/dist/runtime/utils/dev.js +849 -202
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -19,7 +19,7 @@ import { isWindows } from 'std-env';
|
|
|
19
19
|
import { ImpoundPlugin } from 'impound';
|
|
20
20
|
import { resolveModulePath } from 'exsolve';
|
|
21
21
|
|
|
22
|
-
const version = "4.3.0-
|
|
22
|
+
const version = "4.3.0-29442822.8b75e462";
|
|
23
23
|
const nitroBuilder = {
|
|
24
24
|
version: version};
|
|
25
25
|
|
|
@@ -1,140 +1,151 @@
|
|
|
1
1
|
const iframeStorageBridge = (nonce) => (
|
|
2
2
|
/* js */
|
|
3
3
|
`
|
|
4
|
-
(function() {
|
|
5
|
-
const
|
|
4
|
+
(function () {
|
|
5
|
+
const NONCE = ${JSON.stringify(nonce)};
|
|
6
|
+
const memoryStore = Object.create(null);
|
|
7
|
+
|
|
8
|
+
const post = (type, payload) => {
|
|
9
|
+
window.parent.postMessage({ type, nonce: NONCE, ...payload }, '*');
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const isValid = (data) => data && data.nonce === NONCE;
|
|
6
13
|
|
|
7
|
-
const NONCE = ${JSON.stringify(nonce)}
|
|
8
|
-
|
|
9
14
|
const mockStorage = {
|
|
10
|
-
getItem
|
|
11
|
-
return memoryStore
|
|
15
|
+
getItem(key) {
|
|
16
|
+
return Object.hasOwn(memoryStore, key)
|
|
17
|
+
? memoryStore[key]
|
|
18
|
+
: null;
|
|
12
19
|
},
|
|
13
|
-
setItem
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
key: key,
|
|
18
|
-
value: String(value),
|
|
19
|
-
nonce: NONCE
|
|
20
|
-
}, '*');
|
|
20
|
+
setItem(key, value) {
|
|
21
|
+
const v = String(value);
|
|
22
|
+
memoryStore[key] = v;
|
|
23
|
+
post('storage-set', { key, value: v });
|
|
21
24
|
},
|
|
22
|
-
removeItem
|
|
25
|
+
removeItem(key) {
|
|
23
26
|
delete memoryStore[key];
|
|
24
|
-
|
|
25
|
-
type: 'storage-remove',
|
|
26
|
-
key: key,
|
|
27
|
-
nonce: NONCE
|
|
28
|
-
}, '*');
|
|
27
|
+
post('storage-remove', { key });
|
|
29
28
|
},
|
|
30
|
-
clear
|
|
31
|
-
for (const key
|
|
29
|
+
clear() {
|
|
30
|
+
for (const key of Object.keys(memoryStore))
|
|
32
31
|
delete memoryStore[key];
|
|
33
|
-
}
|
|
34
|
-
window.parent.postMessage({
|
|
35
|
-
type: 'storage-clear',
|
|
36
|
-
nonce: NONCE
|
|
37
|
-
}, '*');
|
|
32
|
+
post('storage-clear', {});
|
|
38
33
|
},
|
|
39
|
-
key
|
|
34
|
+
key(index) {
|
|
40
35
|
const keys = Object.keys(memoryStore);
|
|
41
|
-
return keys[index]
|
|
36
|
+
return keys[index] ?? null;
|
|
42
37
|
},
|
|
43
38
|
get length() {
|
|
44
39
|
return Object.keys(memoryStore).length;
|
|
45
40
|
}
|
|
46
41
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
window.addEventListener('message', function(event) {
|
|
59
|
-
if (event.data.type === 'storage-sync-data' && event.data.nonce === NONCE) {
|
|
60
|
-
const data = event.data.data;
|
|
61
|
-
for (const key in data) {
|
|
62
|
-
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
|
63
|
-
memoryStore[key] = data[key];
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (typeof window.initTheme === 'function') {
|
|
67
|
-
window.initTheme();
|
|
68
|
-
}
|
|
69
|
-
window.dispatchEvent(new Event('storage-ready'));
|
|
42
|
+
|
|
43
|
+
const defineLocalStorage = () => {
|
|
44
|
+
try {
|
|
45
|
+
Object.defineProperty(window, 'localStorage', {
|
|
46
|
+
value: mockStorage,
|
|
47
|
+
writable: false,
|
|
48
|
+
configurable: true
|
|
49
|
+
});
|
|
50
|
+
} catch {
|
|
51
|
+
window.localStorage = mockStorage;
|
|
70
52
|
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
defineLocalStorage();
|
|
56
|
+
|
|
57
|
+
window.addEventListener('message', (event) => {
|
|
58
|
+
const data = event.data;
|
|
59
|
+
if (!isValid(data) || data.type !== 'storage-sync-data') return;
|
|
60
|
+
|
|
61
|
+
const incoming = data.data || {};
|
|
62
|
+
for (const key of Object.keys(incoming))
|
|
63
|
+
memoryStore[key] = incoming[key];
|
|
64
|
+
|
|
65
|
+
if (typeof window.initTheme === 'function')
|
|
66
|
+
window.initTheme();
|
|
67
|
+
window.dispatchEvent(new Event('storage-ready'));
|
|
71
68
|
});
|
|
72
|
-
|
|
73
|
-
window.parent.postMessage({
|
|
74
|
-
type: 'storage-sync-request',
|
|
75
|
-
nonce: NONCE
|
|
76
|
-
}, '*');
|
|
77
69
|
|
|
78
70
|
// Clipboard API is unavailable in data: URL iframe, so we use postMessage
|
|
79
71
|
document.addEventListener('DOMContentLoaded', function() {
|
|
80
72
|
window.copyErrorMessage = function(button) {
|
|
81
|
-
|
|
73
|
+
post('clipboard-copy', { text: button.dataset.errorText });
|
|
82
74
|
button.classList.add('copied');
|
|
83
75
|
setTimeout(function() { button.classList.remove('copied'); }, 2000);
|
|
84
76
|
};
|
|
85
77
|
});
|
|
78
|
+
|
|
79
|
+
post('storage-sync-request', {});
|
|
86
80
|
})();
|
|
87
81
|
`
|
|
88
82
|
);
|
|
89
83
|
const parentStorageBridge = (nonce) => (
|
|
90
84
|
/* js */
|
|
91
85
|
`
|
|
92
|
-
(function() {
|
|
93
|
-
const
|
|
86
|
+
(function () {
|
|
87
|
+
const host = document.querySelector('nuxt-error-overlay');
|
|
88
|
+
if (!host) return;
|
|
89
|
+
|
|
90
|
+
const NONCE = ${JSON.stringify(nonce)};
|
|
91
|
+
const isValid = (data) => data && data.nonce === NONCE;
|
|
94
92
|
|
|
95
93
|
// Handle clipboard copy from iframe
|
|
96
94
|
window.addEventListener('message', function(e) {
|
|
97
|
-
if (e
|
|
95
|
+
if (isValid(e) && e.data.type === 'clipboard-copy') {
|
|
98
96
|
navigator.clipboard.writeText(e.data.text).catch(function() {});
|
|
99
97
|
}
|
|
100
98
|
});
|
|
101
99
|
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (host.shadowRoot) {
|
|
108
|
-
clearInterval(checkShadow);
|
|
109
|
-
const iframe = host.shadowRoot.getElementById('frame');
|
|
110
|
-
if (!iframe) return;
|
|
111
|
-
|
|
112
|
-
window.addEventListener('message', function(event) {
|
|
113
|
-
if (!event.data || event.data.nonce !== NONCE) return;
|
|
114
|
-
|
|
115
|
-
const data = event.data;
|
|
116
|
-
|
|
117
|
-
if (data.type === 'storage-set') {
|
|
118
|
-
localStorage.setItem(data.key, data.value);
|
|
119
|
-
} else if (data.type === 'storage-remove') {
|
|
120
|
-
localStorage.removeItem(data.key);
|
|
121
|
-
} else if (data.type === 'storage-clear') {
|
|
122
|
-
localStorage.clear();
|
|
123
|
-
} else if (data.type === 'storage-sync-request') {
|
|
124
|
-
const allData = {};
|
|
125
|
-
for (let i = 0; i < localStorage.length; i++) {
|
|
126
|
-
const key = localStorage.key(i);
|
|
127
|
-
allData[key] = localStorage.getItem(key);
|
|
128
|
-
}
|
|
129
|
-
iframe.contentWindow.postMessage({
|
|
130
|
-
type: 'storage-sync-data',
|
|
131
|
-
data: allData,
|
|
132
|
-
nonce: NONCE
|
|
133
|
-
}, '*');
|
|
134
|
-
}
|
|
135
|
-
});
|
|
100
|
+
const collectLocalStorage = () => {
|
|
101
|
+
const all = {};
|
|
102
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
103
|
+
const k = localStorage.key(i);
|
|
104
|
+
if (k != null) all[k] = localStorage.getItem(k);
|
|
136
105
|
}
|
|
137
|
-
|
|
106
|
+
return all;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const attachWhenReady = () => {
|
|
110
|
+
const root = host.shadowRoot;
|
|
111
|
+
if (!root)
|
|
112
|
+
return false;
|
|
113
|
+
const iframe = root.getElementById('frame');
|
|
114
|
+
if (!iframe || !iframe.contentWindow)
|
|
115
|
+
return false;
|
|
116
|
+
|
|
117
|
+
const handlers = {
|
|
118
|
+
'storage-set': (d) => localStorage.setItem(d.key, d.value),
|
|
119
|
+
'storage-remove': (d) => localStorage.removeItem(d.key),
|
|
120
|
+
'storage-clear': () => localStorage.clear(),
|
|
121
|
+
'storage-sync-request': () => {
|
|
122
|
+
iframe.contentWindow.postMessage({
|
|
123
|
+
type: 'storage-sync-data',
|
|
124
|
+
data: collectLocalStorage(),
|
|
125
|
+
nonce: NONCE
|
|
126
|
+
}, '*');
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
window.addEventListener('message', (event) => {
|
|
131
|
+
const data = event.data;
|
|
132
|
+
if (!isValid(data)) return;
|
|
133
|
+
const fn = handlers[data.type];
|
|
134
|
+
if (fn) fn(data);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
return true;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
if (attachWhenReady())
|
|
141
|
+
return;
|
|
142
|
+
|
|
143
|
+
const obs = new MutationObserver(() => {
|
|
144
|
+
if (attachWhenReady())
|
|
145
|
+
obs.disconnect();
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
obs.observe(host, { childList: true, subtree: true });
|
|
138
149
|
})();
|
|
139
150
|
`
|
|
140
151
|
);
|
|
@@ -147,6 +158,15 @@ const errorCSS = (
|
|
|
147
158
|
--base-width: 1200px;
|
|
148
159
|
--base-height: 900px;
|
|
149
160
|
--z-base: 999999998;
|
|
161
|
+
--error-pip-left: auto;
|
|
162
|
+
--error-pip-top: auto;
|
|
163
|
+
--error-pip-right: 5px;
|
|
164
|
+
--error-pip-bottom: 5px;
|
|
165
|
+
--error-pip-origin: bottom right;
|
|
166
|
+
--app-preview-left: auto;
|
|
167
|
+
--app-preview-top: auto;
|
|
168
|
+
--app-preview-right: 5px;
|
|
169
|
+
--app-preview-bottom: 5px;
|
|
150
170
|
all: initial;
|
|
151
171
|
display: contents;
|
|
152
172
|
}
|
|
@@ -171,37 +191,44 @@ const errorCSS = (
|
|
|
171
191
|
z-index: var(--z-base);
|
|
172
192
|
}
|
|
173
193
|
#frame[inert] {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
194
|
+
left: var(--error-pip-left);
|
|
195
|
+
top: var(--error-pip-top);
|
|
196
|
+
right: var(--error-pip-right);
|
|
197
|
+
bottom: var(--error-pip-bottom);
|
|
178
198
|
width: var(--base-width);
|
|
179
199
|
height: var(--base-height);
|
|
180
200
|
transform: scale(calc(240 / 1200));
|
|
181
|
-
transform-origin:
|
|
201
|
+
transform-origin: var(--error-pip-origin);
|
|
182
202
|
overflow: hidden;
|
|
183
203
|
border-radius: calc(1200 * 8px / 240);
|
|
184
204
|
}
|
|
185
205
|
#preview {
|
|
186
206
|
position: fixed;
|
|
187
|
-
|
|
188
|
-
|
|
207
|
+
left: var(--app-preview-left);
|
|
208
|
+
top: var(--app-preview-top);
|
|
209
|
+
right: var(--app-preview-right);
|
|
210
|
+
bottom: var(--app-preview-bottom);
|
|
189
211
|
width: var(--preview-width);
|
|
190
212
|
height: var(--preview-height);
|
|
191
213
|
overflow: hidden;
|
|
192
|
-
border-radius:
|
|
214
|
+
border-radius: 6px;
|
|
193
215
|
pointer-events: none;
|
|
194
216
|
z-index: var(--z-base);
|
|
195
217
|
background: white;
|
|
196
218
|
display: none;
|
|
197
219
|
}
|
|
220
|
+
#preview iframe {
|
|
221
|
+
transform-origin: var(--error-pip-origin);
|
|
222
|
+
}
|
|
198
223
|
#frame:not([inert]) + #preview {
|
|
199
224
|
display: block;
|
|
200
225
|
}
|
|
201
226
|
#toggle {
|
|
202
227
|
position: fixed;
|
|
203
|
-
|
|
204
|
-
|
|
228
|
+
left: var(--app-preview-left);
|
|
229
|
+
top: var(--app-preview-top);
|
|
230
|
+
right: calc(var(--app-preview-right) - 3px);
|
|
231
|
+
bottom: calc(var(--app-preview-bottom) - 3px);
|
|
205
232
|
width: var(--preview-width);
|
|
206
233
|
height: var(--preview-height);
|
|
207
234
|
background: none;
|
|
@@ -211,6 +238,9 @@ const errorCSS = (
|
|
|
211
238
|
opacity: 0.8;
|
|
212
239
|
transition: opacity 0.2s, box-shadow 0.2s;
|
|
213
240
|
z-index: calc(var(--z-base) + 1);
|
|
241
|
+
display: flex;
|
|
242
|
+
align-items: center;
|
|
243
|
+
justify-content: center;
|
|
214
244
|
}
|
|
215
245
|
#toggle:hover,
|
|
216
246
|
#toggle:focus {
|
|
@@ -219,9 +249,85 @@ const errorCSS = (
|
|
|
219
249
|
}
|
|
220
250
|
#toggle:focus-visible {
|
|
221
251
|
outline: 3px solid #00DC82;
|
|
222
|
-
outline-offset:
|
|
252
|
+
outline-offset: 0;
|
|
223
253
|
box-shadow: 0 0 24px rgba(0, 220, 130, 0.8);
|
|
224
254
|
}
|
|
255
|
+
#frame[inert] ~ #toggle {
|
|
256
|
+
left: var(--error-pip-left);
|
|
257
|
+
top: var(--error-pip-top);
|
|
258
|
+
right: calc(var(--error-pip-right) - 3px);
|
|
259
|
+
bottom: calc(var(--error-pip-bottom) - 3px);
|
|
260
|
+
cursor: grab;
|
|
261
|
+
}
|
|
262
|
+
:host(.dragging) #frame[inert] ~ #toggle {
|
|
263
|
+
cursor: grabbing;
|
|
264
|
+
}
|
|
265
|
+
#frame:not([inert]) ~ #toggle,
|
|
266
|
+
#frame:not([inert]) + #preview {
|
|
267
|
+
cursor: grab;
|
|
268
|
+
}
|
|
269
|
+
:host(.dragging-preview) #frame:not([inert]) ~ #toggle,
|
|
270
|
+
:host(.dragging-preview) #frame:not([inert]) + #preview {
|
|
271
|
+
cursor: grabbing;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
#pip-close {
|
|
275
|
+
position: absolute;
|
|
276
|
+
top: 6px;
|
|
277
|
+
right: 6px;
|
|
278
|
+
width: 24px;
|
|
279
|
+
height: 24px;
|
|
280
|
+
border-radius: 50%;
|
|
281
|
+
border: none;
|
|
282
|
+
background: rgba(0, 0, 0, 0.75);
|
|
283
|
+
color: #fff;
|
|
284
|
+
font-size: 16px;
|
|
285
|
+
line-height: 1;
|
|
286
|
+
display: inline-flex;
|
|
287
|
+
align-items: center;
|
|
288
|
+
justify-content: center;
|
|
289
|
+
cursor: pointer;
|
|
290
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
|
291
|
+
pointer-events: auto;
|
|
292
|
+
}
|
|
293
|
+
#pip-close:focus-visible {
|
|
294
|
+
outline: 2px solid #00DC82;
|
|
295
|
+
outline-offset: 2px;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
#pip-restore {
|
|
299
|
+
position: fixed;
|
|
300
|
+
right: 16px;
|
|
301
|
+
bottom: 16px;
|
|
302
|
+
padding: 8px 14px;
|
|
303
|
+
border-radius: 999px;
|
|
304
|
+
border: 2px solid #00DC82;
|
|
305
|
+
background: #111;
|
|
306
|
+
color: #fff;
|
|
307
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
|
|
308
|
+
font-size: 14px;
|
|
309
|
+
display: inline-flex;
|
|
310
|
+
align-items: center;
|
|
311
|
+
gap: 6px;
|
|
312
|
+
z-index: calc(var(--z-base) + 2);
|
|
313
|
+
cursor: grab;
|
|
314
|
+
}
|
|
315
|
+
#pip-restore:focus-visible {
|
|
316
|
+
outline: 2px solid #00DC82;
|
|
317
|
+
outline-offset: 2px;
|
|
318
|
+
}
|
|
319
|
+
:host(.dragging-restore) #pip-restore {
|
|
320
|
+
cursor: grabbing;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
#frame[hidden],
|
|
324
|
+
#toggle[hidden],
|
|
325
|
+
#preview[hidden],
|
|
326
|
+
#pip-restore[hidden],
|
|
327
|
+
#pip-close[hidden] {
|
|
328
|
+
display: none !important;
|
|
329
|
+
}
|
|
330
|
+
|
|
225
331
|
@media (prefers-reduced-motion: reduce) {
|
|
226
332
|
#toggle {
|
|
227
333
|
transition: none;
|
|
@@ -233,109 +339,650 @@ function webComponentScript(base64HTML, startMinimized) {
|
|
|
233
339
|
return (
|
|
234
340
|
/* js */
|
|
235
341
|
`
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
342
|
+
(function () {
|
|
343
|
+
try {
|
|
344
|
+
// =========================
|
|
345
|
+
// Host + Shadow
|
|
346
|
+
// =========================
|
|
347
|
+
const host = document.querySelector('nuxt-error-overlay');
|
|
348
|
+
if (!host)
|
|
349
|
+
return;
|
|
350
|
+
const shadow = host.attachShadow({ mode: 'open' });
|
|
351
|
+
|
|
352
|
+
// =========================
|
|
353
|
+
// DOM helpers
|
|
354
|
+
// =========================
|
|
355
|
+
const el = (tag) => document.createElement(tag);
|
|
356
|
+
const on = (node, type, fn, opts) => node.addEventListener(type, fn, opts);
|
|
357
|
+
const hide = (node, v) => node.toggleAttribute('hidden', !!v);
|
|
358
|
+
const setVar = (name, value) => host.style.setProperty(name, value);
|
|
359
|
+
const unsetVar = (name) => host.style.removeProperty(name);
|
|
360
|
+
|
|
361
|
+
// =========================
|
|
362
|
+
// Create DOM
|
|
363
|
+
// =========================
|
|
364
|
+
const style = el('style');
|
|
365
|
+
style.textContent = ${JSON.stringify(errorCSS)};
|
|
366
|
+
|
|
367
|
+
const iframe = el('iframe');
|
|
368
|
+
iframe.id = 'frame';
|
|
369
|
+
iframe.src = 'data:text/html;base64,${base64HTML}';
|
|
370
|
+
iframe.title = 'Detailed error stack trace';
|
|
371
|
+
iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin');
|
|
372
|
+
|
|
373
|
+
const preview = el('div');
|
|
374
|
+
preview.id = 'preview';
|
|
375
|
+
|
|
376
|
+
const toggle = el('div');
|
|
377
|
+
toggle.id = 'toggle';
|
|
378
|
+
toggle.setAttribute('aria-expanded', 'true');
|
|
379
|
+
toggle.setAttribute('role', 'button');
|
|
380
|
+
toggle.setAttribute('tabindex', '0');
|
|
381
|
+
toggle.innerHTML = '<span class="sr-only">Toggle detailed error view</span>';
|
|
382
|
+
|
|
383
|
+
const liveRegion = el('div');
|
|
384
|
+
liveRegion.setAttribute('role', 'status');
|
|
385
|
+
liveRegion.setAttribute('aria-live', 'polite');
|
|
386
|
+
liveRegion.className = 'sr-only';
|
|
387
|
+
|
|
388
|
+
const pipCloseButton = el('button');
|
|
389
|
+
pipCloseButton.id = 'pip-close';
|
|
390
|
+
pipCloseButton.setAttribute('type', 'button');
|
|
391
|
+
pipCloseButton.setAttribute('aria-label', 'Hide error preview overlay');
|
|
392
|
+
pipCloseButton.innerHTML = '×';
|
|
393
|
+
pipCloseButton.hidden = true;
|
|
394
|
+
toggle.appendChild(pipCloseButton);
|
|
395
|
+
|
|
396
|
+
const pipRestoreButton = el('button');
|
|
397
|
+
pipRestoreButton.id = 'pip-restore';
|
|
398
|
+
pipRestoreButton.setAttribute('type', 'button');
|
|
399
|
+
pipRestoreButton.setAttribute('aria-label', 'Show error overlay');
|
|
400
|
+
pipRestoreButton.innerHTML = '<span aria-hidden="true">\u27F2</span><span>Show error overlay</span>';
|
|
401
|
+
pipRestoreButton.hidden = true;
|
|
402
|
+
|
|
403
|
+
// Order matters: #frame + #preview adjacency
|
|
404
|
+
shadow.appendChild(style);
|
|
405
|
+
shadow.appendChild(liveRegion);
|
|
406
|
+
shadow.appendChild(iframe);
|
|
407
|
+
shadow.appendChild(preview);
|
|
408
|
+
shadow.appendChild(toggle);
|
|
409
|
+
shadow.appendChild(pipRestoreButton);
|
|
410
|
+
|
|
411
|
+
// =========================
|
|
412
|
+
// Constants / keys
|
|
413
|
+
// =========================
|
|
414
|
+
const POS_KEYS = {
|
|
415
|
+
position: 'nuxt-error-overlay:position',
|
|
416
|
+
hiddenPretty: 'nuxt-error-overlay:error-pip:hidden',
|
|
417
|
+
hiddenPreview: 'nuxt-error-overlay:app-preview:hidden'
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
const CSS_VARS = {
|
|
421
|
+
pip: {
|
|
422
|
+
left: '--error-pip-left',
|
|
423
|
+
top: '--error-pip-top',
|
|
424
|
+
right: '--error-pip-right',
|
|
425
|
+
bottom: '--error-pip-bottom'
|
|
426
|
+
},
|
|
427
|
+
preview: {
|
|
428
|
+
left: '--app-preview-left',
|
|
429
|
+
top: '--app-preview-top',
|
|
430
|
+
right: '--app-preview-right',
|
|
431
|
+
bottom: '--app-preview-bottom'
|
|
290
432
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
const MIN_GAP = 5;
|
|
436
|
+
const DRAG_THRESHOLD = 2;
|
|
437
|
+
|
|
438
|
+
// =========================
|
|
439
|
+
// Local storage safe access + state
|
|
440
|
+
// =========================
|
|
441
|
+
let storageReady = true;
|
|
442
|
+
let isPrettyHidden = false;
|
|
443
|
+
let isPreviewHidden = false;
|
|
444
|
+
|
|
445
|
+
const safeGet = (k) => {
|
|
446
|
+
try {
|
|
447
|
+
return localStorage.getItem(k);
|
|
448
|
+
} catch {
|
|
449
|
+
return null;
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
const safeSet = (k, v) => {
|
|
454
|
+
if (!storageReady)
|
|
455
|
+
return;
|
|
456
|
+
try {
|
|
457
|
+
localStorage.setItem(k, v);
|
|
458
|
+
} catch {}
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
// =========================
|
|
462
|
+
// Sizing helpers
|
|
463
|
+
// =========================
|
|
464
|
+
const vvSize = () => {
|
|
465
|
+
const v = window.visualViewport;
|
|
466
|
+
return v ? { w: v.width, h: v.height } : { w: window.innerWidth, h: window.innerHeight };
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
const previewSize = () => {
|
|
470
|
+
const styles = getComputedStyle(host);
|
|
471
|
+
const w = parseFloat(styles.getPropertyValue('--preview-width')) || 240;
|
|
472
|
+
const h = parseFloat(styles.getPropertyValue('--preview-height')) || 180;
|
|
473
|
+
return { w, h };
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
const sizeForTarget = (target) => {
|
|
477
|
+
if (!target)
|
|
478
|
+
return previewSize();
|
|
479
|
+
const rect = target.getBoundingClientRect();
|
|
480
|
+
if (rect.width && rect.height)
|
|
481
|
+
return { w: rect.width, h: rect.height };
|
|
482
|
+
return previewSize();
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
// =========================
|
|
486
|
+
// Dock model + offset/alignment calculations
|
|
487
|
+
// =========================
|
|
488
|
+
const dock = { edge: null, offset: null, align: null, gap: null };
|
|
489
|
+
|
|
490
|
+
const maxOffsetFor = (edge, size) => {
|
|
491
|
+
const vv = vvSize();
|
|
492
|
+
if (edge === 'left' || edge === 'right')
|
|
493
|
+
return Math.max(MIN_GAP, vv.h - size.h - MIN_GAP);
|
|
494
|
+
return Math.max(MIN_GAP, vv.w - size.w - MIN_GAP);
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
const clampOffset = (edge, value, size) => {
|
|
498
|
+
const max = maxOffsetFor(edge, size);
|
|
499
|
+
return Math.min(Math.max(value, MIN_GAP), max);
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
const updateDockAlignment = (size) => {
|
|
503
|
+
if (!dock.edge || dock.offset == null)
|
|
504
|
+
return;
|
|
505
|
+
const max = maxOffsetFor(dock.edge, size);
|
|
506
|
+
if (dock.offset <= max / 2) {
|
|
507
|
+
dock.align = 'start';
|
|
508
|
+
dock.gap = dock.offset;
|
|
509
|
+
} else {
|
|
510
|
+
dock.align = 'end';
|
|
511
|
+
dock.gap = Math.max(0, max - dock.offset);
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
const appliedOffsetFor = (size) => {
|
|
516
|
+
if (!dock.edge || dock.offset == null)
|
|
517
|
+
return null;
|
|
518
|
+
const max = maxOffsetFor(dock.edge, size);
|
|
519
|
+
|
|
520
|
+
if (dock.align === 'end' && typeof dock.gap === 'number') {
|
|
521
|
+
return clampOffset(dock.edge, max - dock.gap, size);
|
|
522
|
+
}
|
|
523
|
+
if (dock.align === 'start' && typeof dock.gap === 'number') {
|
|
524
|
+
return clampOffset(dock.edge, dock.gap, size);
|
|
525
|
+
}
|
|
526
|
+
return clampOffset(dock.edge, dock.offset, size);
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
const nearestEdgeAt = (x, y) => {
|
|
530
|
+
const { w, h } = vvSize();
|
|
531
|
+
const d = { left: x, right: w - x, top: y, bottom: h - y };
|
|
532
|
+
return Object.keys(d).reduce((a, b) => (d[a] < d[b] ? a : b));
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
const cornerDefaultDock = () => {
|
|
536
|
+
const vv = vvSize();
|
|
537
|
+
const size = previewSize();
|
|
538
|
+
const offset = Math.max(MIN_GAP, vv.w - size.w - MIN_GAP);
|
|
539
|
+
return { edge: 'bottom', offset };
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
const currentTransformOrigin = () => {
|
|
543
|
+
if (!dock.edge) return null;
|
|
544
|
+
if (dock.edge === 'left' || dock.edge === 'top')
|
|
545
|
+
return 'top left';
|
|
546
|
+
if (dock.edge === 'right')
|
|
547
|
+
return 'top right';
|
|
548
|
+
return 'bottom left';
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
// =========================
|
|
552
|
+
// Persist / load dock
|
|
553
|
+
// =========================
|
|
554
|
+
const loadDock = () => {
|
|
555
|
+
const raw = safeGet(POS_KEYS.position);
|
|
556
|
+
if (!raw)
|
|
557
|
+
return;
|
|
558
|
+
try {
|
|
559
|
+
const parsed = JSON.parse(raw);
|
|
560
|
+
const { edge, offset, align, gap } = parsed || {};
|
|
561
|
+
if (!['left', 'right', 'top', 'bottom'].includes(edge))
|
|
562
|
+
return;
|
|
563
|
+
if (typeof offset !== 'number')
|
|
564
|
+
return;
|
|
565
|
+
|
|
566
|
+
dock.edge = edge;
|
|
567
|
+
dock.offset = clampOffset(edge, offset, previewSize());
|
|
568
|
+
dock.align = align === 'start' || align === 'end' ? align : null;
|
|
569
|
+
dock.gap = typeof gap === 'number' ? gap : null;
|
|
570
|
+
|
|
571
|
+
if (!dock.align || dock.gap == null)
|
|
572
|
+
updateDockAlignment(previewSize());
|
|
573
|
+
} catch {}
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
const persistDock = () => {
|
|
577
|
+
if (!dock.edge || dock.offset == null)
|
|
578
|
+
return;
|
|
579
|
+
safeSet(POS_KEYS.position, JSON.stringify({
|
|
580
|
+
edge: dock.edge,
|
|
581
|
+
offset: dock.offset,
|
|
582
|
+
align: dock.align,
|
|
583
|
+
gap: dock.gap
|
|
584
|
+
}));
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
// =========================
|
|
588
|
+
// Apply dock
|
|
589
|
+
// =========================
|
|
590
|
+
const dockToVars = (vars) => ({
|
|
591
|
+
set: (side, v) => host.style.setProperty(vars[side], v),
|
|
592
|
+
clear: (side) => host.style.removeProperty(vars[side])
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
const dockToEl = (node) => ({
|
|
596
|
+
set: (side, v) => { node.style[side] = v; },
|
|
597
|
+
clear: (side) => { node.style[side] = ''; }
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
const applyDock = (target, size, opts) => {
|
|
601
|
+
if (!dock.edge || dock.offset == null) {
|
|
602
|
+
target.clear('left');
|
|
603
|
+
target.clear('top');
|
|
604
|
+
target.clear('right');
|
|
605
|
+
target.clear('bottom');
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
target.set('left', 'auto');
|
|
610
|
+
target.set('top', 'auto');
|
|
611
|
+
target.set('right', 'auto');
|
|
612
|
+
target.set('bottom', 'auto');
|
|
613
|
+
|
|
614
|
+
const applied = appliedOffsetFor(size);
|
|
615
|
+
|
|
616
|
+
if (dock.edge === 'left') {
|
|
617
|
+
target.set('left', MIN_GAP + 'px');
|
|
618
|
+
target.set('top', applied + 'px');
|
|
619
|
+
} else if (dock.edge === 'right') {
|
|
620
|
+
target.set('right', MIN_GAP + 'px');
|
|
621
|
+
target.set('top', applied + 'px');
|
|
622
|
+
} else if (dock.edge === 'top') {
|
|
623
|
+
target.set('top', MIN_GAP + 'px');
|
|
624
|
+
target.set('left', applied + 'px');
|
|
625
|
+
} else {
|
|
626
|
+
target.set('bottom', MIN_GAP + 'px');
|
|
627
|
+
target.set('left', applied + 'px');
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
if (!opts || opts.persist !== false)
|
|
631
|
+
persistDock();
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
const applyDockAll = (opts) => {
|
|
635
|
+
applyDock(dockToVars(CSS_VARS.pip), previewSize(), opts);
|
|
636
|
+
applyDock(dockToVars(CSS_VARS.preview), previewSize(), opts);
|
|
637
|
+
applyDock(dockToEl(pipRestoreButton), sizeForTarget(pipRestoreButton), opts);
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
const repaintToDock = () => {
|
|
641
|
+
if (!dock.edge || dock.offset == null)
|
|
642
|
+
return;
|
|
643
|
+
const origin = currentTransformOrigin();
|
|
644
|
+
if (origin)
|
|
645
|
+
setVar('--error-pip-origin', origin);
|
|
646
|
+
else
|
|
647
|
+
unsetVar('--error-pip-origin');
|
|
648
|
+
applyDockAll({ persist: false });
|
|
649
|
+
};
|
|
650
|
+
|
|
651
|
+
// =========================
|
|
652
|
+
// Hidden state + UI
|
|
653
|
+
// =========================
|
|
654
|
+
const loadHidden = () => {
|
|
655
|
+
const rawPretty = safeGet(POS_KEYS.hiddenPretty);
|
|
656
|
+
if (rawPretty != null)
|
|
657
|
+
isPrettyHidden = rawPretty === '1' || rawPretty === 'true';
|
|
658
|
+
const rawPreview = safeGet(POS_KEYS.hiddenPreview);
|
|
659
|
+
if (rawPreview != null)
|
|
660
|
+
isPreviewHidden = rawPreview === '1' || rawPreview === 'true';
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
const setPrettyHidden = (v) => {
|
|
664
|
+
isPrettyHidden = !!v;
|
|
665
|
+
safeSet(POS_KEYS.hiddenPretty, isPrettyHidden ? '1' : '0');
|
|
666
|
+
updateUI();
|
|
667
|
+
};
|
|
668
|
+
|
|
669
|
+
const setPreviewHidden = (v) => {
|
|
670
|
+
isPreviewHidden = !!v;
|
|
671
|
+
safeSet(POS_KEYS.hiddenPreview, isPreviewHidden ? '1' : '0');
|
|
672
|
+
updateUI();
|
|
673
|
+
};
|
|
674
|
+
|
|
675
|
+
const isMinimized = () => iframe.hasAttribute('inert');
|
|
676
|
+
|
|
677
|
+
const setMinimized = (v) => {
|
|
678
|
+
if (v) {
|
|
679
|
+
iframe.setAttribute('inert', '');
|
|
680
|
+
toggle.setAttribute('aria-expanded', 'false');
|
|
681
|
+
} else {
|
|
682
|
+
iframe.removeAttribute('inert');
|
|
683
|
+
toggle.setAttribute('aria-expanded', 'true');
|
|
684
|
+
}
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
const setRestoreLabel = (kind) => {
|
|
688
|
+
if (kind === 'pretty') {
|
|
689
|
+
pipRestoreButton.innerHTML = '<span aria-hidden="true">\u27F2</span><span>Show error overlay</span>';
|
|
690
|
+
pipRestoreButton.setAttribute('aria-label', 'Show error overlay');
|
|
691
|
+
} else {
|
|
692
|
+
pipRestoreButton.innerHTML = '<span aria-hidden="true">\u27F2</span><span>Show error page</span>';
|
|
693
|
+
pipRestoreButton.setAttribute('aria-label', 'Show error page');
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
const updateUI = () => {
|
|
698
|
+
const minimized = isMinimized();
|
|
699
|
+
const showPiP = minimized && !isPrettyHidden;
|
|
700
|
+
const showPreview = !minimized && !isPreviewHidden;
|
|
701
|
+
const pipHiddenByUser = minimized && isPrettyHidden;
|
|
702
|
+
const previewHiddenByUser = !minimized && isPreviewHidden;
|
|
703
|
+
const showToggle = minimized ? showPiP : showPreview;
|
|
704
|
+
const showRestore = pipHiddenByUser || previewHiddenByUser;
|
|
705
|
+
|
|
706
|
+
hide(iframe, pipHiddenByUser);
|
|
707
|
+
hide(preview, !showPreview);
|
|
708
|
+
hide(toggle, !showToggle);
|
|
709
|
+
hide(pipCloseButton, !showToggle);
|
|
710
|
+
hide(pipRestoreButton, !showRestore);
|
|
711
|
+
|
|
712
|
+
pipCloseButton.setAttribute('aria-label', minimized ? 'Hide error overlay' : 'Hide error page preview');
|
|
713
|
+
|
|
714
|
+
if (pipHiddenByUser)
|
|
715
|
+
setRestoreLabel('pretty');
|
|
716
|
+
else if (previewHiddenByUser)
|
|
717
|
+
setRestoreLabel('preview');
|
|
718
|
+
|
|
719
|
+
host.classList.toggle('pip-hidden', isPrettyHidden);
|
|
720
|
+
host.classList.toggle('preview-hidden', isPreviewHidden);
|
|
721
|
+
};
|
|
722
|
+
|
|
723
|
+
// =========================
|
|
724
|
+
// Preview snapshot
|
|
725
|
+
// =========================
|
|
726
|
+
const updatePreview = () => {
|
|
727
|
+
try {
|
|
728
|
+
let previewIframe = preview.querySelector('iframe');
|
|
729
|
+
if (!previewIframe) {
|
|
730
|
+
previewIframe = el('iframe');
|
|
731
|
+
previewIframe.style.cssText = 'width: 1200px; height: 900px; transform: scale(0.2); transform-origin: top left; border: none;';
|
|
732
|
+
previewIframe.setAttribute('sandbox', 'allow-scripts allow-same-origin');
|
|
733
|
+
preview.appendChild(previewIframe);
|
|
308
734
|
}
|
|
735
|
+
|
|
736
|
+
const doctype = document.doctype ? '<!DOCTYPE ' + document.doctype.name + '>' : '';
|
|
737
|
+
const cleanedHTML = document.documentElement.outerHTML
|
|
738
|
+
.replace(/<nuxt-error-overlay[^>]*>.*?<\\/nuxt-error-overlay>/gs, '')
|
|
739
|
+
.replace(/<script[^>]*>.*?<\\/script>/gs, '');
|
|
740
|
+
|
|
741
|
+
const iframeDoc = previewIframe.contentDocument || previewIframe.contentWindow.document;
|
|
742
|
+
iframeDoc.open();
|
|
743
|
+
iframeDoc.write(doctype + cleanedHTML);
|
|
744
|
+
iframeDoc.close();
|
|
745
|
+
} catch (err) {
|
|
746
|
+
console.error('Failed to update preview:', err);
|
|
309
747
|
}
|
|
748
|
+
};
|
|
749
|
+
|
|
750
|
+
// =========================
|
|
751
|
+
// View toggling
|
|
752
|
+
// =========================
|
|
753
|
+
const toggleView = () => {
|
|
754
|
+
if (isMinimized()) {
|
|
755
|
+
updatePreview();
|
|
756
|
+
setMinimized(false);
|
|
757
|
+
liveRegion.textContent = 'Showing detailed error view';
|
|
758
|
+
setTimeout(() => {
|
|
759
|
+
try {
|
|
760
|
+
iframe.contentWindow.focus();
|
|
761
|
+
} catch {}
|
|
762
|
+
}, 100);
|
|
763
|
+
} else {
|
|
764
|
+
setMinimized(true);
|
|
765
|
+
liveRegion.textContent = 'Showing error page';
|
|
766
|
+
repaintToDock();
|
|
767
|
+
void iframe.offsetWidth;
|
|
768
|
+
}
|
|
769
|
+
updateUI();
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
// =========================
|
|
773
|
+
// Dragging (unified, rAF throttled)
|
|
774
|
+
// =========================
|
|
775
|
+
let drag = null;
|
|
776
|
+
let rafId = null;
|
|
777
|
+
let suppressToggleClick = false;
|
|
778
|
+
let suppressRestoreClick = false;
|
|
779
|
+
|
|
780
|
+
const beginDrag = (e) => {
|
|
781
|
+
if (drag)
|
|
782
|
+
return;
|
|
783
|
+
|
|
784
|
+
if (!dock.edge || dock.offset == null) {
|
|
785
|
+
const def = cornerDefaultDock();
|
|
786
|
+
dock.edge = def.edge;
|
|
787
|
+
dock.offset = def.offset;
|
|
788
|
+
updateDockAlignment(previewSize());
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
const isRestoreTarget = e.currentTarget === pipRestoreButton;
|
|
792
|
+
|
|
793
|
+
drag = {
|
|
794
|
+
kind: isRestoreTarget ? 'restore' : (isMinimized() ? 'pip' : 'preview'),
|
|
795
|
+
pointerId: e.pointerId,
|
|
796
|
+
startX: e.clientX,
|
|
797
|
+
startY: e.clientY,
|
|
798
|
+
lastX: e.clientX,
|
|
799
|
+
lastY: e.clientY,
|
|
800
|
+
moved: false,
|
|
801
|
+
target: e.currentTarget
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
drag.target.setPointerCapture(e.pointerId);
|
|
805
|
+
|
|
806
|
+
if (drag.kind === 'restore')
|
|
807
|
+
host.classList.add('dragging-restore');
|
|
808
|
+
else
|
|
809
|
+
host.classList.add(drag.kind === 'pip' ? 'dragging' : 'dragging-preview');
|
|
810
|
+
|
|
811
|
+
e.preventDefault();
|
|
812
|
+
};
|
|
813
|
+
|
|
814
|
+
const moveDrag = (e) => {
|
|
815
|
+
if (!drag || drag.pointerId !== e.pointerId)
|
|
816
|
+
return;
|
|
817
|
+
|
|
818
|
+
drag.lastX = e.clientX;
|
|
819
|
+
drag.lastY = e.clientY;
|
|
310
820
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
821
|
+
const dx = drag.lastX - drag.startX;
|
|
822
|
+
const dy = drag.lastY - drag.startY;
|
|
823
|
+
|
|
824
|
+
if (!drag.moved && (Math.abs(dx) > DRAG_THRESHOLD || Math.abs(dy) > DRAG_THRESHOLD)) {
|
|
825
|
+
drag.moved = true;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
if (!drag.moved)
|
|
829
|
+
return;
|
|
830
|
+
if (rafId)
|
|
831
|
+
return;
|
|
832
|
+
|
|
833
|
+
rafId = requestAnimationFrame(() => {
|
|
834
|
+
rafId = null;
|
|
835
|
+
|
|
836
|
+
const edge = nearestEdgeAt(drag.lastX, drag.lastY);
|
|
837
|
+
const size = sizeForTarget(drag.target);
|
|
838
|
+
|
|
839
|
+
let offset;
|
|
840
|
+
if (edge === 'left' || edge === 'right') {
|
|
841
|
+
const top = drag.lastY - (size.h / 2);
|
|
842
|
+
offset = clampOffset(edge, Math.round(top), size);
|
|
843
|
+
} else {
|
|
844
|
+
const left = drag.lastX - (size.w / 2);
|
|
845
|
+
offset = clampOffset(edge, Math.round(left), size);
|
|
316
846
|
}
|
|
847
|
+
|
|
848
|
+
dock.edge = edge;
|
|
849
|
+
dock.offset = offset;
|
|
850
|
+
updateDockAlignment(size);
|
|
851
|
+
|
|
852
|
+
const origin = currentTransformOrigin();
|
|
853
|
+
setVar('--error-pip-origin', origin || 'bottom right');
|
|
854
|
+
|
|
855
|
+
applyDockAll({ persist: false });
|
|
317
856
|
});
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
857
|
+
};
|
|
858
|
+
|
|
859
|
+
const endDrag = (e) => {
|
|
860
|
+
if (!drag || drag.pointerId !== e.pointerId)
|
|
861
|
+
return;
|
|
862
|
+
|
|
863
|
+
const endedKind = drag.kind;
|
|
864
|
+
drag.target.releasePointerCapture(e.pointerId);
|
|
865
|
+
|
|
866
|
+
if (endedKind === 'restore')
|
|
867
|
+
host.classList.remove('dragging-restore');
|
|
868
|
+
else
|
|
869
|
+
host.classList.remove(endedKind === 'pip' ? 'dragging' : 'dragging-preview');
|
|
870
|
+
|
|
871
|
+
const didMove = drag.moved;
|
|
872
|
+
drag = null;
|
|
873
|
+
|
|
874
|
+
if (didMove) {
|
|
875
|
+
persistDock();
|
|
876
|
+
if (endedKind === 'restore')
|
|
877
|
+
suppressRestoreClick = true;
|
|
878
|
+
else
|
|
879
|
+
suppressToggleClick = true;
|
|
880
|
+
e.preventDefault();
|
|
881
|
+
e.stopPropagation();
|
|
329
882
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
883
|
+
};
|
|
884
|
+
|
|
885
|
+
const bindDragTarget = (node) => {
|
|
886
|
+
on(node, 'pointerdown', beginDrag);
|
|
887
|
+
on(node, 'pointermove', moveDrag);
|
|
888
|
+
on(node, 'pointerup', endDrag);
|
|
889
|
+
on(node, 'pointercancel', endDrag);
|
|
890
|
+
};
|
|
891
|
+
|
|
892
|
+
bindDragTarget(toggle);
|
|
893
|
+
bindDragTarget(pipRestoreButton);
|
|
894
|
+
|
|
895
|
+
// =========================
|
|
896
|
+
// Events (toggle / close / restore)
|
|
897
|
+
// =========================
|
|
898
|
+
on(toggle, 'click', (e) => {
|
|
899
|
+
if (suppressToggleClick) {
|
|
900
|
+
e.preventDefault();
|
|
901
|
+
suppressToggleClick = false;
|
|
902
|
+
return;
|
|
903
|
+
}
|
|
904
|
+
toggleView();
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
on(toggle, 'keydown', (e) => {
|
|
908
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
909
|
+
e.preventDefault();
|
|
910
|
+
toggleView();
|
|
911
|
+
}
|
|
912
|
+
});
|
|
913
|
+
|
|
914
|
+
on(pipCloseButton, 'click', (e) => {
|
|
915
|
+
e.preventDefault();
|
|
916
|
+
e.stopPropagation();
|
|
917
|
+
if (isMinimized())
|
|
918
|
+
setPrettyHidden(true);
|
|
919
|
+
else
|
|
920
|
+
setPreviewHidden(true);
|
|
921
|
+
});
|
|
922
|
+
|
|
923
|
+
on(pipCloseButton, 'pointerdown', (e) => {
|
|
924
|
+
e.stopPropagation();
|
|
925
|
+
});
|
|
926
|
+
|
|
927
|
+
on(pipRestoreButton, 'click', (e) => {
|
|
928
|
+
if (suppressRestoreClick) {
|
|
929
|
+
e.preventDefault();
|
|
930
|
+
suppressRestoreClick = false;
|
|
931
|
+
return;
|
|
932
|
+
}
|
|
933
|
+
e.preventDefault();
|
|
934
|
+
e.stopPropagation();
|
|
935
|
+
if (isMinimized())
|
|
936
|
+
setPrettyHidden(false);
|
|
937
|
+
else
|
|
938
|
+
setPreviewHidden(false);
|
|
939
|
+
});
|
|
940
|
+
|
|
941
|
+
// =========================
|
|
942
|
+
// Lifecycle: load / sync / repaint
|
|
943
|
+
// =========================
|
|
944
|
+
const loadState = () => {
|
|
945
|
+
loadDock();
|
|
946
|
+
loadHidden();
|
|
947
|
+
|
|
948
|
+
if (isPrettyHidden && !isMinimized())
|
|
949
|
+
setMinimized(true);
|
|
950
|
+
|
|
951
|
+
updateUI();
|
|
952
|
+
repaintToDock();
|
|
953
|
+
};
|
|
954
|
+
|
|
955
|
+
loadState();
|
|
956
|
+
|
|
957
|
+
on(window, 'storage-ready', () => {
|
|
958
|
+
storageReady = true;
|
|
959
|
+
loadState();
|
|
960
|
+
});
|
|
961
|
+
|
|
962
|
+
const onViewportChange = () => repaintToDock();
|
|
963
|
+
|
|
964
|
+
on(window, 'resize', onViewportChange);
|
|
965
|
+
|
|
966
|
+
if (window.visualViewport) {
|
|
967
|
+
on(window.visualViewport, 'resize', onViewportChange);
|
|
968
|
+
on(window.visualViewport, 'scroll', onViewportChange);
|
|
336
969
|
}
|
|
337
|
-
|
|
338
|
-
|
|
970
|
+
|
|
971
|
+
// initial preview
|
|
972
|
+
setTimeout(updatePreview, 100);
|
|
973
|
+
|
|
974
|
+
// initial minimized option
|
|
975
|
+
if (${startMinimized}) {
|
|
976
|
+
setMinimized(true);
|
|
977
|
+
repaintToDock();
|
|
978
|
+
void iframe.offsetWidth;
|
|
979
|
+
updateUI();
|
|
980
|
+
}
|
|
981
|
+
} catch (err) {
|
|
982
|
+
console.error('Failed to initialize Nuxt error overlay:', err);
|
|
983
|
+
}
|
|
984
|
+
})();
|
|
985
|
+
`
|
|
339
986
|
);
|
|
340
987
|
}
|
|
341
988
|
export function generateErrorOverlayHTML(html, options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/nitro-server-nightly",
|
|
3
|
-
"version": "4.3.0-
|
|
3
|
+
"version": "4.3.0-29442822.8b75e462",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@nuxt/devalue": "^2.0.2",
|
|
22
|
-
"@nuxt/kit": "npm:@nuxt/kit-nightly@4.3.0-
|
|
22
|
+
"@nuxt/kit": "npm:@nuxt/kit-nightly@4.3.0-29442822.8b75e462",
|
|
23
23
|
"@unhead/vue": "^2.0.19",
|
|
24
24
|
"@vue/shared": "^3.5.26",
|
|
25
25
|
"consola": "^3.4.2",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"vue-devtools-stub": "^0.1.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"nuxt": "npm:nuxt-nightly@4.3.0-
|
|
50
|
+
"nuxt": "npm:nuxt-nightly@4.3.0-29442822.8b75e462"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.3.0-
|
|
54
|
-
"nuxt": "npm:nuxt-nightly@4.3.0-
|
|
53
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.3.0-29442822.8b75e462",
|
|
54
|
+
"nuxt": "npm:nuxt-nightly@4.3.0-29442822.8b75e462",
|
|
55
55
|
"unbuild": "3.6.1",
|
|
56
56
|
"vitest": "3.2.4"
|
|
57
57
|
},
|