@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.
- package/dist/app-data/index.d.ts +1 -1
- package/dist/{client-BRu0GtRn.mjs → client-Db2rdxUM.mjs} +34 -13
- package/dist/compiler/browser.d.ts +1534 -0
- package/dist/compiler/browser.js +16472 -0
- package/dist/compiler/index.d.mts +1 -1
- package/dist/compiler/index.mjs +2 -2
- package/dist/compiler/utils/index.d.mts +1 -1
- package/dist/{compiler-NrvbUOX1.mjs → compiler-PoywOlbq.mjs} +570 -176
- package/dist/declarations/stencil-public-compiler.d.ts +20 -4
- package/dist/declarations/stencil-public-runtime.d.ts +21 -5
- package/dist/{index-BOrz3rbJ.d.mts → index-BAP9T4CB.d.mts} +1 -1
- package/dist/{index-DnISpqrd.d.ts → index-BXAcVN2j.d.ts} +3 -11
- package/dist/{index-RrQfiPWK.d.mts → index-BvF31nqP.d.mts} +20 -4
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +82 -2
- package/dist/jsx-runtime.mjs +1 -1
- package/dist/{node-75gQKkFz.mjs → node-BKtLn2R9.mjs} +1 -1
- package/dist/runtime/client/lazy.js +137 -26
- package/dist/runtime/client/runtime.d.ts +30 -12
- package/dist/runtime/client/runtime.js +137 -26
- package/dist/runtime/index.d.ts +28 -2
- package/dist/runtime/index.js +137 -26
- package/dist/runtime/server/index.d.mts +27 -1
- package/dist/runtime/server/index.mjs +135 -24
- package/dist/sys/node/index.d.mts +1 -1
- package/dist/sys/node/index.mjs +1 -1
- package/dist/sys/node/worker.mjs +2 -2
- package/dist/testing/index.d.mts +19 -3
- package/dist/testing/index.mjs +58 -68
- package/package.json +9 -5
|
@@ -2,9 +2,6 @@ import { BUILD, Env, NAMESPACE } from "@stencil/core/app-data";
|
|
|
2
2
|
import "rolldown";
|
|
3
3
|
import "typescript";
|
|
4
4
|
//#region src/declarations/stencil-public-runtime.d.ts
|
|
5
|
-
interface ElementDecorator {
|
|
6
|
-
(): PropertyDecorator;
|
|
7
|
-
}
|
|
8
5
|
interface EventDecorator {
|
|
9
6
|
(opts?: EventOptions): PropertyDecorator;
|
|
10
7
|
}
|
|
@@ -32,11 +29,6 @@ interface UserBuildConditionals {
|
|
|
32
29
|
isServer: boolean;
|
|
33
30
|
isTesting: boolean;
|
|
34
31
|
}
|
|
35
|
-
/**
|
|
36
|
-
* The `@Element()` decorator is a reference to the actual host element
|
|
37
|
-
* once it has rendered.
|
|
38
|
-
*/
|
|
39
|
-
declare const Element$2: ElementDecorator;
|
|
40
32
|
/**
|
|
41
33
|
* Components can emit data and events using the Event Emitter decorator.
|
|
42
34
|
* To dispatch Custom DOM events for other components to handle, use the
|
|
@@ -471,7 +463,7 @@ declare namespace JSXBase {
|
|
|
471
463
|
type?: string;
|
|
472
464
|
value?: string | string[] | number;
|
|
473
465
|
popoverTargetAction?: string;
|
|
474
|
-
popoverTargetElement?: Element
|
|
466
|
+
popoverTargetElement?: globalThis.Element | null;
|
|
475
467
|
popoverTarget?: string;
|
|
476
468
|
command?: string;
|
|
477
469
|
commandFor?: string;
|
|
@@ -643,7 +635,7 @@ declare namespace JSXBase {
|
|
|
643
635
|
webkitEntries?: any;
|
|
644
636
|
width?: number | string;
|
|
645
637
|
popoverTargetAction?: string;
|
|
646
|
-
popoverTargetElement?: Element
|
|
638
|
+
popoverTargetElement?: globalThis.Element | null;
|
|
647
639
|
popoverTarget?: string;
|
|
648
640
|
}
|
|
649
641
|
interface KeygenHTMLAttributes<T> extends HTMLAttributes<T> {
|
|
@@ -1349,7 +1341,7 @@ declare namespace JSXBase {
|
|
|
1349
1341
|
[key: `aria${string}`]: string | boolean | undefined;
|
|
1350
1342
|
}
|
|
1351
1343
|
}
|
|
1352
|
-
interface JSXAttributes<T = Element
|
|
1344
|
+
interface JSXAttributes<T = globalThis.Element> {
|
|
1353
1345
|
key?: string | number;
|
|
1354
1346
|
ref?: (elm?: T) => void;
|
|
1355
1347
|
children?: any;
|
|
@@ -2359,6 +2351,32 @@ declare const Fragment: FunctionalComponent;
|
|
|
2359
2351
|
//#region src/runtime/host-listener.d.ts
|
|
2360
2352
|
declare const addHostEventListeners: (elm: HostElement, hostRef: HostRef, listeners?: ComponentRuntimeHostListener[]) => void;
|
|
2361
2353
|
//#endregion
|
|
2354
|
+
//#region src/runtime/inject-side-effect-style.d.ts
|
|
2355
|
+
/**
|
|
2356
|
+
* Registers a root (a shadow root, or `document`) to receive every side-effect CSS import
|
|
2357
|
+
* (a plain, non-component `import './foo.css'`), now and in future. Call in `connectedCallback`,
|
|
2358
|
+
* paired with `unregisterSideEffectStyleTarget` in `disconnectedCallback` so the registry doesn't
|
|
2359
|
+
* hold disconnected roots forever.
|
|
2360
|
+
* @param root the root to register
|
|
2361
|
+
*/
|
|
2362
|
+
declare function registerSideEffectStyleTarget(root: DocumentOrShadowRoot): void;
|
|
2363
|
+
/**
|
|
2364
|
+
* Removes a root registered via `registerSideEffectStyleTarget` - call in `disconnectedCallback`.
|
|
2365
|
+
* @param root the root to unregister
|
|
2366
|
+
*/
|
|
2367
|
+
declare function unregisterSideEffectStyleTarget(root: DocumentOrShadowRoot): void;
|
|
2368
|
+
/**
|
|
2369
|
+
* Applies plain (non-component) CSS text to every registered root - respects shadow DOM
|
|
2370
|
+
* encapsulation instead of always reaching for the top-level document. Not meant to be called
|
|
2371
|
+
* directly: this is what the compiler's CSS-to-ESM output calls for CSS with no Stencil `tag`
|
|
2372
|
+
* (i.e. not a component's own `styleUrl`), typically a third-party dependency's CSS import.
|
|
2373
|
+
*
|
|
2374
|
+
* `@font-face` rules are pulled out and adopted onto top-level `document` not per-root
|
|
2375
|
+
* (Chromium (https://issues.chromium.org/issues/41085401) per-root never loads).
|
|
2376
|
+
* @param cssText the CSS text to apply
|
|
2377
|
+
*/
|
|
2378
|
+
declare function injectSideEffectStyle(cssText: string): void;
|
|
2379
|
+
//#endregion
|
|
2362
2380
|
//#region src/runtime/mixin.d.ts
|
|
2363
2381
|
type Ctor<T = {}> = new (...args: any[]) => T;
|
|
2364
2382
|
declare function Mixin(...mixins: ((base: Ctor) => Ctor)[]): Ctor<{}>;
|
|
@@ -2522,4 +2540,4 @@ declare const jsxs: typeof jsx;
|
|
|
2522
2540
|
*/
|
|
2523
2541
|
declare const jsxDEV: typeof jsx;
|
|
2524
2542
|
//#endregion
|
|
2525
|
-
export { AttachInternals, AttrDeserialize, BUILD, Build, Component, Element$1 as Element, Env, Event, Fragment, H, H as HTMLElement, type HTMLStencilElement, HYDRATED_STYLE_ID, Host, type JSXBase, 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 };
|
|
2543
|
+
export { AttachInternals, AttrDeserialize, BUILD, Build, Component, Element$1 as Element, Env, Event, Fragment, H, H as HTMLElement, type HTMLStencilElement, HYDRATED_STYLE_ID, Host, type JSXBase, 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 };
|
|
@@ -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$/ */
|
|
@@ -1977,16 +1977,33 @@ const signalNodeDisposers = /* @__PURE__ */ new WeakMap();
|
|
|
1977
1977
|
const disposeSignalVNode = (vnode) => {
|
|
1978
1978
|
const elm = vnode.$elm$;
|
|
1979
1979
|
if (elm) {
|
|
1980
|
-
|
|
1981
|
-
if (dispose) {
|
|
1982
|
-
dispose();
|
|
1983
|
-
signalNodeDisposers.delete(elm);
|
|
1984
|
-
}
|
|
1980
|
+
disposeTextSignal(elm);
|
|
1985
1981
|
disposeAllSignalAttrs(elm);
|
|
1986
1982
|
}
|
|
1987
1983
|
vnode.$children$?.forEach(disposeSignalVNode);
|
|
1988
1984
|
};
|
|
1989
1985
|
/**
|
|
1986
|
+
* Tear down a text node's signal subscription, if it has one.
|
|
1987
|
+
* @param textNode the text node to unsubscribe
|
|
1988
|
+
*/
|
|
1989
|
+
const disposeTextSignal = (textNode) => {
|
|
1990
|
+
const dispose = signalNodeDisposers.get(textNode);
|
|
1991
|
+
if (dispose) {
|
|
1992
|
+
dispose();
|
|
1993
|
+
signalNodeDisposers.delete(textNode);
|
|
1994
|
+
}
|
|
1995
|
+
};
|
|
1996
|
+
/**
|
|
1997
|
+
* Subscribe a text node to a signal, keeping its `data` in sync on every change.
|
|
1998
|
+
* @param textNode the text node to keep in sync
|
|
1999
|
+
* @param textSig the signal to subscribe to
|
|
2000
|
+
*/
|
|
2001
|
+
const wireTextSignal = (textNode, textSig) => {
|
|
2002
|
+
signalNodeDisposers.set(textNode, effect$1(() => {
|
|
2003
|
+
textNode.data = String(textSig.value);
|
|
2004
|
+
}));
|
|
2005
|
+
};
|
|
2006
|
+
/**
|
|
1990
2007
|
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
1991
2008
|
*
|
|
1992
2009
|
* @param oldParentVNode the parent VNode from the previous render
|
|
@@ -2008,13 +2025,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2008
2025
|
if (BUILD$1.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`);
|
|
2009
2026
|
if (BUILD$1.vdomText && newVNode.$text$ != null) {
|
|
2010
2027
|
elm = newVNode.$elm$ = win.document.createTextNode(newVNode.$text$);
|
|
2011
|
-
if (BUILD$1.vdomSignals && newVNode.$signal$)
|
|
2012
|
-
const textSig = newVNode.$signal$;
|
|
2013
|
-
const textNode = elm;
|
|
2014
|
-
signalNodeDisposers.set(textNode, effect$1(() => {
|
|
2015
|
-
textNode.data = String(textSig.value);
|
|
2016
|
-
}));
|
|
2017
|
-
}
|
|
2028
|
+
if (BUILD$1.vdomSignals && newVNode.$signal$) wireTextSignal(elm, newVNode.$signal$);
|
|
2018
2029
|
} else if (BUILD$1.slotRelocation && newVNode.$flags$ & VNODE_FLAGS.isSlotReference) {
|
|
2019
2030
|
elm = newVNode.$elm$ = BUILD$1.isDebug || BUILD$1.hydrateServerSide ? slotReferenceDebugNode(newVNode) : win.document.createTextNode("");
|
|
2020
2031
|
if (typeof newVNode.$attrs$?.slot === "string") elm["s-sa"] = newVNode.$attrs$.slot;
|
|
@@ -2375,7 +2386,17 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
|
|
|
2375
2386
|
else if (BUILD$1.hydrateClientSide && isInitialRender && BUILD$1.updatable && oldChildren !== null && newChildren === null) newVNode.$children$ = oldChildren;
|
|
2376
2387
|
if (BUILD$1.svg && isSvgMode && tag === "svg") isSvgMode = false;
|
|
2377
2388
|
} else if (BUILD$1.vdomText && BUILD$1.slotRelocation && (defaultHolder = elm["s-cr"])) defaultHolder.parentNode.textContent = text;
|
|
2378
|
-
else if (BUILD$1.vdomText
|
|
2389
|
+
else if (BUILD$1.vdomText) {
|
|
2390
|
+
if (BUILD$1.vdomSignals && newVNode.$signal$) {
|
|
2391
|
+
if (newVNode.$signal$ !== oldVNode.$signal$) {
|
|
2392
|
+
disposeTextSignal(elm);
|
|
2393
|
+
wireTextSignal(elm, newVNode.$signal$);
|
|
2394
|
+
}
|
|
2395
|
+
} else {
|
|
2396
|
+
if (BUILD$1.vdomSignals && oldVNode.$signal$) disposeTextSignal(elm);
|
|
2397
|
+
if (oldVNode.$text$ !== text) elm.data = text;
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2379
2400
|
};
|
|
2380
2401
|
/**
|
|
2381
2402
|
* Component-global information about nodes which are either currently being
|
|
@@ -3713,12 +3734,13 @@ const restoreSafeSelector = (placeholders, content) => {
|
|
|
3713
3734
|
const _polyfillHost = "-shadowcsshost";
|
|
3714
3735
|
const _polyfillSlotted = "-shadowcssslotted";
|
|
3715
3736
|
const _polyfillHostContext = "-shadowcsscontext";
|
|
3737
|
+
const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
|
|
3716
3738
|
let _cssColonHostRe;
|
|
3717
3739
|
let _cssColonHostContextRe;
|
|
3718
3740
|
let _cssColonSlottedRe;
|
|
3719
|
-
const getCssColonHostRe = () => _cssColonHostRe ??=
|
|
3720
|
-
const getCssColonHostContextRe = () => _cssColonHostContextRe ??=
|
|
3721
|
-
const getCssColonSlottedRe = () => _cssColonSlottedRe ??=
|
|
3741
|
+
const getCssColonHostRe = () => _cssColonHostRe ??= new RegExp("(-shadowcsshost" + _parenSuffix, "gim");
|
|
3742
|
+
const getCssColonHostContextRe = () => _cssColonHostContextRe ??= new RegExp("(-shadowcsscontext" + _parenSuffix, "gim");
|
|
3743
|
+
const getCssColonSlottedRe = () => _cssColonSlottedRe ??= new RegExp("(-shadowcssslotted" + _parenSuffix, "gim");
|
|
3722
3744
|
const _polyfillHostNoCombinator = "-shadowcsshost-no-combinator";
|
|
3723
3745
|
const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
|
|
3724
3746
|
const _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
|
|
@@ -3981,12 +4003,13 @@ const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector)
|
|
|
3981
4003
|
else return shallowPart.trim();
|
|
3982
4004
|
}).join(", ");
|
|
3983
4005
|
};
|
|
4006
|
+
const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer");
|
|
3984
4007
|
const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
|
|
3985
4008
|
return processRules(cssText, (rule) => {
|
|
3986
4009
|
let selector = rule.selector;
|
|
3987
4010
|
let content = rule.content;
|
|
3988
4011
|
if (rule.selector[0] !== "@") selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
|
|
3989
|
-
else if (
|
|
4012
|
+
else if (isScopableAtRule(rule.selector)) content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector);
|
|
3990
4013
|
return {
|
|
3991
4014
|
selector: selector.replace(/\s{2,}/g, " ").trim(),
|
|
3992
4015
|
content
|
|
@@ -4078,14 +4101,12 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
|
4078
4101
|
rule.selector = placeholder + rule.selector;
|
|
4079
4102
|
return rule;
|
|
4080
4103
|
};
|
|
4081
|
-
|
|
4104
|
+
const commentSelectors = (input) => processRules(input, (rule) => {
|
|
4082
4105
|
if (rule.selector[0] !== "@") return processCommentedSelector(rule);
|
|
4083
|
-
|
|
4084
|
-
rule.content = processRules(rule.content, processCommentedSelector);
|
|
4085
|
-
return rule;
|
|
4086
|
-
}
|
|
4106
|
+
if (isScopableAtRule(rule.selector)) rule.content = commentSelectors(rule.content);
|
|
4087
4107
|
return rule;
|
|
4088
4108
|
});
|
|
4109
|
+
cssText = commentSelectors(cssText);
|
|
4089
4110
|
}
|
|
4090
4111
|
const scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector);
|
|
4091
4112
|
cssText = [scoped.cssText, ...commentsWithHash].join("\n");
|
|
@@ -4284,6 +4305,14 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
4284
4305
|
//#endregion
|
|
4285
4306
|
//#region src/runtime/proxy-component.ts
|
|
4286
4307
|
/**
|
|
4308
|
+
* Serialize a prop value the way `setAccessor()` does when it reflects it, so the runtime can
|
|
4309
|
+
* recognize an `attributeChangedCallback` it triggered itself.
|
|
4310
|
+
*
|
|
4311
|
+
* @param propValue the current value of a reflected prop
|
|
4312
|
+
* @returns the string the attribute would hold, or `null` if the attribute would be removed
|
|
4313
|
+
*/
|
|
4314
|
+
const reflectedAttrValue = (propValue) => propValue == null || propValue === false ? null : propValue === true ? "" : String(propValue);
|
|
4315
|
+
/**
|
|
4287
4316
|
* Attach a series of runtime constructs to a compiled Stencil component
|
|
4288
4317
|
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
4289
4318
|
* decorators, callbacks for when attributes change, and so on.
|
|
@@ -4431,7 +4460,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4431
4460
|
return;
|
|
4432
4461
|
}
|
|
4433
4462
|
const propFlags = members.find(([m]) => m === propName);
|
|
4434
|
-
const
|
|
4463
|
+
const propMemberFlags = propFlags ? propFlags[1][0] : 0;
|
|
4464
|
+
const isBooleanTarget = propMemberFlags & MEMBER_FLAGS.Boolean;
|
|
4465
|
+
if (BUILD$1.reflect && propMemberFlags & MEMBER_FLAGS.ReflectAttr && propMemberFlags & MEMBER_FLAGS.Any && !isComplexType(this[propName]) && reflectedAttrValue(this[propName]) === newValue) return;
|
|
4435
4466
|
const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
|
|
4436
4467
|
if (isBooleanTarget) newValue = !(newValue === null || newValue === "false");
|
|
4437
4468
|
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
@@ -5047,6 +5078,86 @@ const hostListenerOpts = (flags) => supportsListenerOptions ? {
|
|
|
5047
5078
|
capture: (flags & LISTENER_FLAGS.Capture) !== 0
|
|
5048
5079
|
} : (flags & LISTENER_FLAGS.Capture) !== 0;
|
|
5049
5080
|
//#endregion
|
|
5081
|
+
//#region src/runtime/inject-side-effect-style.ts
|
|
5082
|
+
const styleSheets = /* @__PURE__ */ new Map();
|
|
5083
|
+
const knownRoots = /* @__PURE__ */ new Set();
|
|
5084
|
+
const adoptedRoots = /* @__PURE__ */ new WeakMap();
|
|
5085
|
+
const knownFontFaces = /* @__PURE__ */ new Set();
|
|
5086
|
+
const adopt = (root, sheet) => {
|
|
5087
|
+
let roots = adoptedRoots.get(sheet);
|
|
5088
|
+
if (!roots) {
|
|
5089
|
+
roots = /* @__PURE__ */ new WeakSet();
|
|
5090
|
+
adoptedRoots.set(sheet, roots);
|
|
5091
|
+
}
|
|
5092
|
+
if (!roots.has(root)) {
|
|
5093
|
+
roots.add(root);
|
|
5094
|
+
root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
|
|
5095
|
+
}
|
|
5096
|
+
};
|
|
5097
|
+
/**
|
|
5098
|
+
* Registers a root (a shadow root, or `document`) to receive every side-effect CSS import
|
|
5099
|
+
* (a plain, non-component `import './foo.css'`), now and in future. Call in `connectedCallback`,
|
|
5100
|
+
* paired with `unregisterSideEffectStyleTarget` in `disconnectedCallback` so the registry doesn't
|
|
5101
|
+
* hold disconnected roots forever.
|
|
5102
|
+
* @param root the root to register
|
|
5103
|
+
*/
|
|
5104
|
+
function registerSideEffectStyleTarget(root) {
|
|
5105
|
+
knownRoots.add(root);
|
|
5106
|
+
for (const sheet of styleSheets.values()) adopt(root, sheet);
|
|
5107
|
+
}
|
|
5108
|
+
/**
|
|
5109
|
+
* Removes a root registered via `registerSideEffectStyleTarget` - call in `disconnectedCallback`.
|
|
5110
|
+
* @param root the root to unregister
|
|
5111
|
+
*/
|
|
5112
|
+
function unregisterSideEffectStyleTarget(root) {
|
|
5113
|
+
knownRoots.delete(root);
|
|
5114
|
+
}
|
|
5115
|
+
const FONT_FACE_RE = /@font-face\s*\{[^{}]*\}/g;
|
|
5116
|
+
/**
|
|
5117
|
+
* Splits `@font-face` rules out of a CSS text - exported standalone (from private
|
|
5118
|
+
* module state - usually 3rd party node_modules) exported for testing
|
|
5119
|
+
* @param cssText the CSS text to split
|
|
5120
|
+
* @returns the font-face rules joined together (`null` if there were none) and the remaining CSS
|
|
5121
|
+
*/
|
|
5122
|
+
function splitFontFaces(cssText) {
|
|
5123
|
+
const fontFaces = cssText.match(FONT_FACE_RE);
|
|
5124
|
+
if (!fontFaces) return {
|
|
5125
|
+
fontFaceText: null,
|
|
5126
|
+
rest: cssText
|
|
5127
|
+
};
|
|
5128
|
+
return {
|
|
5129
|
+
fontFaceText: fontFaces.join("\n"),
|
|
5130
|
+
rest: cssText.replace(FONT_FACE_RE, "")
|
|
5131
|
+
};
|
|
5132
|
+
}
|
|
5133
|
+
/**
|
|
5134
|
+
* Applies plain (non-component) CSS text to every registered root - respects shadow DOM
|
|
5135
|
+
* encapsulation instead of always reaching for the top-level document. Not meant to be called
|
|
5136
|
+
* directly: this is what the compiler's CSS-to-ESM output calls for CSS with no Stencil `tag`
|
|
5137
|
+
* (i.e. not a component's own `styleUrl`), typically a third-party dependency's CSS import.
|
|
5138
|
+
*
|
|
5139
|
+
* `@font-face` rules are pulled out and adopted onto top-level `document` not per-root
|
|
5140
|
+
* (Chromium (https://issues.chromium.org/issues/41085401) per-root never loads).
|
|
5141
|
+
* @param cssText the CSS text to apply
|
|
5142
|
+
*/
|
|
5143
|
+
function injectSideEffectStyle(cssText) {
|
|
5144
|
+
const { fontFaceText, rest } = splitFontFaces(cssText);
|
|
5145
|
+
if (fontFaceText && !knownFontFaces.has(fontFaceText)) {
|
|
5146
|
+
knownFontFaces.add(fontFaceText);
|
|
5147
|
+
const fontFaceSheet = new CSSStyleSheet();
|
|
5148
|
+
fontFaceSheet.replaceSync(fontFaceText);
|
|
5149
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets, fontFaceSheet];
|
|
5150
|
+
}
|
|
5151
|
+
if (!rest.trim()) return;
|
|
5152
|
+
let sheet = styleSheets.get(rest);
|
|
5153
|
+
if (!sheet) {
|
|
5154
|
+
sheet = new CSSStyleSheet();
|
|
5155
|
+
sheet.replaceSync(rest);
|
|
5156
|
+
styleSheets.set(rest, sheet);
|
|
5157
|
+
}
|
|
5158
|
+
for (const root of knownRoots) adopt(root, sheet);
|
|
5159
|
+
}
|
|
5160
|
+
//#endregion
|
|
5050
5161
|
//#region src/runtime/mixin.ts
|
|
5051
5162
|
const baseClass = BUILD$1.lazyLoad ? class {} : globalThis.HTMLElement || class {};
|
|
5052
5163
|
function Mixin(...mixins) {
|
|
@@ -5218,4 +5329,4 @@ function hasKeys(obj) {
|
|
|
5218
5329
|
return false;
|
|
5219
5330
|
}
|
|
5220
5331
|
//#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 };
|
|
5332
|
+
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$/ */
|
|
@@ -1849,16 +1849,33 @@ const signalNodeDisposers = /* @__PURE__ */ new WeakMap();
|
|
|
1849
1849
|
const disposeSignalVNode = (vnode) => {
|
|
1850
1850
|
const elm = vnode.$elm$;
|
|
1851
1851
|
if (elm) {
|
|
1852
|
-
|
|
1853
|
-
if (dispose) {
|
|
1854
|
-
dispose();
|
|
1855
|
-
signalNodeDisposers.delete(elm);
|
|
1856
|
-
}
|
|
1852
|
+
disposeTextSignal(elm);
|
|
1857
1853
|
disposeAllSignalAttrs(elm);
|
|
1858
1854
|
}
|
|
1859
1855
|
vnode.$children$?.forEach(disposeSignalVNode);
|
|
1860
1856
|
};
|
|
1861
1857
|
/**
|
|
1858
|
+
* Tear down a text node's signal subscription, if it has one.
|
|
1859
|
+
* @param textNode the text node to unsubscribe
|
|
1860
|
+
*/
|
|
1861
|
+
const disposeTextSignal = (textNode) => {
|
|
1862
|
+
const dispose = signalNodeDisposers.get(textNode);
|
|
1863
|
+
if (dispose) {
|
|
1864
|
+
dispose();
|
|
1865
|
+
signalNodeDisposers.delete(textNode);
|
|
1866
|
+
}
|
|
1867
|
+
};
|
|
1868
|
+
/**
|
|
1869
|
+
* Subscribe a text node to a signal, keeping its `data` in sync on every change.
|
|
1870
|
+
* @param textNode the text node to keep in sync
|
|
1871
|
+
* @param textSig the signal to subscribe to
|
|
1872
|
+
*/
|
|
1873
|
+
const wireTextSignal = (textNode, textSig) => {
|
|
1874
|
+
signalNodeDisposers.set(textNode, effect$1(() => {
|
|
1875
|
+
textNode.data = String(textSig.value);
|
|
1876
|
+
}));
|
|
1877
|
+
};
|
|
1878
|
+
/**
|
|
1862
1879
|
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
1863
1880
|
*
|
|
1864
1881
|
* @param oldParentVNode the parent VNode from the previous render
|
|
@@ -1880,13 +1897,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
1880
1897
|
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`);
|
|
1881
1898
|
if (BUILD.vdomText && newVNode.$text$ != null) {
|
|
1882
1899
|
elm = newVNode.$elm$ = win.document.createTextNode(newVNode.$text$);
|
|
1883
|
-
if (BUILD.vdomSignals && newVNode.$signal$)
|
|
1884
|
-
const textSig = newVNode.$signal$;
|
|
1885
|
-
const textNode = elm;
|
|
1886
|
-
signalNodeDisposers.set(textNode, effect$1(() => {
|
|
1887
|
-
textNode.data = String(textSig.value);
|
|
1888
|
-
}));
|
|
1889
|
-
}
|
|
1900
|
+
if (BUILD.vdomSignals && newVNode.$signal$) wireTextSignal(elm, newVNode.$signal$);
|
|
1890
1901
|
} else if (BUILD.slotRelocation && newVNode.$flags$ & VNODE_FLAGS.isSlotReference) {
|
|
1891
1902
|
elm = newVNode.$elm$ = BUILD.isDebug || BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode) : win.document.createTextNode("");
|
|
1892
1903
|
if (typeof newVNode.$attrs$?.slot === "string") elm["s-sa"] = newVNode.$attrs$.slot;
|
|
@@ -2247,7 +2258,17 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
|
|
|
2247
2258
|
else if (BUILD.hydrateClientSide && isInitialRender && BUILD.updatable && oldChildren !== null && newChildren === null) newVNode.$children$ = oldChildren;
|
|
2248
2259
|
if (BUILD.svg && isSvgMode && tag === "svg") isSvgMode = false;
|
|
2249
2260
|
} else if (BUILD.vdomText && BUILD.slotRelocation && (defaultHolder = elm["s-cr"])) defaultHolder.parentNode.textContent = text;
|
|
2250
|
-
else if (BUILD.vdomText
|
|
2261
|
+
else if (BUILD.vdomText) {
|
|
2262
|
+
if (BUILD.vdomSignals && newVNode.$signal$) {
|
|
2263
|
+
if (newVNode.$signal$ !== oldVNode.$signal$) {
|
|
2264
|
+
disposeTextSignal(elm);
|
|
2265
|
+
wireTextSignal(elm, newVNode.$signal$);
|
|
2266
|
+
}
|
|
2267
|
+
} else {
|
|
2268
|
+
if (BUILD.vdomSignals && oldVNode.$signal$) disposeTextSignal(elm);
|
|
2269
|
+
if (oldVNode.$text$ !== text) elm.data = text;
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2251
2272
|
};
|
|
2252
2273
|
/**
|
|
2253
2274
|
* Component-global information about nodes which are either currently being
|
|
@@ -3585,12 +3606,13 @@ const restoreSafeSelector = (placeholders, content) => {
|
|
|
3585
3606
|
const _polyfillHost = "-shadowcsshost";
|
|
3586
3607
|
const _polyfillSlotted = "-shadowcssslotted";
|
|
3587
3608
|
const _polyfillHostContext = "-shadowcsscontext";
|
|
3609
|
+
const _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
|
|
3588
3610
|
let _cssColonHostRe;
|
|
3589
3611
|
let _cssColonHostContextRe;
|
|
3590
3612
|
let _cssColonSlottedRe;
|
|
3591
|
-
const getCssColonHostRe = () => _cssColonHostRe ??=
|
|
3592
|
-
const getCssColonHostContextRe = () => _cssColonHostContextRe ??=
|
|
3593
|
-
const getCssColonSlottedRe = () => _cssColonSlottedRe ??=
|
|
3613
|
+
const getCssColonHostRe = () => _cssColonHostRe ??= new RegExp("(-shadowcsshost" + _parenSuffix, "gim");
|
|
3614
|
+
const getCssColonHostContextRe = () => _cssColonHostContextRe ??= new RegExp("(-shadowcsscontext" + _parenSuffix, "gim");
|
|
3615
|
+
const getCssColonSlottedRe = () => _cssColonSlottedRe ??= new RegExp("(-shadowcssslotted" + _parenSuffix, "gim");
|
|
3594
3616
|
const _polyfillHostNoCombinator = "-shadowcsshost-no-combinator";
|
|
3595
3617
|
const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
|
|
3596
3618
|
const _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
|
|
@@ -3853,12 +3875,13 @@ const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector)
|
|
|
3853
3875
|
else return shallowPart.trim();
|
|
3854
3876
|
}).join(", ");
|
|
3855
3877
|
};
|
|
3878
|
+
const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer");
|
|
3856
3879
|
const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
|
|
3857
3880
|
return processRules(cssText, (rule) => {
|
|
3858
3881
|
let selector = rule.selector;
|
|
3859
3882
|
let content = rule.content;
|
|
3860
3883
|
if (rule.selector[0] !== "@") selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
|
|
3861
|
-
else if (
|
|
3884
|
+
else if (isScopableAtRule(rule.selector)) content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector);
|
|
3862
3885
|
return {
|
|
3863
3886
|
selector: selector.replace(/\s{2,}/g, " ").trim(),
|
|
3864
3887
|
content
|
|
@@ -3950,14 +3973,12 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
|
3950
3973
|
rule.selector = placeholder + rule.selector;
|
|
3951
3974
|
return rule;
|
|
3952
3975
|
};
|
|
3953
|
-
|
|
3976
|
+
const commentSelectors = (input) => processRules(input, (rule) => {
|
|
3954
3977
|
if (rule.selector[0] !== "@") return processCommentedSelector(rule);
|
|
3955
|
-
|
|
3956
|
-
rule.content = processRules(rule.content, processCommentedSelector);
|
|
3957
|
-
return rule;
|
|
3958
|
-
}
|
|
3978
|
+
if (isScopableAtRule(rule.selector)) rule.content = commentSelectors(rule.content);
|
|
3959
3979
|
return rule;
|
|
3960
3980
|
});
|
|
3981
|
+
cssText = commentSelectors(cssText);
|
|
3961
3982
|
}
|
|
3962
3983
|
const scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector);
|
|
3963
3984
|
cssText = [scoped.cssText, ...commentsWithHash].join("\n");
|
|
@@ -4156,6 +4177,14 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
4156
4177
|
//#endregion
|
|
4157
4178
|
//#region src/runtime/proxy-component.ts
|
|
4158
4179
|
/**
|
|
4180
|
+
* Serialize a prop value the way `setAccessor()` does when it reflects it, so the runtime can
|
|
4181
|
+
* recognize an `attributeChangedCallback` it triggered itself.
|
|
4182
|
+
*
|
|
4183
|
+
* @param propValue the current value of a reflected prop
|
|
4184
|
+
* @returns the string the attribute would hold, or `null` if the attribute would be removed
|
|
4185
|
+
*/
|
|
4186
|
+
const reflectedAttrValue = (propValue) => propValue == null || propValue === false ? null : propValue === true ? "" : String(propValue);
|
|
4187
|
+
/**
|
|
4159
4188
|
* Attach a series of runtime constructs to a compiled Stencil component
|
|
4160
4189
|
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
4161
4190
|
* decorators, callbacks for when attributes change, and so on.
|
|
@@ -4303,7 +4332,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4303
4332
|
return;
|
|
4304
4333
|
}
|
|
4305
4334
|
const propFlags = members.find(([m]) => m === propName);
|
|
4306
|
-
const
|
|
4335
|
+
const propMemberFlags = propFlags ? propFlags[1][0] : 0;
|
|
4336
|
+
const isBooleanTarget = propMemberFlags & MEMBER_FLAGS.Boolean;
|
|
4337
|
+
if (BUILD.reflect && propMemberFlags & MEMBER_FLAGS.ReflectAttr && propMemberFlags & MEMBER_FLAGS.Any && !isComplexType(this[propName]) && reflectedAttrValue(this[propName]) === newValue) return;
|
|
4307
4338
|
const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
|
|
4308
4339
|
if (isBooleanTarget) newValue = !(newValue === null || newValue === "false");
|
|
4309
4340
|
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
@@ -4919,6 +4950,86 @@ const hostListenerOpts = (flags) => supportsListenerOptions ? {
|
|
|
4919
4950
|
capture: (flags & LISTENER_FLAGS.Capture) !== 0
|
|
4920
4951
|
} : (flags & LISTENER_FLAGS.Capture) !== 0;
|
|
4921
4952
|
//#endregion
|
|
4953
|
+
//#region src/runtime/inject-side-effect-style.ts
|
|
4954
|
+
const styleSheets = /* @__PURE__ */ new Map();
|
|
4955
|
+
const knownRoots = /* @__PURE__ */ new Set();
|
|
4956
|
+
const adoptedRoots = /* @__PURE__ */ new WeakMap();
|
|
4957
|
+
const knownFontFaces = /* @__PURE__ */ new Set();
|
|
4958
|
+
const adopt = (root, sheet) => {
|
|
4959
|
+
let roots = adoptedRoots.get(sheet);
|
|
4960
|
+
if (!roots) {
|
|
4961
|
+
roots = /* @__PURE__ */ new WeakSet();
|
|
4962
|
+
adoptedRoots.set(sheet, roots);
|
|
4963
|
+
}
|
|
4964
|
+
if (!roots.has(root)) {
|
|
4965
|
+
roots.add(root);
|
|
4966
|
+
root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
|
|
4967
|
+
}
|
|
4968
|
+
};
|
|
4969
|
+
/**
|
|
4970
|
+
* Registers a root (a shadow root, or `document`) to receive every side-effect CSS import
|
|
4971
|
+
* (a plain, non-component `import './foo.css'`), now and in future. Call in `connectedCallback`,
|
|
4972
|
+
* paired with `unregisterSideEffectStyleTarget` in `disconnectedCallback` so the registry doesn't
|
|
4973
|
+
* hold disconnected roots forever.
|
|
4974
|
+
* @param root the root to register
|
|
4975
|
+
*/
|
|
4976
|
+
function registerSideEffectStyleTarget(root) {
|
|
4977
|
+
knownRoots.add(root);
|
|
4978
|
+
for (const sheet of styleSheets.values()) adopt(root, sheet);
|
|
4979
|
+
}
|
|
4980
|
+
/**
|
|
4981
|
+
* Removes a root registered via `registerSideEffectStyleTarget` - call in `disconnectedCallback`.
|
|
4982
|
+
* @param root the root to unregister
|
|
4983
|
+
*/
|
|
4984
|
+
function unregisterSideEffectStyleTarget(root) {
|
|
4985
|
+
knownRoots.delete(root);
|
|
4986
|
+
}
|
|
4987
|
+
const FONT_FACE_RE = /@font-face\s*\{[^{}]*\}/g;
|
|
4988
|
+
/**
|
|
4989
|
+
* Splits `@font-face` rules out of a CSS text - exported standalone (from private
|
|
4990
|
+
* module state - usually 3rd party node_modules) exported for testing
|
|
4991
|
+
* @param cssText the CSS text to split
|
|
4992
|
+
* @returns the font-face rules joined together (`null` if there were none) and the remaining CSS
|
|
4993
|
+
*/
|
|
4994
|
+
function splitFontFaces(cssText) {
|
|
4995
|
+
const fontFaces = cssText.match(FONT_FACE_RE);
|
|
4996
|
+
if (!fontFaces) return {
|
|
4997
|
+
fontFaceText: null,
|
|
4998
|
+
rest: cssText
|
|
4999
|
+
};
|
|
5000
|
+
return {
|
|
5001
|
+
fontFaceText: fontFaces.join("\n"),
|
|
5002
|
+
rest: cssText.replace(FONT_FACE_RE, "")
|
|
5003
|
+
};
|
|
5004
|
+
}
|
|
5005
|
+
/**
|
|
5006
|
+
* Applies plain (non-component) CSS text to every registered root - respects shadow DOM
|
|
5007
|
+
* encapsulation instead of always reaching for the top-level document. Not meant to be called
|
|
5008
|
+
* directly: this is what the compiler's CSS-to-ESM output calls for CSS with no Stencil `tag`
|
|
5009
|
+
* (i.e. not a component's own `styleUrl`), typically a third-party dependency's CSS import.
|
|
5010
|
+
*
|
|
5011
|
+
* `@font-face` rules are pulled out and adopted onto top-level `document` not per-root
|
|
5012
|
+
* (Chromium (https://issues.chromium.org/issues/41085401) per-root never loads).
|
|
5013
|
+
* @param cssText the CSS text to apply
|
|
5014
|
+
*/
|
|
5015
|
+
function injectSideEffectStyle(cssText) {
|
|
5016
|
+
const { fontFaceText, rest } = splitFontFaces(cssText);
|
|
5017
|
+
if (fontFaceText && !knownFontFaces.has(fontFaceText)) {
|
|
5018
|
+
knownFontFaces.add(fontFaceText);
|
|
5019
|
+
const fontFaceSheet = new CSSStyleSheet();
|
|
5020
|
+
fontFaceSheet.replaceSync(fontFaceText);
|
|
5021
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets, fontFaceSheet];
|
|
5022
|
+
}
|
|
5023
|
+
if (!rest.trim()) return;
|
|
5024
|
+
let sheet = styleSheets.get(rest);
|
|
5025
|
+
if (!sheet) {
|
|
5026
|
+
sheet = new CSSStyleSheet();
|
|
5027
|
+
sheet.replaceSync(rest);
|
|
5028
|
+
styleSheets.set(rest, sheet);
|
|
5029
|
+
}
|
|
5030
|
+
for (const root of knownRoots) adopt(root, sheet);
|
|
5031
|
+
}
|
|
5032
|
+
//#endregion
|
|
4922
5033
|
//#region src/runtime/mixin.ts
|
|
4923
5034
|
const baseClass = BUILD.lazyLoad ? class {} : globalThis.HTMLElement || class {};
|
|
4924
5035
|
function Mixin(...mixins) {
|
|
@@ -5090,4 +5201,4 @@ function hasKeys(obj) {
|
|
|
5090
5201
|
return false;
|
|
5091
5202
|
}
|
|
5092
5203
|
//#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 };
|
|
5204
|
+
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 };
|