@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
package/dist/runtime/index.js
CHANGED
|
@@ -371,7 +371,7 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
371
371
|
//#endregion
|
|
372
372
|
//#region src/client/client-style.ts
|
|
373
373
|
const styles = /*@__PURE__*/ new Map();
|
|
374
|
-
const
|
|
374
|
+
const modeResolver = [];
|
|
375
375
|
const needsScopedSSR = () => false;
|
|
376
376
|
//#endregion
|
|
377
377
|
//#region src/runtime/runtime-constants.ts
|
|
@@ -480,7 +480,7 @@ let queuePending = false;
|
|
|
480
480
|
const queueDomReads = [];
|
|
481
481
|
const queueDomWrites = [];
|
|
482
482
|
const queueDomWritesLow = [];
|
|
483
|
-
const scheduleFlush = () => win.document?.hidden ?
|
|
483
|
+
const scheduleFlush = () => win.document?.hidden ? setTimeout(flush, 16) : plt.raf(flush);
|
|
484
484
|
const queueTask = (queue, write) => (cb) => {
|
|
485
485
|
queue.push(cb);
|
|
486
486
|
if (!queuePending) {
|
|
@@ -1719,10 +1719,10 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
|
|
|
1719
1719
|
const isComplex = isComplexType(newValue);
|
|
1720
1720
|
if (!BUILD.lazyLoad) {
|
|
1721
1721
|
const isStandardAttr = ln.startsWith("aria-") || ln.startsWith("data-");
|
|
1722
|
-
if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" &&
|
|
1722
|
+
if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" && !customElements.get(elm.tagName.toLowerCase())) {
|
|
1723
1723
|
if (!elm["s-pp"]) elm["s-pp"] = /* @__PURE__ */ new Map();
|
|
1724
1724
|
elm["s-pp"].set(memberName, newValue);
|
|
1725
|
-
return;
|
|
1725
|
+
if (isComplex || /[A-Z]/.test(memberName)) return;
|
|
1726
1726
|
}
|
|
1727
1727
|
}
|
|
1728
1728
|
if ((isProp || isComplex && newValue !== null) && !isSvg) try {
|
|
@@ -3881,7 +3881,7 @@ const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector)
|
|
|
3881
3881
|
else return shallowPart.trim();
|
|
3882
3882
|
}).join(", ");
|
|
3883
3883
|
};
|
|
3884
|
-
const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer");
|
|
3884
|
+
const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer") || selector.startsWith("@container");
|
|
3885
3885
|
const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
|
|
3886
3886
|
return processRules(cssText, (rule) => {
|
|
3887
3887
|
let selector = rule.selector;
|
|
@@ -4000,8 +4000,11 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
|
4000
4000
|
};
|
|
4001
4001
|
//#endregion
|
|
4002
4002
|
//#region src/runtime/mode.ts
|
|
4003
|
-
const computeMode = (elm) =>
|
|
4004
|
-
const setMode = (handler) =>
|
|
4003
|
+
const computeMode = (elm) => modeResolver.map((h) => h(elm)).find((m) => !!m);
|
|
4004
|
+
const setMode = (handler) => {
|
|
4005
|
+
modeResolver.length = 0;
|
|
4006
|
+
modeResolver.push(handler);
|
|
4007
|
+
};
|
|
4005
4008
|
const getMode = (ref) => getHostRef(ref)?.$modeName$;
|
|
4006
4009
|
//#endregion
|
|
4007
4010
|
//#region src/runtime/normalize-watchers.ts
|
|
@@ -4066,23 +4069,14 @@ const normalizeWatchers = (raw) => {
|
|
|
4066
4069
|
*
|
|
4067
4070
|
* @param propValue the new value to coerce to some type
|
|
4068
4071
|
* @param propType the type of the prop, expressed as a binary number
|
|
4069
|
-
* @param isFormAssociated whether the component is form-associated (optional)
|
|
4070
4072
|
* @returns the parsed/coerced value
|
|
4071
4073
|
*/
|
|
4072
|
-
const parsePropertyValue = (propValue, propType
|
|
4074
|
+
const parsePropertyValue = (propValue, propType) => {
|
|
4073
4075
|
if (propValue != null && !isComplexType(propValue)) {
|
|
4074
4076
|
/**
|
|
4075
4077
|
* ensure this value is of the correct prop type
|
|
4076
4078
|
*/
|
|
4077
|
-
if (BUILD.propBoolean && propType & MEMBER_FLAGS.Boolean)
|
|
4078
|
-
/**
|
|
4079
|
-
* For form-associated components, according to HTML spec, the presence of any boolean attribute
|
|
4080
|
-
* (regardless of its value, even "false") should make the property true.
|
|
4081
|
-
* For non-form-associated components, we maintain the legacy behavior where "false" becomes false.
|
|
4082
|
-
*/
|
|
4083
|
-
if (BUILD.formAssociated && isFormAssociated && typeof propValue === "string") return propValue === "" || !!propValue;
|
|
4084
|
-
else return propValue === "false" ? false : propValue === "" || !!propValue;
|
|
4085
|
-
}
|
|
4079
|
+
if (BUILD.propBoolean && propType & MEMBER_FLAGS.Boolean) return propValue === "" || !!propValue;
|
|
4086
4080
|
/**
|
|
4087
4081
|
* force it to be a number
|
|
4088
4082
|
*/
|
|
@@ -4124,7 +4118,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
4124
4118
|
if (BUILD.signalBacking) {
|
|
4125
4119
|
const sig = hostRef?.$signalValues$?.get(propName);
|
|
4126
4120
|
if (sig !== void 0) {
|
|
4127
|
-
const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]
|
|
4121
|
+
const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
4128
4122
|
if (BUILD.serializer && BUILD.reflect && cmpMeta.$attrsToReflect$ && cmpMeta.$serializers$?.[propName]) {
|
|
4129
4123
|
const elm = BUILD.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
4130
4124
|
applySerializers(hostRef, cmpMeta, propName, parsed, BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm);
|
|
@@ -4142,7 +4136,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
4142
4136
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
4143
4137
|
const flags = hostRef.$flags$;
|
|
4144
4138
|
const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
4145
|
-
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]
|
|
4139
|
+
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
4146
4140
|
const didValueChange = newVal !== oldVal && !(Number.isNaN(oldVal) && Number.isNaN(newVal));
|
|
4147
4141
|
if ((!BUILD.lazyLoad || !(flags & HOST_FLAGS.isConstructingInstance) || oldVal === void 0) && didValueChange) {
|
|
4148
4142
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
@@ -4191,6 +4185,22 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
4191
4185
|
*/
|
|
4192
4186
|
const reflectedAttrValue = (propValue) => propValue == null || propValue === false ? null : propValue === true ? "" : String(propValue);
|
|
4193
4187
|
/**
|
|
4188
|
+
* Hand values written to a lazy component's element before its instance existed to the
|
|
4189
|
+
* instance's own `@Prop` setters. Must run as soon as the instance is constructed, so that
|
|
4190
|
+
* whenever `$lazyInstance$` is set, reads through it agree with the element's last write.
|
|
4191
|
+
*
|
|
4192
|
+
* @param hostRef the runtime bookkeeping object of a freshly constructed lazy instance
|
|
4193
|
+
* @param cmpMeta runtime metadata for the component (with any run-time only setters flagged)
|
|
4194
|
+
*/
|
|
4195
|
+
const replayPendingSetterValues = (hostRef, cmpMeta) => {
|
|
4196
|
+
const instance = hostRef.$lazyInstance$;
|
|
4197
|
+
if (!instance) return;
|
|
4198
|
+
for (const [memberName, [memberFlags]] of Object.entries(cmpMeta.$members$ ?? {})) if (memberFlags & MEMBER_FLAGS.Setter && hostRef.$instanceValues$.has(memberName)) {
|
|
4199
|
+
const pendingValue = hostRef.$instanceValues$.get(memberName);
|
|
4200
|
+
if (instance[memberName] !== pendingValue) instance[memberName] = pendingValue;
|
|
4201
|
+
}
|
|
4202
|
+
};
|
|
4203
|
+
/**
|
|
4194
4204
|
* Attach a series of runtime constructs to a compiled Stencil component
|
|
4195
4205
|
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
4196
4206
|
* decorators, callbacks for when attributes change, and so on.
|
|
@@ -4247,9 +4257,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4247
4257
|
if (BUILD.lazyLoad) {
|
|
4248
4258
|
if ((cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Getter) === 0) return getValue(this, memberName);
|
|
4249
4259
|
const ref = getHostRef(this);
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
return instance[memberName];
|
|
4260
|
+
if (!ref) return prototype[memberName];
|
|
4261
|
+
return ref.$lazyInstance$ ? ref.$lazyInstance$[memberName] : getValue(this, memberName);
|
|
4253
4262
|
}
|
|
4254
4263
|
if (!BUILD.lazyLoad) return origGetter ? origGetter.apply(this) : getValue(this, memberName);
|
|
4255
4264
|
},
|
|
@@ -4264,7 +4273,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4264
4273
|
}
|
|
4265
4274
|
if (origSetter) {
|
|
4266
4275
|
if (typeof (memberFlags & MEMBER_FLAGS.State ? this[memberName] : ref.$hostElement$[memberName]) === "undefined" && ref.$instanceValues$.get(memberName)) newValue = ref.$instanceValues$.get(memberName);
|
|
4267
|
-
origSetter.apply(this, [parsePropertyValue(newValue, memberFlags
|
|
4276
|
+
origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
|
|
4268
4277
|
newValue = memberFlags & MEMBER_FLAGS.State ? this[memberName] : ref.$hostElement$[memberName];
|
|
4269
4278
|
setValue(this, memberName, newValue, cmpMeta);
|
|
4270
4279
|
return;
|
|
@@ -4276,26 +4285,15 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4276
4285
|
if (BUILD.lazyLoad) {
|
|
4277
4286
|
if ((flags & PROXY_FLAGS.isElementConstructor) === 0 || (cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Setter) === 0) {
|
|
4278
4287
|
setValue(this, memberName, newValue, cmpMeta);
|
|
4279
|
-
if (flags & PROXY_FLAGS.isElementConstructor && !ref.$lazyInstance$) ref.$fetchedCbList$.push(() => {
|
|
4280
|
-
if (cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Setter && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) ref.$lazyInstance$[memberName] = newValue;
|
|
4281
|
-
});
|
|
4282
4288
|
return;
|
|
4283
4289
|
}
|
|
4284
|
-
const parsedValue = parsePropertyValue(newValue, memberFlags
|
|
4285
|
-
|
|
4290
|
+
const parsedValue = parsePropertyValue(newValue, memberFlags);
|
|
4291
|
+
if (ref.$lazyInstance$) {
|
|
4286
4292
|
const currentValue = ref.$lazyInstance$[memberName];
|
|
4287
4293
|
if (!ref.$instanceValues$.get(memberName) && currentValue) ref.$instanceValues$.set(memberName, currentValue);
|
|
4288
|
-
ref.$lazyInstance$[memberName] =
|
|
4294
|
+
ref.$lazyInstance$[memberName] = parsedValue;
|
|
4289
4295
|
setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
|
|
4290
|
-
};
|
|
4291
|
-
if (ref.$lazyInstance$) setterSetVal(parsedValue);
|
|
4292
|
-
else {
|
|
4293
|
-
ref.$instanceValues$.set(memberName, parsedValue);
|
|
4294
|
-
ref.$fetchedCbList$.push(() => {
|
|
4295
|
-
const pendingValue = ref.$instanceValues$.get(memberName);
|
|
4296
|
-
if (ref.$lazyInstance$[memberName] !== pendingValue) setterSetVal(pendingValue);
|
|
4297
|
-
});
|
|
4298
|
-
}
|
|
4296
|
+
} else ref.$instanceValues$.set(memberName, parsedValue);
|
|
4299
4297
|
}
|
|
4300
4298
|
} });
|
|
4301
4299
|
} else if (BUILD.lazyLoad && BUILD.method && flags & PROXY_FLAGS.isElementConstructor && memberFlags & MEMBER_FLAGS.Method) Object.defineProperty(prototype, memberName, { value(...args) {
|
|
@@ -4347,10 +4345,12 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4347
4345
|
const isBooleanTarget = propMemberFlags & MEMBER_FLAGS.Boolean;
|
|
4348
4346
|
if (BUILD.reflect && propMemberFlags & MEMBER_FLAGS.ReflectAttr && propMemberFlags & MEMBER_FLAGS.Any && !isComplexType(this[propName]) && reflectedAttrValue(this[propName]) === newValue) return;
|
|
4349
4347
|
const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
|
|
4350
|
-
if (isBooleanTarget)
|
|
4351
|
-
|
|
4348
|
+
if (isBooleanTarget) {
|
|
4349
|
+
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.`);
|
|
4350
|
+
newValue = newValue !== null;
|
|
4351
|
+
}
|
|
4352
4352
|
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
4353
|
-
if (!isSpuriousBooleanRemoval && newValue !=
|
|
4353
|
+
if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) this[propName] = newValue;
|
|
4354
4354
|
});
|
|
4355
4355
|
};
|
|
4356
4356
|
Cstr.observedAttributes = Array.from(/* @__PURE__ */ new Set([...Object.keys(cmpMeta.$watchers$ ?? {}), ...members.filter(([_, m]) => m[0] & MEMBER_FLAGS.HasAttribute).map(([propName, m]) => {
|
|
@@ -4411,7 +4411,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
4411
4411
|
} catch (e) {
|
|
4412
4412
|
consoleError(e, elm);
|
|
4413
4413
|
}
|
|
4414
|
-
if (BUILD.member)
|
|
4414
|
+
if (BUILD.member) {
|
|
4415
|
+
hostRef.$flags$ &= ~HOST_FLAGS.isConstructingInstance;
|
|
4416
|
+
replayPendingSetterValues(hostRef, cmpMeta);
|
|
4417
|
+
}
|
|
4415
4418
|
endNewInstance();
|
|
4416
4419
|
if (BUILD.asyncLoading && hostRef.$ancestorComponent$) await awaitAncestorConnected(hostRef.$ancestorComponent$);
|
|
4417
4420
|
if (!(BUILD.slotRelocation && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation)) {
|
|
@@ -4513,9 +4516,16 @@ const connectedCallback = (elm) => {
|
|
|
4513
4516
|
}
|
|
4514
4517
|
if (BUILD.asyncLoading) {
|
|
4515
4518
|
let ancestorComponent = elm;
|
|
4516
|
-
while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
+
while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
|
|
4520
|
+
if (BUILD.hydrateClientSide && !ancestorComponent["s-p"] && ancestorComponent.nodeType === NODE_TYPE.ElementNode && ancestorComponent.hasAttribute("s-id")) {
|
|
4521
|
+
ancestorComponent["s-p"] = [];
|
|
4522
|
+
ancestorComponent["s-rc"] = [];
|
|
4523
|
+
ancestorComponent["s-pc"] = [];
|
|
4524
|
+
}
|
|
4525
|
+
if (ancestorComponent["s-p"]) {
|
|
4526
|
+
attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
|
|
4527
|
+
break;
|
|
4528
|
+
}
|
|
4519
4529
|
}
|
|
4520
4530
|
}
|
|
4521
4531
|
if (BUILD.prop && !BUILD.hydrateServerSide && cmpMeta.$members$) Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
@@ -4631,48 +4641,45 @@ const hmrStandalone = async (hostElement, cmpMeta, hmrVersionId) => {
|
|
|
4631
4641
|
`${modulePath}?s-hmr=${hmrVersionId}`
|
|
4632
4642
|
);
|
|
4633
4643
|
const NewClass = Object.values(newModule).find((v) => typeof v === "function" && v.is === cmpMeta.$tagName$) ?? newModule.default;
|
|
4634
|
-
if (
|
|
4635
|
-
const ctor = customElements.get(cmpMeta.$tagName$);
|
|
4636
|
-
if (ctor) {
|
|
4637
|
-
for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
|
|
4638
|
-
if (key === "constructor") continue;
|
|
4639
|
-
Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
|
|
4640
|
-
}
|
|
4641
|
-
const styleDesc = Object.getOwnPropertyDescriptor(NewClass, "style");
|
|
4642
|
-
if (styleDesc) {
|
|
4643
|
-
Object.defineProperty(ctor, "style", styleDesc);
|
|
4644
|
-
const newStyle = NewClass.style;
|
|
4645
|
-
if (newStyle) {
|
|
4646
|
-
const scopeId = getScopeId(cmpMeta);
|
|
4647
|
-
const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
|
|
4648
|
-
console.log("[stencil-hmr] registerStyle", {
|
|
4649
|
-
tag: cmpMeta.$tagName$,
|
|
4650
|
-
scopeId,
|
|
4651
|
-
isShadow,
|
|
4652
|
-
cssLen: newStyle.length
|
|
4653
|
-
});
|
|
4654
|
-
registerStyle(scopeId, newStyle, isShadow);
|
|
4655
|
-
}
|
|
4656
|
-
}
|
|
4657
|
-
}
|
|
4658
|
-
const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
|
|
4659
|
-
document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => {
|
|
4660
|
-
const hostRef = getHostRef(el);
|
|
4661
|
-
if (BUILD.hostListener && hostRef?.$rmListeners$) {
|
|
4662
|
-
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
4663
|
-
hostRef.$rmListeners$ = void 0;
|
|
4664
|
-
addHostEventListeners(el, hostRef, cmpMeta.$listeners$);
|
|
4665
|
-
}
|
|
4666
|
-
if (!isShadow && hostRef) {
|
|
4667
|
-
console.log("[stencil-hmr] calling attachStyles for", cmpMeta.$tagName$);
|
|
4668
|
-
attachStyles(hostRef);
|
|
4669
|
-
}
|
|
4670
|
-
forceUpdate(el);
|
|
4671
|
-
});
|
|
4644
|
+
if (NewClass) hmrApplyClass(cmpMeta, NewClass);
|
|
4672
4645
|
} catch (e) {
|
|
4673
4646
|
console.error(`[Stencil HMR] Failed to reload <${cmpMeta.$tagName$}>`, e);
|
|
4674
4647
|
}
|
|
4675
4648
|
};
|
|
4649
|
+
/**
|
|
4650
|
+
* Patch a re-executed component class onto the registered one and re-render every live instance.
|
|
4651
|
+
* Shared by the standalone re-import above and bundlers that re-execute the module themselves
|
|
4652
|
+
* (webpack/rspack `module.hot`), which reach it via the constructor's `s-hmr-apply` hook.
|
|
4653
|
+
*
|
|
4654
|
+
* @param cmpMeta runtime metadata for the component
|
|
4655
|
+
* @param NewClass the component's newly executed class
|
|
4656
|
+
*/
|
|
4657
|
+
const hmrApplyClass = (cmpMeta, NewClass) => {
|
|
4658
|
+
const ctor = customElements.get(cmpMeta.$tagName$);
|
|
4659
|
+
const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
|
|
4660
|
+
if (ctor && ctor !== NewClass) {
|
|
4661
|
+
for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
|
|
4662
|
+
if (key === "constructor") continue;
|
|
4663
|
+
Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
|
|
4664
|
+
}
|
|
4665
|
+
const styleDesc = Object.getOwnPropertyDescriptor(NewClass, "style");
|
|
4666
|
+
if (styleDesc) {
|
|
4667
|
+
Object.defineProperty(ctor, "style", styleDesc);
|
|
4668
|
+
const newStyle = NewClass.style;
|
|
4669
|
+
if (newStyle) registerStyle(getScopeId(cmpMeta), newStyle, isShadow);
|
|
4670
|
+
}
|
|
4671
|
+
}
|
|
4672
|
+
document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => {
|
|
4673
|
+
const hostRef = getHostRef(el);
|
|
4674
|
+
if (BUILD.hostListener && hostRef?.$rmListeners$) {
|
|
4675
|
+
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
4676
|
+
hostRef.$rmListeners$ = void 0;
|
|
4677
|
+
addHostEventListeners(el, hostRef, cmpMeta.$listeners$);
|
|
4678
|
+
}
|
|
4679
|
+
if (!isShadow && hostRef) attachStyles(hostRef);
|
|
4680
|
+
forceUpdate(el);
|
|
4681
|
+
});
|
|
4682
|
+
};
|
|
4676
4683
|
//#endregion
|
|
4677
4684
|
//#region src/runtime/bootstrap-standalone.ts
|
|
4678
4685
|
const defineCustomElement = (Cstr, compactMeta) => {
|
|
@@ -4695,9 +4702,12 @@ const proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
4695
4702
|
cmpMeta.$serializers$ = Cstr.$serializers$;
|
|
4696
4703
|
}
|
|
4697
4704
|
if (BUILD.reflect) cmpMeta.$attrsToReflect$ = [];
|
|
4698
|
-
if (BUILD.hotModuleReplacement)
|
|
4699
|
-
|
|
4700
|
-
|
|
4705
|
+
if (BUILD.hotModuleReplacement) {
|
|
4706
|
+
Cstr.prototype["s-hmr"] = function(hmrVersionId) {
|
|
4707
|
+
hmrStart(this, cmpMeta, hmrVersionId);
|
|
4708
|
+
};
|
|
4709
|
+
Cstr["s-hmr-apply"] = (NewClass) => hmrApplyClass(cmpMeta, NewClass);
|
|
4710
|
+
}
|
|
4701
4711
|
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && (BUILD.slotCloneNode || BUILD.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone)) patchCloneNode(Cstr.prototype);
|
|
4702
4712
|
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) {
|
|
4703
4713
|
if (BUILD.lightDomPatches || BUILD.patchAll && cmpMeta.$flags$ & CMP_FLAGS.patchAll) applyLightDomPatches(Cstr.prototype);
|
|
@@ -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 };
|