@solidjs/web 2.0.0-rc.15 → 2.0.0-rc.16
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/README.md +1 -1
- package/dist/server.dev.js +358 -479
- package/dist/server.js +343 -387
- package/dist/server.observe.js +343 -387
- package/dist/web.dev.js +57 -54
- package/dist/web.js +47 -49
- package/dist/web.observe.js +57 -54
- package/frames/dist/client.dev.js +610 -621
- package/frames/dist/client.js +540 -566
- package/frames/dist/client.observe.js +571 -573
- package/frames/dist/regions.js +43 -2
- package/frames/dist/server.dev.js +514 -423
- package/frames/dist/server.js +514 -370
- package/frames/dist/server.observe.js +514 -370
- package/frames/dist/wire.js +371 -6
- package/package.json +11 -11
- package/serialization/dist/decode.js +9 -7
- package/serialization/dist/serialization.js +9 -7
- package/serialization/types/serializer-decode.d.ts +2 -2
- package/server-functions/dist/client.dev.js +3 -1
- package/server-functions/dist/client.js +1 -1
- package/server-functions/dist/client.observe.js +3 -1
- package/server-functions/dist/rich-args.js +33 -1
- package/server-functions/dist/server.dev.js +127 -18
- package/server-functions/dist/server.js +127 -18
- package/server-functions/dist/server.observe.js +127 -18
- package/skills/server-components/SKILL.md +74 -185
- package/types/client.d.ts +15 -5
- package/types/frames/assets-tier.d.ts +2 -2
- package/types/frames/client.d.ts +8 -3
- package/types/frames/frame-client.d.ts +121 -157
- package/types/frames/frame-morph.d.ts +28 -0
- package/types/frames/frame-sink.d.ts +13 -9
- package/types/frames/frame-transport.d.ts +30 -1
- package/types/frames/regions-tier.d.ts +15 -0
- package/types/frames/serializer-decode.d.ts +2 -2
- package/types/frames/server.d.ts +0 -52
- package/types/frames/wire-tier.d.ts +54 -1
- package/types/index.d.ts +2 -2
- package/types/jsx.d.ts +11 -5
- package/types/observe.d.ts +14 -7
- package/types/render.d.ts +3 -1
- package/types/response.d.ts +5 -4
- package/types/serializer-decode.d.ts +2 -2
- package/types/server-functions/argument-codec.d.ts +21 -0
- package/types/server-functions/client.d.ts +14 -5
- package/types/server-functions/server.d.ts +6 -2
- package/types/server-functions/shared.d.ts +19 -0
- package/types/server-observe.d.ts +3 -2
- package/types/server.d.ts +57 -76
- package/frames/dist/bind.dev.js +0 -326
- package/frames/dist/bind.js +0 -295
- package/types/frames/bind-tier.d.ts +0 -60
package/dist/server.observe.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRenderEffect, createMemo, OBSERVE, getOwner, createRoot, $PROXY, onCleanup, runWithOwner, createComponent, omit, getNextChildId } from 'solid-js';
|
|
2
2
|
export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, dynamicComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
|
|
3
|
-
import { sharedConfig, ssrSanitizeError, reportServerError, viewOf, sourceOwners, ssrHandleError, inServerComponentScope, creationStamp, dynamicCore, getProjectionTrace, shareAsyncIterable } from 'solid-js/internal';
|
|
4
|
-
export { ssrScope as scope
|
|
3
|
+
import { sharedConfig, ssrSanitizeError, beginEdgesRender, reportServerError, viewOf, sourceOwners, ssrHandleError, inServerComponentScope, creationStamp, dynamicCore, getProjectionTrace, shareAsyncIterable } from 'solid-js/internal';
|
|
4
|
+
export { ssrScope as scope } from 'solid-js/internal';
|
|
5
5
|
import { createStream, Serializer, getCrossReferenceHeader, Feature } from 'seroval';
|
|
6
6
|
import { AbortSignalPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FormDataPlugin, HeadersPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLSearchParamsPlugin, URLPlugin } from 'seroval-plugins/web';
|
|
7
7
|
|
|
@@ -117,11 +117,9 @@ function parseTraceparent(value) {
|
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
119
|
function randomHex(bytes) {
|
|
120
|
-
const buffer = new Uint8Array(bytes);
|
|
121
|
-
crypto.getRandomValues(buffer);
|
|
122
120
|
let out = "";
|
|
123
|
-
for (let i = 0; i <
|
|
124
|
-
return out;
|
|
121
|
+
for (let i = 0; i < bytes; i += 4) out += (Math.random() * 0x100000000 >>> 0).toString(16).padStart(8, "0");
|
|
122
|
+
return out.length === bytes * 2 ? out : out.slice(0, bytes * 2);
|
|
125
123
|
}
|
|
126
124
|
function randomTraceId() {
|
|
127
125
|
let id = randomHex(16);
|
|
@@ -687,7 +685,12 @@ function respond(value, init = {}) {
|
|
|
687
685
|
}), value);
|
|
688
686
|
}
|
|
689
687
|
headers.set("Content-Type", "application/json");
|
|
690
|
-
return new ResponseEnvelope(new Response(
|
|
688
|
+
return new ResponseEnvelope(new Response(new ReadableStream({
|
|
689
|
+
pull(controller) {
|
|
690
|
+
controller.enqueue(new TextEncoder().encode(JSON.stringify(value)));
|
|
691
|
+
controller.close();
|
|
692
|
+
}
|
|
693
|
+
}), {
|
|
691
694
|
...responseInit,
|
|
692
695
|
headers
|
|
693
696
|
}), value);
|
|
@@ -1469,12 +1472,6 @@ function destinationNonce(nonce, destination) {
|
|
|
1469
1472
|
const value = typeof nonce === "string" ? nonce : nonce[destination];
|
|
1470
1473
|
return typeof value === "string" && value ? value : undefined;
|
|
1471
1474
|
}
|
|
1472
|
-
function scriptNonce(nonce) {
|
|
1473
|
-
return destinationNonce(nonce, "script");
|
|
1474
|
-
}
|
|
1475
|
-
function styleNonce(nonce) {
|
|
1476
|
-
return destinationNonce(nonce, "style");
|
|
1477
|
-
}
|
|
1478
1475
|
function hasNonceProp(props) {
|
|
1479
1476
|
for (const name in props) if (name.length === 5 && asciiLowerCase(name) === "nonce" && props[name] != null) return true;
|
|
1480
1477
|
return false;
|
|
@@ -1603,6 +1600,8 @@ function renderToString(code, options = {}) {
|
|
|
1603
1600
|
onHead
|
|
1604
1601
|
} = options;
|
|
1605
1602
|
const nonce = normalizeNonce(options.nonce);
|
|
1603
|
+
const requestEvent = peekRequestEvent();
|
|
1604
|
+
const errorScope = requestEvent || {};
|
|
1606
1605
|
let scripts = "";
|
|
1607
1606
|
const serializer = createHydrationSerializer({
|
|
1608
1607
|
scopeId: renderId,
|
|
@@ -1625,6 +1624,7 @@ function renderToString(code, options = {}) {
|
|
|
1625
1624
|
resolve: resolveSSRNode,
|
|
1626
1625
|
ssr: ssr,
|
|
1627
1626
|
errorPolicy: options.onError,
|
|
1627
|
+
_errorScope: errorScope,
|
|
1628
1628
|
registerHeadTags(tags) {
|
|
1629
1629
|
registerHeadTags(headRegistry, sharedConfig.context, tracking, null, nonce, tags);
|
|
1630
1630
|
},
|
|
@@ -1659,7 +1659,6 @@ function renderToString(code, options = {}) {
|
|
|
1659
1659
|
registerEntryAssets(manifest);
|
|
1660
1660
|
const context = sharedConfig.context;
|
|
1661
1661
|
context.writer = createHydrationWriter(context, () => !closed);
|
|
1662
|
-
const requestEvent = peekRequestEvent();
|
|
1663
1662
|
if (requestEvent) setRequestErrorHook(requestEvent, options.onError);
|
|
1664
1663
|
context.trace = requestEvent ? traceForEvent(requestEvent) : traceFor(context, undefined);
|
|
1665
1664
|
const render = timeDocument(context, context.trace, "string", requestEvent);
|
|
@@ -1679,7 +1678,7 @@ function renderToString(code, options = {}) {
|
|
|
1679
1678
|
closed = true;
|
|
1680
1679
|
serializer.close();
|
|
1681
1680
|
const head = renderShellHead(headRegistry, nonce, null, noScripts, traceMetaMarkup(context.trace));
|
|
1682
|
-
const document = assembleDocument(resolveSSRSelectValues(html), tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead)
|
|
1681
|
+
const document = withShellEnd(assembleDocument(resolveSSRSelectValues(html), tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead), context, renderId, nonce, noScripts);
|
|
1683
1682
|
if (render) render.shell();
|
|
1684
1683
|
if (requestEvent && requestEvent.response) {
|
|
1685
1684
|
commitResponseStub(requestEvent.response, {
|
|
@@ -1692,7 +1691,7 @@ function renderToString(code, options = {}) {
|
|
|
1692
1691
|
reportServerError(err, {
|
|
1693
1692
|
kind: "render",
|
|
1694
1693
|
handling: "failed"
|
|
1695
|
-
}, null, options.onError);
|
|
1694
|
+
}, null, options.onError, errorScope);
|
|
1696
1695
|
throw err;
|
|
1697
1696
|
} finally {
|
|
1698
1697
|
if (render) settleRender(render, rootOwner, rendered ? "complete" : "error");
|
|
@@ -1714,6 +1713,7 @@ function renderToStream(code, options = {}) {
|
|
|
1714
1713
|
const nonce = normalizeNonce(options.nonce);
|
|
1715
1714
|
const requestEvent = peekRequestEvent();
|
|
1716
1715
|
if (requestEvent) setRequestErrorHook(requestEvent, options.onError);
|
|
1716
|
+
const errorScope = requestEvent || {};
|
|
1717
1717
|
let dispose;
|
|
1718
1718
|
let dead = false;
|
|
1719
1719
|
let render;
|
|
@@ -1768,7 +1768,15 @@ function renderToStream(code, options = {}) {
|
|
|
1768
1768
|
if (dispose) {
|
|
1769
1769
|
const d = dispose;
|
|
1770
1770
|
dispose = () => {};
|
|
1771
|
-
|
|
1771
|
+
try {
|
|
1772
|
+
d();
|
|
1773
|
+
} catch (err) {
|
|
1774
|
+
reportServerError(err, {
|
|
1775
|
+
kind: "render",
|
|
1776
|
+
handling: "failed"
|
|
1777
|
+
}, null, options.onError, errorScope);
|
|
1778
|
+
if (!options.onError && ambientServerErrorHook() === undefined) console.error(err);
|
|
1779
|
+
}
|
|
1772
1780
|
}
|
|
1773
1781
|
if (serializer && typeof serializer.close === "function") {
|
|
1774
1782
|
try {
|
|
@@ -1777,7 +1785,7 @@ function renderToStream(code, options = {}) {
|
|
|
1777
1785
|
reportServerError(err, {
|
|
1778
1786
|
kind: "render",
|
|
1779
1787
|
handling: "serialize"
|
|
1780
|
-
}, null, options.onError);
|
|
1788
|
+
}, null, options.onError, errorScope);
|
|
1781
1789
|
}
|
|
1782
1790
|
}
|
|
1783
1791
|
serializer = abandonedSerializer;
|
|
@@ -1794,7 +1802,7 @@ function renderToStream(code, options = {}) {
|
|
|
1794
1802
|
reportServerError(err, {
|
|
1795
1803
|
kind: "render",
|
|
1796
1804
|
handling: "failed"
|
|
1797
|
-
}, null, options.onError);
|
|
1805
|
+
}, null, options.onError, errorScope);
|
|
1798
1806
|
if (!options.onError && ambientServerErrorHook() === undefined) console.error(err);
|
|
1799
1807
|
abandon();
|
|
1800
1808
|
};
|
|
@@ -1859,6 +1867,18 @@ function renderToStream(code, options = {}) {
|
|
|
1859
1867
|
const canBatchStubs = !options.serializer && !options.sink;
|
|
1860
1868
|
let stubBatch = null;
|
|
1861
1869
|
const STUB_BATCH_KEY = "$B";
|
|
1870
|
+
let stableOrder = false;
|
|
1871
|
+
let parkedWrites = null;
|
|
1872
|
+
const byKey = (a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0;
|
|
1873
|
+
const write = (id, value) => {
|
|
1874
|
+
if (stableOrder && !dead) (parkedWrites ||= []).push([id, value]);else serializer.write(id, value);
|
|
1875
|
+
};
|
|
1876
|
+
const flushParkedWrites = () => {
|
|
1877
|
+
if (!parkedWrites) return;
|
|
1878
|
+
const writes = parkedWrites.sort(byKey);
|
|
1879
|
+
parkedWrites = null;
|
|
1880
|
+
for (let i = 0; i < writes.length; i++) serializer.write(writes[i][0], writes[i][1]);
|
|
1881
|
+
};
|
|
1862
1882
|
const flushStubBatch = () => {
|
|
1863
1883
|
if (!stubBatch) return;
|
|
1864
1884
|
const batch = stubBatch;
|
|
@@ -1869,7 +1889,9 @@ function renderToStream(code, options = {}) {
|
|
|
1869
1889
|
return;
|
|
1870
1890
|
}
|
|
1871
1891
|
const obj = {};
|
|
1872
|
-
|
|
1892
|
+
const entries = [...batch];
|
|
1893
|
+
if (stableOrder) entries.sort(byKey);
|
|
1894
|
+
for (const [id, p] of entries) obj[id] = p;
|
|
1873
1895
|
serializer.write(STUB_BATCH_KEY, obj);
|
|
1874
1896
|
pushTask(`(b=>{for(var k in b)_$HY.r[k]=b[k];delete _$HY.r["${STUB_BATCH_KEY}"]})(_$HY.r["${STUB_BATCH_KEY}"])`);
|
|
1875
1897
|
};
|
|
@@ -1941,7 +1963,7 @@ function renderToStream(code, options = {}) {
|
|
|
1941
1963
|
}
|
|
1942
1964
|
},
|
|
1943
1965
|
shell(shellHtml, meta) {
|
|
1944
|
-
buffer.write(assembleDocument(shellHtml, meta.preloads, meta.preloadLinks, meta.inlineStyles, meta.tasks.length ? meta.tasks : "", nonce, meta.head, onHead)
|
|
1966
|
+
buffer.write(withShellEnd(assembleDocument(shellHtml, meta.preloads, meta.preloadLinks, meta.inlineStyles, meta.tasks.length ? meta.tasks : "", nonce, meta.head, onHead), context, renderId, nonce, noScripts));
|
|
1945
1967
|
},
|
|
1946
1968
|
...options.sink
|
|
1947
1969
|
};
|
|
@@ -1969,6 +1991,7 @@ function renderToStream(code, options = {}) {
|
|
|
1969
1991
|
end();
|
|
1970
1992
|
}
|
|
1971
1993
|
flushStubBatch();
|
|
1994
|
+
flushParkedWrites();
|
|
1972
1995
|
serializer.flush();
|
|
1973
1996
|
}));
|
|
1974
1997
|
}
|
|
@@ -1977,7 +2000,7 @@ function renderToStream(code, options = {}) {
|
|
|
1977
2000
|
const pendingSerialized = new Map();
|
|
1978
2001
|
const guardedChannels = new WeakMap();
|
|
1979
2002
|
const verdictNow = error => {
|
|
1980
|
-
throw ssrSanitizeError(error, null);
|
|
2003
|
+
throw ssrSanitizeError(error, null, undefined, undefined, errorScope);
|
|
1981
2004
|
};
|
|
1982
2005
|
const borderForm = value => toBorderForm(value);
|
|
1983
2006
|
const guardIterable = iterable => ({
|
|
@@ -2125,6 +2148,7 @@ function renderToStream(code, options = {}) {
|
|
|
2125
2148
|
async: true,
|
|
2126
2149
|
nonce: options.nonce,
|
|
2127
2150
|
document: !options.sink,
|
|
2151
|
+
edges: !!options.plugins && options.plugins.some(p => p.tag === "solid/server-component"),
|
|
2128
2152
|
live: {},
|
|
2129
2153
|
registerHeadTags(tags) {
|
|
2130
2154
|
registerHeadTags(headRegistry, context, tracking,
|
|
@@ -2190,7 +2214,7 @@ function renderToStream(code, options = {}) {
|
|
|
2190
2214
|
if (p && typeof p === "object" && typeof p.then === "function") {
|
|
2191
2215
|
if (!firstFlushed && deferStream) {
|
|
2192
2216
|
blockingPromises.add(p);
|
|
2193
|
-
p.then(d =>
|
|
2217
|
+
p.then(d => write(id, d)).catch(e => write(id, e));
|
|
2194
2218
|
return;
|
|
2195
2219
|
}
|
|
2196
2220
|
p = trackSerialized(id, p);
|
|
@@ -2199,7 +2223,7 @@ function renderToStream(code, options = {}) {
|
|
|
2199
2223
|
return;
|
|
2200
2224
|
}
|
|
2201
2225
|
}
|
|
2202
|
-
|
|
2226
|
+
write(id, p);
|
|
2203
2227
|
},
|
|
2204
2228
|
escape: escape,
|
|
2205
2229
|
resolve: resolveSSRNode,
|
|
@@ -2230,11 +2254,11 @@ function renderToStream(code, options = {}) {
|
|
|
2230
2254
|
defuse(p);
|
|
2231
2255
|
registry.set(key, {
|
|
2232
2256
|
resolve: err => queue(() => queue(() => {
|
|
2233
|
-
err ? reject(ssrSanitizeError(err, null)) : resolve(true);
|
|
2257
|
+
err ? reject(ssrSanitizeError(err, null, undefined, undefined, errorScope)) : resolve(true);
|
|
2234
2258
|
queue(flushEnd);
|
|
2235
2259
|
}))
|
|
2236
2260
|
});
|
|
2237
|
-
if (canBatchStubs && !shellCompleted && !dead) (stubBatch ||= new Map()).set(key + "_fr", p);else
|
|
2261
|
+
if (canBatchStubs && !shellCompleted && !dead) (stubBatch ||= new Map()).set(key + "_fr", p);else write(key + "_fr", p);
|
|
2238
2262
|
}
|
|
2239
2263
|
return (value, error, escaped) => {
|
|
2240
2264
|
if (registry.has(key)) {
|
|
@@ -2242,7 +2266,7 @@ function renderToStream(code, options = {}) {
|
|
|
2242
2266
|
registry.delete(key);
|
|
2243
2267
|
if (error) abandonSubtree(key, error);
|
|
2244
2268
|
if (error && escaped) {
|
|
2245
|
-
const wire = ssrSanitizeError(error, null);
|
|
2269
|
+
const wire = ssrSanitizeError(error, null, undefined, undefined, errorScope);
|
|
2246
2270
|
const message = wire instanceof Error ? wire.message : String(wire);
|
|
2247
2271
|
if (sink.error) sink.error("", message);else if (context.live && context.live.error) context.live.error(escaped.frame, message);
|
|
2248
2272
|
}
|
|
@@ -2276,7 +2300,7 @@ function renderToStream(code, options = {}) {
|
|
|
2276
2300
|
sink.fragment(key, resolveSSRSelectValues(value !== undefined ? value : " "), {
|
|
2277
2301
|
styles,
|
|
2278
2302
|
revealGroup,
|
|
2279
|
-
error: error ? ssrSanitizeError(error, null) : error
|
|
2303
|
+
error: error ? ssrSanitizeError(error, null, undefined, undefined, errorScope) : error
|
|
2280
2304
|
});
|
|
2281
2305
|
item.resolve(error);
|
|
2282
2306
|
}
|
|
@@ -2303,6 +2327,7 @@ function renderToStream(code, options = {}) {
|
|
|
2303
2327
|
applyAssetTracking(context, tracking, manifest, noScripts);
|
|
2304
2328
|
context.failRender = failRender;
|
|
2305
2329
|
context.errorPolicy = options.onError;
|
|
2330
|
+
context._errorScope = errorScope;
|
|
2306
2331
|
context.flushed = () => firstFlushed;
|
|
2307
2332
|
context.trace = requestEvent ? traceForEvent(requestEvent) : traceFor(context, undefined);
|
|
2308
2333
|
render = timeDocument(context, context.trace, "stream", requestEvent);
|
|
@@ -2310,40 +2335,48 @@ function renderToStream(code, options = {}) {
|
|
|
2310
2335
|
context.writer = createHydrationWriter(context, () => !completed);
|
|
2311
2336
|
const signal = options.signal;
|
|
2312
2337
|
const onAbort = signal ? () => abandon("signal", !!(signal.reason && signal.reason.quiet === true)) : undefined;
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
}
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
rootHoles
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2338
|
+
const endEdges = context.edges ? beginEdgesRender() : undefined;
|
|
2339
|
+
let html;
|
|
2340
|
+
try {
|
|
2341
|
+
html = createRoot(d => {
|
|
2342
|
+
dispose = () => {
|
|
2343
|
+
context.trace = undefined;
|
|
2344
|
+
if (onAbort) signal.removeEventListener("abort", onAbort);
|
|
2345
|
+
if (endEdges) endEdges();
|
|
2346
|
+
d();
|
|
2347
|
+
};
|
|
2348
|
+
rootOwner = claimRenderRoot(context);
|
|
2349
|
+
if (requestEvent) claimEventRender(requestEvent, context);
|
|
2350
|
+
let res;
|
|
2351
|
+
try {
|
|
2352
|
+
res = resolveSSRNode(escape(code()));
|
|
2353
|
+
} catch (err) {
|
|
2354
|
+
reportServerError(err, {
|
|
2355
|
+
kind: "render",
|
|
2356
|
+
handling: "failed"
|
|
2357
|
+
}, null, options.onError, errorScope);
|
|
2358
|
+
throw err;
|
|
2359
|
+
}
|
|
2360
|
+
if (!res.h.length) return res.t[0];
|
|
2361
|
+
rootHoles = [];
|
|
2362
|
+
let out = res.t[0];
|
|
2363
|
+
for (let i = 0; i < res.h.length; i++) {
|
|
2364
|
+
const id = nextHoleId++;
|
|
2365
|
+
rootHoles.push({
|
|
2366
|
+
id,
|
|
2367
|
+
fn: res.h[i]
|
|
2368
|
+
});
|
|
2369
|
+
out += `<!--rh${id}-->` + res.t[i + 1];
|
|
2370
|
+
}
|
|
2371
|
+
for (const p of res.p) blockingPromises.add(p);
|
|
2372
|
+
return out;
|
|
2373
|
+
}, {
|
|
2374
|
+
id: renderId
|
|
2375
|
+
});
|
|
2376
|
+
} catch (err) {
|
|
2377
|
+
if (endEdges) endEdges();
|
|
2378
|
+
throw err;
|
|
2379
|
+
}
|
|
2347
2380
|
if (onAbort) {
|
|
2348
2381
|
if (signal.aborted) onAbort();else signal.addEventListener("abort", onAbort, {
|
|
2349
2382
|
once: true
|
|
@@ -2422,21 +2455,30 @@ function renderToStream(code, options = {}) {
|
|
|
2422
2455
|
let lastBlockingSize = -1;
|
|
2423
2456
|
let lastRegistrySize = -1;
|
|
2424
2457
|
let drainTurn = 0;
|
|
2458
|
+
let graced = false;
|
|
2425
2459
|
const scheduleFlush = (fn, awaited) => {
|
|
2426
2460
|
const attempt = () => {
|
|
2427
|
-
flushStubBatch();
|
|
2461
|
+
if (!stableOrder) flushStubBatch();
|
|
2428
2462
|
if (registry.size !== lastRegistrySize || drainTurn++ < MIN_DRAIN_TURNS) {
|
|
2429
2463
|
if (registry.size !== lastRegistrySize) drainTurn = 0;
|
|
2430
2464
|
lastRegistrySize = registry.size;
|
|
2431
2465
|
queue(attempt);
|
|
2432
2466
|
return;
|
|
2433
2467
|
}
|
|
2468
|
+
if (!graced && registry.size) {
|
|
2469
|
+
graced = true;
|
|
2470
|
+
lastRegistrySize = -1;
|
|
2471
|
+
drainTurn = 0;
|
|
2472
|
+
deferFlush(attempt);
|
|
2473
|
+
return;
|
|
2474
|
+
}
|
|
2434
2475
|
fn();
|
|
2435
2476
|
};
|
|
2436
2477
|
const progressed = awaited !== lastBlockingSize;
|
|
2437
2478
|
lastBlockingSize = awaited;
|
|
2438
2479
|
lastRegistrySize = -1;
|
|
2439
2480
|
drainTurn = 0;
|
|
2481
|
+
graced = false;
|
|
2440
2482
|
progressed ? queue(attempt) : setTimeout(attempt);
|
|
2441
2483
|
};
|
|
2442
2484
|
let cachedReadable;
|
|
@@ -2503,6 +2545,7 @@ function renderToStream(code, options = {}) {
|
|
|
2503
2545
|
};
|
|
2504
2546
|
return {
|
|
2505
2547
|
then(onFulfilled, onRejected) {
|
|
2548
|
+
if (canBatchStubs) stableOrder = true;
|
|
2506
2549
|
const freezeHead = () => {
|
|
2507
2550
|
if (requestEvent && requestEvent.response) commitResponseStub(requestEvent.response, {
|
|
2508
2551
|
event: requestEvent
|
|
@@ -2601,7 +2644,7 @@ function HydrationScript(props) {
|
|
|
2601
2644
|
nonce: sharedConfig.context && sharedConfig.context.nonce,
|
|
2602
2645
|
...props
|
|
2603
2646
|
};
|
|
2604
|
-
return ssr(hydrationBootstrap(eventNames,
|
|
2647
|
+
return ssr(hydrationBootstrap(eventNames, destinationNonce(nonce, "script"), true));
|
|
2605
2648
|
}
|
|
2606
2649
|
function ssrGroup(fn, n) {
|
|
2607
2650
|
fn.$g = n;
|
|
@@ -2690,8 +2733,8 @@ function ssrGroupSlot(fn, idx) {
|
|
|
2690
2733
|
}
|
|
2691
2734
|
};
|
|
2692
2735
|
}
|
|
2693
|
-
function wireErrorMessage(err) {
|
|
2694
|
-
const wire = ssrSanitizeError(err, null);
|
|
2736
|
+
function wireErrorMessage(err, scope) {
|
|
2737
|
+
const wire = ssrSanitizeError(err, null, undefined, undefined, scope);
|
|
2695
2738
|
return String(wire && wire.message || wire);
|
|
2696
2739
|
}
|
|
2697
2740
|
const holePositionCache = new WeakMap();
|
|
@@ -2753,7 +2796,7 @@ function holeContentPositions(t) {
|
|
|
2753
2796
|
holePositionCache.set(t, cached);
|
|
2754
2797
|
return cached;
|
|
2755
2798
|
}
|
|
2756
|
-
function createLiveHoles(sink, scoped) {
|
|
2799
|
+
function createLiveHoles(sink, scoped, settled, errorScope) {
|
|
2757
2800
|
let nextId = 0;
|
|
2758
2801
|
const stamp = typeof creationStamp === "function" ? creationStamp : () => 0;
|
|
2759
2802
|
const inScope = scoped && typeof inServerComponentScope === "function" ? inServerComponentScope : null;
|
|
@@ -2761,20 +2804,70 @@ function createLiveHoles(sink, scoped) {
|
|
|
2761
2804
|
const swept = (owner, ctx, fn) => {
|
|
2762
2805
|
const prev = sharedConfig.context;
|
|
2763
2806
|
sharedConfig.context = ctx;
|
|
2807
|
+
let dispose;
|
|
2808
|
+
let before;
|
|
2809
|
+
const run = () => createRoot(d => {
|
|
2810
|
+
dispose = d;
|
|
2811
|
+
before = stamp();
|
|
2812
|
+
return fn();
|
|
2813
|
+
}, {
|
|
2814
|
+
transparent: true
|
|
2815
|
+
});
|
|
2764
2816
|
try {
|
|
2765
|
-
return owner ? runWithOwner(owner,
|
|
2817
|
+
return owner ? runWithOwner(owner, run) : run();
|
|
2766
2818
|
} finally {
|
|
2767
2819
|
sharedConfig.context = prev;
|
|
2820
|
+
engine.sweptOwners = before !== undefined && stamp() !== before;
|
|
2821
|
+
if (dispose) dispose();
|
|
2768
2822
|
}
|
|
2769
2823
|
};
|
|
2824
|
+
const stripRow = html => html.replace(/<!--lh:\/?\d+-->| data-lha="\d+"|<!--lr-->/g, "");
|
|
2825
|
+
const rowsOf = v => Array.isArray(v) && v.$rows ? v : null;
|
|
2826
|
+
function holeValue(hole) {
|
|
2827
|
+
const b = hole.$lhBinding;
|
|
2828
|
+
if (b) {
|
|
2829
|
+
const v = hole();
|
|
2830
|
+
return b.fn && rowsOf(b.fn()) || v;
|
|
2831
|
+
}
|
|
2832
|
+
if (!hole.$fn) return hole();
|
|
2833
|
+
const v = hole.$fn();
|
|
2834
|
+
return rowsOf(v) || escape(v);
|
|
2835
|
+
}
|
|
2836
|
+
function resolveValue(value, res) {
|
|
2837
|
+
if (!Array.isArray(value) || !value.$rows) {
|
|
2838
|
+
resolveSSRNode(value, res);
|
|
2839
|
+
return null;
|
|
2840
|
+
}
|
|
2841
|
+
let rows = [];
|
|
2842
|
+
for (const row of value) {
|
|
2843
|
+
const r = resolveSSRNode(escape(row));
|
|
2844
|
+
res.t[res.t.length - 1] += "<!--lr-->" + r.t[0];
|
|
2845
|
+
if (r.h.length) {
|
|
2846
|
+
res.t.push(...r.t.slice(1));
|
|
2847
|
+
res.h.push(...r.h);
|
|
2848
|
+
res.p.push(...r.p);
|
|
2849
|
+
rows = null;
|
|
2850
|
+
} else if (rows) rows.push(engine.sweeping ? r.t[0] : stripRow(r.t[0]));
|
|
2851
|
+
}
|
|
2852
|
+
return rows;
|
|
2853
|
+
}
|
|
2854
|
+
function rowOps(last, rows) {
|
|
2855
|
+
const ops = [];
|
|
2856
|
+
for (let i = 0; i < rows.length; i++) if (i >= last.length || rows[i] !== last[i]) ops.push([i, rows[i]]);
|
|
2857
|
+
return ops.length < rows.length ? {
|
|
2858
|
+
n: rows.length,
|
|
2859
|
+
r: ops
|
|
2860
|
+
} : null;
|
|
2861
|
+
}
|
|
2770
2862
|
function resolveHoleValue(hole) {
|
|
2771
2863
|
const result = {
|
|
2772
2864
|
t: [""],
|
|
2773
2865
|
h: [],
|
|
2774
|
-
p: []
|
|
2866
|
+
p: [],
|
|
2867
|
+
rows: null
|
|
2775
2868
|
};
|
|
2776
2869
|
try {
|
|
2777
|
-
|
|
2870
|
+
result.rows = resolveValue(holeValue(hole), result);
|
|
2778
2871
|
} catch (err) {
|
|
2779
2872
|
const wrap = buildAsyncWrap(err, hole);
|
|
2780
2873
|
if (!wrap) throw err;
|
|
@@ -2792,12 +2885,88 @@ function createLiveHoles(sink, scoped) {
|
|
|
2792
2885
|
}
|
|
2793
2886
|
b.children.length = 0;
|
|
2794
2887
|
}
|
|
2888
|
+
let tops = 0;
|
|
2889
|
+
const ids = new Map();
|
|
2890
|
+
const scopeFor = hole => {
|
|
2891
|
+
const p = engine.scope;
|
|
2892
|
+
return {
|
|
2893
|
+
id: undefined,
|
|
2894
|
+
p,
|
|
2895
|
+
i: p ? p.c++ : tops++,
|
|
2896
|
+
n: null,
|
|
2897
|
+
c: 0,
|
|
2898
|
+
h: hole
|
|
2899
|
+
};
|
|
2900
|
+
};
|
|
2901
|
+
const scopeId = s => s.id !== undefined ? s.id : s.id = s.p ? scopeId(s.p) + "." + s.i : String(s.i);
|
|
2902
|
+
const collect = (v, id, forget) => (v.occ || (v.occ = new Map())).set(id, forget);
|
|
2903
|
+
function rescope(b, hole, fn) {
|
|
2904
|
+
const prevScope = engine.scope;
|
|
2905
|
+
const prevVisit = engine.visit;
|
|
2906
|
+
engine.scope = {
|
|
2907
|
+
id: scopeId(b.scope),
|
|
2908
|
+
p: null,
|
|
2909
|
+
i: 0,
|
|
2910
|
+
n: null,
|
|
2911
|
+
c: 0,
|
|
2912
|
+
h: hole
|
|
2913
|
+
};
|
|
2914
|
+
const visit = engine.visit = {
|
|
2915
|
+
occ: null
|
|
2916
|
+
};
|
|
2917
|
+
try {
|
|
2918
|
+
return fn();
|
|
2919
|
+
} finally {
|
|
2920
|
+
engine.scope = prevScope;
|
|
2921
|
+
engine.visit = prevVisit;
|
|
2922
|
+
b.next = visit.occ;
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2925
|
+
function settleOccurrences(b) {
|
|
2926
|
+
const occ = b.next;
|
|
2927
|
+
b.next = null;
|
|
2928
|
+
if (b.occ) for (const [id, forget] of b.occ) if (!occ || !occ.has(id)) forget();
|
|
2929
|
+
b.occ = occ;
|
|
2930
|
+
if (occ) for (let a = b.up; a; a = a.up) for (const [id, forget] of occ) collect(a, id, forget);
|
|
2931
|
+
}
|
|
2932
|
+
function leave(b, parent, scope, visit) {
|
|
2933
|
+
engine.parent = parent;
|
|
2934
|
+
engine.scope = scope;
|
|
2935
|
+
engine.visit = visit;
|
|
2936
|
+
if (visit && b.occ) for (const [id, forget] of b.occ) collect(visit, id, forget);
|
|
2937
|
+
}
|
|
2795
2938
|
const engine = {
|
|
2796
2939
|
suppressed: 0,
|
|
2797
2940
|
sweeping: false,
|
|
2798
2941
|
parent: null,
|
|
2799
|
-
recordStamp: 0,
|
|
2800
2942
|
gateHit: false,
|
|
2943
|
+
sweptOwners: false,
|
|
2944
|
+
scope: null,
|
|
2945
|
+
visit: null,
|
|
2946
|
+
dry: false,
|
|
2947
|
+
slotId(prop, given) {
|
|
2948
|
+
const s = engine.scope;
|
|
2949
|
+
if (!s) return given;
|
|
2950
|
+
const n = s.n || (s.n = Object.create(null));
|
|
2951
|
+
const i = n[prop] || 0;
|
|
2952
|
+
n[prop] = i + 1;
|
|
2953
|
+
const sid = scopeId(s);
|
|
2954
|
+
const at = sid + "." + i + "\0" + prop;
|
|
2955
|
+
if (given !== undefined) {
|
|
2956
|
+
ids.set(at, given);
|
|
2957
|
+
return given;
|
|
2958
|
+
}
|
|
2959
|
+
return ids.get(at) || `${prop}#~${sid}.${i}`;
|
|
2960
|
+
},
|
|
2961
|
+
seen(id, forget) {
|
|
2962
|
+
if (engine.visit) collect(engine.visit, id, forget);
|
|
2963
|
+
},
|
|
2964
|
+
nest(hole) {
|
|
2965
|
+
const s = engine.scope;
|
|
2966
|
+
if (!s || s.h === hole || hole.$lhSkip || inScope && !inScope()) return undefined;
|
|
2967
|
+
engine.scope = scopeFor(hole);
|
|
2968
|
+
return s;
|
|
2969
|
+
},
|
|
2801
2970
|
content(hole) {
|
|
2802
2971
|
if (hole.$lhSuppress) {
|
|
2803
2972
|
const r = {
|
|
@@ -2805,10 +2974,12 @@ function createLiveHoles(sink, scoped) {
|
|
|
2805
2974
|
h: [],
|
|
2806
2975
|
p: []
|
|
2807
2976
|
};
|
|
2808
|
-
|
|
2809
|
-
|
|
2977
|
+
let rows = null;
|
|
2978
|
+
const b = hole.$lhBinding;
|
|
2979
|
+
const run = () => {
|
|
2980
|
+
engine.suppressed++;
|
|
2810
2981
|
try {
|
|
2811
|
-
|
|
2982
|
+
rows = resolveValue(holeValue(hole), r);
|
|
2812
2983
|
} catch (err) {
|
|
2813
2984
|
const wrap = buildAsyncWrap(err, hole);
|
|
2814
2985
|
if (wrap) {
|
|
@@ -2816,20 +2987,21 @@ function createLiveHoles(sink, scoped) {
|
|
|
2816
2987
|
r.p.push(wrap.p);
|
|
2817
2988
|
r.t.push("");
|
|
2818
2989
|
}
|
|
2990
|
+
} finally {
|
|
2991
|
+
engine.suppressed--;
|
|
2819
2992
|
}
|
|
2820
|
-
}
|
|
2821
|
-
|
|
2822
|
-
}
|
|
2823
|
-
const b = hole.$lhBinding;
|
|
2993
|
+
};
|
|
2994
|
+
b && !engine.sweeping ? rescope(b, hole, run) : run();
|
|
2824
2995
|
if (b && !b.closed && !r.h.length && !engine.sweeping) {
|
|
2825
2996
|
b.last = stripMarkers(r.t[0]);
|
|
2997
|
+
b.rows = rows;
|
|
2998
|
+
settleOccurrences(b);
|
|
2826
2999
|
}
|
|
2827
3000
|
return r.h.length ? r : r.t[0];
|
|
2828
3001
|
}
|
|
2829
3002
|
if (engine.suppressed || engine.sweeping) return null;
|
|
2830
3003
|
if (hole.$lhSkip) return null;
|
|
2831
3004
|
if (inScope && !inScope()) return null;
|
|
2832
|
-
const recordsBefore = engine.recordStamp;
|
|
2833
3005
|
const ownersBefore = stamp();
|
|
2834
3006
|
const owner = getOwner();
|
|
2835
3007
|
const holeCtx = sharedConfig.context;
|
|
@@ -2837,25 +3009,31 @@ function createLiveHoles(sink, scoped) {
|
|
|
2837
3009
|
key: null,
|
|
2838
3010
|
children: [],
|
|
2839
3011
|
last: null,
|
|
3012
|
+
rows: null,
|
|
3013
|
+
fn: hole.$fn,
|
|
2840
3014
|
closed: false,
|
|
3015
|
+
scope: undefined,
|
|
3016
|
+
occ: null,
|
|
3017
|
+
next: null,
|
|
3018
|
+
up: engine.parent,
|
|
2841
3019
|
sweep() {
|
|
2842
3020
|
if (b.closed) return;
|
|
2843
3021
|
const prevSweeping = engine.sweeping;
|
|
2844
3022
|
engine.sweeping = true;
|
|
2845
|
-
engine.
|
|
2846
|
-
const sweepOwnersBefore = stamp();
|
|
3023
|
+
engine.dry = b.last === null;
|
|
2847
3024
|
let res;
|
|
2848
3025
|
try {
|
|
2849
|
-
res = swept(owner, holeCtx, () => resolveHoleValue(hole));
|
|
3026
|
+
res = rescope(b, hole, () => swept(owner, holeCtx, () => resolveHoleValue(hole)));
|
|
2850
3027
|
} catch (err) {
|
|
2851
3028
|
b.closed = true;
|
|
2852
3029
|
sink.closeBinding(b.key);
|
|
2853
|
-
sink.error(b.key, wireErrorMessage(err));
|
|
3030
|
+
sink.error(b.key, wireErrorMessage(err, errorScope));
|
|
2854
3031
|
return;
|
|
2855
3032
|
} finally {
|
|
2856
3033
|
engine.sweeping = prevSweeping;
|
|
3034
|
+
engine.dry = false;
|
|
2857
3035
|
}
|
|
2858
|
-
if (engine.
|
|
3036
|
+
if (engine.sweptOwners && res.h.length) {
|
|
2859
3037
|
b.closed = true;
|
|
2860
3038
|
sink.closeBinding(b.key);
|
|
2861
3039
|
return;
|
|
@@ -2863,29 +3041,38 @@ function createLiveHoles(sink, scoped) {
|
|
|
2863
3041
|
if (res.h.length) return;
|
|
2864
3042
|
const html = res.t[0];
|
|
2865
3043
|
if (b.last === null || html === b.last) return;
|
|
3044
|
+
const ops = b.rows && res.rows && rowOps(b.rows, res.rows);
|
|
2866
3045
|
b.last = html;
|
|
3046
|
+
if (ops && !ops.r.length && ops.n === b.rows.length) return;
|
|
3047
|
+
b.rows = res.rows;
|
|
2867
3048
|
closeChildren(b);
|
|
2868
|
-
|
|
3049
|
+
settleOccurrences(b);
|
|
3050
|
+
sink.hole(b.key, html, ops && !html.includes("<!--slot:") ? ops : null);
|
|
2869
3051
|
}
|
|
2870
3052
|
};
|
|
2871
3053
|
if (engine.parent) engine.parent.children.push(b);
|
|
2872
3054
|
const prevParent = engine.parent;
|
|
3055
|
+
const prevScope = engine.scope;
|
|
3056
|
+
const prevVisit = engine.visit;
|
|
3057
|
+
const scope = b.scope = scopeFor(hole);
|
|
2873
3058
|
engine.parent = b;
|
|
3059
|
+
engine.scope = scope;
|
|
3060
|
+
engine.visit = b;
|
|
2874
3061
|
let value;
|
|
2875
3062
|
let escalated = null;
|
|
2876
3063
|
try {
|
|
2877
|
-
value = hole
|
|
3064
|
+
value = holeValue(hole);
|
|
2878
3065
|
} catch (err) {
|
|
2879
3066
|
const wrap = buildAsyncWrap(err, hole);
|
|
2880
3067
|
if (!wrap) {
|
|
2881
|
-
|
|
3068
|
+
leave(b, prevParent, prevScope, prevVisit);
|
|
2882
3069
|
closeChildren(b);
|
|
2883
3070
|
return "";
|
|
2884
3071
|
}
|
|
2885
3072
|
escalated = wrap;
|
|
2886
3073
|
}
|
|
2887
3074
|
if (!escalated && (typeof value === "function" && value.$lhSkip || value !== null && typeof value === "object" && value.$slot)) {
|
|
2888
|
-
|
|
3075
|
+
leave(b, prevParent, prevScope, prevVisit);
|
|
2889
3076
|
const r = {
|
|
2890
3077
|
t: [""],
|
|
2891
3078
|
h: [],
|
|
@@ -2900,6 +3087,7 @@ function createLiveHoles(sink, scoped) {
|
|
|
2900
3087
|
return r.h.length ? r : r.t[0];
|
|
2901
3088
|
}
|
|
2902
3089
|
let res;
|
|
3090
|
+
let rows = null;
|
|
2903
3091
|
if (escalated) {
|
|
2904
3092
|
closeChildren(b);
|
|
2905
3093
|
escalated.fn.$lhSuppress = true;
|
|
@@ -2916,23 +3104,25 @@ function createLiveHoles(sink, scoped) {
|
|
|
2916
3104
|
p: []
|
|
2917
3105
|
};
|
|
2918
3106
|
try {
|
|
2919
|
-
|
|
3107
|
+
rows = resolveValue(value, res);
|
|
2920
3108
|
} catch (_) {
|
|
2921
|
-
|
|
3109
|
+
leave(b, prevParent, prevScope, prevVisit);
|
|
2922
3110
|
closeChildren(b);
|
|
2923
3111
|
return "";
|
|
2924
3112
|
}
|
|
2925
3113
|
}
|
|
2926
|
-
|
|
2927
|
-
if (
|
|
3114
|
+
leave(b, prevParent, prevScope, prevVisit);
|
|
3115
|
+
if (stamp() !== ownersBefore) {
|
|
2928
3116
|
return res.h.length ? res : res.t[0];
|
|
2929
3117
|
}
|
|
3118
|
+
if (!res.h.length && settled && settled()) return res.t[0];
|
|
2930
3119
|
const id = nextId++;
|
|
2931
3120
|
const key = b.key = "lh:" + id;
|
|
2932
3121
|
const open = `<!--lh:${id}-->`;
|
|
2933
3122
|
const close = `<!--lh:/${id}-->`;
|
|
2934
3123
|
if (!res.h.length) {
|
|
2935
3124
|
b.last = stripMarkers(res.t[0]);
|
|
3125
|
+
b.rows = rows;
|
|
2936
3126
|
sink.openBinding(key, b);
|
|
2937
3127
|
return open + res.t[0] + close;
|
|
2938
3128
|
}
|
|
@@ -2950,7 +3140,7 @@ function createLiveHoles(sink, scoped) {
|
|
|
2950
3140
|
return nextId++;
|
|
2951
3141
|
},
|
|
2952
3142
|
active() {
|
|
2953
|
-
return !inScope || inScope();
|
|
3143
|
+
return (!inScope || inScope()) && !(settled && settled());
|
|
2954
3144
|
},
|
|
2955
3145
|
attr(cap) {
|
|
2956
3146
|
const owner = getOwner();
|
|
@@ -2963,9 +3153,10 @@ function createLiveHoles(sink, scoped) {
|
|
|
2963
3153
|
sweep() {
|
|
2964
3154
|
if (b.closed) return;
|
|
2965
3155
|
const prevSweeping = engine.sweeping;
|
|
3156
|
+
const prevScope = engine.scope;
|
|
2966
3157
|
engine.sweeping = true;
|
|
3158
|
+
engine.scope = null;
|
|
2967
3159
|
engine.gateHit = false;
|
|
2968
|
-
const sweepOwnersBefore = stamp();
|
|
2969
3160
|
let html = "";
|
|
2970
3161
|
try {
|
|
2971
3162
|
let group = null;
|
|
@@ -2992,15 +3183,21 @@ function createLiveHoles(sink, scoped) {
|
|
|
2992
3183
|
};
|
|
2993
3184
|
swept(owner, holeCtx, run);
|
|
2994
3185
|
} catch (err) {
|
|
2995
|
-
if (ssrHandleError(err, true))
|
|
3186
|
+
if (ssrHandleError(err, true)) {
|
|
3187
|
+
if (!engine.sweptOwners) return;
|
|
3188
|
+
b.closed = true;
|
|
3189
|
+
sink.closeBinding(b.key);
|
|
3190
|
+
return;
|
|
3191
|
+
}
|
|
2996
3192
|
b.closed = true;
|
|
2997
3193
|
sink.closeBinding(b.key);
|
|
2998
|
-
sink.error("lha:" + cap.id, wireErrorMessage(err));
|
|
3194
|
+
sink.error("lha:" + cap.id, wireErrorMessage(err, errorScope));
|
|
2999
3195
|
return;
|
|
3000
3196
|
} finally {
|
|
3001
3197
|
engine.sweeping = prevSweeping;
|
|
3198
|
+
engine.scope = prevScope;
|
|
3002
3199
|
}
|
|
3003
|
-
if (engine.gateHit
|
|
3200
|
+
if (engine.gateHit) {
|
|
3004
3201
|
b.closed = true;
|
|
3005
3202
|
sink.closeBinding(b.key);
|
|
3006
3203
|
return;
|
|
@@ -3065,7 +3262,9 @@ function ssr(t) {
|
|
|
3065
3262
|
cap = {
|
|
3066
3263
|
id,
|
|
3067
3264
|
parts: [prefix],
|
|
3068
|
-
base: prefix
|
|
3265
|
+
base: prefix,
|
|
3266
|
+
at: lastOpen.seg,
|
|
3267
|
+
inject
|
|
3069
3268
|
};
|
|
3070
3269
|
return true;
|
|
3071
3270
|
};
|
|
@@ -3114,7 +3313,10 @@ function ssr(t) {
|
|
|
3114
3313
|
});
|
|
3115
3314
|
}
|
|
3116
3315
|
} else {
|
|
3117
|
-
cap
|
|
3316
|
+
if (cap) {
|
|
3317
|
+
result.t[cap.at] = result.t[cap.at].replace(cap.inject, "");
|
|
3318
|
+
cap = null;
|
|
3319
|
+
}
|
|
3118
3320
|
result.h.push(ssrGroupSlot(lastGroupVal.fn, lastGroupIdx++));
|
|
3119
3321
|
result.p.push(lastGroupVal.p);
|
|
3120
3322
|
result.t.push("");
|
|
@@ -3176,12 +3378,15 @@ function ssr(t) {
|
|
|
3176
3378
|
f: hole
|
|
3177
3379
|
});
|
|
3178
3380
|
} else {
|
|
3381
|
+
result.t[cap.at] = result.t[cap.at].replace(cap.inject, "");
|
|
3179
3382
|
cap = null;
|
|
3180
3383
|
}
|
|
3181
3384
|
}
|
|
3182
3385
|
} else {
|
|
3183
3386
|
const capturing = live && !hp.pos[i - 1] && captureStart();
|
|
3387
|
+
const scope = live && hp.pos[i - 1] && live.nest(hole);
|
|
3184
3388
|
const r = tryResolveFunctionHole(hole);
|
|
3389
|
+
if (scope) live.scope = scope;
|
|
3185
3390
|
if (typeof r === "string") {
|
|
3186
3391
|
s += r;
|
|
3187
3392
|
if (capturing) {
|
|
@@ -3191,7 +3396,10 @@ function ssr(t) {
|
|
|
3191
3396
|
});
|
|
3192
3397
|
}
|
|
3193
3398
|
} else {
|
|
3194
|
-
if (capturing)
|
|
3399
|
+
if (capturing) {
|
|
3400
|
+
s = s.replace(cap.inject, "");
|
|
3401
|
+
cap = null;
|
|
3402
|
+
}
|
|
3195
3403
|
result = {
|
|
3196
3404
|
t: [s],
|
|
3197
3405
|
h: [],
|
|
@@ -3255,14 +3463,12 @@ function ssrClassName(value) {
|
|
|
3255
3463
|
if (typeof value === "number") return "" + value;
|
|
3256
3464
|
if (!value) return "";
|
|
3257
3465
|
if (typeof value === "string") return escape(value, true);
|
|
3258
|
-
if (isSlotValue(value)) return "";
|
|
3259
3466
|
value = classListToObject(value);
|
|
3260
3467
|
let classKeys = Object.keys(value),
|
|
3261
3468
|
result = "";
|
|
3262
3469
|
for (let i = 0, len = classKeys.length; i < len; i++) {
|
|
3263
3470
|
const key = classKeys[i];
|
|
3264
|
-
|
|
3265
|
-
if (isSlotValue(classValue)) classValue = slotValueInline();
|
|
3471
|
+
const classValue = value[key];
|
|
3266
3472
|
if (!key || key === "undefined" || !classValue) continue;
|
|
3267
3473
|
result && (result += " ");
|
|
3268
3474
|
result += escape(key, true);
|
|
@@ -3272,13 +3478,11 @@ function ssrClassName(value) {
|
|
|
3272
3478
|
function ssrStyle(value) {
|
|
3273
3479
|
if (!value) return "";
|
|
3274
3480
|
if (typeof value === "string") return escape(value, true);
|
|
3275
|
-
if (isSlotValue(value)) return "";
|
|
3276
3481
|
let result = "";
|
|
3277
3482
|
const k = Object.keys(value);
|
|
3278
3483
|
for (let i = 0; i < k.length; i++) {
|
|
3279
3484
|
const s = escape(k[i], true);
|
|
3280
|
-
|
|
3281
|
-
if (isSlotValue(v)) v = slotValueInline();
|
|
3485
|
+
const v = value[k[i]];
|
|
3282
3486
|
if (v != undefined) {
|
|
3283
3487
|
const r = escape(v, true);
|
|
3284
3488
|
if (r != undefined && r !== "undefined") {
|
|
@@ -3290,7 +3494,6 @@ function ssrStyle(value) {
|
|
|
3290
3494
|
return result;
|
|
3291
3495
|
}
|
|
3292
3496
|
function ssrStyleProperty(name, value) {
|
|
3293
|
-
if (isSlotValue(value)) value = slotValueInline();
|
|
3294
3497
|
return value != null ? name + value : "";
|
|
3295
3498
|
}
|
|
3296
3499
|
function ssrStyleProperties(...entries) {
|
|
@@ -3301,30 +3504,25 @@ function ssrStyleProperties(...entries) {
|
|
|
3301
3504
|
}
|
|
3302
3505
|
return result;
|
|
3303
3506
|
}
|
|
3304
|
-
function ssrElement(tag, props, children, needsId, skip, attrs
|
|
3507
|
+
function ssrElement(tag, props, children, needsId, skip, attrs) {
|
|
3305
3508
|
const hk = needsId ? ssrHydrationKey() : "";
|
|
3306
3509
|
if (typeof props === "function") props = props();
|
|
3307
3510
|
let sources = null;
|
|
3308
3511
|
let proxy = false;
|
|
3309
3512
|
let viewKeys = null;
|
|
3310
3513
|
let owners = null;
|
|
3311
|
-
let ownerIndex = null;
|
|
3312
3514
|
const ctx = renderConfig.context;
|
|
3313
|
-
const slots = ctx !== undefined && ctx.claims !== undefined;
|
|
3314
3515
|
const link = tag === "a" && ctx !== undefined && ctx.linkClaim !== undefined ? {} : null;
|
|
3315
3516
|
if (Array.isArray(props)) {
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
if (slots) ownerIndex = [];
|
|
3326
|
-
collectSpreadSources(tag, props, viewKeys, owners, slots, ownerIndex);
|
|
3327
|
-
}
|
|
3517
|
+
let i = 0;
|
|
3518
|
+
for (; i < props.length; i++) {
|
|
3519
|
+
const s = props[i];
|
|
3520
|
+
if (s == null || typeof s === "function" || $PROXY in s) break;
|
|
3521
|
+
}
|
|
3522
|
+
if (i === props.length) sources = props;else {
|
|
3523
|
+
viewKeys = [];
|
|
3524
|
+
owners = [];
|
|
3525
|
+
collectSpreadSources(props, viewKeys, owners);
|
|
3328
3526
|
}
|
|
3329
3527
|
} else if (props == null) {
|
|
3330
3528
|
props = {};
|
|
@@ -3334,13 +3532,10 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3334
3532
|
owners = [];
|
|
3335
3533
|
sourceOwners(props, viewKeys, owners);
|
|
3336
3534
|
} else proxy = true;
|
|
3337
|
-
} else if (slots && props.$slot === true) {
|
|
3338
|
-
props = slotSpreadSource();
|
|
3339
3535
|
}
|
|
3340
3536
|
const info = tagInfo(tag);
|
|
3341
3537
|
const skipChildren = info.isVoid;
|
|
3342
3538
|
let result = info.open + hk;
|
|
3343
|
-
let behaviors = null;
|
|
3344
3539
|
let childOwner = null;
|
|
3345
3540
|
const last = sources === null ? 0 : sources.length - 1;
|
|
3346
3541
|
let keysOf = null;
|
|
@@ -3375,21 +3570,9 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3375
3570
|
if (prop === undefined) continue;
|
|
3376
3571
|
}
|
|
3377
3572
|
const value = props[key];
|
|
3378
|
-
if (value == undefined)
|
|
3379
|
-
if (slots && claims !== undefined && (prop === "ref" || isEventName(prop))) behaviors = spreadBehaviorPosition(behaviors, prop, value, ctx.claims, ownerIndex !== null ? ownerIndex[i] : s, true);
|
|
3380
|
-
continue;
|
|
3381
|
-
}
|
|
3382
|
-
if (prop.startsWith("prop:")) {
|
|
3383
|
-
continue;
|
|
3384
|
-
}
|
|
3385
|
-
if (prop === "ref" || isEventName(prop)) {
|
|
3386
|
-
if (slots) behaviors = spreadBehaviorPosition(behaviors, prop, value, ctx.claims, ownerIndex !== null ? ownerIndex[i] : s, claims !== undefined);
|
|
3387
|
-
continue;
|
|
3388
|
-
}
|
|
3573
|
+
if (value == undefined || prop.startsWith("prop:") || prop === "ref" || isEventName(prop)) continue;
|
|
3389
3574
|
if (link !== null && LinkAttributes.has(prop)) link[prop] = value;
|
|
3390
|
-
if (
|
|
3391
|
-
result += spreadObjectAttribute(prop, value);
|
|
3392
|
-
} else if (prop === "style") {
|
|
3575
|
+
if (prop === "style") {
|
|
3393
3576
|
result += ` style="${ssrStyle(value)}"`;
|
|
3394
3577
|
} else if (prop === "class") {
|
|
3395
3578
|
result += ` class="${ssrClassName(value)}"`;
|
|
@@ -3400,7 +3583,6 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3400
3583
|
}
|
|
3401
3584
|
}
|
|
3402
3585
|
}
|
|
3403
|
-
if (slots && (behaviors !== null || claims !== undefined)) result += spreadBehaviorMarkers(behaviors, claims, ctx.claims);
|
|
3404
3586
|
if (attrs !== undefined) result += typeof attrs === "function" ? attrs() : attrs;
|
|
3405
3587
|
if (link !== null && link.href !== undefined) result += ssrLinkClaim(link);
|
|
3406
3588
|
if (skipChildren) return {
|
|
@@ -3420,6 +3602,13 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3420
3602
|
};
|
|
3421
3603
|
return ssr([result + ">", info.close], resolveSSRNode(children, undefined, true));
|
|
3422
3604
|
}
|
|
3605
|
+
function collectSpreadSources(props, viewKeys, owners) {
|
|
3606
|
+
for (let i = 0; i < props.length; i++) {
|
|
3607
|
+
let s = props[i];
|
|
3608
|
+
if (typeof s === "function") s = s();
|
|
3609
|
+
if (s != null) sourceOwners(s, viewKeys, owners);
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3423
3612
|
function spreadFormAttribute(prop, info, keys, keysOf, skip) {
|
|
3424
3613
|
const defaultProp = info.formDefaults[prop];
|
|
3425
3614
|
if (defaultProp !== undefined && (skip === undefined || !skip(defaultProp))) {
|
|
@@ -3435,19 +3624,14 @@ function spreadFormAttribute(prop, info, keys, keysOf, skip) {
|
|
|
3435
3624
|
}
|
|
3436
3625
|
function ssrElementAttribute(key, value) {
|
|
3437
3626
|
if (value == undefined) return "";
|
|
3438
|
-
if (key === "style" || key === "class") {
|
|
3439
|
-
return typeof value === "object" ? slotClassOrStyle(key, value) : ` ${key}="${key === "class" ? ssrClassName(value) : ssrStyle(value)}"`;
|
|
3440
|
-
}
|
|
3441
|
-
if (isSlotValue(value)) return slotAttribute(key, value);
|
|
3627
|
+
if (key === "style" || key === "class") return ` ${key}="${key === "class" ? ssrClassName(value) : ssrStyle(value)}"`;
|
|
3442
3628
|
if (typeof value === "boolean") return value ? ` ${key}` : "";
|
|
3443
3629
|
return value === "" ? ` ${key}` : ` ${key}="${escape(value, true)}"`;
|
|
3444
3630
|
}
|
|
3445
3631
|
function ssrAttribute(key, value) {
|
|
3446
3632
|
if (typeof value === "string") return ` ${key}="${value}"`;
|
|
3447
3633
|
if (value == null || value === false) return "";
|
|
3448
|
-
if (typeof value === "object") {
|
|
3449
|
-
return isSlotValue(value) ? slotAttribute(key, value) : ` ${key}="${escape(String(value), true)}"`;
|
|
3450
|
-
}
|
|
3634
|
+
if (typeof value === "object") return ` ${key}="${escape(String(value), true)}"`;
|
|
3451
3635
|
if (typeof value === "function") return ` ${key}="${escape(String(value), true)}"`;
|
|
3452
3636
|
return value === true ? ` ${key}` : ` ${key}="${value}"`;
|
|
3453
3637
|
}
|
|
@@ -3455,232 +3639,6 @@ function ssrHydrationKey() {
|
|
|
3455
3639
|
const hk = getHydrationKey();
|
|
3456
3640
|
return hk ? ` _hk=${hk}` : "";
|
|
3457
3641
|
}
|
|
3458
|
-
const CLAIMS_STREAM = 1;
|
|
3459
|
-
const CLAIMS_DOCUMENT = 2;
|
|
3460
|
-
const SLOT_VALUE = /*#__PURE__*/Symbol.for("solid.slot-value");
|
|
3461
|
-
const SLOT_MARKER = "_s:";
|
|
3462
|
-
const SLOT_FACE_STREAM = 0;
|
|
3463
|
-
const SLOT_FACE_DATA = 1;
|
|
3464
|
-
const SLOT_FACE_MARKUP = 2;
|
|
3465
|
-
function isSlotValue(value) {
|
|
3466
|
-
return value !== null && typeof value === "object" && value[SLOT_VALUE] !== undefined;
|
|
3467
|
-
}
|
|
3468
|
-
function slotValue(occurrence, key, value, face) {
|
|
3469
|
-
const sv = {
|
|
3470
|
-
[SLOT_VALUE]: occurrence,
|
|
3471
|
-
k: key,
|
|
3472
|
-
v: value,
|
|
3473
|
-
f: face
|
|
3474
|
-
};
|
|
3475
|
-
Object.defineProperty(sv, Symbol.toPrimitive, {
|
|
3476
|
-
value: hint => slotValueString()
|
|
3477
|
-
});
|
|
3478
|
-
Object.defineProperty(sv, "toString", {
|
|
3479
|
-
value: () => slotValueString()
|
|
3480
|
-
});
|
|
3481
|
-
Object.defineProperty(sv, "w", {
|
|
3482
|
-
value: () => slotText(sv)
|
|
3483
|
-
});
|
|
3484
|
-
return sv;
|
|
3485
|
-
}
|
|
3486
|
-
function slotValueString(sv, reason) {
|
|
3487
|
-
return "";
|
|
3488
|
-
}
|
|
3489
|
-
function slotText(sv) {
|
|
3490
|
-
const v = sv.f === SLOT_FACE_DATA ? sv.v : undefined;
|
|
3491
|
-
const text = typeof v === "string" || typeof v === "number" ? escape("" + v) : "";
|
|
3492
|
-
return `<!--${SLOT_MARKER}t=${slotEntry(sv)}-->${text}<!--/${SLOT_MARKER}t-->`;
|
|
3493
|
-
}
|
|
3494
|
-
function slotValueInline(kind, sv) {
|
|
3495
|
-
return undefined;
|
|
3496
|
-
}
|
|
3497
|
-
const SLOT_KEY_UNSAFE = /[^A-Za-z0-9_.!~*'()-]/g;
|
|
3498
|
-
function encodeSlotKey(key) {
|
|
3499
|
-
return String(key).replace(SLOT_KEY_UNSAFE, c => encodeURIComponent(c));
|
|
3500
|
-
}
|
|
3501
|
-
function slotEntry(sv, name) {
|
|
3502
|
-
return `${sv[SLOT_VALUE]}:${encodeSlotKey(sv.k)}${name !== undefined ? "=" + encodeSlotKey(name) : ""}`;
|
|
3503
|
-
}
|
|
3504
|
-
function slotMarker(position, entries) {
|
|
3505
|
-
return ` ${SLOT_MARKER}${position}="${entries}"`;
|
|
3506
|
-
}
|
|
3507
|
-
function eventSlotStamp(mode) {
|
|
3508
|
-
return mode === CLAIMS_DOCUMENT ? " _hk" : "";
|
|
3509
|
-
}
|
|
3510
|
-
function slotAttribute(key, sv) {
|
|
3511
|
-
let out = "";
|
|
3512
|
-
if (sv.f === SLOT_FACE_DATA) {
|
|
3513
|
-
const v = sv.v;
|
|
3514
|
-
if (v != null && v !== false) {
|
|
3515
|
-
out = v === true || v === "" ? ` ${key}` : ` ${key}="${escape(String(v), true)}"`;
|
|
3516
|
-
}
|
|
3517
|
-
}
|
|
3518
|
-
return out + slotMarker(key, slotEntry(sv));
|
|
3519
|
-
}
|
|
3520
|
-
function slotClassOrStyle(key, value) {
|
|
3521
|
-
const isClass = key === "class";
|
|
3522
|
-
if (isSlotValue(value)) {
|
|
3523
|
-
let out = "";
|
|
3524
|
-
if (value.f === SLOT_FACE_DATA && value.v != null) {
|
|
3525
|
-
out = ` ${key}="${isClass ? ssrClassName(value.v) : ssrStyle(value.v)}"`;
|
|
3526
|
-
}
|
|
3527
|
-
return out + slotMarker(key, slotEntry(value));
|
|
3528
|
-
}
|
|
3529
|
-
if (typeof value === "object" && value !== null) {
|
|
3530
|
-
const obj = isClass ? classListToObject(value) : value;
|
|
3531
|
-
let entries = "";
|
|
3532
|
-
let inner = "";
|
|
3533
|
-
for (const name of Object.keys(obj)) {
|
|
3534
|
-
let v = obj[name];
|
|
3535
|
-
if (isSlotValue(v)) {
|
|
3536
|
-
entries += (entries ? "," : "") + slotEntry(v, name);
|
|
3537
|
-
v = v.f === SLOT_FACE_DATA ? v.v : undefined;
|
|
3538
|
-
}
|
|
3539
|
-
if (isClass) {
|
|
3540
|
-
if (!name || name === "undefined" || !v) continue;
|
|
3541
|
-
inner += (inner ? " " : "") + escape(name, true);
|
|
3542
|
-
} else if (v != undefined) {
|
|
3543
|
-
const r = escape(v, true);
|
|
3544
|
-
if (r != undefined && r !== "undefined") {
|
|
3545
|
-
inner += (inner ? ";" : "") + `${escape(name, true)}:${r}`;
|
|
3546
|
-
}
|
|
3547
|
-
}
|
|
3548
|
-
}
|
|
3549
|
-
if (entries === "") return ` ${key}="${inner}"`;
|
|
3550
|
-
return (inner ? ` ${key}="${inner}"` : "") + slotMarker(key, entries);
|
|
3551
|
-
}
|
|
3552
|
-
return ` ${key}="${isClass ? ssrClassName(value) : ssrStyle(value)}"`;
|
|
3553
|
-
}
|
|
3554
|
-
function eventPosition(prop) {
|
|
3555
|
-
return prop.slice(2).toLowerCase();
|
|
3556
|
-
}
|
|
3557
|
-
function spreadBehaviorPosition(behaviors, prop, value, mode, index, settle) {
|
|
3558
|
-
if (!isAttrName(prop)) return behaviors;
|
|
3559
|
-
const pos = prop === "ref" ? "ref" : eventPosition(prop);
|
|
3560
|
-
const entries = value == null ? "" : claimEntries(pos, value);
|
|
3561
|
-
if (!settle) {
|
|
3562
|
-
if (entries) (behaviors ||= new Map()).set(pos, entries);
|
|
3563
|
-
return behaviors;
|
|
3564
|
-
}
|
|
3565
|
-
behaviors ||= new Map();
|
|
3566
|
-
const b = behaviors.get(pos);
|
|
3567
|
-
if (b === undefined) behaviors.set(pos, {
|
|
3568
|
-
e: entries,
|
|
3569
|
-
at: index
|
|
3570
|
-
});else {
|
|
3571
|
-
b.e = entries;
|
|
3572
|
-
b.at = index;
|
|
3573
|
-
}
|
|
3574
|
-
return behaviors;
|
|
3575
|
-
}
|
|
3576
|
-
function spreadBehaviorMarkers(behaviors, claims, mode) {
|
|
3577
|
-
if (claims !== undefined) {
|
|
3578
|
-
const segments = claims();
|
|
3579
|
-
for (const k in segments) {
|
|
3580
|
-
const map = segments[k];
|
|
3581
|
-
for (const pos in map) {
|
|
3582
|
-
const value = map[pos];
|
|
3583
|
-
behaviors ||= new Map();
|
|
3584
|
-
const b = behaviors.get(pos);
|
|
3585
|
-
if (pos === "ref") {
|
|
3586
|
-
if (value == null) continue;
|
|
3587
|
-
const entries = claimEntries("ref", value);
|
|
3588
|
-
if (!entries) continue;
|
|
3589
|
-
if (b === undefined) behaviors.set("ref", {
|
|
3590
|
-
e: entries,
|
|
3591
|
-
at: -1
|
|
3592
|
-
});else b.e = b.e ? b.e + "," + entries : entries;
|
|
3593
|
-
continue;
|
|
3594
|
-
}
|
|
3595
|
-
if (b !== undefined && b.at >= +k) continue;
|
|
3596
|
-
const entries = value == null ? "" : claimEntries(pos, value);
|
|
3597
|
-
if (b === undefined) behaviors.set(pos, {
|
|
3598
|
-
e: entries,
|
|
3599
|
-
at: -1
|
|
3600
|
-
});else b.e = entries;
|
|
3601
|
-
}
|
|
3602
|
-
}
|
|
3603
|
-
}
|
|
3604
|
-
let out = "";
|
|
3605
|
-
let events = false;
|
|
3606
|
-
if (behaviors !== null) {
|
|
3607
|
-
for (const [pos, b] of behaviors) {
|
|
3608
|
-
const e = claims === undefined ? b : b.e;
|
|
3609
|
-
if (!e) continue;
|
|
3610
|
-
if (pos === "ref") out += slotMarker("ref", e);else {
|
|
3611
|
-
out += slotMarker("on:" + pos, e);
|
|
3612
|
-
events = true;
|
|
3613
|
-
}
|
|
3614
|
-
}
|
|
3615
|
-
}
|
|
3616
|
-
return events ? out + eventSlotStamp(mode) : out;
|
|
3617
|
-
}
|
|
3618
|
-
function collectSpreadSources(tag, props, viewKeys, owners, slots, ownerIndex) {
|
|
3619
|
-
for (let i = 0; i < props.length; i++) {
|
|
3620
|
-
let s = props[i];
|
|
3621
|
-
if (typeof s === "function") s = s();
|
|
3622
|
-
if (s != null) {
|
|
3623
|
-
if (slots && !($PROXY in s) && s.$slot === true) s = slotSpreadSource();
|
|
3624
|
-
if (ownerIndex === null) sourceOwners(s, viewKeys, owners);else {
|
|
3625
|
-
const ks = [];
|
|
3626
|
-
const os = [];
|
|
3627
|
-
sourceOwners(s, ks, os);
|
|
3628
|
-
for (let j = 0; j < ks.length; j++) {
|
|
3629
|
-
const at = viewKeys.indexOf(ks[j]);
|
|
3630
|
-
if (at !== -1) {
|
|
3631
|
-
viewKeys.splice(at, 1);
|
|
3632
|
-
owners.splice(at, 1);
|
|
3633
|
-
ownerIndex.splice(at, 1);
|
|
3634
|
-
}
|
|
3635
|
-
viewKeys.push(ks[j]);
|
|
3636
|
-
owners.push(os[j]);
|
|
3637
|
-
ownerIndex.push(i);
|
|
3638
|
-
}
|
|
3639
|
-
}
|
|
3640
|
-
}
|
|
3641
|
-
}
|
|
3642
|
-
}
|
|
3643
|
-
function spreadObjectAttribute(prop, value) {
|
|
3644
|
-
if (prop === "style" || prop === "class") return slotClassOrStyle(prop, value);
|
|
3645
|
-
if (!isAttrName(prop)) return "";
|
|
3646
|
-
if (value[SLOT_VALUE] !== undefined) return slotAttribute(prop, value);
|
|
3647
|
-
return ` ${prop}="${escape(value, true)}"`;
|
|
3648
|
-
}
|
|
3649
|
-
function slotSpreadSource(tag, source) {
|
|
3650
|
-
return {};
|
|
3651
|
-
}
|
|
3652
|
-
function ssrClaim(map) {
|
|
3653
|
-
const mode = sharedConfig.context && sharedConfig.context.claims;
|
|
3654
|
-
if (!mode) return "";
|
|
3655
|
-
let out = "";
|
|
3656
|
-
let events = false;
|
|
3657
|
-
for (const pos in map) {
|
|
3658
|
-
const entries = claimEntries(pos, map[pos]);
|
|
3659
|
-
if (!entries) continue;
|
|
3660
|
-
if (pos === "ref") out += slotMarker("ref", entries);else {
|
|
3661
|
-
out += slotMarker("on:" + pos, entries);
|
|
3662
|
-
events = true;
|
|
3663
|
-
}
|
|
3664
|
-
}
|
|
3665
|
-
return events ? out + eventSlotStamp(mode) : out;
|
|
3666
|
-
}
|
|
3667
|
-
function claimEntries(pos, value, mode) {
|
|
3668
|
-
if (Array.isArray(value) && pos !== "ref") {
|
|
3669
|
-
return "";
|
|
3670
|
-
}
|
|
3671
|
-
if (Array.isArray(value)) {
|
|
3672
|
-
let entries = "";
|
|
3673
|
-
for (const v of value) {
|
|
3674
|
-
const inner = claimEntries(pos, v);
|
|
3675
|
-
if (inner) entries += (entries ? "," : "") + inner;
|
|
3676
|
-
}
|
|
3677
|
-
return entries;
|
|
3678
|
-
}
|
|
3679
|
-
if (isSlotValue(value)) {
|
|
3680
|
-
return slotEntry(value);
|
|
3681
|
-
}
|
|
3682
|
-
return "";
|
|
3683
|
-
}
|
|
3684
3642
|
function ssrLinkClaim(attrs) {
|
|
3685
3643
|
const ctx = renderConfig.context;
|
|
3686
3644
|
if (ctx === undefined || ctx.linkClaim === undefined || attrs["aria-current"] != null) return "";
|
|
@@ -3806,7 +3764,6 @@ function escape(s, attr) {
|
|
|
3806
3764
|
if (!attr && t === "function") return escapeLate(s);
|
|
3807
3765
|
if (attr) {
|
|
3808
3766
|
if (s == null || t === "boolean" || t === "number") return s;
|
|
3809
|
-
if (t === "object" && s[SLOT_VALUE] !== undefined) return s;
|
|
3810
3767
|
return escape(String(s), attr);
|
|
3811
3768
|
}
|
|
3812
3769
|
return s;
|
|
@@ -3819,6 +3776,7 @@ function escapeLate(fn) {
|
|
|
3819
3776
|
if (fn.$esc) return fn;
|
|
3820
3777
|
const w = () => escape(fn());
|
|
3821
3778
|
w.$esc = true;
|
|
3779
|
+
w.$fn = fn;
|
|
3822
3780
|
if (fn.$lhSkip) w.$lhSkip = true;
|
|
3823
3781
|
if (fn.$lhSuppress) w.$lhSuppress = true;
|
|
3824
3782
|
if (fn.$lhBinding) w.$lhBinding = fn.$lhBinding;
|
|
@@ -3914,7 +3872,7 @@ function generateHydrationScript({
|
|
|
3914
3872
|
eventNames,
|
|
3915
3873
|
nonce
|
|
3916
3874
|
} = {}) {
|
|
3917
|
-
return hydrationBootstrap(eventNames,
|
|
3875
|
+
return hydrationBootstrap(eventNames, destinationNonce(nonce, "script"), false);
|
|
3918
3876
|
}
|
|
3919
3877
|
function hydrationBootstrap(eventNames = ["click", "input"], nonce, ledger) {
|
|
3920
3878
|
return `<script${nonce ? ` nonce="${escape(String(nonce), true)}"` : ""}>window._$HY||(e=>{let t=e=>e&&e.hasAttribute&&(e.hasAttribute("_hk")?e:t(e.host&&e.host.nodeType?e.host:e.parentNode));["${eventNames.join('","')}"].forEach((o=>document.addEventListener(o,(o=>{if(!e.events)return;let s=t(o.composedPath&&o.composedPath()[0]||o.target);s&&!e.completed.has(s)&&e.events.push([s,o])}))))})(_$HY={events:[],completed:new WeakSet,r:new Proxy({},{set:(r,k,v)=>(v instanceof Promise&&v.catch(()=>{}),r[k]=v,!0)}),${ledger ? "s:{}," : ""}fe(){}});</script><!--xs-->`;
|
|
@@ -3930,10 +3888,12 @@ function allSettled(promises) {
|
|
|
3930
3888
|
return size;
|
|
3931
3889
|
});
|
|
3932
3890
|
}
|
|
3933
|
-
function
|
|
3934
|
-
if (noScripts || !context || !context.bootstrap) return
|
|
3891
|
+
function withShellEnd(html, context, renderId, nonce, noScripts) {
|
|
3892
|
+
if (noScripts || !context || !context.bootstrap) return html;
|
|
3935
3893
|
const id = JSON.stringify(renderId).replace(/</g, "\\u003C");
|
|
3936
|
-
|
|
3894
|
+
const marker = `<script${nonceAttr(nonce, "script")}>_$HY.s[${id}]=1,_$HY.sw&&_$HY.sw(${id})</script>`;
|
|
3895
|
+
const at = html.indexOf("</body>", html.length - 512);
|
|
3896
|
+
return at < 0 ? html + marker : html.slice(0, at) + marker + html.slice(at);
|
|
3937
3897
|
}
|
|
3938
3898
|
function assembleDocument(html, emittedAssets, preloadLinks, inlineStyles, scripts, nonce, headTags, onHead) {
|
|
3939
3899
|
const scriptTag = scripts ? `<script${nonceAttr(nonce, "script")}>${scripts}</script>` : "";
|
|
@@ -4125,10 +4085,6 @@ function tryResolveString(node, nested) {
|
|
|
4125
4085
|
if (node.h && node.h.length > 0) return {
|
|
4126
4086
|
merge: node
|
|
4127
4087
|
};
|
|
4128
|
-
if (node[SLOT_VALUE] !== undefined) {
|
|
4129
|
-
ssrTextTail = false;
|
|
4130
|
-
return node.w();
|
|
4131
|
-
}
|
|
4132
4088
|
if (node.t === undefined) {
|
|
4133
4089
|
return "";
|
|
4134
4090
|
}
|
|
@@ -4181,9 +4137,6 @@ function resolveSSRNode(node, result = {
|
|
|
4181
4137
|
} else if (node.t !== undefined) {
|
|
4182
4138
|
result.t[result.t.length - 1] += node.t;
|
|
4183
4139
|
ssrTextTail = false;
|
|
4184
|
-
} else if (node[SLOT_VALUE] !== undefined) {
|
|
4185
|
-
result.t[result.t.length - 1] += node.w();
|
|
4186
|
-
ssrTextTail = false;
|
|
4187
4140
|
} else ;
|
|
4188
4141
|
} else if (t === "function") {
|
|
4189
4142
|
const live = sharedConfig.context && sharedConfig.context.liveHoles;
|
|
@@ -4194,6 +4147,7 @@ function resolveSSRNode(node, result = {
|
|
|
4194
4147
|
ssrTextTail = true;
|
|
4195
4148
|
} else resolveSSRNode(liveNode, result, false, true);
|
|
4196
4149
|
} else {
|
|
4150
|
+
const scope = live && live.nest(node);
|
|
4197
4151
|
try {
|
|
4198
4152
|
resolveSSRNode(node(), result, false, true);
|
|
4199
4153
|
} catch (err) {
|
|
@@ -4205,6 +4159,8 @@ function resolveSSRNode(node, result = {
|
|
|
4205
4159
|
result.t.push("");
|
|
4206
4160
|
ssrTextTail = true;
|
|
4207
4161
|
}
|
|
4162
|
+
} finally {
|
|
4163
|
+
if (scope) live.scope = scope;
|
|
4208
4164
|
}
|
|
4209
4165
|
}
|
|
4210
4166
|
}
|
|
@@ -4624,7 +4580,7 @@ function dispatchAsInteraction(_e, fn) {
|
|
|
4624
4580
|
return fn();
|
|
4625
4581
|
}
|
|
4626
4582
|
function notSup() {
|
|
4627
|
-
throw new Error("Client-only API called on the server side. Run client-only code in
|
|
4583
|
+
throw new Error("Client-only API called on the server side. Run client-only code in onSettled, or conditionally run client-only component with <Show>.");
|
|
4628
4584
|
}
|
|
4629
4585
|
|
|
4630
4586
|
setContainerTraceResolver(getProjectionTrace);
|
|
@@ -4763,4 +4719,4 @@ function httpHeader(name, value, options) {
|
|
|
4763
4719
|
}
|
|
4764
4720
|
}
|
|
4765
4721
|
|
|
4766
|
-
export {
|
|
4722
|
+
export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, HydrationScript, MathMLElements, NULL_BODY_STATUSES, Namespaces, Portal, RESPONSE_HEADER_VALUE_LIMIT, REVALIDATE_ALL, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, notSup as acquireAsset, notSup as addEvent, applyRef, notSup as assign, claimElement, claimElementTree, notSup as className, clearFlashCookie, clientOnly, commitEventResponse, commitResponseStub, composeMiddleware, configureServerErrors, createLiveHoles, createRequestEvent, createResponseStub, createSSRResponse, notSup as delegateEvents, dispatchAsInteraction, dynamic, notSup as dynamicProperty, effect, escape, generateHydrationScript, notSup as getDelegatedRoot, getExpectedRedirectStatus, getHydrationKey, getHydrationWriter, notSup as getNextElement, notSup as getNextMarker, notSup as getNextMatch, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, httpHeader, httpStatus, notSup as hydrate, notSup as insert, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, notSup as readShallow, redirect, notSup as ref, notSup as registerDelegatedContainer, notSup as registerDelegatedRoot, registerElementClaim, reload, notSup as render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, resolveSSRSelectValues, respond, notSup as runHydrationEvents, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, setLinkClaim, notSup as setProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrSelectValues, ssrStyle, ssrStyleProperties, ssrStyleProperty, notSup as style, takeHydrationValue, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
|