@stencil/core 5.0.0-beta.3 → 5.0.0-beta.31

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/app-data/index.d.ts +1 -1
  2. package/dist/{client-BRu0GtRn.mjs → client-DIvBaMnB.mjs} +182 -70
  3. package/dist/compiler/browser.d.ts +114 -81
  4. package/dist/compiler/browser.js +743 -339
  5. package/dist/compiler/index.d.mts +110 -2
  6. package/dist/compiler/index.mjs +3 -3
  7. package/dist/compiler/utils/index.d.mts +1 -1
  8. package/dist/{compiler-BPgV6bA4.mjs → compiler-BI12oAIV.mjs} +4840 -2899
  9. package/dist/declarations/stencil-public-compiler.d.ts +152 -129
  10. package/dist/declarations/stencil-public-docs.d.ts +23 -0
  11. package/dist/declarations/stencil-public-runtime.d.ts +62 -58
  12. package/dist/{index-DmHmu3y0.d.mts → index-BGUOG9Wc.d.mts} +6 -2
  13. package/dist/{index-BopBfjPu.d.mts → index-BogZpjP2.d.mts} +150 -127
  14. package/dist/{index-BXAcVN2j.d.ts → index-CicD4Pgn.d.ts} +59 -55
  15. package/dist/index.d.mts +3 -0
  16. package/dist/index.mjs +1 -1
  17. package/dist/jsx-runtime.d.mts +6 -0
  18. package/dist/jsx-runtime.mjs +1 -1
  19. package/dist/{node-75gQKkFz.mjs → node-D-21Ykxi.mjs} +41 -47
  20. package/dist/runtime/client/lazy.js +321 -200
  21. package/dist/runtime/client/runtime.d.ts +73 -66
  22. package/dist/runtime/client/runtime.js +321 -200
  23. package/dist/runtime/index.d.ts +4 -5
  24. package/dist/runtime/index.js +319 -198
  25. package/dist/runtime/server/index.d.mts +11 -11
  26. package/dist/runtime/server/index.mjs +371 -239
  27. package/dist/runtime/server/runner.d.mts +4 -4
  28. package/dist/runtime/server/runner.mjs +82 -54
  29. package/dist/signals/index.d.ts +11 -2
  30. package/dist/signals/index.js +14 -35
  31. package/dist/sys/node/index.d.mts +1 -1
  32. package/dist/sys/node/index.mjs +1 -1
  33. package/dist/sys/node/worker.mjs +2 -2
  34. package/dist/testing/index.d.mts +136 -120
  35. package/dist/testing/index.mjs +328 -212
  36. package/package.json +8 -4
@@ -1,2 +1,2 @@
1
- import { n as Env, r as NAMESPACE, t as BUILD } from "../index-BXAcVN2j.js";
1
+ import { n as Env, r as NAMESPACE, t as BUILD } from "../index-CicD4Pgn.js";
2
2
  export { BUILD, Env, NAMESPACE };
@@ -1,5 +1,5 @@
1
1
  import { B as HOST_FLAGS, C as CMP_FLAGS, G as NODE_TYPES, Z as SVG_NS, o as isComplexType, s as isDef, x as queryNonceMetaTagContent } from "./helpers-Cpp3qc3u.mjs";
2
- import { effect } from "@preact/signals-core";
2
+ import * as SignalsCore from "@preact/signals-core";
3
3
  //#region src/app-data/index.ts
4
4
  /**
5
5
  * A collection of default build flags for a Stencil project.
@@ -104,41 +104,6 @@ const BUILD = {
104
104
  asyncQueue: false
105
105
  };
106
106
  //#endregion
107
- //#region src/client/client-build.ts
108
- const Build = {
109
- isDev: BUILD.isDev,
110
- isBrowser: true,
111
- isServer: false,
112
- isTesting: BUILD.isTesting
113
- };
114
- //#endregion
115
- //#region src/client/client-host-ref.ts
116
- /**
117
- * Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
118
- *
119
- * @param ref the runtime ref of interest
120
- * @returns the Host reference (if found) or undefined
121
- */
122
- const getHostRef = (ref) => {
123
- if (ref.__s_ghr) return ref.__s_ghr();
124
- };
125
- const isMemberInElement = (elm, memberName) => memberName in elm;
126
- //#endregion
127
- //#region src/client/client-log.ts
128
- let customError;
129
- const consoleError = (e, el) => (customError || console.error)(e, el);
130
- const STENCIL_DEV_MODE = BUILD.isTesting ? ["STENCIL:"] : ["%cstencil", "color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"];
131
- const consoleDevError = (...m) => console.error(...STENCIL_DEV_MODE, ...m);
132
- const consoleDevWarn = (...m) => console.warn(...STENCIL_DEV_MODE, ...m);
133
- const setErrorHandler = (handler) => customError = handler;
134
- //#endregion
135
- //#region src/client/client-load-module.ts
136
- /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
137
- //#endregion
138
- //#region src/client/client-style.ts
139
- const styles = /*@__PURE__*/ new Map();
140
- const modeResolutionChain = [];
141
- //#endregion
142
107
  //#region src/runtime/runtime-constants.ts
