@stencil/core 4.19.2 → 4.20.0

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 (67) hide show
  1. package/cli/index.cjs +1 -1
  2. package/cli/index.js +1 -1
  3. package/cli/package.json +1 -1
  4. package/compiler/lib.dom.asynciterable.d.ts +5 -0
  5. package/compiler/lib.dom.d.ts +211 -33
  6. package/compiler/lib.dom.iterable.d.ts +8 -0
  7. package/compiler/lib.es2015.core.d.ts +40 -0
  8. package/compiler/lib.es2018.intl.d.ts +16 -4
  9. package/compiler/lib.es2019.intl.d.ts +1 -1
  10. package/compiler/lib.es2020.bigint.d.ts +2 -3
  11. package/compiler/lib.es2020.intl.d.ts +32 -7
  12. package/compiler/lib.es2021.weakref.d.ts +1 -1
  13. package/compiler/lib.es2022.regexp.d.ts +1 -1
  14. package/compiler/lib.es2023.d.ts +1 -0
  15. package/compiler/lib.es2023.intl.d.ts +56 -0
  16. package/compiler/lib.es5.d.ts +31 -9
  17. package/compiler/lib.esnext.array.d.ts +35 -0
  18. package/compiler/lib.esnext.collection.d.ts +77 -0
  19. package/compiler/lib.esnext.d.ts +3 -0
  20. package/compiler/lib.esnext.intl.d.ts +1 -8
  21. package/compiler/lib.esnext.regexp.d.ts +25 -0
  22. package/compiler/lib.esnext.string.d.ts +29 -0
  23. package/compiler/lib.webworker.asynciterable.d.ts +5 -0
  24. package/compiler/lib.webworker.d.ts +20 -6
  25. package/compiler/lib.webworker.iterable.d.ts +5 -0
  26. package/compiler/package.json +1 -1
  27. package/compiler/stencil.js +212817 -210315
  28. package/dev-server/client/index.js +1 -1
  29. package/dev-server/client/package.json +1 -1
  30. package/dev-server/connector.html +2 -2
  31. package/dev-server/index.js +1 -1
  32. package/dev-server/package.json +1 -1
  33. package/dev-server/server-process.js +2 -2
  34. package/internal/app-data/package.json +1 -1
  35. package/internal/client/index.js +49 -31
  36. package/internal/client/package.json +1 -1
  37. package/internal/client/patch-browser.js +1 -1
  38. package/internal/client/shadow-css.js +6 -30
  39. package/internal/hydrate/index.js +52 -36
  40. package/internal/hydrate/package.json +1 -1
  41. package/internal/hydrate/runner.js +7 -7
  42. package/internal/package.json +1 -1
  43. package/internal/stencil-private.d.ts +0 -1
  44. package/internal/stencil-public-compiler.d.ts +8 -5
  45. package/internal/testing/index.js +48 -30
  46. package/internal/testing/package.json +1 -1
  47. package/mock-doc/index.cjs +3 -3
  48. package/mock-doc/index.d.ts +1 -1
  49. package/mock-doc/index.js +3 -3
  50. package/mock-doc/package.json +1 -1
  51. package/package.json +10 -3
  52. package/screenshot/index.js +1 -1
  53. package/screenshot/package.json +1 -1
  54. package/screenshot/pixel-match.js +1 -1
  55. package/screenshot/screenshot-compare.d.ts +1 -2
  56. package/screenshot/screenshot-fs.d.ts +0 -1
  57. package/sys/node/index.js +6 -6
  58. package/sys/node/package.json +1 -1
  59. package/sys/node/worker.js +1 -1
  60. package/testing/index.js +31 -2
  61. package/testing/jest/jest-27-and-under/jest-facade.d.ts +41 -41
  62. package/testing/jest/jest-28/jest-facade.d.ts +35 -53
  63. package/testing/jest/jest-29/jest-facade.d.ts +36 -55
  64. package/testing/package.json +1 -1
  65. package/testing/puppeteer/puppeteer-declarations.d.ts +0 -1
  66. package/testing/puppeteer/puppeteer-screenshot.d.ts +1 -1
  67. package/testing/testing-utils.d.ts +0 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Hydrate Platform v4.19.2 | MIT Licensed | https://stenciljs.com
2
+ Stencil Hydrate Platform v4.20.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -412,17 +412,6 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
412
412
  }
413
413
  }
414
414
  }
415
- for (i2 = node.childNodes.length - 1; i2 >= 0; i2--) {
416
- clientHydrate(
417
- parentVNode,
418
- childRenderNodes,
419
- slotNodes,
420
- shadowRootNodes,
421
- hostElm,
422
- node.childNodes[i2],
423
- hostId
424
- );
425
- }
426
415
  if (node.shadowRoot) {
427
416
  for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
428
417
  clientHydrate(
@@ -436,6 +425,17 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
436
425
  );
437
426
  }
