@stencil/core 5.0.0-alpha.27 → 5.0.0-alpha.29

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 (44) hide show
  1. package/dist/app-data/index.d.ts +1 -1
  2. package/dist/{client-CvcvHKz4.mjs → client-D1MsT-Rp.mjs} +373 -238
  3. package/dist/compiler/index.d.mts +2 -3
  4. package/dist/compiler/index.mjs +3 -3
  5. package/dist/compiler/utils/index.d.mts +272 -2
  6. package/dist/compiler/utils/index.mjs +4 -3
  7. package/dist/{compiler-D43Ied7R.mjs → compiler-BbS9TDF_.mjs} +1845 -1118
  8. package/dist/declarations/stencil-ext-modules.d.ts +5 -5
  9. package/dist/declarations/stencil-public-compiler.d.ts +108 -40
  10. package/dist/declarations/stencil-public-docs.d.ts +9 -0
  11. package/dist/declarations/stencil-public-runtime.d.ts +81 -6
  12. package/dist/fragment-Di1hWOC8.mjs +4 -0
  13. package/dist/{index-F3IidHM1.d.mts → index-BHj3EBl2.d.mts} +395 -312
  14. package/dist/{index-xAkMgLX_.d.ts → index-D2PAsXxx.d.ts} +133 -9
  15. package/dist/index-VK8okIiF.d.mts +108 -0
  16. package/dist/index.d.mts +4 -0
  17. package/dist/index.mjs +91 -2
  18. package/dist/jsx-runtime.mjs +2 -1
  19. package/dist/{node-DKVq_Ud0.mjs → node-BQR4L-TG.mjs} +60 -58
  20. package/dist/reactive-controller-BdCpSAQP.d.mts +13 -0
  21. package/dist/{regular-expression-CFVJOTUh.mjs → regular-expression-XqU5zmPp.mjs} +20 -3
  22. package/dist/{chunk-z9aeyW2b.mjs → rolldown-runtime-BhDjJH2R.mjs} +1 -1
  23. package/dist/runtime/client/lazy.js +411 -165
  24. package/dist/runtime/client/runtime.d.ts +136 -9
  25. package/dist/runtime/client/runtime.js +411 -165
  26. package/dist/runtime/index.d.ts +5 -3
  27. package/dist/runtime/index.js +410 -163
  28. package/dist/runtime/server/index.d.mts +80 -8
  29. package/dist/runtime/server/index.mjs +333 -158
  30. package/dist/runtime/server/runner.d.mts +3 -0
  31. package/dist/runtime/server/runner.mjs +232 -308
  32. package/dist/signals/index.d.ts +2 -0
  33. package/dist/sys/node/index.d.mts +1 -2
  34. package/dist/sys/node/index.mjs +1 -1
  35. package/dist/sys/node/worker.d.mts +1 -1
  36. package/dist/sys/node/worker.mjs +6 -3
  37. package/dist/testing/index.d.mts +4 -9
  38. package/dist/testing/index.mjs +74 -56
  39. package/dist/util-BIa-iHnt.mjs +724 -0
  40. package/dist/validation-Dd3g77T5.mjs +778 -0
  41. package/package.json +27 -27
  42. package/dist/index-3fu7WQs4.d.mts +0 -205
  43. package/dist/validation-ByxKj8bC.mjs +0 -1458
  44. /package/{LICENSE.md → LICENSE} +0 -0
@@ -1,4 +1,4 @@
1
- import { B as HOST_FLAGS, G as NODE_TYPES, H as LISTENER_FLAGS, L as EVENT_FLAGS, S as queryNonceMetaTagContent, W as MEMBER_FLAGS, Z as SVG_NS, c as isDef, et as WATCH_FLAGS, s as isComplexType, t as escapeRegExpSpecialCharacters, w as CMP_FLAGS } from "./regular-expression-CFVJOTUh.mjs";
1
+ import { G as MEMBER_FLAGS, K as NODE_TYPES, Q as SVG_NS, R as EVENT_FLAGS, S as queryNonceMetaTagContent, U as LISTENER_FLAGS, V as HOST_FLAGS, c as isDef, s as isComplexType, t as escapeRegExpSpecialCharacters, tt as WATCH_FLAGS, w as CMP_FLAGS } from "./regular-expression-XqU5zmPp.mjs";
2
2
  import { effect, effect as effect$1, signal } from "@preact/signals-core";
3
3
  //#region src/app-data/index.ts
4
4
  /**
@@ -110,94 +110,6 @@ const Build = {
110
110
  isTesting: BUILD.isTesting
111
111
  };
112
112
  //#endregion
113
- //#region src/client/client-decorators.ts
114
- /**
115
- * Runtime stubs for Stencil decorators.
116
- *
117
- * These decorators are compile-time metadata flags that Stencil's compiler parses
118
- * and transforms. At runtime, they do nothing - the actual component behavior is
119
- * wired up by the compiled output, not by these decorators.
120
- *
121
- * These stubs exist so that:
122
- * 1. Component classes can be instantiated directly in tests without going through
123
- * Stencil's full compilation pipeline
124
- * 2. The decorators don't throw "X is not a function" errors when used outside
125
- * of Stencil's build process
126
- */
127
- /**
128
- * No-op class decorator stub for @Component()
129
- * @param _opts - component options (ignored at runtime)
130
- * @returns a class decorator that returns the target unchanged
131
- */
132
- const Component = (_opts) => (target) => target;
133
- /**
134
- * No-op property decorator stub for @Element()
135
- * @returns a property decorator that does nothing
136
- */
137
- const Element$1 = () => () => {};
138
- /**
139
- * No-op property decorator stub for @Event()
140
- * @param _opts - event options (ignored at runtime)
141
- * @returns a property decorator that does nothing
142
- */
143
- const Event = (_opts) => () => {};
144
- /**
145
- * No-op property decorator stub for @AttachInternals()
146
- * @param _opts - attach internals options (ignored at runtime)
147
- * @returns a property decorator that does nothing
148
- */
149
- const AttachInternals = (_opts) => () => {};
150
- /**
151
- * No-op method decorator stub for @Listen()
152
- * @param _eventName - event name to listen for (ignored at runtime)
153
- * @param _opts - listen options (ignored at runtime)
154
- * @returns a method decorator that does nothing
155
- */
156
- const Listen = (_eventName, _opts) => () => {};
157
- /**
158
- * No-op method decorator stub for @Method()
159
- * @param _opts - method options (ignored at runtime)
160
- * @returns a method decorator that does nothing
161
- */
162
- const Method = (_opts) => () => {};
163
- /**
164
- * No-op property decorator stub for @Prop()
165
- * @param _opts - prop options (ignored at runtime)
166
- * @returns a property decorator that does nothing
167
- */
168
- const Prop = (_opts) => () => {};
169
- /**
170
- * No-op property decorator stub for @State()
171
- * @returns a property decorator that does nothing
172
- */
173
- const State = () => () => {};
174
- /**
175
- * No-op method decorator stub for @Watch()
176
- * @param _propName - property name to watch (ignored at runtime)
177
- * @param _opts - watch options (ignored at runtime)
178
- * @returns a method decorator that does nothing
179
- */
180
- const Watch = (_propName, _opts) => () => {};
181
- /**
182
- * No-op method decorator stub for @PropSerialize()
183
- * @param _propName - property name to serialize (ignored at runtime)
184
- * @returns a method decorator that does nothing
185
- */
186
- const PropSerialize = (_propName) => () => {};
187
- /**
188
- * No-op method decorator stub for @AttrDeserialize()
189
- * @param _propName - property name to deserialize (ignored at runtime)
190
- * @returns a method decorator that does nothing
191
- */
192
- const AttrDeserialize = (_propName) => () => {};
193
- /**
194
- * No-op compile-time utility stub for resolveVar()
195
- * At runtime, this just returns the string representation of whatever is passed in.
196
- * @param variable - the variable to resolve
197
- * @returns the string representation of the variable
198
- */
199
- const resolveVar = (variable) => String(variable);
200
- //#endregion
201
113
  //#region src/utils/get-prop-descriptor.ts
