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

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.14";
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 {
@@ -4392,7 +4393,7 @@ const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector)
4392
4393
  else return shallowPart.trim();
4393
4394
  }).join(", ");
4394
4395
  };
4395
- const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer");
4396
+ const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer") || selector.startsWith("@container");
4396
4397
  const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
4397
4398
  return processRules(cssText, (rule) => {
4398
4399
  let selector = rule.selector;
@@ -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)) {
@@ -5023,9 +5024,16 @@ const connectedCallback = (elm) => {
5023
5024
  }
5024
5025
  if (BUILD.asyncLoading) {
5025
5026
  let ancestorComponent = elm;
5026
- while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) if (BUILD.hydrateClientSide && ancestorComponent.nodeType === NODE_TYPE.ElementNode && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
5027
- attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
5028
- break;
5027
+ while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
5028
+ if (BUILD.hydrateClientSide && !ancestorComponent["s-p"] && ancestorComponent.nodeType === NODE_TYPE.ElementNode && ancestorComponent.hasAttribute("s-id")) {
5029
+ ancestorComponent["s-p"] = [];
5030
+ ancestorComponent["s-rc"] = [];
5031
+ ancestorComponent["s-pc"] = [];
5032
+ }
5033
+ if (ancestorComponent["s-p"]) {
5034
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
5035
+ break;
5036
+ }
5029
5037
  }
5030
5038
  }
5031
5039
  if (BUILD.prop && !BUILD.hydrateServerSide && cmpMeta.$members$) Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
@@ -5141,48 +5149,45 @@ const hmrStandalone = async (hostElement, cmpMeta, hmrVersionId) => {
5141
5149
  `${modulePath}?s-hmr=${hmrVersionId}`
5142
5150
  );
5143
5151
  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
- });
5152
+ if (NewClass) hmrApplyClass(cmpMeta, NewClass);
5182
5153
  } catch (e) {
5183
5154
  console.error(`[Stencil HMR] Failed to reload <${cmpMeta.$tagName$}>`, e);
5184
5155
  }
5185
5156
  };
5157
+ /**
5158
+ * Patch a re-executed component class onto the registered one and re-render every live instance.
5159
+ * Shared by the standalone re-import above and bundlers that re-execute the module themselves
5160
+ * (webpack/rspack `module.hot`), which reach it via the constructor's `s-hmr-apply` hook.
5161
+ *
5162
+ * @param cmpMeta runtime metadata for the component
5163
+ * @param NewClass the component's newly executed class
5164
+ */
5165
+ const hmrApplyClass = (cmpMeta, NewClass) => {
5166
+ const ctor = customElements.get(cmpMeta.$tagName$);
5167
+ const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
5168
+ if (ctor && ctor !== NewClass) {
5169
+ for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
5170
+ if (key === "constructor") continue;
5171
+ Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
5172
+ }
5173
+ const styleDesc = Object.getOwnPropertyDescriptor(NewClass, "style");
5174
+ if (styleDesc) {
5175
+ Object.defineProperty(ctor, "style", styleDesc);
5176
+ const newStyle = NewClass.style;
5177
+ if (newStyle) registerStyle(getScopeId(cmpMeta), newStyle, isShadow);
5178
+ }
5179
+ }
5180
+ document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => {
5181
+ const hostRef = getHostRef(el);
5182
+ if (BUILD.hostListener && hostRef?.$rmListeners$) {
5183
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
5184
+ hostRef.$rmListeners$ = void 0;
5185
+ addHostEventListeners(el, hostRef, cmpMeta.$listeners$);
5186
+ }
5187
+ if (!isShadow && hostRef) attachStyles(hostRef);
5188
+ forceUpdate(el);
5189
+ });
5190
+ };
5186
5191
  //#endregion
5187
5192
  //#region src/runtime/bootstrap-loader.ts
