@stencil/core 5.0.0-beta.12 → 5.0.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{client-CdFmjaQa.mjs → client-NHI55T4R.mjs} +7 -4
- package/dist/compiler/browser.d.ts +96 -54
- package/dist/compiler/browser.js +140 -18
- package/dist/compiler/index.d.mts +87 -2
- package/dist/compiler/index.mjs +3 -3
- package/dist/compiler/utils/index.d.mts +1 -1
- package/dist/{compiler-BjKDj129.mjs → compiler-Dr9JHtLp.mjs} +3571 -2384
- package/dist/declarations/stencil-public-compiler.d.ts +85 -59
- package/dist/declarations/stencil-public-docs.d.ts +23 -0
- package/dist/declarations/stencil-public-runtime.d.ts +2 -2
- package/dist/{index-CKnzMkZC.d.mts → index-BBJVAnzJ.d.mts} +2 -2
- package/dist/{index-Cw1NW9FW.d.mts → index-BilaSOF5.d.mts} +87 -61
- package/dist/index.mjs +1 -1
- package/dist/jsx-runtime.mjs +1 -1
- package/dist/{node-HKfDhPR3.mjs → node-DrwzfDH1.mjs} +1 -1
- package/dist/runtime/client/lazy.js +87 -84
- package/dist/runtime/client/runtime.d.ts +5 -6
- package/dist/runtime/client/runtime.js +87 -84
- package/dist/runtime/index.d.ts +2 -3
- package/dist/runtime/index.js +85 -82
- package/dist/runtime/server/index.d.mts +4 -5
- package/dist/runtime/server/index.mjs +97 -84
- package/dist/runtime/server/runner.mjs +27 -41
- 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 +77 -58
- package/dist/testing/index.mjs +167 -156
- package/package.json +5 -4
|
@@ -1101,7 +1101,7 @@ type Ctor<T = {}> = new (...args: any[]) => T;
|
|
|
1101
1101
|
declare function Mixin(...mixins: ((base: Ctor) => Ctor)[]): Ctor<{}>;
|
|
1102
1102
|
//#endregion
|
|
1103
1103
|
//#region src/runtime/mode.d.ts
|
|
1104
|
-
declare const setMode: (handler: ResolutionHandler) =>
|
|
1104
|
+
declare const setMode: (handler: ResolutionHandler) => void;
|
|
1105
1105
|
declare const getMode: (ref: RuntimeRef) => string;
|
|
1106
1106
|
//#endregion
|
|
1107
1107
|
//#region src/runtime/nonce.d.ts
|
|
@@ -1135,10 +1135,9 @@ declare const setNonce: (nonce: string) => string;
|
|
|
1135
1135
|
*
|
|
1136
1136
|
* @param propValue the new value to coerce to some type
|
|
1137
1137
|
* @param propType the type of the prop, expressed as a binary number
|
|
1138
|
-
* @param isFormAssociated whether the component is form-associated (optional)
|
|
1139
1138
|
* @returns the parsed/coerced value
|
|
1140
1139
|
*/
|
|
1141
|
-
declare const parsePropertyValue: (propValue: unknown, propType: number
|
|
1140
|
+
declare const parsePropertyValue: (propValue: unknown, propType: number) => any;
|
|
1142
1141
|
//#endregion
|
|
1143
1142
|
//#region src/runtime/proxy-component.d.ts
|
|
1144
1143
|
/**
|
|
@@ -1250,7 +1249,7 @@ declare const registerInstance: (lazyInstance: any, hostRef: HostRef) => HostRef
|
|
|
1250
1249
|
declare const registerHost: (elm: HostElement, cmpMeta: ComponentRuntimeMeta) => HostRef;
|
|
1251
1250
|
declare const Build: UserBuildConditionals;
|
|
1252
1251
|
declare const styles: StyleMap;
|
|
1253
|
-
declare const
|
|
1252
|
+
declare const modeResolver: ResolutionHandler[];
|
|
1254
1253
|
/**
|
|
1255
1254
|
* Server-side implementation of getAssetPath.
|
|
1256
1255
|
*
|
|
@@ -1275,4 +1274,4 @@ declare const setAssetPath: (path: string) => string;
|
|
|
1275
1274
|
declare const setScopedSsr: (opts: SsrFactoryOptions) => void;
|
|
1276
1275
|
declare const needsScopedSSR: () => boolean;
|
|
1277
1276
|
//#endregion
|
|
1278
|
-
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,
|
|
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, modeResolver, 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 };
|
|
@@ -1467,10 +1467,10 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
|
|
|
1467
1467
|
const isComplex = isComplexType(newValue);
|
|
1468
1468
|
if (!BUILD$1.lazyLoad) {
|
|
1469
1469
|
const isStandardAttr = ln.startsWith("aria-") || ln.startsWith("data-");
|
|
1470
|
-
if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" &&
|
|
1470
|
+
if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" && !customElements.get(elm.tagName.toLowerCase())) {
|
|
1471
1471
|
if (!elm["s-pp"]) elm["s-pp"] = /* @__PURE__ */ new Map();
|
|
1472
1472
|
elm["s-pp"].set(memberName, newValue);
|
|
1473
|
-
return;
|
|
1473
|
+
if (isComplex || /[A-Z]/.test(memberName)) return;
|
|
1474
1474
|
}
|
|
1475
1475
|
}
|
|
1476
1476
|
if ((isProp || isComplex && newValue !== null) && !isSvg) try {
|
|
@@ -3744,8 +3744,11 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
|
3744
3744
|
};
|
|
3745
3745
|
//#endregion
|
|
3746
3746
|
//#region src/runtime/mode.ts
|
|
3747
|
-
const computeMode = (elm) =>
|
|
3748
|
-
const setMode = (handler) =>
|
|
3747
|
+
const computeMode = (elm) => modeResolver.map((h) => h(elm)).find((m) => !!m);
|
|
3748
|
+
const setMode = (handler) => {
|
|
3749
|
+
modeResolver.length = 0;
|
|
3750
|
+
modeResolver.push(handler);
|
|
3751
|
+
};
|
|
3749
3752
|
const getMode = (ref) => getHostRef(ref)?.$modeName$;
|
|
3750
3753
|
//#endregion
|
|
3751
3754
|
//#region src/runtime/normalize-watchers.ts
|
|
@@ -3810,23 +3813,14 @@ const normalizeWatchers = (raw) => {
|
|
|
3810
3813
|
*
|
|
3811
3814
|
* @param propValue the new value to coerce to some type
|
|
3812
3815
|
* @param propType the type of the prop, expressed as a binary number
|
|
3813
|
-
* @param isFormAssociated whether the component is form-associated (optional)
|
|
3814
3816
|
* @returns the parsed/coerced value
|
|
3815
3817
|
*/
|
|
3816
|
-
const parsePropertyValue = (propValue, propType
|
|
3818
|
+
const parsePropertyValue = (propValue, propType) => {
|
|
3817
3819
|
if (propValue != null && !isComplexType(propValue)) {
|
|
3818
3820
|
/**
|
|
3819
3821
|
* ensure this value is of the correct prop type
|
|
3820
3822
|
*/
|
|
3821
|
-
if (BUILD$1.propBoolean && propType & MEMBER_FLAGS.Boolean)
|
|
3822
|
-
/**
|
|
3823
|
-
* For form-associated components, according to HTML spec, the presence of any boolean attribute
|
|
3824
|
-
* (regardless of its value, even "false") should make the property true.
|
|
3825
|
-
* For non-form-associated components, we maintain the legacy behavior where "false" becomes false.
|
|
3826
|
-
*/
|
|
3827
|
-
if (BUILD$1.formAssociated && isFormAssociated && typeof propValue === "string") return propValue === "" || !!propValue;
|
|
3828
|
-
else return propValue === "false" ? false : propValue === "" || !!propValue;
|
|
3829
|
-
}
|
|
3823
|
+
if (BUILD$1.propBoolean && propType & MEMBER_FLAGS.Boolean) return propValue === "" || !!propValue;
|
|
3830
3824
|
/**
|
|
3831
3825
|
* force it to be a number
|
|
3832
3826
|
*/
|
|
@@ -3868,7 +3862,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3868
3862
|
if (BUILD$1.signalBacking) {
|
|
3869
3863
|
const sig = hostRef?.$signalValues$?.get(propName);
|
|
3870
3864
|
if (sig !== void 0) {
|
|
3871
|
-
const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]
|
|
3865
|
+
const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
3872
3866
|
if (BUILD$1.serializer && BUILD$1.reflect && cmpMeta.$attrsToReflect$ && cmpMeta.$serializers$?.[propName]) {
|
|
3873
3867
|
const elm = BUILD$1.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
3874
3868
|
applySerializers(hostRef, cmpMeta, propName, parsed, BUILD$1.lazyLoad ? hostRef.$lazyInstance$ : elm);
|
|
@@ -3886,7 +3880,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3886
3880
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
3887
3881
|
const flags = hostRef.$flags$;
|
|
3888
3882
|
const instance = BUILD$1.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
3889
|
-
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]
|
|
3883
|
+
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
3890
3884
|
const didValueChange = newVal !== oldVal && !(Number.isNaN(oldVal) && Number.isNaN(newVal));
|
|
3891
3885
|
if ((!BUILD$1.lazyLoad || !(flags & HOST_FLAGS.isConstructingInstance) || oldVal === void 0) && didValueChange) {
|
|
3892
3886
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
@@ -3935,6 +3929,22 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3935
3929
|
*/
|
|
3936
3930
|
const reflectedAttrValue = (propValue) => propValue == null || propValue === false ? null : propValue === true ? "" : String(propValue);
|
|
3937
3931
|
/**
|
|
3932
|
+
* Hand values written to a lazy component's element before its instance existed to the
|
|
3933
|
+
* instance's own `@Prop` setters. Must run as soon as the instance is constructed, so that
|
|
3934
|
+
* whenever `$lazyInstance$` is set, reads through it agree with the element's last write.
|
|
3935
|
+
*
|
|
3936
|
+
* @param hostRef the runtime bookkeeping object of a freshly constructed lazy instance
|
|
3937
|
+
* @param cmpMeta runtime metadata for the component (with any run-time only setters flagged)
|
|
3938
|
+
*/
|
|
3939
|
+
const replayPendingSetterValues = (hostRef, cmpMeta) => {
|
|
3940
|
+
const instance = hostRef.$lazyInstance$;
|
|
3941
|
+
if (!instance) return;
|
|
3942
|
+
for (const [memberName, [memberFlags]] of Object.entries(cmpMeta.$members$ ?? {})) if (memberFlags & MEMBER_FLAGS.Setter && hostRef.$instanceValues$.has(memberName)) {
|
|
3943
|
+
const pendingValue = hostRef.$instanceValues$.get(memberName);
|
|
3944
|
+
if (instance[memberName] !== pendingValue) instance[memberName] = pendingValue;
|
|
3945
|
+
}
|
|
3946
|
+
};
|
|
3947
|
+
/**
|
|
3938
3948
|
* Attach a series of runtime constructs to a compiled Stencil component
|
|
3939
3949
|
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
3940
3950
|
* decorators, callbacks for when attributes change, and so on.
|
|
@@ -3991,9 +4001,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
3991
4001
|
if (BUILD$1.lazyLoad) {
|
|
3992
4002
|
if ((cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Getter) === 0) return getValue(this, memberName);
|
|
3993
4003
|
const ref = getHostRef(this);
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
return instance[memberName];
|
|
4004
|
+
if (!ref) return prototype[memberName];
|
|
4005
|
+
return ref.$lazyInstance$ ? ref.$lazyInstance$[memberName] : getValue(this, memberName);
|
|
3997
4006
|
}
|
|
3998
4007
|
if (!BUILD$1.lazyLoad) return origGetter ? origGetter.apply(this) : getValue(this, memberName);
|
|
3999
4008
|
},
|
|
@@ -4008,7 +4017,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4008
4017
|
}
|
|
4009
4018
|
if (origSetter) {
|
|
4010
4019
|
if (typeof (memberFlags & MEMBER_FLAGS.State ? this[memberName] : ref.$hostElement$[memberName]) === "undefined" && ref.$instanceValues$.get(memberName)) newValue = ref.$instanceValues$.get(memberName);
|
|
4011
|
-
origSetter.apply(this, [parsePropertyValue(newValue, memberFlags
|
|
4020
|
+
origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
|
|
4012
4021
|
newValue = memberFlags & MEMBER_FLAGS.State ? this[memberName] : ref.$hostElement$[memberName];
|
|
4013
4022
|
setValue(this, memberName, newValue, cmpMeta);
|
|
4014
4023
|
return;
|
|
@@ -4020,26 +4029,15 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4020
4029
|
if (BUILD$1.lazyLoad) {
|
|
4021
4030
|
if ((flags & PROXY_FLAGS.isElementConstructor) === 0 || (cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Setter) === 0) {
|
|
4022
4031
|
setValue(this, memberName, newValue, cmpMeta);
|
|
4023
|
-
if (flags & PROXY_FLAGS.isElementConstructor && !ref.$lazyInstance$) ref.$fetchedCbList$.push(() => {
|
|
4024
|
-
if (cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Setter && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) ref.$lazyInstance$[memberName] = newValue;
|
|
4025
|
-
});
|
|
4026
4032
|
return;
|
|
4027
4033
|
}
|
|
4028
|
-
const parsedValue = parsePropertyValue(newValue, memberFlags
|
|
4029
|
-
|
|
4034
|
+
const parsedValue = parsePropertyValue(newValue, memberFlags);
|
|
4035
|
+
if (ref.$lazyInstance$) {
|
|
4030
4036
|
const currentValue = ref.$lazyInstance$[memberName];
|
|
4031
4037
|
if (!ref.$instanceValues$.get(memberName) && currentValue) ref.$instanceValues$.set(memberName, currentValue);
|
|
4032
|
-
ref.$lazyInstance$[memberName] =
|
|
4038
|
+
ref.$lazyInstance$[memberName] = parsedValue;
|
|
4033
4039
|
setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
|
|
4034
|
-
};
|
|
4035
|
-
if (ref.$lazyInstance$) setterSetVal(parsedValue);
|
|
4036
|
-
else {
|
|
4037
|
-
ref.$instanceValues$.set(memberName, parsedValue);
|
|
4038
|
-
ref.$fetchedCbList$.push(() => {
|
|
4039
|
-
const pendingValue = ref.$instanceValues$.get(memberName);
|
|
4040
|
-
if (ref.$lazyInstance$[memberName] !== pendingValue) setterSetVal(pendingValue);
|
|
4041
|
-
});
|
|
4042
|
-
}
|
|
4040
|
+
} else ref.$instanceValues$.set(memberName, parsedValue);
|
|
4043
4041
|
}
|
|
4044
4042
|
} });
|
|
4045
4043
|
} else if (BUILD$1.lazyLoad && BUILD$1.method && flags & PROXY_FLAGS.isElementConstructor && memberFlags & MEMBER_FLAGS.Method) Object.defineProperty(prototype, memberName, { value(...args) {
|
|
@@ -4091,10 +4089,12 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4091
4089
|
const isBooleanTarget = propMemberFlags & MEMBER_FLAGS.Boolean;
|
|
4092
4090
|
if (BUILD$1.reflect && propMemberFlags & MEMBER_FLAGS.ReflectAttr && propMemberFlags & MEMBER_FLAGS.Any && !isComplexType(this[propName]) && reflectedAttrValue(this[propName]) === newValue) return;
|
|
4093
4091
|
const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
|
|
4094
|
-
if (isBooleanTarget)
|
|
4095
|
-
|
|
4092
|
+
if (isBooleanTarget) {
|
|
4093
|
+
if (BUILD$1.isDev && newValue === "false") `${cmpMeta.$tagName$}${attrName}${propName}`;
|
|
4094
|
+
newValue = newValue !== null;
|
|
4095
|
+
}
|
|
4096
4096
|
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
4097
|
-
if (!isSpuriousBooleanRemoval && newValue !=
|
|
4097
|
+
if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) this[propName] = newValue;
|
|
4098
4098
|
});
|
|
4099
4099
|
};
|
|
4100
4100
|
Cstr.observedAttributes = Array.from(/* @__PURE__ */ new Set([...Object.keys(cmpMeta.$watchers$ ?? {}), ...members.filter(([_, m]) => m[0] & MEMBER_FLAGS.HasAttribute).map(([propName, m]) => {
|
|
@@ -4155,7 +4155,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
4155
4155
|
} catch (e) {
|
|
4156
4156
|
consoleError(e, elm);
|
|
4157
4157
|
}
|
|
4158
|
-
if (BUILD$1.member)
|
|
4158
|
+
if (BUILD$1.member) {
|
|
4159
|
+
hostRef.$flags$ &= ~HOST_FLAGS.isConstructingInstance;
|
|
4160
|
+
replayPendingSetterValues(hostRef, cmpMeta);
|
|
4161
|
+
}
|
|
4159
4162
|
endNewInstance();
|
|
4160
4163
|
if (BUILD$1.asyncLoading && hostRef.$ancestorComponent$) await awaitAncestorConnected(hostRef.$ancestorComponent$);
|
|
4161
4164
|
if (!(BUILD$1.slotRelocation && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation)) {
|
|
@@ -4375,48 +4378,45 @@ const hmrStandalone = async (hostElement, cmpMeta, hmrVersionId) => {
|
|
|
4375
4378
|
`${modulePath}?s-hmr=${hmrVersionId}`
|
|
4376
4379
|
);
|
|
4377
4380
|
const NewClass = Object.values(newModule).find((v) => typeof v === "function" && v.is === cmpMeta.$tagName$) ?? newModule.default;
|
|
4378
|
-
if (
|
|
4379
|
-
const ctor = customElements.get(cmpMeta.$tagName$);
|
|
4380
|
-
if (ctor) {
|
|
4381
|
-
for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
|
|
4382
|
-
if (key === "constructor") continue;
|
|
4383
|
-
Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
|
|
4384
|
-
}
|
|
4385
|
-
const styleDesc = Object.getOwnPropertyDescriptor(NewClass, "style");
|
|
4386
|
-
if (styleDesc) {
|
|
4387
|
-
Object.defineProperty(ctor, "style", styleDesc);
|
|
4388
|
-
const newStyle = NewClass.style;
|
|
4389
|
-
if (newStyle) {
|
|
4390
|
-
const scopeId = getScopeId(cmpMeta);
|
|
4391
|
-
const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
|
|
4392
|
-
console.log("[stencil-hmr] registerStyle", {
|
|
4393
|
-
tag: cmpMeta.$tagName$,
|
|
4394
|
-
scopeId,
|
|
4395
|
-
isShadow,
|
|
4396
|
-
cssLen: newStyle.length
|
|
4397
|
-
});
|
|
4398
|
-
registerStyle(scopeId, newStyle, isShadow);
|
|
4399
|
-
}
|
|
4400
|
-
}
|
|
4401
|
-
}
|
|
4402
|
-
const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
|
|
4403
|
-
document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => {
|
|
4404
|
-
const hostRef = getHostRef(el);
|
|
4405
|
-
if (BUILD$1.hostListener && hostRef?.$rmListeners$) {
|
|
4406
|
-
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
4407
|
-
hostRef.$rmListeners$ = void 0;
|
|
4408
|
-
addHostEventListeners(el, hostRef, cmpMeta.$listeners$);
|
|
4409
|
-
}
|
|
4410
|
-
if (!isShadow && hostRef) {
|
|
4411
|
-
console.log("[stencil-hmr] calling attachStyles for", cmpMeta.$tagName$);
|
|
4412
|
-
attachStyles(hostRef);
|
|
4413
|
-
}
|
|
4414
|
-
forceUpdate(el);
|
|
4415
|
-
});
|
|
4381
|
+
if (NewClass) hmrApplyClass(cmpMeta, NewClass);
|
|
4416
4382
|
} catch (e) {
|
|
4417
4383
|
console.error(`[Stencil HMR] Failed to reload <${cmpMeta.$tagName$}>`, e);
|
|
4418
4384
|
}
|
|
4419
4385
|
};
|
|
4386
|
+
/**
|
|
4387
|
+
* Patch a re-executed component class onto the registered one and re-render every live instance.
|
|
4388
|
+
* Shared by the standalone re-import above and bundlers that re-execute the module themselves
|
|
4389
|
+
* (webpack/rspack `module.hot`), which reach it via the constructor's `s-hmr-apply` hook.
|
|
4390
|
+
*
|
|
4391
|
+
* @param cmpMeta runtime metadata for the component
|
|
4392
|
+
* @param NewClass the component's newly executed class
|
|
4393
|
+
*/
|
|
4394
|
+
const hmrApplyClass = (cmpMeta, NewClass) => {
|
|
4395
|
+
const ctor = customElements.get(cmpMeta.$tagName$);
|
|
4396
|
+
const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
|
|
4397
|
+
if (ctor && ctor !== NewClass) {
|
|
4398
|
+
for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
|
|
4399
|
+
if (key === "constructor") continue;
|
|
4400
|
+
Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
|
|
4401
|
+
}
|
|
4402
|
+
const styleDesc = Object.getOwnPropertyDescriptor(NewClass, "style");
|
|
4403
|
+
if (styleDesc) {
|
|
4404
|
+
Object.defineProperty(ctor, "style", styleDesc);
|
|
4405
|
+
const newStyle = NewClass.style;
|
|
4406
|
+
if (newStyle) registerStyle(getScopeId(cmpMeta), newStyle, isShadow);
|
|
4407
|
+
}
|
|
4408
|
+
}
|
|
4409
|
+
document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => {
|
|
4410
|
+
const hostRef = getHostRef(el);
|
|
4411
|
+
if (BUILD$1.hostListener && hostRef?.$rmListeners$) {
|
|
4412
|
+
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
4413
|
+
hostRef.$rmListeners$ = void 0;
|
|
4414
|
+
addHostEventListeners(el, hostRef, cmpMeta.$listeners$);
|
|
4415
|
+
}
|
|
4416
|
+
if (!isShadow && hostRef) attachStyles(hostRef);
|
|
4417
|
+
forceUpdate(el);
|
|
4418
|
+
});
|
|
4419
|
+
};
|
|
4420
4420
|
//#endregion
|
|
4421
4421
|
//#region src/runtime/bootstrap-standalone.ts
|
|
4422
4422
|
const defineCustomElement = (Cstr, compactMeta) => {
|
|
@@ -4439,9 +4439,12 @@ const proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
4439
4439
|
cmpMeta.$serializers$ = Cstr.$serializers$;
|
|
4440
4440
|
}
|
|
4441
4441
|
if (BUILD$1.reflect) cmpMeta.$attrsToReflect$ = [];
|
|
4442
|
-
if (BUILD$1.hotModuleReplacement)
|
|
4443
|
-
|
|
4444
|
-
|
|
4442
|
+
if (BUILD$1.hotModuleReplacement) {
|
|
4443
|
+
Cstr.prototype["s-hmr"] = function(hmrVersionId) {
|
|
4444
|
+
hmrStart(this, cmpMeta, hmrVersionId);
|
|
4445
|
+
};
|
|
4446
|
+
Cstr["s-hmr-apply"] = (NewClass) => hmrApplyClass(cmpMeta, NewClass);
|
|
4447
|
+
}
|
|
4445
4448
|
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && (BUILD$1.slotCloneNode || BUILD$1.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone)) patchCloneNode(Cstr.prototype);
|
|
4446
4449
|
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) {
|
|
4447
4450
|
if (BUILD$1.lightDomPatches || BUILD$1.patchAll && cmpMeta.$flags$ & CMP_FLAGS.patchAll) applyLightDomPatches(Cstr.prototype);
|
|
@@ -5031,7 +5034,7 @@ function proxyHostElement(elm, cstr) {
|
|
|
5031
5034
|
const [[methodName]] = Object.entries(deserializer);
|
|
5032
5035
|
attrPropVal = cstr.prototype[methodName](attrValue, memberName);
|
|
5033
5036
|
}
|
|
5034
|
-
else attrPropVal = parsePropertyValue(attrValue, memberFlags
|
|
5037
|
+
else attrPropVal = parsePropertyValue(attrValue, memberFlags);
|
|
5035
5038
|
}
|
|
5036
5039
|
if (propValue !== void 0) {
|
|
5037
5040
|
attrPropVal = propValue;
|
|
@@ -5110,6 +5113,7 @@ function ssrApp(win, opts, results, afterSsr, resolve, abortController) {
|
|
|
5110
5113
|
setScopedSsr(opts);
|
|
5111
5114
|
let tmrId;
|
|
5112
5115
|
let ranCompleted = false;
|
|
5116
|
+
let modeResolverSnapshot;
|
|
5113
5117
|
const abortedPromise = new Promise((res) => {
|
|
5114
5118
|
if (abortController.signal.aborted) res();
|
|
5115
5119
|
else abortController.signal.addEventListener("abort", () => res(), { once: true });
|
|
@@ -5118,6 +5122,11 @@ function ssrApp(win, opts, results, afterSsr, resolve, abortController) {
|
|
|
5118
5122
|
$nativeClearTimeout(tmrId);
|
|
5119
5123
|
createdElements.clear();
|
|
5120
5124
|
connectedElements.clear();
|
|
5125
|
+
if (modeResolverSnapshot) {
|
|
5126
|
+
modeResolver.length = 0;
|
|
5127
|
+
modeResolver.push(...modeResolverSnapshot);
|
|
5128
|
+
modeResolverSnapshot = void 0;
|
|
5129
|
+
}
|
|
5121
5130
|
if (!ranCompleted) {
|
|
5122
5131
|
ranCompleted = true;
|
|
5123
5132
|
try {
|
|
@@ -5201,6 +5210,10 @@ function ssrApp(win, opts, results, afterSsr, resolve, abortController) {
|
|
|
5201
5210
|
tmrId = $nativeSetTimeout(timeoutExceeded, opts.timeout);
|
|
5202
5211
|
plt.$resourcesUrl$ = new URL(opts.resourcesUrl || "./", win.document.baseURI).href;
|
|
5203
5212
|
globalScripts();
|
|
5213
|
+
if (Array.isArray(opts.modes)) {
|
|
5214
|
+
modeResolverSnapshot = modeResolver.slice();
|
|
5215
|
+
opts.modes.forEach((mode) => setMode(mode));
|
|
5216
|
+
}
|
|
5204
5217
|
patchChild(win.document.body);
|
|
5205
5218
|
waitLoop().then(hydratedComplete).catch(hydratedError);
|
|
5206
5219
|
} catch (e) {
|
|
@@ -5461,7 +5474,7 @@ const Build = {
|
|
|
5461
5474
|
isTesting: false
|
|
5462
5475
|
};
|
|
5463
5476
|
const styles = /* @__PURE__ */ new Map();
|
|
5464
|
-
const
|
|
5477
|
+
const modeResolver = [];
|
|
5465
5478
|
/**
|
|
5466
5479
|
* Server-side implementation of getAssetPath.
|
|
5467
5480
|
*
|
|
@@ -5493,4 +5506,4 @@ const setScopedSsr = (opts) => {
|
|
|
5493
5506
|
const needsScopedSSR = () => scopedSSR;
|
|
5494
5507
|
let scopedSSR = false;
|
|
5495
5508
|
//#endregion
|
|
5496
|
-
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,
|
|
5509
|
+
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, modeResolver, 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 };
|
|
@@ -12257,39 +12257,6 @@ function createWindowFromHtml(templateHtml, uniqueId) {
|
|
|
12257
12257
|
return cloneWindow(templateWindow);
|
|
12258
12258
|
}
|
|
12259
12259
|
//#endregion
|
|
12260
|
-
//#region src/runtime/runtime-constants.ts
|
|
12261
|
-
const HYDRATED_STYLE_ID = "sty-id";
|
|
12262
|
-
const STENCIL_DOC_DATA = "_stencilDocData";
|
|
12263
|
-
//#endregion
|
|
12264
|
-
//#region src/utils/helpers.ts
|
|
12265
|
-
const isString = (v) => typeof v === "string";
|
|
12266
|
-
//#endregion
|
|
12267
|
-
//#region src/runtime/mode.ts
|
|
12268
|
-
const setMode = (handler) => modeResolutionChain.push(handler);
|
|
12269
|
-
BUILD.lazyLoad || globalThis.HTMLElement;
|
|
12270
|
-
//#endregion
|
|
12271
|
-
//#region src/runtime/tag-transform.ts
|
|
12272
|
-
let tagTransformer = void 0;
|
|
12273
|
-
/**
|
|
12274
|
-
* Transforms a tag name using the current tag transformer
|
|
12275
|
-
* @param tag - the tag to transform e.g. `my-tag`
|
|
12276
|
-
* @returns the transformed tag e.g. `new-my-tag`
|
|
12277
|
-
*/
|
|
12278
|
-
function transformTag(tag) {
|
|
12279
|
-
if (!tagTransformer) return tag;
|
|
12280
|
-
return tagTransformer(tag);
|
|
12281
|
-
}
|
|
12282
|
-
/**
|
|
12283
|
-
* Sets the tag transformer to be used when rendering custom elements
|
|
12284
|
-
* @param transformer the transformer function to use. Must return a string
|
|
12285
|
-
*/
|
|
12286
|
-
function setTagTransformer(transformer) {
|
|
12287
|
-
tagTransformer = transformer;
|
|
12288
|
-
}
|
|
12289
|
-
//#endregion
|
|
12290
|
-
//#region src/server/platform/index.ts
|
|
12291
|
-
const modeResolutionChain = [];
|
|
12292
|
-
//#endregion
|
|
12293
12260
|
//#region src/compiler/html/canonical-link.ts
|
|
12294
12261
|
const updateCanonicalLink = (doc, href) => {
|
|
12295
12262
|
let canonicalLinkElm = doc.head.querySelector("link[rel=\"canonical\"]");
|
|
@@ -12316,6 +12283,9 @@ const relocateMetaCharset = (doc) => {
|
|
|
12316
12283
|
head.insertBefore(charsetElm, head.firstChild);
|
|
12317
12284
|
};
|
|
12318
12285
|
//#endregion
|
|
12286
|
+
//#region src/utils/helpers.ts
|
|
12287
|
+
const isString = (v) => typeof v === "string";
|
|
12288
|
+
//#endregion
|
|
12319
12289
|
//#region src/utils/message-utils.ts
|
|
12320
12290
|
/**
|
|
12321
12291
|
* Builds a diagnostic from an `Error`, appends it to the `diagnostics` parameter, and returns the created diagnostic
|
|
@@ -13136,6 +13106,30 @@ const removeUnusedStyleText = (usedSelectors, diagnostics, styleElm) => {
|
|
|
13136
13106
|
}
|
|
13137
13107
|
};
|
|
13138
13108
|
//#endregion
|
|
13109
|
+
//#region src/runtime/runtime-constants.ts
|
|
13110
|
+
const HYDRATED_STYLE_ID = "sty-id";
|
|
13111
|
+
const STENCIL_DOC_DATA = "_stencilDocData";
|
|
13112
|
+
BUILD.lazyLoad || globalThis.HTMLElement;
|
|
13113
|
+
//#endregion
|
|
13114
|
+
//#region src/runtime/tag-transform.ts
|
|
13115
|
+
let tagTransformer = void 0;
|
|
13116
|
+
/**
|
|
13117
|
+
* Transforms a tag name using the current tag transformer
|
|
13118
|
+
* @param tag - the tag to transform e.g. `my-tag`
|
|
13119
|
+
* @returns the transformed tag e.g. `new-my-tag`
|
|
13120
|
+
*/
|
|
13121
|
+
function transformTag(tag) {
|
|
13122
|
+
if (!tagTransformer) return tag;
|
|
13123
|
+
return tagTransformer(tag);
|
|
13124
|
+
}
|
|
13125
|
+
/**
|
|
13126
|
+
* Sets the tag transformer to be used when rendering custom elements
|
|
13127
|
+
* @param transformer the transformer function to use. Must return a string
|
|
13128
|
+
*/
|
|
13129
|
+
function setTagTransformer(transformer) {
|
|
13130
|
+
tagTransformer = transformer;
|
|
13131
|
+
}
|
|
13132
|
+
//#endregion
|
|
13139
13133
|
//#region src/server/runner/inspect-element.ts
|
|
13140
13134
|
function inspectElement(results, elm, depth) {
|
|
13141
13135
|
const children = [...Array.from(elm.children), ...Array.from(elm.shadowRoot ? elm.shadowRoot.children : [])];
|
|
@@ -13546,14 +13540,6 @@ async function render(win, opts, results) {
|
|
|
13546
13540
|
try {
|
|
13547
13541
|
await Promise.resolve(beforeHydrateFn(win.document));
|
|
13548
13542
|
return new Promise((resolve) => {
|
|
13549
|
-
if (Array.isArray(opts.modes)) {
|
|
13550
|
-
/**
|
|
13551
|
-
* Reset the mode resolution chain as we expect every `renderToString` call to render
|
|
13552
|
-
* the components in new environment/document.
|
|
13553
|
-
*/
|
|
13554
|
-
modeResolutionChain.length = 0;
|
|
13555
|
-
opts.modes.forEach((mode) => setMode(mode));
|
|
13556
|
-
}
|
|
13557
13543
|
return ssrFactory(win, opts, results, afterSsr, resolve);
|
|
13558
13544
|
});
|
|
13559
13545
|
} catch (e) {
|
package/dist/sys/node/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as setupNodeProcess, r as createNodeLogger, t as createNodeSys } from "../../node-
|
|
1
|
+
import { n as setupNodeProcess, r as createNodeLogger, t as createNodeSys } from "../../node-DrwzfDH1.mjs";
|
|
2
2
|
export { createNodeLogger, createNodeSys, setupNodeProcess };
|
package/dist/sys/node/worker.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as createWorkerMessageHandler } from "../../compiler-
|
|
2
|
-
import { t as createNodeSys } from "../../node-
|
|
1
|
+
import { l as createWorkerMessageHandler } from "../../compiler-Dr9JHtLp.mjs";
|
|
2
|
+
import { t as createNodeSys } from "../../node-DrwzfDH1.mjs";
|
|
3
3
|
//#region src/sys/node/node-worker-thread.ts
|
|
4
4
|
/**
|
|
5
5
|
* Initialize a worker thread, setting up various machinery for managing
|