@solidjs/web 2.0.0-rc.20 → 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.
Files changed (36) hide show
  1. package/dist/server.dev.js +521 -280
  2. package/dist/server.js +518 -279
  3. package/dist/server.observe.js +518 -279
  4. package/dist/web.dev.js +142 -106
  5. package/dist/web.js +120 -105
  6. package/dist/web.observe.js +120 -105
  7. package/frames/dist/client.dev.js +7 -2
  8. package/frames/dist/client.js +7 -2
  9. package/frames/dist/client.observe.js +7 -2
  10. package/frames/dist/server.dev.js +124 -68
  11. package/frames/dist/server.js +124 -68
  12. package/frames/dist/server.observe.js +124 -68
  13. package/frames/dist/wire.js +1 -1
  14. package/package.json +2 -2
  15. package/serialization/dist/serialization.js +53 -12
  16. package/serialization/types/index.d.ts +42 -0
  17. package/serialization/types/serializer.d.ts +42 -0
  18. package/server-functions/dist/client.dev.js +5 -3
  19. package/server-functions/dist/client.js +5 -3
  20. package/server-functions/dist/client.observe.js +5 -3
  21. package/server-functions/dist/rich-args.js +27 -9
  22. package/server-functions/dist/server.dev.js +122 -36
  23. package/server-functions/dist/server.js +122 -36
  24. package/server-functions/dist/server.observe.js +122 -36
  25. package/types/client.d.ts +54 -3
  26. package/types/constants.d.ts +2 -1
  27. package/types/frames/frame-client.d.ts +2 -0
  28. package/types/frames/serializer.d.ts +42 -0
  29. package/types/frames/tree-rewrite.d.ts +7 -0
  30. package/types/serializer.d.ts +42 -0
  31. package/types/server-functions/client.d.ts +0 -1
  32. package/types/server-functions/server.d.ts +0 -1
  33. package/types/server-functions/shared.d.ts +3 -2
  34. package/types/server-functions/uploads.d.ts +3 -0
  35. package/types/server-mock.d.ts +35 -8
  36. package/types/server.d.ts +89 -18
package/dist/web.js CHANGED
@@ -1,6 +1,6 @@
1
- import { createRenderEffect, createMemo, enableHydration, $PROXY, untrack, runWithOwner, createRoot, getOwner, 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';
1
+ import { createRenderEffect, createMemo, enableHydration, $PROXY, untrack, runRefCallback, createRoot, getOwner, ROOT_ERROR_HOOK, flatten, flush, runWithOwner, heldRead, setSwapHook, isHidden, createComponent, omit, createOwner, createSignal, createEffect } from 'solid-js';
2
+ export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, dynamicComponent, getOwner, heldRead, merge as mergeProps, untrack } from 'solid-js';
3
+ import { sharedConfig, enableServerComponentHydration, hasStaticKeys, viewOf, OmitView, sourceHas, SOURCE_OMIT, sourceGet, SOURCE_MEMO, SOURCE_PROXY, SOURCE_PLAIN, sourceKeys, resolvedTable, dynamicCore } from 'solid-js/internal';
4
4
 