5188
5193
  const bootstrapLazy = (lazyBundles, options = {}) => {
@@ -5600,8 +5605,8 @@ const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, in
5600
5605
  //#endregion
5601
5606
  //#region src/testing/platform/index.ts
5602
5607
  const setMode = (handler) => {
5603
- modeResolutionChain.length = 0;
5604
- modeResolutionChain.push(handler);
5608
+ modeResolver.length = 0;
5609
+ modeResolver.push(handler);
5605
5610
  };
5606
5611
  const needsScopedSSR = () => scopedSSR;
5607
5612
  let scopedSSR = false;
@@ -5680,79 +5685,6 @@ const buildEvents = () => {
5680
5685
  };
5681
5686
  };
5682
5687
  //#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
5688
  //#region src/compiler/sys/resolve/resolve-utils.ts
5757
5689
  const getModuleId = (orgImport) => {
5758
5690
  if (orgImport.startsWith("~")) orgImport = orgImport.substring(1);
@@ -5842,6 +5774,92 @@ const createCustomResolverAsync = (sys, inMemoryFs, exts) => {
5842
5774
  extensions: exts
5843
5775
  };
5844
5776
  };
5777
+ //#endregion
5778
+ //#region src/compiler/app-core/app-data.ts
5779
+ /**
5780
+ * Generate a {@link BuildFeatures} entity, based on the provided component metadata
5781
+ * @param cmps a collection of component compiler metadata, used to set values on the generated build features object
5782
+ * @returns the generated build features entity
5783
+ */
5784
+ const getBuildFeatures = (cmps) => {
5785
+ const slot = cmps.some((c) => c.htmlTagNames.includes("slot"));
5786
+ const shadowDom = cmps.some((c) => c.encapsulation === "shadow");
5787
+ const slotRelocation = cmps.some((c) => c.encapsulation !== "shadow" && c.htmlTagNames.includes("slot"));
5788
+ const f = {
5789
+ allRenderFn: cmps.every((c) => c.hasRenderFn),
5790
+ formAssociated: cmps.some((c) => c.formAssociated),
5791
+ deserializer: cmps.some((c) => c.hasDeserializer),
5792
+ element: cmps.some((c) => c.hasElement),
5793
+ event: cmps.some((c) => c.hasEvent),
5794
+ hasRenderFn: cmps.some((c) => c.hasRenderFn),
5795
+ lifecycle: cmps.some((c) => c.hasLifecycle),
5796
+ asyncLoading: true,
5797
+ hostListener: cmps.some((c) => c.hasListener),
5798
+ hostListenerTargetWindow: cmps.some((c) => c.hasListenerTargetWindow),
5799
+ hostListenerTargetDocument: cmps.some((c) => c.hasListenerTargetDocument),
5800
+ hostListenerTargetBody: cmps.some((c) => c.hasListenerTargetBody),
5801
+ hostListenerTarget: cmps.some((c) => c.hasListenerTarget),
5802
+ member: cmps.some((c) => c.hasMember),
5803
+ method: cmps.some((c) => c.hasMethod),
5804
+ mode: cmps.some((c) => c.hasMode),
5805
+ observeAttribute: cmps.some((c) => c.hasAttribute || c.hasWatchCallback || c.hasDeserializer),
5806
+ prop: cmps.some((c) => c.hasProp),
5807
+ propBoolean: cmps.some((c) => c.hasPropBoolean),
5808
+ propChangeCallback: cmps.some((c) => c.hasWatchCallback || c.hasDeserializer || c.hasSerializer),
5809
+ propNumber: cmps.some((c) => c.hasPropNumber),
5810
+ propString: cmps.some((c) => c.hasPropString),
5811
+ propMutable: cmps.some((c) => c.hasPropMutable),
5812
+ reflect: cmps.some((c) => c.hasReflect || c.hasSerializer),
5813
+ scoped: cmps.some((c) => c.encapsulation === "scoped"),
5814
+ serializer: cmps.some((c) => c.hasSerializer),
5815
+ shadowDom,
5816
+ shadowDelegatesFocus: shadowDom && cmps.some((c) => c.shadowDelegatesFocus),
5817
+ shadowModeClosed: shadowDom && cmps.some((c) => c.shadowMode === "closed"),
5818
+ shadowSlotAssignmentManual: shadowDom && cmps.some((c) => c.slotAssignment === "manual"),
5819
+ shadowClonable: shadowDom && cmps.some((c) => c.shadowClonable),
5820
+ shadowSerializable: shadowDom && cmps.some((c) => c.shadowSerializable),
5821
+ slot,
5822
+ slotRelocation,
5823
+ state: cmps.some((c) => c.hasState),
5824
+ style: cmps.some((c) => c.hasStyle),
5825
+ svg: cmps.some((c) => c.htmlTagNames.includes("svg")),
5826
+ updatable: cmps.some((c) => c.isUpdateable),
5827
+ vdomAttribute: cmps.some((c) => c.hasVdomAttribute),
5828
+ vdomXlink: cmps.some((c) => c.hasVdomXlink),
5829
+ vdomClass: cmps.some((c) => c.hasVdomClass),
5830
+ vdomFunctional: cmps.some((c) => c.hasVdomFunctional),
5831
+ vdomKey: cmps.some((c) => c.hasVdomKey),
5832
+ vdomListener: cmps.some((c) => c.hasVdomListener),
5833
+ vdomPropOrAttr: cmps.some((c) => c.hasVdomPropOrAttr),
5834
+ vdomPropOrAttrPrefix: cmps.some((c) => c.hasVdomPropOrAttrPrefix),
5835
+ vdomRef: cmps.some((c) => c.hasVdomRef),
5836
+ vdomRender: cmps.some((c) => c.hasVdomRender),
5837
+ vdomStyle: cmps.some((c) => c.hasVdomStyle),
5838
+ vdomText: cmps.some((c) => c.hasVdomText),
5839
+ vdomSignals: cmps.some((c) => c.hasSignalsImport),
5840
+ taskQueue: true,
5841
+ patchAll: cmps.some((c) => c.hasPatchAll),
5842
+ patchChildren: cmps.some((c) => c.hasPatchChildren),
5843
+ patchClone: cmps.some((c) => c.hasPatchClone),
5844
+ patchInsert: cmps.some((c) => c.hasPatchInsert)
5845
+ };
5846
+ f.vdomAttribute = f.vdomAttribute || f.reflect;
5847
+ f.vdomPropOrAttr = f.vdomPropOrAttr || f.reflect;
5848
+ return f;
5849
+ };
5850
+ //#endregion
5851
+ //#region src/compiler/style/component-global-styles.ts
5852
+ /**
5853
+ * Match `@import` of a `stencil-*` virtual import in any form CSS allows or a preprocessor emits:
5854
+ * quoted or not, bare or `url()`-wrapped, and with or without whitespace after `@import` (Sass's
5855
+ * compressed output drops it). Capture group 2 holds any trailing modifiers, e.g. `layer(name)`.
5856
+ * @param name the virtual import to match
5857
+ * @returns a global regex
5858
+ */
5859
+ const stencilVirtualImportRe = (name) => new RegExp(`@import(?:\\s+|(?=['"]|url\\())(?:url\\(\\s*)?(['"]?)${name}(?![\\w-])\\1\\s*\\)?([^;]*);?`, "g");
5860
+ stencilVirtualImportRe("stencil-component-globals");
5861
+ stencilVirtualImportRe("stencil-hydrate");
5862
+ stencilVirtualImportRe("stencil-css-components");
5845
5863
  new RegExp(`^(${[.../* @__PURE__ */ new Set([
5846
5864
  "child_process",
5847
5865
  "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.14",
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.14",
130
+ "@stencil/dev-server": "5.0.0-beta.14",
131
+ "@stencil/mock-doc": "5.0.0-beta.14"
131
132
  },
132
133
  "devDependencies": {
133
134
  "@ionic/prettier-config": "^4.0.0",