@stencil/core 5.0.0-rc.1 → 5.0.0-rc.3

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.
@@ -785,7 +785,7 @@ const attachStyles = (hostRef) => {
785
785
  else if (BUILD.hydrateServerSide && BUILD.shadowModeClosed && flags & CMP_FLAGS.shadowNeedsScopedCss && flags & CMP_FLAGS.shadowModeClosed) styleContainerNode = elm;
786
786
  else styleContainerNode = elm.getRootNode();
787
787
  const scopeId = addStyle(styleContainerNode, cmpMeta, hostRef.$modeName$);
788
- if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & CMP_FLAGS.needsScopedEncapsulation) {
788
+ if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & (CMP_FLAGS.needsScopedEncapsulation | CMP_FLAGS.shadowNeedsScopedCss)) {
789
789
  elm["s-sc"] = scopeId;
790
790
  elm.classList.add(scopeId + "-h");
791
791
  }
@@ -1853,10 +1853,10 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
1853
1853
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1854
1854
  const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1855
1855
  if (isInitialLoad) {
1856
- const pendingConnects = BUILD.asyncLoading ? hostRef.$hostElement$["s-pc"] : void 0;
1857
- if (pendingConnects && pendingConnects.length > 0) return Promise.all(pendingConnects).then(dispatch).catch(dispatch);
1858
1856
  queueMicrotask(() => {
1859
- dispatch();
1857
+ const pendingConnects = BUILD.asyncLoading ? hostRef.$hostElement$["s-pc"] : void 0;
1858
+ if (pendingConnects && pendingConnects.length > 0) Promise.all(pendingConnects).then(dispatch, dispatch);
1859
+ else dispatch();
1860
1860
  });
1861
1861
  return;
1862
1862
  }
@@ -1845,7 +1845,7 @@ const validateComponentTag = (tag) => {
1845
1845
  };
1846
1846
  //#endregion
1847
1847
  //#region src/version.ts
1848
- const version = "5.0.0-rc.1";
1848
+ const version = "5.0.0-rc.3";
1849
1849
  //#endregion
1850
1850
  //#region src/compiler/events.ts
1851
1851
  const buildEvents = () => {
@@ -1,3 +1,3 @@
1
- import { A as version, C as hasStencilHydrateImport, D as parseCssOnlyComponents, E as replaceStencilHydrateImport, M as scopeCss, O as buildId, S as hasStencilGlobalsImport, T as replaceStencilGlobalsImport, _ as cmpMetaToDocsComponent, a as createPrerenderer, b as buildHydrateCss, c as createWorkerContext, d as nodeRequire, f as optimizeCss, g as generateManifest, h as generateComponentTypesFile, i as createSystem, j as versions, k as vermoji, l as createWorkerMessageHandler, m as validateHydrated, n as transpile, o as loadConfig, p as validateConfig, r as transpileSync, s as createCompiler, t as ts, u as optimizeJs, v as getScopeId, w as replaceStencilCssComponentsImport, x as hasStencilCssComponentsImport, y as foldBuildFlags } from "../compiler-C_Y38j4m.mjs";
2
- import { a as LOG_LEVELS, i as CustomElementsExportBehaviorOptions } from "../node-Bkq8vRnu.mjs";
1
+ import { A as version, C as hasStencilHydrateImport, D as parseCssOnlyComponents, E as replaceStencilHydrateImport, M as scopeCss, O as buildId, S as hasStencilGlobalsImport, T as replaceStencilGlobalsImport, _ as cmpMetaToDocsComponent, a as createPrerenderer, b as buildHydrateCss, c as createWorkerContext, d as nodeRequire, f as optimizeCss, g as generateManifest, h as generateComponentTypesFile, i as createSystem, j as versions, k as vermoji, l as createWorkerMessageHandler, m as validateHydrated, n as transpile, o as loadConfig, p as validateConfig, r as transpileSync, s as createCompiler, t as ts, u as optimizeJs, v as getScopeId, w as replaceStencilCssComponentsImport, x as hasStencilCssComponentsImport, y as foldBuildFlags } from "../compiler-CWpEJ4Fm.mjs";
2
+ import { a as LOG_LEVELS, i as CustomElementsExportBehaviorOptions } from "../node-Bsfi3pOs.mjs";
3
3
  export { CustomElementsExportBehaviorOptions, LOG_LEVELS, buildHydrateCss, buildId, cmpMetaToDocsComponent, createCompiler, createPrerenderer, createSystem, createWorkerContext, createWorkerMessageHandler, foldBuildFlags, generateComponentTypesFile, generateManifest, getScopeId, hasStencilCssComponentsImport, hasStencilGlobalsImport, hasStencilHydrateImport, loadConfig, nodeRequire, optimizeCss, optimizeJs, parseCssOnlyComponents, replaceStencilCssComponentsImport, replaceStencilGlobalsImport, replaceStencilHydrateImport, scopeCss, transpile, transpileSync, ts, validateConfig, validateHydrated, vermoji, version, versions };
@@ -1,9 +1,9 @@
1
1
  import { n as __require } from "./rolldown-runtime-BhDjJH2R.mjs";
2
- import { A as SSR_PROP_REF_PREFIX, D as HYDRATE_ID, E as HYDRATE_CHILD_ID, O as SERVER_BUILD_FLAGS, T as HYDRATED_CSS, k as SSR_PROPS_REGISTRY_KEY, w as CLIENT_BUILD_FLAGS } from "./client-BMtGBEQV.mjs";
2
+ import { A as SSR_PROP_REF_PREFIX, D as HYDRATE_ID, E as HYDRATE_CHILD_ID, O as SERVER_BUILD_FLAGS, T as HYDRATED_CSS, k as SSR_PROPS_REGISTRY_KEY, w as CLIENT_BUILD_FLAGS } from "./client-BA_FU9aB.mjs";
3
3
  import { $ as VALID_CONFIG_OUTPUT_TARGETS, A as DIST_LAZY, D as COPY, E as COLLECTION_MANIFEST_FILE_NAME, J as STANDALONE, L as EVENT_FLAGS, P as DOCS_JSON, Q as TYPES, R as GENERATED_DTS, S as ASSETS, T as COLLECTION_APP_DATA_FILE_NAME, U as LOADER_BUNDLE, X as STYLE_EXT, Y as STATS, a as isBoolean$1, b as unique, c as isFunction, d as isObject, et as WATCH_FLAGS, f as isString$1, g as sortBy, i as fromEntries, l as isIterable, m as noop, p as mergeIntoWith, r as flatOne, t as dashToPascalCase, u as isNumber$1, v as toDashCase, w as COLLECTION, y as toTitleCase, z as GLOBAL_STYLE } from "./helpers-pTCZhNi0.mjs";
4
4
  import { C as isRootPath, D as byteSize, E as stringifyRuntimeData, O as escapeRegExpSpecialCharacters, S as splitLineBreaks, _ as createOnWarnFn, a as getRolldownSourceMapOptions, c as relativizeSourceMap, d as map, f as ok, g as loadTypeScriptDiagnostics, h as loadTypeScriptDiagnostic, i as getInlineSourceMappingUrlLinker, l as rolldownToStencilSourceMap, m as augmentDiagnosticWithNode, n as validateComponentTag, o as getSourceMappingUrlForEndOfFile, r as isRemoteUrl, t as validateComponentModes, u as err, v as isRolldownError, w as formatComponentRuntimeMeta, x as normalizeDiagnostics, y as loadRolldownDiagnostics } from "./validation-C1mr0klL.mjs";
5
5
  import { $ as buildWarn, A as isOutputTargetDocsVscode, B as isValidConfigOutputTarget, C as isOutputTargetDistLazy, D as isOutputTargetDocsCustomElementsManifest, E as isOutputTargetDocsCustom, F as isOutputTargetSsrWasm, G as normalizeFsPath, H as shouldExcludeComponent, I as isOutputTargetStandalone, J as relative$1, K as normalizeFsPathQuery, L as isOutputTargetStats, M as isOutputTargetLoaderBundle, N as isOutputTargetServerRenderer, O as isOutputTargetDocsJson, P as isOutputTargetSsr, Q as buildJsonFileError, R as isOutputTargetTypes, S as isOutputTargetCustom, T as isOutputTargetDocsAgentSkill, U as join$2, V as relativeImport, Y as resolve$2, Z as buildError, a as hasDependency, b as isOutputTargetCollection, d as parsePackageJson, et as catchError, f as readOnlyArrayHasStringMember, g as getComponentsDtsSrcFilePath, h as filterExcludedComponents, i as getTextDocs, it as isGlob, j as isOutputTargetGlobalStyle, k as isOutputTargetDocsReadme, l as isTsFile, m as filterActiveTargets, n as createJsVarName, nt as hasWarning, o as isDtsFile, p as readPackageJson, q as normalizePath, r as generatePreamble, t as addDocBlock, tt as hasError, u as isTsxFile, v as getComponentsFromModules, w as isOutputTargetDocs, x as isOutputTargetCopy, y as isOutputTargetAssets, z as isOutputTargetWww } from "./util-CP6-333M.mjs";
6
- import { i as CustomElementsExportBehaviorOptions, o as buildEvents, r as createNodeLogger, t as createNodeSys } from "./node-Bkq8vRnu.mjs";
6
+ import { i as CustomElementsExportBehaviorOptions, o as buildEvents, r as createNodeLogger, t as createNodeSys } from "./node-Bsfi3pOs.mjs";
7
7
  import ts, { default as ts$1 } from "typescript";
8
8
  import { readFileSync } from "node:fs";
9
9
  import { basename, dirname, isAbsolute, join, resolve } from "node:path";
@@ -461,9 +461,9 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
461
461
  };
