@stencil/core 5.0.0-beta.12 → 5.0.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{client-CdFmjaQa.mjs → client-CAQvc3hT.mjs} +8 -5
- package/dist/compiler/browser.d.ts +96 -54
- package/dist/compiler/browser.js +141 -19
- 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-Bit_AiP4.mjs} +3575 -2387
- 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-Bw9pHJOq.mjs} +1 -1
- package/dist/runtime/client/lazy.js +99 -89
- package/dist/runtime/client/runtime.d.ts +5 -6
- package/dist/runtime/client/runtime.js +99 -89
- package/dist/runtime/index.d.ts +2 -3
- package/dist/runtime/index.js +97 -87
- package/dist/runtime/server/index.d.mts +4 -5
- package/dist/runtime/server/index.mjs +108 -88
- package/dist/runtime/server/runner.mjs +32 -44
- 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 +178 -160
- package/package.json +5 -4
|
@@ -494,8 +494,8 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
494
494
|
//#endregion
|
|
495
495
|
//#region src/client/client-style.ts
|
|
496
496
|
const styles = /*@__PURE__*/ new Map();
|
|
497
|
-
const
|
|
498
|
-
const
|
|
497
|
+
const modeResolver = [];
|
|
498
|
+
const setScopedSSR = (_opts) => {};
|
|
499
499
|
const needsScopedSSR = () => false;
|
|
500
500
|
//#endregion
|
|
501
501
|
//#region src/runtime/runtime-constants.ts
|
|
@@ -607,7 +607,7 @@ let queuePending = false;
|
|
|
607
607
|
const queueDomReads = [];
|
|
608
608
|
const queueDomWrites = [];
|
|
609
609
|
const queueDomWritesLow = [];
|
|
610
|
-
const scheduleFlush = () => win.document?.hidden ?
|
|
610
|
+
const scheduleFlush = () => win.document?.hidden ? setTimeout(flush, 16) : plt.raf(flush);
|
|
611
611
|
const queueTask = (queue, write) => (cb) => {
|
|
612
612
|
queue.push(cb);
|
|
613
613
|
if (!queuePending) {
|
|
@@ -1853,10 +1853,10 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
|
|
|
1853
1853
|
const isComplex = isComplexType(newValue);
|
|
1854
1854
|
if (!BUILD.lazyLoad) {
|
|
1855
1855
|
const isStandardAttr = ln.startsWith("aria-") || ln.startsWith("data-");
|
|
1856
|
-
if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" &&
|
|
1856
|
+
if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" && !customElements.get(elm.tagName.toLowerCase())) {
|
|
1857
1857
|
if (!elm["s-pp"]) elm["s-pp"] = /* @__PURE__ */ new Map();
|
|
1858
1858
|
elm["s-pp"].set(memberName, newValue);
|
|
1859
|
-
return;
|
|
1859
|
+
if (isComplex || /[A-Z]/.test(memberName)) return;
|
|
1860
1860
|
}
|
|
1861
1861
|
}
|
|
1862
1862
|
if ((isProp || isComplex && newValue !== null) && !isSvg) try {
|
|
@@ -4015,7 +4015,7 @@ const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector)
|
|
|
4015
4015
|
else return shallowPart.trim();
|
|
4016
4016
|
}).join(", ");
|
|
4017
4017
|
};
|
|
4018
|
-
const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer");
|
|
4018
|
+
const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer") || selector.startsWith("@container");
|
|
4019
4019
|
const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
|
|
4020
4020
|
return processRules(cssText, (rule) => {
|
|
4021
4021
|
let selector = rule.selector;
|
|
@@ -4134,8 +4134,11 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
|
4134
4134
|
};
|
|
4135
4135
|
//#endregion
|
|
4136
4136
|
//#region src/runtime/mode.ts
|
|
4137
|
-
const computeMode = (elm) =>
|
|
4138
|
-
const setMode = (handler) =>
|
|
4137
|
+
const computeMode = (elm) => modeResolver.map((h) => h(elm)).find((m) => !!m);
|
|
4138
|
+
const setMode = (handler) => {
|
|
4139
|
+
modeResolver.length = 0;
|
|
4140
|
+
modeResolver.push(handler);
|
|
4141
|
+
};
|
|
4139
4142
|
const getMode = (ref) => getHostRef(ref)?.$modeName$;
|
|
4140
4143
|
//#endregion
|
|
4141
4144
|
//#region src/runtime/normalize-watchers.ts
|
|
@@ -4200,23 +4203,14 @@ const normalizeWatchers = (raw) => {
|
|
|
4200
4203
|
*
|
|
4201
4204
|
* @param propValue the new value to coerce to some type
|
|
4202
4205
|
* @param propType the type of the prop, expressed as a binary number
|
|
4203
|
-
* @param isFormAssociated whether the component is form-associated (optional)
|
|
4204
4206
|
* @returns the parsed/coerced value
|
|
4205
4207
|
*/
|
|
4206
|
-
const parsePropertyValue = (propValue, propType
|
|
4208
|
+
const parsePropertyValue = (propValue, propType) => {
|
|
4207
4209
|
if (propValue != null && !isComplexType(propValue)) {
|
|
4208
4210
|
/**
|
|
4209
4211
|
* ensure this value is of the correct prop type
|
|
4210
4212
|
*/
|
|
4211
|
-
if (BUILD.propBoolean && propType & MEMBER_FLAGS.Boolean)
|
|
4212
|
-
/**
|
|
4213
|
-
* For form-associated components, according to HTML spec, the presence of any boolean attribute
|
|
4214
|
-
* (regardless of its value, even "false") should make the property true.
|
|
4215
|
-
* For non-form-associated components, we maintain the legacy behavior where "false" becomes false.
|
|
4216
|
-
*/
|
|
4217
|
-
if (BUILD.formAssociated && isFormAssociated && typeof propValue === "string") return propValue === "" || !!propValue;
|
|
4218
|
-
else return propValue === "false" ? false : propValue === "" || !!propValue;
|
|
4219
|
-
}
|
|
4213
|
+
if (BUILD.propBoolean && propType & MEMBER_FLAGS.Boolean) return propValue === "" || !!propValue;
|
|
4220
4214
|
/**
|
|
4221
4215
|
* force it to be a number
|
|
4222
4216
|
*/
|
|
@@ -4258,7 +4252,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
4258
4252
|
if (BUILD.signalBacking) {
|
|
4259
4253
|
const sig = hostRef?.$signalValues$?.get(propName);
|
|
4260
4254
|
if (sig !== void 0) {
|
|
4261
|
-
const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]
|
|
4255
|
+
const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
4262
4256
|
if (BUILD.serializer && BUILD.reflect && cmpMeta.$attrsToReflect$ && cmpMeta.$serializers$?.[propName]) {
|
|
4263
4257
|
const elm = BUILD.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
4264
4258
|
applySerializers(hostRef, cmpMeta, propName, parsed, BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm);
|
|
@@ -4276,7 +4270,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
4276
4270
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
4277
4271
|
const flags = hostRef.$flags$;
|
|
4278
4272
|
const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
4279
|
-
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]
|
|
4273
|
+
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
4280
4274
|
const didValueChange = newVal !== oldVal && !(Number.isNaN(oldVal) && Number.isNaN(newVal));
|
|
4281
4275
|
if ((!BUILD.lazyLoad || !(flags & HOST_FLAGS.isConstructingInstance) || oldVal === void 0) && didValueChange) {
|
|
4282
4276
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
@@ -4325,6 +4319,22 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
4325
4319
|
*/
|
|
4326
4320
|
const reflectedAttrValue = (propValue) => propValue == null || propValue === false ? null : propValue === true ? "" : String(propValue);
|
|
4327
4321
|
/**
|
|
4322
|
+
* Hand values written to a lazy component's element before its instance existed to the
|
|
4323
|
+
* instance's own `@Prop` setters. Must run as soon as the instance is constructed, so that
|
|
4324
|
+
* whenever `$lazyInstance$` is set, reads through it agree with the element's last write.
|
|
4325
|
+
*
|
|
4326
|
+
* @param hostRef the runtime bookkeeping object of a freshly constructed lazy instance
|
|
4327
|
+
* @param cmpMeta runtime metadata for the component (with any run-time only setters flagged)
|
|
4328
|
+
*/
|
|
4329
|
+
const replayPendingSetterValues = (hostRef, cmpMeta) => {
|
|
4330
|
+
const instance = hostRef.$lazyInstance$;
|
|
4331
|
+
if (!instance) return;
|
|
4332
|
+
for (const [memberName, [memberFlags]] of Object.entries(cmpMeta.$members$ ?? {})) if (memberFlags & MEMBER_FLAGS.Setter && hostRef.$instanceValues$.has(memberName)) {
|
|
4333
|
+
const pendingValue = hostRef.$instanceValues$.get(memberName);
|
|
4334
|
+
if (instance[memberName] !== pendingValue) instance[memberName] = pendingValue;
|
|
4335
|
+
}
|
|
4336
|
+
};
|
|
4337
|
+
/**
|
|
4328
4338
|
* Attach a series of runtime constructs to a compiled Stencil component
|
|
4329
4339
|
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
4330
4340
|
* decorators, callbacks for when attributes change, and so on.
|
|
@@ -4381,9 +4391,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4381
4391
|
if (BUILD.lazyLoad) {
|
|
4382
4392
|
if ((cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Getter) === 0) return getValue(this, memberName);
|
|
4383
4393
|
const ref = getHostRef(this);
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
return instance[memberName];
|
|
4394
|
+
if (!ref) return prototype[memberName];
|
|
4395
|
+
return ref.$lazyInstance$ ? ref.$lazyInstance$[memberName] : getValue(this, memberName);
|
|
4387
4396
|
}
|
|
4388
4397
|
if (!BUILD.lazyLoad) return origGetter ? origGetter.apply(this) : getValue(this, memberName);
|
|
4389
4398
|
},
|
|
@@ -4398,7 +4407,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4398
4407
|
}
|
|
4399
4408
|
if (origSetter) {
|
|
4400
4409
|
if (typeof (memberFlags & MEMBER_FLAGS.State ? this[memberName] : ref.$hostElement$[memberName]) === "undefined" && ref.$instanceValues$.get(memberName)) newValue = ref.$instanceValues$.get(memberName);
|
|
4401
|
-
origSetter.apply(this, [parsePropertyValue(newValue, memberFlags
|
|
4410
|
+
origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
|
|
4402
4411
|
newValue = memberFlags & MEMBER_FLAGS.State ? this[memberName] : ref.$hostElement$[memberName];
|
|
4403
4412
|
setValue(this, memberName, newValue, cmpMeta);
|
|
4404
4413
|
return;
|
|
@@ -4410,26 +4419,15 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4410
4419
|
if (BUILD.lazyLoad) {
|
|
4411
4420
|
if ((flags & PROXY_FLAGS.isElementConstructor) === 0 || (cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Setter) === 0) {
|
|
4412
4421
|
setValue(this, memberName, newValue, cmpMeta);
|
|
4413
|
-
if (flags & PROXY_FLAGS.isElementConstructor && !ref.$lazyInstance$) ref.$fetchedCbList$.push(() => {
|
|
4414
|
-
if (cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Setter && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) ref.$lazyInstance$[memberName] = newValue;
|
|
4415
|
-
});
|
|
4416
4422
|
return;
|
|
4417
4423
|
}
|
|
4418
|
-
const parsedValue = parsePropertyValue(newValue, memberFlags
|
|
4419
|
-
|
|
4424
|
+
const parsedValue = parsePropertyValue(newValue, memberFlags);
|
|
4425
|
+
if (ref.$lazyInstance$) {
|
|
4420
4426
|
const currentValue = ref.$lazyInstance$[memberName];
|
|
4421
4427
|
if (!ref.$instanceValues$.get(memberName) && currentValue) ref.$instanceValues$.set(memberName, currentValue);
|
|
4422
|
-
ref.$lazyInstance$[memberName] =
|
|
4428
|
+
ref.$lazyInstance$[memberName] = parsedValue;
|
|
4423
4429
|
setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
|
|
4424
|
-
};
|
|
4425
|
-
if (ref.$lazyInstance$) setterSetVal(parsedValue);
|
|
4426
|
-
else {
|
|
4427
|
-
ref.$instanceValues$.set(memberName, parsedValue);
|
|
4428
|
-
ref.$fetchedCbList$.push(() => {
|
|
4429
|
-
const pendingValue = ref.$instanceValues$.get(memberName);
|
|
4430
|
-
if (ref.$lazyInstance$[memberName] !== pendingValue) setterSetVal(pendingValue);
|
|
4431
|
-
});
|
|
4432
|
-
}
|
|
4430
|
+
} else ref.$instanceValues$.set(memberName, parsedValue);
|
|
4433
4431
|
}
|
|
4434
4432
|
} });
|
|
4435
4433
|
} else if (BUILD.lazyLoad && BUILD.method && flags & PROXY_FLAGS.isElementConstructor && memberFlags & MEMBER_FLAGS.Method) Object.defineProperty(prototype, memberName, { value(...args) {
|
|
@@ -4481,10 +4479,12 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4481
4479
|
const isBooleanTarget = propMemberFlags & MEMBER_FLAGS.Boolean;
|
|
4482
4480
|
if (BUILD.reflect && propMemberFlags & MEMBER_FLAGS.ReflectAttr && propMemberFlags & MEMBER_FLAGS.Any && !isComplexType(this[propName]) && reflectedAttrValue(this[propName]) === newValue) return;
|
|
4483
4481
|
const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
|
|
4484
|
-
if (isBooleanTarget)
|
|
4485
|
-
|
|
4482
|
+
if (isBooleanTarget) {
|
|
4483
|
+
if (BUILD.isDev && newValue === "false") consoleDevWarn(`<${cmpMeta.$tagName$} ${attrName}="false">: boolean attributes are true when present, regardless of value. Remove the attribute or set the "${propName}" property to false instead.`);
|
|
4484
|
+
newValue = newValue !== null;
|
|
4485
|
+
}
|
|
4486
4486
|
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
4487
|
-
if (!isSpuriousBooleanRemoval && newValue !=
|
|
4487
|
+
if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) this[propName] = newValue;
|
|
4488
4488
|
});
|
|
4489
4489
|
};
|
|
4490
4490
|
Cstr.observedAttributes = Array.from(/* @__PURE__ */ new Set([...Object.keys(cmpMeta.$watchers$ ?? {}), ...members.filter(([_, m]) => m[0] & MEMBER_FLAGS.HasAttribute).map(([propName, m]) => {
|
|
@@ -4545,7 +4545,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
4545
4545
|
} catch (e) {
|
|
4546
4546
|
consoleError(e, elm);
|
|
4547
4547
|
}
|
|
4548
|
-
if (BUILD.member)
|
|
4548
|
+
if (BUILD.member) {
|
|
4549
|
+
hostRef.$flags$ &= ~HOST_FLAGS.isConstructingInstance;
|
|
4550
|
+
replayPendingSetterValues(hostRef, cmpMeta);
|
|
4551
|
+
}
|
|
4549
4552
|
endNewInstance();
|
|
4550
4553
|
if (BUILD.asyncLoading && hostRef.$ancestorComponent$) await awaitAncestorConnected(hostRef.$ancestorComponent$);
|
|
4551
4554
|
if (!(BUILD.slotRelocation && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation)) {
|
|
@@ -4647,9 +4650,16 @@ const connectedCallback = (elm) => {
|
|
|
4647
4650
|
}
|
|
4648
4651
|
if (BUILD.asyncLoading) {
|
|
4649
4652
|
let ancestorComponent = elm;
|
|
4650
|
-
while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
+
while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
|
|
4654
|
+
if (BUILD.hydrateClientSide && !ancestorComponent["s-p"] && ancestorComponent.nodeType === NODE_TYPE.ElementNode && ancestorComponent.hasAttribute("s-id")) {
|
|
4655
|
+
ancestorComponent["s-p"] = [];
|
|
4656
|
+
ancestorComponent["s-rc"] = [];
|
|
4657
|
+
ancestorComponent["s-pc"] = [];
|
|
4658
|
+
}
|
|
4659
|
+
if (ancestorComponent["s-p"]) {
|
|
4660
|
+
attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
|
|
4661
|
+
break;
|
|
4662
|
+
}
|
|
4653
4663
|
}
|
|
4654
4664
|
}
|
|
4655
4665
|
if (BUILD.prop && !BUILD.hydrateServerSide && cmpMeta.$members$) Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
@@ -4765,48 +4775,45 @@ const hmrStandalone = async (hostElement, cmpMeta, hmrVersionId) => {
|
|
|
4765
4775
|
`${modulePath}?s-hmr=${hmrVersionId}`
|
|
4766
4776
|
);
|
|
4767
4777
|
const NewClass = Object.values(newModule).find((v) => typeof v === "function" && v.is === cmpMeta.$tagName$) ?? newModule.default;
|
|
4768
|
-
if (
|
|
4769
|
-
const ctor = customElements.get(cmpMeta.$tagName$);
|
|
4770
|
-
if (ctor) {
|
|
4771
|
-
for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
|
|
4772
|
-
if (key === "constructor") continue;
|
|
4773
|
-
Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
|
|
4774
|
-
}
|
|
4775
|
-
const styleDesc = Object.getOwnPropertyDescriptor(NewClass, "style");
|
|
4776
|
-
if (styleDesc) {
|
|
4777
|
-
Object.defineProperty(ctor, "style", styleDesc);
|
|
4778
|
-
const newStyle = NewClass.style;
|
|
4779
|
-
if (newStyle) {
|
|
4780
|
-
const scopeId = getScopeId(cmpMeta);
|
|
4781
|
-
const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
|
|
4782
|
-
console.log("[stencil-hmr] registerStyle", {
|
|
4783
|
-
tag: cmpMeta.$tagName$,
|
|
4784
|
-
scopeId,
|
|
4785
|
-
isShadow,
|
|
4786
|
-
cssLen: newStyle.length
|
|
4787
|
-
});
|
|
4788
|
-
registerStyle(scopeId, newStyle, isShadow);
|
|
4789
|
-
}
|
|
4790
|
-
}
|
|
4791
|
-
}
|
|
4792
|
-
const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
|
|
4793
|
-
document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => {
|
|
4794
|
-
const hostRef = getHostRef(el);
|
|
4795
|
-
if (BUILD.hostListener && hostRef?.$rmListeners$) {
|
|
4796
|
-
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
4797
|
-
hostRef.$rmListeners$ = void 0;
|
|
4798
|
-
addHostEventListeners(el, hostRef, cmpMeta.$listeners$);
|
|
4799
|
-
}
|
|
4800
|
-
if (!isShadow && hostRef) {
|
|
4801
|
-
console.log("[stencil-hmr] calling attachStyles for", cmpMeta.$tagName$);
|
|
4802
|
-
attachStyles(hostRef);
|
|
4803
|
-
}
|
|
4804
|
-
forceUpdate(el);
|
|
4805
|
-
});
|
|
4778
|
+
if (NewClass) hmrApplyClass(cmpMeta, NewClass);
|
|
4806
4779
|
} catch (e) {
|
|
4807
4780
|
console.error(`[Stencil HMR] Failed to reload <${cmpMeta.$tagName$}>`, e);
|
|
4808
4781
|
}
|
|
4809
4782
|
};
|
|
4783
|
+
/**
|
|
4784
|
+
* Patch a re-executed component class onto the registered one and re-render every live instance.
|
|
4785
|
+
* Shared by the standalone re-import above and bundlers that re-execute the module themselves
|
|
4786
|
+
* (webpack/rspack `module.hot`), which reach it via the constructor's `s-hmr-apply` hook.
|
|
4787
|
+
*
|
|
4788
|
+
* @param cmpMeta runtime metadata for the component
|
|
4789
|
+
* @param NewClass the component's newly executed class
|
|
4790
|
+
*/
|
|
4791
|
+
const hmrApplyClass = (cmpMeta, NewClass) => {
|
|
4792
|
+
const ctor = customElements.get(cmpMeta.$tagName$);
|
|
4793
|
+
const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
|
|
4794
|
+
if (ctor && ctor !== NewClass) {
|
|
4795
|
+
for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
|
|
4796
|
+
if (key === "constructor") continue;
|
|
4797
|
+
Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
|
|
4798
|
+
}
|
|
4799
|
+
const styleDesc = Object.getOwnPropertyDescriptor(NewClass, "style");
|
|
4800
|
+
if (styleDesc) {
|
|
4801
|
+
Object.defineProperty(ctor, "style", styleDesc);
|
|
4802
|
+
const newStyle = NewClass.style;
|
|
4803
|
+
if (newStyle) registerStyle(getScopeId(cmpMeta), newStyle, isShadow);
|
|
4804
|
+
}
|
|
4805
|
+
}
|
|
4806
|
+
document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => {
|
|
4807
|
+
const hostRef = getHostRef(el);
|
|
4808
|
+
if (BUILD.hostListener && hostRef?.$rmListeners$) {
|
|
4809
|
+
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
4810
|
+
hostRef.$rmListeners$ = void 0;
|
|
4811
|
+
addHostEventListeners(el, hostRef, cmpMeta.$listeners$);
|
|
4812
|
+
}
|
|
4813
|
+
if (!isShadow && hostRef) attachStyles(hostRef);
|
|
4814
|
+
forceUpdate(el);
|
|
4815
|
+
});
|
|
4816
|
+
};
|
|
4810
4817
|
//#endregion
|
|
4811
4818
|
//#region src/runtime/bootstrap-standalone.ts
|
|
4812
4819
|
const defineCustomElement = (Cstr, compactMeta) => {
|
|
@@ -4829,9 +4836,12 @@ const proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
4829
4836
|
cmpMeta.$serializers$ = Cstr.$serializers$;
|
|
4830
4837
|
}
|
|
4831
4838
|
if (BUILD.reflect) cmpMeta.$attrsToReflect$ = [];
|
|
4832
|
-
if (BUILD.hotModuleReplacement)
|
|
4833
|
-
|
|
4834
|
-
|
|
4839
|
+
if (BUILD.hotModuleReplacement) {
|
|
4840
|
+
Cstr.prototype["s-hmr"] = function(hmrVersionId) {
|
|
4841
|
+
hmrStart(this, cmpMeta, hmrVersionId);
|
|
4842
|
+
};
|
|
4843
|
+
Cstr["s-hmr-apply"] = (NewClass) => hmrApplyClass(cmpMeta, NewClass);
|
|
4844
|
+
}
|
|
4835
4845
|
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && (BUILD.slotCloneNode || BUILD.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone)) patchCloneNode(Cstr.prototype);
|
|
4836
4846
|
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) {
|
|
4837
4847
|
if (BUILD.lightDomPatches || BUILD.patchAll && cmpMeta.$flags$ & CMP_FLAGS.patchAll) applyLightDomPatches(Cstr.prototype);
|
|
@@ -5347,4 +5357,4 @@ function hasKeys(obj) {
|
|
|
5347
5357
|
return false;
|
|
5348
5358
|
}
|
|
5349
5359
|
//#endregion
|
|
5350
|
-
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,
|
|
5360
|
+
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, modeResolver, 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 };
|
|
@@ -2277,8 +2277,8 @@ declare const setErrorHandler: (handler: ErrorHandler) => ErrorHandler;
|
|
|
2277
2277
|
//#endregion
|
|
2278
2278
|
//#region src/client/client-style.d.ts
|
|
2279
2279
|
declare const styles: StyleMap;
|
|
2280
|
-
declare const
|
|
2281
|
-
declare const
|
|
2280
|
+
declare const modeResolver: ResolutionHandler[];
|
|
2281
|
+
declare const setScopedSSR: (_opts: SsrFactoryOptions) => void;
|
|
2282
2282
|
declare const needsScopedSSR: () => boolean;
|
|
2283
2283
|
//#endregion
|
|
2284
2284
|
//#region src/client/client-task-queue.d.ts
|
|
@@ -2384,7 +2384,7 @@ type Ctor<T = {}> = new (...args: any[]) => T;
|
|
|
2384
2384
|
declare function Mixin(...mixins: ((base: Ctor) => Ctor)[]): Ctor<{}>;
|
|
2385
2385
|
//#endregion
|
|
2386
2386
|
//#region src/runtime/mode.d.ts
|
|
2387
|
-
declare const setMode: (handler: ResolutionHandler) =>
|
|
2387
|
+
declare const setMode: (handler: ResolutionHandler) => void;
|
|
2388
2388
|
declare const getMode: (ref: RuntimeRef) => string;
|
|
2389
2389
|
//#endregion
|
|
2390
2390
|
//#region src/runtime/nonce.d.ts
|
|
@@ -2442,10 +2442,9 @@ declare const normalizeWatchers: (raw: ComponentConstructorChangeHandlers | unde
|
|
|
2442
2442
|
*
|
|
2443
2443
|
* @param propValue the new value to coerce to some type
|
|
2444
2444
|
* @param propType the type of the prop, expressed as a binary number
|
|
2445
|
-
* @param isFormAssociated whether the component is form-associated (optional)
|
|
2446
2445
|
* @returns the parsed/coerced value
|
|
2447
2446
|
*/
|
|
2448
|
-
declare const parsePropertyValue: (propValue: unknown, propType: number
|
|
2447
|
+
declare const parsePropertyValue: (propValue: unknown, propType: number) => any;
|
|
2449
2448
|
//#endregion
|
|
2450
2449
|
//#region src/runtime/platform-options.d.ts
|
|
2451
2450
|
interface SetPlatformOptions {
|
|
@@ -2542,4 +2541,4 @@ declare const jsxs: typeof jsx;
|
|
|
2542
2541
|
*/
|
|
2543
2542
|
declare const jsxDEV: typeof jsx;
|
|
2544
2543
|
//#endregion
|
|
2545
|
-
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,
|
|
2544
|
+
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, modeResolver, 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 };
|