@absolutejs/absolute 0.19.0-beta.230 → 0.19.0-beta.232

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/.absolutejs/vue-tsc.tsbuildinfo +1 -1
  2. package/.claude/settings.local.json +2 -1
  3. package/dist/ai-client/angular/ai/index.js +12 -14
  4. package/dist/ai-client/react/ai/index.js +12 -14
  5. package/dist/ai-client/vue/ai/index.js +12 -14
  6. package/dist/angular/ai/index.js +13 -15
  7. package/dist/angular/ai/index.js.map +3 -3
  8. package/dist/react/ai/index.js +13 -15
  9. package/dist/react/ai/index.js.map +3 -3
  10. package/dist/svelte/ai/index.js +13 -15
  11. package/dist/svelte/ai/index.js.map +3 -3
  12. package/dist/vue/ai/index.js +13 -15
  13. package/dist/vue/ai/index.js.map +3 -3
  14. package/package.json +1 -1
  15. package/dist/angular/components/image.component.js +0 -202
  16. package/dist/angular/components/index.js +0 -1
  17. package/dist/dev/client/constants.ts +0 -25
  18. package/dist/dev/client/cssUtils.ts +0 -305
  19. package/dist/dev/client/domDiff.ts +0 -225
  20. package/dist/dev/client/domState.ts +0 -420
  21. package/dist/dev/client/domTracker.ts +0 -60
  22. package/dist/dev/client/errorOverlay.ts +0 -183
  23. package/dist/dev/client/frameworkDetect.ts +0 -62
  24. package/dist/dev/client/handlers/angular.ts +0 -551
  25. package/dist/dev/client/handlers/angularRuntime.ts +0 -205
  26. package/dist/dev/client/handlers/html.ts +0 -361
  27. package/dist/dev/client/handlers/htmx.ts +0 -274
  28. package/dist/dev/client/handlers/react.ts +0 -107
  29. package/dist/dev/client/handlers/rebuild.ts +0 -152
  30. package/dist/dev/client/handlers/svelte.ts +0 -331
  31. package/dist/dev/client/handlers/vue.ts +0 -291
  32. package/dist/dev/client/headPatch.ts +0 -232
  33. package/dist/dev/client/hmrClient.ts +0 -250
  34. package/dist/dev/client/moduleVersions.ts +0 -61
  35. package/dist/dev/client/reactRefreshSetup.ts +0 -32
  36. package/dist/svelte/components/Head.svelte +0 -147
  37. package/dist/svelte/components/Head.svelte.d.ts +0 -5
  38. package/dist/svelte/components/Image.svelte +0 -161
  39. package/dist/svelte/components/Image.svelte.d.ts +0 -5
  40. package/dist/svelte/components/JsonLd.svelte +0 -20
  41. package/dist/svelte/components/JsonLd.svelte.d.ts +0 -2
  42. package/dist/vue/components/Image.vue +0 -186
  43. package/dist/vue/components/Image.vue.d.ts +0 -4