462
462
  //#endregion
463
463
  //#region src/version.ts
464
- const version = "5.0.0-rc.1";
465
- const buildId = "1794513770";
466
- const vermoji = "🌹";
464
+ const version = "5.0.0-rc.3";
465
+ const buildId = "1795035070";
466
+ const vermoji = "🐒";
467
467
  /**
468
468
  * Get the installed version of a tool/dependency.
469
469
  * Handles packages with exports maps that point to subdirectories.
@@ -14401,7 +14401,7 @@ const getBundleOptions = (config, buildCtx, compilerCtx, outputTarget) => {
14401
14401
  const conditionals = getStandaloneBuildConditionals(config, buildCtx.components);
14402
14402
  mergeCollectionBuildFlags(conditionals, compilerCtx.collections);
14403
14403
  return {
14404
- id: "customElements",
14404
+ id: `customElements-${outputTarget.customElementsExportBehavior ?? "default"}`,
14405
14405
  platform: "client",
14406
14406
  conditionals,
14407
14407
  customBeforeTransformers: getCustomBeforeTransformers(config, compilerCtx, buildCtx.components, outputTarget, buildCtx),
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { C as Build, S as setErrorHandler, _ as getAssetPath, a as transformTag, b as writeTask, c as Mixin, d as Host, f as h, g as getShadowRoot, h as getElement, i as setTagTransformer, l as getMode, m as getRenderingRef, o as render, p as forceUpdate, s as ReactiveControllerHost, u as setMode, v as setAssetPath, x as setPlatformHelpers, y as readTask } from "./client-BMtGBEQV.mjs";
1
+ import { C as Build, S as setErrorHandler, _ as getAssetPath, a as transformTag, b as writeTask, c as Mixin, d as Host, f as h, g as getShadowRoot, h as getElement, i as setTagTransformer, l as getMode, m as getRenderingRef, o as render, p as forceUpdate, s as ReactiveControllerHost, u as setMode, v as setAssetPath, x as setPlatformHelpers, y as readTask } from "./client-BA_FU9aB.mjs";
2
2
  import { t as Fragment } from "./fragment-Di1hWOC8.mjs";
3
3
  //#region src/client/client-decorators.ts
4
4
  /**
@@ -1,3 +1,3 @@
1
- import { n as jsxDEV, r as jsxs, t as jsx } from "./client-BMtGBEQV.mjs";
1
+ import { n as jsxDEV, r as jsxs, t as jsx } from "./client-BA_FU9aB.mjs";
2
2
  import { t as Fragment } from "./fragment-Di1hWOC8.mjs";
3
3
  export { Fragment, jsx, jsxDEV, jsxs };
@@ -1,5 +1,5 @@
1
1
  import { n as __require } from "./rolldown-runtime-BhDjJH2R.mjs";
2
- import "./client-BMtGBEQV.mjs";
2
+ import "./client-BA_FU9aB.mjs";
3
3
  import { c as isFunction, f as isString, m as noop, r as flatOne } from "./helpers-pTCZhNi0.mjs";
4
4
  import { X as TASK_CANCELED_MSG, Z as buildError, et as catchError, it as isGlob, q as normalizePath, rt as shouldIgnoreError } from "./util-CP6-333M.mjs";
5
5
  import fs from "node:fs";
@@ -1713,7 +1713,7 @@ const attachStyles = (hostRef) => {
1713
1713
  else if (BUILD.hydrateServerSide && BUILD.shadowModeClosed && flags & CMP_FLAGS.shadowNeedsScopedCss && flags & CMP_FLAGS.shadowModeClosed) styleContainerNode = elm;
1714
1714
  else styleContainerNode = elm.getRootNode();
1715
1715
  const scopeId = addStyle(styleContainerNode, cmpMeta, hostRef.$modeName$);
1716
- if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & CMP_FLAGS.needsScopedEncapsulation) {
1716
+ if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & (CMP_FLAGS.needsScopedEncapsulation | CMP_FLAGS.shadowNeedsScopedCss)) {
1717
1717
  elm["s-sc"] = scopeId;
1718
1718
  elm.classList.add(scopeId + "-h");
1719
1719
  }
@@ -2869,24 +2869,24 @@ const markFirstConnected = (hostRef) => {
2869
2869
  hostRef.$onFirstConnectResolve$ = void 0;
2870
2870
  };
2871
2871
  /**
2872
- * Wait for `ancestorElm` to be defined and its real `connectedCallback` to have completed.
2873
- * Shared by the lazy ({@link initializeComponent}) and standalone (`bootstrap-standalone.ts`)
2874
- * `connectedCallback` paths so a component never connects before its nearest Stencil
2875
- * ancestor, regardless of load order. Both call sites already check `BUILD.asyncLoading` and
2876
- * that an ancestor exists before calling this. Lazy's proxy classes are always pre-defined,
2877
- * so the `whenDefined` wait is a no-op there - it only does real work for standalone's
2878
- * autoloader, where the ancestor tag may not be defined yet.
2872
+ * Get a promise for `ancestorElm` to be defined and its real `connectedCallback` to have
2873
+ * completed, or `undefined` if it already has. Shared by the lazy ({@link initializeComponent})
2874
+ * and standalone (`bootstrap-standalone.ts`) `connectedCallback` paths so a component never
2875
+ * connects before its nearest Stencil ancestor, regardless of load order. Callers only `await`
2876
+ * a returned promise, so a component whose ancestor is already connected carries on
2877
+ * synchronously instead of losing a microtask. Lazy's proxy classes are always pre-defined, so
2878
+ * the `whenDefined` wait only does real work for standalone's autoloader, where the ancestor
2879
+ * tag may not be defined yet.
2879
2880
  *
2880
2881
  * @param ancestorElm the nearest Stencil ancestor element
2881
2882
  * @param registry the registry the waiting component is defined in
2883
+ * @returns a promise to await, or `undefined` if there's nothing to wait for
2882
2884
  */
