@stencil/core 5.0.0-beta.12 → 5.0.0-beta.13

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.
@@ -5,12 +5,13 @@ import fs from "node:fs";
5
5
  import "picomatch";
6
6
  import * as SignalsCore from "@preact/signals-core";
7
7
  import path, { basename, dirname } from "path";
8
+ import resolve from "resolve";
8
9
  import "postcss";
9
- import "postcss-safe-parser";
10
+ import "postcss-nesting";
10
11
  import "postcss-selector-parser";
12
+ import "postcss-safe-parser";
11
13
  import "magic-string";
12
14
  import "rolldown";
13
- import resolve from "resolve";
14
15
  import "rolldown/utils";
15
16
  import "terser";
16
17
  import "css-what";
@@ -32,7 +33,7 @@ import "@rollup/pluginutils";
32
33
  import { createHash } from "crypto";
33
34
  import { afterAll, vi } from "vitest";
34
35
  //#region src/version.ts
35
- const version = "5.0.0-beta.12";
36
+ const version = "5.0.0-beta.13";
36
37
  const MEMBER_FLAGS = {
37
38
  String: 1,
38
39
  Number: 2,
@@ -640,7 +641,7 @@ const Env = {};
640
641
  //#endregion
641
642
  //#region src/testing/platform/testing-constants.ts
642
643
  const styles = /* @__PURE__ */ new Map();
643
- const modeResolutionChain = [];
644
+ const modeResolver = [];
644
645
  /**
645
646
  * A mapping of custom element tags (e.g. `my-component`) to their constructor
646
647
  */
@@ -2241,10 +2242,10 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
2241
2242
  const isComplex = isComplexType(newValue);
2242
2243
  if (!BUILD.lazyLoad) {
2243
2244
  const isStandardAttr = ln.startsWith("aria-") || ln.startsWith("data-");
2244
- if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" && typeof customElements !== "undefined" && !customElements.get(elm.tagName.toLowerCase())) {
2245
+ if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" && !customElements.get(elm.tagName.toLowerCase())) {
2245
2246
  if (!elm["s-pp"]) elm["s-pp"] = /* @__PURE__ */ new Map();
2246
2247
  elm["s-pp"].set(memberName, newValue);
2247
- return;
2248
+ if (isComplex || /[A-Z]/.test(memberName)) return;
2248
2249
  }
2249
2250
  }
2250
2251
  if ((isProp || isComplex && newValue !== null) && !isSvg) try {
@@ -4511,7 +4512,7 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
4511
4512
  };
4512
4513
  //#endregion
4513
4514
  //#region src/runtime/mode.ts
4514
- const computeMode = (elm) => modeResolutionChain.map((h) => h(elm)).find((m) => !!m);
4515
+ const computeMode = (elm) => modeResolver.map((h) => h(elm)).find((m) => !!m);
4515
4516
  const getMode = (ref) => getHostRef(ref)?.$modeName$;
4516
4517
  //#endregion
4517
4518
  //#region src/runtime/normalize-watchers.ts
