@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,12 +1,89 @@
1
1
  import { BUILD, BUILD as BUILD$1, Env, NAMESPACE, NAMESPACE as NAMESPACE$1 } from "@stencil/core/app-data";
2
2
  import { globalStyles } from "@stencil/core/app-globals";
3
- import { effect, effect as effect$1, signal } from "@preact/signals-core";
3
+ import * as SignalsCore from "@preact/signals-core";
4
+ //#region src/runtime/runtime-constants.ts
5
+ /**
6
+ * Bit flags for recording various properties of VDom nodes
7
+ */
8
+ const VNODE_FLAGS = {
9
+ /**
10
+ * Whether or not a vdom node is a slot reference
11
+ */
12
+ isSlotReference: 1,
13
+ /**
14
+ * Whether or not a slot element has fallback content
15
+ */
16
+ isSlotFallback: 2,
17
+ /**
18
+ * Whether or not an element is a host element
19
+ */
20
+ isHost: 4
21
+ };
22
+ const PROXY_FLAGS = {
23
+ isElementConstructor: 1,
24
+ proxyState: 2
25
+ };
26
+ const PLATFORM_FLAGS = {
27
+ /**
28
+ * designates a node in the DOM as being actively moved by the runtime
29
+ */
30
+ isTmpDisconnected: 1,
31
+ appLoaded: 2,
32
+ queueSync: 4,
33
+ queueMask: 6
34
+ };
35
+ /**
36
+ * A (subset) of node types which are relevant for the Stencil runtime. These
37
+ * values are based on the values which can possibly be returned by the
38
+ * `.nodeType` property of a DOM node. See here for details:
39
+ *
40
+ * {@link https://dom.spec.whatwg.org/#ref-for-dom-node-nodetype%E2%91%A0}
41
+ */
42
+ const NODE_TYPE = {
43
+ ElementNode: 1,
44
+ TextNode: 3,
45
+ CommentNode: 8,
46
+ DocumentNode: 9,
47
+ DocumentTypeNode: 10,
48
+ DocumentFragment: 11
49
+ };
50
+ const HYDRATE_ID = "s-id";
51
+ const HYDRATED_STYLE_ID = "sty-id";
52
+ const HYDRATE_CHILD_ID = "c-id";
53
+ const HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
54
+ /**
55
+ * Constant for styles to be globally applied to `slot-fb` elements for pseudo-slot behavior.
56
+ *
57
+ * Two cascading rules must be used instead of a `:not()` selector due to Stencil browser
58
+ * support as of Stencil v4.
59
+ */
60
+ const SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
61
+ const XLINK_NS = "http://www.w3.org/1999/xlink";
62
+ /**
63
+ * Minimum delay, in milliseconds, before retrying a failed lazy component load.
64
+ */
65
+ const LAZY_LOAD_RETRY_INTERVAL_MS = 1e3;
66
+ const FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
67
+ "formAssociatedCallback",
68
+ "formResetCallback",
69
+ "formDisabledCallback",
70
+ "formStateRestoreCallback"
71
+ ];
72
+ //#endregion
4
73
  //#region src/client/client-build.ts
74
+ /**
75
+ * `isDev` / `isTesting` are getters, not copies: the transpile path (e.g. `@stencil/unplugin`)
76
+ * sets `BUILD.*` overrides from each component module, which runs after this module is evaluated.
77
+ */
5
78
  const Build = {
6
- isDev: BUILD$1.isDev,
7
79
  isBrowser: true,
8
80
  isServer: false,
9
- isTesting: BUILD$1.isTesting
81
+ get isDev() {
82
+ return BUILD$1.isDev;
83
+ },
84
+ get isTesting() {
85
+ return BUILD$1.isTesting;
86
+ }
10
87
  };
11
88
  //#endregion
12
89
  //#region src/client/client-decorators.ts
@@ -488,79 +565,10 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
488
565
  //#endregion
489
566
  //#region src/client/client-style.ts
490
567
  const styles = /*@__PURE__*/ new Map();
491
- const modeResolutionChain = [];
492
- const setScopedSsr = (_opts) => {};
568
+ const modeResolver = [];
569
+ const setScopedSSR = (_opts) => {};
493
570
  const needsScopedSSR = () => false;
494
571
  //#endregion
495
- //#region src/runtime/runtime-constants.ts
496
- /**
497
- * Bit flags for recording various properties of VDom nodes
498
- */
499
- const VNODE_FLAGS = {
500
- /**
501
- * Whether or not a vdom node is a slot reference
502
- */
503
- isSlotReference: 1,
504
- /**
505
- * Whether or not a slot element has fallback content
506
- */
507
- isSlotFallback: 2,
508
- /**
509
- * Whether or not an element is a host element
510
- */
511
- isHost: 4
512
- };
513
- const PROXY_FLAGS = {
514
- isElementConstructor: 1,
515
- proxyState: 2
516
- };
517
- const PLATFORM_FLAGS = {
518
- /**
519
- * designates a node in the DOM as being actively moved by the runtime
520
- */
521
- isTmpDisconnected: 1,
522
- appLoaded: 2,
523
- queueSync: 4,
524
- queueMask: 6
525
- };
526
- /**
527
- * A (subset) of node types which are relevant for the Stencil runtime. These
528
- * values are based on the values which can possibly be returned by the
529
- * `.nodeType` property of a DOM node. See here for details:
530
- *
531
- * {@link https://dom.spec.whatwg.org/#ref-for-dom-node-nodetype%E2%91%A0}
532
- */
533
- const NODE_TYPE = {
534
- ElementNode: 1,
535
- TextNode: 3,
536
- CommentNode: 8,
537
- DocumentNode: 9,
538
- DocumentTypeNode: 10,
539
- DocumentFragment: 11
540
- };
541
- const HYDRATE_ID = "s-id";
542
- const HYDRATED_STYLE_ID = "sty-id";
543
- const HYDRATE_CHILD_ID = "c-id";
544
- const HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
545
- /**
546
- * Constant for styles to be globally applied to `slot-fb` elements for pseudo-slot behavior.
547
- *
548
- * Two cascading rules must be used instead of a `:not()` selector due to Stencil browser
549
- * support as of Stencil v4.
550
- */
551
- const SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
552
- const XLINK_NS = "http://www.w3.org/1999/xlink";
553
- /**
554
- * Minimum delay, in milliseconds, before retrying a failed lazy component load.
555
- */
556
- const LAZY_LOAD_RETRY_INTERVAL_MS = 1e3;
557
- const FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
558
- "formAssociatedCallback",
559
- "formResetCallback",
560
- "formDisabledCallback",
561
- "formStateRestoreCallback"
562
- ];
563
- //#endregion
564
572
  //#region src/client/client-window.ts
