@stencil/core 5.0.0-rc.14 → 5.0.0-rc.15

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.
@@ -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.14";
1848
+ const version = "5.0.0-rc.15";
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-C451Mp7c.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-D92bSZzV.mjs";
2
2
  import { a as LOG_LEVELS, i as CustomElementsExportBehaviorOptions } from "../node-C6N23fLr.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 };
@@ -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.14";
465
- const buildId = "1795740246";
466
- const vermoji = "🛩";
464
+ const version = "5.0.0-rc.15";
465
+ const buildId = "1795800086";
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.
@@ -8698,7 +8698,8 @@ const getLazyEntry = (isBrowser, assetPath, externalRuntime = false) => {
8698
8698
  const platformExports = [
8699
8699
  "setNonce",
8700
8700
  "setRegistry",
8701
- "setTagTransformer"
8701
+ "setTagTransformer",
8702
+ "transformTag"
8702
8703
  ];
8703
8704
  if (assetPath) platformExports.push("setAssetPath");
8704
8705
  s.append(`export { ${platformExports.join(", ")} } from '${STENCIL_CORE_ID}';\n`);
@@ -11924,6 +11925,12 @@ export type TagTransformer = (tag: string) => string;
11924
11925
  * Useful for namespacing (e.g. \`my-button\` → \`acme-button\`) in multi-library pages.
11925
11926
  */
11926
11927
  export declare function setTagTransformer(transformer: TagTransformer): void;
11928
+
11929
+ /**
11930
+ * Pass a tag name through the installed tag transformer (returns it unchanged if none is set).
11931
+ * Useful for framework wrappers and imperative code that creates components by tag name.
11932
+ */
11933
+ export declare function transformTag(tag: string): string;
11927
11934
  ${hasAssets ? `
11928
11935
  /**
11929
11936
  * Used to manually set the base path where component assets can be found. The
@@ -11975,6 +11982,12 @@ export type TagTransformer = (tag: string) => string;
11975
11982
  */
11976
11983
  export declare const setTagTransformer: (transformer: TagTransformer) => void;
11977
11984
 
11985
+ /**
11986
+ * Pass a tag name through the installed tag transformer (returns it unchanged if none is set).
11987
+ * Useful for framework wrappers and imperative code that creates components by tag name.
11988
+ */
11989
+ export declare const transformTag: (tag: string) => string;
11990
+
11978
11991
  export interface SetPlatformOptions {
11979
11992
  raf?: (c: FrameRequestCallback) => number;
11980
11993
  ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
@@ -14293,7 +14306,7 @@ const generateLoaderModule = (components, outputTarget, relativeAssetPath) => {
14293
14306
  import { transformTag, getRegistry } from '${STENCIL_INTERNAL_STANDALONE_CLIENT_PLATFORM_ID}';
14294
14307
  // The same platform setters as the output's index.js. With \`autoStart: false\`, call them before
14295
14308
  // start() - e.g. setRegistry() for a scoped registry - without importing every component.
14296
- export { setNonce, setRegistry, setTagTransformer, setPlatformOptions } from '${STENCIL_INTERNAL_STANDALONE_CLIENT_PLATFORM_ID}';
14309
+ export { setNonce, setRegistry, setTagTransformer, transformTag, setPlatformOptions } from '${STENCIL_INTERNAL_STANDALONE_CLIENT_PLATFORM_ID}';
14297
14310
  ${assetPathImport}${assetPathInit}
14298
14311
 
14299
14312
  /**
@@ -14688,7 +14701,7 @@ const generateEntryPoint = (outputTarget, cmpImports = [], cmpExports = [], cmpN
14688
14701
  const body = [];
14689
14702
  const imports = [];
14690
14703
  const exports = [];
14691
- exports.push(`export { setNonce, setRegistry, setTagTransformer, setPlatformOptions } from '${STENCIL_INTERNAL_STANDALONE_CLIENT_PLATFORM_ID}';`, `export * from '${USER_INDEX_ENTRY_ID}';`);
14704
+ exports.push(`export { setNonce, setRegistry, setTagTransformer, transformTag, setPlatformOptions } from '${STENCIL_INTERNAL_STANDALONE_CLIENT_PLATFORM_ID}';`, `export * from '${USER_INDEX_ENTRY_ID}';`);
14692
14705
  if (relativeAssetPath) {
14693
14706
  imports.push(`import { setAssetPath } from '${STENCIL_INTERNAL_STANDALONE_CLIENT_PLATFORM_ID}';`);
14694
14707
  exports.push(`export { setAssetPath };`);
@@ -5010,12 +5010,12 @@ const hmrApplyClass = (cmpMeta, NewClass) => {
5010
5010
  /**
5011
5011
  * SSR hosts connected while the HTML parser is still inside them (streamed documents),
5012
5012
  * in connection order - which is document order. Each is held until its subtree is
5013
- * parsed so hydration sees its declarative shadow root and children.
5013
+ * parsed so hydration sees its declarative shadow root and children, and watched for
5014
+ * its end marker arriving (wherever it is - a document observer can't see into shadow roots).
5014
5015
  */
5015
- const pending = /* @__PURE__ */ new Set();
5016
+ const pending = /* @__PURE__ */ new Map();
5016
5017
  /** SSR hosts seen parsed: hydration may since have moved or removed their end marker */
5017
5018
  const parsedHosts = /* @__PURE__ */ new WeakSet();
5018
- let observer;
5019
5019
  const parentOf = (node) => node.parentNode ?? (node.nodeType === NODE_TYPE.DocumentFragment ? node.host : null);
5020
5020
  /**
5021
5021
  * The server writes a `HOST_END_ID` comment as an SSR host's last child, so the parser has
@@ -5035,17 +5035,17 @@ const hasPendingAncestor = (elm) => {
5035
5035
  for (let n = parentOf(elm); n; n = parentOf(n)) if (pending.has(n)) return true;
5036
5036
  return false;
5037
5037
  };
5038
+ const drop = (elm) => {
5039
+ pending.get(elm)?.disconnect();
5040
+ pending.delete(elm);
5041
+ };
5038
5042
  const flush = () => {
5039
- for (const elm of pending) if (!elm.isConnected) pending.delete(elm);
5043
+ for (const elm of pending.keys()) if (!elm.isConnected) drop(elm);
5040
5044
  else if (isParsed(elm)) elm.__attachShadow?.();
5041
- for (const elm of pending) if (isParsed(elm) && !hasPendingAncestor(elm)) {
5042
- pending.delete(elm);
5045
+ for (const elm of pending.keys()) if (isParsed(elm) && !hasPendingAncestor(elm)) {
5046
+ drop(elm);
5043
5047
  elm.connectedCallback?.();
5044
5048
  }
5045
- if (!pending.size) {
5046
- observer?.disconnect();
5047
- observer = void 0;
5048
- }
5049
5049
  };
5050
5050
  /**
5051
5051
  * Whether the parser may still be adding children (including a declarative shadow root)
@@ -5064,18 +5064,13 @@ const mayStillBeParsing = (elm) => win.document?.readyState === "loading" && (!e
5064
5064
  const deferUntilParsed = (elm) => {
5065
5065
  if (pending.has(elm)) return true;
5066
5066
  if (!win.document || !elm.hasAttribute("s-id")) return false;
5067
- const parsed = isParsed(elm);
5068
- if (parsed && !hasPendingAncestor(elm)) return false;
5069
- if (parsed) elm.__attachShadow?.();
5070
- pending.add(elm);
5071
- if (!observer) {
5072
- observer = new MutationObserver(flush);
5073
- observer.observe(win.document, {
5074
- childList: true,
5075
- subtree: true
5076
- });
5077
- win.document.addEventListener("DOMContentLoaded", flush, { once: true });
5078
- }
5067
+ const done = isParsed(elm);
5068
+ if (done && !hasPendingAncestor(elm)) return false;
5069
+ if (done) elm.__attachShadow?.();
5070
+ const observer = new MutationObserver(flush);
5071
+ observer.observe(elm, { childList: true });
5072
+ pending.set(elm, observer);
5073
+ win.document.addEventListener("DOMContentLoaded", flush, { once: true });
5079
5074
  return true;
5080
5075
  };
5081
5076
  //#endregion
@@ -5004,12 +5004,12 @@ const hmrApplyClass = (cmpMeta, NewClass) => {
5004
5004
  /**
5005
5005
  * SSR hosts connected while the HTML parser is still inside them (streamed documents),
5006
5006
  * in connection order - which is document order. Each is held until its subtree is
5007
- * parsed so hydration sees its declarative shadow root and children.
5007
+ * parsed so hydration sees its declarative shadow root and children, and watched for
5008
+ * its end marker arriving (wherever it is - a document observer can't see into shadow roots).
5008
5009
  */
5009
- const pending = /* @__PURE__ */ new Set();
5010
+ const pending = /* @__PURE__ */ new Map();
5010
5011
  /** SSR hosts seen parsed: hydration may since have moved or removed their end marker */
5011
5012
  const parsedHosts = /* @__PURE__ */ new WeakSet();
5012
- let observer;
5013
5013
  const parentOf = (node) => node.parentNode ?? (node.nodeType === NODE_TYPE.DocumentFragment ? node.host : null);
5014
5014
  /**
5015
5015
  * The server writes a `HOST_END_ID` comment as an SSR host's last child, so the parser has
@@ -5029,17 +5029,17 @@ const hasPendingAncestor = (elm) => {
5029
5029
  for (let n = parentOf(elm); n; n = parentOf(n)) if (pending.has(n)) return true;
5030
5030
  return false;
5031
5031
  };
5032
+ const drop = (elm) => {
5033
+ pending.get(elm)?.disconnect();
5034
+ pending.delete(elm);
5035
+ };
5032
5036
  const flush = () => {
5033
- for (const elm of pending) if (!elm.isConnected) pending.delete(elm);
5037
+ for (const elm of pending.keys()) if (!elm.isConnected) drop(elm);
5034
5038
  else if (isParsed(elm)) elm.__attachShadow?.();
5035
- for (const elm of pending) if (isParsed(elm) && !hasPendingAncestor(elm)) {
5036
- pending.delete(elm);
5039
+ for (const elm of pending.keys()) if (isParsed(elm) && !hasPendingAncestor(elm)) {
5040
+ drop(elm);
5037
5041
  elm.connectedCallback?.();
5038
5042
  }
5039
- if (!pending.size) {
5040
- observer?.disconnect();
5041
- observer = void 0;
5042
- }
5043
5043
  };
5044
5044
  /**
5045
5045
  * Whether the parser may still be adding children (including a declarative shadow root)
@@ -5058,18 +5058,13 @@ const mayStillBeParsing = (elm) => win.document?.readyState === "loading" && (!e
5058
5058
  const deferUntilParsed = (elm) => {
5059
5059
  if (pending.has(elm)) return true;
5060
5060
  if (!win.document || !elm.hasAttribute("s-id")) return false;
5061
- const parsed = isParsed(elm);
5062
- if (parsed && !hasPendingAncestor(elm)) return false;
5063
- if (parsed) elm.__attachShadow?.();
5064
- pending.add(elm);
5065
- if (!observer) {
5066
- observer = new MutationObserver(flush);
5067
- observer.observe(win.document, {
5068
- childList: true,
5069
- subtree: true
5070
- });
5071
- win.document.addEventListener("DOMContentLoaded", flush, { once: true });
5072
- }
5061
+ const done = isParsed(elm);
5062
+ if (done && !hasPendingAncestor(elm)) return false;
5063
+ if (done) elm.__attachShadow?.();
5064
+ const observer = new MutationObserver(flush);
5065
+ observer.observe(elm, { childList: true });
5066
+ pending.set(elm, observer);
5067
+ win.document.addEventListener("DOMContentLoaded", flush, { once: true });
5073
5068
  return true;
5074
5069
  };
5075
5070
  //#endregion
@@ -4876,12 +4876,12 @@ const hmrApplyClass = (cmpMeta, NewClass) => {
4876
4876
  /**
4877
4877
  * SSR hosts connected while the HTML parser is still inside them (streamed documents),
4878
4878
  * in connection order - which is document order. Each is held until its subtree is
4879
- * parsed so hydration sees its declarative shadow root and children.
4879
+ * parsed so hydration sees its declarative shadow root and children, and watched for
4880
+ * its end marker arriving (wherever it is - a document observer can't see into shadow roots).
4880
4881
  */
4881
- const pending = /* @__PURE__ */ new Set();
4882
+ const pending = /* @__PURE__ */ new Map();
4882
4883
  /** SSR hosts seen parsed: hydration may since have moved or removed their end marker */
4883
4884
  const parsedHosts = /* @__PURE__ */ new WeakSet();
4884
- let observer;
4885
4885
  const parentOf = (node) => node.parentNode ?? (node.nodeType === NODE_TYPE.DocumentFragment ? node.host : null);
4886
4886
  /**
4887
4887
  * The server writes a `HOST_END_ID` comment as an SSR host's last child, so the parser has
@@ -4901,17 +4901,17 @@ const hasPendingAncestor = (elm) => {
4901
4901
  for (let n = parentOf(elm); n; n = parentOf(n)) if (pending.has(n)) return true;
4902
4902
  return false;
4903
4903
  };
4904
+ const drop = (elm) => {
4905
+ pending.get(elm)?.disconnect();
4906
+ pending.delete(elm);
4907
+ };
4904
4908
  const flush = () => {
4905
- for (const elm of pending) if (!elm.isConnected) pending.delete(elm);
4909
+ for (const elm of pending.keys()) if (!elm.isConnected) drop(elm);
4906
4910
  else if (isParsed(elm)) elm.__attachShadow?.();
4907
- for (const elm of pending) if (isParsed(elm) && !hasPendingAncestor(elm)) {
4908
- pending.delete(elm);
4911
+ for (const elm of pending.keys()) if (isParsed(elm) && !hasPendingAncestor(elm)) {
4912
+ drop(elm);
4909
4913
  elm.connectedCallback?.();
4910
4914
  }
4911
- if (!pending.size) {
4912
- observer?.disconnect();
4913
- observer = void 0;
4914
- }
4915
4915
  };
4916
4916
  /**
4917
4917
  * Whether the parser may still be adding children (including a declarative shadow root)
@@ -4930,18 +4930,13 @@ const mayStillBeParsing = (elm) => win.document?.readyState === "loading" && (!e
4930
4930
  const deferUntilParsed = (elm) => {
4931
4931
  if (pending.has(elm)) return true;
4932
4932
  if (!win.document || !elm.hasAttribute("s-id")) return false;
4933
- const parsed = isParsed(elm);
4934
- if (parsed && !hasPendingAncestor(elm)) return false;
4935
- if (parsed) elm.__attachShadow?.();
4936
- pending.add(elm);
4937
- if (!observer) {
4938
- observer = new MutationObserver(flush);
4939
- observer.observe(win.document, {
4940
- childList: true,
4941
- subtree: true
4942
- });
4943
- win.document.addEventListener("DOMContentLoaded", flush, { once: true });
4944
- }
4933
+ const done = isParsed(elm);
4934
+ if (done && !hasPendingAncestor(elm)) return false;
4935
+ if (done) elm.__attachShadow?.();
4936
+ const observer = new MutationObserver(flush);
4937
+ observer.observe(elm, { childList: true });
4938
+ pending.set(elm, observer);
4939
+ win.document.addEventListener("DOMContentLoaded", flush, { once: true });
4945
4940
  return true;
4946
4941
  };
4947
4942
  //#endregion
@@ -4646,12 +4646,12 @@ const hmrApplyClass = (cmpMeta, NewClass) => {
4646
4646
  /**
4647
4647
  * SSR hosts connected while the HTML parser is still inside them (streamed documents),
4648
4648
  * in connection order - which is document order. Each is held until its subtree is
4649
- * parsed so hydration sees its declarative shadow root and children.
4649
+ * parsed so hydration sees its declarative shadow root and children, and watched for
4650
+ * its end marker arriving (wherever it is - a document observer can't see into shadow roots).
4650
4651
  */
4651
- const pending = /* @__PURE__ */ new Set();
4652
+ const pending = /* @__PURE__ */ new Map();
4652
4653
  /** SSR hosts seen parsed: hydration may since have moved or removed their end marker */
4653
4654
  const parsedHosts = /* @__PURE__ */ new WeakSet();
4654
- let observer;
4655
4655
  const parentOf = (node) => node.parentNode ?? (node.nodeType === NODE_TYPE.DocumentFragment ? node.host : null);
4656
4656
  /**
4657
4657
  * The server writes a `HOST_END_ID` comment as an SSR host's last child, so the parser has
@@ -4671,17 +4671,17 @@ const hasPendingAncestor = (elm) => {
4671
4671
  for (let n = parentOf(elm); n; n = parentOf(n)) if (pending.has(n)) return true;
4672
4672
  return false;
4673
4673
  };
4674
+ const drop = (elm) => {
4675
+ pending.get(elm)?.disconnect();
4676
+ pending.delete(elm);
4677
+ };
4674
4678
  const flush = () => {
4675
- for (const elm of pending) if (!elm.isConnected) pending.delete(elm);
4679
+ for (const elm of pending.keys()) if (!elm.isConnected) drop(elm);
4676
4680
  else if (isParsed(elm)) elm.__attachShadow?.();
4677
- for (const elm of pending) if (isParsed(elm) && !hasPendingAncestor(elm)) {
4678
- pending.delete(elm);
4681
+ for (const elm of pending.keys()) if (isParsed(elm) && !hasPendingAncestor(elm)) {
4682
+ drop(elm);
4679
4683
  elm.connectedCallback?.();
4680
4684
  }
4681
- if (!pending.size) {
4682
- observer?.disconnect();
4683
- observer = void 0;
4684
- }
4685
4685
  };
4686
4686
  /**
4687
4687
  * Whether the parser may still be adding children (including a declarative shadow root)
@@ -4700,18 +4700,13 @@ const mayStillBeParsing = (elm) => win.document?.readyState === "loading" && (!e
4700
4700
  const deferUntilParsed = (elm) => {
4701
4701
  if (pending.has(elm)) return true;
4702
4702
  if (!win.document || !elm.hasAttribute("s-id")) return false;
4703
- const parsed = isParsed(elm);
4704
- if (parsed && !hasPendingAncestor(elm)) return false;
4705
- if (parsed) elm.__attachShadow?.();
4706
- pending.add(elm);
4707
- if (!observer) {
4708
- observer = new MutationObserver(flush);
4709
- observer.observe(win.document, {
4710
- childList: true,
4711
- subtree: true
4712
- });
4713
- win.document.addEventListener("DOMContentLoaded", flush, { once: true });
4714
- }
4703
+ const done = isParsed(elm);
4704
+ if (done && !hasPendingAncestor(elm)) return false;
4705
+ if (done) elm.__attachShadow?.();
4706
+ const observer = new MutationObserver(flush);
4707
+ observer.observe(elm, { childList: true });
4708
+ pending.set(elm, observer);
4709
+ win.document.addEventListener("DOMContentLoaded", flush, { once: true });
4715
4710
  return true;
4716
4711
  };
4717
4712
  //#endregion
@@ -10795,6 +10795,10 @@ function getLabelsForElement(elm) {
10795
10795
  parent = parent.parentNode;
10796
10796
  }
10797
10797
  }
10798
+ Object.defineProperty(labels, "item", {
10799
+ value: (index) => labels[index] ?? null,
10800
+ enumerable: false
10801
+ });
10798
10802
  return labels;
10799
10803
  }
10800
10804
  function patchPropAttributes(prototype, attrs, defaults = {}) {
@@ -1,4 +1,4 @@
1
- import { l as createWorkerMessageHandler } from "../../compiler-C451Mp7c.mjs";
1
+ import { l as createWorkerMessageHandler } from "../../compiler-D92bSZzV.mjs";
2
2
  import { t as createNodeSys } from "../../node-C6N23fLr.mjs";
3
3
  //#region src/sys/node/node-worker-thread.ts
4
4
  /**
@@ -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.14";
36
+ const version = "5.0.0-rc.15";
37
37
  const MEMBER_FLAGS = {
38
38
  String: 1,
39
39
  Number: 2,
@@ -5387,12 +5387,12 @@ const hmrApplyClass = (cmpMeta, NewClass) => {
5387
5387
  /**
5388
5388
  * SSR hosts connected while the HTML parser is still inside them (streamed documents),
5389
5389
  * in connection order - which is document order. Each is held until its subtree is
5390
- * parsed so hydration sees its declarative shadow root and children.
5390
+ * parsed so hydration sees its declarative shadow root and children, and watched for
5391
+ * its end marker arriving (wherever it is - a document observer can't see into shadow roots).
5391
5392
  */
5392
- const pending = /* @__PURE__ */ new Set();
5393
+ const pending = /* @__PURE__ */ new Map();
5393
5394
  /** SSR hosts seen parsed: hydration may since have moved or removed their end marker */
5394
5395
  const parsedHosts = /* @__PURE__ */ new WeakSet();
5395
- let observer;
5396
5396
  const parentOf = (node) => node.parentNode ?? (node.nodeType === NODE_TYPE.DocumentFragment ? node.host : null);
5397
5397
  /**
5398
5398
  * The server writes a `HOST_END_ID` comment as an SSR host's last child, so the parser has
@@ -5412,17 +5412,17 @@ const hasPendingAncestor = (elm) => {
5412
5412
  for (let n = parentOf(elm); n; n = parentOf(n)) if (pending.has(n)) return true;
5413
5413
  return false;
5414
5414
  };
5415
+ const drop = (elm) => {
5416
+ pending.get(elm)?.disconnect();
5417
+ pending.delete(elm);
5418
+ };
5415
5419
  const flush = () => {
5416
- for (const elm of pending) if (!elm.isConnected) pending.delete(elm);
5420
+ for (const elm of pending.keys()) if (!elm.isConnected) drop(elm);
5417
5421
  else if (isParsed(elm)) elm.__attachShadow?.();
5418
- for (const elm of pending) if (isParsed(elm) && !hasPendingAncestor(elm)) {
5419
- pending.delete(elm);
5422
+ for (const elm of pending.keys()) if (isParsed(elm) && !hasPendingAncestor(elm)) {
5423
+ drop(elm);
5420
5424
  elm.connectedCallback?.();
5421
5425
  }
5422
- if (!pending.size) {
5423
- observer?.disconnect();
5424
- observer = void 0;
5425
- }
5426
5426
  };
5427
5427
  /**
5428
5428
  * Whether the parser may still be adding children (including a declarative shadow root)
@@ -5441,18 +5441,13 @@ const mayStillBeParsing = (elm) => win.document?.readyState === "loading" && (!e
5441
5441
  const deferUntilParsed = (elm) => {
5442
5442
  if (pending.has(elm)) return true;
5443
5443
  if (!win.document || !elm.hasAttribute("s-id")) return false;
5444
- const parsed = isParsed(elm);
5445
- if (parsed && !hasPendingAncestor(elm)) return false;
5446
- if (parsed) elm.__attachShadow?.();
5447
- pending.add(elm);
5448
- if (!observer) {
5449
- observer = new MutationObserver(flush);
5450
- observer.observe(win.document, {
5451
- childList: true,
5452
- subtree: true
5453
- });
5454
- win.document.addEventListener("DOMContentLoaded", flush, { once: true });
5455
- }
5444
+ const done = isParsed(elm);
5445
+ if (done && !hasPendingAncestor(elm)) return false;
5446
+ if (done) elm.__attachShadow?.();
5447
+ const observer = new MutationObserver(flush);
5448
+ observer.observe(elm, { childList: true });
5449
+ pending.set(elm, observer);
5450
+ win.document.addEventListener("DOMContentLoaded", flush, { once: true });
5456
5451
  return true;
5457
5452
  };
5458
5453
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core",
3
- "version": "5.0.0-rc.14",
3
+ "version": "5.0.0-rc.15",
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.14",
130
- "@stencil/mock-doc": "5.0.0-rc.14",
131
- "@stencil/cli": "5.0.0-rc.14"
129
+ "@stencil/cli": "5.0.0-rc.15",
130
+ "@stencil/dev-server": "5.0.0-rc.15",
131
+ "@stencil/mock-doc": "5.0.0-rc.15"
132
132
  },
133
133
  "devDependencies": {
134
134
  "@ionic/prettier-config": "^4.0.0",