@@ -4576,23 +4577,14 @@ const normalizeWatchers = (raw) => {
4576
4577
  *
4577
4578
  * @param propValue the new value to coerce to some type
4578
4579
  * @param propType the type of the prop, expressed as a binary number
4579
- * @param isFormAssociated whether the component is form-associated (optional)
4580
4580
  * @returns the parsed/coerced value
4581
4581
  */
4582
- const parsePropertyValue = (propValue, propType, isFormAssociated) => {
4582
+ const parsePropertyValue = (propValue, propType) => {
4583
4583
  if (propValue != null && !isComplexType(propValue)) {
4584
4584
  /**
4585
4585
  * ensure this value is of the correct prop type
4586
4586
  */
4587
- if (BUILD.propBoolean && propType & MEMBER_FLAGS.Boolean) {
4588
- /**
4589
- * For form-associated components, according to HTML spec, the presence of any boolean attribute
4590
- * (regardless of its value, even "false") should make the property true.
4591
- * For non-form-associated components, we maintain the legacy behavior where "false" becomes false.
4592
- */
4593
- if (BUILD.formAssociated && isFormAssociated && typeof propValue === "string") return propValue === "" || !!propValue;
4594
- else return propValue === "false" ? false : propValue === "" || !!propValue;
4595
- }
4587
+ if (BUILD.propBoolean && propType & MEMBER_FLAGS.Boolean) return propValue === "" || !!propValue;
4596
4588
  /**
4597
4589
  * force it to be a number
4598
4590
  */
@@ -4634,7 +4626,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
4634
4626
  if (BUILD.signalBacking) {
4635
4627
  const sig = hostRef?.$signalValues$?.get(propName);
4636
4628
  if (sig !== void 0) {
4637
- const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0], BUILD.formAssociated && !!(cmpMeta.$flags$ & CMP_FLAGS.formAssociated));
4629
+ const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
4638
4630
  if (BUILD.serializer && BUILD.reflect && cmpMeta.$attrsToReflect$ && cmpMeta.$serializers$?.[propName]) {
4639
4631
  const elm = BUILD.lazyLoad ? hostRef.$hostElement$ : ref;
4640
4632
  applySerializers(hostRef, cmpMeta, propName, parsed, BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm);
@@ -4652,7 +4644,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
4652
4644
  const oldVal = hostRef.$instanceValues$.get(propName);
4653
4645
  const flags = hostRef.$flags$;
4654
4646
  const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
4655
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0], BUILD.formAssociated && !!(cmpMeta.$flags$ & CMP_FLAGS.formAssociated));
4647
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
4656
4648
  const didValueChange = newVal !== oldVal && !(Number.isNaN(oldVal) && Number.isNaN(newVal));
4657
4649
  if ((!BUILD.lazyLoad || !(flags & HOST_FLAGS.isConstructingInstance) || oldVal === void 0) && didValueChange) {
4658
4650
  hostRef.$instanceValues$.set(propName, newVal);
@@ -4701,6 +4693,22 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
4701
4693
  */
4702
4694
  const reflectedAttrValue = (propValue) => propValue == null || propValue === false ? null : propValue === true ? "" : String(propValue);
4703
4695
  /**
4696
+ * Hand values written to a lazy component's element before its instance existed to the
4697
+ * instance's own `@Prop` setters. Must run as soon as the instance is constructed, so that
4698
+ * whenever `$lazyInstance$` is set, reads through it agree with the element's last write.
4699
+ *
4700
+ * @param hostRef the runtime bookkeeping object of a freshly constructed lazy instance
4701
+ * @param cmpMeta runtime metadata for the component (with any run-time only setters flagged)
4702
+ */
4703
+ const replayPendingSetterValues = (hostRef, cmpMeta) => {
4704
+ const instance = hostRef.$lazyInstance$;
4705
+ if (!instance) return;
4706
+ for (const [memberName, [memberFlags]] of Object.entries(cmpMeta.$members$ ?? {})) if (memberFlags & MEMBER_FLAGS.Setter && hostRef.$instanceValues$.has(memberName)) {
4707
+ const pendingValue = hostRef.$instanceValues$.get(memberName);
4708
+ if (instance[memberName] !== pendingValue) instance[memberName] = pendingValue;
4709
+ }
4710
+ };
4711
+ /**
4704
4712
  * Attach a series of runtime constructs to a compiled Stencil component
4705
4713
  * constructor, including getters and setters for the `@Prop` and `@State`
4706
4714
  * decorators, callbacks for when attributes change, and so on.
@@ -4757,9 +4765,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
4757
4765
  if (BUILD.lazyLoad) {
4758
4766
  if ((cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Getter) === 0) return getValue(this, memberName);
4759
4767
  const ref = getHostRef(this);
4760
- const instance = ref ? ref.$lazyInstance$ : prototype;
4761
- if (!instance) return;
4762
- return instance[memberName];
4768
+ if (!ref) return prototype[memberName];
4769
+ return ref.$lazyInstance$ ? ref.$lazyInstance$[memberName] : getValue(this, memberName);
4763
4770
  }
4764
4771
  if (!BUILD.lazyLoad) return origGetter ? origGetter.apply(this) : getValue(this, memberName);
4765
4772
  },
@@ -4774,7 +4781,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
4774
4781
  }
4775
4782
  if (origSetter) {
4776
4783
  if (typeof (memberFlags & MEMBER_FLAGS.State ? this[memberName] : ref.$hostElement$[memberName]) === "undefined" && ref.$instanceValues$.get(memberName)) newValue = ref.$instanceValues$.get(memberName);
4777
- origSetter.apply(this, [parsePropertyValue(newValue, memberFlags, BUILD.formAssociated && !!(cmpMeta.$flags$ & CMP_FLAGS.formAssociated))]);
4784
+ origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
4778
4785
  newValue = memberFlags & MEMBER_FLAGS.State ? this[memberName] : ref.$hostElement$[memberName];
4779
4786
  setValue(this, memberName, newValue, cmpMeta);
4780
4787
  return;
@@ -4786,26 +4793,15 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
4786
4793
  if (BUILD.lazyLoad) {
4787
4794
  if ((flags & PROXY_FLAGS.isElementConstructor) === 0 || (cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Setter) === 0) {
4788
4795
  setValue(this, memberName, newValue, cmpMeta);
4789
- if (flags & PROXY_FLAGS.isElementConstructor && !ref.$lazyInstance$) ref.$fetchedCbList$.push(() => {
4790
- if (cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Setter && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) ref.$lazyInstance$[memberName] = newValue;
4791
- });
4792
4796
  return;
4793
4797
  }
4794
- const parsedValue = parsePropertyValue(newValue, memberFlags, BUILD.formAssociated && !!(cmpMeta.$flags$ & CMP_FLAGS.formAssociated));
4795
- const setterSetVal = (val) => {
4798
+ const parsedValue = parsePropertyValue(newValue, memberFlags);
4799
+ if (ref.$lazyInstance$) {
4796
4800
  const currentValue = ref.$lazyInstance$[memberName];
4797
4801
  if (!ref.$instanceValues$.get(memberName) && currentValue) ref.$instanceValues$.set(memberName, currentValue);
4798
- ref.$lazyInstance$[memberName] = val;
4802
+ ref.$lazyInstance$[memberName] = parsedValue;
4799
4803
  setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
4800
- };
4801
- if (ref.$lazyInstance$) setterSetVal(parsedValue);
4802
- else {
4803
- ref.$instanceValues$.set(memberName, parsedValue);
4804
- ref.$fetchedCbList$.push(() => {
4805
- const pendingValue = ref.$instanceValues$.get(memberName);
4806
- if (ref.$lazyInstance$[memberName] !== pendingValue) setterSetVal(pendingValue);
4807
- });
4808
- }
4804
+ } else ref.$instanceValues$.set(memberName, parsedValue);
4809
4805
  }
4810
4806
  } });
4811
4807
  } else if (BUILD.lazyLoad && BUILD.method && flags & PROXY_FLAGS.isElementConstructor && memberFlags & MEMBER_FLAGS.Method) Object.defineProperty(prototype, memberName, { value(...args) {
@@ -4857,10 +4853,12 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
4857
4853
  const isBooleanTarget = propMemberFlags & MEMBER_FLAGS.Boolean;
4858
4854
  if (BUILD.reflect && propMemberFlags & MEMBER_FLAGS.ReflectAttr && propMemberFlags & MEMBER_FLAGS.Any && !isComplexType(this[propName]) && reflectedAttrValue(this[propName]) === newValue) return;
4859
4855
  const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
4860
- if (isBooleanTarget) newValue = !(newValue === null || newValue === "false");
4861
- const currentValue = BUILD.lazyLoad && propMemberFlags & MEMBER_FLAGS.Setter ? hostRef.$instanceValues$.get(propName) : this[propName];
4856
+ if (isBooleanTarget) {
4857
+ if (BUILD.isDev && newValue === "false") consoleDevWarn(`<${cmpMeta.$tagName$} ${attrName}="false">: boolean attributes are true when present, regardless of value. Remove the attribute or set the "${propName}" property to false instead.`);
4858
+ newValue = newValue !== null;
4859
+ }
4862
4860
  const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
4863
- if (!isSpuriousBooleanRemoval && newValue != currentValue && (!propDesc.get || !!propDesc.set)) this[propName] = newValue;
4861
+ if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) this[propName] = newValue;
4864
4862
  });
4865
4863
  };
4866
4864
  Cstr.observedAttributes = Array.from(/* @__PURE__ */ new Set([...Object.keys(cmpMeta.$watchers$ ?? {}), ...members.filter(([_, m]) => m[0] & MEMBER_FLAGS.HasAttribute).map(([propName, m]) => {
@@ -4921,7 +4919,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
4921
4919
  } catch (e) {
4922
4920
  consoleError(e, elm);
4923
4921
  }
4924
- if (BUILD.member) hostRef.$flags$ &= ~HOST_FLAGS.isConstructingInstance;
4922
+ if (BUILD.member) {
4923
+ hostRef.$flags$ &= ~HOST_FLAGS.isConstructingInstance;
4924
+ replayPendingSetterValues(hostRef, cmpMeta);
4925
+ }
4925
4926
  endNewInstance();
4926
4927
  if (BUILD.asyncLoading && hostRef.$ancestorComponent$) await awaitAncestorConnected(hostRef.$ancestorComponent$);
4927
4928
  if (!(BUILD.slotRelocation && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation)) {
@@ -5141,48 +5142,45 @@ const hmrStandalone = async (hostElement, cmpMeta, hmrVersionId) => {
5141
5142
  `${modulePath}?s-hmr=${hmrVersionId}`
5142
5143
  );
5143
5144
  const NewClass = Object.values(newModule).find((v) => typeof v === "function" && v.is === cmpMeta.$tagName$) ?? newModule.default;
5144
- if (!NewClass) return;
5145
- const ctor = customElements.get(cmpMeta.$tagName$);
5146
- if (ctor) {
5147
- for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
5148
- if (key === "constructor") continue;
5149
- Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
5150
- }
5151
- const styleDesc = Object.getOwnPropertyDescriptor(NewClass, "style");
5152
- if (styleDesc) {
5153
- Object.defineProperty(ctor, "style", styleDesc);
5154
- const newStyle = NewClass.style;
5155
- if (newStyle) {
5156
- const scopeId = getScopeId(cmpMeta);
5157
- const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
5158
- console.log("[stencil-hmr] registerStyle", {
5159
- tag: cmpMeta.$tagName$,
5160
- scopeId,
5161
- isShadow,
5162
- cssLen: newStyle.length
5163
- });
5164
- registerStyle(scopeId, newStyle, isShadow);
5165
- }
5166
- }
5167
- }
5168
- const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
5169
- document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => {
5170
- const hostRef = getHostRef(el);
5171
- if (BUILD.hostListener && hostRef?.$rmListeners$) {
5172
- hostRef.$rmListeners$.map((rmListener) => rmListener());
5173
- hostRef.$rmListeners$ = void 0;
5174
- addHostEventListeners(el, hostRef, cmpMeta.$listeners$);
5175
- }
5176
- if (!isShadow && hostRef) {
5177
- console.log("[stencil-hmr] calling attachStyles for", cmpMeta.$tagName$);
5178
- attachStyles(hostRef);
5179
- }
5180
- forceUpdate(el);
5181
- });
5145
+ if (NewClass) hmrApplyClass(cmpMeta, NewClass);
5182
5146
  } catch (e) {
5183
5147
  console.error(`[Stencil HMR] Failed to reload <${cmpMeta.$tagName$}>`, e);
5184
5148
  }
5185
5149
  };
5150
+ /**
5151
+ * Patch a re-executed component class onto the registered one and re-render every live instance.
5152
+ * Shared by the standalone re-import above and bundlers that re-execute the module themselves
5153
+ * (webpack/rspack `module.hot`), which reach it via the constructor's `s-hmr-apply` hook.
5154
+ *
5155
+ * @param cmpMeta runtime metadata for the component
5156
+ * @param NewClass the component's newly executed class
5157
+ */
5158
+ const hmrApplyClass = (cmpMeta, NewClass) => {
5159
+ const ctor = customElements.get(cmpMeta.$tagName$);
5160
+ const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
5161
+ if (ctor && ctor !== NewClass) {
5162
+ for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
5163
+ if (key === "constructor") continue;
5164
+ Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
5165
+ }
5166
+ const styleDesc = Object.getOwnPropertyDescriptor(NewClass, "style");
5167
+ if (styleDesc) {
5168
+ Object.defineProperty(ctor, "style", styleDesc);
5169
+ const newStyle = NewClass.style;
5170
+ if (newStyle) registerStyle(getScopeId(cmpMeta), newStyle, isShadow);
5171
+ }
5172
+ }
5173
+ document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => {
5174
+ const hostRef = getHostRef(el);
5175
+ if (BUILD.hostListener && hostRef?.$rmListeners$) {
5176
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
5177
+ hostRef.$rmListeners$ = void 0;
5178
+ addHostEventListeners(el, hostRef, cmpMeta.$listeners$);
5179
+ }
5180
+ if (!isShadow && hostRef) attachStyles(hostRef);
5181
+ forceUpdate(el);
5182
+ });
5183
+ };
5186
5184
  //#endregion
5187
5185
  //#region src/runtime/bootstrap-loader.ts
5188
5186
  const bootstrapLazy = (lazyBundles, options = {}) => {
@@ -5600,8 +5598,8 @@ const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, in
5600
5598
  //#endregion
5601
5599
  //#region src/testing/platform/index.ts
5602
5600
  const setMode = (handler) => {
5603
- modeResolutionChain.length = 0;
5604
- modeResolutionChain.push(handler);
5601
+ modeResolver.length = 0;
5602
+ modeResolver.push(handler);
5605
5603
  };
5606
5604
  const needsScopedSSR = () => scopedSSR;
5607
5605
  let scopedSSR = false;
@@ -5680,79 +5678,6 @@ const buildEvents = () => {
5680
5678
  };
5681
5679
  };
5682
5680
  //#endregion
5683
- //#region src/compiler/app-core/app-data.ts
5684
- /**
5685
- * Generate a {@link BuildFeatures} entity, based on the provided component metadata
5686
- * @param cmps a collection of component compiler metadata, used to set values on the generated build features object
5687
- * @returns the generated build features entity
5688
- */
5689
- const getBuildFeatures = (cmps) => {
5690
- const slot = cmps.some((c) => c.htmlTagNames.includes("slot"));
5691
- const shadowDom = cmps.some((c) => c.encapsulation === "shadow");
5692
- const slotRelocation = cmps.some((c) => c.encapsulation !== "shadow" && c.htmlTagNames.includes("slot"));
5693
- const f = {
5694
- allRenderFn: cmps.every((c) => c.hasRenderFn),
5695
- formAssociated: cmps.some((c) => c.formAssociated),
5696
- deserializer: cmps.some((c) => c.hasDeserializer),
5697
- element: cmps.some((c) => c.hasElement),
5698
- event: cmps.some((c) => c.hasEvent),
5699
- hasRenderFn: cmps.some((c) => c.hasRenderFn),
5700
- lifecycle: cmps.some((c) => c.hasLifecycle),
5701
- asyncLoading: true,
5702
- hostListener: cmps.some((c) => c.hasListener),
5703
- hostListenerTargetWindow: cmps.some((c) => c.hasListenerTargetWindow),
5704
- hostListenerTargetDocument: cmps.some((c) => c.hasListenerTargetDocument),
5705
- hostListenerTargetBody: cmps.some((c) => c.hasListenerTargetBody),
5706
- hostListenerTarget: cmps.some((c) => c.hasListenerTarget),
5707
- member: cmps.some((c) => c.hasMember),
5708
- method: cmps.some((c) => c.hasMethod),
5709
- mode: cmps.some((c) => c.hasMode),
5710
- observeAttribute: cmps.some((c) => c.hasAttribute || c.hasWatchCallback || c.hasDeserializer),
5711
- prop: cmps.some((c) => c.hasProp),
5712
- propBoolean: cmps.some((c) => c.hasPropBoolean),
5713
- propChangeCallback: cmps.some((c) => c.hasWatchCallback || c.hasDeserializer || c.hasSerializer),
5714
- propNumber: cmps.some((c) => c.hasPropNumber),
5715
- propString: cmps.some((c) => c.hasPropString),
5716
- propMutable: cmps.some((c) => c.hasPropMutable),
5717
- reflect: cmps.some((c) => c.hasReflect || c.hasSerializer),
5718
- scoped: cmps.some((c) => c.encapsulation === "scoped"),
5719
- serializer: cmps.some((c) => c.hasSerializer),
5720
- shadowDom,
5721
- shadowDelegatesFocus: shadowDom && cmps.some((c) => c.shadowDelegatesFocus),
5722
- shadowModeClosed: shadowDom && cmps.some((c) => c.shadowMode === "closed"),
5723
- shadowSlotAssignmentManual: shadowDom && cmps.some((c) => c.slotAssignment === "manual"),
5724
- shadowClonable: shadowDom && cmps.some((c) => c.shadowClonable),
5725
- shadowSerializable: shadowDom && cmps.some((c) => c.shadowSerializable),
5726
- slot,
5727
- slotRelocation,
5728
- state: cmps.some((c) => c.hasState),
5729
- style: cmps.some((c) => c.hasStyle),
5730
- svg: cmps.some((c) => c.htmlTagNames.includes("svg")),
5731
- updatable: cmps.some((c) => c.isUpdateable),
5732
- vdomAttribute: cmps.some((c) => c.hasVdomAttribute),
5733
- vdomXlink: cmps.some((c) => c.hasVdomXlink),
5734
- vdomClass: cmps.some((c) => c.hasVdomClass),
5735
- vdomFunctional: cmps.some((c) => c.hasVdomFunctional),
5736
- vdomKey: cmps.some((c) => c.hasVdomKey),
5737
- vdomListener: cmps.some((c) => c.hasVdomListener),
5738
- vdomPropOrAttr: cmps.some((c) => c.hasVdomPropOrAttr),
5739
- vdomPropOrAttrPrefix: cmps.some((c) => c.hasVdomPropOrAttrPrefix),
5740
- vdomRef: cmps.some((c) => c.hasVdomRef),
5741
- vdomRender: cmps.some((c) => c.hasVdomRender),
5742
- vdomStyle: cmps.some((c) => c.hasVdomStyle),
5743
- vdomText: cmps.some((c) => c.hasVdomText),
5744
- vdomSignals: cmps.some((c) => c.hasSignalsImport),
5745
- taskQueue: true,
5746
- patchAll: cmps.some((c) => c.hasPatchAll),
5747
- patchChildren: cmps.some((c) => c.hasPatchChildren),
5748
- patchClone: cmps.some((c) => c.hasPatchClone),
5749
- patchInsert: cmps.some((c) => c.hasPatchInsert)
5750
- };
5751
- f.vdomAttribute = f.vdomAttribute || f.reflect;
5752
- f.vdomPropOrAttr = f.vdomPropOrAttr || f.reflect;
5753
- return f;
5754
- };
5755
- //#endregion
5756
5681
  //#region src/compiler/sys/resolve/resolve-utils.ts
5757
5682
  const getModuleId = (orgImport) => {
5758
5683
  if (orgImport.startsWith("~")) orgImport = orgImport.substring(1);
@@ -5842,6 +5767,92 @@ const createCustomResolverAsync = (sys, inMemoryFs, exts) => {
5842
5767
  extensions: exts
5843
5768
  };
5844
5769
  };
5770
+ //#endregion
5771
+ //#region src/compiler/app-core/app-data.ts
5772
+ /**
5773
+ * Generate a {@link BuildFeatures} entity, based on the provided component metadata
5774
+ * @param cmps a collection of component compiler metadata, used to set values on the generated build features object
5775
+ * @returns the generated build features entity
5776
+ */
5777
+ const getBuildFeatures = (cmps) => {
5778
+ const slot = cmps.some((c) => c.htmlTagNames.includes("slot"));
5779
+ const shadowDom = cmps.some((c) => c.encapsulation === "shadow");
5780
+ const slotRelocation = cmps.some((c) => c.encapsulation !== "shadow" && c.htmlTagNames.includes("slot"));
5781
+ const f = {
5782
+ allRenderFn: cmps.every((c) => c.hasRenderFn),
5783
+ formAssociated: cmps.some((c) => c.formAssociated),
5784
+ deserializer: cmps.some((c) => c.hasDeserializer),
5785
+ element: cmps.some((c) => c.hasElement),
5786
+ event: cmps.some((c) => c.hasEvent),
5787
+ hasRenderFn: cmps.some((c) => c.hasRenderFn),
5788
+ lifecycle: cmps.some((c) => c.hasLifecycle),
5789
+ asyncLoading: true,
5790
+ hostListener: cmps.some((c) => c.hasListener),
5791
+ hostListenerTargetWindow: cmps.some((c) => c.hasListenerTargetWindow),
5792
+ hostListenerTargetDocument: cmps.some((c) => c.hasListenerTargetDocument),
5793
+ hostListenerTargetBody: cmps.some((c) => c.hasListenerTargetBody),
5794
+ hostListenerTarget: cmps.some((c) => c.hasListenerTarget),
5795
+ member: cmps.some((c) => c.hasMember),
5796
+ method: cmps.some((c) => c.hasMethod),
5797
+ mode: cmps.some((c) => c.hasMode),
5798
+ observeAttribute: cmps.some((c) => c.hasAttribute || c.hasWatchCallback || c.hasDeserializer),
5799
+ prop: cmps.some((c) => c.hasProp),
5800
+ propBoolean: cmps.some((c) => c.hasPropBoolean),
5801
+ propChangeCallback: cmps.some((c) => c.hasWatchCallback || c.hasDeserializer || c.hasSerializer),
5802
+ propNumber: cmps.some((c) => c.hasPropNumber),
5803
+ propString: cmps.some((c) => c.hasPropString),
5804
+ propMutable: cmps.some((c) => c.hasPropMutable),
5805
+ reflect: cmps.some((c) => c.hasReflect || c.hasSerializer),
5806
+ scoped: cmps.some((c) => c.encapsulation === "scoped"),
5807
+ serializer: cmps.some((c) => c.hasSerializer),
5808
+ shadowDom,
5809
+ shadowDelegatesFocus: shadowDom && cmps.some((c) => c.shadowDelegatesFocus),
5810
+ shadowModeClosed: shadowDom && cmps.some((c) => c.shadowMode === "closed"),
5811
+ shadowSlotAssignmentManual: shadowDom && cmps.some((c) => c.slotAssignment === "manual"),
5812
+ shadowClonable: shadowDom && cmps.some((c) => c.shadowClonable),
5813
+ shadowSerializable: shadowDom && cmps.some((c) => c.shadowSerializable),
5814
+ slot,
5815
+ slotRelocation,
5816
+ state: cmps.some((c) => c.hasState),
5817
+ style: cmps.some((c) => c.hasStyle),
5818
+ svg: cmps.some((c) => c.htmlTagNames.includes("svg")),
5819
+ updatable: cmps.some((c) => c.isUpdateable),
5820
+ vdomAttribute: cmps.some((c) => c.hasVdomAttribute),
5821
+ vdomXlink: cmps.some((c) => c.hasVdomXlink),
5822
+ vdomClass: cmps.some((c) => c.hasVdomClass),
5823
+ vdomFunctional: cmps.some((c) => c.hasVdomFunctional),
5824
+ vdomKey: cmps.some((c) => c.hasVdomKey),
5825
+ vdomListener: cmps.some((c) => c.hasVdomListener),
5826
+ vdomPropOrAttr: cmps.some((c) => c.hasVdomPropOrAttr),
5827
+ vdomPropOrAttrPrefix: cmps.some((c) => c.hasVdomPropOrAttrPrefix),
5828
+ vdomRef: cmps.some((c) => c.hasVdomRef),
5829
+ vdomRender: cmps.some((c) => c.hasVdomRender),
5830
+ vdomStyle: cmps.some((c) => c.hasVdomStyle),
5831
+ vdomText: cmps.some((c) => c.hasVdomText),
5832
+ vdomSignals: cmps.some((c) => c.hasSignalsImport),
5833
+ taskQueue: true,
5834
+ patchAll: cmps.some((c) => c.hasPatchAll),
5835
+ patchChildren: cmps.some((c) => c.hasPatchChildren),
5836
+ patchClone: cmps.some((c) => c.hasPatchClone),
5837
+ patchInsert: cmps.some((c) => c.hasPatchInsert)
5838
+ };
5839
+ f.vdomAttribute = f.vdomAttribute || f.reflect;
5840
+ f.vdomPropOrAttr = f.vdomPropOrAttr || f.reflect;
5841
+ return f;
5842
+ };
5843
+ //#endregion
5844
+ //#region src/compiler/style/component-global-styles.ts
5845
+ /**
5846
+ * Match `@import` of a `stencil-*` virtual import in any form CSS allows or a preprocessor emits:
5847
+ * quoted or not, bare or `url()`-wrapped, and with or without whitespace after `@import` (Sass's
5848
+ * compressed output drops it). Capture group 2 holds any trailing modifiers, e.g. `layer(name)`.
5849
+ * @param name the virtual import to match
5850
+ * @returns a global regex
5851
+ */
5852
+ const stencilVirtualImportRe = (name) => new RegExp(`@import(?:\\s+|(?=['"]|url\\())(?:url\\(\\s*)?(['"]?)${name}(?![\\w-])\\1\\s*\\)?([^;]*);?`, "g");
5853
+ stencilVirtualImportRe("stencil-component-globals");
5854
+ stencilVirtualImportRe("stencil-hydrate");
5855
+ stencilVirtualImportRe("stencil-css-components");
5845
5856
  new RegExp(`^(${[.../* @__PURE__ */ new Set([
5846
5857
  "child_process",
5847
5858
  "cluster",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core",
3
- "version": "5.0.0-beta.12",
3
+ "version": "5.0.0-beta.13",
4
4
  "description": "A Compiler for Web Components and Progressive Web Apps",
5
5
  "keywords": [
6
6
  "components",
@@ -117,6 +117,7 @@
117
117
  "magic-string": "^0.30.21",
118
118
  "picomatch": "^4.0.5",
119
119
  "postcss": "^8.5.26",
120
+ "postcss-nesting": "^14.0.1",
120
121
  "postcss-safe-parser": "^7.0.1",
121
122
  "postcss-selector-parser": "^7.1.5",
122
123
  "resolve": "^1.22.12",
@@ -125,9 +126,9 @@
125
126
  "terser": "^5.50.0",
126
127
  "tinyglobby": "^0.2.17",
127
128
  "typescript": ">5.0.0 <7.0.0",
128
- "@stencil/cli": "5.0.0-beta.12",
129
- "@stencil/dev-server": "5.0.0-beta.12",
130
- "@stencil/mock-doc": "5.0.0-beta.12"
129
+ "@stencil/cli": "5.0.0-beta.13",
130
+ "@stencil/dev-server": "5.0.0-beta.13",
131
+ "@stencil/mock-doc": "5.0.0-beta.13"
131
132
  },
132
133
  "devDependencies": {
133
134
  "@ionic/prettier-config": "^4.0.0",