@stencil/core 5.0.0-beta.1 → 5.0.0-beta.11
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/app-data/index.d.ts +1 -1
- package/dist/{client-BRu0GtRn.mjs → client-CdFmjaQa.mjs} +40 -15
- package/dist/compiler/browser.d.ts +1 -1
- package/dist/compiler/browser.js +77 -41
- package/dist/compiler/index.d.mts +1 -1
- package/dist/compiler/index.mjs +2 -2
- package/dist/compiler/utils/index.d.mts +1 -1
- package/dist/{compiler-CJG6qvQt.mjs → compiler-2EypBn_Y.mjs} +346 -122
- package/dist/declarations/stencil-public-compiler.d.ts +6 -1
- package/dist/declarations/stencil-public-runtime.d.ts +57 -55
- package/dist/{index-BXAcVN2j.d.ts → index-BHciXst1.d.ts} +57 -55
- package/dist/{index-DmHmu3y0.d.mts → index-CKnzMkZC.d.mts} +1 -1
- package/dist/{index-BopBfjPu.d.mts → index-Cw1NW9FW.d.mts} +6 -1
- package/dist/index.mjs +1 -1
- package/dist/jsx-runtime.mjs +1 -1
- package/dist/{node-75gQKkFz.mjs → node-HKfDhPR3.mjs} +1 -1
- package/dist/runtime/client/lazy.js +63 -31
- package/dist/runtime/client/runtime.d.ts +57 -55
- package/dist/runtime/client/runtime.js +63 -31
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +63 -31
- package/dist/runtime/server/index.d.mts +2 -1
- package/dist/runtime/server/index.mjs +83 -44
- package/dist/runtime/server/runner.mjs +8 -5
- package/dist/signals/index.d.ts +11 -2
- package/dist/signals/index.js +11 -1
- package/dist/sys/node/index.d.mts +1 -1
- package/dist/sys/node/index.mjs +1 -1
- package/dist/sys/node/worker.mjs +2 -2
- package/dist/testing/index.d.mts +6 -1
- package/dist/testing/index.mjs +64 -32
- package/package.json +4 -4
package/dist/runtime/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BUILD } from "../app-data/index.js";
|
|
2
2
|
import "../app-globals/index.js";
|
|
3
|
-
import
|
|
3
|
+
import * as SignalsCore from "@preact/signals-core";
|
|
4
4
|
//#region src/client/client-build.ts
|
|
5
5
|
const Build = {
|
|
6
6
|
isDev: BUILD.isDev,
|
|
@@ -1557,6 +1557,13 @@ const isComplexType = (o) => {
|
|
|
1557
1557
|
return o === "object" || o === "function";
|
|
1558
1558
|
};
|
|
1559
1559
|
//#endregion
|
|
1560
|
+
//#region src/runtime/signals-core.ts
|
|
1561
|
+
const getCore = () => globalThis[Symbol.for("stencil.preact-signals-core")] ??= SignalsCore;
|
|
1562
|
+
const effect = (fn, options) => getCore().effect(fn, options);
|
|
1563
|
+
function signal(value, options) {
|
|
1564
|
+
return getCore().signal(value, options);
|
|
1565
|
+
}
|
|
1566
|
+
//#endregion
|
|
1560
1567
|
//#region src/runtime/event-emitter.ts
|
|
1561
1568
|
const createEvent = (ref, name, flags) => {
|
|
1562
1569
|
const elm = getElement(ref);
|
|
@@ -1632,7 +1639,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
|
|
|
1632
1639
|
attrMap.get(memberName)?.();
|
|
1633
1640
|
if (!signalAttrDisposers.has(elm)) signalAttrDisposers.set(elm, attrMap);
|
|
1634
1641
|
let prevVal = oldValue;
|
|
1635
|
-
attrMap.set(memberName, effect
|
|
1642
|
+
attrMap.set(memberName, effect(() => {
|
|
1636
1643
|
const curVal = newValue.value;
|
|
1637
1644
|
setAccessor(elm, memberName, prevVal, curVal, isSvg, flags);
|
|
1638
1645
|
prevVal = curVal;
|
|
@@ -1849,16 +1856,33 @@ const signalNodeDisposers = /* @__PURE__ */ new WeakMap();
|
|
|
1849
1856
|
const disposeSignalVNode = (vnode) => {
|
|
1850
1857
|
const elm = vnode.$elm$;
|
|
1851
1858
|
if (elm) {
|
|
1852
|
-
|
|
1853
|
-
if (dispose) {
|
|
1854
|
-
dispose();
|
|
1855
|
-
signalNodeDisposers.delete(elm);
|
|
1856
|
-
}
|
|
1859
|
+
disposeTextSignal(elm);
|
|
1857
1860
|
disposeAllSignalAttrs(elm);
|
|
1858
1861
|
}
|
|
1859
1862
|
vnode.$children$?.forEach(disposeSignalVNode);
|
|
1860
1863
|
};
|
|
1861
1864
|
/**
|
|
1865
|
+
* Tear down a text node's signal subscription, if it has one.
|
|
1866
|
+
* @param textNode the text node to unsubscribe
|
|
1867
|
+
*/
|
|
1868
|
+
const disposeTextSignal = (textNode) => {
|
|
1869
|
+
const dispose = signalNodeDisposers.get(textNode);
|
|
1870
|
+
if (dispose) {
|
|
1871
|
+
dispose();
|
|
1872
|
+
signalNodeDisposers.delete(textNode);
|
|
1873
|
+
}
|
|
1874
|
+
};
|
|
1875
|
+
/**
|
|
1876
|
+
* Subscribe a text node to a signal, keeping its `data` in sync on every change.
|
|
1877
|
+
* @param textNode the text node to keep in sync
|
|
1878
|
+
* @param textSig the signal to subscribe to
|
|
1879
|
+
*/
|
|
1880
|
+
const wireTextSignal = (textNode, textSig) => {
|
|
1881
|
+
signalNodeDisposers.set(textNode, effect(() => {
|
|
1882
|
+
textNode.data = String(textSig.value);
|
|
1883
|
+
}));
|
|
1884
|
+
};
|
|
1885
|
+
/**
|
|
1862
1886
|
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
1863
1887
|
*
|
|
1864
1888
|
* @param oldParentVNode the parent VNode from the previous render
|
|
@@ -1880,13 +1904,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
1880
1904
|
if (BUILD.isDev && newVNode.$elm$) consoleDevError(`The JSX ${newVNode.$text$ !== null ? `"${newVNode.$text$}" text` : `"${String(newVNode.$tag$)}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`);
|
|
1881
1905
|
if (BUILD.vdomText && newVNode.$text$ != null) {
|
|
1882
1906
|
elm = newVNode.$elm$ = win.document.createTextNode(newVNode.$text$);
|
|
1883
|
-
if (BUILD.vdomSignals && newVNode.$signal$)
|
|
1884
|
-
const textSig = newVNode.$signal$;
|
|
1885
|
-
const textNode = elm;
|
|
1886
|
-
signalNodeDisposers.set(textNode, effect$1(() => {
|
|
1887
|
-
textNode.data = String(textSig.value);
|
|
1888
|
-
}));
|
|
1889
|
-
}
|
|
1907
|
+
if (BUILD.vdomSignals && newVNode.$signal$) wireTextSignal(elm, newVNode.$signal$);
|
|
1890
1908
|
} else if (BUILD.slotRelocation && newVNode.$flags$ & VNODE_FLAGS.isSlotReference) {
|
|
1891
1909
|
elm = newVNode.$elm$ = BUILD.isDebug || BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode) : win.document.createTextNode("");
|
|
1892
1910
|
if (typeof newVNode.$attrs$?.slot === "string") elm["s-sa"] = newVNode.$attrs$.slot;
|
|
@@ -2154,7 +2172,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
|
|
|
2154
2172
|
}
|
|
2155
2173
|
if (BUILD.vdomKey && idxInOld >= 0) {
|
|
2156
2174
|
elmToMove = oldCh[idxInOld];
|
|
2157
|
-
if (elmToMove.$tag$ !== newStartVnode.$tag$) node = createElm(oldCh && oldCh[newStartIdx], newVNode,
|
|
2175
|
+
if (elmToMove.$tag$ !== newStartVnode.$tag$) node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
2158
2176
|
else {
|
|
2159
2177
|
patch(elmToMove, newStartVnode, isInitialRender);
|
|
2160
2178
|
oldCh[idxInOld] = void 0;
|
|
@@ -2247,7 +2265,17 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
|
|
|
2247
2265
|
else if (BUILD.hydrateClientSide && isInitialRender && BUILD.updatable && oldChildren !== null && newChildren === null) newVNode.$children$ = oldChildren;
|
|
2248
2266
|
if (BUILD.svg && isSvgMode && tag === "svg") isSvgMode = false;
|
|
2249
2267
|
} else if (BUILD.vdomText && BUILD.slotRelocation && (defaultHolder = elm["s-cr"])) defaultHolder.parentNode.textContent = text;
|
|
2250
|
-
else if (BUILD.vdomText
|
|
2268
|
+
else if (BUILD.vdomText) {
|
|
2269
|
+
if (BUILD.vdomSignals && newVNode.$signal$) {
|
|
2270
|
+
if (newVNode.$signal$ !== oldVNode.$signal$) {
|
|
2271
|
+
disposeTextSignal(elm);
|
|
2272
|
+
wireTextSignal(elm, newVNode.$signal$);
|
|
2273
|
+
}
|
|
2274
|
+
} else {
|
|
2275
|
+
if (BUILD.vdomSignals && oldVNode.$signal$) disposeTextSignal(elm);
|
|
2276
|
+
if (oldVNode.$text$ !== text) elm.data = text;
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2251
2279
|
};
|
|
2252
2280
|
/**
|
|
2253
2281
|
* Component-global information about nodes which are either currently being
|
|
@@ -2947,8 +2975,7 @@ const initializeSignals = (elm, hostRef, cmpMeta) => {
|
|
|
2947
2975
|
const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
2948
2976
|
for (const [memberName, [memberFlags]] of Object.entries(cmpMeta.$members$ ?? {})) {
|
|
2949
2977
|
if (!(memberFlags & MEMBER_FLAGS.PropLike)) continue;
|
|
2950
|
-
const
|
|
2951
|
-
const sig = signal(initialVal);
|
|
2978
|
+
const sig = signal(hostRef.$instanceValues$.get(memberName));
|
|
2952
2979
|
hostRef.$signalValues$.set(memberName, sig);
|
|
2953
2980
|
let prevScheduleVal = sig.peek();
|
|
2954
2981
|
disposers.push(effect(() => {
|
|
@@ -3854,12 +3881,13 @@ const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector)
|
|
|
3854
3881
|
else return shallowPart.trim();
|
|
3855
3882
|
}).join(", ");
|
|
3856
3883
|
};
|
|
3884
|
+
const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer");
|
|
3857
3885
|
const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
|
|
3858
3886
|
return processRules(cssText, (rule) => {
|
|
3859
3887
|
let selector = rule.selector;
|
|
3860
3888
|
let content = rule.content;
|
|
3861
3889
|
if (rule.selector[0] !== "@") selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
|
|
3862
|
-
else if (
|
|
3890
|
+
else if (isScopableAtRule(rule.selector)) content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector);
|
|
3863
3891
|
return {
|
|
3864
3892
|
selector: selector.replace(/\s{2,}/g, " ").trim(),
|
|
3865
3893
|
content
|
|
@@ -3951,14 +3979,12 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
|
3951
3979
|
rule.selector = placeholder + rule.selector;
|
|
3952
3980
|
return rule;
|
|
3953
3981
|
};
|
|
3954
|
-
|
|
3982
|
+
const commentSelectors = (input) => processRules(input, (rule) => {
|
|
3955
3983
|
if (rule.selector[0] !== "@") return processCommentedSelector(rule);
|
|
3956
|
-
|
|
3957
|
-
rule.content = processRules(rule.content, processCommentedSelector);
|
|
3958
|
-
return rule;
|
|
3959
|
-
}
|
|
3984
|
+
if (isScopableAtRule(rule.selector)) rule.content = commentSelectors(rule.content);
|
|
3960
3985
|
return rule;
|
|
3961
3986
|
});
|
|
3987
|
+
cssText = commentSelectors(cssText);
|
|
3962
3988
|
}
|
|
3963
3989
|
const scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector);
|
|
3964
3990
|
cssText = [scoped.cssText, ...commentsWithHash].join("\n");
|
|
@@ -4255,16 +4281,21 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4255
4281
|
});
|
|
4256
4282
|
return;
|
|
4257
4283
|
}
|
|
4258
|
-
const
|
|
4284
|
+
const parsedValue = parsePropertyValue(newValue, memberFlags, BUILD.formAssociated && !!(cmpMeta.$flags$ & CMP_FLAGS.formAssociated));
|
|
4285
|
+
const setterSetVal = (val) => {
|
|
4259
4286
|
const currentValue = ref.$lazyInstance$[memberName];
|
|
4260
4287
|
if (!ref.$instanceValues$.get(memberName) && currentValue) ref.$instanceValues$.set(memberName, currentValue);
|
|
4261
|
-
ref.$lazyInstance$[memberName] =
|
|
4288
|
+
ref.$lazyInstance$[memberName] = val;
|
|
4262
4289
|
setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
|
|
4263
4290
|
};
|
|
4264
|
-
if (ref.$lazyInstance$) setterSetVal();
|
|
4265
|
-
else
|
|
4266
|
-
|
|
4267
|
-
|
|
4291
|
+
if (ref.$lazyInstance$) setterSetVal(parsedValue);
|
|
4292
|
+
else {
|
|
4293
|
+
ref.$instanceValues$.set(memberName, parsedValue);
|
|
4294
|
+
ref.$fetchedCbList$.push(() => {
|
|
4295
|
+
const pendingValue = ref.$instanceValues$.get(memberName);
|
|
4296
|
+
if (ref.$lazyInstance$[memberName] !== pendingValue) setterSetVal(pendingValue);
|
|
4297
|
+
});
|
|
4298
|
+
}
|
|
4268
4299
|
}
|
|
4269
4300
|
} });
|
|
4270
4301
|
} else if (BUILD.lazyLoad && BUILD.method && flags & PROXY_FLAGS.isElementConstructor && memberFlags & MEMBER_FLAGS.Method) Object.defineProperty(prototype, memberName, { value(...args) {
|
|
@@ -4317,8 +4348,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4317
4348
|
if (BUILD.reflect && propMemberFlags & MEMBER_FLAGS.ReflectAttr && propMemberFlags & MEMBER_FLAGS.Any && !isComplexType(this[propName]) && reflectedAttrValue(this[propName]) === newValue) return;
|
|
4318
4349
|
const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
|
|
4319
4350
|
if (isBooleanTarget) newValue = !(newValue === null || newValue === "false");
|
|
4351
|
+
const currentValue = BUILD.lazyLoad && propMemberFlags & MEMBER_FLAGS.Setter ? hostRef.$instanceValues$.get(propName) : this[propName];
|
|
4320
4352
|
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
4321
|
-
if (!isSpuriousBooleanRemoval && newValue !=
|
|
4353
|
+
if (!isSpuriousBooleanRemoval && newValue != currentValue && (!propDesc.get || !!propDesc.set)) this[propName] = newValue;
|
|
4322
4354
|
});
|
|
4323
4355
|
};
|
|
4324
4356
|
Cstr.observedAttributes = Array.from(/* @__PURE__ */ new Set([...Object.keys(cmpMeta.$watchers$ ?? {}), ...members.filter(([_, m]) => m[0] & MEMBER_FLAGS.HasAttribute).map(([propName, m]) => {
|
|
@@ -1026,8 +1026,9 @@ declare const hAsync: (nodeName: any, vnodeData: any, ...children: ChildType[])
|
|
|
1026
1026
|
* @param results The results object to store the hydration results.
|
|
1027
1027
|
* @param afterSsr The callback to be called after SSR is complete.
|
|
1028
1028
|
* @param resolve The resolve function to be called when SSR is complete.
|
|
1029
|
+
* @param abortController The AbortController to use for aborting in-flight fetch() calls and other cancellable work when SSR times out.
|
|
1029
1030
|
*/
|
|
1030
|
-
declare function ssrApp(win: Window & typeof globalThis, opts: SsrFactoryOptions, results: SsrResults, afterSsr: (win: Window, opts: SsrFactoryOptions, results: SsrResults, resolve: (results: SsrResults) => void) => void, resolve: (results: SsrResults) => void): void;
|
|
1031
|
+
declare function ssrApp(win: Window & typeof globalThis, opts: SsrFactoryOptions, results: SsrResults, afterSsr: (win: Window, opts: SsrFactoryOptions, results: SsrResults, resolve: (results: SsrResults) => void) => void, resolve: (results: SsrResults) => void, abortController: AbortController): void;
|
|
1031
1032
|
//#endregion
|
|
1032
1033
|
//#region src/runtime/bootstrap-standalone.d.ts
|
|
1033
1034
|
declare const defineCustomElement: (Cstr: any, compactMeta: ComponentRuntimeMetaCompact) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BUILD, BUILD as BUILD$1, Env, NAMESPACE, NAMESPACE as NAMESPACE$1 } from "@stencil/core/app-data";
|
|
2
2
|
import { globalScripts, globalStyles } from "@stencil/core/app-globals";
|
|
3
|
-
import
|
|
3
|
+
import * as SignalsCore from "@preact/signals-core";
|
|
4
4
|
const MEMBER_FLAGS = {
|
|
5
5
|
String: 1,
|
|
6
6
|
Number: 2,
|
|
@@ -1311,6 +1311,13 @@ const isComplexType = (o) => {
|
|
|
1311
1311
|
return o === "object" || o === "function";
|
|
1312
1312
|
};
|
|
1313
1313
|
//#endregion
|
|
1314
|
+
//#region src/runtime/signals-core.ts
|
|
1315
|
+
const getCore = () => globalThis[Symbol.for("stencil.preact-signals-core")] ??= SignalsCore;
|
|
1316
|
+
const effect = (fn, options) => getCore().effect(fn, options);
|
|
1317
|
+
function signal(value, options) {
|
|
1318
|
+
return getCore().signal(value, options);
|
|
1319
|
+
}
|
|
1320
|
+
//#endregion
|
|
1314
1321
|
//#region src/runtime/event-emitter.ts
|
|
1315
1322
|
const createEvent = (ref, name, flags) => {
|
|
1316
1323
|
const elm = getElement(ref);
|
|
@@ -1380,7 +1387,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
|
|
|
1380
1387
|
attrMap.get(memberName)?.();
|
|
1381
1388
|
if (!signalAttrDisposers.has(elm)) signalAttrDisposers.set(elm, attrMap);
|
|
1382
1389
|
let prevVal = oldValue;
|
|
1383
|
-
attrMap.set(memberName, effect
|
|
1390
|
+
attrMap.set(memberName, effect(() => {
|
|
1384
1391
|
const curVal = newValue.value;
|
|
1385
1392
|
setAccessor(elm, memberName, prevVal, curVal, isSvg, flags);
|
|
1386
1393
|
prevVal = curVal;
|
|
@@ -1597,16 +1604,33 @@ const signalNodeDisposers = /* @__PURE__ */ new WeakMap();
|
|
|
1597
1604
|
const disposeSignalVNode = (vnode) => {
|
|
1598
1605
|
const elm = vnode.$elm$;
|
|
1599
1606
|
if (elm) {
|
|
1600
|
-
|
|
1601
|
-
if (dispose) {
|
|
1602
|
-
dispose();
|
|
1603
|
-
signalNodeDisposers.delete(elm);
|
|
1604
|
-
}
|
|
1607
|
+
disposeTextSignal(elm);
|
|
1605
1608
|
disposeAllSignalAttrs(elm);
|
|
1606
1609
|
}
|
|
1607
1610
|
vnode.$children$?.forEach(disposeSignalVNode);
|
|
1608
1611
|
};
|
|
1609
1612
|
/**
|
|
1613
|
+
* Tear down a text node's signal subscription, if it has one.
|
|
1614
|
+
* @param textNode the text node to unsubscribe
|
|
1615
|
+
*/
|
|
1616
|
+
const disposeTextSignal = (textNode) => {
|
|
1617
|
+
const dispose = signalNodeDisposers.get(textNode);
|
|
1618
|
+
if (dispose) {
|
|
1619
|
+
dispose();
|
|
1620
|
+
signalNodeDisposers.delete(textNode);
|
|
1621
|
+
}
|
|
1622
|
+
};
|
|
1623
|
+
/**
|
|
1624
|
+
* Subscribe a text node to a signal, keeping its `data` in sync on every change.
|
|
1625
|
+
* @param textNode the text node to keep in sync
|
|
1626
|
+
* @param textSig the signal to subscribe to
|
|
1627
|
+
*/
|
|
1628
|
+
const wireTextSignal = (textNode, textSig) => {
|
|
1629
|
+
signalNodeDisposers.set(textNode, effect(() => {
|
|
1630
|
+
textNode.data = String(textSig.value);
|
|
1631
|
+
}));
|
|
1632
|
+
};
|
|
1633
|
+
/**
|
|
1610
1634
|
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
1611
1635
|
*
|
|
1612
1636
|
* @param oldParentVNode the parent VNode from the previous render
|
|
@@ -1628,13 +1652,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
1628
1652
|
if (BUILD$1.isDev && newVNode.$elm$) newVNode.$text$ !== null ? `${newVNode.$text$}` : `${String(newVNode.$tag$)}`;
|
|
1629
1653
|
if (BUILD$1.vdomText && newVNode.$text$ != null) {
|
|
1630
1654
|
elm = newVNode.$elm$ = win.document.createTextNode(newVNode.$text$);
|
|
1631
|
-
if (BUILD$1.vdomSignals && newVNode.$signal$)
|
|
1632
|
-
const textSig = newVNode.$signal$;
|
|
1633
|
-
const textNode = elm;
|
|
1634
|
-
signalNodeDisposers.set(textNode, effect$1(() => {
|
|
1635
|
-
textNode.data = String(textSig.value);
|
|
1636
|
-
}));
|
|
1637
|
-
}
|
|
1655
|
+
if (BUILD$1.vdomSignals && newVNode.$signal$) wireTextSignal(elm, newVNode.$signal$);
|
|
1638
1656
|
} else if (BUILD$1.slotRelocation && newVNode.$flags$ & VNODE_FLAGS.isSlotReference) {
|
|
1639
1657
|
elm = newVNode.$elm$ = BUILD$1.isDebug || BUILD$1.hydrateServerSide ? slotReferenceDebugNode(newVNode) : win.document.createTextNode("");
|
|
1640
1658
|
if (typeof newVNode.$attrs$?.slot === "string") elm["s-sa"] = newVNode.$attrs$.slot;
|
|
@@ -1902,7 +1920,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
|
|
|
1902
1920
|
}
|
|
1903
1921
|
if (BUILD$1.vdomKey && idxInOld >= 0) {
|
|
1904
1922
|
elmToMove = oldCh[idxInOld];
|
|
1905
|
-
if (elmToMove.$tag$ !== newStartVnode.$tag$) node = createElm(oldCh && oldCh[newStartIdx], newVNode,
|
|
1923
|
+
if (elmToMove.$tag$ !== newStartVnode.$tag$) node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
1906
1924
|
else {
|
|
1907
1925
|
patch(elmToMove, newStartVnode, isInitialRender);
|
|
1908
1926
|
oldCh[idxInOld] = void 0;
|
|
@@ -1995,7 +2013,17 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
|
|
|
1995
2013
|
else if (BUILD$1.hydrateClientSide && isInitialRender && BUILD$1.updatable && oldChildren !== null && newChildren === null) newVNode.$children$ = oldChildren;
|
|
1996
2014
|
if (BUILD$1.svg && isSvgMode && tag === "svg") isSvgMode = false;
|
|
1997
2015
|
} else if (BUILD$1.vdomText && BUILD$1.slotRelocation && (defaultHolder = elm["s-cr"])) defaultHolder.parentNode.textContent = text;
|
|
1998
|
-
else if (BUILD$1.vdomText
|
|
2016
|
+
else if (BUILD$1.vdomText) {
|
|
2017
|
+
if (BUILD$1.vdomSignals && newVNode.$signal$) {
|
|
2018
|
+
if (newVNode.$signal$ !== oldVNode.$signal$) {
|
|
2019
|
+
disposeTextSignal(elm);
|
|
2020
|
+
wireTextSignal(elm, newVNode.$signal$);
|
|
2021
|
+
}
|
|
2022
|
+
} else {
|
|
2023
|
+
if (BUILD$1.vdomSignals && oldVNode.$signal$) disposeTextSignal(elm);
|
|
2024
|
+
if (oldVNode.$text$ !== text) elm.data = text;
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
1999
2027
|
};
|
|
2000
2028
|
/**
|
|
2001
2029
|
* Component-global information about nodes which are either currently being
|
|
@@ -2695,8 +2723,7 @@ const initializeSignals = (elm, hostRef, cmpMeta) => {
|
|
|
2695
2723
|
const instance = BUILD$1.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
2696
2724
|
for (const [memberName, [memberFlags]] of Object.entries(cmpMeta.$members$ ?? {})) {
|
|
2697
2725
|
if (!(memberFlags & MEMBER_FLAGS.PropLike)) continue;
|
|
2698
|
-
const
|
|
2699
|
-
const sig = signal(initialVal);
|
|
2726
|
+
const sig = signal(hostRef.$instanceValues$.get(memberName));
|
|
2700
2727
|
hostRef.$signalValues$.set(memberName, sig);
|
|
2701
2728
|
let prevScheduleVal = sig.peek();
|
|
2702
2729
|
disposers.push(effect(() => {
|
|
@@ -3598,12 +3625,13 @@ const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector)
|
|
|
3598
3625
|
else return shallowPart.trim();
|
|
3599
3626
|
}).join(", ");
|
|
3600
3627
|
};
|
|
3628
|
+
const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer");
|
|
3601
3629
|
const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
|
|
3602
3630
|
return processRules(cssText, (rule) => {
|
|
3603
3631
|
let selector = rule.selector;
|
|
3604
3632
|
let content = rule.content;
|
|
3605
3633
|
if (rule.selector[0] !== "@") selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
|
|
3606
|
-
else if (
|
|
3634
|
+
else if (isScopableAtRule(rule.selector)) content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector);
|
|
3607
3635
|
return {
|
|
3608
3636
|
selector: selector.replace(/\s{2,}/g, " ").trim(),
|
|
3609
3637
|
content
|
|
@@ -3695,14 +3723,12 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
|
3695
3723
|
rule.selector = placeholder + rule.selector;
|
|
3696
3724
|
return rule;
|
|
3697
3725
|
};
|
|
3698
|
-
|
|
3726
|
+
const commentSelectors = (input) => processRules(input, (rule) => {
|
|
3699
3727
|
if (rule.selector[0] !== "@") return processCommentedSelector(rule);
|
|
3700
|
-
|
|
3701
|
-
rule.content = processRules(rule.content, processCommentedSelector);
|
|
3702
|
-
return rule;
|
|
3703
|
-
}
|
|
3728
|
+
if (isScopableAtRule(rule.selector)) rule.content = commentSelectors(rule.content);
|
|
3704
3729
|
return rule;
|
|
3705
3730
|
});
|
|
3731
|
+
cssText = commentSelectors(cssText);
|
|
3706
3732
|
}
|
|
3707
3733
|
const scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector);
|
|
3708
3734
|
cssText = [scoped.cssText, ...commentsWithHash].join("\n");
|
|
@@ -3999,16 +4025,21 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
3999
4025
|
});
|
|
4000
4026
|
return;
|
|
4001
4027
|
}
|
|
4002
|
-
const
|
|
4028
|
+
const parsedValue = parsePropertyValue(newValue, memberFlags, BUILD$1.formAssociated && !!(cmpMeta.$flags$ & CMP_FLAGS.formAssociated));
|
|
4029
|
+
const setterSetVal = (val) => {
|
|
4003
4030
|
const currentValue = ref.$lazyInstance$[memberName];
|
|
4004
4031
|
if (!ref.$instanceValues$.get(memberName) && currentValue) ref.$instanceValues$.set(memberName, currentValue);
|
|
4005
|
-
ref.$lazyInstance$[memberName] =
|
|
4032
|
+
ref.$lazyInstance$[memberName] = val;
|
|
4006
4033
|
setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
|
|
4007
4034
|
};
|
|
4008
|
-
if (ref.$lazyInstance$) setterSetVal();
|
|
4009
|
-
else
|
|
4010
|
-
|
|
4011
|
-
|
|
4035
|
+
if (ref.$lazyInstance$) setterSetVal(parsedValue);
|
|
4036
|
+
else {
|
|
4037
|
+
ref.$instanceValues$.set(memberName, parsedValue);
|
|
4038
|
+
ref.$fetchedCbList$.push(() => {
|
|
4039
|
+
const pendingValue = ref.$instanceValues$.get(memberName);
|
|
4040
|
+
if (ref.$lazyInstance$[memberName] !== pendingValue) setterSetVal(pendingValue);
|
|
4041
|
+
});
|
|
4042
|
+
}
|
|
4012
4043
|
}
|
|
4013
4044
|
} });
|
|
4014
4045
|
} else if (BUILD$1.lazyLoad && BUILD$1.method && flags & PROXY_FLAGS.isElementConstructor && memberFlags & MEMBER_FLAGS.Method) Object.defineProperty(prototype, memberName, { value(...args) {
|
|
@@ -4061,8 +4092,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4061
4092
|
if (BUILD$1.reflect && propMemberFlags & MEMBER_FLAGS.ReflectAttr && propMemberFlags & MEMBER_FLAGS.Any && !isComplexType(this[propName]) && reflectedAttrValue(this[propName]) === newValue) return;
|
|
4062
4093
|
const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
|
|
4063
4094
|
if (isBooleanTarget) newValue = !(newValue === null || newValue === "false");
|
|
4095
|
+
const currentValue = BUILD$1.lazyLoad && propMemberFlags & MEMBER_FLAGS.Setter ? hostRef.$instanceValues$.get(propName) : this[propName];
|
|
4064
4096
|
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
4065
|
-
if (!isSpuriousBooleanRemoval && newValue !=
|
|
4097
|
+
if (!isSpuriousBooleanRemoval && newValue != currentValue && (!propDesc.get || !!propDesc.set)) this[propName] = newValue;
|
|
4066
4098
|
});
|
|
4067
4099
|
};
|
|
4068
4100
|
Cstr.observedAttributes = Array.from(/* @__PURE__ */ new Set([...Object.keys(cmpMeta.$watchers$ ?? {}), ...members.filter(([_, m]) => m[0] & MEMBER_FLAGS.HasAttribute).map(([propName, m]) => {
|
|
@@ -5066,8 +5098,9 @@ function forceUpdate$1() {}
|
|
|
5066
5098
|
* @param results The results object to store the hydration results.
|
|
5067
5099
|
* @param afterSsr The callback to be called after SSR is complete.
|
|
5068
5100
|
* @param resolve The resolve function to be called when SSR is complete.
|
|
5101
|
+
* @param abortController The AbortController to use for aborting in-flight fetch() calls and other cancellable work when SSR times out.
|
|
5069
5102
|
*/
|
|
5070
|
-
function ssrApp(win, opts, results, afterSsr, resolve) {
|
|
5103
|
+
function ssrApp(win, opts, results, afterSsr, resolve, abortController) {
|
|
5071
5104
|
const connectedElements = /* @__PURE__ */ new Set();
|
|
5072
5105
|
const createdElements = /* @__PURE__ */ new Set();
|
|
5073
5106
|
const waitingElements = /* @__PURE__ */ new Set();
|
|
@@ -5077,6 +5110,10 @@ function ssrApp(win, opts, results, afterSsr, resolve) {
|
|
|
5077
5110
|
setScopedSsr(opts);
|
|
5078
5111
|
let tmrId;
|
|
5079
5112
|
let ranCompleted = false;
|
|
5113
|
+
const abortedPromise = new Promise((res) => {
|
|
5114
|
+
if (abortController.signal.aborted) res();
|
|
5115
|
+
else abortController.signal.addEventListener("abort", () => res(), { once: true });
|
|
5116
|
+
});
|
|
5080
5117
|
function hydratedComplete() {
|
|
5081
5118
|
$nativeClearTimeout(tmrId);
|
|
5082
5119
|
createdElements.clear();
|
|
@@ -5096,6 +5133,7 @@ function ssrApp(win, opts, results, afterSsr, resolve) {
|
|
|
5096
5133
|
}
|
|
5097
5134
|
function hydratedError(err) {
|
|
5098
5135
|
renderCatchError(opts, results, err);
|
|
5136
|
+
abortController.abort();
|
|
5099
5137
|
hydratedComplete();
|
|
5100
5138
|
}
|
|
5101
5139
|
function timeoutExceeded() {
|
|
@@ -5140,7 +5178,7 @@ function ssrApp(win, opts, results, afterSsr, resolve) {
|
|
|
5140
5178
|
if (isValidComponent(elm, opts) && results.hydratedCount < opts.maxHydrateCount) {
|
|
5141
5179
|
if (!connectedElements.has(elm) && shouldHydrate(elm)) {
|
|
5142
5180
|
connectedElements.add(elm);
|
|
5143
|
-
return hydrateComponent.call(elm, win, results, elm.nodeName, elm, waitingElements);
|
|
5181
|
+
return hydrateComponent.call(elm, win, results, elm.nodeName, elm, waitingElements, abortedPromise);
|
|
5144
5182
|
}
|
|
5145
5183
|
}
|
|
5146
5184
|
return resolved;
|
|
@@ -5169,7 +5207,7 @@ function ssrApp(win, opts, results, afterSsr, resolve) {
|
|
|
5169
5207
|
hydratedError(e);
|
|
5170
5208
|
}
|
|
5171
5209
|
}
|
|
5172
|
-
async function hydrateComponent(win, results, tagName, elm, waitingElements) {
|
|
5210
|
+
async function hydrateComponent(win, results, tagName, elm, waitingElements, aborted) {
|
|
5173
5211
|
tagName = tagName.toLowerCase();
|
|
5174
5212
|
const Cstr = loadModule({
|
|
5175
5213
|
$tagName$: tagName,
|
|
@@ -5184,16 +5222,17 @@ async function hydrateComponent(win, results, tagName, elm, waitingElements) {
|
|
|
5184
5222
|
addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
|
|
5185
5223
|
try {
|
|
5186
5224
|
connectedCallback(elm);
|
|
5187
|
-
await elm.componentOnReady()
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5225
|
+
if (!await Promise.race([elm.componentOnReady().then(() => false), aborted.then(() => true)])) {
|
|
5226
|
+
results.hydratedCount++;
|
|
5227
|
+
const ref = getHostRef(elm);
|
|
5228
|
+
const modeName = !ref?.$modeName$ ? "$" : ref?.$modeName$;
|
|
5229
|
+
if (!results.components.some((c) => c.tag === tagName && c.mode === modeName)) results.components.push({
|
|
5230
|
+
tag: tagName,
|
|
5231
|
+
mode: modeName,
|
|
5232
|
+
count: 0,
|
|
5233
|
+
depth: -1
|
|
5234
|
+
});
|
|
5235
|
+
}
|
|
5197
5236
|
} catch (e) {
|
|
5198
5237
|
win.console.error(e);
|
|
5199
5238
|
}
|
|
@@ -11927,11 +11927,14 @@ function resetWindow(win) {
|
|
|
11927
11927
|
if (win.document != null) try {
|
|
11928
11928
|
win.document.defaultView = win;
|
|
11929
11929
|
} catch {}
|
|
11930
|
-
|
|
11931
|
-
|
|
11932
|
-
|
|
11933
|
-
win.
|
|
11934
|
-
win.
|
|
11930
|
+
const windowDestroyed = () => {
|
|
11931
|
+
throw new Error("MockWindow was already destroyed");
|
|
11932
|
+
};
|
|
11933
|
+
win.fetch = windowDestroyed;
|
|
11934
|
+
win.Headers = windowDestroyed;
|
|
11935
|
+
win.Request = windowDestroyed;
|
|
11936
|
+
win.Response = windowDestroyed;
|
|
11937
|
+
win.FetchError = windowDestroyed;
|
|
11935
11938
|
}
|
|
11936
11939
|
}
|
|
11937
11940
|
function resetWindowDimensions(win) {
|
package/dist/signals/index.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as SignalsCore from "@preact/signals-core";
|
|
2
|
+
import { ReadonlySignal, Signal } from "@preact/signals-core";
|
|
2
3
|
import "rolldown";
|
|
3
4
|
import "typescript";
|
|
5
|
+
//#region src/runtime/signals-core.d.ts
|
|
6
|
+
declare const batch: typeof SignalsCore.batch;
|
|
7
|
+
declare const computed: typeof SignalsCore.computed;
|
|
8
|
+
declare const effect: typeof SignalsCore.effect;
|
|
9
|
+
declare const untracked: typeof SignalsCore.untracked;
|
|
10
|
+
declare function signal<T>(value: T, options?: SignalsCore.SignalOptions<T>): SignalsCore.Signal<T>;
|
|
11
|
+
declare function signal<T = undefined>(): SignalsCore.Signal<T | undefined>;
|
|
12
|
+
//#endregion
|
|
4
13
|
//#region src/runtime/signals.d.ts
|
|
5
14
|
declare const STENCIL_SIGNALS_SYMBOL: unique symbol;
|
|
6
15
|
//#endregion
|
|
@@ -22,7 +31,7 @@ declare const STENCIL_SIGNALS_SYMBOL: unique symbol;
|
|
|
22
31
|
* @param prop - the `@Prop` member name
|
|
23
32
|
* @returns the `ReadonlySignal` for the prop, or `null` if not found / not signal-backed
|
|
24
33
|
*/
|
|
25
|
-
declare const getSignal: <T = unknown>(elm: Element, prop: string) => ReadonlySignal
|
|
34
|
+
declare const getSignal: <T = unknown>(elm: Element, prop: string) => ReadonlySignal<T> | null;
|
|
26
35
|
/**
|
|
27
36
|
* Marks a class method as a reactive effect. Wraps the method in `effect()` after
|
|
28
37
|
* signal initialization and registers cleanup on disconnect. Dependencies are
|
package/dist/signals/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as SignalsCore from "@preact/signals-core";
|
|
2
2
|
//#region src/app-data/index.ts
|
|
3
3
|
/**
|
|
4
4
|
* A collection of default build flags for a Stencil project.
|
|
@@ -140,6 +140,16 @@ const consoleDevWarn = (...m) => console.warn(...STENCIL_DEV_MODE, ...m);
|
|
|
140
140
|
(typeof window !== "undefined" ? window : {}).HTMLElement;
|
|
141
141
|
BUILD.constructableCSS;
|
|
142
142
|
//#endregion
|
|
143
|
+
//#region src/runtime/signals-core.ts
|
|
144
|
+
const getCore = () => globalThis[Symbol.for("stencil.preact-signals-core")] ??= SignalsCore;
|
|
145
|
+
const batch = (fn) => getCore().batch(fn);
|
|
146
|
+
const computed = (fn, options) => getCore().computed(fn, options);
|
|
147
|
+
const effect = (fn, options) => getCore().effect(fn, options);
|
|
148
|
+
const untracked = (fn) => getCore().untracked(fn);
|
|
149
|
+
function signal(value, options) {
|
|
150
|
+
return getCore().signal(value, options);
|
|
151
|
+
}
|
|
152
|
+
//#endregion
|
|
143
153
|
//#region src/runtime/signals.ts
|
|
144
154
|
const STENCIL_SIGNALS_SYMBOL = Symbol.for("stencil.signals");
|
|
145
155
|
BUILD.lazyLoad || globalThis.HTMLElement;
|
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-HKfDhPR3.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-2EypBn_Y.mjs";
|
|
2
|
+
import { t as createNodeSys } from "../../node-HKfDhPR3.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
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -919,7 +919,8 @@ interface StencilConfig {
|
|
|
919
919
|
* Will generate {@link https://nodejs.org/api/packages.html#packages_exports export map} entry points
|
|
920
920
|
* for each component in the build when `true`.
|
|
921
921
|
*
|
|
922
|
-
*
|
|
922
|
+
* Defaults to `true` for "no-config" projects (no `stencil.config.ts`/`.js` file), and `false`
|
|
923
|
+
* whenever a config file is present - set this explicitly to opt an existing project in or out.
|
|
923
924
|
*/
|
|
924
925
|
generateExportMaps?: boolean;
|
|
925
926
|
/**
|
|
@@ -2474,6 +2475,10 @@ interface OutputTargetSsr extends OutputTargetBase {
|
|
|
2474
2475
|
*/
|
|
2475
2476
|
cjs?: boolean;
|
|
2476
2477
|
}
|
|
2478
|
+
/**
|
|
2479
|
+
* Compiles the SSR hydrate app to a WASM plugin (via `extism-js`/QuickJS-ng) that can run
|
|
2480
|
+
* outside of Node
|
|
2481
|
+
*/
|
|
2477
2482
|
interface OutputTargetSsrWasm extends OutputTargetBase {
|
|
2478
2483
|
type: 'ssr-wasm';
|
|
2479
2484
|
/** Output directory. @default 'dist/ssr-wasm' */
|