@stencil/core 4.18.0 → 4.18.1-dev.1715749302.3cfbb8d
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/cli/index.cjs +106 -215
- package/cli/index.js +107 -217
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +1686 -2826
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +117 -227
- package/internal/app-data/index.cjs +1 -0
- package/internal/app-data/index.js +1 -0
- package/internal/app-data/package.json +1 -1
- package/internal/client/index.js +58 -36
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/client/shadow-css.js +1 -2
- package/internal/hydrate/index.js +58 -36
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.js +52 -89
- package/internal/package.json +1 -1
- package/internal/stencil-public-compiler.d.ts +12 -1
- package/internal/stencil-public-runtime.d.ts +3 -8
- package/internal/testing/index.js +57 -35
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +378 -493
- package/mock-doc/index.d.ts +1 -1
- package/mock-doc/index.js +378 -493
- package/mock-doc/package.json +1 -1
- package/package.json +5 -6
- package/screenshot/index.js +43 -85
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +14 -27
- package/sys/node/glob.js +1 -1
- package/sys/node/index.js +42 -42
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +168 -270
- package/testing/jest/jest-27-and-under/jest-facade.d.ts +1 -1
- package/testing/jest/jest-28/jest-facade.d.ts +5 -5
- package/testing/jest/jest-29/jest-facade.d.ts +5 -5
- package/testing/package.json +1 -1
|
@@ -927,7 +927,7 @@ var checkSlotFallbackVisibility = false;
|
|
|
927
927
|
var checkSlotRelocate = false;
|
|
928
928
|
var isSvgMode = false;
|
|
929
929
|
var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
930
|
-
var _a
|
|
930
|
+
var _a;
|
|
931
931
|
const newVNode2 = newParentVNode.$children$[childIndex];
|
|
932
932
|
let i2 = 0;
|
|
933
933
|
let elm;
|
|
@@ -979,13 +979,6 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
979
979
|
if ((import_app_data10.BUILD.shadowDom || import_app_data10.BUILD.scoped) && isDef(scopeId) && elm["s-si"] !== scopeId) {
|
|
980
980
|
elm.classList.add(elm["s-si"] = scopeId);
|
|
981
981
|
}
|
|
982
|
-
if (import_app_data10.BUILD.scoped) {
|
|
983
|
-
const rootScopeId = ((_a = newParentVNode.$elm$) == null ? void 0 : _a["s-rsc"]) || ((_b = newParentVNode.$elm$) == null ? void 0 : _b["s-si"]) || ((_c = newParentVNode.$elm$) == null ? void 0 : _c["s-sc"]);
|
|
984
|
-
if (rootScopeId) {
|
|
985
|
-
elm["s-rsc"] = rootScopeId;
|
|
986
|
-
!elm.classList.contains(rootScopeId) && elm.classList.add(rootScopeId);
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
982
|
if (newVNode2.$children$) {
|
|
990
983
|
for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
|
|
991
984
|
childNode = createElm(oldParentVNode, newVNode2, i2, elm);
|
|
@@ -1008,7 +1001,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
1008
1001
|
elm["s-sr"] = true;
|
|
1009
1002
|
elm["s-cr"] = contentRef;
|
|
1010
1003
|
elm["s-sn"] = newVNode2.$name$ || "";
|
|
1011
|
-
elm["s-rf"] = (
|
|
1004
|
+
elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
|
|
1012
1005
|
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
1013
1006
|
if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
|
|
1014
1007
|
if (import_app_data10.BUILD.experimentalSlotFixes) {
|
|
@@ -1029,7 +1022,7 @@ var relocateToHostRoot = (parentElm) => {
|
|
|
1029
1022
|
const childNodeArray = Array.from(parentElm.childNodes);
|
|
1030
1023
|
for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
|
|
1031
1024
|
if (childNode["s-sh"] != null) {
|
|
1032
|
-
|
|
1025
|
+
insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
|
|
1033
1026
|
childNode["s-sh"] = void 0;
|
|
1034
1027
|
checkSlotRelocate = true;
|
|
1035
1028
|
}
|
|
@@ -1051,7 +1044,7 @@ var putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
1051
1044
|
for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
|
|
1052
1045
|
const childNode = oldSlotChildNodes[i2];
|
|
1053
1046
|
if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
|
|
1054
|
-
parentReferenceNode(childNode)
|
|
1047
|
+
insertBefore(parentReferenceNode(childNode), childNode, referenceNode(childNode));
|
|
1055
1048
|
childNode["s-ol"].remove();
|
|
1056
1049
|
childNode["s-ol"] = void 0;
|
|
1057
1050
|
childNode["s-sh"] = void 0;
|
|
@@ -1074,7 +1067,7 @@ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
|
1074
1067
|
childNode = createElm(null, parentVNode, startIdx, parentElm);
|
|
1075
1068
|
if (childNode) {
|
|
1076
1069
|
vnodes[startIdx].$elm$ = childNode;
|
|
1077
|
-
|
|
1070
|
+
insertBefore(containerElm, childNode, import_app_data10.BUILD.slotRelocation ? referenceNode(before) : before);
|
|
1078
1071
|
}
|
|
1079
1072
|
}
|
|
1080
1073
|
}
|
|
@@ -1134,7 +1127,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
1134
1127
|
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
1135
1128
|
}
|
|
1136
1129
|
patch(oldStartVnode, newEndVnode, isInitialRender);
|
|
1137
|
-
|
|
1130
|
+
insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
1138
1131
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
1139
1132
|
newEndVnode = newCh[--newEndIdx];
|
|
1140
1133
|
} else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
|
|
@@ -1142,7 +1135,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
1142
1135
|
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
1143
1136
|
}
|
|
1144
1137
|
patch(oldEndVnode, newStartVnode, isInitialRender);
|
|
1145
|
-
|
|
1138
|
+
insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
1146
1139
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
1147
1140
|
newStartVnode = newCh[++newStartIdx];
|
|
1148
1141
|
} else {
|
|
@@ -1171,9 +1164,9 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
1171
1164
|
}
|
|
1172
1165
|
if (node) {
|
|
1173
1166
|
if (import_app_data10.BUILD.slotRelocation) {
|
|
1174
|
-
parentReferenceNode(oldStartVnode.$elm$)
|
|
1167
|
+
insertBefore(parentReferenceNode(oldStartVnode.$elm$), node, referenceNode(oldStartVnode.$elm$));
|
|
1175
1168
|
} else {
|
|
1176
|
-
oldStartVnode.$elm$.parentNode
|
|
1169
|
+
insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
|
|
1177
1170
|
}
|
|
1178
1171
|
}
|
|
1179
1172
|
}
|
|
@@ -1344,6 +1337,28 @@ var nullifyVNodeRefs = (vNode) => {
|
|
|
1344
1337
|
vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
|
|
1345
1338
|
}
|
|
1346
1339
|
};
|
|
1340
|
+
var insertBefore = (parent, newNode, reference) => {
|
|
1341
|
+
const inserted = parent == null ? void 0 : parent.insertBefore(newNode, reference);
|
|
1342
|
+
if (import_app_data10.BUILD.scoped) {
|
|
1343
|
+
setParentScopeIdAsClassName(newNode, parent);
|
|
1344
|
+
}
|
|
1345
|
+
return inserted;
|
|
1346
|
+
};
|
|
1347
|
+
var findParentScopeId = (element) => {
|
|
1348
|
+
return element ? element["s-rsc"] || element["s-si"] || element["s-sc"] || findParentScopeId(element.parentElement) : void 0;
|
|
1349
|
+
};
|
|
1350
|
+
var setParentScopeIdAsClassName = (element, parent) => {
|
|
1351
|
+
var _a, _b, _c;
|
|
1352
|
+
if (element && parent) {
|
|
1353
|
+
const oldRootScopeId = element["s-rsc"];
|
|
1354
|
+
const newRootScopeId = findParentScopeId(parent);
|
|
1355
|
+
oldRootScopeId && ((_a = element.classList) == null ? void 0 : _a.contains(oldRootScopeId)) && element.classList.remove(oldRootScopeId);
|
|
1356
|
+
if (newRootScopeId) {
|
|
1357
|
+
element["s-rsc"] = newRootScopeId;
|
|
1358
|
+
!((_b = element.classList) == null ? void 0 : _b.contains(newRootScopeId)) && ((_c = element.classList) == null ? void 0 : _c.add(newRootScopeId));
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
};
|
|
1347
1362
|
var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
1348
1363
|
var _a, _b, _c, _d, _e;
|
|
1349
1364
|
const hostElm = hostRef.$hostElement$;
|
|
@@ -1400,7 +1415,7 @@ render() {
|
|
|
1400
1415
|
if (!nodeToRelocate["s-ol"]) {
|
|
1401
1416
|
const orgLocationNode = import_app_data10.BUILD.isDebug || import_app_data10.BUILD.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode("");
|
|
1402
1417
|
orgLocationNode["s-nr"] = nodeToRelocate;
|
|
1403
|
-
nodeToRelocate.parentNode
|
|
1418
|
+
insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
|
|
1404
1419
|
}
|
|
1405
1420
|
}
|
|
1406
1421
|
for (const relocateData of relocateNodes) {
|
|
@@ -1431,7 +1446,7 @@ render() {
|
|
|
1431
1446
|
if (!import_app_data10.BUILD.experimentalSlotFixes && !nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
|
|
1432
1447
|
nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
|
|
1433
1448
|
}
|
|
1434
|
-
|
|
1449
|
+
insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
|
|
1435
1450
|
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
1436
1451
|
nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false;
|
|
1437
1452
|
}
|
|
@@ -1495,6 +1510,11 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
1495
1510
|
const elm = hostRef.$hostElement$;
|
|
1496
1511
|
const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
|
|
1497
1512
|
const instance = import_app_data11.BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
1513
|
+
if (!instance) {
|
|
1514
|
+
throw new Error(
|
|
1515
|
+
`Can't render component <${elm.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`
|
|
1516
|
+
);
|
|
1517
|
+
}
|
|
1498
1518
|
let maybePromise;
|
|
1499
1519
|
if (isInitialLoad) {
|
|
1500
1520
|
if (import_app_data11.BUILD.lazyLoad && import_app_data11.BUILD.hostListener) {
|
|
@@ -1743,6 +1763,11 @@ var serverSideConnected = (elm) => {
|
|
|
1743
1763
|
var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
1744
1764
|
var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
1745
1765
|
const hostRef = getHostRef(ref);
|
|
1766
|
+
if (import_app_data12.BUILD.lazyLoad && !hostRef) {
|
|
1767
|
+
throw new Error(
|
|
1768
|
+
`Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`
|
|
1769
|
+
);
|
|
1770
|
+
}
|
|
1746
1771
|
const elm = import_app_data12.BUILD.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
1747
1772
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
1748
1773
|
const flags = hostRef.$flags$;
|
|
@@ -2065,7 +2090,7 @@ var setContentReference = (elm) => {
|
|
|
2065
2090
|
import_app_data15.BUILD.isDebug ? `content-ref (host=${elm.localName})` : ""
|
|
2066
2091
|
);
|
|
2067
2092
|
contentRefElm["s-cn"] = true;
|
|
2068
|
-
|
|
2093
|
+
insertBefore(elm, contentRefElm, elm.firstChild);
|
|
2069
2094
|
};
|
|
2070
2095
|
|
|
2071
2096
|
// src/runtime/disconnected-callback.ts
|
|
@@ -2134,7 +2159,8 @@ var patchCloneNode = (HostElementPrototype) => {
|
|
|
2134
2159
|
"s-ol",
|
|
2135
2160
|
"s-nr",
|
|
2136
2161
|
"s-si",
|
|
2137
|
-
"s-rf"
|
|
2162
|
+
"s-rf",
|
|
2163
|
+
"s-rsc"
|
|
2138
2164
|
];
|
|
2139
2165
|
for (; i2 < srcNode.childNodes.length; i2++) {
|
|
2140
2166
|
slotted = srcNode.childNodes[i2]["s-nr"];
|
|
@@ -2162,7 +2188,7 @@ var patchSlotAppendChild = (HostElementPrototype) => {
|
|
|
2162
2188
|
if (slotNode) {
|
|
2163
2189
|
const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
|
|
2164
2190
|
const appendAfter = slotChildNodes[slotChildNodes.length - 1];
|
|
2165
|
-
const insertedNode = appendAfter.parentNode
|
|
2191
|
+
const insertedNode = insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
|
|
2166
2192
|
updateFallbackSlotVisibility(this);
|
|
2167
2193
|
return insertedNode;
|
|
2168
2194
|
}
|
|
@@ -2203,7 +2229,7 @@ var patchSlotPrepend = (HostElementPrototype) => {
|
|
|
2203
2229
|
newChild["s-ol"] = slotPlaceholder;
|
|
2204
2230
|
const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
|
|
2205
2231
|
const appendAfter = slotChildNodes[0];
|
|
2206
|
-
return appendAfter.parentNode
|
|
2232
|
+
return insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
|
|
2207
2233
|
}
|
|
2208
2234
|
if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
|
|
2209
2235
|
newChild.hidden = true;
|
|
@@ -2301,7 +2327,7 @@ var patchTextContent = (hostElementPrototype) => {
|
|
|
2301
2327
|
if (node["s-sn"] === "") {
|
|
2302
2328
|
const textNode = this.ownerDocument.createTextNode(value);
|
|
2303
2329
|
textNode["s-sn"] = "";
|
|
2304
|
-
node.parentElement
|
|
2330
|
+
insertBefore(node.parentElement, textNode, node.nextSibling);
|
|
2305
2331
|
} else {
|
|
2306
2332
|
node.remove();
|
|
2307
2333
|
}
|
|
@@ -2332,7 +2358,7 @@ var patchTextContent = (hostElementPrototype) => {
|
|
|
2332
2358
|
this.__textContent = value;
|
|
2333
2359
|
const contentRefElm = this["s-cr"];
|
|
2334
2360
|
if (contentRefElm) {
|
|
2335
|
-
|
|
2361
|
+
insertBefore(this, contentRefElm, this.firstChild);
|
|
2336
2362
|
}
|
|
2337
2363
|
}
|
|
2338
2364
|
}
|
|
@@ -2726,14 +2752,10 @@ var hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
2726
2752
|
}
|
|
2727
2753
|
};
|
|
2728
2754
|
var getHostListenerTarget = (elm, flags) => {
|
|
2729
|
-
if (import_app_data20.BUILD.hostListenerTargetDocument && flags & 4 /* TargetDocument */)
|
|
2730
|
-
|
|
2731
|
-
if (import_app_data20.BUILD.
|
|
2732
|
-
|
|
2733
|
-
if (import_app_data20.BUILD.hostListenerTargetBody && flags & 16 /* TargetBody */)
|
|
2734
|
-
return doc.body;
|
|
2735
|
-
if (import_app_data20.BUILD.hostListenerTargetParent && flags & 32 /* TargetParent */)
|
|
2736
|
-
return elm.parentElement;
|
|
2755
|
+
if (import_app_data20.BUILD.hostListenerTargetDocument && flags & 4 /* TargetDocument */) return doc;
|
|
2756
|
+
if (import_app_data20.BUILD.hostListenerTargetWindow && flags & 8 /* TargetWindow */) return win;
|
|
2757
|
+
if (import_app_data20.BUILD.hostListenerTargetBody && flags & 16 /* TargetBody */) return doc.body;
|
|
2758
|
+
if (import_app_data20.BUILD.hostListenerTargetParent && flags & 32 /* TargetParent */) return elm.parentElement;
|
|
2737
2759
|
return elm;
|
|
2738
2760
|
};
|
|
2739
2761
|
var hostListenerOpts = (flags) => supportsListenerOptions ? {
|
|
@@ -2758,7 +2780,7 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
|
|
|
2758
2780
|
const orgLocationNodes = [];
|
|
2759
2781
|
parseVNodeAnnotations(doc2, doc2.body, docData, orgLocationNodes);
|
|
2760
2782
|
orgLocationNodes.forEach((orgLocationNode) => {
|
|
2761
|
-
var _a
|
|
2783
|
+
var _a;
|
|
2762
2784
|
if (orgLocationNode != null && orgLocationNode["s-nr"]) {
|
|
2763
2785
|
const nodeRef = orgLocationNode["s-nr"];
|
|
2764
2786
|
let hostId = nodeRef["s-host-id"];
|
|
@@ -2781,7 +2803,7 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
|
|
|
2781
2803
|
}
|
|
2782
2804
|
const commentBeforeTextNode = doc2.createComment(childId);
|
|
2783
2805
|
commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
|
|
2784
|
-
(
|
|
2806
|
+
insertBefore(nodeRef.parentNode, commentBeforeTextNode, nodeRef);
|
|
2785
2807
|
}
|
|
2786
2808
|
}
|
|
2787
2809
|
let orgLocationNodeId = `${ORG_LOCATION_ID}.${childId}`;
|
|
@@ -2866,7 +2888,7 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
|
|
|
2866
2888
|
if (nodeName !== "STYLE" && nodeName !== "SCRIPT") {
|
|
2867
2889
|
const textNodeId = `${TEXT_NODE_ID}.${childId}`;
|
|
2868
2890
|
const commentBeforeTextNode = doc2.createComment(textNodeId);
|
|
2869
|
-
parentNode
|
|
2891
|
+
insertBefore(parentNode, commentBeforeTextNode, childElm);
|
|
2870
2892
|
}
|
|
2871
2893
|
} else if (childElm.nodeType === 8 /* CommentNode */) {
|
|
2872
2894
|
if (childElm["s-sr"]) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/core/internal/testing",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.1-dev.1715749302.3cfbb8d",
|
|
4
4
|
"description": "Stencil internal testing platform to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"private": true
|