@absolutejs/absolute 0.19.0-beta.807 → 0.19.0-beta.809
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/angular/browser.js +9801 -57
- package/dist/angular/browser.js.map +246 -4
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +14877 -60
- package/dist/angular/index.js.map +281 -4
- package/dist/angular/server.js +5610 -45
- package/dist/angular/server.js.map +51 -3
- package/dist/build.js +18092 -45
- package/dist/build.js.map +99 -3
- package/dist/cli/index.js +317 -86
- package/dist/client/index.js +1091 -70
- package/dist/client/index.js.map +24 -4
- package/dist/core/streamingSlotRegistrar.js +108 -11
- package/dist/core/streamingSlotRegistrar.js.map +4 -3
- package/dist/core/streamingSlotRegistry.js +169 -7
- package/dist/core/streamingSlotRegistry.js.map +5 -3
- package/dist/index.js +19957 -547
- package/dist/index.js.map +116 -3
- package/dist/islands/browser.js +228 -9
- package/dist/islands/browser.js.map +9 -4
- package/dist/islands/index.js +1908 -17
- package/dist/islands/index.js.map +27 -3
- package/dist/react/browser.js +328 -12
- package/dist/react/browser.js.map +12 -4
- package/dist/react/components/index.js +167 -16
- package/dist/react/components/index.js.map +6 -3
- package/dist/react/hooks/index.js +183 -8
- package/dist/react/hooks/index.js.map +7 -3
- package/dist/react/index.js +3627 -36
- package/dist/react/index.js.map +45 -4
- package/dist/react/jsxDevRuntimeCompat.js +61 -2
- package/dist/react/jsxDevRuntimeCompat.js.map +2 -2
- package/dist/react/server.js +1789 -18
- package/dist/react/server.js.map +21 -3
- package/dist/src/angular/injectorPatch.d.ts +1 -0
- package/dist/src/angular/islands.d.ts +1 -0
- package/dist/src/client/hydrators/react.d.ts +3 -0
- package/dist/src/client/hydrators/svelte.d.ts +2 -0
- package/dist/src/client/hydrators/vue.d.ts +2 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/svelte/browser.js +247 -12
- package/dist/svelte/browser.js.map +10 -3
- package/dist/svelte/index.js +3732 -37
- package/dist/svelte/index.js.map +47 -4
- package/dist/svelte/server.js +2794 -21
- package/dist/svelte/server.js.map +27 -3
- package/dist/vue/browser.js +348 -12
- package/dist/vue/browser.js.map +12 -4
- package/dist/vue/components/Image.js +240 -7
- package/dist/vue/components/Image.js.map +6 -3
- package/dist/vue/components/index.js +544 -11
- package/dist/vue/components/index.js.map +9 -3
- package/dist/vue/index.js +4212 -52
- package/dist/vue/index.js.map +50 -4
- package/dist/vue/server.js +1849 -18
- package/dist/vue/server.js.map +21 -3
- package/package.json +1 -1
- package/dist/chunk-0867j0r0.js +0 -136
- package/dist/chunk-0867j0r0.js.map +0 -10
- package/dist/chunk-102fp7xe.js +0 -63
- package/dist/chunk-102fp7xe.js.map +0 -10
- package/dist/chunk-11zpfqz6.js +0 -19
- package/dist/chunk-11zpfqz6.js.map +0 -10
- package/dist/chunk-1rfh7hw9.js +0 -319
- package/dist/chunk-1rfh7hw9.js.map +0 -11
- package/dist/chunk-1x4fxm57.js +0 -51
- package/dist/chunk-1x4fxm57.js.map +0 -9
- package/dist/chunk-25v9t56f.js +0 -29
- package/dist/chunk-25v9t56f.js.map +0 -11
- package/dist/chunk-2f21eenc.js +0 -21
- package/dist/chunk-2f21eenc.js.map +0 -10
- package/dist/chunk-2ga2znex.js +0 -13
- package/dist/chunk-2ga2znex.js.map +0 -9
- package/dist/chunk-30yrw0f6.js +0 -33
- package/dist/chunk-30yrw0f6.js.map +0 -10
- package/dist/chunk-3g91wb4f.js +0 -358
- package/dist/chunk-3g91wb4f.js.map +0 -10
- package/dist/chunk-3rea1gam.js +0 -4403
- package/dist/chunk-3rea1gam.js.map +0 -28
- package/dist/chunk-3yjzpcne.js +0 -34
- package/dist/chunk-3yjzpcne.js.map +0 -10
- package/dist/chunk-41bf6aqt.js +0 -17
- package/dist/chunk-41bf6aqt.js.map +0 -9
- package/dist/chunk-4d39r92n.js +0 -81
- package/dist/chunk-4d39r92n.js.map +0 -10
- package/dist/chunk-5003emhv.js +0 -17
- package/dist/chunk-5003emhv.js.map +0 -10
- package/dist/chunk-5f67rsed.js +0 -466
- package/dist/chunk-5f67rsed.js.map +0 -10
- package/dist/chunk-5fhp1jap.js +0 -9169
- package/dist/chunk-5fhp1jap.js.map +0 -236
- package/dist/chunk-629x0yh4.js +0 -20
- package/dist/chunk-629x0yh4.js.map +0 -9
- package/dist/chunk-6pdj08z3.js +0 -73
- package/dist/chunk-6pdj08z3.js.map +0 -12
- package/dist/chunk-6qjbrt0k.js +0 -13
- package/dist/chunk-6qjbrt0k.js.map +0 -9
- package/dist/chunk-6sccb4jr.js +0 -14
- package/dist/chunk-6sccb4jr.js.map +0 -9
- package/dist/chunk-798spvzv.js +0 -50
- package/dist/chunk-798spvzv.js.map +0 -10
- package/dist/chunk-7fw6x3js.js +0 -131
- package/dist/chunk-7fw6x3js.js.map +0 -11
- package/dist/chunk-7kjj42xm.js +0 -11
- package/dist/chunk-7kjj42xm.js.map +0 -10
- package/dist/chunk-7mtstdqn.js +0 -90
- package/dist/chunk-7mtstdqn.js.map +0 -10
- package/dist/chunk-851whwc7.js +0 -17
- package/dist/chunk-851whwc7.js.map +0 -10
- package/dist/chunk-85n68sy6.js +0 -103
- package/dist/chunk-85n68sy6.js.map +0 -10
- package/dist/chunk-8kcfffry.js +0 -35
- package/dist/chunk-8kcfffry.js.map +0 -10
- package/dist/chunk-92fsjfpp.js +0 -1731
- package/dist/chunk-92fsjfpp.js.map +0 -11
- package/dist/chunk-93sqk7be.js +0 -139
- package/dist/chunk-93sqk7be.js.map +0 -12
- package/dist/chunk-9c5tj4k3.js +0 -130
- package/dist/chunk-9c5tj4k3.js.map +0 -10
- package/dist/chunk-9j59emg3.js +0 -184
- package/dist/chunk-9j59emg3.js.map +0 -11
- package/dist/chunk-9ve9jq72.js +0 -203
- package/dist/chunk-9ve9jq72.js.map +0 -10
- package/dist/chunk-9xrsjeem.js +0 -12
- package/dist/chunk-9xrsjeem.js.map +0 -9
- package/dist/chunk-a9mvyp04.js +0 -87
- package/dist/chunk-a9mvyp04.js.map +0 -10
- package/dist/chunk-b3gbnrwe.js +0 -21
- package/dist/chunk-b3gbnrwe.js.map +0 -10
- package/dist/chunk-bgb8k1qs.js +0 -672
- package/dist/chunk-bgb8k1qs.js.map +0 -15
- package/dist/chunk-bmgqm774.js +0 -65
- package/dist/chunk-bmgqm774.js.map +0 -9
- package/dist/chunk-bxfghpma.js +0 -69
- package/dist/chunk-bxfghpma.js.map +0 -10
- package/dist/chunk-c1jfjnka.js +0 -74
- package/dist/chunk-c1jfjnka.js.map +0 -10
- package/dist/chunk-cbkrwmvh.js +0 -80
- package/dist/chunk-cbkrwmvh.js.map +0 -10
- package/dist/chunk-cdxd7sy2.js +0 -71
- package/dist/chunk-cdxd7sy2.js.map +0 -10
- package/dist/chunk-cg95827x.js +0 -21
- package/dist/chunk-cg95827x.js.map +0 -10
- package/dist/chunk-cm0g4q6w.js +0 -149
- package/dist/chunk-cm0g4q6w.js.map +0 -10
- package/dist/chunk-d7mwkzry.js +0 -261
- package/dist/chunk-d7mwkzry.js.map +0 -10
- package/dist/chunk-d9c0am65.js +0 -12
- package/dist/chunk-d9c0am65.js.map +0 -10
- package/dist/chunk-daqghmg8.js +0 -12
- package/dist/chunk-daqghmg8.js.map +0 -9
- package/dist/chunk-e3r9fxaa.js +0 -149
- package/dist/chunk-e3r9fxaa.js.map +0 -10
- package/dist/chunk-e8eecyrq.js +0 -244
- package/dist/chunk-e8eecyrq.js.map +0 -10
- package/dist/chunk-ex2hxe0v.js +0 -160
- package/dist/chunk-ex2hxe0v.js.map +0 -11
- package/dist/chunk-fak944et.js +0 -91
- package/dist/chunk-fak944et.js.map +0 -10
- package/dist/chunk-fygx2ymm.js +0 -118
- package/dist/chunk-fygx2ymm.js.map +0 -12
- package/dist/chunk-g15qj669.js +0 -271
- package/dist/chunk-g15qj669.js.map +0 -11
- package/dist/chunk-gd6wmknh.js +0 -121
- package/dist/chunk-gd6wmknh.js.map +0 -11
- package/dist/chunk-gf0ygptk.js +0 -85
- package/dist/chunk-gf0ygptk.js.map +0 -11
- package/dist/chunk-gytkmthr.js +0 -220
- package/dist/chunk-gytkmthr.js.map +0 -10
- package/dist/chunk-h5bbfn3n.js +0 -28
- package/dist/chunk-h5bbfn3n.js.map +0 -11
- package/dist/chunk-h6mye9r3.js +0 -93
- package/dist/chunk-h6mye9r3.js.map +0 -10
- package/dist/chunk-hcsmxw1v.js +0 -85
- package/dist/chunk-hcsmxw1v.js.map +0 -10
- package/dist/chunk-hyjs4bqs.js +0 -8
- package/dist/chunk-hyjs4bqs.js.map +0 -10
- package/dist/chunk-jn91vzkh.js +0 -66
- package/dist/chunk-jn91vzkh.js.map +0 -10
- package/dist/chunk-jpkjdgsk.js +0 -167
- package/dist/chunk-jpkjdgsk.js.map +0 -11
- package/dist/chunk-jwxt8gnp.js +0 -13
- package/dist/chunk-jwxt8gnp.js.map +0 -9
- package/dist/chunk-kk8w9rh5.js +0 -195
- package/dist/chunk-kk8w9rh5.js.map +0 -10
- package/dist/chunk-kwgh8rmg.js +0 -426
- package/dist/chunk-kwgh8rmg.js.map +0 -14
- package/dist/chunk-m97ze5hz.js +0 -46
- package/dist/chunk-m97ze5hz.js.map +0 -10
- package/dist/chunk-mbazhahf.js +0 -60
- package/dist/chunk-mbazhahf.js.map +0 -10
- package/dist/chunk-mgfwq18r.js +0 -15
- package/dist/chunk-mgfwq18r.js.map +0 -9
- package/dist/chunk-mtgf69xn.js +0 -88
- package/dist/chunk-mtgf69xn.js.map +0 -10
- package/dist/chunk-mtxzyxpg.js +0 -102
- package/dist/chunk-mtxzyxpg.js.map +0 -10
- package/dist/chunk-nehhtthw.js +0 -225
- package/dist/chunk-nehhtthw.js.map +0 -10
- package/dist/chunk-p5504p14.js +0 -16
- package/dist/chunk-p5504p14.js.map +0 -10
- package/dist/chunk-p5zgj77m.js +0 -184
- package/dist/chunk-p5zgj77m.js.map +0 -10
- package/dist/chunk-pnscgw95.js +0 -90
- package/dist/chunk-pnscgw95.js.map +0 -10
- package/dist/chunk-pvpp4pvs.js +0 -17
- package/dist/chunk-pvpp4pvs.js.map +0 -10
- package/dist/chunk-qh75agse.js +0 -95
- package/dist/chunk-qh75agse.js.map +0 -10
- package/dist/chunk-qxq2zcty.js +0 -52
- package/dist/chunk-qxq2zcty.js.map +0 -10
- package/dist/chunk-r6e8pytx.js +0 -22
- package/dist/chunk-r6e8pytx.js.map +0 -9
- package/dist/chunk-r7jmgqnw.js +0 -114
- package/dist/chunk-r7jmgqnw.js.map +0 -10
- package/dist/chunk-s6defjk2.js +0 -116
- package/dist/chunk-s6defjk2.js.map +0 -10
- package/dist/chunk-sd39p726.js +0 -619
- package/dist/chunk-sd39p726.js.map +0 -10
- package/dist/chunk-swrnzs4c.js +0 -63
- package/dist/chunk-swrnzs4c.js.map +0 -10
- package/dist/chunk-tfe3sb44.js +0 -33
- package/dist/chunk-tfe3sb44.js.map +0 -10
- package/dist/chunk-tjr0kcev.js +0 -41
- package/dist/chunk-tjr0kcev.js.map +0 -9
- package/dist/chunk-tx9edm1x.js +0 -34
- package/dist/chunk-tx9edm1x.js.map +0 -10
- package/dist/chunk-txhm2vb5.js +0 -18
- package/dist/chunk-txhm2vb5.js.map +0 -9
- package/dist/chunk-v5vmsxmy.js +0 -526
- package/dist/chunk-v5vmsxmy.js.map +0 -12
- package/dist/chunk-vjhxm8n2.js +0 -29
- package/dist/chunk-vjhxm8n2.js.map +0 -9
- package/dist/chunk-vkrpm7kc.js +0 -247
- package/dist/chunk-vkrpm7kc.js.map +0 -12
- package/dist/chunk-w3m4m5we.js +0 -4925
- package/dist/chunk-w3m4m5we.js.map +0 -12
- package/dist/chunk-wrxtn9ve.js +0 -18
- package/dist/chunk-wrxtn9ve.js.map +0 -10
- package/dist/chunk-x09cskqd.js +0 -377
- package/dist/chunk-x09cskqd.js.map +0 -10
- package/dist/chunk-xnt8c6h2.js +0 -576
- package/dist/chunk-xnt8c6h2.js.map +0 -10
- package/dist/chunk-xw0tx842.js +0 -13
- package/dist/chunk-xw0tx842.js.map +0 -9
- package/dist/chunk-xx5b6b9m.js +0 -69
- package/dist/chunk-xx5b6b9m.js.map +0 -10
- package/dist/chunk-xz1kdswj.js +0 -21
- package/dist/chunk-xz1kdswj.js.map +0 -9
- package/dist/chunk-y84qnsd3.js +0 -32
- package/dist/chunk-y84qnsd3.js.map +0 -10
- package/dist/chunk-ywjn0rad.js +0 -14
- package/dist/chunk-ywjn0rad.js.map +0 -9
- package/dist/chunk-z9nvhm6r.js +0 -13
- package/dist/chunk-z9nvhm6r.js.map +0 -9
- package/dist/chunk-zhmvdpk6.js +0 -15
- package/dist/chunk-zhmvdpk6.js.map +0 -9
- package/dist/chunk-zrg9d4zw.js +0 -784
- package/dist/chunk-zrg9d4zw.js.map +0 -10
package/dist/client/index.js
CHANGED
|
@@ -1,59 +1,247 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
function __accessProp(key) {
|
|
8
|
+
return this[key];
|
|
9
|
+
}
|
|
10
|
+
var __toESMCache_node;
|
|
11
|
+
var __toESMCache_esm;
|
|
12
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
13
|
+
var canCache = mod != null && typeof mod === "object";
|
|
14
|
+
if (canCache) {
|
|
15
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
16
|
+
var cached = cache.get(mod);
|
|
17
|
+
if (cached)
|
|
18
|
+
return cached;
|
|
19
|
+
}
|
|
20
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
21
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
22
|
+
for (let key of __getOwnPropNames(mod))
|
|
23
|
+
if (!__hasOwnProp.call(to, key))
|
|
24
|
+
__defProp(to, key, {
|
|
25
|
+
get: __accessProp.bind(mod, key),
|
|
26
|
+
enumerable: true
|
|
27
|
+
});
|
|
28
|
+
if (canCache)
|
|
29
|
+
cache.set(mod, to);
|
|
30
|
+
return to;
|
|
31
|
+
};
|
|
32
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
33
|
+
var __returnValue = (v) => v;
|
|
34
|
+
function __exportSetter(name, newValue) {
|
|
35
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
36
|
+
}
|
|
37
|
+
var __export = (target, all) => {
|
|
38
|
+
for (var name in all)
|
|
39
|
+
__defProp(target, name, {
|
|
40
|
+
get: all[name],
|
|
41
|
+
enumerable: true,
|
|
42
|
+
configurable: true,
|
|
43
|
+
set: __exportSetter.bind(all, name)
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
47
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
48
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
49
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
50
|
+
else
|
|
51
|
+
for (var i = decorators.length - 1;i >= 0; i--)
|
|
52
|
+
if (d = decorators[i])
|
|
53
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
54
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
55
|
+
};
|
|
56
|
+
var __legacyMetadataTS = (k, v) => {
|
|
57
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
58
|
+
return Reflect.metadata(k, v);
|
|
59
|
+
};
|
|
60
|
+
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
61
|
+
var __require = import.meta.require;
|
|
33
62
|
|
|
34
|
-
// src/
|
|
35
|
-
var
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (!
|
|
63
|
+
// src/core/islandManifest.ts
|
|
64
|
+
var toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + framework.slice(1), collectFrameworkIslands = (manifest, prefix) => {
|
|
65
|
+
const entries = {};
|
|
66
|
+
let found = false;
|
|
67
|
+
for (const [key, value] of Object.entries(manifest)) {
|
|
68
|
+
if (!key.startsWith(prefix))
|
|
69
|
+
continue;
|
|
70
|
+
const component = key.slice(prefix.length);
|
|
71
|
+
if (!component)
|
|
72
|
+
continue;
|
|
73
|
+
entries[component] = value;
|
|
74
|
+
found = true;
|
|
75
|
+
}
|
|
76
|
+
return found ? entries : undefined;
|
|
77
|
+
}, getIslandManifestEntries = (manifest) => {
|
|
78
|
+
const islands = {};
|
|
79
|
+
const frameworks = ["react", "svelte", "vue", "angular"];
|
|
80
|
+
for (const framework of frameworks) {
|
|
81
|
+
const prefix = `Island${toIslandFrameworkSegment(framework)}`;
|
|
82
|
+
const entries = collectFrameworkIslands(manifest, prefix);
|
|
83
|
+
if (entries)
|
|
84
|
+
islands[framework] = entries;
|
|
85
|
+
}
|
|
86
|
+
return islands;
|
|
87
|
+
}, getIslandManifestKey = (framework, component) => `Island${toIslandFrameworkSegment(framework)}${component}`;
|
|
88
|
+
|
|
89
|
+
// src/client/streamSwap.ts
|
|
90
|
+
var streamSwapRuntime = () => {
|
|
91
|
+
const absoluteWindow = window;
|
|
92
|
+
const SLOT_PATCH_EVENT = "absolutejs:slot-patch";
|
|
93
|
+
if (absoluteWindow.__ABS_SLOT_RUNTIME__ === true)
|
|
94
|
+
return;
|
|
95
|
+
absoluteWindow.__ABS_SLOT_RUNTIME__ = true;
|
|
96
|
+
absoluteWindow.__ABS_SLOT_CONSUMERS__ = absoluteWindow.__ABS_SLOT_CONSUMERS__ ?? {};
|
|
97
|
+
absoluteWindow.__ABS_SLOT_PENDING__ = absoluteWindow.__ABS_SLOT_PENDING__ ?? {};
|
|
98
|
+
const consumers = absoluteWindow.__ABS_SLOT_CONSUMERS__;
|
|
99
|
+
const pending = absoluteWindow.__ABS_SLOT_PENDING__;
|
|
100
|
+
const isObjectRecord = (value) => Boolean(value) && typeof value === "object";
|
|
101
|
+
const isPatchedPendingEntry = (value) => {
|
|
102
|
+
if (!isObjectRecord(value))
|
|
103
|
+
return false;
|
|
104
|
+
return value.domPatched === true && "payload" in value;
|
|
105
|
+
};
|
|
106
|
+
const unwrapPendingPayload = (value) => isPatchedPendingEntry(value) ? value.payload : value;
|
|
107
|
+
const canApplyImmediately = () => absoluteWindow.__ABS_SLOT_HYDRATION_PENDING__ !== true;
|
|
108
|
+
const isAngularDeferPayload = (payload) => {
|
|
109
|
+
if (!isObjectRecord(payload))
|
|
110
|
+
return false;
|
|
111
|
+
return payload.kind === "angular-defer";
|
|
112
|
+
};
|
|
113
|
+
const isVueSuspensePayload = (payload) => {
|
|
114
|
+
if (!isObjectRecord(payload))
|
|
115
|
+
return false;
|
|
116
|
+
return payload.kind === "vue-suspense";
|
|
117
|
+
};
|
|
118
|
+
const resolveHtml = (payload) => {
|
|
119
|
+
if (!isObjectRecord(payload)) {
|
|
120
|
+
return typeof payload === "string" ? payload : "";
|
|
121
|
+
}
|
|
122
|
+
if (typeof payload.html === "string") {
|
|
123
|
+
return payload.html;
|
|
124
|
+
}
|
|
125
|
+
return "";
|
|
126
|
+
};
|
|
127
|
+
const apply = (id, pendingEntry) => {
|
|
128
|
+
const payload = unwrapPendingPayload(pendingEntry);
|
|
129
|
+
if (!canApplyImmediately()) {
|
|
130
|
+
pending[id] = payload;
|
|
40
131
|
return;
|
|
41
|
-
|
|
42
|
-
|
|
132
|
+
}
|
|
133
|
+
const consumer = consumers[id];
|
|
134
|
+
if (typeof consumer !== "function") {
|
|
135
|
+
applyToDom(id, payload, pendingEntry);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const handled = consumer(payload);
|
|
139
|
+
if (handled !== false) {
|
|
140
|
+
delete pending[id];
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
applyToDom(id, payload, pendingEntry);
|
|
43
144
|
};
|
|
44
|
-
|
|
45
|
-
|
|
145
|
+
const applyToDom = (id, payload, pendingEntry) => {
|
|
146
|
+
if (isAngularDeferPayload(payload)) {
|
|
147
|
+
pending[id] = payload;
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const node = document.getElementById(id);
|
|
151
|
+
if (!node) {
|
|
152
|
+
pending[id] = payload;
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const html = resolveHtml(payload);
|
|
156
|
+
if (isVueSuspensePayload(payload) && isPatchedPendingEntry(pendingEntry)) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
node.innerHTML = html;
|
|
160
|
+
node.setAttribute("data-absolute-slot-state", "resolved");
|
|
161
|
+
window.dispatchEvent(new CustomEvent(SLOT_PATCH_EVENT, {
|
|
162
|
+
detail: { html, id, payload }
|
|
163
|
+
}));
|
|
164
|
+
if (isVueSuspensePayload(payload)) {
|
|
165
|
+
pending[id] = { domPatched: true, payload };
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
delete pending[id];
|
|
169
|
+
};
|
|
170
|
+
const flush = () => {
|
|
171
|
+
for (const id in pending) {
|
|
172
|
+
if (!Object.prototype.hasOwnProperty.call(pending, id))
|
|
173
|
+
continue;
|
|
174
|
+
apply(id, pending[id] ?? "");
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
absoluteWindow.__ABS_SLOT_FLUSH__ = flush;
|
|
178
|
+
absoluteWindow.__ABS_SLOT_ENQUEUE__ = (id, payload) => {
|
|
179
|
+
apply(id, payload);
|
|
180
|
+
};
|
|
181
|
+
if (typeof MutationObserver === "function") {
|
|
182
|
+
const observer = new MutationObserver(flush);
|
|
183
|
+
const root = document.documentElement ?? document.body ?? document;
|
|
184
|
+
observer.observe(root, { childList: true, subtree: true });
|
|
185
|
+
}
|
|
186
|
+
if (document.readyState === "loading") {
|
|
187
|
+
document.addEventListener("DOMContentLoaded", flush, { once: true });
|
|
188
|
+
}
|
|
189
|
+
flush();
|
|
190
|
+
}, stripFunctionWrapper = (value) => {
|
|
191
|
+
const start = value.indexOf("{");
|
|
192
|
+
const end = value.lastIndexOf("}");
|
|
193
|
+
if (start < 0 || end <= start)
|
|
194
|
+
return "";
|
|
195
|
+
return value.slice(start + 1, end);
|
|
196
|
+
}, getStreamSwapRuntimeScript = () => `(function(){${stripFunctionWrapper(streamSwapRuntime.toString())}})();`;
|
|
197
|
+
|
|
198
|
+
// src/core/islands.ts
|
|
199
|
+
function getIslandComponent(component) {
|
|
200
|
+
if (isIslandComponentDefinition(component)) {
|
|
201
|
+
return component.component;
|
|
202
|
+
}
|
|
203
|
+
return component;
|
|
204
|
+
}
|
|
205
|
+
var defineIslandComponent = (component, options) => ({
|
|
206
|
+
component,
|
|
207
|
+
export: options.export,
|
|
208
|
+
source: options.source
|
|
209
|
+
}), defineIslandRegistry = (registry) => registry, isRecord = (value) => typeof value === "object" && value !== null, getIslandBuildReference = (component) => {
|
|
210
|
+
if (!isIslandComponentDefinition(component))
|
|
211
|
+
return null;
|
|
212
|
+
return {
|
|
213
|
+
export: component.export,
|
|
214
|
+
source: component.source
|
|
215
|
+
};
|
|
216
|
+
}, isIslandComponentDefinition = (value) => isRecord(value) && ("component" in value) && ("source" in value) && typeof value.source === "string", parseIslandProps = (rawProps) => {
|
|
217
|
+
if (!rawProps)
|
|
218
|
+
return {};
|
|
219
|
+
return JSON.parse(rawProps);
|
|
220
|
+
}, serializeIslandProps = (props) => JSON.stringify(props ?? {});
|
|
221
|
+
var init_islands = () => {};
|
|
222
|
+
|
|
223
|
+
// src/core/islandMarkupAttributes.ts
|
|
224
|
+
var getIslandMarkerAttributes = (props, islandId) => ({
|
|
225
|
+
"data-component": props.component,
|
|
226
|
+
"data-framework": props.framework,
|
|
227
|
+
"data-hydrate": props.hydrate ?? "load",
|
|
228
|
+
"data-island": "true",
|
|
229
|
+
...islandId ? { "data-island-id": islandId } : {},
|
|
230
|
+
"data-props": serializeIslandProps(props.props)
|
|
231
|
+
}), escapeHtmlAttribute = (value) => value.replaceAll("&", "&").replaceAll('"', """).replaceAll("<", "<").replaceAll(">", ">"), serializeIslandAttributes = (attributes) => Object.entries(attributes).map(([key, value]) => `${key}="${escapeHtmlAttribute(value)}"`).join(" ");
|
|
232
|
+
var init_islandMarkupAttributes = __esm(() => {
|
|
233
|
+
init_islands();
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
// src/client/hydrators/react.ts
|
|
237
|
+
var exports_react = {};
|
|
238
|
+
__export(exports_react, {
|
|
239
|
+
isReactComponent: () => isReactComponent,
|
|
240
|
+
hydrateReactIsland: () => hydrateReactIsland
|
|
241
|
+
});
|
|
46
242
|
import { createElement } from "react";
|
|
47
243
|
import { hydrateRoot } from "react-dom/client";
|
|
48
|
-
|
|
49
|
-
import { createSSRApp, h } from "vue";
|
|
50
|
-
initializeIslandMarkupSnapshot();
|
|
51
|
-
var idleDeadline = {
|
|
52
|
-
didTimeout: false,
|
|
53
|
-
timeRemaining: () => 0
|
|
54
|
-
};
|
|
55
|
-
var requestIdle = typeof window !== "undefined" && "requestIdleCallback" in window ? window.requestIdleCallback.bind(window) : (callback) => window.setTimeout(() => callback(idleDeadline), 1);
|
|
56
|
-
var hydrateReactIsland = (component, element, props) => {
|
|
244
|
+
var reactIslandRoots, isPropsRecord = (value) => typeof value === "object" && value !== null, isReactComponent = (value) => typeof value === "function", hydrateReactIsland = (component, element, props) => {
|
|
57
245
|
const existingRoot = reactIslandRoots.get(element);
|
|
58
246
|
if (existingRoot) {
|
|
59
247
|
existingRoot.render(isPropsRecord(props) ? createElement(component, props) : createElement(component));
|
|
@@ -65,63 +253,896 @@ var hydrateReactIsland = (component, element, props) => {
|
|
|
65
253
|
}
|
|
66
254
|
reactIslandRoots.set(element, hydrateRoot(element, createElement(component, props)));
|
|
67
255
|
};
|
|
68
|
-
var
|
|
256
|
+
var init_react = __esm(() => {
|
|
257
|
+
reactIslandRoots = new WeakMap;
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
// src/client/hydrators/svelte.ts
|
|
261
|
+
var exports_svelte = {};
|
|
262
|
+
__export(exports_svelte, {
|
|
263
|
+
isSvelteComponent: () => isSvelteComponent,
|
|
264
|
+
hydrateSvelteIsland: () => hydrateSvelteIsland
|
|
265
|
+
});
|
|
266
|
+
import { hydrate as hydrateSvelte } from "svelte";
|
|
267
|
+
var isPropsRecord2 = (value) => typeof value === "object" && value !== null, isSvelteComponent = (value) => typeof value === "function", hydrateSvelteIsland = (component, element, props) => {
|
|
69
268
|
hydrateSvelte(component, {
|
|
70
|
-
props:
|
|
269
|
+
props: isPropsRecord2(props) ? props : undefined,
|
|
71
270
|
target: element
|
|
72
271
|
});
|
|
73
272
|
};
|
|
74
|
-
var
|
|
273
|
+
var init_svelte = () => {};
|
|
274
|
+
|
|
275
|
+
// src/client/hydrators/vue.ts
|
|
276
|
+
var exports_vue = {};
|
|
277
|
+
__export(exports_vue, {
|
|
278
|
+
isVueComponent: () => isVueComponent,
|
|
279
|
+
hydrateVueIsland: () => hydrateVueIsland
|
|
280
|
+
});
|
|
281
|
+
import { createSSRApp, h } from "vue";
|
|
282
|
+
var vueIslandApps, isPropsRecord3 = (value) => typeof value === "object" && value !== null, isVueComponent = (value) => typeof value === "function" || isPropsRecord3(value), hydrateVueIsland = (component, element, props) => {
|
|
75
283
|
if (vueIslandApps.has(element)) {
|
|
76
284
|
return;
|
|
77
285
|
}
|
|
78
286
|
const app = createSSRApp({
|
|
79
|
-
render: () => h(component,
|
|
287
|
+
render: () => h(component, isPropsRecord3(props) ? props : undefined)
|
|
80
288
|
});
|
|
81
289
|
app.mount(element);
|
|
82
290
|
vueIslandApps.set(element, app);
|
|
83
291
|
};
|
|
292
|
+
var init_vue = __esm(() => {
|
|
293
|
+
vueIslandApps = new WeakMap;
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
// src/angular/resolveAngularPackage.ts
|
|
297
|
+
import { existsSync, readFileSync } from "fs";
|
|
298
|
+
import { join, resolve } from "path";
|
|
299
|
+
var resolveAngularPackageDir = (specifier) => {
|
|
300
|
+
const fromCompiledRuntime = process.env.ABSOLUTE_BUILD_DIR ? resolve(process.env.ABSOLUTE_BUILD_DIR, "node_modules", specifier) : null;
|
|
301
|
+
if (fromCompiledRuntime && existsSync(fromCompiledRuntime)) {
|
|
302
|
+
return fromCompiledRuntime;
|
|
303
|
+
}
|
|
304
|
+
const fromProject = resolve(process.cwd(), "node_modules", specifier);
|
|
305
|
+
if (existsSync(fromProject)) {
|
|
306
|
+
return fromProject;
|
|
307
|
+
}
|
|
308
|
+
return null;
|
|
309
|
+
}, resolvePackageEntry = (packageDir) => {
|
|
310
|
+
try {
|
|
311
|
+
const pkg = JSON.parse(readFileSync(join(packageDir, "package.json"), "utf-8"));
|
|
312
|
+
const rootExport = pkg.exports?.["."];
|
|
313
|
+
const entry = (typeof rootExport === "string" ? rootExport : rootExport?.default) ?? pkg.module ?? pkg.main ?? "index.js";
|
|
314
|
+
return join(packageDir, entry);
|
|
315
|
+
} catch {
|
|
316
|
+
return packageDir;
|
|
317
|
+
}
|
|
318
|
+
}, resolveAngularPackage = (specifier) => {
|
|
319
|
+
const packageDir = resolveAngularPackageDir(specifier);
|
|
320
|
+
if (packageDir)
|
|
321
|
+
return resolvePackageEntry(packageDir);
|
|
322
|
+
return specifier;
|
|
323
|
+
}, toSafeVendorName = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), resolveAngularRuntimePath = (specifier) => {
|
|
324
|
+
const buildDir = process.env.ABSOLUTE_BUILD_DIR;
|
|
325
|
+
if (buildDir) {
|
|
326
|
+
const vendorPath = join(buildDir, "angular", "vendor", "server", `${toSafeVendorName(specifier)}.js`);
|
|
327
|
+
if (existsSync(vendorPath))
|
|
328
|
+
return vendorPath;
|
|
329
|
+
}
|
|
330
|
+
return resolveAngularPackage(specifier);
|
|
331
|
+
};
|
|
332
|
+
var init_resolveAngularPackage = () => {};
|
|
333
|
+
|
|
334
|
+
// src/angular/angularPatch.ts
|
|
335
|
+
var exports_angularPatch = {};
|
|
336
|
+
__export(exports_angularPatch, {
|
|
337
|
+
applyPatches: () => applyPatches
|
|
338
|
+
});
|
|
339
|
+
var ensureHead = (doc) => {
|
|
340
|
+
if (!doc || doc.head || !doc.documentElement) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
const head = doc.createElement("head");
|
|
344
|
+
doc.documentElement.insertBefore(head, doc.documentElement.firstChild);
|
|
345
|
+
}, SSR_LAYOUT_RECT, layoutPatchApplied = false, collectPrototypeChain = (instance) => {
|
|
346
|
+
const protos = [];
|
|
347
|
+
let current = instance ? Object.getPrototypeOf(instance) : null;
|
|
348
|
+
while (current && current !== Object.prototype) {
|
|
349
|
+
protos.push(current);
|
|
350
|
+
current = Object.getPrototypeOf(current);
|
|
351
|
+
}
|
|
352
|
+
return protos;
|
|
353
|
+
}, patchElementLayout = (doc) => {
|
|
354
|
+
if (layoutPatchApplied || !doc) {
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
let element;
|
|
358
|
+
try {
|
|
359
|
+
element = doc.createElement("div");
|
|
360
|
+
} catch {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
const protos = collectPrototypeChain(element);
|
|
364
|
+
if (protos.length === 0)
|
|
365
|
+
return;
|
|
366
|
+
const copyLayoutRect = (rect) => ({ ...rect });
|
|
367
|
+
const createLayoutRect = () => copyLayoutRect(SSR_LAYOUT_RECT);
|
|
368
|
+
const getClientRects = () => [];
|
|
369
|
+
const noop = () => {
|
|
370
|
+
return;
|
|
371
|
+
};
|
|
372
|
+
const numericProps = [
|
|
373
|
+
"clientWidth",
|
|
374
|
+
"clientHeight",
|
|
375
|
+
"clientLeft",
|
|
376
|
+
"clientTop",
|
|
377
|
+
"offsetWidth",
|
|
378
|
+
"offsetHeight",
|
|
379
|
+
"offsetLeft",
|
|
380
|
+
"offsetTop",
|
|
381
|
+
"scrollWidth",
|
|
382
|
+
"scrollHeight",
|
|
383
|
+
"scrollLeft",
|
|
384
|
+
"scrollTop"
|
|
385
|
+
];
|
|
386
|
+
for (const proto of protos) {
|
|
387
|
+
const define = (name, value) => {
|
|
388
|
+
const descriptor = Object.getOwnPropertyDescriptor(proto, name);
|
|
389
|
+
if (typeof descriptor?.value === "function")
|
|
390
|
+
return;
|
|
391
|
+
Object.defineProperty(proto, name, {
|
|
392
|
+
configurable: true,
|
|
393
|
+
value,
|
|
394
|
+
writable: true
|
|
395
|
+
});
|
|
396
|
+
};
|
|
397
|
+
define("getBoundingClientRect", createLayoutRect);
|
|
398
|
+
define("getClientRects", getClientRects);
|
|
399
|
+
define("scrollTo", noop);
|
|
400
|
+
define("scrollBy", noop);
|
|
401
|
+
define("scrollIntoView", noop);
|
|
402
|
+
define("focus", noop);
|
|
403
|
+
define("blur", noop);
|
|
404
|
+
for (const prop of numericProps) {
|
|
405
|
+
const desc = Object.getOwnPropertyDescriptor(proto, prop);
|
|
406
|
+
if (desc)
|
|
407
|
+
continue;
|
|
408
|
+
Object.defineProperty(proto, prop, {
|
|
409
|
+
configurable: true,
|
|
410
|
+
get: () => 0
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
layoutPatchApplied = true;
|
|
415
|
+
}, applyPatches = async () => {
|
|
416
|
+
const { \u{275}DominoAdapter } = await import(resolveAngularRuntimePath("@angular/platform-server"));
|
|
417
|
+
if (!\u{275}DominoAdapter?.prototype) {
|
|
418
|
+
console.warn("[Angular Patch] \u0275DominoAdapter not found, skipping patches");
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
try {
|
|
422
|
+
const adapter = new \u{275}DominoAdapter;
|
|
423
|
+
const seedDoc = typeof adapter.createHtmlDocument === "function" ? adapter.createHtmlDocument() : typeof adapter.getDefaultDocument === "function" ? adapter.getDefaultDocument() : null;
|
|
424
|
+
if (seedDoc) {
|
|
425
|
+
patchElementLayout(seedDoc);
|
|
426
|
+
const probe = seedDoc.createElement("div");
|
|
427
|
+
if (typeof probe.getBoundingClientRect !== "function") {
|
|
428
|
+
console.warn("[Angular Patch] Layout shim did not stick on probe element prototype chain");
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
} catch (error) {
|
|
432
|
+
console.warn("[Angular Patch] Could not eagerly patch Element prototypes:", error);
|
|
433
|
+
}
|
|
434
|
+
const proto = \u{275}DominoAdapter.prototype;
|
|
435
|
+
const origGetBaseHref = proto.getBaseHref;
|
|
436
|
+
proto.getBaseHref = function(doc) {
|
|
437
|
+
if (!doc || !doc.head || typeof doc.head.children === "undefined") {
|
|
438
|
+
return "";
|
|
439
|
+
}
|
|
440
|
+
return origGetBaseHref.call(this, doc);
|
|
441
|
+
};
|
|
442
|
+
const origCreateHtmlDocument = proto.createHtmlDocument;
|
|
443
|
+
proto.createHtmlDocument = function() {
|
|
444
|
+
const doc = origCreateHtmlDocument.call(this);
|
|
445
|
+
ensureHead(doc);
|
|
446
|
+
patchElementLayout(doc);
|
|
447
|
+
return doc;
|
|
448
|
+
};
|
|
449
|
+
const origGetDefaultDocument = proto.getDefaultDocument;
|
|
450
|
+
proto.getDefaultDocument = function() {
|
|
451
|
+
const doc = origGetDefaultDocument.call(this);
|
|
452
|
+
ensureHead(doc);
|
|
453
|
+
patchElementLayout(doc);
|
|
454
|
+
return doc;
|
|
455
|
+
};
|
|
456
|
+
return true;
|
|
457
|
+
};
|
|
458
|
+
var init_angularPatch = __esm(() => {
|
|
459
|
+
init_resolveAngularPackage();
|
|
460
|
+
SSR_LAYOUT_RECT = Object.freeze({
|
|
461
|
+
bottom: 0,
|
|
462
|
+
height: 0,
|
|
463
|
+
left: 0,
|
|
464
|
+
right: 0,
|
|
465
|
+
top: 0,
|
|
466
|
+
width: 0,
|
|
467
|
+
x: 0,
|
|
468
|
+
y: 0,
|
|
469
|
+
toJSON() {
|
|
470
|
+
return this;
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
// src/angular/angularDeps.ts
|
|
476
|
+
var initDominoAdapter = (platformServer) => {
|
|
477
|
+
try {
|
|
478
|
+
platformServer.\u{275}DominoAdapter?.makeCurrent?.();
|
|
479
|
+
} catch (err) {
|
|
480
|
+
console.error("Failed to initialize DominoAdapter:", err);
|
|
481
|
+
}
|
|
482
|
+
}, loadAngularDeps = async () => {
|
|
483
|
+
if (true) {
|
|
484
|
+
await import(resolveAngularRuntimePath("@angular/compiler"));
|
|
485
|
+
}
|
|
486
|
+
const { applyPatches: applyPatches2 } = await Promise.resolve().then(() => (init_angularPatch(), exports_angularPatch));
|
|
487
|
+
await applyPatches2();
|
|
488
|
+
const [platformBrowser, platformServer, common, core] = await Promise.all([
|
|
489
|
+
import(resolveAngularRuntimePath("@angular/platform-browser")),
|
|
490
|
+
import(resolveAngularRuntimePath("@angular/platform-server")),
|
|
491
|
+
import(resolveAngularRuntimePath("@angular/common")),
|
|
492
|
+
import(resolveAngularRuntimePath("@angular/core"))
|
|
493
|
+
]);
|
|
494
|
+
if (false) {}
|
|
495
|
+
initDominoAdapter(platformServer);
|
|
496
|
+
return {
|
|
497
|
+
APP_BASE_HREF: common.APP_BASE_HREF,
|
|
498
|
+
bootstrapApplication: platformBrowser.bootstrapApplication,
|
|
499
|
+
DomSanitizer: platformBrowser.DomSanitizer,
|
|
500
|
+
ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,
|
|
501
|
+
inject: core.inject,
|
|
502
|
+
provideClientHydration: platformBrowser.provideClientHydration,
|
|
503
|
+
provideServerRendering: platformServer.provideServerRendering,
|
|
504
|
+
provideZonelessChangeDetection: core.provideZonelessChangeDetection,
|
|
505
|
+
reflectComponentType: core.reflectComponentType,
|
|
506
|
+
renderApplication: platformServer.renderApplication,
|
|
507
|
+
REQUEST: core.REQUEST,
|
|
508
|
+
REQUEST_CONTEXT: core.REQUEST_CONTEXT,
|
|
509
|
+
RESPONSE_INIT: core.RESPONSE_INIT,
|
|
510
|
+
Sanitizer: core.Sanitizer,
|
|
511
|
+
SecurityContext: core.SecurityContext,
|
|
512
|
+
withHttpTransferCacheOptions: platformBrowser.withHttpTransferCacheOptions
|
|
513
|
+
};
|
|
514
|
+
}, angularDeps = null, getAngularDeps = () => {
|
|
515
|
+
if (!angularDeps) {
|
|
516
|
+
angularDeps = loadAngularDeps();
|
|
517
|
+
}
|
|
518
|
+
return angularDeps;
|
|
519
|
+
};
|
|
520
|
+
var init_angularDeps = __esm(() => {
|
|
521
|
+
init_resolveAngularPackage();
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
// src/utils/stringModifiers.ts
|
|
525
|
+
var normalizeSlug = (str) => str.trim().replace(/\s+/g, "-").replace(/[^A-Za-z0-9\-_]+/g, "").replace(/[-_]{2,}/g, "-"), toKebab = (str) => normalizeSlug(str).replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), toPascal = (str) => {
|
|
526
|
+
if (!str.includes("-") && !str.includes("_")) {
|
|
527
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
528
|
+
}
|
|
529
|
+
return normalizeSlug(str).split(/[-_]/).filter(Boolean).map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1).toLowerCase()).join("");
|
|
530
|
+
}, toScreamingSnake = (str) => str.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toUpperCase();
|
|
531
|
+
|
|
532
|
+
// src/utils/registerClientScript.ts
|
|
533
|
+
var scriptRegistry, requestCounter = 0, getRequestId = () => `req_${Date.now()}_${++requestCounter}`, ssrContextGetter = null, getSsrContextId = () => ssrContextGetter?.() || Object.getOwnPropertyDescriptor(globalThis, "__absolutejs_requestId")?.value, registerClientScript = (script, requestId) => {
|
|
534
|
+
const id = requestId || getSsrContextId() || getRequestId();
|
|
535
|
+
if (!scriptRegistry.has(id)) {
|
|
536
|
+
scriptRegistry.set(id, new Set);
|
|
537
|
+
}
|
|
538
|
+
scriptRegistry.get(id)?.add(script);
|
|
539
|
+
return id;
|
|
540
|
+
}, setSsrContextGetter = (getter) => {
|
|
541
|
+
ssrContextGetter = getter;
|
|
542
|
+
}, clearAllClientScripts = () => {
|
|
543
|
+
scriptRegistry.clear();
|
|
544
|
+
}, generateClientScriptCode = (scripts) => {
|
|
545
|
+
if (scripts.length === 0) {
|
|
546
|
+
return "";
|
|
547
|
+
}
|
|
548
|
+
const scriptCode = scripts.map((script, index) => {
|
|
549
|
+
const funcString = script.toString();
|
|
550
|
+
const bodyMatch = funcString.match(/\{([\s\S]*)\}/);
|
|
551
|
+
if (!bodyMatch || !bodyMatch[1]) {
|
|
552
|
+
return "";
|
|
553
|
+
}
|
|
554
|
+
const body = bodyMatch[1].trim();
|
|
555
|
+
return `
|
|
556
|
+
(function() {
|
|
557
|
+
var executed = false;
|
|
558
|
+
function executeScript_${index}() {
|
|
559
|
+
if (executed) return;
|
|
560
|
+
executed = true;
|
|
561
|
+
${body}
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
if (document.readyState === 'complete' || document.readyState === 'interactive') {
|
|
565
|
+
executeScript_${index}();
|
|
566
|
+
} else {
|
|
567
|
+
document.addEventListener('DOMContentLoaded', executeScript_${index});
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
// Watch for hydration-added elements
|
|
571
|
+
var observer = new MutationObserver(function() {
|
|
572
|
+
executeScript_${index}();
|
|
573
|
+
if (executed) observer.disconnect();
|
|
574
|
+
});
|
|
575
|
+
if (!executed) {
|
|
576
|
+
observer.observe(document.body || document.documentElement, { childList: true, subtree: true });
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// Single fallback timeout
|
|
580
|
+
setTimeout(function() {
|
|
581
|
+
executeScript_${index}();
|
|
582
|
+
observer.disconnect();
|
|
583
|
+
}, 1000);
|
|
584
|
+
})();`;
|
|
585
|
+
}).join(`
|
|
586
|
+
`);
|
|
587
|
+
return `<script>
|
|
588
|
+
(function() {
|
|
589
|
+
${scriptCode}
|
|
590
|
+
})();
|
|
591
|
+
</script>`;
|
|
592
|
+
}, getAndClearClientScripts = (requestId) => {
|
|
593
|
+
const id = requestId || ssrContextGetter?.();
|
|
594
|
+
if (!id)
|
|
595
|
+
return [];
|
|
596
|
+
const scripts = scriptRegistry.get(id);
|
|
597
|
+
if (!scripts) {
|
|
598
|
+
return [];
|
|
599
|
+
}
|
|
600
|
+
const scriptArray = Array.from(scripts);
|
|
601
|
+
scriptRegistry.delete(id);
|
|
602
|
+
return scriptArray;
|
|
603
|
+
};
|
|
604
|
+
var init_registerClientScript = __esm(() => {
|
|
605
|
+
scriptRegistry = new Map;
|
|
606
|
+
if (typeof globalThis !== "undefined") {
|
|
607
|
+
Object.assign(globalThis, { registerClientScript });
|
|
608
|
+
}
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
// src/angular/httpTransferCache.ts
|
|
612
|
+
var ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER = "x-skip-transfer-cache", buildAbsoluteHttpTransferCacheOptions = (options = {}) => {
|
|
613
|
+
const {
|
|
614
|
+
filter: userFilter,
|
|
615
|
+
skipHeader = ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER,
|
|
616
|
+
...angularOptions
|
|
617
|
+
} = options;
|
|
618
|
+
return {
|
|
619
|
+
includePostRequests: false,
|
|
620
|
+
includeRequestsWithAuthHeaders: false,
|
|
621
|
+
...angularOptions,
|
|
622
|
+
filter: (request) => !request.headers.has(skipHeader) && (userFilter?.(request) ?? true)
|
|
623
|
+
};
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
// src/angular/requestProviders.ts
|
|
627
|
+
import { REQUEST, REQUEST_CONTEXT, RESPONSE_INIT } from "@angular/core";
|
|
628
|
+
var buildRequestProviders = (deps, request, requestContext, responseInit) => [
|
|
629
|
+
{ provide: deps.REQUEST, useValue: request ?? null },
|
|
630
|
+
{ provide: deps.REQUEST_CONTEXT, useValue: requestContext ?? null },
|
|
631
|
+
{ provide: deps.RESPONSE_INIT, useValue: responseInit ?? null }
|
|
632
|
+
];
|
|
633
|
+
var init_requestProviders = () => {};
|
|
634
|
+
|
|
635
|
+
// src/angular/ssrRender.ts
|
|
636
|
+
var routePropsCache, cacheRouteData = (pagePath, data) => {
|
|
637
|
+
const cacheKey = pagePath.split("?")[0] ?? pagePath;
|
|
638
|
+
routePropsCache.set(cacheKey, data);
|
|
639
|
+
}, getCachedRouteData = (pagePath) => routePropsCache.get(pagePath), selectorCache, buildProviders = (deps, sanitizer, maybeProps, tokenMap, request, requestContext, responseInit, userProviders = []) => {
|
|
640
|
+
const providers = [
|
|
641
|
+
deps.provideServerRendering(),
|
|
642
|
+
deps.provideClientHydration(deps.withHttpTransferCacheOptions(buildAbsoluteHttpTransferCacheOptions())),
|
|
643
|
+
deps.provideZonelessChangeDetection(),
|
|
644
|
+
{ provide: deps.APP_BASE_HREF, useValue: "/" },
|
|
645
|
+
{
|
|
646
|
+
provide: deps.DomSanitizer,
|
|
647
|
+
useValue: sanitizer
|
|
648
|
+
},
|
|
649
|
+
{ provide: deps.Sanitizer, useValue: sanitizer },
|
|
650
|
+
...buildRequestProviders(deps, request, requestContext, responseInit),
|
|
651
|
+
...userProviders
|
|
652
|
+
];
|
|
653
|
+
if (!maybeProps) {
|
|
654
|
+
return providers;
|
|
655
|
+
}
|
|
656
|
+
const propProviders = Object.entries(maybeProps).map(([propName, propValue]) => ({
|
|
657
|
+
token: tokenMap.get(toScreamingSnake(propName)),
|
|
658
|
+
value: propValue
|
|
659
|
+
})).filter((entry) => entry.token).map((entry) => ({ provide: entry.token, useValue: entry.value }));
|
|
660
|
+
return [...providers, ...propProviders];
|
|
661
|
+
}, clearSelectorCache = () => selectorCache.clear(), isInjectionToken = (value) => {
|
|
662
|
+
if (!value || typeof value !== "object") {
|
|
663
|
+
return false;
|
|
664
|
+
}
|
|
665
|
+
return "ngMetadataName" in value && value.ngMetadataName === "InjectionToken";
|
|
666
|
+
}, discoverTokens = (pageModule) => new Map(Object.entries(pageModule).filter(([, value]) => isInjectionToken(value))), resolveSelector = (deps, pagePath, PageComponent) => {
|
|
667
|
+
const cached = selectorCache.get(pagePath);
|
|
668
|
+
if (cached) {
|
|
669
|
+
return cached;
|
|
670
|
+
}
|
|
671
|
+
const selector = deps.reflectComponentType(PageComponent)?.selector ?? "ng-app";
|
|
672
|
+
selectorCache.set(pagePath, selector);
|
|
673
|
+
return selector;
|
|
674
|
+
}, injectBeforeClose = (html, snippet) => {
|
|
675
|
+
if (html.includes("</body>")) {
|
|
676
|
+
return html.replace("</body>", `${snippet}</body>`);
|
|
677
|
+
}
|
|
678
|
+
if (html.includes("</html>")) {
|
|
679
|
+
return html.replace("</html>", `${snippet}</html>`);
|
|
680
|
+
}
|
|
681
|
+
return html + snippet;
|
|
682
|
+
}, injectSsrScripts = (html, requestId, indexPath, props) => {
|
|
683
|
+
let result = html;
|
|
684
|
+
const registeredScripts = getAndClearClientScripts(requestId);
|
|
685
|
+
if (registeredScripts.length > 0) {
|
|
686
|
+
result = injectBeforeClose(result, generateClientScriptCode(registeredScripts));
|
|
687
|
+
}
|
|
688
|
+
if (props) {
|
|
689
|
+
result = injectBeforeClose(result, `<script>window.__ABS_ANGULAR_PAGE_PROPS__ = ${JSON.stringify(props)};</script>`);
|
|
690
|
+
}
|
|
691
|
+
if (indexPath) {
|
|
692
|
+
const escapedIndexPath = JSON.stringify(indexPath);
|
|
693
|
+
result = injectBeforeClose(result, `<script>import(${escapedIndexPath});</script>`);
|
|
694
|
+
}
|
|
695
|
+
return result;
|
|
696
|
+
}, renderAngularApp = async (deps, PageComponent, providers, document2, url = "/") => {
|
|
697
|
+
const bootstrap = (context) => deps.bootstrapApplication(PageComponent, { providers }, context);
|
|
698
|
+
return withSuppressedAngularDevLogs(() => deps.renderApplication(bootstrap, {
|
|
699
|
+
document: document2,
|
|
700
|
+
platformProviders: [],
|
|
701
|
+
url
|
|
702
|
+
}));
|
|
703
|
+
}, withSuppressedAngularDevLogs = async (render) => {
|
|
704
|
+
const origLog = console.log;
|
|
705
|
+
console.log = (...args) => {
|
|
706
|
+
if (typeof args[0] === "string" && args[0].includes("development mode")) {
|
|
707
|
+
return;
|
|
708
|
+
}
|
|
709
|
+
origLog.apply(console, args);
|
|
710
|
+
};
|
|
711
|
+
try {
|
|
712
|
+
return await render();
|
|
713
|
+
} finally {
|
|
714
|
+
console.log = origLog;
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
var init_ssrRender = __esm(() => {
|
|
718
|
+
init_registerClientScript();
|
|
719
|
+
init_requestProviders();
|
|
720
|
+
routePropsCache = new Map;
|
|
721
|
+
selectorCache = new Map;
|
|
722
|
+
});
|
|
723
|
+
|
|
724
|
+
// src/angular/islands.ts
|
|
725
|
+
var exports_islands = {};
|
|
726
|
+
__export(exports_islands, {
|
|
727
|
+
renderAngularIslandToHtml: () => renderAngularIslandToHtml,
|
|
728
|
+
mountAngularIsland: () => mountAngularIsland,
|
|
729
|
+
isAngularComponent: () => isAngularComponent,
|
|
730
|
+
getAngularIslandSelector: () => getAngularIslandSelector
|
|
731
|
+
});
|
|
732
|
+
var angularIslandSelector = "abs-angular-island", isAngularComponent = (value) => typeof value === "function", getAngularIslandSelector = (_islandId) => angularIslandSelector, getSelectorFromRenderedIsland = (rootElement) => {
|
|
733
|
+
const firstChild = rootElement.firstElementChild;
|
|
734
|
+
if (!(firstChild instanceof HTMLElement)) {
|
|
735
|
+
return null;
|
|
736
|
+
}
|
|
737
|
+
const selector = firstChild.tagName.toLowerCase();
|
|
738
|
+
return selector.length > 0 ? selector : null;
|
|
739
|
+
}, getClientAngularComponentSelector = (component) => {
|
|
740
|
+
const maybeDef = Reflect.get(component, "\u0275cmp");
|
|
741
|
+
if (typeof maybeDef !== "object" || maybeDef === null) {
|
|
742
|
+
return null;
|
|
743
|
+
}
|
|
744
|
+
const maybeSelectors = Reflect.get(maybeDef, "selectors");
|
|
745
|
+
if (!Array.isArray(maybeSelectors)) {
|
|
746
|
+
return null;
|
|
747
|
+
}
|
|
748
|
+
const [firstSelectorGroup] = maybeSelectors;
|
|
749
|
+
if (!Array.isArray(firstSelectorGroup)) {
|
|
750
|
+
return null;
|
|
751
|
+
}
|
|
752
|
+
const [selector] = firstSelectorGroup;
|
|
753
|
+
return typeof selector === "string" && selector.length > 0 ? selector : null;
|
|
754
|
+
}, createAngularIslandApp = async () => {
|
|
755
|
+
const { EnvironmentInjector, provideZonelessChangeDetection } = await import("@angular/core");
|
|
756
|
+
const { createApplication } = await import("@angular/platform-browser");
|
|
757
|
+
const app = await createApplication({
|
|
758
|
+
providers: [provideZonelessChangeDetection()]
|
|
759
|
+
});
|
|
760
|
+
const environmentInjector = app.injector.get(EnvironmentInjector);
|
|
761
|
+
return { app, environmentInjector };
|
|
762
|
+
}, angularIslandAppPromise = null, getAngularIslandApp = async () => {
|
|
763
|
+
if (!angularIslandAppPromise) {
|
|
764
|
+
angularIslandAppPromise = createAngularIslandApp();
|
|
765
|
+
}
|
|
766
|
+
return angularIslandAppPromise;
|
|
767
|
+
}, wrapperMetadataCache, requestRenderCache, getRequestRenderCache = () => {
|
|
768
|
+
const requestId = getSsrContextId();
|
|
769
|
+
if (!requestId) {
|
|
770
|
+
return null;
|
|
771
|
+
}
|
|
772
|
+
const cached = requestRenderCache.get(requestId);
|
|
773
|
+
if (cached) {
|
|
774
|
+
return cached;
|
|
775
|
+
}
|
|
776
|
+
const renderCache = new Map;
|
|
777
|
+
requestRenderCache.set(requestId, renderCache);
|
|
778
|
+
return renderCache;
|
|
779
|
+
}, getAngularIslandWrapperKey = (component, _islandId) => {
|
|
780
|
+
const componentName = typeof component.name === "string" && component.name.length > 0 ? component.name : "AngularIsland";
|
|
781
|
+
return `${componentName}:${angularIslandSelector}`;
|
|
782
|
+
}, getIslandRenderCacheKey = (component, props) => {
|
|
783
|
+
const componentName = typeof component.name === "string" && component.name.length > 0 ? component.name : "AngularIsland";
|
|
784
|
+
return `${componentName}:${JSON.stringify(props)}`;
|
|
785
|
+
}, buildAngularIslandWrapperMetadata = async (component, islandId, wrapperKey) => {
|
|
786
|
+
const { Component, InjectionToken, inject } = await import("@angular/core");
|
|
787
|
+
const { NgComponentOutlet } = await import("@angular/common");
|
|
788
|
+
const deps = await getAngularDeps();
|
|
789
|
+
const selector = getAngularIslandSelector(islandId);
|
|
790
|
+
const propsToken = new InjectionToken(`${wrapperKey}:props`);
|
|
791
|
+
|
|
792
|
+
class AngularIslandWrapperComponent {
|
|
793
|
+
component = component;
|
|
794
|
+
props = inject(propsToken);
|
|
795
|
+
}
|
|
796
|
+
return {
|
|
797
|
+
deps,
|
|
798
|
+
propsToken,
|
|
799
|
+
selector,
|
|
800
|
+
WrapperComponent: Component({
|
|
801
|
+
imports: [NgComponentOutlet, component],
|
|
802
|
+
selector,
|
|
803
|
+
standalone: true,
|
|
804
|
+
template: '<ng-container *ngComponentOutlet="component; inputs: props"></ng-container>'
|
|
805
|
+
})(AngularIslandWrapperComponent)
|
|
806
|
+
};
|
|
807
|
+
}, createAngularIslandWrapper = async (component, islandId) => {
|
|
808
|
+
const wrapperKey = getAngularIslandWrapperKey(component, islandId);
|
|
809
|
+
const cached = wrapperMetadataCache.get(wrapperKey);
|
|
810
|
+
if (cached) {
|
|
811
|
+
return cached;
|
|
812
|
+
}
|
|
813
|
+
const metadataPromise = buildAngularIslandWrapperMetadata(component, islandId, wrapperKey);
|
|
814
|
+
wrapperMetadataCache.set(wrapperKey, metadataPromise);
|
|
815
|
+
return metadataPromise;
|
|
816
|
+
}, extractAngularIslandRoot = (html, selector) => {
|
|
817
|
+
const openTag = `<${selector}`;
|
|
818
|
+
const start = html.indexOf(openTag);
|
|
819
|
+
if (start < 0) {
|
|
820
|
+
throw new Error(`Could not find Angular island root "${selector}".`);
|
|
821
|
+
}
|
|
822
|
+
const endTag = `</${selector}>`;
|
|
823
|
+
const end = html.indexOf(endTag, start);
|
|
824
|
+
if (end < 0) {
|
|
825
|
+
throw new Error(`Could not close Angular island root "${selector}".`);
|
|
826
|
+
}
|
|
827
|
+
return html.slice(start, end + endTag.length);
|
|
828
|
+
}, mountAngularIsland = async (component, element, props, islandId) => {
|
|
829
|
+
await import("@angular/compiler");
|
|
830
|
+
const { createComponent, inputBinding } = await import("@angular/core");
|
|
831
|
+
const selector = getAngularIslandSelector(islandId);
|
|
832
|
+
const { app, environmentInjector } = await getAngularIslandApp();
|
|
833
|
+
let rootElement = element.querySelector(selector);
|
|
834
|
+
if (!(rootElement instanceof HTMLElement)) {
|
|
835
|
+
element.innerHTML = `<${selector}></${selector}>`;
|
|
836
|
+
rootElement = element.querySelector(selector);
|
|
837
|
+
}
|
|
838
|
+
if (!(rootElement instanceof HTMLElement))
|
|
839
|
+
return app;
|
|
840
|
+
const componentSelector = getClientAngularComponentSelector(component) ?? getSelectorFromRenderedIsland(rootElement);
|
|
841
|
+
if (!componentSelector)
|
|
842
|
+
return app;
|
|
843
|
+
rootElement.innerHTML = `<${componentSelector}></${componentSelector}>`;
|
|
844
|
+
const hostElement = rootElement.querySelector(componentSelector);
|
|
845
|
+
if (!(hostElement instanceof HTMLElement))
|
|
846
|
+
return app;
|
|
847
|
+
const bindings = Object.entries(props).map(([key, value]) => inputBinding(key, () => value));
|
|
848
|
+
const componentRef = createComponent(component, {
|
|
849
|
+
bindings,
|
|
850
|
+
environmentInjector,
|
|
851
|
+
hostElement
|
|
852
|
+
});
|
|
853
|
+
app.attachView(componentRef.hostView);
|
|
854
|
+
componentRef.changeDetectorRef.detectChanges();
|
|
855
|
+
window.__ABS_ANGULAR_ISLAND_APPS__ ??= [];
|
|
856
|
+
window.__ABS_ANGULAR_ISLAND_APPS__.push(app);
|
|
857
|
+
return app;
|
|
858
|
+
}, renderAngularIslandToHtml = async (component, props, islandId) => {
|
|
859
|
+
const requestCache = getRequestRenderCache();
|
|
860
|
+
const renderCacheKey = getIslandRenderCacheKey(component, props);
|
|
861
|
+
const cachedHtml = requestCache?.get(renderCacheKey);
|
|
862
|
+
if (cachedHtml) {
|
|
863
|
+
return cachedHtml;
|
|
864
|
+
}
|
|
865
|
+
const { deps, propsToken, selector, WrapperComponent } = await createAngularIslandWrapper(component, islandId);
|
|
866
|
+
const providers = [
|
|
867
|
+
deps.provideServerRendering(),
|
|
868
|
+
deps.provideZonelessChangeDetection(),
|
|
869
|
+
{ provide: deps.APP_BASE_HREF, useValue: "/" },
|
|
870
|
+
{ provide: propsToken, useValue: props }
|
|
871
|
+
];
|
|
872
|
+
const document2 = `<!DOCTYPE html><html><body><${selector}></${selector}></body></html>`;
|
|
873
|
+
const html = await withSuppressedAngularDevLogs(() => deps.renderApplication((context) => deps.bootstrapApplication(WrapperComponent, { providers }, context), {
|
|
874
|
+
document: document2,
|
|
875
|
+
platformProviders: [],
|
|
876
|
+
url: "/"
|
|
877
|
+
}));
|
|
878
|
+
const islandHtml = extractAngularIslandRoot(html, selector);
|
|
879
|
+
requestCache?.set(renderCacheKey, islandHtml);
|
|
880
|
+
return islandHtml;
|
|
881
|
+
};
|
|
882
|
+
var init_islands2 = __esm(() => {
|
|
883
|
+
init_angularDeps();
|
|
884
|
+
init_ssrRender();
|
|
885
|
+
init_registerClientScript();
|
|
886
|
+
wrapperMetadataCache = new Map;
|
|
887
|
+
requestRenderCache = new Map;
|
|
888
|
+
});
|
|
889
|
+
|
|
890
|
+
// src/client/islandResolver.ts
|
|
891
|
+
var createIslandManifestResolver = (manifest) => {
|
|
892
|
+
const islandManifest = getIslandManifestEntries(manifest);
|
|
893
|
+
return async (framework, component) => {
|
|
894
|
+
const modulePath = islandManifest[framework]?.[component] ?? manifest[getIslandManifestKey(framework, component)];
|
|
895
|
+
if (!modulePath)
|
|
896
|
+
return;
|
|
897
|
+
const loadedModule = await import(modulePath);
|
|
898
|
+
return loadedModule.default;
|
|
899
|
+
};
|
|
900
|
+
};
|
|
901
|
+
// node_modules/zustand/esm/vanilla.mjs
|
|
902
|
+
var createStoreImpl = (createState) => {
|
|
903
|
+
let state;
|
|
904
|
+
const listeners = /* @__PURE__ */ new Set;
|
|
905
|
+
const setState = (partial, replace) => {
|
|
906
|
+
const nextState = typeof partial === "function" ? partial(state) : partial;
|
|
907
|
+
if (!Object.is(nextState, state)) {
|
|
908
|
+
const previousState = state;
|
|
909
|
+
state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
|
|
910
|
+
listeners.forEach((listener) => listener(state, previousState));
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
const getState = () => state;
|
|
914
|
+
const getInitialState = () => initialState;
|
|
915
|
+
const subscribe = (listener) => {
|
|
916
|
+
listeners.add(listener);
|
|
917
|
+
return () => listeners.delete(listener);
|
|
918
|
+
};
|
|
919
|
+
const api = { setState, getState, getInitialState, subscribe };
|
|
920
|
+
const initialState = state = createState(setState, getState, api);
|
|
921
|
+
return api;
|
|
922
|
+
};
|
|
923
|
+
var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
|
|
924
|
+
|
|
925
|
+
// node_modules/zustand/esm/middleware.mjs
|
|
926
|
+
function combine(initialState, create) {
|
|
927
|
+
return (...args) => Object.assign({}, initialState, create(...args));
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
// src/client/islandStore.ts
|
|
931
|
+
var getIslandStoreSnapshot = () => {
|
|
932
|
+
globalThis.__ABS_ISLAND_STATE__ ??= {};
|
|
933
|
+
return globalThis.__ABS_ISLAND_STATE__;
|
|
934
|
+
};
|
|
935
|
+
var getIslandStores = () => {
|
|
936
|
+
globalThis.__ABS_ISLAND_STORES__ ??= new Map;
|
|
937
|
+
return globalThis.__ABS_ISLAND_STORES__;
|
|
938
|
+
};
|
|
939
|
+
var isSerializableValue = (value) => typeof value !== "function" && value !== undefined;
|
|
940
|
+
var toSerializableState = (state) => Object.fromEntries(Object.entries(state).filter(([, value]) => isSerializableValue(value)));
|
|
941
|
+
var applySnapshot = (store, snapshot) => {
|
|
942
|
+
if (!snapshot) {
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
store.setState({
|
|
946
|
+
...store.getState(),
|
|
947
|
+
...snapshot
|
|
948
|
+
});
|
|
949
|
+
};
|
|
950
|
+
var getPeerStores = (storeInstances, ownerStore) => [...storeInstances].filter((peer) => peer.store !== ownerStore);
|
|
951
|
+
var syncIslandSnapshot = (storeId, state, storeInstances, ownerStore) => {
|
|
952
|
+
const nextSnapshot = toSerializableState(state);
|
|
953
|
+
getIslandStoreSnapshot()[storeId] = nextSnapshot;
|
|
954
|
+
for (const peerStore of getPeerStores(storeInstances, ownerStore)) {
|
|
955
|
+
peerStore.applyExternalSnapshot(nextSnapshot);
|
|
956
|
+
}
|
|
957
|
+
};
|
|
958
|
+
var createIslandStore = (storeId, initialState, createState) => {
|
|
959
|
+
const store = createStore(combine(initialState, createState));
|
|
960
|
+
const stores = getIslandStores();
|
|
961
|
+
const storeInstances = stores.get(storeId) ?? new Set;
|
|
962
|
+
const initialSnapshot = getIslandStoreSnapshot()[storeId];
|
|
963
|
+
applySnapshot(store, initialSnapshot);
|
|
964
|
+
let isApplyingExternalSnapshot = false;
|
|
965
|
+
const applyExternalSnapshot = (snapshot) => {
|
|
966
|
+
isApplyingExternalSnapshot = true;
|
|
967
|
+
applySnapshot(store, snapshot);
|
|
968
|
+
};
|
|
969
|
+
storeInstances.add({
|
|
970
|
+
applyExternalSnapshot,
|
|
971
|
+
store
|
|
972
|
+
});
|
|
973
|
+
stores.set(storeId, storeInstances);
|
|
974
|
+
syncIslandSnapshot(storeId, store.getState(), storeInstances, store);
|
|
975
|
+
store.subscribe((state) => {
|
|
976
|
+
if (isApplyingExternalSnapshot) {
|
|
977
|
+
isApplyingExternalSnapshot = false;
|
|
978
|
+
return;
|
|
979
|
+
}
|
|
980
|
+
syncIslandSnapshot(storeId, state, storeInstances, store);
|
|
981
|
+
});
|
|
982
|
+
return store;
|
|
983
|
+
};
|
|
984
|
+
var getIslandStoreServerSnapshot = (store, selector) => selector(store.getInitialState());
|
|
985
|
+
var applySnapshotToStoreInstances = (storeId, instances, snapshot) => {
|
|
986
|
+
for (const instance of instances) {
|
|
987
|
+
instance.applyExternalSnapshot(snapshot[storeId] ?? {});
|
|
988
|
+
}
|
|
989
|
+
};
|
|
990
|
+
var initializeIslandStores = (state) => {
|
|
991
|
+
const currentSnapshot = getIslandStoreSnapshot();
|
|
992
|
+
const nextSnapshot = {
|
|
993
|
+
...state,
|
|
994
|
+
...currentSnapshot
|
|
995
|
+
};
|
|
996
|
+
globalThis.__ABS_ISLAND_STATE__ = nextSnapshot;
|
|
997
|
+
for (const [storeId, store] of getIslandStores()) {
|
|
998
|
+
applySnapshotToStoreInstances(storeId, store, nextSnapshot);
|
|
999
|
+
}
|
|
1000
|
+
};
|
|
1001
|
+
var readIslandStore = (store, selector) => selector(store.getState());
|
|
1002
|
+
var subscribeIslandStore = (store, selector, listener) => {
|
|
1003
|
+
let currentSelection = selector(store.getState());
|
|
1004
|
+
return store.subscribe((state) => {
|
|
1005
|
+
const nextSelection = selector(state);
|
|
1006
|
+
if (Object.is(nextSelection, currentSelection)) {
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
currentSelection = nextSelection;
|
|
1010
|
+
listener(nextSelection);
|
|
1011
|
+
});
|
|
1012
|
+
};
|
|
1013
|
+
// src/client/islandRuntime.ts
|
|
1014
|
+
init_islands();
|
|
1015
|
+
|
|
1016
|
+
// src/client/preserveIslandMarkup.ts
|
|
1017
|
+
init_islandMarkupAttributes();
|
|
1018
|
+
var getClaimMap = () => {
|
|
1019
|
+
if (typeof window === "undefined") {
|
|
1020
|
+
return null;
|
|
1021
|
+
}
|
|
1022
|
+
window.__ABS_CLAIMED_ISLAND_MARKUP__ ??= new Map;
|
|
1023
|
+
return window.__ABS_CLAIMED_ISLAND_MARKUP__;
|
|
1024
|
+
};
|
|
1025
|
+
var getSnapshotMap = () => {
|
|
1026
|
+
if (typeof window === "undefined") {
|
|
1027
|
+
return null;
|
|
1028
|
+
}
|
|
1029
|
+
window.__ABS_SERVER_ISLAND_HTML__ ??= new Map;
|
|
1030
|
+
return window.__ABS_SERVER_ISLAND_HTML__;
|
|
1031
|
+
};
|
|
1032
|
+
var getIslandSignature = (props) => {
|
|
1033
|
+
const attributes = getIslandMarkerAttributes(props);
|
|
1034
|
+
return [
|
|
1035
|
+
attributes["data-component"],
|
|
1036
|
+
attributes["data-framework"],
|
|
1037
|
+
attributes["data-hydrate"],
|
|
1038
|
+
attributes["data-props"]
|
|
1039
|
+
].join("::");
|
|
1040
|
+
};
|
|
1041
|
+
var isMatchingIslandElement = (element, props) => {
|
|
1042
|
+
if (!(element instanceof HTMLElement)) {
|
|
1043
|
+
return false;
|
|
1044
|
+
}
|
|
1045
|
+
const attributes = getIslandMarkerAttributes(props);
|
|
1046
|
+
return element.dataset.island === "true" && element.dataset.component === attributes["data-component"] && element.dataset.framework === attributes["data-framework"] && (element.dataset.hydrate ?? "load") === attributes["data-hydrate"] && (element.dataset.props ?? "{}") === attributes["data-props"];
|
|
1047
|
+
};
|
|
1048
|
+
var snapshotIslandElement = (element, snapshotMap) => {
|
|
1049
|
+
const signature = [
|
|
1050
|
+
element.dataset.component,
|
|
1051
|
+
element.dataset.framework,
|
|
1052
|
+
element.dataset.hydrate ?? "load",
|
|
1053
|
+
element.dataset.props ?? "{}"
|
|
1054
|
+
].join("::");
|
|
1055
|
+
const existing = snapshotMap.get(signature) ?? [];
|
|
1056
|
+
const attributes = Object.fromEntries(element.getAttributeNames().map((name) => [name, element.getAttribute(name) ?? ""]));
|
|
1057
|
+
existing.push({
|
|
1058
|
+
attributes,
|
|
1059
|
+
innerHTML: element.innerHTML
|
|
1060
|
+
});
|
|
1061
|
+
snapshotMap.set(signature, existing);
|
|
1062
|
+
};
|
|
1063
|
+
var initializeIslandMarkupSnapshot = () => {
|
|
1064
|
+
if (typeof document === "undefined") {
|
|
1065
|
+
return;
|
|
1066
|
+
}
|
|
1067
|
+
const snapshotMap = getSnapshotMap();
|
|
1068
|
+
if (!snapshotMap || snapshotMap.size > 0) {
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
1071
|
+
const elements = Array.from(document.querySelectorAll('[data-island="true"]'));
|
|
1072
|
+
for (const element of elements) {
|
|
1073
|
+
snapshotIslandElement(element, snapshotMap);
|
|
1074
|
+
}
|
|
1075
|
+
};
|
|
1076
|
+
var preserveIslandMarkup = (props) => {
|
|
1077
|
+
if (typeof document === "undefined") {
|
|
1078
|
+
return {
|
|
1079
|
+
attributes: getIslandMarkerAttributes(props),
|
|
1080
|
+
innerHTML: ""
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
const claimMap = getClaimMap();
|
|
1084
|
+
const snapshotMap = getSnapshotMap();
|
|
1085
|
+
const signature = getIslandSignature(props);
|
|
1086
|
+
const claimedCount = claimMap?.get(signature) ?? 0;
|
|
1087
|
+
const snapshotCandidate = snapshotMap?.get(signature)?.[claimedCount];
|
|
1088
|
+
const candidates = Array.from(document.querySelectorAll('[data-island="true"]')).filter((element) => isMatchingIslandElement(element, props));
|
|
1089
|
+
const candidate = candidates[claimedCount];
|
|
1090
|
+
if (claimMap) {
|
|
1091
|
+
claimMap.set(signature, claimedCount + 1);
|
|
1092
|
+
}
|
|
1093
|
+
return {
|
|
1094
|
+
attributes: snapshotCandidate?.attributes ?? getIslandMarkerAttributes(props),
|
|
1095
|
+
innerHTML: snapshotCandidate?.innerHTML ?? candidate?.innerHTML ?? ""
|
|
1096
|
+
};
|
|
1097
|
+
};
|
|
1098
|
+
|
|
1099
|
+
// src/client/islandRuntime.ts
|
|
1100
|
+
initializeIslandMarkupSnapshot();
|
|
1101
|
+
var idleDeadline = {
|
|
1102
|
+
didTimeout: false,
|
|
1103
|
+
timeRemaining: () => 0
|
|
1104
|
+
};
|
|
1105
|
+
var requestIdle = typeof window !== "undefined" && "requestIdleCallback" in window ? window.requestIdleCallback.bind(window) : (callback) => window.setTimeout(() => callback(idleDeadline), 1);
|
|
1106
|
+
var isPropsRecord4 = (value) => typeof value === "object" && value !== null;
|
|
84
1107
|
var isIslandElement = (value) => value instanceof HTMLElement && value.dataset.island === "true";
|
|
85
|
-
var isPropsRecord = (value) => typeof value === "object" && value !== null;
|
|
86
|
-
var isReactComponent = (value) => typeof value === "function";
|
|
87
|
-
var isSvelteComponent = (value) => typeof value === "function";
|
|
88
|
-
var isVueComponent = (value) => typeof value === "function" || isPropsRecord(value);
|
|
89
|
-
var isAngularComponent = (value) => typeof value === "function";
|
|
90
1108
|
var observedRoots = new WeakSet;
|
|
91
1109
|
var hydratingIslands = new WeakSet;
|
|
92
|
-
var reactIslandRoots = new WeakMap;
|
|
93
|
-
var vueIslandApps = new WeakMap;
|
|
94
1110
|
var hydrateByFramework = async (registry, framework, componentName, element, props, resolveComponent) => {
|
|
1111
|
+
const propsRecord = isPropsRecord4(props) ? props : undefined;
|
|
95
1112
|
if (framework === "react") {
|
|
1113
|
+
const { hydrateReactIsland: hydrateReactIsland2, isReactComponent: isReactComponent2 } = await Promise.resolve().then(() => (init_react(), exports_react));
|
|
96
1114
|
const resolvedComponent = await resolveComponent?.(framework, componentName) ?? getIslandComponent(registry.react?.[componentName]);
|
|
97
|
-
if (!
|
|
1115
|
+
if (!isReactComponent2(resolvedComponent))
|
|
98
1116
|
return;
|
|
99
|
-
|
|
1117
|
+
hydrateReactIsland2(resolvedComponent, element, propsRecord);
|
|
100
1118
|
element.dataset.hydrated = "true";
|
|
101
1119
|
return;
|
|
102
1120
|
}
|
|
103
1121
|
if (framework === "svelte") {
|
|
1122
|
+
const { hydrateSvelteIsland: hydrateSvelteIsland2, isSvelteComponent: isSvelteComponent2 } = await Promise.resolve().then(() => (init_svelte(), exports_svelte));
|
|
104
1123
|
const resolvedComponent = await resolveComponent?.(framework, componentName) ?? getIslandComponent(registry.svelte?.[componentName]);
|
|
105
|
-
if (!
|
|
1124
|
+
if (!isSvelteComponent2(resolvedComponent))
|
|
106
1125
|
return;
|
|
107
|
-
|
|
1126
|
+
hydrateSvelteIsland2(resolvedComponent, element, propsRecord);
|
|
108
1127
|
element.dataset.hydrated = "true";
|
|
109
1128
|
return;
|
|
110
1129
|
}
|
|
111
1130
|
if (framework === "vue") {
|
|
1131
|
+
const { hydrateVueIsland: hydrateVueIsland2, isVueComponent: isVueComponent2 } = await Promise.resolve().then(() => (init_vue(), exports_vue));
|
|
112
1132
|
const resolvedComponent = await resolveComponent?.(framework, componentName) ?? getIslandComponent(registry.vue?.[componentName]);
|
|
113
|
-
if (!
|
|
1133
|
+
if (!isVueComponent2(resolvedComponent))
|
|
114
1134
|
return;
|
|
115
|
-
|
|
1135
|
+
hydrateVueIsland2(resolvedComponent, element, propsRecord);
|
|
116
1136
|
element.dataset.hydrated = "true";
|
|
117
1137
|
return;
|
|
118
1138
|
}
|
|
119
1139
|
if (framework === "angular") {
|
|
1140
|
+
const { mountAngularIsland: mountAngularIsland2, isAngularComponent: isAngularComponent2 } = await Promise.resolve().then(() => (init_islands2(), exports_islands));
|
|
120
1141
|
const resolvedComponent = await resolveComponent?.(framework, componentName) ?? getIslandComponent(registry.angular?.[componentName]);
|
|
121
1142
|
const { islandId } = element.dataset;
|
|
122
|
-
if (!
|
|
1143
|
+
if (!isAngularComponent2(resolvedComponent) || !islandId)
|
|
123
1144
|
return;
|
|
124
|
-
await
|
|
1145
|
+
await mountAngularIsland2(resolvedComponent, element, propsRecord ?? {}, islandId);
|
|
125
1146
|
element.dataset.hydrated = "true";
|
|
126
1147
|
}
|
|
127
1148
|
};
|
|
@@ -222,5 +1243,5 @@ export {
|
|
|
222
1243
|
createIslandManifestResolver
|
|
223
1244
|
};
|
|
224
1245
|
|
|
225
|
-
//# debugId=
|
|
1246
|
+
//# debugId=C91D1959780716EA64756E2164756E21
|
|
226
1247
|
//# sourceMappingURL=index.js.map
|