@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.dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRenderEffect, getOwner, createMemo, OBSERVE, DEV, createRoot, $PROXY,
|
|
1
|
+
import { createRenderEffect, getOwner, createMemo, OBSERVE, DEV, 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';
|
|
@@ -367,7 +367,15 @@ function rewriteTree(value, visit, withPath) {
|
|
|
367
367
|
} catch (err) {
|
|
368
368
|
if (err !== CYCLE) throw err;
|
|
369
369
|
}
|
|
370
|
-
|
|
370
|
+
const memo = state.memo || (state.memo = new Map());
|
|
371
|
+
const marks = {
|
|
372
|
+
at: new Map(),
|
|
373
|
+
stack: [],
|
|
374
|
+
changed: new Set(),
|
|
375
|
+
next: 0
|
|
376
|
+
};
|
|
377
|
+
mark(value, visit, path, memo, marks);
|
|
378
|
+
return clone(value, memo, marks.changed);
|
|
371
379
|
}
|
|
372
380
|
function shape(value) {
|
|
373
381
|
return Array.isArray(value) ? 1 : Object.getPrototypeOf(value) === Object.prototype ? 2 : 0;
|
|
@@ -415,28 +423,73 @@ function cow(value, visit, path, depth, state) {
|
|
|
415
423
|
if (ancestors !== undefined) ancestors.delete(value);
|
|
416
424
|
return out;
|
|
417
425
|
}
|
|
418
|
-
function
|
|
419
|
-
|
|
426
|
+
function mark(value, visit, path, memo, m) {
|
|
427
|
+
const seen = m.at.get(value);
|
|
428
|
+
if (seen !== undefined) return seen;
|
|
429
|
+
if (memo.has(value)) return -1;
|
|
420
430
|
const r = visit(value, path);
|
|
421
431
|
if (r !== DESCEND) {
|
|
422
432
|
memo.set(value, r);
|
|
423
|
-
return
|
|
433
|
+
return -1;
|
|
424
434
|
}
|
|
425
435
|
const s = shape(value);
|
|
426
|
-
if (s === 0) return
|
|
427
|
-
const
|
|
436
|
+
if (s === 0) return -1;
|
|
437
|
+
const index = m.next++;
|
|
438
|
+
let low = index;
|
|
439
|
+
let changed = false;
|
|
440
|
+
let open = false;
|
|
441
|
+
const keys = s === 1 ? value : Object.keys(value);
|
|
442
|
+
for (let i = 0; i < keys.length; i++) {
|
|
443
|
+
const k = s === 1 ? i : keys[i];
|
|
444
|
+
const c = value[k];
|
|
445
|
+
if (c === null || typeof c !== "object") continue;
|
|
446
|
+
if (!open) {
|
|
447
|
+
open = true;
|
|
448
|
+
m.at.set(value, index);
|
|
449
|
+
m.stack.push(value);
|
|
450
|
+
}
|
|
451
|
+
const l = mark(c, visit, undefined , memo, m);
|
|
452
|
+
if (l >= 0 && l < low) low = l;
|
|
453
|
+
if (memo.has(c) && memo.get(c) !== c || l === Infinity && m.changed.has(c)) changed = true;
|
|
454
|
+
}
|
|
455
|
+
if (!open) return -1;
|
|
456
|
+
if (low === index) {
|
|
457
|
+
m.at.set(value, Infinity);
|
|
458
|
+
if (m.stack[m.stack.length - 1] === value) {
|
|
459
|
+
m.stack.pop();
|
|
460
|
+
if (changed) m.changed.add(value);
|
|
461
|
+
return Infinity;
|
|
462
|
+
}
|
|
463
|
+
const members = m.stack.splice(m.stack.lastIndexOf(value));
|
|
464
|
+
if (!changed) for (const n of members) if (m.changed.has(n)) {
|
|
465
|
+
changed = true;
|
|
466
|
+
break;
|
|
467
|
+
}
|
|
468
|
+
for (const n of members) {
|
|
469
|
+
m.at.set(n, Infinity);
|
|
470
|
+
if (changed) m.changed.add(n);
|
|
471
|
+
}
|
|
472
|
+
return Infinity;
|
|
473
|
+
}
|
|
474
|
+
if (changed) m.changed.add(value);
|
|
475
|
+
return low;
|
|
476
|
+
}
|
|
477
|
+
function clone(value, memo, changed) {
|
|
478
|
+
if (memo.has(value)) return memo.get(value);
|
|
479
|
+
if (!changed.has(value)) return value;
|
|
480
|
+
const out = Array.isArray(value) ? value.slice() : {
|
|
428
481
|
...value
|
|
429
482
|
};
|
|
430
483
|
memo.set(value, out);
|
|
431
|
-
if (
|
|
484
|
+
if (Array.isArray(value)) {
|
|
432
485
|
for (let i = 0; i < value.length; i++) {
|
|
433
486
|
const c = value[i];
|
|
434
|
-
if (c !== null && typeof c === "object") out[i] = clone(c,
|
|
487
|
+
if (c !== null && typeof c === "object") out[i] = clone(c, memo, changed);
|
|
435
488
|
}
|
|
436
489
|
} else {
|
|
437
490
|
for (const k of Object.keys(value)) {
|
|
438
491
|
const c = value[k];
|
|
439
|
-
if (c !== null && typeof c === "object") out[k] = clone(c,
|
|
492
|
+
if (c !== null && typeof c === "object") out[k] = clone(c, memo, changed);
|
|
440
493
|
}
|
|
441
494
|
}
|
|
442
495
|
return out;
|
|
@@ -576,7 +629,7 @@ function createKeyedSerializer(serialize, onError, onDone) {
|
|
|
576
629
|
stream = serialize(key, value, {
|
|
577
630
|
onError: onError && (err => {
|
|
578
631
|
failed = true;
|
|
579
|
-
onError(err);
|
|
632
|
+
onError(err, key);
|
|
580
633
|
if (cancel) {
|
|
581
634
|
cancel();
|
|
582
635
|
settle();
|
|
@@ -649,7 +702,7 @@ function createHydrationSerializer({
|
|
|
649
702
|
});
|
|
650
703
|
return createKeyedSerializer(late ? late(serialize, refs, onData, scopeId) : serialize, onError, onDone);
|
|
651
704
|
}
|
|
652
|
-
function rejectUnserializedKey(serialize, refs, onData, scopeId) {
|
|
705
|
+
function rejectUnserializedKey(serialize, refs, onData, scopeId, plain) {
|
|
653
706
|
let taken = 0;
|
|
654
707
|
let fresh = [];
|
|
655
708
|
const set = refs.set;
|
|
@@ -672,8 +725,9 @@ function rejectUnserializedKey(serialize, refs, onData, scopeId) {
|
|
|
672
725
|
if (ref instanceof Promise) ids.add(id + 1);else if (isStream(ref) || Object.getPrototypeOf(ref) === Object.prototype && !Object.keys(ref).length) ids.add(id);
|
|
673
726
|
}
|
|
674
727
|
if (!ids.size) return;
|
|
675
|
-
const
|
|
676
|
-
const
|
|
728
|
+
const text = plain && plain(key);
|
|
729
|
+
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))}";
|
|
730
|
+
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]);
|
|
677
731
|
onData("($R=>{const e=new Error(" + message + ");" + body + "})(" + (scopeId == null ? "$R" : '$R["' + serializeKey(scopeId) + '"]') + ")");
|
|
678
732
|
};
|
|
679
733
|
return serialize(key, value, {
|
|
@@ -1279,6 +1333,7 @@ function preloadInvalid(field, message, value) {
|
|
|
1279
1333
|
}
|
|
1280
1334
|
});
|
|
1281
1335
|
}
|
|
1336
|
+
const SSR_NODE = /*#__PURE__*/Symbol.for("solid.ssrNode");
|
|
1282
1337
|
function unrecognizedInsert(node) {
|
|
1283
1338
|
devCheck({
|
|
1284
1339
|
code: "UNRECOGNIZED_INSERT_VALUE",
|
|
@@ -1875,7 +1930,8 @@ function tagInfo(tag) {
|
|
|
1875
1930
|
textarea: tag === "textarea",
|
|
1876
1931
|
raw: tag === "script" || tag === "style",
|
|
1877
1932
|
formDefaults,
|
|
1878
|
-
formAttributes
|
|
1933
|
+
formAttributes,
|
|
1934
|
+
sel: tag === "select" ? 1 : tag === "option" ? 2 : 0
|
|
1879
1935
|
};
|
|
1880
1936
|
if (tagInfos.size < 512) tagInfos.set(tag, info);
|
|
1881
1937
|
}
|
|
@@ -1977,7 +2033,7 @@ function renderToString(code, options = {}) {
|
|
|
1977
2033
|
closed = true;
|
|
1978
2034
|
serializer.close();
|
|
1979
2035
|
const head = renderShellHead(headRegistry, nonce, null, noScripts, traceMetaMarkup(context.trace));
|
|
1980
|
-
const document = withShellEnd(assembleDocument(
|
|
2036
|
+
const document = withShellEnd(assembleDocument(html, tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead, tracking.lowModules), context, renderId, nonce, noScripts);
|
|
1981
2037
|
if (render) render.shell();
|
|
1982
2038
|
if (requestEvent && requestEvent.response) {
|
|
1983
2039
|
commitResponseStub(requestEvent.response, {
|
|
@@ -2064,7 +2120,8 @@ function renderToStream(code, options = {}) {
|
|
|
2064
2120
|
if (render) settleRender(render, rootOwner, disconnect ? "abandoned" : "error");
|
|
2065
2121
|
const sink = writable;
|
|
2066
2122
|
buffer = {
|
|
2067
|
-
write() {}
|
|
2123
|
+
write() {},
|
|
2124
|
+
flush() {}
|
|
2068
2125
|
};
|
|
2069
2126
|
writable = {
|
|
2070
2127
|
end() {}
|
|
@@ -2158,24 +2215,64 @@ function renderToStream(code, options = {}) {
|
|
|
2158
2215
|
let stableOrder = false;
|
|
2159
2216
|
let parkedWrites = null;
|
|
2160
2217
|
const byKey = (a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0;
|
|
2161
|
-
let writing = 0;
|
|
2162
2218
|
let stranded = false;
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2219
|
+
let writingRecord = false;
|
|
2220
|
+
let recordFailed = false;
|
|
2221
|
+
const plainRecords = new WeakMap();
|
|
2222
|
+
const caught = new Set();
|
|
2223
|
+
let unclaimed = null;
|
|
2224
|
+
const rejected = new Map();
|
|
2225
|
+
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`;
|
|
2226
|
+
const plainFor = (id, value) => {
|
|
2227
|
+
const keyed = value !== null && typeof value === "object";
|
|
2228
|
+
let plain = keyed && plainRecords.get(value);
|
|
2229
|
+
if (!plain) {
|
|
2230
|
+
plain = new Error(plainMessage(id, value));
|
|
2231
|
+
if (keyed) plainRecords.set(value, plain);
|
|
2169
2232
|
}
|
|
2233
|
+
return plain;
|
|
2170
2234
|
};
|
|
2171
|
-
const
|
|
2172
|
-
if (
|
|
2235
|
+
const claim = () => {
|
|
2236
|
+
if (unclaimed) {
|
|
2237
|
+
for (const reason of unclaimed) if (!caught.has(reason)) stranded = true;
|
|
2238
|
+
unclaimed = null;
|
|
2239
|
+
}
|
|
2240
|
+
return stranded;
|
|
2241
|
+
};
|
|
2242
|
+
const claimLater = reason => {
|
|
2243
|
+
if (firstFlushed || stranded || caught.has(reason)) return;
|
|
2244
|
+
if (!unclaimed) {
|
|
2245
|
+
unclaimed = new Set();
|
|
2246
|
+
deferFlush(() => {
|
|
2247
|
+
if (!rootHoles && claim()) abandon();
|
|
2248
|
+
});
|
|
2249
|
+
}
|
|
2250
|
+
unclaimed.add(reason);
|
|
2251
|
+
};
|
|
2252
|
+
const handOver = (id, value, error) => {
|
|
2253
|
+
if (!error || options.serializer) return serializer.write(id, value);
|
|
2254
|
+
let plain = value !== null && typeof value === "object" && plainRecords.get(value);
|
|
2255
|
+
if (!plain) {
|
|
2256
|
+
recordFailed = false;
|
|
2257
|
+
writingRecord = true;
|
|
2258
|
+
try {
|
|
2259
|
+
serializer.write(id, value);
|
|
2260
|
+
} finally {
|
|
2261
|
+
writingRecord = false;
|
|
2262
|
+
}
|
|
2263
|
+
if (!recordFailed) return;
|
|
2264
|
+
plain = plainFor(id, value);
|
|
2265
|
+
}
|
|
2266
|
+
serializer.write(id, plain);
|
|
2267
|
+
};
|
|
2268
|
+
const write = (id, value, error) => {
|
|
2269
|
+
if (stableOrder && !dead) (parkedWrites ||= []).push([id, value, error]);else handOver(id, value, error);
|
|
2173
2270
|
};
|
|
2174
2271
|
const flushParkedWrites = () => {
|
|
2175
2272
|
if (!parkedWrites) return;
|
|
2176
2273
|
const writes = parkedWrites.sort(byKey);
|
|
2177
2274
|
parkedWrites = null;
|
|
2178
|
-
for (let i = 0; i < writes.length; i++) handOver(writes[i][0], writes[i][1]);
|
|
2275
|
+
for (let i = 0; i < writes.length; i++) handOver(writes[i][0], writes[i][1], writes[i][2]);
|
|
2179
2276
|
};
|
|
2180
2277
|
const flushStubBatch = () => {
|
|
2181
2278
|
if (!stubBatch) return;
|
|
@@ -2200,7 +2297,7 @@ function renderToStream(code, options = {}) {
|
|
|
2200
2297
|
const onDone = () => {
|
|
2201
2298
|
if (dead) return;
|
|
2202
2299
|
writeTasks();
|
|
2203
|
-
if (
|
|
2300
|
+
if (claim()) return abandon();
|
|
2204
2301
|
lastBlockingSize = blockingPromises.size;
|
|
2205
2302
|
doShell();
|
|
2206
2303
|
onCompleteAll && onCompleteAll({
|
|
@@ -2263,11 +2360,19 @@ function renderToStream(code, options = {}) {
|
|
|
2263
2360
|
plugins: options.plugins,
|
|
2264
2361
|
onData: payload => sink.data(payload),
|
|
2265
2362
|
onDone,
|
|
2266
|
-
onError: err => {
|
|
2267
|
-
|
|
2268
|
-
|
|
2363
|
+
onError: (err, key) => {
|
|
2364
|
+
const rejection = !options.serializer && !writingRecord && rejected.has(key);
|
|
2365
|
+
const reason = rejection && rejected.get(key);
|
|
2366
|
+
if (!rejection || reason === null || typeof reason !== "object" || !plainRecords.has(reason)) reportFailure(err, "serialize");
|
|
2367
|
+
if (writingRecord) recordFailed = true;else if (rejection) {
|
|
2368
|
+
plainFor(key, reason);
|
|
2369
|
+
claimLater(reason);
|
|
2370
|
+
} else if (!options.serializer && !firstFlushed && !stranded) {
|
|
2371
|
+
stranded = true;
|
|
2372
|
+
deferFlush(() => abandon());
|
|
2373
|
+
}
|
|
2269
2374
|
},
|
|
2270
|
-
late: rejectUnserializedKey
|
|
2375
|
+
late: (serialize, refs, onData, scopeId) => rejectUnserializedKey(serialize, refs, onData, scopeId, key => !firstFlushed && rejected.has(key) ? plainMessage(key, rejected.get(key)) : undefined)
|
|
2271
2376
|
});
|
|
2272
2377
|
let rootAssetsSerialized = false;
|
|
2273
2378
|
const serializeRootAssets = () => {
|
|
@@ -2346,7 +2451,10 @@ function renderToStream(code, options = {}) {
|
|
|
2346
2451
|
raced.catch(() => {});
|
|
2347
2452
|
pendingSerialized.set(id, settle);
|
|
2348
2453
|
const drop = () => pendingSerialized.delete(id);
|
|
2349
|
-
p.then(drop,
|
|
2454
|
+
p.then(drop, reason => {
|
|
2455
|
+
drop();
|
|
2456
|
+
rejected.set(id, reason);
|
|
2457
|
+
});
|
|
2350
2458
|
return raced;
|
|
2351
2459
|
};
|
|
2352
2460
|
const abandonSubtree = (key, error) => {
|
|
@@ -2509,12 +2617,17 @@ function renderToStream(code, options = {}) {
|
|
|
2509
2617
|
const last = html.indexOf(`<!--!$/${id}-->`, first + placeholder.length);
|
|
2510
2618
|
html = html.slice(0, first) + resolveSSRSync(escape(payloadFn())) + html.slice(last + placeholder.length + 1);
|
|
2511
2619
|
},
|
|
2512
|
-
serialize(id, p, deferStream) {
|
|
2620
|
+
serialize(id, p, deferStream, errorRecord) {
|
|
2513
2621
|
p = guardChannel(p);
|
|
2514
2622
|
if (p && typeof p === "object" && typeof p.then === "function") {
|
|
2515
2623
|
if (!firstFlushed && deferStream) {
|
|
2516
2624
|
blockingPromises.add(p);
|
|
2517
|
-
p.then(d => write(id, d)).catch(e =>
|
|
2625
|
+
p.then(d => write(id, d)).catch(e => {
|
|
2626
|
+
rejected.set(id, e);
|
|
2627
|
+
const r = Promise.reject(e);
|
|
2628
|
+
r.catch(() => {});
|
|
2629
|
+
write(id, r);
|
|
2630
|
+
});
|
|
2518
2631
|
return;
|
|
2519
2632
|
}
|
|
2520
2633
|
p = trackSerialized(id, p);
|
|
@@ -2523,7 +2636,7 @@ function renderToStream(code, options = {}) {
|
|
|
2523
2636
|
return;
|
|
2524
2637
|
}
|
|
2525
2638
|
}
|
|
2526
|
-
write(id, p);
|
|
2639
|
+
write(id, p, errorRecord);
|
|
2527
2640
|
},
|
|
2528
2641
|
escape: escape,
|
|
2529
2642
|
resolve: resolveSSRNode,
|
|
@@ -2597,7 +2710,7 @@ function renderToStream(code, options = {}) {
|
|
|
2597
2710
|
const styles = collectStreamStyles(key, tracking, headStyles);
|
|
2598
2711
|
const headOps = error ? null : flushHeadFragment(headRegistry, key, nonce);
|
|
2599
2712
|
if (headOps) emitHeadOps(key, headOps);
|
|
2600
|
-
sink.fragment(key,
|
|
2713
|
+
sink.fragment(key, value !== undefined ? value : error ? "" : " ", {
|
|
2601
2714
|
styles,
|
|
2602
2715
|
revealGroup,
|
|
2603
2716
|
error: error ? ssrSanitizeError(error, null, undefined, undefined, errorScope) : error
|
|
@@ -2628,6 +2741,10 @@ function renderToStream(code, options = {}) {
|
|
|
2628
2741
|
context.failRender = failRender;
|
|
2629
2742
|
context.errorPolicy = options.onError;
|
|
2630
2743
|
context._errorScope = errorScope;
|
|
2744
|
+
context.contained = (error, wire) => {
|
|
2745
|
+
caught.add(error);
|
|
2746
|
+
caught.add(wire);
|
|
2747
|
+
};
|
|
2631
2748
|
context.flushed = () => firstFlushed;
|
|
2632
2749
|
context.trace = requestEvent ? traceForEvent(requestEvent) : traceFor(context, undefined);
|
|
2633
2750
|
render = timeDocument(context, context.trace, "stream", requestEvent);
|
|
@@ -2745,7 +2862,7 @@ function renderToStream(code, options = {}) {
|
|
|
2745
2862
|
flushStubBatch();
|
|
2746
2863
|
const head = renderShellHead(headRegistry, nonce, k => registry.has(k), noScripts, traceMetaMarkup(context.trace));
|
|
2747
2864
|
if (render) render.shell();
|
|
2748
|
-
sink.shell(
|
|
2865
|
+
sink.shell(html, {
|
|
2749
2866
|
preloads: tracking.emittedAssets,
|
|
2750
2867
|
preloadLinks: tracking.preloadLinks,
|
|
2751
2868
|
inlineStyles: tracking.inlineStyles,
|
|
@@ -2821,7 +2938,7 @@ function renderToStream(code, options = {}) {
|
|
|
2821
2938
|
return;
|
|
2822
2939
|
}
|
|
2823
2940
|
if (!shellCompleted) return flush();
|
|
2824
|
-
if (
|
|
2941
|
+
if (claim()) return abandon();
|
|
2825
2942
|
const encoder = new TextEncoder();
|
|
2826
2943
|
const writer = w.getWriter();
|
|
2827
2944
|
let pendingWrites = Promise.resolve();
|
|
@@ -2921,7 +3038,7 @@ function renderToStream(code, options = {}) {
|
|
|
2921
3038
|
return;
|
|
2922
3039
|
}
|
|
2923
3040
|
if (!shellCompleted) return flush();
|
|
2924
|
-
if (
|
|
3041
|
+
if (claim()) return abandon();
|
|
2925
3042
|
const sink = guardSink(w);
|
|
2926
3043
|
buffer = writable = coalesceWrites(sink.write, sink.end);
|
|
2927
3044
|
buffer.write(tmp);
|
|
@@ -2987,6 +3104,8 @@ function buildAsyncWrap(err, node) {
|
|
|
2987
3104
|
fn.$rw = true;
|
|
2988
3105
|
if (suppress) fn.$lhSuppress = true;
|
|
2989
3106
|
if (node.$lhSkip) fn.$lhSkip = true;
|
|
3107
|
+
if (node.$lhInTag) fn.$lhInTag = true;
|
|
3108
|
+
if (node.$lhAttr) fn.$lhAttr = node.$lhAttr;
|
|
2990
3109
|
if (node.$lhBinding) fn.$lhBinding = node.$lhBinding;
|
|
2991
3110
|
return {
|
|
2992
3111
|
fn,
|
|
@@ -3199,7 +3318,8 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
|
|
|
3199
3318
|
t: [""],
|
|
3200
3319
|
h: [],
|
|
3201
3320
|
p: [],
|
|
3202
|
-
rows: null
|
|
3321
|
+
rows: null,
|
|
3322
|
+
$: SSR_NODE
|
|
3203
3323
|
};
|
|
3204
3324
|
try {
|
|
3205
3325
|
result.rows = resolveValue(holeValue(hole), result);
|
|
@@ -3298,16 +3418,41 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
|
|
|
3298
3418
|
},
|
|
3299
3419
|
nest(hole) {
|
|
3300
3420
|
const s = engine.scope;
|
|
3301
|
-
if (!s || s.h === hole || hole.$lhSkip || inScope && !inScope()) return undefined;
|
|
3421
|
+
if (!s || s.h === hole || hole.$lhSkip || hole.$lhInTag || inScope && !inScope()) return undefined;
|
|
3302
3422
|
engine.scope = scopeFor(hole);
|
|
3303
3423
|
return s;
|
|
3304
3424
|
},
|
|
3305
3425
|
content(hole) {
|
|
3426
|
+
if (hole.$lhInTag) {
|
|
3427
|
+
const cap = hole.$lhAttr;
|
|
3428
|
+
if (!cap || cap.adopted || engine.suppressed || engine.sweeping) return null;
|
|
3429
|
+
const r = tryResolveFunctionHole(hole);
|
|
3430
|
+
if (typeof r !== "string") {
|
|
3431
|
+
const res = {
|
|
3432
|
+
t: [""],
|
|
3433
|
+
h: [],
|
|
3434
|
+
p: [],
|
|
3435
|
+
$: SSR_NODE
|
|
3436
|
+
};
|
|
3437
|
+
appendResolvedNode(res, r);
|
|
3438
|
+
return res;
|
|
3439
|
+
}
|
|
3440
|
+
if (--cap.waiting === 0 && !cap.closed) {
|
|
3441
|
+
try {
|
|
3442
|
+
cap.base = attrPartsText(cap.parts);
|
|
3443
|
+
} catch (err) {
|
|
3444
|
+
cap.base = null;
|
|
3445
|
+
}
|
|
3446
|
+
if (cap.base !== null) engine.attr(cap);
|
|
3447
|
+
}
|
|
3448
|
+
return r;
|
|
3449
|
+
}
|
|
3306
3450
|
if (hole.$lhSuppress) {
|
|
3307
3451
|
const r = {
|
|
3308
3452
|
t: [""],
|
|
3309
3453
|
h: [],
|
|
3310
|
-
p: []
|
|
3454
|
+
p: [],
|
|
3455
|
+
$: SSR_NODE
|
|
3311
3456
|
};
|
|
3312
3457
|
let rows = null;
|
|
3313
3458
|
const b = hole.$lhBinding;
|
|
@@ -3412,7 +3557,8 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
|
|
|
3412
3557
|
const r = {
|
|
3413
3558
|
t: [""],
|
|
3414
3559
|
h: [],
|
|
3415
|
-
p: []
|
|
3560
|
+
p: [],
|
|
3561
|
+
$: SSR_NODE
|
|
3416
3562
|
};
|
|
3417
3563
|
engine.suppressed++;
|
|
3418
3564
|
try {
|
|
@@ -3431,13 +3577,15 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
|
|
|
3431
3577
|
res = {
|
|
3432
3578
|
t: ["", ""],
|
|
3433
3579
|
h: [escalated.fn],
|
|
3434
|
-
p: [escalated.p]
|
|
3580
|
+
p: [escalated.p],
|
|
3581
|
+
$: SSR_NODE
|
|
3435
3582
|
};
|
|
3436
3583
|
} else {
|
|
3437
3584
|
res = {
|
|
3438
3585
|
t: [""],
|
|
3439
3586
|
h: [],
|
|
3440
|
-
p: []
|
|
3587
|
+
p: [],
|
|
3588
|
+
$: SSR_NODE
|
|
3441
3589
|
};
|
|
3442
3590
|
try {
|
|
3443
3591
|
rows = resolveValue(value, res);
|
|
@@ -3467,20 +3615,59 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
|
|
|
3467
3615
|
t[t.length - 1] += close;
|
|
3468
3616
|
sink.openBinding(key, b);
|
|
3469
3617
|
return {
|
|
3470
|
-
t,
|
|
3618
|
+
t: t,
|
|
3471
3619
|
h: res.h,
|
|
3472
|
-
p: res.p
|
|
3620
|
+
p: res.p,
|
|
3621
|
+
$: SSR_NODE
|
|
3473
3622
|
};
|
|
3474
3623
|
},
|
|
3475
3624
|
mint() {
|
|
3476
3625
|
return nextId++;
|
|
3477
3626
|
},
|
|
3627
|
+
open(text, off, hole) {
|
|
3628
|
+
const pending = hole && hole.$lhAttr;
|
|
3629
|
+
let inject;
|
|
3630
|
+
let id;
|
|
3631
|
+
if (pending && !pending.adopted && text.startsWith(pending.inject, off)) {
|
|
3632
|
+
pending.adopted = true;
|
|
3633
|
+
({
|
|
3634
|
+
id,
|
|
3635
|
+
inject
|
|
3636
|
+
} = pending);
|
|
3637
|
+
} else {
|
|
3638
|
+
id = nextId++;
|
|
3639
|
+
inject = ` data-lha="${id}"`;
|
|
3640
|
+
text = text.slice(0, off) + inject + text.slice(off);
|
|
3641
|
+
}
|
|
3642
|
+
const prefix = text.slice(off + inject.length);
|
|
3643
|
+
return {
|
|
3644
|
+
id,
|
|
3645
|
+
parts: [prefix],
|
|
3646
|
+
base: prefix,
|
|
3647
|
+
inject,
|
|
3648
|
+
waiting: 0,
|
|
3649
|
+
text
|
|
3650
|
+
};
|
|
3651
|
+
},
|
|
3652
|
+
retry(fn, cap) {
|
|
3653
|
+
if (typeof fn !== "function") return;
|
|
3654
|
+
fn.$lhInTag = true;
|
|
3655
|
+
if (cap) {
|
|
3656
|
+
fn.$lhAttr = cap;
|
|
3657
|
+
cap.waiting++;
|
|
3658
|
+
}
|
|
3659
|
+
},
|
|
3478
3660
|
active() {
|
|
3479
3661
|
return (!inScope || inScope()) && !(settled && settled());
|
|
3480
3662
|
},
|
|
3481
3663
|
attr(cap) {
|
|
3482
|
-
|
|
3483
|
-
|
|
3664
|
+
if (cap.waiting) {
|
|
3665
|
+
cap.owner = getOwner();
|
|
3666
|
+
cap.ctx = sharedConfig.context;
|
|
3667
|
+
return;
|
|
3668
|
+
}
|
|
3669
|
+
const owner = cap.owner !== undefined ? cap.owner : getOwner();
|
|
3670
|
+
const holeCtx = cap.ctx !== undefined ? cap.ctx : sharedConfig.context;
|
|
3484
3671
|
const b = {
|
|
3485
3672
|
key: "lha:" + cap.id,
|
|
3486
3673
|
children: [],
|
|
@@ -3495,29 +3682,7 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
|
|
|
3495
3682
|
engine.gateHit = false;
|
|
3496
3683
|
let html = "";
|
|
3497
3684
|
try {
|
|
3498
|
-
|
|
3499
|
-
let groupVal = null;
|
|
3500
|
-
const run = () => {
|
|
3501
|
-
for (const part of cap.parts) {
|
|
3502
|
-
if (typeof part === "string") {
|
|
3503
|
-
html += part;
|
|
3504
|
-
continue;
|
|
3505
|
-
}
|
|
3506
|
-
let v;
|
|
3507
|
-
if (part.g) {
|
|
3508
|
-
if (group !== part.g) {
|
|
3509
|
-
group = part.g;
|
|
3510
|
-
groupVal = part.g();
|
|
3511
|
-
}
|
|
3512
|
-
v = groupVal[part.i];
|
|
3513
|
-
} else {
|
|
3514
|
-
v = part.f();
|
|
3515
|
-
}
|
|
3516
|
-
const vt = typeof v;
|
|
3517
|
-
if (vt === "string" || vt === "number") html += v;
|
|
3518
|
-
}
|
|
3519
|
-
};
|
|
3520
|
-
swept(owner, holeCtx, run);
|
|
3685
|
+
swept(owner, holeCtx, () => html = attrPartsText(cap.parts));
|
|
3521
3686
|
} catch (err) {
|
|
3522
3687
|
if (ssrHandleError(err, true)) {
|
|
3523
3688
|
if (!engine.sweptOwners) return;
|
|
@@ -3631,10 +3796,35 @@ function rowPatch(a, b) {
|
|
|
3631
3796
|
}
|
|
3632
3797
|
}
|
|
3633
3798
|
}
|
|
3799
|
+
function attrPartsText(parts) {
|
|
3800
|
+
let html = "";
|
|
3801
|
+
let group = null;
|
|
3802
|
+
let groupVal = null;
|
|
3803
|
+
for (const part of parts) {
|
|
3804
|
+
if (typeof part === "string") {
|
|
3805
|
+
html += part;
|
|
3806
|
+
continue;
|
|
3807
|
+
}
|
|
3808
|
+
let v;
|
|
3809
|
+
if (part.g) {
|
|
3810
|
+
if (group !== part.g) {
|
|
3811
|
+
group = part.g;
|
|
3812
|
+
groupVal = part.g();
|
|
3813
|
+
}
|
|
3814
|
+
v = groupVal[part.i];
|
|
3815
|
+
} else {
|
|
3816
|
+
v = part.f();
|
|
3817
|
+
}
|
|
3818
|
+
const vt = typeof v;
|
|
3819
|
+
if (vt === "string" || vt === "number") html += v;
|
|
3820
|
+
}
|
|
3821
|
+
return html;
|
|
3822
|
+
}
|
|
3634
3823
|
function ssr(t) {
|
|
3635
3824
|
const len = arguments.length;
|
|
3636
3825
|
if (len === 1) return {
|
|
3637
|
-
t
|
|
3826
|
+
t: t,
|
|
3827
|
+
$: SSR_NODE
|
|
3638
3828
|
};
|
|
3639
3829
|
let s = t[0];
|
|
3640
3830
|
let result = null;
|
|
@@ -3650,30 +3840,18 @@ function ssr(t) {
|
|
|
3650
3840
|
seg: -1,
|
|
3651
3841
|
off: hp.openOff[0]
|
|
3652
3842
|
};
|
|
3653
|
-
const captureStart =
|
|
3843
|
+
const captureStart = hole => {
|
|
3654
3844
|
if (cap) return true;
|
|
3655
3845
|
if (!lastOpen || live.suppressed || live.sweeping || !live.active()) return false;
|
|
3846
|
+
if (lastOpen.r === null && result !== null && result.t.length === 1) {
|
|
3847
|
+
lastOpen.r = result;
|
|
3848
|
+
lastOpen.seg = 0;
|
|
3849
|
+
}
|
|
3656
3850
|
if (lastOpen.r !== result || result !== null && lastOpen.seg !== result.t.length - 1) {
|
|
3657
3851
|
return false;
|
|
3658
3852
|
}
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
let prefix;
|
|
3662
|
-
if (result === null) {
|
|
3663
|
-
s = s.slice(0, lastOpen.off) + inject + s.slice(lastOpen.off);
|
|
3664
|
-
prefix = s.slice(lastOpen.off + inject.length);
|
|
3665
|
-
} else {
|
|
3666
|
-
const seg = result.t[lastOpen.seg];
|
|
3667
|
-
result.t[lastOpen.seg] = seg.slice(0, lastOpen.off) + inject + seg.slice(lastOpen.off);
|
|
3668
|
-
prefix = result.t[lastOpen.seg].slice(lastOpen.off + inject.length);
|
|
3669
|
-
}
|
|
3670
|
-
cap = {
|
|
3671
|
-
id,
|
|
3672
|
-
parts: [prefix],
|
|
3673
|
-
base: prefix,
|
|
3674
|
-
at: lastOpen.seg,
|
|
3675
|
-
inject
|
|
3676
|
-
};
|
|
3853
|
+
cap = live.open(result === null ? s : result.t[lastOpen.seg], lastOpen.off, hole);
|
|
3854
|
+
if (result === null) s = cap.text;else result.t[lastOpen.seg] = cap.text;
|
|
3677
3855
|
return true;
|
|
3678
3856
|
};
|
|
3679
3857
|
for (let i = 1; i < len; i++) {
|
|
@@ -3704,7 +3882,8 @@ function ssr(t) {
|
|
|
3704
3882
|
result = {
|
|
3705
3883
|
t: [s],
|
|
3706
3884
|
h: [],
|
|
3707
|
-
p: []
|
|
3885
|
+
p: [],
|
|
3886
|
+
$: SSR_NODE
|
|
3708
3887
|
};
|
|
3709
3888
|
s = "";
|
|
3710
3889
|
}
|
|
@@ -3714,18 +3893,23 @@ function ssr(t) {
|
|
|
3714
3893
|
if (Array.isArray(lastGroupVal)) {
|
|
3715
3894
|
value = lastGroupVal[lastGroupIdx++];
|
|
3716
3895
|
hasValue = true;
|
|
3717
|
-
if (live && !hp.pos[i - 1] && captureStart()) {
|
|
3896
|
+
if (live && !hp.pos[i - 1] && captureStart(hole)) {
|
|
3718
3897
|
cap.parts.push({
|
|
3719
3898
|
g: hole,
|
|
3720
3899
|
i: lastGroupIdx - 1
|
|
3721
3900
|
});
|
|
3722
3901
|
}
|
|
3723
3902
|
} else {
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3903
|
+
const slot = ssrGroupSlot(lastGroupVal.fn, lastGroupIdx++);
|
|
3904
|
+
if (live && !hp.pos[i - 1]) {
|
|
3905
|
+
const capturing = captureStart(hole);
|
|
3906
|
+
if (capturing) cap.parts.push({
|
|
3907
|
+
g: hole,
|
|
3908
|
+
i: lastGroupIdx - 1
|
|
3909
|
+
});
|
|
3910
|
+
live.retry(slot, capturing && cap);
|
|
3727
3911
|
}
|
|
3728
|
-
result.h.push(
|
|
3912
|
+
result.h.push(slot);
|
|
3729
3913
|
result.p.push(lastGroupVal.p);
|
|
3730
3914
|
result.t.push("");
|
|
3731
3915
|
}
|
|
@@ -3745,7 +3929,8 @@ function ssr(t) {
|
|
|
3745
3929
|
result = {
|
|
3746
3930
|
t: [s],
|
|
3747
3931
|
h: [],
|
|
3748
|
-
p: []
|
|
3932
|
+
p: [],
|
|
3933
|
+
$: SSR_NODE
|
|
3749
3934
|
};
|
|
3750
3935
|
s = "";
|
|
3751
3936
|
if (rs.merge !== undefined) mergeTemplateInto(result, rs.merge);else resolveSSRNode(rs.bail, result);
|
|
@@ -3763,7 +3948,8 @@ function ssr(t) {
|
|
|
3763
3948
|
result = {
|
|
3764
3949
|
t: [s],
|
|
3765
3950
|
h: [],
|
|
3766
|
-
p: []
|
|
3951
|
+
p: [],
|
|
3952
|
+
$: SSR_NODE
|
|
3767
3953
|
};
|
|
3768
3954
|
s = "";
|
|
3769
3955
|
}
|
|
@@ -3771,28 +3957,27 @@ function ssr(t) {
|
|
|
3771
3957
|
}
|
|
3772
3958
|
} else if (result !== null) {
|
|
3773
3959
|
const inTag = live && !hp.pos[i - 1];
|
|
3774
|
-
const capturing = inTag && captureStart();
|
|
3960
|
+
const capturing = inTag && captureStart(hole);
|
|
3775
3961
|
const li = capturing ? result.t.length - 1 : 0;
|
|
3776
3962
|
const before = capturing ? result.t[li].length : 0;
|
|
3963
|
+
const pushed = result.h.length;
|
|
3777
3964
|
if (live) live.suppressed++;
|
|
3778
3965
|
try {
|
|
3779
3966
|
resolveSSRNode(hole, result);
|
|
3780
3967
|
} finally {
|
|
3781
3968
|
if (live) live.suppressed--;
|
|
3782
3969
|
}
|
|
3970
|
+
if (inTag) {
|
|
3971
|
+
for (let k = pushed; k < result.h.length; k++) live.retry(result.h[k], capturing && cap);
|
|
3972
|
+
}
|
|
3783
3973
|
if (capturing) {
|
|
3784
|
-
if (result.t.length - 1 === li)
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
});
|
|
3789
|
-
} else {
|
|
3790
|
-
result.t[cap.at] = result.t[cap.at].replace(cap.inject, "");
|
|
3791
|
-
cap = null;
|
|
3792
|
-
}
|
|
3974
|
+
if (result.t.length - 1 === li) cap.base += result.t[li].slice(before);
|
|
3975
|
+
cap.parts.push({
|
|
3976
|
+
f: hole
|
|
3977
|
+
});
|
|
3793
3978
|
}
|
|
3794
3979
|
} else {
|
|
3795
|
-
const capturing = live && !hp.pos[i - 1] && captureStart();
|
|
3980
|
+
const capturing = live && !hp.pos[i - 1] && captureStart(hole);
|
|
3796
3981
|
const scope = live && hp.pos[i - 1] && live.nest(hole);
|
|
3797
3982
|
const r = tryResolveFunctionHole(hole);
|
|
3798
3983
|
if (scope) live.scope = scope;
|
|
@@ -3805,17 +3990,18 @@ function ssr(t) {
|
|
|
3805
3990
|
});
|
|
3806
3991
|
}
|
|
3807
3992
|
} else {
|
|
3808
|
-
if (capturing) {
|
|
3809
|
-
s = s.replace(cap.inject, "");
|
|
3810
|
-
cap = null;
|
|
3811
|
-
}
|
|
3812
3993
|
result = {
|
|
3813
3994
|
t: [s],
|
|
3814
3995
|
h: [],
|
|
3815
|
-
p: []
|
|
3996
|
+
p: [],
|
|
3997
|
+
$: SSR_NODE
|
|
3816
3998
|
};
|
|
3817
3999
|
s = "";
|
|
3818
4000
|
appendResolvedNode(result, r);
|
|
4001
|
+
if (capturing) cap.parts.push({
|
|
4002
|
+
f: hole
|
|
4003
|
+
});
|
|
4004
|
+
if (live && !hp.pos[i - 1]) for (const h of result.h) live.retry(h, capturing && cap);
|
|
3819
4005
|
}
|
|
3820
4006
|
}
|
|
3821
4007
|
if (devNext !== undefined) checkUnscopedHole(devNext, t, i - 1, hole);
|
|
@@ -3829,7 +4015,8 @@ function ssr(t) {
|
|
|
3829
4015
|
result = {
|
|
3830
4016
|
t: [s],
|
|
3831
4017
|
h: [],
|
|
3832
|
-
p: []
|
|
4018
|
+
p: [],
|
|
4019
|
+
$: SSR_NODE
|
|
3833
4020
|
};
|
|
3834
4021
|
s = "";
|
|
3835
4022
|
appendResolvedNode(result, r);
|
|
@@ -3865,7 +4052,8 @@ function ssr(t) {
|
|
|
3865
4052
|
if (result === null) s += next;else result.t[result.t.length - 1] += next;
|
|
3866
4053
|
}
|
|
3867
4054
|
if (result === null) return {
|
|
3868
|
-
t: s
|
|
4055
|
+
t: s,
|
|
4056
|
+
$: SSR_NODE
|
|
3869
4057
|
};
|
|
3870
4058
|
return result;
|
|
3871
4059
|
}
|
|
@@ -3945,6 +4133,7 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
|
|
|
3945
4133
|
}
|
|
3946
4134
|
const info = tagInfo(tag);
|
|
3947
4135
|
const skipChildren = info.isVoid;
|
|
4136
|
+
let sel, optValue, optOwn;
|
|
3948
4137
|
let result = info.open + hk;
|
|
3949
4138
|
let childOwner = null;
|
|
3950
4139
|
const last = sources === null ? 0 : sources.length - 1;
|
|
@@ -3963,6 +4152,11 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
|
|
|
3963
4152
|
for (let j = s + 1; j <= last; j++) {
|
|
3964
4153
|
if (keysOf[j].includes(prop)) continue nextKey;
|
|
3965
4154
|
}
|
|
4155
|
+
if (info.sel === 1 && prop === "value") {
|
|
4156
|
+
const value = props[prop];
|
|
4157
|
+
sel = ssrSelect(value);
|
|
4158
|
+
continue;
|
|
4159
|
+
}
|
|
3966
4160
|
if (info.textarea && (prop === "value" || prop === "defaultValue")) {
|
|
3967
4161
|
const value = props[prop];
|
|
3968
4162
|
if (value !== null) children = escape(value);
|
|
@@ -3982,6 +4176,9 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
|
|
|
3982
4176
|
const value = props[key];
|
|
3983
4177
|
if (value == undefined || prop.startsWith("prop:") || prop === "ref" || isEventName(prop)) continue;
|
|
3984
4178
|
if (link !== null && LinkAttributes.has(prop)) link[prop] = value;
|
|
4179
|
+
if (info.sel === 2) {
|
|
4180
|
+
if (prop === "value") optValue = value;else if (prop === "selected" && value) optOwn = true;
|
|
4181
|
+
}
|
|
3985
4182
|
if (prop === "style") {
|
|
3986
4183
|
result += ` style="${ssrStyle(value)}"`;
|
|
3987
4184
|
} else if (prop === "class") {
|
|
@@ -3996,10 +4193,11 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
|
|
|
3996
4193
|
if (attrs !== undefined) result += typeof attrs === "function" ? attrs() : attrs;
|
|
3997
4194
|
if (link !== null && link.href !== undefined) result += ssrLinkClaim(link);
|
|
3998
4195
|
if (skipChildren) return {
|
|
3999
|
-
t: result + " />"
|
|
4196
|
+
t: result + " />",
|
|
4197
|
+
$: SSR_NODE
|
|
4000
4198
|
};
|
|
4001
|
-
if (
|
|
4002
|
-
if (typeof children
|
|
4199
|
+
if (sel !== undefined) children = ssrIn(sel, () => spreadChildren(info, childOwner, children));else children = spreadChildren(info, childOwner, children);
|
|
4200
|
+
if (info.sel === 2) result += ssrOption(optValue !== undefined || typeof children !== "string" ? optValue : children.replace(/</g, "<").replace(/&/g, "&").replace(/\s+/g, " ").trim(), undefined, optOwn);
|
|
4003
4201
|
let thunk = null;
|
|
4004
4202
|
if (typeof children === "function" && (ctx === undefined || !ctx.liveHoles)) {
|
|
4005
4203
|
thunk = children;
|
|
@@ -4010,7 +4208,8 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
|
|
|
4010
4208
|
const res = {
|
|
4011
4209
|
t: [""],
|
|
4012
4210
|
h: [],
|
|
4013
|
-
p: []
|
|
4211
|
+
p: [],
|
|
4212
|
+
$: SSR_NODE
|
|
4014
4213
|
};
|
|
4015
4214
|
pushSSRAsyncHole(res, err, thunk);
|
|
4016
4215
|
return ssr([result + ">", info.close], res);
|
|
@@ -4018,19 +4217,23 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
|
|
|
4018
4217
|
}
|
|
4019
4218
|
const ct = typeof children;
|
|
4020
4219
|
if (ct === "string" || ct === "number") return {
|
|
4021
|
-
t: result + ">" + children + info.close
|
|
4220
|
+
t: result + ">" + children + info.close,
|
|
4221
|
+
$: SSR_NODE
|
|
4022
4222
|
};
|
|
4023
4223
|
if (children == null || ct === "boolean") return {
|
|
4024
|
-
t: result + ">" + info.close
|
|
4224
|
+
t: result + ">" + info.close,
|
|
4225
|
+
$: SSR_NODE
|
|
4025
4226
|
};
|
|
4026
|
-
if (ct === "object" && !children.h && typeof children.t === "string") return {
|
|
4027
|
-
t: result + ">" + children.t + info.close
|
|
4227
|
+
if (ct === "object" && children.$ === SSR_NODE && !children.h && typeof children.t === "string") return {
|
|
4228
|
+
t: result + ">" + children.t + info.close,
|
|
4229
|
+
$: SSR_NODE
|
|
4028
4230
|
};
|
|
4029
4231
|
if (thunk === null) return ssr([result + ">", info.close], resolveSSRNode(children, undefined, true));
|
|
4030
4232
|
const res = {
|
|
4031
4233
|
t: [""],
|
|
4032
4234
|
h: [],
|
|
4033
|
-
p: []
|
|
4235
|
+
p: [],
|
|
4236
|
+
$: SSR_NODE
|
|
4034
4237
|
};
|
|
4035
4238
|
try {
|
|
4036
4239
|
resolveSSRNode(children, res, false, true);
|
|
@@ -4039,6 +4242,10 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
|
|
|
4039
4242
|
}
|
|
4040
4243
|
return ssr([result + ">", info.close], res);
|
|
4041
4244
|
}
|
|
4245
|
+
function spreadChildren(info, childOwner, children) {
|
|
4246
|
+
if (childOwner !== null) children = info.raw ? childOwner.children : escape(childOwner.children);
|
|
4247
|
+
return typeof children === "function" ? children() : children;
|
|
4248
|
+
}
|
|
4042
4249
|
function collectSpreadSources(props, viewKeys, owners) {
|
|
4043
4250
|
for (let i = 0; i < props.length; i++) {
|
|
4044
4251
|
let s = props[i];
|
|
@@ -4081,110 +4288,37 @@ function ssrLinkClaim(attrs) {
|
|
|
4081
4288
|
if (ctx === undefined || ctx.linkClaim === undefined || attrs["aria-current"] != null) return "";
|
|
4082
4289
|
return ctx.linkClaim(attrs);
|
|
4083
4290
|
}
|
|
4084
|
-
|
|
4085
|
-
|
|
4291
|
+
const SELECT = Symbol();
|
|
4292
|
+
function ssrSelect(value) {
|
|
4293
|
+
const owner = createOwner({
|
|
4294
|
+
transparent: true
|
|
4295
|
+
});
|
|
4296
|
+
const state = {
|
|
4297
|
+
v: value,
|
|
4298
|
+
d: false,
|
|
4299
|
+
o: owner
|
|
4300
|
+
};
|
|
4301
|
+
owner._context = {
|
|
4302
|
+
...owner._context,
|
|
4303
|
+
[SELECT]: state
|
|
4304
|
+
};
|
|
4305
|
+
return state;
|
|
4086
4306
|
}
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
for (let j = i + 1; j < html.length; j++) {
|
|
4090
|
-
const c = html.charCodeAt(j);
|
|
4091
|
-
if (c === 34) {
|
|
4092
|
-
j = html.indexOf('"', j + 1);
|
|
4093
|
-
if (j < 0) return -1;
|
|
4094
|
-
} else if (c === 62) return j;
|
|
4095
|
-
}
|
|
4096
|
-
return -1;
|
|
4307
|
+
function ssrIn(state, fn) {
|
|
4308
|
+
return runWithOwner(state.o, fn);
|
|
4097
4309
|
}
|
|
4098
|
-
function
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
const lt = html.indexOf("<", i);
|
|
4103
|
-
if (lt < 0) return t + html.slice(i);
|
|
4104
|
-
t += html.slice(i, lt);
|
|
4105
|
-
if (!html.startsWith("<!--", lt)) return t;
|
|
4106
|
-
const ce = html.indexOf("-->", lt);
|
|
4107
|
-
if (ce < 0) return t;
|
|
4108
|
-
i = ce + 3;
|
|
4109
|
-
}
|
|
4110
|
-
}
|
|
4111
|
-
function tagIs(html, i, name) {
|
|
4112
|
-
if (!html.startsWith(name, i + 1)) return false;
|
|
4113
|
-
const c = html.charCodeAt(i + 1 + name.length);
|
|
4114
|
-
return c === 32 || c === 62 || c === 9 || c === 10 || c === 13;
|
|
4115
|
-
}
|
|
4116
|
-
let selectValuesActive = false;
|
|
4117
|
-
function ssrSelectValues() {
|
|
4118
|
-
selectValuesActive = true;
|
|
4119
|
-
}
|
|
4120
|
-
function resolveSSRSelectValues(html) {
|
|
4121
|
-
if (!selectValuesActive) return html;
|
|
4122
|
-
let cand = html.indexOf("<select");
|
|
4123
|
-
if (cand < 0) return html;
|
|
4124
|
-
let out = "";
|
|
4125
|
-
let idx = 0;
|
|
4126
|
-
while (cand >= 0) {
|
|
4127
|
-
if (!tagIs(html, cand, "select")) {
|
|
4128
|
-
cand = html.indexOf("<select", cand + 7);
|
|
4129
|
-
continue;
|
|
4130
|
-
}
|
|
4131
|
-
const e0 = tagEnd(html, cand);
|
|
4132
|
-
if (e0 < 0) break;
|
|
4133
|
-
const open = html.slice(cand, e0 + 1);
|
|
4134
|
-
const m = SELECT_VALUE_ATTR.exec(open);
|
|
4135
|
-
if (!m) {
|
|
4136
|
-
cand = html.indexOf("<select", e0 + 1);
|
|
4137
|
-
continue;
|
|
4138
|
-
}
|
|
4139
|
-
const bound = decodeSSREntities(m[1] ?? "");
|
|
4140
|
-
const sel = {
|
|
4141
|
-
values: /\smultiple(?=[\s>=])/.test(open) ? bound.split(",") : [bound],
|
|
4142
|
-
strip: cand + m.index,
|
|
4143
|
-
stripEnd: cand + m.index + m[0].length,
|
|
4144
|
-
body: e0 + 1,
|
|
4145
|
-
marks: [],
|
|
4146
|
-
defaulted: false
|
|
4147
|
-
};
|
|
4148
|
-
let committed = false;
|
|
4149
|
-
let i = html.indexOf("<", e0 + 1);
|
|
4150
|
-
while (i >= 0) {
|
|
4151
|
-
let e;
|
|
4152
|
-
if (html.charCodeAt(i + 1) === 33) {
|
|
4153
|
-
e = html.charCodeAt(i + 2) === 45 ? html.indexOf("-->", i) : html.indexOf(">", i);
|
|
4154
|
-
if (e < 0) break;
|
|
4155
|
-
if (html.charCodeAt(i + 2) === 45) e += 2;
|
|
4156
|
-
} else {
|
|
4157
|
-
e = tagEnd(html, i);
|
|
4158
|
-
if (e < 0) break;
|
|
4159
|
-
if (html.startsWith("</select>", i)) {
|
|
4160
|
-
out += html.slice(idx, sel.strip) + html.slice(sel.stripEnd, sel.body);
|
|
4161
|
-
let seg = sel.body;
|
|
4162
|
-
if (!sel.defaulted) {
|
|
4163
|
-
for (let k = 0; k < sel.marks.length; k++) {
|
|
4164
|
-
out += html.slice(seg, sel.marks[k]) + " selected";
|
|
4165
|
-
seg = sel.marks[k];
|
|
4166
|
-
}
|
|
4167
|
-
}
|
|
4168
|
-
out += html.slice(seg, i);
|
|
4169
|
-
idx = i;
|
|
4170
|
-
committed = true;
|
|
4171
|
-
break;
|
|
4172
|
-
} else if (tagIs(html, i, "option")) {
|
|
4173
|
-
const attrs = html.slice(i + 7, e);
|
|
4174
|
-
if (/\sselected(?=[\s=]|$)/.test(attrs)) sel.defaulted = true;else {
|
|
4175
|
-
const vm = SELECT_VALUE_ATTR.exec(attrs);
|
|
4176
|
-
const value = vm ? decodeSSREntities(vm[1] ?? "") : decodeSSREntities(optionText(html, e + 1)).replace(/\s+/g, " ").trim();
|
|
4177
|
-
if (sel.values.includes(value)) sel.marks.push(e);
|
|
4178
|
-
}
|
|
4179
|
-
}
|
|
4180
|
-
}
|
|
4181
|
-
i = html.indexOf("<", e + 1);
|
|
4182
|
-
}
|
|
4183
|
-
if (!committed) break;
|
|
4184
|
-
cand = html.indexOf("<select", idx);
|
|
4310
|
+
function ssrOption(value, state, own) {
|
|
4311
|
+
if (state === undefined) {
|
|
4312
|
+
const o = getOwner();
|
|
4313
|
+
if (!o || !(state = o._context[SELECT])) return "";
|
|
4185
4314
|
}
|
|
4186
|
-
if (
|
|
4187
|
-
|
|
4315
|
+
if (own) return state.d = true, "";
|
|
4316
|
+
if (state.d) return "";
|
|
4317
|
+
if (typeof value === "function") value = value();
|
|
4318
|
+
if (value == null) return "";
|
|
4319
|
+
value = String(value);
|
|
4320
|
+
const v = state.v;
|
|
4321
|
+
return v != null && (v.map ? v.some(x => x != null && String(x) === value) : String(v) === value) ? " selected" : "";
|
|
4188
4322
|
}
|
|
4189
4323
|
function escape(s, attr) {
|
|
4190
4324
|
const t = typeof s;
|
|
@@ -4292,7 +4426,7 @@ function tryJoinPlainSSRArray(nodes) {
|
|
|
4292
4426
|
let out = "";
|
|
4293
4427
|
for (let i = 0, len = nodes.length; i < len; i++) {
|
|
4294
4428
|
const node = nodes[i];
|
|
4295
|
-
if (node == null || typeof node !== "object" || node.h || typeof node.t !== "string") {
|
|
4429
|
+
if (node == null || typeof node !== "object" || node.$ !== SSR_NODE || node.h || typeof node.t !== "string") {
|
|
4296
4430
|
return undefined;
|
|
4297
4431
|
}
|
|
4298
4432
|
out += node.t;
|
|
@@ -4520,13 +4654,13 @@ function tryResolveString(node, nested) {
|
|
|
4520
4654
|
}
|
|
4521
4655
|
return s;
|
|
4522
4656
|
}
|
|
4523
|
-
if (node
|
|
4524
|
-
merge: node
|
|
4525
|
-
};
|
|
4526
|
-
if (node.t === undefined) {
|
|
4657
|
+
if (node.$ !== SSR_NODE) {
|
|
4527
4658
|
unrecognizedInsert(node);
|
|
4528
4659
|
return "";
|
|
4529
4660
|
}
|
|
4661
|
+
if (node.h && node.h.length > 0) return {
|
|
4662
|
+
merge: node
|
|
4663
|
+
};
|
|
4530
4664
|
ssrTextTail = false;
|
|
4531
4665
|
return Array.isArray(node.t) ? node.t[0] : node.t;
|
|
4532
4666
|
}
|
|
@@ -4546,7 +4680,8 @@ function tryResolveString(node, nested) {
|
|
|
4546
4680
|
function resolveSSRNode(node, result = {
|
|
4547
4681
|
t: [""],
|
|
4548
4682
|
h: [],
|
|
4549
|
-
p: []
|
|
4683
|
+
p: [],
|
|
4684
|
+
$: SSR_NODE
|
|
4550
4685
|
}, top, nested) {
|
|
4551
4686
|
if (!nested) ssrTextTail = false;
|
|
4552
4687
|
const t = typeof node;
|
|
@@ -4565,7 +4700,9 @@ function resolveSSRNode(node, result = {
|
|
|
4565
4700
|
if (slotLive) slotLive.suppressed--;
|
|
4566
4701
|
}
|
|
4567
4702
|
} else if (t === "object") {
|
|
4568
|
-
if (node
|
|
4703
|
+
if (node.$ !== SSR_NODE) {
|
|
4704
|
+
unrecognizedInsert(node);
|
|
4705
|
+
} else if (node.h) {
|
|
4569
4706
|
result.t[result.t.length - 1] += node.t[0];
|
|
4570
4707
|
if (node.t.length > 1) {
|
|
4571
4708
|
result.t.push(...node.t.slice(1));
|
|
@@ -4573,10 +4710,10 @@ function resolveSSRNode(node, result = {
|
|
|
4573
4710
|
result.p.push(...node.p);
|
|
4574
4711
|
}
|
|
4575
4712
|
ssrTextTail = false;
|
|
4576
|
-
} else
|
|
4713
|
+
} else {
|
|
4577
4714
|
result.t[result.t.length - 1] += node.t;
|
|
4578
4715
|
ssrTextTail = false;
|
|
4579
|
-
}
|
|
4716
|
+
}
|
|
4580
4717
|
} else if (t === "function") {
|
|
4581
4718
|
const live = sharedConfig.context && sharedConfig.context.liveHoles;
|
|
4582
4719
|
let liveNode = null;
|
|
@@ -5013,6 +5150,10 @@ function registerElementClaim() {
|
|
|
5013
5150
|
return noopCleanup;
|
|
5014
5151
|
}
|
|
5015
5152
|
function noopCleanup() {}
|
|
5153
|
+
function setTrustedTypesPolicy() {}
|
|
5154
|
+
function trustedHTML(html) {
|
|
5155
|
+
return html;
|
|
5156
|
+
}
|
|
5016
5157
|
function claimElement(node) {
|
|
5017
5158
|
return node;
|
|
5018
5159
|
}
|
|
@@ -5162,4 +5303,4 @@ function httpHeader(name, value, options) {
|
|
|
5162
5303
|
}
|
|
5163
5304
|
}
|
|
5164
5305
|
|
|
5165
|
-
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,
|
|
5306
|
+
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 };
|