@stencil/core 5.0.0-beta.0 → 5.0.0-beta.10

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.
@@ -1650,6 +1650,12 @@ interface TransformCssToEsmOutput {
1650
1650
  varName: string;
1651
1651
  importPath: string;
1652
1652
  }[];
1653
+ /**
1654
+ * Whether `output` itself has an observable side effect (a plain, untagged CSS file's
1655
+ * generated module self-injects CSSStyleSheets; a Stencil component's tagged `styleUrl`
1656
+ * output doesn't)
1657
+ */
1658
+ moduleSideEffects?: boolean;
1653
1659
  }
1654
1660
  interface PackageJsonData {
1655
1661
  name?: string;
@@ -1791,7 +1797,8 @@ interface StencilConfig {
1791
1797
  * Will generate {@link https://nodejs.org/api/packages.html#packages_exports export map} entry points
1792
1798
  * for each component in the build when `true`.
1793
1799
  *
1794
- * @default false
1800
+ * Defaults to `true` for "no-config" projects (no `stencil.config.ts`/`.js` file), and `false`
1801
+ * whenever a config file is present - set this explicitly to opt an existing project in or out.
1795
1802
  */
1796
1803
  generateExportMaps?: boolean;
1797
1804
  /**
@@ -1845,10 +1852,19 @@ interface StencilConfig {
1845
1852
  */
1846
1853
  rolldownConfig?: RolldownConfig;
1847
1854
  /**
1848
- * Sets if the JS browser files are minified or not. Stencil uses `terser` under the hood.
1855
+ * Sets if the JS browser files are minified or not.
1849
1856
  * Defaults to `false` in dev mode and `true` in production mode.
1850
1857
  */
1851
1858
  minifyJs?: boolean;
1859
+ /**
1860
+ * Which minifier to use for JS output when `minifyJs` is enabled.
1861
+ *
1862
+ * - `oxc`: built into rolldown. Much faster than terser. Output may be slightly larger.
1863
+ * - `terser`: slower, but currently produces the smallest output.
1864
+ *
1865
+ * Defaults to `oxc`.
1866
+ */
1867
+ jsMinifier?: 'terser' | 'oxc';
1852
1868
  /**
1853
1869
  * Sets if the CSS is minified or not.
1854
1870
  * Defaults to `false` in dev mode and `true` in production mode.
@@ -2194,7 +2210,7 @@ type RequireFields<T, K extends keyof T> = T & { [P in K]-?: T[P]; };
2194
2210
  /**
2195
2211
  * Fields in {@link Config} to make required for {@link ValidatedConfig}
2196
2212
  */
2197
- type StrictConfigFields = keyof Pick<Config, 'cacheDir' | 'devServer' | 'compat' | 'fsNamespace' | 'hydratedFlag' | 'logLevel' | 'logger' | 'minifyCss' | 'minifyJs' | 'namespace' | 'outputTargets' | 'packageJsonFilePath' | 'rolldownConfig' | 'rootDir' | 'srcDir' | 'srcIndexHtml' | 'sys' | 'transformAliasedImportPaths'>;
2213
+ type StrictConfigFields = keyof Pick<Config, 'cacheDir' | 'devServer' | 'compat' | 'fsNamespace' | 'hydratedFlag' | 'jsMinifier' | 'logLevel' | 'logger' | 'minifyCss' | 'minifyJs' | 'namespace' | 'outputTargets' | 'packageJsonFilePath' | 'rolldownConfig' | 'rootDir' | 'srcDir' | 'srcIndexHtml' | 'sys' | 'transformAliasedImportPaths'>;
2198
2214
  /**
2199
2215
  * A version of {@link Config} that makes certain fields required. This type represents a valid configuration entity.
2200
2216
  * When a configuration is received by the user, it is a bag of unverified data. In order to make stricter guarantees
@@ -4457,7 +4473,7 @@ type BuildOverrideKeys = 'hotModuleReplacement' | 'signalBacking' | 'vdomSignals
4457
4473
  * and types stay in sync with the authoritative definition.
4458
4474
  */
4459
4475
  type BuildOverrides = Pick<BuildConditionals, BuildOverrideKeys>;
4460
- type CompileTarget = 'latest' | 'esnext' | 'es2020' | 'es2019' | 'es2018' | 'es2017' | 'es2015' | string | undefined;
4476
+ type CompileTarget = 'latest' | 'esnext' | 'es2022' | 'es2020' | 'es2019' | 'es2018' | 'es2017' | string | undefined;
4461
4477
  interface TranspileResults {
4462
4478
  code: string;
4463
4479
  data?: any[];
@@ -463,7 +463,7 @@ declare function getAssetPath(path: string): string;
463
463
  * @param vnode - The virtual DOM tree to render
464
464
  * @param container - The container element to render the virtual DOM tree to
465
465
  */
466
- declare function render(vnode: VNode, container: Element): void;
466
+ declare function render(vnode: VNode, container: globalThis.Element): void;
467
467
  /**
468
468
  * Used to manually set the base path where assets can be found. For lazy-loaded
469
469
  * builds the asset path is automatically set and assets copied to the correct
@@ -567,6 +567,22 @@ declare function setTagTransformer(transformer: TagTransformer): void;
567
567
  * @returns the transformed tag e.g. `new-my-tag`
568
568
  */
569
569
  declare function transformTag(tag: string): string;
570
+ /**
571
+ * Registers a root - a shadowRoot, or `document` - to receive every plain CSS import
572
+ * (e.g. a dependency's own `import './foo.css'`) applied as a side effect.
573
+ * Call once per component instance that needs it, e.g. in `connectedCallback`.
574
+ * Pair with {@link unregisterSideEffectStyleTarget} in `disconnectedCallback`.
575
+ *
576
+ * @param root the root to register
577
+ */
578
+ declare function registerSideEffectStyleTarget(root: DocumentOrShadowRoot): void;
579
+ /**
580
+ * Removes a root registered via {@link registerSideEffectStyleTarget} - call in
581
+ * `disconnectedCallback`.
582
+ *
583
+ * @param root the root to unregister
584
+ */
585
+ declare function unregisterSideEffectStyleTarget(root: DocumentOrShadowRoot): void;
570
586
  type MixinFactory = (base: MixedInCtor) => MixedInCtor;
571
587
  /**
572
588
  * A constructor type that can be used as the base for mixin factories.
@@ -1169,7 +1185,7 @@ declare namespace JSXBase {
1169
1185
  type?: string;
1170
1186
  value?: string | string[] | number;
1171
1187
  popoverTargetAction?: string;
1172
- popoverTargetElement?: Element | null;
1188
+ popoverTargetElement?: globalThis.Element | null;
1173
1189
  popoverTarget?: string;
1174
1190
  command?: string;
1175
1191
  commandFor?: string;
@@ -1341,7 +1357,7 @@ declare namespace JSXBase {
1341
1357
  webkitEntries?: any;
1342
1358
  width?: number | string;
1343
1359
  popoverTargetAction?: string;
1344
- popoverTargetElement?: Element | null;
1360
+ popoverTargetElement?: globalThis.Element | null;
1345
1361
  popoverTarget?: string;
1346
1362
  }
1347
1363
  interface KeygenHTMLAttributes<T> extends HTMLAttributes<T> {
@@ -2047,7 +2063,7 @@ declare namespace JSXBase {
2047
2063
  [key: `aria${string}`]: string | boolean | undefined;
2048
2064
  }
2049
2065
  }
2050
- interface JSXAttributes<T = Element> {
2066
+ interface JSXAttributes<T = globalThis.Element> {
2051
2067
  key?: string | number;
2052
2068
  ref?: (elm?: T) => void;
2053
2069
  children?: any;
@@ -2064,4 +2080,4 @@ interface CustomElementsDefineOptions {
2064
2080
  ce?: (eventName: string, opts?: any) => CustomEvent;
2065
2081
  }
2066
2082
  //#endregion
2067
- export { AttachInternals, AttachInternalsDecorator, AttachInternalsOptions, AttrDeserialize, AttrDeserializeDecorator, Build, ChildNode, Component, ComponentDecorator, ComponentDidLoad, ComponentDidUpdate, ComponentInterface, ComponentOptions, ComponentShouldUpdateChanges, ComponentWillLoad, ComponentWillUpdate, CustomElementsDefineOptions, Element, ElementDecorator, EncapsulationOptions, Env, ErrorHandler, Event, EventDecorator, EventEmitter, EventOptions, Fragment, FunctionalComponent, FunctionalUtilities, HTMLStencilElement, Host, HostAttributes, LocalJSX as JSX, JSXAttributes, JSXBase, Listen, ListenDecorator, ListenOptions, ListenTargetOptions, Method, MethodDecorator, MethodOptions, MixedInCtor, Mixin, ModeStyles, NoneEncapsulation, Prop, PropDecorator, PropOptions, PropSerialize, PropSerializeDecorator, QueueApi, RafCallback, ReactiveController, ReactiveControllerHost, ReactiveControllerHostInterface, ResolutionHandler, ResolveVarFunction, ScopedEncapsulation, ShadowEncapsulation, ShadowRootOptions, SignalRef, SlotPatch, State, StateDecorator, TagTransformer, UserBuildConditionals, VNode, VNodeData, Watch, WatchDecorator, forceUpdate, getAssetPath, getElement, getMode, getRenderingRef, getShadowRoot, h, jsx, jsxs, readTask, render, resolveVar, setAssetPath, setErrorHandler, setMode, setNonce, setPlatformHelpers, setTagTransformer, transformTag, writeTask };
2083
+ export { AttachInternals, AttachInternalsDecorator, AttachInternalsOptions, AttrDeserialize, AttrDeserializeDecorator, Build, ChildNode, Component, ComponentDecorator, ComponentDidLoad, ComponentDidUpdate, ComponentInterface, ComponentOptions, ComponentShouldUpdateChanges, ComponentWillLoad, ComponentWillUpdate, CustomElementsDefineOptions, Element, ElementDecorator, EncapsulationOptions, Env, ErrorHandler, Event, EventDecorator, EventEmitter, EventOptions, Fragment, FunctionalComponent, FunctionalUtilities, HTMLStencilElement, Host, HostAttributes, LocalJSX as JSX, JSXAttributes, JSXBase, Listen, ListenDecorator, ListenOptions, ListenTargetOptions, Method, MethodDecorator, MethodOptions, MixedInCtor, Mixin, ModeStyles, NoneEncapsulation, Prop, PropDecorator, PropOptions, PropSerialize, PropSerializeDecorator, QueueApi, RafCallback, ReactiveController, ReactiveControllerHost, ReactiveControllerHostInterface, ResolutionHandler, ResolveVarFunction, ScopedEncapsulation, ShadowEncapsulation, ShadowRootOptions, SignalRef, SlotPatch, State, StateDecorator, TagTransformer, UserBuildConditionals, VNode, VNodeData, Watch, WatchDecorator, forceUpdate, getAssetPath, getElement, getMode, getRenderingRef, getShadowRoot, h, jsx, jsxs, readTask, registerSideEffectStyleTarget, render, resolveVar, setAssetPath, setErrorHandler, setMode, setNonce, setPlatformHelpers, setTagTransformer, transformTag, unregisterSideEffectStyleTarget, writeTask };
@@ -1,4 +1,4 @@
1
- import { Gn as FunctionalComponent, Qn as VNode, Wn as ErrorHandler, Xn as TagTransformer, Yn as ResolutionHandler, Zn as UserBuildConditionals, a as HostElement, l as PropsType, qn as RafCallback, t as ChildType, u as RuntimeRef } from "./index-RrQfiPWK.mjs";
1
+ import { Gn as FunctionalComponent, Qn as VNode, Wn as ErrorHandler, Xn as TagTransformer, Yn as ResolutionHandler, Zn as UserBuildConditionals, a as HostElement, l as PropsType, qn as RafCallback, t as ChildType, u as RuntimeRef } from "./index-BvF31nqP.mjs";
2
2
  //#region src/client/client-build.d.ts
3
3
  declare const Build: UserBuildConditionals;
4
4
  //#endregion
@@ -1,9 +1,6 @@
1
1
  import "rolldown";
2
2
  import "typescript";
3
3
  //#region src/declarations/stencil-public-runtime.d.ts
4
- interface ElementDecorator {
5
- (): PropertyDecorator;
6
- }
7
4
  interface EventDecorator {
8
5
  (opts?: EventOptions): PropertyDecorator;
9
6
  }
@@ -25,11 +22,6 @@ interface EventOptions {
25
22
  */
26
23
  composed?: boolean;
27
24
  }
28
- /**
29
- * The `@Element()` decorator is a reference to the actual host element
30
- * once it has rendered.
31
- */
32
- declare const Element$1: ElementDecorator;
33
25
  /**
34
26
  * Components can emit data and events using the Event Emitter decorator.
35
27
  * To dispatch Custom DOM events for other components to handle, use the
@@ -460,7 +452,7 @@ declare namespace JSXBase {
460
452
  type?: string;
461
453
  value?: string | string[] | number;
462
454
  popoverTargetAction?: string;
463
- popoverTargetElement?: Element$1 | null;
455
+ popoverTargetElement?: globalThis.Element | null;
464
456
  popoverTarget?: string;
465
457
  command?: string;
466
458
  commandFor?: string;
@@ -632,7 +624,7 @@ declare namespace JSXBase {
632
624
  webkitEntries?: any;
633
625
  width?: number | string;
634
626
  popoverTargetAction?: string;
635
- popoverTargetElement?: Element$1 | null;
627
+ popoverTargetElement?: globalThis.Element | null;
636
628
  popoverTarget?: string;
637
629
  }
638
630
  interface KeygenHTMLAttributes<T> extends HTMLAttributes<T> {
@@ -1338,7 +1330,7 @@ declare namespace JSXBase {
1338
1330
  [key: `aria${string}`]: string | boolean | undefined;
1339
1331
  }
1340
1332
  }
1341
- interface JSXAttributes<T = Element$1> {
1333
+ interface JSXAttributes<T = globalThis.Element> {
1342
1334
  key?: string | number;
1343
1335
  ref?: (elm?: T) => void;
1344
1336
  children?: any;
@@ -1784,7 +1784,8 @@ interface StencilConfig {
1784
1784
  * Will generate {@link https://nodejs.org/api/packages.html#packages_exports export map} entry points
1785
1785
  * for each component in the build when `true`.
1786
1786
  *
1787
- * @default false
1787
+ * Defaults to `true` for "no-config" projects (no `stencil.config.ts`/`.js` file), and `false`
1788
+ * whenever a config file is present - set this explicitly to opt an existing project in or out.
1788
1789
  */
1789
1790
  generateExportMaps?: boolean;
1790
1791
  /**
@@ -1838,10 +1839,19 @@ interface StencilConfig {
1838
1839
  */
1839
1840
  rolldownConfig?: RolldownConfig;
1840
1841
  /**
1841
- * Sets if the JS browser files are minified or not. Stencil uses `terser` under the hood.
1842
+ * Sets if the JS browser files are minified or not.
1842
1843
  * Defaults to `false` in dev mode and `true` in production mode.
1843
1844
  */
1844
1845
  minifyJs?: boolean;
1846
+ /**
1847
+ * Which minifier to use for JS output when `minifyJs` is enabled.
1848
+ *
1849
+ * - `oxc`: built into rolldown. Much faster than terser. Output may be slightly larger.
1850
+ * - `terser`: slower, but currently produces the smallest output.
1851
+ *
1852
+ * Defaults to `oxc`.
1853
+ */
1854
+ jsMinifier?: 'terser' | 'oxc';
1845
1855
  /**
1846
1856
  * Sets if the CSS is minified or not.
1847
1857
  * Defaults to `false` in dev mode and `true` in production mode.
@@ -2187,7 +2197,7 @@ type RequireFields<T, K extends keyof T> = T & { [P in K]-?: T[P]; };
2187
2197
  /**
2188
2198
  * Fields in {@link Config} to make required for {@link ValidatedConfig}
2189
2199
  */
2190
- type StrictConfigFields = keyof Pick<Config, 'cacheDir' | 'devServer' | 'compat' | 'fsNamespace' | 'hydratedFlag' | 'logLevel' | 'logger' | 'minifyCss' | 'minifyJs' | 'namespace' | 'outputTargets' | 'packageJsonFilePath' | 'rolldownConfig' | 'rootDir' | 'srcDir' | 'srcIndexHtml' | 'sys' | 'transformAliasedImportPaths'>;
2200
+ type StrictConfigFields = keyof Pick<Config, 'cacheDir' | 'devServer' | 'compat' | 'fsNamespace' | 'hydratedFlag' | 'jsMinifier' | 'logLevel' | 'logger' | 'minifyCss' | 'minifyJs' | 'namespace' | 'outputTargets' | 'packageJsonFilePath' | 'rolldownConfig' | 'rootDir' | 'srcDir' | 'srcIndexHtml' | 'sys' | 'transformAliasedImportPaths'>;
2191
2201
  /**
2192
2202
  * A version of {@link Config} that makes certain fields required. This type represents a valid configuration entity.
2193
2203
  * When a configuration is received by the user, it is a bag of unverified data. In order to make stricter guarantees
@@ -4450,7 +4460,7 @@ type BuildOverrideKeys = 'hotModuleReplacement' | 'signalBacking' | 'vdomSignals
4450
4460
  * and types stay in sync with the authoritative definition.
4451
4461
  */
4452
4462
  type BuildOverrides = Pick<BuildConditionals, BuildOverrideKeys>;
4453
- type CompileTarget = 'latest' | 'esnext' | 'es2020' | 'es2019' | 'es2018' | 'es2017' | 'es2015' | string | undefined;
4463
+ type CompileTarget = 'latest' | 'esnext' | 'es2022' | 'es2020' | 'es2019' | 'es2018' | 'es2017' | string | undefined;
4454
4464
  interface TranspileResults {
4455
4465
  code: string;
4456
4466
  data?: any[];
@@ -6062,6 +6072,12 @@ interface TransformCssToEsmOutput {
6062
6072
  varName: string;
6063
6073
  importPath: string;
6064
6074
  }[];
6075
+ /**
6076
+ * Whether `output` itself has an observable side effect (a plain, untagged CSS file's
6077
+ * generated module self-injects CSSStyleSheets; a Stencil component's tagged `styleUrl`
6078
+ * output doesn't)
6079
+ */
6080
+ moduleSideEffects?: boolean;
6065
6081
  }
6066
6082
  interface PackageJsonData {
6067
6083
  name?: string;
package/dist/index.d.mts CHANGED
@@ -57,6 +57,7 @@ export {
57
57
  Prop,
58
58
  readTask,
59
59
  ReactiveControllerHost,
60
+ registerSideEffectStyleTarget,
60
61
  render,
61
62
  resolveVar,
62
63
  setAssetPath,
@@ -67,6 +68,7 @@ export {
67
68
  setTagTransformer,
68
69
  State,
69
70
  transformTag,
71
+ unregisterSideEffectStyleTarget,
70
72
  Watch,
71
73
  writeTask,
72
74
  } from './declarations/stencil-public-runtime';
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { C as setErrorHandler, _ as getAssetPath, a as transformTag, b as writeTask, c as Mixin, d as Host, f as h, g as getShadowRoot, h as getElement, i as setTagTransformer, l as getMode, m as getRenderingRef, o as render, p as forceUpdate, s as ReactiveControllerHost, u as setMode, v as setAssetPath, w as Build, x as setPlatformHelpers, y as readTask } from "./client-BRu0GtRn.mjs";
1
+ import { C as setErrorHandler, _ as getAssetPath, a as transformTag, b as writeTask, c as Mixin, d as Host, f as h, g as getShadowRoot, h as getElement, i as setTagTransformer, l as getMode, m as getRenderingRef, o as render, p as forceUpdate, s as ReactiveControllerHost, u as setMode, v as setAssetPath, w as Build, x as setPlatformHelpers, y as readTask } from "./client-Db2rdxUM.mjs";
2
2
  import { t as Fragment } from "./fragment-Di1hWOC8.mjs";
3
3
  //#region src/client/client-decorators.ts
4
4
  /**
@@ -88,4 +88,84 @@ const AttrDeserialize = (_propName) => () => {};
88
88
  */
89
89
  const resolveVar = (variable) => String(variable);
90
90
  //#endregion
91
- export { AttachInternals, AttrDeserialize, Build, Component, Element, Event, Fragment, Host, Listen, Method, Mixin, Prop, PropSerialize, ReactiveControllerHost, State, Watch, forceUpdate, getAssetPath, getElement, getMode, getRenderingRef, getShadowRoot, h, readTask, render, resolveVar, setAssetPath, setErrorHandler, setMode, setPlatformHelpers, setTagTransformer, transformTag, writeTask };
91
+ //#region src/runtime/inject-side-effect-style.ts
92
+ const styleSheets = /* @__PURE__ */ new Map();
93
+ const knownRoots = /* @__PURE__ */ new Set();
94
+ const adoptedRoots = /* @__PURE__ */ new WeakMap();
95
+ const knownFontFaces = /* @__PURE__ */ new Set();
96
+ const adopt = (root, sheet) => {
97
+ let roots = adoptedRoots.get(sheet);
98
+ if (!roots) {
99
+ roots = /* @__PURE__ */ new WeakSet();
100
+ adoptedRoots.set(sheet, roots);
101
+ }
102
+ if (!roots.has(root)) {
103
+ roots.add(root);
104
+ root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
105
+ }
106
+ };
107
+ /**
108
+ * Registers a root (a shadow root, or `document`) to receive every side-effect CSS import
109
+ * (a plain, non-component `import './foo.css'`), now and in future. Call in `connectedCallback`,
110
+ * paired with `unregisterSideEffectStyleTarget` in `disconnectedCallback` so the registry doesn't
111
+ * hold disconnected roots forever.
112
+ * @param root the root to register
113
+ */
114
+ function registerSideEffectStyleTarget(root) {
115
+ knownRoots.add(root);
116
+ for (const sheet of styleSheets.values()) adopt(root, sheet);
117
+ }
118
+ /**
119
+ * Removes a root registered via `registerSideEffectStyleTarget` - call in `disconnectedCallback`.
120
+ * @param root the root to unregister
121
+ */
122
+ function unregisterSideEffectStyleTarget(root) {
123
+ knownRoots.delete(root);
124
+ }
125
+ const FONT_FACE_RE = /@font-face\s*\{[^{}]*\}/g;
126
+ /**
127
+ * Splits `@font-face` rules out of a CSS text - exported standalone (from private
128
+ * module state - usually 3rd party node_modules) exported for testing
129
+ * @param cssText the CSS text to split
130
+ * @returns the font-face rules joined together (`null` if there were none) and the remaining CSS
131
+ */
132
+ function splitFontFaces(cssText) {
133
+ const fontFaces = cssText.match(FONT_FACE_RE);
134
+ if (!fontFaces) return {
135
+ fontFaceText: null,
136
+ rest: cssText
137
+ };
138
+ return {
139
+ fontFaceText: fontFaces.join("\n"),
140
+ rest: cssText.replace(FONT_FACE_RE, "")
141
+ };
142
+ }
143
+ /**
144
+ * Applies plain (non-component) CSS text to every registered root - respects shadow DOM
145
+ * encapsulation instead of always reaching for the top-level document. Not meant to be called
146
+ * directly: this is what the compiler's CSS-to-ESM output calls for CSS with no Stencil `tag`
147
+ * (i.e. not a component's own `styleUrl`), typically a third-party dependency's CSS import.
148
+ *
149
+ * `@font-face` rules are pulled out and adopted onto top-level `document` not per-root
150
+ * (Chromium (https://issues.chromium.org/issues/41085401) per-root never loads).
151
+ * @param cssText the CSS text to apply
152
+ */
153
+ function injectSideEffectStyle(cssText) {
154
+ const { fontFaceText, rest } = splitFontFaces(cssText);
155
+ if (fontFaceText && !knownFontFaces.has(fontFaceText)) {
156
+ knownFontFaces.add(fontFaceText);
157
+ const fontFaceSheet = new CSSStyleSheet();
158
+ fontFaceSheet.replaceSync(fontFaceText);
159
+ document.adoptedStyleSheets = [...document.adoptedStyleSheets, fontFaceSheet];
160
+ }
161
+ if (!rest.trim()) return;
162
+ let sheet = styleSheets.get(rest);
163
+ if (!sheet) {
164
+ sheet = new CSSStyleSheet();
165
+ sheet.replaceSync(rest);
166
+ styleSheets.set(rest, sheet);
167
+ }
168
+ for (const root of knownRoots) adopt(root, sheet);
169
+ }
170
+ //#endregion
171
+ export { AttachInternals, AttrDeserialize, Build, Component, Element, Event, Fragment, Host, Listen, Method, Mixin, Prop, PropSerialize, ReactiveControllerHost, State, Watch, forceUpdate, getAssetPath, getElement, getMode, getRenderingRef, getShadowRoot, h, injectSideEffectStyle, readTask, registerSideEffectStyleTarget, render, resolveVar, setAssetPath, setErrorHandler, setMode, setPlatformHelpers, setTagTransformer, transformTag, unregisterSideEffectStyleTarget, writeTask };
@@ -1,3 +1,3 @@
1
- import { n as jsxDEV, r as jsxs, t as jsx } from "./client-BRu0GtRn.mjs";
1
+ import { n as jsxDEV, r as jsxs, t as jsx } from "./client-Db2rdxUM.mjs";
2
2
  import { t as Fragment } from "./fragment-Di1hWOC8.mjs";
3
3
  export { Fragment, jsx, jsxDEV, jsxs };
@@ -1,5 +1,5 @@
1
1
  import { n as __require } from "./rolldown-runtime-BhDjJH2R.mjs";
2
- import "./client-BRu0GtRn.mjs";
2
+ import "./client-Db2rdxUM.mjs";
3
3
  import { c as isFunction, f as isString, m as noop, r as flatOne } from "./helpers-Cpp3qc3u.mjs";
4
4
  import { $ as catchError, K as normalizePath, X as buildError, Y as TASK_CANCELED_MSG, nt as shouldIgnoreError, rt as isGlob } from "./util-IKfWWLJo.mjs";
5
5
  import fs from "node:fs";
@@ -463,8 +463,6 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
463
463
  if (module) return module[exportName];
464
464
  const retryCount = failedLoadAttempts.get(bundleId) ?? 0;
465
465
  const cacheBustParams = [retryCount > 0 ? `s-retry=${retryCount}` : "", BUILD.hotModuleReplacement && hmrVersionId ? `s-hmr=${hmrVersionId}` : ""].filter(Boolean).join("&");
466
- /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
467
- const entryFile = `${bundleId}.entry.js${cacheBustParams ? "?" + cacheBustParams : ""}`;
468
466
  const onLoad = (importedModule) => {
469
467
  if (!BUILD.hotModuleReplacement) {
470
468
  failedLoadAttempts.delete(bundleId);
@@ -476,6 +474,8 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
476
474
  failedLoadAttempts.set(bundleId, retryCount + 1);
477
475
  consoleError(e, hostRef.$hostElement$);
478
476
  };
477
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
478
+ const entryFile = `${bundleId}.entry.js${cacheBustParams ? "?" + cacheBustParams : ""}`;
479
479
  if (lazyLoadBasePath) return import(
480
480
  /* @vite-ignore */
481
481
  /* webpackInclude: /\.entry\.js$/ */
@@ -1983,16 +1983,33 @@ const signalNodeDisposers = /* @__PURE__ */ new WeakMap();
1983
1983
  const disposeSignalVNode = (vnode) => {
1984
1984
  const elm = vnode.$elm$;
1985
1985
  if (elm) {
1986
- const dispose = signalNodeDisposers.get(elm);
1987
- if (dispose) {
1988
- dispose();
1989
- signalNodeDisposers.delete(elm);
1990
- }
1986
+ disposeTextSignal(elm);
1991
1987
  disposeAllSignalAttrs(elm);
1992
1988
  }
1993
1989
  vnode.$children$?.forEach(disposeSignalVNode);
1994
1990
  };
1995
1991
  /**
1992
+ * Tear down a text node's signal subscription, if it has one.
1993
+ * @param textNode the text node to unsubscribe
1994
+ */
1995
+ const disposeTextSignal = (textNode) => {
1996
+ const dispose = signalNodeDisposers.get(textNode);
1997
+ if (dispose) {
1998
+ dispose();
1999
+ signalNodeDisposers.delete(textNode);
2000
+ }
2001
+ };
2002
+ /**
2003
+ * Subscribe a text node to a signal, keeping its `data` in sync on every change.
2004
+ * @param textNode the text node to keep in sync
2005
+ * @param textSig the signal to subscribe to
2006
+ */
2007
+ const wireTextSignal = (textNode, textSig) => {
2008
+ signalNodeDisposers.set(textNode, effect$1(() => {
2009
+ textNode.data = String(textSig.value);
2010
+ }));
2011
+ };
2012
+ /**
1996
2013
  * Create a DOM Node corresponding to one of the children of a given VNode.
1997
2014
  *
1998
2015
  * @param oldParentVNode the parent VNode from the previous render
@@ -2014,13 +2031,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex) => {
2014
2031
  if (BUILD.isDev && newVNode.$elm$) consoleDevError(`The JSX ${newVNode.$text$ !== null ? `"${newVNode.$text$}" text` : `"${String(newVNode.$tag$)}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`);
2015
2032
  if (BUILD.vdomText && newVNode.$text$ != null) {
2016
2033
  elm = newVNode.$elm$ = win.document.createTextNode(newVNode.$text$);
2017
- if (BUILD.vdomSignals && newVNode.$signal$) {
2018
- const textSig = newVNode.$signal$;
2019
- const textNode = elm;
2020
- signalNodeDisposers.set(textNode, effect$1(() => {
2021
- textNode.data = String(textSig.value);
2022
- }));
2023
- }
2034
+ if (BUILD.vdomSignals && newVNode.$signal$) wireTextSignal(elm, newVNode.$signal$);
2024
2035
  } else if (BUILD.slotRelocation && newVNode.$flags$ & VNODE_FLAGS.isSlotReference) {
2025
2036
  elm = newVNode.$elm$ = BUILD.isDebug || BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode) : win.document.createTextNode("");
2026
2037
  if (typeof newVNode.$attrs$?.slot === "string") elm["s-sa"] = newVNode.$attrs$.slot;
@@ -2381,7 +2392,17 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
2381
2392
  else if (BUILD.hydrateClientSide && isInitialRender && BUILD.updatable && oldChildren !== null && newChildren === null) newVNode.$children$ = oldChildren;
2382
2393
  if (BUILD.svg && isSvgMode && tag === "svg") isSvgMode = false;
2383
2394
  } else if (BUILD.vdomText && BUILD.slotRelocation && (defaultHolder = elm["s-cr"])) defaultHolder.parentNode.textContent = text;
2384
- else if (BUILD.vdomText && oldVNode.$text$ !== text) elm.data = text;
2395
+ else if (BUILD.vdomText) {
2396
+ if (BUILD.vdomSignals && newVNode.$signal$) {
2397
+ if (newVNode.$signal$ !== oldVNode.$signal$) {
2398
+ disposeTextSignal(elm);
2399
+ wireTextSignal(elm, newVNode.$signal$);
2400
+ }
2401
+ } else {
2402
+ if (BUILD.vdomSignals && oldVNode.$signal$) disposeTextSignal(elm);
2403
+ if (oldVNode.$text$ !== text) elm.data = text;
2404
+ }
2405
+ }
2385
2406
  };
2386
2407
  /**
2387
2408
  * Component-global information about nodes which are either currently being
@@ -3719,12 +3740,13 @@ const restoreSafeSelector = (placeholders, content) => {
3719
3740
  const _polyfillHost = "-shadowcsshost";
3720
3741
  const _polyfillSlotted = "-shadowcssslotted";
3721
3742
  const _polyfillHostContext = "-shadowcsscontext";
3743
+ const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
3722
3744
  let _cssColonHostRe;
3723
3745
  let _cssColonHostContextRe;
3724
3746
  let _cssColonSlottedRe;
3725
- const getCssColonHostRe = () => _cssColonHostRe ??= /* @__PURE__ */ new RegExp("(-shadowcsshost)(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)", "gim");
3726
- const getCssColonHostContextRe = () => _cssColonHostContextRe ??= /* @__PURE__ */ new RegExp("(-shadowcsscontext)(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)", "gim");
3727
- const getCssColonSlottedRe = () => _cssColonSlottedRe ??= /* @__PURE__ */ new RegExp("(-shadowcssslotted)(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)", "gim");
3747
+ const getCssColonHostRe = () => _cssColonHostRe ??= new RegExp("(-shadowcsshost" + _parenSuffix, "gim");
3748
+ const getCssColonHostContextRe = () => _cssColonHostContextRe ??= new RegExp("(-shadowcsscontext" + _parenSuffix, "gim");
3749
+ const getCssColonSlottedRe = () => _cssColonSlottedRe ??= new RegExp("(-shadowcssslotted" + _parenSuffix, "gim");
3728
3750
  const _polyfillHostNoCombinator = "-shadowcsshost-no-combinator";
3729
3751
  const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
3730
3752
  const _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
@@ -3987,12 +4009,13 @@ const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector)
3987
4009
  else return shallowPart.trim();
3988
4010
  }).join(", ");
3989
4011
  };
4012
+ const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer");
3990
4013
  const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
3991
4014
  return processRules(cssText, (rule) => {
3992
4015
  let selector = rule.selector;
3993
4016
  let content = rule.content;
3994
4017
  if (rule.selector[0] !== "@") selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
3995
- else if (rule.selector.startsWith("@media") || rule.selector.startsWith("@supports") || rule.selector.startsWith("@page") || rule.selector.startsWith("@document")) content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector);
4018
+ else if (isScopableAtRule(rule.selector)) content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector);
3996
4019
  return {
3997
4020
  selector: selector.replace(/\s{2,}/g, " ").trim(),
3998
4021
  content
@@ -4084,14 +4107,12 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
4084
4107
  rule.selector = placeholder + rule.selector;
4085
4108
  return rule;
4086
4109
  };
4087
- cssText = processRules(cssText, (rule) => {
4110
+ const commentSelectors = (input) => processRules(input, (rule) => {
4088
4111
  if (rule.selector[0] !== "@") return processCommentedSelector(rule);
4089
- else if (rule.selector.startsWith("@media") || rule.selector.startsWith("@supports") || rule.selector.startsWith("@page") || rule.selector.startsWith("@document")) {
4090
- rule.content = processRules(rule.content, processCommentedSelector);
4091
- return rule;
4092
- }
4112
+ if (isScopableAtRule(rule.selector)) rule.content = commentSelectors(rule.content);
4093
4113
  return rule;
4094
4114
  });
4115
+ cssText = commentSelectors(cssText);
4095
4116
  }
4096
4117
  const scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector);
4097
4118
  cssText = [scoped.cssText, ...commentsWithHash].join("\n");
@@ -4290,6 +4311,14 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
4290
4311
  //#endregion
4291
4312
  //#region src/runtime/proxy-component.ts
4292
4313
  /**
4314
+ * Serialize a prop value the way `setAccessor()` does when it reflects it, so the runtime can
4315
+ * recognize an `attributeChangedCallback` it triggered itself.
4316
+ *
4317
+ * @param propValue the current value of a reflected prop
4318
+ * @returns the string the attribute would hold, or `null` if the attribute would be removed
4319
+ */
4320
+ const reflectedAttrValue = (propValue) => propValue == null || propValue === false ? null : propValue === true ? "" : String(propValue);
4321
+ /**
4293
4322
  * Attach a series of runtime constructs to a compiled Stencil component
4294
4323
  * constructor, including getters and setters for the `@Prop` and `@State`
4295
4324
  * decorators, callbacks for when attributes change, and so on.
@@ -4437,7 +4466,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
4437
4466
  return;
4438
4467
  }
4439
4468
  const propFlags = members.find(([m]) => m === propName);
4440
- const isBooleanTarget = propFlags && propFlags[1][0] & MEMBER_FLAGS.Boolean;
4469
+ const propMemberFlags = propFlags ? propFlags[1][0] : 0;
4470
+ const isBooleanTarget = propMemberFlags & MEMBER_FLAGS.Boolean;
4471
+ if (BUILD.reflect && propMemberFlags & MEMBER_FLAGS.ReflectAttr && propMemberFlags & MEMBER_FLAGS.Any && !isComplexType(this[propName]) && reflectedAttrValue(this[propName]) === newValue) return;
4441
4472
  const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
4442
4473
  if (isBooleanTarget) newValue = !(newValue === null || newValue === "false");
4443
4474
  const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
@@ -5053,6 +5084,86 @@ const hostListenerOpts = (flags) => supportsListenerOptions ? {
5053
5084
  capture: (flags & LISTENER_FLAGS.Capture) !== 0
5054
5085
  } : (flags & LISTENER_FLAGS.Capture) !== 0;
5055
5086
  //#endregion
5087
+ //#region src/runtime/inject-side-effect-style.ts
5088
+ const styleSheets = /* @__PURE__ */ new Map();
5089
+ const knownRoots = /* @__PURE__ */ new Set();
5090
+ const adoptedRoots = /* @__PURE__ */ new WeakMap();
5091
+ const knownFontFaces = /* @__PURE__ */ new Set();
5092
+ const adopt = (root, sheet) => {
5093
+ let roots = adoptedRoots.get(sheet);
5094
+ if (!roots) {
5095
+ roots = /* @__PURE__ */ new WeakSet();
5096
+ adoptedRoots.set(sheet, roots);
5097
+ }
5098
+ if (!roots.has(root)) {
5099
+ roots.add(root);
5100
+ root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
5101
+ }
5102
+ };
5103
+ /**
5104
+ * Registers a root (a shadow root, or `document`) to receive every side-effect CSS import
5105
+ * (a plain, non-component `import './foo.css'`), now and in future. Call in `connectedCallback`,
5106
+ * paired with `unregisterSideEffectStyleTarget` in `disconnectedCallback` so the registry doesn't
5107
+ * hold disconnected roots forever.
5108
+ * @param root the root to register
5109
+ */
5110
+ function registerSideEffectStyleTarget(root) {
5111
+ knownRoots.add(root);
5112
+ for (const sheet of styleSheets.values()) adopt(root, sheet);
5113
+ }
5114
+ /**
5115
+ * Removes a root registered via `registerSideEffectStyleTarget` - call in `disconnectedCallback`.
5116
+ * @param root the root to unregister
5117
+ */
5118
+ function unregisterSideEffectStyleTarget(root) {
5119
+ knownRoots.delete(root);
5120
+ }
5121
+ const FONT_FACE_RE = /@font-face\s*\{[^{}]*\}/g;
5122
+ /**
5123
+ * Splits `@font-face` rules out of a CSS text - exported standalone (from private
5124
+ * module state - usually 3rd party node_modules) exported for testing
5125
+ * @param cssText the CSS text to split
5126
+ * @returns the font-face rules joined together (`null` if there were none) and the remaining CSS
5127
+ */
5128
+ function splitFontFaces(cssText) {
5129
+ const fontFaces = cssText.match(FONT_FACE_RE);
5130
+ if (!fontFaces) return {
5131
+ fontFaceText: null,
5132
+ rest: cssText
5133
+ };
5134
+ return {
5135
+ fontFaceText: fontFaces.join("\n"),
5136
+ rest: cssText.replace(FONT_FACE_RE, "")
5137
+ };
5138
+ }
5139
+ /**
5140
+ * Applies plain (non-component) CSS text to every registered root - respects shadow DOM
5141
+ * encapsulation instead of always reaching for the top-level document. Not meant to be called
5142
+ * directly: this is what the compiler's CSS-to-ESM output calls for CSS with no Stencil `tag`
5143
+ * (i.e. not a component's own `styleUrl`), typically a third-party dependency's CSS import.
5144
+ *
5145
+ * `@font-face` rules are pulled out and adopted onto top-level `document` not per-root
5146
+ * (Chromium (https://issues.chromium.org/issues/41085401) per-root never loads).
5147
+ * @param cssText the CSS text to apply
5148
+ */
5149
+ function injectSideEffectStyle(cssText) {
5150
+ const { fontFaceText, rest } = splitFontFaces(cssText);
5151
+ if (fontFaceText && !knownFontFaces.has(fontFaceText)) {
5152
+ knownFontFaces.add(fontFaceText);
5153
+ const fontFaceSheet = new CSSStyleSheet();
5154
+ fontFaceSheet.replaceSync(fontFaceText);
5155
+ document.adoptedStyleSheets = [...document.adoptedStyleSheets, fontFaceSheet];
5156
+ }
5157
+ if (!rest.trim()) return;
5158
+ let sheet = styleSheets.get(rest);
5159
+ if (!sheet) {
5160
+ sheet = new CSSStyleSheet();
5161
+ sheet.replaceSync(rest);
5162
+ styleSheets.set(rest, sheet);
5163
+ }
5164
+ for (const root of knownRoots) adopt(root, sheet);
5165
+ }
5166
+ //#endregion
5056
5167
  //#region src/runtime/mixin.ts
5057
5168
  const baseClass = BUILD.lazyLoad ? class {} : globalThis.HTMLElement || class {};
5058
5169
  function Mixin(...mixins) {
@@ -5224,4 +5335,4 @@ function hasKeys(obj) {
5224
5335
  return false;
5225
5336
  }
5226
5337
  //#endregion
5227
- export { AttachInternals, AttrDeserialize, BUILD, Build, Component, Element$1 as Element, Env, Event, Fragment, H, H as HTMLElement, HYDRATED_STYLE_ID, Host, Listen, Method, Mixin, NAMESPACE, Prop, PropSerialize, ReactiveControllerHost, STENCIL_DEV_MODE, State, Watch, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, isMemberInElement, jsx, jsxDEV, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, normalizeWatchers, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, readTask, registerHost, registerInstance, render, resolveVar, setAssetPath, setErrorHandler, setLazyLoadBasePath, setMode, setNonce, setPlatformHelpers, setPlatformOptions, setRegistry, setScopedSsr, setTagTransformer, setValue, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, transformTag, win, writeTask };
5338
+ export { AttachInternals, AttrDeserialize, BUILD, Build, Component, Element$1 as Element, Env, Event, Fragment, H, H as HTMLElement, HYDRATED_STYLE_ID, Host, Listen, Method, Mixin, NAMESPACE, Prop, PropSerialize, ReactiveControllerHost, STENCIL_DEV_MODE, State, Watch, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, injectSideEffectStyle, isMemberInElement, jsx, jsxDEV, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, normalizeWatchers, parsePropertyValue, plt, postUpdateComponent, promiseResolve, proxyComponent, proxyCustomElement, readTask, registerHost, registerInstance, registerSideEffectStyleTarget, render, resolveVar, setAssetPath, setErrorHandler, setLazyLoadBasePath, setMode, setNonce, setPlatformHelpers, setPlatformOptions, setRegistry, setScopedSsr, setTagTransformer, setValue, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, transformTag, unregisterSideEffectStyleTarget, win, writeTask };