@solidjs/web 2.0.0-rc.14 → 2.0.0-rc.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +1 -1
  2. package/dist/server.dev.js +475 -591
  3. package/dist/server.js +459 -489
  4. package/dist/server.observe.js +459 -498
  5. package/dist/web.dev.js +206 -220
  6. package/dist/web.js +196 -208
  7. package/dist/web.observe.js +206 -213
  8. package/frames/dist/client.dev.js +664 -643
  9. package/frames/dist/client.js +593 -582
  10. package/frames/dist/client.observe.js +624 -589
  11. package/frames/dist/regions.js +43 -2
  12. package/frames/dist/server.dev.js +578 -450
  13. package/frames/dist/server.js +578 -397
  14. package/frames/dist/server.observe.js +578 -397
  15. package/frames/dist/trace.js +4 -1
  16. package/frames/dist/wire.js +371 -6
  17. package/package.json +13 -13
  18. package/serialization/dist/decode.js +11 -9
  19. package/serialization/dist/serialization.js +11 -9
  20. package/serialization/types/serializer-decode.d.ts +2 -2
  21. package/server-functions/dist/client.dev.js +5 -2
  22. package/server-functions/dist/client.js +3 -2
  23. package/server-functions/dist/client.observe.js +5 -2
  24. package/server-functions/dist/rich-args.js +33 -1
  25. package/server-functions/dist/server.dev.js +218 -35
  26. package/server-functions/dist/server.js +218 -35
  27. package/server-functions/dist/server.observe.js +218 -35
  28. package/skills/server-components/SKILL.md +74 -185
  29. package/types/client.d.ts +112 -10
  30. package/types/constants.d.ts +2 -1
  31. package/types/frames/assets-tier.d.ts +2 -2
  32. package/types/frames/client.d.ts +8 -3
  33. package/types/frames/frame-client.d.ts +121 -157
  34. package/types/frames/frame-morph.d.ts +28 -0
  35. package/types/frames/frame-sink.d.ts +13 -9
  36. package/types/frames/frame-transport.d.ts +30 -1
  37. package/types/frames/regions-tier.d.ts +15 -0
  38. package/types/frames/serializer-decode.d.ts +2 -2
  39. package/types/frames/server.d.ts +1 -53
  40. package/types/frames/wire-tier.d.ts +54 -1
  41. package/types/head.d.ts +1 -0
  42. package/types/index.d.ts +57 -50
  43. package/types/index.server.d.ts +3 -27
  44. package/types/jsx.d.ts +14 -17
  45. package/types/observe.d.ts +14 -7
  46. package/types/render.d.ts +3 -1
  47. package/types/response.d.ts +31 -8
  48. package/types/serializer-decode.d.ts +2 -2
  49. package/types/server-functions/argument-codec.d.ts +21 -0
  50. package/types/server-functions/client.d.ts +18 -5
  51. package/types/server-functions/server.d.ts +6 -2
  52. package/types/server-functions/shared.d.ts +19 -0
  53. package/types/server-mock.d.ts +9 -2
  54. package/types/server-observe.d.ts +3 -2
  55. package/types/server.d.ts +124 -67
  56. package/frames/dist/bind.dev.js +0 -326
  57. package/frames/dist/bind.js +0 -295
  58. package/types/frames/bind-tier.d.ts +0 -60
package/dist/web.dev.js CHANGED
@@ -1,6 +1,6 @@
1
- import { createRenderEffect, getOwner, createMemo, OBSERVE, DEV, enableHydration, $PROXY, untrack, runWithOwner, resetErrorHalt, enforceLoadingBoundary, createRoot, ROOT_ERROR_HOOK, flatten, flush, createComponent, omit, createOwner, createSignal, createEffect, onCleanup } from 'solid-js';
2
- export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
3
- import { sharedConfig, sourceKeys, SOURCE_PROXY, resolvedTable, viewOf, OmitView, hasStaticKeys, SOURCE_MEMO, sourceHas, SOURCE_OMIT, sourceGet, SOURCE_PLAIN, $DEVCOMP } from 'solid-js/internal';
1
+ import { createRenderEffect, getOwner, createMemo, OBSERVE, DEV, enableHydration, $PROXY, untrack, runWithOwner, resetErrorHalt, enforceLoadingBoundary, createRoot, ROOT_ERROR_HOOK, flatten, flush, createComponent, omit, createOwner, createSignal, createEffect } from 'solid-js';
2
+ export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, dynamicComponent, getOwner, merge as mergeProps, untrack } from 'solid-js';
3
+ import { sharedConfig, enableServerComponentHydration, resolvedTable, viewOf, OmitView, hasStaticKeys, SOURCE_MEMO, sourceHas, SOURCE_OMIT, sourceGet, sourceKeys, SOURCE_PROXY, SOURCE_PLAIN, dynamicCore } from 'solid-js/internal';
4
4
 
