@stencil/core 5.0.0-beta.0 → 5.0.0-beta.2
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.
- package/dist/app-data/index.d.ts +1 -1
- package/dist/compiler/browser.d.ts +1534 -0
- package/dist/compiler/browser.js +16435 -0
- package/dist/compiler/index.d.mts +1 -1
- package/dist/compiler/index.mjs +1 -1
- package/dist/compiler/utils/index.d.mts +1 -1
- package/dist/{compiler-NrvbUOX1.mjs → compiler-C8yf59oh.mjs} +325 -74
- package/dist/declarations/stencil-public-compiler.d.ts +18 -3
- package/dist/declarations/stencil-public-runtime.d.ts +21 -5
- package/dist/{index-DnISpqrd.d.ts → index-BXAcVN2j.d.ts} +3 -11
- package/dist/{index-RrQfiPWK.d.mts → index-BopBfjPu.d.mts} +18 -3
- package/dist/{index-BOrz3rbJ.d.mts → index-DmHmu3y0.d.mts} +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +81 -1
- package/dist/runtime/client/lazy.js +103 -13
- package/dist/runtime/client/runtime.d.ts +30 -12
- package/dist/runtime/client/runtime.js +103 -13
- package/dist/runtime/index.d.ts +28 -2
- package/dist/runtime/index.js +103 -13
- package/dist/runtime/server/index.d.mts +27 -1
- package/dist/runtime/server/index.mjs +101 -11
- package/dist/sys/node/index.d.mts +1 -1
- package/dist/sys/node/worker.mjs +1 -1
- package/dist/testing/index.d.mts +17 -2
- package/dist/testing/index.mjs +24 -55
- package/package.json +9 -5
|
@@ -457,8 +457,6 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
457
457
|
if (module) return module[exportName];
|
|
458
458
|
const retryCount = failedLoadAttempts.get(bundleId) ?? 0;
|
|
459
459
|
const cacheBustParams = [retryCount > 0 ? `s-retry=${retryCount}` : "", BUILD$1.hotModuleReplacement && hmrVersionId ? `s-hmr=${hmrVersionId}` : ""].filter(Boolean).join("&");
|
|
460
|
-
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
|
|
461
|
-
const entryFile = `${bundleId}.entry.js${cacheBustParams ? "?" + cacheBustParams : ""}`;
|
|
462
460
|
const onLoad = (importedModule) => {
|
|
463
461
|
if (!BUILD$1.hotModuleReplacement) {
|
|
464
462
|
failedLoadAttempts.delete(bundleId);
|
|
@@ -470,6 +468,8 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
470
468
|
failedLoadAttempts.set(bundleId, retryCount + 1);
|
|
471
469
|
consoleError(e, hostRef.$hostElement$);
|
|
472
470
|
};
|
|
471
|
+
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
|
|
472
|
+
const entryFile = `${bundleId}.entry.js${cacheBustParams ? "?" + cacheBustParams : ""}`;
|
|
473
473
|
if (lazyLoadBasePath) return import(
|
|
474
474
|
/* @vite-ignore */
|
|
475
475
|
/* webpackInclude: /\.entry\.js$/ */
|
|
@@ -3713,12 +3713,13 @@ const restoreSafeSelector = (placeholders, content) => {
|
|
|
3713
3713
|
const _polyfillHost = "-shadowcsshost";
|
|
3714
3714
|
const _polyfillSlotted = "-shadowcssslotted";
|
|
3715
3715
|
const _polyfillHostContext = "-shadowcsscontext";
|
|
3716
|
+
const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
|
|
3716
3717
|
let _cssColonHostRe;
|
|
3717
3718
|
let _cssColonHostContextRe;
|
|
3718
3719
|
let _cssColonSlottedRe;
|
|
3719
|
-
const getCssColonHostRe = () => _cssColonHostRe ??=
|
|
3720
|
-
const getCssColonHostContextRe = () => _cssColonHostContextRe ??=
|
|
3721
|
-
const getCssColonSlottedRe = () => _cssColonSlottedRe ??=
|
|
3720
|
+
const getCssColonHostRe = () => _cssColonHostRe ??= new RegExp("(-shadowcsshost" + _parenSuffix, "gim");
|
|
3721
|
+
const getCssColonHostContextRe = () => _cssColonHostContextRe ??= new RegExp("(-shadowcsscontext" + _parenSuffix, "gim");
|
|
3722
|
+
const getCssColonSlottedRe = () => _cssColonSlottedRe ??= new RegExp("(-shadowcssslotted" + _parenSuffix, "gim");
|
|
3722
3723
|
const _polyfillHostNoCombinator = "-shadowcsshost-no-combinator";
|
|
3723
3724
|
const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
|
|
3724
3725
|
const _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
|
|
@@ -3981,12 +3982,13 @@ const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector)
|
|
|
3981
3982
|
else return shallowPart.trim();
|
|
3982
3983
|
}).join(", ");
|
|
3983
3984
|
};
|
|
3985
|
+
const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer");
|
|
3984
3986
|
const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
|
|
3985
3987
|
return processRules(cssText, (rule) => {
|
|
3986
3988
|
let selector = rule.selector;
|
|
3987
3989
|
let content = rule.content;
|
|
3988
3990
|
if (rule.selector[0] !== "@") selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
|
|
3989
|
-
else if (
|
|
3991
|
+
else if (isScopableAtRule(rule.selector)) content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector);
|
|
3990
3992
|
return {
|
|
3991
3993
|
selector: selector.replace(/\s{2,}/g, " ").trim(),
|
|
3992
3994
|
content
|
|
@@ -4078,14 +4080,12 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
|
4078
4080
|
rule.selector = placeholder + rule.selector;
|
|
4079
4081
|
return rule;
|
|
4080
4082
|
};
|
|
4081
|
-
|
|
4083
|
+
const commentSelectors = (input) => processRules(input, (rule) => {
|
|
4082
4084
|
if (rule.selector[0] !== "@") return processCommentedSelector(rule);
|
|
4083
|
-
|
|
4084
|
-
rule.content = processRules(rule.content, processCommentedSelector);
|
|
4085
|
-
return rule;
|
|
4086
|
-
}
|
|
4085
|
+
if (isScopableAtRule(rule.selector)) rule.content = commentSelectors(rule.content);
|
|
4087
4086
|
return rule;
|
|
4088
4087
|
});
|
|
4088
|
+
cssText = commentSelectors(cssText);
|
|
4089
4089
|
}
|
|
4090
4090
|
const scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector);
|
|
4091
4091
|
cssText = [scoped.cssText, ...commentsWithHash].join("\n");
|
|
@@ -4284,6 +4284,14 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
4284
4284
|
//#endregion
|
|
4285
4285
|
//#region src/runtime/proxy-component.ts
|
|
4286
4286
|
/**
|
|
4287
|
+
* Serialize a prop value the way `setAccessor()` does when it reflects it, so the runtime can
|
|
4288
|
+
* recognize an `attributeChangedCallback` it triggered itself.
|
|
4289
|
+
*
|
|
4290
|
+
* @param propValue the current value of a reflected prop
|
|
4291
|
+
* @returns the string the attribute would hold, or `null` if the attribute would be removed
|
|
4292
|
+
*/
|
|
4293
|
+
const reflectedAttrValue = (propValue) => propValue == null || propValue === false ? null : propValue === true ? "" : String(propValue);
|
|
4294
|
+
/**
|
|
4287
4295
|
* Attach a series of runtime constructs to a compiled Stencil component
|
|
4288
4296
|
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
4289
4297
|
* decorators, callbacks for when attributes change, and so on.
|
|
@@ -4431,7 +4439,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4431
4439
|
return;
|
|
4432
4440
|
}
|
|
4433
4441
|
const propFlags = members.find(([m]) => m === propName);
|
|
4434
|
-
const
|
|
4442
|
+
const propMemberFlags = propFlags ? propFlags[1][0] : 0;
|
|
4443
|
+
const isBooleanTarget = propMemberFlags & MEMBER_FLAGS.Boolean;
|
|
4444
|
+
if (BUILD$1.reflect && propMemberFlags & MEMBER_FLAGS.ReflectAttr && propMemberFlags & MEMBER_FLAGS.Any && !isComplexType(this[propName]) && reflectedAttrValue(this[propName]) === newValue) return;
|
|
4435
4445
|
const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
|
|
4436
4446
|
if (isBooleanTarget) newValue = !(newValue === null || newValue === "false");
|
|
4437
4447
|
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
@@ -5047,6 +5057,86 @@ const hostListenerOpts = (flags) => supportsListenerOptions ? {
|
|
|
5047
5057
|
capture: (flags & LISTENER_FLAGS.Capture) !== 0
|
|
5048
5058
|
} : (flags & LISTENER_FLAGS.Capture) !== 0;
|
|
5049
5059
|
//#endregion
|
|
5060
|
+
//#region src/runtime/inject-side-effect-style.ts
|
|
5061
|
+
const styleSheets = /* @__PURE__ */ new Map();
|
|
5062
|
+
const knownRoots = /* @__PURE__ */ new Set();
|
|
5063
|
+
const adoptedRoots = /* @__PURE__ */ new WeakMap();
|
|
5064
|
+
const knownFontFaces = /* @__PURE__ */ new Set();
|
|
5065
|
+
const adopt = (root, sheet) => {
|
|
5066
|
+
let roots = adoptedRoots.get(sheet);
|
|
5067
|
+
if (!roots) {
|
|
5068
|
+
roots = /* @__PURE__ */ new WeakSet();
|
|
5069
|
+
adoptedRoots.set(sheet, roots);
|
|
5070
|
+
}
|
|
5071
|
+
if (!roots.has(root)) {
|
|
5072
|
+
roots.add(root);
|
|
5073
|
+
root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
|
|
5074
|
+
}
|
|
5075
|
+
};
|
|
5076
|
+
/**
|
|
5077
|
+
* Registers a root (a shadow root, or `document`) to receive every side-effect CSS import
|
|
5078
|
+
* (a plain, non-component `import './foo.css'`), now and in future. Call in `connectedCallback`,
|
|
5079
|
+
* paired with `unregisterSideEffectStyleTarget` in `disconnectedCallback` so the registry doesn't
|
|
5080
|
+
* hold disconnected roots forever.
|
|
5081
|
+
* @param root the root to register
|
|
5082
|
+
*/
|
|
5083
|
+
function registerSideEffectStyleTarget(root) {
|
|
5084
|
+
knownRoots.add(root);
|
|
5085
|
+
for (const sheet of styleSheets.values()) adopt(root, sheet);
|
|
5086
|
+
}
|
|
5087
|
+
/**
|
|
5088
|
+
* Removes a root registered via `registerSideEffectStyleTarget` - call in `disconnectedCallback`.
|
|
5089
|
+
* @param root the root to unregister
|
|
5090
|
+
*/
|
|
5091
|
+
function unregisterSideEffectStyleTarget(root) {
|
|
5092
|
+
knownRoots.delete(root);
|
|
5093
|
+
}
|
|
5094
|
+
const FONT_FACE_RE = /@font-face\s*\{[^{}]*\}/g;
|
|
5095
|
+
/**
|
|
5096
|
+
* Splits `@font-face` rules out of a CSS text - exported standalone (from private
|
|
5097
|
+
* module state - usually 3rd party node_modules) exported for testing
|
|
5098
|
+
* @param cssText the CSS text to split
|
|
5099
|
+
* @returns the font-face rules joined together (`null` if there were none) and the remaining CSS
|
|
5100
|
+
*/
|
|
5101
|
+
function splitFontFaces(cssText) {
|
|
5102
|
+
const fontFaces = cssText.match(FONT_FACE_RE);
|
|
5103
|
+
if (!fontFaces) return {
|
|
5104
|
+
fontFaceText: null,
|
|
5105
|
+
rest: cssText
|
|
5106
|
+
};
|
|
5107
|
+
return {
|
|
5108
|
+
fontFaceText: fontFaces.join("\n"),
|
|
5109
|
+
rest: cssText.replace(FONT_FACE_RE, "")
|
|
5110
|
+
};
|
|
5111
|
+
}
|
|
5112
|
+
/**
|
|
5113
|
+
* Applies plain (non-component) CSS text to every registered root - respects shadow DOM
|
|
5114
|
+
* encapsulation instead of always reaching for the top-level document. Not meant to be called
|
|
5115
|
+
* directly: this is what the compiler's CSS-to-ESM output calls for CSS with no Stencil `tag`
|
|
5116
|
+
* (i.e. not a component's own `styleUrl`), typically a third-party dependency's CSS import.
|
|
5117
|
+
*
|
|
5118
|
+
* `@font-face` rules are pulled out and adopted onto top-level `document` not per-root
|
|
5119
|
+
* (Chromium (https://issues.chromium.org/issues/41085401) per-root never loads).
|
|
5120
|
+
* @param cssText the CSS text to apply
|
|
5121
|
+
*/
|
|
5122
|
+
function injectSideEffectStyle(cssText) {
|
|
5123
|
+
const { fontFaceText, rest } = splitFontFaces(cssText);
|
|
5124
|
+
if (fontFaceText && !knownFontFaces.has(fontFaceText)) {
|
|
5125
|
+
knownFontFaces.add(fontFaceText);
|
|
5126
|
+
const fontFaceSheet = new CSSStyleSheet();
|
|
5127
|
+
fontFaceSheet.replaceSync(fontFaceText);
|
|
5128
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets, fontFaceSheet];
|
|
5129
|
+
}
|
|
5130
|
+
if (!rest.trim()) return;
|
|
5131
|
+
let sheet = styleSheets.get(rest);
|
|
5132
|
+
if (!sheet) {
|
|
5133
|
+
sheet = new CSSStyleSheet();
|
|
5134
|
+
sheet.replaceSync(rest);
|
|
5135
|
+
styleSheets.set(rest, sheet);
|
|
5136
|
+
}
|
|
5137
|
+
for (const root of knownRoots) adopt(root, sheet);
|
|
5138
|
+
}
|
|
5139
|
+
//#endregion
|
|
5050
5140
|
//#region src/runtime/mixin.ts
|
|
5051
5141
|
const baseClass = BUILD$1.lazyLoad ? class {} : globalThis.HTMLElement || class {};
|
|
5052
5142
|
function Mixin(...mixins) {
|
|
@@ -5218,4 +5308,4 @@ function hasKeys(obj) {
|
|
|
5218
5308
|
return false;
|
|
5219
5309
|
}
|
|
5220
5310
|
//#endregion
|
|
5221
|
-
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 };
|
|
5311
|
+
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 };
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ReactiveControllerHostInterface, E as VNode, S as MixedInCtor, T as TagTransformer, _ as ComponentInterface, a as ComponentConstructor, b as HTMLStencilElement, c as ComponentRuntimeMeta, d as HostRef, f as LazyBundlesRuntimeData, g as RuntimeRef, h as RenderNode, i as ChildType, l as ComponentRuntimeMetaCompact, m as PropsType, o as ComponentConstructorChangeHandlers, p as PlatformRuntime, s as ComponentRuntimeHostListener, u as HostElement, v as CustomElementsDefineOptions, w as ResolutionHandler, x as JSXBase, y as FunctionalComponent } from "../index-
|
|
1
|
+
import { C as ReactiveControllerHostInterface, E as VNode, S as MixedInCtor, T as TagTransformer, _ as ComponentInterface, a as ComponentConstructor, b as HTMLStencilElement, c as ComponentRuntimeMeta, d as HostRef, f as LazyBundlesRuntimeData, g as RuntimeRef, h as RenderNode, i as ChildType, l as ComponentRuntimeMetaCompact, m as PropsType, o as ComponentConstructorChangeHandlers, p as PlatformRuntime, s as ComponentRuntimeHostListener, u as HostElement, v as CustomElementsDefineOptions, w as ResolutionHandler, x as JSXBase, y as FunctionalComponent } from "../index-BXAcVN2j.js";
|
|
2
2
|
//#region src/runtime/asset-path.d.ts
|
|
3
3
|
declare const getAssetPath: (path: string) => string;
|
|
4
4
|
declare const setAssetPath: (path: string) => string;
|
|
@@ -47,6 +47,32 @@ declare const Fragment: FunctionalComponent;
|
|
|
47
47
|
//#region src/runtime/host-listener.d.ts
|
|
48
48
|
declare const addHostEventListeners: (elm: HostElement, hostRef: HostRef, listeners?: ComponentRuntimeHostListener[]) => void;
|
|
49
49
|
//#endregion
|
|
50
|
+
//#region src/runtime/inject-side-effect-style.d.ts
|
|
51
|
+
/**
|
|
52
|
+
* Registers a root (a shadow root, or `document`) to receive every side-effect CSS import
|
|
53
|
+
* (a plain, non-component `import './foo.css'`), now and in future. Call in `connectedCallback`,
|
|
54
|
+
* paired with `unregisterSideEffectStyleTarget` in `disconnectedCallback` so the registry doesn't
|
|
55
|
+
* hold disconnected roots forever.
|
|
56
|
+
* @param root the root to register
|
|
57
|
+
*/
|
|
58
|
+
declare function registerSideEffectStyleTarget(root: DocumentOrShadowRoot): void;
|
|
59
|
+
/**
|
|
60
|
+
* Removes a root registered via `registerSideEffectStyleTarget` - call in `disconnectedCallback`.
|
|
61
|
+
* @param root the root to unregister
|
|
62
|
+
*/
|
|
63
|
+
declare function unregisterSideEffectStyleTarget(root: DocumentOrShadowRoot): void;
|
|
64
|
+
/**
|
|
65
|
+
* Applies plain (non-component) CSS text to every registered root - respects shadow DOM
|
|
66
|
+
* encapsulation instead of always reaching for the top-level document. Not meant to be called
|
|
67
|
+
* directly: this is what the compiler's CSS-to-ESM output calls for CSS with no Stencil `tag`
|
|
68
|
+
* (i.e. not a component's own `styleUrl`), typically a third-party dependency's CSS import.
|
|
69
|
+
*
|
|
70
|
+
* `@font-face` rules are pulled out and adopted onto top-level `document` not per-root
|
|
71
|
+
* (Chromium (https://issues.chromium.org/issues/41085401) per-root never loads).
|
|
72
|
+
* @param cssText the CSS text to apply
|
|
73
|
+
*/
|
|
74
|
+
declare function injectSideEffectStyle(cssText: string): void;
|
|
75
|
+
//#endregion
|
|
50
76
|
//#region src/runtime/mixin.d.ts
|
|
51
77
|
type Ctor<T = {}> = new (...args: any[]) => T;
|
|
52
78
|
declare function Mixin(...mixins: ((base: Ctor) => Ctor)[]): Ctor<{}>;
|
|
@@ -210,4 +236,4 @@ declare const jsxs: typeof jsx;
|
|
|
210
236
|
*/
|
|
211
237
|
declare const jsxDEV: typeof jsx;
|
|
212
238
|
//#endregion
|
|
213
|
-
export { Fragment, type HTMLStencilElement, HYDRATED_STYLE_ID, Host, type JSXBase, Mixin, ReactiveControllerHost, addHostEventListeners, bootstrapLazy, connectedCallback, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, jsx, jsxDEV, jsxs, normalizeWatchers, parsePropertyValue, postUpdateComponent, proxyComponent, proxyCustomElement, render, setAssetPath, setMode, setNonce, setPlatformOptions, setRegistry, setTagTransformer, setValue, transformTag };
|
|
239
|
+
export { Fragment, type HTMLStencilElement, HYDRATED_STYLE_ID, Host, type JSXBase, Mixin, ReactiveControllerHost, addHostEventListeners, bootstrapLazy, connectedCallback, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, injectSideEffectStyle, jsx, jsxDEV, jsxs, normalizeWatchers, parsePropertyValue, postUpdateComponent, proxyComponent, proxyCustomElement, registerSideEffectStyleTarget, render, setAssetPath, setMode, setNonce, setPlatformOptions, setRegistry, setTagTransformer, setValue, transformTag, unregisterSideEffectStyleTarget };
|
package/dist/runtime/index.js
CHANGED
|
@@ -347,8 +347,6 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
347
347
|
if (module) return module[exportName];
|
|
348
348
|
const retryCount = failedLoadAttempts.get(bundleId) ?? 0;
|
|
349
349
|
const cacheBustParams = [retryCount > 0 ? `s-retry=${retryCount}` : "", BUILD.hotModuleReplacement && hmrVersionId ? `s-hmr=${hmrVersionId}` : ""].filter(Boolean).join("&");
|
|
350
|
-
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
|
|
351
|
-
const entryFile = `${bundleId}.entry.js${cacheBustParams ? "?" + cacheBustParams : ""}`;
|
|
352
350
|
const onLoad = (importedModule) => {
|
|
353
351
|
if (!BUILD.hotModuleReplacement) {
|
|
354
352
|
failedLoadAttempts.delete(bundleId);
|
|
@@ -360,6 +358,8 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
360
358
|
failedLoadAttempts.set(bundleId, retryCount + 1);
|
|
361
359
|
consoleError(e, hostRef.$hostElement$);
|
|
362
360
|
};
|
|
361
|
+
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
|
|
362
|
+
const entryFile = `${bundleId}.entry.js${cacheBustParams ? "?" + cacheBustParams : ""}`;
|
|
363
363
|
return import(
|
|
364
364
|
/* @vite-ignore */
|
|
365
365
|
/* webpackInclude: /\.entry\.js$/ */
|
|
@@ -3585,12 +3585,13 @@ const restoreSafeSelector = (placeholders, content) => {
|
|
|
3585
3585
|
const _polyfillHost = "-shadowcsshost";
|
|
3586
3586
|
const _polyfillSlotted = "-shadowcssslotted";
|
|
3587
3587
|
const _polyfillHostContext = "-shadowcsscontext";
|
|
3588
|
+
const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
|
|
3588
3589
|
let _cssColonHostRe;
|
|
3589
3590
|
let _cssColonHostContextRe;
|
|
3590
3591
|
let _cssColonSlottedRe;
|
|
3591
|
-
const getCssColonHostRe = () => _cssColonHostRe ??=
|
|
3592
|
-
const getCssColonHostContextRe = () => _cssColonHostContextRe ??=
|
|
3593
|
-
const getCssColonSlottedRe = () => _cssColonSlottedRe ??=
|
|
3592
|
+
const getCssColonHostRe = () => _cssColonHostRe ??= new RegExp("(-shadowcsshost" + _parenSuffix, "gim");
|
|
3593
|
+
const getCssColonHostContextRe = () => _cssColonHostContextRe ??= new RegExp("(-shadowcsscontext" + _parenSuffix, "gim");
|
|
3594
|
+
const getCssColonSlottedRe = () => _cssColonSlottedRe ??= new RegExp("(-shadowcssslotted" + _parenSuffix, "gim");
|
|
3594
3595
|
const _polyfillHostNoCombinator = "-shadowcsshost-no-combinator";
|
|
3595
3596
|
const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
|
|
3596
3597
|
const _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
|
|
@@ -3853,12 +3854,13 @@ const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector)
|
|
|
3853
3854
|
else return shallowPart.trim();
|
|
3854
3855
|
}).join(", ");
|
|
3855
3856
|
};
|
|
3857
|
+
const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer");
|
|
3856
3858
|
const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
|
|
3857
3859
|
return processRules(cssText, (rule) => {
|
|
3858
3860
|
let selector = rule.selector;
|
|
3859
3861
|
let content = rule.content;
|
|
3860
3862
|
if (rule.selector[0] !== "@") selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
|
|
3861
|
-
else if (
|
|
3863
|
+
else if (isScopableAtRule(rule.selector)) content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector);
|
|
3862
3864
|
return {
|
|
3863
3865
|
selector: selector.replace(/\s{2,}/g, " ").trim(),
|
|
3864
3866
|
content
|
|
@@ -3950,14 +3952,12 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
|
3950
3952
|
rule.selector = placeholder + rule.selector;
|
|
3951
3953
|
return rule;
|
|
3952
3954
|
};
|
|
3953
|
-
|
|
3955
|
+
const commentSelectors = (input) => processRules(input, (rule) => {
|
|
3954
3956
|
if (rule.selector[0] !== "@") return processCommentedSelector(rule);
|
|
3955
|
-
|
|
3956
|
-
rule.content = processRules(rule.content, processCommentedSelector);
|
|
3957
|
-
return rule;
|
|
3958
|
-
}
|
|
3957
|
+
if (isScopableAtRule(rule.selector)) rule.content = commentSelectors(rule.content);
|
|
3959
3958
|
return rule;
|
|
3960
3959
|
});
|
|
3960
|
+
cssText = commentSelectors(cssText);
|
|
3961
3961
|
}
|
|
3962
3962
|
const scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector);
|
|
3963
3963
|
cssText = [scoped.cssText, ...commentsWithHash].join("\n");
|
|
@@ -4156,6 +4156,14 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
4156
4156
|
//#endregion
|
|
4157
4157
|
//#region src/runtime/proxy-component.ts
|
|
4158
4158
|
/**
|
|
4159
|
+
* Serialize a prop value the way `setAccessor()` does when it reflects it, so the runtime can
|
|
4160
|
+
* recognize an `attributeChangedCallback` it triggered itself.
|
|
4161
|
+
*
|
|
4162
|
+
* @param propValue the current value of a reflected prop
|
|
4163
|
+
* @returns the string the attribute would hold, or `null` if the attribute would be removed
|
|
4164
|
+
*/
|
|
4165
|
+
const reflectedAttrValue = (propValue) => propValue == null || propValue === false ? null : propValue === true ? "" : String(propValue);
|
|
4166
|
+
/**
|
|
4159
4167
|
* Attach a series of runtime constructs to a compiled Stencil component
|
|
4160
4168
|
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
4161
4169
|
* decorators, callbacks for when attributes change, and so on.
|
|
@@ -4303,7 +4311,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4303
4311
|
return;
|
|
4304
4312
|
}
|
|
4305
4313
|
const propFlags = members.find(([m]) => m === propName);
|
|
4306
|
-
const
|
|
4314
|
+
const propMemberFlags = propFlags ? propFlags[1][0] : 0;
|
|
4315
|
+
const isBooleanTarget = propMemberFlags & MEMBER_FLAGS.Boolean;
|
|
4316
|
+
if (BUILD.reflect && propMemberFlags & MEMBER_FLAGS.ReflectAttr && propMemberFlags & MEMBER_FLAGS.Any && !isComplexType(this[propName]) && reflectedAttrValue(this[propName]) === newValue) return;
|
|
4307
4317
|
const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
|
|
4308
4318
|
if (isBooleanTarget) newValue = !(newValue === null || newValue === "false");
|
|
4309
4319
|
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
@@ -4919,6 +4929,86 @@ const hostListenerOpts = (flags) => supportsListenerOptions ? {
|
|
|
4919
4929
|
capture: (flags & LISTENER_FLAGS.Capture) !== 0
|
|
4920
4930
|
} : (flags & LISTENER_FLAGS.Capture) !== 0;
|
|
4921
4931
|
//#endregion
|
|
4932
|
+
//#region src/runtime/inject-side-effect-style.ts
|
|
4933
|
+
const styleSheets = /* @__PURE__ */ new Map();
|
|
4934
|
+
const knownRoots = /* @__PURE__ */ new Set();
|
|
4935
|
+
const adoptedRoots = /* @__PURE__ */ new WeakMap();
|
|
4936
|
+
const knownFontFaces = /* @__PURE__ */ new Set();
|
|
4937
|
+
const adopt = (root, sheet) => {
|
|
4938
|
+
let roots = adoptedRoots.get(sheet);
|
|
4939
|
+
if (!roots) {
|
|
4940
|
+
roots = /* @__PURE__ */ new WeakSet();
|
|
4941
|
+
adoptedRoots.set(sheet, roots);
|
|
4942
|
+
}
|
|
4943
|
+
if (!roots.has(root)) {
|
|
4944
|
+
roots.add(root);
|
|
4945
|
+
root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
|
|
4946
|
+
}
|
|
4947
|
+
};
|
|
4948
|
+
/**
|
|
4949
|
+
* Registers a root (a shadow root, or `document`) to receive every side-effect CSS import
|
|
4950
|
+
* (a plain, non-component `import './foo.css'`), now and in future. Call in `connectedCallback`,
|
|
4951
|
+
* paired with `unregisterSideEffectStyleTarget` in `disconnectedCallback` so the registry doesn't
|
|
4952
|
+
* hold disconnected roots forever.
|
|
4953
|
+
* @param root the root to register
|
|
4954
|
+
*/
|
|
4955
|
+
function registerSideEffectStyleTarget(root) {
|
|
4956
|
+
knownRoots.add(root);
|
|
4957
|
+
for (const sheet of styleSheets.values()) adopt(root, sheet);
|
|
4958
|
+
}
|
|
4959
|
+
/**
|
|
4960
|
+
* Removes a root registered via `registerSideEffectStyleTarget` - call in `disconnectedCallback`.
|
|
4961
|
+
* @param root the root to unregister
|
|
4962
|
+
*/
|
|
4963
|
+
function unregisterSideEffectStyleTarget(root) {
|
|
4964
|
+
knownRoots.delete(root);
|
|
4965
|
+
}
|
|
4966
|
+
const FONT_FACE_RE = /@font-face\s*\{[^{}]*\}/g;
|
|
4967
|
+
/**
|
|
4968
|
+
* Splits `@font-face` rules out of a CSS text - exported standalone (from private
|
|
4969
|
+
* module state - usually 3rd party node_modules) exported for testing
|
|
4970
|
+
* @param cssText the CSS text to split
|
|
4971
|
+
* @returns the font-face rules joined together (`null` if there were none) and the remaining CSS
|
|
4972
|
+
*/
|
|
4973
|
+
function splitFontFaces(cssText) {
|
|
4974
|
+
const fontFaces = cssText.match(FONT_FACE_RE);
|
|
4975
|
+
if (!fontFaces) return {
|
|
4976
|
+
fontFaceText: null,
|
|
4977
|
+
rest: cssText
|
|
4978
|
+
};
|
|
4979
|
+
return {
|
|
4980
|
+
fontFaceText: fontFaces.join("\n"),
|
|
4981
|
+
rest: cssText.replace(FONT_FACE_RE, "")
|
|
4982
|
+
};
|
|
4983
|
+
}
|
|
4984
|
+
/**
|
|
4985
|
+
* Applies plain (non-component) CSS text to every registered root - respects shadow DOM
|
|
4986
|
+
* encapsulation instead of always reaching for the top-level document. Not meant to be called
|
|
4987
|
+
* directly: this is what the compiler's CSS-to-ESM output calls for CSS with no Stencil `tag`
|
|
4988
|
+
* (i.e. not a component's own `styleUrl`), typically a third-party dependency's CSS import.
|
|
4989
|
+
*
|
|
4990
|
+
* `@font-face` rules are pulled out and adopted onto top-level `document` not per-root
|
|
4991
|
+
* (Chromium (https://issues.chromium.org/issues/41085401) per-root never loads).
|
|
4992
|
+
* @param cssText the CSS text to apply
|
|
4993
|
+
*/
|
|
4994
|
+
function injectSideEffectStyle(cssText) {
|
|
4995
|
+
const { fontFaceText, rest } = splitFontFaces(cssText);
|
|
4996
|
+
if (fontFaceText && !knownFontFaces.has(fontFaceText)) {
|
|
4997
|
+
knownFontFaces.add(fontFaceText);
|
|
4998
|
+
const fontFaceSheet = new CSSStyleSheet();
|
|
4999
|
+
fontFaceSheet.replaceSync(fontFaceText);
|
|
5000
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets, fontFaceSheet];
|
|
5001
|
+
}
|
|
5002
|
+
if (!rest.trim()) return;
|
|
5003
|
+
let sheet = styleSheets.get(rest);
|
|
5004
|
+
if (!sheet) {
|
|
5005
|
+
sheet = new CSSStyleSheet();
|
|
5006
|
+
sheet.replaceSync(rest);
|
|
5007
|
+
styleSheets.set(rest, sheet);
|
|
5008
|
+
}
|
|
5009
|
+
for (const root of knownRoots) adopt(root, sheet);
|
|
5010
|
+
}
|
|
5011
|
+
//#endregion
|
|
4922
5012
|
//#region src/runtime/mixin.ts
|
|
4923
5013
|
const baseClass = BUILD.lazyLoad ? class {} : globalThis.HTMLElement || class {};
|
|
4924
5014
|
function Mixin(...mixins) {
|
|
@@ -5090,4 +5180,4 @@ function hasKeys(obj) {
|
|
|
5090
5180
|
return false;
|
|
5091
5181
|
}
|
|
5092
5182
|
//#endregion
|
|
5093
|
-
export { Fragment, HYDRATED_STYLE_ID, Host, Mixin, ReactiveControllerHost, addHostEventListeners, bootstrapLazy, connectedCallback, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, jsx, jsxDEV, jsxs, normalizeWatchers, parsePropertyValue, postUpdateComponent, proxyComponent, proxyCustomElement, render, setAssetPath, setMode, setNonce, setPlatformOptions, setRegistry, setTagTransformer, setValue, transformTag };
|
|
5183
|
+
export { Fragment, HYDRATED_STYLE_ID, Host, Mixin, ReactiveControllerHost, addHostEventListeners, bootstrapLazy, connectedCallback, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getMode, getRegistry, getRenderingRef, getShadowRoot, getValue, h, injectSideEffectStyle, jsx, jsxDEV, jsxs, normalizeWatchers, parsePropertyValue, postUpdateComponent, proxyComponent, proxyCustomElement, registerSideEffectStyleTarget, render, setAssetPath, setMode, setNonce, setPlatformOptions, setRegistry, setTagTransformer, setValue, transformTag, unregisterSideEffectStyleTarget };
|
|
@@ -1069,6 +1069,32 @@ declare const Fragment: FunctionalComponent;
|
|
|
1069
1069
|
//#region src/runtime/host-listener.d.ts
|
|
1070
1070
|
declare const addHostEventListeners: (elm: HostElement, hostRef: HostRef, listeners?: ComponentRuntimeHostListener[]) => void;
|
|
1071
1071
|
//#endregion
|
|
1072
|
+
//#region src/runtime/inject-side-effect-style.d.ts
|
|
1073
|
+
/**
|
|
1074
|
+
* Registers a root (a shadow root, or `document`) to receive every side-effect CSS import
|
|
1075
|
+
* (a plain, non-component `import './foo.css'`), now and in future. Call in `connectedCallback`,
|
|
1076
|
+
* paired with `unregisterSideEffectStyleTarget` in `disconnectedCallback` so the registry doesn't
|
|
1077
|
+
* hold disconnected roots forever.
|
|
1078
|
+
* @param root the root to register
|
|
1079
|
+
*/
|
|
1080
|
+
declare function registerSideEffectStyleTarget(root: DocumentOrShadowRoot): void;
|
|
1081
|
+
/**
|
|
1082
|
+
* Removes a root registered via `registerSideEffectStyleTarget` - call in `disconnectedCallback`.
|
|
1083
|
+
* @param root the root to unregister
|
|
1084
|
+
*/
|
|
1085
|
+
declare function unregisterSideEffectStyleTarget(root: DocumentOrShadowRoot): void;
|
|
1086
|
+
/**
|
|
1087
|
+
* Applies plain (non-component) CSS text to every registered root - respects shadow DOM
|
|
1088
|
+
* encapsulation instead of always reaching for the top-level document. Not meant to be called
|
|
1089
|
+
* directly: this is what the compiler's CSS-to-ESM output calls for CSS with no Stencil `tag`
|
|
1090
|
+
* (i.e. not a component's own `styleUrl`), typically a third-party dependency's CSS import.
|
|
1091
|
+
*
|
|
1092
|
+
* `@font-face` rules are pulled out and adopted onto top-level `document` not per-root
|
|
1093
|
+
* (Chromium (https://issues.chromium.org/issues/41085401) per-root never loads).
|
|
1094
|
+
* @param cssText the CSS text to apply
|
|
1095
|
+
*/
|
|
1096
|
+
declare function injectSideEffectStyle(cssText: string): void;
|
|
1097
|
+
//#endregion
|
|
1072
1098
|
//#region src/runtime/mixin.d.ts
|
|
1073
1099
|
type Ctor<T = {}> = new (...args: any[]) => T;
|
|
1074
1100
|
declare function Mixin(...mixins: ((base: Ctor) => Ctor)[]): Ctor<{}>;
|
|
@@ -1248,4 +1274,4 @@ declare const setAssetPath: (path: string) => string;
|
|
|
1248
1274
|
declare const setScopedSsr: (opts: SsrFactoryOptions) => void;
|
|
1249
1275
|
declare const needsScopedSSR: () => boolean;
|
|
1250
1276
|
//#endregion
|
|
1251
|
-
export { BUILD, Build, Env, Fragment, Host, Mixin, NAMESPACE, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRenderingRef, getShadowRoot, getValue, hAsync as h, insertVdomAnnotations, isMemberInElement, jsx, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, parsePropertyValue, plt, postUpdateComponent, proxyComponent, proxyCustomElement, readTask, registerComponents, registerHost, registerInstance, renderVdom, setAssetPath, setErrorHandler, setMode, setNonce, setPlatformHelpers, setScopedSsr, setTagTransformer, setValue, ssrApp, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, transformTag, win, writeTask };
|
|
1277
|
+
export { BUILD, Build, Env, Fragment, Host, Mixin, NAMESPACE, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRenderingRef, getShadowRoot, getValue, hAsync as h, injectSideEffectStyle, insertVdomAnnotations, isMemberInElement, jsx, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, parsePropertyValue, plt, postUpdateComponent, proxyComponent, proxyCustomElement, readTask, registerComponents, registerHost, registerInstance, registerSideEffectStyleTarget, renderVdom, setAssetPath, setErrorHandler, setMode, setNonce, setPlatformHelpers, setScopedSsr, setTagTransformer, setValue, ssrApp, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, transformTag, unregisterSideEffectStyleTarget, win, writeTask };
|
|
@@ -3329,12 +3329,13 @@ const restoreSafeSelector = (placeholders, content) => {
|
|
|
3329
3329
|
const _polyfillHost = "-shadowcsshost";
|
|
3330
3330
|
const _polyfillSlotted = "-shadowcssslotted";
|
|
3331
3331
|
const _polyfillHostContext = "-shadowcsscontext";
|
|
3332
|
+
const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
|
|
3332
3333
|
let _cssColonHostRe;
|
|
3333
3334
|
let _cssColonHostContextRe;
|
|
3334
3335
|
let _cssColonSlottedRe;
|
|
3335
|
-
const getCssColonHostRe = () => _cssColonHostRe ??=
|
|
3336
|
-
const getCssColonHostContextRe = () => _cssColonHostContextRe ??=
|
|
3337
|
-
const getCssColonSlottedRe = () => _cssColonSlottedRe ??=
|
|
3336
|
+
const getCssColonHostRe = () => _cssColonHostRe ??= new RegExp("(-shadowcsshost" + _parenSuffix, "gim");
|
|
3337
|
+
const getCssColonHostContextRe = () => _cssColonHostContextRe ??= new RegExp("(-shadowcsscontext" + _parenSuffix, "gim");
|
|
3338
|
+
const getCssColonSlottedRe = () => _cssColonSlottedRe ??= new RegExp("(-shadowcssslotted" + _parenSuffix, "gim");
|
|
3338
3339
|
const _polyfillHostNoCombinator = "-shadowcsshost-no-combinator";
|
|
3339
3340
|
const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
|
|
3340
3341
|
const _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
|
|
@@ -3597,12 +3598,13 @@ const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector)
|
|
|
3597
3598
|
else return shallowPart.trim();
|
|
3598
3599
|
}).join(", ");
|
|
3599
3600
|
};
|
|
3601
|
+
const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer");
|
|
3600
3602
|
const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
|
|
3601
3603
|
return processRules(cssText, (rule) => {
|
|
3602
3604
|
let selector = rule.selector;
|
|
3603
3605
|
let content = rule.content;
|
|
3604
3606
|
if (rule.selector[0] !== "@") selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
|
|
3605
|
-
else if (
|
|
3607
|
+
else if (isScopableAtRule(rule.selector)) content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector);
|
|
3606
3608
|
return {
|
|
3607
3609
|
selector: selector.replace(/\s{2,}/g, " ").trim(),
|
|
3608
3610
|
content
|
|
@@ -3694,14 +3696,12 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
|
3694
3696
|
rule.selector = placeholder + rule.selector;
|
|
3695
3697
|
return rule;
|
|
3696
3698
|
};
|
|
3697
|
-
|
|
3699
|
+
const commentSelectors = (input) => processRules(input, (rule) => {
|
|
3698
3700
|
if (rule.selector[0] !== "@") return processCommentedSelector(rule);
|
|
3699
|
-
|
|
3700
|
-
rule.content = processRules(rule.content, processCommentedSelector);
|
|
3701
|
-
return rule;
|
|
3702
|
-
}
|
|
3701
|
+
if (isScopableAtRule(rule.selector)) rule.content = commentSelectors(rule.content);
|
|
3703
3702
|
return rule;
|
|
3704
3703
|
});
|
|
3704
|
+
cssText = commentSelectors(cssText);
|
|
3705
3705
|
}
|
|
3706
3706
|
const scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector);
|
|
3707
3707
|
cssText = [scoped.cssText, ...commentsWithHash].join("\n");
|
|
@@ -3900,6 +3900,14 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3900
3900
|
//#endregion
|
|
3901
3901
|
//#region src/runtime/proxy-component.ts
|
|
3902
3902
|
/**
|
|
3903
|
+
* Serialize a prop value the way `setAccessor()` does when it reflects it, so the runtime can
|
|
3904
|
+
* recognize an `attributeChangedCallback` it triggered itself.
|
|
3905
|
+
*
|
|
3906
|
+
* @param propValue the current value of a reflected prop
|
|
3907
|
+
* @returns the string the attribute would hold, or `null` if the attribute would be removed
|
|
3908
|
+
*/
|
|
3909
|
+
const reflectedAttrValue = (propValue) => propValue == null || propValue === false ? null : propValue === true ? "" : String(propValue);
|
|
3910
|
+
/**
|
|
3903
3911
|
* Attach a series of runtime constructs to a compiled Stencil component
|
|
3904
3912
|
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
3905
3913
|
* decorators, callbacks for when attributes change, and so on.
|
|
@@ -4047,7 +4055,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4047
4055
|
return;
|
|
4048
4056
|
}
|
|
4049
4057
|
const propFlags = members.find(([m]) => m === propName);
|
|
4050
|
-
const
|
|
4058
|
+
const propMemberFlags = propFlags ? propFlags[1][0] : 0;
|
|
4059
|
+
const isBooleanTarget = propMemberFlags & MEMBER_FLAGS.Boolean;
|
|
4060
|
+
if (BUILD$1.reflect && propMemberFlags & MEMBER_FLAGS.ReflectAttr && propMemberFlags & MEMBER_FLAGS.Any && !isComplexType(this[propName]) && reflectedAttrValue(this[propName]) === newValue) return;
|
|
4051
4061
|
const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
|
|
4052
4062
|
if (isBooleanTarget) newValue = !(newValue === null || newValue === "false");
|
|
4053
4063
|
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
@@ -4660,6 +4670,86 @@ const getHostListenerTarget = (doc, elm, flags) => {
|
|
|
4660
4670
|
};
|
|
4661
4671
|
const hostListenerOpts = (flags) => (flags & LISTENER_FLAGS.Capture) !== 0;
|
|
4662
4672
|
//#endregion
|
|
4673
|
+
//#region src/runtime/inject-side-effect-style.ts
|
|
4674
|
+
const styleSheets = /* @__PURE__ */ new Map();
|
|
4675
|
+
const knownRoots = /* @__PURE__ */ new Set();
|
|
4676
|
+
const adoptedRoots = /* @__PURE__ */ new WeakMap();
|
|
4677
|
+
const knownFontFaces = /* @__PURE__ */ new Set();
|
|
4678
|
+
const adopt = (root, sheet) => {
|
|
4679
|
+
let roots = adoptedRoots.get(sheet);
|
|
4680
|
+
if (!roots) {
|
|
4681
|
+
roots = /* @__PURE__ */ new WeakSet();
|
|
4682
|
+
adoptedRoots.set(sheet, roots);
|
|
4683
|
+
}
|
|
4684
|
+
if (!roots.has(root)) {
|
|
4685
|
+
roots.add(root);
|
|
4686
|
+
root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
|
|
4687
|
+
}
|
|
4688
|
+
};
|
|
4689
|
+
/**
|
|
4690
|
+
* Registers a root (a shadow root, or `document`) to receive every side-effect CSS import
|
|
4691
|
+
* (a plain, non-component `import './foo.css'`), now and in future. Call in `connectedCallback`,
|
|
4692
|
+
* paired with `unregisterSideEffectStyleTarget` in `disconnectedCallback` so the registry doesn't
|
|
4693
|
+
* hold disconnected roots forever.
|
|
4694
|
+
* @param root the root to register
|
|
4695
|
+
*/
|
|
4696
|
+
function registerSideEffectStyleTarget(root) {
|
|
4697
|
+
knownRoots.add(root);
|
|
4698
|
+
for (const sheet of styleSheets.values()) adopt(root, sheet);
|
|
4699
|
+
}
|
|
4700
|
+
/**
|
|
4701
|
+
* Removes a root registered via `registerSideEffectStyleTarget` - call in `disconnectedCallback`.
|
|
4702
|
+
* @param root the root to unregister
|
|
4703
|
+
*/
|
|
4704
|
+
function unregisterSideEffectStyleTarget(root) {
|
|
4705
|
+
knownRoots.delete(root);
|
|
4706
|
+
}
|
|
4707
|
+
const FONT_FACE_RE = /@font-face\s*\{[^{}]*\}/g;
|
|
4708
|
+
/**
|
|
4709
|
+
* Splits `@font-face` rules out of a CSS text - exported standalone (from private
|
|
4710
|
+
* module state - usually 3rd party node_modules) exported for testing
|
|
4711
|
+
* @param cssText the CSS text to split
|
|
4712
|
+
* @returns the font-face rules joined together (`null` if there were none) and the remaining CSS
|
|
4713
|
+
*/
|
|
4714
|
+
function splitFontFaces(cssText) {
|
|
4715
|
+
const fontFaces = cssText.match(FONT_FACE_RE);
|
|
4716
|
+
if (!fontFaces) return {
|
|
4717
|
+
fontFaceText: null,
|
|
4718
|
+
rest: cssText
|
|
4719
|
+
};
|
|
4720
|
+
return {
|
|
4721
|
+
fontFaceText: fontFaces.join("\n"),
|
|
4722
|
+
rest: cssText.replace(FONT_FACE_RE, "")
|
|
4723
|
+
};
|
|
4724
|
+
}
|
|
4725
|
+
/**
|
|
4726
|
+
* Applies plain (non-component) CSS text to every registered root - respects shadow DOM
|
|
4727
|
+
* encapsulation instead of always reaching for the top-level document. Not meant to be called
|
|
4728
|
+
* directly: this is what the compiler's CSS-to-ESM output calls for CSS with no Stencil `tag`
|
|
4729
|
+
* (i.e. not a component's own `styleUrl`), typically a third-party dependency's CSS import.
|
|
4730
|
+
*
|
|
4731
|
+
* `@font-face` rules are pulled out and adopted onto top-level `document` not per-root
|
|
4732
|
+
* (Chromium (https://issues.chromium.org/issues/41085401) per-root never loads).
|
|
4733
|
+
* @param cssText the CSS text to apply
|
|
4734
|
+
*/
|
|
4735
|
+
function injectSideEffectStyle(cssText) {
|
|
4736
|
+
const { fontFaceText, rest } = splitFontFaces(cssText);
|
|
4737
|
+
if (fontFaceText && !knownFontFaces.has(fontFaceText)) {
|
|
4738
|
+
knownFontFaces.add(fontFaceText);
|
|
4739
|
+
const fontFaceSheet = new CSSStyleSheet();
|
|
4740
|
+
fontFaceSheet.replaceSync(fontFaceText);
|
|
4741
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets, fontFaceSheet];
|
|
4742
|
+
}
|
|
4743
|
+
if (!rest.trim()) return;
|
|
4744
|
+
let sheet = styleSheets.get(rest);
|
|
4745
|
+
if (!sheet) {
|
|
4746
|
+
sheet = new CSSStyleSheet();
|
|
4747
|
+
sheet.replaceSync(rest);
|
|
4748
|
+
styleSheets.set(rest, sheet);
|
|
4749
|
+
}
|
|
4750
|
+
for (const root of knownRoots) adopt(root, sheet);
|
|
4751
|
+
}
|
|
4752
|
+
//#endregion
|
|
4663
4753
|
//#region src/runtime/mixin.ts
|
|
4664
4754
|
const baseClass = BUILD$1.lazyLoad ? class {} : globalThis.HTMLElement || class {};
|
|
4665
4755
|
function Mixin(...mixins) {
|
|
@@ -5363,4 +5453,4 @@ const setScopedSsr = (opts) => {
|
|
|
5363
5453
|
const needsScopedSSR = () => scopedSSR;
|
|
5364
5454
|
let scopedSSR = false;
|
|
5365
5455
|
//#endregion
|
|
5366
|
-
export { BUILD, Build, Env, Fragment, Host, Mixin, NAMESPACE, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRenderingRef, getShadowRoot, getValue, hAsync as h, insertVdomAnnotations, isMemberInElement, jsx, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, parsePropertyValue, plt, postUpdateComponent, proxyComponent, proxyCustomElement, readTask, registerComponents, registerHost, registerInstance, renderVdom, setAssetPath, setErrorHandler, setMode, setNonce, setPlatformHelpers, setScopedSsr, setTagTransformer, setValue, ssrApp, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, transformTag, win, writeTask };
|
|
5456
|
+
export { BUILD, Build, Env, Fragment, Host, Mixin, NAMESPACE, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRenderingRef, getShadowRoot, getValue, hAsync as h, injectSideEffectStyle, insertVdomAnnotations, isMemberInElement, jsx, jsxs, loadModule, modeResolutionChain, needsScopedSSR, nextTick, parsePropertyValue, plt, postUpdateComponent, proxyComponent, proxyCustomElement, readTask, registerComponents, registerHost, registerInstance, registerSideEffectStyleTarget, renderVdom, setAssetPath, setErrorHandler, setMode, setNonce, setPlatformHelpers, setScopedSsr, setTagTransformer, setValue, ssrApp, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, transformTag, unregisterSideEffectStyleTarget, win, writeTask };
|
package/dist/sys/node/worker.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as createWorkerMessageHandler } from "../../compiler-
|
|
1
|
+
import { l as createWorkerMessageHandler } from "../../compiler-C8yf59oh.mjs";
|
|
2
2
|
import { t as createNodeSys } from "../../node-75gQKkFz.mjs";
|
|
3
3
|
//#region src/sys/node/node-worker-thread.ts
|
|
4
4
|
/**
|