143
108
  /**
144
109
  * Bit flags for recording various properties of VDom nodes
@@ -191,6 +156,62 @@ const HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
191
156
  */
192
157
  const SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
193
158
  const XLINK_NS = "http://www.w3.org/1999/xlink";
159
+ /**
160
+ * `Build` values fixed per platform. Shared by each runtime's `Build` export and the compiler's
161
+ * `Build.*` folding (`compiler/bundle/build-flags-plugin.ts`), so the two can't disagree.
162
+ */
163
+ const CLIENT_BUILD_FLAGS = {
164
+ isBrowser: true,
165
+ isServer: false
166
+ };
167
+ const SERVER_BUILD_FLAGS = {
168
+ isBrowser: false,
169
+ isServer: true,
170
+ isDev: false,
171
+ isTesting: false
172
+ };
173
+ //#endregion
174
+ //#region src/client/client-build.ts
175
+ /**
176
+ * `isDev` / `isTesting` are getters, not copies: the transpile path (e.g. `@stencil/unplugin`)
177
+ * sets `BUILD.*` overrides from each component module, which runs after this module is evaluated.
178
+ */
179
+ const Build = {
180
+ ...CLIENT_BUILD_FLAGS,
181
+ get isDev() {
182
+ return BUILD.isDev;
183
+ },
184
+ get isTesting() {
185
+ return BUILD.isTesting;
186
+ }
187
+ };
188
+ //#endregion
189
+ //#region src/client/client-host-ref.ts
190
+ /**
191
+ * Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
192
+ *
193
+ * @param ref the runtime ref of interest
194
+ * @returns the Host reference (if found) or undefined
195
+ */
196
+ const getHostRef = (ref) => {
197
+ if (ref.__s_ghr) return ref.__s_ghr();
198
+ };
199
+ const isMemberInElement = (elm, memberName) => memberName in elm;
200
+ //#endregion
201
+ //#region src/client/client-log.ts
202
+ let customError;
203
+ const consoleError = (e, el) => (customError || console.error)(e, el);
204
+ const STENCIL_DEV_MODE = BUILD.isTesting ? ["STENCIL:"] : ["%cstencil", "color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"];
205
+ const consoleDevError = (...m) => console.error(...STENCIL_DEV_MODE, ...m);
206
+ const consoleDevWarn = (...m) => console.warn(...STENCIL_DEV_MODE, ...m);
207
+ const setErrorHandler = (handler) => customError = handler;
208
+ //#endregion
209
+ //#region src/client/client-load-module.ts
210
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
211
+ //#endregion
212
+ //#region src/client/client-style.ts
213
+ const styles = /*@__PURE__*/ new Map();
214
+ const modeResolver = [];
194
215
  //#endregion
195
216
  //#region src/client/client-window.ts
196
217
  const win = typeof window !== "undefined" ? window : {};
@@ -223,7 +244,7 @@ let queuePending = false;
223
244
  const queueDomReads = [];
224
245
  const queueDomWrites = [];
225
246
  const queueDomWritesLow = [];