2883
- const awaitAncestorConnected = async (ancestorElm, registry) => {
2884
- let ancestorHostRef = getHostRef(ancestorElm);
2885
- if (!BUILD.lazyLoad && !ancestorHostRef) {
2886
- await registry.whenDefined(ancestorElm.tagName.toLowerCase());
2887
- ancestorHostRef = getHostRef(ancestorElm);
2888
- }
2889
- if (ancestorHostRef && !(ancestorHostRef.$flags$ & HOST_FLAGS.hasFiredConnected)) await ensureFirstConnectPromise(ancestorHostRef);
2885
+ const whenAncestorConnected = (ancestorElm, registry) => {
2886
+ const pendingConnect = (hostRef) => hostRef && !(hostRef.$flags$ & HOST_FLAGS.hasFiredConnected) ? ensureFirstConnectPromise(hostRef) : void 0;
2887
+ const ancestorHostRef = getHostRef(ancestorElm);
2888
+ if (!BUILD.lazyLoad && !ancestorHostRef) return registry.whenDefined(ancestorElm.tagName.toLowerCase()).then(() => pendingConnect(getHostRef(ancestorElm)));
2889
+ return pendingConnect(ancestorHostRef);
2890
2890
  };
2891
2891
  const attachToAncestor = (hostRef, ancestorComponent) => {
2892
2892
  if (BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
@@ -2906,10 +2906,10 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
2906
2906
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
2907
2907
  const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
2908
2908
  if (isInitialLoad) {
2909
- const pendingConnects = BUILD.asyncLoading ? hostRef.$hostElement$["s-pc"] : void 0;
2910
- if (pendingConnects && pendingConnects.length > 0) return Promise.all(pendingConnects).then(dispatch).catch(dispatch);
2911
2909
  queueMicrotask(() => {
2912
- dispatch();
2910
+ const pendingConnects = BUILD.asyncLoading ? hostRef.$hostElement$["s-pc"] : void 0;
2911
+ if (pendingConnects && pendingConnects.length > 0) Promise.all(pendingConnects).then(dispatch, dispatch);
2912
+ else dispatch();
2913
2913
  });
2914
2914
  return;
2915
2915
  }
@@ -3502,7 +3502,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
3502
3502
  let scopeId;
3503
3503
  if (BUILD.scoped) {
3504
3504
  const cmpMeta = hostRef.$cmpMeta$;
3505
- if (cmpMeta && cmpMeta.$flags$ & CMP_FLAGS.needsScopedEncapsulation && hostElm["s-sc"]) {
3505
+ if (cmpMeta && cmpMeta.$flags$ & (CMP_FLAGS.needsScopedEncapsulation | CMP_FLAGS.shadowNeedsScopedCss) && hostElm["s-sc"]) {
3506
3506
  scopeId = hostElm["s-sc"];
3507
3507
  hostElm.classList.add(scopeId + "-h");
3508
3508
  } else if (hostElm["s-sc"]) delete hostElm["s-sc"];
@@ -4690,7 +4690,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
4690
4690
  replayPendingSetterValues(hostRef, cmpMeta);
4691
4691
  }
4692
4692
  endNewInstance();
4693
- if (BUILD.asyncLoading && hostRef.$ancestorComponent$) await awaitAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(elm));
4693
+ if (BUILD.asyncLoading && hostRef.$ancestorComponent$) {
4694
+ const ancestorConnected = whenAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(elm));
4695
+ if (ancestorConnected) await ancestorConnected;
4696
+ }
4694
4697
  if (!(BUILD.slotRelocation && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation)) {
4695
4698
  fireConnectedCallback(hostRef.$lazyInstance$, elm);
4696
4699
  if (BUILD.asyncLoading) markFirstConnected(hostRef);
@@ -5091,8 +5094,11 @@ const proxyCustomElement = (Cstr, compactMeta) => {
5091
5094
  }
5092
5095
  connectedCallback(this);
5093
5096
  if (BUILD.asyncLoading && hostRef && hostRef.$ancestorComponent$) {
5094
- await awaitAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(this));
5095
- if (!this.isConnected) return;
5097
+ const ancestorConnected = whenAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(this));
5098
+ if (ancestorConnected) {
5099
+ await ancestorConnected;
5100
+ if (!this.isConnected) return;
5101
+ }
5096
5102
  }
5097
5103
  if (originalConnectedCallback && (plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected) === 0) originalConnectedCallback.call(this);
5098
5104
  if (BUILD.asyncLoading && hostRef) markFirstConnected(hostRef);
@@ -1707,7 +1707,7 @@ const attachStyles = (hostRef) => {
1707
1707
  else if (BUILD$1.hydrateServerSide && BUILD$1.shadowModeClosed && flags & CMP_FLAGS.shadowNeedsScopedCss && flags & CMP_FLAGS.shadowModeClosed) styleContainerNode = elm;
1708
1708
  else styleContainerNode = elm.getRootNode();
1709
1709
  const scopeId = addStyle(styleContainerNode, cmpMeta, hostRef.$modeName$);
1710
- if ((BUILD$1.shadowDom || BUILD$1.scoped) && BUILD$1.cssAnnotations && flags & CMP_FLAGS.needsScopedEncapsulation) {
1710
+ if ((BUILD$1.shadowDom || BUILD$1.scoped) && BUILD$1.cssAnnotations && flags & (CMP_FLAGS.needsScopedEncapsulation | CMP_FLAGS.shadowNeedsScopedCss)) {
1711
1711
  elm["s-sc"] = scopeId;
1712
1712
  elm.classList.add(scopeId + "-h");
1713
1713
  }
@@ -2863,24 +2863,24 @@ const markFirstConnected = (hostRef) => {
2863
2863
  hostRef.$onFirstConnectResolve$ = void 0;
2864
2864
  };
2865
2865
  /**
2866
- * Wait for `ancestorElm` to be defined and its real `connectedCallback` to have completed.
2867
- * Shared by the lazy ({@link initializeComponent}) and standalone (`bootstrap-standalone.ts`)
2868
- * `connectedCallback` paths so a component never connects before its nearest Stencil
2869
- * ancestor, regardless of load order. Both call sites already check `BUILD.asyncLoading` and
2870
- * that an ancestor exists before calling this. Lazy's proxy classes are always pre-defined,
2871
- * so the `whenDefined` wait is a no-op there - it only does real work for standalone's
2872
- * autoloader, where the ancestor tag may not be defined yet.
2866
+ * Get a promise for `ancestorElm` to be defined and its real `connectedCallback` to have
2867
+ * completed, or `undefined` if it already has. Shared by the lazy ({@link initializeComponent})
2868
+ * and standalone (`bootstrap-standalone.ts`) `connectedCallback` paths so a component never
2869
+ * connects before its nearest Stencil ancestor, regardless of load order. Callers only `await`
2870
+ * a returned promise, so a component whose ancestor is already connected carries on
2871
+ * synchronously instead of losing a microtask. Lazy's proxy classes are always pre-defined, so
2872
+ * the `whenDefined` wait only does real work for standalone's autoloader, where the ancestor
2873
+ * tag may not be defined yet.
2873
2874
  *
2874
2875
  * @param ancestorElm the nearest Stencil ancestor element
2875
2876
  * @param registry the registry the waiting component is defined in
2877
+ * @returns a promise to await, or `undefined` if there's nothing to wait for
2876
2878
  */
2877
- const awaitAncestorConnected = async (ancestorElm, registry) => {
2878
- let ancestorHostRef = getHostRef(ancestorElm);
2879
- if (!BUILD$1.lazyLoad && !ancestorHostRef) {
2880
- await registry.whenDefined(ancestorElm.tagName.toLowerCase());
2881
- ancestorHostRef = getHostRef(ancestorElm);
2882
- }
2883
- if (ancestorHostRef && !(ancestorHostRef.$flags$ & HOST_FLAGS.hasFiredConnected)) await ensureFirstConnectPromise(ancestorHostRef);
2879
+ const whenAncestorConnected = (ancestorElm, registry) => {
2880
+ const pendingConnect = (hostRef) => hostRef && !(hostRef.$flags$ & HOST_FLAGS.hasFiredConnected) ? ensureFirstConnectPromise(hostRef) : void 0;
2881
+ const ancestorHostRef = getHostRef(ancestorElm);
2882
+ if (!BUILD$1.lazyLoad && !ancestorHostRef) return registry.whenDefined(ancestorElm.tagName.toLowerCase()).then(() => pendingConnect(getHostRef(ancestorElm)));
2883
+ return pendingConnect(ancestorHostRef);
2884
2884
  };
2885
2885
  const attachToAncestor = (hostRef, ancestorComponent) => {
2886
2886
  if (BUILD$1.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
@@ -2900,10 +2900,10 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
2900
2900
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
2901
2901
  const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
2902
2902
  if (isInitialLoad) {
2903
- const pendingConnects = BUILD$1.asyncLoading ? hostRef.$hostElement$["s-pc"] : void 0;
2904
- if (pendingConnects && pendingConnects.length > 0) return Promise.all(pendingConnects).then(dispatch).catch(dispatch);
2905
2903
  queueMicrotask(() => {
2906
- dispatch();
2904
+ const pendingConnects = BUILD$1.asyncLoading ? hostRef.$hostElement$["s-pc"] : void 0;
2905
+ if (pendingConnects && pendingConnects.length > 0) Promise.all(pendingConnects).then(dispatch, dispatch);
2906
+ else dispatch();
2907
2907
  });
2908
2908
  return;
2909
2909
  }
@@ -3496,7 +3496,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
3496
3496
  let scopeId;
3497
3497
  if (BUILD$1.scoped) {
3498
3498
  const cmpMeta = hostRef.$cmpMeta$;
3499
- if (cmpMeta && cmpMeta.$flags$ & CMP_FLAGS.needsScopedEncapsulation && hostElm["s-sc"]) {
3499
+ if (cmpMeta && cmpMeta.$flags$ & (CMP_FLAGS.needsScopedEncapsulation | CMP_FLAGS.shadowNeedsScopedCss) && hostElm["s-sc"]) {
3500
3500
  scopeId = hostElm["s-sc"];
3501
3501
  hostElm.classList.add(scopeId + "-h");
3502
3502
  } else if (hostElm["s-sc"]) delete hostElm["s-sc"];
@@ -4684,7 +4684,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
4684
4684
  replayPendingSetterValues(hostRef, cmpMeta);
4685
4685
  }
4686
4686
  endNewInstance();
4687
- if (BUILD$1.asyncLoading && hostRef.$ancestorComponent$) await awaitAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(elm));
4687
+ if (BUILD$1.asyncLoading && hostRef.$ancestorComponent$) {
4688
+ const ancestorConnected = whenAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(elm));
4689
+ if (ancestorConnected) await ancestorConnected;
4690
+ }
4688
4691
  if (!(BUILD$1.slotRelocation && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation)) {
4689
4692
  fireConnectedCallback(hostRef.$lazyInstance$, elm);
4690
4693
  if (BUILD$1.asyncLoading) markFirstConnected(hostRef);
@@ -5085,8 +5088,11 @@ const proxyCustomElement = (Cstr, compactMeta) => {
5085
5088
  }
5086
5089
  connectedCallback(this);
5087
5090
  if (BUILD$1.asyncLoading && hostRef && hostRef.$ancestorComponent$) {
5088
- await awaitAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(this));
5089
- if (!this.isConnected) return;
5091
+ const ancestorConnected = whenAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(this));
5092
+ if (ancestorConnected) {
5093
+ await ancestorConnected;
5094
+ if (!this.isConnected) return;
5095
+ }
5090
5096
  }
5091
5097
  if (originalConnectedCallback && (plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected) === 0) originalConnectedCallback.call(this);
5092
5098
  if (BUILD$1.asyncLoading && hostRef) markFirstConnected(hostRef);
@@ -1579,7 +1579,7 @@ const attachStyles = (hostRef) => {
1579
1579
  else if (BUILD.hydrateServerSide && BUILD.shadowModeClosed && flags & CMP_FLAGS.shadowNeedsScopedCss && flags & CMP_FLAGS.shadowModeClosed) styleContainerNode = elm;
1580
1580
  else styleContainerNode = elm.getRootNode();
1581
1581
  const scopeId = addStyle(styleContainerNode, cmpMeta, hostRef.$modeName$);
1582
- if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & CMP_FLAGS.needsScopedEncapsulation) {
1582
+ if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & (CMP_FLAGS.needsScopedEncapsulation | CMP_FLAGS.shadowNeedsScopedCss)) {
1583
1583
  elm["s-sc"] = scopeId;
1584
1584
  elm.classList.add(scopeId + "-h");
1585
1585
  }
@@ -2735,24 +2735,24 @@ const markFirstConnected = (hostRef) => {
2735
2735
  hostRef.$onFirstConnectResolve$ = void 0;
2736
2736
  };
2737
2737
  /**
2738
- * Wait for `ancestorElm` to be defined and its real `connectedCallback` to have completed.
2739
- * Shared by the lazy ({@link initializeComponent}) and standalone (`bootstrap-standalone.ts`)
2740
- * `connectedCallback` paths so a component never connects before its nearest Stencil
2741
- * ancestor, regardless of load order. Both call sites already check `BUILD.asyncLoading` and
2742
- * that an ancestor exists before calling this. Lazy's proxy classes are always pre-defined,
2743
- * so the `whenDefined` wait is a no-op there - it only does real work for standalone's
2744
- * autoloader, where the ancestor tag may not be defined yet.
2738
+ * Get a promise for `ancestorElm` to be defined and its real `connectedCallback` to have
2739
+ * completed, or `undefined` if it already has. Shared by the lazy ({@link initializeComponent})
2740
+ * and standalone (`bootstrap-standalone.ts`) `connectedCallback` paths so a component never
2741
+ * connects before its nearest Stencil ancestor, regardless of load order. Callers only `await`
2742
+ * a returned promise, so a component whose ancestor is already connected carries on
2743
+ * synchronously instead of losing a microtask. Lazy's proxy classes are always pre-defined, so
2744
+ * the `whenDefined` wait only does real work for standalone's autoloader, where the ancestor
2745
+ * tag may not be defined yet.
2745
2746
  *
2746
2747
  * @param ancestorElm the nearest Stencil ancestor element
2747
2748
  * @param registry the registry the waiting component is defined in
2749
+ * @returns a promise to await, or `undefined` if there's nothing to wait for
2748
2750
  */
2749
- const awaitAncestorConnected = async (ancestorElm, registry) => {
2750
- let ancestorHostRef = getHostRef(ancestorElm);
2751
- if (!BUILD.lazyLoad && !ancestorHostRef) {
2752
- await registry.whenDefined(ancestorElm.tagName.toLowerCase());
2753
- ancestorHostRef = getHostRef(ancestorElm);
2754
- }
2755
- if (ancestorHostRef && !(ancestorHostRef.$flags$ & HOST_FLAGS.hasFiredConnected)) await ensureFirstConnectPromise(ancestorHostRef);
2751
+ const whenAncestorConnected = (ancestorElm, registry) => {
2752
+ const pendingConnect = (hostRef) => hostRef && !(hostRef.$flags$ & HOST_FLAGS.hasFiredConnected) ? ensureFirstConnectPromise(hostRef) : void 0;
2753
+ const ancestorHostRef = getHostRef(ancestorElm);
2754
+ if (!BUILD.lazyLoad && !ancestorHostRef) return registry.whenDefined(ancestorElm.tagName.toLowerCase()).then(() => pendingConnect(getHostRef(ancestorElm)));
2755
+ return pendingConnect(ancestorHostRef);
2756
2756
  };
2757
2757
  const attachToAncestor = (hostRef, ancestorComponent) => {
2758
2758
  if (BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
@@ -2772,10 +2772,10 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
2772
2772
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
2773
2773
  const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
2774
2774
  if (isInitialLoad) {
2775
- const pendingConnects = BUILD.asyncLoading ? hostRef.$hostElement$["s-pc"] : void 0;
2776
- if (pendingConnects && pendingConnects.length > 0) return Promise.all(pendingConnects).then(dispatch).catch(dispatch);
2777
2775
  queueMicrotask(() => {
2778
- dispatch();
2776
+ const pendingConnects = BUILD.asyncLoading ? hostRef.$hostElement$["s-pc"] : void 0;
2777
+ if (pendingConnects && pendingConnects.length > 0) Promise.all(pendingConnects).then(dispatch, dispatch);
2778
+ else dispatch();
2779
2779
  });
2780
2780
  return;
2781
2781
  }
@@ -3368,7 +3368,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
3368
3368
  let scopeId;
3369
3369
  if (BUILD.scoped) {
3370
3370
  const cmpMeta = hostRef.$cmpMeta$;
3371
- if (cmpMeta && cmpMeta.$flags$ & CMP_FLAGS.needsScopedEncapsulation && hostElm["s-sc"]) {
3371
+ if (cmpMeta && cmpMeta.$flags$ & (CMP_FLAGS.needsScopedEncapsulation | CMP_FLAGS.shadowNeedsScopedCss) && hostElm["s-sc"]) {
3372
3372
  scopeId = hostElm["s-sc"];
3373
3373
  hostElm.classList.add(scopeId + "-h");
3374
3374
  } else if (hostElm["s-sc"]) delete hostElm["s-sc"];
@@ -4556,7 +4556,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
4556
4556
  replayPendingSetterValues(hostRef, cmpMeta);
4557
4557
  }
4558
4558
  endNewInstance();
4559
- if (BUILD.asyncLoading && hostRef.$ancestorComponent$) await awaitAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(elm));
4559
+ if (BUILD.asyncLoading && hostRef.$ancestorComponent$) {
4560
+ const ancestorConnected = whenAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(elm));
4561
+ if (ancestorConnected) await ancestorConnected;
4562
+ }
4560
4563
  if (!(BUILD.slotRelocation && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation)) {
4561
4564
  fireConnectedCallback(hostRef.$lazyInstance$, elm);
4562
4565
  if (BUILD.asyncLoading) markFirstConnected(hostRef);
@@ -4957,8 +4960,11 @@ const proxyCustomElement = (Cstr, compactMeta) => {
4957
4960
  }
4958
4961
  connectedCallback(this);
4959
4962
  if (BUILD.asyncLoading && hostRef && hostRef.$ancestorComponent$) {
4960
- await awaitAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(this));
4961
- if (!this.isConnected) return;
4963
+ const ancestorConnected = whenAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(this));
4964
+ if (ancestorConnected) {
4965
+ await ancestorConnected;
4966
+ if (!this.isConnected) return;
4967
+ }
4962
4968
  }
4963
4969
  if (originalConnectedCallback && (plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected) === 0) originalConnectedCallback.call(this);
4964
4970
  if (BUILD.asyncLoading && hostRef) markFirstConnected(hostRef);
@@ -1350,7 +1350,7 @@ const attachStyles = (hostRef) => {
1350
1350
  else if (BUILD$1.hydrateServerSide && BUILD$1.shadowModeClosed && flags & CMP_FLAGS.shadowNeedsScopedCss && flags & CMP_FLAGS.shadowModeClosed) styleContainerNode = elm;
1351
1351
  else styleContainerNode = elm.getRootNode();
1352
1352
  const scopeId = addStyle(styleContainerNode, cmpMeta, hostRef.$modeName$);
1353
- if ((BUILD$1.shadowDom || BUILD$1.scoped) && BUILD$1.cssAnnotations && flags & CMP_FLAGS.needsScopedEncapsulation) {
1353
+ if ((BUILD$1.shadowDom || BUILD$1.scoped) && BUILD$1.cssAnnotations && flags & (CMP_FLAGS.needsScopedEncapsulation | CMP_FLAGS.shadowNeedsScopedCss)) {
1354
1354
  elm["s-sc"] = scopeId;
1355
1355
  elm.classList.add(scopeId + "-h");
1356
1356
  }
@@ -2507,24 +2507,24 @@ const markFirstConnected = (hostRef) => {
2507
2507
  hostRef.$onFirstConnectResolve$ = void 0;
2508
2508
  };
2509
2509
  /**
2510
- * Wait for `ancestorElm` to be defined and its real `connectedCallback` to have completed.
2511
- * Shared by the lazy ({@link initializeComponent}) and standalone (`bootstrap-standalone.ts`)
2512
- * `connectedCallback` paths so a component never connects before its nearest Stencil
2513
- * ancestor, regardless of load order. Both call sites already check `BUILD.asyncLoading` and
2514
- * that an ancestor exists before calling this. Lazy's proxy classes are always pre-defined,
2515
- * so the `whenDefined` wait is a no-op there - it only does real work for standalone's
2516
- * autoloader, where the ancestor tag may not be defined yet.
2510
+ * Get a promise for `ancestorElm` to be defined and its real `connectedCallback` to have
2511
+ * completed, or `undefined` if it already has. Shared by the lazy ({@link initializeComponent})
2512
+ * and standalone (`bootstrap-standalone.ts`) `connectedCallback` paths so a component never
2513
+ * connects before its nearest Stencil ancestor, regardless of load order. Callers only `await`
2514
+ * a returned promise, so a component whose ancestor is already connected carries on
2515
+ * synchronously instead of losing a microtask. Lazy's proxy classes are always pre-defined, so
2516
+ * the `whenDefined` wait only does real work for standalone's autoloader, where the ancestor
2517
+ * tag may not be defined yet.
2517
2518
  *
2518
2519
  * @param ancestorElm the nearest Stencil ancestor element
2519
2520
  * @param registry the registry the waiting component is defined in
2521
+ * @returns a promise to await, or `undefined` if there's nothing to wait for
2520
2522
  */
2521
- const awaitAncestorConnected = async (ancestorElm, registry) => {
2522
- let ancestorHostRef = getHostRef(ancestorElm);
2523
- if (!BUILD$1.lazyLoad && !ancestorHostRef) {
2524
- await registry.whenDefined(ancestorElm.tagName.toLowerCase());
2525
- ancestorHostRef = getHostRef(ancestorElm);
2526
- }
2527
- if (ancestorHostRef && !(ancestorHostRef.$flags$ & HOST_FLAGS.hasFiredConnected)) await ensureFirstConnectPromise(ancestorHostRef);
2523
+ const whenAncestorConnected = (ancestorElm, registry) => {
2524
+ const pendingConnect = (hostRef) => hostRef && !(hostRef.$flags$ & HOST_FLAGS.hasFiredConnected) ? ensureFirstConnectPromise(hostRef) : void 0;
2525
+ const ancestorHostRef = getHostRef(ancestorElm);
2526
+ if (!BUILD$1.lazyLoad && !ancestorHostRef) return registry.whenDefined(ancestorElm.tagName.toLowerCase()).then(() => pendingConnect(getHostRef(ancestorElm)));
2527
+ return pendingConnect(ancestorHostRef);
2528
2528
  };
2529
2529
  const attachToAncestor = (hostRef, ancestorComponent) => {
2530
2530
  if (BUILD$1.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
@@ -2544,10 +2544,10 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
2544
2544
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
2545
2545
  const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
2546
2546
  if (isInitialLoad) {
2547
- const pendingConnects = BUILD$1.asyncLoading ? hostRef.$hostElement$["s-pc"] : void 0;
2548
- if (pendingConnects && pendingConnects.length > 0) return Promise.all(pendingConnects).then(dispatch).catch(dispatch);
2549
2547
  queueMicrotask(() => {
2550
- dispatch();
2548
+ const pendingConnects = BUILD$1.asyncLoading ? hostRef.$hostElement$["s-pc"] : void 0;
2549
+ if (pendingConnects && pendingConnects.length > 0) Promise.all(pendingConnects).then(dispatch, dispatch);
2550
+ else dispatch();
2551
2551
  });
2552
2552
  return;
2553
2553
  }
@@ -3138,7 +3138,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
3138
3138
  let scopeId;
3139
3139
  if (BUILD$1.scoped) {
3140
3140
  const cmpMeta = hostRef.$cmpMeta$;
3141
- if (cmpMeta && cmpMeta.$flags$ & CMP_FLAGS.needsScopedEncapsulation && hostElm["s-sc"]) {
3141
+ if (cmpMeta && cmpMeta.$flags$ & (CMP_FLAGS.needsScopedEncapsulation | CMP_FLAGS.shadowNeedsScopedCss) && hostElm["s-sc"]) {
3142
3142
  scopeId = hostElm["s-sc"];
3143
3143
  hostElm.classList.add(scopeId + "-h");
3144
3144
  } else if (hostElm["s-sc"]) delete hostElm["s-sc"];
@@ -4326,7 +4326,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
4326
4326
  replayPendingSetterValues(hostRef, cmpMeta);
4327
4327
  }
4328
4328
  endNewInstance();
4329
- if (BUILD$1.asyncLoading && hostRef.$ancestorComponent$) await awaitAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(elm));
4329
+ if (BUILD$1.asyncLoading && hostRef.$ancestorComponent$) {
4330
+ const ancestorConnected = whenAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(elm));
4331
+ if (ancestorConnected) await ancestorConnected;
4332
+ }
4330
4333
  if (!(BUILD$1.slotRelocation && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation)) {
4331
4334
  fireConnectedCallback(hostRef.$lazyInstance$, elm);
4332
4335
  if (BUILD$1.asyncLoading) markFirstConnected(hostRef);
@@ -4727,8 +4730,11 @@ const proxyCustomElement = (Cstr, compactMeta) => {
4727
4730
  }
4728
4731
  connectedCallback(this);
4729
4732
  if (BUILD$1.asyncLoading && hostRef && hostRef.$ancestorComponent$) {
4730
- await awaitAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(this));
4731
- if (!this.isConnected) return;
4733
+ const ancestorConnected = whenAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(this));
4734
+ if (ancestorConnected) {
4735
+ await ancestorConnected;
4736
+ if (!this.isConnected) return;
4737
+ }
4732
4738
  }
4733
4739
  if (originalConnectedCallback && (plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected) === 0) originalConnectedCallback.call(this);
4734
4740
  if (BUILD$1.asyncLoading && hostRef) markFirstConnected(hostRef);
@@ -1,2 +1,2 @@
1
- import { n as setupNodeProcess, r as createNodeLogger, t as createNodeSys } from "../../node-Bkq8vRnu.mjs";
1
+ import { n as setupNodeProcess, r as createNodeLogger, t as createNodeSys } from "../../node-Bsfi3pOs.mjs";
2
2
  export { createNodeLogger, createNodeSys, setupNodeProcess };
@@ -1,5 +1,5 @@
1
- import { l as createWorkerMessageHandler } from "../../compiler-C_Y38j4m.mjs";
2
- import { t as createNodeSys } from "../../node-Bkq8vRnu.mjs";
1
+ import { l as createWorkerMessageHandler } from "../../compiler-CWpEJ4Fm.mjs";
2
+ import { t as createNodeSys } from "../../node-Bsfi3pOs.mjs";
3
3
  //#region src/sys/node/node-worker-thread.ts
4
4
  /**
5
5
  * Initialize a worker thread, setting up various machinery for managing
@@ -33,7 +33,7 @@ import "@rollup/pluginutils";
33
33
  import { createHash } from "crypto";
34
34
  import { afterAll, vi } from "vitest";
35
35
  //#region src/version.ts
36
- const version = "5.0.0-rc.1";
36
+ const version = "5.0.0-rc.3";
37
37
  const MEMBER_FLAGS = {
38
38
  String: 1,
39
39
  Number: 2,
@@ -2157,7 +2157,7 @@ const attachStyles = (hostRef) => {
2157
2157
  else if (BUILD.hydrateServerSide && BUILD.shadowModeClosed && flags & CMP_FLAGS.shadowNeedsScopedCss && flags & CMP_FLAGS.shadowModeClosed) styleContainerNode = elm;
2158
2158
  else styleContainerNode = elm.getRootNode();
2159
2159
  const scopeId = addStyle(styleContainerNode, cmpMeta, hostRef.$modeName$);
2160
- if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & CMP_FLAGS.needsScopedEncapsulation) {
2160
+ if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & (CMP_FLAGS.needsScopedEncapsulation | CMP_FLAGS.shadowNeedsScopedCss)) {
2161
2161
  elm["s-sc"] = scopeId;
2162
2162
  elm.classList.add(scopeId + "-h");
2163
2163
  }
@@ -3261,24 +3261,24 @@ const markFirstConnected = (hostRef) => {
3261
3261
  hostRef.$onFirstConnectResolve$ = void 0;
3262
3262
  };
3263
3263
  /**
3264
- * Wait for `ancestorElm` to be defined and its real `connectedCallback` to have completed.
3265
- * Shared by the lazy ({@link initializeComponent}) and standalone (`bootstrap-standalone.ts`)
3266
- * `connectedCallback` paths so a component never connects before its nearest Stencil
3267
- * ancestor, regardless of load order. Both call sites already check `BUILD.asyncLoading` and
3268
- * that an ancestor exists before calling this. Lazy's proxy classes are always pre-defined,
3269
- * so the `whenDefined` wait is a no-op there - it only does real work for standalone's
3270
- * autoloader, where the ancestor tag may not be defined yet.
3264
+ * Get a promise for `ancestorElm` to be defined and its real `connectedCallback` to have
3265
+ * completed, or `undefined` if it already has. Shared by the lazy ({@link initializeComponent})
3266
+ * and standalone (`bootstrap-standalone.ts`) `connectedCallback` paths so a component never
3267
+ * connects before its nearest Stencil ancestor, regardless of load order. Callers only `await`
3268
+ * a returned promise, so a component whose ancestor is already connected carries on
3269
+ * synchronously instead of losing a microtask. Lazy's proxy classes are always pre-defined, so
3270
+ * the `whenDefined` wait only does real work for standalone's autoloader, where the ancestor
3271
+ * tag may not be defined yet.
3271
3272
  *
3272
3273
  * @param ancestorElm the nearest Stencil ancestor element
3273
3274
  * @param registry the registry the waiting component is defined in
3275
+ * @returns a promise to await, or `undefined` if there's nothing to wait for
3274
3276
  */
3275
- const awaitAncestorConnected = async (ancestorElm, registry) => {
3276
- let ancestorHostRef = getHostRef(ancestorElm);
3277
- if (!BUILD.lazyLoad && !ancestorHostRef) {
3278
- await registry.whenDefined(ancestorElm.tagName.toLowerCase());
3279
- ancestorHostRef = getHostRef(ancestorElm);
3280
- }
3281
- if (ancestorHostRef && !(ancestorHostRef.$flags$ & HOST_FLAGS.hasFiredConnected)) await ensureFirstConnectPromise(ancestorHostRef);
3277
+ const whenAncestorConnected = (ancestorElm, registry) => {
3278
+ const pendingConnect = (hostRef) => hostRef && !(hostRef.$flags$ & HOST_FLAGS.hasFiredConnected) ? ensureFirstConnectPromise(hostRef) : void 0;
3279
+ const ancestorHostRef = getHostRef(ancestorElm);
3280
+ if (!BUILD.lazyLoad && !ancestorHostRef) return registry.whenDefined(ancestorElm.tagName.toLowerCase()).then(() => pendingConnect(getHostRef(ancestorElm)));
3281
+ return pendingConnect(ancestorHostRef);
3282
3282
  };
3283
3283
  const attachToAncestor = (hostRef, ancestorComponent) => {
3284
3284
  if (BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
@@ -3298,10 +3298,10 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
3298
3298
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
3299
3299
  const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
3300
3300
  if (isInitialLoad) {
3301
- const pendingConnects = BUILD.asyncLoading ? hostRef.$hostElement$["s-pc"] : void 0;
3302
- if (pendingConnects && pendingConnects.length > 0) return Promise.all(pendingConnects).then(dispatch).catch(dispatch);
3303
3301
  queueMicrotask(() => {
3304
- dispatch();
3302
+ const pendingConnects = BUILD.asyncLoading ? hostRef.$hostElement$["s-pc"] : void 0;
3303
+ if (pendingConnects && pendingConnects.length > 0) Promise.all(pendingConnects).then(dispatch, dispatch);
3304
+ else dispatch();
3305
3305
  });
3306
3306
  return;
3307
3307
  }
@@ -3894,7 +3894,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
3894
3894
  let scopeId;
3895
3895
  if (BUILD.scoped) {
3896
3896
  const cmpMeta = hostRef.$cmpMeta$;
3897
- if (cmpMeta && cmpMeta.$flags$ & CMP_FLAGS.needsScopedEncapsulation && hostElm["s-sc"]) {
3897
+ if (cmpMeta && cmpMeta.$flags$ & (CMP_FLAGS.needsScopedEncapsulation | CMP_FLAGS.shadowNeedsScopedCss) && hostElm["s-sc"]) {
3898
3898
  scopeId = hostElm["s-sc"];
3899
3899
  hostElm.classList.add(scopeId + "-h");
3900
3900
  } else if (hostElm["s-sc"]) delete hostElm["s-sc"];
@@ -5067,7 +5067,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
5067
5067
  replayPendingSetterValues(hostRef, cmpMeta);
5068
5068
  }
5069
5069
  endNewInstance();
5070
- if (BUILD.asyncLoading && hostRef.$ancestorComponent$) await awaitAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(elm));
5070
+ if (BUILD.asyncLoading && hostRef.$ancestorComponent$) {
5071
+ const ancestorConnected = whenAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(elm));
5072
+ if (ancestorConnected) await ancestorConnected;
5073
+ }
5071
5074
  if (!(BUILD.slotRelocation && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation)) {
5072
5075
  fireConnectedCallback(hostRef.$lazyInstance$, elm);
5073
5076
  if (BUILD.asyncLoading) markFirstConnected(hostRef);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core",
3
- "version": "5.0.0-rc.1",
3
+ "version": "5.0.0-rc.3",
4
4
  "description": "A Compiler for Web Components and Progressive Web Apps",
5
5
  "keywords": [
6
6
  "components",
@@ -126,9 +126,9 @@
126
126
  "terser": "^5.50.0",
127
127
  "tinyglobby": "^0.2.17",
128
128
  "typescript": ">5.0.0 <7.0.0",
129
- "@stencil/dev-server": "5.0.0-rc.1",
130
- "@stencil/mock-doc": "5.0.0-rc.1",
131
- "@stencil/cli": "5.0.0-rc.1"
129
+ "@stencil/cli": "5.0.0-rc.3",
130
+ "@stencil/mock-doc": "5.0.0-rc.3",
131
+ "@stencil/dev-server": "5.0.0-rc.3"
132
132
  },
133
133
  "devDependencies": {
134
134
  "@ionic/prettier-config": "^4.0.0",