@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.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,7 @@ 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
1621
|
let dispose;
|
|
1622
1622
|
let dead = false;
|
|
1623
1623
|
let render;
|
|
@@ -1661,7 +1661,15 @@ function renderToStream(code, options = {}) {
|
|
|
1661
1661
|
if (dispose) {
|
|
1662
1662
|
const d = dispose;
|
|
1663
1663
|
dispose = () => {};
|
|
1664
|
-
|
|
1664
|
+
try {
|
|
1665
|
+
d();
|
|
1666
|
+
} catch (err) {
|
|
1667
|
+
reportServerError(err, {
|
|
1668
|
+
kind: "render",
|
|
1669
|
+
handling: "failed"
|
|
1670
|
+
}, null, options.onError, errorScope);
|
|
1671
|
+
if (!options.onError && ambientServerErrorHook() === undefined) console.error(err);
|
|
1672
|
+
}
|
|
1665
1673
|
}
|
|
1666
1674
|
if (serializer && typeof serializer.close === "function") {
|
|
1667
1675
|
try {
|
|
@@ -1670,7 +1678,7 @@ function renderToStream(code, options = {}) {
|
|
|
1670
1678
|
reportServerError(err, {
|
|
1671
1679
|
kind: "render",
|
|
1672
1680
|
handling: "serialize"
|
|
1673
|
-
}, null, options.onError);
|
|
1681
|
+
}, null, options.onError, errorScope);
|
|
1674
1682
|
}
|
|
1675
1683
|
}
|
|
1676
1684
|
serializer = abandonedSerializer;
|
|
@@ -1687,7 +1695,7 @@ function renderToStream(code, options = {}) {
|
|
|
1687
1695
|
reportServerError(err, {
|
|
1688
1696
|
kind: "render",
|
|
1689
1697
|
handling: "failed"
|
|
1690
|
-
}, null, options.onError);
|
|
1698
|
+
}, null, options.onError, errorScope);
|
|
1691
1699
|
if (!options.onError && ambientServerErrorHook() === undefined) console.error(err);
|
|
1692
1700
|
abandon();
|
|
1693
1701
|
};
|
|
@@ -1742,6 +1750,18 @@ function renderToStream(code, options = {}) {
|
|
|
1742
1750
|
const canBatchStubs = !options.serializer && !options.sink;
|
|
1743
1751
|
let stubBatch = null;
|
|
1744
1752
|
const STUB_BATCH_KEY = "$B";
|
|
1753
|
+
let stableOrder = false;
|
|
1754
|
+
let parkedWrites = null;
|
|
1755
|
+
const byKey = (a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0;
|
|
1756
|
+
const write = (id, value) => {
|
|
1757
|
+
if (stableOrder && !dead) (parkedWrites ||= []).push([id, value]);else serializer.write(id, value);
|
|
1758
|
+
};
|
|
1759
|
+
const flushParkedWrites = () => {
|
|
1760
|
+
if (!parkedWrites) return;
|
|
1761
|
+
const writes = parkedWrites.sort(byKey);
|
|
1762
|
+
parkedWrites = null;
|
|
1763
|
+
for (let i = 0; i < writes.length; i++) serializer.write(writes[i][0], writes[i][1]);
|
|
1764
|
+
};
|
|
1745
1765
|
const flushStubBatch = () => {
|
|
1746
1766
|
if (!stubBatch) return;
|
|
1747
1767
|
const batch = stubBatch;
|
|
@@ -1752,7 +1772,9 @@ function renderToStream(code, options = {}) {
|
|
|
1752
1772
|
return;
|
|
1753
1773
|
}
|
|
1754
1774
|
const obj = {};
|
|
1755
|
-
|
|
1775
|
+
const entries = [...batch];
|
|
1776
|
+
if (stableOrder) entries.sort(byKey);
|
|
1777
|
+
for (const [id, p] of entries) obj[id] = p;
|
|
1756
1778
|
serializer.write(STUB_BATCH_KEY, obj);
|
|
1757
1779
|
pushTask(`(b=>{for(var k in b)_$HY.r[k]=b[k];delete _$HY.r["${STUB_BATCH_KEY}"]})(_$HY.r["${STUB_BATCH_KEY}"])`);
|
|
1758
1780
|
};
|
|
@@ -1824,7 +1846,7 @@ function renderToStream(code, options = {}) {
|
|
|
1824
1846
|
}
|
|
1825
1847
|
},
|
|
1826
1848
|
shell(shellHtml, meta) {
|
|
1827
|
-
buffer.write(assembleDocument(shellHtml, meta.preloads, meta.preloadLinks, meta.inlineStyles, meta.tasks.length ? meta.tasks : "", nonce, meta.head, onHead)
|
|
1849
|
+
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
1850
|
},
|
|
1829
1851
|
...options.sink
|
|
1830
1852
|
};
|
|
@@ -1852,6 +1874,7 @@ function renderToStream(code, options = {}) {
|
|
|
1852
1874
|
end();
|
|
1853
1875
|
}
|
|
1854
1876
|
flushStubBatch();
|
|
1877
|
+
flushParkedWrites();
|
|
1855
1878
|
serializer.flush();
|
|
1856
1879
|
}));
|
|
1857
1880
|
}
|
|
@@ -1860,7 +1883,7 @@ function renderToStream(code, options = {}) {
|
|
|
1860
1883
|
const pendingSerialized = new Map();
|
|
1861
1884
|
const guardedChannels = new WeakMap();
|
|
1862
1885
|
const verdictNow = error => {
|
|
1863
|
-
throw ssrSanitizeError(error, null);
|
|
1886
|
+
throw ssrSanitizeError(error, null, undefined, undefined, errorScope);
|
|
1864
1887
|
};
|
|
1865
1888
|
const borderForm = value => toBorderForm(value);
|
|
1866
1889
|
const guardIterable = iterable => ({
|
|
@@ -1992,6 +2015,7 @@ function renderToStream(code, options = {}) {
|
|
|
1992
2015
|
async: true,
|
|
1993
2016
|
nonce: options.nonce,
|
|
1994
2017
|
document: !options.sink,
|
|
2018
|
+
edges: !!options.plugins && options.plugins.some(p => p.tag === "solid/server-component"),
|
|
1995
2019
|
live: {},
|
|
1996
2020
|
registerHeadTags(tags) {
|
|
1997
2021
|
registerHeadTags(headRegistry, context, tracking,
|
|
@@ -2057,7 +2081,7 @@ function renderToStream(code, options = {}) {
|
|
|
2057
2081
|
if (p && typeof p === "object" && typeof p.then === "function") {
|
|
2058
2082
|
if (!firstFlushed && deferStream) {
|
|
2059
2083
|
blockingPromises.add(p);
|
|
2060
|
-
p.then(d =>
|
|
2084
|
+
p.then(d => write(id, d)).catch(e => write(id, e));
|
|
2061
2085
|
return;
|
|
2062
2086
|
}
|
|
2063
2087
|
p = trackSerialized(id, p);
|
|
@@ -2066,7 +2090,7 @@ function renderToStream(code, options = {}) {
|
|
|
2066
2090
|
return;
|
|
2067
2091
|
}
|
|
2068
2092
|
}
|
|
2069
|
-
|
|
2093
|
+
write(id, p);
|
|
2070
2094
|
},
|
|
2071
2095
|
escape: escape,
|
|
2072
2096
|
resolve: resolveSSRNode,
|
|
@@ -2097,11 +2121,11 @@ function renderToStream(code, options = {}) {
|
|
|
2097
2121
|
defuse(p);
|
|
2098
2122
|
registry.set(key, {
|
|
2099
2123
|
resolve: err => queue(() => queue(() => {
|
|
2100
|
-
err ? reject(ssrSanitizeError(err, null)) : resolve(true);
|
|
2124
|
+
err ? reject(ssrSanitizeError(err, null, undefined, undefined, errorScope)) : resolve(true);
|
|
2101
2125
|
queue(flushEnd);
|
|
2102
2126
|
}))
|
|
2103
2127
|
});
|
|
2104
|
-
if (canBatchStubs && !shellCompleted && !dead) (stubBatch ||= new Map()).set(key + "_fr", p);else
|
|
2128
|
+
if (canBatchStubs && !shellCompleted && !dead) (stubBatch ||= new Map()).set(key + "_fr", p);else write(key + "_fr", p);
|
|
2105
2129
|
}
|
|
2106
2130
|
return (value, error, escaped) => {
|
|
2107
2131
|
if (registry.has(key)) {
|
|
@@ -2109,7 +2133,7 @@ function renderToStream(code, options = {}) {
|
|
|
2109
2133
|
registry.delete(key);
|
|
2110
2134
|
if (error) abandonSubtree(key);
|
|
2111
2135
|
if (error && escaped) {
|
|
2112
|
-
const wire = ssrSanitizeError(error, null);
|
|
2136
|
+
const wire = ssrSanitizeError(error, null, undefined, undefined, errorScope);
|
|
2113
2137
|
const message = wire instanceof Error ? wire.message : String(wire);
|
|
2114
2138
|
if (sink.error) sink.error("", message);else if (context.live && context.live.error) context.live.error(escaped.frame, message);
|
|
2115
2139
|
}
|
|
@@ -2143,7 +2167,7 @@ function renderToStream(code, options = {}) {
|
|
|
2143
2167
|
sink.fragment(key, resolveSSRSelectValues(value !== undefined ? value : " "), {
|
|
2144
2168
|
styles,
|
|
2145
2169
|
revealGroup,
|
|
2146
|
-
error: error ? ssrSanitizeError(error, null) : error
|
|
2170
|
+
error: error ? ssrSanitizeError(error, null, undefined, undefined, errorScope) : error
|
|
2147
2171
|
});
|
|
2148
2172
|
item.resolve(error);
|
|
2149
2173
|
}
|
|
@@ -2170,6 +2194,7 @@ function renderToStream(code, options = {}) {
|
|
|
2170
2194
|
applyAssetTracking(context, tracking, manifest, noScripts);
|
|
2171
2195
|
context.failRender = failRender;
|
|
2172
2196
|
context.errorPolicy = options.onError;
|
|
2197
|
+
context._errorScope = errorScope;
|
|
2173
2198
|
context.flushed = () => firstFlushed;
|
|
2174
2199
|
context.trace = requestEvent ? traceForEvent(requestEvent) : traceFor(context, undefined);
|
|
2175
2200
|
render = timeDocument(context, context.trace);
|
|
@@ -2177,40 +2202,48 @@ function renderToStream(code, options = {}) {
|
|
|
2177
2202
|
context.writer = createHydrationWriter(context, () => !completed);
|
|
2178
2203
|
const signal = options.signal;
|
|
2179
2204
|
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
|
-
rootHoles
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2205
|
+
const endEdges = context.edges ? beginEdgesRender() : undefined;
|
|
2206
|
+
let html;
|
|
2207
|
+
try {
|
|
2208
|
+
html = createRoot(d => {
|
|
2209
|
+
dispose = () => {
|
|
2210
|
+
context.trace = undefined;
|
|
2211
|
+
if (onAbort) signal.removeEventListener("abort", onAbort);
|
|
2212
|
+
if (endEdges) endEdges();
|
|
2213
|
+
d();
|
|
2214
|
+
};
|
|
2215
|
+
rootOwner = claimRenderRoot(context);
|
|
2216
|
+
if (requestEvent) claimEventRender(requestEvent, context);
|
|
2217
|
+
let res;
|
|
2218
|
+
try {
|
|
2219
|
+
res = resolveSSRNode(escape(code()));
|
|
2220
|
+
} catch (err) {
|
|
2221
|
+
reportServerError(err, {
|
|
2222
|
+
kind: "render",
|
|
2223
|
+
handling: "failed"
|
|
2224
|
+
}, null, options.onError, errorScope);
|
|
2225
|
+
throw err;
|
|
2226
|
+
}
|
|
2227
|
+
if (!res.h.length) return res.t[0];
|
|
2228
|
+
rootHoles = [];
|
|
2229
|
+
let out = res.t[0];
|
|
2230
|
+
for (let i = 0; i < res.h.length; i++) {
|
|
2231
|
+
const id = nextHoleId++;
|
|
2232
|
+
rootHoles.push({
|
|
2233
|
+
id,
|
|
2234
|
+
fn: res.h[i]
|
|
2235
|
+
});
|
|
2236
|
+
out += `<!--rh${id}-->` + res.t[i + 1];
|
|
2237
|
+
}
|
|
2238
|
+
for (const p of res.p) blockingPromises.add(p);
|
|
2239
|
+
return out;
|
|
2240
|
+
}, {
|
|
2241
|
+
id: renderId
|
|
2242
|
+
});
|
|
2243
|
+
} catch (err) {
|
|
2244
|
+
if (endEdges) endEdges();
|
|
2245
|
+
throw err;
|
|
2246
|
+
}
|
|
2214
2247
|
if (onAbort) {
|
|
2215
2248
|
if (signal.aborted) onAbort();else signal.addEventListener("abort", onAbort, {
|
|
2216
2249
|
once: true
|
|
@@ -2289,21 +2322,30 @@ function renderToStream(code, options = {}) {
|
|
|
2289
2322
|
let lastBlockingSize = -1;
|
|
2290
2323
|
let lastRegistrySize = -1;
|
|
2291
2324
|
let drainTurn = 0;
|
|
2325
|
+
let graced = false;
|
|
2292
2326
|
const scheduleFlush = (fn, awaited) => {
|
|
2293
2327
|
const attempt = () => {
|
|
2294
|
-
flushStubBatch();
|
|
2328
|
+
if (!stableOrder) flushStubBatch();
|
|
2295
2329
|
if (registry.size !== lastRegistrySize || drainTurn++ < MIN_DRAIN_TURNS) {
|
|
2296
2330
|
if (registry.size !== lastRegistrySize) drainTurn = 0;
|
|
2297
2331
|
lastRegistrySize = registry.size;
|
|
2298
2332
|
queue(attempt);
|
|
2299
2333
|
return;
|
|
2300
2334
|
}
|
|
2335
|
+
if (!graced && registry.size) {
|
|
2336
|
+
graced = true;
|
|
2337
|
+
lastRegistrySize = -1;
|
|
2338
|
+
drainTurn = 0;
|
|
2339
|
+
deferFlush(attempt);
|
|
2340
|
+
return;
|
|
2341
|
+
}
|
|
2301
2342
|
fn();
|
|
2302
2343
|
};
|
|
2303
2344
|
const progressed = awaited !== lastBlockingSize;
|
|
2304
2345
|
lastBlockingSize = awaited;
|
|
2305
2346
|
lastRegistrySize = -1;
|
|
2306
2347
|
drainTurn = 0;
|
|
2348
|
+
graced = false;
|
|
2307
2349
|
progressed ? queue(attempt) : setTimeout(attempt);
|
|
2308
2350
|
};
|
|
2309
2351
|
let cachedReadable;
|
|
@@ -2370,6 +2412,7 @@ function renderToStream(code, options = {}) {
|
|
|
2370
2412
|
};
|
|
2371
2413
|
return {
|
|
2372
2414
|
then(onFulfilled, onRejected) {
|
|
2415
|
+
if (canBatchStubs) stableOrder = true;
|
|
2373
2416
|
const freezeHead = () => {
|
|
2374
2417
|
if (requestEvent && requestEvent.response) commitResponseStub(requestEvent.response, {
|
|
2375
2418
|
event: requestEvent
|
|
@@ -2468,7 +2511,7 @@ function HydrationScript(props) {
|
|
|
2468
2511
|
nonce: sharedConfig.context && sharedConfig.context.nonce,
|
|
2469
2512
|
...props
|
|
2470
2513
|
};
|
|
2471
|
-
return ssr(hydrationBootstrap(eventNames,
|
|
2514
|
+
return ssr(hydrationBootstrap(eventNames, destinationNonce(nonce, "script"), true));
|
|
2472
2515
|
}
|
|
2473
2516
|
function ssrGroup(fn, n) {
|
|
2474
2517
|
fn.$g = n;
|
|
@@ -2557,8 +2600,8 @@ function ssrGroupSlot(fn, idx) {
|
|
|
2557
2600
|
}
|
|
2558
2601
|
};
|
|
2559
2602
|
}
|
|
2560
|
-
function wireErrorMessage(err) {
|
|
2561
|
-
const wire = ssrSanitizeError(err, null);
|
|
2603
|
+
function wireErrorMessage(err, scope) {
|
|
2604
|
+
const wire = ssrSanitizeError(err, null, undefined, undefined, scope);
|
|
2562
2605
|
return String(wire && wire.message || wire);
|
|
2563
2606
|
}
|
|
2564
2607
|
const holePositionCache = new WeakMap();
|
|
@@ -2620,7 +2663,7 @@ function holeContentPositions(t) {
|
|
|
2620
2663
|
holePositionCache.set(t, cached);
|
|
2621
2664
|
return cached;
|
|
2622
2665
|
}
|
|
2623
|
-
function createLiveHoles(sink, scoped) {
|
|
2666
|
+
function createLiveHoles(sink, scoped, settled, errorScope) {
|
|
2624
2667
|
let nextId = 0;
|
|
2625
2668
|
const stamp = typeof creationStamp === "function" ? creationStamp : () => 0;
|
|
2626
2669
|
const inScope = scoped && typeof inServerComponentScope === "function" ? inServerComponentScope : null;
|
|
@@ -2628,20 +2671,70 @@ function createLiveHoles(sink, scoped) {
|
|
|
2628
2671
|
const swept = (owner, ctx, fn) => {
|
|
2629
2672
|
const prev = sharedConfig.context;
|
|
2630
2673
|
sharedConfig.context = ctx;
|
|
2674
|
+
let dispose;
|
|
2675
|
+
let before;
|
|
2676
|
+
const run = () => createRoot(d => {
|
|
2677
|
+
dispose = d;
|
|
2678
|
+
before = stamp();
|
|
2679
|
+
return fn();
|
|
2680
|
+
}, {
|
|
2681
|
+
transparent: true
|
|
2682
|
+
});
|
|
2631
2683
|
try {
|
|
2632
|
-
return owner ? runWithOwner(owner,
|
|
2684
|
+
return owner ? runWithOwner(owner, run) : run();
|
|
2633
2685
|
} finally {
|
|
2634
2686
|
sharedConfig.context = prev;
|
|
2687
|
+
engine.sweptOwners = before !== undefined && stamp() !== before;
|
|
2688
|
+
if (dispose) dispose();
|
|
2635
2689
|
}
|
|
2636
2690
|
};
|
|
2691
|
+
const stripRow = html => html.replace(/<!--lh:\/?\d+-->| data-lha="\d+"|<!--lr-->/g, "");
|
|
2692
|
+
const rowsOf = v => Array.isArray(v) && v.$rows ? v : null;
|
|
2693
|
+
function holeValue(hole) {
|
|
2694
|
+
const b = hole.$lhBinding;
|
|
2695
|
+
if (b) {
|
|
2696
|
+
const v = hole();
|
|
2697
|
+
return b.fn && rowsOf(b.fn()) || v;
|
|
2698
|
+
}
|
|
2699
|
+
if (!hole.$fn) return hole();
|
|
2700
|
+
const v = hole.$fn();
|
|
2701
|
+
return rowsOf(v) || escape(v);
|
|
2702
|
+
}
|
|
2703
|
+
function resolveValue(value, res) {
|
|
2704
|
+
if (!Array.isArray(value) || !value.$rows) {
|
|
2705
|
+
resolveSSRNode(value, res);
|
|
2706
|
+
return null;
|
|
2707
|
+
}
|
|
2708
|
+
let rows = [];
|
|
2709
|
+
for (const row of value) {
|
|
2710
|
+
const r = resolveSSRNode(escape(row));
|
|
2711
|
+
res.t[res.t.length - 1] += "<!--lr-->" + r.t[0];
|
|
2712
|
+
if (r.h.length) {
|
|
2713
|
+
res.t.push(...r.t.slice(1));
|
|
2714
|
+
res.h.push(...r.h);
|
|
2715
|
+
res.p.push(...r.p);
|
|
2716
|
+
rows = null;
|
|
2717
|
+
} else if (rows) rows.push(engine.sweeping ? r.t[0] : stripRow(r.t[0]));
|
|
2718
|
+
}
|
|
2719
|
+
return rows;
|
|
2720
|
+
}
|
|
2721
|
+
function rowOps(last, rows) {
|
|
2722
|
+
const ops = [];
|
|
2723
|
+
for (let i = 0; i < rows.length; i++) if (i >= last.length || rows[i] !== last[i]) ops.push([i, rows[i]]);
|
|
2724
|
+
return ops.length < rows.length ? {
|
|
2725
|
+
n: rows.length,
|
|
2726
|
+
r: ops
|
|
2727
|
+
} : null;
|
|
2728
|
+
}
|
|
2637
2729
|
function resolveHoleValue(hole) {
|
|
2638
2730
|
const result = {
|
|
2639
2731
|
t: [""],
|
|
2640
2732
|
h: [],
|
|
2641
|
-
p: []
|
|
2733
|
+
p: [],
|
|
2734
|
+
rows: null
|
|
2642
2735
|
};
|
|
2643
2736
|
try {
|
|
2644
|
-
|
|
2737
|
+
result.rows = resolveValue(holeValue(hole), result);
|
|
2645
2738
|
} catch (err) {
|
|
2646
2739
|
const wrap = buildAsyncWrap(err, hole);
|
|
2647
2740
|
if (!wrap) throw err;
|
|
@@ -2659,12 +2752,88 @@ function createLiveHoles(sink, scoped) {
|
|
|
2659
2752
|
}
|
|
2660
2753
|
b.children.length = 0;
|
|
2661
2754
|
}
|
|
2755
|
+
let tops = 0;
|
|
2756
|
+
const ids = new Map();
|
|
2757
|
+
const scopeFor = hole => {
|
|
2758
|
+
const p = engine.scope;
|
|
2759
|
+
return {
|
|
2760
|
+
id: undefined,
|
|
2761
|
+
p,
|
|
2762
|
+
i: p ? p.c++ : tops++,
|
|
2763
|
+
n: null,
|
|
2764
|
+
c: 0,
|
|
2765
|
+
h: hole
|
|
2766
|
+
};
|
|
2767
|
+
};
|
|
2768
|
+
const scopeId = s => s.id !== undefined ? s.id : s.id = s.p ? scopeId(s.p) + "." + s.i : String(s.i);
|
|
2769
|
+
const collect = (v, id, forget) => (v.occ || (v.occ = new Map())).set(id, forget);
|
|
2770
|
+
function rescope(b, hole, fn) {
|
|
2771
|
+
const prevScope = engine.scope;
|
|
2772
|
+
const prevVisit = engine.visit;
|
|
2773
|
+
engine.scope = {
|
|
2774
|
+
id: scopeId(b.scope),
|
|
2775
|
+
p: null,
|
|
2776
|
+
i: 0,
|
|
2777
|
+
n: null,
|
|
2778
|
+
c: 0,
|
|
2779
|
+
h: hole
|
|
2780
|
+
};
|
|
2781
|
+
const visit = engine.visit = {
|
|
2782
|
+
occ: null
|
|
2783
|
+
};
|
|
2784
|
+
try {
|
|
2785
|
+
return fn();
|
|
2786
|
+
} finally {
|
|
2787
|
+
engine.scope = prevScope;
|
|
2788
|
+
engine.visit = prevVisit;
|
|
2789
|
+
b.next = visit.occ;
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
function settleOccurrences(b) {
|
|
2793
|
+
const occ = b.next;
|
|
2794
|
+
b.next = null;
|
|
2795
|
+
if (b.occ) for (const [id, forget] of b.occ) if (!occ || !occ.has(id)) forget();
|
|
2796
|
+
b.occ = occ;
|
|
2797
|
+
if (occ) for (let a = b.up; a; a = a.up) for (const [id, forget] of occ) collect(a, id, forget);
|
|
2798
|
+
}
|
|
2799
|
+
function leave(b, parent, scope, visit) {
|
|
2800
|
+
engine.parent = parent;
|
|
2801
|
+
engine.scope = scope;
|
|
2802
|
+
engine.visit = visit;
|
|
2803
|
+
if (visit && b.occ) for (const [id, forget] of b.occ) collect(visit, id, forget);
|
|
2804
|
+
}
|
|
2662
2805
|
const engine = {
|
|
2663
2806
|
suppressed: 0,
|
|
2664
2807
|
sweeping: false,
|
|
2665
2808
|
parent: null,
|
|
2666
|
-
recordStamp: 0,
|
|
2667
2809
|
gateHit: false,
|
|
2810
|
+
sweptOwners: false,
|
|
2811
|
+
scope: null,
|
|
2812
|
+
visit: null,
|
|
2813
|
+
dry: false,
|
|
2814
|
+
slotId(prop, given) {
|
|
2815
|
+
const s = engine.scope;
|
|
2816
|
+
if (!s) return given;
|
|
2817
|
+
const n = s.n || (s.n = Object.create(null));
|
|
2818
|
+
const i = n[prop] || 0;
|
|
2819
|
+
n[prop] = i + 1;
|
|
2820
|
+
const sid = scopeId(s);
|
|
2821
|
+
const at = sid + "." + i + "\0" + prop;
|
|
2822
|
+
if (given !== undefined) {
|
|
2823
|
+
ids.set(at, given);
|
|
2824
|
+
return given;
|
|
2825
|
+
}
|
|
2826
|
+
return ids.get(at) || `${prop}#~${sid}.${i}`;
|
|
2827
|
+
},
|
|
2828
|
+
seen(id, forget) {
|
|
2829
|
+
if (engine.visit) collect(engine.visit, id, forget);
|
|
2830
|
+
},
|
|
2831
|
+
nest(hole) {
|
|
2832
|
+
const s = engine.scope;
|
|
2833
|
+
if (!s || s.h === hole || hole.$lhSkip || inScope && !inScope()) return undefined;
|
|
2834
|
+
engine.scope = scopeFor(hole);
|
|
2835
|
+
return s;
|
|
2836
|
+
},
|
|
2668
2837
|
content(hole) {
|
|
2669
2838
|
if (hole.$lhSuppress) {
|
|
2670
2839
|
const r = {
|
|
@@ -2672,10 +2841,12 @@ function createLiveHoles(sink, scoped) {
|
|
|
2672
2841
|
h: [],
|
|
2673
2842
|
p: []
|
|
2674
2843
|
};
|
|
2675
|
-
|
|
2676
|
-
|
|
2844
|
+
let rows = null;
|
|
2845
|
+
const b = hole.$lhBinding;
|
|
2846
|
+
const run = () => {
|
|
2847
|
+
engine.suppressed++;
|
|
2677
2848
|
try {
|
|
2678
|
-
|
|
2849
|
+
rows = resolveValue(holeValue(hole), r);
|
|
2679
2850
|
} catch (err) {
|
|
2680
2851
|
const wrap = buildAsyncWrap(err, hole);
|
|
2681
2852
|
if (wrap) {
|
|
@@ -2683,20 +2854,21 @@ function createLiveHoles(sink, scoped) {
|
|
|
2683
2854
|
r.p.push(wrap.p);
|
|
2684
2855
|
r.t.push("");
|
|
2685
2856
|
}
|
|
2857
|
+
} finally {
|
|
2858
|
+
engine.suppressed--;
|
|
2686
2859
|
}
|
|
2687
|
-
}
|
|
2688
|
-
|
|
2689
|
-
}
|
|
2690
|
-
const b = hole.$lhBinding;
|
|
2860
|
+
};
|
|
2861
|
+
b && !engine.sweeping ? rescope(b, hole, run) : run();
|
|
2691
2862
|
if (b && !b.closed && !r.h.length && !engine.sweeping) {
|
|
2692
2863
|
b.last = stripMarkers(r.t[0]);
|
|
2864
|
+
b.rows = rows;
|
|
2865
|
+
settleOccurrences(b);
|
|
2693
2866
|
}
|
|
2694
2867
|
return r.h.length ? r : r.t[0];
|
|
2695
2868
|
}
|
|
2696
2869
|
if (engine.suppressed || engine.sweeping) return null;
|
|
2697
2870
|
if (hole.$lhSkip) return null;
|
|
2698
2871
|
if (inScope && !inScope()) return null;
|
|
2699
|
-
const recordsBefore = engine.recordStamp;
|
|
2700
2872
|
const ownersBefore = stamp();
|
|
2701
2873
|
const owner = getOwner();
|
|
2702
2874
|
const holeCtx = sharedConfig.context;
|
|
@@ -2704,25 +2876,31 @@ function createLiveHoles(sink, scoped) {
|
|
|
2704
2876
|
key: null,
|
|
2705
2877
|
children: [],
|
|
2706
2878
|
last: null,
|
|
2879
|
+
rows: null,
|
|
2880
|
+
fn: hole.$fn,
|
|
2707
2881
|
closed: false,
|
|
2882
|
+
scope: undefined,
|
|
2883
|
+
occ: null,
|
|
2884
|
+
next: null,
|
|
2885
|
+
up: engine.parent,
|
|
2708
2886
|
sweep() {
|
|
2709
2887
|
if (b.closed) return;
|
|
2710
2888
|
const prevSweeping = engine.sweeping;
|
|
2711
2889
|
engine.sweeping = true;
|
|
2712
|
-
engine.
|
|
2713
|
-
const sweepOwnersBefore = stamp();
|
|
2890
|
+
engine.dry = b.last === null;
|
|
2714
2891
|
let res;
|
|
2715
2892
|
try {
|
|
2716
|
-
res = swept(owner, holeCtx, () => resolveHoleValue(hole));
|
|
2893
|
+
res = rescope(b, hole, () => swept(owner, holeCtx, () => resolveHoleValue(hole)));
|
|
2717
2894
|
} catch (err) {
|
|
2718
2895
|
b.closed = true;
|
|
2719
2896
|
sink.closeBinding(b.key);
|
|
2720
|
-
sink.error(b.key, wireErrorMessage(err));
|
|
2897
|
+
sink.error(b.key, wireErrorMessage(err, errorScope));
|
|
2721
2898
|
return;
|
|
2722
2899
|
} finally {
|
|
2723
2900
|
engine.sweeping = prevSweeping;
|
|
2901
|
+
engine.dry = false;
|
|
2724
2902
|
}
|
|
2725
|
-
if (engine.
|
|
2903
|
+
if (engine.sweptOwners && res.h.length) {
|
|
2726
2904
|
b.closed = true;
|
|
2727
2905
|
sink.closeBinding(b.key);
|
|
2728
2906
|
return;
|
|
@@ -2730,29 +2908,38 @@ function createLiveHoles(sink, scoped) {
|
|
|
2730
2908
|
if (res.h.length) return;
|
|
2731
2909
|
const html = res.t[0];
|
|
2732
2910
|
if (b.last === null || html === b.last) return;
|
|
2911
|
+
const ops = b.rows && res.rows && rowOps(b.rows, res.rows);
|
|
2733
2912
|
b.last = html;
|
|
2913
|
+
if (ops && !ops.r.length && ops.n === b.rows.length) return;
|
|
2914
|
+
b.rows = res.rows;
|
|
2734
2915
|
closeChildren(b);
|
|
2735
|
-
|
|
2916
|
+
settleOccurrences(b);
|
|
2917
|
+
sink.hole(b.key, html, ops && !html.includes("<!--slot:") ? ops : null);
|
|
2736
2918
|
}
|
|
2737
2919
|
};
|
|
2738
2920
|
if (engine.parent) engine.parent.children.push(b);
|
|
2739
2921
|
const prevParent = engine.parent;
|
|
2922
|
+
const prevScope = engine.scope;
|
|
2923
|
+
const prevVisit = engine.visit;
|
|
2924
|
+
const scope = b.scope = scopeFor(hole);
|
|
2740
2925
|
engine.parent = b;
|
|
2926
|
+
engine.scope = scope;
|
|
2927
|
+
engine.visit = b;
|
|
2741
2928
|
let value;
|
|
2742
2929
|
let escalated = null;
|
|
2743
2930
|
try {
|
|
2744
|
-
value = hole
|
|
2931
|
+
value = holeValue(hole);
|
|
2745
2932
|
} catch (err) {
|
|
2746
2933
|
const wrap = buildAsyncWrap(err, hole);
|
|
2747
2934
|
if (!wrap) {
|
|
2748
|
-
|
|
2935
|
+
leave(b, prevParent, prevScope, prevVisit);
|
|
2749
2936
|
closeChildren(b);
|
|
2750
2937
|
return "";
|
|
2751
2938
|
}
|
|
2752
2939
|
escalated = wrap;
|
|
2753
2940
|
}
|
|
2754
2941
|
if (!escalated && (typeof value === "function" && value.$lhSkip || value !== null && typeof value === "object" && value.$slot)) {
|
|
2755
|
-
|
|
2942
|
+
leave(b, prevParent, prevScope, prevVisit);
|
|
2756
2943
|
const r = {
|
|
2757
2944
|
t: [""],
|
|
2758
2945
|
h: [],
|
|
@@ -2767,6 +2954,7 @@ function createLiveHoles(sink, scoped) {
|
|
|
2767
2954
|
return r.h.length ? r : r.t[0];
|
|
2768
2955
|
}
|
|
2769
2956
|
let res;
|
|
2957
|
+
let rows = null;
|
|
2770
2958
|
if (escalated) {
|
|
2771
2959
|
closeChildren(b);
|
|
2772
2960
|
escalated.fn.$lhSuppress = true;
|
|
@@ -2783,23 +2971,25 @@ function createLiveHoles(sink, scoped) {
|
|
|
2783
2971
|
p: []
|
|
2784
2972
|
};
|
|
2785
2973
|
try {
|
|
2786
|
-
|
|
2974
|
+
rows = resolveValue(value, res);
|
|
2787
2975
|
} catch (_) {
|
|
2788
|
-
|
|
2976
|
+
leave(b, prevParent, prevScope, prevVisit);
|
|
2789
2977
|
closeChildren(b);
|
|
2790
2978
|
return "";
|
|
2791
2979
|
}
|
|
2792
2980
|
}
|
|
2793
|
-
|
|
2794
|
-
if (
|
|
2981
|
+
leave(b, prevParent, prevScope, prevVisit);
|
|
2982
|
+
if (stamp() !== ownersBefore) {
|
|
2795
2983
|
return res.h.length ? res : res.t[0];
|
|
2796
2984
|
}
|
|
2985
|
+
if (!res.h.length && settled && settled()) return res.t[0];
|
|
2797
2986
|
const id = nextId++;
|
|
2798
2987
|
const key = b.key = "lh:" + id;
|
|
2799
2988
|
const open = `<!--lh:${id}-->`;
|
|
2800
2989
|
const close = `<!--lh:/${id}-->`;
|
|
2801
2990
|
if (!res.h.length) {
|
|
2802
2991
|
b.last = stripMarkers(res.t[0]);
|
|
2992
|
+
b.rows = rows;
|
|
2803
2993
|
sink.openBinding(key, b);
|
|
2804
2994
|
return open + res.t[0] + close;
|
|
2805
2995
|
}
|
|
@@ -2817,7 +3007,7 @@ function createLiveHoles(sink, scoped) {
|
|
|
2817
3007
|
return nextId++;
|
|
2818
3008
|
},
|
|
2819
3009
|
active() {
|
|
2820
|
-
return !inScope || inScope();
|
|
3010
|
+
return (!inScope || inScope()) && !(settled && settled());
|
|
2821
3011
|
},
|
|
2822
3012
|
attr(cap) {
|
|
2823
3013
|
const owner = getOwner();
|
|
@@ -2830,9 +3020,10 @@ function createLiveHoles(sink, scoped) {
|
|
|
2830
3020
|
sweep() {
|
|
2831
3021
|
if (b.closed) return;
|
|
2832
3022
|
const prevSweeping = engine.sweeping;
|
|
3023
|
+
const prevScope = engine.scope;
|
|
2833
3024
|
engine.sweeping = true;
|
|
3025
|
+
engine.scope = null;
|
|
2834
3026
|
engine.gateHit = false;
|
|
2835
|
-
const sweepOwnersBefore = stamp();
|
|
2836
3027
|
let html = "";
|
|
2837
3028
|
try {
|
|
2838
3029
|
let group = null;
|
|
@@ -2859,15 +3050,21 @@ function createLiveHoles(sink, scoped) {
|
|
|
2859
3050
|
};
|
|
2860
3051
|
swept(owner, holeCtx, run);
|
|
2861
3052
|
} catch (err) {
|
|
2862
|
-
if (ssrHandleError(err, true))
|
|
3053
|
+
if (ssrHandleError(err, true)) {
|
|
3054
|
+
if (!engine.sweptOwners) return;
|
|
3055
|
+
b.closed = true;
|
|
3056
|
+
sink.closeBinding(b.key);
|
|
3057
|
+
return;
|
|
3058
|
+
}
|
|
2863
3059
|
b.closed = true;
|
|
2864
3060
|
sink.closeBinding(b.key);
|
|
2865
|
-
sink.error("lha:" + cap.id, wireErrorMessage(err));
|
|
3061
|
+
sink.error("lha:" + cap.id, wireErrorMessage(err, errorScope));
|
|
2866
3062
|
return;
|
|
2867
3063
|
} finally {
|
|
2868
3064
|
engine.sweeping = prevSweeping;
|
|
3065
|
+
engine.scope = prevScope;
|
|
2869
3066
|
}
|
|
2870
|
-
if (engine.gateHit
|
|
3067
|
+
if (engine.gateHit) {
|
|
2871
3068
|
b.closed = true;
|
|
2872
3069
|
sink.closeBinding(b.key);
|
|
2873
3070
|
return;
|
|
@@ -2932,7 +3129,9 @@ function ssr(t) {
|
|
|
2932
3129
|
cap = {
|
|
2933
3130
|
id,
|
|
2934
3131
|
parts: [prefix],
|
|
2935
|
-
base: prefix
|
|
3132
|
+
base: prefix,
|
|
3133
|
+
at: lastOpen.seg,
|
|
3134
|
+
inject
|
|
2936
3135
|
};
|
|
2937
3136
|
return true;
|
|
2938
3137
|
};
|
|
@@ -2981,7 +3180,10 @@ function ssr(t) {
|
|
|
2981
3180
|
});
|
|
2982
3181
|
}
|
|
2983
3182
|
} else {
|
|
2984
|
-
cap
|
|
3183
|
+
if (cap) {
|
|
3184
|
+
result.t[cap.at] = result.t[cap.at].replace(cap.inject, "");
|
|
3185
|
+
cap = null;
|
|
3186
|
+
}
|
|
2985
3187
|
result.h.push(ssrGroupSlot(lastGroupVal.fn, lastGroupIdx++));
|
|
2986
3188
|
result.p.push(lastGroupVal.p);
|
|
2987
3189
|
result.t.push("");
|
|
@@ -3043,12 +3245,15 @@ function ssr(t) {
|
|
|
3043
3245
|
f: hole
|
|
3044
3246
|
});
|
|
3045
3247
|
} else {
|
|
3248
|
+
result.t[cap.at] = result.t[cap.at].replace(cap.inject, "");
|
|
3046
3249
|
cap = null;
|
|
3047
3250
|
}
|
|
3048
3251
|
}
|
|
3049
3252
|
} else {
|
|
3050
3253
|
const capturing = live && !hp.pos[i - 1] && captureStart();
|
|
3254
|
+
const scope = live && hp.pos[i - 1] && live.nest(hole);
|
|
3051
3255
|
const r = tryResolveFunctionHole(hole);
|
|
3256
|
+
if (scope) live.scope = scope;
|
|
3052
3257
|
if (typeof r === "string") {
|
|
3053
3258
|
s += r;
|
|
3054
3259
|
if (capturing) {
|
|
@@ -3058,7 +3263,10 @@ function ssr(t) {
|
|
|
3058
3263
|
});
|
|
3059
3264
|
}
|
|
3060
3265
|
} else {
|
|
3061
|
-
if (capturing)
|
|
3266
|
+
if (capturing) {
|
|
3267
|
+
s = s.replace(cap.inject, "");
|
|
3268
|
+
cap = null;
|
|
3269
|
+
}
|
|
3062
3270
|
result = {
|
|
3063
3271
|
t: [s],
|
|
3064
3272
|
h: [],
|
|
@@ -3122,14 +3330,12 @@ function ssrClassName(value) {
|
|
|
3122
3330
|
if (typeof value === "number") return "" + value;
|
|
3123
3331
|
if (!value) return "";
|
|
3124
3332
|
if (typeof value === "string") return escape(value, true);
|
|
3125
|
-
if (isSlotValue(value)) return "";
|
|
3126
3333
|
value = classListToObject(value);
|
|
3127
3334
|
let classKeys = Object.keys(value),
|
|
3128
3335
|
result = "";
|
|
3129
3336
|
for (let i = 0, len = classKeys.length; i < len; i++) {
|
|
3130
3337
|
const key = classKeys[i];
|
|
3131
|
-
|
|
3132
|
-
if (isSlotValue(classValue)) classValue = slotValueInline();
|
|
3338
|
+
const classValue = value[key];
|
|
3133
3339
|
if (!key || key === "undefined" || !classValue) continue;
|
|
3134
3340
|
result && (result += " ");
|
|
3135
3341
|
result += escape(key, true);
|
|
@@ -3139,13 +3345,11 @@ function ssrClassName(value) {
|
|
|
3139
3345
|
function ssrStyle(value) {
|
|
3140
3346
|
if (!value) return "";
|
|
3141
3347
|
if (typeof value === "string") return escape(value, true);
|
|
3142
|
-
if (isSlotValue(value)) return "";
|
|
3143
3348
|
let result = "";
|
|
3144
3349
|
const k = Object.keys(value);
|
|
3145
3350
|
for (let i = 0; i < k.length; i++) {
|
|
3146
3351
|
const s = escape(k[i], true);
|
|
3147
|
-
|
|
3148
|
-
if (isSlotValue(v)) v = slotValueInline();
|
|
3352
|
+
const v = value[k[i]];
|
|
3149
3353
|
if (v != undefined) {
|
|
3150
3354
|
const r = escape(v, true);
|
|
3151
3355
|
if (r != undefined && r !== "undefined") {
|
|
@@ -3157,7 +3361,6 @@ function ssrStyle(value) {
|
|
|
3157
3361
|
return result;
|
|
3158
3362
|
}
|
|
3159
3363
|
function ssrStyleProperty(name, value) {
|
|
3160
|
-
if (isSlotValue(value)) value = slotValueInline();
|
|
3161
3364
|
return value != null ? name + value : "";
|
|
3162
3365
|
}
|
|
3163
3366
|
function ssrStyleProperties(...entries) {
|
|
@@ -3168,30 +3371,25 @@ function ssrStyleProperties(...entries) {
|
|
|
3168
3371
|
}
|
|
3169
3372
|
return result;
|
|
3170
3373
|
}
|
|
3171
|
-
function ssrElement(tag, props, children, needsId, skip, attrs
|
|
3374
|
+
function ssrElement(tag, props, children, needsId, skip, attrs) {
|
|
3172
3375
|
const hk = needsId ? ssrHydrationKey() : "";
|
|
3173
3376
|
if (typeof props === "function") props = props();
|
|
3174
3377
|
let sources = null;
|
|
3175
3378
|
let proxy = false;
|
|
3176
3379
|
let viewKeys = null;
|
|
3177
3380
|
let owners = null;
|
|
3178
|
-
let ownerIndex = null;
|
|
3179
3381
|
const ctx = renderConfig.context;
|
|
3180
|
-
const slots = ctx !== undefined && ctx.claims !== undefined;
|
|
3181
3382
|
const link = tag === "a" && ctx !== undefined && ctx.linkClaim !== undefined ? {} : null;
|
|
3182
3383
|
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
|
-
}
|
|
3384
|
+
let i = 0;
|
|
3385
|
+
for (; i < props.length; i++) {
|
|
3386
|
+
const s = props[i];
|
|
3387
|
+
if (s == null || typeof s === "function" || $PROXY in s) break;
|
|
3388
|
+
}
|
|
3389
|
+
if (i === props.length) sources = props;else {
|
|
3390
|
+
viewKeys = [];
|
|
3391
|
+
owners = [];
|
|
3392
|
+
collectSpreadSources(props, viewKeys, owners);
|
|
3195
3393
|
}
|
|
3196
3394
|
} else if (props == null) {
|
|
3197
3395
|
props = {};
|
|
@@ -3201,13 +3399,10 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3201
3399
|
owners = [];
|
|
3202
3400
|
sourceOwners(props, viewKeys, owners);
|
|
3203
3401
|
} else proxy = true;
|
|
3204
|
-
} else if (slots && props.$slot === true) {
|
|
3205
|
-
props = slotSpreadSource();
|
|
3206
3402
|
}
|
|
3207
3403
|
const info = tagInfo(tag);
|
|
3208
3404
|
const skipChildren = info.isVoid;
|
|
3209
3405
|
let result = info.open + hk;
|
|
3210
|
-
let behaviors = null;
|
|
3211
3406
|
let childOwner = null;
|
|
3212
3407
|
const last = sources === null ? 0 : sources.length - 1;
|
|
3213
3408
|
let keysOf = null;
|
|
@@ -3242,21 +3437,9 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3242
3437
|
if (prop === undefined) continue;
|
|
3243
3438
|
}
|
|
3244
3439
|
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
|
-
}
|
|
3440
|
+
if (value == undefined || prop.startsWith("prop:") || prop === "ref" || isEventName(prop)) continue;
|
|
3256
3441
|
if (link !== null && LinkAttributes.has(prop)) link[prop] = value;
|
|
3257
|
-
if (
|
|
3258
|
-
result += spreadObjectAttribute(prop, value);
|
|
3259
|
-
} else if (prop === "style") {
|
|
3442
|
+
if (prop === "style") {
|
|
3260
3443
|
result += ` style="${ssrStyle(value)}"`;
|
|
3261
3444
|
} else if (prop === "class") {
|
|
3262
3445
|
result += ` class="${ssrClassName(value)}"`;
|
|
@@ -3267,7 +3450,6 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3267
3450
|
}
|
|
3268
3451
|
}
|
|
3269
3452
|
}
|
|
3270
|
-
if (slots && (behaviors !== null || claims !== undefined)) result += spreadBehaviorMarkers(behaviors, claims, ctx.claims);
|
|
3271
3453
|
if (attrs !== undefined) result += typeof attrs === "function" ? attrs() : attrs;
|
|
3272
3454
|
if (link !== null && link.href !== undefined) result += ssrLinkClaim(link);
|
|
3273
3455
|
if (skipChildren) return {
|
|
@@ -3287,6 +3469,13 @@ function ssrElement(tag, props, children, needsId, skip, attrs, claims) {
|
|
|
3287
3469
|
};
|
|
3288
3470
|
return ssr([result + ">", info.close], resolveSSRNode(children, undefined, true));
|
|
3289
3471
|
}
|
|
3472
|
+
function collectSpreadSources(props, viewKeys, owners) {
|
|
3473
|
+
for (let i = 0; i < props.length; i++) {
|
|
3474
|
+
let s = props[i];
|
|
3475
|
+
if (typeof s === "function") s = s();
|
|
3476
|
+
if (s != null) sourceOwners(s, viewKeys, owners);
|
|
3477
|
+
}
|
|
3478
|
+
}
|
|
3290
3479
|
function spreadFormAttribute(prop, info, keys, keysOf, skip) {
|
|
3291
3480
|
const defaultProp = info.formDefaults[prop];
|
|
3292
3481
|
if (defaultProp !== undefined && (skip === undefined || !skip(defaultProp))) {
|
|
@@ -3302,19 +3491,14 @@ function spreadFormAttribute(prop, info, keys, keysOf, skip) {
|
|
|
3302
3491
|
}
|
|
3303
3492
|
function ssrElementAttribute(key, value) {
|
|
3304
3493
|
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);
|
|
3494
|
+
if (key === "style" || key === "class") return ` ${key}="${key === "class" ? ssrClassName(value) : ssrStyle(value)}"`;
|
|
3309
3495
|
if (typeof value === "boolean") return value ? ` ${key}` : "";
|
|
3310
3496
|
return value === "" ? ` ${key}` : ` ${key}="${escape(value, true)}"`;
|
|
3311
3497
|
}
|
|
3312
3498
|
function ssrAttribute(key, value) {
|
|
3313
3499
|
if (typeof value === "string") return ` ${key}="${value}"`;
|
|
3314
3500
|
if (value == null || value === false) return "";
|
|
3315
|
-
if (typeof value === "object") {
|
|
3316
|
-
return isSlotValue(value) ? slotAttribute(key, value) : ` ${key}="${escape(String(value), true)}"`;
|
|
3317
|
-
}
|
|
3501
|
+
if (typeof value === "object") return ` ${key}="${escape(String(value), true)}"`;
|
|
3318
3502
|
if (typeof value === "function") return ` ${key}="${escape(String(value), true)}"`;
|
|
3319
3503
|
return value === true ? ` ${key}` : ` ${key}="${value}"`;
|
|
3320
3504
|
}
|
|
@@ -3322,232 +3506,6 @@ function ssrHydrationKey() {
|
|
|
3322
3506
|
const hk = getHydrationKey();
|
|
3323
3507
|
return hk ? ` _hk=${hk}` : "";
|
|
3324
3508
|
}
|
|
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
3509
|
function ssrLinkClaim(attrs) {
|
|
3552
3510
|
const ctx = renderConfig.context;
|
|
3553
3511
|
if (ctx === undefined || ctx.linkClaim === undefined || attrs["aria-current"] != null) return "";
|
|
@@ -3673,7 +3631,6 @@ function escape(s, attr) {
|
|
|
3673
3631
|
if (!attr && t === "function") return escapeLate(s);
|
|
3674
3632
|
if (attr) {
|
|
3675
3633
|
if (s == null || t === "boolean" || t === "number") return s;
|
|
3676
|
-
if (t === "object" && s[SLOT_VALUE] !== undefined) return s;
|
|
3677
3634
|
return escape(String(s), attr);
|
|
3678
3635
|
}
|
|
3679
3636
|
return s;
|
|
@@ -3686,6 +3643,7 @@ function escapeLate(fn) {
|
|
|
3686
3643
|
if (fn.$esc) return fn;
|
|
3687
3644
|
const w = () => escape(fn());
|
|
3688
3645
|
w.$esc = true;
|
|
3646
|
+
w.$fn = fn;
|
|
3689
3647
|
if (fn.$lhSkip) w.$lhSkip = true;
|
|
3690
3648
|
if (fn.$lhSuppress) w.$lhSuppress = true;
|
|
3691
3649
|
if (fn.$lhBinding) w.$lhBinding = fn.$lhBinding;
|
|
@@ -3781,7 +3739,7 @@ function generateHydrationScript({
|
|
|
3781
3739
|
eventNames,
|
|
3782
3740
|
nonce
|
|
3783
3741
|
} = {}) {
|
|
3784
|
-
return hydrationBootstrap(eventNames,
|
|
3742
|
+
return hydrationBootstrap(eventNames, destinationNonce(nonce, "script"), false);
|
|
3785
3743
|
}
|
|
3786
3744
|
function hydrationBootstrap(eventNames = ["click", "input"], nonce, ledger) {
|
|
3787
3745
|
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 +3755,12 @@ function allSettled(promises) {
|
|
|
3797
3755
|
return size;
|
|
3798
3756
|
});
|
|
3799
3757
|
}
|
|
3800
|
-
function
|
|
3801
|
-
if (noScripts || !context || !context.bootstrap) return
|
|
3758
|
+
function withShellEnd(html, context, renderId, nonce, noScripts) {
|
|
3759
|
+
if (noScripts || !context || !context.bootstrap) return html;
|
|
3802
3760
|
const id = JSON.stringify(renderId).replace(/</g, "\\u003C");
|
|
3803
|
-
|
|
3761
|
+
const marker = `<script${nonceAttr(nonce, "script")}>_$HY.s[${id}]=1,_$HY.sw&&_$HY.sw(${id})</script>`;
|
|
3762
|
+
const at = html.indexOf("</body>", html.length - 512);
|
|
3763
|
+
return at < 0 ? html + marker : html.slice(0, at) + marker + html.slice(at);
|
|
3804
3764
|
}
|
|
3805
3765
|
function assembleDocument(html, emittedAssets, preloadLinks, inlineStyles, scripts, nonce, headTags, onHead) {
|
|
3806
3766
|
const scriptTag = scripts ? `<script${nonceAttr(nonce, "script")}>${scripts}</script>` : "";
|
|
@@ -3992,10 +3952,6 @@ function tryResolveString(node, nested) {
|
|
|
3992
3952
|
if (node.h && node.h.length > 0) return {
|
|
3993
3953
|
merge: node
|
|
3994
3954
|
};
|
|
3995
|
-
if (node[SLOT_VALUE] !== undefined) {
|
|
3996
|
-
ssrTextTail = false;
|
|
3997
|
-
return node.w();
|
|
3998
|
-
}
|
|
3999
3955
|
if (node.t === undefined) {
|
|
4000
3956
|
return "";
|
|
4001
3957
|
}
|
|
@@ -4048,9 +4004,6 @@ function resolveSSRNode(node, result = {
|
|
|
4048
4004
|
} else if (node.t !== undefined) {
|
|
4049
4005
|
result.t[result.t.length - 1] += node.t;
|
|
4050
4006
|
ssrTextTail = false;
|
|
4051
|
-
} else if (node[SLOT_VALUE] !== undefined) {
|
|
4052
|
-
result.t[result.t.length - 1] += node.w();
|
|
4053
|
-
ssrTextTail = false;
|
|
4054
4007
|
} else ;
|
|
4055
4008
|
} else if (t === "function") {
|
|
4056
4009
|
const live = sharedConfig.context && sharedConfig.context.liveHoles;
|
|
@@ -4061,6 +4014,7 @@ function resolveSSRNode(node, result = {
|
|
|
4061
4014
|
ssrTextTail = true;
|
|
4062
4015
|
} else resolveSSRNode(liveNode, result, false, true);
|
|
4063
4016
|
} else {
|
|
4017
|
+
const scope = live && live.nest(node);
|
|
4064
4018
|
try {
|
|
4065
4019
|
resolveSSRNode(node(), result, false, true);
|
|
4066
4020
|
} catch (err) {
|
|
@@ -4072,6 +4026,8 @@ function resolveSSRNode(node, result = {
|
|
|
4072
4026
|
result.t.push("");
|
|
4073
4027
|
ssrTextTail = true;
|
|
4074
4028
|
}
|
|
4029
|
+
} finally {
|
|
4030
|
+
if (scope) live.scope = scope;
|
|
4075
4031
|
}
|
|
4076
4032
|
}
|
|
4077
4033
|
}
|
|
@@ -4469,7 +4425,7 @@ function dispatchAsInteraction(_e, fn) {
|
|
|
4469
4425
|
return fn();
|
|
4470
4426
|
}
|
|
4471
4427
|
function notSup() {
|
|
4472
|
-
throw new Error("Client-only API called on the server side. Run client-only code in
|
|
4428
|
+
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
4429
|
}
|
|
4474
4430
|
|
|
4475
4431
|
setContainerTraceResolver(getProjectionTrace);
|
|
@@ -4608,4 +4564,4 @@ function httpHeader(name, value, options) {
|
|
|
4608
4564
|
}
|
|
4609
4565
|
}
|
|
4610
4566
|
|
|
4611
|
-
export {
|
|
4567
|
+
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 };
|