@stencil/core 5.0.0-rc.1 → 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-BMtGBEQV.mjs → client-DkvdNuPu.mjs} +9 -9
- 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-C_Y38j4m.mjs → compiler-ChKFuRry.mjs} +326 -123
- package/dist/declarations/stencil-public-compiler.d.ts +25 -7
- package/dist/{index-CFiy6MZ3.d.mts → index-BxnfbT3a.d.mts} +25 -7
- package/dist/{index-CViiWNQ9.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-Bkq8vRnu.mjs → node-C59vQZNg.mjs} +1 -1
- package/dist/runtime/client/lazy.js +202 -159
- package/dist/runtime/client/runtime.js +202 -159
- package/dist/runtime/index.js +202 -159
- package/dist/runtime/server/index.mjs +202 -159
- 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 +198 -158
- package/package.json +4 -4
|
@@ -707,7 +707,7 @@ const patchSlotPrepend = (HostElementPrototype) => {
|
|
|
707
707
|
return toReturn;
|
|
708
708
|
}
|
|
709
709
|
if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) newChild.hidden = true;
|
|
710
|
-
return HostElementPrototype.__prepend(newChild);
|
|
710
|
+
return HostElementPrototype.__prepend.call(this, newChild);
|
|
711
711
|
});
|
|
712
712
|
};
|
|
713
713
|
};
|
|
@@ -1350,7 +1350,7 @@ const attachStyles = (hostRef) => {
|
|
|
1350
1350
|
else if (BUILD$1.hydrateServerSide && BUILD$1.shadowModeClosed && flags & CMP_FLAGS.shadowNeedsScopedCss && flags & CMP_FLAGS.shadowModeClosed) styleContainerNode = elm;
|
|
1351
1351
|
else styleContainerNode = elm.getRootNode();
|
|
1352
1352
|
const scopeId = addStyle(styleContainerNode, cmpMeta, hostRef.$modeName$);
|
|
1353
|
-
if ((BUILD$1.shadowDom || BUILD$1.scoped) && BUILD$1.cssAnnotations && flags & CMP_FLAGS.needsScopedEncapsulation) {
|
|
1353
|
+
if ((BUILD$1.shadowDom || BUILD$1.scoped) && BUILD$1.cssAnnotations && flags & (CMP_FLAGS.needsScopedEncapsulation | CMP_FLAGS.shadowNeedsScopedCss)) {
|
|
1354
1354
|
elm["s-sc"] = scopeId;
|
|
1355
1355
|
elm.classList.add(scopeId + "-h");
|
|
1356
1356
|
}
|
|
@@ -1444,12 +1444,51 @@ const isComplexType = (o) => {
|
|
|
1444
1444
|
return o === "object" || o === "function";
|
|
1445
1445
|
};
|
|
1446
1446
|
//#endregion
|
|
1447
|
-
//#region src/runtime/
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1447
|
+
//#region src/runtime/parse-property-value.ts
|
|
1448
|
+
/**
|
|
1449
|
+
* Parse a new property value for a given property type.
|
|
1450
|
+
*
|
|
1451
|
+
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
1452
|
+
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
1453
|
+
* 1. `any`, the type given to `propValue` in the function signature
|
|
1454
|
+
* 2. the type stored from `propType`.
|
|
1455
|
+
*
|
|
1456
|
+
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
1457
|
+
*
|
|
1458
|
+
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
1459
|
+
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
1460
|
+
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
1461
|
+
* ```tsx
|
|
1462
|
+
* <my-cmp prop-val={0}></my-cmp>
|
|
1463
|
+
* ```
|
|
1464
|
+
*
|
|
1465
|
+
* HTML prop values on the other hand, will always a string
|
|
1466
|
+
*
|
|
1467
|
+
* @param propValue the new value to coerce to some type
|
|
1468
|
+
* @param propType the type of the prop, expressed as a binary number
|
|
1469
|
+
* @returns the parsed/coerced value
|
|
1470
|
+
*/
|
|
1471
|
+
const parsePropertyValue = (propValue, propType) => {
|
|
1472
|
+
if (propValue != null && !isComplexType(propValue)) {
|
|
1473
|
+
/**
|
|
1474
|
+
* ensure this value is of the correct prop type
|
|
1475
|
+
*/
|
|
1476
|
+
if (BUILD$1.propBoolean && propType & MEMBER_FLAGS.Boolean) return propValue === "" || !!propValue;
|
|
1477
|
+
/**
|
|
1478
|
+
* force it to be a number
|
|
1479
|
+
*/
|
|
1480
|
+
if (BUILD$1.propNumber && propType & MEMBER_FLAGS.Number) return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
|
|
1481
|
+
/**
|
|
1482
|
+
* could have been passed as a number or boolean but we still want it as a string
|
|
1483
|
+
*/
|
|
1484
|
+
if (BUILD$1.propString && propType & MEMBER_FLAGS.String) return String(propValue);
|
|
1485
|
+
return propValue;
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* not sure exactly what type we want so no need to change to a different type
|
|
1489
|
+
*/
|
|
1490
|
+
return propValue;
|
|
1491
|
+
};
|
|
1453
1492
|
//#endregion
|
|
1454
1493
|
//#region src/runtime/event-emitter.ts
|
|
1455
1494
|
const createEvent = (ref, name, flags) => {
|
|
@@ -2507,24 +2546,24 @@ const markFirstConnected = (hostRef) => {
|
|
|
2507
2546
|
hostRef.$onFirstConnectResolve$ = void 0;
|
|
2508
2547
|
};
|
|
2509
2548
|
/**
|
|
2510
|
-
*
|
|
2511
|
-
* Shared by the lazy ({@link initializeComponent})
|
|
2512
|
-
* `connectedCallback` paths so a component never
|
|
2513
|
-
* ancestor, regardless of load order.
|
|
2514
|
-
*
|
|
2515
|
-
*
|
|
2516
|
-
*
|
|
2549
|
+
* Get a promise for `ancestorElm` to be defined and its real `connectedCallback` to have
|
|
2550
|
+
* completed, or `undefined` if it already has. Shared by the lazy ({@link initializeComponent})
|
|
2551
|
+
* and standalone (`bootstrap-standalone.ts`) `connectedCallback` paths so a component never
|
|
2552
|
+
* connects before its nearest Stencil ancestor, regardless of load order. Callers only `await`
|
|
2553
|
+
* a returned promise, so a component whose ancestor is already connected carries on
|
|
2554
|
+
* synchronously instead of losing a microtask. Lazy's proxy classes are always pre-defined, so
|
|
2555
|
+
* the `whenDefined` wait only does real work for standalone's autoloader, where the ancestor
|
|
2556
|
+
* tag may not be defined yet.
|
|
2517
2557
|
*
|
|
2518
2558
|
* @param ancestorElm the nearest Stencil ancestor element
|
|
2519
2559
|
* @param registry the registry the waiting component is defined in
|
|
2560
|
+
* @returns a promise to await, or `undefined` if there's nothing to wait for
|
|
2520
2561
|
*/
|
|
2521
|
-
const
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
}
|
|
2527
|
-
if (ancestorHostRef && !(ancestorHostRef.$flags$ & HOST_FLAGS.hasFiredConnected)) await ensureFirstConnectPromise(ancestorHostRef);
|
|
2562
|
+
const whenAncestorConnected = (ancestorElm, registry) => {
|
|
2563
|
+
const pendingConnect = (hostRef) => hostRef && !(hostRef.$flags$ & HOST_FLAGS.hasFiredConnected) ? ensureFirstConnectPromise(hostRef) : void 0;
|
|
2564
|
+
const ancestorHostRef = getHostRef(ancestorElm);
|
|
2565
|
+
if (!BUILD$1.lazyLoad && !ancestorHostRef) return registry.whenDefined(ancestorElm.tagName.toLowerCase()).then(() => pendingConnect(getHostRef(ancestorElm)));
|
|
2566
|
+
return pendingConnect(ancestorHostRef);
|
|
2528
2567
|
};
|
|
2529
2568
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
2530
2569
|
if (BUILD$1.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
|
|
@@ -2544,10 +2583,10 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
|
2544
2583
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
2545
2584
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
2546
2585
|
if (isInitialLoad) {
|
|
2547
|
-
const pendingConnects = BUILD$1.asyncLoading ? hostRef.$hostElement$["s-pc"] : void 0;
|
|
2548
|
-
if (pendingConnects && pendingConnects.length > 0) return Promise.all(pendingConnects).then(dispatch).catch(dispatch);
|
|
2549
2586
|
queueMicrotask(() => {
|
|
2550
|
-
|
|
2587
|
+
const pendingConnects = BUILD$1.asyncLoading ? hostRef.$hostElement$["s-pc"] : void 0;
|
|
2588
|
+
if (pendingConnects && pendingConnects.length > 0) Promise.all(pendingConnects).then(dispatch, dispatch);
|
|
2589
|
+
else dispatch();
|
|
2551
2590
|
});
|
|
2552
2591
|
return;
|
|
2553
2592
|
}
|
|
@@ -2850,6 +2889,124 @@ const serverSideConnected = (elm) => {
|
|
|
2850
2889
|
}
|
|
2851
2890
|
};
|
|
2852
2891
|
//#endregion
|
|
2892
|
+
//#region src/runtime/set-value.ts
|
|
2893
|
+
/**
|
|
2894
|
+
* The value a reflected prop writes to its attribute: the serialized value if it has one.
|
|
2895
|
+
* @param hostRef the component's host ref
|
|
2896
|
+
* @param propName the prop
|
|
2897
|
+
* @param val the prop's value
|
|
2898
|
+
* @returns the value to reflect
|
|
2899
|
+
*/
|
|
2900
|
+
const getReflectedValue = (hostRef, propName, val) => BUILD$1.serializer && hostRef.$serializerValues$.has(propName) ? hostRef.$serializerValues$.get(propName) : val;
|
|
2901
|
+
/**
|
|
2902
|
+
* Write a reflected prop's attribute as soon as the prop changes, like native elements do,
|
|
2903
|
+
* so it agrees with the prop before watchers run. Until the first render, rendering reflects it.
|
|
2904
|
+
* @param hostRef the component's host ref
|
|
2905
|
+
* @param cmpMeta the component's runtime metadata
|
|
2906
|
+
* @param elm the host element
|
|
2907
|
+
* @param propName the prop that changed
|
|
2908
|
+
* @param oldAttrVal the previously reflected value
|
|
2909
|
+
* @param newAttrVal the value to reflect
|
|
2910
|
+
*/
|
|
2911
|
+
const reflectProp = (hostRef, cmpMeta, elm, propName, oldAttrVal, newAttrVal) => {
|
|
2912
|
+
if (!(hostRef.$flags$ & HOST_FLAGS.hasRendered) || !(cmpMeta.$members$[propName][0] & MEMBER_FLAGS.ReflectAttr)) return;
|
|
2913
|
+
const attrName = cmpMeta.$attrsToReflect$?.find(([p]) => p === propName)?.[1];
|
|
2914
|
+
if (!attrName) return;
|
|
2915
|
+
if (BUILD$1.serializer) hostRef.$flags$ |= HOST_FLAGS.isReflecting;
|
|
2916
|
+
setAccessor(elm, attrName, oldAttrVal, newAttrVal, false, VNODE_FLAGS.isHost);
|
|
2917
|
+
if (BUILD$1.serializer) hostRef.$flags$ &= ~HOST_FLAGS.isReflecting;
|
|
2918
|
+
};
|
|
2919
|
+
const applySerializers = (hostRef, cmpMeta, propName, val, instance) => {
|
|
2920
|
+
const run = (inst) => {
|
|
2921
|
+
let attrVal = val;
|
|
2922
|
+
for (const serializer of cmpMeta.$serializers$[propName]) {
|
|
2923
|
+
const [[methodName]] = Object.entries(serializer);
|
|
2924
|
+
attrVal = inst[methodName](attrVal, propName);
|
|
2925
|
+
}
|
|
2926
|
+
hostRef.$serializerValues$.set(propName, attrVal);
|
|
2927
|
+
};
|
|
2928
|
+
if (instance) run(instance);
|
|
2929
|
+
else hostRef.$fetchedCbList$.push(() => run(hostRef.$lazyInstance$));
|
|
2930
|
+
};
|
|
2931
|
+
const getValue = (ref, propName) => {
|
|
2932
|
+
if (BUILD$1.signalBacking) {
|
|
2933
|
+
const sig = getHostRef(ref)?.$signalValues$?.get(propName);
|
|
2934
|
+
if (sig !== void 0) return sig.value;
|
|
2935
|
+
}
|
|
2936
|
+
return getHostRef(ref).$instanceValues$.get(propName);
|
|
2937
|
+
};
|
|
2938
|
+
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
2939
|
+
const hostRef = getHostRef(ref);
|
|
2940
|
+
if (BUILD$1.serializer && hostRef?.$flags$ & HOST_FLAGS.isReflecting && hostRef.$serializerValues$.has(propName) && hostRef.$serializerValues$.get(propName) === newVal) return;
|
|
2941
|
+
if (BUILD$1.signalBacking) {
|
|
2942
|
+
const sig = hostRef?.$signalValues$?.get(propName);
|
|
2943
|
+
if (sig !== void 0) {
|
|
2944
|
+
const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
2945
|
+
if (BUILD$1.serializer && BUILD$1.reflect && cmpMeta.$attrsToReflect$ && cmpMeta.$serializers$?.[propName]) {
|
|
2946
|
+
const elm = BUILD$1.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
2947
|
+
applySerializers(hostRef, cmpMeta, propName, parsed, BUILD$1.lazyLoad ? hostRef.$lazyInstance$ : elm);
|
|
2948
|
+
}
|
|
2949
|
+
if (!(Number.isNaN(sig.peek()) && Number.isNaN(parsed))) sig.value = parsed;
|
|
2950
|
+
return;
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
if (!hostRef) {
|
|
2954
|
+
if (BUILD$1.lazyLoad) throw new Error(BUILD$1.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$}"`);
|
|
2955
|
+
return;
|
|
2956
|
+
}
|
|
2957
|
+
const elm = BUILD$1.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
2958
|
+
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
2959
|
+
const flags = hostRef.$flags$;
|
|
2960
|
+
const instance = BUILD$1.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
2961
|
+
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
2962
|
+
const didValueChange = newVal !== oldVal && !(Number.isNaN(oldVal) && Number.isNaN(newVal));
|
|
2963
|
+
if ((!BUILD$1.lazyLoad || !(flags & HOST_FLAGS.isConstructingInstance) || oldVal === void 0) && didValueChange) {
|
|
2964
|
+
hostRef.$instanceValues$.set(propName, newVal);
|
|
2965
|
+
const oldAttrVal = BUILD$1.reflect && getReflectedValue(hostRef, propName, oldVal);
|
|
2966
|
+
if (BUILD$1.serializer && BUILD$1.reflect && cmpMeta.$attrsToReflect$ && cmpMeta.$serializers$?.[propName]) applySerializers(hostRef, cmpMeta, propName, newVal, instance);
|
|
2967
|
+
if (BUILD$1.reflect) reflectProp(hostRef, cmpMeta, elm, propName, oldAttrVal, getReflectedValue(hostRef, propName, newVal));
|
|
2968
|
+
if (BUILD$1.isDev) {
|
|
2969
|
+
if (hostRef.$flags$ & HOST_FLAGS.devOnRender) `${propName}`;
|
|
2970
|
+
else if (hostRef.$flags$ & HOST_FLAGS.devOnDidLoad) `${propName}`;
|
|
2971
|
+
}
|
|
2972
|
+
if (BUILD$1.propChangeCallback && cmpMeta.$watchers$) {
|
|
2973
|
+
const watchMethods = cmpMeta.$watchers$[propName];
|
|
2974
|
+
if (watchMethods) watchMethods.map((watcher) => {
|
|
2975
|
+
try {
|
|
2976
|
+
const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
|
|
2977
|
+
if (flags & HOST_FLAGS.isWatchReady || watcherFlags & WATCH_FLAGS.Immediate) {
|
|
2978
|
+
if (BUILD$1.signalBacking && !hostRef.$signalValues$) return;
|
|
2979
|
+
if (!instance) hostRef.$fetchedCbList$.push(() => {
|
|
2980
|
+
hostRef.$lazyInstance$[watchMethodName](newVal, oldVal, propName);
|
|
2981
|
+
});
|
|
2982
|
+
else instance[watchMethodName](newVal, oldVal, propName);
|
|
2983
|
+
}
|
|
2984
|
+
} catch (e) {
|
|
2985
|
+
consoleError(e, elm);
|
|
2986
|
+
}
|
|
2987
|
+
});
|
|
2988
|
+
}
|
|
2989
|
+
if (BUILD$1.updatable && flags & HOST_FLAGS.hasRendered) {
|
|
2990
|
+
if (instance.componentShouldUpdate) {
|
|
2991
|
+
const changes = hostRef.$queuedPropChanges$ ||= {};
|
|
2992
|
+
changes[propName] = {
|
|
2993
|
+
newVal,
|
|
2994
|
+
oldVal: changes[propName]?.oldVal ?? oldVal
|
|
2995
|
+
};
|
|
2996
|
+
}
|
|
2997
|
+
if (!(flags & HOST_FLAGS.isQueuedForUpdate)) scheduleUpdate(hostRef, false);
|
|
2998
|
+
}
|
|
2999
|
+
}
|
|
3000
|
+
};
|
|
3001
|
+
//#endregion
|
|
3002
|
+
//#region src/runtime/signals-core.ts
|
|
3003
|
+
const getCore = () => globalThis[Symbol.for("stencil.preact-signals-core")] ??= SignalsCore;
|
|
3004
|
+
const effect = (fn, options) => getCore().effect(fn, options);
|
|
3005
|
+
const untracked = (fn) => getCore().untracked(fn);
|
|
3006
|
+
function signal(value, options) {
|
|
3007
|
+
return getCore().signal(value, options);
|
|
3008
|
+
}
|
|
3009
|
+
//#endregion
|
|
2853
3010
|
//#region src/runtime/signals.ts
|
|
2854
3011
|
const STENCIL_SIGNALS_SYMBOL = Symbol.for("stencil.signals");
|
|
2855
3012
|
/**
|
|
@@ -2894,6 +3051,14 @@ const initializeSignals = (elm, hostRef, cmpMeta) => {
|
|
|
2894
3051
|
}
|
|
2895
3052
|
prevScheduleVal = newVal;
|
|
2896
3053
|
}));
|
|
3054
|
+
if (BUILD$1.reflect && memberFlags & MEMBER_FLAGS.ReflectAttr) {
|
|
3055
|
+
let prevAttrVal = getReflectedValue(hostRef, memberName, sig.peek());
|
|
3056
|
+
disposers.push(effect(() => {
|
|
3057
|
+
const attrVal = getReflectedValue(hostRef, memberName, sig.value);
|
|
3058
|
+
untracked(() => reflectProp(hostRef, cmpMeta, elm, memberName, prevAttrVal, attrVal));
|
|
3059
|
+
prevAttrVal = attrVal;
|
|
3060
|
+
}));
|
|
3061
|
+
}
|
|
2897
3062
|
if (BUILD$1.propChangeCallback && cmpMeta.$watchers$?.[memberName]) {
|
|
2898
3063
|
const watchMethods = cmpMeta.$watchers$[memberName];
|
|
2899
3064
|
let prevWatchVal = sig.peek();
|
|
@@ -2962,7 +3127,7 @@ const initializeEffects = (elm, hostRef) => {
|
|
|
2962
3127
|
* Modified for Stencil's compiler and vdom
|
|
2963
3128
|
*/
|
|
2964
3129
|
const h = (nodeName, vnodeData, ...children) => {
|
|
2965
|
-
if (typeof nodeName === "string") nodeName = transformTag(nodeName);
|
|
3130
|
+
if (typeof nodeName === "string" && nodeName.includes("-")) nodeName = transformTag(nodeName);
|
|
2966
3131
|
let child = null;
|
|
2967
3132
|
let key = null;
|
|
2968
3133
|
let slotName = null;
|
|
@@ -3138,7 +3303,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
3138
3303
|
let scopeId;
|
|
3139
3304
|
if (BUILD$1.scoped) {
|
|
3140
3305
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
3141
|
-
if (cmpMeta && cmpMeta.$flags$ & CMP_FLAGS.needsScopedEncapsulation && hostElm["s-sc"]) {
|
|
3306
|
+
if (cmpMeta && cmpMeta.$flags$ & (CMP_FLAGS.needsScopedEncapsulation | CMP_FLAGS.shadowNeedsScopedCss) && hostElm["s-sc"]) {
|
|
3142
3307
|
scopeId = hostElm["s-sc"];
|
|
3143
3308
|
hostElm.classList.add(scopeId + "-h");
|
|
3144
3309
|
} else if (hostElm["s-sc"]) delete hostElm["s-sc"];
|
|
@@ -3434,7 +3599,7 @@ const addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) =
|
|
|
3434
3599
|
if (!slottedNode || slottedNode.nodeValue?.startsWith("s.")) return;
|
|
3435
3600
|
do {
|
|
3436
3601
|
const sa = slottedNode["getAttribute"] && slottedNode.getAttribute("slot");
|
|
3437
|
-
if ((sa || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && !sa && (slottedNode.nodeType === NODE_TYPE.CommentNode || slottedNode.nodeType === NODE_TYPE.TextNode)) {
|
|
3602
|
+
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)) {
|
|
3438
3603
|
slottedNode["s-sn"] = slotName;
|
|
3439
3604
|
group.push({
|
|
3440
3605
|
slot: slotNode,
|
|
@@ -3956,134 +4121,6 @@ const normalizeWatchers = (raw) => {
|
|
|
3956
4121
|
return out;
|
|
3957
4122
|
};
|
|
3958
4123
|
//#endregion
|
|
3959
|
-
//#region src/runtime/parse-property-value.ts
|
|
3960
|
-
/**
|
|
3961
|
-
* Parse a new property value for a given property type.
|
|
3962
|
-
*
|
|
3963
|
-
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
3964
|
-
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
3965
|
-
* 1. `any`, the type given to `propValue` in the function signature
|
|
3966
|
-
* 2. the type stored from `propType`.
|
|
3967
|
-
*
|
|
3968
|
-
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
3969
|
-
*
|
|
3970
|
-
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
3971
|
-
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
3972
|
-
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
3973
|
-
* ```tsx
|
|
3974
|
-
* <my-cmp prop-val={0}></my-cmp>
|
|
3975
|
-
* ```
|
|
3976
|
-
*
|
|
3977
|
-
* HTML prop values on the other hand, will always a string
|
|
3978
|
-
*
|
|
3979
|
-
* @param propValue the new value to coerce to some type
|
|
3980
|
-
* @param propType the type of the prop, expressed as a binary number
|
|
3981
|
-
* @returns the parsed/coerced value
|
|
3982
|
-
*/
|
|
3983
|
-
const parsePropertyValue = (propValue, propType) => {
|
|
3984
|
-
if (propValue != null && !isComplexType(propValue)) {
|
|
3985
|
-
/**
|
|
3986
|
-
* ensure this value is of the correct prop type
|
|
3987
|
-
*/
|
|
3988
|
-
if (BUILD$1.propBoolean && propType & MEMBER_FLAGS.Boolean) return propValue === "" || !!propValue;
|
|
3989
|
-
/**
|
|
3990
|
-
* force it to be a number
|
|
3991
|
-
*/
|
|
3992
|
-
if (BUILD$1.propNumber && propType & MEMBER_FLAGS.Number) return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
|
|
3993
|
-
/**
|
|
3994
|
-
* could have been passed as a number or boolean but we still want it as a string
|
|
3995
|
-
*/
|
|
3996
|
-
if (BUILD$1.propString && propType & MEMBER_FLAGS.String) return String(propValue);
|
|
3997
|
-
return propValue;
|
|
3998
|
-
}
|
|
3999
|
-
/**
|
|
4000
|
-
* not sure exactly what type we want so no need to change to a different type
|
|
4001
|
-
*/
|
|
4002
|
-
return propValue;
|
|
4003
|
-
};
|
|
4004
|
-
//#endregion
|
|
4005
|
-
//#region src/runtime/set-value.ts
|
|
4006
|
-
const applySerializers = (hostRef, cmpMeta, propName, val, instance) => {
|
|
4007
|
-
const run = (inst) => {
|
|
4008
|
-
let attrVal = val;
|
|
4009
|
-
for (const serializer of cmpMeta.$serializers$[propName]) {
|
|
4010
|
-
const [[methodName]] = Object.entries(serializer);
|
|
4011
|
-
attrVal = inst[methodName](attrVal, propName);
|
|
4012
|
-
}
|
|
4013
|
-
hostRef.$serializerValues$.set(propName, attrVal);
|
|
4014
|
-
};
|
|
4015
|
-
if (instance) run(instance);
|
|
4016
|
-
else hostRef.$fetchedCbList$.push(() => run(hostRef.$lazyInstance$));
|
|
4017
|
-
};
|
|
4018
|
-
const getValue = (ref, propName) => {
|
|
4019
|
-
if (BUILD$1.signalBacking) {
|
|
4020
|
-
const sig = getHostRef(ref)?.$signalValues$?.get(propName);
|
|
4021
|
-
if (sig !== void 0) return sig.value;
|
|
4022
|
-
}
|
|
4023
|
-
return getHostRef(ref).$instanceValues$.get(propName);
|
|
4024
|
-
};
|
|
4025
|
-
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
4026
|
-
const hostRef = getHostRef(ref);
|
|
4027
|
-
if (BUILD$1.serializer && hostRef?.$flags$ & HOST_FLAGS.isReflecting && hostRef.$serializerValues$.has(propName) && hostRef.$serializerValues$.get(propName) === newVal) return;
|
|
4028
|
-
if (BUILD$1.signalBacking) {
|
|
4029
|
-
const sig = hostRef?.$signalValues$?.get(propName);
|
|
4030
|
-
if (sig !== void 0) {
|
|
4031
|
-
const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
4032
|
-
if (BUILD$1.serializer && BUILD$1.reflect && cmpMeta.$attrsToReflect$ && cmpMeta.$serializers$?.[propName]) {
|
|
4033
|
-
const elm = BUILD$1.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
4034
|
-
applySerializers(hostRef, cmpMeta, propName, parsed, BUILD$1.lazyLoad ? hostRef.$lazyInstance$ : elm);
|
|
4035
|
-
}
|
|
4036
|
-
if (!(Number.isNaN(sig.peek()) && Number.isNaN(parsed))) sig.value = parsed;
|
|
4037
|
-
return;
|
|
4038
|
-
}
|
|
4039
|
-
}
|
|
4040
|
-
if (!hostRef) {
|
|
4041
|
-
if (BUILD$1.lazyLoad) throw new Error(BUILD$1.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$}"`);
|
|
4042
|
-
return;
|
|
4043
|
-
}
|
|
4044
|
-
const elm = BUILD$1.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
4045
|
-
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
4046
|
-
const flags = hostRef.$flags$;
|
|
4047
|
-
const instance = BUILD$1.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
4048
|
-
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
4049
|
-
const didValueChange = newVal !== oldVal && !(Number.isNaN(oldVal) && Number.isNaN(newVal));
|
|
4050
|
-
if ((!BUILD$1.lazyLoad || !(flags & HOST_FLAGS.isConstructingInstance) || oldVal === void 0) && didValueChange) {
|
|
4051
|
-
hostRef.$instanceValues$.set(propName, newVal);
|
|
4052
|
-
if (BUILD$1.serializer && BUILD$1.reflect && cmpMeta.$attrsToReflect$ && cmpMeta.$serializers$?.[propName]) applySerializers(hostRef, cmpMeta, propName, newVal, instance);
|
|
4053
|
-
if (BUILD$1.isDev) {
|
|
4054
|
-
if (hostRef.$flags$ & HOST_FLAGS.devOnRender) `${propName}`;
|
|
4055
|
-
else if (hostRef.$flags$ & HOST_FLAGS.devOnDidLoad) `${propName}`;
|
|
4056
|
-
}
|
|
4057
|
-
if (BUILD$1.propChangeCallback && cmpMeta.$watchers$) {
|
|
4058
|
-
const watchMethods = cmpMeta.$watchers$[propName];
|
|
4059
|
-
if (watchMethods) watchMethods.map((watcher) => {
|
|
4060
|
-
try {
|
|
4061
|
-
const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
|
|
4062
|
-
if (flags & HOST_FLAGS.isWatchReady || watcherFlags & WATCH_FLAGS.Immediate) {
|
|
4063
|
-
if (BUILD$1.signalBacking && !hostRef.$signalValues$) return;
|
|
4064
|
-
if (!instance) hostRef.$fetchedCbList$.push(() => {
|
|
4065
|
-
hostRef.$lazyInstance$[watchMethodName](newVal, oldVal, propName);
|
|
4066
|
-
});
|
|
4067
|
-
else instance[watchMethodName](newVal, oldVal, propName);
|
|
4068
|
-
}
|
|
4069
|
-
} catch (e) {
|
|
4070
|
-
consoleError(e, elm);
|
|
4071
|
-
}
|
|
4072
|
-
});
|
|
4073
|
-
}
|
|
4074
|
-
if (BUILD$1.updatable && flags & HOST_FLAGS.hasRendered) {
|
|
4075
|
-
if (instance.componentShouldUpdate) {
|
|
4076
|
-
const changes = hostRef.$queuedPropChanges$ ||= {};
|
|
4077
|
-
changes[propName] = {
|
|
4078
|
-
newVal,
|
|
4079
|
-
oldVal: changes[propName]?.oldVal ?? oldVal
|
|
4080
|
-
};
|
|
4081
|
-
}
|
|
4082
|
-
if (!(flags & HOST_FLAGS.isQueuedForUpdate)) scheduleUpdate(hostRef, false);
|
|
4083
|
-
}
|
|
4084
|
-
}
|
|
4085
|
-
};
|
|
4086
|
-
//#endregion
|
|
4087
4124
|
//#region src/runtime/proxy-component.ts
|
|
4088
4125
|
/**
|
|
4089
4126
|
* Serialize a prop value the way `setAccessor()` does when it reflects it, so the runtime can
|
|
@@ -4326,7 +4363,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
4326
4363
|
replayPendingSetterValues(hostRef, cmpMeta);
|
|
4327
4364
|
}
|
|
4328
4365
|
endNewInstance();
|
|
4329
|
-
if (BUILD$1.asyncLoading && hostRef.$ancestorComponent$)
|
|
4366
|
+
if (BUILD$1.asyncLoading && hostRef.$ancestorComponent$) {
|
|
4367
|
+
const ancestorConnected = whenAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(elm));
|
|
4368
|
+
if (ancestorConnected) await ancestorConnected;
|
|
4369
|
+
}
|
|
4330
4370
|
if (!(BUILD$1.slotRelocation && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation)) {
|
|
4331
4371
|
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
4332
4372
|
if (BUILD$1.asyncLoading) markFirstConnected(hostRef);
|
|
@@ -4727,8 +4767,11 @@ const proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
4727
4767
|
}
|
|
4728
4768
|
connectedCallback(this);
|
|
4729
4769
|
if (BUILD$1.asyncLoading && hostRef && hostRef.$ancestorComponent$) {
|
|
4730
|
-
|
|
4731
|
-
if (
|
|
4770
|
+
const ancestorConnected = whenAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(this));
|
|
4771
|
+
if (ancestorConnected) {
|
|
4772
|
+
await ancestorConnected;
|
|
4773
|
+
if (!this.isConnected) return;
|
|
4774
|
+
}
|
|
4732
4775
|
}
|
|
4733
4776
|
if (originalConnectedCallback && (plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected) === 0) originalConnectedCallback.call(this);
|
|
4734
4777
|
if (BUILD$1.asyncLoading && hostRef) markFirstConnected(hostRef);
|
|
@@ -6972,7 +6972,7 @@ var MockCSSStyleDeclaration = class {
|
|
|
6972
6972
|
this._styles.clear();
|
|
6973
6973
|
return;
|
|
6974
6974
|
}
|
|
6975
|
-
cssText
|
|
6975
|
+
splitDeclarations(cssText).forEach((rule) => {
|
|
6976
6976
|
rule = rule.trim();
|
|
6977
6977
|
if (rule.length > 0) {
|
|
6978
6978
|
const splt = rule.split(":");
|
|
@@ -6985,6 +6985,41 @@ var MockCSSStyleDeclaration = class {
|
|
|
6985
6985
|
});
|
|
6986
6986
|
}
|
|
6987
6987
|
};
|
|
6988
|
+
/**
|
|
6989
|
+
* Splits a CSS declaration list at its top-level semicolons. A semicolon inside
|
|
6990
|
+
* parentheses (e.g. the `;base64,` in `url(data:image/png;base64,...)`) or inside
|
|
6991
|
+
* a quoted string does not end a declaration.
|
|
6992
|
+
*
|
|
6993
|
+
* @param cssText the declaration list, such as the value of a `style` attribute
|
|
6994
|
+
* @returns the individual declarations, without their separating semicolons
|
|
6995
|
+
*/
|
|
6996
|
+
function splitDeclarations(cssText) {
|
|
6997
|
+
const declarations = [];
|
|
6998
|
+
let current = "";
|
|
6999
|
+
let depth = 0;
|
|
7000
|
+
let quote = "";
|
|
7001
|
+
for (let i = 0; i < cssText.length; i++) {
|
|
7002
|
+
const char = cssText[i];
|
|
7003
|
+
if (char === "\\" && i + 1 < cssText.length) {
|
|
7004
|
+
current += char + cssText[++i];
|
|
7005
|
+
continue;
|
|
7006
|
+
}
|
|
7007
|
+
if (quote) {
|
|
7008
|
+
if (char === quote) quote = "";
|
|
7009
|
+
} else if (char === "\"" || char === "'") quote = char;
|
|
7010
|
+
else if (char === "(") depth++;
|
|
7011
|
+
else if (char === ")") {
|
|
7012
|
+
if (depth > 0) depth--;
|
|
7013
|
+
} else if (char === ";" && depth === 0) {
|
|
7014
|
+
declarations.push(current);
|
|
7015
|
+
current = "";
|
|
7016
|
+
continue;
|
|
7017
|
+
}
|
|
7018
|
+
current += char;
|
|
7019
|
+
}
|
|
7020
|
+
declarations.push(current);
|
|
7021
|
+
return declarations;
|
|
7022
|
+
}
|
|
6988
7023
|
function createCSSStyleDeclaration() {
|
|
6989
7024
|
return new Proxy(new MockCSSStyleDeclaration(), cssProxyHandler);
|
|
6990
7025
|
}
|
|
@@ -7737,10 +7772,10 @@ function* streamToHtml(node, opts, output) {
|
|
|
7737
7772
|
if (node.hasAttribute("style")) {
|
|
7738
7773
|
const cssText = node.style.cssText;
|
|
7739
7774
|
if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth + cssText.length + 10 > opts.approximateLineWidth) {
|
|
7740
|
-
yield `\nstyle="${cssText}">`;
|
|
7775
|
+
yield `\nstyle="${escapeString(cssText, true)}">`;
|
|
7741
7776
|
output.currentLineWidth = 0;
|
|
7742
7777
|
} else {
|
|
7743
|
-
yield ` style="${cssText}">`;
|
|
7778
|
+
yield ` style="${escapeString(cssText, true)}">`;
|
|
7744
7779
|
output.currentLineWidth += cssText.length + 10;
|
|
7745
7780
|
}
|
|
7746
7781
|
} else {
|
|
@@ -7755,7 +7790,7 @@ function* streamToHtml(node, opts, output) {
|
|
|
7755
7790
|
yield* streamToHtml(shadowRoot, opts, output);
|
|
7756
7791
|
output.indent = output.indent - (opts.indentSpaces ?? 0);
|
|
7757
7792
|
const childNodes = getChildNodes(node);
|
|
7758
|
-
if (opts.newLines && (childNodes.length === 0 || childNodes.length === 1 && childNodes[0].nodeType === 3 && childNodes[0].nodeValue?.trim() === "")) {
|
|
7793
|
+
if (opts.newLines && (childNodes.length === 0 || childNodes.length === 1 && childNodes[0].nodeType === 3 && childNodes[0].nodeValue?.trim() === "" || hasOnlyRemovedComments(childNodes, opts))) {
|
|
7759
7794
|
yield "\n";
|
|
7760
7795
|
output.currentLineWidth = 0;
|
|
7761
7796
|
for (let i = 0; i < output.indent; i++) yield " ";
|
|
@@ -7767,7 +7802,7 @@ function* streamToHtml(node, opts, output) {
|
|
|
7767
7802
|
const childNodes = tagName === "template" ? node.content.childNodes : getChildNodes(node);
|
|
7768
7803
|
const childNodeLength = childNodes.length;
|
|
7769
7804
|
if (childNodeLength > 0) {
|
|
7770
|
-
if (childNodeLength === 1 && childNodes[0].nodeType === 3 && (typeof childNodes[0].nodeValue !== "string" || childNodes[0].nodeValue.trim() === "")) {} else {
|
|
7805
|
+
if (childNodeLength === 1 && childNodes[0].nodeType === 3 && (typeof childNodes[0].nodeValue !== "string" || childNodes[0].nodeValue.trim() === "")) {} else if (hasOnlyRemovedComments(childNodes, opts)) {} else {
|
|
7771
7806
|
const isWithinWhitespaceSensitiveNode = opts.newLines || (opts.indentSpaces ?? 0) > 0 ? isWithinWhitespaceSensitive(node) : false;
|
|
7772
7807
|
if (!isWithinWhitespaceSensitiveNode && (opts.indentSpaces ?? 0) > 0 && ignoreTag === false) output.indent = output.indent + (opts.indentSpaces ?? 0);
|
|
7773
7808
|
for (let i = 0; i < childNodeLength; i++) {
|
|
@@ -7858,12 +7893,11 @@ function* streamToHtml(node, opts, output) {
|
|
|
7858
7893
|
}
|
|
7859
7894
|
} else if (node.nodeType === 8) {
|
|
7860
7895
|
const nodeValue = node.nodeValue;
|
|
7861
|
-
const isHydrateAnnotation = nodeValue?.startsWith("r.") || nodeValue?.startsWith("o.") || nodeValue?.startsWith("s.") || nodeValue?.startsWith("t.");
|
|
7862
7896
|
/**
|
|
7863
7897
|
* remove comments from stringified output if user set the `removeHtmlComments` e.g.
|
|
7864
7898
|
* in the `renderToString` function and we are no dealing with a hydrate annotation
|
|
7865
7899
|
*/
|
|
7866
|
-
if (opts
|
|
7900
|
+
if (isRemovedComment(node, opts)) return;
|
|
7867
7901
|
const isWithinWhitespaceSensitiveNode = opts.newLines || (opts.indentSpaces ?? 0) > 0 ? isWithinWhitespaceSensitive(node) : false;
|
|
7868
7902
|
if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
|
|
7869
7903
|
yield "\n";
|
|
@@ -7909,6 +7943,38 @@ function isWithinWhitespaceSensitive(node) {
|
|
|
7909
7943
|
return false;
|
|
7910
7944
|
}
|
|
7911
7945
|
/**
|
|
7946
|
+
* Determine whether a comment node is left out of the serialized output, which
|
|
7947
|
+
* happens when `removeHtmlComments` is set and the comment is not a hydrate
|
|
7948
|
+
* annotation.
|
|
7949
|
+
*
|
|
7950
|
+
* @param node a node to check
|
|
7951
|
+
* @param opts serialization options
|
|
7952
|
+
* @returns whether or not the node is a comment that will not be serialized
|
|
7953
|
+
*/
|
|
7954
|
+
function isRemovedComment(node, opts) {
|
|
7955
|
+
if (node.nodeType !== 8 || !opts.removeHtmlComments) return false;
|
|
7956
|
+
const nodeValue = node.nodeValue;
|
|
7957
|
+
return !(nodeValue?.startsWith("r.") || nodeValue?.startsWith("o.") || nodeValue?.startsWith("s.") || nodeValue?.startsWith("t."));
|
|
7958
|
+
}
|
|
7959
|
+
/**
|
|
7960
|
+
* Determine whether a list of child nodes contains at least one comment that is
|
|
7961
|
+
* removed from the output and otherwise only whitespace text, so that serializing
|
|
7962
|
+
* it produces no content.
|
|
7963
|
+
*
|
|
7964
|
+
* @param childNodes the child nodes to check
|
|
7965
|
+
* @param opts serialization options
|
|
7966
|
+
* @returns whether or not the child nodes serialize to nothing
|
|
7967
|
+
*/
|
|
7968
|
+
function hasOnlyRemovedComments(childNodes, opts) {
|
|
7969
|
+
let hasRemovedComment = false;
|
|
7970
|
+
for (let i = 0; i < childNodes.length; i++) {
|
|
7971
|
+
const childNode = childNodes[i];
|
|
7972
|
+
if (isRemovedComment(childNode, opts)) hasRemovedComment = true;
|
|
7973
|
+
else if (childNode.nodeType !== 3 || typeof childNode.nodeValue === "string" && childNode.nodeValue.trim() !== "") return false;
|
|
7974
|
+
}
|
|
7975
|
+
return hasRemovedComment;
|
|
7976
|
+
}
|
|
7977
|
+
/**
|
|
7912
7978
|
* Normalizes the `childNodes` of a node due to if `experimentalSlotFixes` is enabled, `
|
|
7913
7979
|
* childNodes` will only return 'slotted' / lightDOM nodes
|
|
7914
7980
|
*
|
|
@@ -8711,6 +8777,15 @@ var MockElement = class extends MockNode {
|
|
|
8711
8777
|
set title(value) {
|
|
8712
8778
|
this.setAttributeNS(null, "title", value);
|
|
8713
8779
|
}
|
|
8780
|
+
toggleAttribute(attrName, force) {
|
|
8781
|
+
const has = this.hasAttribute(attrName);
|
|
8782
|
+
if (force ?? !has) {
|
|
8783
|
+
if (!has) this.setAttribute(attrName, "");
|
|
8784
|
+
return true;
|
|
8785
|
+
}
|
|
8786
|
+
if (has) this.removeAttribute(attrName);
|
|
8787
|
+
return false;
|
|
8788
|
+
}
|
|
8714
8789
|
animate() {}
|
|
8715
8790
|
onanimationstart() {}
|
|
8716
8791
|
onanimationend() {}
|
package/dist/sys/node/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as setupNodeProcess, r as createNodeLogger, t as createNodeSys } from "../../node-
|
|
1
|
+
import { n as setupNodeProcess, r as createNodeLogger, t as createNodeSys } from "../../node-C59vQZNg.mjs";
|
|
2
2
|
export { createNodeLogger, createNodeSys, setupNodeProcess };
|
package/dist/sys/node/worker.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as createWorkerMessageHandler } from "../../compiler-
|
|
2
|
-
import { t as createNodeSys } from "../../node-
|
|
1
|
+
import { l as createWorkerMessageHandler } from "../../compiler-ChKFuRry.mjs";
|
|
2
|
+
import { t as createNodeSys } from "../../node-C59vQZNg.mjs";
|
|
3
3
|
//#region src/sys/node/node-worker-thread.ts
|
|
4
4
|
/**
|
|
5
5
|
* Initialize a worker thread, setting up various machinery for managing
|