226
- const scheduleFlush = () => win.document?.hidden ? nextTick(flush) : plt.raf(flush);
247
+ const scheduleFlush = () => win.document?.hidden ? setTimeout(flush, 16) : plt.raf(flush);
227
248
  const queueTask = (queue, write) => (cb) => {
228
249
  queue.push(cb);
229
250
  if (!queuePending) {
@@ -438,6 +459,50 @@ function findSlotFromSlottedNode(slottedNode, parentHost) {
438
459
  //#endregion
439
460
  //#region src/runtime/dom-extras.ts
440
461
  /**
462
+ * Patches a node slotted into a non-shadow component so it behaves as it would in a native slot:
463
+ * - `parentNode` returns the host element
464
+ * - `remove()` fires `slotchange` on the node's slot
465
+ *
466
+ * @param node the slotted node to be patched
467
+ */
468
+ const patchSlottedNode = (node) => {
469
+ patchParentNode(node);
470
+ patchSlottedRemove(node);
471
+ };
472
+ /**
473
+ * Detaches a slotted node from where it physically sits in the component's rendered DOM, through
474
+ * the unpatched accessors. Not via `remove()`: mock-doc's `remove()` calls
475
+ * `parentNode.removeChild()`, and a slotted node's patched `parentNode` is the host, whose patched
476
+ * `removeChild()` would come straight back here.
477
+ *
478
+ * @param node the slotted node to detach
479
+ */
480
+ const removeSlottedNode = (node) => {
481
+ const parent = internalCall(node, "parentNode");
482
+ if (parent) internalCall(parent, "removeChild")(node);
483
+ };
484
+ /**
485
+ * Patches `remove()` on a node slotted into a non-shadow component, so that removing it fires
486
+ * `slotchange` on its slot (and updates fallback content), as removing a node from a native slot
487
+ * does. Stencil's own node moves, while `isTmpDisconnected` is set, don't fire it.
488
+ *
489
+ * @param node the slotted node to patch
490
+ */
491
+ const patchSlottedRemove = (node) => {
492
+ const child = node;
493
+ if (!child || child.__remove || typeof child.remove !== "function") return;
494
+ child.__remove = child.remove;
495
+ child.remove = function() {
496
+ const host = this["s-ol"]?.parentElement;
497
+ const { slotNode } = findSlotFromSlottedNode(this);
498
+ removeSlottedNode(this);
499
+ if (slotNode && !(plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected)) {
500
+ dispatchSlotChangeEvent(slotNode);
501
+ updateFallbackSlotVisibility(host);
502
+ }
503
+ };
504
+ };
505
+ /**
441
506
  * Patches the `parentNode` accessor of a non-shadow slotted node
442
507
  *
443
508
  * @param node the slotted node to be patched
@@ -722,6 +787,10 @@ const attachStyles = (hostRef) => {
722
787
  */
723
788
  const getScopeId = (cmp, mode) => "sc-" + (BUILD.mode && mode && cmp.$flags$ & CMP_FLAGS.hasMode ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
724
789
  //#endregion
790
+ //#region src/runtime/signals-core.ts
791
+ const getCore = () => globalThis[Symbol.for("stencil.preact-signals-core")] ??= SignalsCore;
792
+ const effect = (fn, options) => getCore().effect(fn, options);
793
+ //#endregion
725
794
  //#region src/runtime/event-emitter.ts
726
795
  /**
727
796
  * Helper function to create & dispatch a custom Event on a provided target
@@ -736,6 +805,11 @@ const emitEvent = (elm, name, opts) => {
736
805
  return ev;
737
806
  };
738
807
  const getRegistry = () => customElements;
808
+ /**
809
+ * @param elm a defined component host
810
+ * @returns the registry the host's class was defined in, else the active registry
811
+ */
812
+ const getHostRegistry = (elm) => elm.constructor._registry ?? getRegistry();
739
813
  //#endregion
740
814
  //#region src/runtime/vdom/set-accessor.ts
741
815
  /**
@@ -859,10 +933,10 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
859
933
  const isComplex = isComplexType(newValue);
860
934
  if (!BUILD.lazyLoad) {
861
935
  const isStandardAttr = ln.startsWith("aria-") || ln.startsWith("data-");
862
- if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" && typeof customElements !== "undefined" && !customElements.get(elm.tagName.toLowerCase())) {
936
+ if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" && !customElements.get(elm.tagName.toLowerCase())) {
863
937
  if (!elm["s-pp"]) elm["s-pp"] = /* @__PURE__ */ new Map();
864
938
  elm["s-pp"].set(memberName, newValue);
865
- return;
939
+ if (isComplex || /[A-Z]/.test(memberName)) return;
866
940
  }
867
941
  }
868
942
  if ((isProp || isComplex && newValue !== null) && !isSvg) try {
@@ -980,6 +1054,7 @@ function sortedAttrNames(attrNames) {
980
1054
  let scopeId;
981
1055
  let contentRef;
982
1056
  let hostTagName;
1057
+ let hostRegistry;
983
1058
  let useNativeShadowDom = false;
984
1059
  let checkSlotFallbackVisibility = false;
985
1060
  let checkSlotRelocate = false;
@@ -989,6 +1064,7 @@ let isSvgMode = false;
989
1064
  * These ensure that ref callbacks are called in the correct order:
990
1065
  * first all removal callbacks (with null), then all attachment callbacks (with elements).
991
1066
  */
1067
+ const initialSlotChanges = /* @__PURE__ */ new Set();
992
1068
  const refCallbacksToRemove = [];
993
1069
  const refCallbacksToAttach = [];
994
1070
  /** Disposers for signal subscriptions on individual DOM nodes (text nodes, <s-show> wrappers). */
@@ -996,16 +1072,33 @@ const signalNodeDisposers = /* @__PURE__ */ new WeakMap();
996
1072
  const disposeSignalVNode = (vnode) => {
997
1073
  const elm = vnode.$elm$;
998
1074
  if (elm) {
999
- const dispose = signalNodeDisposers.get(elm);
1000
- if (dispose) {
1001
- dispose();
1002
- signalNodeDisposers.delete(elm);
1003
- }
1075
+ disposeTextSignal(elm);
1004
1076
  disposeAllSignalAttrs(elm);
1005
1077
  }
1006
1078
  vnode.$children$?.forEach(disposeSignalVNode);
1007
1079
  };
1008
1080
  /**
1081
+ * Tear down a text node's signal subscription, if it has one.
1082
+ * @param textNode the text node to unsubscribe
1083
+ */
1084
+ const disposeTextSignal = (textNode) => {
1085
+ const dispose = signalNodeDisposers.get(textNode);
1086
+ if (dispose) {
1087
+ dispose();
1088
+ signalNodeDisposers.delete(textNode);
1089
+ }
1090
+ };
1091
+ /**
1092
+ * Subscribe a text node to a signal, keeping its `data` in sync on every change.
1093
+ * @param textNode the text node to keep in sync
1094
+ * @param textSig the signal to subscribe to
1095
+ */
1096
+ const wireTextSignal = (textNode, textSig) => {
1097
+ signalNodeDisposers.set(textNode, effect(() => {
1098
+ textNode.data = String(textSig.value);
1099
+ }));
1100
+ };
1101
+ /**
1009
1102
  * Create a DOM Node corresponding to one of the children of a given VNode.
1010
1103
  *
1011
1104
  * @param oldParentVNode the parent VNode from the previous render
@@ -1027,13 +1120,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex) => {
1027
1120
  if (BUILD.isDev && newVNode.$elm$) consoleDevError(`The JSX ${newVNode.$text$ !== null ? `"${newVNode.$text$}" text` : `"${String(newVNode.$tag$)}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`);
1028
1121
  if (BUILD.vdomText && newVNode.$text$ != null) {
1029
1122
  elm = newVNode.$elm$ = win.document.createTextNode(newVNode.$text$);
1030
- if (BUILD.vdomSignals && newVNode.$signal$) {
1031
- const textSig = newVNode.$signal$;
1032
- const textNode = elm;
1033
- signalNodeDisposers.set(textNode, effect(() => {
1034
- textNode.data = String(textSig.value);
1035
- }));
1036
- }
1123
+ if (BUILD.vdomSignals && newVNode.$signal$) wireTextSignal(elm, newVNode.$signal$);
1037
1124
  } else if (BUILD.slotRelocation && newVNode.$flags$ & VNODE_FLAGS.isSlotReference) {
1038
1125
  elm = newVNode.$elm$ = BUILD.isDebug || BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode) : win.document.createTextNode("");
1039
1126
  if (typeof newVNode.$attrs$?.slot === "string") elm["s-sa"] = newVNode.$attrs$.slot;
@@ -1042,8 +1129,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex) => {
1042
1129
  if (BUILD.svg && !isSvgMode) isSvgMode = newVNode.$tag$ === "svg";
1043
1130
  if (!win.document) throw new Error("No DOM environment available for rendering.");
1044
1131
  const tag = !useNativeShadowDom && BUILD.slotRelocation && newVNode.$flags$ & VNODE_FLAGS.isSlotFallback ? "slot-fb" : newVNode.$tag$;
1045
- const _reg = getRegistry();
1046
- const registryOpts = _reg !== win.customElements && tag.includes("-") ? { customElementRegistry: _reg } : void 0;
1132
+ const registryOpts = hostRegistry !== win.customElements && tag.includes("-") ? { customElementRegistry: hostRegistry } : void 0;
1047
1133
  elm = newVNode.$elm$ = BUILD.svg && isSvgMode ? win.document.createElementNS(SVG_NS, tag) : win.document.createElement(tag, registryOpts);
1048
1134
  if (BUILD.svg && isSvgMode && newVNode.$tag$ === "foreignObject") isSvgMode = false;
1049
1135
  if (BUILD.vdomAttribute) updateElement(null, newVNode, isSvgMode);
@@ -1301,7 +1387,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
1301
1387
  }
1302
1388
  if (BUILD.vdomKey && idxInOld >= 0) {
1303
1389
  elmToMove = oldCh[idxInOld];
1304
- if (elmToMove.$tag$ !== newStartVnode.$tag$) node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
1390
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
1305
1391
  else {
1306
1392
  patch(elmToMove, newStartVnode, isInitialRender);
1307
1393
  oldCh[idxInOld] = void 0;
@@ -1394,7 +1480,17 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
1394
1480
  else if (BUILD.hydrateClientSide && isInitialRender && BUILD.updatable && oldChildren !== null && newChildren === null) newVNode.$children$ = oldChildren;
1395
1481
  if (BUILD.svg && isSvgMode && tag === "svg") isSvgMode = false;
1396
1482
  } else if (BUILD.vdomText && BUILD.slotRelocation && (defaultHolder = elm["s-cr"])) defaultHolder.parentNode.textContent = text;
1397
- else if (BUILD.vdomText && oldVNode.$text$ !== text) elm.data = text;
1483
+ else if (BUILD.vdomText) {
1484
+ if (BUILD.vdomSignals && newVNode.$signal$) {
1485
+ if (newVNode.$signal$ !== oldVNode.$signal$) {
1486
+ disposeTextSignal(elm);
1487
+ wireTextSignal(elm, newVNode.$signal$);
1488
+ }
1489
+ } else {
1490
+ if (BUILD.vdomSignals && oldVNode.$signal$) disposeTextSignal(elm);
1491
+ if (oldVNode.$text$ !== text) elm.data = text;
1492
+ }
1493
+ }
1398
1494
  };
1399
1495
  /**
1400
1496
  * Component-global information about nodes which are either currently being
@@ -1523,10 +1619,13 @@ const insertBefore = (parent, newNode, reference, isInitialLoad) => {
1523
1619
  if (BUILD.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
1524
1620
  else if (typeof newNode["s-sn"] === "string") {
1525
1621
  const hostElm = newNode["s-hn"] && parent.closest?.(newNode["s-hn"]);
1526
- if ((BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE) patchParentNode(newNode);
1622
+ if ((BUILD.lightDomPatches || BUILD.slotChildNodes || BUILD.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE) patchSlottedNode(newNode);
1527
1623
  parent.insertBefore(newNode, reference);
1528
1624
  const { slotNode } = findSlotFromSlottedNode(newNode);
1529
- if (slotNode && !isInitialLoad) dispatchSlotChangeEvent(slotNode);
1625
+ if (slotNode) {
1626
+ if (isInitialLoad) initialSlotChanges.add(slotNode);
1627
+ else dispatchSlotChangeEvent(slotNode);
1628
+ }
1530
1629
  return newNode;
1531
1630
  }
1532
1631
  }
@@ -1582,6 +1681,7 @@ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1582
1681
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1583
1682
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1584
1683
  hostTagName = hostElm.tagName;
1684
+ hostRegistry = getHostRegistry(hostElm);
1585
1685
  if (BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) throw new Error(`The <Host> must be the single root component.
1586
1686
  Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
1587
1687
 
@@ -1681,6 +1781,11 @@ render() {
1681
1781
  if (checkSlotFallbackVisibility) updateFallbackSlotVisibility(rootVnode.$elm$);
1682
1782
  plt.$flags$ &= ~PLATFORM_FLAGS.isTmpDisconnected;
1683
1783
  relocateNodes.length = 0;
1784
+ if (initialSlotChanges.size) {
1785
+ const slotNodes = [...initialSlotChanges];
1786
+ initialSlotChanges.clear();
1787
+ nextTick(() => slotNodes.forEach(dispatchSlotChangeEvent));
1788
+ }
1684
1789
  }
1685
1790
  if (BUILD.slotRelocation && !useNativeShadowDom && !(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && hostElm["s-cr"]) {
1686
1791
  const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
@@ -2097,9 +2202,7 @@ const h = (nodeName, vnodeData, ...children) => {
2097
2202
  if (classData && !(BUILD.vdomSignals && isSignalLike(classData))) vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
2098
2203
  }
2099
2204
  }
2100
- if (BUILD.isDev && vNodeChildren.some(isHost)) consoleDevError(`The <Host> must be the single root component. Make sure:
2101
- - You are NOT using hostData() and <Host> in the same component.
2102
- - <Host> is used once, and it's the single root component of the render() function.`);
2205
+ if (BUILD.isDev && vNodeChildren.some(isHost)) consoleDevError(`The <Host> must be used once, and be the single root component of the render() function.`);
2103
2206
  if (BUILD.vdomFunctional && typeof nodeName === "function") return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
2104
2207
  const vnode = newVNode(nodeName, null);
2105
2208
  vnode.$attrs$ = vnodeData;
@@ -2152,17 +2255,23 @@ const vdomFnUtils = {
2152
2255
  * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
2153
2256
  * friendlier public interface (hence, 'convertToPublic').
2154
2257
  *
2155
- * @param node the virtual DOM node to convert
2258
+ * Functional components receive primitive children unwrapped, so those
2259
+ * become text-only child nodes.
2260
+ *
2261
+ * @param node the virtual DOM node (or primitive child) to convert
2156
2262
  * @returns a converted child node
2157
2263
  */
2158
- const convertToPublic = (node) => ({
2264
+ const convertToPublic = (node) => typeof node !== "object" ? {
2265
+ vtag: null,
2266
+ vtext: String(node)
2267
+ } : {
2159
2268
  vattrs: node.$attrs$,
2160
2269
  vchildren: node.$children$,
2161
2270
  vkey: node.$key$,
2162
2271
  vname: node.$name$,
2163
2272
  vtag: node.$tag$,
2164
2273
  vtext: node.$text$
2165
- });
2274
+ };
2166
2275
  /**
2167
2276
  * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
2168
2277
  * order to use the resulting object in the virtual DOM. The initial object was
@@ -2179,11 +2288,11 @@ const convertToPrivate = (node) => {
2179
2288
  if (node.vname) vnodeData.name = node.vname;
2180
2289
  return h(node.vtag, vnodeData, ...node.vchildren || []);
2181
2290
  }
2182
- const vnode = newVNode(node.vtag, node.vtext);
2183
- vnode.$attrs$ = node.vattrs;
2184
- vnode.$children$ = node.vchildren;
2185
- vnode.$key$ = node.vkey;
2186
- vnode.$name$ = node.vname;
2291
+ const vnode = newVNode(node.vtag ?? null, node.vtext);
2292
+ vnode.$attrs$ = node.vattrs ?? null;
2293
+ vnode.$children$ = node.vchildren ?? null;
2294
+ vnode.$key$ = node.vkey ?? null;
2295
+ vnode.$name$ = node.vname ?? null;
2187
2296
  return vnode;
2188
2297
  };
2189
2298
  /**
@@ -2203,7 +2312,10 @@ const validateInputProperties = (inputElm) => {
2203
2312
  };
2204
2313
  //#endregion
2205
2314
  //#region src/runtime/mode.ts
2206
- const setMode = (handler) => modeResolutionChain.push(handler);
2315
+ const setMode = (handler) => {
2316
+ modeResolver.length = 0;
2317
+ modeResolver.push(handler);
2318
+ };
2207
2319
  const getMode = (ref) => getHostRef(ref)?.$modeName$;
2208
2320
  //#endregion
2209
2321
  //#region src/runtime/mixin.ts
@@ -2365,4 +2477,4 @@ function hasKeys(obj) {
2365
2477
  return false;
2366
2478
  }
2367
2479
  //#endregion
2368
- export { setErrorHandler as C, HYDRATED_CSS as S, getAssetPath as _, transformTag as a, writeTask as b, Mixin as c, Host as d, h as f, getShadowRoot as g, getElement as h, setTagTransformer as i, getMode as l, getRenderingRef as m, jsxDEV as n, render as o, forceUpdate as p, jsxs as r, ReactiveControllerHost as s, jsx as t, setMode as u, setAssetPath as v, Build as w, setPlatformHelpers as x, readTask as y };
2480
+ export { Build as C, SERVER_BUILD_FLAGS as E, setErrorHandler as S, HYDRATED_CSS as T, getAssetPath as _, transformTag as a, writeTask as b, Mixin as c, Host as d, h as f, getShadowRoot as g, getElement as h, setTagTransformer as i, getMode as l, getRenderingRef as m, jsxDEV as n, render as o, forceUpdate as p, jsxs as r, ReactiveControllerHost as s, jsx as t, setMode as u, setAssetPath as v, CLIENT_BUILD_FLAGS as w, setPlatformHelpers as x, readTask as y };