565
573
  const win = typeof window !== "undefined" ? window : {};
566
574
  const H = win.HTMLElement || class {};
@@ -601,7 +609,7 @@ let queuePending = false;
601
609
  const queueDomReads = [];
602
610
  const queueDomWrites = [];
603
611
  const queueDomWritesLow = [];
604
- const scheduleFlush = () => win.document?.hidden ? nextTick(flush) : plt.raf(flush);
612
+ const scheduleFlush = () => win.document?.hidden ? setTimeout(flush, 16) : plt.raf(flush);
605
613
  const queueTask = (queue, write) => (cb) => {
606
614
  queue.push(cb);
607
615
  if (!queuePending) {
@@ -964,6 +972,7 @@ const patchSlotAppendChild = (HostElementPrototype) => {
964
972
  const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
965
973
  if (slotNode) {
966
974
  addSlotRelocateNode(newChild, slotNode);
975
+ patchSlottedNode(newChild);
967
976
  const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
968
977
  const appendAfter = slotChildNodes[slotChildNodes.length - 1];
969
978
  const insertedNode = internalCall(internalCall(appendAfter, "parentNode"), "insertBefore")(newChild, appendAfter.nextSibling);
@@ -986,8 +995,10 @@ const patchSlotRemoveChild = (ElementPrototype) => {
986
995
  ElementPrototype.__removeChild = ElementPrototype.removeChild;
987
996
  ElementPrototype.removeChild = function(toRemove) {
988
997
  if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
989
- if (getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, toRemove["s-sn"]) && toRemove.isConnected) {
990
- toRemove.remove();
998
+ const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, toRemove["s-sn"]);
999
+ if (slotNode && toRemove.isConnected) {
1000
+ removeSlottedNode(toRemove);
1001
+ if (slotNode[0]) dispatchSlotChangeEvent(slotNode[0]);
991
1002
  updateFallbackSlotVisibility(this);
992
1003
  return;
993
1004
  }
@@ -1010,6 +1021,7 @@ const patchSlotPrepend = (HostElementPrototype) => {
1010
1021
  const slotNode = getHostSlotNodes(internalCall(this, "childNodes"), this.tagName, slotName)[0];
1011
1022
  if (slotNode) {
1012
1023
  addSlotRelocateNode(newChild, slotNode, true);
1024
+ patchSlottedNode(newChild);
1013
1025
  const appendAfter = getSlotChildSiblings(slotNode, slotName)[0];
1014
1026
  const toReturn = internalCall(internalCall(appendAfter, "parentNode"), "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
1015
1027
  dispatchSlotChangeEvent(slotNode);
@@ -1085,6 +1097,7 @@ const patchInsertBefore = (HostElementPrototype) => {
1085
1097
  }
1086
1098
  if (slotName === currentChild["s-sn"]) {
1087
1099
  addSlotRelocateNode(newChild, slotNode);
1100
+ patchSlottedNode(newChild);
1088
1101
  internalCall(internalCall(currentChild, "parentNode"), "insertBefore")(newChild, currentChild);
1089
1102
  dispatchSlotChangeEvent(slotNode);
1090
1103
  }
@@ -1163,10 +1176,21 @@ const patchChildSlotNodes = (elm) => {
1163
1176
  } });
1164
1177
  };
1165
1178
  /**
1166
- * Patches sibling accessors of a 'slotted' node within a non-shadow component.
1167
- * Meaning whilst stepping through a non-shadow element's nodes, only the mock 'lightDOM' nodes are returned.
1168
- * Especially relevant when rendering components via SSR... Frameworks will often try to reconcile their
1169
- * VDOM with the real DOM by stepping through nodes with 'nextSibling' et al.
1179
+ * Patches a node slotted into a non-shadow component so it behaves as it would in a native slot:
1180
+ * - `parentNode` returns the host element
1181
+ * - `remove()` fires `slotchange` on the node's slot
1182
+ *
1183
+ * @param node the slotted node to be patched
1184
+ */
1185
+ const patchSlottedNode = (node) => {
1186
+ patchParentNode(node);
1187
+ patchSlottedRemove(node);
1188
+ };
1189
+ /**
1190
+ * Patches a slotted node from SSR markup: everything {@link patchSlottedNode} does, plus its
1191
+ * sibling accessors, so whilst stepping through a non-shadow element's nodes only the mock
1192
+ * 'lightDOM' nodes are returned. Frameworks hydrating SSR output often reconcile their VDOM with
1193
+ * the real DOM by stepping through nodes with 'nextSibling' et al.
1170
1194
  * - `nextSibling`
1171
1195
  * - `nextElementSibling`
1172
1196
  * - `previousSibling`
@@ -1174,11 +1198,11 @@ const patchChildSlotNodes = (elm) => {
1174
1198
  *
1175
1199
  * @param node the slotted node to be patched
1176
1200
  */
1177
- const patchSlottedNode = (node) => {
1201
+ const patchSsrSlottedNode = (node) => {
1178
1202
  if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return;
1179
1203
  patchNextSibling(node);
1180
1204
  patchPreviousSibling(node);
1181
- patchParentNode(node);
1205
+ patchSlottedNode(node);
1182
1206
  if (node.nodeType === Node.ELEMENT_NODE) {
1183
1207
  patchNextElementSibling(node);
1184
1208
  patchPreviousElementSibling(node);
@@ -1245,6 +1269,39 @@ const patchPreviousElementSibling = (element) => {
1245
1269
  } });
1246
1270
  };
1247
1271
  /**
1272
+ * Detaches a slotted node from where it physically sits in the component's rendered DOM, through
1273
+ * the unpatched accessors. Not via `remove()`: mock-doc's `remove()` calls
1274
+ * `parentNode.removeChild()`, and a slotted node's patched `parentNode` is the host, whose patched
1275
+ * `removeChild()` would come straight back here.
1276
+ *
1277
+ * @param node the slotted node to detach
1278
+ */
1279
+ const removeSlottedNode = (node) => {
1280
+ const parent = internalCall(node, "parentNode");
1281
+ if (parent) internalCall(parent, "removeChild")(node);
1282
+ };
1283
+ /**
1284
+ * Patches `remove()` on a node slotted into a non-shadow component, so that removing it fires
1285
+ * `slotchange` on its slot (and updates fallback content), as removing a node from a native slot
1286
+ * does. Stencil's own node moves, while `isTmpDisconnected` is set, don't fire it.
1287
+ *
1288
+ * @param node the slotted node to patch
1289
+ */
1290
+ const patchSlottedRemove = (node) => {
1291
+ const child = node;
1292
+ if (!child || child.__remove || typeof child.remove !== "function") return;
1293
+ child.__remove = child.remove;
1294
+ child.remove = function() {
1295
+ const host = this["s-ol"]?.parentElement;
1296
+ const { slotNode } = findSlotFromSlottedNode(this);
1297
+ removeSlottedNode(this);
1298
+ if (slotNode && !(plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected)) {
1299
+ dispatchSlotChangeEvent(slotNode);
1300
+ updateFallbackSlotVisibility(host);
1301
+ }
1302
+ };
1303
+ };
1304
+ /**
1248
1305
  * Patches the `parentNode` accessor of a non-shadow slotted node
1249
1306
  *
1250
1307
  * @param node the slotted node to be patched
@@ -1685,6 +1742,13 @@ const isComplexType = (o) => {
1685
1742
  return o === "object" || o === "function";
1686
1743
  };
1687
1744
  //#endregion
1745
+ //#region src/runtime/signals-core.ts
1746
+ const getCore = () => globalThis[Symbol.for("stencil.preact-signals-core")] ??= SignalsCore;
1747
+ const effect = (fn, options) => getCore().effect(fn, options);
1748
+ function signal(value, options) {
1749
+ return getCore().signal(value, options);
1750
+ }
1751
+ //#endregion
1688
1752
  //#region src/runtime/event-emitter.ts
1689
1753
  const createEvent = (ref, name, flags) => {
1690
1754
  const elm = getElement(ref);
@@ -1717,6 +1781,11 @@ const setRegistry = (registry) => {
1717
1781
  _registry = registry;
1718
1782
  };
1719
1783
  const getRegistry = () => _registry ?? customElements;
1784
+ /**
1785
+ * @param elm a defined component host
1786
+ * @returns the registry the host's class was defined in, else the active registry
1787
+ */
1788
+ const getHostRegistry = (elm) => elm.constructor._registry ?? getRegistry();
1720
1789
  //#endregion
1721
1790
  //#region src/runtime/vdom/set-accessor.ts
1722
1791
  /**
@@ -1760,7 +1829,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
1760
1829
  attrMap.get(memberName)?.();
1761
1830
  if (!signalAttrDisposers.has(elm)) signalAttrDisposers.set(elm, attrMap);
1762
1831
  let prevVal = oldValue;
1763
- attrMap.set(memberName, effect$1(() => {
1832
+ attrMap.set(memberName, effect(() => {
1764
1833
  const curVal = newValue.value;
1765
1834
  setAccessor(elm, memberName, prevVal, curVal, isSvg, flags);
1766
1835
  prevVal = curVal;
@@ -1840,10 +1909,10 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
1840
1909
  const isComplex = isComplexType(newValue);
1841
1910
  if (!BUILD$1.lazyLoad) {
1842
1911
  const isStandardAttr = ln.startsWith("aria-") || ln.startsWith("data-");
1843
- if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" && typeof customElements !== "undefined" && !customElements.get(elm.tagName.toLowerCase())) {
1912
+ if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" && !customElements.get(elm.tagName.toLowerCase())) {
1844
1913
  if (!elm["s-pp"]) elm["s-pp"] = /* @__PURE__ */ new Map();
1845
1914
  elm["s-pp"].set(memberName, newValue);
1846
- return;
1915
+ if (isComplex || /[A-Z]/.test(memberName)) return;
1847
1916
  }
1848
1917
  }
1849
1918
  if ((isProp || isComplex && newValue !== null) && !isSvg) try {
@@ -1961,6 +2030,7 @@ function sortedAttrNames(attrNames) {
1961
2030
  let scopeId;
1962
2031
  let contentRef;
1963
2032
  let hostTagName;
2033
+ let hostRegistry;
1964
2034
  let useNativeShadowDom = false;
1965
2035
  let checkSlotFallbackVisibility = false;
1966
2036
  let checkSlotRelocate = false;
@@ -1970,6 +2040,7 @@ let isSvgMode = false;
1970
2040
  * These ensure that ref callbacks are called in the correct order:
1971
2041
  * first all removal callbacks (with null), then all attachment callbacks (with elements).
1972
2042
  */
2043
+ const initialSlotChanges = /* @__PURE__ */ new Set();
1973
2044
  const refCallbacksToRemove = [];
1974
2045
  const refCallbacksToAttach = [];
1975
2046
  /** Disposers for signal subscriptions on individual DOM nodes (text nodes, <s-show> wrappers). */
@@ -1977,16 +2048,33 @@ const signalNodeDisposers = /* @__PURE__ */ new WeakMap();
1977
2048
  const disposeSignalVNode = (vnode) => {
1978
2049
  const elm = vnode.$elm$;
1979
2050
  if (elm) {
1980
- const dispose = signalNodeDisposers.get(elm);
1981
- if (dispose) {
1982
- dispose();
1983
- signalNodeDisposers.delete(elm);
1984
- }
2051
+ disposeTextSignal(elm);
1985
2052
  disposeAllSignalAttrs(elm);
1986
2053
  }
1987
2054
  vnode.$children$?.forEach(disposeSignalVNode);
1988
2055
  };
1989
2056
  /**
2057
+ * Tear down a text node's signal subscription, if it has one.
2058
+ * @param textNode the text node to unsubscribe
2059
+ */
2060
+ const disposeTextSignal = (textNode) => {
2061
+ const dispose = signalNodeDisposers.get(textNode);
2062
+ if (dispose) {
2063
+ dispose();
2064
+ signalNodeDisposers.delete(textNode);
2065
+ }
2066
+ };
2067
+ /**
2068
+ * Subscribe a text node to a signal, keeping its `data` in sync on every change.
2069
+ * @param textNode the text node to keep in sync
2070
+ * @param textSig the signal to subscribe to
2071
+ */
2072
+ const wireTextSignal = (textNode, textSig) => {
2073
+ signalNodeDisposers.set(textNode, effect(() => {
2074
+ textNode.data = String(textSig.value);
2075
+ }));
2076
+ };
2077
+ /**
1990
2078
  * Create a DOM Node corresponding to one of the children of a given VNode.
1991
2079
  *
1992
2080
  * @param oldParentVNode the parent VNode from the previous render
@@ -2008,13 +2096,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex) => {
2008
2096
  if (BUILD$1.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`);
2009
2097
  if (BUILD$1.vdomText && newVNode.$text$ != null) {
2010
2098
  elm = newVNode.$elm$ = win.document.createTextNode(newVNode.$text$);
2011
- if (BUILD$1.vdomSignals && newVNode.$signal$) {
2012
- const textSig = newVNode.$signal$;
2013
- const textNode = elm;
2014
- signalNodeDisposers.set(textNode, effect$1(() => {
2015
- textNode.data = String(textSig.value);
2016
- }));
2017
- }
2099
+ if (BUILD$1.vdomSignals && newVNode.$signal$) wireTextSignal(elm, newVNode.$signal$);
2018
2100
  } else if (BUILD$1.slotRelocation && newVNode.$flags$ & VNODE_FLAGS.isSlotReference) {
2019
2101
  elm = newVNode.$elm$ = BUILD$1.isDebug || BUILD$1.hydrateServerSide ? slotReferenceDebugNode(newVNode) : win.document.createTextNode("");
2020
2102
  if (typeof newVNode.$attrs$?.slot === "string") elm["s-sa"] = newVNode.$attrs$.slot;
@@ -2023,8 +2105,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex) => {
2023
2105
  if (BUILD$1.svg && !isSvgMode) isSvgMode = newVNode.$tag$ === "svg";
2024
2106
  if (!win.document) throw new Error("No DOM environment available for rendering.");
2025
2107
  const tag = !useNativeShadowDom && BUILD$1.slotRelocation && newVNode.$flags$ & VNODE_FLAGS.isSlotFallback ? "slot-fb" : newVNode.$tag$;
2026
- const _reg = getRegistry();
2027
- const registryOpts = _reg !== win.customElements && tag.includes("-") ? { customElementRegistry: _reg } : void 0;
2108
+ const registryOpts = hostRegistry !== win.customElements && tag.includes("-") ? { customElementRegistry: hostRegistry } : void 0;
2028
2109
  elm = newVNode.$elm$ = BUILD$1.svg && isSvgMode ? win.document.createElementNS(SVG_NS, tag) : win.document.createElement(tag, registryOpts);
2029
2110
  if (BUILD$1.svg && isSvgMode && newVNode.$tag$ === "foreignObject") isSvgMode = false;
2030
2111
  if (BUILD$1.vdomAttribute) updateElement(null, newVNode, isSvgMode);
@@ -2282,7 +2363,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
2282
2363
  }
2283
2364
  if (BUILD$1.vdomKey && idxInOld >= 0) {
2284
2365
  elmToMove = oldCh[idxInOld];
2285
- if (elmToMove.$tag$ !== newStartVnode.$tag$) node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
2366
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
2286
2367
  else {
2287
2368
  patch(elmToMove, newStartVnode, isInitialRender);
2288
2369
  oldCh[idxInOld] = void 0;
@@ -2375,7 +2456,17 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
2375
2456
  else if (BUILD$1.hydrateClientSide && isInitialRender && BUILD$1.updatable && oldChildren !== null && newChildren === null) newVNode.$children$ = oldChildren;
2376
2457
  if (BUILD$1.svg && isSvgMode && tag === "svg") isSvgMode = false;
2377
2458
  } else if (BUILD$1.vdomText && BUILD$1.slotRelocation && (defaultHolder = elm["s-cr"])) defaultHolder.parentNode.textContent = text;
2378
- else if (BUILD$1.vdomText && oldVNode.$text$ !== text) elm.data = text;
2459
+ else if (BUILD$1.vdomText) {
2460
+ if (BUILD$1.vdomSignals && newVNode.$signal$) {
2461
+ if (newVNode.$signal$ !== oldVNode.$signal$) {
2462
+ disposeTextSignal(elm);
2463
+ wireTextSignal(elm, newVNode.$signal$);
2464
+ }
2465
+ } else {
2466
+ if (BUILD$1.vdomSignals && oldVNode.$signal$) disposeTextSignal(elm);
2467
+ if (oldVNode.$text$ !== text) elm.data = text;
2468
+ }
2469
+ }
2379
2470
  };
2380
2471
  /**
2381
2472
  * Component-global information about nodes which are either currently being
@@ -2504,10 +2595,13 @@ const insertBefore = (parent, newNode, reference, isInitialLoad) => {
2504
2595
  if (BUILD$1.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
2505
2596
  else if (typeof newNode["s-sn"] === "string") {
2506
2597
  const hostElm = newNode["s-hn"] && parent.closest?.(newNode["s-hn"]);
2507
- if ((BUILD$1.lightDomPatches || BUILD$1.slotChildNodes || BUILD$1.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE) patchParentNode(newNode);
2598
+ if ((BUILD$1.lightDomPatches || BUILD$1.slotChildNodes || BUILD$1.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE) patchSlottedNode(newNode);
2508
2599
  parent.insertBefore(newNode, reference);
2509
2600
  const { slotNode } = findSlotFromSlottedNode(newNode);
2510
- if (slotNode && !isInitialLoad) dispatchSlotChangeEvent(slotNode);
2601
+ if (slotNode) {
2602
+ if (isInitialLoad) initialSlotChanges.add(slotNode);
2603
+ else dispatchSlotChangeEvent(slotNode);
2604
+ }
2511
2605
  return newNode;
2512
2606
  }
2513
2607
  }
@@ -2563,6 +2657,7 @@ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
2563
2657
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
2564
2658
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
2565
2659
  hostTagName = hostElm.tagName;
2660
+ hostRegistry = getHostRegistry(hostElm);
2566
2661
  if (BUILD$1.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) throw new Error(`The <Host> must be the single root component.
2567
2662
  Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
2568
2663
 
@@ -2662,6 +2757,11 @@ render() {
2662
2757
  if (checkSlotFallbackVisibility) updateFallbackSlotVisibility(rootVnode.$elm$);
2663
2758
  plt.$flags$ &= ~PLATFORM_FLAGS.isTmpDisconnected;
2664
2759
  relocateNodes.length = 0;
2760
+ if (initialSlotChanges.size) {
2761
+ const slotNodes = [...initialSlotChanges];
2762
+ initialSlotChanges.clear();
2763
+ nextTick(() => slotNodes.forEach(dispatchSlotChangeEvent));
2764
+ }
2665
2765
  }
2666
2766
  if (BUILD$1.slotRelocation && !useNativeShadowDom && !(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && hostElm["s-cr"]) {
2667
2767
  const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
@@ -2715,11 +2815,12 @@ const markFirstConnected = (hostRef) => {
2715
2815
  * autoloader, where the ancestor tag may not be defined yet.
2716
2816
  *
2717
2817
  * @param ancestorElm the nearest Stencil ancestor element
2818
+ * @param registry the registry the waiting component is defined in
2718
2819
  */
2719
- const awaitAncestorConnected = async (ancestorElm) => {
2820
+ const awaitAncestorConnected = async (ancestorElm, registry) => {
2720
2821
  let ancestorHostRef = getHostRef(ancestorElm);
2721
2822
  if (!BUILD$1.lazyLoad && !ancestorHostRef) {
2722
- await getRegistry().whenDefined(ancestorElm.tagName.toLowerCase());
2823
+ await registry.whenDefined(ancestorElm.tagName.toLowerCase());
2723
2824
  ancestorHostRef = getHostRef(ancestorElm);
2724
2825
  }
2725
2826
  if (ancestorHostRef && !(ancestorHostRef.$flags$ & HOST_FLAGS.hasFiredConnected)) await ensureFirstConnectPromise(ancestorHostRef);
@@ -3075,8 +3176,7 @@ const initializeSignals = (elm, hostRef, cmpMeta) => {
3075
3176
  const instance = BUILD$1.lazyLoad ? hostRef.$lazyInstance$ : elm;
3076
3177
  for (const [memberName, [memberFlags]] of Object.entries(cmpMeta.$members$ ?? {})) {
3077
3178
  if (!(memberFlags & MEMBER_FLAGS.PropLike)) continue;
3078
- const initialVal = hostRef.$instanceValues$.get(memberName);
3079
- const sig = signal(initialVal);
3179
+ const sig = signal(hostRef.$instanceValues$.get(memberName));
3080
3180
  hostRef.$signalValues$.set(memberName, sig);
3081
3181
  let prevScheduleVal = sig.peek();
3082
3182
  disposers.push(effect(() => {
@@ -3204,9 +3304,7 @@ const h = (nodeName, vnodeData, ...children) => {
3204
3304
  if (classData && !(BUILD$1.vdomSignals && isSignalLike(classData))) vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
3205
3305
  }
3206
3306
  }
3207
- if (BUILD$1.isDev && vNodeChildren.some(isHost)) consoleDevError(`The <Host> must be the single root component. Make sure:
3208
- - You are NOT using hostData() and <Host> in the same component.
3209
- - <Host> is used once, and it's the single root component of the render() function.`);
3307
+ if (BUILD$1.isDev && vNodeChildren.some(isHost)) consoleDevError(`The <Host> must be used once, and be the single root component of the render() function.`);
3210
3308
  if (BUILD$1.vdomFunctional && typeof nodeName === "function") return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
3211
3309
  const vnode = newVNode(nodeName, null);
3212
3310
  vnode.$attrs$ = vnodeData;
@@ -3259,17 +3357,23 @@ const vdomFnUtils = {
3259
3357
  * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
3260
3358
  * friendlier public interface (hence, 'convertToPublic').
3261
3359
  *
3262
- * @param node the virtual DOM node to convert
3360
+ * Functional components receive primitive children unwrapped, so those
3361
+ * become text-only child nodes.
3362
+ *
3363
+ * @param node the virtual DOM node (or primitive child) to convert
3263
3364
  * @returns a converted child node
3264
3365
  */
3265
- const convertToPublic = (node) => ({
3366
+ const convertToPublic = (node) => typeof node !== "object" ? {
3367
+ vtag: null,
3368
+ vtext: String(node)
3369
+ } : {
3266
3370
  vattrs: node.$attrs$,
3267
3371
  vchildren: node.$children$,
3268
3372
  vkey: node.$key$,
3269
3373
  vname: node.$name$,
3270
3374
  vtag: node.$tag$,
3271
3375
  vtext: node.$text$
3272
- });
3376
+ };
3273
3377
  /**
3274
3378
  * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
3275
3379
  * order to use the resulting object in the virtual DOM. The initial object was
@@ -3286,11 +3390,11 @@ const convertToPrivate = (node) => {
3286
3390
  if (node.vname) vnodeData.name = node.vname;
3287
3391
  return h(node.vtag, vnodeData, ...node.vchildren || []);
3288
3392
  }
3289
- const vnode = newVNode(node.vtag, node.vtext);
3290
- vnode.$attrs$ = node.vattrs;
3291
- vnode.$children$ = node.vchildren;
3292
- vnode.$key$ = node.vkey;
3293
- vnode.$name$ = node.vname;
3393
+ const vnode = newVNode(node.vtag ?? null, node.vtext);
3394
+ vnode.$attrs$ = node.vattrs ?? null;
3395
+ vnode.$children$ = node.vchildren ?? null;
3396
+ vnode.$key$ = node.vkey ?? null;
3397
+ vnode.$name$ = node.vname ?? null;
3294
3398
  return vnode;
3295
3399
  };
3296
3400
  /**
@@ -3410,7 +3514,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
3410
3514
  }
3411
3515
  addSlotRelocateNode(siNode, siSlot, false, siNode["s-oo"] || currentPos);
3412
3516
  if (siNode.parentElement?.shadowRoot && siNode["getAttribute"] && siNode.getAttribute("slot")) siNode.removeAttribute("slot");
3413
- if (BUILD$1.lightDomPatches || BUILD$1.slotChildNodes || BUILD$1.patchAll && hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll) patchSlottedNode(siNode);
3517
+ if (BUILD$1.lightDomPatches || BUILD$1.slotChildNodes || BUILD$1.patchAll && hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll) patchSsrSlottedNode(siNode);
3414
3518
  }
3415
3519
  currentPos = (siNode["s-oo"] || currentPos) + 1;
3416
3520
  }
@@ -3588,6 +3692,7 @@ const initializeDocumentHydrate = (node, orgLocNodes) => {
3588
3692
  const createSimpleVNode = (vnode) => ({
3589
3693
  $flags$: 0,
3590
3694
  $index$: "0",
3695
+ $children$: null,
3591
3696
  ...vnode
3592
3697
  });
3593
3698
  function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) {
@@ -3982,7 +4087,7 @@ const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector)
3982
4087
  else return shallowPart.trim();
3983
4088
  }).join(", ");
3984
4089
  };
3985
- const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer");
4090
+ const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer") || selector.startsWith("@container");
3986
4091
  const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
3987
4092
  return processRules(cssText, (rule) => {
3988
4093
  let selector = rule.selector;
@@ -4101,8 +4206,11 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
4101
4206
  };
4102
4207
  //#endregion
4103
4208
  //#region src/runtime/mode.ts
4104
- const computeMode = (elm) => modeResolutionChain.map((h) => h(elm)).find((m) => !!m);
4105
- const setMode = (handler) => modeResolutionChain.push(handler);
4209
+ const computeMode = (elm) => modeResolver.map((h) => h(elm)).find((m) => !!m);
4210
+ const setMode = (handler) => {
4211
+ modeResolver.length = 0;
4212
+ modeResolver.push(handler);
4213
+ };
4106
4214
  const getMode = (ref) => getHostRef(ref)?.$modeName$;
4107
4215
  //#endregion
4108
4216
  //#region src/runtime/normalize-watchers.ts
@@ -4167,23 +4275,14 @@ const normalizeWatchers = (raw) => {
4167
4275
  *
4168
4276
  * @param propValue the new value to coerce to some type
4169
4277
  * @param propType the type of the prop, expressed as a binary number
4170
- * @param isFormAssociated whether the component is form-associated (optional)
4171
4278
  * @returns the parsed/coerced value
4172
4279
  */
4173
- const parsePropertyValue = (propValue, propType, isFormAssociated) => {
4280
+ const parsePropertyValue = (propValue, propType) => {
4174
4281
  if (propValue != null && !isComplexType(propValue)) {
4175
4282
  /**
4176
4283
  * ensure this value is of the correct prop type
4177
4284
  */
4178
- if (BUILD$1.propBoolean && propType & MEMBER_FLAGS.Boolean) {
4179
- /**
4180
- * For form-associated components, according to HTML spec, the presence of any boolean attribute
4181
- * (regardless of its value, even "false") should make the property true.
4182
- * For non-form-associated components, we maintain the legacy behavior where "false" becomes false.
4183
- */
4184
- if (BUILD$1.formAssociated && isFormAssociated && typeof propValue === "string") return propValue === "" || !!propValue;
4185
- else return propValue === "false" ? false : propValue === "" || !!propValue;
4186
- }
4285
+ if (BUILD$1.propBoolean && propType & MEMBER_FLAGS.Boolean) return propValue === "" || !!propValue;
4187
4286
  /**
4188
4287
  * force it to be a number
4189
4288
  */
@@ -4225,7 +4324,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
4225
4324
  if (BUILD$1.signalBacking) {
4226
4325
  const sig = hostRef?.$signalValues$?.get(propName);
4227
4326
  if (sig !== void 0) {
4228
- const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0], BUILD$1.formAssociated && !!(cmpMeta.$flags$ & CMP_FLAGS.formAssociated));
4327
+ const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
4229
4328
  if (BUILD$1.serializer && BUILD$1.reflect && cmpMeta.$attrsToReflect$ && cmpMeta.$serializers$?.[propName]) {
4230
4329
  const elm = BUILD$1.lazyLoad ? hostRef.$hostElement$ : ref;
4231
4330
  applySerializers(hostRef, cmpMeta, propName, parsed, BUILD$1.lazyLoad ? hostRef.$lazyInstance$ : elm);
@@ -4243,7 +4342,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
4243
4342
  const oldVal = hostRef.$instanceValues$.get(propName);
4244
4343
  const flags = hostRef.$flags$;
4245
4344
  const instance = BUILD$1.lazyLoad ? hostRef.$lazyInstance$ : elm;
4246
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0], BUILD$1.formAssociated && !!(cmpMeta.$flags$ & CMP_FLAGS.formAssociated));
4345
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
4247
4346
  const didValueChange = newVal !== oldVal && !(Number.isNaN(oldVal) && Number.isNaN(newVal));
4248
4347
  if ((!BUILD$1.lazyLoad || !(flags & HOST_FLAGS.isConstructingInstance) || oldVal === void 0) && didValueChange) {
4249
4348
  hostRef.$instanceValues$.set(propName, newVal);
@@ -4292,6 +4391,22 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
4292
4391
  */
4293
4392
  const reflectedAttrValue = (propValue) => propValue == null || propValue === false ? null : propValue === true ? "" : String(propValue);
4294
4393
  /**
4394
+ * Hand values written to a lazy component's element before its instance existed to the
4395
+ * instance's own `@Prop` setters. Must run as soon as the instance is constructed, so that
4396
+ * whenever `$lazyInstance$` is set, reads through it agree with the element's last write.
4397
+ *
4398
+ * @param hostRef the runtime bookkeeping object of a freshly constructed lazy instance
4399
+ * @param cmpMeta runtime metadata for the component (with any run-time only setters flagged)
4400
+ */
4401
+ const replayPendingSetterValues = (hostRef, cmpMeta) => {
4402
+ const instance = hostRef.$lazyInstance$;
4403
+ if (!instance) return;
4404
+ for (const [memberName, [memberFlags]] of Object.entries(cmpMeta.$members$ ?? {})) if (memberFlags & MEMBER_FLAGS.Setter && hostRef.$instanceValues$.has(memberName)) {
4405
+ const pendingValue = hostRef.$instanceValues$.get(memberName);
4406
+ if (instance[memberName] !== pendingValue) instance[memberName] = pendingValue;
4407
+ }
4408
+ };
4409
+ /**
4295
4410
  * Attach a series of runtime constructs to a compiled Stencil component
4296
4411
  * constructor, including getters and setters for the `@Prop` and `@State`
4297
4412
  * decorators, callbacks for when attributes change, and so on.
@@ -4348,9 +4463,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
4348
4463
  if (BUILD$1.lazyLoad) {
4349
4464
  if ((cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Getter) === 0) return getValue(this, memberName);
4350
4465
  const ref = getHostRef(this);
4351
- const instance = ref ? ref.$lazyInstance$ : prototype;
4352
- if (!instance) return;
4353
- return instance[memberName];
4466
+ if (!ref) return prototype[memberName];
4467
+ return ref.$lazyInstance$ ? ref.$lazyInstance$[memberName] : getValue(this, memberName);
4354
4468
  }
4355
4469
  if (!BUILD$1.lazyLoad) return origGetter ? origGetter.apply(this) : getValue(this, memberName);
4356
4470
  },
@@ -4365,7 +4479,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
4365
4479
  }
4366
4480
  if (origSetter) {
4367
4481
  if (typeof (memberFlags & MEMBER_FLAGS.State ? this[memberName] : ref.$hostElement$[memberName]) === "undefined" && ref.$instanceValues$.get(memberName)) newValue = ref.$instanceValues$.get(memberName);
4368
- origSetter.apply(this, [parsePropertyValue(newValue, memberFlags, BUILD$1.formAssociated && !!(cmpMeta.$flags$ & CMP_FLAGS.formAssociated))]);
4482
+ origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
4369
4483
  newValue = memberFlags & MEMBER_FLAGS.State ? this[memberName] : ref.$hostElement$[memberName];
4370
4484
  setValue(this, memberName, newValue, cmpMeta);
4371
4485
  return;
@@ -4377,21 +4491,15 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
4377
4491
  if (BUILD$1.lazyLoad) {
4378
4492
  if ((flags & PROXY_FLAGS.isElementConstructor) === 0 || (cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Setter) === 0) {
4379
4493
  setValue(this, memberName, newValue, cmpMeta);
4380
- if (flags & PROXY_FLAGS.isElementConstructor && !ref.$lazyInstance$) ref.$fetchedCbList$.push(() => {
4381
- if (cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Setter && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) ref.$lazyInstance$[memberName] = newValue;
4382
- });
4383
4494
  return;
4384
4495
  }
4385
- const setterSetVal = () => {
4496
+ const parsedValue = parsePropertyValue(newValue, memberFlags);
4497
+ if (ref.$lazyInstance$) {
4386
4498
  const currentValue = ref.$lazyInstance$[memberName];
4387
4499
  if (!ref.$instanceValues$.get(memberName) && currentValue) ref.$instanceValues$.set(memberName, currentValue);
4388
- ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, memberFlags, BUILD$1.formAssociated && !!(cmpMeta.$flags$ & CMP_FLAGS.formAssociated));
4500
+ ref.$lazyInstance$[memberName] = parsedValue;
4389
4501
  setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
4390
- };
4391
- if (ref.$lazyInstance$) setterSetVal();
4392
- else ref.$fetchedCbList$.push(() => {
4393
- setterSetVal();
4394
- });
4502
+ } else ref.$instanceValues$.set(memberName, parsedValue);
4395
4503
  }
4396
4504
  } });
4397
4505
  } else if (BUILD$1.lazyLoad && BUILD$1.method && flags & PROXY_FLAGS.isElementConstructor && memberFlags & MEMBER_FLAGS.Method) Object.defineProperty(prototype, memberName, { value(...args) {
@@ -4443,7 +4551,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
4443
4551
  const isBooleanTarget = propMemberFlags & MEMBER_FLAGS.Boolean;
4444
4552
  if (BUILD$1.reflect && propMemberFlags & MEMBER_FLAGS.ReflectAttr && propMemberFlags & MEMBER_FLAGS.Any && !isComplexType(this[propName]) && reflectedAttrValue(this[propName]) === newValue) return;
4445
4553
  const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
4446
- if (isBooleanTarget) newValue = !(newValue === null || newValue === "false");
4554
+ if (isBooleanTarget) {
4555
+ if (BUILD$1.isDev && newValue === "false") consoleDevWarn(`<${cmpMeta.$tagName$} ${attrName}="false">: boolean attributes are true when present, regardless of value. Remove the attribute or set the "${propName}" property to false instead.`);
4556
+ newValue = newValue !== null;
4557
+ }
4447
4558
  const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
4448
4559
  if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) this[propName] = newValue;
4449
4560
  });
@@ -4506,9 +4617,12 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
4506
4617
  } catch (e) {
4507
4618
  consoleError(e, elm);
4508
4619
  }
4509
- if (BUILD$1.member) hostRef.$flags$ &= ~HOST_FLAGS.isConstructingInstance;
4620
+ if (BUILD$1.member) {
4621
+ hostRef.$flags$ &= ~HOST_FLAGS.isConstructingInstance;
4622
+ replayPendingSetterValues(hostRef, cmpMeta);
4623
+ }
4510
4624
  endNewInstance();
4511
- if (BUILD$1.asyncLoading && hostRef.$ancestorComponent$) await awaitAncestorConnected(hostRef.$ancestorComponent$);
4625
+ if (BUILD$1.asyncLoading && hostRef.$ancestorComponent$) await awaitAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(elm));
4512
4626
  if (!(BUILD$1.slotRelocation && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation)) {
4513
4627
  fireConnectedCallback(hostRef.$lazyInstance$, elm);
4514
4628
  if (BUILD$1.asyncLoading) markFirstConnected(hostRef);
@@ -4608,9 +4722,16 @@ const connectedCallback = (elm) => {
4608
4722
  }
4609
4723
  if (BUILD$1.asyncLoading) {
4610
4724
  let ancestorComponent = elm;
4611
- while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) if (BUILD$1.hydrateClientSide && ancestorComponent.nodeType === NODE_TYPE.ElementNode && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
4612
- attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
4613
- break;
4725
+ while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
4726
+ if (BUILD$1.hydrateClientSide && !ancestorComponent["s-p"] && ancestorComponent.nodeType === NODE_TYPE.ElementNode && ancestorComponent.hasAttribute("s-id")) {
4727
+ ancestorComponent["s-p"] = [];
4728
+ ancestorComponent["s-rc"] = [];
4729
+ ancestorComponent["s-pc"] = [];
4730
+ }
4731
+ if (ancestorComponent["s-p"]) {
4732
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
4733
+ break;
4734
+ }
4614
4735
  }
4615
4736
  }
4616
4737
  if (BUILD$1.prop && !BUILD$1.hydrateServerSide && cmpMeta.$members$) Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
@@ -4726,48 +4847,45 @@ const hmrStandalone = async (hostElement, cmpMeta, hmrVersionId) => {
4726
4847
  `${modulePath}?s-hmr=${hmrVersionId}`
4727
4848
  );
4728
4849
  const NewClass = Object.values(newModule).find((v) => typeof v === "function" && v.is === cmpMeta.$tagName$) ?? newModule.default;
4729
- if (!NewClass) return;
4730
- const ctor = customElements.get(cmpMeta.$tagName$);
4731
- if (ctor) {
4732
- for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
4733
- if (key === "constructor") continue;
4734
- Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
4735
- }
4736
- const styleDesc = Object.getOwnPropertyDescriptor(NewClass, "style");
4737
- if (styleDesc) {
4738
- Object.defineProperty(ctor, "style", styleDesc);
4739
- const newStyle = NewClass.style;
4740
- if (newStyle) {
4741
- const scopeId = getScopeId(cmpMeta);
4742
- const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
4743
- console.log("[stencil-hmr] registerStyle", {
4744
- tag: cmpMeta.$tagName$,
4745
- scopeId,
4746
- isShadow,
4747
- cssLen: newStyle.length
4748
- });
4749
- registerStyle(scopeId, newStyle, isShadow);
4750
- }
4751
- }
4752
- }
4753
- const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
4754
- document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => {
4755
- const hostRef = getHostRef(el);
4756
- if (BUILD$1.hostListener && hostRef?.$rmListeners$) {
4757
- hostRef.$rmListeners$.map((rmListener) => rmListener());
4758
- hostRef.$rmListeners$ = void 0;
4759
- addHostEventListeners(el, hostRef, cmpMeta.$listeners$);
4760
- }
4761
- if (!isShadow && hostRef) {
4762
- console.log("[stencil-hmr] calling attachStyles for", cmpMeta.$tagName$);
4763
- attachStyles(hostRef);
4764
- }
4765
- forceUpdate(el);
4766
- });
4850
+ if (NewClass) hmrApplyClass(cmpMeta, NewClass);
4767
4851
  } catch (e) {
4768
4852
  console.error(`[Stencil HMR] Failed to reload <${cmpMeta.$tagName$}>`, e);
4769
4853
  }
4770
4854
  };
4855
+ /**
4856
+ * Patch a re-executed component class onto the registered one and re-render every live instance.
4857
+ * Shared by the standalone re-import above and bundlers that re-execute the module themselves
4858
+ * (webpack/rspack `module.hot`), which reach it via the constructor's `s-hmr-apply` hook.
4859
+ *
4860
+ * @param cmpMeta runtime metadata for the component
4861
+ * @param NewClass the component's newly executed class
4862
+ */
4863
+ const hmrApplyClass = (cmpMeta, NewClass) => {
4864
+ const ctor = customElements.get(cmpMeta.$tagName$);
4865
+ const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
4866
+ if (ctor && ctor !== NewClass) {
4867
+ for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
4868
+ if (key === "constructor") continue;
4869
+ Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
4870
+ }
4871
+ const styleDesc = Object.getOwnPropertyDescriptor(NewClass, "style");
4872
+ if (styleDesc) {
4873
+ Object.defineProperty(ctor, "style", styleDesc);
4874
+ const newStyle = NewClass.style;
4875
+ if (newStyle) registerStyle(getScopeId(cmpMeta), newStyle, isShadow);
4876
+ }
4877
+ }
4878
+ document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => {
4879
+ const hostRef = getHostRef(el);
4880
+ if (BUILD$1.hostListener && hostRef?.$rmListeners$) {
4881
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
4882
+ hostRef.$rmListeners$ = void 0;
4883
+ addHostEventListeners(el, hostRef, cmpMeta.$listeners$);
4884
+ }
4885
+ if (!isShadow && hostRef) attachStyles(hostRef);
4886
+ forceUpdate(el);
4887
+ });
4888
+ };
4771
4889
  //#endregion
4772
4890
  //#region src/runtime/bootstrap-standalone.ts
4773
4891
  const defineCustomElement = (Cstr, compactMeta) => {
@@ -4790,9 +4908,12 @@ const proxyCustomElement = (Cstr, compactMeta) => {
4790
4908
  cmpMeta.$serializers$ = Cstr.$serializers$;
4791
4909
  }
4792
4910
  if (BUILD$1.reflect) cmpMeta.$attrsToReflect$ = [];
4793
- if (BUILD$1.hotModuleReplacement) Cstr.prototype["s-hmr"] = function(hmrVersionId) {
4794
- hmrStart(this, cmpMeta, hmrVersionId);
4795
- };
4911
+ if (BUILD$1.hotModuleReplacement) {
4912
+ Cstr.prototype["s-hmr"] = function(hmrVersionId) {
4913
+ hmrStart(this, cmpMeta, hmrVersionId);
4914
+ };
4915
+ Cstr["s-hmr-apply"] = (NewClass) => hmrApplyClass(cmpMeta, NewClass);
4916
+ }
4796
4917
  if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && (BUILD$1.slotCloneNode || BUILD$1.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone)) patchCloneNode(Cstr.prototype);
4797
4918
  if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) {
4798
4919
  if (BUILD$1.lightDomPatches || BUILD$1.patchAll && cmpMeta.$flags$ & CMP_FLAGS.patchAll) applyLightDomPatches(Cstr.prototype);
@@ -4831,7 +4952,7 @@ const proxyCustomElement = (Cstr, compactMeta) => {
4831
4952
  }
4832
4953
  connectedCallback(this);
4833
4954
  if (BUILD$1.asyncLoading && hostRef && hostRef.$ancestorComponent$) {
4834
- await awaitAncestorConnected(hostRef.$ancestorComponent$);
4955
+ await awaitAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(this));
4835
4956
  if (!this.isConnected) return;
4836
4957
  }
4837
4958
  if (originalConnectedCallback && (plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected) === 0) originalConnectedCallback.call(this);
@@ -5146,7 +5267,7 @@ function Mixin(...mixins) {
5146
5267
  //#region src/runtime/nonce.ts
5147
5268
  /**
5148
5269
  * Assigns the given value to the nonce property on the runtime platform object.
5149
- * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
5270
+ * During runtime, this value is used to set the nonce attribute on all dynamically created style tags.
5150
5271
  * @param nonce The value to be assigned to the platform nonce property.
5151
5272
  * @returns void
5152
5273
  */
@@ -5308,4 +5429,4 @@ function hasKeys(obj) {
5308
5429
  return false;
5309
5430
  }
5310
5431
  //#endregion
5311
- export { AttachInternals, AttrDeserialize, BUILD, Build, Component, Element$1 as Element, Env, Event, Fragment, H, H as HTMLElement, HYDRATED_STYLE_ID, Host, Listen, Method, Mixin, NAMESPACE, Prop, PropSerialize, ReactiveControllerHost, STENCIL_DEV_MODE, State, Watch, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, injectSideEffectStyle, isMemberInElement, jsx, jsxDEV, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, normalizeWatchers, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, readTask, registerHost, registerInstance, registerSideEffectStyleTarget, render, resolveVar, setAssetPath, setErrorHandler, setLazyLoadBasePath, setMode, setNonce, setPlatformHelpers, setPlatformOptions, setRegistry, setScopedSsr, setTagTransformer, setValue, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, transformTag, unregisterSideEffectStyleTarget, win, writeTask };
5432
+ export { AttachInternals, AttrDeserialize, BUILD, Build, Component, Element$1 as Element, Env, Event, Fragment, H, H as HTMLElement, HYDRATED_STYLE_ID, Host, Listen, Method, Mixin, NAMESPACE, Prop, PropSerialize, ReactiveControllerHost, STENCIL_DEV_MODE, State, Watch, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, injectSideEffectStyle, isMemberInElement, jsx, jsxDEV, jsxs, loadModule, modeResolver, needsScopedSSR, nextTick, normalizeWatchers, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, readTask, registerHost, registerInstance, registerSideEffectStyleTarget, render, resolveVar, setAssetPath, setErrorHandler, setLazyLoadBasePath, setMode, setNonce, setPlatformHelpers, setPlatformOptions, setRegistry, setScopedSSR, setTagTransformer, setValue, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, transformTag, unregisterSideEffectStyleTarget, win, writeTask };