5
5
  const DOMWithState = {
6
6
  INPUT: {
@@ -32,6 +32,7 @@ const DOMWithState = {
32
32
  };
33
33
  const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
34
34
  const $$SLOT = /*#__PURE__*/Symbol("slot");
35
+ const $$INDEX = /*#__PURE__*/Symbol("index");
35
36
  const $$HOST = /*#__PURE__*/Symbol("host");
36
37
  const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
37
38
  const SVGElements = /*#__PURE__*/new Set([
@@ -71,32 +72,36 @@ function memo(fn) {
71
72
  }
72
73
 
73
74
  function reconcileArrays(parentNode, a, b, marker) {
74
- let active = parentNode.moveBefore && parentNode.isConnected && document.activeElement;
75
- if (active === document.body) active = null;
75
+ let bLength = b.length,
76
+ aEnd = a.length,
77
+ bEnd = bLength,
78
+ aStart = 0,
79
+ bStart = 0,
80
+ stamped,
81
+ after,
82
+ index,
83
+ anchor;
84
+ while (aStart < aEnd && a[aStart] === b[bStart]) {
85
+ aStart++;
86
+ bStart++;
87
+ }
88
+ if (aStart === aEnd && bStart === bEnd) return;
89
+ const mv = parentNode.moveBefore && parentNode.isConnected;
76
90
  const slot = marker || parentNode;
77
91
  const insert = (n, ref) => {
78
- active && n.isConnected && n.contains(active) ? parentNode.moveBefore(n, ref) : parentNode.insertBefore(n, ref);
92
+ mv && n.isConnected ? parentNode.moveBefore(n, ref) : parentNode.insertBefore(n, ref);
79
93
  if (marker || n[$$SLOT]) n[$$SLOT] = slot;
80
94
  };
81
- if (!a.length) {
95
+ if (!aEnd) {
82
96
  for (const n of b) insert(n, marker);
83
97
  return;
84
98
  }
85
- const isLive = n => {
86
- if (!n) return false;
87
- const tag = n[$$SLOT];
88
- return n.parentNode === parentNode && (!tag || tag === slot);
99
+ const isLive = n => n && n.parentNode === parentNode && (!(n = n[$$SLOT]) || n === slot);
100
+ const ref = k => {
101
+ while (k < bLength && !isLive(b[k])) k++;
102
+ return b[k] || (after && after.parentNode !== parentNode ? marker || null : after);
89
103
  };
90
- let bLength = b.length,
91
- aEnd = a.length,
92
- bEnd = bLength,
93
- aStart = 0,
94
- bStart = 0,
95
- tail = a[aEnd - 1],
96
- after = isLive(tail) ? tail.nextSibling : marker || null,
97
- map = null,
98
- anchor,
99
- anchorTag;
104
+ after = isLive(anchor = a[aEnd - 1]) ? anchor.nextSibling : marker || null;
100
105
  while (aStart < aEnd || bStart < bEnd) {
101
106
  if (a[aStart] === b[bStart]) {
102
107
  aStart++;
@@ -108,52 +113,43 @@ function reconcileArrays(parentNode, a, b, marker) {
108
113
  bEnd--;
109
114
  }
110
115
  if (aEnd === aStart) {
111
- let k = bEnd;
112
- while (k < bLength && !isLive(b[k])) k++;
113
- const node = k < bLength ? b[k] : after;
114
- while (bStart < bEnd) insert(b[bStart++], node);
115
- } else if (bEnd === bStart) {
116
- while (aStart < aEnd) {
117
- const n = a[aStart++];
118
- if ((!map || !map.has(n)) && isLive(n)) n.remove();
119
- }
120
- } else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === slot)) {
116
+ anchor = ref(bEnd);
117
+ while (bStart < bEnd) insert(b[bStart++], anchor);
118
+ } else if (!isLive(anchor = a[aStart])) aStart++;
119
+ else if (b[bStart] === a[aEnd - 1] && (
120
+ anchor === b[bEnd - 1] ||
121
+ !stamped && anchor === b[bStart + 1] && a[aStart + 1] === b[bStart + 2])) {
121
122
  do {
122
123
  insert(a[--aEnd], anchor);
123
124
  bStart++;
124
- if (aStart >= aEnd - 1 || bStart >= bEnd) break;
125
- } while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
125
+ } while (aStart < aEnd - 1 && bStart < bEnd && anchor === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
126
+ } else if (bStart < bEnd && anchor === b[bEnd - 1] && a[aStart + 1] !== b[bEnd - 2] && isLive(b[bStart]) && isLive(a[aEnd - 1])) {
127
+ insert(anchor, ref(bEnd));
128
+ aStart++;
129
+ bEnd--;
126
130
  } else {
127
- if (!isLive(a[aStart])) {
128
- aStart++;
129
- continue;
131
+ if (!stamped) {
132
+ stamped = 1;
133
+ for (index = bStart; index < bEnd;) b[index][$$INDEX] = index++;
130
134
  }
131
- if (!map) {
132
- map = new Map();
133
- let i = bStart;
134
- while (i < bEnd) map.set(b[i], i++);
135
- }
136
- const index = map.get(a[aStart]);
137
- if (index != null) {
135
+ if ((index = anchor[$$INDEX]) >= 0 && b[index] === anchor) {
138
136
  if (bStart < index && index < bEnd) {
139
137
  let i = aStart,
140
- sequence = 1,
141
- t;
142
- while (++i < aEnd && i < bEnd) {
143
- if ((t = map.get(a[i])) == null || t !== index + sequence) break;
144
- sequence++;
145
- }
138
+ sequence = 1;
139
+ while (++i < aEnd && i < bEnd && a[i] === b[index + sequence]) sequence++;
146
140
  if (sequence > index - bStart) {
147
- const node = a[aStart];
148
- while (bStart < index) insert(b[bStart++], node);
141
+ while (bStart < index) insert(b[bStart++], anchor);
149
142
  } else {
150
- const newNode = b[bStart++],
151
- node = a[aStart++];
152
- active && parentNode.contains(active) ? insert(newNode, node) : parentNode.replaceChild(newNode, node);
143
+ const newNode = b[bStart++];
144
+ aStart++;
145
+ mv ? insert(newNode, anchor) : parentNode.replaceChild(newNode, anchor);
153
146
  if (marker || newNode[$$SLOT]) newNode[$$SLOT] = slot;
154
147
  }
155
148
  } else aStart++;
156
- } else a[aStart++].remove();
149
+ } else {
150
+ anchor.remove();
151
+ aStart++;
152
+ }
157
153
  }
158
154
  }
159
155
  }
@@ -390,16 +386,11 @@ function render(code, element, init, options = {}) {
390
386
  createRoot(dispose => {
391
387
  disposer = dispose;
392
388
  if (options.onError) getOwner()[ROOT_ERROR_HOOK] = options.onError;
393
- if (element === document) {
394
- const tree = code();
395
- effect(() => flatten(tree), () => {});
396
- } else {
397
- const tree = code();
398
- insert(element, () => tree, element.firstChild ? null : undefined, init, {
399
- ...options.insertOptions,
400
- schedule: true
401
- });
402
- }
389
+ const tree = code();
390
+ if (element === document) effect(() => flatten(tree), () => {});else insert(element, () => tree, element.firstChild ? null : undefined, init, {
391
+ ...options.insertOptions,
392
+ schedule: true
393
+ });
403
394
  }, {
404
395
  id: options.renderId
405
396
  });
@@ -416,10 +407,18 @@ function render(code, element, init, options = {}) {
416
407
  element.textContent = "";
417
408
  };
418
409
  }
410
+ let policy;
411
+ function setTrustedTypesPolicy(value) {
412
+ policy = value;
413
+ }
414
+ function trustedHTML(html) {
415
+ return policy ? policy.createHTML(html) : html;
416
+ }
419
417
  function create(html, bypassGuard, flag) {
420
418
  const t = document.createElement("template");
421
- t.innerHTML = html;
422
- return flag === 2 ? t.content.firstChild.firstChild : t.content.firstChild;
419
+ t.innerHTML = policy ? policy.createHTML(html) : html;
420
+ const node = t.content.firstChild;
421
+ return flag === 2 ? node.firstChild : node;
423
422
  }
424
423
  function template(html, flag) {
425
424
  let node;
@@ -427,8 +426,7 @@ function template(html, flag) {
427
426
  return fn;
428
427
  }
429
428
  function delegateEvents(eventNames) {
430
- for (let i = 0, l = eventNames.length; i < l; i++) {
431
- const name = eventNames[i];
429
+ for (const name of eventNames) {
432
430
  if (!delegatedEvents.has(name)) {
433
431
  delegatedEvents.add(name);
434
432
  delegatedContainers.forEach((state, container) => attachDelegatedEvent(name, container, state));
@@ -476,9 +474,10 @@ function dispatchAsInteraction(e, fn) {
476
474
  function getDelegatedRoot(node) {
477
475
  while (node) {
478
476
  if (delegatedContainers.get(node)?.roots) return node;
479
- node = node._$host || node.parentNode || node.host;
477
+ node = parentOf(node);
480
478
  }
481
479
  }
480
+ const parentOf = node => node._$host || node.parentNode || node.host;
482
481
  function findOwner(target, state) {
483
482
  let node = target;
484
483
  let distance = 0;
@@ -488,7 +487,7 @@ function findOwner(target, state) {
488
487
  distance
489
488
  };
490
489
  distance++;
491
- node = node._$host || node.parentNode || node.host;
490
+ node = parentOf(node);
492
491
  }
493
492
  }
494
493
  function setProperty(node, name, value) {
@@ -502,6 +501,9 @@ function setProperty(node, name, value) {
502
501
  function setStatefulProperty(node, name, value) {
503
502
  node[name] = value;
504
503
  }
504
+ function strictHandler(fn) {
505
+ return fn();
506
+ }
505
507
  let claimHandlers = null;
506
508
  const claimAttributeSets = [];
507
509
  const CLAIM_SEAM = Symbol.for("solid.element-claims");
@@ -581,7 +583,7 @@ function className(node, value, prev) {
581
583
  return;
582
584
  }
583
585
  if (typeof value === "string") {
584
- node._$classes = undefined;
586
+ if (node._$classes) node._$classes = undefined;
585
587
  value !== prev && node.setAttribute("class", value);
586
588
  return;
587
589
  }
@@ -687,14 +689,22 @@ function setStyleProperty(node, name, value) {
687
689
  function spread(node, props, skipChildren, skip, name, loc) {
688
690
  const prevProps = {};
689
691
  const owner = claimHandlers !== null && (node.localName === "a" || node.localName === "form") ? getOwner() : undefined;
692
+ let held = 0;
690
693
  const apply = newProps => {
691
694
  const r = newProps.ref;
692
695
  if (r !== prevProps.ref && (typeof r === "function" || Array.isArray(r))) ref(() => r, node);
696
+ spreadHeld = held;
693
697
  assign(node, newProps, true, prevProps, true);
698
+ spreadHeld = 0;
694
699
  if (owner !== undefined) claimElement(node, owner);
695
700
  };
701
+ const read = fn => () => {
702
+ const p = fn();
703
+ held = heldRead();
704
+ return p;
705
+ };
696
706
  if (Array.isArray(props)) {
697
- effect(() => collectSources({}, props, undefined, skip), apply);
707
+ effect(read(() => collectSources({}, props, undefined, skip)), apply);
698
708
  if (!skipChildren && !(skip !== undefined && skip("children"))) insert(node, () => {
699
709
  for (let i = props.length - 1; i >= 0; i--) {
700
710
  const s = resolveSource(props[i]);
@@ -703,7 +713,7 @@ function spread(node, props, skipChildren, skip, name, loc) {
703
713
  });
704
714
  return prevProps;
705
715
  }
706
- effect(() => {
716
+ const collect = () => {
707
717
  const source = resolveSource(props);
708
718
  const newProps = {};
709
719
  const table = resolvedTable(source);
@@ -713,7 +723,8 @@ function spread(node, props, skipChildren, skip, name, loc) {
713
723
  if (view instanceof OmitView) collectProps(newProps, view, SOURCE_OMIT, skip);else if (view !== undefined) collectSources(newProps, view.sources, view.kinds, skip);else collectProps(newProps, source, $PROXY in source ? SOURCE_PROXY : SOURCE_PLAIN, skip);
714
724
  }
715
725
  return newProps;
716
- }, apply);
726
+ };
727
+ effect(read(collect), apply);
717
728
  if (!skipChildren && !(skip !== undefined && skip("children"))) {
718
729
  if (typeof props !== "function" && props != null && hasStaticKeys(props)) {
719
730
  const desc = Object.getOwnPropertyDescriptor(props, "children");
@@ -801,7 +812,7 @@ function applyRef(r, element) {
801
812
  }
802
813
  function ref(fn, element) {
803
814
  const resolved = untrack(fn);
804
- runWithOwner(null, () => applyRef(resolved, element));
815
+ runRefCallback(() => applyRef(resolved, element));
805
816
  }
806
817
  function scope(fn) {
807
818
  fn.$s = true;
@@ -812,6 +823,10 @@ const SCOPE_OPTIONS = {
812
823
  };
813
824
  let hydrationRt = null;
814
825
  let selectInsert = null;
826
+ let hostRt = null;
827
+ function installHostTagging() {
828
+ hostRt = tagHost;
829
+ }
815
830
  function installHydrationRuntime() {
816
831
  hydrationRt = {
817
832
  claimInitial(parent, multi, initial) {
@@ -822,8 +837,7 @@ function installHydrationRuntime() {
822
837
  },
823
838
  reclaimRegion(current, parent, marker) {
824
839
  if (!sharedConfig.hydrating || current == null || !parent.isConnected) return current;
825
- const first = Array.isArray(current) ? current[0] : current;
826
- if (first == null || first.isConnected) return current;
840
+ if (Array.isArray(current) ? current.every(n => !n || n.isConnected) : current.isConnected) return current;
827
841
  let nodes;
828
842
  if (marker) {
829
843
  nodes = [];
@@ -892,7 +906,7 @@ function insert(parent, accessor, marker, initial, options) {
892
906
  accessor = normalize(accessor, initial, multi, true);
893
907
  if (typeof accessor !== "function") {
894
908
  insertExpression(parent, accessor, initial, marker);
895
- host && tagHost(accessor, host);
909
+ hostRt !== null && host && hostRt(accessor, host);
896
910
  return;
897
911
  }
898
912
  }
@@ -915,13 +929,13 @@ function insert(parent, accessor, marker, initial, options) {
915
929
  } : options;
916
930
  effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
917
931
  current = insertExpression(parent, inner, current, marker);
918
- host && tagHost(current, host);
932
+ hostRt !== null && host && hostRt(current, host);
919
933
  }, innerOptions);
920
934
  return INNER_OWNED;
921
935
  }, value => {
922
936
  if (value === INNER_OWNED) return;
923
937
  current = insertExpression(parent, value, current, marker);
924
- host && tagHost(current, host);
938
+ hostRt !== null && host && hostRt(current, host);
925
939
  },
926
940
  accessor.$s ? options ? {
927
941
  ...options,
@@ -1004,7 +1018,7 @@ function trackAssetLoad(entry, adopted) {
1004
1018
  }
1005
1019
  entry.loadState = "pending";
1006
1020
  entry.loadPromise = new Promise(resolve => {
1007
- const settle = state => {
1021
+ const settle = entry.settle = state => {
1008
1022
  entry.loadState = state;
1009
1023
  resolve();
1010
1024
  };
@@ -1116,6 +1130,7 @@ function acquireAsset(descriptor) {
1116
1130
  entry.timer = setTimeout(() => {
1117
1131
  assetRegistry.delete(key);
1118
1132
  entry.element && entry.element.remove();
1133
+ if (entry.loadState === "pending") entry.settle("errored");
1119
1134
  }, ASSET_REMOVAL_GRACE);
1120
1135
  };
1121
1136
  }
@@ -1132,6 +1147,7 @@ function initHeadRegistry() {
1132
1147
  headRegistrations = [];
1133
1148
  headOwned = new Map();
1134
1149
  headApplied = new Map();
1150
+ setSwapHook(scheduleHeadApply);
1135
1151
  const t = document.querySelector("title");
1136
1152
  headFallbackTitle = t ? t.hasAttribute("data-dh") ? t.getAttribute("data-dhf") : t.textContent : null;
1137
1153
  if (globalThis._$HY) globalThis._$HY.h = applyServerHeadOps;
@@ -1182,7 +1198,7 @@ function flushHeadRegistry() {
1182
1198
  return;
1183
1199
  }
1184
1200
  headScheduled = false;
1185
- const winners = resolveHead(headRegistrations);
1201
+ const winners = resolveHead(headRegistrations.filter(r => !isHidden(r.node)));
1186
1202
  for (const [identity, els] of headOwned) {
1187
1203
  if (winners.has(identity)) continue;
1188
1204
  headOwned.delete(identity);
@@ -1294,10 +1310,12 @@ function useHead(tags) {
1294
1310
  initHeadRegistry();
1295
1311
  const reg = {
1296
1312
  seq: -1,
1297
- tags: null
1313
+ tags: null,
1314
+ node: null
1298
1315
  };
1299
1316
  const uid = ++headUid;
1300
1317
  effect(() => {
1318
+ reg.node = getOwner();
1301
1319
  let list = typeof tags === "function" ? tags() : tags;
1302
1320
  if (!Array.isArray(list)) list = [list];
1303
1321
  const replaceable = [];
@@ -1619,10 +1637,11 @@ function flattenClassList(list, result) {
1619
1637
  else if (typeof item !== "boolean" && (item || item === 0)) result[item] = true;
1620
1638
  }
1621
1639
  }
1640
+ let spreadHeld = 0;
1622
1641
  function assignProp(node, prop, value, prev, skipRef, nodeName) {
1623
1642
  if (prop === "style") return style(node, value, prev), value;
1624
1643
  if (prop === "class") return className(node, value, prev), value;
1625
- if (value === prev && DOMWithState[nodeName]?.[prop] !== 1) return prev;
1644
+ if (value === prev && (spreadHeld || DOMWithState[nodeName]?.[prop] !== 1)) return prev;
1626
1645
  if (prop === "ref") {
1627
1646
  if (!skipRef && value) ref(() => value, node);
1628
1647
  return value;
@@ -1667,39 +1686,32 @@ function eventHandler(e, container, state) {
1667
1686
  e[$$EVENT_OWNER] = owner;
1668
1687
  let node = resumeNode || e.target;
1669
1688
  const key = EVENT_KEY + e.type;
1670
- const retarget = value => Object.defineProperty(e, "target", {
1689
+ const define = (name, value) => Object.defineProperty(e, name, {
1671
1690
  configurable: true,
1672
1691
  value
1673
1692
  });
1674
1693
  const handleNode = () => {
1675
1694
  const handler = node[key];
1676
1695
  if (handler && !node.disabled) {
1696
+ define("currentTarget", node);
1677
1697
  const data = node[`${key}Data`];
1678
1698
  data !== undefined ? handler.call(node, data, e) : typeof handler === "function" ? handler.call(node, e) : handler.handleEvent(e);
1679
1699
  if (e.cancelBubble) return;
1680
1700
  }
1681
- node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
1701
+ node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && define("target", node.host);
1682
1702
  return true;
1683
1703
  };
1704
+ const atOwner = () => node === owner || node.parentNode === owner;
1684
1705
  const walkUpTree = () => {
1685
- while (node && handleNode()) {
1686
- if (node === owner || node.parentNode === owner) break;
1687
- node = node._$host || node.parentNode || node.host;
1688
- }
1706
+ while (node && handleNode() && !atOwner()) node = parentOf(node);
1689
1707
  };
1690
- Object.defineProperty(e, "currentTarget", {
1691
- configurable: true,
1692
- get() {
1693
- return node || owner;
1694
- }
1695
- });
1696
1708
  if (resumeNode) {
1697
- if (resumeNode === e.target) node = resumeNode._$host || resumeNode.parentNode || resumeNode.host;
1709
+ if (resumeNode === e.target) node = parentOf(resumeNode);
1698
1710
  if (node && node !== owner) walkUpTree();
1699
1711
  } else if (e.composedPath) {
1700
1712
  const path = e.composedPath();
1701
1713
  if (path.length) {
1702
- retarget(path[0]);
1714
+ define("target", path[0]);
1703
1715
  for (let i = 0; i < path.length; i++) {
1704
1716
  node = path[i];
1705
1717
  if (!handleNode()) break;
@@ -1708,9 +1720,7 @@ function eventHandler(e, container, state) {
1708
1720
  walkUpTree();
1709
1721
  break;
1710
1722
  }
1711
- if (node === owner || node.parentNode === owner) {
1712
- break;
1713
- }
1723
+ if (atOwner()) break;
1714
1724
  }
1715
1725
  } else walkUpTree();
1716
1726
  }
@@ -1770,7 +1780,8 @@ function insertExpression(parent, value, current, marker) {
1770
1780
  if (t === "string" || t === "number") {
1771
1781
  const prev = currentArray ? current[i] : undefined;
1772
1782
  if (prev && prev.nodeType === 3) {
1773
- if (prev.data !== "" + item) prev.data = item;
1783
+ const last = prev._$d;
1784
+ if (last !== item && (last !== undefined || prev.data !== "" + item)) prev.data = prev._$d = item;
1774
1785
  value[i] = prev;
1775
1786
  } else value[i] = document.createTextNode(item);
1776
1787
  }
@@ -1830,13 +1841,16 @@ function normalize(value, current, multi, doNotUnwrap) {
1830
1841
  }
1831
1842
  return value;
1832
1843
  }
1844
+ function hostGetter() {
1845
+ return this[$$HOST]();
1846
+ }
1833
1847
  function tagHost(value, host) {
1834
1848
  if (Array.isArray(value)) {
1835
1849
  for (let i = 0, len = value.length; i < len; i++) tagHost(value[i], host);
1836
1850
  } else if (value && value.nodeType && value[$$HOST] !== host) {
1837
1851
  value[$$HOST] = host;
1838
1852
  Object.defineProperty(value, "_$host", {
1839
- get: host,
1853
+ get: hostGetter,
1840
1854
  configurable: true
1841
1855
  });
1842
1856
  }
@@ -2097,6 +2111,7 @@ function portalImpl(props) {
2097
2111
  const m = untrack(mount);
2098
2112
  m.appendChild(endMarker);
2099
2113
  const dispose = runWithOwner(owner, () => createRoot(d => {
2114
+ installHostTagging();
2100
2115
  insert(m, c, endMarker, undefined, {
2101
2116
  host: () => treeMarker.parentNode
2102
2117
  });
@@ -2182,4 +2197,4 @@ _moduleUrl) {
2182
2197
  function httpStatus(_code, _text) {}
2183
2198
  function httpHeader(_name, _value, _options) {}
2184
2199
 
2185
- 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, setStatefulProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrStyle, ssrStyleProperties, ssrStyleProperty, style, takeHydrationValue, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };
2200
+ 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, installHostTagging, 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, setStatefulProperty, setStyleProperty, setTrustedTypesPolicy, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrElementAttribute, ssrGroup, ssrHydrationKey, ssrLinkClaim, ssrStyle, ssrStyleProperties, ssrStyleProperty, strictHandler, style, takeHydrationValue, template, trustedHTML, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, waitAsset, warmAsset };