@stencil/core 5.0.0-beta.2 → 5.0.0-beta.21

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 (35) hide show
  1. package/dist/app-data/index.d.ts +1 -1
  2. package/dist/{client-BRu0GtRn.mjs → client-CVXS3JZ-.mjs} +105 -60
  3. package/dist/compiler/browser.d.ts +110 -79
  4. package/dist/compiler/browser.js +571 -269
  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-C8yf59oh.mjs → compiler-ApS_Tn_4.mjs} +4460 -2742
  9. package/dist/declarations/stencil-public-compiler.d.ts +144 -120
  10. package/dist/declarations/stencil-public-docs.d.ts +23 -0
  11. package/dist/declarations/stencil-public-runtime.d.ts +60 -58
  12. package/dist/{index-BopBfjPu.d.mts → index-B9-Byy8z.d.mts} +142 -118
  13. package/dist/{index-BXAcVN2j.d.ts → index-BHciXst1.d.ts} +57 -55
  14. package/dist/{index-DmHmu3y0.d.mts → index-Dz1G9pWZ.d.mts} +2 -2
  15. package/dist/index.d.mts +3 -0
  16. package/dist/index.mjs +1 -1
  17. package/dist/jsx-runtime.mjs +1 -1
  18. package/dist/{node-75gQKkFz.mjs → node-Bz2SOK7_.mjs} +6 -35
  19. package/dist/runtime/client/lazy.js +228 -180
  20. package/dist/runtime/client/runtime.d.ts +67 -66
  21. package/dist/runtime/client/runtime.js +228 -180
  22. package/dist/runtime/index.d.ts +4 -5
  23. package/dist/runtime/index.js +226 -178
  24. package/dist/runtime/server/index.d.mts +11 -11
  25. package/dist/runtime/server/index.mjs +287 -220
  26. package/dist/runtime/server/runner.d.mts +4 -4
  27. package/dist/runtime/server/runner.mjs +82 -54
  28. package/dist/signals/index.d.ts +11 -2
  29. package/dist/signals/index.js +11 -1
  30. package/dist/sys/node/index.d.mts +1 -1
  31. package/dist/sys/node/index.mjs +1 -1
  32. package/dist/sys/node/worker.mjs +2 -2
  33. package/dist/testing/index.d.mts +129 -112
  34. package/dist/testing/index.mjs +244 -193
  35. package/package.json +8 -4
@@ -1,11 +1,80 @@
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
5
74
  const Build = {
6
- isDev: BUILD$1.isDev,
7
75
  isBrowser: true,
8
76
  isServer: false,
77
+ isDev: BUILD$1.isDev,
9
78
  isTesting: BUILD$1.isTesting
10
79
  };
11
80
  //#endregion
@@ -488,79 +557,10 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
488
557
  //#endregion
489
558
  //#region src/client/client-style.ts
490
559
  const styles = /*@__PURE__*/ new Map();
491
- const modeResolutionChain = [];
492
- const setScopedSsr = (_opts) => {};
560
+ const modeResolver = [];
561
+ const setScopedSSR = (_opts) => {};
493
562
  const needsScopedSSR = () => false;
494
563
  //#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
564
  //#region src/client/client-window.ts
565
565
  const win = typeof window !== "undefined" ? window : {};
566
566
  const H = win.HTMLElement || class {};
@@ -601,7 +601,7 @@ let queuePending = false;
601
601
  const queueDomReads = [];
602
602
  const queueDomWrites = [];
603
603
  const queueDomWritesLow = [];
