@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
|
@@ -156,6 +156,11 @@ const HOST_FLAGS = {
|
|
|
156
156
|
* is true while an initialization attempt is merely queued/in-flight.
|
|
157
157
|
*/
|
|
158
158
|
hasFailedLoad: 2048,
|
|
159
|
+
/**
|
|
160
|
+
* Set while `renderVdom` patches the host, so writes of a serialized reflected value
|
|
161
|
+
* coming from the runtime's own reflection aren't applied back to the prop.
|
|
162
|
+
*/
|
|
163
|
+
isReflecting: 16384,
|
|
159
164
|
devOnRender: 4096,
|
|
160
165
|
devOnDidLoad: 8192
|
|
161
166
|
};
|
|
@@ -702,7 +707,7 @@ const patchSlotPrepend = (HostElementPrototype) => {
|
|
|
702
707
|
return toReturn;
|
|
703
708
|
}
|
|
704
709
|
if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) newChild.hidden = true;
|
|
705
|
-
return HostElementPrototype.__prepend(newChild);
|
|
710
|
+
return HostElementPrototype.__prepend.call(this, newChild);
|
|
706
711
|
});
|
|
707
712
|
};
|
|
708
713
|
};
|
|
@@ -1345,7 +1350,7 @@ const attachStyles = (hostRef) => {
|
|
|
1345
1350
|
else if (BUILD$1.hydrateServerSide && BUILD$1.shadowModeClosed && flags & CMP_FLAGS.shadowNeedsScopedCss && flags & CMP_FLAGS.shadowModeClosed) styleContainerNode = elm;
|
|
1346
1351
|
else styleContainerNode = elm.getRootNode();
|
|
1347
1352
|
const scopeId = addStyle(styleContainerNode, cmpMeta, hostRef.$modeName$);
|
|
1348
|
-
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)) {
|
|
1349
1354
|
elm["s-sc"] = scopeId;
|
|
1350
1355
|
elm.classList.add(scopeId + "-h");
|
|
1351
1356
|
}
|
|
@@ -1439,12 +1444,51 @@ const isComplexType = (o) => {
|
|
|
1439
1444
|
return o === "object" || o === "function";
|
|
1440
1445
|
};
|
|
1441
1446
|
//#endregion
|
|
1442
|
-
//#region src/runtime/
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
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
|
+
};
|
|
1448
1492
|
//#endregion
|
|
1449
1493
|
//#region src/runtime/event-emitter.ts
|
|
1450
1494
|
const createEvent = (ref, name, flags) => {
|
|
@@ -2389,7 +2433,9 @@ render() {
|
|
|
2389
2433
|
checkSlotFallbackVisibility = false;
|
|
2390
2434
|
checkSlotRelocate = !useNativeShadowDom && !!(cmpMeta.$flags$ & CMP_FLAGS.hasSlot);
|
|
2391
2435
|
}
|
|
2436
|
+
if (BUILD$1.serializer) hostRef.$flags$ |= HOST_FLAGS.isReflecting;
|
|
2392
2437
|
patch(oldVNode, rootVnode, isInitialLoad);
|
|
2438
|
+
if (BUILD$1.serializer) hostRef.$flags$ &= ~HOST_FLAGS.isReflecting;
|
|
2393
2439
|
if (BUILD$1.slotRelocation) {
|
|
2394
2440
|
plt.$flags$ |= PLATFORM_FLAGS.isTmpDisconnected;
|
|
2395
2441
|
if (checkSlotRelocate) {
|
|
@@ -2500,24 +2546,24 @@ const markFirstConnected = (hostRef) => {
|
|
|
2500
2546
|
hostRef.$onFirstConnectResolve$ = void 0;
|
|
2501
2547
|
};
|
|
2502
2548
|
/**
|
|
2503
|
-
*
|
|
2504
|
-
* Shared by the lazy ({@link initializeComponent})
|
|
2505
|
-
* `connectedCallback` paths so a component never
|
|
2506
|
-
* ancestor, regardless of load order.
|
|
2507
|
-
*
|
|
2508
|
-
*
|
|
2509
|
-
*
|
|
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.
|
|
2510
2557
|
*
|
|
2511
2558
|
* @param ancestorElm the nearest Stencil ancestor element
|
|
2512
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
|
|
2513
2561
|
*/
|
|
2514
|
-
const
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
}
|
|
2520
|
-
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);
|
|
2521
2567
|
};
|
|
2522
2568
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
2523
2569
|
if (BUILD$1.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
|
|
@@ -2537,10 +2583,10 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
|
2537
2583
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
2538
2584
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
2539
2585
|
if (isInitialLoad) {
|
|
2540
|
-
const pendingConnects = BUILD$1.asyncLoading ? hostRef.$hostElement$["s-pc"] : void 0;
|
|
2541
|
-
if (pendingConnects && pendingConnects.length > 0) return Promise.all(pendingConnects).then(dispatch).catch(dispatch);
|
|
2542
2586
|
queueMicrotask(() => {
|
|
2543
|
-
|
|
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();
|
|
2544
2590
|
});
|
|
2545
2591
|
return;
|
|
2546
2592
|
}
|
|
@@ -2843,6 +2889,124 @@ const serverSideConnected = (elm) => {
|
|
|
2843
2889
|
}
|
|
2844
2890
|
};
|
|
2845
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
|
|
2846
3010
|
//#region src/runtime/signals.ts
|
|
2847
3011
|
const STENCIL_SIGNALS_SYMBOL = Symbol.for("stencil.signals");
|
|
2848
3012
|
/**
|
|
@@ -2887,6 +3051,14 @@ const initializeSignals = (elm, hostRef, cmpMeta) => {
|
|
|
2887
3051
|
}
|
|
2888
3052
|
prevScheduleVal = newVal;
|
|
2889
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
|
+
}
|
|
2890
3062
|
if (BUILD$1.propChangeCallback && cmpMeta.$watchers$?.[memberName]) {
|
|
2891
3063
|
const watchMethods = cmpMeta.$watchers$[memberName];
|
|
2892
3064
|
let prevWatchVal = sig.peek();
|
|
@@ -2955,7 +3127,7 @@ const initializeEffects = (elm, hostRef) => {
|
|
|
2955
3127
|
* Modified for Stencil's compiler and vdom
|
|
2956
3128
|
*/
|
|
2957
3129
|
const h = (nodeName, vnodeData, ...children) => {
|
|
2958
|
-
if (typeof nodeName === "string") nodeName = transformTag(nodeName);
|
|
3130
|
+
if (typeof nodeName === "string" && nodeName.includes("-")) nodeName = transformTag(nodeName);
|
|
2959
3131
|
let child = null;
|
|
2960
3132
|
let key = null;
|
|
2961
3133
|
let slotName = null;
|
|
@@ -3131,7 +3303,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
3131
3303
|
let scopeId;
|
|
3132
3304
|
if (BUILD$1.scoped) {
|
|
3133
3305
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
3134
|
-
if (cmpMeta && cmpMeta.$flags$ & CMP_FLAGS.needsScopedEncapsulation && hostElm["s-sc"]) {
|
|
3306
|
+
if (cmpMeta && cmpMeta.$flags$ & (CMP_FLAGS.needsScopedEncapsulation | CMP_FLAGS.shadowNeedsScopedCss) && hostElm["s-sc"]) {
|
|
3135
3307
|
scopeId = hostElm["s-sc"];
|
|
3136
3308
|
hostElm.classList.add(scopeId + "-h");
|
|
3137
3309
|
} else if (hostElm["s-sc"]) delete hostElm["s-sc"];
|
|
@@ -3427,7 +3599,7 @@ const addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) =
|
|
|
3427
3599
|
if (!slottedNode || slottedNode.nodeValue?.startsWith("s.")) return;
|
|
3428
3600
|
do {
|
|
3429
3601
|
const sa = slottedNode["getAttribute"] && slottedNode.getAttribute("slot");
|
|
3430
|
-
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)) {
|
|
3431
3603
|
slottedNode["s-sn"] = slotName;
|
|
3432
3604
|
group.push({
|
|
3433
3605
|
slot: slotNode,
|
|
@@ -3949,134 +4121,6 @@ const normalizeWatchers = (raw) => {
|
|
|
3949
4121
|
return out;
|
|
3950
4122
|
};
|
|
3951
4123
|
//#endregion
|
|
3952
|
-
//#region src/runtime/parse-property-value.ts
|
|
3953
|
-
/**
|
|
3954
|
-
* Parse a new property value for a given property type.
|
|
3955
|
-
*
|
|
3956
|
-
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
3957
|
-
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
3958
|
-
* 1. `any`, the type given to `propValue` in the function signature
|
|
3959
|
-
* 2. the type stored from `propType`.
|
|
3960
|
-
*
|
|
3961
|
-
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
3962
|
-
*
|
|
3963
|
-
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
3964
|
-
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
3965
|
-
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
3966
|
-
* ```tsx
|
|
3967
|
-
* <my-cmp prop-val={0}></my-cmp>
|
|
3968
|
-
* ```
|
|
3969
|
-
*
|
|
3970
|
-
* HTML prop values on the other hand, will always a string
|
|
3971
|
-
*
|
|
3972
|
-
* @param propValue the new value to coerce to some type
|
|
3973
|
-
* @param propType the type of the prop, expressed as a binary number
|
|
3974
|
-
* @returns the parsed/coerced value
|
|
3975
|
-
*/
|
|
3976
|
-
const parsePropertyValue = (propValue, propType) => {
|
|
3977
|
-
if (propValue != null && !isComplexType(propValue)) {
|
|
3978
|
-
/**
|
|
3979
|
-
* ensure this value is of the correct prop type
|
|
3980
|
-
*/
|
|
3981
|
-
if (BUILD$1.propBoolean && propType & MEMBER_FLAGS.Boolean) return propValue === "" || !!propValue;
|
|
3982
|
-
/**
|
|
3983
|
-
* force it to be a number
|
|
3984
|
-
*/
|
|
3985
|
-
if (BUILD$1.propNumber && propType & MEMBER_FLAGS.Number) return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
|
|
3986
|
-
/**
|
|
3987
|
-
* could have been passed as a number or boolean but we still want it as a string
|
|
3988
|
-
*/
|
|
3989
|
-
if (BUILD$1.propString && propType & MEMBER_FLAGS.String) return String(propValue);
|
|
3990
|
-
return propValue;
|
|
3991
|
-
}
|
|
3992
|
-
/**
|
|
3993
|
-
* not sure exactly what type we want so no need to change to a different type
|
|
3994
|
-
*/
|
|
3995
|
-
return propValue;
|
|
3996
|
-
};
|
|
3997
|
-
//#endregion
|
|
3998
|
-
//#region src/runtime/set-value.ts
|
|
3999
|
-
const applySerializers = (hostRef, cmpMeta, propName, val, instance) => {
|
|
4000
|
-
const run = (inst) => {
|
|
4001
|
-
let attrVal = val;
|
|
4002
|
-
for (const serializer of cmpMeta.$serializers$[propName]) {
|
|
4003
|
-
const [[methodName]] = Object.entries(serializer);
|
|
4004
|
-
attrVal = inst[methodName](attrVal, propName);
|
|
4005
|
-
}
|
|
4006
|
-
hostRef.$serializerValues$.set(propName, attrVal);
|
|
4007
|
-
};
|
|
4008
|
-
if (instance) run(instance);
|
|
4009
|
-
else hostRef.$fetchedCbList$.push(() => run(hostRef.$lazyInstance$));
|
|
4010
|
-
};
|
|
4011
|
-
const getValue = (ref, propName) => {
|
|
4012
|
-
if (BUILD$1.signalBacking) {
|
|
4013
|
-
const sig = getHostRef(ref)?.$signalValues$?.get(propName);
|
|
4014
|
-
if (sig !== void 0) return sig.value;
|
|
4015
|
-
}
|
|
4016
|
-
return getHostRef(ref).$instanceValues$.get(propName);
|
|
4017
|
-
};
|
|
4018
|
-
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
4019
|
-
const hostRef = getHostRef(ref);
|
|
4020
|
-
if (BUILD$1.signalBacking) {
|
|
4021
|
-
const sig = hostRef?.$signalValues$?.get(propName);
|
|
4022
|
-
if (sig !== void 0) {
|
|
4023
|
-
const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
4024
|
-
if (BUILD$1.serializer && BUILD$1.reflect && cmpMeta.$attrsToReflect$ && cmpMeta.$serializers$?.[propName]) {
|
|
4025
|
-
const elm = BUILD$1.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
4026
|
-
applySerializers(hostRef, cmpMeta, propName, parsed, BUILD$1.lazyLoad ? hostRef.$lazyInstance$ : elm);
|
|
4027
|
-
}
|
|
4028
|
-
if (!(Number.isNaN(sig.peek()) && Number.isNaN(parsed))) sig.value = parsed;
|
|
4029
|
-
return;
|
|
4030
|
-
}
|
|
4031
|
-
}
|
|
4032
|
-
if (!hostRef) {
|
|
4033
|
-
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$}"`);
|
|
4034
|
-
return;
|
|
4035
|
-
}
|
|
4036
|
-
if (BUILD$1.serializer && hostRef.$serializerValues$.has(propName) && hostRef.$serializerValues$.get(propName) === newVal) return;
|
|
4037
|
-
const elm = BUILD$1.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
4038
|
-
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
4039
|
-
const flags = hostRef.$flags$;
|
|
4040
|
-
const instance = BUILD$1.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
4041
|
-
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
4042
|
-
const didValueChange = newVal !== oldVal && !(Number.isNaN(oldVal) && Number.isNaN(newVal));
|
|
4043
|
-
if ((!BUILD$1.lazyLoad || !(flags & HOST_FLAGS.isConstructingInstance) || oldVal === void 0) && didValueChange) {
|
|
4044
|
-
hostRef.$instanceValues$.set(propName, newVal);
|
|
4045
|
-
if (BUILD$1.serializer && BUILD$1.reflect && cmpMeta.$attrsToReflect$ && cmpMeta.$serializers$?.[propName]) applySerializers(hostRef, cmpMeta, propName, newVal, instance);
|
|
4046
|
-
if (BUILD$1.isDev) {
|
|
4047
|
-
if (hostRef.$flags$ & HOST_FLAGS.devOnRender) `${propName}`;
|
|
4048
|
-
else if (hostRef.$flags$ & HOST_FLAGS.devOnDidLoad) `${propName}`;
|
|
4049
|
-
}
|
|
4050
|
-
if (BUILD$1.propChangeCallback && cmpMeta.$watchers$) {
|
|
4051
|
-
const watchMethods = cmpMeta.$watchers$[propName];
|
|
4052
|
-
if (watchMethods) watchMethods.map((watcher) => {
|
|
4053
|
-
try {
|
|
4054
|
-
const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
|
|
4055
|
-
if (flags & HOST_FLAGS.isWatchReady || watcherFlags & WATCH_FLAGS.Immediate) {
|
|
4056
|
-
if (BUILD$1.signalBacking && !hostRef.$signalValues$) return;
|
|
4057
|
-
if (!instance) hostRef.$fetchedCbList$.push(() => {
|
|
4058
|
-
hostRef.$lazyInstance$[watchMethodName](newVal, oldVal, propName);
|
|
4059
|
-
});
|
|
4060
|
-
else instance[watchMethodName](newVal, oldVal, propName);
|
|
4061
|
-
}
|
|
4062
|
-
} catch (e) {
|
|
4063
|
-
consoleError(e, elm);
|
|
4064
|
-
}
|
|
4065
|
-
});
|
|
4066
|
-
}
|
|
4067
|
-
if (BUILD$1.updatable && flags & HOST_FLAGS.hasRendered) {
|
|
4068
|
-
if (instance.componentShouldUpdate) {
|
|
4069
|
-
const changes = hostRef.$queuedPropChanges$ ||= {};
|
|
4070
|
-
changes[propName] = {
|
|
4071
|
-
newVal,
|
|
4072
|
-
oldVal: changes[propName]?.oldVal ?? oldVal
|
|
4073
|
-
};
|
|
4074
|
-
}
|
|
4075
|
-
if (!(flags & HOST_FLAGS.isQueuedForUpdate)) scheduleUpdate(hostRef, false);
|
|
4076
|
-
}
|
|
4077
|
-
}
|
|
4078
|
-
};
|
|
4079
|
-
//#endregion
|
|
4080
4124
|
//#region src/runtime/proxy-component.ts
|
|
4081
4125
|
/**
|
|
4082
4126
|
* Serialize a prop value the way `setAccessor()` does when it reflects it, so the runtime can
|
|
@@ -4209,7 +4253,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4209
4253
|
plt.jmp(() => {
|
|
4210
4254
|
const propName = attrNameToPropName.get(attrName);
|
|
4211
4255
|
const hostRef = getHostRef(this);
|
|
4212
|
-
if (BUILD$1.serializer && hostRef.$serializerValues$.has(propName) && hostRef.$serializerValues$.get(propName) === newValue) return;
|
|
4256
|
+
if (BUILD$1.serializer && hostRef.$flags$ & HOST_FLAGS.isReflecting && hostRef.$serializerValues$.has(propName) && hostRef.$serializerValues$.get(propName) === newValue) return;
|
|
4213
4257
|
if (this.hasOwnProperty(propName) && BUILD$1.lazyLoad) {
|
|
4214
4258
|
newValue = this[propName];
|
|
4215
4259
|
delete this[propName];
|
|
@@ -4319,7 +4363,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
4319
4363
|
replayPendingSetterValues(hostRef, cmpMeta);
|
|
4320
4364
|
}
|
|
4321
4365
|
endNewInstance();
|
|
4322
|
-
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
|
+
}
|
|
4323
4370
|
if (!(BUILD$1.slotRelocation && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation)) {
|
|
4324
4371
|
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
4325
4372
|
if (BUILD$1.asyncLoading) markFirstConnected(hostRef);
|
|
@@ -4720,8 +4767,11 @@ const proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
4720
4767
|
}
|
|
4721
4768
|
connectedCallback(this);
|
|
4722
4769
|
if (BUILD$1.asyncLoading && hostRef && hostRef.$ancestorComponent$) {
|
|
4723
|
-
|
|
4724
|
-
if (
|
|
4770
|
+
const ancestorConnected = whenAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(this));
|
|
4771
|
+
if (ancestorConnected) {
|
|
4772
|
+
await ancestorConnected;
|
|
4773
|
+
if (!this.isConnected) return;
|
|
4774
|
+
}
|
|
4725
4775
|
}
|
|
4726
4776
|
if (originalConnectedCallback && (plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected) === 0) originalConnectedCallback.call(this);
|
|
4727
4777
|
if (BUILD$1.asyncLoading && hostRef) markFirstConnected(hostRef);
|
|
@@ -4869,7 +4919,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
4869
4919
|
if (!hostRef) return;
|
|
4870
4920
|
const i = deferredConnectedCallbacks.findIndex((host) => host === this);
|
|
4871
4921
|
if (i > -1) deferredConnectedCallbacks.splice(i, 1);
|
|
4872
|
-
if (hostRef
|
|
4922
|
+
if (hostRef.$vnode$?.$elm$?.isConnected === false) delete hostRef.$vnode$.$elm$;
|
|
4873
4923
|
});
|
|
4874
4924
|
}
|
|
4875
4925
|
componentOnReady() {
|
|
@@ -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
|