@stencil/core 4.42.0 → 4.42.1

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 (45) 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/package.json +1 -1
  5. package/compiler/stencil.js +117 -20
  6. package/dev-server/client/index.js +1 -1
  7. package/dev-server/client/package.json +1 -1
  8. package/dev-server/connector.html +2 -2
  9. package/dev-server/index.js +1 -1
  10. package/dev-server/package.json +1 -1
  11. package/dev-server/server-process.js +2 -2
  12. package/internal/app-data/package.json +1 -1
  13. package/internal/app-globals/package.json +1 -1
  14. package/internal/client/index.js +201 -166
  15. package/internal/client/package.json +1 -1
  16. package/internal/client/patch-browser.js +1 -1
  17. package/internal/client/shadow-css.js +1 -1
  18. package/internal/hydrate/index.js +202 -167
  19. package/internal/hydrate/package.json +1 -1
  20. package/internal/hydrate/runner.js +56 -22
  21. package/internal/package.json +1 -1
  22. package/internal/stencil-core/index.d.ts +1 -0
  23. package/internal/stencil-private.d.ts +6 -0
  24. package/internal/stencil-public-runtime.d.ts +0 -4
  25. package/internal/testing/index.js +201 -166
  26. package/internal/testing/package.json +1 -1
  27. package/mock-doc/index.cjs +56 -22
  28. package/mock-doc/index.d.ts +10 -2
  29. package/mock-doc/index.js +56 -22
  30. package/mock-doc/package.json +1 -1
  31. package/package.json +1 -1
  32. package/screenshot/index.js +1 -1
  33. package/screenshot/package.json +1 -1
  34. package/screenshot/pixel-match.js +1 -1
  35. package/sys/node/460.node-fetch.js +3 -3
  36. package/sys/node/autoprefixer.js +2 -2
  37. package/sys/node/glob.js +1 -1
  38. package/sys/node/graceful-fs.js +1 -1
  39. package/sys/node/index.js +28 -28
  40. package/sys/node/node-fetch.js +4 -4
  41. package/sys/node/package.json +1 -1
  42. package/sys/node/prompts.js +1 -1
  43. package/sys/node/worker.js +1 -1
  44. package/testing/index.js +2 -1
  45. package/testing/package.json +1 -1
@@ -4068,7 +4068,7 @@ var scopeCss = (cssText, scopeId2, commentOriginalSelector) => {
4068
4068
  });
4069
4069
  }
4070
4070
  scoped.slottedSelectors.forEach((slottedSelector) => {
4071
- const regex = new RegExp(escapeRegExpSpecialCharacters(slottedSelector.orgSelector), "g");
4071
+ const regex = new RegExp(escapeRegExpSpecialCharacters(slottedSelector.orgSelector) + "(?=\\s*[,{]|$)", "g");
4072
4072
  cssText = cssText.replace(regex, slottedSelector.updatedSelector);
4073
4073
  });
4074
4074
  cssText = expandPartSelectors(cssText);
@@ -4193,7 +4193,20 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
4193
4193
  }
4194
4194
  }
4195
4195
  } else if (import_app_data11.BUILD.vdomPropOrAttr && memberName[0] === "a" && memberName.startsWith("attr:")) {
4196
- const attrName = memberName.slice(5);
4196
+ const propName = memberName.slice(5);
4197
+ let attrName;
4198
+ if (import_app_data11.BUILD.member) {
4199
+ const hostRef = getHostRef(elm);
4200
+ if (hostRef && hostRef.$cmpMeta$ && hostRef.$cmpMeta$.$members$) {
4201
+ const memberMeta = hostRef.$cmpMeta$.$members$[propName];
4202
+ if (memberMeta && memberMeta[1]) {
4203
+ attrName = memberMeta[1];
4204
+ }
4205
+ }
4206
+ }
4207
+ if (!attrName) {
4208
+ attrName = propName.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
4209
+ }
4197
4210
  if (newValue == null || newValue === false) {
4198
4211
  if (newValue !== false || elm.getAttribute(attrName) === "") {
4199
4212
  elm.removeAttribute(attrName);
@@ -5049,7 +5062,7 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
5049
5062
  if (childrenPromises.length === 0) {
5050
5063
  postUpdate();
5051
5064
  } else {
5052
- Promise.all(childrenPromises).then(postUpdate);
5065
+ Promise.all(childrenPromises).then(postUpdate).catch(postUpdate);
5053
5066
  hostRef.$flags$ |= 4 /* isWaitingForChildren */;
5054
5067
  childrenPromises.length = 0;
5055
5068
  }
@@ -5310,13 +5323,16 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
5310
5323
  });
5311
5324
  }