604
- const scheduleFlush = () => win.document?.hidden ? nextTick(flush) : plt.raf(flush);
604
+ const scheduleFlush = () => win.document?.hidden ? setTimeout(flush, 16) : plt.raf(flush);
605
605
  const queueTask = (queue, write) => (cb) => {
606
606
  queue.push(cb);
607
607
  if (!queuePending) {
@@ -1685,6 +1685,13 @@ const isComplexType = (o) => {
1685
1685
  return o === "object" || o === "function";
1686
1686
  };
1687
1687
  //#endregion
1688
+ //#region src/runtime/signals-core.ts
1689
+ const getCore = () => globalThis[Symbol.for("stencil.preact-signals-core")] ??= SignalsCore;
1690
+ const effect = (fn, options) => getCore().effect(fn, options);
1691
+ function signal(value, options) {
1692
+ return getCore().signal(value, options);
1693
+ }
1694
+ //#endregion
1688
1695
  //#region src/runtime/event-emitter.ts
1689
1696
  const createEvent = (ref, name, flags) => {
1690
1697
  const elm = getElement(ref);
@@ -1717,6 +1724,11 @@ const setRegistry = (registry) => {
1717
1724
  _registry = registry;
1718
1725
  };
1719
1726
  const getRegistry = () => _registry ?? customElements;
1727
+ /**
1728
+ * @param elm a defined component host
1729
+ * @returns the registry the host's class was defined in, else the active registry
1730
+ */
1731
+ const getHostRegistry = (elm) => elm.constructor._registry ?? getRegistry();
1720
1732
  //#endregion
1721
1733
  //#region src/runtime/vdom/set-accessor.ts
1722
1734
  /**
@@ -1760,7 +1772,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
1760
1772
  attrMap.get(memberName)?.();
1761
1773
  if (!signalAttrDisposers.has(elm)) signalAttrDisposers.set(elm, attrMap);
1762
1774
  let prevVal = oldValue;
1763
- attrMap.set(memberName, effect$1(() => {
1775
+ attrMap.set(memberName, effect(() => {
1764
1776
  const curVal = newValue.value;
1765
1777
  setAccessor(elm, memberName, prevVal, curVal, isSvg, flags);
1766
1778
  prevVal = curVal;
@@ -1840,10 +1852,10 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
1840
1852
  const isComplex = isComplexType(newValue);
1841
1853
  if (!BUILD$1.lazyLoad) {
1842
1854
  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())) {
1855
+ if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" && !customElements.get(elm.tagName.toLowerCase())) {
1844
1856
  if (!elm["s-pp"]) elm["s-pp"] = /* @__PURE__ */ new Map();
1845
1857
  elm["s-pp"].set(memberName, newValue);
1846
- return;
1858
+ if (isComplex || /[A-Z]/.test(memberName)) return;
1847
1859
  }
1848
1860
  }
1849
1861
  if ((isProp || isComplex && newValue !== null) && !isSvg) try {
@@ -1961,6 +1973,7 @@ function sortedAttrNames(attrNames) {
1961
1973
  let scopeId;
1962
1974
  let contentRef;
1963
1975
  let hostTagName;
1976
+ let hostRegistry;
1964
1977
  let useNativeShadowDom = false;
1965
1978
  let checkSlotFallbackVisibility = false;
1966
1979
  let checkSlotRelocate = false;
@@ -1977,16 +1990,33 @@ const signalNodeDisposers = /* @__PURE__ */ new WeakMap();
1977
1990
  const disposeSignalVNode = (vnode) => {
1978
1991
  const elm = vnode.$elm$;
1979
1992
  if (elm) {
1980
- const dispose = signalNodeDisposers.get(elm);
1981
- if (dispose) {
1982
- dispose();
1983
- signalNodeDisposers.delete(elm);
1984
- }
1993
+ disposeTextSignal(elm);
1985
1994
  disposeAllSignalAttrs(elm);
1986
1995
  }
1987
1996
  vnode.$children$?.forEach(disposeSignalVNode);
1988
1997
  };
1989
1998
  /**
1999
+ * Tear down a text node's signal subscription, if it has one.
2000
+ * @param textNode the text node to unsubscribe
2001
+ */
2002
+ const disposeTextSignal = (textNode) => {
2003
+ const dispose = signalNodeDisposers.get(textNode);
2004
+ if (dispose) {
2005
+ dispose();
2006
+ signalNodeDisposers.delete(textNode);
2007
+ }
2008
+ };
2009
+ /**
2010
+ * Subscribe a text node to a signal, keeping its `data` in sync on every change.
2011
+ * @param textNode the text node to keep in sync
2012
+ * @param textSig the signal to subscribe to
2013
+ */
2014
+ const wireTextSignal = (textNode, textSig) => {
2015
+ signalNodeDisposers.set(textNode, effect(() => {
2016
+ textNode.data = String(textSig.value);
2017
+ }));
2018
+ };
2019
+ /**
1990
2020
  * Create a DOM Node corresponding to one of the children of a given VNode.
1991
2021
  *
1992
2022
  * @param oldParentVNode the parent VNode from the previous render
@@ -2008,13 +2038,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex) => {
2008
2038
  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
2039
  if (BUILD$1.vdomText && newVNode.$text$ != null) {
2010
2040
  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
- }
2041
+ if (BUILD$1.vdomSignals && newVNode.$signal$) wireTextSignal(elm, newVNode.$signal$);
2018
2042
  } else if (BUILD$1.slotRelocation && newVNode.$flags$ & VNODE_FLAGS.isSlotReference) {
2019
2043
  elm = newVNode.$elm$ = BUILD$1.isDebug || BUILD$1.hydrateServerSide ? slotReferenceDebugNode(newVNode) : win.document.createTextNode("");
2020
2044
  if (typeof newVNode.$attrs$?.slot === "string") elm["s-sa"] = newVNode.$attrs$.slot;
@@ -2023,8 +2047,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex) => {
2023
2047
  if (BUILD$1.svg && !isSvgMode) isSvgMode = newVNode.$tag$ === "svg";
2024
2048
  if (!win.document) throw new Error("No DOM environment available for rendering.");
2025
2049
  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;
2050
+ const registryOpts = hostRegistry !== win.customElements && tag.includes("-") ? { customElementRegistry: hostRegistry } : void 0;
2028
2051
  elm = newVNode.$elm$ = BUILD$1.svg && isSvgMode ? win.document.createElementNS(SVG_NS, tag) : win.document.createElement(tag, registryOpts);
2029
2052
  if (BUILD$1.svg && isSvgMode && newVNode.$tag$ === "foreignObject") isSvgMode = false;
2030
2053
  if (BUILD$1.vdomAttribute) updateElement(null, newVNode, isSvgMode);
@@ -2282,7 +2305,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
2282
2305
  }
2283
2306
  if (BUILD$1.vdomKey && idxInOld >= 0) {
2284
2307
  elmToMove = oldCh[idxInOld];
2285
- if (elmToMove.$tag$ !== newStartVnode.$tag$) node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
2308
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
2286
2309
  else {
2287
2310
  patch(elmToMove, newStartVnode, isInitialRender);
2288
2311
  oldCh[idxInOld] = void 0;
@@ -2375,7 +2398,17 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
2375
2398
  else if (BUILD$1.hydrateClientSide && isInitialRender && BUILD$1.updatable && oldChildren !== null && newChildren === null) newVNode.$children$ = oldChildren;
2376
2399
  if (BUILD$1.svg && isSvgMode && tag === "svg") isSvgMode = false;
2377
2400
  } 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;
2401
+ else if (BUILD$1.vdomText) {
2402
+ if (BUILD$1.vdomSignals && newVNode.$signal$) {
2403
+ if (newVNode.$signal$ !== oldVNode.$signal$) {
2404
+ disposeTextSignal(elm);
2405
+ wireTextSignal(elm, newVNode.$signal$);
2406
+ }
2407
+ } else {
2408
+ if (BUILD$1.vdomSignals && oldVNode.$signal$) disposeTextSignal(elm);
2409
+ if (oldVNode.$text$ !== text) elm.data = text;
2410
+ }
2411
+ }
2379
2412
  };
2380
2413
  /**
2381
2414
  * Component-global information about nodes which are either currently being
@@ -2563,6 +2596,7 @@ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
2563
2596
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
2564
2597
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
2565
2598
  hostTagName = hostElm.tagName;
2599
+ hostRegistry = getHostRegistry(hostElm);
2566
2600
  if (BUILD$1.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) throw new Error(`The <Host> must be the single root component.
2567
2601
  Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
2568
2602
 
@@ -2715,11 +2749,12 @@ const markFirstConnected = (hostRef) => {
2715
2749
  * autoloader, where the ancestor tag may not be defined yet.
2716
2750
  *
2717
2751
  * @param ancestorElm the nearest Stencil ancestor element
2752
+ * @param registry the registry the waiting component is defined in
2718
2753
  */
2719
- const awaitAncestorConnected = async (ancestorElm) => {
2754
+ const awaitAncestorConnected = async (ancestorElm, registry) => {
2720
2755
  let ancestorHostRef = getHostRef(ancestorElm);
2721
2756
  if (!BUILD$1.lazyLoad && !ancestorHostRef) {
2722
- await getRegistry().whenDefined(ancestorElm.tagName.toLowerCase());
2757
+ await registry.whenDefined(ancestorElm.tagName.toLowerCase());
2723
2758
  ancestorHostRef = getHostRef(ancestorElm);
2724
2759
  }
2725
2760
  if (ancestorHostRef && !(ancestorHostRef.$flags$ & HOST_FLAGS.hasFiredConnected)) await ensureFirstConnectPromise(ancestorHostRef);
@@ -3075,8 +3110,7 @@ const initializeSignals = (elm, hostRef, cmpMeta) => {
3075
3110
  const instance = BUILD$1.lazyLoad ? hostRef.$lazyInstance$ : elm;
3076
3111
  for (const [memberName, [memberFlags]] of Object.entries(cmpMeta.$members$ ?? {})) {
3077
3112
  if (!(memberFlags & MEMBER_FLAGS.PropLike)) continue;
3078
- const initialVal = hostRef.$instanceValues$.get(memberName);
3079
- const sig = signal(initialVal);
3113
+ const sig = signal(hostRef.$instanceValues$.get(memberName));
3080
3114
  hostRef.$signalValues$.set(memberName, sig);
3081
3115
  let prevScheduleVal = sig.peek();
3082
3116
  disposers.push(effect(() => {
@@ -3204,9 +3238,7 @@ const h = (nodeName, vnodeData, ...children) => {
3204
3238
  if (classData && !(BUILD$1.vdomSignals && isSignalLike(classData))) vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
3205
3239
  }
3206
3240
  }
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.`);
3241
+ 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
3242
  if (BUILD$1.vdomFunctional && typeof nodeName === "function") return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
3211
3243
  const vnode = newVNode(nodeName, null);
3212
3244
  vnode.$attrs$ = vnodeData;
@@ -3982,7 +4014,7 @@ const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector)
3982
4014
  else return shallowPart.trim();
3983
4015
  }).join(", ");
3984
4016
  };
3985
- const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer");
4017
+ const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer") || selector.startsWith("@container");
3986
4018
  const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
3987
4019
  return processRules(cssText, (rule) => {
3988
4020
  let selector = rule.selector;
@@ -4101,8 +4133,11 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
4101
4133
  };
4102
4134
  //#endregion
4103
4135
  //#region src/runtime/mode.ts
4104
- const computeMode = (elm) => modeResolutionChain.map((h) => h(elm)).find((m) => !!m);
4105
- const setMode = (handler) => modeResolutionChain.push(handler);
4136
+ const computeMode = (elm) => modeResolver.map((h) => h(elm)).find((m) => !!m);
4137
+ const setMode = (handler) => {
4138
+ modeResolver.length = 0;
4139
+ modeResolver.push(handler);
4140
+ };
4106
4141
  const getMode = (ref) => getHostRef(ref)?.$modeName$;
4107
4142
  //#endregion
4108
4143
  //#region src/runtime/normalize-watchers.ts
@@ -4167,23 +4202,14 @@ const normalizeWatchers = (raw) => {
4167
4202
  *
4168
4203
  * @param propValue the new value to coerce to some type
4169
4204
  * @param propType the type of the prop, expressed as a binary number
4170
- * @param isFormAssociated whether the component is form-associated (optional)
4171
4205
  * @returns the parsed/coerced value
4172
4206
  */
4173
- const parsePropertyValue = (propValue, propType, isFormAssociated) => {
4207
+ const parsePropertyValue = (propValue, propType) => {
4174
4208
  if (propValue != null && !isComplexType(propValue)) {
4175
4209
  /**
4176
4210
  * ensure this value is of the correct prop type
4177
4211
  */
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
- }
4212
+ if (BUILD$1.propBoolean && propType & MEMBER_FLAGS.Boolean) return propValue === "" || !!propValue;
4187
4213
  /**
4188
4214
  * force it to be a number
4189
4215
  */
@@ -4225,7 +4251,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
4225
4251
  if (BUILD$1.signalBacking) {
4226
4252
  const sig = hostRef?.$signalValues$?.get(propName);
4227
4253
  if (sig !== void 0) {
4228
- const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0], BUILD$1.formAssociated && !!(cmpMeta.$flags$ & CMP_FLAGS.formAssociated));
4254
+ const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
4229
4255
  if (BUILD$1.serializer && BUILD$1.reflect && cmpMeta.$attrsToReflect$ && cmpMeta.$serializers$?.[propName]) {
4230
4256
  const elm = BUILD$1.lazyLoad ? hostRef.$hostElement$ : ref;
4231
4257
  applySerializers(hostRef, cmpMeta, propName, parsed, BUILD$1.lazyLoad ? hostRef.$lazyInstance$ : elm);
@@ -4243,7 +4269,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
4243
4269
  const oldVal = hostRef.$instanceValues$.get(propName);
4244
4270
  const flags = hostRef.$flags$;
4245
4271
  const instance = BUILD$1.lazyLoad ? hostRef.$lazyInstance$ : elm;
4246
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0], BUILD$1.formAssociated && !!(cmpMeta.$flags$ & CMP_FLAGS.formAssociated));
4272
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
4247
4273
  const didValueChange = newVal !== oldVal && !(Number.isNaN(oldVal) && Number.isNaN(newVal));
4248
4274
  if ((!BUILD$1.lazyLoad || !(flags & HOST_FLAGS.isConstructingInstance) || oldVal === void 0) && didValueChange) {
4249
4275
  hostRef.$instanceValues$.set(propName, newVal);
@@ -4292,6 +4318,22 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
4292
4318
  */
4293
4319
  const reflectedAttrValue = (propValue) => propValue == null || propValue === false ? null : propValue === true ? "" : String(propValue);
4294
4320
  /**
4321
+ * Hand values written to a lazy component's element before its instance existed to the
4322
+ * instance's own `@Prop` setters. Must run as soon as the instance is constructed, so that
4323
+ * whenever `$lazyInstance$` is set, reads through it agree with the element's last write.
4324
+ *
4325
+ * @param hostRef the runtime bookkeeping object of a freshly constructed lazy instance
4326
+ * @param cmpMeta runtime metadata for the component (with any run-time only setters flagged)
4327
+ */
4328
+ const replayPendingSetterValues = (hostRef, cmpMeta) => {
4329
+ const instance = hostRef.$lazyInstance$;
4330
+ if (!instance) return;
4331
+ for (const [memberName, [memberFlags]] of Object.entries(cmpMeta.$members$ ?? {})) if (memberFlags & MEMBER_FLAGS.Setter && hostRef.$instanceValues$.has(memberName)) {
4332
+ const pendingValue = hostRef.$instanceValues$.get(memberName);
4333
+ if (instance[memberName] !== pendingValue) instance[memberName] = pendingValue;
4334
+ }
4335
+ };
4336
+ /**
4295
4337
  * Attach a series of runtime constructs to a compiled Stencil component
4296
4338
  * constructor, including getters and setters for the `@Prop` and `@State`
4297
4339
  * decorators, callbacks for when attributes change, and so on.
@@ -4348,9 +4390,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
4348
4390
  if (BUILD$1.lazyLoad) {
4349
4391
  if ((cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Getter) === 0) return getValue(this, memberName);
4350
4392
  const ref = getHostRef(this);
4351
- const instance = ref ? ref.$lazyInstance$ : prototype;
4352
- if (!instance) return;
4353
- return instance[memberName];
4393
+ if (!ref) return prototype[memberName];
4394
+ return ref.$lazyInstance$ ? ref.$lazyInstance$[memberName] : getValue(this, memberName);
4354
4395
  }
4355
4396
  if (!BUILD$1.lazyLoad) return origGetter ? origGetter.apply(this) : getValue(this, memberName);
4356
4397
  },
@@ -4365,7 +4406,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
4365
4406
  }
4366
4407
  if (origSetter) {
4367
4408
  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))]);
4409
+ origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
4369
4410
  newValue = memberFlags & MEMBER_FLAGS.State ? this[memberName] : ref.$hostElement$[memberName];
4370
4411
  setValue(this, memberName, newValue, cmpMeta);
4371
4412
  return;
@@ -4377,21 +4418,15 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
4377
4418
  if (BUILD$1.lazyLoad) {
4378
4419
  if ((flags & PROXY_FLAGS.isElementConstructor) === 0 || (cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Setter) === 0) {
4379
4420
  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
4421
  return;
4384
4422
  }
4385
- const setterSetVal = () => {
4423
+ const parsedValue = parsePropertyValue(newValue, memberFlags);
4424
+ if (ref.$lazyInstance$) {
4386
4425
  const currentValue = ref.$lazyInstance$[memberName];
4387
4426
  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));
4427
+ ref.$lazyInstance$[memberName] = parsedValue;
4389
4428
  setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
4390
- };
4391
- if (ref.$lazyInstance$) setterSetVal();
4392
- else ref.$fetchedCbList$.push(() => {
4393
- setterSetVal();
4394
- });
4429
+ } else ref.$instanceValues$.set(memberName, parsedValue);
4395
4430
  }
4396
4431
  } });
4397
4432
  } else if (BUILD$1.lazyLoad && BUILD$1.method && flags & PROXY_FLAGS.isElementConstructor && memberFlags & MEMBER_FLAGS.Method) Object.defineProperty(prototype, memberName, { value(...args) {
@@ -4443,7 +4478,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
4443
4478
  const isBooleanTarget = propMemberFlags & MEMBER_FLAGS.Boolean;
4444
4479
  if (BUILD$1.reflect && propMemberFlags & MEMBER_FLAGS.ReflectAttr && propMemberFlags & MEMBER_FLAGS.Any && !isComplexType(this[propName]) && reflectedAttrValue(this[propName]) === newValue) return;
4445
4480
  const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
4446
- if (isBooleanTarget) newValue = !(newValue === null || newValue === "false");
4481
+ if (isBooleanTarget) {
4482
+ 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.`);
4483
+ newValue = newValue !== null;
4484
+ }
4447
4485
  const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
4448
4486
  if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) this[propName] = newValue;
4449
4487
  });
@@ -4506,9 +4544,12 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
4506
4544
  } catch (e) {
4507
4545
  consoleError(e, elm);
4508
4546
  }
4509
- if (BUILD$1.member) hostRef.$flags$ &= ~HOST_FLAGS.isConstructingInstance;
4547
+ if (BUILD$1.member) {
4548
+ hostRef.$flags$ &= ~HOST_FLAGS.isConstructingInstance;
4549
+ replayPendingSetterValues(hostRef, cmpMeta);
4550
+ }
4510
4551
  endNewInstance();
4511
- if (BUILD$1.asyncLoading && hostRef.$ancestorComponent$) await awaitAncestorConnected(hostRef.$ancestorComponent$);
4552
+ if (BUILD$1.asyncLoading && hostRef.$ancestorComponent$) await awaitAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(elm));
4512
4553
  if (!(BUILD$1.slotRelocation && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation)) {
4513
4554
  fireConnectedCallback(hostRef.$lazyInstance$, elm);
4514
4555
  if (BUILD$1.asyncLoading) markFirstConnected(hostRef);
@@ -4608,9 +4649,16 @@ const connectedCallback = (elm) => {
4608
4649
  }
4609
4650
  if (BUILD$1.asyncLoading) {
4610
4651
  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;
4652
+ while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
4653
+ if (BUILD$1.hydrateClientSide && !ancestorComponent["s-p"] && ancestorComponent.nodeType === NODE_TYPE.ElementNode && ancestorComponent.hasAttribute("s-id")) {
4654
+ ancestorComponent["s-p"] = [];
4655
+ ancestorComponent["s-rc"] = [];
4656
+ ancestorComponent["s-pc"] = [];
4657
+ }
4658
+ if (ancestorComponent["s-p"]) {
4659
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
4660
+ break;
4661
+ }
4614
4662
  }
4615
4663
  }
4616
4664
  if (BUILD$1.prop && !BUILD$1.hydrateServerSide && cmpMeta.$members$) Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
@@ -4726,48 +4774,45 @@ const hmrStandalone = async (hostElement, cmpMeta, hmrVersionId) => {
4726
4774
  `${modulePath}?s-hmr=${hmrVersionId}`
4727
4775
  );
4728
4776
  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
- });
4777
+ if (NewClass) hmrApplyClass(cmpMeta, NewClass);
4767
4778
  } catch (e) {
4768
4779
  console.error(`[Stencil HMR] Failed to reload <${cmpMeta.$tagName$}>`, e);
4769
4780
  }
