@solidjs/web 2.0.0-rc.21 → 2.0.0-rc.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.dev.js +380 -239
- package/dist/server.js +377 -238
- package/dist/server.observe.js +377 -238
- package/dist/web.dev.js +125 -82
- package/dist/web.js +103 -81
- package/dist/web.observe.js +103 -81
- package/frames/dist/client.dev.js +7 -2
- package/frames/dist/client.js +7 -2
- package/frames/dist/client.observe.js +7 -2
- package/frames/dist/server.dev.js +122 -62
- package/frames/dist/server.js +122 -62
- package/frames/dist/server.observe.js +122 -62
- package/frames/dist/wire.js +1 -1
- package/package.json +2 -2
- package/serialization/dist/serialization.js +5 -4
- package/serialization/types/index.d.ts +8 -1
- package/serialization/types/serializer.d.ts +8 -1
- package/server-functions/dist/client.dev.js +5 -3
- package/server-functions/dist/client.js +5 -3
- package/server-functions/dist/client.observe.js +5 -3
- package/types/client.d.ts +54 -3
- package/types/constants.d.ts +2 -1
- package/types/frames/frame-client.d.ts +2 -0
- package/types/frames/serializer.d.ts +8 -1
- package/types/frames/tree-rewrite.d.ts +7 -0
- package/types/serializer.d.ts +8 -1
- package/types/server-functions/shared.d.ts +3 -2
- package/types/server.d.ts +48 -7
package/dist/server.observe.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRenderEffect, createMemo, OBSERVE, getOwner, createRoot, $PROXY,
|
|
1
|
+
import { createRenderEffect, createMemo, OBSERVE, getOwner, createRoot, $PROXY, runWithOwner, createOwner, onCleanup, 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
3
|
import { sharedConfig, ssrSanitizeError, beginEdgesRender, reportServerError, viewOf, sourceOwners, ssrHandleError, inServerComponentScope, creationStamp, dynamicCore, getProjectionTrace, shareAsyncIterable } from 'solid-js/internal';
|
|
4
4
|
export { ssrScope as scope } from 'solid-js/internal';
|
|
@@ -355,7 +355,15 @@ function rewriteTree(value, visit, withPath) {
|
|
|
355
355
|
} catch (err) {
|
|
356
356
|
if (err !== CYCLE) throw err;
|
|
357
357
|
}
|
|
358
|
-
|
|
358
|
+
const memo = state.memo || (state.memo = new Map());
|
|
359
|
+
const marks = {
|
|
360
|
+
at: new Map(),
|
|
361
|
+
stack: [],
|
|
362
|
+
changed: new Set(),
|
|
363
|
+
next: 0
|
|
364
|
+
};
|
|
365
|
+
mark(value, visit, path, memo, marks);
|
|
366
|
+
return clone(value, memo, marks.changed);
|
|
359
367
|
}
|
|
360
368
|
function shape(value) {
|
|
361
369
|
return Array.isArray(value) ? 1 : Object.getPrototypeOf(value) === Object.prototype ? 2 : 0;
|
|
@@ -403,28 +411,73 @@ function cow(value, visit, path, depth, state) {
|
|
|
403
411
|
if (ancestors !== undefined) ancestors.delete(value);
|
|
404
412
|
return out;
|
|
405
413
|
}
|
|
406
|
-
function
|
|
407
|
-
|
|
414
|
+
function mark(value, visit, path, memo, m) {
|
|
415
|
+
const seen = m.at.get(value);
|
|
416
|
+
if (seen !== undefined) return seen;
|
|
417
|
+
if (memo.has(value)) return -1;
|
|
408
418
|
const r = visit(value, path);
|
|
409
419
|
if (r !== DESCEND) {
|
|
410
420
|
memo.set(value, r);
|
|
411
|
-
return
|
|
421
|
+
return -1;
|
|
412
422
|
}
|
|
413
423
|
const s = shape(value);
|
|
414
|
-
if (s === 0) return
|
|
415
|
-
const
|
|
424
|
+
if (s === 0) return -1;
|
|
425
|
+
const index = m.next++;
|
|
426
|
+
let low = index;
|
|
427
|
+
let changed = false;
|
|
428
|
+
let open = false;
|
|
429
|
+
const keys = s === 1 ? value : Object.keys(value);
|
|
430
|
+
for (let i = 0; i < keys.length; i++) {
|
|
431
|
+
const k = s === 1 ? i : keys[i];
|
|
432
|
+
const c = value[k];
|
|
433
|
+
if (c === null || typeof c !== "object") continue;
|
|
434
|
+
if (!open) {
|
|
435
|
+
open = true;
|
|
436
|
+
m.at.set(value, index);
|
|
437
|
+
m.stack.push(value);
|
|
438
|
+
}
|
|
439
|
+
const l = mark(c, visit, undefined , memo, m);
|
|
440
|
+
if (l >= 0 && l < low) low = l;
|
|
441
|
+
if (memo.has(c) && memo.get(c) !== c || l === Infinity && m.changed.has(c)) changed = true;
|
|
442
|
+
}
|
|
443
|
+
if (!open) return -1;
|
|
444
|
+
if (low === index) {
|
|
445
|
+
m.at.set(value, Infinity);
|
|
446
|
+
if (m.stack[m.stack.length - 1] === value) {
|
|
447
|
+
m.stack.pop();
|
|
448
|
+
if (changed) m.changed.add(value);
|
|
449
|
+
return Infinity;
|
|
450
|
+
}
|
|
451
|
+
const members = m.stack.splice(m.stack.lastIndexOf(value));
|
|
452
|
+
if (!changed) for (const n of members) if (m.changed.has(n)) {
|
|
453
|
+
changed = true;
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
for (const n of members) {
|
|
457
|
+
m.at.set(n, Infinity);
|
|
458
|
+
if (changed) m.changed.add(n);
|
|
459
|
+
}
|
|
460
|
+
return Infinity;
|
|
461
|
+
}
|
|
462
|
+
if (changed) m.changed.add(value);
|
|
463
|
+
return low;
|
|
464
|
+
}
|
|
465
|
+
function clone(value, memo, changed) {
|
|
466
|
+
if (memo.has(value)) return memo.get(value);
|
|
467
|
+
if (!changed.has(value)) return value;
|
|
468
|
+
const out = Array.isArray(value) ? value.slice() : {
|
|
416
469
|
...value
|
|
417
470
|
};
|
|
418
471
|
memo.set(value, out);
|
|
419
|
-
if (
|
|
472
|
+
if (Array.isArray(value)) {
|
|
420
473
|
for (let i = 0; i < value.length; i++) {
|
|
421
474
|
const c = value[i];
|
|
422
|
-
if (c !== null && typeof c === "object") out[i] = clone(c,
|
|
475
|
+
if (c !== null && typeof c === "object") out[i] = clone(c, memo, changed);
|
|
423
476
|
}
|
|
424
477
|
} else {
|
|
425
478
|
for (const k of Object.keys(value)) {
|
|
426
479
|
const c = value[k];
|
|
427
|
-
if (c !== null && typeof c === "object") out[k] = clone(c,
|
|
480
|
+
if (c !== null && typeof c === "object") out[k] = clone(c, memo, changed);
|
|
428
481
|
}
|
|
429
482
|
}
|
|
430
483
|
return out;
|
|
@@ -564,7 +617,7 @@ function createKeyedSerializer(serialize, onError, onDone) {
|
|
|
564
617
|
stream = serialize(key, value, {
|
|
565
618
|
onError: onError && (err => {
|
|
566
619
|
failed = true;
|
|
567
|
-
onError(err);
|
|
620
|
+
onError(err, key);
|
|
568
621
|
if (cancel) {
|
|
569
622
|
cancel();
|
|
570
623
|
settle();
|
|
@@ -637,7 +690,7 @@ function createHydrationSerializer({
|
|
|
637
690
|
});
|
|
638
691
|
return createKeyedSerializer(late ? late(serialize, refs, onData, scopeId) : serialize, onError, onDone);
|
|
639
692
|
}
|
|
640
|
-
function rejectUnserializedKey(serialize, refs, onData, scopeId) {
|
|
693
|
+
function rejectUnserializedKey(serialize, refs, onData, scopeId, plain) {
|
|
641
694
|
let taken = 0;
|
|
642
695
|
let fresh = [];
|
|
643
696
|
const set = refs.set;
|
|
@@ -660,8 +713,9 @@ function rejectUnserializedKey(serialize, refs, onData, scopeId) {
|
|
|
660
713
|
if (ref instanceof Promise) ids.add(id + 1);else if (isStream(ref) || Object.getPrototypeOf(ref) === Object.prototype && !Object.keys(ref).length) ids.add(id);
|
|
661
714
|
}
|
|
662
715
|
if (!ids.size) return;
|
|
663
|
-
const
|
|
664
|
-
const
|
|
716
|
+
const text = plain && plain(key);
|
|
717
|
+
const body = "for(const i of[" + [...ids] + "]){const v=$R[i];v&&(v.f?" + (text === undefined ? "v.f(e)" : "(v.f(e),v.p.s||(v.p.s=2,v.p.v=e))") + ":v.throw&&v.throw(e))}";
|
|
718
|
+
const message = JSON.stringify(text === undefined ? "Serialization failed: the hydration value for key " + JSON.stringify(key) + " could not be serialized on the server" : text).replace(/[<\u2028\u2029]/g, c => KEY_ESCAPES[c]);
|
|
665
719
|
onData("($R=>{const e=new Error(" + message + ");" + body + "})(" + (scopeId == null ? "$R" : '$R["' + serializeKey(scopeId) + '"]') + ")");
|
|
666
720
|
};
|
|
667
721
|
return serialize(key, value, {
|
|
@@ -1176,6 +1230,7 @@ function isSetAttr(value) {
|
|
|
1176
1230
|
return value != null && value !== false && value !== "";
|
|
1177
1231
|
}
|
|
1178
1232
|
const PRELOAD_LINK_ATTRIBUTES = ["type", "crossorigin", "integrity", "referrerpolicy", "fetchpriority", "media", "imagesrcset", "imagesizes"];
|
|
1233
|
+
const SSR_NODE = /*#__PURE__*/Symbol.for("solid.ssrNode");
|
|
1179
1234
|
function registerPreloadLink(tracking, headRegistry, link, nonce) {
|
|
1180
1235
|
if (!link || typeof link !== "object") {
|
|
1181
1236
|
return null;
|
|
@@ -1706,7 +1761,8 @@ function tagInfo(tag) {
|
|
|
1706
1761
|
textarea: tag === "textarea",
|
|
1707
1762
|
raw: tag === "script" || tag === "style",
|
|
1708
1763
|
formDefaults,
|
|
1709
|
-
formAttributes
|
|
1764
|
+
formAttributes,
|
|
1765
|
+
sel: tag === "select" ? 1 : tag === "option" ? 2 : 0
|
|
1710
1766
|
};
|
|
1711
1767
|
if (tagInfos.size < 512) tagInfos.set(tag, info);
|
|
1712
1768
|
}
|
|
@@ -1808,7 +1864,7 @@ function renderToString(code, options = {}) {
|
|
|
1808
1864
|
closed = true;
|
|
1809
1865
|
serializer.close();
|
|
1810
1866
|
const head = renderShellHead(headRegistry, nonce, null, noScripts, traceMetaMarkup(context.trace));
|
|
1811
|
-
const document = withShellEnd(assembleDocument(
|
|
1867
|
+
const document = withShellEnd(assembleDocument(html, tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead, tracking.lowModules), context, renderId, nonce, noScripts);
|
|
1812
1868
|
if (render) render.shell();
|
|
1813
1869
|
if (requestEvent && requestEvent.response) {
|
|
1814
1870
|
commitResponseStub(requestEvent.response, {
|
|
@@ -1895,7 +1951,8 @@ function renderToStream(code, options = {}) {
|
|
|
1895
1951
|
if (render) settleRender(render, rootOwner, disconnect ? "abandoned" : "error");
|
|
1896
1952
|
const sink = writable;
|
|
1897
1953
|
buffer = {
|
|
1898
|
-
write() {}
|
|
1954
|
+
write() {},
|
|
1955
|
+
flush() {}
|
|
1899
1956
|
};
|
|
1900
1957
|
writable = {
|
|
1901
1958
|
end() {}
|
|
@@ -1989,24 +2046,64 @@ function renderToStream(code, options = {}) {
|
|
|
1989
2046
|
let stableOrder = false;
|
|
1990
2047
|
let parkedWrites = null;
|
|
1991
2048
|
const byKey = (a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0;
|
|
1992
|
-
let writing = 0;
|
|
1993
2049
|
let stranded = false;
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2050
|
+
let writingRecord = false;
|
|
2051
|
+
let recordFailed = false;
|
|
2052
|
+
const plainRecords = new WeakMap();
|
|
2053
|
+
const caught = new Set();
|
|
2054
|
+
let unclaimed = null;
|
|
2055
|
+
const rejected = new Map();
|
|
2056
|
+
const plainMessage = (id, value) => value != null && typeof value.message === "string" ? value.message : `The error record for key ${JSON.stringify(id)} could not be serialized on the server`;
|
|
2057
|
+
const plainFor = (id, value) => {
|
|
2058
|
+
const keyed = value !== null && typeof value === "object";
|
|
2059
|
+
let plain = keyed && plainRecords.get(value);
|
|
2060
|
+
if (!plain) {
|
|
2061
|
+
plain = new Error(plainMessage(id, value));
|
|
2062
|
+
if (keyed) plainRecords.set(value, plain);
|
|
2063
|
+
}
|
|
2064
|
+
return plain;
|
|
2065
|
+
};
|
|
2066
|
+
const claim = () => {
|
|
2067
|
+
if (unclaimed) {
|
|
2068
|
+
for (const reason of unclaimed) if (!caught.has(reason)) stranded = true;
|
|
2069
|
+
unclaimed = null;
|
|
2070
|
+
}
|
|
2071
|
+
return stranded;
|
|
2072
|
+
};
|
|
2073
|
+
const claimLater = reason => {
|
|
2074
|
+
if (firstFlushed || stranded || caught.has(reason)) return;
|
|
2075
|
+
if (!unclaimed) {
|
|
2076
|
+
unclaimed = new Set();
|
|
2077
|
+
deferFlush(() => {
|
|
2078
|
+
if (!rootHoles && claim()) abandon();
|
|
2079
|
+
});
|
|
2080
|
+
}
|
|
2081
|
+
unclaimed.add(reason);
|
|
2082
|
+
};
|
|
2083
|
+
const handOver = (id, value, error) => {
|
|
2084
|
+
if (!error || options.serializer) return serializer.write(id, value);
|
|
2085
|
+
let plain = value !== null && typeof value === "object" && plainRecords.get(value);
|
|
2086
|
+
if (!plain) {
|
|
2087
|
+
recordFailed = false;
|
|
2088
|
+
writingRecord = true;
|
|
2089
|
+
try {
|
|
2090
|
+
serializer.write(id, value);
|
|
2091
|
+
} finally {
|
|
2092
|
+
writingRecord = false;
|
|
2093
|
+
}
|
|
2094
|
+
if (!recordFailed) return;
|
|
2095
|
+
plain = plainFor(id, value);
|
|
2000
2096
|
}
|
|
2097
|
+
serializer.write(id, plain);
|
|
2001
2098
|
};
|
|
2002
|
-
const write = (id, value) => {
|
|
2003
|
-
if (stableOrder && !dead) (parkedWrites ||= []).push([id, value]);else handOver(id, value);
|
|
2099
|
+
const write = (id, value, error) => {
|
|
2100
|
+
if (stableOrder && !dead) (parkedWrites ||= []).push([id, value, error]);else handOver(id, value, error);
|
|
2004
2101
|
};
|
|
2005
2102
|
const flushParkedWrites = () => {
|
|
2006
2103
|
if (!parkedWrites) return;
|
|
2007
2104
|
const writes = parkedWrites.sort(byKey);
|
|
2008
2105
|
parkedWrites = null;
|
|
2009
|
-
for (let i = 0; i < writes.length; i++) handOver(writes[i][0], writes[i][1]);
|
|
2106
|
+
for (let i = 0; i < writes.length; i++) handOver(writes[i][0], writes[i][1], writes[i][2]);
|
|
2010
2107
|
};
|
|
2011
2108
|
const flushStubBatch = () => {
|
|
2012
2109
|
if (!stubBatch) return;
|
|
@@ -2031,7 +2128,7 @@ function renderToStream(code, options = {}) {
|
|
|
2031
2128
|
const onDone = () => {
|
|
2032
2129
|
if (dead) return;
|
|
2033
2130
|
writeTasks();
|
|
2034
|
-
if (
|
|
2131
|
+
if (claim()) return abandon();
|
|
2035
2132
|
lastBlockingSize = blockingPromises.size;
|
|
2036
2133
|
doShell();
|
|
2037
2134
|
onCompleteAll && onCompleteAll({
|
|
@@ -2094,11 +2191,19 @@ function renderToStream(code, options = {}) {
|
|
|
2094
2191
|
plugins: options.plugins,
|
|
2095
2192
|
onData: payload => sink.data(payload),
|
|
2096
2193
|
onDone,
|
|
2097
|
-
onError: err => {
|
|
2098
|
-
|
|
2099
|
-
|
|
2194
|
+
onError: (err, key) => {
|
|
2195
|
+
const rejection = !options.serializer && !writingRecord && rejected.has(key);
|
|
2196
|
+
const reason = rejection && rejected.get(key);
|
|
2197
|
+
if (!rejection || reason === null || typeof reason !== "object" || !plainRecords.has(reason)) reportFailure(err, "serialize");
|
|
2198
|
+
if (writingRecord) recordFailed = true;else if (rejection) {
|
|
2199
|
+
plainFor(key, reason);
|
|
2200
|
+
claimLater(reason);
|
|
2201
|
+
} else if (!options.serializer && !firstFlushed && !stranded) {
|
|
2202
|
+
stranded = true;
|
|
2203
|
+
deferFlush(() => abandon());
|
|
2204
|
+
}
|
|
2100
2205
|
},
|
|
2101
|
-
late: rejectUnserializedKey
|
|
2206
|
+
late: (serialize, refs, onData, scopeId) => rejectUnserializedKey(serialize, refs, onData, scopeId, key => !firstFlushed && rejected.has(key) ? plainMessage(key, rejected.get(key)) : undefined)
|
|
2102
2207
|
});
|
|
2103
2208
|
let rootAssetsSerialized = false;
|
|
2104
2209
|
const serializeRootAssets = () => {
|
|
@@ -2177,7 +2282,10 @@ function renderToStream(code, options = {}) {
|
|
|
2177
2282
|
raced.catch(() => {});
|
|
2178
2283
|
pendingSerialized.set(id, settle);
|
|
2179
2284
|
const drop = () => pendingSerialized.delete(id);
|
|
2180
|
-
p.then(drop,
|
|
2285
|
+
p.then(drop, reason => {
|
|
2286
|
+
drop();
|
|
2287
|
+
rejected.set(id, reason);
|
|
2288
|
+
});
|
|
2181
2289
|
return raced;
|
|
2182
2290
|
};
|
|
2183
2291
|
const abandonSubtree = (key, error) => {
|
|
@@ -2340,12 +2448,17 @@ function renderToStream(code, options = {}) {
|
|
|
2340
2448
|
const last = html.indexOf(`<!--!$/${id}-->`, first + placeholder.length);
|
|
2341
2449
|
html = html.slice(0, first) + resolveSSRSync(escape(payloadFn())) + html.slice(last + placeholder.length + 1);
|
|
2342
2450
|
},
|
|
2343
|
-
serialize(id, p, deferStream) {
|
|
2451
|
+
serialize(id, p, deferStream, errorRecord) {
|
|
2344
2452
|
p = guardChannel(p);
|
|
2345
2453
|
if (p && typeof p === "object" && typeof p.then === "function") {
|
|
2346
2454
|
if (!firstFlushed && deferStream) {
|
|
2347
2455
|
blockingPromises.add(p);
|
|
2348
|
-
p.then(d => write(id, d)).catch(e =>
|
|
2456
|
+
p.then(d => write(id, d)).catch(e => {
|
|
2457
|
+
rejected.set(id, e);
|
|
2458
|
+
const r = Promise.reject(e);
|
|
2459
|
+
r.catch(() => {});
|
|
2460
|
+
write(id, r);
|
|
2461
|
+
});
|
|
2349
2462
|
return;
|
|
2350
2463
|
}
|
|
2351
2464
|
p = trackSerialized(id, p);
|
|
@@ -2354,7 +2467,7 @@ function renderToStream(code, options = {}) {
|
|
|
2354
2467
|
return;
|
|
2355
2468
|
}
|
|
2356
2469
|
}
|
|
2357
|
-
write(id, p);
|
|
2470
|
+
write(id, p, errorRecord);
|
|
2358
2471
|
},
|
|
2359
2472
|
escape: escape,
|
|
2360
2473
|
resolve: resolveSSRNode,
|
|
@@ -2428,7 +2541,7 @@ function renderToStream(code, options = {}) {
|
|
|
2428
2541
|
const styles = collectStreamStyles(key, tracking, headStyles);
|
|
2429
2542
|
const headOps = error ? null : flushHeadFragment(headRegistry, key, nonce);
|
|
2430
2543
|
if (headOps) emitHeadOps(key, headOps);
|
|
2431
|
-
sink.fragment(key,
|
|
2544
|
+
sink.fragment(key, value !== undefined ? value : error ? "" : " ", {
|
|
2432
2545
|
styles,
|
|
2433
2546
|
revealGroup,
|
|
2434
2547
|
error: error ? ssrSanitizeError(error, null, undefined, undefined, errorScope) : error
|
|
@@ -2459,6 +2572,10 @@ function renderToStream(code, options = {}) {
|
|
|
2459
2572
|
context.failRender = failRender;
|
|
2460
2573
|
context.errorPolicy = options.onError;
|
|
2461
2574
|
context._errorScope = errorScope;
|
|
2575
|
+
context.contained = (error, wire) => {
|
|
2576
|
+
caught.add(error);
|
|
2577
|
+
caught.add(wire);
|
|
2578
|
+
};
|
|
2462
2579
|
context.flushed = () => firstFlushed;
|
|
2463
2580
|
context.trace = requestEvent ? traceForEvent(requestEvent) : traceFor(context, undefined);
|
|
2464
2581
|
render = timeDocument(context, context.trace, "stream", requestEvent);
|
|
@@ -2576,7 +2693,7 @@ function renderToStream(code, options = {}) {
|
|
|
2576
2693
|
flushStubBatch();
|
|
2577
2694
|
const head = renderShellHead(headRegistry, nonce, k => registry.has(k), noScripts, traceMetaMarkup(context.trace));
|
|
2578
2695
|
if (render) render.shell();
|
|
2579
|
-
sink.shell(
|
|
2696
|
+
sink.shell(html, {
|
|
2580
2697
|
preloads: tracking.emittedAssets,
|
|
2581
2698
|
preloadLinks: tracking.preloadLinks,
|
|
2582
2699
|
inlineStyles: tracking.inlineStyles,
|
|
@@ -2652,7 +2769,7 @@ function renderToStream(code, options = {}) {
|
|
|
2652
2769
|
return;
|
|
2653
2770
|
}
|
|
2654
2771
|
if (!shellCompleted) return flush();
|
|
2655
|
-
if (
|
|
2772
|
+
if (claim()) return abandon();
|
|
2656
2773
|
const encoder = new TextEncoder();
|
|
2657
2774
|
const writer = w.getWriter();
|
|
2658
2775
|
let pendingWrites = Promise.resolve();
|
|
@@ -2752,7 +2869,7 @@ function renderToStream(code, options = {}) {
|
|
|
2752
2869
|
return;
|
|
2753
2870
|
}
|
|
2754
2871
|
if (!shellCompleted) return flush();
|
|
2755
|
-
if (
|
|
2872
|
+
if (claim()) return abandon();
|
|
2756
2873
|
const sink = guardSink(w);
|
|
2757
2874
|
buffer = writable = coalesceWrites(sink.write, sink.end);
|
|
2758
2875
|
buffer.write(tmp);
|
|
@@ -2818,6 +2935,8 @@ function buildAsyncWrap(err, node) {
|
|
|
2818
2935
|
fn.$rw = true;
|
|
2819
2936
|
if (suppress) fn.$lhSuppress = true;
|
|
2820
2937
|
if (node.$lhSkip) fn.$lhSkip = true;
|
|
2938
|
+
if (node.$lhInTag) fn.$lhInTag = true;
|
|
2939
|
+
if (node.$lhAttr) fn.$lhAttr = node.$lhAttr;
|
|
2821
2940
|
if (node.$lhBinding) fn.$lhBinding = node.$lhBinding;
|
|
2822
2941
|
return {
|
|
2823
2942
|
fn,
|
|
@@ -3019,7 +3138,8 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
|
|
|
3019
3138
|
t: [""],
|
|
3020
3139
|
h: [],
|
|
3021
3140
|
p: [],
|
|
3022
|
-
rows: null
|
|
3141
|
+
rows: null,
|
|
3142
|
+
$: SSR_NODE
|
|
3023
3143
|
};
|
|
3024
3144
|
try {
|
|
3025
3145
|
result.rows = resolveValue(holeValue(hole), result);
|
|
@@ -3118,16 +3238,41 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
|
|
|
3118
3238
|
},
|
|
3119
3239
|
nest(hole) {
|
|
3120
3240
|
const s = engine.scope;
|
|
3121
|
-
if (!s || s.h === hole || hole.$lhSkip || inScope && !inScope()) return undefined;
|
|
3241
|
+
if (!s || s.h === hole || hole.$lhSkip || hole.$lhInTag || inScope && !inScope()) return undefined;
|
|
3122
3242
|
engine.scope = scopeFor(hole);
|
|
3123
3243
|
return s;
|
|
3124
3244
|
},
|
|
3125
3245
|
content(hole) {
|
|
3246
|
+
if (hole.$lhInTag) {
|
|
3247
|
+
const cap = hole.$lhAttr;
|
|
3248
|
+
if (!cap || cap.adopted || engine.suppressed || engine.sweeping) return null;
|
|
3249
|
+
const r = tryResolveFunctionHole(hole);
|
|
3250
|
+
if (typeof r !== "string") {
|
|
3251
|
+
const res = {
|
|
3252
|
+
t: [""],
|
|
3253
|
+
h: [],
|
|
3254
|
+
p: [],
|
|
3255
|
+
$: SSR_NODE
|
|
3256
|
+
};
|
|
3257
|
+
appendResolvedNode(res, r);
|
|
3258
|
+
return res;
|
|
3259
|
+
}
|
|
3260
|
+
if (--cap.waiting === 0 && !cap.closed) {
|
|
3261
|
+
try {
|
|
3262
|
+
cap.base = attrPartsText(cap.parts);
|
|
3263
|
+
} catch (err) {
|
|
3264
|
+
cap.base = null;
|
|
3265
|
+
}
|
|
3266
|
+
if (cap.base !== null) engine.attr(cap);
|
|
3267
|
+
}
|
|
3268
|
+
return r;
|
|
3269
|
+
}
|
|
3126
3270
|
if (hole.$lhSuppress) {
|
|
3127
3271
|
const r = {
|
|
3128
3272
|
t: [""],
|
|
3129
3273
|
h: [],
|
|
3130
|
-
p: []
|
|
3274
|
+
p: [],
|
|
3275
|
+
$: SSR_NODE
|
|
3131
3276
|
};
|
|
3132
3277
|
let rows = null;
|
|
3133
3278
|
const b = hole.$lhBinding;
|
|
@@ -3231,7 +3376,8 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
|
|
|
3231
3376
|
const r = {
|
|
3232
3377
|
t: [""],
|
|
3233
3378
|
h: [],
|
|
3234
|
-
p: []
|
|
3379
|
+
p: [],
|
|
3380
|
+
$: SSR_NODE
|
|
3235
3381
|
};
|
|
3236
3382
|
engine.suppressed++;
|
|
3237
3383
|
try {
|
|
@@ -3250,13 +3396,15 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
|
|
|
3250
3396
|
res = {
|
|
3251
3397
|
t: ["", ""],
|
|
3252
3398
|
h: [escalated.fn],
|
|
3253
|
-
p: [escalated.p]
|
|
3399
|
+
p: [escalated.p],
|
|
3400
|
+
$: SSR_NODE
|
|
3254
3401
|
};
|
|
3255
3402
|
} else {
|
|
3256
3403
|
res = {
|
|
3257
3404
|
t: [""],
|
|
3258
3405
|
h: [],
|
|
3259
|
-
p: []
|
|
3406
|
+
p: [],
|
|
3407
|
+
$: SSR_NODE
|
|
3260
3408
|
};
|
|
3261
3409
|
try {
|
|
3262
3410
|
rows = resolveValue(value, res);
|
|
@@ -3286,20 +3434,59 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
|
|
|
3286
3434
|
t[t.length - 1] += close;
|
|
3287
3435
|
sink.openBinding(key, b);
|
|
3288
3436
|
return {
|
|
3289
|
-
t,
|
|
3437
|
+
t: t,
|
|
3290
3438
|
h: res.h,
|
|
3291
|
-
p: res.p
|
|
3439
|
+
p: res.p,
|
|
3440
|
+
$: SSR_NODE
|
|
3292
3441
|
};
|
|
3293
3442
|
},
|
|
3294
3443
|
mint() {
|
|
3295
3444
|
return nextId++;
|
|
3296
3445
|
},
|
|
3446
|
+
open(text, off, hole) {
|
|
3447
|
+
const pending = hole && hole.$lhAttr;
|
|
3448
|
+
let inject;
|
|
3449
|
+
let id;
|
|
3450
|
+
if (pending && !pending.adopted && text.startsWith(pending.inject, off)) {
|
|
3451
|
+
pending.adopted = true;
|
|
3452
|
+
({
|
|
3453
|
+
id,
|
|
3454
|
+
inject
|
|
3455
|
+
} = pending);
|
|
3456
|
+
} else {
|
|
3457
|
+
id = nextId++;
|
|
3458
|
+
inject = ` data-lha="${id}"`;
|
|
3459
|
+
text = text.slice(0, off) + inject + text.slice(off);
|
|
3460
|
+
}
|
|
3461
|
+
const prefix = text.slice(off + inject.length);
|
|
3462
|
+
return {
|
|
3463
|
+
id,
|
|
3464
|
+
parts: [prefix],
|
|
3465
|
+
base: prefix,
|
|
3466
|
+
inject,
|
|
3467
|
+
waiting: 0,
|
|
3468
|
+
text
|
|
3469
|
+
};
|
|
3470
|
+
},
|
|
3471
|
+
retry(fn, cap) {
|
|
3472
|
+
if (typeof fn !== "function") return;
|
|
3473
|
+
fn.$lhInTag = true;
|
|
3474
|
+
if (cap) {
|
|
3475
|
+
fn.$lhAttr = cap;
|
|
3476
|
+
cap.waiting++;
|
|
3477
|
+
}
|
|
3478
|
+
},
|
|
3297
3479
|
active() {
|
|
3298
3480
|
return (!inScope || inScope()) && !(settled && settled());
|
|
3299
3481
|
},
|
|
3300
3482
|
attr(cap) {
|
|
3301
|
-
|
|
3302
|
-
|
|
3483
|
+
if (cap.waiting) {
|
|
3484
|
+
cap.owner = getOwner();
|
|
3485
|
+
cap.ctx = sharedConfig.context;
|
|
3486
|
+
return;
|
|
3487
|
+
}
|
|
3488
|
+
const owner = cap.owner !== undefined ? cap.owner : getOwner();
|
|
3489
|
+
const holeCtx = cap.ctx !== undefined ? cap.ctx : sharedConfig.context;
|
|
3303
3490
|
const b = {
|
|
3304
3491
|
key: "lha:" + cap.id,
|
|
3305
3492
|
children: [],
|
|
@@ -3314,29 +3501,7 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
|
|
|
3314
3501
|
engine.gateHit = false;
|
|
3315
3502
|
let html = "";
|
|
3316
3503
|
try {
|
|
3317
|
-
|
|
3318
|
-
let groupVal = null;
|
|
3319
|
-
const run = () => {
|
|
3320
|
-
for (const part of cap.parts) {
|
|
3321
|
-
if (typeof part === "string") {
|
|
3322
|
-
html += part;
|
|
3323
|
-
continue;
|
|
3324
|
-
}
|
|
3325
|
-
let v;
|
|
3326
|
-
if (part.g) {
|
|
3327
|
-
if (group !== part.g) {
|
|
3328
|
-
group = part.g;
|
|
3329
|
-
groupVal = part.g();
|
|
3330
|
-
}
|
|
3331
|
-
v = groupVal[part.i];
|
|
3332
|
-
} else {
|
|
3333
|
-
v = part.f();
|
|
3334
|
-
}
|
|
3335
|
-
const vt = typeof v;
|
|
3336
|
-
if (vt === "string" || vt === "number") html += v;
|
|
3337
|
-
}
|
|
3338
|
-
};
|
|
3339
|
-
swept(owner, holeCtx, run);
|
|
3504
|
+
swept(owner, holeCtx, () => html = attrPartsText(cap.parts));
|
|
3340
3505
|
} catch (err) {
|
|
3341
3506
|
if (ssrHandleError(err, true)) {
|
|
3342
3507
|
if (!engine.sweptOwners) return;
|
|
@@ -3443,10 +3608,35 @@ function rowPatch(a, b) {
|
|
|
3443
3608
|
}
|
|
3444
3609
|
}
|
|
3445
3610
|
}
|
|
3611
|
+
function attrPartsText(parts) {
|
|
3612
|
+
let html = "";
|
|
3613
|
+
let group = null;
|
|
3614
|
+
let groupVal = null;
|
|
3615
|
+
for (const part of parts) {
|
|
3616
|
+
if (typeof part === "string") {
|
|
3617
|
+
html += part;
|
|
3618
|
+
continue;
|
|
3619
|
+
}
|
|
3620
|
+
let v;
|
|
3621
|
+
if (part.g) {
|
|
3622
|
+
if (group !== part.g) {
|
|
3623
|
+
group = part.g;
|
|
3624
|
+
groupVal = part.g();
|
|
3625
|
+
}
|
|
3626
|
+
v = groupVal[part.i];
|
|
3627
|
+
} else {
|
|
3628
|
+
v = part.f();
|
|
3629
|
+
}
|
|
3630
|
+
const vt = typeof v;
|
|
3631
|
+
if (vt === "string" || vt === "number") html += v;
|
|
3632
|
+
}
|
|
3633
|
+
return html;
|
|
3634
|
+
}
|
|
3446
3635
|
function ssr(t) {
|
|
3447
3636
|
const len = arguments.length;
|
|
3448
3637
|
if (len === 1) return {
|
|
3449
|
-
t
|
|
3638
|
+
t: t,
|
|
3639
|
+
$: SSR_NODE
|
|
3450
3640
|
};
|
|
3451
3641
|
let s = t[0];
|
|
3452
3642
|
let result = null;
|
|
@@ -3462,30 +3652,18 @@ function ssr(t) {
|
|
|
3462
3652
|
seg: -1,
|
|
3463
3653
|
off: hp.openOff[0]
|
|
3464
3654
|
};
|
|
3465
|
-
const captureStart =
|
|
3655
|
+
const captureStart = hole => {
|
|
3466
3656
|
if (cap) return true;
|
|
3467
3657
|
if (!lastOpen || live.suppressed || live.sweeping || !live.active()) return false;
|
|
3658
|
+
if (lastOpen.r === null && result !== null && result.t.length === 1) {
|
|
3659
|
+
lastOpen.r = result;
|
|
3660
|
+
lastOpen.seg = 0;
|
|
3661
|
+
}
|
|
3468
3662
|
if (lastOpen.r !== result || result !== null && lastOpen.seg !== result.t.length - 1) {
|
|
3469
3663
|
return false;
|
|
3470
3664
|
}
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
let prefix;
|
|
3474
|
-
if (result === null) {
|
|
3475
|
-
s = s.slice(0, lastOpen.off) + inject + s.slice(lastOpen.off);
|
|
3476
|
-
prefix = s.slice(lastOpen.off + inject.length);
|
|
3477
|
-
} else {
|
|
3478
|
-
const seg = result.t[lastOpen.seg];
|
|
3479
|
-
result.t[lastOpen.seg] = seg.slice(0, lastOpen.off) + inject + seg.slice(lastOpen.off);
|
|
3480
|
-
prefix = result.t[lastOpen.seg].slice(lastOpen.off + inject.length);
|
|
3481
|
-
}
|
|
3482
|
-
cap = {
|
|
3483
|
-
id,
|
|
3484
|
-
parts: [prefix],
|
|
3485
|
-
base: prefix,
|
|
3486
|
-
at: lastOpen.seg,
|
|
3487
|
-
inject
|
|
3488
|
-
};
|
|
3665
|
+
cap = live.open(result === null ? s : result.t[lastOpen.seg], lastOpen.off, hole);
|
|
3666
|
+
if (result === null) s = cap.text;else result.t[lastOpen.seg] = cap.text;
|
|
3489
3667
|
return true;
|
|
3490
3668
|
};
|
|
3491
3669
|
for (let i = 1; i < len; i++) {
|
|
@@ -3516,7 +3694,8 @@ function ssr(t) {
|
|
|
3516
3694
|
result = {
|
|
3517
3695
|
t: [s],
|
|
3518
3696
|
h: [],
|
|
3519
|
-
p: []
|
|
3697
|
+
p: [],
|
|
3698
|
+
$: SSR_NODE
|
|
3520
3699
|
};
|
|
3521
3700
|
s = "";
|
|
3522
3701
|
}
|
|
@@ -3526,18 +3705,23 @@ function ssr(t) {
|
|
|
3526
3705
|
if (Array.isArray(lastGroupVal)) {
|
|
3527
3706
|
value = lastGroupVal[lastGroupIdx++];
|
|
3528
3707
|
hasValue = true;
|
|
3529
|
-
if (live && !hp.pos[i - 1] && captureStart()) {
|
|
3708
|
+
if (live && !hp.pos[i - 1] && captureStart(hole)) {
|
|
3530
3709
|
cap.parts.push({
|
|
3531
3710
|
g: hole,
|
|
3532
3711
|
i: lastGroupIdx - 1
|
|
3533
3712
|
});
|
|
3534
3713
|
}
|
|
3535
3714
|
} else {
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3715
|
+
const slot = ssrGroupSlot(lastGroupVal.fn, lastGroupIdx++);
|
|
3716
|
+
if (live && !hp.pos[i - 1]) {
|
|
3717
|
+
const capturing = captureStart(hole);
|
|
3718
|
+
if (capturing) cap.parts.push({
|
|
3719
|
+
g: hole,
|
|
3720
|
+
i: lastGroupIdx - 1
|
|
3721
|
+
});
|
|
3722
|
+
live.retry(slot, capturing && cap);
|
|
3539
3723
|
}
|
|
3540
|
-
result.h.push(
|
|
3724
|
+
result.h.push(slot);
|
|
3541
3725
|
result.p.push(lastGroupVal.p);
|
|
3542
3726
|
result.t.push("");
|
|
3543
3727
|
}
|
|
@@ -3557,7 +3741,8 @@ function ssr(t) {
|
|
|
3557
3741
|
result = {
|
|
3558
3742
|
t: [s],
|
|
3559
3743
|
h: [],
|
|
3560
|
-
p: []
|
|
3744
|
+
p: [],
|
|
3745
|
+
$: SSR_NODE
|
|
3561
3746
|
};
|
|
3562
3747
|
s = "";
|
|
3563
3748
|
if (rs.merge !== undefined) mergeTemplateInto(result, rs.merge);else resolveSSRNode(rs.bail, result);
|
|
@@ -3574,7 +3759,8 @@ function ssr(t) {
|
|
|
3574
3759
|
result = {
|
|
3575
3760
|
t: [s],
|
|
3576
3761
|
h: [],
|
|
3577
|
-
p: []
|
|
3762
|
+
p: [],
|
|
3763
|
+
$: SSR_NODE
|
|
3578
3764
|
};
|
|
3579
3765
|
s = "";
|
|
3580
3766
|
}
|
|
@@ -3582,28 +3768,27 @@ function ssr(t) {
|
|
|
3582
3768
|
}
|
|
3583
3769
|
} else if (result !== null) {
|
|
3584
3770
|
const inTag = live && !hp.pos[i - 1];
|
|
3585
|
-
const capturing = inTag && captureStart();
|
|
3771
|
+
const capturing = inTag && captureStart(hole);
|
|
3586
3772
|
const li = capturing ? result.t.length - 1 : 0;
|
|
3587
3773
|
const before = capturing ? result.t[li].length : 0;
|
|
3774
|
+
const pushed = result.h.length;
|
|
3588
3775
|
if (live) live.suppressed++;
|
|
3589
3776
|
try {
|
|
3590
3777
|
resolveSSRNode(hole, result);
|
|
3591
3778
|
} finally {
|
|
3592
3779
|
if (live) live.suppressed--;
|
|
3593
3780
|
}
|
|
3781
|
+
if (inTag) {
|
|
3782
|
+
for (let k = pushed; k < result.h.length; k++) live.retry(result.h[k], capturing && cap);
|
|
3783
|
+
}
|
|
3594
3784
|
if (capturing) {
|
|
3595
|
-
if (result.t.length - 1 === li)
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
});
|
|
3600
|
-
} else {
|
|
3601
|
-
result.t[cap.at] = result.t[cap.at].replace(cap.inject, "");
|
|
3602
|
-
cap = null;
|
|
3603
|
-
}
|
|
3785
|
+
if (result.t.length - 1 === li) cap.base += result.t[li].slice(before);
|
|
3786
|
+
cap.parts.push({
|
|
3787
|
+
f: hole
|
|
3788
|
+
});
|
|
3604
3789
|
}
|
|
3605
3790
|
} else {
|
|
3606
|
-
const capturing = live && !hp.pos[i - 1] && captureStart();
|
|
3791
|
+
const capturing = live && !hp.pos[i - 1] && captureStart(hole);
|
|
3607
3792
|
const scope = live && hp.pos[i - 1] && live.nest(hole);
|
|
3608
3793
|
const r = tryResolveFunctionHole(hole);
|
|
3609
3794
|
if (scope) live.scope = scope;
|
|
@@ -3616,17 +3801,18 @@ function ssr(t) {
|
|
|
3616
3801
|
});
|
|
3617
3802
|
}
|
|
3618
3803
|
} else {
|
|
3619
|
-
if (capturing) {
|
|
3620
|
-
s = s.replace(cap.inject, "");
|
|
3621
|
-
cap = null;
|
|
3622
|
-
}
|
|
3623
3804
|
result = {
|
|
3624
3805
|
t: [s],
|
|
3625
3806
|
h: [],
|
|
3626
|
-
p: []
|
|
3807
|
+
p: [],
|
|
3808
|
+
$: SSR_NODE
|
|
3627
3809
|
};
|
|
3628
3810
|
s = "";
|
|
3629
3811
|
appendResolvedNode(result, r);
|
|
3812
|
+
if (capturing) cap.parts.push({
|
|
3813
|
+
f: hole
|
|
3814
|
+
});
|
|
3815
|
+
if (live && !hp.pos[i - 1]) for (const h of result.h) live.retry(h, capturing && cap);
|
|
3630
3816
|
}
|
|
3631
3817
|
}
|
|
3632
3818
|
} else if (result !== null) {
|
|
@@ -3639,7 +3825,8 @@ function ssr(t) {
|
|
|
3639
3825
|
result = {
|
|
3640
3826
|
t: [s],
|
|
3641
3827
|
h: [],
|
|
3642
|
-
p: []
|
|
3828
|
+
p: [],
|
|
3829
|
+
$: SSR_NODE
|
|
3643
3830
|
};
|
|
3644
3831
|
s = "";
|
|
3645
3832
|
appendResolvedNode(result, r);
|
|
@@ -3675,7 +3862,8 @@ function ssr(t) {
|
|
|
3675
3862
|
if (result === null) s += next;else result.t[result.t.length - 1] += next;
|
|
3676
3863
|
}
|
|
3677
3864
|
if (result === null) return {
|
|
3678
|
-
t: s
|
|
3865
|
+
t: s,
|
|
3866
|
+
$: SSR_NODE
|
|
3679
3867
|
};
|
|
3680
3868
|
return result;
|
|
3681
3869
|
}
|
|
@@ -3755,6 +3943,7 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
|
|
|
3755
3943
|
}
|
|
3756
3944
|
const info = tagInfo(tag);
|
|
3757
3945
|
const skipChildren = info.isVoid;
|
|
3946
|
+
let sel, optValue, optOwn;
|
|
3758
3947
|
let result = info.open + hk;
|
|
3759
3948
|
let childOwner = null;
|
|
3760
3949
|
const last = sources === null ? 0 : sources.length - 1;
|
|
@@ -3773,6 +3962,11 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
|
|
|
3773
3962
|
for (let j = s + 1; j <= last; j++) {
|
|
3774
3963
|
if (keysOf[j].includes(prop)) continue nextKey;
|
|
3775
3964
|
}
|
|
3965
|
+
if (info.sel === 1 && prop === "value") {
|
|
3966
|
+
const value = props[prop];
|
|
3967
|
+
sel = ssrSelect(value);
|
|
3968
|
+
continue;
|
|
3969
|
+
}
|
|
3776
3970
|
if (info.textarea && (prop === "value" || prop === "defaultValue")) {
|
|
3777
3971
|
const value = props[prop];
|
|
3778
3972
|
if (value !== null) children = escape(value);
|
|
@@ -3792,6 +3986,9 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
|
|
|
3792
3986
|
const value = props[key];
|
|
3793
3987
|
if (value == undefined || prop.startsWith("prop:") || prop === "ref" || isEventName(prop)) continue;
|
|
3794
3988
|
if (link !== null && LinkAttributes.has(prop)) link[prop] = value;
|
|
3989
|
+
if (info.sel === 2) {
|
|
3990
|
+
if (prop === "value") optValue = value;else if (prop === "selected" && value) optOwn = true;
|
|
3991
|
+
}
|
|
3795
3992
|
if (prop === "style") {
|
|
3796
3993
|
result += ` style="${ssrStyle(value)}"`;
|
|
3797
3994
|
} else if (prop === "class") {
|
|
@@ -3806,10 +4003,11 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
|
|
|
3806
4003
|
if (attrs !== undefined) result += typeof attrs === "function" ? attrs() : attrs;
|
|
3807
4004
|
if (link !== null && link.href !== undefined) result += ssrLinkClaim(link);
|
|
3808
4005
|
if (skipChildren) return {
|
|
3809
|
-
t: result + " />"
|
|
4006
|
+
t: result + " />",
|
|
4007
|
+
$: SSR_NODE
|
|
3810
4008
|
};
|
|
3811
|
-
if (
|
|
3812
|
-
if (typeof children
|
|
4009
|
+
if (sel !== undefined) children = ssrIn(sel, () => spreadChildren(info, childOwner, children));else children = spreadChildren(info, childOwner, children);
|
|
4010
|
+
if (info.sel === 2) result += ssrOption(optValue !== undefined || typeof children !== "string" ? optValue : children.replace(/</g, "<").replace(/&/g, "&").replace(/\s+/g, " ").trim(), undefined, optOwn);
|
|
3813
4011
|
let thunk = null;
|
|
3814
4012
|
if (typeof children === "function" && (ctx === undefined || !ctx.liveHoles)) {
|
|
3815
4013
|
thunk = children;
|
|
@@ -3820,7 +4018,8 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
|
|
|
3820
4018
|
const res = {
|
|
3821
4019
|
t: [""],
|
|
3822
4020
|
h: [],
|
|
3823
|
-
p: []
|
|
4021
|
+
p: [],
|
|
4022
|
+
$: SSR_NODE
|
|
3824
4023
|
};
|
|
3825
4024
|
pushSSRAsyncHole(res, err, thunk);
|
|
3826
4025
|
return ssr([result + ">", info.close], res);
|
|
@@ -3828,19 +4027,23 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
|
|
|
3828
4027
|
}
|
|
3829
4028
|
const ct = typeof children;
|
|
3830
4029
|
if (ct === "string" || ct === "number") return {
|
|
3831
|
-
t: result + ">" + children + info.close
|
|
4030
|
+
t: result + ">" + children + info.close,
|
|
4031
|
+
$: SSR_NODE
|
|
3832
4032
|
};
|
|
3833
4033
|
if (children == null || ct === "boolean") return {
|
|
3834
|
-
t: result + ">" + info.close
|
|
4034
|
+
t: result + ">" + info.close,
|
|
4035
|
+
$: SSR_NODE
|
|
3835
4036
|
};
|
|
3836
|
-
if (ct === "object" && !children.h && typeof children.t === "string") return {
|
|
3837
|
-
t: result + ">" + children.t + info.close
|
|
4037
|
+
if (ct === "object" && children.$ === SSR_NODE && !children.h && typeof children.t === "string") return {
|
|
4038
|
+
t: result + ">" + children.t + info.close,
|
|
4039
|
+
$: SSR_NODE
|
|
3838
4040
|
};
|
|
3839
4041
|
if (thunk === null) return ssr([result + ">", info.close], resolveSSRNode(children, undefined, true));
|
|
3840
4042
|
const res = {
|
|
3841
4043
|
t: [""],
|
|
3842
4044
|
h: [],
|
|
3843
|
-
p: []
|
|
4045
|
+
p: [],
|
|
4046
|
+
$: SSR_NODE
|
|
3844
4047
|
};
|
|
3845
4048
|
try {
|
|
3846
4049
|
resolveSSRNode(children, res, false, true);
|
|
@@ -3849,6 +4052,10 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
|
|
|
3849
4052
|
}
|
|
3850
4053
|
return ssr([result + ">", info.close], res);
|
|
3851
4054
|
}
|
|
4055
|
+
function spreadChildren(info, childOwner, children) {
|
|
4056
|
+
if (childOwner !== null) children = info.raw ? childOwner.children : escape(childOwner.children);
|
|
4057
|
+
return typeof children === "function" ? children() : children;
|
|
4058
|
+
}
|
|
3852
4059
|
function collectSpreadSources(props, viewKeys, owners) {
|
|
3853
4060
|
for (let i = 0; i < props.length; i++) {
|
|
3854
4061
|
let s = props[i];
|
|
@@ -3891,110 +4098,37 @@ function ssrLinkClaim(attrs) {
|
|
|
3891
4098
|
if (ctx === undefined || ctx.linkClaim === undefined || attrs["aria-current"] != null) return "";
|
|
3892
4099
|
return ctx.linkClaim(attrs);
|
|
3893
4100
|
}
|
|
3894
|
-
|
|
3895
|
-
|
|
4101
|
+
const SELECT = Symbol();
|
|
4102
|
+
function ssrSelect(value) {
|
|
4103
|
+
const owner = createOwner({
|
|
4104
|
+
transparent: true
|
|
4105
|
+
});
|
|
4106
|
+
const state = {
|
|
4107
|
+
v: value,
|
|
4108
|
+
d: false,
|
|
4109
|
+
o: owner
|
|
4110
|
+
};
|
|
4111
|
+
owner._context = {
|
|
4112
|
+
...owner._context,
|
|
4113
|
+
[SELECT]: state
|
|
4114
|
+
};
|
|
4115
|
+
return state;
|
|
3896
4116
|
}
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
for (let j = i + 1; j < html.length; j++) {
|
|
3900
|
-
const c = html.charCodeAt(j);
|
|
3901
|
-
if (c === 34) {
|
|
3902
|
-
j = html.indexOf('"', j + 1);
|
|
3903
|
-
if (j < 0) return -1;
|
|
3904
|
-
} else if (c === 62) return j;
|
|
3905
|
-
}
|
|
3906
|
-
return -1;
|
|
4117
|
+
function ssrIn(state, fn) {
|
|
4118
|
+
return runWithOwner(state.o, fn);
|
|
3907
4119
|
}
|
|
3908
|
-
function
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
const lt = html.indexOf("<", i);
|
|
3913
|
-
if (lt < 0) return t + html.slice(i);
|
|
3914
|
-
t += html.slice(i, lt);
|
|
3915
|
-
if (!html.startsWith("<!--", lt)) return t;
|
|
3916
|
-
const ce = html.indexOf("-->", lt);
|
|
3917
|
-
if (ce < 0) return t;
|
|
3918
|
-
i = ce + 3;
|
|
3919
|
-
}
|
|
3920
|
-
}
|
|
3921
|
-
function tagIs(html, i, name) {
|
|
3922
|
-
if (!html.startsWith(name, i + 1)) return false;
|
|
3923
|
-
const c = html.charCodeAt(i + 1 + name.length);
|
|
3924
|
-
return c === 32 || c === 62 || c === 9 || c === 10 || c === 13;
|
|
3925
|
-
}
|
|
3926
|
-
let selectValuesActive = false;
|
|
3927
|
-
function ssrSelectValues() {
|
|
3928
|
-
selectValuesActive = true;
|
|
3929
|
-
}
|
|
3930
|
-
function resolveSSRSelectValues(html) {
|
|
3931
|
-
if (!selectValuesActive) return html;
|
|
3932
|
-
let cand = html.indexOf("<select");
|
|
3933
|
-
if (cand < 0) return html;
|
|
3934
|
-
let out = "";
|
|
3935
|
-
let idx = 0;
|
|
3936
|
-
while (cand >= 0) {
|
|
3937
|
-
if (!tagIs(html, cand, "select")) {
|
|
3938
|
-
cand = html.indexOf("<select", cand + 7);
|
|
3939
|
-
continue;
|
|
3940
|
-
}
|
|
3941
|
-
const e0 = tagEnd(html, cand);
|
|
3942
|
-
if (e0 < 0) break;
|
|
3943
|
-
const open = html.slice(cand, e0 + 1);
|
|
3944
|
-
const m = SELECT_VALUE_ATTR.exec(open);
|
|
3945
|
-
if (!m) {
|
|
3946
|
-
cand = html.indexOf("<select", e0 + 1);
|
|
3947
|
-
continue;
|
|
3948
|
-
}
|
|
3949
|
-
const bound = decodeSSREntities(m[1] ?? "");
|
|
3950
|
-
const sel = {
|
|
3951
|
-
values: /\smultiple(?=[\s>=])/.test(open) ? bound.split(",") : [bound],
|
|
3952
|
-
strip: cand + m.index,
|
|
3953
|
-
stripEnd: cand + m.index + m[0].length,
|
|
3954
|
-
body: e0 + 1,
|
|
3955
|
-
marks: [],
|
|
3956
|
-
defaulted: false
|
|
3957
|
-
};
|
|
3958
|
-
let committed = false;
|
|
3959
|
-
let i = html.indexOf("<", e0 + 1);
|
|
3960
|
-
while (i >= 0) {
|
|
3961
|
-
let e;
|
|
3962
|
-
if (html.charCodeAt(i + 1) === 33) {
|
|
3963
|
-
e = html.charCodeAt(i + 2) === 45 ? html.indexOf("-->", i) : html.indexOf(">", i);
|
|
3964
|
-
if (e < 0) break;
|
|
3965
|
-
if (html.charCodeAt(i + 2) === 45) e += 2;
|
|
3966
|
-
} else {
|
|
3967
|
-
e = tagEnd(html, i);
|
|
3968
|
-
if (e < 0) break;
|
|
3969
|
-
if (html.startsWith("</select>", i)) {
|
|
3970
|
-
out += html.slice(idx, sel.strip) + html.slice(sel.stripEnd, sel.body);
|
|
3971
|
-
let seg = sel.body;
|
|
3972
|
-
if (!sel.defaulted) {
|
|
3973
|
-
for (let k = 0; k < sel.marks.length; k++) {
|
|
3974
|
-
out += html.slice(seg, sel.marks[k]) + " selected";
|
|
3975
|
-
seg = sel.marks[k];
|
|
3976
|
-
}
|
|
3977
|
-
}
|
|
3978
|
-
out += html.slice(seg, i);
|
|
3979
|
-
idx = i;
|
|
3980
|
-
committed = true;
|
|
3981
|
-
break;
|
|
3982
|
-
} else if (tagIs(html, i, "option")) {
|
|
3983
|
-
const attrs = html.slice(i + 7, e);
|
|
3984
|
-
if (/\sselected(?=[\s=]|$)/.test(attrs)) sel.defaulted = true;else {
|
|
3985
|
-
const vm = SELECT_VALUE_ATTR.exec(attrs);
|
|
3986
|
-
const value = vm ? decodeSSREntities(vm[1] ?? "") : decodeSSREntities(optionText(html, e + 1)).replace(/\s+/g, " ").trim();
|
|
3987
|
-
if (sel.values.includes(value)) sel.marks.push(e);
|
|
3988
|
-
}
|
|
3989
|
-
}
|
|
3990
|
-
}
|
|
3991
|
-
i = html.indexOf("<", e + 1);
|
|
3992
|
-
}
|
|
3993
|
-
if (!committed) break;
|
|
3994
|
-
cand = html.indexOf("<select", idx);
|
|
4120
|
+
function ssrOption(value, state, own) {
|
|
4121
|
+
if (state === undefined) {
|
|
4122
|
+
const o = getOwner();
|
|
4123
|
+
if (!o || !(state = o._context[SELECT])) return "";
|
|
3995
4124
|
}
|
|
3996
|
-
if (
|
|
3997
|
-
|
|
4125
|
+
if (own) return state.d = true, "";
|
|
4126
|
+
if (state.d) return "";
|
|
4127
|
+
if (typeof value === "function") value = value();
|
|
4128
|
+
if (value == null) return "";
|
|
4129
|
+
value = String(value);
|
|
4130
|
+
const v = state.v;
|
|
4131
|
+
return v != null && (v.map ? v.some(x => x != null && String(x) === value) : String(v) === value) ? " selected" : "";
|
|
3998
4132
|
}
|
|
3999
4133
|
function escape(s, attr) {
|
|
4000
4134
|
const t = typeof s;
|
|
@@ -4101,7 +4235,7 @@ function tryJoinPlainSSRArray(nodes) {
|
|
|
4101
4235
|
let out = "";
|
|
4102
4236
|
for (let i = 0, len = nodes.length; i < len; i++) {
|
|
4103
4237
|
const node = nodes[i];
|
|
4104
|
-
if (node == null || typeof node !== "object" || node.h || typeof node.t !== "string") {
|
|
4238
|
+
if (node == null || typeof node !== "object" || node.$ !== SSR_NODE || node.h || typeof node.t !== "string") {
|
|
4105
4239
|
return undefined;
|
|
4106
4240
|
}
|
|
4107
4241
|
out += node.t;
|
|
@@ -4329,12 +4463,12 @@ function tryResolveString(node, nested) {
|
|
|
4329
4463
|
}
|
|
4330
4464
|
return s;
|
|
4331
4465
|
}
|
|
4466
|
+
if (node.$ !== SSR_NODE) {
|
|
4467
|
+
return "";
|
|
4468
|
+
}
|
|
4332
4469
|
if (node.h && node.h.length > 0) return {
|
|
4333
4470
|
merge: node
|
|
4334
4471
|
};
|
|
4335
|
-
if (node.t === undefined) {
|
|
4336
|
-
return "";
|
|
4337
|
-
}
|
|
4338
4472
|
ssrTextTail = false;
|
|
4339
4473
|
return Array.isArray(node.t) ? node.t[0] : node.t;
|
|
4340
4474
|
}
|
|
@@ -4354,7 +4488,8 @@ function tryResolveString(node, nested) {
|
|
|
4354
4488
|
function resolveSSRNode(node, result = {
|
|
4355
4489
|
t: [""],
|
|
4356
4490
|
h: [],
|
|
4357
|
-
p: []
|
|
4491
|
+
p: [],
|
|
4492
|
+
$: SSR_NODE
|
|
4358
4493
|
}, top, nested) {
|
|
4359
4494
|
if (!nested) ssrTextTail = false;
|
|
4360
4495
|
const t = typeof node;
|
|
@@ -4373,7 +4508,7 @@ function resolveSSRNode(node, result = {
|
|
|
4373
4508
|
if (slotLive) slotLive.suppressed--;
|
|
4374
4509
|
}
|
|
4375
4510
|
} else if (t === "object") {
|
|
4376
|
-
if (node.h) {
|
|
4511
|
+
if (node.$ !== SSR_NODE) ; else if (node.h) {
|
|
4377
4512
|
result.t[result.t.length - 1] += node.t[0];
|
|
4378
4513
|
if (node.t.length > 1) {
|
|
4379
4514
|
result.t.push(...node.t.slice(1));
|
|
@@ -4381,10 +4516,10 @@ function resolveSSRNode(node, result = {
|
|
|
4381
4516
|
result.p.push(...node.p);
|
|
4382
4517
|
}
|
|
4383
4518
|
ssrTextTail = false;
|
|
4384
|
-
} else
|
|
4519
|
+
} else {
|
|
4385
4520
|
result.t[result.t.length - 1] += node.t;
|
|
4386
4521
|
ssrTextTail = false;
|
|
4387
|
-
}
|
|
4522
|
+
}
|
|
4388
4523
|
} else if (t === "function") {
|
|
4389
4524
|
const live = sharedConfig.context && sharedConfig.context.liveHoles;
|
|
4390
4525
|
let liveNode = null;
|
|
@@ -4820,6 +4955,10 @@ function registerElementClaim() {
|
|
|
4820
4955
|
return noopCleanup;
|
|
4821
4956
|
}
|
|
4822
4957
|
function noopCleanup() {}
|
|
4958
|
+
function setTrustedTypesPolicy() {}
|
|
4959
|
+
function trustedHTML(html) {
|
|
4960
|
+
return html;
|
|
4961
|
+
}
|
|
4823
4962
|
function claimElement(node) {
|
|
4824
4963
|
return node;
|
|
4825
4964
|
}
|
|
@@ -4969,4 +5108,4 @@ function httpHeader(name, value, options) {
|
|
|
4969
5108
|
}
|
|
4970
5109
|
}
|
|
4971
5110
|
|
|
4972
|
-
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,
|
|
5111
|
+
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, notSup as heldRead, 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, respond, notSup as runHydrationEvents, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, setLinkClaim, notSup as setProperty, notSup as setStatefulProperty, notSup as setStyleProperty, setTrustedTypesPolicy, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrIn, ssrLinkClaim, ssrOption, ssrSelect, ssrStyle, ssrStyleProperties, ssrStyleProperty, notSup as strictHandler, notSup as style, takeHydrationValue, notSup as template, trustedHTML, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
|