438
427
  }
428
+ for (i2 = node.childNodes.length - 1; i2 >= 0; i2--) {
429
+ clientHydrate(
430
+ parentVNode,
431
+ childRenderNodes,
432
+ slotNodes,
433
+ shadowRootNodes,
434
+ hostElm,
435
+ node.childNodes[i2],
436
+ hostId
437
+ );
438
+ }
439
439
  } else if (node.nodeType === 8 /* CommentNode */) {
440
440
  childIdSplt = node.nodeValue.split(".");
441
441
  if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
@@ -513,14 +513,14 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
513
513
  var initializeDocumentHydrate = (node, orgLocNodes) => {
514
514
  if (node.nodeType === 1 /* ElementNode */) {
515
515
  let i2 = 0;
516
- for (; i2 < node.childNodes.length; i2++) {
517
- initializeDocumentHydrate(node.childNodes[i2], orgLocNodes);
518
- }
519
516
  if (node.shadowRoot) {
520
- for (i2 = 0; i2 < node.shadowRoot.childNodes.length; i2++) {
517
+ for (; i2 < node.shadowRoot.childNodes.length; i2++) {
521
518
  initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
522
519
  }
523
520
  }
521
+ for (i2 = 0; i2 < node.childNodes.length; i2++) {
522
+ initializeDocumentHydrate(node.childNodes[i2], orgLocNodes);
523
+ }
524
524
  } else if (node.nodeType === 8 /* CommentNode */) {
525
525
  const childIdSplt = node.nodeValue.split(".");
526
526
  if (childIdSplt[0] === ORG_LOCATION_ID) {
@@ -639,10 +639,21 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
639
639
  if (nonce != null) {
640
640
  styleElm.setAttribute("nonce", nonce);
641
641
  }
642
- if (BUILD7.hydrateServerSide || BUILD7.hotModuleReplacement) {
642
+ if ((BUILD7.hydrateServerSide || BUILD7.hotModuleReplacement) && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
643
643
  styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
644
644
  }
645
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector("link"));
645
+ const injectStyle = (
646
+ /**
647
+ * we render a scoped component
648
+ */
649
+ !(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) || /**
650
+ * we are using shadow dom and render the style tag within the shadowRoot
651
+ */
652
+ cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD"
653
+ );
654
+ if (injectStyle) {
655
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector("link"));
656
+ }
646
657
  }
647
658
  if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
648
659
  styleElm.innerHTML += SLOT_FB_CSS;
@@ -667,7 +678,7 @@ var attachStyles = (hostRef) => {
667
678
  cmpMeta,
668
679
  hostRef.$modeName$
669
680
  );
670
- if ((BUILD7.shadowDom || BUILD7.scoped) && BUILD7.cssAnnotations && flags & 10 /* needsScopedEncapsulation */) {
681
+ if ((BUILD7.shadowDom || BUILD7.scoped) && BUILD7.cssAnnotations && flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
671
682
  elm["s-sc"] = scopeId2;
672
683
  elm.classList.add(scopeId2 + "-h");
673
684
  if (BUILD7.scoped && flags & 2 /* scopedCssEncapsulation */) {
@@ -677,7 +688,6 @@ var attachStyles = (hostRef) => {
677
688
  endAttachStyles();
678
689
  };
679
690
  var getScopeId = (cmp, mode) => "sc-" + (BUILD7.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
680
- var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
681
691
 
682
692
  // src/runtime/vdom/vdom-render.ts
683
693
  import { BUILD as BUILD10 } from "@stencil/core/internal/app-data";
@@ -873,7 +883,9 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
873
883
  if (BUILD10.vdomAttribute) {
874
884
  updateElement(null, newVNode2, isSvgMode);
875
885
  }
876
- if ((BUILD10.shadowDom || BUILD10.scoped) && isDef(scopeId) && elm["s-si"] !== scopeId) {
886
+ const rootNode = elm.getRootNode();
887
+ const isElementWithinShadowRoot = !rootNode.querySelector("body");
888
+ if (!isElementWithinShadowRoot && BUILD10.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
877
889
  elm.classList.add(elm["s-si"] = scopeId);
878
890
  }
879
891
  if (BUILD10.scoped) {
@@ -1087,6 +1099,15 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
1087
1099
  var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
1088
1100
  if (leftVNode.$tag$ === rightVNode.$tag$) {
1089
1101
  if (BUILD10.slotRelocation && leftVNode.$tag$ === "slot") {
1102
+ if (
1103
+ // The component gets hydrated and no VDOM has been initialized.
1104
+ // Here the comparison can't happen as $name$ property is not set for `leftNode`.
1105
+ "$nodeId$" in leftVNode && isInitialRender && // `leftNode` is not from type HTMLComment which would cause many
1106
+ // hydration comments to be removed
1107
+ leftVNode.$elm$.nodeType !== 8
1108
+ ) {
1109
+ return false;
1110
+ }
1090
1111
  return leftVNode.$name$ === rightVNode.$name$;
1091
1112
  }
1092
1113
  if (BUILD10.vdomKey && !isInitialRender) {
@@ -1128,7 +1149,10 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
1128
1149
  elm.textContent = "";
1129
1150
  }
1130
1151
  addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
1131
- } else if (BUILD10.updatable && oldChildren !== null) {
1152
+ } else if (
1153
+ // don't do this on initial render as it can cause non-hydrated content to be removed
1154
+ !isInitialRender && BUILD10.updatable && oldChildren !== null
1155
+ ) {
1132
1156
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
1133
1157
  }
1134
1158
  if (BUILD10.svg && isSvgMode && tag === "svg") {
@@ -1820,7 +1844,8 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
1820
1844
  if (this.hasOwnProperty(propName)) {
1821
1845
  newValue = this[propName];
1822
1846
  delete this[propName];
1823
- } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && this[propName] == newValue) {
1847
+ } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
1848
+ this[propName] == newValue) {
1824
1849
  return;
1825
1850
  } else if (propName == null) {
1826
1851
  const hostRef = getHostRef(this);
@@ -1927,7 +1952,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1927
1952
  const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
1928
1953
  if (!BUILD14.hydrateServerSide && BUILD14.shadowDom && // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
1929
1954
  BUILD14.shadowDomShim && cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
1930
- style = await import("../client/shadow-css.js").then((m) => m.scopeCss(style, scopeId2, false));
1955
+ style = await import("../client/shadow-css.js").then((m) => m.scopeCss(style, scopeId2));
1931
1956
  }
1932
1957
  registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1933
1958
  endRegisterStyles();
@@ -2496,10 +2521,8 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
2496
2521
  const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
2497
2522
  const dataStyles = /* @__PURE__ */ doc.createElement("style");
2498
2523
  const deferredConnectedCallbacks = [];
2499
- const styles2 = /* @__PURE__ */ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2500
2524
  let appLoadFallback;
2501
2525
  let isBootstrapping = true;
2502
- let i2 = 0;
2503
2526
  Object.assign(plt, options);
2504
2527
  plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", doc.baseURI).href;
2505
2528
  if (BUILD19.asyncQueue) {
@@ -2510,11 +2533,6 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
2510
2533
  if (BUILD19.hydrateClientSide) {
2511
2534
  plt.$flags$ |= 2 /* appLoaded */;
2512
2535
  }
2513
- if (BUILD19.hydrateClientSide && BUILD19.shadowDom) {
2514
- for (; i2 < styles2.length; i2++) {
2515
- registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
2516
- }
2517
- }
2518
2536
  let hasSlotRelocation = false;
2519
2537
  lazyBundles.map((lazyBundle) => {
2520
2538
  lazyBundle[1].map((compactMeta) => {
@@ -2881,7 +2899,7 @@ var globalScripts = (
2881
2899
 
2882
2900
  // src/hydrate/platform/proxy-host-element.ts
2883
2901
  import { BUILD as BUILD21 } from "@stencil/core/internal/app-data";
2884
- function proxyHostElement(elm, cmpMeta, opts) {
2902
+ function proxyHostElement(elm, cmpMeta) {
2885
2903
  if (typeof elm.componentOnReady !== "function") {
2886
2904
  elm.componentOnReady = componentOnReady;
2887
2905
  }
@@ -2894,10 +2912,8 @@ function proxyHostElement(elm, cmpMeta, opts) {
2894
2912
  mode: "open",
2895
2913
  delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
2896
2914
  });
2897
- } else if (opts.serializeShadowRoot) {
2898
- elm.attachShadow({ mode: "open" });
2899
2915
  } else {
2900
- elm.shadowRoot = elm;
2916
+ elm.attachShadow({ mode: "open" });
2901
2917
  }
2902
2918
  }
2903
2919
  if (cmpMeta.$members$ != null) {
@@ -3010,7 +3026,7 @@ function hydrateApp(win2, opts, results, afterHydrate, resolve) {
3010
3026
  createdElements.add(elm);
3011
3027
  elm.connectedCallback = patchedConnectedCallback2;
3012
3028
  registerHost(elm, Cstr.cmpMeta);
3013
- proxyHostElement(elm, Cstr.cmpMeta, opts);
3029
+ proxyHostElement(elm, Cstr.cmpMeta);
3014
3030
  }
3015
3031
  }
3016
3032
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/hydrate",
3
- "version": "4.19.2",
3
+ "version": "4.20.0",
4
4
  "description": "Stencil internal hydrate platform to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "private": true
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Hydrate Runner v4.19.2 | MIT Licensed | https://stenciljs.com
2
+ Stencil Hydrate Runner v4.20.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -10414,7 +10414,7 @@ function normalizeSerializationOptions(opts = {}) {
10414
10414
  removeAttributeQuotes: typeof opts.removeAttributeQuotes !== "boolean" ? false : opts.removeAttributeQuotes,
10415
10415
  removeBooleanAttributeQuotes: typeof opts.removeBooleanAttributeQuotes !== "boolean" ? false : opts.removeBooleanAttributeQuotes,
10416
10416
  removeHtmlComments: typeof opts.removeHtmlComments !== "boolean" ? false : opts.removeHtmlComments,
10417
- serializeShadowRoot: typeof opts.serializeShadowRoot !== "boolean" ? false : opts.serializeShadowRoot,
10417
+ serializeShadowRoot: typeof opts.serializeShadowRoot !== "boolean" ? true : opts.serializeShadowRoot,
10418
10418
  fullDocument: typeof opts.fullDocument !== "boolean" ? true : opts.fullDocument
10419
10419
  };
10420
10420
  }
@@ -10540,7 +10540,7 @@ style="${cssText}">`;
10540
10540
  }
10541
10541
  if (EMPTY_ELEMENTS.has(tagName) === false) {
10542
10542
  const shadowRoot = node.shadowRoot;
10543
- if (opts.serializeShadowRoot && shadowRoot != null) {
10543
+ if (shadowRoot != null && opts.serializeShadowRoot) {
10544
10544
  output.indent = output.indent + ((_c = opts.indentSpaces) != null ? _c : 0);
10545
10545
  yield* streamToHtml(shadowRoot, opts, output);
10546
10546
  output.indent = output.indent - ((_d = opts.indentSpaces) != null ? _d : 0);
@@ -14884,7 +14884,7 @@ var removeUnusedStyleText = (usedSelectors, diagnostics, styleElm) => {
14884
14884
 
14885
14885
  // src/hydrate/runner/inspect-element.ts
14886
14886
  function inspectElement(results, elm, depth) {
14887
- const children = elm.children;
14887
+ const children = [...Array.from(elm.children), ...Array.from(elm.shadowRoot ? elm.shadowRoot.children : [])];
14888
14888
  for (let i = 0, ii = children.length; i < ii; i++) {
14889
14889
  const childElm = children[i];
14890
14890
  const tagName = childElm.nodeName.toLowerCase();
@@ -15279,7 +15279,7 @@ function renderToString(html, options, asStream) {
15279
15279
  const opts = normalizeHydrateOptions(options);
15280
15280
  opts.serializeToHtml = true;
15281
15281
  opts.fullDocument = typeof opts.fullDocument === "boolean" ? opts.fullDocument : true;
15282
- opts.serializeShadowRoot = Boolean(opts.serializeShadowRoot);
15282
+ opts.serializeShadowRoot = typeof opts.serializeShadowRoot === "boolean" ? opts.serializeShadowRoot : true;
15283
15283
  opts.constrainTimeouts = false;
15284
15284
  return hydrateDocument(html, opts, asStream);
15285
15285
  }
@@ -15336,7 +15336,7 @@ async function render(win, opts, results) {
15336
15336
  });
15337
15337
  }
15338
15338
  initializeWindow(win, win.document, opts, results);
15339
- const beforeHydrateFn = typeof opts.beforeHydrate === "function" ? opts.beforeHydrate(win.document) : NOOP;
15339
+ const beforeHydrateFn = typeof opts.beforeHydrate === "function" ? opts.beforeHydrate : NOOP;
15340
15340
  try {
15341
15341
  await Promise.resolve(beforeHydrateFn(win.document));
15342
15342
  return new Promise((resolve) => hydrateFactory(win, opts, results, afterHydrate, resolve));
@@ -15353,7 +15353,7 @@ function renderStream(win, opts, results) {
15353
15353
  return Readable.from(processRender());
15354
15354
  }
15355
15355
  async function afterHydrate(win, opts, results, resolve) {
15356
- const afterHydrateFn = typeof opts.afterHydrate === "function" ? opts.afterHydrate(win.document) : NOOP;
15356
+ const afterHydrateFn = typeof opts.afterHydrate === "function" ? opts.afterHydrate : NOOP;
15357
15357
  try {
15358
15358
  await Promise.resolve(afterHydrateFn(win.document));
15359
15359
  return resolve(finalizeHydrate(win, win.document, opts, results));
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal",
3
- "version": "4.19.2",
3
+ "version": "4.20.0",
4
4
  "description": "Stencil internals only to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -1690,7 +1690,6 @@ export interface TransformCssToEsmInput {
1690
1690
  * is not shared by multiple fields, nor is it a composite of multiple modes).
1691
1691
  */
1692
1692
  mode?: string;
1693
- commentOriginalSelector?: boolean;
1694
1693
  sourceMap?: boolean;
1695
1694
  minify?: boolean;
1696
1695
  docs?: boolean;
@@ -382,6 +382,7 @@ export interface Config extends StencilConfig {
382
382
  suppressLogs?: boolean;
383
383
  profile?: boolean;
384
384
  tsCompilerOptions?: any;
385
+ tsWatchOptions?: any;
385
386
  _isValidated?: boolean;
386
387
  _isTesting?: boolean;
387
388
  }
@@ -1612,6 +1613,8 @@ export interface Testing {
1612
1613
  run(opts: TestingRunOptions): Promise<boolean>;
1613
1614
  destroy(): Promise<void>;
1614
1615
  }
1616
+ export declare type Path = string;
1617
+ export declare type TransformerConfig = [string, Record<string, unknown>];
1615
1618
  /**
1616
1619
  * Options for initiating a run of Stencil tests (spec and/or end-to-end)
1617
1620
  */
@@ -1643,7 +1646,7 @@ export interface JestConfig {
1643
1646
  * By default, Jest runs all tests and produces all errors into the console upon completion.
1644
1647
  * The bail config option can be used here to have Jest stop running tests after the first failure. Default: false
1645
1648
  */
1646
- bail?: boolean;
1649
+ bail?: boolean | number;
1647
1650
  /**
1648
1651
  * The directory where Jest should store its cached dependency information. Jest attempts to scan your dependency tree once (up-front)
1649
1652
  * and cache it in order to ease some of the filesystem raking that needs to happen while running tests. This config option lets you
@@ -1717,8 +1720,8 @@ export interface JestConfig {
1717
1720
  reporters?: any;
1718
1721
  resetMocks?: boolean;
1719
1722
  resetModules?: boolean;
1720
- resolver?: string;
1721
- restoreMocks?: string;
1723
+ resolver?: Path | null;
1724
+ restoreMocks?: boolean;
1722
1725
  rootDir?: string;
1723
1726
  roots?: any[];
1724
1727
  runner?: string;
@@ -1735,13 +1738,13 @@ export interface JestConfig {
1735
1738
  testMatch?: string[];
1736
1739
  testPathIgnorePatterns?: string[];
1737
1740
  testPreset?: string;
1738
- testRegex?: string;
1741
+ testRegex?: string[];
1739
1742
  testResultsProcessor?: string;
1740
1743
  testRunner?: string;
1741
1744
  testURL?: string;
1742
1745
  timers?: string;
1743
1746
  transform?: {
1744
- [key: string]: string;
1747
+ [regex: string]: Path | TransformerConfig;
1745
1748
  };
1746
1749
  transformIgnorePatterns?: any[];
1747
1750
  unmockedModulePathPatterns?: any[];
@@ -784,17 +784,6 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
784
784
  }
785
785
  }
786
786
  }
787
- for (i2 = node.childNodes.length - 1; i2 >= 0; i2--) {
788
- clientHydrate(
789
- parentVNode,
790
- childRenderNodes,
791
- slotNodes,
792
- shadowRootNodes,
793
- hostElm,
794
- node.childNodes[i2],
795
- hostId
796
- );
797
- }
798
787
  if (node.shadowRoot) {
799
788
  for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
800
789
  clientHydrate(
@@ -808,6 +797,17 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
808
797
  );
809
798
  }
810
799
  }
800
+ for (i2 = node.childNodes.length - 1; i2 >= 0; i2--) {
801
+ clientHydrate(
802
+ parentVNode,
803
+ childRenderNodes,
804
+ slotNodes,
805
+ shadowRootNodes,
806
+ hostElm,
807
+ node.childNodes[i2],
808
+ hostId
809
+ );
810
+ }
811
811
  } else if (node.nodeType === 8 /* CommentNode */) {
812
812
  childIdSplt = node.nodeValue.split(".");
813
813
  if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
@@ -885,14 +885,14 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
885
885
  var initializeDocumentHydrate = (node, orgLocNodes) => {
886
886
  if (node.nodeType === 1 /* ElementNode */) {
887
887
  let i2 = 0;
888
- for (; i2 < node.childNodes.length; i2++) {
889
- initializeDocumentHydrate(node.childNodes[i2], orgLocNodes);
890
- }
891
888
  if (node.shadowRoot) {
892
- for (i2 = 0; i2 < node.shadowRoot.childNodes.length; i2++) {
889
+ for (; i2 < node.shadowRoot.childNodes.length; i2++) {
893
890
  initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
894
891
  }
895
892
  }
893
+ for (i2 = 0; i2 < node.childNodes.length; i2++) {
894
+ initializeDocumentHydrate(node.childNodes[i2], orgLocNodes);
895
+ }
896
896
  } else if (node.nodeType === 8 /* CommentNode */) {
897
897
  const childIdSplt = node.nodeValue.split(".");
898
898
  if (childIdSplt[0] === ORG_LOCATION_ID) {
@@ -1011,10 +1011,21 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
1011
1011
  if (nonce != null) {
1012
1012
  styleElm.setAttribute("nonce", nonce);
1013
1013
  }
1014
- if (import_app_data7.BUILD.hydrateServerSide || import_app_data7.BUILD.hotModuleReplacement) {
1014
+ if ((import_app_data7.BUILD.hydrateServerSide || import_app_data7.BUILD.hotModuleReplacement) && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
1015
1015
  styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
1016
1016
  }
1017
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector("link"));
1017
+ const injectStyle = (
1018
+ /**
1019
+ * we render a scoped component
1020
+ */
1021
+ !(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) || /**
1022
+ * we are using shadow dom and render the style tag within the shadowRoot
1023
+ */
1024
+ cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD"
1025
+ );
1026
+ if (injectStyle) {
1027
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector("link"));
1028
+ }
1018
1029
  }
1019
1030
  if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
1020
1031
  styleElm.innerHTML += SLOT_FB_CSS;
@@ -1039,7 +1050,7 @@ var attachStyles = (hostRef) => {
1039
1050
  cmpMeta,
1040
1051
  hostRef.$modeName$
1041
1052
  );
1042
- if ((import_app_data7.BUILD.shadowDom || import_app_data7.BUILD.scoped) && import_app_data7.BUILD.cssAnnotations && flags & 10 /* needsScopedEncapsulation */) {
1053
+ if ((import_app_data7.BUILD.shadowDom || import_app_data7.BUILD.scoped) && import_app_data7.BUILD.cssAnnotations && flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
1043
1054
  elm["s-sc"] = scopeId2;
1044
1055
  elm.classList.add(scopeId2 + "-h");
1045
1056
  if (import_app_data7.BUILD.scoped && flags & 2 /* scopedCssEncapsulation */) {
@@ -1049,7 +1060,6 @@ var attachStyles = (hostRef) => {
1049
1060
  endAttachStyles();
1050
1061
  };
1051
1062
  var getScopeId = (cmp, mode) => "sc-" + (import_app_data7.BUILD.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
1052
- var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
1053
1063
 
1054
1064
  // src/runtime/vdom/vdom-render.ts
1055
1065
  var import_app_data10 = require("@stencil/core/internal/app-data");
@@ -1245,7 +1255,9 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
1245
1255
  if (import_app_data10.BUILD.vdomAttribute) {
1246
1256
  updateElement(null, newVNode2, isSvgMode);
1247
1257
  }
1248
- if ((import_app_data10.BUILD.shadowDom || import_app_data10.BUILD.scoped) && isDef(scopeId) && elm["s-si"] !== scopeId) {
1258
+ const rootNode = elm.getRootNode();
1259
+ const isElementWithinShadowRoot = !rootNode.querySelector("body");
1260
+ if (!isElementWithinShadowRoot && import_app_data10.BUILD.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
1249
1261
  elm.classList.add(elm["s-si"] = scopeId);
1250
1262
  }
1251
1263
  if (import_app_data10.BUILD.scoped) {
@@ -1459,6 +1471,15 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
1459
1471
  var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
1460
1472
  if (leftVNode.$tag$ === rightVNode.$tag$) {
1461
1473
  if (import_app_data10.BUILD.slotRelocation && leftVNode.$tag$ === "slot") {
1474
+ if (
1475
+ // The component gets hydrated and no VDOM has been initialized.
1476
+ // Here the comparison can't happen as $name$ property is not set for `leftNode`.
1477
+ "$nodeId$" in leftVNode && isInitialRender && // `leftNode` is not from type HTMLComment which would cause many
1478
+ // hydration comments to be removed
1479
+ leftVNode.$elm$.nodeType !== 8
1480
+ ) {
1481
+ return false;
1482
+ }
1462
1483
  return leftVNode.$name$ === rightVNode.$name$;
1463
1484
  }
1464
1485
  if (import_app_data10.BUILD.vdomKey && !isInitialRender) {
@@ -1500,7 +1521,10 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
1500
1521
  elm.textContent = "";
1501
1522
  }
1502
1523
  addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
1503
- } else if (import_app_data10.BUILD.updatable && oldChildren !== null) {
1524
+ } else if (
1525
+ // don't do this on initial render as it can cause non-hydrated content to be removed
1526
+ !isInitialRender && import_app_data10.BUILD.updatable && oldChildren !== null
1527
+ ) {
1504
1528
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
1505
1529
  }
1506
1530
  if (import_app_data10.BUILD.svg && isSvgMode && tag === "svg") {
@@ -2192,7 +2216,8 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
2192
2216
  if (this.hasOwnProperty(propName)) {
2193
2217
  newValue = this[propName];
2194
2218
  delete this[propName];
2195
- } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && this[propName] == newValue) {
2219
+ } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
2220
+ this[propName] == newValue) {
2196
2221
  return;
2197
2222
  } else if (propName == null) {
2198
2223
  const hostRef = getHostRef(this);
@@ -2299,7 +2324,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
2299
2324
  const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
2300
2325
  if (!import_app_data14.BUILD.hydrateServerSide && import_app_data14.BUILD.shadowDom && // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
2301
2326
  import_app_data14.BUILD.shadowDomShim && cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
2302
- style = await import("../client/shadow-css.js").then((m) => m.scopeCss(style, scopeId2, false));
2327
+ style = await import("../client/shadow-css.js").then((m) => m.scopeCss(style, scopeId2));
2303
2328
  }
2304
2329
  registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
2305
2330
  endRegisterStyles();
@@ -2868,10 +2893,8 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
2868
2893
  const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
2869
2894
  const dataStyles = /* @__PURE__ */ doc.createElement("style");
2870
2895
  const deferredConnectedCallbacks = [];
2871
- const styles2 = /* @__PURE__ */ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2872
2896
  let appLoadFallback;
2873
2897
  let isBootstrapping = true;
2874
- let i2 = 0;
2875
2898
  Object.assign(plt, options);
2876
2899
  plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", doc.baseURI).href;
2877
2900
  if (import_app_data19.BUILD.asyncQueue) {
@@ -2882,11 +2905,6 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
2882
2905
  if (import_app_data19.BUILD.hydrateClientSide) {
2883
2906
  plt.$flags$ |= 2 /* appLoaded */;
2884
2907
  }
2885
- if (import_app_data19.BUILD.hydrateClientSide && import_app_data19.BUILD.shadowDom) {
2886
- for (; i2 < styles2.length; i2++) {
2887
- registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
2888
- }
2889
- }
2890
2908
  let hasSlotRelocation = false;
2891
2909
  lazyBundles.map((lazyBundle) => {
2892
2910
  lazyBundle[1].map((compactMeta) => {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/testing",
3
- "version": "4.19.2",
3
+ "version": "4.20.0",
4
4
  "description": "Stencil internal testing platform to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "private": true
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Mock Doc (CommonJS) v4.19.2 | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc (CommonJS) v4.20.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __defProp = Object.defineProperty;
@@ -6287,7 +6287,7 @@ function normalizeSerializationOptions(opts = {}) {
6287
6287
  removeAttributeQuotes: typeof opts.removeAttributeQuotes !== "boolean" ? false : opts.removeAttributeQuotes,
6288
6288
  removeBooleanAttributeQuotes: typeof opts.removeBooleanAttributeQuotes !== "boolean" ? false : opts.removeBooleanAttributeQuotes,
6289
6289
  removeHtmlComments: typeof opts.removeHtmlComments !== "boolean" ? false : opts.removeHtmlComments,
6290
- serializeShadowRoot: typeof opts.serializeShadowRoot !== "boolean" ? false : opts.serializeShadowRoot,
6290
+ serializeShadowRoot: typeof opts.serializeShadowRoot !== "boolean" ? true : opts.serializeShadowRoot,
6291
6291
  fullDocument: typeof opts.fullDocument !== "boolean" ? true : opts.fullDocument
6292
6292
  };
6293
6293
  }
@@ -6413,7 +6413,7 @@ style="${cssText}">`;
6413
6413
  }
6414
6414
  if (EMPTY_ELEMENTS.has(tagName) === false) {
6415
6415
  const shadowRoot = node.shadowRoot;
6416
- if (opts.serializeShadowRoot && shadowRoot != null) {
6416
+ if (shadowRoot != null && opts.serializeShadowRoot) {
6417
6417
  output.indent = output.indent + ((_c = opts.indentSpaces) != null ? _c : 0);
6418
6418
  yield* streamToHtml(shadowRoot, opts, output);
6419
6419
  output.indent = output.indent - ((_d = opts.indentSpaces) != null ? _d : 0);
@@ -975,7 +975,7 @@ declare class MockWindow {
975
975
  addEventListener: (_type: string, _handler: (ev?: any) => void) => void;
976
976
  removeEventListener: (_type: string, _handler: (ev?: any) => void) => void;
977
977
  dispatchEvent: (_ev: any) => void;
978
- onchange: (this: MediaQueryList, ev: MediaQueryListEvent) => any;
978
+ onchange: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null;
979
979
  };
980
980
  get Node(): any;
981
981
  get NodeList(): any;
package/mock-doc/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Mock Doc v4.19.2 | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc v4.20.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
 
5
5
  // src/runtime/runtime-constants.ts
@@ -6234,7 +6234,7 @@ function normalizeSerializationOptions(opts = {}) {
6234
6234
  removeAttributeQuotes: typeof opts.removeAttributeQuotes !== "boolean" ? false : opts.removeAttributeQuotes,
6235
6235
  removeBooleanAttributeQuotes: typeof opts.removeBooleanAttributeQuotes !== "boolean" ? false : opts.removeBooleanAttributeQuotes,
6236
6236
  removeHtmlComments: typeof opts.removeHtmlComments !== "boolean" ? false : opts.removeHtmlComments,
6237
- serializeShadowRoot: typeof opts.serializeShadowRoot !== "boolean" ? false : opts.serializeShadowRoot,
6237
+ serializeShadowRoot: typeof opts.serializeShadowRoot !== "boolean" ? true : opts.serializeShadowRoot,
6238
6238
  fullDocument: typeof opts.fullDocument !== "boolean" ? true : opts.fullDocument
6239
6239
  };
6240
6240
  }
@@ -6360,7 +6360,7 @@ style="${cssText}">`;
6360
6360
  }
6361
6361
  if (EMPTY_ELEMENTS.has(tagName) === false) {
6362
6362
  const shadowRoot = node.shadowRoot;
6363
- if (opts.serializeShadowRoot && shadowRoot != null) {
6363
+ if (shadowRoot != null && opts.serializeShadowRoot) {
6364
6364
  output.indent = output.indent + ((_c = opts.indentSpaces) != null ? _c : 0);
6365
6365
  yield* streamToHtml(shadowRoot, opts, output);
6366
6366
  output.indent = output.indent - ((_d = opts.indentSpaces) != null ? _d : 0);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/mock-doc",
3
- "version": "4.19.2",
3
+ "version": "4.20.0",
4
4
  "description": "Mock window, document and DOM outside of a browser environment.",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core",
3
- "version": "4.19.2",
3
+ "version": "4.20.0",
4
4
  "license": "MIT",
5
5
  "main": "./internal/stencil-core/index.cjs",
6
6
  "module": "./internal/stencil-core/index.js",
@@ -66,6 +66,10 @@
66
66
  "import": "./compiler/*",
67
67
  "types": "./compiler/*"
68
68
  },
69
+ "./screenshot": {
70
+ "require": "./screenshot/index.js",
71
+ "types": "./screenshot/index.d.ts"
72
+ },
69
73
  "./sys/node": {
70
74
  "import": "./sys/node/index.js",
71
75
  "require": "./sys/node/index.js",
@@ -80,6 +84,9 @@
80
84
  "types": "./testing/index.d.ts",
81
85
  "require": "./testing/index.js"
82
86
  },
87
+ "./testing/jest-preset": {
88
+ "require": "./testing/jest-preset.js"
89
+ },
83
90
  "./testing/*": {
84
91
  "import": "./testing/*",
85
92
  "require": "./testing/*"
@@ -154,7 +161,7 @@
154
161
  "eslint-plugin-jsdoc": "^48.0.0",
155
162
  "eslint-plugin-simple-import-sort": "^12.0.0",
156
163
  "eslint-plugin-wdio": "^8.24.12",
157
- "execa": "8.0.1",
164
+ "execa": "9.3.0",
158
165
  "exit": "^0.1.2",
159
166
  "fs-extra": "^11.0.0",
160
167
  "glob": "10.4.1",
@@ -181,7 +188,7 @@
181
188
  "semver": "^7.3.7",
182
189
  "terser": "5.31.1",
183
190
  "tsx": "^4.10.3",
184
- "typescript": "~5.4.0",
191
+ "typescript": "~5.5.3",
185
192
  "webpack": "^5.75.0",
186
193
  "ws": "8.17.1"
187
194
  },
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Screenshot v4.19.2 | MIT Licensed | https://stenciljs.com
2
+ Stencil Screenshot v4.20.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __create = Object.create;