4770
4781
  };
4782
+ /**
4783
+ * Patch a re-executed component class onto the registered one and re-render every live instance.
4784
+ * Shared by the standalone re-import above and bundlers that re-execute the module themselves
4785
+ * (webpack/rspack `module.hot`), which reach it via the constructor's `s-hmr-apply` hook.
4786
+ *
4787
+ * @param cmpMeta runtime metadata for the component
4788
+ * @param NewClass the component's newly executed class
4789
+ */
4790
+ const hmrApplyClass = (cmpMeta, NewClass) => {
4791
+ const ctor = customElements.get(cmpMeta.$tagName$);
4792
+ const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
4793
+ if (ctor && ctor !== NewClass) {
4794
+ for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
4795
+ if (key === "constructor") continue;
4796
+ Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
4797
+ }
4798
+ const styleDesc = Object.getOwnPropertyDescriptor(NewClass, "style");
4799
+ if (styleDesc) {
4800
+ Object.defineProperty(ctor, "style", styleDesc);
4801
+ const newStyle = NewClass.style;
4802
+ if (newStyle) registerStyle(getScopeId(cmpMeta), newStyle, isShadow);
4803
+ }
4804
+ }
4805
+ document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => {
4806
+ const hostRef = getHostRef(el);
4807
+ if (BUILD$1.hostListener && hostRef?.$rmListeners$) {
4808
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
4809
+ hostRef.$rmListeners$ = void 0;
4810
+ addHostEventListeners(el, hostRef, cmpMeta.$listeners$);
4811
+ }
4812
+ if (!isShadow && hostRef) attachStyles(hostRef);
4813
+ forceUpdate(el);
4814
+ });
4815
+ };
4771
4816
  //#endregion