5
5
  const DOMWithState = {
6
6
  INPUT: {
@@ -56,8 +56,10 @@ const transparentOptions = {
56
56
  sync: true
57
57
  };
58
58
  let spreadName;
59
- function setSpreadName(name) {
59
+ let spreadLoc;
60
+ function setSpreadName(name, loc) {
60
61
  spreadName = name;
62
+ spreadLoc = loc;
61
63
  }
62
64
  const syncOptions = {
63
65
  sync: true
@@ -69,7 +71,8 @@ function tagElement(node) {
69
71
  function effect(fn, effectFn, options) {
70
72
  if (spreadName !== undefined && (options === undefined || options.name === undefined)) options = {
71
73
  ...options,
72
- name: spreadName + ".spread"
74
+ name: spreadName + ".spread",
75
+ loc: spreadLoc
73
76
  };
74
77
  const nodeOptions = options ? {
75
78
  sync: true,
@@ -98,40 +101,39 @@ function memo(fn) {
98
101
  }
99
102
 
100
103
  function reconcileArrays(parentNode, a, b, marker) {
104
+ const isLive = n => {
105
+ if (!n) return false;
106
+ const tag = n[$$SLOT];
107
+ return n.parentNode === parentNode && (!tag || tag === marker);
108
+ };
101
109
  let bLength = b.length,
102
110
  aEnd = a.length,
103
111
  bEnd = bLength,
104
112
  aStart = 0,
105
113
  bStart = 0,
106
114
  tail = a[aEnd - 1],
107
- tailTag = tail[$$SLOT],
108
- after = tail.parentNode === parentNode && (!tailTag || tailTag === marker) ? tail.nextSibling : marker || null,
115
+ after = isLive(tail) ? tail.nextSibling : marker || null,
109
116
  map = null,
110
117
  anchor,
111
118
  anchorTag;
112
- const isLive = n => {
113
- if (!n) return false;
114
- const tag = n[$$SLOT];
115
- return n.parentNode === parentNode && (!tag || tag === marker);
116
- };
117
119
  while (aStart < aEnd || bStart < bEnd) {
118
- if (a[aStart] === b[bStart] && isLive(a[aStart])) {
120
+ if (a[aStart] === b[bStart]) {
119
121
  aStart++;
120
122
  bStart++;
121
123
  continue;
122
124
  }
123
- while (a[aEnd - 1] === b[bEnd - 1] && isLive(a[aEnd - 1])) {
125
+ while (aEnd > aStart && bEnd > bStart && a[aEnd - 1] === b[bEnd - 1]) {
124
126
  aEnd--;
125
127
  bEnd--;
126
128
  }
127
129
  if (aEnd === aStart) {
128
130
  let node;
129
131
  if (bEnd < bLength) {
130
- if (bStart) {
131
- const prev = b[bStart - 1];
132
- const prevTag = prev[$$SLOT];
133
- node = prev.parentNode === parentNode && (!prevTag || prevTag === marker) ? prev.nextSibling : after;
134
- } else node = b[bEnd - bStart];
132
+ if (bStart && isLive(node = b[bStart - 1])) node = node.nextSibling;else {
133
+ let k = bEnd;
134
+ while (k < bLength && !isLive(b[k])) k++;
135
+ node = k < bLength ? b[k] : after;
136
+ }
135
137
  } else node = after;
136
138
  while (bStart < bEnd) {
137
139
  const n = b[bStart++];
@@ -141,10 +143,7 @@ function reconcileArrays(parentNode, a, b, marker) {
141
143
  } else if (bEnd === bStart) {
142
144
  while (aStart < aEnd) {
143
145
  const n = a[aStart++];
144
- if (!map || !map.has(n)) {
145
- const tag = n[$$SLOT];
146
- if (n.parentNode === parentNode && (!tag || tag === marker)) n.remove();
147
- }
146
+ if ((!map || !map.has(n)) && isLive(n)) n.remove();
148
147
  }
149
148
  } else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === marker)) {
150
149
  if (marker) {
@@ -163,6 +162,10 @@ function reconcileArrays(parentNode, a, b, marker) {
163
162
  } while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
164
163
  }
165
164
  } else {
165
+ if (!isLive(a[aStart])) {
166
+ aStart++;
167
+ continue;
168
+ }
166
169
  if (!map) {
167
170
  map = new Map();
168
171
  let i = bStart;
@@ -179,31 +182,19 @@ function reconcileArrays(parentNode, a, b, marker) {
179
182
  sequence++;
180
183
  }
181
184
  if (sequence > index - bStart) {
182
- const head = a[aStart];
183
- const headTag = head[$$SLOT];
184
- const node = head.parentNode === parentNode && (!headTag || headTag === marker) ? head : after;
185
+ const node = a[aStart];
185
186
  while (bStart < index) {
186
187
  const n = b[bStart++];
187
188
  parentNode.insertBefore(n, node);
188
189
  if (marker) n[$$SLOT] = marker;
189
190
  }
190
191
  } else {
191
- const oldNode = a[aStart++];
192
192
  const newNode = b[bStart++];
193
- const oldTag = oldNode[$$SLOT];
194
- if (oldNode.parentNode === parentNode && (!oldTag || oldTag === marker)) {
195
- parentNode.replaceChild(newNode, oldNode);
196
- } else {
197
- parentNode.insertBefore(newNode, after);
198
- }
193
+ parentNode.replaceChild(newNode, a[aStart++]);
199
194
  if (marker) newNode[$$SLOT] = marker;
200
195
  }
201
196
  } else aStart++;
202
- } else {
203
- const n = a[aStart++];
204
- const nTag = n[$$SLOT];
205
- if (n.parentNode === parentNode && (!nTag || nTag === marker)) n.remove();
206
- }
197
+ } else a[aStart++].remove();
207
198
  }
208
199
  }
209
200
  }
@@ -293,6 +284,10 @@ function qualifierValue(name, value) {
293
284
  function asciiLowerCase(value) {
294
285
  return value.replace(/[A-Z]/g, c => String.fromCharCode(c.charCodeAt(0) + 32));
295
286
  }
287
+ const JSON_SCRIPT_TYPE = /^(?:importmap|speculationrules)$|^[\t\n\r ]*(?:application\/json|text\/json|[\w!#$%&'*+.^`|~-]+\/[\w!#$%&'*+.^`|~-]*\+json)[\t\n\r ]*(?:;|$)/i;
288
+ function headBodyText(tag, props, text) {
289
+ return tag === "script" && JSON_SCRIPT_TYPE.test(String(props.type)) ? text.replace(/</g, "\\u003C") : text;
290
+ }
296
291
  function resourceIdentity(tag, props) {
297
292
  const url = String(props.href || props.src || "");
298
293
  let id = "res:" + tag + ":" + (props.rel || "") + ":" + url.length + ":" + url;
@@ -493,6 +488,13 @@ function takeHydrationValue(key) {
493
488
  value: v
494
489
  };
495
490
  }
491
+ function setLinkClaim(_handler) {
492
+ return false;
493
+ }
494
+ function hasServerLinkState() {
495
+ const registry = globalThis._$HY && globalThis._$HY.r;
496
+ return !!registry && registry.links === 1;
497
+ }
496
498
  const getTraceContext = voidFn;
497
499
  function render(code, element, init, options = {}) {
498
500
  if (!element) {
@@ -635,17 +637,31 @@ function setProperty(node, name, value) {
635
637
  tagElement(node);
636
638
  if (isHydrating(node)) return;
637
639
  const nodeName = node.nodeName;
638
- if (name === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((name === "value" || name === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) node[name] = value ?? "";else node[name] = value;
640
+ if (name === "value" && nodeName === "SELECT") writeSelectValue(node, value);else if ((name === "value" || name === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) {
641
+ if (value == null && /^(checkbox|radio)$/.test(node.type)) node.removeAttribute("value");else node[name] = value ?? "";
642
+ } else node[name] = value;
643
+ reclaimAttribute(node, name);
639
644
  }
640
645
  let claimHandlers = null;
646
+ const claimAttributeSets = [];
641
647
  const CLAIM_SEAM = Symbol.for("solid.element-claims");
642
- function registerElementClaim(handler) {
648
+ function registerElementClaim(handler, options) {
643
649
  (claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
650
+ claimAttributeSets.push(options?.attributes || ["href", "action"]);
644
651
  return () => {
645
652
  const index = claimHandlers.indexOf(handler);
646
- index > -1 && claimHandlers.splice(index, 1);
653
+ if (index > -1) {
654
+ claimHandlers.splice(index, 1);
655
+ claimAttributeSets.splice(index, 1);
656
+ }
647
657
  };
648
658
  }
659
+ function runClaimHandlers(handlers, node) {
660
+ for (let i = 0; i < handlers.length; i++) handlers[i](node);
661
+ }
662
+ function reclaimAttribute(node, name) {
663
+ if (claimHandlers !== null && node._$claimed && claimAttributeSets.some(set => set.includes(name.slice(name.indexOf(":") + 1)))) runClaimHandlers(claimHandlers, node);
664
+ }
649
665
  const CLAIMED_ELEMENTS = "a[href], form[action]";
650
666
  function claimElementTree(root) {
651
667
  const handlers = globalThis[CLAIM_SEAM];
@@ -653,17 +669,20 @@ function claimElementTree(root) {
653
669
  const isElement = root.nodeType === 1;
654
670
  if (!isElement && root.nodeType !== 11) return root;
655
671
  if (isElement && root.matches(CLAIMED_ELEMENTS)) {
656
- for (let i = 0; i < handlers.length; i++) handlers[i](root);
672
+ root._$claimed = true;
673
+ runClaimHandlers(handlers, root);
657
674
  }
658
675
  const found = root.querySelectorAll(CLAIMED_ELEMENTS);
659
676
  for (let i = 0; i < found.length; i++) {
660
- for (let j = 0; j < handlers.length; j++) handlers[j](found[i]);
677
+ found[i]._$claimed = true;
678
+ runClaimHandlers(handlers, found[i]);
661
679
  }
662
680
  return root;
663
681
  }
664
- function claimElement(node) {
665
- if (claimHandlers !== null) {
666
- for (let i = 0; i < claimHandlers.length; i++) claimHandlers[i](node);
682
+ function claimElement(node, owner) {
683
+ if (claimHandlers !== null && !node._$claimed) {
684
+ node._$claimed = true;
685
+ if (owner === undefined) runClaimHandlers(claimHandlers, node);else runWithOwner(owner, () => runClaimHandlers(claimHandlers, node));
667
686
  }
668
687
  return node;
669
688
  }
@@ -684,12 +703,13 @@ function setAttribute(node, name, value) {
684
703
  }
685
704
  }
686
705
  if (selectMultiple) node._$multiple = true;
687
- if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
706
+ reclaimAttribute(node, name);
688
707
  }
689
708
  function setAttributeNS(node, namespace, name, value) {
690
709
  tagElement(node);
691
710
  if (isHydrating(node)) return;
692
711
  if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
712
+ reclaimAttribute(node, name);
693
713
  }
694
714
  function className(node, value, prev) {
695
715
  tagElement(node);
@@ -804,7 +824,7 @@ function readShallow(value) {
804
824
  if (value === null || typeof value !== "object") return value;
805
825
  if (Array.isArray(value)) return value.map(readShallow);
806
826
  if (value[$PROXY] !== value) return value;
807
- const keys = sourceKeys(value, SOURCE_PROXY);
827
+ const keys = Reflect.ownKeys(value);
808
828
  const out = {};
809
829
  for (let i = 0; i < keys.length; i++) {
810
830
  const k = keys[i];
@@ -817,21 +837,24 @@ function setStyleProperty(node, name, value) {
817
837
  if (isHydrating(node)) return;
818
838
  value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
819
839
  }
820
- function spread(node, props, skipChildren, skip, name) {
840
+ function spread(node, props, skipChildren, skip, name, loc) {
821
841
  if (name !== undefined) {
822
842
  const outer = spreadName;
823
- setSpreadName(name);
843
+ const outerLoc = spreadLoc;
844
+ setSpreadName(name, loc);
824
845
  try {
825
846
  return spread(node, props, skipChildren, skip);
826
847
  } finally {
827
- setSpreadName(outer);
848
+ setSpreadName(outer, outerLoc);
828
849
  }
829
850
  }
830
851
  const prevProps = {};
852
+ const owner = claimHandlers !== null && (node.localName === "a" || node.localName === "form") ? getOwner() : undefined;
831
853
  const apply = newProps => {
832
854
  const r = newProps.ref;
833
855
  if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
834
856
  assign(node, newProps, true, prevProps, true);
857
+ if (owner !== undefined) claimElement(node, owner);
835
858
  };
836
859
  if (Array.isArray(props)) {
837
860
  effect(() => collectSources({}, props, undefined, skip), apply);
@@ -977,6 +1000,7 @@ function checkUnscopedHole(snapshot, accessor, parent) {
977
1000
  } : {});
978
1001
  }
979
1002
  let hydrationRt = null;
1003
+ let selectInsert = null;
980
1004
  function installHydrationRuntime() {
981
1005
  hydrationRt = {
982
1006
  claimInitial(parent, multi, initial) {
@@ -1051,7 +1075,8 @@ function isPlaceholderScaffolding(node, t) {
1051
1075
  function insert(parent, accessor, marker, initial, options) {
1052
1076
  if (spreadName !== undefined && (options === undefined || options.name === undefined)) options = {
1053
1077
  ...options,
1054
- name: spreadName + ".children"
1078
+ name: spreadName + ".children",
1079
+ loc: spreadLoc
1055
1080
  };
1056
1081
  const multi = marker !== undefined;
1057
1082
  const host = options && options.host;
@@ -1071,13 +1096,16 @@ function insert(parent, accessor, marker, initial, options) {
1071
1096
  initial = [placeholder];
1072
1097
  }
1073
1098
  let current = initial;
1074
- effect(prev => {
1099
+ let ran = false;
1100
+ effect(() => {
1075
1101
  if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
1076
1102
  const devNext = unscopedHoleSnapshot(accessor, parent) ;
1077
1103
  const value = normalize(accessor(), current, multi, true);
1078
1104
  checkUnscopedHole(devNext, accessor, parent);
1105
+ const again = ran;
1106
+ ran = true;
1079
1107
  if (typeof value !== "function") return value;
1080
- const innerOptions = prev !== undefined && !(options && options.schedule) ? {
1108
+ const innerOptions = again && !(options && options.schedule) ? {
1081
1109
  ...options,
1082
1110
  schedule: true
1083
1111
  } : options;
@@ -1408,7 +1436,7 @@ function createHeadElement(tag, props) {
1408
1436
  if (v == null || v === false) continue;
1409
1437
  el.setAttribute(name, v === true ? "" : String(v));
1410
1438
  }
1411
- if (props.children != null) el.textContent = String(props.children);
1439
+ if (props.children != null) el.textContent = headBodyText(tag, props, String(props.children));
1412
1440
  return el;
1413
1441
  }
1414
1442
  function renderHeadElement(t, identity, existing) {
@@ -1431,7 +1459,7 @@ function headElementMatches(el, t) {
1431
1459
  } else if (el.getAttribute(name) !== (v === true ? "" : String(v))) return false;
1432
1460
  }
1433
1461
  const children = t.props.children;
1434
- return (children == null ? "" : String(children)) === el.textContent;
1462
+ return (children == null ? "" : headBodyText(t.tag, t.props, String(children))) === el.textContent;
1435
1463
  }
1436
1464
  function mountHeadResource(tag, props) {
1437
1465
  const identity = resourceIdentity(tag, props);
@@ -1548,7 +1576,22 @@ function loadModuleAssets(mapping) {
1548
1576
  function hydrate(code, element, options = {}) {
1549
1577
  enableHydration();
1550
1578
  installHydrationRuntime();
1551
- if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
1579
+ const hy = globalThis._$HY;
1580
+ const id = options.renderId || "";
1581
+ if (hy.s && !hy.s[id] && !hy.s[""] && !hy.done && document.readyState === "loading") {
1582
+ let started, disposer;
1583
+ const start = () => started || (started = true, disposer = hydrate(code, element, options));
1584
+ (hy.sp || (hy.sp = [])).push([id, start]);
1585
+ hy.sw = key => hy.sp.forEach(([k, f]) => (!key || k === key) && queueMicrotask(f));
1586
+ document.addEventListener("DOMContentLoaded", start, {
1587
+ once: true
1588
+ });
1589
+ return () => {
1590
+ started = true;
1591
+ disposer && disposer();
1592
+ };
1593
+ }
1594
+ if (hy.done) return render(code, element, [...element.childNodes], options);
1552
1595
  const head = (element.nodeType === 9 ? element : element.ownerDocument).head;
1553
1596
  if (head && element.contains(head)) {
1554
1597
  let n = head.firstChild;
@@ -1784,13 +1827,32 @@ function isHydrating(node) {
1784
1827
  if (!sharedConfig.hydrating) return false;
1785
1828
  if (sharedConfig.isClaiming && !sharedConfig.isClaiming()) return false;
1786
1829
  if (!node || node.isConnected) return true;
1787
- const roots = sharedConfig.claimRoots;
1788
- if (roots) {
1789
- for (let i = 0; i < roots.length; i++) {
1790
- if (roots[i].contains(node)) return true;
1830
+ return serverComponentClaims !== null && serverComponentClaims.claimed(node);
1831
+ }
1832
+ let serverComponentClaims = null;
1833
+ function installServerComponentHydration() {
1834
+ enableServerComponentHydration();
1835
+ if (serverComponentClaims !== null) return;
1836
+ serverComponentClaims = {
1837
+ claimed(node) {
1838
+ const roots = sharedConfig.claimRoots;
1839
+ if (roots) {
1840
+ for (let i = 0; i < roots.length; i++) {
1841
+ if (roots[i].contains(node)) return true;
1842
+ }
1843
+ }
1844
+ return false;
1845
+ },
1846
+ inFrame(element) {
1847
+ const frames = element.querySelectorAll("[data-fid]");
1848
+ const frameCount = frames.length;
1849
+ if (frameCount === 0) return undefined;
1850
+ return node => {
1851
+ for (let j = 0; j < frameCount; j++) if (frames[j].contains(node)) return true;
1852
+ return false;
1853
+ };
1791
1854
  }
1792
- }
1793
- return false;
1855
+ };
1794
1856
  }
1795
1857
  function classListToObject(classList) {
1796
1858
  if (Array.isArray(classList)) {
@@ -1842,8 +1904,10 @@ function assignProp(node, prop, value, prev, skipRef, nodeName) {
1842
1904
  }
1843
1905
  } else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
1844
1906
  if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
1845
- if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA"))
1846
- node[prop] = value ?? "";else node[prop] = value;
1907
+ if (prop === "value" && nodeName === "SELECT") writeSelectValue(node, value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA")) {
1908
+ if (value == null && /^(checkbox|radio)$/.test(node.type)) node.removeAttribute("value");else node[prop] = value ?? "";
1909
+ } else node[prop] = value;
1910
+ reclaimAttribute(node, prop);
1847
1911
  } else {
1848
1912
  const ns = hasNamespace && Namespaces[prop.split(":")[0]];
1849
1913
  if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
@@ -1858,14 +1922,13 @@ function eventHandler(e, container, state) {
1858
1922
  if (prev === true || prev === container || !container.contains(prev)) return;
1859
1923
  resumeNode = prev;
1860
1924
  }
1861
- const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
1862
- if (state && !owner) return;
1863
- if (owner && owner === resumeNode) return;
1864
- e[$$EVENT_OWNER] = owner || true;
1925
+ const owner = state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner;
1926
+ if (!owner) return;
1927
+ if (owner === resumeNode) return;
1928
+ e[$$EVENT_OWNER] = owner;
1865
1929
  let node = resumeNode || e.target;
1866
1930
  const key = EVENT_KEY + e.type;
1867
1931
  const oriTarget = e.target;
1868
- const boundary = owner || container || e.currentTarget;
1869
1932
  const retarget = value => Object.defineProperty(e, "target", {
1870
1933
  configurable: true,
1871
1934
  value
@@ -1882,19 +1945,19 @@ function eventHandler(e, container, state) {
1882
1945
  };
1883
1946
  const walkUpTree = () => {
1884
1947
  while (node && handleNode()) {
1885
- if (node === boundary || node.parentNode === boundary) break;
1948
+ if (node === owner || node.parentNode === owner) break;
1886
1949
  node = node._$host || node.parentNode || node.host;
1887
1950
  }
1888
1951
  };
1889
1952
  Object.defineProperty(e, "currentTarget", {
1890
1953
  configurable: true,
1891
1954
  get() {
1892
- return node || boundary || document;
1955
+ return node || owner;
1893
1956
  }
1894
1957
  });
1895
1958
  if (resumeNode) {
1896
1959
  if (resumeNode === e.target) node = resumeNode._$host || resumeNode.parentNode || resumeNode.host;
1897
- if (node && node !== boundary) walkUpTree();
1960
+ if (node && node !== owner) walkUpTree();
1898
1961
  } else if (e.composedPath) {
1899
1962
  const path = e.composedPath();
1900
1963
  if (path.length) {
@@ -1907,7 +1970,7 @@ function eventHandler(e, container, state) {
1907
1970
  walkUpTree();
1908
1971
  break;
1909
1972
  }
1910
- if (node === boundary || node.parentNode === boundary) {
1973
+ if (node === owner || node.parentNode === owner) {
1911
1974
  break;
1912
1975
  }
1913
1976
  }
@@ -1932,7 +1995,10 @@ function insertExpression(parent, value, current, marker) {
1932
1995
  return value;
1933
1996
  }
1934
1997
  if (value === current) return value;
1935
- if (hydrationRt !== null && sharedConfig.hydrating && current == null && value && [].concat(value).every(n => n?.parentNode === parent) && value.length !== 0) return value;
1998
+ if (hydrationRt !== null && sharedConfig.hydrating && value && value.length !== 0) {
1999
+ const tracked = [].concat(current ?? []);
2000
+ if ([].concat(value).every(n => (n === tracked[0] && tracked.shift(), n?.parentNode === parent)) && !tracked.length) return value;
2001
+ }
1936
2002
  const t = typeof value,
1937
2003
  multi = marker !== undefined;
1938
2004
  if (t === "string" || t === "number") {
@@ -1991,8 +2057,34 @@ function insertExpression(parent, value, current, marker) {
1991
2057
  value
1992
2058
  }
1993
2059
  });
2060
+ selectInsert && selectInsert(parent);
1994
2061
  return value;
1995
2062
  }
2063
+ function selectChange(e) {
2064
+ (e = e.currentTarget || e)._$v = null;
2065
+ e.removeEventListener("change", selectChange, true);
2066
+ }
2067
+ function writeSelectValue(node, value) {
2068
+ const had = node._$v && node._$v.map,
2069
+ has = value != null && value.map;
2070
+ if (has) had || node.addEventListener("change", selectChange, true);else had && node.removeEventListener("change", selectChange, true);
2071
+ if (value == null) {
2072
+ node._$v = null;
2073
+ return queueMicrotask(() => node.value = value) || (node.value = value);
2074
+ }
2075
+ node._$v = value;
2076
+ (selectInsert ||= p => {
2077
+ p && p._$v == null && (p = p.parentNode);
2078
+ const v = p && p._$v;
2079
+ if (v == null) return;
2080
+ if (v.map) {
2081
+ const o = [...p.options];
2082
+ for (let i = 0; i < o.length; i++) o[i].selected = v.some(x => x == o[i].value);
2083
+ v.every(x => o.some(el => el.value == x)) && selectChange(p);
2084
+ } else p.value = v, p.selectedIndex > -1 && p.value == v && (p._$v = null);
2085
+ })(node);
2086
+ queueMicrotask(() => selectInsert(node));
2087
+ }
1996
2088
  function normalize(value, current, multi, doNotUnwrap) {
1997
2089
  value = flatten(value, {
1998
2090
  skipNonRendered: true,
@@ -2000,7 +2092,7 @@ function normalize(value, current, multi, doNotUnwrap) {
2000
2092
  });
2001
2093
  if (doNotUnwrap && typeof value === "function") return value;
2002
2094
  if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
2003
- if (sharedConfig.hydrating && Array.isArray(value)) {
2095
+ if (hydrationRt !== null && sharedConfig.hydrating && Array.isArray(value)) {
2004
2096
  for (let i = 0, len = value.length; i < len; i++) {
2005
2097
  const item = value[i],
2006
2098
  prev = current && current[i],
@@ -2071,22 +2163,12 @@ function cleanChildren(parent, current, marker, replacement) {
2071
2163
  }
2072
2164
  function gatherHydratable(element, root) {
2073
2165
  const templates = element.querySelectorAll(root ? `[_hk^="${root.replace(/["\\]/g, "\\$&")}"]` : `*[_hk]`);
2074
- const frames = root ? null : element.querySelectorAll("[data-fid]");
2075
- const frameCount = frames ? frames.length : 0;
2166
+ const inFrame = root || serverComponentClaims === null ? undefined : serverComponentClaims.inFrame(element);
2076
2167
  const registry = sharedConfig.registry;
2077
2168
  for (let i = 0; i < templates.length; i++) {
2078
2169
  const node = templates[i];
2170
+ if (inFrame !== undefined && inFrame(node)) continue;
2079
2171
  const key = node.getAttribute("_hk");
2080
- if (frameCount !== 0) {
2081
- let inFrame = false;
2082
- for (let j = 0; j < frameCount; j++) {
2083
- if (frames[j].contains(node)) {
2084
- inFrame = true;
2085
- break;
2086
- }
2087
- }
2088
- if (inFrame) continue;
2089
- }
2090
2172
  if (!registry.has(key)) registry.set(key, node);
2091
2173
  }
2092
2174
  }
@@ -2128,6 +2210,7 @@ function composeMiddleware(middlewares) {
2128
2210
  function ssr(template, ...nodes) {}
2129
2211
  function ssrElement(name, props, children, needsId, skip, attrs) {}
2130
2212
  function ssrElementAttribute(key, value) {}
2213
+ function ssrLinkClaim(attrs) {}
2131
2214
  function ssrClassName(value) {}
2132
2215
  function ssrStyle(value) {}
2133
2216
  function ssrStyleProperty(name, value) {}
@@ -2139,17 +2222,24 @@ function resolveSSRNode(node, result, top, nested) {}
2139
2222
  function escape(s, attr) {}
2140
2223
 
2141
2224
  const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
2142
- // PURE-annotated factory (same convention as solid's MockPromise): the brand
2143
- const ResponseEnvelope = /* @__PURE__ */(() => {
2144
- class ResponseEnvelope {
2145
- constructor(response, value) {
2146
- this.response = response;
2147
- this.value = value;
2148
- }
2225
+ let EnvelopeClass;
2226
+ const ResponseEnvelope = function ResponseEnvelope(response, value) {
2227
+ if (!EnvelopeClass) {
2228
+ EnvelopeClass = class extends Response {
2229
+ constructor(response, value) {
2230
+ super(response ? response.body : null, response && {
2231
+ status: response.status,
2232
+ statusText: response.statusText,
2233
+ headers: copyHeaders(response.headers)
2234
+ });
2235
+ this.response = response ? this : undefined;
2236
+ this.value = value;
2237
+ }
2238
+ };
2239
+ EnvelopeClass.prototype[ENVELOPE] = true;
2149
2240
  }
2150
- ResponseEnvelope.prototype[ENVELOPE] = true;
2151
- return ResponseEnvelope;
2152
- })();
2241
+ return new EnvelopeClass(response, value);
2242
+ };
2153
2243
  function isResponseEnvelope(value) {
2154
2244
  return !!(value && typeof value === "object" && value[ENVELOPE]);
2155
2245
  }
@@ -2174,6 +2264,16 @@ function isSafeError(value) {
2174
2264
  const REVALIDATE_HEADER = "X-Revalidate";
2175
2265
  const REVALIDATE_ALL = "*";
2176
2266
  const RESPONSE_HEADER_VALUE_LIMIT = 4096;
2267
+ function copyHeaders(init) {
2268
+ const source = init;
2269
+ if (!source || !source.getSetCookie) return new Headers(init);
2270
+ const headers = new Headers();
2271
+ source.forEach((value, key) => {
2272
+ if (key !== "set-cookie") headers.append(key, value);
2273
+ });
2274
+ for (const cookie of source.getSetCookie()) headers.append("Set-Cookie", cookie);
2275
+ return headers;
2276
+ }
2177
2277
  function initWithRevalidate(init = {}) {
2178
2278
  const resolved = typeof init === "number" ? {
2179
2279
  status: init
@@ -2182,18 +2282,7 @@ function initWithRevalidate(init = {}) {
2182
2282
  revalidate,
2183
2283
  ...responseInit
2184
2284
  } = resolved;
2185
- let headers;
2186
- if (responseInit.headers && responseInit.headers.getSetCookie) {
2187
- headers = new Headers();
2188
- responseInit.headers.forEach((value, key) => {
2189
- if (key !== "set-cookie") headers.append(key, value);
2190
- });
2191
- for (const cookie of responseInit.headers.getSetCookie()) {
2192
- headers.append("Set-Cookie", cookie);
2193
- }
2194
- } else {
2195
- headers = new Headers(responseInit.headers);
2196
- }
2285
+ const headers = copyHeaders(responseInit.headers);
2197
2286
  if (revalidate !== undefined) {
2198
2287
  const list = Array.isArray(revalidate) ? revalidate : [revalidate];
2199
2288
  if (list.length > 1 && list.includes(REVALIDATE_ALL)) {
@@ -2257,7 +2346,12 @@ function respond(value, init = {}) {
2257
2346
  }), value);
2258
2347
  }
2259
2348
  headers.set("Content-Type", "application/json");
2260
- return new ResponseEnvelope(new Response(JSON.stringify(value), {
2349
+ return new ResponseEnvelope(new Response(new ReadableStream({
2350
+ pull(controller) {
2351
+ controller.enqueue(new TextEncoder().encode(JSON.stringify(value)));
2352
+ controller.close();
2353
+ }
2354
+ }), {
2261
2355
  ...responseInit,
2262
2356
  headers
2263
2357
  }), value);
@@ -2317,117 +2411,9 @@ function portalImpl(props) {
2317
2411
  });
2318
2412
  return treeMarker;
2319
2413
  }
2320
- const COMPONENT_BINDING = Symbol.for("solid.component-binding");
2321
- const FLIGHT = Symbol("solid.dynamic-flight");
2322
- function bindingOf(value) {
2323
- return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
2324
- }
2325
2414
  function dynamic(source, options) {
2326
2415
  return dynamicCore(source, options, staticElement);
2327
2416
  }
2328
- function dynamicComponent(source, options) {
2329
- return dynamicCore(source, options);
2330
- }
2331
- function dynamicCore(source, options, tagArm) {
2332
- if (options?.static) return staticDynamic(untrack(source), tagArm);
2333
- const sites = new Set();
2334
- let deliveredAddress;
2335
- const resolveBinding = (next, prev) => {
2336
- const binding = bindingOf(next);
2337
- if (!binding) return next;
2338
- deliveredAddress = binding.address;
2339
- const prevBinding = bindingOf(prev);
2340
- if (prevBinding && prevBinding.component === binding.component) {
2341
- for (const deliver of sites) deliver(binding.address);
2342
- return prev;
2343
- }
2344
- return next;
2345
- };
2346
- const sameInstance = (prev, next) => {
2347
- if (prev === next) return true;
2348
- const held = bindingOf(prev);
2349
- const incoming = bindingOf(next);
2350
- if (!held || !incoming || held.component !== incoming.component) return false;
2351
- if (held.address === incoming.address) return true;
2352
- if (deliveredAddress === undefined) return false;
2353
- if (incoming.address !== deliveredAddress) {
2354
- deliveredAddress = incoming.address;
2355
- for (const deliver of sites) deliver(incoming.address);
2356
- }
2357
- return true;
2358
- };
2359
- const cached = createMemo(prev => {
2360
- const next = source();
2361
- if (!next || typeof next.then !== "function") return resolveBinding(next, prev);
2362
- return {
2363
- [FLIGHT]: next
2364
- };
2365
- }, {
2366
- lazy: true,
2367
- equals: sameInstance
2368
- });
2369
- return props => {
2370
- if (sharedConfig.hydrating) {
2371
- try {
2372
- untrack(cached);
2373
- } catch {}
2374
- }
2375
- let latest = 0;
2376
- const value = createMemo(prev => {
2377
- const c = cached();
2378
- if (!c || !c[FLIGHT]) return resolveBinding(c, prev);
2379
- const next = c[FLIGHT];
2380
- const token = ++latest;
2381
- return {
2382
- then: (onFulfilled, onRejected) => next.then(resolved => {
2383
- const landed = token === latest ? resolveBinding(resolved, prev) : resolved;
2384
- return onFulfilled ? onFulfilled(landed) : landed;
2385
- }, onRejected)
2386
- };
2387
- }, {
2388
- equals: sameInstance
2389
- });
2390
- return createMemo(() => {
2391
- const component = value();
2392
- switch (typeof component) {
2393
- case "function":
2394
- {
2395
- Object.assign(component, {
2396
- [$DEVCOMP]: true
2397
- });
2398
- const binding = bindingOf(component);
2399
- if (binding) {
2400
- const [address, setAddress] = createSignal(deliveredAddress ??= binding.address, {
2401
- ownedWrite: true
2402
- });
2403
- sites.add(setAddress);
2404
- onCleanup(() => sites.delete(setAddress));
2405
- return untrack(() => binding.component(props, address));
2406
- }
2407
- return untrack(() => component(props));
2408
- }
2409
- case "string":
2410
- return tagArm ? tagArm(component, props) : undefined;
2411
- }
2412
- });
2413
- };
2414
- }
2415
- function staticDynamic(component, tagArm) {
2416
- if (component && typeof component.then === "function") throw new Error("dynamic(): a static source must resolve synchronously, not to a promise");
2417
- if (typeof component === "function") {
2418
- Object.assign(component, {
2419
- [$DEVCOMP]: true
2420
- });
2421
- const binding = bindingOf(component);
2422
- if (binding) {
2423
- const address = () => binding.address;
2424
- return props => untrack(() => binding.component(props, address));
2425
- }
2426
- return props => untrack(() => component(props));
2427
- }
2428
- if (typeof component === "string" && tagArm) return props => tagArm(component, props);
2429
- return () => undefined;
2430
- }
2431
2417
  function staticElement(tag, props) {
2432
2418
  const hydrating = sharedConfig.hydrating;
2433
2419
  const el = hydrating ? getNextElement() : createElement(tag, untrack(() => props.is), untrack(() => props.xmlns));
@@ -2474,4 +2460,4 @@ _moduleUrl) {
2474
2460
  function httpStatus(_code, _text) {}
2475
2461
  function httpHeader(_name, _value, _options) {}
2476
2462
 
2477
- 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, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, configureServerErrors, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dispatchAsInteraction, dynamic, dynamicComponent, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getHydrationWriter, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, readShallow, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperties, ssrStyleProperty, style, takeHydrationValue, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
2463
+ 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, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, configureServerErrors, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dispatchAsInteraction, dynamic, dynamicProperty, effect, escape, generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getHydrationWriter, getNextElement, getNextMarker, getNextMatch, getNextSibling, getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, getTraceContext, hasFlashCookie, hasServerLinkState, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, installServerComponentHydration, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, parseCookieHeader, readShallow, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, reportRequestFailure, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setLinkClaim, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrStyle, ssrStyleProperties, ssrStyleProperty, style, takeHydrationValue, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };