@solidjs/web 2.0.0-rc.21 → 2.0.0-rc.23

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.
@@ -1,4 +1,4 @@
1
- import { createRenderEffect, createMemo, OBSERVE, getOwner, createRoot, $PROXY, onCleanup, runWithOwner, createComponent, omit, getNextChildId } from 'solid-js';
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';
@@ -284,6 +284,24 @@ function traceMetaMarkup(record) {
284
284
  }
285
285
  return markup;
286
286
  }
287
+ function sharedCacheMayStore(cacheControl, cdnCacheControl) {
288
+ return mayStore(cacheControl, true) || mayStore(cdnCacheControl, false);
289
+ }
290
+ const DIRECTIVE = /([^\s=,]+)\s*(=\s*(?:"(?:[^"\\]|\\.)*"?|[^,]*))?/g;
291
+ function mayStore(value, asks) {
292
+ if (value === null) return false;
293
+ let shared = !asks;
294
+ for (const [, directive, argument] of value.matchAll(DIRECTIVE)) {
295
+ const name = directive.toLowerCase();
296
+ if (name === "no-store" || name === "private" && !argument) return false;
297
+ if (name === "public" || name === "s-maxage") shared = true;
298
+ }
299
+ return shared;
300
+ }
301
+ function withholdForSharedCache(record, event) {
302
+ const headers = event && event.response && event.response.headers;
303
+ if (record.emit && headers && sharedCacheMayStore(headers.get("Cache-Control"), headers.get("CDN-Cache-Control"))) record.emit = false;
304
+ }
287
305
 
288
306
  const RECORDS = Symbol.for("@solidjs/signals/observe/records");
289
307
  function records() {
@@ -355,7 +373,15 @@ function rewriteTree(value, visit, withPath) {
355
373
  } catch (err) {
356
374
  if (err !== CYCLE) throw err;
357
375
  }
358
- return clone(value, visit, path, state.memo || (state.memo = new Map()));
376
+ const memo = state.memo || (state.memo = new Map());
377
+ const marks = {
378
+ at: new Map(),
379
+ stack: [],
380
+ changed: new Set(),
381
+ next: 0
382
+ };
383
+ mark(value, visit, path, memo, marks);
384
+ return clone(value, memo, marks.changed);
359
385
  }
360
386
  function shape(value) {
361
387
  return Array.isArray(value) ? 1 : Object.getPrototypeOf(value) === Object.prototype ? 2 : 0;
@@ -403,28 +429,73 @@ function cow(value, visit, path, depth, state) {
403
429
  if (ancestors !== undefined) ancestors.delete(value);
404
430
  return out;
405
431
  }
406
- function clone(value, visit, path, memo) {
407
- if (memo.has(value)) return memo.get(value);
432
+ function mark(value, visit, path, memo, m) {
433
+ const seen = m.at.get(value);
434
+ if (seen !== undefined) return seen;
435
+ if (memo.has(value)) return -1;
408
436
  const r = visit(value, path);
409
437
  if (r !== DESCEND) {
410
438
  memo.set(value, r);
411
- return r;
439
+ return -1;
412
440
  }
413
441
  const s = shape(value);
414
- if (s === 0) return value;
415
- const out = s === 1 ? value.slice() : {
442
+ if (s === 0) return -1;
443
+ const index = m.next++;
444
+ let low = index;
445
+ let changed = false;
446
+ let open = false;
447
+ const keys = s === 1 ? value : Object.keys(value);
448
+ for (let i = 0; i < keys.length; i++) {
449
+ const k = s === 1 ? i : keys[i];
450
+ const c = value[k];
451
+ if (c === null || typeof c !== "object") continue;
452
+ if (!open) {
453
+ open = true;
454
+ m.at.set(value, index);
455
+ m.stack.push(value);
456
+ }
457
+ const l = mark(c, visit, undefined , memo, m);
458
+ if (l >= 0 && l < low) low = l;
459
+ if (memo.has(c) && memo.get(c) !== c || l === Infinity && m.changed.has(c)) changed = true;
460
+ }
461
+ if (!open) return -1;
462
+ if (low === index) {
463
+ m.at.set(value, Infinity);
464
+ if (m.stack[m.stack.length - 1] === value) {
465
+ m.stack.pop();
466
+ if (changed) m.changed.add(value);
467
+ return Infinity;
468
+ }
469
+ const members = m.stack.splice(m.stack.lastIndexOf(value));
470
+ if (!changed) for (const n of members) if (m.changed.has(n)) {
471
+ changed = true;
472
+ break;
473
+ }
474
+ for (const n of members) {
475
+ m.at.set(n, Infinity);
476
+ if (changed) m.changed.add(n);
477
+ }
478
+ return Infinity;
479
+ }
480
+ if (changed) m.changed.add(value);
481
+ return low;
482
+ }
483
+ function clone(value, memo, changed) {
484
+ if (memo.has(value)) return memo.get(value);
485
+ if (!changed.has(value)) return value;
486
+ const out = Array.isArray(value) ? value.slice() : {
416
487
  ...value
417
488
  };
418
489
  memo.set(value, out);
419
- if (s === 1) {
490
+ if (Array.isArray(value)) {
420
491
  for (let i = 0; i < value.length; i++) {
421
492
  const c = value[i];
422
- if (c !== null && typeof c === "object") out[i] = clone(c, visit, undefined , memo);
493
+ if (c !== null && typeof c === "object") out[i] = clone(c, memo, changed);
423
494
  }
424
495
  } else {
425
496
  for (const k of Object.keys(value)) {
426
497
  const c = value[k];
427
- if (c !== null && typeof c === "object") out[k] = clone(c, visit, undefined , memo);
498
+ if (c !== null && typeof c === "object") out[k] = clone(c, memo, changed);
428
499
  }
429
500
  }
430
501
  return out;
@@ -564,7 +635,7 @@ function createKeyedSerializer(serialize, onError, onDone) {
564
635
  stream = serialize(key, value, {
565
636
  onError: onError && (err => {
566
637
  failed = true;
567
- onError(err);
638
+ onError(err, key);
568
639
  if (cancel) {
569
640
  cancel();
570
641
  settle();
@@ -637,7 +708,7 @@ function createHydrationSerializer({
637
708
  });
638
709
  return createKeyedSerializer(late ? late(serialize, refs, onData, scopeId) : serialize, onError, onDone);
639
710
  }
640
- function rejectUnserializedKey(serialize, refs, onData, scopeId) {
711
+ function rejectUnserializedKey(serialize, refs, onData, scopeId, plain) {
641
712
  let taken = 0;
642
713
  let fresh = [];
643
714
  const set = refs.set;
@@ -660,8 +731,9 @@ function rejectUnserializedKey(serialize, refs, onData, scopeId) {
660
731
  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
732
  }
662
733
  if (!ids.size) return;
663
- const body = "for(const i of[" + [...ids] + "]){const v=$R[i];v&&(v.f?v.f(e):v.throw&&v.throw(e))}";
664
- const message = JSON.stringify("Serialization failed: the hydration value for key " + JSON.stringify(key) + " could not be serialized on the server").replace(/[<\u2028\u2029]/g, c => KEY_ESCAPES[c]);
734
+ const text = plain && plain(key);
735
+ 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))}";
736
+ 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
737
  onData("($R=>{const e=new Error(" + message + ");" + body + "})(" + (scopeId == null ? "$R" : '$R["' + serializeKey(scopeId) + '"]') + ")");
666
738
  };
667
739
  return serialize(key, value, {
@@ -1176,6 +1248,7 @@ function isSetAttr(value) {
1176
1248
  return value != null && value !== false && value !== "";
1177
1249
  }
1178
1250
  const PRELOAD_LINK_ATTRIBUTES = ["type", "crossorigin", "integrity", "referrerpolicy", "fetchpriority", "media", "imagesrcset", "imagesizes"];
1251
+ const SSR_NODE = /*#__PURE__*/Symbol.for("solid.ssrNode");
1179
1252
  function registerPreloadLink(tracking, headRegistry, link, nonce) {
1180
1253
  if (!link || typeof link !== "object") {
1181
1254
  return null;
@@ -1706,7 +1779,8 @@ function tagInfo(tag) {
1706
1779
  textarea: tag === "textarea",
1707
1780
  raw: tag === "script" || tag === "style",
1708
1781
  formDefaults,
1709
- formAttributes
1782
+ formAttributes,
1783
+ sel: tag === "select" ? 1 : tag === "option" ? 2 : 0
1710
1784
  };
1711
1785
  if (tagInfos.size < 512) tagInfos.set(tag, info);
1712
1786
  }
@@ -1807,8 +1881,9 @@ function renderToString(code, options = {}) {
1807
1881
  serializeFragmentAssets("", tracking.boundaryModules, sharedConfig.context, renderId);
1808
1882
  closed = true;
1809
1883
  serializer.close();
1884
+ withholdForSharedCache(context.trace, requestEvent);
1810
1885
  const head = renderShellHead(headRegistry, nonce, null, noScripts, traceMetaMarkup(context.trace));
1811
- const document = withShellEnd(assembleDocument(resolveSSRSelectValues(html), tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead, tracking.lowModules), context, renderId, nonce, noScripts);
1886
+ const document = withShellEnd(assembleDocument(html, tracking.emittedAssets, tracking.preloadLinks, tracking.inlineStyles, scripts.length ? scripts : "", nonce, head, onHead, tracking.lowModules), context, renderId, nonce, noScripts);
1812
1887
  if (render) render.shell();
1813
1888
  if (requestEvent && requestEvent.response) {
1814
1889
  commitResponseStub(requestEvent.response, {
@@ -1895,7 +1970,8 @@ function renderToStream(code, options = {}) {
1895
1970
  if (render) settleRender(render, rootOwner, disconnect ? "abandoned" : "error");
1896
1971
  const sink = writable;
1897
1972
  buffer = {
1898
- write() {}
1973
+ write() {},
1974
+ flush() {}
1899
1975
  };
1900
1976
  writable = {
1901
1977
  end() {}
@@ -1989,24 +2065,64 @@ function renderToStream(code, options = {}) {
1989
2065
  let stableOrder = false;
1990
2066
  let parkedWrites = null;
1991
2067
  const byKey = (a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0;
1992
- let writing = 0;
1993
2068
  let stranded = false;
1994
- const handOver = (id, value) => {
1995
- writing++;
1996
- try {
1997
- serializer.write(id, value);
1998
- } finally {
1999
- writing--;
2069
+ let writingRecord = false;
2070
+ let recordFailed = false;
2071
+ const plainRecords = new WeakMap();
2072
+ const caught = new Set();
2073
+ let unclaimed = null;
2074
+ const rejected = new Map();
2075
+ 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`;
2076
+ const plainFor = (id, value) => {
2077
+ const keyed = value !== null && typeof value === "object";
2078
+ let plain = keyed && plainRecords.get(value);
2079
+ if (!plain) {
2080
+ plain = new Error(plainMessage(id, value));
2081
+ if (keyed) plainRecords.set(value, plain);
2082
+ }
2083
+ return plain;
2084
+ };
2085
+ const claim = () => {
2086
+ if (unclaimed) {
2087
+ for (const reason of unclaimed) if (!caught.has(reason)) stranded = true;
2088
+ unclaimed = null;
2089
+ }
2090
+ return stranded;
2091
+ };
2092
+ const claimLater = reason => {
2093
+ if (firstFlushed || stranded || caught.has(reason)) return;
2094
+ if (!unclaimed) {
2095
+ unclaimed = new Set();
2096
+ deferFlush(() => {
2097
+ if (!rootHoles && claim()) abandon();
2098
+ });
2099
+ }
2100
+ unclaimed.add(reason);
2101
+ };
2102
+ const handOver = (id, value, error) => {
2103
+ if (!error || options.serializer) return serializer.write(id, value);
2104
+ let plain = value !== null && typeof value === "object" && plainRecords.get(value);
2105
+ if (!plain) {
2106
+ recordFailed = false;
2107
+ writingRecord = true;
2108
+ try {
2109
+ serializer.write(id, value);
2110
+ } finally {
2111
+ writingRecord = false;
2112
+ }
2113
+ if (!recordFailed) return;
2114
+ plain = plainFor(id, value);
2000
2115
  }
2116
+ serializer.write(id, plain);
2001
2117
  };
2002
- const write = (id, value) => {
2003
- if (stableOrder && !dead) (parkedWrites ||= []).push([id, value]);else handOver(id, value);
2118
+ const write = (id, value, error) => {
2119
+ if (stableOrder && !dead) (parkedWrites ||= []).push([id, value, error]);else handOver(id, value, error);
2004
2120
  };
2005
2121
  const flushParkedWrites = () => {
2006
2122
  if (!parkedWrites) return;
2007
2123
  const writes = parkedWrites.sort(byKey);
2008
2124
  parkedWrites = null;
2009
- for (let i = 0; i < writes.length; i++) handOver(writes[i][0], writes[i][1]);
2125
+ for (let i = 0; i < writes.length; i++) handOver(writes[i][0], writes[i][1], writes[i][2]);
2010
2126
  };
2011
2127
  const flushStubBatch = () => {
2012
2128
  if (!stubBatch) return;
@@ -2031,7 +2147,7 @@ function renderToStream(code, options = {}) {
2031
2147
  const onDone = () => {
2032
2148
  if (dead) return;
2033
2149
  writeTasks();
2034
- if (stranded) return abandon();
2150
+ if (claim()) return abandon();
2035
2151
  lastBlockingSize = blockingPromises.size;
2036
2152
  doShell();
2037
2153
  onCompleteAll && onCompleteAll({
@@ -2094,11 +2210,19 @@ function renderToStream(code, options = {}) {
2094
2210
  plugins: options.plugins,
2095
2211
  onData: payload => sink.data(payload),
2096
2212
  onDone,
2097
- onError: err => {
2098
- reportFailure(err, "serialize");
2099
- if (!writing && !options.serializer && !firstFlushed) stranded = true;
2213
+ onError: (err, key) => {
2214
+ const rejection = !options.serializer && !writingRecord && rejected.has(key);
2215
+ const reason = rejection && rejected.get(key);
2216
+ if (!rejection || reason === null || typeof reason !== "object" || !plainRecords.has(reason)) reportFailure(err, "serialize");
2217
+ if (writingRecord) recordFailed = true;else if (rejection) {
2218
+ plainFor(key, reason);
2219
+ claimLater(reason);
2220
+ } else if (!options.serializer && !firstFlushed && !stranded) {
2221
+ stranded = true;
2222
+ deferFlush(() => abandon());
2223
+ }
2100
2224
  },
2101
- late: rejectUnserializedKey
2225
+ late: (serialize, refs, onData, scopeId) => rejectUnserializedKey(serialize, refs, onData, scopeId, key => !firstFlushed && rejected.has(key) ? plainMessage(key, rejected.get(key)) : undefined)
2102
2226
  });
2103
2227
  let rootAssetsSerialized = false;
2104
2228
  const serializeRootAssets = () => {
@@ -2177,7 +2301,10 @@ function renderToStream(code, options = {}) {
2177
2301
  raced.catch(() => {});
2178
2302
  pendingSerialized.set(id, settle);
2179
2303
  const drop = () => pendingSerialized.delete(id);
2180
- p.then(drop, drop);
2304
+ p.then(drop, reason => {
2305
+ drop();
2306
+ rejected.set(id, reason);
2307
+ });
2181
2308
  return raced;
2182
2309
  };
2183
2310
  const abandonSubtree = (key, error) => {
@@ -2340,12 +2467,17 @@ function renderToStream(code, options = {}) {
2340
2467
  const last = html.indexOf(`<!--!$/${id}-->`, first + placeholder.length);
2341
2468
  html = html.slice(0, first) + resolveSSRSync(escape(payloadFn())) + html.slice(last + placeholder.length + 1);
2342
2469
  },
2343
- serialize(id, p, deferStream) {
2470
+ serialize(id, p, deferStream, errorRecord) {
2344
2471
  p = guardChannel(p);
2345
2472
  if (p && typeof p === "object" && typeof p.then === "function") {
2346
2473
  if (!firstFlushed && deferStream) {
2347
2474
  blockingPromises.add(p);
2348
- p.then(d => write(id, d)).catch(e => write(id, e));
2475
+ p.then(d => write(id, d)).catch(e => {
2476
+ rejected.set(id, e);
2477
+ const r = Promise.reject(e);
2478
+ r.catch(() => {});
2479
+ write(id, r);
2480
+ });
2349
2481
  return;
2350
2482
  }
2351
2483
  p = trackSerialized(id, p);
@@ -2354,7 +2486,7 @@ function renderToStream(code, options = {}) {
2354
2486
  return;
2355
2487
  }
2356
2488
  }
2357
- write(id, p);
2489
+ write(id, p, errorRecord);
2358
2490
  },
2359
2491
  escape: escape,
2360
2492
  resolve: resolveSSRNode,
@@ -2428,7 +2560,7 @@ function renderToStream(code, options = {}) {
2428
2560
  const styles = collectStreamStyles(key, tracking, headStyles);
2429
2561
  const headOps = error ? null : flushHeadFragment(headRegistry, key, nonce);
2430
2562
  if (headOps) emitHeadOps(key, headOps);
2431
- sink.fragment(key, resolveSSRSelectValues(value !== undefined ? value : error ? "" : " "), {
2563
+ sink.fragment(key, value !== undefined ? value : error ? "" : " ", {
2432
2564
  styles,
2433
2565
  revealGroup,
2434
2566
  error: error ? ssrSanitizeError(error, null, undefined, undefined, errorScope) : error
@@ -2459,6 +2591,10 @@ function renderToStream(code, options = {}) {
2459
2591
  context.failRender = failRender;
2460
2592
  context.errorPolicy = options.onError;
2461
2593
  context._errorScope = errorScope;
2594
+ context.contained = (error, wire) => {
2595
+ caught.add(error);
2596
+ caught.add(wire);
2597
+ };
2462
2598
  context.flushed = () => firstFlushed;
2463
2599
  context.trace = requestEvent ? traceForEvent(requestEvent) : traceFor(context, undefined);
2464
2600
  render = timeDocument(context, context.trace, "stream", requestEvent);
@@ -2574,9 +2710,10 @@ function renderToStream(code, options = {}) {
2574
2710
  }
2575
2711
  serializeRootAssets();
2576
2712
  flushStubBatch();
2713
+ withholdForSharedCache(context.trace, requestEvent);
2577
2714
  const head = renderShellHead(headRegistry, nonce, k => registry.has(k), noScripts, traceMetaMarkup(context.trace));
2578
2715
  if (render) render.shell();
2579
- sink.shell(resolveSSRSelectValues(html), {
2716
+ sink.shell(html, {
2580
2717
  preloads: tracking.emittedAssets,
2581
2718
  preloadLinks: tracking.preloadLinks,
2582
2719
  inlineStyles: tracking.inlineStyles,
@@ -2652,7 +2789,7 @@ function renderToStream(code, options = {}) {
2652
2789
  return;
2653
2790
  }
2654
2791
  if (!shellCompleted) return flush();
2655
- if (stranded) return abandon();
2792
+ if (claim()) return abandon();
2656
2793
  const encoder = new TextEncoder();
2657
2794
  const writer = w.getWriter();
2658
2795
  let pendingWrites = Promise.resolve();
@@ -2752,7 +2889,7 @@ function renderToStream(code, options = {}) {
2752
2889
  return;
2753
2890
  }
2754
2891
  if (!shellCompleted) return flush();
2755
- if (stranded) return abandon();
2892
+ if (claim()) return abandon();
2756
2893
  const sink = guardSink(w);
2757
2894
  buffer = writable = coalesceWrites(sink.write, sink.end);
2758
2895
  buffer.write(tmp);
@@ -2818,6 +2955,8 @@ function buildAsyncWrap(err, node) {
2818
2955
  fn.$rw = true;
2819
2956
  if (suppress) fn.$lhSuppress = true;
2820
2957
  if (node.$lhSkip) fn.$lhSkip = true;
2958
+ if (node.$lhInTag) fn.$lhInTag = true;
2959
+ if (node.$lhAttr) fn.$lhAttr = node.$lhAttr;
2821
2960
  if (node.$lhBinding) fn.$lhBinding = node.$lhBinding;
2822
2961
  return {
2823
2962
  fn,
@@ -3019,7 +3158,8 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
3019
3158
  t: [""],
3020
3159
  h: [],
3021
3160
  p: [],
3022
- rows: null
3161
+ rows: null,
3162
+ $: SSR_NODE
3023
3163
  };
3024
3164
  try {
3025
3165
  result.rows = resolveValue(holeValue(hole), result);
@@ -3118,16 +3258,41 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
3118
3258
  },
3119
3259
  nest(hole) {
3120
3260
  const s = engine.scope;
3121
- if (!s || s.h === hole || hole.$lhSkip || inScope && !inScope()) return undefined;
3261
+ if (!s || s.h === hole || hole.$lhSkip || hole.$lhInTag || inScope && !inScope()) return undefined;
3122
3262
  engine.scope = scopeFor(hole);
3123
3263
  return s;
3124
3264
  },
3125
3265
  content(hole) {
3266
+ if (hole.$lhInTag) {
3267
+ const cap = hole.$lhAttr;
3268
+ if (!cap || cap.adopted || engine.suppressed || engine.sweeping) return null;
3269
+ const r = tryResolveFunctionHole(hole);
3270
+ if (typeof r !== "string") {
3271
+ const res = {
3272
+ t: [""],
3273
+ h: [],
3274
+ p: [],
3275
+ $: SSR_NODE
3276
+ };
3277
+ appendResolvedNode(res, r);
3278
+ return res;
3279
+ }
3280
+ if (--cap.waiting === 0 && !cap.closed) {
3281
+ try {
3282
+ cap.base = attrPartsText(cap.parts);
3283
+ } catch (err) {
3284
+ cap.base = null;
3285
+ }
3286
+ if (cap.base !== null) engine.attr(cap);
3287
+ }
3288
+ return r;
3289
+ }
3126
3290
  if (hole.$lhSuppress) {
3127
3291
  const r = {
3128
3292
  t: [""],
3129
3293
  h: [],
3130
- p: []
3294
+ p: [],
3295
+ $: SSR_NODE
3131
3296
  };
3132
3297
  let rows = null;
3133
3298
  const b = hole.$lhBinding;
@@ -3231,7 +3396,8 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
3231
3396
  const r = {
3232
3397
  t: [""],
3233
3398
  h: [],
3234
- p: []
3399
+ p: [],
3400
+ $: SSR_NODE
3235
3401
  };
3236
3402
  engine.suppressed++;
3237
3403
  try {
@@ -3250,13 +3416,15 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
3250
3416
  res = {
3251
3417
  t: ["", ""],
3252
3418
  h: [escalated.fn],
3253
- p: [escalated.p]
3419
+ p: [escalated.p],
3420
+ $: SSR_NODE
3254
3421
  };
3255
3422
  } else {
3256
3423
  res = {
3257
3424
  t: [""],
3258
3425
  h: [],
3259
- p: []
3426
+ p: [],
3427
+ $: SSR_NODE
3260
3428
  };
3261
3429
  try {
3262
3430
  rows = resolveValue(value, res);
@@ -3286,20 +3454,59 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
3286
3454
  t[t.length - 1] += close;
3287
3455
  sink.openBinding(key, b);
3288
3456
  return {
3289
- t,
3457
+ t: t,
3290
3458
  h: res.h,
3291
- p: res.p
3459
+ p: res.p,
3460
+ $: SSR_NODE
3292
3461
  };
3293
3462
  },
3294
3463
  mint() {
3295
3464
  return nextId++;
3296
3465
  },
3466
+ open(text, off, hole) {
3467
+ const pending = hole && hole.$lhAttr;
3468
+ let inject;
3469
+ let id;
3470
+ if (pending && !pending.adopted && text.startsWith(pending.inject, off)) {
3471
+ pending.adopted = true;
3472
+ ({
3473
+ id,
3474
+ inject
3475
+ } = pending);
3476
+ } else {
3477
+ id = nextId++;
3478
+ inject = ` data-lha="${id}"`;
3479
+ text = text.slice(0, off) + inject + text.slice(off);
3480
+ }
3481
+ const prefix = text.slice(off + inject.length);
3482
+ return {
3483
+ id,
3484
+ parts: [prefix],
3485
+ base: prefix,
3486
+ inject,
3487
+ waiting: 0,
3488
+ text
3489
+ };
3490
+ },
3491
+ retry(fn, cap) {
3492
+ if (typeof fn !== "function") return;
3493
+ fn.$lhInTag = true;
3494
+ if (cap) {
3495
+ fn.$lhAttr = cap;
3496
+ cap.waiting++;
3497
+ }
3498
+ },
3297
3499
  active() {
3298
3500
  return (!inScope || inScope()) && !(settled && settled());
3299
3501
  },
3300
3502
  attr(cap) {
3301
- const owner = getOwner();
3302
- const holeCtx = sharedConfig.context;
3503
+ if (cap.waiting) {
3504
+ cap.owner = getOwner();
3505
+ cap.ctx = sharedConfig.context;
3506
+ return;
3507
+ }
3508
+ const owner = cap.owner !== undefined ? cap.owner : getOwner();
3509
+ const holeCtx = cap.ctx !== undefined ? cap.ctx : sharedConfig.context;
3303
3510
  const b = {
3304
3511
  key: "lha:" + cap.id,
3305
3512
  children: [],
@@ -3314,29 +3521,7 @@ function createLiveHoles(sink, scoped, settled, errorScope) {
3314
3521
  engine.gateHit = false;
3315
3522
  let html = "";
3316
3523
  try {
3317
- let group = null;
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);
3524
+ swept(owner, holeCtx, () => html = attrPartsText(cap.parts));
3340
3525
  } catch (err) {
3341
3526
  if (ssrHandleError(err, true)) {
3342
3527
  if (!engine.sweptOwners) return;
@@ -3443,10 +3628,35 @@ function rowPatch(a, b) {
3443
3628
  }
3444
3629
  }
3445
3630
  }
3631
+ function attrPartsText(parts) {
3632
+ let html = "";
3633
+ let group = null;
3634
+ let groupVal = null;
3635
+ for (const part of parts) {
3636
+ if (typeof part === "string") {
3637
+ html += part;
3638
+ continue;
3639
+ }
3640
+ let v;
3641
+ if (part.g) {
3642
+ if (group !== part.g) {
3643
+ group = part.g;
3644
+ groupVal = part.g();
3645
+ }
3646
+ v = groupVal[part.i];
3647
+ } else {
3648
+ v = part.f();
3649
+ }
3650
+ const vt = typeof v;
3651
+ if (vt === "string" || vt === "number") html += v;
3652
+ }
3653
+ return html;
3654
+ }
3446
3655
  function ssr(t) {
3447
3656
  const len = arguments.length;
3448
3657
  if (len === 1) return {
3449
- t
3658
+ t: t,
3659
+ $: SSR_NODE
3450
3660
  };
3451
3661
  let s = t[0];
3452
3662
  let result = null;
@@ -3462,30 +3672,18 @@ function ssr(t) {
3462
3672
  seg: -1,
3463
3673
  off: hp.openOff[0]
3464
3674
  };
3465
- const captureStart = () => {
3675
+ const captureStart = hole => {
3466
3676
  if (cap) return true;
3467
3677
  if (!lastOpen || live.suppressed || live.sweeping || !live.active()) return false;
3678
+ if (lastOpen.r === null && result !== null && result.t.length === 1) {
3679
+ lastOpen.r = result;
3680
+ lastOpen.seg = 0;
3681
+ }
3468
3682
  if (lastOpen.r !== result || result !== null && lastOpen.seg !== result.t.length - 1) {
3469
3683
  return false;
3470
3684
  }
3471
- const id = live.mint();
3472
- const inject = ` data-lha="${id}"`;
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
- };
3685
+ cap = live.open(result === null ? s : result.t[lastOpen.seg], lastOpen.off, hole);
3686
+ if (result === null) s = cap.text;else result.t[lastOpen.seg] = cap.text;
3489
3687
  return true;
3490
3688
  };
3491
3689
  for (let i = 1; i < len; i++) {
@@ -3516,7 +3714,8 @@ function ssr(t) {
3516
3714
  result = {
3517
3715
  t: [s],
3518
3716
  h: [],
3519
- p: []
3717
+ p: [],
3718
+ $: SSR_NODE
3520
3719
  };
3521
3720
  s = "";
3522
3721
  }
@@ -3526,18 +3725,23 @@ function ssr(t) {
3526
3725
  if (Array.isArray(lastGroupVal)) {
3527
3726
  value = lastGroupVal[lastGroupIdx++];
3528
3727
  hasValue = true;
3529
- if (live && !hp.pos[i - 1] && captureStart()) {
3728
+ if (live && !hp.pos[i - 1] && captureStart(hole)) {
3530
3729
  cap.parts.push({
3531
3730
  g: hole,
3532
3731
  i: lastGroupIdx - 1
3533
3732
  });
3534
3733
  }
3535
3734
  } else {
3536
- if (cap) {
3537
- result.t[cap.at] = result.t[cap.at].replace(cap.inject, "");
3538
- cap = null;
3735
+ const slot = ssrGroupSlot(lastGroupVal.fn, lastGroupIdx++);
3736
+ if (live && !hp.pos[i - 1]) {
3737
+ const capturing = captureStart(hole);
3738
+ if (capturing) cap.parts.push({
3739
+ g: hole,
3740
+ i: lastGroupIdx - 1
3741
+ });
3742
+ live.retry(slot, capturing && cap);
3539
3743
  }
3540
- result.h.push(ssrGroupSlot(lastGroupVal.fn, lastGroupIdx++));
3744
+ result.h.push(slot);
3541
3745
  result.p.push(lastGroupVal.p);
3542
3746
  result.t.push("");
3543
3747
  }
@@ -3557,7 +3761,8 @@ function ssr(t) {
3557
3761
  result = {
3558
3762
  t: [s],
3559
3763
  h: [],
3560
- p: []
3764
+ p: [],
3765
+ $: SSR_NODE
3561
3766
  };
3562
3767
  s = "";
3563
3768
  if (rs.merge !== undefined) mergeTemplateInto(result, rs.merge);else resolveSSRNode(rs.bail, result);
@@ -3574,7 +3779,8 @@ function ssr(t) {
3574
3779
  result = {
3575
3780
  t: [s],
3576
3781
  h: [],
3577
- p: []
3782
+ p: [],
3783
+ $: SSR_NODE
3578
3784
  };
3579
3785
  s = "";
3580
3786
  }
@@ -3582,28 +3788,27 @@ function ssr(t) {
3582
3788
  }
3583
3789
  } else if (result !== null) {
3584
3790
  const inTag = live && !hp.pos[i - 1];
3585
- const capturing = inTag && captureStart();
3791
+ const capturing = inTag && captureStart(hole);
3586
3792
  const li = capturing ? result.t.length - 1 : 0;
3587
3793
  const before = capturing ? result.t[li].length : 0;
3794
+ const pushed = result.h.length;
3588
3795
  if (live) live.suppressed++;
3589
3796
  try {
3590
3797
  resolveSSRNode(hole, result);
3591
3798
  } finally {
3592
3799
  if (live) live.suppressed--;
3593
3800
  }
3801
+ if (inTag) {
3802
+ for (let k = pushed; k < result.h.length; k++) live.retry(result.h[k], capturing && cap);
3803
+ }
3594
3804
  if (capturing) {
3595
- if (result.t.length - 1 === li) {
3596
- cap.base += result.t[li].slice(before);
3597
- cap.parts.push({
3598
- f: hole
3599
- });
3600
- } else {
3601
- result.t[cap.at] = result.t[cap.at].replace(cap.inject, "");
3602
- cap = null;
3603
- }
3805
+ if (result.t.length - 1 === li) cap.base += result.t[li].slice(before);
3806
+ cap.parts.push({
3807
+ f: hole
3808
+ });
3604
3809
  }
3605
3810
  } else {
3606
- const capturing = live && !hp.pos[i - 1] && captureStart();
3811
+ const capturing = live && !hp.pos[i - 1] && captureStart(hole);
3607
3812
  const scope = live && hp.pos[i - 1] && live.nest(hole);
3608
3813
  const r = tryResolveFunctionHole(hole);
3609
3814
  if (scope) live.scope = scope;
@@ -3616,17 +3821,18 @@ function ssr(t) {
3616
3821
  });
3617
3822
  }
3618
3823
  } else {
3619
- if (capturing) {
3620
- s = s.replace(cap.inject, "");
3621
- cap = null;
3622
- }
3623
3824
  result = {
3624
3825
  t: [s],
3625
3826
  h: [],
3626
- p: []
3827
+ p: [],
3828
+ $: SSR_NODE
3627
3829
  };
3628
3830
  s = "";
3629
3831
  appendResolvedNode(result, r);
3832
+ if (capturing) cap.parts.push({
3833
+ f: hole
3834
+ });
3835
+ if (live && !hp.pos[i - 1]) for (const h of result.h) live.retry(h, capturing && cap);
3630
3836
  }
3631
3837
  }
3632
3838
  } else if (result !== null) {
@@ -3639,7 +3845,8 @@ function ssr(t) {
3639
3845
  result = {
3640
3846
  t: [s],
3641
3847
  h: [],
3642
- p: []
3848
+ p: [],
3849
+ $: SSR_NODE
3643
3850
  };
3644
3851
  s = "";
3645
3852
  appendResolvedNode(result, r);
@@ -3675,7 +3882,8 @@ function ssr(t) {
3675
3882
  if (result === null) s += next;else result.t[result.t.length - 1] += next;
3676
3883
  }
3677
3884
  if (result === null) return {
3678
- t: s
3885
+ t: s,
3886
+ $: SSR_NODE
3679
3887
  };
3680
3888
  return result;
3681
3889
  }
@@ -3737,14 +3945,14 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
3737
3945
  let i = 0;
3738
3946
  for (; i < props.length; i++) {
3739
3947
  const s = props[i];
3740
- if (s == null || typeof s === "function" || $PROXY in s) break;
3948
+ if (!s || typeof s === "function" || $PROXY in s) break;
3741
3949
  }
3742
3950
  if (i === props.length) sources = props;else {
3743
3951
  viewKeys = [];
3744
3952
  owners = [];
3745
3953
  collectSpreadSources(props, viewKeys, owners);
3746
3954
  }
3747
- } else if (props == null) {
3955
+ } else if (!props) {
3748
3956
  props = {};
3749
3957
  } else if ($PROXY in props) {
3750
3958
  if (viewOf(props) !== undefined) {
@@ -3755,6 +3963,7 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
3755
3963
  }
3756
3964
  const info = tagInfo(tag);
3757
3965
  const skipChildren = info.isVoid;
3966
+ let sel, optValue, optOwn;
3758
3967
  let result = info.open + hk;
3759
3968
  let childOwner = null;
3760
3969
  const last = sources === null ? 0 : sources.length - 1;
@@ -3773,6 +3982,11 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
3773
3982
  for (let j = s + 1; j <= last; j++) {
3774
3983
  if (keysOf[j].includes(prop)) continue nextKey;
3775
3984
  }
3985
+ if (info.sel === 1 && prop === "value") {
3986
+ const value = props[prop];
3987
+ sel = ssrSelect(value);
3988
+ continue;
3989
+ }
3776
3990
  if (info.textarea && (prop === "value" || prop === "defaultValue")) {
3777
3991
  const value = props[prop];
3778
3992
  if (value !== null) children = escape(value);
@@ -3792,6 +4006,9 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
3792
4006
  const value = props[key];
3793
4007
  if (value == undefined || prop.startsWith("prop:") || prop === "ref" || isEventName(prop)) continue;
3794
4008
  if (link !== null && LinkAttributes.has(prop)) link[prop] = value;
4009
+ if (info.sel === 2) {
4010
+ if (prop === "value") optValue = value;else if (prop === "selected" && value) optOwn = true;
4011
+ }
3795
4012
  if (prop === "style") {
3796
4013
  result += ` style="${ssrStyle(value)}"`;
3797
4014
  } else if (prop === "class") {
@@ -3806,10 +4023,11 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
3806
4023
  if (attrs !== undefined) result += typeof attrs === "function" ? attrs() : attrs;
3807
4024
  if (link !== null && link.href !== undefined) result += ssrLinkClaim(link);
3808
4025
  if (skipChildren) return {
3809
- t: result + " />"
4026
+ t: result + " />",
4027
+ $: SSR_NODE
3810
4028
  };
3811
- if (childOwner !== null) children = info.raw ? childOwner.children : escape(childOwner.children);
3812
- if (typeof children === "function") children = children();
4029
+ if (sel !== undefined) children = ssrIn(sel, () => spreadChildren(info, childOwner, children));else children = spreadChildren(info, childOwner, children);
4030
+ if (info.sel === 2) result += ssrOption(optValue !== undefined || typeof children !== "string" ? optValue : children.replace(/&lt;/g, "<").replace(/&amp;/g, "&").replace(/\s+/g, " ").trim(), undefined, optOwn);
3813
4031
  let thunk = null;
3814
4032
  if (typeof children === "function" && (ctx === undefined || !ctx.liveHoles)) {
3815
4033
  thunk = children;
@@ -3820,7 +4038,8 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
3820
4038
  const res = {
3821
4039
  t: [""],
3822
4040
  h: [],
3823
- p: []
4041
+ p: [],
4042
+ $: SSR_NODE
3824
4043
  };
3825
4044
  pushSSRAsyncHole(res, err, thunk);
3826
4045
  return ssr([result + ">", info.close], res);
@@ -3828,19 +4047,23 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
3828
4047
  }
3829
4048
  const ct = typeof children;
3830
4049
  if (ct === "string" || ct === "number") return {
3831
- t: result + ">" + children + info.close
4050
+ t: result + ">" + children + info.close,
4051
+ $: SSR_NODE
3832
4052
  };
3833
4053
  if (children == null || ct === "boolean") return {
3834
- t: result + ">" + info.close
4054
+ t: result + ">" + info.close,
4055
+ $: SSR_NODE
3835
4056
  };
3836
- if (ct === "object" && !children.h && typeof children.t === "string") return {
3837
- t: result + ">" + children.t + info.close
4057
+ if (ct === "object" && children.$ === SSR_NODE && !children.h && typeof children.t === "string") return {
4058
+ t: result + ">" + children.t + info.close,
4059
+ $: SSR_NODE
3838
4060
  };
3839
4061
  if (thunk === null) return ssr([result + ">", info.close], resolveSSRNode(children, undefined, true));
3840
4062
  const res = {
3841
4063
  t: [""],
3842
4064
  h: [],
3843
- p: []
4065
+ p: [],
4066
+ $: SSR_NODE
3844
4067
  };
3845
4068
  try {
3846
4069
  resolveSSRNode(children, res, false, true);
@@ -3849,11 +4072,15 @@ function ssrElement(tag, props, children, needsId, skip, attrs) {
3849
4072
  }
3850
4073
  return ssr([result + ">", info.close], res);
3851
4074
  }
4075
+ function spreadChildren(info, childOwner, children) {
4076
+ if (childOwner !== null) children = info.raw ? childOwner.children : escape(childOwner.children);
4077
+ return typeof children === "function" ? children() : children;
4078
+ }
3852
4079
  function collectSpreadSources(props, viewKeys, owners) {
3853
4080
  for (let i = 0; i < props.length; i++) {
3854
4081
  let s = props[i];
3855
4082
  if (typeof s === "function") s = s();
3856
- if (s != null) sourceOwners(s, viewKeys, owners);
4083
+ if (s) sourceOwners(s, viewKeys, owners);
3857
4084
  }
3858
4085
  }
3859
4086
  function spreadFormAttribute(prop, info, keys, keysOf, skip) {
@@ -3891,110 +4118,37 @@ function ssrLinkClaim(attrs) {
3891
4118
  if (ctx === undefined || ctx.linkClaim === undefined || attrs["aria-current"] != null) return "";
3892
4119
  return ctx.linkClaim(attrs);
3893
4120
  }
3894
- function decodeSSREntities(s) {
3895
- return s.indexOf("&") < 0 ? s : s.replace(/&quot;/g, '"').replace(/&lt;/g, "<").replace(/&amp;/g, "&");
4121
+ const SELECT = Symbol();
4122
+ function ssrSelect(value) {
4123
+ const owner = createOwner({
4124
+ transparent: true
4125
+ });
4126
+ const state = {
4127
+ v: value,
4128
+ d: false,
4129
+ o: owner
4130
+ };
4131
+ owner._context = {
4132
+ ...owner._context,
4133
+ [SELECT]: state
4134
+ };
4135
+ return state;
3896
4136
  }
3897
- const SELECT_VALUE_ATTR = /\svalue(?:="([^"]*)")?(?=[\s>]|$)/;
3898
- function tagEnd(html, i) {
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;
4137
+ function ssrIn(state, fn) {
4138
+ return runWithOwner(state.o, fn);
3907
4139
  }
3908
- function optionText(html, from) {
3909
- let t = "";
3910
- let i = from;
3911
- for (;;) {
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);
4140
+ function ssrOption(value, state, own) {
4141
+ if (state === undefined) {
4142
+ const o = getOwner();
4143
+ if (!o || !(state = o._context[SELECT])) return "";
3995
4144
  }
3996
- if (idx === 0) return html;
3997
- return out + html.slice(idx);
4145
+ if (own) return state.d = true, "";
4146
+ if (state.d) return "";
4147
+ if (typeof value === "function") value = value();
4148
+ if (value == null) return "";
4149
+ value = String(value);
4150
+ const v = state.v;
4151
+ return v != null && (v.map ? v.some(x => x != null && String(x) === value) : String(v) === value) ? " selected" : "";
3998
4152
  }
3999
4153
  function escape(s, attr) {
4000
4154
  const t = typeof s;
@@ -4101,7 +4255,7 @@ function tryJoinPlainSSRArray(nodes) {
4101
4255
  let out = "";
4102
4256
  for (let i = 0, len = nodes.length; i < len; i++) {
4103
4257
  const node = nodes[i];
4104
- if (node == null || typeof node !== "object" || node.h || typeof node.t !== "string") {
4258
+ if (node == null || typeof node !== "object" || node.$ !== SSR_NODE || node.h || typeof node.t !== "string") {
4105
4259
  return undefined;
4106
4260
  }
4107
4261
  out += node.t;
@@ -4329,12 +4483,12 @@ function tryResolveString(node, nested) {
4329
4483
  }
4330
4484
  return s;
4331
4485
  }
4486
+ if (node.$ !== SSR_NODE) {
4487
+ return "";
4488
+ }
4332
4489
  if (node.h && node.h.length > 0) return {
4333
4490
  merge: node
4334
4491
  };
4335
- if (node.t === undefined) {
4336
- return "";
4337
- }
4338
4492
  ssrTextTail = false;
4339
4493
  return Array.isArray(node.t) ? node.t[0] : node.t;
4340
4494
  }
@@ -4354,7 +4508,8 @@ function tryResolveString(node, nested) {
4354
4508
  function resolveSSRNode(node, result = {
4355
4509
  t: [""],
4356
4510
  h: [],
4357
- p: []
4511
+ p: [],
4512
+ $: SSR_NODE
4358
4513
  }, top, nested) {
4359
4514
  if (!nested) ssrTextTail = false;
4360
4515
  const t = typeof node;
@@ -4373,7 +4528,7 @@ function resolveSSRNode(node, result = {
4373
4528
  if (slotLive) slotLive.suppressed--;
4374
4529
  }
4375
4530
  } else if (t === "object") {
4376
- if (node.h) {
4531
+ if (node.$ !== SSR_NODE) ; else if (node.h) {
4377
4532
  result.t[result.t.length - 1] += node.t[0];
4378
4533
  if (node.t.length > 1) {
4379
4534
  result.t.push(...node.t.slice(1));
@@ -4381,10 +4536,10 @@ function resolveSSRNode(node, result = {
4381
4536
  result.p.push(...node.p);
4382
4537
  }
4383
4538
  ssrTextTail = false;
4384
- } else if (node.t !== undefined) {
4539
+ } else {
4385
4540
  result.t[result.t.length - 1] += node.t;
4386
4541
  ssrTextTail = false;
4387
- } else ;
4542
+ }
4388
4543
  } else if (t === "function") {
4389
4544
  const live = sharedConfig.context && sharedConfig.context.liveHoles;
4390
4545
  let liveNode = null;
@@ -4820,6 +4975,10 @@ function registerElementClaim() {
4820
4975
  return noopCleanup;
4821
4976
  }
4822
4977
  function noopCleanup() {}
4978
+ function setTrustedTypesPolicy() {}
4979
+ function trustedHTML(html) {
4980
+ return html;
4981
+ }
4823
4982
  function claimElement(node) {
4824
4983
  return node;
4825
4984
  }
@@ -4969,4 +5128,4 @@ function httpHeader(name, value, options) {
4969
5128
  }
4970
5129
  }
4971
5130
 
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, resolveSSRSelectValues, respond, notSup as runHydrationEvents, serializeCookie, notSup as setAttribute, notSup as setAttributeNS, setLinkClaim, notSup as setProperty, notSup as setStatefulProperty, notSup as setStyleProperty, notSup as spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrSelectValues, ssrStyle, ssrStyleProperties, ssrStyleProperty, notSup as style, takeHydrationValue, notSup as template, notSup as unregisterDelegatedContainer, notSup as unregisterDelegatedRoot, useHead };
5131
+ 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 };