202
114
  /**
203
115
  * Walks up a prototype chain to find a property descriptor.
@@ -301,8 +213,13 @@ const registerHost = (hostElement, cmpMeta) => {
301
213
  if (BUILD.asyncLoading) {
302
214
  hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
303
215
  hostElement["s-rp"] = hostRef.$onReadyPromise$;
216
+ if (!BUILD.lazyLoad) {
217
+ hostRef.$onFirstConnectPromise$ = new Promise((r) => hostRef.$onFirstConnectResolve$ = r);
218
+ hostElement["s-fc"] = hostRef.$onFirstConnectPromise$;
219
+ }
304
220
  if (!hostElement["s-p"]) hostElement["s-p"] = [];
305
221
  if (!hostElement["s-rc"]) hostElement["s-rc"] = [];
222
+ if (!hostElement["s-pc"]) hostElement["s-pc"] = [];
306
223
  }
307
224
  if (BUILD.lazyLoad) hostRef.$fetchedCbList$ = [];
308
225
  const ref = hostRef;
@@ -321,7 +238,12 @@ const consoleDevWarn = (...m) => console.warn(...STENCIL_DEV_MODE, ...m);
321
238
  const setErrorHandler = (handler) => customError = handler;
322
239
  //#endregion
323
240
  //#region src/client/client-load-module.ts
324
- const cmpModules = /* @__PURE__ */ new Map();
241
+ const cmpModules = /*@__PURE__*/ new Map();
242
+ /**
243
+ * Tracks how many times a dynamic `import()` for a given lazy bundle has failed.
244
+ * Used to cache bust the retry attempt in connected-callback.ts
245
+ */
246
+ const failedLoadAttempts = /*@__PURE__*/ new Map();
325
247
  /**
326
248
  * We need to separate out this prefix so that Esbuild doesn't try to resolve
327
249
  * the below, but instead retains a dynamic `import()` statement in the
@@ -348,13 +270,21 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
348
270
  } else if (!bundleId) return;
349
271
  const module = !BUILD.hotModuleReplacement ? cmpModules.get(bundleId) : false;
350
272
  if (module) return module[exportName];
273
+ const retryCount = failedLoadAttempts.get(bundleId) ?? 0;
274
+ const cacheBustParams = [retryCount > 0 ? `s-retry=${retryCount}` : "", BUILD.hotModuleReplacement && hmrVersionId ? `s-hmr=${hmrVersionId}` : ""].filter(Boolean).join("&");
351
275
  /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
352
- const entryFile = `${bundleId}.entry.js${BUILD.hotModuleReplacement && hmrVersionId ? "?s-hmr=" + hmrVersionId : ""}`;
276
+ const entryFile = `${bundleId}.entry.js${cacheBustParams ? "?" + cacheBustParams : ""}`;
353
277
  const onLoad = (importedModule) => {
354
- if (!BUILD.hotModuleReplacement) cmpModules.set(bundleId, importedModule);
278
+ if (!BUILD.hotModuleReplacement) {
279
+ failedLoadAttempts.delete(bundleId);
280
+ cmpModules.set(bundleId, importedModule);
281
+ }
355
282
  return importedModule[exportName];
356
283
  };
357
- const onError = (e) => consoleError(e, hostRef.$hostElement$);
284
+ const onError = (e) => {
285
+ failedLoadAttempts.set(bundleId, retryCount + 1);
286
+ consoleError(e, hostRef.$hostElement$);
287
+ };
358
288
  return import(
359
289
  /* @vite-ignore */
360
290
  /* webpackInclude: /\.entry\.js$/ */
@@ -365,7 +295,7 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
365
295
  };
366
296
  //#endregion
367
297
  //#region src/client/client-style.ts
368
- const styles = /* @__PURE__ */ new Map();
298
+ const styles = /*@__PURE__*/ new Map();
369
299
  const modeResolutionChain = [];
370
300
  const needsScopedSSR = () => false;
371
301
  //#endregion