5312
5325
  }
5313
- if (import_app_data15.BUILD.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
5326
+ if (import_app_data15.BUILD.updatable && flags & 2 /* hasRendered */) {
5314
5327
  if (instance.componentShouldUpdate) {
5315
- if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
5328
+ const shouldUpdate = instance.componentShouldUpdate(newVal, oldVal, propName);
5329
+ if (shouldUpdate === false && !(flags & 16 /* isQueuedForUpdate */)) {
5316
5330
  return;
5317
5331
  }
5318
5332
  }
5319
- scheduleUpdate(hostRef, false);
5333
+ if (!(flags & 16 /* isQueuedForUpdate */)) {
5334
+ scheduleUpdate(hostRef, false);
5335
+ }
5320
5336
  }
5321
5337
  }
5322
5338
  };
@@ -5564,94 +5580,105 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
5564
5580
  // src/runtime/initialize-component.ts
5565
5581
  var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
5566
5582
  let Cstr;
5567
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
5568
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
5569
- const bundleId = cmpMeta.$lazyBundleId$;
5570
- if (import_app_data17.BUILD.lazyLoad && bundleId) {
5571
- const CstrImport = loadModule(cmpMeta, hostRef, hmrVersionId);
5572
- if (CstrImport && "then" in CstrImport) {
5573
- const endLoad = uniqueTime(
5574
- `st:load:${cmpMeta.$tagName$}:${hostRef.$modeName$}`,
5575
- `[Stencil] Load module for <${cmpMeta.$tagName$}>`
5576
- );
5577
- Cstr = await CstrImport;
5578
- endLoad();
5579
- } else {
5580
- Cstr = CstrImport;
5581
- }
5582
- if (!Cstr) {
5583
- throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
5584
- }
5585
- if (import_app_data17.BUILD.member && !Cstr.isProxied) {
5583
+ try {
5584
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
5585
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
5586
+ const bundleId = cmpMeta.$lazyBundleId$;
5587
+ if (import_app_data17.BUILD.lazyLoad && bundleId) {
5588
+ const CstrImport = loadModule(cmpMeta, hostRef, hmrVersionId);
5589
+ if (CstrImport && "then" in CstrImport) {
5590
+ const endLoad = uniqueTime(
5591
+ `st:load:${cmpMeta.$tagName$}:${hostRef.$modeName$}`,
5592
+ `[Stencil] Load module for <${cmpMeta.$tagName$}>`
5593
+ );
5594
+ Cstr = await CstrImport;
5595
+ endLoad();
5596
+ } else {
5597
+ Cstr = CstrImport;
5598
+ }
5599
+ if (!Cstr) {
5600
+ throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
5601
+ }
5602
+ if (import_app_data17.BUILD.member && !Cstr.isProxied) {
5603
+ if (import_app_data17.BUILD.propChangeCallback) {
5604
+ cmpMeta.$watchers$ = Cstr.watchers;
5605
+ cmpMeta.$serializers$ = Cstr.serializers;
5606
+ cmpMeta.$deserializers$ = Cstr.deserializers;
5607
+ }
5608
+ proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
5609
+ Cstr.isProxied = true;
5610
+ }
5611
+ const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
5612
+ if (import_app_data17.BUILD.member) {
5613
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
5614
+ }
5615
+ try {
5616
+ new Cstr(hostRef);
5617
+ } catch (e) {
5618
+ consoleError(e, elm);
5619
+ }
5620
+ if (import_app_data17.BUILD.member) {
5621
+ hostRef.$flags$ &= ~8 /* isConstructingInstance */;
5622
+ }
5586
5623
  if (import_app_data17.BUILD.propChangeCallback) {
5587
- cmpMeta.$watchers$ = Cstr.watchers;
5588
- cmpMeta.$serializers$ = Cstr.serializers;
5589
- cmpMeta.$deserializers$ = Cstr.deserializers;
5624
+ hostRef.$flags$ |= 128 /* isWatchReady */;
5625
+ }
5626
+ endNewInstance();
5627
+ const needsDeferredCallback = import_app_data17.BUILD.slotRelocation && cmpMeta.$flags$ & 4 /* hasSlotRelocation */;
5628
+ if (!needsDeferredCallback) {
5629
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
5630
+ } else {
5631
+ hostRef.$deferredConnectedCallback$ = true;
5590
5632
  }
5591
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
5592
- Cstr.isProxied = true;
5593
- }
5594
- const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
5595
- if (import_app_data17.BUILD.member) {
5596
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
5597
- }
5598
- try {
5599
- new Cstr(hostRef);
5600
- } catch (e) {
5601
- consoleError(e, elm);
5602
- }
5603
- if (import_app_data17.BUILD.member) {
5604
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
5605
- }
5606
- if (import_app_data17.BUILD.propChangeCallback) {
5607
- hostRef.$flags$ |= 128 /* isWatchReady */;
5608
- }
5609
- endNewInstance();
5610
- const needsDeferredCallback = import_app_data17.BUILD.slotRelocation && cmpMeta.$flags$ & 4 /* hasSlotRelocation */;
5611
- if (!needsDeferredCallback) {
5612
- fireConnectedCallback(hostRef.$lazyInstance$, elm);
5613
5633
  } else {
5614
- hostRef.$deferredConnectedCallback$ = true;
5615
- }
5616
- } else {
5617
- Cstr = elm.constructor;
5618
- const cmpTag = elm.localName;
5619
- customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
5620
- }
5621
- if (import_app_data17.BUILD.style && Cstr && Cstr.style) {
5622
- let style;
5623
- if (typeof Cstr.style === "string") {
5624
- style = Cstr.style;
5625
- } else if (import_app_data17.BUILD.mode && typeof Cstr.style !== "string") {
5626
- hostRef.$modeName$ = computeMode(elm);
5627
- if (hostRef.$modeName$) {
5628
- style = Cstr.style[hostRef.$modeName$];
5629
- }
5630
- if (import_app_data17.BUILD.hydrateServerSide && hostRef.$modeName$) {
5631
- elm.setAttribute("s-mode", hostRef.$modeName$);
5632
- }
5633
- }
5634
- const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
5635
- if (!styles.has(scopeId2) || import_app_data17.BUILD.hotModuleReplacement && hmrVersionId) {
5636
- const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
5637
- if (import_app_data17.BUILD.hydrateServerSide && import_app_data17.BUILD.shadowDom) {
5638
- if (cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */) {
5639
- style = scopeCss(style, scopeId2, true);
5640
- } else if (needsScopedSSR()) {
5641
- style = expandPartSelectors(style);
5634
+ Cstr = elm.constructor;
5635
+ const cmpTag = elm.localName;
5636
+ customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
5637
+ }
5638
+ if (import_app_data17.BUILD.style && Cstr && Cstr.style) {
5639
+ let style;
5640
+ if (typeof Cstr.style === "string") {
5641
+ style = Cstr.style;
5642
+ } else if (import_app_data17.BUILD.mode && typeof Cstr.style !== "string") {
5643
+ hostRef.$modeName$ = computeMode(elm);
5644
+ if (hostRef.$modeName$) {
5645
+ style = Cstr.style[hostRef.$modeName$];
5646
+ }
5647
+ if (import_app_data17.BUILD.hydrateServerSide && hostRef.$modeName$) {
5648
+ elm.setAttribute("s-mode", hostRef.$modeName$);
5649
+ }
5650
+ }
5651
+ const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
5652
+ if (!styles.has(scopeId2) || import_app_data17.BUILD.hotModuleReplacement && hmrVersionId) {
5653
+ const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
5654
+ if (import_app_data17.BUILD.hydrateServerSide && import_app_data17.BUILD.shadowDom) {
5655
+ if (cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */) {
5656
+ style = scopeCss(style, scopeId2, true);
5657
+ } else if (needsScopedSSR()) {
5658
+ style = expandPartSelectors(style);
5659
+ }
5642
5660
  }
5661
+ registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
5662
+ endRegisterStyles();
5643
5663
  }
5644
- registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
5645
- endRegisterStyles();
5646
5664
  }
5647
5665
  }
5648
- }
5649
- const ancestorComponent = hostRef.$ancestorComponent$;
5650
- const schedule = () => scheduleUpdate(hostRef, true);
5651
- if (import_app_data17.BUILD.asyncLoading && ancestorComponent && ancestorComponent["s-rc"]) {
5652
- ancestorComponent["s-rc"].push(schedule);
5653
- } else {
5654
- schedule();
5666
+ const ancestorComponent = hostRef.$ancestorComponent$;
5667
+ const schedule = () => scheduleUpdate(hostRef, true);
5668
+ if (import_app_data17.BUILD.asyncLoading && ancestorComponent && ancestorComponent["s-rc"]) {
5669
+ ancestorComponent["s-rc"].push(schedule);
5670
+ } else {
5671
+ schedule();
5672
+ }
5673
+ } catch (e) {
5674
+ consoleError(e, elm);
5675
+ if (import_app_data17.BUILD.asyncLoading && hostRef.$onRenderResolve$) {
5676
+ hostRef.$onRenderResolve$();
5677
+ hostRef.$onRenderResolve$ = void 0;
5678
+ }
5679
+ if (import_app_data17.BUILD.asyncLoading && hostRef.$onReadyResolve$) {
5680
+ hostRef.$onReadyResolve$(elm);
5681
+ }
5655
5682
  }
5656
5683
  };
5657
5684
  var fireConnectedCallback = (instance, elm) => {
@@ -5783,91 +5810,99 @@ var proxyCustomElement = (Cstr, compactMeta) => {
5783
5810
  $flags$: compactMeta[0],
5784
5811
  $tagName$: compactMeta[1]
5785
5812
  };
5786
- if (import_app_data20.BUILD.member) {
5787
- cmpMeta.$members$ = compactMeta[2];
5788
- }
5789
- if (import_app_data20.BUILD.hostListener) {
5790
- cmpMeta.$listeners$ = compactMeta[3];
5791
- }
5792
- if (import_app_data20.BUILD.propChangeCallback) {
5793
- cmpMeta.$watchers$ = Cstr.$watchers$;
5794
- cmpMeta.$deserializers$ = Cstr.$deserializers$;
5795
- cmpMeta.$serializers$ = Cstr.$serializers$;
5796
- }
5797
- if (import_app_data20.BUILD.reflect) {
5798
- cmpMeta.$attrsToReflect$ = [];
5799
- }
5800
- if (import_app_data20.BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
5801
- cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
5802
- }
5803
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && cmpMeta.$flags$ & 256 /* hasSlot */) {
5804
- if (import_app_data20.BUILD.experimentalSlotFixes) {
5805
- patchPseudoShadowDom(Cstr.prototype);
5806
- } else {
5807
- if (import_app_data20.BUILD.slotChildNodesFix) {
5808
- patchChildSlotNodes(Cstr.prototype);
5809
- }
5810
- if (import_app_data20.BUILD.cloneNodeFix) {
5811
- patchCloneNode(Cstr.prototype);
5812
- }
5813
- if (import_app_data20.BUILD.appendChildSlotFix) {
5814
- patchSlotAppendChild(Cstr.prototype);
5815
- }
5816
- if (import_app_data20.BUILD.scopedSlotTextContentFix && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
5817
- patchTextContent(Cstr.prototype);
5818
- }
5813
+ try {
5814
+ if (import_app_data20.BUILD.member) {
5815
+ cmpMeta.$members$ = compactMeta[2];
5819
5816
  }
5820
- } else if (import_app_data20.BUILD.cloneNodeFix) {
5821
- patchCloneNode(Cstr.prototype);
5822
- }
5823
- if (import_app_data20.BUILD.hydrateClientSide && import_app_data20.BUILD.shadowDom) {
5824
- hydrateScopedToShadow();
5825
- }
5826
- const originalConnectedCallback = Cstr.prototype.connectedCallback;
5827
- const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
5828
- Object.assign(Cstr.prototype, {
5829
- __hasHostListenerAttached: false,
5830
- __registerHost() {
5831
- registerHost(this, cmpMeta);
5832
- },
5833
- connectedCallback() {
5834
- if (!this.__hasHostListenerAttached) {
5835
- const hostRef = getHostRef(this);
5836
- if (!hostRef) {
5837
- return;
5817
+ if (import_app_data20.BUILD.hostListener) {
5818
+ cmpMeta.$listeners$ = compactMeta[3];
5819
+ }
5820
+ if (import_app_data20.BUILD.propChangeCallback) {
5821
+ cmpMeta.$watchers$ = Cstr.$watchers$;
5822
+ cmpMeta.$deserializers$ = Cstr.$deserializers$;
5823
+ cmpMeta.$serializers$ = Cstr.$serializers$;
5824
+ }
5825
+ if (import_app_data20.BUILD.reflect) {
5826
+ cmpMeta.$attrsToReflect$ = [];
5827
+ }
5828
+ if (import_app_data20.BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
5829
+ cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
5830
+ }
5831
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && cmpMeta.$flags$ & 256 /* hasSlot */) {
5832
+ if (import_app_data20.BUILD.experimentalSlotFixes) {
5833
+ patchPseudoShadowDom(Cstr.prototype);
5834
+ } else {
5835
+ if (import_app_data20.BUILD.slotChildNodesFix) {
5836
+ patchChildSlotNodes(Cstr.prototype);
5837
+ }
5838
+ if (import_app_data20.BUILD.cloneNodeFix) {
5839
+ patchCloneNode(Cstr.prototype);
5840
+ }
5841
+ if (import_app_data20.BUILD.appendChildSlotFix) {
5842
+ patchSlotAppendChild(Cstr.prototype);
5843
+ }
5844
+ if (import_app_data20.BUILD.scopedSlotTextContentFix && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
5845
+ patchTextContent(Cstr.prototype);
5838
5846
  }
5839
- addHostEventListeners(this, hostRef, cmpMeta.$listeners$, false);
5840
- this.__hasHostListenerAttached = true;
5841
- }
5842
- connectedCallback(this);
5843
- if (originalConnectedCallback) {
5844
- originalConnectedCallback.call(this);
5845
- }
5846
- },
5847
- disconnectedCallback() {
5848
- disconnectedCallback(this);
5849
- if (originalDisconnectedCallback) {
5850
- originalDisconnectedCallback.call(this);
5851
5847
  }
5852
- },
5853
- __attachShadow() {
5854
- if (supportsShadow) {
5855
- if (!this.shadowRoot) {
5856
- createShadowRoot.call(this, cmpMeta);
5857
- } else {
5858
- if (this.shadowRoot.mode !== "open") {
5859
- throw new Error(
5860
- `Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`
5861
- );
5848
+ } else if (import_app_data20.BUILD.cloneNodeFix) {
5849
+ patchCloneNode(Cstr.prototype);
5850
+ }
5851
+ if (import_app_data20.BUILD.hydrateClientSide && import_app_data20.BUILD.shadowDom) {
5852
+ hydrateScopedToShadow();
5853
+ }
5854
+ const originalConnectedCallback = Cstr.prototype.connectedCallback;
5855
+ const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
5856
+ Object.assign(Cstr.prototype, {
5857
+ __hasHostListenerAttached: false,
5858
+ __registerHost() {
5859
+ registerHost(this, cmpMeta);
5860
+ },
5861
+ connectedCallback() {
5862
+ if (!this.__hasHostListenerAttached) {
5863
+ const hostRef = getHostRef(this);
5864
+ if (!hostRef) {
5865
+ return;
5862
5866
  }
5867
+ addHostEventListeners(this, hostRef, cmpMeta.$listeners$, false);
5868
+ this.__hasHostListenerAttached = true;
5869
+ }
5870
+ connectedCallback(this);
5871
+ if (originalConnectedCallback) {
5872
+ originalConnectedCallback.call(this);
5873
+ }
5874
+ },
5875
+ disconnectedCallback() {
5876
+ disconnectedCallback(this);
5877
+ if (originalDisconnectedCallback) {
5878
+ originalDisconnectedCallback.call(this);
5879
+ }
5880
+ },
5881
+ __attachShadow() {
5882
+ if (supportsShadow) {
5883
+ if (!this.shadowRoot) {
5884
+ createShadowRoot.call(this, cmpMeta);
5885
+ } else {
5886
+ if (this.shadowRoot.mode !== "open") {
5887
+ throw new Error(
5888
+ `Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`
5889
+ );
5890
+ }
5891
+ }
5892
+ } else {
5893
+ this.shadowRoot = this;
5863
5894
  }
5864
- } else {
5865
- this.shadowRoot = this;
5866
5895
  }
5867
- }
5868
- });
5869
- Cstr.is = cmpMeta.$tagName$;
5870
- return proxyComponent(Cstr, cmpMeta, 1 /* isElementConstructor */ | 2 /* proxyState */);
5896
+ });
5897
+ Object.defineProperty(Cstr, "is", {
5898
+ value: cmpMeta.$tagName$,
5899
+ configurable: true
5900
+ });
5901
+ return proxyComponent(Cstr, cmpMeta, 1 /* isElementConstructor */ | 2 /* proxyState */);
5902
+ } catch (e) {
5903
+ consoleError(e);
5904
+ return Cstr;
5905
+ }
5871
5906
  };
5872
5907
  var forceModeUpdate = (elm) => {
5873
5908
  if (import_app_data20.BUILD.style && import_app_data20.BUILD.mode && !import_app_data20.BUILD.lazyLoad) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/testing",
3
- "version": "4.42.0",
3
+ "version": "4.42.1",
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.42.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc (CommonJS) v4.42.1 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __defProp = Object.defineProperty;
@@ -7816,6 +7816,8 @@ function createElement(ownerDocument, tagName) {
7816
7816
  return new MockImageElement(ownerDocument);
7817
7817
  case "input":
7818
7818
  return new MockInputElement(ownerDocument);
7819
+ case "label":
7820
+ return new MockLabelElement(ownerDocument);
7819
7821
  case "link":
7820
7822
  return new MockLinkElement(ownerDocument);
7821
7823
  case "meta":
@@ -7894,6 +7896,9 @@ var MockButtonElement = class extends MockHTMLElement {
7894
7896
  constructor(ownerDocument) {
7895
7897
  super(ownerDocument, "button");
7896
7898
  }
7899
+ get labels() {
7900
+ return getLabelsForElement(this);
7901
+ }
7897
7902
  };
7898
7903
  patchPropAttributes(
7899
7904
  MockButtonElement.prototype,
@@ -7941,6 +7946,9 @@ var MockInputElement = class extends MockHTMLElement {
7941
7946
  }
7942
7947
  return null;
7943
7948
  }
7949
+ get labels() {
7950
+ return getLabelsForElement(this);
7951
+ }
7944
7952
  };
7945
7953
  patchPropAttributes(
7946
7954
  MockInputElement.prototype,
@@ -7989,6 +7997,26 @@ var MockFormElement = class extends MockHTMLElement {
7989
7997
  patchPropAttributes(MockFormElement.prototype, {
7990
7998
  name: String
7991
7999
  });
8000
+ var MockLabelElement = class extends MockHTMLElement {
8001
+ constructor(ownerDocument) {
8002
+ super(ownerDocument, "label");
8003
+ }
8004
+ get htmlFor() {
8005
+ return this.getAttributeNS(null, "for") || "";
8006
+ }
8007
+ set htmlFor(value) {
8008
+ this.setAttributeNS(null, "for", value);
8009
+ }
8010
+ get control() {
8011
+ var _a, _b;
8012
+ const forAttr = this.htmlFor;
8013
+ if (forAttr) {
8014
+ return (_b = (_a = this.ownerDocument) == null ? void 0 : _a.getElementById(forAttr)) != null ? _b : null;
8015
+ }
8016
+ const labelableSelector = 'button, input:not([type="hidden"]), meter, output, progress, select, textarea';
8017
+ return this.querySelector(labelableSelector);
8018
+ }
8019
+ };
7992
8020
  var MockLinkElement = class extends MockHTMLElement {
7993
8021
  constructor(ownerDocument) {
7994
8022
  super(ownerDocument, "link");
@@ -8399,6 +8427,30 @@ function fullUrl(elm, attrName) {
8399
8427
  }
8400
8428
  return val.replace(/\'|\"/g, "").trim();
8401
8429
  }
8430
+ function getLabelsForElement(elm) {
8431
+ const labels = [];
8432
+ const id = elm.id;
8433
+ const doc = elm.ownerDocument;
8434
+ if (doc) {
8435
+ if (id) {
8436
+ const allLabels = doc.getElementsByTagName("label");
8437
+ for (let i = 0; i < allLabels.length; i++) {
8438
+ const label = allLabels[i];
8439
+ if (label.htmlFor === id) {
8440
+ labels.push(label);
8441
+ }
8442
+ }
8443
+ }
8444
+ let parent = elm.parentNode;
8445
+ while (parent) {
8446
+ if (parent.nodeName === "LABEL" && !labels.includes(parent)) {
8447
+ labels.push(parent);
8448
+ }
8449
+ parent = parent.parentNode;
8450
+ }
8451
+ }
8452
+ return labels;
8453
+ }
8402
8454
  function patchPropAttributes(prototype, attrs, defaults = {}) {
8403
8455
  Object.keys(attrs).forEach((propName) => {
8404
8456
  const attr = attrs[propName];
@@ -9132,7 +9184,6 @@ var MockWindow = class {
9132
9184
  __timeouts;
9133
9185
  __history;
9134
9186
  __elementCstr;
9135
- __htmlElementCstr;
9136
9187
  __charDataCstr;
9137
9188
  __docTypeCstr;
9138
9189
  __docCstr;
@@ -9339,27 +9390,10 @@ var MockWindow = class {
9339
9390
  return JSON;
9340
9391
  }
9341
9392
  get HTMLElement() {
9342
- if (this.__htmlElementCstr == null) {
9343
- const ownerDocument = this.document;
9344
- this.__htmlElementCstr = class extends MockHTMLElement {
9345
- constructor() {
9346
- super(ownerDocument, "");
9347
- const observedAttributes = this.constructor.observedAttributes;
9348
- if (Array.isArray(observedAttributes) && typeof this.attributeChangedCallback === "function") {
9349
- observedAttributes.forEach((attrName) => {
9350
- const attrValue = this.getAttribute(attrName);
9351
- if (attrValue != null) {
9352
- this.attributeChangedCallback(attrName, null, attrValue);
9353
- }
9354
- });
9355
- }
9356
- }
9357
- };
9358
- }
9359
- return this.__htmlElementCstr;
9393
+ return MockHTMLElement;
9360
9394
  }
9361
- set HTMLElement(htmlElementCstr) {
9362
- this.__htmlElementCstr = htmlElementCstr;
9395
+ get SVGElement() {
9396
+ return MockSVGElement;
9363
9397
  }
9364
9398
  get IntersectionObserver() {
9365
9399
  return MockIntersectionObserver;
@@ -165,6 +165,7 @@ declare class MockAnchorElement extends MockHTMLElement {
165
165
  }
166
166
  declare class MockButtonElement extends MockHTMLElement {
167
167
  constructor(ownerDocument: any);
168
+ get labels(): MockHTMLElement[];
168
169
  }
169
170
  declare class MockImageElement extends MockHTMLElement {
170
171
  constructor(ownerDocument: any);
@@ -176,10 +177,17 @@ declare class MockImageElement extends MockHTMLElement {
176
177
  declare class MockInputElement extends MockHTMLElement {
177
178
  constructor(ownerDocument: any);
178
179
  get list(): HTMLElement;
180
+ get labels(): MockHTMLElement[];
179
181
  }
180
182
  declare class MockFormElement extends MockHTMLElement {
181
183
  constructor(ownerDocument: any);
182
184
  }
185
+ declare class MockLabelElement extends MockHTMLElement {
186
+ constructor(ownerDocument: any);
187
+ get htmlFor(): string;
188
+ set htmlFor(value: string);
189
+ get control(): MockHTMLElement | null;
190
+ }
183
191
  declare class MockLinkElement extends MockHTMLElement {
184
192
  constructor(ownerDocument: any);
185
193
  get href(): string;
@@ -1018,8 +1026,8 @@ declare class MockWindow {
1018
1026
  get history(): any;
1019
1027
  set history(hsty: any);
1020
1028
  get JSON(): JSON;
1021
- get HTMLElement(): any;
1022
- set HTMLElement(htmlElementCstr: any);
1029
+ get HTMLElement(): typeof MockHTMLElement;
1030
+ get SVGElement(): typeof MockSVGElement;
1023
1031
  get IntersectionObserver(): typeof MockIntersectionObserver;
1024
1032
  get ResizeObserver(): typeof MockResizeObserver;
1025
1033
  get localStorage(): MockStorage;