@stencil/core 5.0.0-beta.3 → 5.0.0-beta.31
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-DIvBaMnB.mjs} +182 -70
- package/dist/compiler/browser.d.ts +114 -81
- package/dist/compiler/browser.js +743 -339
- package/dist/compiler/index.d.mts +110 -2
- package/dist/compiler/index.mjs +3 -3
- package/dist/compiler/utils/index.d.mts +1 -1
- package/dist/{compiler-BPgV6bA4.mjs → compiler-BI12oAIV.mjs} +4840 -2899
- package/dist/declarations/stencil-public-compiler.d.ts +152 -129
- package/dist/declarations/stencil-public-docs.d.ts +23 -0
- package/dist/declarations/stencil-public-runtime.d.ts +62 -58
- package/dist/{index-DmHmu3y0.d.mts → index-BGUOG9Wc.d.mts} +6 -2
- package/dist/{index-BopBfjPu.d.mts → index-BogZpjP2.d.mts} +150 -127
- package/dist/{index-BXAcVN2j.d.ts → index-CicD4Pgn.d.ts} +59 -55
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +1 -1
- package/dist/jsx-runtime.d.mts +6 -0
- package/dist/jsx-runtime.mjs +1 -1
- package/dist/{node-75gQKkFz.mjs → node-D-21Ykxi.mjs} +41 -47
- package/dist/runtime/client/lazy.js +321 -200
- package/dist/runtime/client/runtime.d.ts +73 -66
- package/dist/runtime/client/runtime.js +321 -200
- package/dist/runtime/index.d.ts +4 -5
- package/dist/runtime/index.js +319 -198
- package/dist/runtime/server/index.d.mts +11 -11
- package/dist/runtime/server/index.mjs +371 -239
- package/dist/runtime/server/runner.d.mts +4 -4
- package/dist/runtime/server/runner.mjs +82 -54
- package/dist/signals/index.d.ts +11 -2
- package/dist/signals/index.js +14 -35
- 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 +136 -120
- package/dist/testing/index.mjs +328 -212
- package/package.json +8 -4
|
@@ -1,6 +1,105 @@
|
|
|
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
|
+
//#region src/runtime/runtime-constants.ts
|
|
5
|
+
/**
|
|
6
|
+
* Bit flags for recording various properties of VDom nodes
|
|
7
|
+
*/
|
|
8
|
+
const VNODE_FLAGS = {
|
|
9
|
+
/**
|
|
10
|
+
* Whether or not a vdom node is a slot reference
|
|
11
|
+
*/
|
|
12
|
+
isSlotReference: 1,
|
|
13
|
+
/**
|
|
14
|
+
* Whether or not a slot element has fallback content
|
|
15
|
+
*/
|
|
16
|
+
isSlotFallback: 2,
|
|
17
|
+
/**
|
|
18
|
+
* Whether or not an element is a host element
|
|
19
|
+
*/
|
|
20
|
+
isHost: 4
|
|
21
|
+
};
|
|
22
|
+
const PROXY_FLAGS = {
|
|
23
|
+
isElementConstructor: 1,
|
|
24
|
+
proxyState: 2
|
|
25
|
+
};
|
|
26
|
+
const PLATFORM_FLAGS = {
|
|
27
|
+
/**
|
|
28
|
+
* designates a node in the DOM as being actively moved by the runtime
|
|
29
|
+
*/
|
|
30
|
+
isTmpDisconnected: 1,
|
|
31
|
+
appLoaded: 2,
|
|
32
|
+
queueSync: 4,
|
|
33
|
+
queueMask: 6
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* A (subset) of node types which are relevant for the Stencil runtime. These
|
|
37
|
+
* values are based on the values which can possibly be returned by the
|
|
38
|
+
* `.nodeType` property of a DOM node. See here for details:
|
|
39
|
+
*
|
|
40
|
+
* {@link https://dom.spec.whatwg.org/#ref-for-dom-node-nodetype%E2%91%A0}
|
|
41
|
+
*/
|
|
42
|
+
const NODE_TYPE = {
|
|
43
|
+
ElementNode: 1,
|
|
44
|
+
TextNode: 3,
|
|
45
|
+
CommentNode: 8,
|
|
46
|
+
DocumentNode: 9,
|
|
47
|
+
DocumentTypeNode: 10,
|
|
48
|
+
DocumentFragment: 11
|
|
49
|
+
};
|
|
50
|
+
const HYDRATE_ID = "s-id";
|
|
51
|
+
const HYDRATED_STYLE_ID = "sty-id";
|
|
52
|
+
const HYDRATE_CHILD_ID = "c-id";
|
|
53
|
+
const HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
|
|
54
|
+
const STENCIL_DOC_DATA = "_stencilDocData";
|
|
55
|
+
const DEFAULT_DOC_DATA = {
|
|
56
|
+
hostIds: 0,
|
|
57
|
+
rootLevelIds: 0,
|
|
58
|
+
staticComponents: /* @__PURE__ */ new Set()
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Constant for styles to be globally applied to `slot-fb` elements for pseudo-slot behavior.
|
|
62
|
+
*
|
|
63
|
+
* Two cascading rules must be used instead of a `:not()` selector due to Stencil browser
|
|
64
|
+
* support as of Stencil v4.
|
|
65
|
+
*/
|
|
66
|
+
const SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
|
|
67
|
+
const XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
68
|
+
/**
|
|
69
|
+
* Minimum delay, in milliseconds, before retrying a failed lazy component load.
|
|
70
|
+
*/
|
|
71
|
+
const LAZY_LOAD_RETRY_INTERVAL_MS = 1e3;
|
|
72
|
+
const FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
|
|
73
|
+
"formAssociatedCallback",
|
|
74
|
+
"formResetCallback",
|
|
75
|
+
"formDisabledCallback",
|
|
76
|
+
"formStateRestoreCallback"
|
|
77
|
+
];
|
|
78
|
+
const SERVER_BUILD_FLAGS = {
|
|
79
|
+
isBrowser: false,
|
|
80
|
+
isServer: true,
|
|
81
|
+
isDev: false,
|
|
82
|
+
isTesting: false
|
|
83
|
+
};
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/runtime/tag-transform.ts
|
|
86
|
+
let tagTransformer = void 0;
|
|
87
|
+
/**
|
|
88
|
+
* Transforms a tag name using the current tag transformer
|
|
89
|
+
* @param tag - the tag to transform e.g. `my-tag`
|
|
90
|
+
* @returns the transformed tag e.g. `new-my-tag`
|
|
91
|
+
*/
|
|
92
|
+
function transformTag(tag) {
|
|
93
|
+
if (!tagTransformer) return tag;
|
|
94
|
+
return tagTransformer(tag);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Sets the tag transformer to be used when rendering custom elements
|
|
98
|
+
* @param transformer the transformer function to use. Must return a string
|
|
99
|
+
*/
|
|
100
|
+
function setTagTransformer(transformer) {
|
|
101
|
+
tagTransformer = transformer;
|
|
102
|
+
}
|
|
4
103
|
const MEMBER_FLAGS = {
|
|
5
104
|
String: 1,
|
|
6
105
|
Number: 2,
|
|
@@ -253,81 +352,6 @@ const reWireGetterSetter = (instance, hostRef) => {
|
|
|
253
352
|
});
|
|
254
353
|
};
|
|
255
354
|
//#endregion
|
|
256
|
-
//#region src/runtime/runtime-constants.ts
|
|
257
|
-
/**
|
|
258
|
-
* Bit flags for recording various properties of VDom nodes
|
|
259
|
-
*/
|
|
260
|
-
const VNODE_FLAGS = {
|
|
261
|
-
/**
|
|
262
|
-
* Whether or not a vdom node is a slot reference
|
|
263
|
-
*/
|
|
264
|
-
isSlotReference: 1,
|
|
265
|
-
/**
|
|
266
|
-
* Whether or not a slot element has fallback content
|
|
267
|
-
*/
|
|
268
|
-
isSlotFallback: 2,
|
|
269
|
-
/**
|
|
270
|
-
* Whether or not an element is a host element
|
|
271
|
-
*/
|
|
272
|
-
isHost: 4
|
|
273
|
-
};
|
|
274
|
-
const PROXY_FLAGS = {
|
|
275
|
-
isElementConstructor: 1,
|
|
276
|
-
proxyState: 2
|
|
277
|
-
};
|
|
278
|
-
const PLATFORM_FLAGS = {
|
|
279
|
-
/**
|
|
280
|
-
* designates a node in the DOM as being actively moved by the runtime
|
|
281
|
-
*/
|
|
282
|
-
isTmpDisconnected: 1,
|
|
283
|
-
appLoaded: 2,
|
|
284
|
-
queueSync: 4,
|
|
285
|
-
queueMask: 6
|
|
286
|
-
};
|
|
287
|
-
/**
|
|
288
|
-
* A (subset) of node types which are relevant for the Stencil runtime. These
|
|
289
|
-
* values are based on the values which can possibly be returned by the
|
|
290
|
-
* `.nodeType` property of a DOM node. See here for details:
|
|
291
|
-
*
|
|
292
|
-
* {@link https://dom.spec.whatwg.org/#ref-for-dom-node-nodetype%E2%91%A0}
|
|
293
|
-
*/
|
|
294
|
-
const NODE_TYPE = {
|
|
295
|
-
ElementNode: 1,
|
|
296
|
-
TextNode: 3,
|
|
297
|
-
CommentNode: 8,
|
|
298
|
-
DocumentNode: 9,
|
|
299
|
-
DocumentTypeNode: 10,
|
|
300
|
-
DocumentFragment: 11
|
|
301
|
-
};
|
|
302
|
-
const HYDRATE_ID = "s-id";
|
|
303
|
-
const HYDRATED_STYLE_ID = "sty-id";
|
|
304
|
-
const HYDRATE_CHILD_ID = "c-id";
|
|
305
|
-
const HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
|
|
306
|
-
const STENCIL_DOC_DATA = "_stencilDocData";
|
|
307
|
-
const DEFAULT_DOC_DATA = {
|
|
308
|
-
hostIds: 0,
|
|
309
|
-
rootLevelIds: 0,
|
|
310
|
-
staticComponents: /* @__PURE__ */ new Set()
|
|
311
|
-
};
|
|
312
|
-
/**
|
|
313
|
-
* Constant for styles to be globally applied to `slot-fb` elements for pseudo-slot behavior.
|
|
314
|
-
*
|
|
315
|
-
* Two cascading rules must be used instead of a `:not()` selector due to Stencil browser
|
|
316
|
-
* support as of Stencil v4.
|
|
317
|
-
*/
|
|
318
|
-
const SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
|
|
319
|
-
const XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
320
|
-
/**
|
|
321
|
-
* Minimum delay, in milliseconds, before retrying a failed lazy component load.
|
|
322
|
-
*/
|
|
323
|
-
const LAZY_LOAD_RETRY_INTERVAL_MS = 1e3;
|
|
324
|
-
const FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
|
|
325
|
-
"formAssociatedCallback",
|
|
326
|
-
"formResetCallback",
|
|
327
|
-
"formDisabledCallback",
|
|
328
|
-
"formStateRestoreCallback"
|
|
329
|
-
];
|
|
330
|
-
//#endregion
|
|
331
355
|
//#region src/utils/shadow-root.ts
|
|
332
356
|
let globalStyleSheet;
|
|
333
357
|
const GLOBAL_STYLE_ID = "sc-global";
|
|
@@ -616,6 +640,7 @@ const patchSlotAppendChild = (HostElementPrototype) => {
|
|
|
616
640
|
const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
|
|
617
641
|
if (slotNode) {
|
|
618
642
|
addSlotRelocateNode(newChild, slotNode);
|
|
643
|
+
patchSlottedNode(newChild);
|
|
619
644
|
const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
|
|
620
645
|
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
|
|
621
646
|
const insertedNode = internalCall(internalCall(appendAfter, "parentNode"), "insertBefore")(newChild, appendAfter.nextSibling);
|
|
@@ -638,8 +663,10 @@ const patchSlotRemoveChild = (ElementPrototype) => {
|
|
|
638
663
|
ElementPrototype.__removeChild = ElementPrototype.removeChild;
|
|
639
664
|
ElementPrototype.removeChild = function(toRemove) {
|
|
640
665
|
if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
|
|
641
|
-
|
|
642
|
-
|
|
666
|
+
const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, toRemove["s-sn"]);
|
|
667
|
+
if (slotNode && toRemove.isConnected) {
|
|
668
|
+
removeSlottedNode(toRemove);
|
|
669
|
+
if (slotNode[0]) dispatchSlotChangeEvent(slotNode[0]);
|
|
643
670
|
updateFallbackSlotVisibility(this);
|
|
644
671
|
return;
|
|
645
672
|
}
|
|
@@ -662,6 +689,7 @@ const patchSlotPrepend = (HostElementPrototype) => {
|
|
|
662
689
|
const slotNode = getHostSlotNodes(internalCall(this, "childNodes"), this.tagName, slotName)[0];
|
|
663
690
|
if (slotNode) {
|
|
664
691
|
addSlotRelocateNode(newChild, slotNode, true);
|
|
692
|
+
patchSlottedNode(newChild);
|
|
665
693
|
const appendAfter = getSlotChildSiblings(slotNode, slotName)[0];
|
|
666
694
|
const toReturn = internalCall(internalCall(appendAfter, "parentNode"), "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
|
|
667
695
|
dispatchSlotChangeEvent(slotNode);
|
|
@@ -737,6 +765,7 @@ const patchInsertBefore = (HostElementPrototype) => {
|
|
|
737
765
|
}
|
|
738
766
|
if (slotName === currentChild["s-sn"]) {
|
|
739
767
|
addSlotRelocateNode(newChild, slotNode);
|
|
768
|
+
patchSlottedNode(newChild);
|
|
740
769
|
internalCall(internalCall(currentChild, "parentNode"), "insertBefore")(newChild, currentChild);
|
|
741
770
|
dispatchSlotChangeEvent(slotNode);
|
|
742
771
|
}
|
|
@@ -815,10 +844,21 @@ const patchChildSlotNodes = (elm) => {
|
|
|
815
844
|
} });
|
|
816
845
|
};
|
|
817
846
|
/**
|
|
818
|
-
* Patches
|
|
819
|
-
*
|
|
820
|
-
*
|
|
821
|
-
*
|
|
847
|
+
* Patches a node slotted into a non-shadow component so it behaves as it would in a native slot:
|
|
848
|
+
* - `parentNode` returns the host element
|
|
849
|
+
* - `remove()` fires `slotchange` on the node's slot
|
|
850
|
+
*
|
|
851
|
+
* @param node the slotted node to be patched
|
|
852
|
+
*/
|
|
853
|
+
const patchSlottedNode = (node) => {
|
|
854
|
+
patchParentNode(node);
|
|
855
|
+
patchSlottedRemove(node);
|
|
856
|
+
};
|
|
857
|
+
/**
|
|
858
|
+
* Patches a slotted node from SSR markup: everything {@link patchSlottedNode} does, plus its
|
|
859
|
+
* sibling accessors, so whilst stepping through a non-shadow element's nodes only the mock
|
|
860
|
+
* 'lightDOM' nodes are returned. Frameworks hydrating SSR output often reconcile their VDOM with
|
|
861
|
+
* the real DOM by stepping through nodes with 'nextSibling' et al.
|
|
822
862
|
* - `nextSibling`
|
|
823
863
|
* - `nextElementSibling`
|
|
824
864
|
* - `previousSibling`
|
|
@@ -826,11 +866,11 @@ const patchChildSlotNodes = (elm) => {
|
|
|
826
866
|
*
|
|
827
867
|
* @param node the slotted node to be patched
|
|
828
868
|
*/
|
|
829
|
-
const
|
|
869
|
+
const patchSsrSlottedNode = (node) => {
|
|
830
870
|
if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return;
|
|
831
871
|
patchNextSibling(node);
|
|
832
872
|
patchPreviousSibling(node);
|
|
833
|
-
|
|
873
|
+
patchSlottedNode(node);
|
|
834
874
|
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
835
875
|
patchNextElementSibling(node);
|
|
836
876
|
patchPreviousElementSibling(node);
|
|
@@ -897,6 +937,39 @@ const patchPreviousElementSibling = (element) => {
|
|
|
897
937
|
} });
|
|
898
938
|
};
|
|
899
939
|
/**
|
|
940
|
+
* Detaches a slotted node from where it physically sits in the component's rendered DOM, through
|
|
941
|
+
* the unpatched accessors. Not via `remove()`: mock-doc's `remove()` calls
|
|
942
|
+
* `parentNode.removeChild()`, and a slotted node's patched `parentNode` is the host, whose patched
|
|
943
|
+
* `removeChild()` would come straight back here.
|
|
944
|
+
*
|
|
945
|
+
* @param node the slotted node to detach
|
|
946
|
+
*/
|
|
947
|
+
const removeSlottedNode = (node) => {
|
|
948
|
+
const parent = internalCall(node, "parentNode");
|
|
949
|
+
if (parent) internalCall(parent, "removeChild")(node);
|
|
950
|
+
};
|
|
951
|
+
/**
|
|
952
|
+
* Patches `remove()` on a node slotted into a non-shadow component, so that removing it fires
|
|
953
|
+
* `slotchange` on its slot (and updates fallback content), as removing a node from a native slot
|
|
954
|
+
* does. Stencil's own node moves, while `isTmpDisconnected` is set, don't fire it.
|
|
955
|
+
*
|
|
956
|
+
* @param node the slotted node to patch
|
|
957
|
+
*/
|
|
958
|
+
const patchSlottedRemove = (node) => {
|
|
959
|
+
const child = node;
|
|
960
|
+
if (!child || child.__remove || typeof child.remove !== "function") return;
|
|
961
|
+
child.__remove = child.remove;
|
|
962
|
+
child.remove = function() {
|
|
963
|
+
const host = this["s-ol"]?.parentElement;
|
|
964
|
+
const { slotNode } = findSlotFromSlottedNode(this);
|
|
965
|
+
removeSlottedNode(this);
|
|
966
|
+
if (slotNode && !(plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected)) {
|
|
967
|
+
dispatchSlotChangeEvent(slotNode);
|
|
968
|
+
updateFallbackSlotVisibility(host);
|
|
969
|
+
}
|
|
970
|
+
};
|
|
971
|
+
};
|
|
972
|
+
/**
|
|
900
973
|
* Patches the `parentNode` accessor of a non-shadow slotted node
|
|
901
974
|
*
|
|
902
975
|
* @param node the slotted node to be patched
|
|
@@ -1311,6 +1384,13 @@ const isComplexType = (o) => {
|
|
|
1311
1384
|
return o === "object" || o === "function";
|
|
1312
1385
|
};
|
|
1313
1386
|
//#endregion
|
|
1387
|
+
//#region src/runtime/signals-core.ts
|
|
1388
|
+
const getCore = () => globalThis[Symbol.for("stencil.preact-signals-core")] ??= SignalsCore;
|
|
1389
|
+
const effect = (fn, options) => getCore().effect(fn, options);
|
|
1390
|
+
function signal(value, options) {
|
|
1391
|
+
return getCore().signal(value, options);
|
|
1392
|
+
}
|
|
1393
|
+
//#endregion
|
|
1314
1394
|
//#region src/runtime/event-emitter.ts
|
|
1315
1395
|
const createEvent = (ref, name, flags) => {
|
|
1316
1396
|
const elm = getElement(ref);
|
|
@@ -1337,6 +1417,11 @@ const emitEvent = (elm, name, opts) => {
|
|
|
1337
1417
|
return ev;
|
|
1338
1418
|
};
|
|
1339
1419
|
const getRegistry = () => customElements;
|
|
1420
|
+
/**
|
|
1421
|
+
* @param elm a defined component host
|
|
1422
|
+
* @returns the registry the host's class was defined in, else the active registry
|
|
1423
|
+
*/
|
|
1424
|
+
const getHostRegistry = (elm) => elm.constructor._registry ?? getRegistry();
|
|
1340
1425
|
//#endregion
|
|
1341
1426
|
//#region src/runtime/vdom/set-accessor.ts
|
|
1342
1427
|
/**
|
|
@@ -1380,7 +1465,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
|
|
|
1380
1465
|
attrMap.get(memberName)?.();
|
|
1381
1466
|
if (!signalAttrDisposers.has(elm)) signalAttrDisposers.set(elm, attrMap);
|
|
1382
1467
|
let prevVal = oldValue;
|
|
1383
|
-
attrMap.set(memberName, effect
|
|
1468
|
+
attrMap.set(memberName, effect(() => {
|
|
1384
1469
|
const curVal = newValue.value;
|
|
1385
1470
|
setAccessor(elm, memberName, prevVal, curVal, isSvg, flags);
|
|
1386
1471
|
prevVal = curVal;
|
|
@@ -1460,10 +1545,10 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
|
|
|
1460
1545
|
const isComplex = isComplexType(newValue);
|
|
1461
1546
|
if (!BUILD$1.lazyLoad) {
|
|
1462
1547
|
const isStandardAttr = ln.startsWith("aria-") || ln.startsWith("data-");
|
|
1463
|
-
if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" &&
|
|
1548
|
+
if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" && !customElements.get(elm.tagName.toLowerCase())) {
|
|
1464
1549
|
if (!elm["s-pp"]) elm["s-pp"] = /* @__PURE__ */ new Map();
|
|
1465
1550
|
elm["s-pp"].set(memberName, newValue);
|
|
1466
|
-
return;
|
|
1551
|
+
if (isComplex || /[A-Z]/.test(memberName)) return;
|
|
1467
1552
|
}
|
|
1468
1553
|
}
|
|
1469
1554
|
if ((isProp || isComplex && newValue !== null) && !isSvg) try {
|
|
@@ -1581,6 +1666,7 @@ function sortedAttrNames(attrNames) {
|
|
|
1581
1666
|
let scopeId;
|
|
1582
1667
|
let contentRef;
|
|
1583
1668
|
let hostTagName;
|
|
1669
|
+
let hostRegistry;
|
|
1584
1670
|
let useNativeShadowDom = false;
|
|
1585
1671
|
let checkSlotFallbackVisibility = false;
|
|
1586
1672
|
let checkSlotRelocate = false;
|
|
@@ -1590,6 +1676,7 @@ let isSvgMode = false;
|
|
|
1590
1676
|
* These ensure that ref callbacks are called in the correct order:
|
|
1591
1677
|
* first all removal callbacks (with null), then all attachment callbacks (with elements).
|
|
1592
1678
|
*/
|
|
1679
|
+
const initialSlotChanges = /* @__PURE__ */ new Set();
|
|
1593
1680
|
const refCallbacksToRemove = [];
|
|
1594
1681
|
const refCallbacksToAttach = [];
|
|
1595
1682
|
/** Disposers for signal subscriptions on individual DOM nodes (text nodes, <s-show> wrappers). */
|
|
@@ -1597,16 +1684,33 @@ const signalNodeDisposers = /* @__PURE__ */ new WeakMap();
|
|
|
1597
1684
|
const disposeSignalVNode = (vnode) => {
|
|
1598
1685
|
const elm = vnode.$elm$;
|
|
1599
1686
|
if (elm) {
|
|
1600
|
-
|
|
1601
|
-
if (dispose) {
|
|
1602
|
-
dispose();
|
|
1603
|
-
signalNodeDisposers.delete(elm);
|
|
1604
|
-
}
|
|
1687
|
+
disposeTextSignal(elm);
|
|
1605
1688
|
disposeAllSignalAttrs(elm);
|
|
1606
1689
|
}
|
|
1607
1690
|
vnode.$children$?.forEach(disposeSignalVNode);
|
|
1608
1691
|
};
|
|
1609
1692
|
/**
|
|
1693
|
+
* Tear down a text node's signal subscription, if it has one.
|
|
1694
|
+
* @param textNode the text node to unsubscribe
|
|
1695
|
+
*/
|
|
1696
|
+
const disposeTextSignal = (textNode) => {
|
|
1697
|
+
const dispose = signalNodeDisposers.get(textNode);
|
|
1698
|
+
if (dispose) {
|
|
1699
|
+
dispose();
|
|
1700
|
+
signalNodeDisposers.delete(textNode);
|
|
1701
|
+
}
|
|
1702
|
+
};
|
|
1703
|
+
/**
|
|
1704
|
+
* Subscribe a text node to a signal, keeping its `data` in sync on every change.
|
|
1705
|
+
* @param textNode the text node to keep in sync
|
|
1706
|
+
* @param textSig the signal to subscribe to
|
|
1707
|
+
*/
|
|
1708
|
+
const wireTextSignal = (textNode, textSig) => {
|
|
1709
|
+
signalNodeDisposers.set(textNode, effect(() => {
|
|
1710
|
+
textNode.data = String(textSig.value);
|
|
1711
|
+
}));
|
|
1712
|
+
};
|
|
1713
|
+
/**
|
|
1610
1714
|
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
1611
1715
|
*
|
|
1612
1716
|
* @param oldParentVNode the parent VNode from the previous render
|
|
@@ -1628,13 +1732,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
1628
1732
|
if (BUILD$1.isDev && newVNode.$elm$) newVNode.$text$ !== null ? `${newVNode.$text$}` : `${String(newVNode.$tag$)}`;
|
|
1629
1733
|
if (BUILD$1.vdomText && newVNode.$text$ != null) {
|
|
1630
1734
|
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
|
-
}
|
|
1735
|
+
if (BUILD$1.vdomSignals && newVNode.$signal$) wireTextSignal(elm, newVNode.$signal$);
|
|
1638
1736
|
} else if (BUILD$1.slotRelocation && newVNode.$flags$ & VNODE_FLAGS.isSlotReference) {
|
|
1639
1737
|
elm = newVNode.$elm$ = BUILD$1.isDebug || BUILD$1.hydrateServerSide ? slotReferenceDebugNode(newVNode) : win.document.createTextNode("");
|
|
1640
1738
|
if (typeof newVNode.$attrs$?.slot === "string") elm["s-sa"] = newVNode.$attrs$.slot;
|
|
@@ -1643,8 +1741,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
1643
1741
|
if (BUILD$1.svg && !isSvgMode) isSvgMode = newVNode.$tag$ === "svg";
|
|
1644
1742
|
if (!win.document) throw new Error("No DOM environment available for rendering.");
|
|
1645
1743
|
const tag = !useNativeShadowDom && BUILD$1.slotRelocation && newVNode.$flags$ & VNODE_FLAGS.isSlotFallback ? "slot-fb" : newVNode.$tag$;
|
|
1646
|
-
const
|
|
1647
|
-
const registryOpts = _reg !== win.customElements && tag.includes("-") ? { customElementRegistry: _reg } : void 0;
|
|
1744
|
+
const registryOpts = hostRegistry !== win.customElements && tag.includes("-") ? { customElementRegistry: hostRegistry } : void 0;
|
|
1648
1745
|
elm = newVNode.$elm$ = BUILD$1.svg && isSvgMode ? win.document.createElementNS(SVG_NS, tag) : win.document.createElement(tag, registryOpts);
|
|
1649
1746
|
if (BUILD$1.svg && isSvgMode && newVNode.$tag$ === "foreignObject") isSvgMode = false;
|
|
1650
1747
|
if (BUILD$1.vdomAttribute) updateElement(null, newVNode, isSvgMode);
|
|
@@ -1902,7 +1999,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
|
|
|
1902
1999
|
}
|
|
1903
2000
|
if (BUILD$1.vdomKey && idxInOld >= 0) {
|
|
1904
2001
|
elmToMove = oldCh[idxInOld];
|
|
1905
|
-
if (elmToMove.$tag$ !== newStartVnode.$tag$) node = createElm(oldCh && oldCh[newStartIdx], newVNode,
|
|
2002
|
+
if (elmToMove.$tag$ !== newStartVnode.$tag$) node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
1906
2003
|
else {
|
|
1907
2004
|
patch(elmToMove, newStartVnode, isInitialRender);
|
|
1908
2005
|
oldCh[idxInOld] = void 0;
|
|
@@ -1995,7 +2092,17 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
|
|
|
1995
2092
|
else if (BUILD$1.hydrateClientSide && isInitialRender && BUILD$1.updatable && oldChildren !== null && newChildren === null) newVNode.$children$ = oldChildren;
|
|
1996
2093
|
if (BUILD$1.svg && isSvgMode && tag === "svg") isSvgMode = false;
|
|
1997
2094
|
} else if (BUILD$1.vdomText && BUILD$1.slotRelocation && (defaultHolder = elm["s-cr"])) defaultHolder.parentNode.textContent = text;
|
|
1998
|
-
else if (BUILD$1.vdomText
|
|
2095
|
+
else if (BUILD$1.vdomText) {
|
|
2096
|
+
if (BUILD$1.vdomSignals && newVNode.$signal$) {
|
|
2097
|
+
if (newVNode.$signal$ !== oldVNode.$signal$) {
|
|
2098
|
+
disposeTextSignal(elm);
|
|
2099
|
+
wireTextSignal(elm, newVNode.$signal$);
|
|
2100
|
+
}
|
|
2101
|
+
} else {
|
|
2102
|
+
if (BUILD$1.vdomSignals && oldVNode.$signal$) disposeTextSignal(elm);
|
|
2103
|
+
if (oldVNode.$text$ !== text) elm.data = text;
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
1999
2106
|
};
|
|
2000
2107
|
/**
|
|
2001
2108
|
* Component-global information about nodes which are either currently being
|
|
@@ -2124,10 +2231,13 @@ const insertBefore = (parent, newNode, reference, isInitialLoad) => {
|
|
|
2124
2231
|
if (BUILD$1.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
|
|
2125
2232
|
else if (typeof newNode["s-sn"] === "string") {
|
|
2126
2233
|
const hostElm = newNode["s-hn"] && parent.closest?.(newNode["s-hn"]);
|
|
2127
|
-
if ((BUILD$1.lightDomPatches || BUILD$1.slotChildNodes || BUILD$1.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE)
|
|
2234
|
+
if ((BUILD$1.lightDomPatches || BUILD$1.slotChildNodes || BUILD$1.patchAll && !!(hostElm && getHostRef(hostElm)?.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)) && parent.getRootNode().nodeType !== NODE_TYPES.DOCUMENT_FRAGMENT_NODE) patchSlottedNode(newNode);
|
|
2128
2235
|
parent.insertBefore(newNode, reference);
|
|
2129
2236
|
const { slotNode } = findSlotFromSlottedNode(newNode);
|
|
2130
|
-
if (slotNode
|
|
2237
|
+
if (slotNode) {
|
|
2238
|
+
if (isInitialLoad) initialSlotChanges.add(slotNode);
|
|
2239
|
+
else dispatchSlotChangeEvent(slotNode);
|
|
2240
|
+
}
|
|
2131
2241
|
return newNode;
|
|
2132
2242
|
}
|
|
2133
2243
|
}
|
|
@@ -2183,6 +2293,7 @@ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
2183
2293
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
2184
2294
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
2185
2295
|
hostTagName = hostElm.tagName;
|
|
2296
|
+
hostRegistry = getHostRegistry(hostElm);
|
|
2186
2297
|
if (BUILD$1.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) throw new Error(`The <Host> must be the single root component.
|
|
2187
2298
|
Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
|
|
2188
2299
|
|
|
@@ -2282,6 +2393,11 @@ render() {
|
|
|
2282
2393
|
if (checkSlotFallbackVisibility) updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
2283
2394
|
plt.$flags$ &= ~PLATFORM_FLAGS.isTmpDisconnected;
|
|
2284
2395
|
relocateNodes.length = 0;
|
|
2396
|
+
if (initialSlotChanges.size) {
|
|
2397
|
+
const slotNodes = [...initialSlotChanges];
|
|
2398
|
+
initialSlotChanges.clear();
|
|
2399
|
+
nextTick(() => slotNodes.forEach(dispatchSlotChangeEvent));
|
|
2400
|
+
}
|
|
2285
2401
|
}
|
|
2286
2402
|
if (BUILD$1.slotRelocation && !useNativeShadowDom && !(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && hostElm["s-cr"]) {
|
|
2287
2403
|
const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
|
|
@@ -2335,11 +2451,12 @@ const markFirstConnected = (hostRef) => {
|
|
|
2335
2451
|
* autoloader, where the ancestor tag may not be defined yet.
|
|
2336
2452
|
*
|
|
2337
2453
|
* @param ancestorElm the nearest Stencil ancestor element
|
|
2454
|
+
* @param registry the registry the waiting component is defined in
|
|
2338
2455
|
*/
|
|
2339
|
-
const awaitAncestorConnected = async (ancestorElm) => {
|
|
2456
|
+
const awaitAncestorConnected = async (ancestorElm, registry) => {
|
|
2340
2457
|
let ancestorHostRef = getHostRef(ancestorElm);
|
|
2341
2458
|
if (!BUILD$1.lazyLoad && !ancestorHostRef) {
|
|
2342
|
-
await
|
|
2459
|
+
await registry.whenDefined(ancestorElm.tagName.toLowerCase());
|
|
2343
2460
|
ancestorHostRef = getHostRef(ancestorElm);
|
|
2344
2461
|
}
|
|
2345
2462
|
if (ancestorHostRef && !(ancestorHostRef.$flags$ & HOST_FLAGS.hasFiredConnected)) await ensureFirstConnectPromise(ancestorHostRef);
|
|
@@ -2695,8 +2812,7 @@ const initializeSignals = (elm, hostRef, cmpMeta) => {
|
|
|
2695
2812
|
const instance = BUILD$1.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
2696
2813
|
for (const [memberName, [memberFlags]] of Object.entries(cmpMeta.$members$ ?? {})) {
|
|
2697
2814
|
if (!(memberFlags & MEMBER_FLAGS.PropLike)) continue;
|
|
2698
|
-
const
|
|
2699
|
-
const sig = signal(initialVal);
|
|
2815
|
+
const sig = signal(hostRef.$instanceValues$.get(memberName));
|
|
2700
2816
|
hostRef.$signalValues$.set(memberName, sig);
|
|
2701
2817
|
let prevScheduleVal = sig.peek();
|
|
2702
2818
|
disposers.push(effect(() => {
|
|
@@ -2875,17 +2991,23 @@ const vdomFnUtils = {
|
|
|
2875
2991
|
* Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
|
|
2876
2992
|
* friendlier public interface (hence, 'convertToPublic').
|
|
2877
2993
|
*
|
|
2878
|
-
*
|
|
2994
|
+
* Functional components receive primitive children unwrapped, so those
|
|
2995
|
+
* become text-only child nodes.
|
|
2996
|
+
*
|
|
2997
|
+
* @param node the virtual DOM node (or primitive child) to convert
|
|
2879
2998
|
* @returns a converted child node
|
|
2880
2999
|
*/
|
|
2881
|
-
const convertToPublic = (node) =>
|
|
3000
|
+
const convertToPublic = (node) => typeof node !== "object" ? {
|
|
3001
|
+
vtag: null,
|
|
3002
|
+
vtext: String(node)
|
|
3003
|
+
} : {
|
|
2882
3004
|
vattrs: node.$attrs$,
|
|
2883
3005
|
vchildren: node.$children$,
|
|
2884
3006
|
vkey: node.$key$,
|
|
2885
3007
|
vname: node.$name$,
|
|
2886
3008
|
vtag: node.$tag$,
|
|
2887
3009
|
vtext: node.$text$
|
|
2888
|
-
}
|
|
3010
|
+
};
|
|
2889
3011
|
/**
|
|
2890
3012
|
* Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
|
|
2891
3013
|
* order to use the resulting object in the virtual DOM. The initial object was
|
|
@@ -2902,11 +3024,11 @@ const convertToPrivate = (node) => {
|
|
|
2902
3024
|
if (node.vname) vnodeData.name = node.vname;
|
|
2903
3025
|
return h(node.vtag, vnodeData, ...node.vchildren || []);
|
|
2904
3026
|
}
|
|
2905
|
-
const vnode = newVNode(node.vtag, node.vtext);
|
|
2906
|
-
vnode.$attrs$ = node.vattrs;
|
|
2907
|
-
vnode.$children$ = node.vchildren;
|
|
2908
|
-
vnode.$key$ = node.vkey;
|
|
2909
|
-
vnode.$name$ = node.vname;
|
|
3027
|
+
const vnode = newVNode(node.vtag ?? null, node.vtext);
|
|
3028
|
+
vnode.$attrs$ = node.vattrs ?? null;
|
|
3029
|
+
vnode.$children$ = node.vchildren ?? null;
|
|
3030
|
+
vnode.$key$ = node.vkey ?? null;
|
|
3031
|
+
vnode.$name$ = node.vname ?? null;
|
|
2910
3032
|
return vnode;
|
|
2911
3033
|
};
|
|
2912
3034
|
/**
|
|
@@ -3026,7 +3148,7 @@ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
3026
3148
|
}
|
|
3027
3149
|
addSlotRelocateNode(siNode, siSlot, false, siNode["s-oo"] || currentPos);
|
|
3028
3150
|
if (siNode.parentElement?.shadowRoot && siNode["getAttribute"] && siNode.getAttribute("slot")) siNode.removeAttribute("slot");
|
|
3029
|
-
if (BUILD$1.lightDomPatches || BUILD$1.slotChildNodes || BUILD$1.patchAll && hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll)
|
|
3151
|
+
if (BUILD$1.lightDomPatches || BUILD$1.slotChildNodes || BUILD$1.patchAll && hostRef.$cmpMeta$.$flags$ & CMP_FLAGS.patchAll) patchSsrSlottedNode(siNode);
|
|
3030
3152
|
}
|
|
3031
3153
|
currentPos = (siNode["s-oo"] || currentPos) + 1;
|
|
3032
3154
|
}
|
|
@@ -3204,6 +3326,7 @@ const initializeDocumentHydrate = (node, orgLocNodes) => {
|
|
|
3204
3326
|
const createSimpleVNode = (vnode) => ({
|
|
3205
3327
|
$flags$: 0,
|
|
3206
3328
|
$index$: "0",
|
|
3329
|
+
$children$: null,
|
|
3207
3330
|
...vnode
|
|
3208
3331
|
});
|
|
3209
3332
|
function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) {
|
|
@@ -3598,7 +3721,7 @@ const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector)
|
|
|
3598
3721
|
else return shallowPart.trim();
|
|
3599
3722
|
}).join(", ");
|
|
3600
3723
|
};
|
|
3601
|
-
const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer");
|
|
3724
|
+
const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer") || selector.startsWith("@container");
|
|
3602
3725
|
const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
|
|
3603
3726
|
return processRules(cssText, (rule) => {
|
|
3604
3727
|
let selector = rule.selector;
|
|
@@ -3717,8 +3840,11 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
|
|
|
3717
3840
|
};
|
|
3718
3841
|
//#endregion
|
|
3719
3842
|
//#region src/runtime/mode.ts
|
|
3720
|
-
const computeMode = (elm) =>
|
|
3721
|
-
const setMode = (handler) =>
|
|
3843
|
+
const computeMode = (elm) => modeResolver.map((h) => h(elm)).find((m) => !!m);
|
|
3844
|
+
const setMode = (handler) => {
|
|
3845
|
+
modeResolver.length = 0;
|
|
3846
|
+
modeResolver.push(handler);
|
|
3847
|
+
};
|
|
3722
3848
|
const getMode = (ref) => getHostRef(ref)?.$modeName$;
|
|
3723
3849
|
//#endregion
|
|
3724
3850
|
//#region src/runtime/normalize-watchers.ts
|
|
@@ -3783,23 +3909,14 @@ const normalizeWatchers = (raw) => {
|
|
|
3783
3909
|
*
|
|
3784
3910
|
* @param propValue the new value to coerce to some type
|
|
3785
3911
|
* @param propType the type of the prop, expressed as a binary number
|
|
3786
|
-
* @param isFormAssociated whether the component is form-associated (optional)
|
|
3787
3912
|
* @returns the parsed/coerced value
|
|
3788
3913
|
*/
|
|
3789
|
-
const parsePropertyValue = (propValue, propType
|
|
3914
|
+
const parsePropertyValue = (propValue, propType) => {
|
|
3790
3915
|
if (propValue != null && !isComplexType(propValue)) {
|
|
3791
3916
|
/**
|
|
3792
3917
|
* ensure this value is of the correct prop type
|
|
3793
3918
|
*/
|
|
3794
|
-
if (BUILD$1.propBoolean && propType & MEMBER_FLAGS.Boolean)
|
|
3795
|
-
/**
|
|
3796
|
-
* For form-associated components, according to HTML spec, the presence of any boolean attribute
|
|
3797
|
-
* (regardless of its value, even "false") should make the property true.
|
|
3798
|
-
* For non-form-associated components, we maintain the legacy behavior where "false" becomes false.
|
|
3799
|
-
*/
|
|
3800
|
-
if (BUILD$1.formAssociated && isFormAssociated && typeof propValue === "string") return propValue === "" || !!propValue;
|
|
3801
|
-
else return propValue === "false" ? false : propValue === "" || !!propValue;
|
|
3802
|
-
}
|
|
3919
|
+
if (BUILD$1.propBoolean && propType & MEMBER_FLAGS.Boolean) return propValue === "" || !!propValue;
|
|
3803
3920
|
/**
|
|
3804
3921
|
* force it to be a number
|
|
3805
3922
|
*/
|
|
@@ -3841,7 +3958,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3841
3958
|
if (BUILD$1.signalBacking) {
|
|
3842
3959
|
const sig = hostRef?.$signalValues$?.get(propName);
|
|
3843
3960
|
if (sig !== void 0) {
|
|
3844
|
-
const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]
|
|
3961
|
+
const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
3845
3962
|
if (BUILD$1.serializer && BUILD$1.reflect && cmpMeta.$attrsToReflect$ && cmpMeta.$serializers$?.[propName]) {
|
|
3846
3963
|
const elm = BUILD$1.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
3847
3964
|
applySerializers(hostRef, cmpMeta, propName, parsed, BUILD$1.lazyLoad ? hostRef.$lazyInstance$ : elm);
|
|
@@ -3859,7 +3976,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3859
3976
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
3860
3977
|
const flags = hostRef.$flags$;
|
|
3861
3978
|
const instance = BUILD$1.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
3862
|
-
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]
|
|
3979
|
+
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
3863
3980
|
const didValueChange = newVal !== oldVal && !(Number.isNaN(oldVal) && Number.isNaN(newVal));
|
|
3864
3981
|
if ((!BUILD$1.lazyLoad || !(flags & HOST_FLAGS.isConstructingInstance) || oldVal === void 0) && didValueChange) {
|
|
3865
3982
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
@@ -3908,6 +4025,22 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3908
4025
|
*/
|
|
3909
4026
|
const reflectedAttrValue = (propValue) => propValue == null || propValue === false ? null : propValue === true ? "" : String(propValue);
|
|
3910
4027
|
/**
|
|
4028
|
+
* Hand values written to a lazy component's element before its instance existed to the
|
|
4029
|
+
* instance's own `@Prop` setters. Must run as soon as the instance is constructed, so that
|
|
4030
|
+
* whenever `$lazyInstance$` is set, reads through it agree with the element's last write.
|
|
4031
|
+
*
|
|
4032
|
+
* @param hostRef the runtime bookkeeping object of a freshly constructed lazy instance
|
|
4033
|
+
* @param cmpMeta runtime metadata for the component (with any run-time only setters flagged)
|
|
4034
|
+
*/
|
|
4035
|
+
const replayPendingSetterValues = (hostRef, cmpMeta) => {
|
|
4036
|
+
const instance = hostRef.$lazyInstance$;
|
|
4037
|
+
if (!instance) return;
|
|
4038
|
+
for (const [memberName, [memberFlags]] of Object.entries(cmpMeta.$members$ ?? {})) if (memberFlags & MEMBER_FLAGS.Setter && hostRef.$instanceValues$.has(memberName)) {
|
|
4039
|
+
const pendingValue = hostRef.$instanceValues$.get(memberName);
|
|
4040
|
+
if (instance[memberName] !== pendingValue) instance[memberName] = pendingValue;
|
|
4041
|
+
}
|
|
4042
|
+
};
|
|
4043
|
+
/**
|
|
3911
4044
|
* Attach a series of runtime constructs to a compiled Stencil component
|
|
3912
4045
|
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
3913
4046
|
* decorators, callbacks for when attributes change, and so on.
|
|
@@ -3964,9 +4097,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
3964
4097
|
if (BUILD$1.lazyLoad) {
|
|
3965
4098
|
if ((cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Getter) === 0) return getValue(this, memberName);
|
|
3966
4099
|
const ref = getHostRef(this);
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
return instance[memberName];
|
|
4100
|
+
if (!ref) return prototype[memberName];
|
|
4101
|
+
return ref.$lazyInstance$ ? ref.$lazyInstance$[memberName] : getValue(this, memberName);
|
|
3970
4102
|
}
|
|
3971
4103
|
if (!BUILD$1.lazyLoad) return origGetter ? origGetter.apply(this) : getValue(this, memberName);
|
|
3972
4104
|
},
|
|
@@ -3981,7 +4113,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
3981
4113
|
}
|
|
3982
4114
|
if (origSetter) {
|
|
3983
4115
|
if (typeof (memberFlags & MEMBER_FLAGS.State ? this[memberName] : ref.$hostElement$[memberName]) === "undefined" && ref.$instanceValues$.get(memberName)) newValue = ref.$instanceValues$.get(memberName);
|
|
3984
|
-
origSetter.apply(this, [parsePropertyValue(newValue, memberFlags
|
|
4116
|
+
origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
|
|
3985
4117
|
newValue = memberFlags & MEMBER_FLAGS.State ? this[memberName] : ref.$hostElement$[memberName];
|
|
3986
4118
|
setValue(this, memberName, newValue, cmpMeta);
|
|
3987
4119
|
return;
|
|
@@ -3993,21 +4125,15 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
3993
4125
|
if (BUILD$1.lazyLoad) {
|
|
3994
4126
|
if ((flags & PROXY_FLAGS.isElementConstructor) === 0 || (cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Setter) === 0) {
|
|
3995
4127
|
setValue(this, memberName, newValue, cmpMeta);
|
|
3996
|
-
if (flags & PROXY_FLAGS.isElementConstructor && !ref.$lazyInstance$) ref.$fetchedCbList$.push(() => {
|
|
3997
|
-
if (cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Setter && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) ref.$lazyInstance$[memberName] = newValue;
|
|
3998
|
-
});
|
|
3999
4128
|
return;
|
|
4000
4129
|
}
|
|
4001
|
-
const
|
|
4130
|
+
const parsedValue = parsePropertyValue(newValue, memberFlags);
|
|
4131
|
+
if (ref.$lazyInstance$) {
|
|
4002
4132
|
const currentValue = ref.$lazyInstance$[memberName];
|
|
4003
4133
|
if (!ref.$instanceValues$.get(memberName) && currentValue) ref.$instanceValues$.set(memberName, currentValue);
|
|
4004
|
-
ref.$lazyInstance$[memberName] =
|
|
4134
|
+
ref.$lazyInstance$[memberName] = parsedValue;
|
|
4005
4135
|
setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
|
|
4006
|
-
};
|
|
4007
|
-
if (ref.$lazyInstance$) setterSetVal();
|
|
4008
|
-
else ref.$fetchedCbList$.push(() => {
|
|
4009
|
-
setterSetVal();
|
|
4010
|
-
});
|
|
4136
|
+
} else ref.$instanceValues$.set(memberName, parsedValue);
|
|
4011
4137
|
}
|
|
4012
4138
|
} });
|
|
4013
4139
|
} else if (BUILD$1.lazyLoad && BUILD$1.method && flags & PROXY_FLAGS.isElementConstructor && memberFlags & MEMBER_FLAGS.Method) Object.defineProperty(prototype, memberName, { value(...args) {
|
|
@@ -4059,7 +4185,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
4059
4185
|
const isBooleanTarget = propMemberFlags & MEMBER_FLAGS.Boolean;
|
|
4060
4186
|
if (BUILD$1.reflect && propMemberFlags & MEMBER_FLAGS.ReflectAttr && propMemberFlags & MEMBER_FLAGS.Any && !isComplexType(this[propName]) && reflectedAttrValue(this[propName]) === newValue) return;
|
|
4061
4187
|
const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
|
|
4062
|
-
if (isBooleanTarget)
|
|
4188
|
+
if (isBooleanTarget) {
|
|
4189
|
+
if (BUILD$1.isDev && newValue === "false") `${cmpMeta.$tagName$}${attrName}${propName}`;
|
|
4190
|
+
newValue = newValue !== null;
|
|
4191
|
+
}
|
|
4063
4192
|
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
4064
4193
|
if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) this[propName] = newValue;
|
|
4065
4194
|
});
|
|
@@ -4122,9 +4251,12 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
4122
4251
|
} catch (e) {
|
|
4123
4252
|
consoleError(e, elm);
|
|
4124
4253
|
}
|
|
4125
|
-
if (BUILD$1.member)
|
|
4254
|
+
if (BUILD$1.member) {
|
|
4255
|
+
hostRef.$flags$ &= ~HOST_FLAGS.isConstructingInstance;
|
|
4256
|
+
replayPendingSetterValues(hostRef, cmpMeta);
|
|
4257
|
+
}
|
|
4126
4258
|
endNewInstance();
|
|
4127
|
-
if (BUILD$1.asyncLoading && hostRef.$ancestorComponent$) await awaitAncestorConnected(hostRef.$ancestorComponent
|
|
4259
|
+
if (BUILD$1.asyncLoading && hostRef.$ancestorComponent$) await awaitAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(elm));
|
|
4128
4260
|
if (!(BUILD$1.slotRelocation && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation)) {
|
|
4129
4261
|
fireConnectedCallback(hostRef.$lazyInstance$, elm);
|
|
4130
4262
|
if (BUILD$1.asyncLoading) markFirstConnected(hostRef);
|
|
@@ -4224,9 +4356,16 @@ const connectedCallback = (elm) => {
|
|
|
4224
4356
|
}
|
|
4225
4357
|
if (BUILD$1.asyncLoading) {
|
|
4226
4358
|
let ancestorComponent = elm;
|
|
4227
|
-
while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)
|
|
4228
|
-
|
|
4229
|
-
|
|
4359
|
+
while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
|
|
4360
|
+
if (BUILD$1.hydrateClientSide && !ancestorComponent["s-p"] && ancestorComponent.nodeType === NODE_TYPE.ElementNode && ancestorComponent.hasAttribute("s-id")) {
|
|
4361
|
+
ancestorComponent["s-p"] = [];
|
|
4362
|
+
ancestorComponent["s-rc"] = [];
|
|
4363
|
+
ancestorComponent["s-pc"] = [];
|
|
4364
|
+
}
|
|
4365
|
+
if (ancestorComponent["s-p"]) {
|
|
4366
|
+
attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
|
|
4367
|
+
break;
|
|
4368
|
+
}
|
|
4230
4369
|
}
|
|
4231
4370
|
}
|
|
4232
4371
|
if (BUILD$1.prop && !BUILD$1.hydrateServerSide && cmpMeta.$members$) Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
@@ -4342,48 +4481,45 @@ const hmrStandalone = async (hostElement, cmpMeta, hmrVersionId) => {
|
|
|
4342
4481
|
`${modulePath}?s-hmr=${hmrVersionId}`
|
|
4343
4482
|
);
|
|
4344
4483
|
const NewClass = Object.values(newModule).find((v) => typeof v === "function" && v.is === cmpMeta.$tagName$) ?? newModule.default;
|
|
4345
|
-
if (
|
|
4346
|
-
const ctor = customElements.get(cmpMeta.$tagName$);
|
|
4347
|
-
if (ctor) {
|
|
4348
|
-
for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
|
|
4349
|
-
if (key === "constructor") continue;
|
|
4350
|
-
Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
|
|
4351
|
-
}
|
|
4352
|
-
const styleDesc = Object.getOwnPropertyDescriptor(NewClass, "style");
|
|
4353
|
-
if (styleDesc) {
|
|
4354
|
-
Object.defineProperty(ctor, "style", styleDesc);
|
|
4355
|
-
const newStyle = NewClass.style;
|
|
4356
|
-
if (newStyle) {
|
|
4357
|
-
const scopeId = getScopeId(cmpMeta);
|
|
4358
|
-
const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
|
|
4359
|
-
console.log("[stencil-hmr] registerStyle", {
|
|
4360
|
-
tag: cmpMeta.$tagName$,
|
|
4361
|
-
scopeId,
|
|
4362
|
-
isShadow,
|
|
4363
|
-
cssLen: newStyle.length
|
|
4364
|
-
});
|
|
4365
|
-
registerStyle(scopeId, newStyle, isShadow);
|
|
4366
|
-
}
|
|
4367
|
-
}
|
|
4368
|
-
}
|
|
4369
|
-
const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
|
|
4370
|
-
document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => {
|
|
4371
|
-
const hostRef = getHostRef(el);
|
|
4372
|
-
if (BUILD$1.hostListener && hostRef?.$rmListeners$) {
|
|
4373
|
-
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
4374
|
-
hostRef.$rmListeners$ = void 0;
|
|
4375
|
-
addHostEventListeners(el, hostRef, cmpMeta.$listeners$);
|
|
4376
|
-
}
|
|
4377
|
-
if (!isShadow && hostRef) {
|
|
4378
|
-
console.log("[stencil-hmr] calling attachStyles for", cmpMeta.$tagName$);
|
|
4379
|
-
attachStyles(hostRef);
|
|
4380
|
-
}
|
|
4381
|
-
forceUpdate(el);
|
|
4382
|
-
});
|
|
4484
|
+
if (NewClass) hmrApplyClass(cmpMeta, NewClass);
|
|
4383
4485
|
} catch (e) {
|
|
4384
4486
|
console.error(`[Stencil HMR] Failed to reload <${cmpMeta.$tagName$}>`, e);
|
|
4385
4487
|
}
|
|
4386
4488
|
};
|
|
4489
|
+
/**
|
|
4490
|
+
* Patch a re-executed component class onto the registered one and re-render every live instance.
|
|
4491
|
+
* Shared by the standalone re-import above and bundlers that re-execute the module themselves
|
|
4492
|
+
* (webpack/rspack `module.hot`), which reach it via the constructor's `s-hmr-apply` hook.
|
|
4493
|
+
*
|
|
4494
|
+
* @param cmpMeta runtime metadata for the component
|
|
4495
|
+
* @param NewClass the component's newly executed class
|
|
4496
|
+
*/
|
|
4497
|
+
const hmrApplyClass = (cmpMeta, NewClass) => {
|
|
4498
|
+
const ctor = customElements.get(cmpMeta.$tagName$);
|
|
4499
|
+
const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
|
|
4500
|
+
if (ctor && ctor !== NewClass) {
|
|
4501
|
+
for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
|
|
4502
|
+
if (key === "constructor") continue;
|
|
4503
|
+
Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
|
|
4504
|
+
}
|
|
4505
|
+
const styleDesc = Object.getOwnPropertyDescriptor(NewClass, "style");
|
|
4506
|
+
if (styleDesc) {
|
|
4507
|
+
Object.defineProperty(ctor, "style", styleDesc);
|
|
4508
|
+
const newStyle = NewClass.style;
|
|
4509
|
+
if (newStyle) registerStyle(getScopeId(cmpMeta), newStyle, isShadow);
|
|
4510
|
+
}
|
|
4511
|
+
}
|
|
4512
|
+
document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => {
|
|
4513
|
+
const hostRef = getHostRef(el);
|
|
4514
|
+
if (BUILD$1.hostListener && hostRef?.$rmListeners$) {
|
|
4515
|
+
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
4516
|
+
hostRef.$rmListeners$ = void 0;
|
|
4517
|
+
addHostEventListeners(el, hostRef, cmpMeta.$listeners$);
|
|
4518
|
+
}
|
|
4519
|
+
if (!isShadow && hostRef) attachStyles(hostRef);
|
|
4520
|
+
forceUpdate(el);
|
|
4521
|
+
});
|
|
4522
|
+
};
|
|
4387
4523
|
//#endregion
|
|
4388
4524
|
//#region src/runtime/bootstrap-standalone.ts
|
|
4389
4525
|
const defineCustomElement = (Cstr, compactMeta) => {
|
|
@@ -4406,9 +4542,12 @@ const proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
4406
4542
|
cmpMeta.$serializers$ = Cstr.$serializers$;
|
|
4407
4543
|
}
|
|
4408
4544
|
if (BUILD$1.reflect) cmpMeta.$attrsToReflect$ = [];
|
|
4409
|
-
if (BUILD$1.hotModuleReplacement)
|
|
4410
|
-
|
|
4411
|
-
|
|
4545
|
+
if (BUILD$1.hotModuleReplacement) {
|
|
4546
|
+
Cstr.prototype["s-hmr"] = function(hmrVersionId) {
|
|
4547
|
+
hmrStart(this, cmpMeta, hmrVersionId);
|
|
4548
|
+
};
|
|
4549
|
+
Cstr["s-hmr-apply"] = (NewClass) => hmrApplyClass(cmpMeta, NewClass);
|
|
4550
|
+
}
|
|
4412
4551
|
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && (BUILD$1.slotCloneNode || BUILD$1.patchClone && cmpMeta.$flags$ & CMP_FLAGS.patchClone)) patchCloneNode(Cstr.prototype);
|
|
4413
4552
|
if (!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation) && cmpMeta.$flags$ & CMP_FLAGS.hasSlot) {
|
|
4414
4553
|
if (BUILD$1.lightDomPatches || BUILD$1.patchAll && cmpMeta.$flags$ & CMP_FLAGS.patchAll) applyLightDomPatches(Cstr.prototype);
|
|
@@ -4447,7 +4586,7 @@ const proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
4447
4586
|
}
|
|
4448
4587
|
connectedCallback(this);
|
|
4449
4588
|
if (BUILD$1.asyncLoading && hostRef && hostRef.$ancestorComponent$) {
|
|
4450
|
-
await awaitAncestorConnected(hostRef.$ancestorComponent
|
|
4589
|
+
await awaitAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(this));
|
|
4451
4590
|
if (!this.isConnected) return;
|
|
4452
4591
|
}
|
|
4453
4592
|
if (originalConnectedCallback && (plt.$flags$ & PLATFORM_FLAGS.isTmpDisconnected) === 0) originalConnectedCallback.call(this);
|
|
@@ -4759,31 +4898,12 @@ function Mixin(...mixins) {
|
|
|
4759
4898
|
//#region src/runtime/nonce.ts
|
|
4760
4899
|
/**
|
|
4761
4900
|
* Assigns the given value to the nonce property on the runtime platform object.
|
|
4762
|
-
* During runtime, this value is used to set the nonce attribute on all dynamically created
|
|
4901
|
+
* During runtime, this value is used to set the nonce attribute on all dynamically created style tags.
|
|
4763
4902
|
* @param nonce The value to be assigned to the platform nonce property.
|
|
4764
4903
|
* @returns void
|
|
4765
4904
|
*/
|
|
4766
4905
|
const setNonce = (nonce) => plt.$nonce$ = nonce;
|
|
4767
4906
|
//#endregion
|
|
4768
|
-
//#region src/runtime/tag-transform.ts
|
|
4769
|
-
let tagTransformer = void 0;
|
|
4770
|
-
/**
|
|
4771
|
-
* Transforms a tag name using the current tag transformer
|
|
4772
|
-
* @param tag - the tag to transform e.g. `my-tag`
|
|
4773
|
-
* @returns the transformed tag e.g. `new-my-tag`
|
|
4774
|
-
*/
|
|
4775
|
-
function transformTag(tag) {
|
|
4776
|
-
if (!tagTransformer) return tag;
|
|
4777
|
-
return tagTransformer(tag);
|
|
4778
|
-
}
|
|
4779
|
-
/**
|
|
4780
|
-
* Sets the tag transformer to be used when rendering custom elements
|
|
4781
|
-
* @param transformer the transformer function to use. Must return a string
|
|
4782
|
-
*/
|
|
4783
|
-
function setTagTransformer(transformer) {
|
|
4784
|
-
tagTransformer = transformer;
|
|
4785
|
-
}
|
|
4786
|
-
//#endregion
|
|
4787
4907
|
//#region src/runtime/vdom/jsx-runtime.ts
|
|
4788
4908
|
function jsx(type, props, key) {
|
|
4789
4909
|
const { children, ...rest } = props ?? {};
|
|
@@ -4998,7 +5118,7 @@ function proxyHostElement(elm, cstr) {
|
|
|
4998
5118
|
const [[methodName]] = Object.entries(deserializer);
|
|
4999
5119
|
attrPropVal = cstr.prototype[methodName](attrValue, memberName);
|
|
5000
5120
|
}
|
|
5001
|
-
else attrPropVal = parsePropertyValue(attrValue, memberFlags
|
|
5121
|
+
else attrPropVal = parsePropertyValue(attrValue, memberFlags);
|
|
5002
5122
|
}
|
|
5003
5123
|
if (propValue !== void 0) {
|
|
5004
5124
|
attrPropVal = propValue;
|
|
@@ -5065,8 +5185,9 @@ function forceUpdate$1() {}
|
|
|
5065
5185
|
* @param results The results object to store the hydration results.
|
|
5066
5186
|
* @param afterSsr The callback to be called after SSR is complete.
|
|
5067
5187
|
* @param resolve The resolve function to be called when SSR is complete.
|
|
5188
|
+
* @param abortController The AbortController to use for aborting in-flight fetch() calls and other cancellable work when SSR times out.
|
|
5068
5189
|
*/
|
|
5069
|
-
function ssrApp(win, opts, results, afterSsr, resolve) {
|
|
5190
|
+
function ssrApp(win, opts, results, afterSsr, resolve, abortController) {
|
|
5070
5191
|
const connectedElements = /* @__PURE__ */ new Set();
|
|
5071
5192
|
const createdElements = /* @__PURE__ */ new Set();
|
|
5072
5193
|
const waitingElements = /* @__PURE__ */ new Set();
|
|
@@ -5076,10 +5197,20 @@ function ssrApp(win, opts, results, afterSsr, resolve) {
|
|
|
5076
5197
|
setScopedSsr(opts);
|
|
5077
5198
|
let tmrId;
|
|
5078
5199
|
let ranCompleted = false;
|
|
5200
|
+
let modeResolverSnapshot;
|
|
5201
|
+
const abortedPromise = new Promise((res) => {
|
|
5202
|
+
if (abortController.signal.aborted) res();
|
|
5203
|
+
else abortController.signal.addEventListener("abort", () => res(), { once: true });
|
|
5204
|
+
});
|
|
5079
5205
|
function hydratedComplete() {
|
|
5080
5206
|
$nativeClearTimeout(tmrId);
|
|
5081
5207
|
createdElements.clear();
|
|
5082
5208
|
connectedElements.clear();
|
|
5209
|
+
if (modeResolverSnapshot) {
|
|
5210
|
+
modeResolver.length = 0;
|
|
5211
|
+
modeResolver.push(...modeResolverSnapshot);
|
|
5212
|
+
modeResolverSnapshot = void 0;
|
|
5213
|
+
}
|
|
5083
5214
|
if (!ranCompleted) {
|
|
5084
5215
|
ranCompleted = true;
|
|
5085
5216
|
try {
|
|
@@ -5095,6 +5226,7 @@ function ssrApp(win, opts, results, afterSsr, resolve) {
|
|
|
5095
5226
|
}
|
|
5096
5227
|
function hydratedError(err) {
|
|
5097
5228
|
renderCatchError(opts, results, err);
|
|
5229
|
+
abortController.abort();
|
|
5098
5230
|
hydratedComplete();
|
|
5099
5231
|
}
|
|
5100
5232
|
function timeoutExceeded() {
|
|
@@ -5139,7 +5271,7 @@ function ssrApp(win, opts, results, afterSsr, resolve) {
|
|
|
5139
5271
|
if (isValidComponent(elm, opts) && results.hydratedCount < opts.maxHydrateCount) {
|
|
5140
5272
|
if (!connectedElements.has(elm) && shouldHydrate(elm)) {
|
|
5141
5273
|
connectedElements.add(elm);
|
|
5142
|
-
return hydrateComponent.call(elm, win, results, elm.nodeName, elm, waitingElements);
|
|
5274
|
+
return hydrateComponent.call(elm, win, results, elm.nodeName, elm, waitingElements, abortedPromise);
|
|
5143
5275
|
}
|
|
5144
5276
|
}
|
|
5145
5277
|
return resolved;
|
|
@@ -5162,13 +5294,17 @@ function ssrApp(win, opts, results, afterSsr, resolve) {
|
|
|
5162
5294
|
tmrId = $nativeSetTimeout(timeoutExceeded, opts.timeout);
|
|
5163
5295
|
plt.$resourcesUrl$ = new URL(opts.resourcesUrl || "./", win.document.baseURI).href;
|
|
5164
5296
|
globalScripts();
|
|
5297
|
+
if (Array.isArray(opts.modes)) {
|
|
5298
|
+
modeResolverSnapshot = modeResolver.slice();
|
|
5299
|
+
opts.modes.forEach((mode) => setMode(mode));
|
|
5300
|
+
}
|
|
5165
5301
|
patchChild(win.document.body);
|
|
5166
5302
|
waitLoop().then(hydratedComplete).catch(hydratedError);
|
|
5167
5303
|
} catch (e) {
|
|
5168
5304
|
hydratedError(e);
|
|
5169
5305
|
}
|
|
5170
5306
|
}
|
|
5171
|
-
async function hydrateComponent(win, results, tagName, elm, waitingElements) {
|
|
5307
|
+
async function hydrateComponent(win, results, tagName, elm, waitingElements, aborted) {
|
|
5172
5308
|
tagName = tagName.toLowerCase();
|
|
5173
5309
|
const Cstr = loadModule({
|
|
5174
5310
|
$tagName$: tagName,
|
|
@@ -5183,16 +5319,17 @@ async function hydrateComponent(win, results, tagName, elm, waitingElements) {
|
|
|
5183
5319
|
addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
|
|
5184
5320
|
try {
|
|
5185
5321
|
connectedCallback(elm);
|
|
5186
|
-
await elm.componentOnReady()
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5322
|
+
if (!await Promise.race([elm.componentOnReady().then(() => false), aborted.then(() => true)])) {
|
|
5323
|
+
results.hydratedCount++;
|
|
5324
|
+
const ref = getHostRef(elm);
|
|
5325
|
+
const modeName = !ref?.$modeName$ ? "$" : ref?.$modeName$;
|
|
5326
|
+
if (!results.components.some((c) => c.tag === tagName && c.mode === modeName)) results.components.push({
|
|
5327
|
+
tag: tagName,
|
|
5328
|
+
mode: modeName,
|
|
5329
|
+
count: 0,
|
|
5330
|
+
depth: -1
|
|
5331
|
+
});
|
|
5332
|
+
}
|
|
5196
5333
|
} catch (e) {
|
|
5197
5334
|
win.console.error(e);
|
|
5198
5335
|
}
|
|
@@ -5338,7 +5475,7 @@ const isMemberInElement = (elm, memberName) => {
|
|
|
5338
5475
|
const registerComponents = (Cstrs) => {
|
|
5339
5476
|
for (const Cstr of Cstrs) {
|
|
5340
5477
|
const exportName = Cstr.cmpMeta.$tagName$;
|
|
5341
|
-
const transformedTagName =
|
|
5478
|
+
const transformedTagName = transformTag(exportName);
|
|
5342
5479
|
cmpModules.set(exportName, { [exportName]: Cstr });
|
|
5343
5480
|
if (transformedTagName !== exportName) cmpModules.set(transformedTagName, { [transformedTagName]: Cstr });
|
|
5344
5481
|
}
|
|
@@ -5414,14 +5551,9 @@ const registerHost = (elm, cmpMeta) => {
|
|
|
5414
5551
|
elm.__s_ghr = () => hostRef;
|
|
5415
5552
|
return hostRef;
|
|
5416
5553
|
};
|
|
5417
|
-
const Build = {
|
|
5418
|
-
isDev: false,
|
|
5419
|
-
isBrowser: false,
|
|
5420
|
-
isServer: true,
|
|
5421
|
-
isTesting: false
|
|
5422
|
-
};
|
|
5554
|
+
const Build = { ...SERVER_BUILD_FLAGS };
|
|
5423
5555
|
const styles = /* @__PURE__ */ new Map();
|
|
5424
|
-
const
|
|
5556
|
+
const modeResolver = [];
|
|
5425
5557
|
/**
|
|
5426
5558
|
* Server-side implementation of getAssetPath.
|
|
5427
5559
|
*
|
|
@@ -5453,4 +5585,4 @@ const setScopedSsr = (opts) => {
|
|
|
5453
5585
|
const needsScopedSSR = () => scopedSSR;
|
|
5454
5586
|
let scopedSSR = false;
|
|
5455
5587
|
//#endregion
|
|
5456
|
-
export { BUILD, Build, Env, Fragment, Host, Mixin, NAMESPACE, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRenderingRef, getShadowRoot, getValue, hAsync as h, injectSideEffectStyle, insertVdomAnnotations, isMemberInElement, jsx, jsxs, loadModule,
|
|
5588
|
+
export { BUILD, Build, Env, Fragment, Host, Mixin, NAMESPACE, addHostEventListeners, bootstrapLazy, cmpModules, connectedCallback, consoleDevError, consoleDevInfo, consoleDevWarn, consoleError, createEvent, defineCustomElement, disconnectedCallback, forceModeUpdate, forceUpdate, getAssetPath, getElement, getHostRef, getMode, getRenderingRef, getShadowRoot, getValue, hAsync as h, injectSideEffectStyle, insertVdomAnnotations, isMemberInElement, jsx, jsxs, loadModule, modeResolver, needsScopedSSR, nextTick, parsePropertyValue, plt, postUpdateComponent, proxyComponent, proxyCustomElement, readTask, registerComponents, registerHost, registerInstance, registerSideEffectStyleTarget, renderVdom, setAssetPath, setErrorHandler, setMode, setNonce, setPlatformHelpers, setScopedSsr, setTagTransformer, setValue, ssrApp, styles, supportsConstructableStylesheets, supportsListenerOptions, supportsMutableAdoptedStyleSheets, transformTag, unregisterSideEffectStyleTarget, win, writeTask };
|