@@ -433,6 +363,10 @@ const DEFAULT_DOC_DATA = {
433
363
  */
434
364
  const SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
435
365
  const XLINK_NS = "http://www.w3.org/1999/xlink";
366
+ /**
367
+ * Minimum delay, in milliseconds, before retrying a failed lazy component load.
368
+ */
369
+ const LAZY_LOAD_RETRY_INTERVAL_MS = 1e3;
436
370
  const FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
437
371
  "formAssociatedCallback",
438
372
  "formResetCallback",
@@ -455,7 +389,7 @@ const plt = {
455
389
  const setPlatformHelpers = (helpers) => {
456
390
  Object.assign(plt, helpers);
457
391
  };
458
- const supportsListenerOptions = /* @__PURE__ */ (() => {
392
+ const supportsListenerOptions = /*@__PURE__*/ (() => {
459
393
  let supported = false;
460
394
  try {
461
395
  win.document?.addEventListener("e", null, Object.defineProperty({}, "passive", { get() {
@@ -465,14 +399,14 @@ const supportsListenerOptions = /* @__PURE__ */ (() => {
465
399
  return supported;
466
400
  })();
467
401
  const promiseResolve = (v) => Promise.resolve(v);
468
- const supportsConstructableStylesheets = BUILD.constructableCSS ? /* @__PURE__ */ (() => {
402
+ const supportsConstructableStylesheets = BUILD.constructableCSS ? /*@__PURE__*/ (() => {
469
403
  try {
470
404
  if (!win.document.adoptedStyleSheets) return false;
471
405
  return typeof new CSSStyleSheet().replaceSync === "function";
472
406
  } catch {}
473
407
  return false;
474
408
  })() : false;
475
- const supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @__PURE__ */ (() => !!win.document && Object.getOwnPropertyDescriptor(win.document.adoptedStyleSheets, "length").writable)() : false;
409
+ const supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /*@__PURE__*/ (() => !!win.document && Object.getOwnPropertyDescriptor(win.document.adoptedStyleSheets, "length").writable)() : false;
476
410
  //#endregion
477
411
  //#region src/client/client-task-queue.ts
478
412
  let queueCongestion = 0;
@@ -480,12 +414,13 @@ let queuePending = false;
480
414
  const queueDomReads = [];
481
415
  const queueDomWrites = [];
482
416
  const queueDomWritesLow = [];
417
+ const scheduleFlush = () => win.document?.hidden ? nextTick(flush) : plt.raf(flush);
483
418
  const queueTask = (queue, write) => (cb) => {
484
419
  queue.push(cb);
485
420
  if (!queuePending) {
486
421
  queuePending = true;
487
422
  if (write && plt.$flags$ & PLATFORM_FLAGS.queueSync) nextTick(flush);
488
- else plt.raf(flush);
423
+ else scheduleFlush();
489
424
  }
490
425
  };
491
426
  const consume = (queue) => {
@@ -518,16 +453,16 @@ const flush = () => {
518
453
  queueDomWritesLow.push(...queueDomWrites);
519
454
  queueDomWrites.length = 0;
520
455
  }
521
- if (queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0) plt.raf(flush);
456
+ if (queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0) scheduleFlush();
522
457
  else queueCongestion = 0;
523
458
  } else {
524
459
  consume(queueDomWrites);
525
- if (queuePending = queueDomReads.length > 0) plt.raf(flush);
460
+ if (queuePending = queueDomReads.length > 0) scheduleFlush();
526
461
  }
527
462
  };
528
463
  const nextTick = (cb) => promiseResolve().then(cb);
529
- const readTask = /* @__PURE__ */ queueTask(queueDomReads, false);
530
- const writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
464
+ const readTask = /*@__PURE__*/ queueTask(queueDomReads, false);
465
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
531
466
  //#endregion
532
467
  //#region src/runtime/asset-path.ts
533
468
  const getAssetPath = (path) => {
@@ -566,8 +501,10 @@ function createShadowRoot(cmpMeta) {
566
501
  const shadowRoot = this.attachShadow(opts);
567
502
  if (BUILD.shadowModeClosed && isClosed) this.__shadowRoot = shadowRoot;
568
503
  if (globalStyleSheet === void 0) globalStyleSheet = createStyleSheetIfNeededAndSupported("") ?? null;
569
- if (globalStyleSheet) if (supportsMutableAdoptedStyleSheets) shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
570
- else shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
504
+ if (globalStyleSheet) {
505
+ if (supportsMutableAdoptedStyleSheets) shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
506
+ else shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
507
+ }
571
508
  }
572
509
  //#endregion
573
510
  //#region src/runtime/slot-polyfill-utils.ts
@@ -587,8 +524,10 @@ function createShadowRoot(cmpMeta) {
587
524
  const updateFallbackSlotVisibility = (elm) => {
588
525
  const childNodes = internalCall(elm, "childNodes");
589
526
  if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
590
- if (slotNode.nodeType === NODE_TYPE.ElementNode && slotNode.tagName === "SLOT-FB") if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) slotNode.hidden = true;
591
- else slotNode.hidden = false;
527
+ if (slotNode.nodeType === NODE_TYPE.ElementNode && slotNode.tagName === "SLOT-FB") {
528
+ if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) slotNode.hidden = true;
529
+ else slotNode.hidden = false;
530
+ }
592
531
  });
593
532
  let i = 0;
594
533
  for (i = 0; i < childNodes.length; i++) {
@@ -631,7 +570,7 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
631
570
  slottedNodes.push(childNode);
632
571
  if (typeof slotName !== "undefined") return slottedNodes;
633
572
  }
634
- slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode.childNodes, hostName, slotName)];
573
+ slottedNodes = [...slottedNodes, ...getHostSlotNodes(internalCall(childNode, "childNodes"), hostName, slotName)];
635
574
  }
636
575
  return slottedNodes;
637
576
  }
@@ -662,7 +601,7 @@ const isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
662
601
  if (nodeToRelocate.getAttribute("slot") === slotName) return true;
663
602
  return false;
664
603
  }
665
- if (nodeToRelocate["s-sn"] === slotName) return true;
604
+ if (typeof nodeToRelocate["s-sa"] === "string") return nodeToRelocate["s-sa"] === slotName;
666
605
  return slotName === "";
667
606
  };
668
607
  /**
@@ -711,8 +650,10 @@ function patchSlotNode(node) {
711
650
  const assignedFactory = (elementsOnly) => function(opts) {
712
651
  const toReturn = [];
713
652
  const slotName = this["s-sn"];
714
- if (opts?.flatten) if (BUILD.isDev) console.error("Flattening is not supported for Stencil non-shadow slots. You can use `.childNodes` for nested slot fallback content.");
715
- else console.error("Flattening not supported for Stencil non-shadow slots");
653
+ if (opts?.flatten) {
654
+ if (BUILD.isDev) console.error("Flattening is not supported for Stencil non-shadow slots. You can use `.childNodes` for nested slot fallback content.");
655
+ else console.error("Flattening not supported for Stencil non-shadow slots");
656
+ }
716
657
  const parent = this["s-cr"].parentElement;
717
658
  (parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes)).forEach((n) => {
718
659
  if (slotName === getSlotName(n)) toReturn.push(n);
@@ -803,8 +744,10 @@ const patchCloneNode = (HostElementPrototype) => {
803
744
  for (; i < childNodes.length; i++) {
804
745
  slotted = childNodes[i]["s-nr"];
805
746
  nonStencilNode = stencilPrivates.every((privateField) => !childNodes[i][privateField]);
806
- if (slotted) if (clonedNode.__appendChild) clonedNode.__appendChild(slotted.cloneNode(true));
807
- else clonedNode.appendChild(slotted.cloneNode(true));
747
+ if (slotted) {
748
+ if (clonedNode.__appendChild) clonedNode.__appendChild(slotted.cloneNode(true));
749
+ else clonedNode.appendChild(slotted.cloneNode(true));
750
+ }
808
751
  if (nonStencilNode) clonedNode.appendChild(childNodes[i].cloneNode(true));
809
752
  }
810
753
  }
@@ -1007,11 +950,11 @@ const patchChildSlotNodes = (elm) => {
1007
950
  } });
1008
951
  patchHostOriginalAccessor("firstChild", elm);
1009
952
  Object.defineProperty(elm, "firstChild", { get() {
1010
- return this.childNodes[0];
953
+ return this.childNodes[0] || null;
1011
954
  } });
1012
955
  patchHostOriginalAccessor("lastChild", elm);
1013
956
  Object.defineProperty(elm, "lastChild", { get() {
1014
- return this.childNodes[this.childNodes.length - 1];
957
+ return this.childNodes[this.childNodes.length - 1] || null;
1015
958
  } });
1016
959
  patchHostOriginalAccessor("childNodes", elm);
1017
960
  Object.defineProperty(elm, "childNodes", { get() {
@@ -1057,7 +1000,7 @@ const patchNextSibling = (node) => {
1057
1000
  Object.defineProperty(node, "nextSibling", { get: function() {
1058
1001
  const parentNodes = this["s-ol"]?.parentNode.childNodes;
1059
1002
  const index = parentNodes?.indexOf(this);
1060
- if (parentNodes && index > -1) return parentNodes[index + 1];
1003
+ if (parentNodes && index > -1) return parentNodes[index + 1] || null;
1061
1004
  return this.__nextSibling;
1062
1005
  } });
1063
1006
  };
@@ -1072,7 +1015,7 @@ const patchNextElementSibling = (element) => {
1072
1015
  Object.defineProperty(element, "nextElementSibling", { get: function() {
1073
1016
  const parentEles = this["s-ol"]?.parentNode.children;
1074
1017
  const index = parentEles?.indexOf(this);
1075
- if (parentEles && index > -1) return parentEles[index + 1];
1018
+ if (parentEles && index > -1) return parentEles[index + 1] || null;
1076
1019
  return this.__nextElementSibling;
1077
1020
  } });
1078
1021
  };
@@ -1087,7 +1030,7 @@ const patchPreviousSibling = (node) => {
1087
1030
  Object.defineProperty(node, "previousSibling", { get: function() {
1088
1031
  const parentNodes = this["s-ol"]?.parentNode.childNodes;
1089
1032
  const index = parentNodes?.indexOf(this);
1090
- if (parentNodes && index > -1) return parentNodes[index - 1];
1033
+ if (parentNodes && index > -1) return parentNodes[index - 1] || null;
1091
1034
  return this.__previousSibling;
1092
1035
  } });
1093
1036
  };
@@ -1102,7 +1045,7 @@ const patchPreviousElementSibling = (element) => {
1102
1045
  Object.defineProperty(element, "previousElementSibling", { get: function() {
1103
1046
  const parentNodes = this["s-ol"]?.parentNode.children;
1104
1047
  const index = parentNodes?.indexOf(this);
1105
- if (parentNodes && index > -1) return parentNodes[index - 1];
1048
+ if (parentNodes && index > -1) return parentNodes[index - 1] || null;
1106
1049
  return this.__previousElementSibling;
1107
1050
  } });
1108
1051
  };
@@ -1264,7 +1207,7 @@ const installDevTools = () => {
1264
1207
  };
1265
1208
  //#endregion
1266
1209
  //#region src/runtime/styles.ts
1267
- const rootAppliedStyles = /* @__PURE__ */ new WeakMap();
1210
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
1268
1211
  /**
1269
1212
  * Get or initialize the set of applied style scope IDs for a container element.
1270
1213
  *
@@ -1288,9 +1231,10 @@ const getAppliedStyles = (container) => {
1288
1231
  * @param prepend if true, add to beginning; if false, add to end
1289
1232
  */
1290
1233
  const adoptStylesheet = (container, sheet, prepend = false) => {
1291
- if (supportsMutableAdoptedStyleSheets) if (prepend) container.adoptedStyleSheets.unshift(sheet);
1292
- else container.adoptedStyleSheets.push(sheet);
1293
- else if (prepend) container.adoptedStyleSheets = [sheet, ...container.adoptedStyleSheets];
1234
+ if (supportsMutableAdoptedStyleSheets) {
1235
+ if (prepend) container.adoptedStyleSheets.unshift(sheet);
1236
+ else container.adoptedStyleSheets.push(sheet);
1237
+ } else if (prepend) container.adoptedStyleSheets = [sheet, ...container.adoptedStyleSheets];
1294
1238
  else container.adoptedStyleSheets = [...container.adoptedStyleSheets, sheet];
1295
1239
  };
1296
1240
  /**
@@ -1303,7 +1247,7 @@ const adoptStylesheet = (container, sheet, prepend = false) => {
1303
1247
  * @returns a new CSSStyleSheet for the correct window
1304
1248
  */
1305
1249
  const createStylesheetForWindow = (container, cssText) => {
1306
- const sheet = new (container.defaultView ?? container.ownerDocument?.defaultView ?? win).CSSStyleSheet();
1250
+ const sheet = new (container.defaultView ?? (container.ownerDocument?.defaultView) ?? win).CSSStyleSheet();
1307
1251
  sheet.replaceSync(cssText);
1308
1252
  return sheet;
1309
1253
  };
@@ -1374,41 +1318,46 @@ const addStyle = (styleContainerNode, cmpMeta, mode) => {
1374
1318
  /**
1375
1319
  * attach styles at the end of the head tag if we render scoped components
1376
1320
  */
1377
- if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation)) if (styleContainerNode.nodeName === "HEAD") {
1378
- /**
1379
- * if the page contains preconnect links, we want to insert the styles
1380
- * after the last preconnect link to ensure the styles are preloaded
1381
- */
1382
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
1383
- const referenceNode = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
1384
- styleContainerNode.insertBefore(styleElm, referenceNode?.parentNode === styleContainerNode ? referenceNode : null);
1385
- } else if ("host" in styleContainerNode) if (supportsConstructableStylesheets) {
1386
- const stylesheet = createStylesheetForWindow(styleContainerNode, style);
1387
- adoptStylesheet(styleContainerNode, stylesheet, true);
1388
- } else {
1389
- /**
1390
- * If a scoped component is used within a shadow root and constructable stylesheets are
1391
- * not supported, we want to insert the styles at the beginning of the shadow root node.
1392
- *
1393
- * However, if there is already a style node in the shadow root, we just append
1394
- * the styles to the existing node.
1395
- *
1396
- * Note: order of how styles are applied is important. The new style node
1397
- * should be inserted before the existing style node.
1398
- *
1399
- * During HMR, create separate style elements for scoped components so they can be
1400
- * updated independently without affecting other components' styles.
1401
- */
1402
- const existingStyleContainer = styleContainerNode.querySelector("style");
1403
- if (existingStyleContainer && !BUILD.hotModuleReplacement) existingStyleContainer.textContent = style + existingStyleContainer.textContent;
1404
- else styleContainerNode.prepend(styleElm);
1321
+ if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation)) {
1322
+ if (styleContainerNode.nodeName === "HEAD") {
1323
+ /**
1324
+ * if the page contains preconnect links, we want to insert the styles
1325
+ * after the last preconnect link to ensure the styles are preloaded
1326
+ */
1327
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
1328
+ const referenceNode = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
1329
+ styleContainerNode.insertBefore(styleElm, referenceNode?.parentNode === styleContainerNode ? referenceNode : null);
1330
+ } else if ("host" in styleContainerNode) {
1331
+ if (supportsConstructableStylesheets) {
1332
+ const stylesheet = createStylesheetForWindow(styleContainerNode, style);
1333
+ adoptStylesheet(styleContainerNode, stylesheet, true);
1334
+ } else {
1335
+ /**
1336
+ * If a scoped component is used within a shadow root and constructable stylesheets are
1337
+ * not supported, we want to insert the styles at the beginning of the shadow root node.
1338
+ *
1339
+ * However, if there is already a style node in the shadow root, we just append
1340
+ * the styles to the existing node.
1341
+ *
1342
+ * Note: order of how styles are applied is important. The new style node
1343
+ * should be inserted before the existing style node.
1344
+ *
1345
+ * During HMR, create separate style elements for scoped components so they can be
1346
+ * updated independently without affecting other components' styles.
1347
+ */
1348
+ const existingStyleContainer = styleContainerNode.querySelector("style");
1349
+ if (existingStyleContainer && !BUILD.hotModuleReplacement) existingStyleContainer.textContent = style + existingStyleContainer.textContent;
1350
+ else styleContainerNode.prepend(styleElm);
1351
+ }
1352
+ } else styleContainerNode.append(styleElm);
1405
1353
  }
1406
- else styleContainerNode.append(styleElm);
1407
1354
  /**
1408
1355
  * attach styles at the beginning of a shadow root node if we render shadow components
1409
1356
  */
1410
- if (cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) if (isClosedShadowSSR) styleContainerNode.prepend(styleElm);
1411
- else styleContainerNode.insertBefore(styleElm, null);
1357
+ if (cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) {
1358
+ if (isClosedShadowSSR) styleContainerNode.prepend(styleElm);
1359
+ else styleContainerNode.insertBefore(styleElm, null);
1360
+ }
1412
1361
  if (appliedStyles) appliedStyles.add(scopeId);
1413
1362
  }
1414
1363
  } else if (BUILD.constructableCSS) {
@@ -1611,11 +1560,15 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
1611
1560
  }
1612
1561
  } else if (BUILD.vdomStyle && memberName === "style") {
1613
1562
  if (BUILD.updatable) {
1614
- for (const prop in oldValue) if (!newValue || newValue[prop] == null) if (!BUILD.hydrateServerSide && prop.includes("-")) elm.style.removeProperty(prop);
1615
- else elm.style[prop] = "";
1563
+ for (const prop in oldValue) if (!newValue || newValue[prop] == null) {
1564
+ if (!BUILD.hydrateServerSide && prop.includes("-")) elm.style.removeProperty(prop);
1565
+ else elm.style[prop] = "";
1566
+ }
1567
+ }
1568
+ for (const prop in newValue) if (!oldValue || newValue[prop] !== oldValue[prop]) {
1569
+ if (!BUILD.hydrateServerSide && prop.includes("-")) elm.style.setProperty(prop, newValue[prop]);
1570
+ else elm.style[prop] = newValue[prop];
1616
1571
  }
1617
- for (const prop in newValue) if (!oldValue || newValue[prop] !== oldValue[prop]) if (!BUILD.hydrateServerSide && prop.includes("-")) elm.style.setProperty(prop, newValue[prop]);
1618
- else elm.style[prop] = newValue[prop];
1619
1572
  } else if (BUILD.vdomKey && memberName === "key") {} else if (BUILD.vdomRef && memberName === "ref") {
1620
1573
  if (newValue) queueRefAttachment(newValue, elm);
1621
1574
  } else if (BUILD.vdomListener && (BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
@@ -1624,7 +1577,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
1624
1577
  else memberName = ln[2] + memberName.slice(3);
1625
1578
  if (oldValue || newValue) {
1626
1579
  const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
1627
- memberName = memberName.replace(/* @__PURE__ */ new RegExp(CAPTURE_EVENT_SUFFIX + "$"), "");
1580
+ memberName = memberName.replace(/*@__PURE__*/ new RegExp(CAPTURE_EVENT_SUFFIX + "$"), "");
1628
1581
  if (oldValue) plt.rel(elm, memberName, oldValue, capture);
1629
1582
  if (newValue) plt.ael(elm, memberName, newValue, capture);
1630
1583
  }
@@ -1663,8 +1616,10 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
1663
1616
  if (!elm.tagName.includes("-")) {
1664
1617
  const n = newValue == null ? "" : newValue;
1665
1618
  if (memberName === "list") isProp = false;
1666
- else if (oldValue == null || elm[memberName] !== n) if (typeof elm.__lookupSetter__(memberName) === "function") elm[memberName] = n;
1667
- else elm.setAttribute(memberName, n);
1619
+ else if (oldValue == null || elm[memberName] !== n) {
1620
+ if (typeof elm.__lookupSetter__(memberName) === "function") elm[memberName] = n;
1621
+ else elm.setAttribute(memberName, n);
1622
+ }
1668
1623
  } else if (elm[memberName] !== newValue) elm[memberName] = newValue;
1669
1624
  } catch {}
1670
1625
  /**
@@ -1682,8 +1637,10 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
1682
1637
  }
1683
1638
  }
1684
1639
  if (newValue == null || newValue === false) {
1685
- if (newValue !== false || elm.getAttribute(memberName) === "") if (BUILD.vdomXlink && xlink) elm.removeAttributeNS(XLINK_NS, memberName);
1686
- else elm.removeAttribute(memberName);
1640
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
1641
+ if (BUILD.vdomXlink && xlink) elm.removeAttributeNS(XLINK_NS, memberName);
1642
+ else elm.removeAttribute(memberName);
1643
+ }
1687
1644
  } else if ((!isProp || flags & VNODE_FLAGS.isHost || isSvg) && !isComplex && elm.nodeType === NODE_TYPE.ElementNode) {
1688
1645
  newValue = newValue === true ? "" : newValue;
1689
1646
  if (BUILD.vdomXlink && xlink) elm.setAttributeNS(XLINK_NS, memberName, newValue);
@@ -1814,6 +1771,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex) => {
1814
1771
  }
1815
1772
  } else if (BUILD.slotRelocation && newVNode.$flags$ & VNODE_FLAGS.isSlotReference) {
1816
1773
  elm = newVNode.$elm$ = BUILD.isDebug || BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode) : win.document.createTextNode("");
1774
+ if (typeof newVNode.$attrs$?.slot === "string") elm["s-sa"] = newVNode.$attrs$.slot;
1817
1775
  if (BUILD.vdomAttribute) updateElement(null, newVNode, isSvgMode);
1818
1776
  } else {
1819
1777
  if (BUILD.svg && !isSvgMode) isSvgMode = newVNode.$tag$ === "svg";
@@ -2089,8 +2047,10 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
2089
2047
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
2090
2048
  newStartVnode = newCh[++newStartIdx];
2091
2049
  }
2092
- if (node) if (BUILD.slotRelocation) insertBefore(referenceNode(oldStartVnode.$elm$).parentNode, node, referenceNode(oldStartVnode.$elm$));
2093
- else insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
2050
+ if (node) {
2051
+ if (BUILD.slotRelocation) insertBefore(referenceNode(oldStartVnode.$elm$).parentNode, node, referenceNode(oldStartVnode.$elm$));
2052
+ else insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
2053
+ }
2094
2054
  }
2095
2055
  if (oldStartIdx > oldEndIdx) addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
2096
2056
  else if (BUILD.updatable && newStartIdx > newEndIdx) removeVnodes(oldCh, oldStartIdx, oldEndIdx);
@@ -2177,6 +2137,30 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
2177
2137
  */
2178
2138
  const relocateNodes = [];
2179
2139
  /**
2140
+ * When a forwarded `<slot>` gets relocated, drag along any content already forwarded through it,
2141
+ * to wherever it just landed (or nowhere, to be hidden, if it didn't match anything).
2142
+ *
2143
+ * Runs as its own pass after {@link markSlotContentForRelocation} rather than inside it, so that
2144
+ * function's matching order - which hydration's node/comment ordering depends on - is untouched.
2145
+ */
2146
+ const carryContentWithRelocatedSlotRefs = () => {
2147
+ for (const relocateData of relocateNodes.slice()) {
2148
+ const marker = relocateData.$nodeToRelocate$;
2149
+ if (!marker["s-sr"]) continue;
2150
+ const carriedSiblings = getSlotChildSiblings(marker, marker["s-sn"] || "", false);
2151
+ for (const carriedSibling of carriedSiblings) {
2152
+ if (!carriedSibling["s-ol"]) continue;
2153
+ let siblingRelocateData = relocateNodes.find((r) => r.$nodeToRelocate$ === carriedSibling);
2154
+ if (!siblingRelocateData) {
2155
+ siblingRelocateData = { $nodeToRelocate$: carriedSibling };
2156
+ relocateNodes.push(siblingRelocateData);
2157
+ }
2158
+ siblingRelocateData.$slotRefNode$ = relocateData.$slotRefNode$;
2159
+ if (relocateData.$slotRefNode$) carriedSibling["s-sh"] = relocateData.$slotRefNode$["s-hn"];
2160
+ }
2161
+ }
2162
+ };
2163
+ /**
2180
2164
  * Mark the contents of a slot for relocation via adding references to them to
2181
2165
  * the {@link relocateNodes} data structure. The actual work of relocating them
2182
2166
  * will then be handled in {@link renderVdom}.
@@ -2375,6 +2359,7 @@ render() {
2375
2359
  plt.$flags$ |= PLATFORM_FLAGS.isTmpDisconnected;
2376
2360
  if (checkSlotRelocate) {
2377
2361
  markSlotContentForRelocation(rootVnode.$elm$);
2362
+ carryContentWithRelocatedSlotRefs();
2378
2363
  for (const relocateData of relocateNodes) {
2379
2364
  const nodeToRelocate = relocateData.$nodeToRelocate$;
2380
2365
  if (!nodeToRelocate["s-ol"] && win.document) {
@@ -2434,7 +2419,7 @@ render() {
2434
2419
  }
2435
2420
  if (BUILD.slotRelocation && !useNativeShadowDom && !(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && hostElm["s-cr"]) {
2436
2421
  const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
2437
- for (const childNode of children) if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
2422
+ for (const childNode of children) if (childNode["s-hn"] !== hostTagName && childNode["s-sh"] !== hostTagName) {
2438
2423
  if (isInitialLoad && childNode["s-ih"] == null) childNode["s-ih"] = childNode.hidden ?? false;
2439
2424
  if (childNode.nodeType === NODE_TYPE.ElementNode) childNode.hidden = true;
2440
2425
  else if (childNode.nodeType === NODE_TYPE.TextNode && !!childNode.nodeValue.trim()) {
@@ -2452,16 +2437,58 @@ const slotReferenceDebugNode = (slotVNode) => win.document?.createComment(`<slot
2452
2437
  const originalLocationDebugNode = (nodeToRelocate) => win.document?.createComment(`org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`));
2453
2438
  //#endregion
2454
2439
  //#region src/runtime/update-component.ts
2440
+ /**
2441
+ * Get a promise that resolves once `hostRef`'s real `connectedCallback` has fired for the first time.
2442
+ *
2443
+ * @param hostRef the component's host reference
2444
+ * @returns a promise that resolves once the component's real `connectedCallback` has fired
2445
+ */
2446
+ const ensureFirstConnectPromise = (hostRef) => {
2447
+ if (!hostRef.$onFirstConnectPromise$) hostRef.$onFirstConnectPromise$ = new Promise((r) => hostRef.$onFirstConnectResolve$ = r);
2448
+ return hostRef.$onFirstConnectPromise$;
2449
+ };
2450
+ /**
2451
+ * Resolve `hostRef`'s first-connect promise and flag it connected. Called once this
2452
+ * component's real `connectedCallback` fires, plus from error/disconnect cleanup so a
2453
+ * component that never connects can't hang an ancestor or descendant forever.
2454
+ *
2455
+ * @param hostRef the component's host reference
2456
+ */
2457
+ const markFirstConnected = (hostRef) => {
2458
+ hostRef.$flags$ |= HOST_FLAGS.hasFiredConnected;
2459
+ hostRef.$onFirstConnectResolve$?.();
2460
+ hostRef.$onFirstConnectResolve$ = void 0;
2461
+ };
2462
+ /**
2463
+ * Wait for `ancestorElm` to be defined and its real `connectedCallback` to have completed.
2464
+ * Shared by the lazy ({@link initializeComponent}) and standalone (`bootstrap-standalone.ts`)
2465
+ * `connectedCallback` paths so a component never connects before its nearest Stencil
2466
+ * ancestor, regardless of load order. Both call sites already check `BUILD.asyncLoading` and
2467
+ * that an ancestor exists before calling this. Lazy's proxy classes are always pre-defined,
2468
+ * so the `whenDefined` wait is a no-op there - it only does real work for standalone's
2469
+ * autoloader, where the ancestor tag may not be defined yet.
2470
+ *
2471
+ * @param ancestorElm the nearest Stencil ancestor element
2472
+ */
2473
+ const awaitAncestorConnected = async (ancestorElm) => {
2474
+ let ancestorHostRef = getHostRef(ancestorElm);
2475
+ if (!BUILD.lazyLoad && !ancestorHostRef) {
2476
+ await getRegistry().whenDefined(ancestorElm.tagName.toLowerCase());
2477
+ ancestorHostRef = getHostRef(ancestorElm);
2478
+ }
2479
+ if (ancestorHostRef && !(ancestorHostRef.$flags$ & HOST_FLAGS.hasFiredConnected)) await ensureFirstConnectPromise(ancestorHostRef);
2480
+ };
2455
2481
  const attachToAncestor = (hostRef, ancestorComponent) => {
2456
2482
  if (BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
2457
2483
  const index = ancestorComponent["s-p"].push(new Promise((r) => hostRef.$onRenderResolve$ = () => {
2458
2484
  ancestorComponent["s-p"].splice(index - 1, 1);
2459
2485
  r();
2460
2486
  }));
2487
+ if (ancestorComponent["s-pc"]) ancestorComponent["s-pc"].push(ensureFirstConnectPromise(hostRef));
2461
2488
  }
2462
2489
  };
2463
2490
  const scheduleUpdate = (hostRef, isInitialLoad) => {
2464
- if (BUILD.taskQueue && BUILD.updatable) hostRef.$flags$ |= HOST_FLAGS.isQueuedForUpdate;
2491
+ if (BUILD.updatable) hostRef.$flags$ |= HOST_FLAGS.isQueuedForUpdate;
2465
2492
  if (BUILD.asyncLoading && hostRef.$flags$ & HOST_FLAGS.isWaitingForChildren) {
2466
2493
  hostRef.$flags$ |= HOST_FLAGS.needsRerender;
2467
2494
  return;
@@ -2469,6 +2496,8 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
2469
2496
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
2470
2497
  const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
2471
2498
  if (isInitialLoad) {
2499
+ const pendingConnects = BUILD.asyncLoading ? hostRef.$hostElement$["s-pc"] : void 0;
2500
+ if (pendingConnects && pendingConnects.length > 0) return Promise.all(pendingConnects).then(dispatch).catch(dispatch);
2472
2501
  queueMicrotask(() => {
2473
2502
  dispatch();
2474
2503
  });
@@ -2508,10 +2537,6 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
2508
2537
  let maybePromise;
2509
2538
  if (isInitialLoad) {
2510
2539
  if (BUILD.lazyLoad) {
2511
- if (BUILD.slotRelocation && hostRef.$deferredConnectedCallback$) {
2512
- hostRef.$deferredConnectedCallback$ = false;
2513
- safeCall(instance, "connectedCallback", void 0, elm);
2514
- }
2515
2540
  if (BUILD.hostListener) {
2516
2541
  hostRef.$flags$ |= HOST_FLAGS.isListenReady;
2517
2542
  if (hostRef.$queuedListeners$) {
@@ -2524,6 +2549,14 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
2524
2549
  if (BUILD.lifecycleDOMEvents) emitLifecycleEvent(elm, "componentWillLoad");
2525
2550
  maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
2526
2551
  } else {
2552
+ if (BUILD.updatable && hostRef.$queuedPropChanges$) {
2553
+ const changes = hostRef.$queuedPropChanges$;
2554
+ hostRef.$queuedPropChanges$ = void 0;
2555
+ if (safeCall(instance, "componentShouldUpdate", changes, elm) === false) {
2556
+ hostRef.$flags$ &= ~HOST_FLAGS.isQueuedForUpdate;
2557
+ return;
2558
+ }
2559
+ }
2527
2560
  if (BUILD.lifecycleDOMEvents) emitLifecycleEvent(elm, "componentWillUpdate");
2528
2561
  maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
2529
2562
  }
@@ -2638,7 +2671,6 @@ let renderingRef = null;
2638
2671
  const callRender = (hostRef, instance, elm, isInitialLoad) => {
2639
2672
  const allRenderFn = !!BUILD.allRenderFn;
2640
2673
  const lazyLoad = !!BUILD.lazyLoad;
2641
- const taskQueue = !!BUILD.taskQueue;
2642
2674
  const updatable = !!BUILD.updatable;
2643
2675
  try {
2644
2676
  renderingRef = instance;
@@ -2647,14 +2679,17 @@ const callRender = (hostRef, instance, elm, isInitialLoad) => {
2647
2679
  * method, so we can call the method immediately. If not, check before calling it.
2648
2680
  */
2649
2681
  instance = allRenderFn ? instance.render() : instance.render && instance.render();
2650
- if (updatable && taskQueue) hostRef.$flags$ &= ~HOST_FLAGS.isQueuedForUpdate;
2682
+ if (updatable) hostRef.$flags$ &= ~HOST_FLAGS.isQueuedForUpdate;
2651
2683
  if (updatable || lazyLoad) hostRef.$flags$ |= HOST_FLAGS.hasRendered;
2652
- if (BUILD.hasRenderFn || BUILD.reflect) if (BUILD.vdomRender || BUILD.reflect) if (BUILD.hydrateServerSide) return Promise.resolve(instance).then((value) => renderVdom(hostRef, value, isInitialLoad));
2653
- else renderVdom(hostRef, instance, isInitialLoad);
2654
- else {
2655
- const shadowRoot = elm.shadowRoot;
2656
- if (hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.shadowDomEncapsulation) shadowRoot.textContent = instance;
2657
- else elm.textContent = instance;
2684
+ if (BUILD.hasRenderFn || BUILD.reflect) {
2685
+ if (BUILD.vdomRender || BUILD.reflect) {
2686
+ if (BUILD.hydrateServerSide) return Promise.resolve(instance).then((value) => renderVdom(hostRef, value, isInitialLoad));
2687
+ else renderVdom(hostRef, instance, isInitialLoad);
2688
+ } else {
2689
+ const shadowRoot = elm.shadowRoot;
2690
+ if (hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.shadowDomEncapsulation) shadowRoot.textContent = instance;
2691
+ else elm.textContent = instance;
2692
+ }
2658
2693
  }
2659
2694
  } catch (e) {
2660
2695
  consoleError(e, hostRef.$hostElement$);
@@ -2794,17 +2829,19 @@ const initializeSignals = (elm, hostRef, cmpMeta) => {
2794
2829
  const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
2795
2830
  for (const [memberName, [memberFlags]] of Object.entries(cmpMeta.$members$ ?? {})) {
2796
2831
  if (!(memberFlags & MEMBER_FLAGS.PropLike)) continue;
2797
- const sig = signal(hostRef.$instanceValues$.get(memberName));
2832
+ const initialVal = hostRef.$instanceValues$.get(memberName);
2833
+ const sig = signal(initialVal);
2798
2834
  hostRef.$signalValues$.set(memberName, sig);
2799
2835
  let prevScheduleVal = sig.peek();
2800
2836
  disposers.push(effect(() => {
2801
2837
  const newVal = sig.value;
2802
2838
  if (hostRef.$flags$ & HOST_FLAGS.hasRendered) {
2803
2839
  if (instance?.componentShouldUpdate) {
2804
- if (instance.componentShouldUpdate(newVal, prevScheduleVal, memberName) === false && !(hostRef.$flags$ & HOST_FLAGS.isQueuedForUpdate)) {
2805
- prevScheduleVal = newVal;
2806
- return;
2807
- }
2840
+ const changes = hostRef.$queuedPropChanges$ ||= {};
2841
+ changes[memberName] = {
2842
+ newVal,
2843
+ oldVal: changes[memberName]?.oldVal ?? prevScheduleVal
2844
+ };
2808
2845
  }
2809
2846
  if (!(hostRef.$flags$ & HOST_FLAGS.isQueuedForUpdate)) scheduleUpdate(hostRef, false);
2810
2847
  }
@@ -2839,7 +2876,8 @@ const initializeSignals = (elm, hostRef, cmpMeta) => {
2839
2876
  consoleError(e, elm);
2840
2877
  }
2841
2878
  }));
2842
- elm[STENCIL_SIGNALS_SYMBOL] = new Map([...hostRef.$signalValues$].filter(([k]) => (cmpMeta.$members$?.[k]?.[0] ?? 0) & MEMBER_FLAGS.Prop));
2879
+ const publicSignals = new Map([...hostRef.$signalValues$].filter(([k]) => (cmpMeta.$members$?.[k]?.[0] ?? 0) & MEMBER_FLAGS.Prop));
2880
+ elm[STENCIL_SIGNALS_SYMBOL] = publicSignals;
2843
2881
  hostRef.$signalCleanup$ = () => {
2844
2882
  disposers.forEach((d) => d());
2845
2883
  elm[STENCIL_SIGNALS_SYMBOL] = void 0;
@@ -2888,19 +2926,25 @@ const h = (nodeName, vnodeData, ...children) => {
2888
2926
  for (let i = 0; i < c.length; i++) {
2889
2927
  child = c[i];
2890
2928
  if (Array.isArray(child)) walk(child);
2891
- else if (child != null && typeof child !== "boolean") if (BUILD.vdomSignals && isSignalLike(child)) {
2892
- const sigVNode = newVNode(null, String(child.peek()));
2893
- sigVNode.$signal$ = child;
2894
- vNodeChildren.push(sigVNode);
2895
- lastSimple = false;
2896
- } else {
2897
- if (simple = typeof nodeName !== "function" && !isComplexType(child)) child = String(child);
2898
- else if (BUILD.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) consoleDevError(`vNode passed as children has unexpected type.
2899
- Make sure it's using the correct h() function.
2900
- Empty objects can also be the cause, look for JSX comments that became objects.`);
2901
- if (simple && lastSimple) vNodeChildren[vNodeChildren.length - 1].$text$ += child;
2902
- else vNodeChildren.push(simple ? newVNode(null, child) : child);
2903
- lastSimple = simple;
2929
+ else if (child != null && typeof child !== "boolean") {
2930
+ if (BUILD.vdomSignals && isSignalLike(child)) {
2931
+ const sigVNode = newVNode(null, String(child.peek()));
2932
+ sigVNode.$signal$ = child;
2933
+ vNodeChildren.push(sigVNode);
2934
+ lastSimple = false;
2935
+ } else {
2936
+ if (simple = typeof nodeName !== "function" && !isComplexType(child)) child = String(child);
2937
+ else if (typeof nodeName !== "function" && child.$flags$ === void 0) {
2938
+ if (BUILD.isDev) consoleDevError(`vNode passed as children has unexpected type.
2939
+ Make sure it's using the correct h() function.
2940
+ Empty objects can also be the cause, look for JSX comments that became objects.`);
2941
+ else consoleError("Invalid vNode child");
2942
+ continue;
2943
+ }
2944
+ if (simple && lastSimple) vNodeChildren[vNodeChildren.length - 1].$text$ += child;
2945
+ else vNodeChildren.push(simple ? newVNode(null, child) : child);
2946
+ lastSimple = simple;
2947
+ }
2904
2948
  }
2905
2949
  }
2906
2950
  };
@@ -3874,14 +3918,15 @@ const parsePropertyValue = (propValue, propType, isFormAssociated) => {
3874
3918
  /**
3875
3919
  * ensure this value is of the correct prop type
3876
3920
  */
3877
- if (BUILD.propBoolean && propType & MEMBER_FLAGS.Boolean)
3878
- /**
3879
- * For form-associated components, according to HTML spec, the presence of any boolean attribute
3880
- * (regardless of its value, even "false") should make the property true.
3881
- * For non-form-associated components, we maintain the legacy behavior where "false" becomes false.
3882
- */
3883
- if (BUILD.formAssociated && isFormAssociated && typeof propValue === "string") return propValue === "" || !!propValue;
3884
- else return propValue === "false" ? false : propValue === "" || !!propValue;
3921
+ if (BUILD.propBoolean && propType & MEMBER_FLAGS.Boolean) {
3922
+ /**
3923
+ * For form-associated components, according to HTML spec, the presence of any boolean attribute
3924
+ * (regardless of its value, even "false") should make the property true.
3925
+ * For non-form-associated components, we maintain the legacy behavior where "false" becomes false.
3926
+ */
3927
+ if (BUILD.formAssociated && isFormAssociated && typeof propValue === "string") return propValue === "" || !!propValue;
3928
+ else return propValue === "false" ? false : propValue === "" || !!propValue;
3929
+ }
3885
3930
  /**
3886
3931
  * force it to be a number
3887
3932
  */
@@ -3969,7 +4014,11 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
3969
4014
  }
3970
4015
  if (BUILD.updatable && flags & HOST_FLAGS.hasRendered) {
3971
4016
  if (instance.componentShouldUpdate) {
3972
- if (instance.componentShouldUpdate(newVal, oldVal, propName) === false && !(flags & HOST_FLAGS.isQueuedForUpdate)) return;
4017
+ const changes = hostRef.$queuedPropChanges$ ||= {};
4018
+ changes[propName] = {
4019
+ newVal,
4020
+ oldVal: changes[propName]?.oldVal ?? oldVal
4021
+ };
3973
4022
  }
3974
4023
  if (!(flags & HOST_FLAGS.isQueuedForUpdate)) scheduleUpdate(hostRef, false);
3975
4024
  }
@@ -4103,11 +4152,12 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
4103
4152
  };
4104
4153
  for (const deserializer of cmpMeta.$deserializers$[propName]) {
4105
4154
  const [[methodName]] = Object.entries(deserializer);
4106
- if (BUILD.lazyLoad) if (hostRef.$lazyInstance$) setVal(methodName, hostRef.$lazyInstance$);
4107
- else hostRef.$fetchedCbList$.push(() => {
4108
- setVal(methodName, hostRef.$lazyInstance$);
4109
- });
4110
- else setVal(methodName, this);
4155
+ if (BUILD.lazyLoad) {
4156
+ if (hostRef.$lazyInstance$) setVal(methodName, hostRef.$lazyInstance$);
4157
+ else hostRef.$fetchedCbList$.push(() => {
4158
+ setVal(methodName, hostRef.$lazyInstance$);
4159
+ });
4160
+ } else setVal(methodName, this);
4111
4161
  }
4112
4162
  return;
4113
4163
  } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && this[propName] == newValue) return;
@@ -4131,7 +4181,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
4131
4181
  if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) this[propName] = newValue;
4132
4182
  });
4133
4183
  };
4134
- Cstr.observedAttributes = Array.from(new Set([...Object.keys(cmpMeta.$watchers$ ?? {}), ...members.filter(([_, m]) => m[0] & MEMBER_FLAGS.HasAttribute).map(([propName, m]) => {
4184
+ Cstr.observedAttributes = Array.from(/* @__PURE__ */ new Set([...Object.keys(cmpMeta.$watchers$ ?? {}), ...members.filter(([_, m]) => m[0] & MEMBER_FLAGS.HasAttribute).map(([propName, m]) => {
4135
4185
  const attrName = m[1] || propName;
4136
4186
  attrNameToPropName.set(attrName, propName);
4137
4187
  if (BUILD.reflect && m[0] & MEMBER_FLAGS.ReflectAttr) cmpMeta.$attrsToReflect$?.push([propName, attrName]);
@@ -4158,6 +4208,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
4158
4208
  try {
4159
4209
  if ((hostRef.$flags$ & HOST_FLAGS.hasInitializedComponent) === 0) {
4160
4210
  hostRef.$flags$ |= HOST_FLAGS.hasInitializedComponent;
4211
+ hostRef.$flags$ &= ~HOST_FLAGS.hasFailedLoad;
4161
4212
  const bundleId = cmpMeta.$lazyBundleId$;
4162
4213
  if (BUILD.lazyLoad && bundleId) {
4163
4214
  const CstrImport = loadModule(cmpMeta, hostRef, hmrVersionId);
@@ -4166,7 +4217,12 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
4166
4217
  Cstr = await CstrImport;
4167
4218
  endLoad();
4168
4219
  } else Cstr = CstrImport;
4169
- if (!Cstr) throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
4220
+ if (!Cstr) {
4221
+ hostRef.$flags$ &= ~HOST_FLAGS.hasInitializedComponent;
4222
+ hostRef.$loadRetryCount$ = (hostRef.$loadRetryCount$ ?? 0) + 1;
4223
+ if (hostRef.$loadRetryCount$ < 3) hostRef.$flags$ |= HOST_FLAGS.hasFailedLoad;
4224
+ throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
4225
+ }
4170
4226
  if (BUILD.member && !Cstr.isProxied) {
4171
4227
  if (BUILD.propChangeCallback) {
4172
4228
  cmpMeta.$watchers$ = normalizeWatchers(Cstr.watchers);
@@ -4185,8 +4241,14 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
4185
4241
  }
4186
4242
  if (BUILD.member) hostRef.$flags$ &= ~HOST_FLAGS.isConstructingInstance;
4187
4243
  endNewInstance();
4188
- if (!(BUILD.slotRelocation && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation)) fireConnectedCallback(hostRef.$lazyInstance$, elm);
4189
- else hostRef.$deferredConnectedCallback$ = true;
4244
+ if (BUILD.asyncLoading && hostRef.$ancestorComponent$) await awaitAncestorConnected(hostRef.$ancestorComponent$);
4245
+ if (!(BUILD.slotRelocation && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation)) {
4246
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
4247
+ if (BUILD.asyncLoading) markFirstConnected(hostRef);
4248
+ } else queueMicrotask(() => {
4249
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
4250
+ if (BUILD.asyncLoading) markFirstConnected(hostRef);
4251
+ });
4190
4252
  } else Cstr = elm.constructor;
4191
4253
  if (BUILD.style && Cstr && Cstr.style) {
4192
4254
  /**
@@ -4245,7 +4307,8 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
4245
4307
  hostRef.$onRenderResolve$();
4246
4308
  hostRef.$onRenderResolve$ = void 0;
4247
4309
  }
4248
- if (BUILD.asyncLoading && hostRef.$onReadyResolve$) hostRef.$onReadyResolve$(elm);
4310
+ if (BUILD.asyncLoading) markFirstConnected(hostRef);
4311
+ if (BUILD.asyncLoading && hostRef.$onReadyResolve$ && !(hostRef.$flags$ & HOST_FLAGS.hasFailedLoad)) hostRef.$onReadyResolve$(elm);
4249
4312
  }
4250
4313
  };
4251
4314
  const fireConnectedCallback = (instance, elm) => {
@@ -4308,6 +4371,7 @@ const connectedCallback = (elm) => {
4308
4371
  } else {
4309
4372
  addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
4310
4373
  if (hostRef?.$lazyInstance$) fireConnectedCallback(hostRef.$lazyInstance$, elm);
4374
+ else if (hostRef.$flags$ & HOST_FLAGS.hasFailedLoad) setTimeout(() => initializeComponent(elm, hostRef, cmpMeta), LAZY_LOAD_RETRY_INTERVAL_MS);
4311
4375
  else if (hostRef?.$onReadyPromise$) hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
4312
4376
  }
4313
4377
  endConnected();
@@ -4337,6 +4401,7 @@ const disconnectedCallback = async (elm) => {
4337
4401
  hostRef.$signalCleanup$();
4338
4402
  hostRef.$signalCleanup$ = void 0;
4339
4403
  }
4404
+ if (BUILD.asyncLoading && hostRef && !(hostRef.$flags$ & HOST_FLAGS.hasFiredConnected)) markFirstConnected(hostRef);
4340
4405
  if (!BUILD.lazyLoad) disconnectInstance(elm);
4341
4406
  else if (hostRef?.$lazyInstance$) disconnectInstance(hostRef.$lazyInstance$, elm);
4342
4407
  else if (hostRef?.$onReadyPromise$) hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
@@ -4450,8 +4515,8 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
4450
4515
  const exclude = options.exclude || [];
4451
4516
  const _reg = options.registry ?? getRegistry();
4452
4517
  const head = win.document.head;
4453
- const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
4454
- const dataStyles = /* @__PURE__ */ win.document.createElement("style");
4518
+ const metaCharset = /*@__PURE__*/ head.querySelector("meta[charset]");
4519
+ const dataStyles = /*@__PURE__*/ win.document.createElement("style");
4455
4520
  const deferredConnectedCallbacks = [];
4456
4521
  let appLoadFallback;
4457
4522
  let isBootstrapping = true;
@@ -4519,8 +4584,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
4519
4584
  *
4520
4585
  * Also remove the reference from `deferredConnectedCallbacks` array
4521
4586
  * otherwise removed instances won't get garbage collected.
4587
+ *
4588
+ * Use `nextTick` (microtask) rather than `plt.raf` since
4589
+ * `requestAnimationFrame` callbacks do not fire while `document.hidden`
4522
4590
  */
4523
- plt.raf(() => {
4591
+ nextTick(() => {
4524
4592
  const hostRef = getHostRef(this);
4525
4593
  if (!hostRef) return;
4526
4594
  const i = deferredConnectedCallbacks.findIndex((host) => host === this);
@@ -4533,18 +4601,20 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
4533
4601
  }
4534
4602
  };
4535
4603
  if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && (BUILD.slotCloneNode || BUILD.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone)) patchCloneNode(HostElement.prototype);
4536
- if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) if (BUILD.lightDomPatches || BUILD.patchAll && cmpMeta.$flags$ & CMP_FLAGS.patchAll) applyLightDomPatches(HostElement.prototype);
4537
- else {
4538
- if (BUILD.slotChildNodes || BUILD.patchChildren && cmpMeta.$flags$ & CMP_FLAGS.patchChildren) patchChildSlotNodes(HostElement.prototype);
4539
- if (BUILD.slotDomMutations || BUILD.patchInsert && cmpMeta.$flags$ & CMP_FLAGS.patchInsert) {
4540
- patchSlotAppendChild(HostElement.prototype);
4541
- patchSlotAppend(HostElement.prototype);
4542
- patchSlotPrepend(HostElement.prototype);
4543
- patchSlotInsertAdjacentHTML(HostElement.prototype);
4544
- patchInsertBefore(HostElement.prototype);
4545
- patchSlotRemoveChild(HostElement.prototype);
4604
+ if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) {
4605
+ if (BUILD.lightDomPatches || BUILD.patchAll && cmpMeta.$flags$ & CMP_FLAGS.patchAll) applyLightDomPatches(HostElement.prototype);
4606
+ else {
4607
+ if (BUILD.slotChildNodes || BUILD.patchChildren && cmpMeta.$flags$ & CMP_FLAGS.patchChildren) patchChildSlotNodes(HostElement.prototype);
4608
+ if (BUILD.slotDomMutations || BUILD.patchInsert && cmpMeta.$flags$ & CMP_FLAGS.patchInsert) {
4609
+ patchSlotAppendChild(HostElement.prototype);
4610
+ patchSlotAppend(HostElement.prototype);
4611
+ patchSlotPrepend(HostElement.prototype);
4612
+ patchSlotInsertAdjacentHTML(HostElement.prototype);
4613
+ patchInsertBefore(HostElement.prototype);
4614
+ patchSlotRemoveChild(HostElement.prototype);
4615
+ }
4616
+ if (BUILD.slotTextContent) patchTextContent(HostElement.prototype);
4546
4617
  }
4547
- if (BUILD.slotTextContent) patchTextContent(HostElement.prototype);
4548
4618
  }
4549
4619
  if (BUILD.formAssociated && cmpMeta.$flags$ & CMP_FLAGS.formAssociated) HostElement.formAssociated = true;
4550
4620
  if (BUILD.hotModuleReplacement) HostElement.prototype["s-hmr"] = function(hmrVersionId) {
@@ -4575,9 +4645,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
4575
4645
  endBootstrap();
4576
4646
  };
4577
4647
  //#endregion
4578
- //#region src/runtime/fragment.ts
4579
- const Fragment = (_, children) => children;
4580
- //#endregion
4581
4648
  //#region src/runtime/host-listener.ts
4582
4649
  const addHostEventListeners = (elm, hostRef, listeners) => {
4583
4650
  if (BUILD.hostListener && listeners && win.document) listeners.map(([flags, name, method]) => {
@@ -4590,9 +4657,10 @@ const addHostEventListeners = (elm, hostRef, listeners) => {
4590
4657
  };
4591
4658
  const hostListenerProxy = (hostRef, methodName) => (ev) => {
4592
4659
  try {
4593
- if (BUILD.lazyLoad) if (hostRef.$flags$ & HOST_FLAGS.isListenReady) hostRef.$lazyInstance$?.[methodName](ev);
4594
- else (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
4595
- else hostRef.$hostElement$[methodName](ev);
4660
+ if (BUILD.lazyLoad) {
4661
+ if (hostRef.$flags$ & HOST_FLAGS.isListenReady) hostRef.$lazyInstance$?.[methodName](ev);
4662
+ else (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
4663
+ } else hostRef.$hostElement$[methodName](ev);
4596
4664
  } catch (e) {
4597
4665
  consoleError(e, hostRef.$hostElement$);
4598
4666
  }
@@ -4614,6 +4682,73 @@ function Mixin(...mixins) {
4614
4682
  return mixins.reduceRight((acc, mixin) => mixin(acc), baseClass);
4615
4683
  }
4616
4684
  //#endregion
4685
+ //#region src/runtime/reactive-controller.ts
4686
+ const ReactiveControllerHost = (Base) => class ReactiveControllerHostMixin extends Base {
4687
+ controllers = /* @__PURE__ */ new Set();
4688
+ #connected = false;
4689
+ #updateCompleteResolvers = [];
4690
+ addController(controller) {
4691
+ this.controllers.add(controller);
4692
+ if (this.#connected) controller.hostConnected?.();
4693
+ }
4694
+ removeController(controller) {
4695
+ this.controllers.delete(controller);
4696
+ }
4697
+ requestUpdate() {
4698
+ forceUpdate(this);
4699
+ }
4700
+ get updateComplete() {
4701
+ return new Promise((resolve) => this.#updateCompleteResolvers.push(resolve));
4702
+ }
4703
+ connectedCallback() {
4704
+ super.connectedCallback?.();
4705
+ this.#connected = true;
4706
+ const el = getElement(this);
4707
+ if (el && el !== this) {
4708
+ el.addController = (controller) => this.addController(controller);
4709
+ el.removeController = (controller) => this.removeController(controller);
4710
+ el.requestUpdate = () => this.requestUpdate();
4711
+ Object.defineProperty(el, "updateComplete", {
4712
+ configurable: true,
4713
+ get: () => this.updateComplete
4714
+ });
4715
+ }
4716
+ this.controllers.forEach((c) => c.hostConnected?.());
4717
+ }
4718
+ disconnectedCallback() {
4719
+ super.disconnectedCallback?.();
4720
+ this.#connected = false;
4721
+ this.controllers.forEach((c) => c.hostDisconnected?.());
4722
+ }
4723
+ async componentWillLoad() {
4724
+ await super.componentWillLoad?.();
4725
+ await Promise.all([...this.controllers].map((c) => c.hostWillLoad?.()));
4726
+ }
4727
+ componentDidLoad() {
4728
+ super.componentDidLoad?.();
4729
+ this.controllers.forEach((c) => c.hostDidLoad?.());
4730
+ }
4731
+ async componentWillRender() {
4732
+ await super.componentWillRender?.();
4733
+ await Promise.all([...this.controllers].map((c) => c.hostWillRender?.()));
4734
+ }
4735
+ componentDidRender() {
4736
+ super.componentDidRender?.();
4737
+ this.controllers.forEach((c) => c.hostDidRender?.());
4738
+ const resolvers = this.#updateCompleteResolvers;
4739
+ this.#updateCompleteResolvers = [];
4740
+ resolvers.forEach((resolve) => resolve(true));
4741
+ }
4742
+ async componentWillUpdate() {
4743
+ await super.componentWillUpdate?.();
4744
+ await Promise.all([...this.controllers].map((c) => c.hostWillUpdate?.()));
4745
+ }
4746
+ componentDidUpdate() {
4747
+ super.componentDidUpdate?.();
4748
+ this.controllers.forEach((c) => c.hostDidUpdate?.());
4749
+ }
4750
+ };
4751
+ //#endregion
4617
4752
  //#region src/runtime/render.ts
4618
4753
  /**
4619
4754
  * A WeakMap to persist HostRef objects across multiple render() calls to the
@@ -4700,4 +4835,4 @@ function hasKeys(obj) {
4700
4835
  return false;
4701
4836
  }
4702
4837
  //#endregion
4703
- export { HYDRATE_ID as A, Event as B, setAssetPath as C, DEFAULT_DOC_DATA as D, setPlatformHelpers as E, reWireGetterSetter as F, State as G, Method as H, AttachInternals as I, Build as J, Watch as K, AttrDeserialize as L, STENCIL_DOC_DATA as M, setErrorHandler as N, HYDRATED_CSS as O, getHostRef as P, Component as R, getAssetPath as S, writeTask as T, Prop as U, Listen as V, PropSerialize as W, Env as X, BUILD as Y, insertBefore as _, transformTag as a, getElement as b, Fragment as c, setMode as d, scopeCss as f, getRenderingRef as g, forceUpdate as h, setTagTransformer as i, NODE_TYPE as j, HYDRATE_CHILD_ID as k, bootstrapLazy as l, h as m, jsxDEV as n, render as o, Host as p, resolveVar as q, jsxs as r, Mixin as s, jsx as t, getMode as u, renderVdom as v, readTask as w, getShadowRoot as x, createEvent as y, Element$1 as z };
4838
+ export { HYDRATE_ID as A, setAssetPath as C, DEFAULT_DOC_DATA as D, setPlatformHelpers as E, reWireGetterSetter as F, Build as I, BUILD as L, STENCIL_DOC_DATA as M, setErrorHandler as N, HYDRATED_CSS as O, getHostRef as P, Env as R, getAssetPath as S, writeTask as T, insertBefore as _, transformTag as a, getElement as b, Mixin as c, setMode as d, scopeCss as f, getRenderingRef as g, forceUpdate as h, setTagTransformer as i, NODE_TYPE as j, HYDRATE_CHILD_ID as k, bootstrapLazy as l, h as m, jsxDEV as n, render as o, Host as p, jsxs as r, ReactiveControllerHost as s, jsx as t, getMode as u, renderVdom as v, readTask as w, getShadowRoot as x, createEvent as y };