@solidjs/web 2.0.0-rc.15 → 2.0.0-rc.17
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 +361 -483
- package/dist/server.js +346 -391
- package/dist/server.observe.js +346 -391
- package/dist/web.dev.js +110 -55
- package/dist/web.js +51 -50
- package/dist/web.observe.js +61 -55
- 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 +793 -424
- package/frames/dist/server.js +792 -371
- package/frames/dist/server.observe.js +792 -371
- 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 +13 -22
- package/server-functions/dist/client.js +11 -22
- package/server-functions/dist/client.observe.js +13 -22
- package/server-functions/dist/rich-args.js +84 -1
- package/server-functions/dist/server.dev.js +194 -20
- package/server-functions/dist/server.js +194 -20
- package/server-functions/dist/server.observe.js +194 -20
- package/skills/server-components/SKILL.md +74 -185
- package/types/client.d.ts +27 -5
- package/types/diagnostics.d.ts +16 -0
- 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 +30 -0
- package/types/server-functions/client.d.ts +27 -9
- package/types/server-functions/server.d.ts +23 -2
- package/types/server-functions/shared.d.ts +19 -0
- package/types/server-functions/uploads.d.ts +50 -0
- package/types/server-observe.d.ts +3 -2
- package/types/server.d.ts +58 -77
- 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.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRenderEffect, createMemo, 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
|
|
|
@@ -111,11 +111,9 @@ function parseTraceparent(value) {
|
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
113
|
function randomHex(bytes) {
|
|
114
|
-
const buffer = new Uint8Array(bytes);
|
|
115
|
-
crypto.getRandomValues(buffer);
|
|
116
114
|
let out = "";
|
|
117
|
-
for (let i = 0; i <
|
|
118
|
-
return out;
|
|
115
|
+
for (let i = 0; i < bytes; i += 4) out += (Math.random() * 0x100000000 >>> 0).toString(16).padStart(8, "0");
|
|
116
|
+
return out.length === bytes * 2 ? out : out.slice(0, bytes * 2);
|
|
119
117
|
}
|
|
120
118
|
function randomTraceId() {
|
|
121
119
|
let id = randomHex(16);
|
|
@@ -603,7 +601,12 @@ function respond(value, init = {}) {
|
|
|
603
601
|
}), value);
|
|
604
602
|
}
|
|
605
603
|
headers.set("Content-Type", "application/json");
|
|
606
|
-
return new ResponseEnvelope(new Response(
|
|
604
|
+
return new ResponseEnvelope(new Response(new ReadableStream({
|
|
605
|
+
pull(controller) {
|
|
606
|
+
controller.enqueue(new TextEncoder().encode(JSON.stringify(value)));
|
|
607
|
+
controller.close();
|
|
608
|
+
}
|
|
609
|
+
}), {
|
|
607
610
|
...responseInit,
|
|
608
611
|
headers
|
|
609
612
|
}), value);
|
|
@@ -1373,12 +1376,6 @@ function destinationNonce(nonce, destination) {
|
|
|
1373
1376
|
const value = typeof nonce === "string" ? nonce : nonce[destination];
|
|
1374
1377
|
return typeof value === "string" && value ? value : undefined;
|
|
1375
1378
|
}
|
|
1376
|
-
function scriptNonce(nonce) {
|
|
1377
|
-
return destinationNonce(nonce, "script");
|
|
1378
|
-
}
|
|
1379
|
-
function styleNonce(nonce) {
|
|
1380
|
-
return destinationNonce(nonce, "style");
|
|
1381
|
-
}
|
|
1382
1379
|
function hasNonceProp(props) {
|
|
1383
1380
|
for (const name in props) if (name.length === 5 && asciiLowerCase(name) === "nonce" && props[name] != null) return true;
|
|
1384
1381
|
return false;
|
|
@@ -1507,6 +1504,8 @@ function renderToString(code, options = {}) {
|
|
|
1507
1504
|
onHead
|
|
1508
1505
|
} = options;
|
|
1509
1506
|
const nonce = normalizeNonce(options.nonce);
|
|
1507
|
+
const requestEvent = peekRequestEvent();
|
|
1508
|
+
const errorScope = requestEvent || {};
|
|
1510
1509
|
let scripts = "";
|
|
1511
1510
|
const serializer = createHydrationSerializer({
|
|
1512
1511
|
scopeId: renderId,
|
|
@@ -1529,6 +1528,7 @@ function renderToString(code, options = {}) {
|
|
|
1529
1528
|
resolve: resolveSSRNode,
|
|
1530
1529
|
ssr: ssr,
|
|
1531
1530
|
errorPolicy: options.onError,
|
|
1531
|
+
_errorScope: errorScope,
|
|
1532
1532
|
registerHeadTags(tags) {
|
|
1533
1533
|
registerHeadTags(headRegistry, sharedConfig.context, tracking, null, nonce, tags);
|
|
1534
1534
|
},
|
|
@@ -1563,7 +1563,6 @@ function renderToString(code, options = {}) {
|
|
|
1563
1563
|
registerEntryAssets(manifest);
|
|
1564
1564
|
const context = sharedConfig.context;
|
|
1565
1565
|
context.writer = createHydrationWriter(context, () => !closed);
|
|
1566
|
-
const requestEvent = peekRequestEvent();
|
|
1567
1566
|
if (requestEvent) setRequestErrorHook(requestEvent, options.onError);
|
|
1568
1567
|
context.trace = requestEvent ? traceForEvent(requestEvent) : traceFor(context, undefined);
|
|
1569
1568
|
const render = timeDocument(context, context.trace);
|
|
@@ -1583,7 +1582,7 @@ function renderToString(code, options = {}) {
|
|
|
1583
1582
|
closed = true;
|
|
1584
1583
|
serializer.close();
|
|
1585
1584
|
const head = renderShellHead(headRegistry, nonce, null, noScripts, traceMetaMarkup(context.trace));
|
|
1586
|
-
const document = assembleDocument(resolveSSRSelectValues(html), tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead)
|
|
1585
|
+
const document = withShellEnd(assembleDocument(resolveSSRSelectValues(html), tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead), context, renderId, nonce, noScripts);
|
|
1587
1586
|
if (render) render.shell();
|
|
1588
1587
|
if (requestEvent && requestEvent.response) {
|
|
1589
1588
|
commitResponseStub(requestEvent.response, {
|
|
@@ -1596,7 +1595,7 @@ function renderToString(code, options = {}) {
|
|
|
1596
1595
|
reportServerError(err, {
|
|
1597
1596
|
kind: "render",
|
|
1598
1597
|
handling: "failed"
|
|
1599
|
-
}, null, options.onError);
|
|
1598
|
+
}, null, options.onError, errorScope);
|
|
1600
1599
|
throw err;
|
|
1601
1600
|
} finally {
|
|
1602
1601
|
if (render) settleRender(render, rootOwner, rendered ? "complete" : "error");
|
|
@@ -1618,6 +1617,14 @@ function renderToStream(code, options = {}) {
|
|
|
1618
1617
|
const nonce = normalizeNonce(options.nonce);
|
|
1619
1618
|
const requestEvent = peekRequestEvent();
|
|
1620
1619
|
if (requestEvent) setRequestErrorHook(requestEvent, options.onError);
|
|
1620
|
+
const errorScope = requestEvent || {};
|
|
1621
|
+
const reportFailure = (err, handling) => {
|
|
1622
|
+
reportServerError(err, {
|
|
1623
|
+
kind: "render",
|
|
1624
|
+
handling
|
|
1625
|
+
}, null, options.onError, errorScope);
|
|
1626
|
+
if (!options.onError && ambientServerErrorHook() === undefined) console.error(err);
|
|
1627
|
+
};
|
|
1621
1628
|
let dispose;
|
|
1622
1629
|
let dead = false;
|
|
1623
1630
|
let render;
|
|
@@ -1670,7 +1677,7 @@ function renderToStream(code, options = {}) {
|
|
|
1670
1677
|
reportServerError(err, {
|
|
1671
1678
|
kind: "render",
|
|
1672
1679
|
handling: "serialize"
|
|
1673
|
-
}, null, options.onError);
|
|
1680
|
+
}, null, options.onError, errorScope);
|
|
1674
1681
|
}
|
|
1675
1682
|
}
|
|
1676
1683
|
serializer = abandonedSerializer;
|
|
@@ -1684,11 +1691,7 @@ function renderToStream(code, options = {}) {
|
|
|
1684
1691
|
} else if (!sink && onDisconnectedBeforeShell) onDisconnectedBeforeShell();
|
|
1685
1692
|
};
|
|
1686
1693
|
const failRender = err => {
|
|
1687
|
-
|
|
1688
|
-
kind: "render",
|
|
1689
|
-
handling: "failed"
|
|
1690
|
-
}, null, options.onError);
|
|
1691
|
-
if (!options.onError && ambientServerErrorHook() === undefined) console.error(err);
|
|
1694
|
+
reportFailure(err, "failed");
|
|
1692
1695
|
abandon();
|
|
1693
1696
|
};
|
|
1694
1697
|
const failRootRender = err => {
|
|
@@ -1742,6 +1745,18 @@ function renderToStream(code, options = {}) {
|
|
|
1742
1745
|
const canBatchStubs = !options.serializer && !options.sink;
|
|
1743
1746
|
let stubBatch = null;
|
|
1744
1747
|
const STUB_BATCH_KEY = "$B";
|
|
1748
|
+
let stableOrder = false;
|
|
1749
|
+
let parkedWrites = null;
|
|
1750
|
+
const byKey = (a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0;
|
|
1751
|
+
const write = (id, value) => {
|
|
1752
|
+
if (stableOrder && !dead) (parkedWrites ||= []).push([id, value]);else serializer.write(id, value);
|
|
1753
|
+
};
|
|
1754
|
+
const flushParkedWrites = () => {
|
|
1755
|
+
if (!parkedWrites) return;
|
|
1756
|
+
const writes = parkedWrites.sort(byKey);
|
|
1757
|
+
parkedWrites = null;
|
|
1758
|
+
for (let i = 0; i < writes.length; i++) serializer.write(writes[i][0], writes[i][1]);
|
|
1759
|
+
};
|
|
1745
1760
|
const flushStubBatch = () => {
|
|
1746
1761
|
if (!stubBatch) return;
|
|
1747
1762
|
const batch = stubBatch;
|
|
@@ -1752,7 +1767,9 @@ function renderToStream(code, options = {}) {
|
|
|
1752
1767
|
return;
|
|
1753
1768
|
}
|
|
1754
1769
|
const obj = {};
|
|
1755
|
-
|
|
1770
|
+
const entries = [...batch];
|
|
1771
|
+
if (stableOrder) entries.sort(byKey);
|
|
1772
|
+
for (const [id, p] of entries) obj[id] = p;
|
|
1756
1773
|
serializer.write(STUB_BATCH_KEY, obj);
|
|
1757
1774
|
pushTask(`(b=>{for(var k in b)_$HY.r[k]=b[k];delete _$HY.r["${STUB_BATCH_KEY}"]})(_$HY.r["${STUB_BATCH_KEY}"])`);
|
|
1758
1775
|
};
|
|
@@ -1824,7 +1841,7 @@ function renderToStream(code, options = {}) {
|
|
|
1824
1841
|
}
|
|
1825
1842
|
},
|
|
1826
1843
|
shell(shellHtml, meta) {
|
|
1827
|
-
buffer.write(assembleDocument(shellHtml, meta.preloads, meta.preloadLinks, meta.inlineStyles, meta.tasks.length ? meta.tasks : "", nonce, meta.head, onHead)
|
|
1844
|
+
buffer.write(withShellEnd(assembleDocument(shellHtml, meta.preloads, meta.preloadLinks, meta.inlineStyles, meta.tasks.length ? meta.tasks : "", nonce, meta.head, onHead), context, renderId, nonce, noScripts));
|
|
1828
1845
|
},
|
|
1829
1846
|
...options.sink
|
|
1830
1847
|
};
|
|
@@ -1833,7 +1850,7 @@ function renderToStream(code, options = {}) {
|
|
|
1833
1850
|
plugins: options.plugins,
|
|
1834
1851
|
onData: payload => sink.data(payload),
|
|
1835
1852
|
onDone,
|
|
1836
|
-
onError:
|
|
1853
|
+
onError: err => reportFailure(err, "serialize")
|
|
1837
1854
|
});
|
|
1838
1855
|
let rootAssetsSerialized = false;
|
|
1839
1856
|
const serializeRootAssets = () => {
|
|
@@ -1852,6 +1869,7 @@ function renderToStream(code, options = {}) {
|
|
|
1852
1869
|
end();
|
|
1853
1870
|
}
|
|
1854
1871
|
flushStubBatch();
|
|
1872
|
+
flushParkedWrites();
|
|
1855
1873
|
serializer.flush();
|
|
1856
1874
|
}));
|
|
1857
1875
|
}
|
|
@@ -1860,7 +1878,7 @@ function renderToStream(code, options = {}) {
|
|
|
1860
1878
|
const pendingSerialized = new Map();
|
|
1861
1879
|
const guardedChannels = new WeakMap();
|
|
1862
1880
|
const verdictNow = error => {
|
|
1863
|
-
throw ssrSanitizeError(error, null);
|
|
1881
|
+
throw ssrSanitizeError(error, null, undefined, undefined, errorScope);
|
|
1864
1882
|
};
|
|
1865
1883
|
const borderForm = value => toBorderForm(value);
|
|
1866
1884
|
const guardIterable = iterable => ({
|
|
@@ -1992,6 +2010,7 @@ function renderToStream(code, options = {}) {
|
|
|
1992
2010
|
async: true,
|
|
1993
2011
|
nonce: options.nonce,
|
|
1994
2012
|
document: !options.sink,
|
|
2013
|
+
edges: !!options.plugins && options.plugins.some(p => p.tag === "solid/server-component"),
|
|
1995
2014
|
live: {},
|
|
1996
2015
|
registerHeadTags(tags) {
|
|
1997
2016
|
registerHeadTags(headRegistry, context, tracking,
|
|
@@ -2057,7 +2076,7 @@ function renderToStream(code, options = {}) {
|
|
|
2057
2076
|
if (p && typeof p === "object" && typeof p.then === "function") {
|
|
2058
2077
|
if (!firstFlushed && deferStream) {
|
|
2059
2078
|
blockingPromises.add(p);
|
|
2060
|
-
p.then(d =>
|
|
2079
|
+
p.then(d => write(id, d)).catch(e => write(id, e));
|
|
2061
2080
|
return;
|
|
2062
2081
|
}
|
|
2063
2082
|
p = trackSerialized(id, p);
|
|
@@ -2066,7 +2085,7 @@ function renderToStream(code, options = {}) {
|
|
|
2066
2085
|
return;
|
|
2067
2086
|
}
|
|
2068
2087
|
}
|
|
2069
|
-
|
|
2088
|
+
write(id, p);
|
|
2070
2089
|
},
|
|
2071
2090
|
escape: escape,
|
|
2072
2091
|
resolve: resolveSSRNode,
|
|
@@ -2097,11 +2116,11 @@ function renderToStream(code, options = {}) {
|
|
|
2097
2116
|
defuse(p);
|
|
2098
2117
|
registry.set(key, {
|
|
2099
2118
|
resolve: err => queue(() => queue(() => {
|
|
2100
|
-
err ? reject(ssrSanitizeError(err, null)) : resolve(true);
|
|
2119
|
+
err ? reject(ssrSanitizeError(err, null, undefined, undefined, errorScope)) : resolve(true);
|
|
2101
2120
|
queue(flushEnd);
|
|
2102
2121
|
}))
|
|
2103
2122
|
});
|
|
2104
|
-
if (canBatchStubs && !shellCompleted && !dead) (stubBatch ||= new Map()).set(key + "_fr", p);else
|
|
2123
|
+
if (canBatchStubs && !shellCompleted && !dead) (stubBatch ||= new Map()).set(key + "_fr", p);else write(key + "_fr", p);
|
|
2105
2124
|
}
|
|
2106
2125
|
return (value, error, escaped) => {
|
|
2107
2126
|
if (registry.has(key)) {
|
|
@@ -2109,7 +2128,7 @@ function renderToStream(code, options = {}) {
|
|
|
2109
2128
|
registry.delete(key);
|
|
2110
2129
|
if (error) abandonSubtree(key);
|
|
2111
2130
|
if (error && escaped) {
|
|
2112
|
-
const wire = ssrSanitizeError(error, null);
|
|
2131
|
+
const wire = ssrSanitizeError(error, null, undefined, undefined, errorScope);
|
|
2113
2132
|
const message = wire instanceof Error ? wire.message : String(wire);
|
|
2114
2133
|
if (sink.error) sink.error("", message);else if (context.live && context.live.error) context.live.error(escaped.frame, message);
|
|
2115
2134
|
}
|
|
@@ -2143,7 +2162,7 @@ function renderToStream(code, options = {}) {
|
|
|
2143
2162
|
sink.fragment(key, resolveSSRSelectValues(value !== undefined ? value : " "), {
|
|
2144
2163
|
styles,
|
|
2145
2164
|
revealGroup,
|
|
2146
|
-
error: error ? ssrSanitizeError(error, null) : error
|
|
2165
|
+
error: error ? ssrSanitizeError(error, null, undefined, undefined, errorScope) : error
|
|
2147
2166
|
});
|
|
2148
2167
|
item.resolve(error);
|
|
2149
2168
|
}
|
|
@@ -2170,6 +2189,7 @@ function renderToStream(code, options = {}) {
|
|
|
2170
2189
|
applyAssetTracking(context, tracking, manifest, noScripts);
|
|
2171
2190
|
context.failRender = failRender;
|
|
2172
2191
|
context.errorPolicy = options.onError;
|
|
2192
|
+
context._errorScope = errorScope;
|
|
2173
2193
|
context.flushed = () => firstFlushed;
|
|
2174
2194
|
context.trace = requestEvent ? traceForEvent(requestEvent) : traceFor(context, undefined);
|
|
2175
2195
|
render = timeDocument(context, context.trace);
|
|
@@ -2177,40 +2197,52 @@ function renderToStream(code, options = {}) {
|
|
|
2177
2197
|
context.writer = createHydrationWriter(context, () => !completed);
|
|
2178
2198
|
const signal = options.signal;
|
|
2179
2199
|
const onAbort = signal ? () => abandon("signal", !!(signal.reason && signal.reason.quiet === true)) : undefined;
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2200
|
+
const endEdges = context.edges ? beginEdgesRender() : undefined;
|
|
2201
|
+
let html;
|
|
2202
|
+
try {
|
|
2203
|
+
html = createRoot(d => {
|
|
2204
|
+
dispose = () => {
|
|
2205
|
+
context.trace = undefined;
|
|
2206
|
+
if (onAbort) signal.removeEventListener("abort", onAbort);
|
|
2207
|
+
if (endEdges) endEdges();
|
|
2208
|
+
try {
|
|
2209
|
+
d();
|
|
2210
|
+
} catch (err) {
|
|
2211
|
+
reportFailure(err, "failed");
|
|
2212
|
+
}
|
|
2213
|
+
};
|
|
2214
|
+
rootOwner = claimRenderRoot(context);
|
|
2215
|
+
if (requestEvent) claimEventRender(requestEvent, context);
|
|
2216
|
+
let res;
|
|
2217
|
+
try {
|
|
2218
|
+
res = resolveSSRNode(escape(code()));
|
|
2219
|
+
} catch (err) {
|
|
2220
|
+
reportServerError(err, {
|
|
2221
|
+
kind: "render",
|
|
2222
|
+
handling: "failed"
|
|
2223
|
+
}, null, options.onError, errorScope);
|
|
2224
|
+
throw err;
|
|
2225
|
+
}
|
|
2226
|
+
if (!res.h.length) return res.t[0];
|
|
2227
|
+
rootHoles = [];
|
|
2228
|
+
let out = res.t[0];
|
|
2229
|
+
for (let i = 0; i < res.h.length; i++) {
|
|
2230
|
+
const id = nextHoleId++;
|
|
2231
|
+
rootHoles.push({
|
|
2232
|
+
id,
|
|
2233
|
+
fn: res.h[i]
|
|
2234
|
+
});
|
|
2235
|
+
out += `<!--rh${id}-->` + res.t[i + 1];
|
|
2236
|
+
}
|
|
2237
|
+
for (const p of res.p) blockingPromises.add(p);
|
|
2238
|
+
return out;
|
|
2239
|
+
}, {
|
|
2240
|
+
id: renderId
|
|
2241
|
+
});
|
|
2242
|
+
} catch (err) {
|
|
2243
|
+
if (endEdges) endEdges();
|
|
2244
|
+
throw err;
|
|
2245
|
+
}
|
|
2214
2246
|
if (onAbort) {
|
|
2215
2247
|
if (signal.aborted) onAbort();else signal.addEventListener("abort", onAbort, {
|
|
2216
2248
|
once: true
|
|
@@ -2289,21 +2321,30 @@ function renderToStream(code, options = {}) {
|
|
|
2289
2321
|
let lastBlockingSize = -1;
|
|
2290
2322
|
let lastRegistrySize = -1;
|
|
2291
2323
|
let drainTurn = 0;
|
|
2324
|
+
let graced = false;
|
|
2292
2325
|
const scheduleFlush = (fn, awaited) => {
|
|
2293
2326
|
const attempt = () => {
|
|
2294
|
-
flushStubBatch();
|
|
2327
|
+
if (!stableOrder) flushStubBatch();
|
|
2295
2328
|
if (registry.size !== lastRegistrySize || drainTurn++ < MIN_DRAIN_TURNS) {
|
|
2296
2329
|
if (registry.size !== lastRegistrySize) drainTurn = 0;
|
|
2297
2330
|
lastRegistrySize = registry.size;
|
|
2298
2331
|
queue(attempt);
|
|
2299
2332
|
return;
|
|
2300
2333
|
}
|
|
2334
|
+
if (!graced && registry.size) {
|
|
2335
|
+
graced = true;
|
|
2336
|
+
lastRegistrySize = -1;
|
|
2337
|
+
drainTurn = 0;
|
|
2338
|
+
deferFlush(attempt);
|
|
2339
|
+
return;
|
|
2340
|
+
}
|
|
2301
2341
|
fn();
|
|
2302
2342
|
};
|
|
2303
2343
|
const progressed = awaited !== lastBlockingSize;
|
|
2304
2344
|
lastBlockingSize = awaited;
|
|
2305
2345
|
lastRegistrySize = -1;
|
|
2306
2346
|
drainTurn = 0;
|
|
2347
|
+
graced = false;
|
|
2307
2348
|
progressed ? queue(attempt) : setTimeout(attempt);
|
|
2308
2349
|
};
|
|
2309
2350
|
let cachedReadable;
|
|
@@ -2370,6 +2411,7 @@ function renderToStream(code, options = {}) {
|
|
|
2370
2411
|
};
|
|
2371
2412
|
return {
|
|
2372
2413
|
then(onFulfilled, onRejected) {
|
|
2414
|
+
if (canBatchStubs) stableOrder = true;
|
|
2373
2415
|
const freezeHead = () => {
|
|
2374
2416
|
if (requestEvent && requestEvent.response) commitResponseStub(requestEvent.response, {
|
|
2375
2417
|
event: requestEvent
|
|
@@ -2468,7 +2510,7 @@ function HydrationScript(props) {
|
|
|
2468
2510
|
nonce: sharedConfig.context && sharedConfig.context.nonce,
|
|
2469
2511
|
...props
|
|
2470
2512
|
};
|
|
2471
|
-
return ssr(hydrationBootstrap(eventNames,
|
|
2513
|
+
return ssr(hydrationBootstrap(eventNames, destinationNonce(nonce, "script"), true));
|
|
2472
2514
|
}
|
|
2473
2515
|
function ssrGroup(fn, n) {
|
|
2474
2516
|
fn.$g = n;
|
|
@@ -2557,8 +2599,8 @@ function ssrGroupSlot(fn, idx) {
|
|
|
2557
2599
|
}
|
|
2558
2600
|
};
|
|
2559
2601
|
}
|
|
2560
|
-
function wireErrorMessage(err) {
|
|
2561
|
-
const wire = ssrSanitizeError(err, null);
|
|
2602
|
+
function wireErrorMessage(err, scope) {
|
|
2603
|
+
const wire = ssrSanitizeError(err, null, undefined, undefined, scope);
|
|
2562
2604
|
return String(wire && wire.message || wire);
|
|
2563
2605
|
}
|
|
2564
2606
|
const holePositionCache = new WeakMap();
|
|
@@ -2620,7 +2662,7 @@ function holeContentPositions(t) {
|
|
|
2620
2662
|
holePositionCache.set(t, cached);
|
|
2621
2663
|
return cached;
|
|
2622
2664
|
}
|
|
2623
|
-
function createLiveHoles(sink, scoped) {
|
|
2665
|
+
function createLiveHoles(sink, scoped, settled, errorScope) {
|
|
2624
2666
|
let nextId = 0;
|
|
2625
2667
|
const stamp = typeof creationStamp === "function" ? creationStamp : () => 0;
|
|
2626
2668
|
const inScope = scoped && typeof inServerComponentScope === "function" ? inServerComponentScope : null;
|
|
@@ -2628,20 +2670,70 @@ function createLiveHoles(sink, scoped) {
|
|
|
2628
2670
|
const swept = (owner, ctx, fn) => {
|
|
2629
2671
|
const prev = sharedConfig.context;
|
|
2630
2672
|
sharedConfig.context = ctx;
|
|
2673
|
+
let dispose;
|
|
2674
|
+
let before;
|
|
2675
|
+
const run = () => createRoot(d => {
|
|
2676
|
+
dispose = d;
|
|
2677
|
+
before = stamp();
|
|
2678
|
+
return fn();
|
|
2679
|
+
}, {
|
|
2680
|
+
transparent: true
|
|
2681
|
+
});
|
|
2631
2682
|
try {
|
|
2632
|
-
return owner ? runWithOwner(owner,
|
|
2683
|
+
return owner ? runWithOwner(owner, run) : run();
|
|
2633
2684
|
} finally {
|
|
2634
2685
|
sharedConfig.context = prev;
|
|
2686
|
+
engine.sweptOwners = before !== undefined && stamp() !== before;
|
|
2687
|
+
if (dispose) dispose();
|
|
2635
2688
|
}
|
|
2636
2689
|
};
|
|
2690
|
+
const stripRow = html => html.replace(/<!--lh:\/?\d+-->| data-lha="\d+"|<!--lr-->/g, "");
|
|
2691
|
+
const rowsOf = v => Array.isArray(v) && v.$rows ? v : null;
|
|
2692
|
+
function holeValue(hole) {
|
|
2693
|
+
const b = hole.$lhBinding;
|
|
2694
|
+
if (b) {
|
|
2695
|
+
const v = hole();
|
|
2696
|
+
return b.fn && rowsOf(b.fn()) || v;
|
|
2697
|
+
}
|
|
2698
|
+
if (!hole.$fn) return hole();
|
|
2699
|
+
const v = hole.$fn();
|
|
2700
|
+
return rowsOf(v) || escape(v);
|
|
2701
|
+
}
|
|
2702
|
+
function resolveValue(value, res) {
|
|
2703
|
+
if (!Array.isArray(value) || !value.$rows) {
|
|
2704
|
+
resolveSSRNode(value, res);
|
|
2705
|
+
return null;
|
|
2706
|
+
}
|
|
2707
|
+
let rows = [];
|
|
2708
|
+
for (const row of value) {
|
|
2709
|
+
const r = resolveSSRNode(escape(row));
|
|
2710
|
+
res.t[res.t.length - 1] += "<!--lr-->" + r.t[0];
|
|
2711
|
+
if (r.h.length) {
|
|
2712
|
+
res.t.push(...r.t.slice(1));
|
|
2713
|
+
res.h.push(...r.h);
|
|
2714
|
+
res.p.push(...r.p);
|
|
2715
|
+
rows = null;
|
|
2716
|
+
} else if (rows) rows.push(engine.sweeping ? r.t[0] : stripRow(r.t[0]));
|
|
2717
|
+
}
|
|
2718
|
+
return rows;
|
|
2719
|
+
}
|
|
2720
|
+
function rowOps(last, rows) {
|
|
2721
|
+
const ops = [];
|
|
2722
|
+
for (let i = 0; i < rows.length; i++) if (i >= last.length || rows[i] !== last[i]) ops.push([i, rows[i]]);
|
|
2723
|
+
return ops.length < rows.length ? {
|
|
2724
|
+
n: rows.length,
|
|
2725
|
+
r: ops
|
|
2726
|
+
} : null;
|
|
2727
|
+
}
|
|
2637
2728
|
function resolveHoleValue(hole) {
|
|
2638
2729
|
const result = {
|
|
2639
2730
|
t: [""],
|
|
2640
2731
|
h: [],
|
|
2641
|
-
p: []
|
|
2732
|
+
p: [],
|
|
2733
|
+
rows: null
|
|
2642
2734
|
};
|
|
2643
2735
|
try {
|
|
2644
|
-
|
|
2736
|
+
result.rows = resolveValue(holeValue(hole), result);
|
|
2645
2737
|
} catch (err) {
|
|
2646
2738
|
const wrap = buildAsyncWrap(err, hole);
|
|
2647
2739
|
if (!wrap) throw err;
|
|
@@ -2659,12 +2751,88 @@ function createLiveHoles(sink, scoped) {
|
|
|
2659
2751
|
}
|
|
2660
2752
|
b.children.length = 0;
|
|
2661
2753
|
}
|
|
2754
|
+
let tops = 0;
|
|
2755
|
+
const ids = new Map();
|
|
2756
|
+
const scopeFor = hole => {
|
|
2757
|
+
const p = engine.scope;
|
|
2758
|
+
return {
|
|
2759
|
+
id: undefined,
|
|
2760
|
+
p,
|
|
2761
|
+
i: p ? p.c++ : tops++,
|
|
2762
|
+
n: null,
|
|
2763
|
+
c: 0,
|
|
2764
|
+
h: hole
|
|
2765
|
+
};
|
|
2766
|
+
};
|
|
2767
|
+
const scopeId = s => s.id !== undefined ? s.id : s.id = s.p ? scopeId(s.p) + "." + s.i : String(s.i);
|
|
2768
|
+
const collect = (v, id, forget) => (v.occ || (v.occ = new Map())).set(id, forget);
|
|
2769
|
+
function rescope(b, hole, fn) {
|
|
2770
|
+
const prevScope = engine.scope;
|
|
2771
|
+
const prevVisit = engine.visit;
|
|
2772
|
+
engine.scope = {
|
|
2773
|
+
id: scopeId(b.scope),
|
|
2774
|
+
p: null,
|
|
2775
|
+
i: 0,
|
|
2776
|
+
n: null,
|
|
2777
|
+
c: 0,
|
|
2778
|
+
h: hole
|
|
2779
|
+
};
|
|
2780
|
+
const visit = engine.visit = {
|
|
2781
|
+
occ: null
|
|
2782
|
+
};
|
|
2783
|
+
try {
|
|
2784
|
+
return fn();
|
|
2785
|
+
} finally {
|
|
2786
|
+
engine.scope = prevScope;
|
|
2787
|
+
engine.visit = prevVisit;
|
|
2788
|
+
b.next = visit.occ;
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
function settleOccurrences(b) {
|
|
2792
|
+
const occ = b.next;
|
|
2793
|
+
b.next = null;
|
|
2794
|
+
if (b.occ) for (const [id, forget] of b.occ) if (!occ || !occ.has(id)) forget();
|
|
2795
|
+
b.occ = occ;
|
|
2796
|
+
if (occ) for (let a = b.up; a; a = a.up) for (const [id, forget] of occ) collect(a, id, forget);
|
|
2797
|
+
}
|
|
2798
|
+
function leave(b, parent, scope, visit) {
|
|
2799
|
+
engine.parent = parent;
|
|
2800
|
+
engine.scope = scope;
|
|
2801
|
+
engine.visit = visit;
|
|
2802
|
+
if (visit && b.occ) for (const [id, forget] of b.occ) collect(visit, id, forget);
|
|
2803
|
+
}
|
|
2662
2804
|
const engine = {
|
|
2663
2805
|
suppressed: 0,
|
|
2664
2806
|
sweeping: false,
|
|
2665
2807
|
parent: null,
|
|
2666
|
-
recordStamp: 0,
|
|
2667
2808
|
gateHit: false,
|
|
2809
|
+
sweptOwners: false,
|
|
2810
|
+
scope: null,
|
|
2811
|
+
visit: null,
|
|
2812
|
+
dry: false,
|
|
2813
|
+
slotId(prop, given) {
|
|
2814
|
+
const s = engine.scope;
|
|
2815
|
+
if (!s) return given;
|
|
2816
|
+
const n = s.n || (s.n = Object.create(null));
|
|
2817
|
+
const i = n[prop] || 0;
|
|
2818
|
+
n[prop] = i + 1;
|
|
2819
|
+
const sid = scopeId(s);
|
|
2820
|
+
const at = sid + "." + i + "\0" + prop;
|
|
2821
|
+
if (given !== undefined) {
|
|
2822
|
+
ids.set(at, given);
|
|
2823
|
+
return given;
|
|
2824
|
+
}
|
|
2825
|
+
return ids.get(at) || `${prop}#~${sid}.${i}`;
|
|
2826
|
+
},
|
|
2827
|
+
seen(id, forget) {
|
|
2828
|
+
if (engine.visit) collect(engine.visit, id, forget);
|
|
2829
|
+
},
|
|
2830
|
+
nest(hole) {
|
|
2831
|
+
const s = engine.scope;
|
|
2832
|
+
if (!s || s.h === hole || hole.$lhSkip || inScope && !inScope()) return undefined;
|
|
2833
|
+
engine.scope = scopeFor(hole);
|
|
2834
|
+
return s;
|
|
2835
|
+
},
|
|
2668
2836
|
content(hole) {
|
|
2669
2837
|
if (hole.$lhSuppress) {
|
|
2670
2838
|
const r = {
|
|
@@ -2672,10 +2840,12 @@ function createLiveHoles(sink, scoped) {
|
|
|
2672
2840
|
h: [],
|
|
2673
2841
|
p: []
|
|
2674
2842
|
};
|
|
2675
|
-
|
|
2676
|
-
|
|
2843
|
+
let rows = null;
|
|
2844
|
+
const b = hole.$lhBinding;
|
|
2845
|
+
const run = () => {
|
|
2846
|
+
engine.suppressed++;
|
|
2677
2847
|
try {
|
|
2678
|
-
|
|
2848
|
+
rows = resolveValue(holeValue(hole), r);
|
|
2679
2849
|
} catch (err) {
|
|
2680
2850
|
const wrap = buildAsyncWrap(err, hole);
|
|
2681
2851
|
if (wrap) {
|
|
@@ -2683,20 +2853,21 @@ function createLiveHoles(sink, scoped) {
|
|
|
2683
2853
|
r.p.push(wrap.p);
|
|
2684
2854
|
r.t.push("");
|
|
2685
2855
|
}
|
|
2856
|
+
} finally {
|
|
2857
|
+
engine.suppressed--;
|
|
2686
2858
|
}
|
|
2687
|
-
}
|
|
2688
|
-
|
|
2689
|
-
}
|
|
2690
|
-
const b = hole.$lhBinding;
|
|
2859
|
+
};
|
|
2860
|
+
b && !engine.sweeping ? rescope(b, hole, run) : run();
|
|
2691
2861
|
if (b && !b.closed && !r.h.length && !engine.sweeping) {
|
|
2692
2862
|
b.last = stripMarkers(r.t[0]);
|
|
2863
|
+
b.rows = rows;
|
|
2864
|
+
settleOccurrences(b);
|
|
2693
2865
|
}
|
|
2694
2866
|
return r.h.length ? r : r.t[0];
|
|
2695
2867
|
}
|
|
2696
2868
|
if (engine.suppressed || engine.sweeping) return null;
|
|
2697
2869
|
if (hole.$lhSkip) return null;
|
|
2698
2870
|
if (inScope && !inScope()) return null;
|
|
2699
|
-
const recordsBefore = engine.recordStamp;
|
|
2700
2871
|
const ownersBefore = stamp();
|
|
2701
2872
|
const owner = getOwner();
|
|
2702
2873
|
const holeCtx = sharedConfig.context;
|
|
@@ -2704,25 +2875,31 @@ function createLiveHoles(sink, scoped) {
|
|
|
2704
2875
|
key: null,
|
|
2705
2876
|
children: [],
|
|
2706
2877
|
last: null,
|
|
2878
|
+
rows: null,
|
|
2879
|
+
fn: hole.$fn,
|
|
2707
2880
|
closed: false,
|
|
2881
|
+
scope: undefined,
|
|
2882
|
+
occ: null,
|
|
2883
|
+
next: null,
|
|
2884
|
+
up: engine.parent,
|
|
2708
2885
|
sweep() {
|
|
2709
2886
|
if (b.closed) return;
|
|
2710
2887
|
const prevSweeping = engine.sweeping;
|
|
2711
2888
|
engine.sweeping = true;
|
|
2712
|
-
engine.
|
|
2713
|
-
const sweepOwnersBefore = stamp();
|
|
2889
|
+
engine.dry = b.last === null;
|
|
2714
2890
|
let res;
|
|
2715
2891
|
try {
|
|
2716
|
-
res = swept(owner, holeCtx, () => resolveHoleValue(hole));
|
|
2892
|
+
res = rescope(b, hole, () => swept(owner, holeCtx, () => resolveHoleValue(hole)));
|
|
2717
2893
|
} catch (err) {
|
|
2718
2894
|
b.closed = true;
|
|
2719
2895
|
sink.closeBinding(b.key);
|
|
2720
|
-
sink.error(b.key, wireErrorMessage(err));
|
|
2896
|
+
sink.error(b.key, wireErrorMessage(err, errorScope));
|
|
2721
2897
|
return;
|
|
2722
2898
|
} finally {
|
|
2723
2899
|
engine.sweeping = prevSweeping;
|
|
2900
|
+
engine.dry = false;
|
|
2724
2901
|
}
|
|
2725
|
-
if (engine.
|
|
2902
|
+
if (engine.sweptOwners && res.h.length) {
|
|
2726
2903
|
b.closed = true;
|
|
2727
2904
|
sink.closeBinding(b.key);
|
|
2728
2905
|
return;
|
|
@@ -2730,29 +2907,38 @@ function createLiveHoles(sink, scoped) {
|
|
|
2730
2907
|
if (res.h.length) return;
|
|
2731
2908
|
const html = res.t[0];
|
|
2732
2909
|
if (b.last === null || html === b.last) return;
|
|
2910
|
+
const ops = b.rows && res.rows && rowOps(b.rows, res.rows);
|
|
2733
2911
|
b.last = html;
|
|
2912
|
+
if (ops && !ops.r.length && ops.n === b.rows.length) return;
|
|
2913
|
+
b.rows = res.rows;
|
|
2734
2914
|
closeChildren(b);
|
|
2735
|
-
|
|
2915
|
+
settleOccurrences(b);
|
|
2916
|
+
sink.hole(b.key, html, ops && !html.includes("<!--slot:") ? ops : null);
|
|
2736
2917
|
}
|
|
2737
2918
|
};
|
|
2738
2919
|
if (engine.parent) engine.parent.children.push(b);
|
|
2739
2920
|
const prevParent = engine.parent;
|
|
2921
|
+
const prevScope = engine.scope;
|
|
2922
|
+
const prevVisit = engine.visit;
|
|
2923
|
+
const scope = b.scope = scopeFor(hole);
|
|
2740
2924
|
engine.parent = b;
|
|
2925
|
+
engine.scope = scope;
|
|
2926
|
+
engine.visit = b;
|
|
2741
2927
|
let value;
|
|
2742
2928
|
let escalated = null;
|
|
2743
2929
|
try {
|
|
2744
|
-
value = hole
|
|
2930
|
+
value = holeValue(hole);
|
|
2745
2931
|
} catch (err) {
|
|
2746
2932
|
const wrap = buildAsyncWrap(err, hole);
|
|
2747
2933
|
if (!wrap) {
|
|
2748
|
-
|
|
2934
|
+
leave(b, prevParent, prevScope, prevVisit);
|
|
2749
2935
|
closeChildren(b);
|
|
2750
2936
|
return "";
|
|
2751
2937
|
}
|
|
2752
2938
|
escalated = wrap;
|
|
2753
2939
|
}
|
|
2754
2940
|
if (!escalated && (typeof value === "function" && value.$lhSkip || value !== null && typeof value === "object" && value.$slot)) {
|
|
2755
|
-
|
|
2941
|
+
leave(b, prevParent, prevScope, prevVisit);
|
|
2756
2942
|
const r = {
|
|
2757
2943
|
t: [""],
|
|
2758
2944
|
h: [],
|
|
@@ -2767,6 +2953,7 @@ function createLiveHoles(sink, scoped) {
|
|
|
2767
2953
|
return r.h.length ? r : r.t[0];
|
|
2768
2954
|
}
|
|
2769
2955
|
let res;
|
|
2956
|
+
let rows = null;
|
|
2770
2957
|
if (escalated) {
|
|
2771
2958
|
closeChildren(b);
|
|
2772
2959
|
escalated.fn.$lhSuppress = true;
|
|
@@ -2783,23 +2970,25 @@ function createLiveHoles(sink, scoped) {
|
|
|
2783
2970
|
p: []
|
|
2784
2971
|
};
|
|
2785
2972
|
try {
|
|
2786
|
-
|
|
2973
|
+
rows = resolveValue(value, res);
|
|
2787
2974
|
} catch (_) {
|
|
2788
|
-
|
|
2975
|
+
leave(b, prevParent, prevScope, prevVisit);
|
|
2789
2976
|
closeChildren(b);
|
|
2790
2977
|
return "";
|
|
2791
2978
|
}
|
|
2792
2979
|
}
|
|
2793
|
-
|
|
2794
|
-
if (
|
|
2980
|
+
leave(b, prevParent, prevScope, prevVisit);
|
|
2981
|
+
if (stamp() !== ownersBefore) {
|
|
2795
2982
|
return res.h.length ? res : res.t[0];
|
|
2796
2983
|
}
|
|
2984
|
+
if (!res.h.length && settled && settled()) return res.t[0];
|
|
2797
2985
|
const id = nextId++;
|
|
2798
2986
|
const key = b.key = "lh:" + id;
|
|
2799
2987
|
const open = `<!--lh:${id}-->`;
|
|
2800
2988
|
const close = `<!--lh:/${id}-->`;
|
|
2801
2989
|
if (!res.h.length) {
|
|
2802
2990
|
b.last = stripMarkers(res.t[0]);
|
|
2991
|
+
b.rows = rows;
|
|
2803
2992
|
sink.openBinding(key, b);
|
|
2804
2993
|
return open + res.t[0] + close;
|
|
2805
2994
|
}
|
|
@@ -2817,7 +3006,7 @@ function createLiveHoles(sink, scoped) {
|
|
|
2817
3006
|
return nextId++;
|
|
2818
3007
|
},
|
|
2819
3008
|
active() {
|
|
2820
|
-
return !inScope || inScope();
|
|
3009
|
+
return (!inScope || inScope()) && !(settled && settled());
|
|
2821
3010
|
},
|
|
2822
3011
|
attr(cap) {
|
|
2823
3012
|
const owner = getOwner();
|
|
@@ -2830,9 +3019,10 @@ function createLiveHoles(sink, scoped) {
|
|
|
2830
3019
|
sweep() {
|
|
2831
3020
|
if (b.closed) return;
|
|
2832
3021
|
const prevSweeping = engine.sweeping;
|
|
3022
|
+
const prevScope = engine.scope;
|
|
2833
3023
|
engine.sweeping = true;
|
|
3024
|
+
engine.scope = null;
|
|
2834
3025
|
engine.gateHit = false;
|
|
2835
|
-
const sweepOwnersBefore = stamp();
|
|
2836
3026
|
let html = "";
|
|
2837
3027
|
try {
|
|
2838
3028
|
let group = null;
|
|
@@ -2859,15 +3049,21 @@ function createLiveHoles(sink, scoped) {
|
|
|
2859
3049
|
};
|
|
2860
3050
|
swept(owner, holeCtx, run);
|
|
2861
3051
|
} catch (err) {
|
|
2862
|
-
if (ssrHandleError(err, true))
|
|
3052
|
+
if (ssrHandleError(err, true)) {
|
|
3053
|
+
if (!engine.sweptOwners) return;
|
|
3054
|
+
b.closed = true;
|
|
3055
|
+
sink.closeBinding(b.key);
|
|
3056
|
+
return;
|
|
3057
|
+
}
|
|
2863
3058
|
b.closed = true;
|
|
2864
3059
|
sink.closeBinding(b.key);
|
|
2865
|
-
sink.error("lha:" + cap.id, wireErrorMessage(err));
|
|
3060
|
+
sink.error("lha:" + cap.id, wireErrorMessage(err, errorScope));
|
|
2866
3061
|
return;
|
|
2867
3062
|
} finally {
|
|
2868
3063
|
engine.sweeping = prevSweeping;
|
|
3064
|
+
engine.scope = prevScope;
|
|
2869
3065
|
}
|
|
2870
|
-
if (engine.gateHit
|
|
3066
|
+
if (engine.gateHit) {
|
|
2871
3067
|
b.closed = true;
|
|
2872
3068
|
sink.closeBinding(b.key);
|
|
2873
3069
|
return;
|
|
@@ -2932,7 +3128,9 @@ function ssr(t) {
|
|
|
2932
3128
|
cap = {
|
|
2933
3129
|
id,
|
|
2934
3130
|
parts: [prefix],
|
|
2935
|
-
base: prefix
|
|
3131
|
+
base: prefix,
|
|
3132
|
+
at: lastOpen.seg,
|
|
3133
|
+
inject
|
|
2936
3134
|
};
|
|
2937
3135
|
return true;
|
|
2938
3136
|
};
|
|
@@ -2981,7 +3179,10 @@ function ssr(t) {
|
|
|
2981
3179
|
});
|
|
2982
3180
|
}
|
|
2983
3181
|
} else {
|
|
2984
|
-
cap
|
|
3182
|
+
if (cap) {
|
|
3183
|
+
result.t[cap.at] = result.t[cap.at].replace(cap.inject, "");
|
|
3184
|
+
cap = null;
|
|
3185
|
+
}
|
|
2985
3186
|
result.h.push(ssrGroupSlot(lastGroupVal.fn, lastGroupIdx++));
|
|
2986
3187
|
result.p.push(lastGroupVal.p);
|
|
2987
3188
|
result.t.push("");
|
|
@@ -3043,12 +3244,15 @@ function ssr(t) {
|
|
|
3043
3244
|
f: hole
|
|
3044
3245
|
});
|
|
3045
3246
|
} else {
|
|
3247
|
+
result.t[cap.at] = result.t[cap.at].replace(cap.inject, "");
|
|
3046
3248
|
cap = null;
|
|
3047
3249
|
}
|
|
3048
3250
|
}
|
|
3049
3251
|
} else {
|
|
3050
3252
|
const capturing = live && !hp.pos[i - 1] && captureStart();
|
|
3253
|
+
const scope = live && hp.pos[i - 1] && live.nest(hole);
|
|
3051
3254
|
const r = tryResolveFunctionHole(hole);
|
|
3255
|
+
if (scope) live.scope = scope;
|
|
3052
3256
|
if (typeof r === "string") {
|
|
3053
3257
|
s += r;
|
|
3054
3258
|
if (capturing) {
|
|
@@ -3058,7 +3262,10 @@ function ssr(t) {
|
|
|
3058
3262
|
});
|
|
3059
3263
|
}
|
|
3060
3264
|
} else {
|
|
3061
|
-
if (capturing)
|
|
3265
|
+
if (capturing) {
|
|
3266
|
+
s = s.replace(cap.inject, "");
|
|
3267
|
+
cap = null;
|
|
3268
|
+
}
|
|
3062
3269
|
result = {
|
|
3063
3270
|
t: [s],
|
|
3064
3271
|
h: [],
|
|
@@ -3122,14 +3329,12 @@ function ssrClassName(value) {
|
|
|
3122
3329
|
if (typeof value === "number") return "" + value;
|
|
3123
3330
|
if (!value) return "";
|
|
3124
3331
|
if (typeof value === "string") return escape(value, true);
|
|
3125
|
-
if (isSlotValue(value)) return "";
|
|
3126
3332
|
value = classListToObject(value);
|
|
3127
3333
|
let classKeys = Object.keys(value),
|
|
3128
3334
|
result = "";
|
|
3129
3335
|
for (let i = 0, len = classKeys.length; i < len; i++) {
|
|
3130
3336
|
const key = classKeys[i];
|
|
3131
|
-
|
|
3132
|
-
if (isSlotValue(classValue)) classValue = slotValueInline();
|
|
3337
|
+
const classValue = value[key];
|
|
3133
3338
|
if (!key || key === "undefined" || !classValue) continue;
|
|
3134
3339
|
result && (result += " ");
|
|
3135
3340
|
result += escape(key, true);
|
|
@@ -3139,13 +3344,11 @@ function ssrClassName(value) {
|
|
|
3139
3344
|
function ssrStyle(value) {
|
|
3140
3345
|
if (!value) return "";
|
|
3141
3346
|
if (typeof value === "string") return escape(value, true);
|
|
3142
|
-
if (isSlotValue(value)) return "";
|
|
3143
3347
|
let result = "";
|
|
3144
3348
|
const k = Object.keys(value);
|
|
3145
3349
|
for (let i = 0; i < k.length; i++) {
|
|
3146
3350
|
const s = escape(k[i], true);
|
|
3147
|
-
|
|
3148
|
-
if (isSlotValue(v)) v = slotValueInline();
|
|
3351
|
+
const v = value[k[i]];
|
|
3149
3352
|
if (v != undefined) {
|
|
3150
3353
|
const r = escape(v, true);
|
|
3151
3354
|
if (r != undefined && r !== "undefined") {
|
|
@@ -3157,7 +3360,6 @@ function ssrStyle(value) {
|
|
|
3157
3360
|
return result;
|
|
3158
3361
|
}
|
|
3159
3362
|
function ssrStyleProperty(name, value) {
|
|
3160
|
-
if (isSlotValue(value)) value = slotValueInline();
|
|
3161
3363
|
return value != null ? name + value : "";
|
|
3162
3364
|
}
|
|
3163
3365
|
function ssrStyleProperties(...entries) {
|
|
@@ -3168,30 +3370,25 @@ function ssrStyleProperties(...entries) {
|
|
|
3168
3370
|
}
|
|
3169
3371
|
return result;
|
|
3170
3372
|
}
|
|
3171
|
-
function ssrElement(tag, props, children, needsId, skip, attrs
|
|
3373
|
+
function ssrElement(tag, props, children, needsId, skip, attrs) {
|
|
3172
3374
|
const hk = needsId ? ssrHydrationKey() : "";
|
|
3173
3375
|
if (typeof props === "function") props = props();
|
|
3174
3376
|
let sources = null;
|
|
3175
3377
|
let proxy = false;
|
|
3176
3378
|
let viewKeys = null;
|
|
3177
3379
|
let owners = null;
|
|
3178
|
-
let ownerIndex = null;
|
|
3179
3380
|
const ctx = renderConfig.context;
|
|
3180
|
-
const slots = ctx !== undefined && ctx.claims !== undefined;
|
|
3181
3381
|
const link = tag === "a" && ctx !== undefined && ctx.linkClaim !== undefined ? {} : null;
|
|
3182
3382
|
if (Array.isArray(props)) {
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
if (slots) ownerIndex = [];
|
|
3193
|
-
collectSpreadSources(tag, props, viewKeys, owners, slots, ownerIndex);
|
|
3194
|
-
}
|
|
3383
|
+
let i = 0;
|
|
3384
|
+
for (; i < props.length; i++) {
|
|
3385
|
+
const s = props[i];
|
|
3386
|
+
if (s == null || typeof s === "function" || $PROXY in s) break;
|
|
3387
|
+
}
|
|
3388
|
+
if (i === props.length) sources = props;else {
|
|
3389
|
+
viewKeys = [];
|
|
3390
|
+
owners = [];
|
|
3391
|
+
collectSpreadSources(props, viewKeys, owners);
|
|
3195
3392
|
}
|
|
3196
3393
|
} else if (props == null) {
|
|
3197
3394
|
props = {};
|
|
@@ -3201,13 +3398,10 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3201
3398
|
owners = [];
|
|
3202
3399
|
sourceOwners(props, viewKeys, owners);
|
|
3203
3400
|
} else proxy = true;
|
|
3204
|
-
} else if (slots && props.$slot === true) {
|
|
3205
|
-
props = slotSpreadSource();
|
|
3206
3401
|
}
|
|
3207
3402
|
const info = tagInfo(tag);
|
|
3208
3403
|
const skipChildren = info.isVoid;
|
|
3209
3404
|
let result = info.open + hk;
|
|
3210
|
-
let behaviors = null;
|
|
3211
3405
|
let childOwner = null;
|
|
3212
3406
|
const last = sources === null ? 0 : sources.length - 1;
|
|
3213
3407
|
let keysOf = null;
|
|
@@ -3242,21 +3436,9 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3242
3436
|
if (prop === undefined) continue;
|
|
3243
3437
|
}
|
|
3244
3438
|
const value = props[key];
|
|
3245
|
-
if (value == undefined)
|
|
3246
|
-
if (slots && claims !== undefined && (prop === "ref" || isEventName(prop))) behaviors = spreadBehaviorPosition(behaviors, prop, value, ctx.claims, ownerIndex !== null ? ownerIndex[i] : s, true);
|
|
3247
|
-
continue;
|
|
3248
|
-
}
|
|
3249
|
-
if (prop.startsWith("prop:")) {
|
|
3250
|
-
continue;
|
|
3251
|
-
}
|
|
3252
|
-
if (prop === "ref" || isEventName(prop)) {
|
|
3253
|
-
if (slots) behaviors = spreadBehaviorPosition(behaviors, prop, value, ctx.claims, ownerIndex !== null ? ownerIndex[i] : s, claims !== undefined);
|
|
3254
|
-
continue;
|
|
3255
|
-
}
|
|
3439
|
+
if (value == undefined || prop.startsWith("prop:") || prop === "ref" || isEventName(prop)) continue;
|
|
3256
3440
|
if (link !== null && LinkAttributes.has(prop)) link[prop] = value;
|
|
3257
|
-
if (
|
|
3258
|
-
result += spreadObjectAttribute(prop, value);
|
|
3259
|
-
} else if (prop === "style") {
|
|
3441
|
+
if (prop === "style") {
|
|
3260
3442
|
result += ` style="${ssrStyle(value)}"`;
|
|
3261
3443
|
} else if (prop === "class") {
|
|
3262
3444
|
result += ` class="${ssrClassName(value)}"`;
|
|
@@ -3267,7 +3449,6 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3267
3449
|
}
|
|
3268
3450
|
}
|
|
3269
3451
|
}
|
|
3270
|
-
if (slots && (behaviors !== null || claims !== undefined)) result += spreadBehaviorMarkers(behaviors, claims, ctx.claims);
|
|
3271
3452
|
if (attrs !== undefined) result += typeof attrs === "function" ? attrs() : attrs;
|
|
3272
3453
|
if (link !== null && link.href !== undefined) result += ssrLinkClaim(link);
|
|
3273
3454
|
if (skipChildren) return {
|
|
@@ -3287,6 +3468,13 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3287
3468
|
};
|
|
3288
3469
|
return ssr([result + ">", info.close], resolveSSRNode(children, undefined, true));
|
|
3289
3470
|
}
|
|
3471
|
+
function collectSpreadSources(props, viewKeys, owners) {
|
|
3472
|
+
for (let i = 0; i < props.length; i++) {
|
|
3473
|
+
let s = props[i];
|
|
3474
|
+
if (typeof s === "function") s = s();
|
|
3475
|
+
if (s != null) sourceOwners(s, viewKeys, owners);
|
|
3476
|
+
}
|
|
3477
|
+
}
|
|
3290
3478
|
function spreadFormAttribute(prop, info, keys, keysOf, skip) {
|
|
3291
3479
|
const defaultProp = info.formDefaults[prop];
|
|
3292
3480
|
if (defaultProp !== undefined && (skip === undefined || !skip(defaultProp))) {
|
|
@@ -3302,19 +3490,14 @@ function spreadFormAttribute(prop, info, keys, keysOf, skip) {
|
|
|
3302
3490
|
}
|
|
3303
3491
|
function ssrElementAttribute(key, value) {
|
|
3304
3492
|
if (value == undefined) return "";
|
|
3305
|
-
if (key === "style" || key === "class") {
|
|
3306
|
-
return typeof value === "object" ? slotClassOrStyle(key, value) : ` ${key}="${key === "class" ? ssrClassName(value) : ssrStyle(value)}"`;
|
|
3307
|
-
}
|
|
3308
|
-
if (isSlotValue(value)) return slotAttribute(key, value);
|
|
3493
|
+
if (key === "style" || key === "class") return ` ${key}="${key === "class" ? ssrClassName(value) : ssrStyle(value)}"`;
|
|
3309
3494
|
if (typeof value === "boolean") return value ? ` ${key}` : "";
|
|
3310
3495
|
return value === "" ? ` ${key}` : ` ${key}="${escape(value, true)}"`;
|
|
3311
3496
|
}
|
|
3312
3497
|
function ssrAttribute(key, value) {
|
|
3313
3498
|
if (typeof value === "string") return ` ${key}="${value}"`;
|
|
3314
3499
|
if (value == null || value === false) return "";
|
|
3315
|
-
if (typeof value === "object") {
|
|
3316
|
-
return isSlotValue(value) ? slotAttribute(key, value) : ` ${key}="${escape(String(value), true)}"`;
|
|
3317
|
-
}
|
|
3500
|
+
if (typeof value === "object") return ` ${key}="${escape(String(value), true)}"`;
|
|
3318
3501
|
if (typeof value === "function") return ` ${key}="${escape(String(value), true)}"`;
|
|
3319
3502
|
return value === true ? ` ${key}` : ` ${key}="${value}"`;
|
|
3320
3503
|
}
|
|
@@ -3322,232 +3505,6 @@ function ssrHydrationKey() {
|
|
|
3322
3505
|
const hk = getHydrationKey();
|
|
3323
3506
|
return hk ? ` _hk=${hk}` : "";
|
|
3324
3507
|
}
|
|
3325
|
-
const CLAIMS_STREAM = 1;
|
|
3326
|
-
const CLAIMS_DOCUMENT = 2;
|
|
3327
|
-
const SLOT_VALUE = /*#__PURE__*/Symbol.for("solid.slot-value");
|
|
3328
|
-
const SLOT_MARKER = "_s:";
|
|
3329
|
-
const SLOT_FACE_STREAM = 0;
|
|
3330
|
-
const SLOT_FACE_DATA = 1;
|
|
3331
|
-
const SLOT_FACE_MARKUP = 2;
|
|
3332
|
-
function isSlotValue(value) {
|
|
3333
|
-
return value !== null && typeof value === "object" && value[SLOT_VALUE] !== undefined;
|
|
3334
|
-
}
|
|
3335
|
-
function slotValue(occurrence, key, value, face) {
|
|
3336
|
-
const sv = {
|
|
3337
|
-
[SLOT_VALUE]: occurrence,
|
|
3338
|
-
k: key,
|
|
3339
|
-
v: value,
|
|
3340
|
-
f: face
|
|
3341
|
-
};
|
|
3342
|
-
Object.defineProperty(sv, Symbol.toPrimitive, {
|
|
3343
|
-
value: hint => slotValueString()
|
|
3344
|
-
});
|
|
3345
|
-
Object.defineProperty(sv, "toString", {
|
|
3346
|
-
value: () => slotValueString()
|
|
3347
|
-
});
|
|
3348
|
-
Object.defineProperty(sv, "w", {
|
|
3349
|
-
value: () => slotText(sv)
|
|
3350
|
-
});
|
|
3351
|
-
return sv;
|
|
3352
|
-
}
|
|
3353
|
-
function slotValueString(sv, reason) {
|
|
3354
|
-
return "";
|
|
3355
|
-
}
|
|
3356
|
-
function slotText(sv) {
|
|
3357
|
-
const v = sv.f === SLOT_FACE_DATA ? sv.v : undefined;
|
|
3358
|
-
const text = typeof v === "string" || typeof v === "number" ? escape("" + v) : "";
|
|
3359
|
-
return `<!--${SLOT_MARKER}t=${slotEntry(sv)}-->${text}<!--/${SLOT_MARKER}t-->`;
|
|
3360
|
-
}
|
|
3361
|
-
function slotValueInline(kind, sv) {
|
|
3362
|
-
return undefined;
|
|
3363
|
-
}
|
|
3364
|
-
const SLOT_KEY_UNSAFE = /[^A-Za-z0-9_.!~*'()-]/g;
|
|
3365
|
-
function encodeSlotKey(key) {
|
|
3366
|
-
return String(key).replace(SLOT_KEY_UNSAFE, c => encodeURIComponent(c));
|
|
3367
|
-
}
|
|
3368
|
-
function slotEntry(sv, name) {
|
|
3369
|
-
return `${sv[SLOT_VALUE]}:${encodeSlotKey(sv.k)}${name !== undefined ? "=" + encodeSlotKey(name) : ""}`;
|
|
3370
|
-
}
|
|
3371
|
-
function slotMarker(position, entries) {
|
|
3372
|
-
return ` ${SLOT_MARKER}${position}="${entries}"`;
|
|
3373
|
-
}
|
|
3374
|
-
function eventSlotStamp(mode) {
|
|
3375
|
-
return mode === CLAIMS_DOCUMENT ? " _hk" : "";
|
|
3376
|
-
}
|
|
3377
|
-
function slotAttribute(key, sv) {
|
|
3378
|
-
let out = "";
|
|
3379
|
-
if (sv.f === SLOT_FACE_DATA) {
|
|
3380
|
-
const v = sv.v;
|
|
3381
|
-
if (v != null && v !== false) {
|
|
3382
|
-
out = v === true || v === "" ? ` ${key}` : ` ${key}="${escape(String(v), true)}"`;
|
|
3383
|
-
}
|
|
3384
|
-
}
|
|
3385
|
-
return out + slotMarker(key, slotEntry(sv));
|
|
3386
|
-
}
|
|
3387
|
-
function slotClassOrStyle(key, value) {
|
|
3388
|
-
const isClass = key === "class";
|
|
3389
|
-
if (isSlotValue(value)) {
|
|
3390
|
-
let out = "";
|
|
3391
|
-
if (value.f === SLOT_FACE_DATA && value.v != null) {
|
|
3392
|
-
out = ` ${key}="${isClass ? ssrClassName(value.v) : ssrStyle(value.v)}"`;
|
|
3393
|
-
}
|
|
3394
|
-
return out + slotMarker(key, slotEntry(value));
|
|
3395
|
-
}
|
|
3396
|
-
if (typeof value === "object" && value !== null) {
|
|
3397
|
-
const obj = isClass ? classListToObject(value) : value;
|
|
3398
|
-
let entries = "";
|
|
3399
|
-
let inner = "";
|
|
3400
|
-
for (const name of Object.keys(obj)) {
|
|
3401
|
-
let v = obj[name];
|
|
3402
|
-
if (isSlotValue(v)) {
|
|
3403
|
-
entries += (entries ? "," : "") + slotEntry(v, name);
|
|
3404
|
-
v = v.f === SLOT_FACE_DATA ? v.v : undefined;
|
|
3405
|
-
}
|
|
3406
|
-
if (isClass) {
|
|
3407
|
-
if (!name || name === "undefined" || !v) continue;
|
|
3408
|
-
inner += (inner ? " " : "") + escape(name, true);
|
|
3409
|
-
} else if (v != undefined) {
|
|
3410
|
-
const r = escape(v, true);
|
|
3411
|
-
if (r != undefined && r !== "undefined") {
|
|
3412
|
-
inner += (inner ? ";" : "") + `${escape(name, true)}:${r}`;
|
|
3413
|
-
}
|
|
3414
|
-
}
|
|
3415
|
-
}
|
|
3416
|
-
if (entries === "") return ` ${key}="${inner}"`;
|
|
3417
|
-
return (inner ? ` ${key}="${inner}"` : "") + slotMarker(key, entries);
|
|
3418
|
-
}
|
|
3419
|
-
return ` ${key}="${isClass ? ssrClassName(value) : ssrStyle(value)}"`;
|
|
3420
|
-
}
|
|
3421
|
-
function eventPosition(prop) {
|
|
3422
|
-
return prop.slice(2).toLowerCase();
|
|
3423
|
-
}
|
|
3424
|
-
function spreadBehaviorPosition(behaviors, prop, value, mode, index, settle) {
|
|
3425
|
-
if (!isAttrName(prop)) return behaviors;
|
|
3426
|
-
const pos = prop === "ref" ? "ref" : eventPosition(prop);
|
|
3427
|
-
const entries = value == null ? "" : claimEntries(pos, value);
|
|
3428
|
-
if (!settle) {
|
|
3429
|
-
if (entries) (behaviors ||= new Map()).set(pos, entries);
|
|
3430
|
-
return behaviors;
|
|
3431
|
-
}
|
|
3432
|
-
behaviors ||= new Map();
|
|
3433
|
-
const b = behaviors.get(pos);
|
|
3434
|
-
if (b === undefined) behaviors.set(pos, {
|
|
3435
|
-
e: entries,
|
|
3436
|
-
at: index
|
|
3437
|
-
});else {
|
|
3438
|
-
b.e = entries;
|
|
3439
|
-
b.at = index;
|
|
3440
|
-
}
|
|
3441
|
-
return behaviors;
|
|
3442
|
-
}
|
|
3443
|
-
function spreadBehaviorMarkers(behaviors, claims, mode) {
|
|
3444
|
-
if (claims !== undefined) {
|
|
3445
|
-
const segments = claims();
|
|
3446
|
-
for (const k in segments) {
|
|
3447
|
-
const map = segments[k];
|
|
3448
|
-
for (const pos in map) {
|
|
3449
|
-
const value = map[pos];
|
|
3450
|
-
behaviors ||= new Map();
|
|
3451
|
-
const b = behaviors.get(pos);
|
|
3452
|
-
if (pos === "ref") {
|
|
3453
|
-
if (value == null) continue;
|
|
3454
|
-
const entries = claimEntries("ref", value);
|
|
3455
|
-
if (!entries) continue;
|
|
3456
|
-
if (b === undefined) behaviors.set("ref", {
|
|
3457
|
-
e: entries,
|
|
3458
|
-
at: -1
|
|
3459
|
-
});else b.e = b.e ? b.e + "," + entries : entries;
|
|
3460
|
-
continue;
|
|
3461
|
-
}
|
|
3462
|
-
if (b !== undefined && b.at >= +k) continue;
|
|
3463
|
-
const entries = value == null ? "" : claimEntries(pos, value);
|
|
3464
|
-
if (b === undefined) behaviors.set(pos, {
|
|
3465
|
-
e: entries,
|
|
3466
|
-
at: -1
|
|
3467
|
-
});else b.e = entries;
|
|
3468
|
-
}
|
|
3469
|
-
}
|
|
3470
|
-
}
|
|
3471
|
-
let out = "";
|
|
3472
|
-
let events = false;
|
|
3473
|
-
if (behaviors !== null) {
|
|
3474
|
-
for (const [pos, b] of behaviors) {
|
|
3475
|
-
const e = claims === undefined ? b : b.e;
|
|
3476
|
-
if (!e) continue;
|
|
3477
|
-
if (pos === "ref") out += slotMarker("ref", e);else {
|
|
3478
|
-
out += slotMarker("on:" + pos, e);
|
|
3479
|
-
events = true;
|
|
3480
|
-
}
|
|
3481
|
-
}
|
|
3482
|
-
}
|
|
3483
|
-
return events ? out + eventSlotStamp(mode) : out;
|
|
3484
|
-
}
|
|
3485
|
-
function collectSpreadSources(tag, props, viewKeys, owners, slots, ownerIndex) {
|
|
3486
|
-
for (let i = 0; i < props.length; i++) {
|
|
3487
|
-
let s = props[i];
|
|
3488
|
-
if (typeof s === "function") s = s();
|
|
3489
|
-
if (s != null) {
|
|
3490
|
-
if (slots && !($PROXY in s) && s.$slot === true) s = slotSpreadSource();
|
|
3491
|
-
if (ownerIndex === null) sourceOwners(s, viewKeys, owners);else {
|
|
3492
|
-
const ks = [];
|
|
3493
|
-
const os = [];
|
|
3494
|
-
sourceOwners(s, ks, os);
|
|
3495
|
-
for (let j = 0; j < ks.length; j++) {
|
|
3496
|
-
const at = viewKeys.indexOf(ks[j]);
|
|
3497
|
-
if (at !== -1) {
|
|
3498
|
-
viewKeys.splice(at, 1);
|
|
3499
|
-
owners.splice(at, 1);
|
|
3500
|
-
ownerIndex.splice(at, 1);
|
|
3501
|
-
}
|
|
3502
|
-
viewKeys.push(ks[j]);
|
|
3503
|
-
owners.push(os[j]);
|
|
3504
|
-
ownerIndex.push(i);
|
|
3505
|
-
}
|
|
3506
|
-
}
|
|
3507
|
-
}
|
|
3508
|
-
}
|
|
3509
|
-
}
|
|
3510
|
-
function spreadObjectAttribute(prop, value) {
|
|
3511
|
-
if (prop === "style" || prop === "class") return slotClassOrStyle(prop, value);
|
|
3512
|
-
if (!isAttrName(prop)) return "";
|
|
3513
|
-
if (value[SLOT_VALUE] !== undefined) return slotAttribute(prop, value);
|
|
3514
|
-
return ` ${prop}="${escape(value, true)}"`;
|
|
3515
|
-
}
|
|
3516
|
-
function slotSpreadSource(tag, source) {
|
|
3517
|
-
return {};
|
|
3518
|
-
}
|
|
3519
|
-
function ssrClaim(map) {
|
|
3520
|
-
const mode = sharedConfig.context && sharedConfig.context.claims;
|
|
3521
|
-
if (!mode) return "";
|
|
3522
|
-
let out = "";
|
|
3523
|
-
let events = false;
|
|
3524
|
-
for (const pos in map) {
|
|
3525
|
-
const entries = claimEntries(pos, map[pos]);
|
|
3526
|
-
if (!entries) continue;
|
|
3527
|
-
if (pos === "ref") out += slotMarker("ref", entries);else {
|
|
3528
|
-
out += slotMarker("on:" + pos, entries);
|
|
3529
|
-
events = true;
|
|
3530
|
-
}
|
|
3531
|
-
}
|
|
3532
|
-
return events ? out + eventSlotStamp(mode) : out;
|
|
3533
|
-
}
|
|
3534
|
-
function claimEntries(pos, value, mode) {
|
|
3535
|
-
if (Array.isArray(value) && pos !== "ref") {
|
|
3536
|
-
return "";
|
|
3537
|
-
}
|
|
3538
|
-
if (Array.isArray(value)) {
|
|
3539
|
-
let entries = "";
|
|
3540
|
-
for (const v of value) {
|
|
3541
|
-
const inner = claimEntries(pos, v);
|
|
3542
|
-
if (inner) entries += (entries ? "," : "") + inner;
|
|
3543
|
-
}
|
|
3544
|
-
return entries;
|
|
3545
|
-
}
|
|
3546
|
-
if (isSlotValue(value)) {
|
|
3547
|
-
return slotEntry(value);
|
|
3548
|
-
}
|
|
3549
|
-
return "";
|
|
3550
|
-
}
|
|
3551
3508
|
function ssrLinkClaim(attrs) {
|
|
3552
3509
|
const ctx = renderConfig.context;
|
|
3553
3510
|
if (ctx === undefined || ctx.linkClaim === undefined || attrs["aria-current"] != null) return "";
|
|
@@ -3673,7 +3630,6 @@ function escape(s, attr) {
|
|
|
3673
3630
|
if (!attr && t === "function") return escapeLate(s);
|
|
3674
3631
|
if (attr) {
|
|
3675
3632
|
if (s == null || t === "boolean" || t === "number") return s;
|
|
3676
|
-
if (t === "object" && s[SLOT_VALUE] !== undefined) return s;
|
|
3677
3633
|
return escape(String(s), attr);
|
|
3678
3634
|
}
|
|
3679
3635
|
return s;
|
|
@@ -3686,6 +3642,7 @@ function escapeLate(fn) {
|
|
|
3686
3642
|
if (fn.$esc) return fn;
|
|
3687
3643
|
const w = () => escape(fn());
|
|
3688
3644
|
w.$esc = true;
|
|
3645
|
+
w.$fn = fn;
|
|
3689
3646
|
if (fn.$lhSkip) w.$lhSkip = true;
|
|
3690
3647
|
if (fn.$lhSuppress) w.$lhSuppress = true;
|
|
3691
3648
|
if (fn.$lhBinding) w.$lhBinding = fn.$lhBinding;
|
|
@@ -3781,7 +3738,7 @@ function generateHydrationScript({
|
|
|
3781
3738
|
eventNames,
|
|
3782
3739
|
nonce
|
|
3783
3740
|
} = {}) {
|
|
3784
|
-
return hydrationBootstrap(eventNames,
|
|
3741
|
+
return hydrationBootstrap(eventNames, destinationNonce(nonce, "script"), false);
|
|
3785
3742
|
}
|
|
3786
3743
|
function hydrationBootstrap(eventNames = ["click", "input"], nonce, ledger) {
|
|
3787
3744
|
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-->`;
|
|
@@ -3797,10 +3754,12 @@ function allSettled(promises) {
|
|
|
3797
3754
|
return size;
|
|
3798
3755
|
});
|
|
3799
3756
|
}
|
|
3800
|
-
function
|
|
3801
|
-
if (noScripts || !context || !context.bootstrap) return
|
|
3757
|
+
function withShellEnd(html, context, renderId, nonce, noScripts) {
|
|
3758
|
+
if (noScripts || !context || !context.bootstrap) return html;
|
|
3802
3759
|
const id = JSON.stringify(renderId).replace(/</g, "\\u003C");
|
|
3803
|
-
|
|
3760
|
+
const marker = `<script${nonceAttr(nonce, "script")}>_$HY.s[${id}]=1,_$HY.sw&&_$HY.sw(${id})</script>`;
|
|
3761
|
+
const at = html.indexOf("</body>", html.length - 512);
|
|
3762
|
+
return at < 0 ? html + marker : html.slice(0, at) + marker + html.slice(at);
|
|
3804
3763
|
}
|
|
3805
3764
|
function assembleDocument(html, emittedAssets, preloadLinks, inlineStyles, scripts, nonce, headTags, onHead) {
|
|
3806
3765
|
const scriptTag = scripts ? `<script${nonceAttr(nonce, "script")}>${scripts}</script>` : "";
|
|
@@ -3992,10 +3951,6 @@ function tryResolveString(node, nested) {
|
|
|
3992
3951
|
if (node.h && node.h.length > 0) return {
|
|
3993
3952
|
merge: node
|
|
3994
3953
|
};
|
|
3995
|
-
if (node[SLOT_VALUE] !== undefined) {
|
|
3996
|
-
ssrTextTail = false;
|
|
3997
|
-
return node.w();
|
|
3998
|
-
}
|
|
3999
3954
|
if (node.t === undefined) {
|
|
4000
3955
|
return "";
|
|
4001
3956
|
}
|
|
@@ -4048,9 +4003,6 @@ function resolveSSRNode(node, result = {
|
|
|
4048
4003
|
} else if (node.t !== undefined) {
|
|
4049
4004
|
result.t[result.t.length - 1] += node.t;
|
|
4050
4005
|
ssrTextTail = false;
|
|
4051
|
-
} else if (node[SLOT_VALUE] !== undefined) {
|
|
4052
|
-
result.t[result.t.length - 1] += node.w();
|
|
4053
|
-
ssrTextTail = false;
|
|
4054
4006
|
} else ;
|
|
4055
4007
|
} else if (t === "function") {
|
|
4056
4008
|
const live = sharedConfig.context && sharedConfig.context.liveHoles;
|
|
@@ -4061,6 +4013,7 @@ function resolveSSRNode(node, result = {
|
|
|
4061
4013
|
ssrTextTail = true;
|
|
4062
4014
|
} else resolveSSRNode(liveNode, result, false, true);
|
|
4063
4015
|
} else {
|
|
4016
|
+
const scope = live && live.nest(node);
|
|
4064
4017
|
try {
|
|
4065
4018
|
resolveSSRNode(node(), result, false, true);
|
|
4066
4019
|
} catch (err) {
|
|
@@ -4072,6 +4025,8 @@ function resolveSSRNode(node, result = {
|
|
|
4072
4025
|
result.t.push("");
|
|
4073
4026
|
ssrTextTail = true;
|
|
4074
4027
|
}
|
|
4028
|
+
} finally {
|
|
4029
|
+
if (scope) live.scope = scope;
|
|
4075
4030
|
}
|
|
4076
4031
|
}
|
|
4077
4032
|
}
|
|
@@ -4469,7 +4424,7 @@ function dispatchAsInteraction(_e, fn) {
|
|
|
4469
4424
|
return fn();
|
|
4470
4425
|
}
|
|
4471
4426
|
function notSup() {
|
|
4472
|
-
throw new Error("Client-only API called on the server side. Run client-only code in
|
|
4427
|
+
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>.");
|
|
4473
4428
|
}
|
|
4474
4429
|
|
|
4475
4430
|
setContainerTraceResolver(getProjectionTrace);
|
|
@@ -4608,4 +4563,4 @@ function httpHeader(name, value, options) {
|
|
|
4608
4563
|
}
|
|
4609
4564
|
}
|
|
4610
4565
|
|
|
4611
|
-
export {
|
|
4566
|
+
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 setStatefulProperty, 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 };
|