@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
|
@@ -488,8 +488,8 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
488
488
|
//#endregion
|
|
489
489
|
//#region src/client/client-style.ts
|
|
490
490
|
const styles = /*@__PURE__*/ new Map();
|
|
491
|
-
const
|
|
492
|
-
const
|
|
491
|
+
const modeResolver = [];
|
|
492
|
+
const setScopedSSR = (_opts) => {};
|
|
493
493
|
const needsScopedSSR = () => false;
|
|
494
494
|
//#endregion
|
|
495
495
|
//#region src/runtime/runtime-constants.ts
|
|
@@ -601,7 +601,7 @@ let queuePending = false;
|
|
|
601
601
|
const queueDomReads = [];
|
|
602
602
|
const queueDomWrites = [];
|
|
603
603
|
const queueDomWritesLow = [];
|
|
604
|
-
const scheduleFlush = () => win.document?.hidden ?
|
|
604
|
+
const scheduleFlush = () => win.document?.hidden ? setTimeout(flush, 16) : plt.raf(flush);
|
|
605
605
|
const queueTask = (queue, write) => (cb) => {
|
|
606
606
|
queue.push(cb);
|
|
607
607
|
if (!queuePending) {
|
|
@@ -1847,10 +1847,10 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
|
|
|
1847
1847
|
const isComplex = isComplexType(newValue);
|
|
1848
1848
|
if (!BUILD$1.lazyLoad) {
|
|
1849
1849
|
const isStandardAttr = ln.startsWith("aria-") || ln.startsWith("data-");
|
|
1850
|
-
if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" &&
|
|
1850
|
+
if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" && !customElements.get(elm.tagName.toLowerCase())) {
|
|
1851
1851
|
if (!elm["s-pp"]) elm["s-pp"] = /* @__PURE__ */ new Map();
|
|
1852
1852
|
elm["s-pp"].set(memberName, newValue);
|
|
1853
|
-
return;
|
|
1853
|
+
if (isComplex || /[A-Z]/.test(memberName)) return;
|
|
1854
1854
|
}
|
|
1855
1855
|
}
|
|
1856
1856
|
if ((isProp || isComplex && newValue !== null) && !isSvg) try {
|
|
@@ -4009,7 +4009,7 @@ const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector)
|
|
|
4009
4009
|
else return shallowPart.trim();
|
|
4010
4010
|
}).join(", ");
|
|
4011
4011
|
};
|
|
4012
|
-
const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer");
|
|
4012
|
+
const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer") || selector.startsWith("@container");
|
|
4013
4013
|
const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
|
|
4014
4014
|
return processRules(cssText, (rule) => {
|
|
4015
4015
|
let selector = rule.selector;
|
|
@@ -4128,8 +4128,11 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
|
4128
4128
|
};
|
|
4129
4129
|
//#endregion
|
|
4130
4130
|
//#region src/runtime/mode.ts
|
|
4131
|
-
const computeMode = (elm) =>
|
|
4132
|
-
const setMode = (handler) =>
|
|
4131
|
+
const computeMode = (elm) => modeResolver.map((h) => h(elm)).find((m) => !!m);
|
|
4132
|
+
const setMode = (handler) => {
|
|
4133
|
+
modeResolver.length = 0;
|
|
4134
|
+
modeResolver.push(handler);
|
|
4135
|
+
};
|
|
4133
4136
|
const getMode = (ref) => getHostRef(ref)?.$modeName$;
|
|
4134
4137
|
//#endregion
|
|
4135
4138
|
//#region src/runtime/normalize-watchers.ts
|
|
@@ -4194,23 +4197,14 @@ const normalizeWatchers = (raw) => {
|
|
|
4194
4197
|
*
|
|
4195
4198
|
* @param propValue the new value to coerce to some type
|
|
4196
4199
|
* @param propType the type of the prop, expressed as a binary number
|
|
4197
|
-
* @param isFormAssociated whether the component is form-associated (optional)
|
|
4198
4200
|
* @returns the parsed/coerced value
|
|
4199
4201
|
*/
|
|
4200
|
-
const parsePropertyValue = (propValue, propType
|
|
4202
|
+
const parsePropertyValue = (propValue, propType) => {
|
|
4201
4203
|
if (propValue != null && !isComplexType(propValue)) {
|
|
4202
4204
|
/**
|
|
4203
4205
|
* ensure this value is of the correct prop type
|
|
4204
4206
|
*/
|
|
4205
|
-
if (BUILD$1.propBoolean && propType & MEMBER_FLAGS.Boolean)
|
|
4206
|
-
/**
|
|
4207
|
-
* For form-associated components, according to HTML spec, the presence of any boolean attribute
|
|
4208
|
-
* (regardless of its value, even "false") should make the property true.
|
|
4209
|
-
* For non-form-associated components, we maintain the legacy behavior where "false" becomes false.
|
|
4210
|
-
*/
|
|
4211
|
-
if (BUILD$1.formAssociated && isFormAssociated && typeof propValue === "string") return propValue === "" || !!propValue;
|
|
4212
|
-
else return propValue === "false" ? false : propValue === "" || !!propValue;
|
|
4213
|
-
}
|
|
4207
|
+
if (BUILD$1.propBoolean && propType & MEMBER_FLAGS.Boolean) return propValue === "" || !!propValue;
|
|
4214
4208
|
/**
|
|
4215
4209
|
* force it to be a number
|
|
4216
4210
|
*/
|
|
@@ -4252,7 +4246,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
4252
4246
|
if (BUILD$1.signalBacking) {
|
|
4253
4247
|
const sig = hostRef?.$signalValues$?.get(propName);
|
|
4254
4248
|
if (sig !== void 0) {
|
|
4255
|
-
const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]
|
|
4249
|
+
const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
4256
4250
|
if (BUILD$1.serializer && BUILD$1.reflect && cmpMeta.$attrsToReflect$ && cmpMeta.$serializers$?.[propName]) {
|
|
4257
4251
|
const elm = BUILD$1.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
4258
4252
|
applySerializers(hostRef, cmpMeta, propName, parsed, BUILD$1.lazyLoad ? hostRef.$lazyInstance$ : elm);
|
|
@@ -4270,7 +4264,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
4270
4264
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
4271
4265
|
const flags = hostRef.$flags$;
|
|
4272
4266
|
const instance = BUILD$1.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
4273
|
-
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]
|
|
4267
|
+
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
4274
4268
|
const didValueChange = newVal !== oldVal && !(Number.isNaN(oldVal) && Number.isNaN(newVal));
|
|
4275
4269
|
if ((!BUILD$1.lazyLoad || !(flags & HOST_FLAGS.isConstructingInstance) || oldVal === void 0) && didValueChange) {
|
|
4276
4270
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
@@ -4319,6 +4313,22 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
4319
4313
|
*/
|
|
4320
4314
|
const reflectedAttrValue = (propValue) => propValue == null || propValue === false ? null : propValue === true ? "" : String(propValue);
|
|
4321
4315
|
/**
|
|
4316
|
+
* Hand values written to a lazy component's element before its instance existed to the
|
|
4317
|
+
* instance's own `@Prop` setters. Must run as soon as the instance is constructed, so that
|
|
4318
|
+
* whenever `$lazyInstance$` is set, reads through it agree with the element's last write.
|
|
4319
|
+
*
|
|
4320
|
+
* @param hostRef the runtime bookkeeping object of a freshly constructed lazy instance
|
|
4321
|
+
* @param cmpMeta runtime metadata for the component (with any run-time only setters flagged)
|
|
4322
|
+
*/
|
|
4323
|
+
const replayPendingSetterValues = (hostRef, cmpMeta) => {
|
|
4324
|
+
const instance = hostRef.$lazyInstance$;
|
|
4325
|
+
if (!instance) return;
|
|
4326
|
+
for (const [memberName, [memberFlags]] of Object.entries(cmpMeta.$members$ ?? {})) if (memberFlags & MEMBER_FLAGS.Setter && hostRef.$instanceValues$.has(memberName)) {
|
|
4327
|
+
const pendingValue = hostRef.$instanceValues$.get(memberName);
|
|
4328
|
+
if (instance[memberName] !== pendingValue) instance[memberName] = pendingValue;
|
|
4329
|
+
}
|
|
4330
|
+
};
|
|
4331
|
+
/**
|
|
4322
4332
|
* Attach a series of runtime constructs to a compiled Stencil component
|
|
4323
4333
|
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
4324
4334
|
* decorators, callbacks for when attributes change, and so on.
|
|
@@ -4375,9 +4385,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4375
4385
|
if (BUILD$1.lazyLoad) {
|
|
4376
4386
|
if ((cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Getter) === 0) return getValue(this, memberName);
|
|
4377
4387
|
const ref = getHostRef(this);
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
return instance[memberName];
|
|
4388
|
+
if (!ref) return prototype[memberName];
|
|
4389
|
+
return ref.$lazyInstance$ ? ref.$lazyInstance$[memberName] : getValue(this, memberName);
|
|
4381
4390
|
}
|
|
4382
4391
|
if (!BUILD$1.lazyLoad) return origGetter ? origGetter.apply(this) : getValue(this, memberName);
|
|
4383
4392
|
},
|
|
@@ -4392,7 +4401,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4392
4401
|
}
|
|
4393
4402
|
if (origSetter) {
|
|
4394
4403
|
if (typeof (memberFlags & MEMBER_FLAGS.State ? this[memberName] : ref.$hostElement$[memberName]) === "undefined" && ref.$instanceValues$.get(memberName)) newValue = ref.$instanceValues$.get(memberName);
|
|
4395
|
-
origSetter.apply(this, [parsePropertyValue(newValue, memberFlags
|
|
4404
|
+
origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
|
|
4396
4405
|
newValue = memberFlags & MEMBER_FLAGS.State ? this[memberName] : ref.$hostElement$[memberName];
|
|
4397
4406
|
setValue(this, memberName, newValue, cmpMeta);
|
|
4398
4407
|
return;
|
|
@@ -4404,26 +4413,15 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4404
4413
|
if (BUILD$1.lazyLoad) {
|
|
4405
4414
|
if ((flags & PROXY_FLAGS.isElementConstructor) === 0 || (cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Setter) === 0) {
|
|
4406
4415
|
setValue(this, memberName, newValue, cmpMeta);
|
|
4407
|
-
if (flags & PROXY_FLAGS.isElementConstructor && !ref.$lazyInstance$) ref.$fetchedCbList$.push(() => {
|
|
4408
|
-
if (cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Setter && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) ref.$lazyInstance$[memberName] = newValue;
|
|
4409
|
-
});
|
|
4410
4416
|
return;
|
|
4411
4417
|
}
|
|
4412
|
-
const parsedValue = parsePropertyValue(newValue, memberFlags
|
|
4413
|
-
|
|
4418
|
+
const parsedValue = parsePropertyValue(newValue, memberFlags);
|
|
4419
|
+
if (ref.$lazyInstance$) {
|
|
4414
4420
|
const currentValue = ref.$lazyInstance$[memberName];
|
|
4415
4421
|
if (!ref.$instanceValues$.get(memberName) && currentValue) ref.$instanceValues$.set(memberName, currentValue);
|
|
4416
|
-
ref.$lazyInstance$[memberName] =
|
|
4422
|
+
ref.$lazyInstance$[memberName] = parsedValue;
|
|
4417
4423
|
setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
|
|
4418
|
-
};
|
|
4419
|
-
if (ref.$lazyInstance$) setterSetVal(parsedValue);
|
|
4420
|
-
else {
|
|
4421
|
-
ref.$instanceValues$.set(memberName, parsedValue);
|
|
4422
|
-
ref.$fetchedCbList$.push(() => {
|
|
4423
|
-
const pendingValue = ref.$instanceValues$.get(memberName);
|
|
4424
|
-
if (ref.$lazyInstance$[memberName] !== pendingValue) setterSetVal(pendingValue);
|
|
4425
|
-
});
|
|
4426
|
-
}
|
|
4424
|
+
} else ref.$instanceValues$.set(memberName, parsedValue);
|
|
4427
4425
|
}
|
|
4428
4426
|
} });
|
|
4429
4427
|
} else if (BUILD$1.lazyLoad && BUILD$1.method && flags & PROXY_FLAGS.isElementConstructor && memberFlags & MEMBER_FLAGS.Method) Object.defineProperty(prototype, memberName, { value(...args) {
|
|
@@ -4475,10 +4473,12 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4475
4473
|
const isBooleanTarget = propMemberFlags & MEMBER_FLAGS.Boolean;
|
|
4476
4474
|
if (BUILD$1.reflect && propMemberFlags & MEMBER_FLAGS.ReflectAttr && propMemberFlags & MEMBER_FLAGS.Any && !isComplexType(this[propName]) && reflectedAttrValue(this[propName]) === newValue) return;
|
|
4477
4475
|
const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
|
|
4478
|
-
if (isBooleanTarget)
|
|
4479
|
-
|
|
4476
|
+
if (isBooleanTarget) {
|
|
4477
|
+
if (BUILD$1.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.`);
|
|
4478
|
+
newValue = newValue !== null;
|
|
4479
|
+
}
|
|
4480
4480
|
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
4481
|
-
if (!isSpuriousBooleanRemoval && newValue !=
|
|
4481
|
+
if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) this[propName] = newValue;
|
|
4482
4482
|
});
|
|
4483
4483
|
};
|
|
4484
4484
|
Cstr.observedAttributes = Array.from(/* @__PURE__ */ new Set([...Object.keys(cmpMeta.$watchers$ ?? {}), ...members.filter(([_, m]) => m[0] & MEMBER_FLAGS.HasAttribute).map(([propName, m]) => {
|
|
@@ -4539,7 +4539,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
4539
4539
|
} catch (e) {
|
|
4540
4540
|
consoleError(e, elm);
|
|
4541
4541
|
}
|
|
4542
|
-
if (BUILD$1.member)
|
|
4542
|
+
if (BUILD$1.member) {
|
|
4543
|
+
hostRef.$flags$ &= ~HOST_FLAGS.isConstructingInstance;
|
|
4544
|
+
replayPendingSetterValues(hostRef, cmpMeta);
|
|
4545
|
+
}
|
|
4543
4546
|
endNewInstance();
|
|
4544
4547
|
if (BUILD$1.asyncLoading && hostRef.$ancestorComponent$) await awaitAncestorConnected(hostRef.$ancestorComponent$);
|
|
4545
4548
|
if (!(BUILD$1.slotRelocation && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation)) {
|
|
@@ -4641,9 +4644,16 @@ const connectedCallback = (elm) => {
|
|
|
4641
4644
|
}
|
|
4642
4645
|
if (BUILD$1.asyncLoading) {
|
|
4643
4646
|
let ancestorComponent = elm;
|
|
4644
|
-
while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
+
while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
|
|
4648
|
+
if (BUILD$1.hydrateClientSide && !ancestorComponent["s-p"] && ancestorComponent.nodeType === NODE_TYPE.ElementNode && ancestorComponent.hasAttribute("s-id")) {
|
|
4649
|
+
ancestorComponent["s-p"] = [];
|
|
4650
|
+
ancestorComponent["s-rc"] = [];
|
|
4651
|
+
ancestorComponent["s-pc"] = [];
|
|
4652
|
+
}
|
|
4653
|
+
if (ancestorComponent["s-p"]) {
|
|
4654
|
+
attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
|
|
4655
|
+
break;
|
|
4656
|
+
}
|
|
4647
4657
|
}
|
|
4648
4658
|
}
|
|
4649
4659
|
if (BUILD$1.prop && !BUILD$1.hydrateServerSide && cmpMeta.$members$) Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
@@ -4759,48 +4769,45 @@ const hmrStandalone = async (hostElement, cmpMeta, hmrVersionId) => {
|
|
|
4759
4769
|
`${modulePath}?s-hmr=${hmrVersionId}`
|
|
4760
4770
|
);
|
|
4761
4771
|
const NewClass = Object.values(newModule).find((v) => typeof v === "function" && v.is === cmpMeta.$tagName$) ?? newModule.default;
|
|
4762
|
-
if (
|
|
4763
|
-
const ctor = customElements.get(cmpMeta.$tagName$);
|
|
4764
|
-
if (ctor) {
|
|
4765
|
-
for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
|
|
4766
|
-
if (key === "constructor") continue;
|
|
4767
|
-
Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
|
|
4768
|
-
}
|
|
4769
|
-
const styleDesc = Object.getOwnPropertyDescriptor(NewClass, "style");
|
|
4770
|
-
if (styleDesc) {
|
|
4771
|
-
Object.defineProperty(ctor, "style", styleDesc);
|
|
4772
|
-
const newStyle = NewClass.style;
|
|
4773
|
-
if (newStyle) {
|
|
4774
|
-
const scopeId = getScopeId(cmpMeta);
|
|
4775
|
-
const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
|
|
4776
|
-
console.log("[stencil-hmr] registerStyle", {
|
|
4777
|
-
tag: cmpMeta.$tagName$,
|
|
4778
|
-
scopeId,
|
|
4779
|
-
isShadow,
|
|
4780
|
-
cssLen: newStyle.length
|
|
4781
|
-
});
|
|
4782
|
-
registerStyle(scopeId, newStyle, isShadow);
|
|
4783
|
-
}
|
|
4784
|
-
}
|
|
4785
|
-
}
|
|
4786
|
-
const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
|
|
4787
|
-
document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => {
|
|
4788
|
-
const hostRef = getHostRef(el);
|
|
4789
|
-
if (BUILD$1.hostListener && hostRef?.$rmListeners$) {
|
|
4790
|
-
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
4791
|
-
hostRef.$rmListeners$ = void 0;
|
|
4792
|
-
addHostEventListeners(el, hostRef, cmpMeta.$listeners$);
|
|
4793
|
-
}
|
|
4794
|
-
if (!isShadow && hostRef) {
|
|
4795
|
-
console.log("[stencil-hmr] calling attachStyles for", cmpMeta.$tagName$);
|
|
4796
|
-
attachStyles(hostRef);
|
|
4797
|
-
}
|
|
4798
|
-
forceUpdate(el);
|
|
4799
|
-
});
|
|
4772
|
+
if (NewClass) hmrApplyClass(cmpMeta, NewClass);
|
|
4800
4773
|
} catch (e) {
|
|
4801
4774
|
console.error(`[Stencil HMR] Failed to reload <${cmpMeta.$tagName$}>`, e);
|
|
4802
4775
|
}
|
|
4803
4776
|
};
|
|
4777
|
+
/**
|
|
4778
|
+
* Patch a re-executed component class onto the registered one and re-render every live instance.
|
|
4779
|
+
* Shared by the standalone re-import above and bundlers that re-execute the module themselves
|
|
4780
|
+
* (webpack/rspack `module.hot`), which reach it via the constructor's `s-hmr-apply` hook.
|
|
4781
|
+
*
|
|
4782
|
+
* @param cmpMeta runtime metadata for the component
|
|
4783
|
+
* @param NewClass the component's newly executed class
|
|
4784
|
+
*/
|
|
4785
|
+
const hmrApplyClass = (cmpMeta, NewClass) => {
|
|
4786
|
+
const ctor = customElements.get(cmpMeta.$tagName$);
|
|
4787
|
+
const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
|
|
4788
|
+
if (ctor && ctor !== NewClass) {
|
|
4789
|
+
for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
|
|
4790
|
+
if (key === "constructor") continue;
|
|
4791
|
+
Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
|
|
4792
|
+
}
|
|
4793
|
+
const styleDesc = Object.getOwnPropertyDescriptor(NewClass, "style");
|
|
4794
|
+
if (styleDesc) {
|
|
4795
|
+
Object.defineProperty(ctor, "style", styleDesc);
|
|
4796
|
+
const newStyle = NewClass.style;
|
|
4797
|
+
if (newStyle) registerStyle(getScopeId(cmpMeta), newStyle, isShadow);
|
|
4798
|
+
}
|
|
4799
|
+
}
|
|
4800
|
+
document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => {
|
|
4801
|
+
const hostRef = getHostRef(el);
|
|
4802
|
+
if (BUILD$1.hostListener && hostRef?.$rmListeners$) {
|
|
4803
|
+
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
4804
|
+
hostRef.$rmListeners$ = void 0;
|
|
4805
|
+
addHostEventListeners(el, hostRef, cmpMeta.$listeners$);
|
|
4806
|
+
}
|
|
4807
|
+
if (!isShadow && hostRef) attachStyles(hostRef);
|
|
4808
|
+
forceUpdate(el);
|
|
4809
|
+
});
|
|
4810
|
+
};
|
|
4804
4811
|
//#endregion
|
|
4805
4812
|
//#region src/runtime/bootstrap-standalone.ts
|
|
4806
4813
|
const defineCustomElement = (Cstr, compactMeta) => {
|
|
@@ -4823,9 +4830,12 @@ const proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
4823
4830
|
cmpMeta.$serializers$ = Cstr.$serializers$;
|
|
4824
4831
|
}
|
|
4825
4832
|
if (BUILD$1.reflect) cmpMeta.$attrsToReflect$ = [];
|
|
4826
|
-
if (BUILD$1.hotModuleReplacement)
|
|
4827
|
-
|
|
4828
|
-
|
|
4833
|
+
if (BUILD$1.hotModuleReplacement) {
|
|
4834
|
+
Cstr.prototype["s-hmr"] = function(hmrVersionId) {
|
|
4835
|
+
hmrStart(this, cmpMeta, hmrVersionId);
|
|
4836
|
+
};
|
|
4837
|
+
Cstr["s-hmr-apply"] = (NewClass) => hmrApplyClass(cmpMeta, NewClass);
|
|
4838
|
+
}
|
|
4829
4839
|
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && (BUILD$1.slotCloneNode || BUILD$1.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone)) patchCloneNode(Cstr.prototype);
|
|
4830
4840
|
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) {
|
|
4831
4841
|
if (BUILD$1.lightDomPatches || BUILD$1.patchAll && cmpMeta.$flags$ & CMP_FLAGS.patchAll) applyLightDomPatches(Cstr.prototype);
|
|
@@ -5341,4 +5351,4 @@ function hasKeys(obj) {
|
|
|
5341
5351
|
return false;
|
|
5342
5352
|
}
|
|
5343
5353
|
//#endregion
|
|
5344
|
-
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,
|
|
5354
|
+
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 };
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ type Ctor<T = {}> = new (...args: any[]) => T;
|
|
|
78
78
|
declare function Mixin(...mixins: ((base: Ctor) => Ctor)[]): Ctor<{}>;
|
|
79
79
|
//#endregion
|
|
80
80
|
//#region src/runtime/mode.d.ts
|
|
81
|
-
declare const setMode: (handler: ResolutionHandler) =>
|
|
81
|
+
declare const setMode: (handler: ResolutionHandler) => void;
|
|
82
82
|
declare const getMode: (ref: RuntimeRef) => string;
|
|
83
83
|
//#endregion
|
|
84
84
|
//#region src/runtime/nonce.d.ts
|
|
@@ -136,10 +136,9 @@ declare const normalizeWatchers: (raw: ComponentConstructorChangeHandlers | unde
|
|
|
136
136
|
*
|
|
137
137
|
* @param propValue the new value to coerce to some type
|
|
138
138
|
* @param propType the type of the prop, expressed as a binary number
|
|
139
|
-
* @param isFormAssociated whether the component is form-associated (optional)
|
|
140
139
|
* @returns the parsed/coerced value
|
|
141
140
|
*/
|
|
142
|
-
declare const parsePropertyValue: (propValue: unknown, propType: number
|
|
141
|
+
declare const parsePropertyValue: (propValue: unknown, propType: number) => any;
|
|
143
142
|
//#endregion
|
|
144
143
|
//#region src/runtime/platform-options.d.ts
|
|
145
144
|
interface SetPlatformOptions {
|