@absolutejs/absolute 0.19.0-beta.706 → 0.19.0-beta.707

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 (80) hide show
  1. package/dist/angular/components/constants.js +78 -0
  2. package/dist/angular/components/core/streamingSlotRegistrar.js +58 -0
  3. package/dist/angular/components/core/streamingSlotRegistry.js +114 -0
  4. package/dist/angular/components/defer-slot-payload.js +6 -0
  5. package/dist/angular/components/defer-slot-templates.directive.js +44 -0
  6. package/dist/angular/components/defer-slot.component.js +149 -0
  7. package/dist/angular/components/image.component.js +202 -0
  8. package/dist/angular/components/index.js +4 -0
  9. package/dist/angular/components/stream-slot.component.js +103 -0
  10. package/dist/angular/index.js +7 -9
  11. package/dist/angular/index.js.map +4 -4
  12. package/dist/angular/server.js +7 -9
  13. package/dist/angular/server.js.map +4 -4
  14. package/dist/build.js +19 -26
  15. package/dist/build.js.map +4 -4
  16. package/dist/cli/index.js +197 -144
  17. package/dist/client/index.js +2 -4
  18. package/dist/client/index.js.map +2 -2
  19. package/dist/dev/client/constants.ts +26 -0
  20. package/dist/dev/client/cssUtils.ts +307 -0
  21. package/dist/dev/client/domDiff.ts +226 -0
  22. package/dist/dev/client/domState.ts +421 -0
  23. package/dist/dev/client/domTracker.ts +61 -0
  24. package/dist/dev/client/errorOverlay.ts +184 -0
  25. package/dist/dev/client/frameworkDetect.ts +63 -0
  26. package/dist/dev/client/handlers/angular.ts +572 -0
  27. package/dist/dev/client/handlers/angularRuntime.ts +226 -0
  28. package/dist/dev/client/handlers/html.ts +364 -0
  29. package/dist/dev/client/handlers/htmx.ts +278 -0
  30. package/dist/dev/client/handlers/react.ts +108 -0
  31. package/dist/dev/client/handlers/rebuild.ts +153 -0
  32. package/dist/dev/client/handlers/svelte.ts +334 -0
  33. package/dist/dev/client/handlers/vue.ts +292 -0
  34. package/dist/dev/client/headPatch.ts +233 -0
  35. package/dist/dev/client/hmrClient.ts +273 -0
  36. package/dist/dev/client/hmrState.ts +14 -0
  37. package/dist/dev/client/moduleVersions.ts +62 -0
  38. package/dist/dev/client/reactRefreshSetup.ts +32 -0
  39. package/dist/index.js +29 -33
  40. package/dist/index.js.map +5 -5
  41. package/dist/islands/index.js +6 -8
  42. package/dist/islands/index.js.map +4 -4
  43. package/dist/react/browser.js +7 -7
  44. package/dist/react/browser.js.map +2 -2
  45. package/dist/react/components/browser/index.js +101 -101
  46. package/dist/react/components/index.js +104 -104
  47. package/dist/react/components/index.js.map +2 -2
  48. package/dist/react/index.js +17 -19
  49. package/dist/react/index.js.map +4 -4
  50. package/dist/react/server.js +3 -3
  51. package/dist/react/server.js.map +3 -3
  52. package/dist/src/angular/components/constants.d.ts +75 -0
  53. package/dist/src/angular/components/defer-slot-templates.directive.d.ts +7 -0
  54. package/dist/src/angular/components/defer-slot.component.d.ts +5 -2
  55. package/dist/src/angular/components/image.component.d.ts +5 -2
  56. package/dist/src/angular/components/index.d.ts +4 -4
  57. package/dist/src/angular/components/stream-slot.component.d.ts +3 -0
  58. package/dist/src/constants.d.ts +1 -0
  59. package/dist/svelte/components/AwaitSlot.svelte +39 -0
  60. package/dist/svelte/components/AwaitSlot.svelte.d.ts +2 -0
  61. package/dist/svelte/components/Head.svelte +144 -0
  62. package/dist/svelte/components/Head.svelte.d.ts +2 -0
  63. package/dist/svelte/components/Image.svelte +164 -0
  64. package/dist/svelte/components/Image.svelte.d.ts +5 -0
  65. package/dist/svelte/components/Island.svelte +71 -0
  66. package/dist/svelte/components/Island.svelte.d.ts +5 -0
  67. package/dist/svelte/components/JsonLd.svelte +21 -0
  68. package/dist/svelte/components/JsonLd.svelte.d.ts +2 -0
  69. package/dist/svelte/components/StreamSlot.svelte +41 -0
  70. package/dist/svelte/components/StreamSlot.svelte.d.ts +2 -0
  71. package/dist/svelte/index.js +7 -9
  72. package/dist/svelte/index.js.map +4 -4
  73. package/dist/svelte/server.js +4 -4
  74. package/dist/svelte/server.js.map +3 -3
  75. package/dist/types/globals.d.ts +122 -0
  76. package/dist/vue/index.js +7 -9
  77. package/dist/vue/index.js.map +4 -4
  78. package/dist/vue/server.js +3 -3
  79. package/dist/vue/server.js.map +3 -3
  80. package/package.json +1 -1
