@absolutejs/absolute 0.19.0-beta.783 → 0.19.0-beta.785
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 +57 -9801
- package/dist/angular/browser.js.map +4 -246
- package/dist/angular/index.js +61 -14967
- package/dist/angular/index.js.map +4 -282
- package/dist/angular/server.js +45 -5699
- package/dist/angular/server.js.map +3 -52
- package/dist/build.js +45 -18021
- package/dist/build.js.map +3 -100
- package/dist/chunk-102fp7xe.js +63 -0
- package/dist/chunk-102fp7xe.js.map +10 -0
- package/dist/chunk-11zpfqz6.js +19 -0
- package/dist/chunk-11zpfqz6.js.map +10 -0
- package/dist/chunk-1e9vsfyh.js +100 -0
- package/dist/chunk-1e9vsfyh.js.map +10 -0
- package/dist/chunk-25v9t56f.js +29 -0
- package/dist/chunk-25v9t56f.js.map +11 -0
- package/dist/chunk-2f21eenc.js +21 -0
- package/dist/chunk-2f21eenc.js.map +10 -0
- package/dist/chunk-2ga2znex.js +13 -0
- package/dist/chunk-2ga2znex.js.map +9 -0
- package/dist/chunk-30yrw0f6.js +33 -0
- package/dist/chunk-30yrw0f6.js.map +10 -0
- package/dist/chunk-3c7mpj3m.js +784 -0
- package/dist/chunk-3c7mpj3m.js.map +10 -0
- package/dist/chunk-3g91wb4f.js +358 -0
- package/dist/chunk-3g91wb4f.js.map +10 -0
- package/dist/chunk-3yjzpcne.js +34 -0
- package/dist/chunk-3yjzpcne.js.map +10 -0
- package/dist/chunk-4bq79t8v.js +136 -0
- package/dist/chunk-4bq79t8v.js.map +10 -0
- package/dist/chunk-4d39r92n.js +81 -0
- package/dist/chunk-4d39r92n.js.map +10 -0
- package/dist/chunk-4m75s5xf.js +184 -0
- package/dist/chunk-4m75s5xf.js.map +11 -0
- package/dist/chunk-5003emhv.js +17 -0
- package/dist/chunk-5003emhv.js.map +10 -0
- package/dist/chunk-5fhp1jap.js +9169 -0
- package/dist/chunk-5fhp1jap.js.map +236 -0
- package/dist/chunk-6fkgm9s5.js +569 -0
- package/dist/chunk-6fkgm9s5.js.map +10 -0
- package/dist/chunk-6pdj08z3.js +73 -0
- package/dist/chunk-6pdj08z3.js.map +12 -0
- package/dist/chunk-6qjbrt0k.js +13 -0
- package/dist/chunk-6qjbrt0k.js.map +9 -0
- package/dist/chunk-6sccb4jr.js +14 -0
- package/dist/chunk-6sccb4jr.js.map +9 -0
- package/dist/chunk-73brtyw5.js +16 -0
- package/dist/chunk-73brtyw5.js.map +9 -0
- package/dist/chunk-77cqkarb.js +25 -0
- package/dist/chunk-77cqkarb.js.map +9 -0
- package/dist/chunk-798spvzv.js +50 -0
- package/dist/chunk-798spvzv.js.map +10 -0
- package/dist/chunk-7fw6x3js.js +131 -0
- package/dist/chunk-7fw6x3js.js.map +11 -0
- package/dist/chunk-7kjj42xm.js +11 -0
- package/dist/chunk-7kjj42xm.js.map +10 -0
- package/dist/chunk-851whwc7.js +17 -0
- package/dist/chunk-851whwc7.js.map +10 -0
- package/dist/chunk-85n68sy6.js +103 -0
- package/dist/chunk-85n68sy6.js.map +10 -0
- package/dist/chunk-8feq2qek.js +17 -0
- package/dist/chunk-8feq2qek.js.map +9 -0
- package/dist/chunk-8kcfffry.js +35 -0
- package/dist/chunk-8kcfffry.js.map +10 -0
- package/dist/chunk-93sqk7be.js +139 -0
- package/dist/chunk-93sqk7be.js.map +12 -0
- package/dist/chunk-97572s32.js +262 -0
- package/dist/chunk-97572s32.js.map +12 -0
- package/dist/chunk-9a307ca6.js +1742 -0
- package/dist/chunk-9a307ca6.js.map +11 -0
- package/dist/chunk-9c5tj4k3.js +130 -0
- package/dist/chunk-9c5tj4k3.js.map +10 -0
- package/dist/chunk-9xrsjeem.js +12 -0
- package/dist/chunk-9xrsjeem.js.map +9 -0
- package/dist/chunk-a9mvyp04.js +87 -0
- package/dist/chunk-a9mvyp04.js.map +10 -0
- package/dist/chunk-b3gbnrwe.js +21 -0
- package/dist/chunk-b3gbnrwe.js.map +10 -0
- package/dist/chunk-bmgqm774.js +65 -0
- package/dist/chunk-bmgqm774.js.map +9 -0
- package/dist/chunk-bxfghpma.js +69 -0
- package/dist/chunk-bxfghpma.js.map +10 -0
- package/dist/chunk-c1jfjnka.js +74 -0
- package/dist/chunk-c1jfjnka.js.map +10 -0
- package/dist/chunk-cbkrwmvh.js +80 -0
- package/dist/chunk-cbkrwmvh.js.map +10 -0
- package/dist/chunk-cdxd7sy2.js +71 -0
- package/dist/chunk-cdxd7sy2.js.map +10 -0
- package/dist/chunk-cg95827x.js +21 -0
- package/dist/chunk-cg95827x.js.map +10 -0
- package/dist/chunk-d9c0am65.js +12 -0
- package/dist/chunk-d9c0am65.js.map +10 -0
- package/dist/chunk-daqghmg8.js +12 -0
- package/dist/chunk-daqghmg8.js.map +9 -0
- package/dist/chunk-dr9yqsdb.js +203 -0
- package/dist/chunk-dr9yqsdb.js.map +10 -0
- package/dist/chunk-e8eecyrq.js +244 -0
- package/dist/chunk-e8eecyrq.js.map +10 -0
- package/dist/chunk-ex2hxe0v.js +160 -0
- package/dist/chunk-ex2hxe0v.js.map +11 -0
- package/dist/chunk-ey5hs6x6.js +253 -0
- package/dist/chunk-ey5hs6x6.js.map +11 -0
- package/dist/chunk-fak944et.js +91 -0
- package/dist/chunk-fak944et.js.map +10 -0
- package/dist/chunk-fygx2ymm.js +118 -0
- package/dist/chunk-fygx2ymm.js.map +12 -0
- package/dist/chunk-g15qj669.js +271 -0
- package/dist/chunk-g15qj669.js.map +11 -0
- package/dist/chunk-g3j22qf6.js +51 -0
- package/dist/chunk-g3j22qf6.js.map +9 -0
- package/dist/chunk-gd6wmknh.js +121 -0
- package/dist/chunk-gd6wmknh.js.map +11 -0
- package/dist/chunk-gf0ygptk.js +85 -0
- package/dist/chunk-gf0ygptk.js.map +11 -0
- package/dist/chunk-gq0zxpm0.js +90 -0
- package/dist/chunk-gq0zxpm0.js.map +10 -0
- package/dist/chunk-gytkmthr.js +220 -0
- package/dist/chunk-gytkmthr.js.map +10 -0
- package/dist/chunk-h5bbfn3n.js +28 -0
- package/dist/chunk-h5bbfn3n.js.map +11 -0
- package/dist/chunk-h6mye9r3.js +93 -0
- package/dist/chunk-h6mye9r3.js.map +10 -0
- package/dist/chunk-hcsmxw1v.js +85 -0
- package/dist/chunk-hcsmxw1v.js.map +10 -0
- package/dist/chunk-hep68ja7.js +4444 -0
- package/dist/chunk-hep68ja7.js.map +29 -0
- package/dist/chunk-hhqh49fz.js +149 -0
- package/dist/chunk-hhqh49fz.js.map +10 -0
- package/dist/chunk-hyjs4bqs.js +8 -0
- package/dist/chunk-hyjs4bqs.js.map +10 -0
- package/dist/chunk-hza0n8qm.js +20 -0
- package/dist/chunk-hza0n8qm.js.map +9 -0
- package/dist/chunk-jn91vzkh.js +66 -0
- package/dist/chunk-jn91vzkh.js.map +10 -0
- package/dist/chunk-jwxt8gnp.js +13 -0
- package/dist/chunk-jwxt8gnp.js.map +9 -0
- package/dist/chunk-kk8w9rh5.js +195 -0
- package/dist/chunk-kk8w9rh5.js.map +10 -0
- package/dist/chunk-kndkjsya.js +261 -0
- package/dist/chunk-kndkjsya.js.map +10 -0
- package/dist/chunk-kvq01j35.js +36 -0
- package/dist/chunk-kvq01j35.js.map +10 -0
- package/dist/chunk-mbazhahf.js +60 -0
- package/dist/chunk-mbazhahf.js.map +10 -0
- package/dist/chunk-mgfwq18r.js +15 -0
- package/dist/chunk-mgfwq18r.js.map +9 -0
- package/dist/chunk-mtgf69xn.js +88 -0
- package/dist/chunk-mtgf69xn.js.map +10 -0
- package/dist/chunk-nehhtthw.js +225 -0
- package/dist/chunk-nehhtthw.js.map +10 -0
- package/dist/chunk-nhzf4az4.js +149 -0
- package/dist/chunk-nhzf4az4.js.map +10 -0
- package/dist/chunk-p5504p14.js +16 -0
- package/dist/chunk-p5504p14.js.map +10 -0
- package/dist/chunk-pnscgw95.js +90 -0
- package/dist/chunk-pnscgw95.js.map +10 -0
- package/dist/chunk-pvpp4pvs.js +17 -0
- package/dist/chunk-pvpp4pvs.js.map +10 -0
- package/dist/chunk-qh75agse.js +95 -0
- package/dist/chunk-qh75agse.js.map +10 -0
- package/dist/chunk-qk8kd3hr.js +526 -0
- package/dist/chunk-qk8kd3hr.js.map +12 -0
- package/dist/chunk-qxq2zcty.js +52 -0
- package/dist/chunk-qxq2zcty.js.map +10 -0
- package/dist/chunk-r7jmgqnw.js +114 -0
- package/dist/chunk-r7jmgqnw.js.map +10 -0
- package/dist/chunk-s6defjk2.js +116 -0
- package/dist/chunk-s6defjk2.js.map +10 -0
- package/dist/chunk-sd39p726.js +619 -0
- package/dist/chunk-sd39p726.js.map +10 -0
- package/dist/chunk-smgj0epn.js +18 -0
- package/dist/chunk-smgj0epn.js.map +9 -0
- package/dist/chunk-swrnzs4c.js +63 -0
- package/dist/chunk-swrnzs4c.js.map +10 -0
- package/dist/chunk-t81a331y.js +27 -0
- package/dist/chunk-t81a331y.js.map +10 -0
- package/dist/chunk-tfe3sb44.js +33 -0
- package/dist/chunk-tfe3sb44.js.map +10 -0
- package/dist/chunk-tx9edm1x.js +34 -0
- package/dist/chunk-tx9edm1x.js.map +10 -0
- package/dist/chunk-vkrpm7kc.js +247 -0
- package/dist/chunk-vkrpm7kc.js.map +12 -0
- package/dist/chunk-vvz7dcvq.js +434 -0
- package/dist/chunk-vvz7dcvq.js.map +13 -0
- package/dist/chunk-w3m4m5we.js +4925 -0
- package/dist/chunk-w3m4m5we.js.map +12 -0
- package/dist/chunk-wrxtn9ve.js +18 -0
- package/dist/chunk-wrxtn9ve.js.map +10 -0
- package/dist/chunk-xpkjbmd3.js +428 -0
- package/dist/chunk-xpkjbmd3.js.map +14 -0
- package/dist/chunk-xrmjy8kk.js +454 -0
- package/dist/chunk-xrmjy8kk.js.map +10 -0
- package/dist/chunk-xw0tx842.js +13 -0
- package/dist/chunk-xw0tx842.js.map +9 -0
- package/dist/chunk-xx5b6b9m.js +69 -0
- package/dist/chunk-xx5b6b9m.js.map +10 -0
- package/dist/chunk-xz1kdswj.js +21 -0
- package/dist/chunk-xz1kdswj.js.map +9 -0
- package/dist/chunk-xzvy9hr4.js +377 -0
- package/dist/chunk-xzvy9hr4.js.map +10 -0
- package/dist/chunk-yfqhr31t.js +39 -0
- package/dist/chunk-yfqhr31t.js.map +9 -0
- package/dist/chunk-ygzd5s4z.js +184 -0
- package/dist/chunk-ygzd5s4z.js.map +10 -0
- package/dist/chunk-ywjn0rad.js +14 -0
- package/dist/chunk-ywjn0rad.js.map +9 -0
- package/dist/chunk-z9nvhm6r.js +13 -0
- package/dist/chunk-z9nvhm6r.js.map +9 -0
- package/dist/chunk-zhmvdpk6.js +15 -0
- package/dist/chunk-zhmvdpk6.js.map +9 -0
- package/dist/client/index.js +32 -1112
- package/dist/client/index.js.map +4 -22
- package/dist/core/streamingSlotRegistrar.js +11 -108
- package/dist/core/streamingSlotRegistrar.js.map +3 -4
- package/dist/core/streamingSlotRegistry.js +7 -169
- package/dist/core/streamingSlotRegistry.js.map +3 -5
- package/dist/index.js +536 -19835
- package/dist/index.js.map +3 -117
- package/dist/islands/browser.js +9 -228
- package/dist/islands/browser.js.map +4 -9
- package/dist/islands/index.js +17 -1986
- package/dist/islands/index.js.map +3 -28
- package/dist/react/browser.js +12 -328
- package/dist/react/browser.js.map +4 -12
- package/dist/react/components/index.js +16 -167
- package/dist/react/components/index.js.map +3 -6
- package/dist/react/hooks/index.js +8 -183
- package/dist/react/hooks/index.js.map +3 -7
- package/dist/react/index.js +36 -3705
- package/dist/react/index.js.map +4 -46
- package/dist/react/jsxDevRuntimeCompat.js +2 -61
- package/dist/react/jsxDevRuntimeCompat.js.map +2 -2
- package/dist/react/server.js +18 -1789
- package/dist/react/server.js.map +3 -21
- package/dist/src/core/index.d.ts +0 -2
- package/dist/svelte/browser.js +12 -247
- package/dist/svelte/browser.js.map +3 -10
- package/dist/svelte/index.js +37 -3810
- package/dist/svelte/index.js.map +4 -48
- package/dist/svelte/server.js +21 -2787
- package/dist/svelte/server.js.map +3 -27
- package/dist/vue/browser.js +12 -348
- package/dist/vue/browser.js.map +4 -12
- package/dist/vue/components/Image.js +7 -240
- package/dist/vue/components/Image.js.map +3 -6
- package/dist/vue/components/index.js +11 -544
- package/dist/vue/components/index.js.map +3 -9
- package/dist/vue/index.js +52 -4290
- package/dist/vue/index.js.map +4 -51
- package/dist/vue/server.js +18 -1849
- package/dist/vue/server.js.map +3 -21
- package/package.json +1 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// node_modules/zustand/esm/vanilla.mjs
|
|
3
|
+
var createStoreImpl = (createState) => {
|
|
4
|
+
let state;
|
|
5
|
+
const listeners = /* @__PURE__ */ new Set;
|
|
6
|
+
const setState = (partial, replace) => {
|
|
7
|
+
const nextState = typeof partial === "function" ? partial(state) : partial;
|
|
8
|
+
if (!Object.is(nextState, state)) {
|
|
9
|
+
const previousState = state;
|
|
10
|
+
state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
|
|
11
|
+
listeners.forEach((listener) => listener(state, previousState));
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const getState = () => state;
|
|
15
|
+
const getInitialState = () => initialState;
|
|
16
|
+
const subscribe = (listener) => {
|
|
17
|
+
listeners.add(listener);
|
|
18
|
+
return () => listeners.delete(listener);
|
|
19
|
+
};
|
|
20
|
+
const api = { setState, getState, getInitialState, subscribe };
|
|
21
|
+
const initialState = state = createState(setState, getState, api);
|
|
22
|
+
return api;
|
|
23
|
+
};
|
|
24
|
+
var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
|
|
25
|
+
|
|
26
|
+
// node_modules/zustand/esm/middleware.mjs
|
|
27
|
+
function combine(initialState, create) {
|
|
28
|
+
return (...args) => Object.assign({}, initialState, create(...args));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// src/client/islandStore.ts
|
|
32
|
+
var getIslandStoreSnapshot = () => {
|
|
33
|
+
globalThis.__ABS_ISLAND_STATE__ ??= {};
|
|
34
|
+
return globalThis.__ABS_ISLAND_STATE__;
|
|
35
|
+
};
|
|
36
|
+
var getIslandStores = () => {
|
|
37
|
+
globalThis.__ABS_ISLAND_STORES__ ??= new Map;
|
|
38
|
+
return globalThis.__ABS_ISLAND_STORES__;
|
|
39
|
+
};
|
|
40
|
+
var isSerializableValue = (value) => typeof value !== "function" && value !== undefined;
|
|
41
|
+
var toSerializableState = (state) => Object.fromEntries(Object.entries(state).filter(([, value]) => isSerializableValue(value)));
|
|
42
|
+
var applySnapshot = (store, snapshot) => {
|
|
43
|
+
if (!snapshot) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
store.setState({
|
|
47
|
+
...store.getState(),
|
|
48
|
+
...snapshot
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
var getPeerStores = (storeInstances, ownerStore) => [...storeInstances].filter((peer) => peer.store !== ownerStore);
|
|
52
|
+
var syncIslandSnapshot = (storeId, state, storeInstances, ownerStore) => {
|
|
53
|
+
const nextSnapshot = toSerializableState(state);
|
|
54
|
+
getIslandStoreSnapshot()[storeId] = nextSnapshot;
|
|
55
|
+
for (const peerStore of getPeerStores(storeInstances, ownerStore)) {
|
|
56
|
+
peerStore.applyExternalSnapshot(nextSnapshot);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
var createIslandStore = (storeId, initialState, createState) => {
|
|
60
|
+
const store = createStore(combine(initialState, createState));
|
|
61
|
+
const stores = getIslandStores();
|
|
62
|
+
const storeInstances = stores.get(storeId) ?? new Set;
|
|
63
|
+
const initialSnapshot = getIslandStoreSnapshot()[storeId];
|
|
64
|
+
applySnapshot(store, initialSnapshot);
|
|
65
|
+
let isApplyingExternalSnapshot = false;
|
|
66
|
+
const applyExternalSnapshot = (snapshot) => {
|
|
67
|
+
isApplyingExternalSnapshot = true;
|
|
68
|
+
applySnapshot(store, snapshot);
|
|
69
|
+
};
|
|
70
|
+
storeInstances.add({
|
|
71
|
+
applyExternalSnapshot,
|
|
72
|
+
store
|
|
73
|
+
});
|
|
74
|
+
stores.set(storeId, storeInstances);
|
|
75
|
+
syncIslandSnapshot(storeId, store.getState(), storeInstances, store);
|
|
76
|
+
store.subscribe((state) => {
|
|
77
|
+
if (isApplyingExternalSnapshot) {
|
|
78
|
+
isApplyingExternalSnapshot = false;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
syncIslandSnapshot(storeId, state, storeInstances, store);
|
|
82
|
+
});
|
|
83
|
+
return store;
|
|
84
|
+
};
|
|
85
|
+
var getIslandStoreServerSnapshot = (store, selector) => selector(store.getInitialState());
|
|
86
|
+
var applySnapshotToStoreInstances = (storeId, instances, snapshot) => {
|
|
87
|
+
for (const instance of instances) {
|
|
88
|
+
instance.applyExternalSnapshot(snapshot[storeId] ?? {});
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var initializeIslandStores = (state) => {
|
|
92
|
+
const currentSnapshot = getIslandStoreSnapshot();
|
|
93
|
+
const nextSnapshot = {
|
|
94
|
+
...state,
|
|
95
|
+
...currentSnapshot
|
|
96
|
+
};
|
|
97
|
+
globalThis.__ABS_ISLAND_STATE__ = nextSnapshot;
|
|
98
|
+
for (const [storeId, store] of getIslandStores()) {
|
|
99
|
+
applySnapshotToStoreInstances(storeId, store, nextSnapshot);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
var readIslandStore = (store, selector) => selector(store.getState());
|
|
103
|
+
var subscribeIslandStore = (store, selector, listener) => {
|
|
104
|
+
let currentSelection = selector(store.getState());
|
|
105
|
+
return store.subscribe((state) => {
|
|
106
|
+
const nextSelection = selector(state);
|
|
107
|
+
if (Object.is(nextSelection, currentSelection)) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
currentSelection = nextSelection;
|
|
111
|
+
listener(nextSelection);
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export { createIslandStore, getIslandStoreServerSnapshot, initializeIslandStores, readIslandStore, subscribeIslandStore };
|
|
116
|
+
|
|
117
|
+
//# debugId=BAB6679FFC15F26F64756E2164756E21
|
|
118
|
+
//# sourceMappingURL=chunk-fygx2ymm.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../node_modules/zustand/esm/vanilla.mjs", "../node_modules/zustand/esm/middleware.mjs", "../src/client/islandStore.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\" || nextState === null) ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const getInitialState = () => initialState;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const api = { setState, getState, getInitialState, subscribe };\n const initialState = state = createState(setState, getState, api);\n return api;\n};\nconst createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);\n\nexport { createStore };\n",
|
|
6
|
+
"const reduxImpl = (reducer, initial) => (set, _get, api) => {\n api.dispatch = (action) => {\n set((state) => reducer(state, action), false, action);\n return action;\n };\n api.dispatchFromDevtools = true;\n return { dispatch: (...args) => api.dispatch(...args), ...initial };\n};\nconst redux = reduxImpl;\n\nconst shouldDispatchFromDevtools = (api) => !!api.dispatchFromDevtools && typeof api.dispatch === \"function\";\nconst trackedConnections = /* @__PURE__ */ new Map();\nconst getTrackedConnectionState = (name) => {\n const api = trackedConnections.get(name);\n if (!api) return {};\n return Object.fromEntries(\n Object.entries(api.stores).map(([key, api2]) => [key, api2.getState()])\n );\n};\nconst extractConnectionInformation = (store, extensionConnector, options) => {\n if (store === void 0) {\n return {\n type: \"untracked\",\n connection: extensionConnector.connect(options)\n };\n }\n const existingConnection = trackedConnections.get(options.name);\n if (existingConnection) {\n return { type: \"tracked\", store, ...existingConnection };\n }\n const newConnection = {\n connection: extensionConnector.connect(options),\n stores: {}\n };\n trackedConnections.set(options.name, newConnection);\n return { type: \"tracked\", store, ...newConnection };\n};\nconst removeStoreFromTrackedConnections = (name, store) => {\n if (store === void 0) return;\n const connectionInfo = trackedConnections.get(name);\n if (!connectionInfo) return;\n delete connectionInfo.stores[store];\n if (Object.keys(connectionInfo.stores).length === 0) {\n trackedConnections.delete(name);\n }\n};\nconst findCallerName = (stack) => {\n var _a, _b;\n if (!stack) return void 0;\n const traceLines = stack.split(\"\\n\");\n const apiSetStateLineIndex = traceLines.findIndex(\n (traceLine) => traceLine.includes(\"api.setState\")\n );\n if (apiSetStateLineIndex < 0) return void 0;\n const callerLine = ((_a = traceLines[apiSetStateLineIndex + 1]) == null ? void 0 : _a.trim()) || \"\";\n return (_b = /.+ (.+) .+/.exec(callerLine)) == null ? void 0 : _b[1];\n};\nconst devtoolsImpl = (fn, devtoolsOptions = {}) => (set, get, api) => {\n const { enabled, anonymousActionType, store, ...options } = devtoolsOptions;\n let extensionConnector;\n try {\n extensionConnector = (enabled != null ? enabled : (import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") && window.__REDUX_DEVTOOLS_EXTENSION__;\n } catch (e) {\n }\n if (!extensionConnector) {\n return fn(set, get, api);\n }\n const { connection, ...connectionInformation } = extractConnectionInformation(store, extensionConnector, options);\n let isRecording = true;\n api.setState = ((state, replace, nameOrAction) => {\n const r = set(state, replace);\n if (!isRecording) return r;\n const action = nameOrAction === void 0 ? {\n type: anonymousActionType || findCallerName(new Error().stack) || \"anonymous\"\n } : typeof nameOrAction === \"string\" ? { type: nameOrAction } : nameOrAction;\n if (store === void 0) {\n connection == null ? void 0 : connection.send(action, get());\n return r;\n }\n connection == null ? void 0 : connection.send(\n {\n ...action,\n type: `${store}/${action.type}`\n },\n {\n ...getTrackedConnectionState(options.name),\n [store]: api.getState()\n }\n );\n return r;\n });\n api.devtools = {\n cleanup: () => {\n if (connection && typeof connection.unsubscribe === \"function\") {\n connection.unsubscribe();\n }\n removeStoreFromTrackedConnections(options.name, store);\n }\n };\n const setStateFromDevtools = (...a) => {\n const originalIsRecording = isRecording;\n isRecording = false;\n set(...a);\n isRecording = originalIsRecording;\n };\n const initialState = fn(api.setState, get, api);\n if (connectionInformation.type === \"untracked\") {\n connection == null ? void 0 : connection.init(initialState);\n } else {\n connectionInformation.stores[connectionInformation.store] = api;\n connection == null ? void 0 : connection.init(\n Object.fromEntries(\n Object.entries(connectionInformation.stores).map(([key, store2]) => [\n key,\n key === connectionInformation.store ? initialState : store2.getState()\n ])\n )\n );\n }\n if (shouldDispatchFromDevtools(api)) {\n let didWarnAboutReservedActionType = false;\n const originalDispatch = api.dispatch;\n api.dispatch = (...args) => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\" && args[0].type === \"__setState\" && !didWarnAboutReservedActionType) {\n console.warn(\n '[zustand devtools middleware] \"__setState\" action type is reserved to set state from the devtools. Avoid using it.'\n );\n didWarnAboutReservedActionType = true;\n }\n originalDispatch(...args);\n };\n }\n connection.subscribe((message) => {\n var _a;\n switch (message.type) {\n case \"ACTION\":\n if (typeof message.payload !== \"string\") {\n console.error(\n \"[zustand devtools middleware] Unsupported action format\"\n );\n return;\n }\n return parseJsonThen(\n message.payload,\n (action) => {\n if (action.type === \"__setState\") {\n if (store === void 0) {\n setStateFromDevtools(action.state);\n return;\n }\n if (Object.keys(action.state).length !== 1) {\n console.error(\n `\n [zustand devtools middleware] Unsupported __setState action format.\n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n `\n );\n }\n const stateFromDevtools = action.state[store];\n if (stateFromDevtools === void 0 || stateFromDevtools === null) {\n return;\n }\n if (JSON.stringify(api.getState()) !== JSON.stringify(stateFromDevtools)) {\n setStateFromDevtools(stateFromDevtools);\n }\n return;\n }\n if (shouldDispatchFromDevtools(api)) {\n api.dispatch(action);\n }\n }\n );\n case \"DISPATCH\":\n switch (message.payload.type) {\n case \"RESET\":\n setStateFromDevtools(initialState);\n if (store === void 0) {\n return connection == null ? void 0 : connection.init(api.getState());\n }\n return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n case \"COMMIT\":\n if (store === void 0) {\n connection == null ? void 0 : connection.init(api.getState());\n return;\n }\n return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n case \"ROLLBACK\":\n return parseJsonThen(message.state, (state) => {\n if (store === void 0) {\n setStateFromDevtools(state);\n connection == null ? void 0 : connection.init(api.getState());\n return;\n }\n setStateFromDevtools(state[store]);\n connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n });\n case \"JUMP_TO_STATE\":\n case \"JUMP_TO_ACTION\":\n return parseJsonThen(message.state, (state) => {\n if (store === void 0) {\n setStateFromDevtools(state);\n return;\n }\n if (JSON.stringify(api.getState()) !== JSON.stringify(state[store])) {\n setStateFromDevtools(state[store]);\n }\n });\n case \"IMPORT_STATE\": {\n const { nextLiftedState } = message.payload;\n const lastComputedState = (_a = nextLiftedState.computedStates.slice(-1)[0]) == null ? void 0 : _a.state;\n if (!lastComputedState) return;\n if (store === void 0) {\n setStateFromDevtools(lastComputedState);\n } else {\n setStateFromDevtools(lastComputedState[store]);\n }\n connection == null ? void 0 : connection.send(\n null,\n // FIXME no-any\n nextLiftedState\n );\n return;\n }\n case \"PAUSE_RECORDING\":\n return isRecording = !isRecording;\n }\n return;\n }\n });\n return initialState;\n};\nconst devtools = devtoolsImpl;\nconst parseJsonThen = (stringified, fn) => {\n let parsed;\n try {\n parsed = JSON.parse(stringified);\n } catch (e) {\n console.error(\n \"[zustand devtools middleware] Could not parse the received json\",\n e\n );\n }\n if (parsed !== void 0) fn(parsed);\n};\n\nconst subscribeWithSelectorImpl = (fn) => (set, get, api) => {\n const origSubscribe = api.subscribe;\n api.subscribe = ((selector, optListener, options) => {\n let listener = selector;\n if (optListener) {\n const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;\n let currentSlice = selector(api.getState());\n listener = (state) => {\n const nextSlice = selector(state);\n if (!equalityFn(currentSlice, nextSlice)) {\n const previousSlice = currentSlice;\n optListener(currentSlice = nextSlice, previousSlice);\n }\n };\n if (options == null ? void 0 : options.fireImmediately) {\n optListener(currentSlice, currentSlice);\n }\n }\n return origSubscribe(listener);\n });\n const initialState = fn(set, get, api);\n return initialState;\n};\nconst subscribeWithSelector = subscribeWithSelectorImpl;\n\nfunction combine(initialState, create) {\n return (...args) => Object.assign({}, initialState, create(...args));\n}\n\nfunction createJSONStorage(getStorage, options) {\n let storage;\n try {\n storage = getStorage();\n } catch (e) {\n return;\n }\n const persistStorage = {\n getItem: (name) => {\n var _a;\n const parse = (str2) => {\n if (str2 === null) {\n return null;\n }\n return JSON.parse(str2, options == null ? void 0 : options.reviver);\n };\n const str = (_a = storage.getItem(name)) != null ? _a : null;\n if (str instanceof Promise) {\n return str.then(parse);\n }\n return parse(str);\n },\n setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, options == null ? void 0 : options.replacer)),\n removeItem: (name) => storage.removeItem(name)\n };\n return persistStorage;\n}\nconst toThenable = (fn) => (input) => {\n try {\n const result = fn(input);\n if (result instanceof Promise) {\n return result;\n }\n return {\n then(onFulfilled) {\n return toThenable(onFulfilled)(result);\n },\n catch(_onRejected) {\n return this;\n }\n };\n } catch (e) {\n return {\n then(_onFulfilled) {\n return this;\n },\n catch(onRejected) {\n return toThenable(onRejected)(e);\n }\n };\n }\n};\nconst persistImpl = (config, baseOptions) => (set, get, api) => {\n let options = {\n storage: createJSONStorage(() => window.localStorage),\n partialize: (state) => state,\n version: 0,\n merge: (persistedState, currentState) => ({\n ...currentState,\n ...persistedState\n }),\n ...baseOptions\n };\n let hasHydrated = false;\n let hydrationVersion = 0;\n const hydrationListeners = /* @__PURE__ */ new Set();\n const finishHydrationListeners = /* @__PURE__ */ new Set();\n let storage = options.storage;\n if (!storage) {\n return config(\n (...args) => {\n console.warn(\n `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`\n );\n set(...args);\n },\n get,\n api\n );\n }\n const setItem = () => {\n const state = options.partialize({ ...get() });\n return storage.setItem(options.name, {\n state,\n version: options.version\n });\n };\n const savedSetState = api.setState;\n api.setState = (state, replace) => {\n savedSetState(state, replace);\n return setItem();\n };\n const configResult = config(\n (...args) => {\n set(...args);\n return setItem();\n },\n get,\n api\n );\n api.getInitialState = () => configResult;\n let stateFromStorage;\n const hydrate = () => {\n var _a, _b;\n if (!storage) return;\n const currentVersion = ++hydrationVersion;\n hasHydrated = false;\n hydrationListeners.forEach((cb) => {\n var _a2;\n return cb((_a2 = get()) != null ? _a2 : configResult);\n });\n const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a = get()) != null ? _a : configResult)) || void 0;\n return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {\n if (deserializedStorageValue) {\n if (typeof deserializedStorageValue.version === \"number\" && deserializedStorageValue.version !== options.version) {\n if (options.migrate) {\n const migration = options.migrate(\n deserializedStorageValue.state,\n deserializedStorageValue.version\n );\n if (migration instanceof Promise) {\n return migration.then((result) => [true, result]);\n }\n return [true, migration];\n }\n console.error(\n `State loaded from storage couldn't be migrated since no migrate function was provided`\n );\n } else {\n return [false, deserializedStorageValue.state];\n }\n }\n return [false, void 0];\n }).then((migrationResult) => {\n var _a2;\n if (currentVersion !== hydrationVersion) {\n return;\n }\n const [migrated, migratedState] = migrationResult;\n stateFromStorage = options.merge(\n migratedState,\n (_a2 = get()) != null ? _a2 : configResult\n );\n set(stateFromStorage, true);\n if (migrated) {\n return setItem();\n }\n }).then(() => {\n if (currentVersion !== hydrationVersion) {\n return;\n }\n postRehydrationCallback == null ? void 0 : postRehydrationCallback(get(), void 0);\n stateFromStorage = get();\n hasHydrated = true;\n finishHydrationListeners.forEach((cb) => cb(stateFromStorage));\n }).catch((e) => {\n if (currentVersion !== hydrationVersion) {\n return;\n }\n postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);\n });\n };\n api.persist = {\n setOptions: (newOptions) => {\n options = {\n ...options,\n ...newOptions\n };\n if (newOptions.storage) {\n storage = newOptions.storage;\n }\n },\n clearStorage: () => {\n storage == null ? void 0 : storage.removeItem(options.name);\n },\n getOptions: () => options,\n rehydrate: () => hydrate(),\n hasHydrated: () => hasHydrated,\n onHydrate: (cb) => {\n hydrationListeners.add(cb);\n return () => {\n hydrationListeners.delete(cb);\n };\n },\n onFinishHydration: (cb) => {\n finishHydrationListeners.add(cb);\n return () => {\n finishHydrationListeners.delete(cb);\n };\n }\n };\n if (!options.skipHydration) {\n hydrate();\n }\n return stateFromStorage || configResult;\n};\nconst persist = persistImpl;\n\nfunction ssrSafe(config, isSSR = typeof window === \"undefined\") {\n return (set, get, api) => {\n if (!isSSR) {\n return config(set, get, api);\n }\n const ssrSet = () => {\n throw new Error(\"Cannot set state of Zustand store in SSR\");\n };\n api.setState = ssrSet;\n return config(ssrSet, get, api);\n };\n}\n\nexport { combine, createJSONStorage, devtools, persist, redux, subscribeWithSelector, ssrSafe as unstable_ssrSafe };\n",
|
|
7
|
+
"import { createStore, type StateCreator, type StoreApi } from 'zustand/vanilla';\nimport { combine } from 'zustand/middleware';\n\nexport type IslandStoreState = object;\ntype IslandStoreSnapshot = Record<string, unknown>;\ntype IslandStoreShape<\n\tTState extends IslandStoreState,\n\tTActions extends object\n> = Omit<TState, keyof TActions> & TActions;\nexport type IslandStateSnapshot = Record<string, IslandStoreSnapshot>;\ntype AnyIslandStore = StoreApi<object>;\ntype IslandStoreInstance = {\n\tapplyExternalSnapshot: (snapshot: IslandStoreSnapshot) => void;\n\tstore: AnyIslandStore;\n};\n\nconst ABSOLUTE_ISLAND_STATE = '__ABS_ISLAND_STATE__';\nconst ABSOLUTE_ISLAND_STORES = '__ABS_ISLAND_STORES__';\n\ndeclare global {\n\tvar __ABS_ISLAND_STATE__: IslandStateSnapshot | undefined;\n\tvar __ABS_ISLAND_STORES__:\n\t\t| Map<string, Set<IslandStoreInstance>>\n\t\t| undefined;\n}\n\nconst getIslandStoreSnapshot = () => {\n\tglobalThis.__ABS_ISLAND_STATE__ ??= {};\n\n\treturn globalThis.__ABS_ISLAND_STATE__;\n};\n\nconst getIslandStores = () => {\n\tglobalThis.__ABS_ISLAND_STORES__ ??= new Map();\n\n\treturn globalThis.__ABS_ISLAND_STORES__;\n};\n\nconst isSerializableValue = (value: unknown) =>\n\ttypeof value !== 'function' && value !== undefined;\n\nconst toSerializableState = <T extends object>(state: T) =>\n\tObject.fromEntries(\n\t\tObject.entries(state).filter(([, value]) => isSerializableValue(value))\n\t);\n\nconst applySnapshot = <T extends object>(\n\tstore: StoreApi<T>,\n\tsnapshot: IslandStoreSnapshot | undefined\n) => {\n\tif (!snapshot) {\n\t\treturn;\n\t}\n\n\tstore.setState({\n\t\t...store.getState(),\n\t\t...snapshot\n\t});\n};\n\nconst getPeerStores = (\n\tstoreInstances: Set<IslandStoreInstance>,\n\townerStore: AnyIslandStore\n) => [...storeInstances].filter((peer) => peer.store !== ownerStore);\n\nconst syncIslandSnapshot = <\n\tTState extends IslandStoreState,\n\tTActions extends object\n>(\n\tstoreId: string,\n\tstate: IslandStoreShape<TState, TActions>,\n\tstoreInstances: Set<IslandStoreInstance>,\n\townerStore: AnyIslandStore\n) => {\n\tconst nextSnapshot = toSerializableState(state);\n\tgetIslandStoreSnapshot()[storeId] = nextSnapshot;\n\n\tfor (const peerStore of getPeerStores(storeInstances, ownerStore)) {\n\t\tpeerStore.applyExternalSnapshot(nextSnapshot);\n\t}\n};\n\nexport const createIslandStore = <\n\tTState extends IslandStoreState,\n\tTActions extends object\n>(\n\tstoreId: string,\n\tinitialState: TState,\n\tcreateState: StateCreator<TState, [], [], TActions>\n) => {\n\tconst store = createStore(combine(initialState, createState));\n\tconst stores = getIslandStores();\n\tconst storeInstances =\n\t\tstores.get(storeId) ?? new Set<IslandStoreInstance>();\n\tconst initialSnapshot = getIslandStoreSnapshot()[storeId];\n\tapplySnapshot(store, initialSnapshot);\n\tlet isApplyingExternalSnapshot = false;\n\n\tconst applyExternalSnapshot = (snapshot: IslandStoreSnapshot) => {\n\t\tisApplyingExternalSnapshot = true;\n\t\tapplySnapshot(store, snapshot);\n\t};\n\n\tstoreInstances.add({\n\t\tapplyExternalSnapshot,\n\t\tstore\n\t});\n\tstores.set(storeId, storeInstances);\n\n\tsyncIslandSnapshot(storeId, store.getState(), storeInstances, store);\n\tstore.subscribe((state) => {\n\t\tif (isApplyingExternalSnapshot) {\n\t\t\tisApplyingExternalSnapshot = false;\n\n\t\t\treturn;\n\t\t}\n\n\t\tsyncIslandSnapshot(storeId, state, storeInstances, store);\n\t});\n\n\treturn store;\n};\nexport const getIslandStoreServerSnapshot = <\n\tTState extends IslandStoreState,\n\tTSelected\n>(\n\tstore: StoreApi<TState>,\n\tselector: (state: TState) => TSelected\n) => selector(store.getInitialState());\nconst applySnapshotToStoreInstances = (\n\tstoreId: string,\n\tinstances: Set<IslandStoreInstance>,\n\tsnapshot: IslandStateSnapshot\n) => {\n\tfor (const instance of instances) {\n\t\tinstance.applyExternalSnapshot(snapshot[storeId] ?? {});\n\t}\n};\n\nexport const initializeIslandStores = (state: IslandStateSnapshot) => {\n\tconst currentSnapshot = getIslandStoreSnapshot();\n\tconst nextSnapshot: IslandStateSnapshot = {\n\t\t...state,\n\t\t...currentSnapshot\n\t};\n\n\tglobalThis.__ABS_ISLAND_STATE__ = nextSnapshot;\n\n\tfor (const [storeId, store] of getIslandStores()) {\n\t\tapplySnapshotToStoreInstances(storeId, store, nextSnapshot);\n\t}\n};\nexport const readIslandStore = <TState extends IslandStoreState, TSelected>(\n\tstore: StoreApi<TState>,\n\tselector: (state: TState) => TSelected\n) => selector(store.getState());\nexport const resetIslandStoreForTesting = () => {\n\tdelete globalThis.__ABS_ISLAND_STATE__;\n\tdelete globalThis.__ABS_ISLAND_STORES__;\n};\nexport const subscribeIslandStore = <\n\tTState extends IslandStoreState,\n\tTSelected\n>(\n\tstore: StoreApi<TState>,\n\tselector: (state: TState) => TSelected,\n\tlistener: (value: TSelected) => void\n) => {\n\tlet currentSelection = selector(store.getState());\n\n\treturn store.subscribe((state) => {\n\t\tconst nextSelection = selector(state);\n\t\tif (Object.is(nextSelection, currentSelection)) {\n\t\t\treturn;\n\t\t}\n\n\t\tcurrentSelection = nextSelection;\n\t\tlistener(nextSelection);\n\t});\n};\n\nexport { ABSOLUTE_ISLAND_STATE, ABSOLUTE_ISLAND_STORES };\n"
|
|
8
|
+
],
|
|
9
|
+
"mappings": ";;AAAA,IAAM,kBAAkB,CAAC,gBAAgB;AAAA,EACvC,IAAI;AAAA,EACJ,MAAM,4BAA4B,IAAI;AAAA,EACtC,MAAM,WAAW,CAAC,SAAS,YAAY;AAAA,IACrC,MAAM,YAAY,OAAO,YAAY,aAAa,QAAQ,KAAK,IAAI;AAAA,IACnE,IAAI,CAAC,OAAO,GAAG,WAAW,KAAK,GAAG;AAAA,MAChC,MAAM,gBAAgB;AAAA,MACtB,SAAS,WAAW,OAAO,UAAU,OAAO,cAAc,YAAY,cAAc,QAAQ,YAAY,OAAO,OAAO,CAAC,GAAG,OAAO,SAAS;AAAA,MAC1I,UAAU,QAAQ,CAAC,aAAa,SAAS,OAAO,aAAa,CAAC;AAAA,IAChE;AAAA;AAAA,EAEF,MAAM,WAAW,MAAM;AAAA,EACvB,MAAM,kBAAkB,MAAM;AAAA,EAC9B,MAAM,YAAY,CAAC,aAAa;AAAA,IAC9B,UAAU,IAAI,QAAQ;AAAA,IACtB,OAAO,MAAM,UAAU,OAAO,QAAQ;AAAA;AAAA,EAExC,MAAM,MAAM,EAAE,UAAU,UAAU,iBAAiB,UAAU;AAAA,EAC7D,MAAM,eAAe,QAAQ,YAAY,UAAU,UAAU,GAAG;AAAA,EAChE,OAAO;AAAA;AAET,IAAM,cAAe,CAAC,gBAAgB,cAAc,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GAAG,eAAe,gBAAgB,GAAG;AAAA,MAC/C;AAAA,IACD;AAAA,IAEA,mBAAmB;AAAA,IACnB,SAAS,aAAa;AAAA,GACtB;AAAA;",
|
|
10
|
+
"debugId": "BAB6679FFC15F26F64756E2164756E21",
|
|
11
|
+
"names": []
|
|
12
|
+
}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
isStreamingSlotCollectionActive,
|
|
4
|
+
registerStreamingSlot,
|
|
5
|
+
warnMissingStreamingSlotCollector
|
|
6
|
+
} from "./chunk-qxq2zcty.js";
|
|
7
|
+
import {
|
|
8
|
+
__require
|
|
9
|
+
} from "./chunk-bmgqm774.js";
|
|
10
|
+
// src/vue/components/SuspenseSlot.ts
|
|
11
|
+
import {
|
|
12
|
+
cloneVNode,
|
|
13
|
+
defineComponent,
|
|
14
|
+
h,
|
|
15
|
+
isVNode,
|
|
16
|
+
onMounted,
|
|
17
|
+
onBeforeUnmount,
|
|
18
|
+
ref,
|
|
19
|
+
useSSRContext
|
|
20
|
+
} from "vue";
|
|
21
|
+
var renderVueNodesToHtml = async (nodes) => {
|
|
22
|
+
const { createSSRApp, h: createVNode } = await import("vue");
|
|
23
|
+
const { renderToString } = await import("vue/server-renderer");
|
|
24
|
+
const app = createSSRApp({
|
|
25
|
+
render: () => createVNode("div", undefined, nodes ?? undefined)
|
|
26
|
+
});
|
|
27
|
+
const html = await renderToString(app);
|
|
28
|
+
return html.replace(/^<div>|<\/div>$/g, "");
|
|
29
|
+
};
|
|
30
|
+
var hasFrameworkSlots = (defaultSlot, fallbackSlot, errorSlot, promise) => defaultSlot !== undefined || fallbackSlot !== undefined || errorSlot !== undefined || promise !== undefined;
|
|
31
|
+
var allowMismatchOnSlotNodes = (nodes) => {
|
|
32
|
+
if (Array.isArray(nodes)) {
|
|
33
|
+
return nodes.map((node) => allowMismatchOnSlotNodes(node));
|
|
34
|
+
}
|
|
35
|
+
if (isVNode(nodes)) {
|
|
36
|
+
return cloneVNode(nodes, {
|
|
37
|
+
"data-allow-mismatch": ""
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return nodes;
|
|
41
|
+
};
|
|
42
|
+
var resolveSuspenseValue = async (resolve, promise) => {
|
|
43
|
+
if (resolve !== undefined) {
|
|
44
|
+
return resolve();
|
|
45
|
+
}
|
|
46
|
+
if (promise !== undefined) {
|
|
47
|
+
return promise;
|
|
48
|
+
}
|
|
49
|
+
return;
|
|
50
|
+
};
|
|
51
|
+
var isObjectRecord = (value) => Boolean(value) && typeof value === "object";
|
|
52
|
+
var isVueSuspensePayload = (payload) => {
|
|
53
|
+
if (!isObjectRecord(payload)) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return payload.kind === "vue-suspense";
|
|
57
|
+
};
|
|
58
|
+
var hasEventDetailId = (event, id) => {
|
|
59
|
+
if (!(event instanceof CustomEvent)) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
const { detail } = event;
|
|
63
|
+
if (!detail || typeof detail !== "object") {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
return detail.id === id;
|
|
67
|
+
};
|
|
68
|
+
var toLegacySuspenseSlotRegistration = (props) => {
|
|
69
|
+
if (!props.resolve) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
errorHtml: props.errorHtml,
|
|
74
|
+
fallbackHtml: props.fallbackHtml,
|
|
75
|
+
id: props.id,
|
|
76
|
+
timeoutMs: props.timeoutMs,
|
|
77
|
+
resolve: async () => {
|
|
78
|
+
const resolved = await props.resolve?.();
|
|
79
|
+
return typeof resolved === "string" ? resolved : "";
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
var registerLegacySuspenseSlot = (props) => {
|
|
84
|
+
registerStreamingSlot({
|
|
85
|
+
errorHtml: props.errorHtml,
|
|
86
|
+
fallbackHtml: props.fallbackHtml,
|
|
87
|
+
id: props.id,
|
|
88
|
+
resolve: props.resolve,
|
|
89
|
+
timeoutMs: props.timeoutMs
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
var resolveStreamingSuspenseSlot = async (props, slots) => {
|
|
93
|
+
try {
|
|
94
|
+
const value = await resolveSuspenseValue(props.resolve, props.promise);
|
|
95
|
+
const nodes = allowMismatchOnSlotNodes(slots.default?.({ value }) ?? []);
|
|
96
|
+
const html = await renderVueNodesToHtml(nodes);
|
|
97
|
+
return {
|
|
98
|
+
html,
|
|
99
|
+
kind: "vue-suspense",
|
|
100
|
+
value
|
|
101
|
+
};
|
|
102
|
+
} catch (error) {
|
|
103
|
+
const errorNodes = slots.error?.({ error });
|
|
104
|
+
if (errorNodes !== undefined)
|
|
105
|
+
return renderVueNodesToHtml(allowMismatchOnSlotNodes(errorNodes));
|
|
106
|
+
if (typeof props.errorHtml === "string")
|
|
107
|
+
return props.errorHtml;
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
var registerSuspenseSlotForSsr = (props, slots, usesFrameworkSlots) => {
|
|
112
|
+
if (!isStreamingSlotCollectionActive()) {
|
|
113
|
+
warnMissingStreamingSlotCollector("SuspenseSlot");
|
|
114
|
+
}
|
|
115
|
+
const legacyRegistration = toLegacySuspenseSlotRegistration(props);
|
|
116
|
+
if (!usesFrameworkSlots && legacyRegistration) {
|
|
117
|
+
registerLegacySuspenseSlot(legacyRegistration);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
registerStreamingSlot({
|
|
121
|
+
id: props.id,
|
|
122
|
+
timeoutMs: props.timeoutMs,
|
|
123
|
+
resolve: () => resolveStreamingSuspenseSlot(props, slots)
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
var applySuspensePayload = (payload, state) => {
|
|
127
|
+
state.hasError.value = payload.state === "error";
|
|
128
|
+
state.resolvedValue.value = payload.value;
|
|
129
|
+
state.isResolved.value = payload.state !== "error";
|
|
130
|
+
};
|
|
131
|
+
var SuspenseSlot = defineComponent({
|
|
132
|
+
name: "AbsoluteSuspenseSlot",
|
|
133
|
+
props: {
|
|
134
|
+
className: { default: undefined, type: String },
|
|
135
|
+
errorHtml: { default: undefined, type: String },
|
|
136
|
+
fallbackHtml: { default: "", type: String },
|
|
137
|
+
id: { required: true, type: String },
|
|
138
|
+
promise: {
|
|
139
|
+
default: undefined,
|
|
140
|
+
type: Object
|
|
141
|
+
},
|
|
142
|
+
resolve: {
|
|
143
|
+
default: undefined,
|
|
144
|
+
type: Function
|
|
145
|
+
},
|
|
146
|
+
timeoutMs: { default: undefined, type: Number }
|
|
147
|
+
},
|
|
148
|
+
setup(props, { slots }) {
|
|
149
|
+
const readPatchedDomState = () => {
|
|
150
|
+
if (typeof document === "undefined")
|
|
151
|
+
return false;
|
|
152
|
+
const slotNode = document.getElementById(props.id);
|
|
153
|
+
if (!slotNode)
|
|
154
|
+
return false;
|
|
155
|
+
return slotNode.getAttribute("data-absolute-slot-state") === "resolved";
|
|
156
|
+
};
|
|
157
|
+
const isResolved = ref(false);
|
|
158
|
+
const resolvedValue = ref(undefined);
|
|
159
|
+
const hasError = ref(false);
|
|
160
|
+
const hasPatchedDom = ref(readPatchedDomState());
|
|
161
|
+
const usesFrameworkSlots = hasFrameworkSlots(slots.default, slots.fallback, slots.error, props.promise);
|
|
162
|
+
const isSsrRender = useSSRContext() !== undefined;
|
|
163
|
+
if (isSsrRender) {
|
|
164
|
+
registerSuspenseSlotForSsr(props, slots, usesFrameworkSlots);
|
|
165
|
+
}
|
|
166
|
+
if (typeof window !== "undefined" && usesFrameworkSlots) {
|
|
167
|
+
const consumers = window.__ABS_SLOT_CONSUMERS__ = window.__ABS_SLOT_CONSUMERS__ ?? {};
|
|
168
|
+
let runtimeReady = false;
|
|
169
|
+
consumers[props.id] = (payload) => {
|
|
170
|
+
if (!runtimeReady)
|
|
171
|
+
return false;
|
|
172
|
+
if (!isVueSuspensePayload(payload)) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
applySuspensePayload(payload, {
|
|
176
|
+
hasError,
|
|
177
|
+
isResolved,
|
|
178
|
+
resolvedValue
|
|
179
|
+
});
|
|
180
|
+
return true;
|
|
181
|
+
};
|
|
182
|
+
const handlePatchedDom = (event) => {
|
|
183
|
+
if (hasEventDetailId(event, props.id)) {
|
|
184
|
+
hasPatchedDom.value = true;
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
onMounted(() => {
|
|
188
|
+
hasPatchedDom.value = readPatchedDomState();
|
|
189
|
+
window.addEventListener("absolutejs:slot-patch", handlePatchedDom);
|
|
190
|
+
runtimeReady = true;
|
|
191
|
+
window.__ABS_SLOT_FLUSH__?.();
|
|
192
|
+
});
|
|
193
|
+
onBeforeUnmount(() => {
|
|
194
|
+
window.removeEventListener("absolutejs:slot-patch", handlePatchedDom);
|
|
195
|
+
delete window.__ABS_SLOT_CONSUMERS__?.[props.id];
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
const resolveSlotChildren = () => {
|
|
199
|
+
if (hasPatchedDom.value) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
if (hasError.value) {
|
|
203
|
+
return allowMismatchOnSlotNodes(slots.error?.({ error: undefined }) ?? slots.fallback?.() ?? undefined) ?? undefined;
|
|
204
|
+
}
|
|
205
|
+
if (isResolved.value) {
|
|
206
|
+
return allowMismatchOnSlotNodes(slots.default?.({ value: resolvedValue.value }) ?? undefined) ?? undefined;
|
|
207
|
+
}
|
|
208
|
+
return allowMismatchOnSlotNodes(slots.fallback?.() ?? undefined);
|
|
209
|
+
};
|
|
210
|
+
return () => {
|
|
211
|
+
if (!usesFrameworkSlots) {
|
|
212
|
+
return h("div", {
|
|
213
|
+
class: props.className,
|
|
214
|
+
"data-absolute-slot": "true",
|
|
215
|
+
id: props.id,
|
|
216
|
+
innerHTML: props.fallbackHtml
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
return h("div", {
|
|
220
|
+
class: props.className,
|
|
221
|
+
"data-absolute-slot": "true",
|
|
222
|
+
"data-allow-mismatch": "",
|
|
223
|
+
id: props.id
|
|
224
|
+
}, resolveSlotChildren() ?? undefined);
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
// src/vue/components/StreamSlot.ts
|
|
229
|
+
import { defineComponent as defineComponent2, h as h2, useSSRContext as useSSRContext2 } from "vue";
|
|
230
|
+
var StreamSlot = defineComponent2({
|
|
231
|
+
name: "AbsoluteStreamSlot",
|
|
232
|
+
props: {
|
|
233
|
+
className: { default: undefined, type: String },
|
|
234
|
+
errorHtml: { default: undefined, type: String },
|
|
235
|
+
fallbackHtml: { default: "", type: String },
|
|
236
|
+
id: { required: true, type: String },
|
|
237
|
+
resolve: {
|
|
238
|
+
required: true,
|
|
239
|
+
type: Function
|
|
240
|
+
},
|
|
241
|
+
timeoutMs: { default: undefined, type: Number }
|
|
242
|
+
},
|
|
243
|
+
setup(props) {
|
|
244
|
+
if (useSSRContext2() !== undefined) {
|
|
245
|
+
registerStreamSlotForSsr(props);
|
|
246
|
+
}
|
|
247
|
+
return () => h2("div", {
|
|
248
|
+
class: props.className,
|
|
249
|
+
"data-absolute-slot": "true",
|
|
250
|
+
id: props.id,
|
|
251
|
+
innerHTML: props.fallbackHtml
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
var registerStreamSlotForSsr = (props) => {
|
|
256
|
+
if (!isStreamingSlotCollectionActive()) {
|
|
257
|
+
warnMissingStreamingSlotCollector("StreamSlot");
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
registerStreamingSlot({
|
|
261
|
+
errorHtml: props.errorHtml,
|
|
262
|
+
fallbackHtml: props.fallbackHtml,
|
|
263
|
+
id: props.id,
|
|
264
|
+
resolve: props.resolve,
|
|
265
|
+
timeoutMs: props.timeoutMs
|
|
266
|
+
});
|
|
267
|
+
};
|
|
268
|
+
export { SuspenseSlot, StreamSlot };
|
|
269
|
+
|
|
270
|
+
//# debugId=20D4051859B2A33064756E2164756E21
|
|
271
|
+
//# sourceMappingURL=chunk-g15qj669.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/vue/components/SuspenseSlot.ts", "../src/vue/components/StreamSlot.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import {\n\tcloneVNode,\n\tdefineComponent,\n\th,\n\tisVNode,\n\tonMounted,\n\tonBeforeUnmount,\n\tref,\n\tuseSSRContext,\n\ttype Slot,\n\ttype VNodeChild\n} from 'vue';\nimport {\n\tisStreamingSlotCollectionActive,\n\tregisterStreamingSlot,\n\twarnMissingStreamingSlotCollector\n} from '../../core/streamingSlotRegistrar';\n\nconst renderVueNodesToHtml = async (nodes: VNodeChild) => {\n\tconst { createSSRApp, h: createVNode } = await import('vue');\n\tconst { renderToString } = await import('vue/server-renderer');\n\n\tconst app = createSSRApp({\n\t\trender: () => createVNode('div', undefined, nodes ?? undefined)\n\t});\n\tconst html = await renderToString(app);\n\n\treturn html.replace(/^<div>|<\\/div>$/g, '');\n};\n\nconst hasFrameworkSlots = (\n\tdefaultSlot: Slot | undefined,\n\tfallbackSlot: Slot | undefined,\n\terrorSlot: Slot | undefined,\n\tpromise: Promise<unknown> | undefined\n) =>\n\tdefaultSlot !== undefined ||\n\tfallbackSlot !== undefined ||\n\terrorSlot !== undefined ||\n\tpromise !== undefined;\n\nconst allowMismatchOnSlotNodes: (nodes: VNodeChild) => VNodeChild = (nodes) => {\n\tif (Array.isArray(nodes)) {\n\t\treturn nodes.map((node) => allowMismatchOnSlotNodes(node));\n\t}\n\tif (isVNode(nodes)) {\n\t\treturn cloneVNode(nodes, {\n\t\t\t'data-allow-mismatch': ''\n\t\t});\n\t}\n\n\treturn nodes;\n};\n\nconst resolveSuspenseValue = async (\n\tresolve: (() => Promise<unknown> | unknown) | undefined,\n\tpromise: Promise<unknown> | undefined\n) => {\n\tif (resolve !== undefined) {\n\t\treturn resolve();\n\t}\n\n\tif (promise !== undefined) {\n\t\treturn promise;\n\t}\n\n\treturn undefined;\n};\n\ntype LegacySuspenseSlotRegistration = {\n\terrorHtml?: string;\n\tfallbackHtml: string;\n\tid: string;\n\tresolve: () => Promise<string> | string;\n\ttimeoutMs?: number;\n};\n\ntype SuspenseSlotProps = {\n\tclassName?: string;\n\terrorHtml?: string;\n\tfallbackHtml: string;\n\tid: string;\n\tpromise?: Promise<unknown>;\n\tresolve?: () => Promise<unknown> | unknown;\n\ttimeoutMs?: number;\n};\n\ntype VueSuspensePayload = {\n\tkind: 'vue-suspense';\n\tstate?: unknown;\n\tvalue?: unknown;\n};\n\nconst isObjectRecord = (value: unknown): value is Record<string, unknown> =>\n\tBoolean(value) && typeof value === 'object';\n\nconst isVueSuspensePayload = (\n\tpayload: unknown\n): payload is VueSuspensePayload => {\n\tif (!isObjectRecord(payload)) {\n\t\treturn false;\n\t}\n\n\treturn payload.kind === 'vue-suspense';\n};\n\nconst hasEventDetailId = (event: Event, id: string) => {\n\tif (!(event instanceof CustomEvent)) {\n\t\treturn false;\n\t}\n\n\tconst { detail } = event;\n\tif (!detail || typeof detail !== 'object') {\n\t\treturn false;\n\t}\n\n\treturn detail.id === id;\n};\n\nconst toLegacySuspenseSlotRegistration = (\n\tprops: SuspenseSlotProps\n): LegacySuspenseSlotRegistration | null => {\n\tif (!props.resolve) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\terrorHtml: props.errorHtml,\n\t\tfallbackHtml: props.fallbackHtml,\n\t\tid: props.id,\n\t\ttimeoutMs: props.timeoutMs,\n\t\tresolve: async () => {\n\t\t\tconst resolved = await props.resolve?.();\n\n\t\t\treturn typeof resolved === 'string' ? resolved : '';\n\t\t}\n\t};\n};\n\nconst registerLegacySuspenseSlot = (props: LegacySuspenseSlotRegistration) => {\n\tregisterStreamingSlot({\n\t\terrorHtml: props.errorHtml,\n\t\tfallbackHtml: props.fallbackHtml,\n\t\tid: props.id,\n\t\tresolve: props.resolve,\n\t\ttimeoutMs: props.timeoutMs\n\t});\n};\n\nconst resolveStreamingSuspenseSlot = async (\n\tprops: SuspenseSlotProps,\n\tslots: Record<string, Slot | undefined>\n) => {\n\ttry {\n\t\tconst value = await resolveSuspenseValue(props.resolve, props.promise);\n\t\tconst nodes = allowMismatchOnSlotNodes(\n\t\t\tslots.default?.({ value }) ?? []\n\t\t);\n\t\tconst html = await renderVueNodesToHtml(nodes);\n\n\t\treturn {\n\t\t\thtml,\n\t\t\tkind: 'vue-suspense',\n\t\t\tvalue\n\t\t};\n\t} catch (error) {\n\t\tconst errorNodes = slots.error?.({ error });\n\t\tif (errorNodes !== undefined)\n\t\t\treturn renderVueNodesToHtml(allowMismatchOnSlotNodes(errorNodes));\n\t\tif (typeof props.errorHtml === 'string') return props.errorHtml;\n\n\t\tthrow error;\n\t}\n};\n\nconst registerSuspenseSlotForSsr = (\n\tprops: SuspenseSlotProps,\n\tslots: Record<string, Slot | undefined>,\n\tusesFrameworkSlots: boolean\n) => {\n\tif (!isStreamingSlotCollectionActive()) {\n\t\twarnMissingStreamingSlotCollector('SuspenseSlot');\n\t}\n\tconst legacyRegistration = toLegacySuspenseSlotRegistration(props);\n\tif (!usesFrameworkSlots && legacyRegistration) {\n\t\tregisterLegacySuspenseSlot(legacyRegistration);\n\n\t\treturn;\n\t}\n\n\tregisterStreamingSlot({\n\t\tid: props.id,\n\t\ttimeoutMs: props.timeoutMs,\n\t\tresolve: () => resolveStreamingSuspenseSlot(props, slots)\n\t});\n};\n\nconst applySuspensePayload = (\n\tpayload: VueSuspensePayload,\n\tstate: {\n\t\thasError: { value: boolean };\n\t\tisResolved: { value: boolean };\n\t\tresolvedValue: { value: unknown };\n\t}\n) => {\n\tstate.hasError.value = payload.state === 'error';\n\tstate.resolvedValue.value = payload.value;\n\tstate.isResolved.value = payload.state !== 'error';\n};\n\nexport const SuspenseSlot = defineComponent({\n\tname: 'AbsoluteSuspenseSlot',\n\tprops: {\n\t\tclassName: { default: undefined, type: String },\n\t\terrorHtml: { default: undefined, type: String },\n\t\tfallbackHtml: { default: '', type: String },\n\t\tid: { required: true, type: String },\n\t\tpromise: {\n\t\t\tdefault: undefined,\n\t\t\ttype: Object\n\t\t},\n\t\tresolve: {\n\t\t\tdefault: undefined,\n\t\t\ttype: Function\n\t\t},\n\t\ttimeoutMs: { default: undefined, type: Number }\n\t},\n\tsetup(props: SuspenseSlotProps, { slots }) {\n\t\tconst readPatchedDomState = () => {\n\t\t\tif (typeof document === 'undefined') return false;\n\t\t\tconst slotNode = document.getElementById(props.id);\n\t\t\tif (!slotNode) return false;\n\n\t\t\treturn (\n\t\t\t\tslotNode.getAttribute('data-absolute-slot-state') === 'resolved'\n\t\t\t);\n\t\t};\n\t\tconst isResolved = ref(false);\n\t\tconst resolvedValue = ref<unknown>(undefined);\n\t\tconst hasError = ref(false);\n\t\tconst hasPatchedDom = ref(readPatchedDomState());\n\t\tconst usesFrameworkSlots = hasFrameworkSlots(\n\t\t\tslots.default,\n\t\t\tslots.fallback,\n\t\t\tslots.error,\n\t\t\tprops.promise\n\t\t);\n\t\tconst isSsrRender = useSSRContext() !== undefined;\n\n\t\tif (isSsrRender) {\n\t\t\tregisterSuspenseSlotForSsr(props, slots, usesFrameworkSlots);\n\t\t}\n\n\t\tif (typeof window !== 'undefined' && usesFrameworkSlots) {\n\t\t\tconst consumers = (window.__ABS_SLOT_CONSUMERS__ =\n\t\t\t\twindow.__ABS_SLOT_CONSUMERS__ ?? {});\n\t\t\tlet runtimeReady = false;\n\t\t\tconsumers[props.id] = (payload) => {\n\t\t\t\tif (!runtimeReady) return false;\n\t\t\t\tif (!isVueSuspensePayload(payload)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tapplySuspensePayload(payload, {\n\t\t\t\t\thasError,\n\t\t\t\t\tisResolved,\n\t\t\t\t\tresolvedValue\n\t\t\t\t});\n\n\t\t\t\treturn true;\n\t\t\t};\n\t\t\tconst handlePatchedDom = (event: Event) => {\n\t\t\t\tif (hasEventDetailId(event, props.id)) {\n\t\t\t\t\thasPatchedDom.value = true;\n\t\t\t\t}\n\t\t\t};\n\t\t\tonMounted(() => {\n\t\t\t\thasPatchedDom.value = readPatchedDomState();\n\t\t\t\twindow.addEventListener(\n\t\t\t\t\t'absolutejs:slot-patch',\n\t\t\t\t\thandlePatchedDom\n\t\t\t\t);\n\t\t\t\truntimeReady = true;\n\t\t\t\twindow.__ABS_SLOT_FLUSH__?.();\n\t\t\t});\n\t\t\tonBeforeUnmount(() => {\n\t\t\t\twindow.removeEventListener(\n\t\t\t\t\t'absolutejs:slot-patch',\n\t\t\t\t\thandlePatchedDom\n\t\t\t\t);\n\t\t\t\tdelete window.__ABS_SLOT_CONSUMERS__?.[props.id];\n\t\t\t});\n\t\t}\n\n\t\tconst resolveSlotChildren = () => {\n\t\t\tif (hasPatchedDom.value) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tif (hasError.value) {\n\t\t\t\treturn (\n\t\t\t\t\tallowMismatchOnSlotNodes(\n\t\t\t\t\t\tslots.error?.({ error: undefined }) ??\n\t\t\t\t\t\t\tslots.fallback?.() ??\n\t\t\t\t\t\t\tundefined\n\t\t\t\t\t) ?? undefined\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (isResolved.value) {\n\t\t\t\treturn (\n\t\t\t\t\tallowMismatchOnSlotNodes(\n\t\t\t\t\t\tslots.default?.({ value: resolvedValue.value }) ??\n\t\t\t\t\t\t\tundefined\n\t\t\t\t\t) ?? undefined\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn allowMismatchOnSlotNodes(slots.fallback?.() ?? undefined);\n\t\t};\n\n\t\treturn () => {\n\t\t\tif (!usesFrameworkSlots) {\n\t\t\t\treturn h('div', {\n\t\t\t\t\tclass: props.className,\n\t\t\t\t\t'data-absolute-slot': 'true',\n\t\t\t\t\tid: props.id,\n\t\t\t\t\tinnerHTML: props.fallbackHtml\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn h(\n\t\t\t\t'div',\n\t\t\t\t{\n\t\t\t\t\tclass: props.className,\n\t\t\t\t\t'data-absolute-slot': 'true',\n\t\t\t\t\t'data-allow-mismatch': '',\n\t\t\t\t\tid: props.id\n\t\t\t\t},\n\t\t\t\tresolveSlotChildren() ?? undefined\n\t\t\t);\n\t\t};\n\t}\n});\n",
|
|
6
|
+
"import { defineComponent, h, useSSRContext } from 'vue';\nimport {\n\tisStreamingSlotCollectionActive,\n\tregisterStreamingSlot,\n\twarnMissingStreamingSlotCollector\n} from '../../core/streamingSlotRegistrar';\n\ntype StreamSlotProps = {\n\tclassName?: string;\n\terrorHtml?: string;\n\tfallbackHtml: string;\n\tid: string;\n\tresolve: () => Promise<string> | string;\n\ttimeoutMs?: number;\n};\n\nexport const StreamSlot = defineComponent({\n\tname: 'AbsoluteStreamSlot',\n\tprops: {\n\t\tclassName: { default: undefined, type: String },\n\t\terrorHtml: { default: undefined, type: String },\n\t\tfallbackHtml: { default: '', type: String },\n\t\tid: { required: true, type: String },\n\t\tresolve: {\n\t\t\trequired: true,\n\t\t\ttype: Function\n\t\t},\n\t\ttimeoutMs: { default: undefined, type: Number }\n\t},\n\tsetup(props: StreamSlotProps) {\n\t\tif (useSSRContext() !== undefined) {\n\t\t\tregisterStreamSlotForSsr(props);\n\t\t}\n\n\t\treturn () =>\n\t\t\th('div', {\n\t\t\t\tclass: props.className,\n\t\t\t\t'data-absolute-slot': 'true',\n\t\t\t\tid: props.id,\n\t\t\t\tinnerHTML: props.fallbackHtml\n\t\t\t});\n\t}\n});\n\nconst registerStreamSlotForSsr = (props: StreamSlotProps) => {\n\tif (!isStreamingSlotCollectionActive()) {\n\t\twarnMissingStreamingSlotCollector('StreamSlot');\n\n\t\treturn;\n\t}\n\n\tregisterStreamingSlot({\n\t\terrorHtml: props.errorHtml,\n\t\tfallbackHtml: props.fallbackHtml,\n\t\tid: props.id,\n\t\tresolve: props.resolve,\n\t\ttimeoutMs: props.timeoutMs\n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A,EACA,KAAK,CAAC,OAAwB;AAAA,IAC7B,IAAI,eAAc,MAAM,WAAW;AAAA,MAClC,yBAAyB,KAAK;AAAA,IAC/B;AAAA,IAEA,OAAO,MACN,GAAE,OAAO;AAAA,MACR,OAAO,MAAM;AAAA,MACb,sBAAsB;AAAA,MACtB,IAAI,MAAM;AAAA,MACV,WAAW,MAAM;AAAA,IAClB,CAAC;AAAA;AAEJ,CAAC;AAED,IAAM,2BAA2B,CAAC,UAA2B;AAAA,EAC5D,IAAI,CAAC,gCAAgC,GAAG;AAAA,IACvC,kCAAkC,YAAY;AAAA,IAE9C;AAAA,EACD;AAAA,EAEA,sBAAsB;AAAA,IACrB,WAAW,MAAM;AAAA,IACjB,cAAc,MAAM;AAAA,IACpB,IAAI,MAAM;AAAA,IACV,SAAS,MAAM;AAAA,IACf,WAAW,MAAM;AAAA,EAClB,CAAC;AAAA;",
|
|
9
|
+
"debugId": "20D4051859B2A33064756E2164756E21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
devBuild
|
|
4
|
+
} from "./chunk-hep68ja7.js";
|
|
5
|
+
import"./chunk-vkrpm7kc.js";
|
|
6
|
+
import"./chunk-cg95827x.js";
|
|
7
|
+
import"./chunk-hcsmxw1v.js";
|
|
8
|
+
import"./chunk-3g91wb4f.js";
|
|
9
|
+
import"./chunk-4d39r92n.js";
|
|
10
|
+
import"./chunk-93sqk7be.js";
|
|
11
|
+
import"./chunk-ey5hs6x6.js";
|
|
12
|
+
import"./chunk-7kjj42xm.js";
|
|
13
|
+
import"./chunk-bxfghpma.js";
|
|
14
|
+
import"./chunk-cdxd7sy2.js";
|
|
15
|
+
import"./chunk-jn91vzkh.js";
|
|
16
|
+
import"./chunk-swrnzs4c.js";
|
|
17
|
+
import"./chunk-b3gbnrwe.js";
|
|
18
|
+
import"./chunk-1e9vsfyh.js";
|
|
19
|
+
import"./chunk-hyjs4bqs.js";
|
|
20
|
+
import"./chunk-t81a331y.js";
|
|
21
|
+
import"./chunk-85n68sy6.js";
|
|
22
|
+
import"./chunk-vvz7dcvq.js";
|
|
23
|
+
import"./chunk-kndkjsya.js";
|
|
24
|
+
import"./chunk-h5bbfn3n.js";
|
|
25
|
+
import"./chunk-11zpfqz6.js";
|
|
26
|
+
import"./chunk-a9mvyp04.js";
|
|
27
|
+
import"./chunk-kk8w9rh5.js";
|
|
28
|
+
import"./chunk-d9c0am65.js";
|
|
29
|
+
import"./chunk-cbkrwmvh.js";
|
|
30
|
+
import"./chunk-5003emhv.js";
|
|
31
|
+
import"./chunk-sd39p726.js";
|
|
32
|
+
import"./chunk-gf0ygptk.js";
|
|
33
|
+
import"./chunk-851whwc7.js";
|
|
34
|
+
import"./chunk-s6defjk2.js";
|
|
35
|
+
import"./chunk-p5504p14.js";
|
|
36
|
+
import"./chunk-4m75s5xf.js";
|
|
37
|
+
import"./chunk-dr9yqsdb.js";
|
|
38
|
+
import"./chunk-7fw6x3js.js";
|
|
39
|
+
import"./chunk-mbazhahf.js";
|
|
40
|
+
import"./chunk-6fkgm9s5.js";
|
|
41
|
+
import"./chunk-qh75agse.js";
|
|
42
|
+
import"./chunk-2f21eenc.js";
|
|
43
|
+
import"./chunk-8kcfffry.js";
|
|
44
|
+
import"./chunk-3yjzpcne.js";
|
|
45
|
+
import"./chunk-bmgqm774.js";
|
|
46
|
+
export {
|
|
47
|
+
devBuild
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
//# debugId=168CA101CFD7E28A64756E2164756E21
|
|
51
|
+
//# sourceMappingURL=chunk-g3j22qf6.js.map
|