@@ -1,420 +0,0 @@
1
- /* DOM state snapshot/restore to preserve user-visible state across HMR */
2
-
3
- import type { DOMStateEntry, DOMStateSnapshot } from '../../../types/client';
4
- import {
5
- FOCUS_ID_PREFIX_LENGTH,
6
- FOCUS_IDX_PREFIX_LENGTH,
7
- FOCUS_NAME_PREFIX_LENGTH,
8
- UNFOUND_INDEX
9
- } from './constants';
10
-
11
- const trySetSelectionRange = (
12
- element: HTMLInputElement | HTMLTextAreaElement,
13
- start: number,
14
- end: number
15
- ) => {
16
- try {
17
- element.setSelectionRange(start, end);
18
- } catch {
19
- /* ignore */
20
- }
21
- };
22
-
23
- const restoreSelectionRange = (
24
- element: HTMLInputElement | HTMLTextAreaElement,
25
- entry: DOMStateEntry
26
- ) => {
27
- if (
28
- entry.selStart === undefined ||
29
- entry.selEnd === undefined ||
30
- !element.setSelectionRange
31
- )
32
- return;
33
- trySetSelectionRange(element, entry.selStart, entry.selEnd);
34
- };
35
-
36
- const restoreInputEntry = (target: Element, entry: DOMStateEntry) => {
37
- if (!(target instanceof HTMLInputElement)) return;
38
- const input = target;
39
- const type = entry.type || input.getAttribute('type') || 'text';
40
- if (type === 'checkbox' || type === 'radio') {
41
- if (entry.checked !== undefined) input.checked = entry.checked;
42
- } else if (entry.value !== undefined) {
43
- input.value = entry.value;
44
- }
45
- restoreSelectionRange(input, entry);
46
- };
47
-
48
- const restoreTextareaEntry = (target: Element, entry: DOMStateEntry) => {
49
- if (!(target instanceof HTMLTextAreaElement)) return;
50
- const textarea = target;
51
- if (entry.value !== undefined) textarea.value = entry.value;
52
- restoreSelectionRange(textarea, entry);
53
- };
54
-
55
- const restoreSelectEntry = (target: Element, entry: DOMStateEntry) => {
56
- if (!Array.isArray(entry.values)) return;
57
- if (!(target instanceof HTMLSelectElement)) return;
58
- const select = target;
59
- const { values } = entry;
60
- Array.from(select.options).forEach((opt) => {
61
- opt.selected = values.indexOf(opt.value) !== UNFOUND_INDEX;
62
- });
63
- };
64
-
65
- const restoreEntry = (target: Element, entry: DOMStateEntry) => {
66
- if (target.tagName === 'INPUT') {
67
- restoreInputEntry(target, entry);
68
-
69
- return;
70
- }
71
- if (target.tagName === 'TEXTAREA') {
72
- restoreTextareaEntry(target, entry);
73
-
74
- return;
75
- }
76
- if (target.tagName === 'SELECT') {
77
- restoreSelectEntry(target, entry);
78
-
79
- return;
80
- }
81
- if (target.tagName === 'OPTION') {
82
- if (entry.selected !== undefined && target instanceof HTMLOptionElement)
83
- target.selected = entry.selected;
84
-
85
- return;
86
- }
87
- if (target.tagName === 'DETAILS') {
88
- if (entry.open !== undefined && target instanceof HTMLDetailsElement)
89
- target.open = entry.open;
90
-
91
- return;
92
- }
93
- if (target.getAttribute('contenteditable') === 'true') {
94
- if (entry.text !== undefined) target.textContent = entry.text;
95
- }
96
- };
97
-
98
- const findEntryTarget = (
99
- root: HTMLElement,
100
- elements: NodeListOf<Element>,
101
- entry: DOMStateEntry
102
- ) => {
103
- if (entry.id) return root.querySelector(`#${CSS.escape(entry.id)}`);
104
- if (entry.name)
105
- return root.querySelector(`[name="${CSS.escape(entry.name)}"]`);
106
- if (elements[entry.idx]) return elements[entry.idx] ?? null;
107
-
108
- return null;
109
- };
110
-
111
- const resolveFocusElement = (
112
- root: HTMLElement,
113
- elements: NodeListOf<Element>,
114
- activeKey: string
115
- ) => {
116
- if (activeKey.startsWith('id:'))
117
- return root.querySelector(
118
- `#${CSS.escape(activeKey.slice(FOCUS_ID_PREFIX_LENGTH))}`
119
- );
120
- if (activeKey.startsWith('name:'))
121
- return root.querySelector(
122
- `[name="${CSS.escape(activeKey.slice(FOCUS_NAME_PREFIX_LENGTH))}"]`
123
- );
124
- if (!activeKey.startsWith('idx:')) return null;
125
- const idx = parseInt(activeKey.slice(FOCUS_IDX_PREFIX_LENGTH), 10);
126
- if (isNaN(idx) || !elements[idx]) return null;
127
-
128
- return elements[idx];
129
- };
130
-
131
- export const restoreDOMState = (
132
- root: HTMLElement,
133
- snapshot: DOMStateSnapshot
134
- ) => {
135
- if (!snapshot || !snapshot.items) return;
136
- const selector =
137
- 'input, textarea, select, option, [contenteditable="true"], details';
138
- const elements = root.querySelectorAll(selector);
139
-
140
- snapshot.items.forEach((entry) => {
141
- const target = findEntryTarget(root, elements, entry);
142
- if (!target) return;
143
- restoreEntry(target, entry);
144
- });
145
-
146
- if (!snapshot.activeKey) return;
147
- const focusEl = resolveFocusElement(root, elements, snapshot.activeKey);
148
- if (focusEl instanceof HTMLElement) {
149
- focusEl.focus();
150
- }
151
- };
152
-
153
- const resolveFormElement = (
154
- isStandalone: boolean,
155
- form: Element | null,
156
- name: string
157
- ) => {
158
- if (isStandalone) {
159
- const element: HTMLInputElement | null = document.querySelector(
160
- `input[name="${name}"], textarea[name="${name}"], select[name="${name}"]`
161
- );
162
- if (element) return element;
163
-
164
- const byId = document.getElementById(name);
165
- if (byId instanceof HTMLInputElement) return byId;
166
-
167
- return null;
168
- }
169
- if (!form) return null;
170
-
171
- const found = form.querySelector(`[name="${name}"], #${name}`);
172
- if (
173
- found instanceof HTMLInputElement ||
174
- found instanceof HTMLTextAreaElement ||
175
- found instanceof HTMLSelectElement
176
- )
177
- return found;
178
-
179
- return null;
180
- };
181
-
182
- const applyFormValue = (
183
- element: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement,
184
- value: boolean | string
185
- ) => {
186
- if (
187
- element instanceof HTMLInputElement &&
188
- (element.type === 'checkbox' || element.type === 'radio')
189
- ) {
190
- element.checked = value === true;
191
-
192
- return;
193
- }
194
- element.value = String(value);
195
- };
196
-
197
- const resolveForm = (formId: string) => {
198
- const formIndex = parseInt(formId.replace('form-', ''));
199
- const form = document.getElementById(formId);
200
- if (form) return form;
201
- if (isNaN(formIndex)) return null;
202
- try {
203
- return document.querySelector(`form:nth-of-type(${formIndex + 1})`);
204
- } catch {
205
- return null;
206
- }
207
- };
208
-
209
- const restoreRadioGroup = (
210
- isStandalone: boolean,
211
- form: Element | null,
212
- groupName: string,
213
- selectedValue: string
214
- ) => {
215
- const scope = isStandalone ? document : form;
216
- if (!scope) return;
217
-
218
- const escapedName = CSS.escape(groupName);
219
- const escapedValue = CSS.escape(selectedValue);
220
- const radio = scope.querySelector<HTMLInputElement>(
221
- `input[type="radio"][name="${escapedName}"][value="${escapedValue}"]`
222
- );
223
-
224
- if (radio) {
225
- radio.checked = true;
226
- }
227
- };
228
-
229
- const RADIO_PREFIX = '__radio__';
230
-
231
- export const restoreFormState = (
232
- formState: Record<string, Record<string, boolean | string>>
233
- ) => {
234
- Object.keys(formState).forEach((formId) => {
235
- const isStandalone = formId === '__standalone__';
236
- const form = isStandalone ? null : resolveForm(formId);
237
- const formData = formState[formId];
238
- if (!formData) return;
239
- Object.keys(formData).forEach((name) => {
240
- if (name.startsWith(RADIO_PREFIX)) {
241
- const groupName = name.slice(RADIO_PREFIX.length);
242
- const value = formData[name];
243
- if (value === undefined) return;
244
- restoreRadioGroup(isStandalone, form, groupName, String(value));
245
-
246
- return;
247
- }
248
- const element = resolveFormElement(isStandalone, form, name);
249
- if (!element) return;
250
- const value = formData[name];
251
- if (value === undefined) return;
252
- applyFormValue(element, value);
253
- });
254
- });
255
- };
256
-
257
- export const restoreScrollState = (scrollState: {
258
- window: { x: number; y: number };
259
- }) => {
260
- if (scrollState && scrollState.window) {
261
- window.scrollTo(scrollState.window.x, scrollState.window.y);
262
- }
263
- };
264
-
265
- const saveInputEntry = (elem: Element, entry: DOMStateEntry) => {
266
- if (!(elem instanceof HTMLInputElement)) return;
267
- const input = elem;
268
- const type = input.getAttribute('type') || 'text';
269
- entry.type = type;
270
- if (type === 'checkbox' || type === 'radio') {
271
- entry.checked = input.checked;
272
- } else {
273
- entry.value = input.value;
274
- }
275
- if (input.selectionStart !== null && input.selectionEnd !== null) {
276
- entry.selStart = input.selectionStart;
277
- entry.selEnd = input.selectionEnd;
278
- }
279
- };
280
-
281
- const saveTextareaEntry = (elem: Element, entry: DOMStateEntry) => {
282
- if (!(elem instanceof HTMLTextAreaElement)) return;
283
- const textarea = elem;
284
- entry.value = textarea.value;
285
- if (textarea.selectionStart !== null && textarea.selectionEnd !== null) {
286
- entry.selStart = textarea.selectionStart;
287
- entry.selEnd = textarea.selectionEnd;
288
- }
289
- };
290
-
291
- const saveSelectEntry = (elem: Element, entry: DOMStateEntry) => {
292
- if (!(elem instanceof HTMLSelectElement)) return;
293
- const select = elem;
294
- const vals: string[] = [];
295
- Array.from(select.options).forEach((opt) => {
296
- if (opt.selected) vals.push(opt.value);
297
- });
298
- entry.values = vals;
299
- };
300
-
301
- const saveElementEntry = (elem: Element, entry: DOMStateEntry) => {
302
- if (elem.tagName === 'INPUT') {
303
- saveInputEntry(elem, entry);
304
-
305
- return;
306
- }
307
- if (elem.tagName === 'TEXTAREA') {
308
- saveTextareaEntry(elem, entry);
309
-
310
- return;
311
- }
312
- if (elem.tagName === 'SELECT') {
313
- saveSelectEntry(elem, entry);
314
-
315
- return;
316
- }
317
- if (elem.tagName === 'OPTION') {
318
- if (elem instanceof HTMLOptionElement) entry.selected = elem.selected;
319
-
320
- return;
321
- }
322
- if (elem.tagName === 'DETAILS') {
323
- if (elem instanceof HTMLDetailsElement) entry.open = elem.open;
324
-
325
- return;
326
- }
327
- if (elem.getAttribute('contenteditable') === 'true') {
328
- entry.text = elem.textContent || undefined;
329
- }
330
- };
331
-
332
- export const saveDOMState = (root: HTMLElement) => {
333
- const snapshot: DOMStateSnapshot = { activeKey: null, items: [] };
334
- const selector =
335
- 'input, textarea, select, option, [contenteditable="true"], details';
336
- const elements = root.querySelectorAll(selector);
337
-
338
- elements.forEach((el, idx) => {
339
- const entry: DOMStateEntry = {
340
- idx,
341
- tag: el.tagName.toLowerCase()
342
- };
343
- const id = el.getAttribute('id');
344
- const name = el.getAttribute('name');
345
- if (id) entry.id = id;
346
- else if (name) entry.name = name;
347
- saveElementEntry(el, entry);
348
- snapshot.items.push(entry);
349
- });
350
-
351
- const active = document.activeElement;
352
- if (!active || !root.contains(active)) return snapshot;
353
- const id = active.getAttribute('id');
354
- const name = active.getAttribute('name');
355
- if (id) snapshot.activeKey = `id:${id}`;
356
- else if (name) snapshot.activeKey = `name:${name}`;
357
- else
358
- snapshot.activeKey = `idx:${Array.prototype.indexOf.call(elements, active)}`;
359
-
360
- return snapshot;
361
- };
362
-
363
- const collectInputState = (
364
- element: HTMLInputElement,
365
- name: string,
366
- target: Record<string, boolean | string>
367
- ) => {
368
- if (element.type === 'radio') {
369
- if (element.checked) target[`__radio__${name}`] = element.value;
370
-
371
- return;
372
- }
373
- if (element.type === 'checkbox') {
374
- target[name] = element.checked;
375
-
376
- return;
377
- }
378
- target[name] = element.value;
379
- };
380
-
381
- export const saveFormState = () => {
382
- const formState: Record<string, Record<string, boolean | string>> = {};
383
- const forms = document.querySelectorAll('form');
384
- forms.forEach((form, formIndex) => {
385
- const formId = form.id || `form-${formIndex}`;
386
- const formData: Record<string, boolean | string> = {};
387
- formState[formId] = formData;
388
- const inputs = form.querySelectorAll('input, textarea, select');
389
- inputs.forEach((input) => {
390
- if (!(input instanceof HTMLInputElement)) return;
391
- const name =
392
- input.name || input.id || `input-${formIndex}-${inputs.length}`;
393
- collectInputState(input, name, formData);
394
- });
395
- });
396
-
397
- const standaloneInputs = document.querySelectorAll(
398
- 'input:not(form input), textarea:not(form textarea), select:not(form select)'
399
- );
400
- if (standaloneInputs.length <= 0) return formState;
401
- const standaloneData: Record<string, boolean | string> = {};
402
- formState['__standalone__'] = standaloneData;
403
- standaloneInputs.forEach((input) => {
404
- if (!(input instanceof HTMLInputElement)) return;
405
- const name =
406
- input.name || input.id || `standalone-${standaloneInputs.length}`;
407
- collectInputState(input, name, standaloneData);
408
- });
409
-
410
- return formState;
411
- };
412
-
413
- export const saveScrollState = () => {
414
- const scrollX = window.scrollX || window.pageXOffset;
415
- const scrollY = window.scrollY || window.pageYOffset;
416
-
417
- return {
418
- window: { x: scrollX, y: scrollY }
419
- };
420
- };
@@ -1,60 +0,0 @@
1
- /* Snapshot/restore for JS-modified DOM state across HMR updates.
2
- * Before patching, captures text and dynamic children of elements with IDs.
3
- * After patching, restores values that were changed by user scripts. */
4
-
5
- type DOMSnapshot = {
6
- children: Map<string, string>;
7
- text: Map<string, string>;
8
- };
9
-
10
- export const restoreDOMChanges = (
11
- root: HTMLElement,
12
- snapshot: DOMSnapshot,
13
- newHTML: string
14
- ) => {
15
- const tempDiv = document.createElement('div');
16
- tempDiv.innerHTML = newHTML;
17
-
18
- /* Restore JS-modified text on leaf elements */
19
- snapshot.text.forEach((liveText, elId) => {
20
- const newEl = tempDiv.querySelector(`#${CSS.escape(elId)}`);
21
- const newText = newEl ? newEl.textContent || '' : '';
22
- if (liveText === newText) return;
23
-
24
- const liveEl = root.querySelector(`#${CSS.escape(elId)}`);
25
- if (liveEl) {
26
- liveEl.textContent = liveText;
27
- }
28
- });
29
-
30
- /* Restore JS-added children (e.g. dynamically appended list items) */
31
- snapshot.children.forEach((liveHTML, elId) => {
32
- const newEl = tempDiv.querySelector(`#${CSS.escape(elId)}`);
33
- const newInner = newEl ? newEl.innerHTML : '';
34
- if (liveHTML === newInner || liveHTML.length <= newInner.length) return;
35
-
36
- const liveEl = root.querySelector(`#${CSS.escape(elId)}`);
37
- if (liveEl) {
38
- liveEl.innerHTML = liveHTML;
39
- }
40
- });
41
- };
42
- export const snapshotDOMChanges = (root: HTMLElement): DOMSnapshot => {
43
- const text = new Map<string, string>();
44
- const children = new Map<string, string>();
45
-
46
- root.querySelectorAll('[id]').forEach((elem) => {
47
- const { childNodes } = elem;
48
- const isTextLeaf = Array.from(childNodes).every(
49
- (child) => child.nodeType === Node.TEXT_NODE
50
- );
51
-
52
- if (isTextLeaf && childNodes.length > 0) {
53
- text.set(elem.id, elem.textContent || '');
54
- } else if (elem.children.length > 0) {
55
- children.set(elem.id, elem.innerHTML);
56
- }
57
- });
58
-
59
- return { children, text };
60
- };
@@ -1,183 +0,0 @@
1
- /* AbsoluteJS Error Overlay - branded, per-framework, modern styling */
2
-
3
- import type { ErrorOverlayOptions } from '../../../types/client';
4
- import { OVERLAY_FADE_DURATION_MS } from './constants';
5
-
6
- let errorOverlayElement: HTMLDivElement | null = null;
7
- let currentOverlayKind: 'compilation' | 'runtime' | null = null;
8
-
9
- const frameworkLabels: Record<string, string> = {
10
- angular: 'Angular',
11
- assets: 'Assets',
12
- html: 'HTML',
13
- htmx: 'HTMX',
14
- react: 'React',
15
- svelte: 'Svelte',
16
- unknown: 'Unknown',
17
- vue: 'Vue'
18
- };
19
-
20
- const frameworkColors: Record<string, string> = {
21
- angular: '#dd0031',
22
- assets: '#563d7c',
23
- html: '#e34c26',
24
- htmx: '#1a365d',
25
- react: '#61dafb',
26
- svelte: '#ff3e00',
27
- unknown: '#94a3b8',
28
- vue: '#42b883'
29
- };
30
-
31
- const removeOverlayElement = () => {
32
- if (errorOverlayElement && errorOverlayElement.parentNode) {
33
- errorOverlayElement.parentNode.removeChild(errorOverlayElement);
34
- }
35
- errorOverlayElement = null;
36
- currentOverlayKind = null;
37
- };
38
-
39
- export const hideErrorOverlay = () => {
40
- const elm = errorOverlayElement;
41
- if (!elm || !elm.parentNode) {
42
- removeOverlayElement();
43
-
44
- return;
45
- }
46
- elm.style.transition = 'opacity 150ms ease-out';
47
- elm.style.opacity = '0';
48
- errorOverlayElement = null;
49
- currentOverlayKind = null;
50
- setTimeout(() => {
51
- if (elm.parentNode) elm.parentNode.removeChild(elm);
52
- }, OVERLAY_FADE_DURATION_MS);
53
- };
54
-
55
- export const isRuntimeErrorOverlay = () => currentOverlayKind === 'runtime';
56
-
57
- const buildLocationSection = (
58
- file: string | undefined,
59
- line: number | undefined,
60
- column: number | undefined,
61
- lineText: string | undefined
62
- ) => {
63
- if (!file && line === undefined && column === undefined && !lineText) {
64
- return null;
65
- }
66
-
67
- const locSection = document.createElement('div');
68
- locSection.style.cssText = 'margin-bottom:20px;';
69
-
70
- const locLabel = document.createElement('div');
71
- locLabel.style.cssText =
72
- 'font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.08em;color:#94a3b8;margin-bottom:8px;';
73
- locLabel.textContent = 'Where';
74
- locSection.appendChild(locLabel);
75
-
76
- const locParts: string[] = [];
77
- if (file) locParts.push(file);
78
- if (line !== undefined) locParts.push(String(line));
79
- if (column !== undefined) locParts.push(String(column));
80
- const loc = locParts.join(':') || 'Unknown location';
81
-
82
- const locEl = document.createElement('div');
83
- locEl.style.cssText =
84
- 'padding:12px 20px;background:rgba(71,85,105,0.3);border-radius:10px;border:1px solid rgba(71,85,105,0.4);color:#cbd5e1;font-size:13px;';
85
- locEl.textContent = loc;
86
- locSection.appendChild(locEl);
87
-
88
- if (lineText) {
89
- const codeBlock = document.createElement('pre');
90
- codeBlock.style.cssText =
91
- 'margin:8px 0 0;padding:14px 20px;background:rgba(15,23,42,0.8);border-radius:10px;border:1px solid rgba(71,85,105,0.4);color:#94a3b8;font-size:13px;overflow-x:auto;white-space:pre;';
92
- codeBlock.textContent = lineText;
93
- locSection.appendChild(codeBlock);
94
- }
95
-
96
- return locSection;
97
- };
98
-
99
- export const showErrorOverlay = (opts: ErrorOverlayOptions) => {
100
- const message = opts.message || 'Build failed';
101
- const { file } = opts;
102
- const { line } = opts;
103
- const { column } = opts;
104
- const { lineText } = opts;
105
- const framework = (opts.framework || 'unknown').toLowerCase();
106
- const frameworkLabel = frameworkLabels[framework] || framework;
107
- const accent = frameworkColors[framework] || '#94a3b8';
108
-
109
- removeOverlayElement();
110
- currentOverlayKind = opts.kind || 'compilation';
111
-
112
- const overlay = document.createElement('div');
113
- overlay.id = 'absolutejs-error-overlay';
114
- overlay.setAttribute('data-hmr-overlay', 'true');
115
- overlay.style.cssText =
116
- 'position:fixed;inset:0;z-index:2147483647;background:linear-gradient(135deg,rgba(15,23,42,0.98) 0%,rgba(30,41,59,0.98) 100%);backdrop-filter:blur(12px);color:#e2e8f0;font-family:"JetBrains Mono","Fira Code",ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:14px;line-height:1.6;overflow:auto;padding:32px;box-sizing:border-box;display:flex;align-items:flex-start;justify-content:center;';
117
-
118
- const card = document.createElement('div');
119
- card.style.cssText =
120
- 'max-width:720px;width:100%;background:rgba(30,41,59,0.6);border:1px solid rgba(71,85,105,0.5);border-radius:16px;box-shadow:0 25px 50px -12px rgba(0,0,0,0.5),0 0 0 1px rgba(255,255,255,0.05);overflow:hidden;';
121
-
122
- const header = document.createElement('div');
123
- header.style.cssText =
124
- 'display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 24px;background:rgba(15,23,42,0.5);border-bottom:1px solid rgba(71,85,105,0.4);';
125
- header.innerHTML = `<div style="display:flex;align-items:center;gap:12px;"><span style="font-weight:700;font-size:20px;color:#fff;letter-spacing:-0.02em;">AbsoluteJS</span><span style="padding:5px 10px;border-radius:8px;font-size:12px;font-weight:600;background:${
126
- accent
127
- };color:#fff;opacity:0.95;box-shadow:0 2px 4px rgba(0,0,0,0.2);">${
128
- frameworkLabel
129
- }</span></div><span style="color:#94a3b8;font-size:13px;font-weight:500;">${
130
- opts.kind === 'runtime' ? 'Runtime Error' : 'Compilation Error'
131
- }</span>`;
132
- card.appendChild(header);
133
-
134
- const content = document.createElement('div');
135
- content.style.cssText = 'padding:24px;';
136
-
137
- const errorSection = document.createElement('div');
138
- errorSection.style.cssText = 'margin-bottom:20px;';
139
-
140
- const errorLabel = document.createElement('div');
141
- errorLabel.style.cssText =
142
- 'font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.08em;color:#94a3b8;margin-bottom:8px;';
143
- errorLabel.textContent = 'What went wrong';
144
- errorSection.appendChild(errorLabel);
145
-
146
- const msgEl = document.createElement('pre');
147
- msgEl.style.cssText =
148
- 'margin:0;padding:16px 20px;background:rgba(239,68,68,0.12);border:1px solid rgba(239,68,68,0.25);border-radius:10px;overflow-x:auto;white-space:pre-wrap;word-break:break-word;color:#fca5a5;font-size:13px;line-height:1.5;';
149
- msgEl.textContent = message;
150
- errorSection.appendChild(msgEl);
151
- content.appendChild(errorSection);
152
-
153
- const locSection = buildLocationSection(file, line, column, lineText);
154
- if (locSection) {
155
- content.appendChild(locSection);
156
- }
157
-
158
- const footer = document.createElement('div');
159
- footer.style.cssText =
160
- 'display:flex;justify-content:flex-end;padding-top:8px;';
161
-
162
- const dismiss = document.createElement('button');
163
- dismiss.textContent = 'Dismiss';
164
- dismiss.style.cssText = `padding:10px 20px;background:${
165
- accent
166
- };color:#fff;border:none;border-radius:10px;font-size:13px;font-weight:600;cursor:pointer;box-shadow:0 2px 8px rgba(0,0,0,0.2);transition:opacity 0.15s,transform 0.15s;`;
167
- dismiss.onmouseover = function () {
168
- dismiss.style.opacity = '0.9';
169
- dismiss.style.transform = 'translateY(-1px)';
170
- };
171
- dismiss.onmouseout = function () {
172
- dismiss.style.opacity = '1';
173
- dismiss.style.transform = 'translateY(0)';
174
- };
175
- dismiss.onclick = hideErrorOverlay;
176
- footer.appendChild(dismiss);
177
- content.appendChild(footer);
178
- card.appendChild(content);
179
- overlay.appendChild(card);
180
- if (!document.body) return;
181
- document.body.appendChild(overlay);
182
- errorOverlayElement = overlay;
183
- };