4772
4817
  //#region src/runtime/bootstrap-standalone.ts
4773
4818
  const defineCustomElement = (Cstr, compactMeta) => {
@@ -4790,9 +4835,12 @@ const proxyCustomElement = (Cstr, compactMeta) => {
4790
4835
  cmpMeta.$serializers$ = Cstr.$serializers$;
4791
4836
  }
4792
4837
  if (BUILD$1.reflect) cmpMeta.$attrsToReflect$ = [];
4793
- if (BUILD$1.hotModuleReplacement) Cstr.prototype["s-hmr"] = function(hmrVersionId) {
4794
- hmrStart(this, cmpMeta, hmrVersionId);
4795
- };
4838
+ if (BUILD$1.hotModuleReplacement) {
4839
+ Cstr.prototype["s-hmr"] = function(hmrVersionId) {
4840
+ hmrStart(this, cmpMeta, hmrVersionId);
4841
+ };
4842
+ Cstr["s-hmr-apply"] = (NewClass) => hmrApplyClass(cmpMeta, NewClass);
4843
+ }
4796
4844
  if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && (BUILD$1.slotCloneNode || BUILD$1.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone)) patchCloneNode(Cstr.prototype);
4797
4845
  if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) {
4798
4846
  if (BUILD$1.lightDomPatches || BUILD$1.patchAll && cmpMeta.$flags$ & CMP_FLAGS.patchAll) applyLightDomPatches(Cstr.prototype);
@@ -4831,7 +4879,7 @@ const proxyCustomElement = (Cstr, compactMeta) => {
4831
4879
  }
4832
4880
  connectedCallback(this);
4833
4881
  if (BUILD$1.asyncLoading && hostRef && hostRef.$ancestorComponent$) {
4834
- await awaitAncestorConnected(hostRef.$ancestorComponent$);
4882
+ await awaitAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(this));
4835
4883
  if (!this.isConnected) return;
4836
4884
  }
4837
4885
  if (originalConnectedCallback && (plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected) === 0) originalConnectedCallback.call(this);
@@ -5146,7 +5194,7 @@ function Mixin(...mixins) {
5146
5194
  //#region src/runtime/nonce.ts
5147
5195
  /**
5148
5196
  * 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.
5197
+ * During runtime, this value is used to set the nonce attribute on all dynamically created style tags.
5150
5198
  * @param nonce The value to be assigned to the platform nonce property.
5151
5199
  * @returns void
5152
5200
  */
@@ -5308,4 +5356,4 @@ function hasKeys(obj) {
5308
5356
  return false;
5309
5357
  }
5310
5358
  //#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 };
5359
+ 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 };