@@ -0,0 +1,184 @@
1
+ import type {} from '../../types/globals';
2
+ /* AbsoluteJS Error Overlay - branded, per-framework, modern styling */
3
+
4
+ import type { ErrorOverlayOptions } from '../../types/client';
5
+ import { OVERLAY_FADE_DURATION_MS } from './constants';
6
+
7
+ let errorOverlayElement: HTMLDivElement | null = null;
8
+ let currentOverlayKind: 'compilation' | 'runtime' | null = null;
9
+
10
+ const frameworkLabels: Record<string, string> = {
11
+ angular: 'Angular',
12
+ assets: 'Assets',
13
+ html: 'HTML',
14
+ htmx: 'HTMX',
15
+ react: 'React',
16
+ svelte: 'Svelte',
17
+ unknown: 'Unknown',
18
+ vue: 'Vue'
19
+ };
20
+
21
+ const frameworkColors: Record<string, string> = {
22
+ angular: '#dd0031',
23
+ assets: '#563d7c',
24
+ html: '#e34c26',
25
+ htmx: '#1a365d',
26
+ react: '#61dafb',
27
+ svelte: '#ff3e00',
28
+ unknown: '#94a3b8',
29
+ vue: '#42b883'
30
+ };
31
+
32
+ const removeOverlayElement = () => {
33
+ if (errorOverlayElement && errorOverlayElement.parentNode) {
34
+ errorOverlayElement.parentNode.removeChild(errorOverlayElement);
35
+ }
36
+ errorOverlayElement = null;
37
+ currentOverlayKind = null;
38
+ };
39
+
40
+ export const hideErrorOverlay = () => {
41
+ const elm = errorOverlayElement;
42
+ if (!elm || !elm.parentNode) {
43
+ removeOverlayElement();
44
+
45
+ return;
46
+ }
47
+ elm.style.transition = 'opacity 150ms ease-out';
48
+ elm.style.opacity = '0';
49
+ errorOverlayElement = null;
50
+ currentOverlayKind = null;
51
+ setTimeout(() => {
52
+ if (elm.parentNode) elm.parentNode.removeChild(elm);
53
+ }, OVERLAY_FADE_DURATION_MS);
54
+ };
55
+
56
+ export const isRuntimeErrorOverlay = () => currentOverlayKind === 'runtime';
57
+
58
+ const buildLocationSection = (
59
+ file: string | undefined,
60
+ line: number | undefined,
61
+ column: number | undefined,
62
+ lineText: string | undefined
63
+ ) => {
64
+ if (!file && line === undefined && column === undefined && !lineText) {
65
+ return null;
66
+ }
67
+
68
+ const locSection = document.createElement('div');
69
+ locSection.style.cssText = 'margin-bottom:20px;';
70
+
71
+ const locLabel = document.createElement('div');
72
+ locLabel.style.cssText =
73
+ 'font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.08em;color:#94a3b8;margin-bottom:8px;';
74
+ locLabel.textContent = 'Where';
75
+ locSection.appendChild(locLabel);
76
+
77
+ const locParts: string[] = [];
78
+ if (file) locParts.push(file);
79
+ if (line !== undefined) locParts.push(String(line));
80
+ if (column !== undefined) locParts.push(String(column));
81
+ const loc = locParts.join(':') || 'Unknown location';
82
+
83
+ const locEl = document.createElement('div');
84
+ locEl.style.cssText =
85
+ '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;';
86
+ locEl.textContent = loc;
87
+ locSection.appendChild(locEl);
88
+
89
+ if (lineText) {
90
+ const codeBlock = document.createElement('pre');
91
+ codeBlock.style.cssText =
92
+ '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;';
93
+ codeBlock.textContent = lineText;
94
+ locSection.appendChild(codeBlock);
95
+ }
96
+
97
+ return locSection;
98
+ };
99
+
100
+ export const showErrorOverlay = (opts: ErrorOverlayOptions) => {
101
+ const message = opts.message || 'Build failed';
102
+ const { file } = opts;
103
+ const { line } = opts;
104
+ const { column } = opts;
105
+ const { lineText } = opts;
106
+ const framework = (opts.framework || 'unknown').toLowerCase();
107
+ const frameworkLabel = frameworkLabels[framework] || framework;
108
+ const accent = frameworkColors[framework] || '#94a3b8';
109
+
110
+ removeOverlayElement();
111
+ currentOverlayKind = opts.kind || 'compilation';
112
+
113
+ const overlay = document.createElement('div');
114
+ overlay.id = 'absolutejs-error-overlay';
115
+ overlay.setAttribute('data-hmr-overlay', 'true');
116
+ overlay.style.cssText =
117
+ '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;';
118
+
119
+ const card = document.createElement('div');
120
+ card.style.cssText =
121
+ '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;';
122
+
123
+ const header = document.createElement('div');
124
+ header.style.cssText =
125
+ '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);';
126
+ 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:${
127
+ accent
128
+ };color:#fff;opacity:0.95;box-shadow:0 2px 4px rgba(0,0,0,0.2);">${
129
+ frameworkLabel
130
+ }</span></div><span style="color:#94a3b8;font-size:13px;font-weight:500;">${
131
+ opts.kind === 'runtime' ? 'Runtime Error' : 'Compilation Error'
132
+ }</span>`;
133
+ card.appendChild(header);
134
+
135
+ const content = document.createElement('div');
136
+ content.style.cssText = 'padding:24px;';
137
+
138
+ const errorSection = document.createElement('div');
139
+ errorSection.style.cssText = 'margin-bottom:20px;';
140
+
141
+ const errorLabel = document.createElement('div');
142
+ errorLabel.style.cssText =
143
+ 'font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.08em;color:#94a3b8;margin-bottom:8px;';
144
+ errorLabel.textContent = 'What went wrong';
145
+ errorSection.appendChild(errorLabel);
146
+
147
+ const msgEl = document.createElement('pre');
148
+ msgEl.style.cssText =
149
+ '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;';
150
+ msgEl.textContent = message;
151
+ errorSection.appendChild(msgEl);
152
+ content.appendChild(errorSection);
153
+
154
+ const locSection = buildLocationSection(file, line, column, lineText);
155
+ if (locSection) {
156
+ content.appendChild(locSection);
157
+ }
158
+
159
+ const footer = document.createElement('div');
160
+ footer.style.cssText =
161
+ 'display:flex;justify-content:flex-end;padding-top:8px;';
162
+
163
+ const dismiss = document.createElement('button');
164
+ dismiss.textContent = 'Dismiss';
165
+ dismiss.style.cssText = `padding:10px 20px;background:${
166
+ accent
167
+ };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;`;
168
+ dismiss.onmouseover = function () {
169
+ dismiss.style.opacity = '0.9';
170
+ dismiss.style.transform = 'translateY(-1px)';
171
+ };
172
+ dismiss.onmouseout = function () {
173
+ dismiss.style.opacity = '1';
174
+ dismiss.style.transform = 'translateY(0)';
175
+ };
176
+ dismiss.onclick = hideErrorOverlay;
177
+ footer.appendChild(dismiss);
178
+ content.appendChild(footer);
179
+ card.appendChild(content);
180
+ overlay.appendChild(card);
181
+ if (!document.body) return;
182
+ document.body.appendChild(overlay);
183
+ errorOverlayElement = overlay;
184
+ };
@@ -0,0 +1,63 @@
1
+ import type {} from '../../types/globals';
2
+ /* Framework detection and manifest lookup utilities */
3
+
4
+ export const detectCurrentFramework = () => {
5
+ if (window.__HMR_FRAMEWORK__) return window.__HMR_FRAMEWORK__;
6
+ if (window.__REACT_ROOT__) return 'react';
7
+ const path = window.location.pathname;
8
+ if (path === '/vue' || path.startsWith('/vue/')) return 'vue';
9
+ if (path === '/svelte' || path.startsWith('/svelte/')) return 'svelte';
10
+ if (path === '/angular' || path.startsWith('/angular/')) return 'angular';
11
+ if (path === '/htmx' || path.startsWith('/htmx/')) return 'htmx';
12
+ if (path === '/html' || path.startsWith('/html/')) return 'html';
13
+ if (path === '/react' || path.startsWith('/react/')) return 'react';
14
+
15
+ return null;
16
+ };
17
+ export const findIndexPath = (
18
+ manifest: Record<string, string> | undefined,
19
+ sourceFile: string | undefined,
20
+ framework: string
21
+ ) => {
22
+ if (!manifest) return null;
23
+
24
+ if (sourceFile) {
25
+ const componentName = getComponentNameFromPath(sourceFile);
26
+ const indexKey = componentName ? `${componentName}Index` : null;
27
+ if (indexKey && manifest[indexKey]) {
28
+ return manifest[indexKey];
29
+ }
30
+ }
31
+
32
+ const frameworkPatterns: Record<string, RegExp> = {
33
+ angular: /angular/i,
34
+ react: /react/i,
35
+ svelte: /svelte/i,
36
+ vue: /vue/i
37
+ };
38
+ const pattern = frameworkPatterns[framework];
39
+
40
+ for (const key in manifest) {
41
+ const value = manifest[key];
42
+ if (
43
+ key.endsWith('Index') &&
44
+ value &&
45
+ (!pattern || pattern.test(key) || value.includes(`/${framework}/`))
46
+ ) {
47
+ return value;
48
+ }
49
+ }
50
+
51
+ return null;
52
+ };
53
+ export const getComponentNameFromPath = (filePath: string) => {
54
+ if (!filePath) return null;
55
+ const parts = filePath.replace(/\\/g, '/').split('/');
56
+ const fileName = parts[parts.length - 1] || '';
57
+ const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|html)$/, '');
58
+
59
+ return baseName
60
+ .split(/[-_]/)
61
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
62
+ .join('');
63
+ };