@stencil/core 5.0.0-rc.0 → 5.0.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{client-ClM4H9-P.mjs → client-DkvdNuPu.mjs} +12 -10
- package/dist/compiler/browser.d.ts +23 -5
- package/dist/compiler/browser.js +99 -17
- package/dist/compiler/index.d.mts +2 -2
- package/dist/compiler/index.mjs +2 -2
- package/dist/compiler/utils/index.d.mts +1 -1
- package/dist/compiler/utils/index.mjs +3 -3
- package/dist/{compiler-DFanjq9z.mjs → compiler-ChKFuRry.mjs} +329 -126
- package/dist/declarations/stencil-public-compiler.d.ts +25 -7
- package/dist/{helpers-Cpp3qc3u.mjs → helpers-pTCZhNi0.mjs} +5 -0
- package/dist/{index-DvfFOkiJ.d.mts → index-BxnfbT3a.d.mts} +30 -7
- package/dist/{index-aBMJC5F9.d.mts → index-xOwTL_5Z.d.mts} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/jsx-runtime.mjs +1 -1
- package/dist/{node-DJP8JuAS.mjs → node-C59vQZNg.mjs} +3 -3
- package/dist/runtime/client/lazy.js +211 -161
- package/dist/runtime/client/runtime.js +211 -161
- package/dist/runtime/index.js +211 -161
- package/dist/runtime/server/index.mjs +211 -161
- package/dist/runtime/server/runner.mjs +82 -7
- 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.mjs +207 -160
- package/dist/{util-C-H1H84W.mjs → util-CP6-333M.mjs} +1 -1
- package/dist/{validation-ByYYKvnS.mjs → validation-C1mr0klL.mjs} +2 -2
- package/package.json +4 -4
package/dist/testing/index.mjs
CHANGED
|
@@ -33,7 +33,7 @@ import "@rollup/pluginutils";
|
|
|
33
33
|
import { createHash } from "crypto";
|
|
34
34
|
import { afterAll, vi } from "vitest";
|
|
35
35
|
//#region src/version.ts
|
|
36
|
-
const version = "5.0.0-rc.
|
|
36
|
+
const version = "5.0.0-rc.10";
|
|
37
37
|
const MEMBER_FLAGS = {
|
|
38
38
|
String: 1,
|
|
39
39
|
Number: 2,
|
|
@@ -88,6 +88,11 @@ const HOST_FLAGS = {
|
|
|
88
88
|
* is true while an initialization attempt is merely queued/in-flight.
|
|
89
89
|
*/
|
|
90
90
|
hasFailedLoad: 2048,
|
|
91
|
+
/**
|
|
92
|
+
* Set while `renderVdom` patches the host, so writes of a serialized reflected value
|
|
93
|
+
* coming from the runtime's own reflection aren't applied back to the prop.
|
|
94
|
+
*/
|
|
95
|
+
isReflecting: 16384,
|
|
91
96
|
devOnRender: 4096,
|
|
92
97
|
devOnDidLoad: 8192
|
|
93
98
|
};
|
|
@@ -1540,7 +1545,7 @@ const patchSlotPrepend = (HostElementPrototype) => {
|
|
|
1540
1545
|
return toReturn;
|
|
1541
1546
|
}
|
|
1542
1547
|
if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) newChild.hidden = true;
|
|
1543
|
-
return HostElementPrototype.__prepend(newChild);
|
|
1548
|
+
return HostElementPrototype.__prepend.call(this, newChild);
|
|
1544
1549
|
});
|
|
1545
1550
|
};
|
|
1546
1551
|
};
|
|
@@ -2152,7 +2157,7 @@ const attachStyles = (hostRef) => {
|
|
|
2152
2157
|
else if (BUILD.hydrateServerSide && BUILD.shadowModeClosed && flags & CMP_FLAGS.shadowNeedsScopedCss && flags & CMP_FLAGS.shadowModeClosed) styleContainerNode = elm;
|
|
2153
2158
|
else styleContainerNode = elm.getRootNode();
|
|
2154
2159
|
const scopeId = addStyle(styleContainerNode, cmpMeta, hostRef.$modeName$);
|
|
2155
|
-
if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & CMP_FLAGS.needsScopedEncapsulation) {
|
|
2160
|
+
if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & (CMP_FLAGS.needsScopedEncapsulation | CMP_FLAGS.shadowNeedsScopedCss)) {
|
|
2156
2161
|
elm["s-sc"] = scopeId;
|
|
2157
2162
|
elm.classList.add(scopeId + "-h");
|
|
2158
2163
|
}
|
|
@@ -2219,12 +2224,51 @@ const hydrateScopedToShadow = (cmpMetas) => {
|
|
|
2219
2224
|
}
|
|
2220
2225
|
};
|
|
2221
2226
|
//#endregion
|
|
2222
|
-
//#region src/runtime/
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2227
|
+
//#region src/runtime/parse-property-value.ts
|
|
2228
|
+
/**
|
|
2229
|
+
* Parse a new property value for a given property type.
|
|
2230
|
+
*
|
|
2231
|
+
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
2232
|
+
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
2233
|
+
* 1. `any`, the type given to `propValue` in the function signature
|
|
2234
|
+
* 2. the type stored from `propType`.
|
|
2235
|
+
*
|
|
2236
|
+
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
2237
|
+
*
|
|
2238
|
+
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
2239
|
+
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
2240
|
+
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
2241
|
+
* ```tsx
|
|
2242
|
+
* <my-cmp prop-val={0}></my-cmp>
|
|
2243
|
+
* ```
|
|
2244
|
+
*
|
|
2245
|
+
* HTML prop values on the other hand, will always a string
|
|
2246
|
+
*
|
|
2247
|
+
* @param propValue the new value to coerce to some type
|
|
2248
|
+
* @param propType the type of the prop, expressed as a binary number
|
|
2249
|
+
* @returns the parsed/coerced value
|
|
2250
|
+
*/
|
|
2251
|
+
const parsePropertyValue = (propValue, propType) => {
|
|
2252
|
+
if (propValue != null && !isComplexType(propValue)) {
|
|
2253
|
+
/**
|
|
2254
|
+
* ensure this value is of the correct prop type
|
|
2255
|
+
*/
|
|
2256
|
+
if (BUILD.propBoolean && propType & MEMBER_FLAGS.Boolean) return propValue === "" || !!propValue;
|
|
2257
|
+
/**
|
|
2258
|
+
* force it to be a number
|
|
2259
|
+
*/
|
|
2260
|
+
if (BUILD.propNumber && propType & MEMBER_FLAGS.Number) return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
|
|
2261
|
+
/**
|
|
2262
|
+
* could have been passed as a number or boolean but we still want it as a string
|
|
2263
|
+
*/
|
|
2264
|
+
if (BUILD.propString && propType & MEMBER_FLAGS.String) return String(propValue);
|
|
2265
|
+
return propValue;
|
|
2266
|
+
}
|
|
2267
|
+
/**
|
|
2268
|
+
* not sure exactly what type we want so no need to change to a different type
|
|
2269
|
+
*/
|
|
2270
|
+
return propValue;
|
|
2271
|
+
};
|
|
2228
2272
|
const getRegistry = () => globalThis.customElements;
|
|
2229
2273
|
/**
|
|
2230
2274
|
* @param elm a defined component host
|
|
@@ -3143,7 +3187,9 @@ render() {
|
|
|
3143
3187
|
checkSlotFallbackVisibility = false;
|
|
3144
3188
|
checkSlotRelocate = !useNativeShadowDom && !!(cmpMeta.$flags$ & CMP_FLAGS.hasSlot);
|
|
3145
3189
|
}
|
|
3190
|
+
if (BUILD.serializer) hostRef.$flags$ |= HOST_FLAGS.isReflecting;
|
|
3146
3191
|
patch(oldVNode, rootVnode, isInitialLoad);
|
|
3192
|
+
if (BUILD.serializer) hostRef.$flags$ &= ~HOST_FLAGS.isReflecting;
|
|
3147
3193
|
if (BUILD.slotRelocation) {
|
|
3148
3194
|
plt.$flags$ |= PLATFORM_FLAGS.isTmpDisconnected;
|
|
3149
3195
|
if (checkSlotRelocate) {
|
|
@@ -3254,24 +3300,24 @@ const markFirstConnected = (hostRef) => {
|
|
|
3254
3300
|
hostRef.$onFirstConnectResolve$ = void 0;
|
|
3255
3301
|
};
|
|
3256
3302
|
/**
|
|
3257
|
-
*
|
|
3258
|
-
* Shared by the lazy ({@link initializeComponent})
|
|
3259
|
-
* `connectedCallback` paths so a component never
|
|
3260
|
-
* ancestor, regardless of load order.
|
|
3261
|
-
*
|
|
3262
|
-
*
|
|
3263
|
-
*
|
|
3303
|
+
* Get a promise for `ancestorElm` to be defined and its real `connectedCallback` to have
|
|
3304
|
+
* completed, or `undefined` if it already has. Shared by the lazy ({@link initializeComponent})
|
|
3305
|
+
* and standalone (`bootstrap-standalone.ts`) `connectedCallback` paths so a component never
|
|
3306
|
+
* connects before its nearest Stencil ancestor, regardless of load order. Callers only `await`
|
|
3307
|
+
* a returned promise, so a component whose ancestor is already connected carries on
|
|
3308
|
+
* synchronously instead of losing a microtask. Lazy's proxy classes are always pre-defined, so
|
|
3309
|
+
* the `whenDefined` wait only does real work for standalone's autoloader, where the ancestor
|
|
3310
|
+
* tag may not be defined yet.
|
|
3264
3311
|
*
|
|
3265
3312
|
* @param ancestorElm the nearest Stencil ancestor element
|
|
3266
3313
|
* @param registry the registry the waiting component is defined in
|
|
3314
|
+
* @returns a promise to await, or `undefined` if there's nothing to wait for
|
|
3267
3315
|
*/
|
|
3268
|
-
const
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
}
|
|
3274
|
-
if (ancestorHostRef && !(ancestorHostRef.$flags$ & HOST_FLAGS.hasFiredConnected)) await ensureFirstConnectPromise(ancestorHostRef);
|
|
3316
|
+
const whenAncestorConnected = (ancestorElm, registry) => {
|
|
3317
|
+
const pendingConnect = (hostRef) => hostRef && !(hostRef.$flags$ & HOST_FLAGS.hasFiredConnected) ? ensureFirstConnectPromise(hostRef) : void 0;
|
|
3318
|
+
const ancestorHostRef = getHostRef(ancestorElm);
|
|
3319
|
+
if (!BUILD.lazyLoad && !ancestorHostRef) return registry.whenDefined(ancestorElm.tagName.toLowerCase()).then(() => pendingConnect(getHostRef(ancestorElm)));
|
|
3320
|
+
return pendingConnect(ancestorHostRef);
|
|
3275
3321
|
};
|
|
3276
3322
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
3277
3323
|
if (BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
|
|
@@ -3291,10 +3337,10 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
|
3291
3337
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
3292
3338
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
3293
3339
|
if (isInitialLoad) {
|
|
3294
|
-
const pendingConnects = BUILD.asyncLoading ? hostRef.$hostElement$["s-pc"] : void 0;
|
|
3295
|
-
if (pendingConnects && pendingConnects.length > 0) return Promise.all(pendingConnects).then(dispatch).catch(dispatch);
|
|
3296
3340
|
queueMicrotask(() => {
|
|
3297
|
-
|
|
3341
|
+
const pendingConnects = BUILD.asyncLoading ? hostRef.$hostElement$["s-pc"] : void 0;
|
|
3342
|
+
if (pendingConnects && pendingConnects.length > 0) Promise.all(pendingConnects).then(dispatch, dispatch);
|
|
3343
|
+
else dispatch();
|
|
3298
3344
|
});
|
|
3299
3345
|
return;
|
|
3300
3346
|
}
|
|
@@ -3597,6 +3643,124 @@ const serverSideConnected = (elm) => {
|
|
|
3597
3643
|
}
|
|
3598
3644
|
};
|
|
3599
3645
|
//#endregion
|
|
3646
|
+
//#region src/runtime/set-value.ts
|
|
3647
|
+
/**
|
|
3648
|
+
* The value a reflected prop writes to its attribute: the serialized value if it has one.
|
|
3649
|
+
* @param hostRef the component's host ref
|
|
3650
|
+
* @param propName the prop
|
|
3651
|
+
* @param val the prop's value
|
|
3652
|
+
* @returns the value to reflect
|
|
3653
|
+
*/
|
|
3654
|
+
const getReflectedValue = (hostRef, propName, val) => BUILD.serializer && hostRef.$serializerValues$.has(propName) ? hostRef.$serializerValues$.get(propName) : val;
|
|
3655
|
+
/**
|
|
3656
|
+
* Write a reflected prop's attribute as soon as the prop changes, like native elements do,
|
|
3657
|
+
* so it agrees with the prop before watchers run. Until the first render, rendering reflects it.
|
|
3658
|
+
* @param hostRef the component's host ref
|
|
3659
|
+
* @param cmpMeta the component's runtime metadata
|
|
3660
|
+
* @param elm the host element
|
|
3661
|
+
* @param propName the prop that changed
|
|
3662
|
+
* @param oldAttrVal the previously reflected value
|
|
3663
|
+
* @param newAttrVal the value to reflect
|
|
3664
|
+
*/
|
|
3665
|
+
const reflectProp = (hostRef, cmpMeta, elm, propName, oldAttrVal, newAttrVal) => {
|
|
3666
|
+
if (!(hostRef.$flags$ & HOST_FLAGS.hasRendered) || !(cmpMeta.$members$[propName][0] & MEMBER_FLAGS.ReflectAttr)) return;
|
|
3667
|
+
const attrName = cmpMeta.$attrsToReflect$?.find(([p]) => p === propName)?.[1];
|
|
3668
|
+
if (!attrName) return;
|
|
3669
|
+
if (BUILD.serializer) hostRef.$flags$ |= HOST_FLAGS.isReflecting;
|
|
3670
|
+
setAccessor(elm, attrName, oldAttrVal, newAttrVal, false, VNODE_FLAGS.isHost);
|
|
3671
|
+
if (BUILD.serializer) hostRef.$flags$ &= ~HOST_FLAGS.isReflecting;
|
|
3672
|
+
};
|
|
3673
|
+
const applySerializers = (hostRef, cmpMeta, propName, val, instance) => {
|
|
3674
|
+
const run = (inst) => {
|
|
3675
|
+
let attrVal = val;
|
|
3676
|
+
for (const serializer of cmpMeta.$serializers$[propName]) {
|
|
3677
|
+
const [[methodName]] = Object.entries(serializer);
|
|
3678
|
+
attrVal = inst[methodName](attrVal, propName);
|
|
3679
|
+
}
|
|
3680
|
+
hostRef.$serializerValues$.set(propName, attrVal);
|
|
3681
|
+
};
|
|
3682
|
+
if (instance) run(instance);
|
|
3683
|
+
else hostRef.$fetchedCbList$.push(() => run(hostRef.$lazyInstance$));
|
|
3684
|
+
};
|
|
3685
|
+
const getValue = (ref, propName) => {
|
|
3686
|
+
if (BUILD.signalBacking) {
|
|
3687
|
+
const sig = getHostRef(ref)?.$signalValues$?.get(propName);
|
|
3688
|
+
if (sig !== void 0) return sig.value;
|
|
3689
|
+
}
|
|
3690
|
+
return getHostRef(ref).$instanceValues$.get(propName);
|
|
3691
|
+
};
|
|
3692
|
+
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
3693
|
+
const hostRef = getHostRef(ref);
|
|
3694
|
+
if (BUILD.serializer && hostRef?.$flags$ & HOST_FLAGS.isReflecting && hostRef.$serializerValues$.has(propName) && hostRef.$serializerValues$.get(propName) === newVal) return;
|
|
3695
|
+
if (BUILD.signalBacking) {
|
|
3696
|
+
const sig = hostRef?.$signalValues$?.get(propName);
|
|
3697
|
+
if (sig !== void 0) {
|
|
3698
|
+
const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
3699
|
+
if (BUILD.serializer && BUILD.reflect && cmpMeta.$attrsToReflect$ && cmpMeta.$serializers$?.[propName]) {
|
|
3700
|
+
const elm = BUILD.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
3701
|
+
applySerializers(hostRef, cmpMeta, propName, parsed, BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm);
|
|
3702
|
+
}
|
|
3703
|
+
if (!(Number.isNaN(sig.peek()) && Number.isNaN(parsed))) sig.value = parsed;
|
|
3704
|
+
return;
|
|
3705
|
+
}
|
|
3706
|
+
}
|
|
3707
|
+
if (!hostRef) {
|
|
3708
|
+
if (BUILD.lazyLoad) throw new Error(BUILD.isDev ? `Couldn't find host element for "${cmpMeta.$tagName$}". This usually happens when integrating a 3rd party Stencil component with another Stencil runtime. See https://github.com/stenciljs/core/issues/5457` : `Host element not found for "${cmpMeta.$tagName$}"`);
|
|
3709
|
+
return;
|
|
3710
|
+
}
|
|
3711
|
+
const elm = BUILD.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
3712
|
+
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
3713
|
+
const flags = hostRef.$flags$;
|
|
3714
|
+
const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
3715
|
+
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
3716
|
+
const didValueChange = newVal !== oldVal && !(Number.isNaN(oldVal) && Number.isNaN(newVal));
|
|
3717
|
+
if ((!BUILD.lazyLoad || !(flags & HOST_FLAGS.isConstructingInstance) || oldVal === void 0) && didValueChange) {
|
|
3718
|
+
hostRef.$instanceValues$.set(propName, newVal);
|
|
3719
|
+
const oldAttrVal = BUILD.reflect && getReflectedValue(hostRef, propName, oldVal);
|
|
3720
|
+
if (BUILD.serializer && BUILD.reflect && cmpMeta.$attrsToReflect$ && cmpMeta.$serializers$?.[propName]) applySerializers(hostRef, cmpMeta, propName, newVal, instance);
|
|
3721
|
+
if (BUILD.reflect) reflectProp(hostRef, cmpMeta, elm, propName, oldAttrVal, getReflectedValue(hostRef, propName, newVal));
|
|
3722
|
+
if (BUILD.isDev) {
|
|
3723
|
+
if (hostRef.$flags$ & HOST_FLAGS.devOnRender) consoleDevWarn(`The state/prop "${propName}" changed during rendering. This can potentially lead to infinite-loops and other bugs.`, "\nElement", elm, "\nNew value", newVal, "\nOld value", oldVal);
|
|
3724
|
+
else if (hostRef.$flags$ & HOST_FLAGS.devOnDidLoad) consoleDevWarn(`The state/prop "${propName}" changed during "componentDidLoad()", this triggers extra re-renders, try to setup on "componentWillLoad()"`, "\nElement", elm, "\nNew value", newVal, "\nOld value", oldVal);
|
|
3725
|
+
}
|
|
3726
|
+
if (BUILD.propChangeCallback && cmpMeta.$watchers$) {
|
|
3727
|
+
const watchMethods = cmpMeta.$watchers$[propName];
|
|
3728
|
+
if (watchMethods) watchMethods.map((watcher) => {
|
|
3729
|
+
try {
|
|
3730
|
+
const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
|
|
3731
|
+
if (flags & HOST_FLAGS.isWatchReady || watcherFlags & WATCH_FLAGS.Immediate) {
|
|
3732
|
+
if (BUILD.signalBacking && !hostRef.$signalValues$) return;
|
|
3733
|
+
if (!instance) hostRef.$fetchedCbList$.push(() => {
|
|
3734
|
+
hostRef.$lazyInstance$[watchMethodName](newVal, oldVal, propName);
|
|
3735
|
+
});
|
|
3736
|
+
else instance[watchMethodName](newVal, oldVal, propName);
|
|
3737
|
+
}
|
|
3738
|
+
} catch (e) {
|
|
3739
|
+
consoleError(e, elm);
|
|
3740
|
+
}
|
|
3741
|
+
});
|
|
3742
|
+
}
|
|
3743
|
+
if (BUILD.updatable && flags & HOST_FLAGS.hasRendered) {
|
|
3744
|
+
if (instance.componentShouldUpdate) {
|
|
3745
|
+
const changes = hostRef.$queuedPropChanges$ ||= {};
|
|
3746
|
+
changes[propName] = {
|
|
3747
|
+
newVal,
|
|
3748
|
+
oldVal: changes[propName]?.oldVal ?? oldVal
|
|
3749
|
+
};
|
|
3750
|
+
}
|
|
3751
|
+
if (!(flags & HOST_FLAGS.isQueuedForUpdate)) scheduleUpdate(hostRef, false);
|
|
3752
|
+
}
|
|
3753
|
+
}
|
|
3754
|
+
};
|
|
3755
|
+
//#endregion
|
|
3756
|
+
//#region src/runtime/signals-core.ts
|
|
3757
|
+
const getCore = () => globalThis[Symbol.for("stencil.preact-signals-core")] ??= SignalsCore;
|
|
3758
|
+
const effect = (fn, options) => getCore().effect(fn, options);
|
|
3759
|
+
const untracked = (fn) => getCore().untracked(fn);
|
|
3760
|
+
function signal(value, options) {
|
|
3761
|
+
return getCore().signal(value, options);
|
|
3762
|
+
}
|
|
3763
|
+
//#endregion
|
|
3600
3764
|
//#region src/runtime/signals.ts
|
|
3601
3765
|
const STENCIL_SIGNALS_SYMBOL = Symbol.for("stencil.signals");
|
|
3602
3766
|
/**
|
|
@@ -3641,6 +3805,14 @@ const initializeSignals = (elm, hostRef, cmpMeta) => {
|
|
|
3641
3805
|
}
|
|
3642
3806
|
prevScheduleVal = newVal;
|
|
3643
3807
|
}));
|
|
3808
|
+
if (BUILD.reflect && memberFlags & MEMBER_FLAGS.ReflectAttr) {
|
|
3809
|
+
let prevAttrVal = getReflectedValue(hostRef, memberName, sig.peek());
|
|
3810
|
+
disposers.push(effect(() => {
|
|
3811
|
+
const attrVal = getReflectedValue(hostRef, memberName, sig.value);
|
|
3812
|
+
untracked(() => reflectProp(hostRef, cmpMeta, elm, memberName, prevAttrVal, attrVal));
|
|
3813
|
+
prevAttrVal = attrVal;
|
|
3814
|
+
}));
|
|
3815
|
+
}
|
|
3644
3816
|
if (BUILD.propChangeCallback && cmpMeta.$watchers$?.[memberName]) {
|
|
3645
3817
|
const watchMethods = cmpMeta.$watchers$[memberName];
|
|
3646
3818
|
let prevWatchVal = sig.peek();
|
|
@@ -3709,7 +3881,7 @@ const initializeEffects = (elm, hostRef) => {
|
|
|
3709
3881
|
* Modified for Stencil's compiler and vdom
|
|
3710
3882
|
*/
|
|
3711
3883
|
const h = (nodeName, vnodeData, ...children) => {
|
|
3712
|
-
if (typeof nodeName === "string") nodeName = transformTag(nodeName);
|
|
3884
|
+
if (typeof nodeName === "string" && nodeName.includes("-")) nodeName = transformTag(nodeName);
|
|
3713
3885
|
let child = null;
|
|
3714
3886
|
let key = null;
|
|
3715
3887
|
let slotName = null;
|
|
@@ -3887,7 +4059,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
3887
4059
|
let scopeId;
|
|
3888
4060
|
if (BUILD.scoped) {
|
|
3889
4061
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
3890
|
-
if (cmpMeta && cmpMeta.$flags$ & CMP_FLAGS.needsScopedEncapsulation && hostElm["s-sc"]) {
|
|
4062
|
+
if (cmpMeta && cmpMeta.$flags$ & (CMP_FLAGS.needsScopedEncapsulation | CMP_FLAGS.shadowNeedsScopedCss) && hostElm["s-sc"]) {
|
|
3891
4063
|
scopeId = hostElm["s-sc"];
|
|
3892
4064
|
hostElm.classList.add(scopeId + "-h");
|
|
3893
4065
|
} else if (hostElm["s-sc"]) delete hostElm["s-sc"];
|
|
@@ -4183,7 +4355,7 @@ const addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) =
|
|
|
4183
4355
|
if (!slottedNode || slottedNode.nodeValue?.startsWith("s.")) return;
|
|
4184
4356
|
do {
|
|
4185
4357
|
const sa = slottedNode["getAttribute"] && slottedNode.getAttribute("slot");
|
|
4186
|
-
if ((sa || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && !sa && (slottedNode.nodeType === NODE_TYPE.CommentNode || slottedNode.nodeType === NODE_TYPE.TextNode)) {
|
|
4358
|
+
if ((slottedNode["getAttribute"] && slottedNode.getAttribute("s-sn")) === slotName || (sa || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && !sa && (slottedNode.nodeType === NODE_TYPE.CommentNode || slottedNode.nodeType === NODE_TYPE.TextNode)) {
|
|
4187
4359
|
slottedNode["s-sn"] = slotName;
|
|
4188
4360
|
group.push({
|
|
4189
4361
|
slot: slotNode,
|
|
@@ -4690,134 +4862,6 @@ const normalizeWatchers = (raw) => {
|
|
|
4690
4862
|
return out;
|
|
4691
4863
|
};
|
|
4692
4864
|
//#endregion
|
|
4693
|
-
//#region src/runtime/parse-property-value.ts
|
|
4694
|
-
/**
|
|
4695
|
-
* Parse a new property value for a given property type.
|
|
4696
|
-
*
|
|
4697
|
-
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
4698
|
-
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
4699
|
-
* 1. `any`, the type given to `propValue` in the function signature
|
|
4700
|
-
* 2. the type stored from `propType`.
|
|
4701
|
-
*
|
|
4702
|
-
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
4703
|
-
*
|
|
4704
|
-
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
4705
|
-
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
4706
|
-
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
4707
|
-
* ```tsx
|
|
4708
|
-
* <my-cmp prop-val={0}></my-cmp>
|
|
4709
|
-
* ```
|
|
4710
|
-
*
|
|
4711
|
-
* HTML prop values on the other hand, will always a string
|
|
4712
|
-
*
|
|
4713
|
-
* @param propValue the new value to coerce to some type
|
|
4714
|
-
* @param propType the type of the prop, expressed as a binary number
|
|
4715
|
-
* @returns the parsed/coerced value
|
|
4716
|
-
*/
|
|
4717
|
-
const parsePropertyValue = (propValue, propType) => {
|
|
4718
|
-
if (propValue != null && !isComplexType(propValue)) {
|
|
4719
|
-
/**
|
|
4720
|
-
* ensure this value is of the correct prop type
|
|
4721
|
-
*/
|
|
4722
|
-
if (BUILD.propBoolean && propType & MEMBER_FLAGS.Boolean) return propValue === "" || !!propValue;
|
|
4723
|
-
/**
|
|
4724
|
-
* force it to be a number
|
|
4725
|
-
*/
|
|
4726
|
-
if (BUILD.propNumber && propType & MEMBER_FLAGS.Number) return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
|
|
4727
|
-
/**
|
|
4728
|
-
* could have been passed as a number or boolean but we still want it as a string
|
|
4729
|
-
*/
|
|
4730
|
-
if (BUILD.propString && propType & MEMBER_FLAGS.String) return String(propValue);
|
|
4731
|
-
return propValue;
|
|
4732
|
-
}
|
|
4733
|
-
/**
|
|
4734
|
-
* not sure exactly what type we want so no need to change to a different type
|
|
4735
|
-
*/
|
|
4736
|
-
return propValue;
|
|
4737
|
-
};
|
|
4738
|
-
//#endregion
|
|
4739
|
-
//#region src/runtime/set-value.ts
|
|
4740
|
-
const applySerializers = (hostRef, cmpMeta, propName, val, instance) => {
|
|
4741
|
-
const run = (inst) => {
|
|
4742
|
-
let attrVal = val;
|
|
4743
|
-
for (const serializer of cmpMeta.$serializers$[propName]) {
|
|
4744
|
-
const [[methodName]] = Object.entries(serializer);
|
|
4745
|
-
attrVal = inst[methodName](attrVal, propName);
|
|
4746
|
-
}
|
|
4747
|
-
hostRef.$serializerValues$.set(propName, attrVal);
|
|
4748
|
-
};
|
|
4749
|
-
if (instance) run(instance);
|
|
4750
|
-
else hostRef.$fetchedCbList$.push(() => run(hostRef.$lazyInstance$));
|
|
4751
|
-
};
|
|
4752
|
-
const getValue = (ref, propName) => {
|
|
4753
|
-
if (BUILD.signalBacking) {
|
|
4754
|
-
const sig = getHostRef(ref)?.$signalValues$?.get(propName);
|
|
4755
|
-
if (sig !== void 0) return sig.value;
|
|
4756
|
-
}
|
|
4757
|
-
return getHostRef(ref).$instanceValues$.get(propName);
|
|
4758
|
-
};
|
|
4759
|
-
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
4760
|
-
const hostRef = getHostRef(ref);
|
|
4761
|
-
if (BUILD.signalBacking) {
|
|
4762
|
-
const sig = hostRef?.$signalValues$?.get(propName);
|
|
4763
|
-
if (sig !== void 0) {
|
|
4764
|
-
const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
4765
|
-
if (BUILD.serializer && BUILD.reflect && cmpMeta.$attrsToReflect$ && cmpMeta.$serializers$?.[propName]) {
|
|
4766
|
-
const elm = BUILD.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
4767
|
-
applySerializers(hostRef, cmpMeta, propName, parsed, BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm);
|
|
4768
|
-
}
|
|
4769
|
-
if (!(Number.isNaN(sig.peek()) && Number.isNaN(parsed))) sig.value = parsed;
|
|
4770
|
-
return;
|
|
4771
|
-
}
|
|
4772
|
-
}
|
|
4773
|
-
if (!hostRef) {
|
|
4774
|
-
if (BUILD.lazyLoad) throw new Error(BUILD.isDev ? `Couldn't find host element for "${cmpMeta.$tagName$}". This usually happens when integrating a 3rd party Stencil component with another Stencil runtime. See https://github.com/stenciljs/core/issues/5457` : `Host element not found for "${cmpMeta.$tagName$}"`);
|
|
4775
|
-
return;
|
|
4776
|
-
}
|
|
4777
|
-
if (BUILD.serializer && hostRef.$serializerValues$.has(propName) && hostRef.$serializerValues$.get(propName) === newVal) return;
|
|
4778
|
-
const elm = BUILD.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
4779
|
-
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
4780
|
-
const flags = hostRef.$flags$;
|
|
4781
|
-
const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
4782
|
-
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
4783
|
-
const didValueChange = newVal !== oldVal && !(Number.isNaN(oldVal) && Number.isNaN(newVal));
|
|
4784
|
-
if ((!BUILD.lazyLoad || !(flags & HOST_FLAGS.isConstructingInstance) || oldVal === void 0) && didValueChange) {
|
|
4785
|
-
hostRef.$instanceValues$.set(propName, newVal);
|
|
4786
|
-
if (BUILD.serializer && BUILD.reflect && cmpMeta.$attrsToReflect$ && cmpMeta.$serializers$?.[propName]) applySerializers(hostRef, cmpMeta, propName, newVal, instance);
|
|
4787
|
-
if (BUILD.isDev) {
|
|
4788
|
-
if (hostRef.$flags$ & HOST_FLAGS.devOnRender) consoleDevWarn(`The state/prop "${propName}" changed during rendering. This can potentially lead to infinite-loops and other bugs.`, "\nElement", elm, "\nNew value", newVal, "\nOld value", oldVal);
|
|
4789
|
-
else if (hostRef.$flags$ & HOST_FLAGS.devOnDidLoad) consoleDevWarn(`The state/prop "${propName}" changed during "componentDidLoad()", this triggers extra re-renders, try to setup on "componentWillLoad()"`, "\nElement", elm, "\nNew value", newVal, "\nOld value", oldVal);
|
|
4790
|
-
}
|
|
4791
|
-
if (BUILD.propChangeCallback && cmpMeta.$watchers$) {
|
|
4792
|
-
const watchMethods = cmpMeta.$watchers$[propName];
|
|
4793
|
-
if (watchMethods) watchMethods.map((watcher) => {
|
|
4794
|
-
try {
|
|
4795
|
-
const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
|
|
4796
|
-
if (flags & HOST_FLAGS.isWatchReady || watcherFlags & WATCH_FLAGS.Immediate) {
|
|
4797
|
-
if (BUILD.signalBacking && !hostRef.$signalValues$) return;
|
|
4798
|
-
if (!instance) hostRef.$fetchedCbList$.push(() => {
|
|
4799
|
-
hostRef.$lazyInstance$[watchMethodName](newVal, oldVal, propName);
|
|
4800
|
-
});
|
|
4801
|
-
else instance[watchMethodName](newVal, oldVal, propName);
|
|
4802
|
-
}
|
|
4803
|
-
} catch (e) {
|
|
4804
|
-
consoleError(e, elm);
|
|
4805
|
-
}
|
|
4806
|
-
});
|
|
4807
|
-
}
|
|
4808
|
-
if (BUILD.updatable && flags & HOST_FLAGS.hasRendered) {
|
|
4809
|
-
if (instance.componentShouldUpdate) {
|
|
4810
|
-
const changes = hostRef.$queuedPropChanges$ ||= {};
|
|
4811
|
-
changes[propName] = {
|
|
4812
|
-
newVal,
|
|
4813
|
-
oldVal: changes[propName]?.oldVal ?? oldVal
|
|
4814
|
-
};
|
|
4815
|
-
}
|
|
4816
|
-
if (!(flags & HOST_FLAGS.isQueuedForUpdate)) scheduleUpdate(hostRef, false);
|
|
4817
|
-
}
|
|
4818
|
-
}
|
|
4819
|
-
};
|
|
4820
|
-
//#endregion
|
|
4821
4865
|
//#region src/runtime/proxy-component.ts
|
|
4822
4866
|
/**
|
|
4823
4867
|
* Serialize a prop value the way `setAccessor()` does when it reflects it, so the runtime can
|
|
@@ -4950,7 +4994,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4950
4994
|
plt.jmp(() => {
|
|
4951
4995
|
const propName = attrNameToPropName.get(attrName);
|
|
4952
4996
|
const hostRef = getHostRef(this);
|
|
4953
|
-
if (BUILD.serializer && hostRef.$serializerValues$.has(propName) && hostRef.$serializerValues$.get(propName) === newValue) return;
|
|
4997
|
+
if (BUILD.serializer && hostRef.$flags$ & HOST_FLAGS.isReflecting && hostRef.$serializerValues$.has(propName) && hostRef.$serializerValues$.get(propName) === newValue) return;
|
|
4954
4998
|
if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
|
|
4955
4999
|
newValue = this[propName];
|
|
4956
5000
|
delete this[propName];
|
|
@@ -5060,7 +5104,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
5060
5104
|
replayPendingSetterValues(hostRef, cmpMeta);
|
|
5061
5105
|
}
|
|
5062
5106
|
endNewInstance();
|
|
5063
|
-
if (BUILD.asyncLoading && hostRef.$ancestorComponent$)
|
|
5107
|
+
if (BUILD.asyncLoading && hostRef.$ancestorComponent$) {
|
|
5108
|
+
const ancestorConnected = whenAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(elm));
|
|
5109
|
+
if (ancestorConnected) await ancestorConnected;
|
|
5110
|
+
}
|
|
5064
5111
|
if (!(BUILD.slotRelocation && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation)) {
|
|
5065
5112
|
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
5066
5113
|
if (BUILD.asyncLoading) markFirstConnected(hostRef);
|
|
@@ -5493,7 +5540,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
5493
5540
|
if (!hostRef) return;
|
|
5494
5541
|
const i = deferredConnectedCallbacks.findIndex((host) => host === this);
|
|
5495
5542
|
if (i > -1) deferredConnectedCallbacks.splice(i, 1);
|
|
5496
|
-
if (hostRef
|
|
5543
|
+
if (hostRef.$vnode$?.$elm$?.isConnected === false) delete hostRef.$vnode$.$elm$;
|
|
5497
5544
|
});
|
|
5498
5545
|
}
|
|
5499
5546
|
componentOnReady() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as VALID_CONFIG_OUTPUT_TARGETS, A as DIST_LAZY, D as COPY, F as DOCS_README, I as DOCS_VSCODE, J as STANDALONE, M as DOCS_CUSTOM, N as DOCS_CUSTOM_ELEMENTS_MANIFEST, O as CUSTOM, P as DOCS_JSON, Q as TYPES, R as GENERATED_DTS, S as ASSETS, U as LOADER_BUNDLE, Y as STATS, f as isString, g as sortBy, j as DOCS_AGENT_SKILL, n as escapeWithPattern, q as SSR_WASM, r as flatOne, t as dashToPascalCase, v as toDashCase, w as COLLECTION, z as GLOBAL_STYLE } from "./helpers-
|
|
1
|
+
import { $ as VALID_CONFIG_OUTPUT_TARGETS, A as DIST_LAZY, D as COPY, F as DOCS_README, I as DOCS_VSCODE, J as STANDALONE, M as DOCS_CUSTOM, N as DOCS_CUSTOM_ELEMENTS_MANIFEST, O as CUSTOM, P as DOCS_JSON, Q as TYPES, R as GENERATED_DTS, S as ASSETS, U as LOADER_BUNDLE, Y as STATS, f as isString, g as sortBy, j as DOCS_AGENT_SKILL, n as escapeWithPattern, q as SSR_WASM, r as flatOne, t as dashToPascalCase, v as toDashCase, w as COLLECTION, z as GLOBAL_STYLE } from "./helpers-pTCZhNi0.mjs";
|
|
2
2
|
import nodePath, { basename, dirname, relative } from "node:path";
|
|
3
3
|
import picomatch from "picomatch";
|
|
4
4
|
//#region src/utils/is-glob.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
|
-
import { C as CMP_FLAGS, H as LISTENER_FLAGS, W as MEMBER_FLAGS, et as WATCH_FLAGS, f as isString, l as isIterable, y as toTitleCase } from "./helpers-
|
|
3
|
-
import { $ as buildWarn, J as relative$1, Y as resolve$1, q as normalizePath } from "./util-
|
|
2
|
+
import { C as CMP_FLAGS, H as LISTENER_FLAGS, W as MEMBER_FLAGS, et as WATCH_FLAGS, f as isString, l as isIterable, y as toTitleCase } from "./helpers-pTCZhNi0.mjs";
|
|
3
|
+
import { $ as buildWarn, J as relative$1, Y as resolve$1, q as normalizePath } from "./util-CP6-333M.mjs";
|
|
4
4
|
import nodePath from "node:path";
|
|
5
5
|
//#region src/utils/regular-expression.ts
|
|
6
6
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/core",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.10",
|
|
4
4
|
"description": "A Compiler for Web Components and Progressive Web Apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"components",
|
|
@@ -126,9 +126,9 @@
|
|
|
126
126
|
"terser": "^5.50.0",
|
|
127
127
|
"tinyglobby": "^0.2.17",
|
|
128
128
|
"typescript": ">5.0.0 <7.0.0",
|
|
129
|
-
"@stencil/
|
|
130
|
-
"@stencil/
|
|
131
|
-
"@stencil/
|
|
129
|
+
"@stencil/dev-server": "5.0.0-rc.10",
|
|
130
|
+
"@stencil/cli": "5.0.0-rc.10",
|
|
131
|
+
"@stencil/mock-doc": "5.0.0-rc.10"
|
|
132
132
|
},
|
|
133
133
|
"devDependencies": {
|
|
134
134
|
"@ionic/prettier-config": "^4.0.0",
|