@stencil/core 4.32.0 → 4.33.0
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 +1 -1
- package/cli/index.js +1 -1
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +21 -9
- 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 +2 -2
- package/internal/app-data/package.json +1 -1
- package/internal/app-globals/index.d.ts +2 -0
- package/internal/app-globals/index.js +14 -0
- package/internal/app-globals/package.json +14 -0
- package/internal/client/index.js +285 -286
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/hydrate/index.js +284 -293
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.js +53 -32
- package/internal/package.json +1 -1
- package/internal/stencil-private.d.ts +4 -1
- package/internal/stencil-public-runtime.d.ts +1 -1
- package/internal/testing/index.js +294 -288
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +28 -10
- package/mock-doc/index.d.ts +5 -4
- package/mock-doc/index.js +28 -10
- package/mock-doc/package.json +1 -1
- package/package.json +5 -1
- package/screenshot/index.js +1 -1
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +1 -1
- package/sys/node/index.js +21 -21
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +27 -24
- package/testing/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Stencil Hydrate Platform v4.
|
|
2
|
+
Stencil Hydrate Platform v4.33.0 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
@@ -73,7 +73,7 @@ var getAssetPath = (path) => {
|
|
|
73
73
|
var setAssetPath = (path) => plt.$resourcesUrl$ = path;
|
|
74
74
|
|
|
75
75
|
// src/runtime/bootstrap-custom-element.ts
|
|
76
|
-
import { BUILD as
|
|
76
|
+
import { BUILD as BUILD21 } from "@stencil/core/internal/app-data";
|
|
77
77
|
|
|
78
78
|
// src/utils/helpers.ts
|
|
79
79
|
var isDef = (v) => v != null && v !== void 0;
|
|
@@ -245,6 +245,19 @@ function deserializeProperty(value) {
|
|
|
245
245
|
return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
+
// src/utils/shadow-root.ts
|
|
249
|
+
import { BUILD as BUILD2 } from "@stencil/core/internal/app-data";
|
|
250
|
+
import { globalStyles } from "@stencil/core/internal/app-globals";
|
|
251
|
+
function createShadowRoot(cmpMeta) {
|
|
252
|
+
const shadowRoot = BUILD2.shadowDelegatesFocus ? this.attachShadow({
|
|
253
|
+
mode: "open",
|
|
254
|
+
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
|
|
255
|
+
}) : this.attachShadow({ mode: "open" });
|
|
256
|
+
const sheet = new CSSStyleSheet();
|
|
257
|
+
sheet.replaceSync(globalStyles);
|
|
258
|
+
shadowRoot.adoptedStyleSheets.push(sheet);
|
|
259
|
+
}
|
|
260
|
+
|
|
248
261
|
// src/utils/util.ts
|
|
249
262
|
var lowerPathParam = (fn) => (p) => fn(p.toLowerCase());
|
|
250
263
|
var isDtsFile = lowerPathParam((p) => p.endsWith(".d.ts") || p.endsWith(".d.mts") || p.endsWith(".d.cts"));
|
|
@@ -260,16 +273,16 @@ var isJsxFile = lowerPathParam(
|
|
|
260
273
|
var isJsFile = lowerPathParam((p) => p.endsWith(".js") || p.endsWith(".mjs") || p.endsWith(".cjs"));
|
|
261
274
|
|
|
262
275
|
// src/runtime/connected-callback.ts
|
|
263
|
-
import { BUILD as
|
|
276
|
+
import { BUILD as BUILD19 } from "@stencil/core/internal/app-data";
|
|
264
277
|
|
|
265
278
|
// src/runtime/client-hydrate.ts
|
|
266
|
-
import { BUILD as
|
|
279
|
+
import { BUILD as BUILD7 } from "@stencil/core/internal/app-data";
|
|
267
280
|
|
|
268
281
|
// src/runtime/dom-extras.ts
|
|
269
|
-
import { BUILD as
|
|
282
|
+
import { BUILD as BUILD4 } from "@stencil/core/internal/app-data";
|
|
270
283
|
|
|
271
284
|
// src/runtime/slot-polyfill-utils.ts
|
|
272
|
-
import { BUILD as
|
|
285
|
+
import { BUILD as BUILD3 } from "@stencil/core/internal/app-data";
|
|
273
286
|
|
|
274
287
|
// src/runtime/runtime-constants.ts
|
|
275
288
|
var CONTENT_REF_ID = "r";
|
|
@@ -375,7 +388,7 @@ var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
|
|
|
375
388
|
if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
|
|
376
389
|
const parent = slotNode["s-cr"].parentNode;
|
|
377
390
|
const appendMethod = prepend ? internalCall(parent, "prepend") : internalCall(parent, "appendChild");
|
|
378
|
-
if (
|
|
391
|
+
if (BUILD3.hydrateClientSide && typeof position !== "undefined") {
|
|
379
392
|
slottedNodeLocation["s-oo"] = position;
|
|
380
393
|
const childNodes = internalCall(parent, "childNodes");
|
|
381
394
|
const slotRelocateNodes = [slottedNodeLocation];
|
|
@@ -453,9 +466,9 @@ var patchCloneNode = (HostElementPrototype) => {
|
|
|
453
466
|
const orgCloneNode = HostElementPrototype.cloneNode;
|
|
454
467
|
HostElementPrototype.cloneNode = function(deep) {
|
|
455
468
|
const srcNode = this;
|
|
456
|
-
const isShadowDom =
|
|
469
|
+
const isShadowDom = BUILD4.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
|
|
457
470
|
const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
|
|
458
|
-
if (
|
|
471
|
+
if (BUILD4.slot && !isShadowDom && deep) {
|
|
459
472
|
let i2 = 0;
|
|
460
473
|
let slotted, nonStencilNode;
|
|
461
474
|
const stencilPrivates = [
|
|
@@ -480,7 +493,7 @@ var patchCloneNode = (HostElementPrototype) => {
|
|
|
480
493
|
slotted = childNodes[i2]["s-nr"];
|
|
481
494
|
nonStencilNode = stencilPrivates.every((privateField) => !childNodes[i2][privateField]);
|
|
482
495
|
if (slotted) {
|
|
483
|
-
if (
|
|
496
|
+
if (BUILD4.appendChildSlotFix && clonedNode.__appendChild) {
|
|
484
497
|
clonedNode.__appendChild(slotted.cloneNode(true));
|
|
485
498
|
} else {
|
|
486
499
|
clonedNode.appendChild(slotted.cloneNode(true));
|
|
@@ -812,10 +825,10 @@ function internalCall(node, method) {
|
|
|
812
825
|
}
|
|
813
826
|
|
|
814
827
|
// src/runtime/profile.ts
|
|
815
|
-
import { BUILD as
|
|
828
|
+
import { BUILD as BUILD5 } from "@stencil/core/internal/app-data";
|
|
816
829
|
var i = 0;
|
|
817
830
|
var createTime = (fnName, tagName = "") => {
|
|
818
|
-
if (
|
|
831
|
+
if (BUILD5.profile && performance.mark) {
|
|
819
832
|
const key = `st:${fnName}:${tagName}:${i++}`;
|
|
820
833
|
performance.mark(key);
|
|
821
834
|
return () => performance.measure(`[Stencil] ${fnName}() <${tagName}>`, key);
|
|
@@ -826,7 +839,7 @@ var createTime = (fnName, tagName = "") => {
|
|
|
826
839
|
}
|
|
827
840
|
};
|
|
828
841
|
var uniqueTime = (key, measureText) => {
|
|
829
|
-
if (
|
|
842
|
+
if (BUILD5.profile && performance.mark) {
|
|
830
843
|
if (performance.getEntriesByName(key, "mark").length === 0) {
|
|
831
844
|
performance.mark(key);
|
|
832
845
|
}
|
|
@@ -884,7 +897,7 @@ var inspect = (ref) => {
|
|
|
884
897
|
};
|
|
885
898
|
};
|
|
886
899
|
var installDevTools = () => {
|
|
887
|
-
if (
|
|
900
|
+
if (BUILD5.devTools) {
|
|
888
901
|
const stencil = win.stencil = win.stencil || {};
|
|
889
902
|
const originalInspect = stencil.inspect;
|
|
890
903
|
stencil.inspect = (ref) => {
|
|
@@ -898,7 +911,7 @@ var installDevTools = () => {
|
|
|
898
911
|
};
|
|
899
912
|
|
|
900
913
|
// src/runtime/vdom/h.ts
|
|
901
|
-
import { BUILD as
|
|
914
|
+
import { BUILD as BUILD6 } from "@stencil/core/internal/app-data";
|
|
902
915
|
var h = (nodeName, vnodeData, ...children) => {
|
|
903
916
|
let child = null;
|
|
904
917
|
let key = null;
|
|
@@ -914,7 +927,7 @@ var h = (nodeName, vnodeData, ...children) => {
|
|
|
914
927
|
} else if (child != null && typeof child !== "boolean") {
|
|
915
928
|
if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
|
|
916
929
|
child = String(child);
|
|
917
|
-
} else if (
|
|
930
|
+
} else if (BUILD6.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
|
|
918
931
|
consoleDevError(`vNode passed as children has unexpected type.
|
|
919
932
|
Make sure it's using the correct h() function.
|
|
920
933
|
Empty objects can also be the cause, look for JSX comments that became objects.`);
|
|
@@ -930,28 +943,28 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
|
|
|
930
943
|
};
|
|
931
944
|
walk(children);
|
|
932
945
|
if (vnodeData) {
|
|
933
|
-
if (
|
|
946
|
+
if (BUILD6.isDev && nodeName === "input") {
|
|
934
947
|
validateInputProperties(vnodeData);
|
|
935
948
|
}
|
|
936
|
-
if (
|
|
949
|
+
if (BUILD6.vdomKey && vnodeData.key) {
|
|
937
950
|
key = vnodeData.key;
|
|
938
951
|
}
|
|
939
|
-
if (
|
|
952
|
+
if (BUILD6.slotRelocation && vnodeData.name) {
|
|
940
953
|
slotName = vnodeData.name;
|
|
941
954
|
}
|
|
942
|
-
if (
|
|
955
|
+
if (BUILD6.vdomClass) {
|
|
943
956
|
const classData = vnodeData.className || vnodeData.class;
|
|
944
957
|
if (classData) {
|
|
945
958
|
vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
|
|
946
959
|
}
|
|
947
960
|
}
|
|
948
961
|
}
|
|
949
|
-
if (
|
|
962
|
+
if (BUILD6.isDev && vNodeChildren.some(isHost)) {
|
|
950
963
|
consoleDevError(`The <Host> must be the single root component. Make sure:
|
|
951
964
|
- You are NOT using hostData() and <Host> in the same component.
|
|
952
965
|
- <Host> is used once, and it's the single root component of the render() function.`);
|
|
953
966
|
}
|
|
954
|
-
if (
|
|
967
|
+
if (BUILD6.vdomFunctional && typeof nodeName === "function") {
|
|
955
968
|
return nodeName(
|
|
956
969
|
vnodeData === null ? {} : vnodeData,
|
|
957
970
|
vNodeChildren,
|
|
@@ -963,10 +976,10 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
|
|
|
963
976
|
if (vNodeChildren.length > 0) {
|
|
964
977
|
vnode.$children$ = vNodeChildren;
|
|
965
978
|
}
|
|
966
|
-
if (
|
|
979
|
+
if (BUILD6.vdomKey) {
|
|
967
980
|
vnode.$key$ = key;
|
|
968
981
|
}
|
|
969
|
-
if (
|
|
982
|
+
if (BUILD6.slotRelocation) {
|
|
970
983
|
vnode.$name$ = slotName;
|
|
971
984
|
}
|
|
972
985
|
return vnode;
|
|
@@ -979,13 +992,13 @@ var newVNode = (tag, text) => {
|
|
|
979
992
|
$elm$: null,
|
|
980
993
|
$children$: null
|
|
981
994
|
};
|
|
982
|
-
if (
|
|
995
|
+
if (BUILD6.vdomAttribute) {
|
|
983
996
|
vnode.$attrs$ = null;
|
|
984
997
|
}
|
|
985
|
-
if (
|
|
998
|
+
if (BUILD6.vdomKey) {
|
|
986
999
|
vnode.$key$ = null;
|
|
987
1000
|
}
|
|
988
|
-
if (
|
|
1001
|
+
if (BUILD6.slotRelocation) {
|
|
989
1002
|
vnode.$name$ = null;
|
|
990
1003
|
}
|
|
991
1004
|
return vnode;
|
|
@@ -1045,7 +1058,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1045
1058
|
const childRenderNodes = [];
|
|
1046
1059
|
const slotNodes = [];
|
|
1047
1060
|
const slottedNodes = [];
|
|
1048
|
-
const shadowRootNodes =
|
|
1061
|
+
const shadowRootNodes = BUILD7.shadowDom && shadowRoot ? [] : null;
|
|
1049
1062
|
const vnode = newVNode(tagName, null);
|
|
1050
1063
|
vnode.$elm$ = hostElm;
|
|
1051
1064
|
const members = Object.entries(((_a = hostRef.$cmpMeta$) == null ? void 0 : _a.$members$) || {});
|
|
@@ -1062,7 +1075,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1062
1075
|
}
|
|
1063
1076
|
});
|
|
1064
1077
|
let scopeId2;
|
|
1065
|
-
if (
|
|
1078
|
+
if (BUILD7.scoped) {
|
|
1066
1079
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
1067
1080
|
if (cmpMeta && cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */ && hostElm["s-sc"]) {
|
|
1068
1081
|
scopeId2 = hostElm["s-sc"];
|
|
@@ -1151,7 +1164,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1151
1164
|
slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
|
|
1152
1165
|
}
|
|
1153
1166
|
addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
|
|
1154
|
-
if (
|
|
1167
|
+
if (BUILD7.experimentalSlotFixes) {
|
|
1155
1168
|
patchSlottedNode(slottedItem.node);
|
|
1156
1169
|
}
|
|
1157
1170
|
}
|
|
@@ -1160,12 +1173,12 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1160
1173
|
}
|
|
1161
1174
|
}
|
|
1162
1175
|
}
|
|
1163
|
-
if (
|
|
1176
|
+
if (BUILD7.scoped && scopeId2 && slotNodes.length) {
|
|
1164
1177
|
slotNodes.forEach((slot) => {
|
|
1165
1178
|
slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
|
|
1166
1179
|
});
|
|
1167
1180
|
}
|
|
1168
|
-
if (
|
|
1181
|
+
if (BUILD7.shadowDom && shadowRoot && !shadowRoot.childNodes.length) {
|
|
1169
1182
|
let rnIdex = 0;
|
|
1170
1183
|
const rnLen = shadowRootNodes.length;
|
|
1171
1184
|
if (rnLen) {
|
|
@@ -1215,7 +1228,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
1215
1228
|
if (!parentVNode.$children$) {
|
|
1216
1229
|
parentVNode.$children$ = [];
|
|
1217
1230
|
}
|
|
1218
|
-
if (
|
|
1231
|
+
if (BUILD7.scoped && scopeId2) {
|
|
1219
1232
|
node["s-si"] = scopeId2;
|
|
1220
1233
|
childVNode.$attrs$.class += " " + scopeId2;
|
|
1221
1234
|
}
|
|
@@ -1233,7 +1246,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
1233
1246
|
shadowRootNodes,
|
|
1234
1247
|
slottedNodes
|
|
1235
1248
|
);
|
|
1236
|
-
if (
|
|
1249
|
+
if (BUILD7.scoped && scopeId2) {
|
|
1237
1250
|
node.classList.add(scopeId2);
|
|
1238
1251
|
}
|
|
1239
1252
|
}
|
|
@@ -1330,9 +1343,9 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
1330
1343
|
slottedNodes
|
|
1331
1344
|
);
|
|
1332
1345
|
} else if (childNodeType === CONTENT_REF_ID) {
|
|
1333
|
-
if (
|
|
1346
|
+
if (BUILD7.shadowDom && shadowRootNodes) {
|
|
1334
1347
|
node.remove();
|
|
1335
|
-
} else if (
|
|
1348
|
+
} else if (BUILD7.slotRelocation) {
|
|
1336
1349
|
hostElm["s-cr"] = node;
|
|
1337
1350
|
node["s-cn"] = true;
|
|
1338
1351
|
}
|
|
@@ -1398,7 +1411,7 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
|
|
|
1398
1411
|
childVNode.$name$ = slotName || null;
|
|
1399
1412
|
childVNode.$tag$ = "slot";
|
|
1400
1413
|
const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
|
|
1401
|
-
if (
|
|
1414
|
+
if (BUILD7.shadowDom && shadowRootNodes && win.document) {
|
|
1402
1415
|
const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$);
|
|
1403
1416
|
if (childVNode.$name$) {
|
|
1404
1417
|
childVNode.$elm$.setAttribute("name", slotName);
|
|
@@ -1447,7 +1460,7 @@ var findCorrespondingNode = (node, type) => {
|
|
|
1447
1460
|
};
|
|
1448
1461
|
|
|
1449
1462
|
// src/runtime/initialize-component.ts
|
|
1450
|
-
import { BUILD as
|
|
1463
|
+
import { BUILD as BUILD18 } from "@stencil/core/internal/app-data";
|
|
1451
1464
|
|
|
1452
1465
|
// src/utils/shadow-css.ts
|
|
1453
1466
|
/**
|
|
@@ -1822,33 +1835,33 @@ var setMode = (handler) => modeResolutionChain.push(handler);
|
|
|
1822
1835
|
var getMode = (ref) => getHostRef(ref).$modeName$;
|
|
1823
1836
|
|
|
1824
1837
|
// src/runtime/proxy-component.ts
|
|
1825
|
-
import { BUILD as
|
|
1838
|
+
import { BUILD as BUILD17 } from "@stencil/core/internal/app-data";
|
|
1826
1839
|
|
|
1827
1840
|
// src/runtime/set-value.ts
|
|
1828
|
-
import { BUILD as
|
|
1841
|
+
import { BUILD as BUILD16 } from "@stencil/core/internal/app-data";
|
|
1829
1842
|
|
|
1830
1843
|
// src/runtime/parse-property-value.ts
|
|
1831
|
-
import { BUILD as
|
|
1844
|
+
import { BUILD as BUILD8 } from "@stencil/core/internal/app-data";
|
|
1832
1845
|
var parsePropertyValue = (propValue, propType) => {
|
|
1833
|
-
if ((
|
|
1846
|
+
if ((BUILD8.hydrateClientSide || BUILD8.hydrateServerSide) && typeof propValue === "string" && (propValue.startsWith("{") && propValue.endsWith("}") || propValue.startsWith("[") && propValue.endsWith("]"))) {
|
|
1834
1847
|
try {
|
|
1835
1848
|
propValue = JSON.parse(propValue);
|
|
1836
1849
|
return propValue;
|
|
1837
1850
|
} catch (e) {
|
|
1838
1851
|
}
|
|
1839
1852
|
}
|
|
1840
|
-
if ((
|
|
1853
|
+
if ((BUILD8.hydrateClientSide || BUILD8.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
|
|
1841
1854
|
propValue = deserializeProperty(propValue);
|
|
1842
1855
|
return propValue;
|
|
1843
1856
|
}
|
|
1844
1857
|
if (propValue != null && !isComplexType(propValue)) {
|
|
1845
|
-
if (
|
|
1858
|
+
if (BUILD8.propBoolean && propType & 4 /* Boolean */) {
|
|
1846
1859
|
return propValue === "false" ? false : propValue === "" || !!propValue;
|
|
1847
1860
|
}
|
|
1848
|
-
if (
|
|
1861
|
+
if (BUILD8.propNumber && propType & 2 /* Number */) {
|
|
1849
1862
|
return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
|
|
1850
1863
|
}
|
|
1851
|
-
if (
|
|
1864
|
+
if (BUILD8.propString && propType & 1 /* String */) {
|
|
1852
1865
|
return String(propValue);
|
|
1853
1866
|
}
|
|
1854
1867
|
return propValue;
|
|
@@ -1857,21 +1870,21 @@ var parsePropertyValue = (propValue, propType) => {
|
|
|
1857
1870
|
};
|
|
1858
1871
|
|
|
1859
1872
|
// src/runtime/update-component.ts
|
|
1860
|
-
import { BUILD as
|
|
1873
|
+
import { BUILD as BUILD15, NAMESPACE } from "@stencil/core/internal/app-data";
|
|
1861
1874
|
|
|
1862
1875
|
// src/runtime/event-emitter.ts
|
|
1863
|
-
import { BUILD as
|
|
1876
|
+
import { BUILD as BUILD10 } from "@stencil/core/internal/app-data";
|
|
1864
1877
|
|
|
1865
1878
|
// src/runtime/element.ts
|
|
1866
|
-
import { BUILD as
|
|
1867
|
-
var getElement = (ref) =>
|
|
1879
|
+
import { BUILD as BUILD9 } from "@stencil/core/internal/app-data";
|
|
1880
|
+
var getElement = (ref) => BUILD9.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
|
|
1868
1881
|
|
|
1869
1882
|
// src/runtime/event-emitter.ts
|
|
1870
1883
|
var createEvent = (ref, name, flags) => {
|
|
1871
1884
|
const elm = getElement(ref);
|
|
1872
1885
|
return {
|
|
1873
1886
|
emit: (detail) => {
|
|
1874
|
-
if (
|
|
1887
|
+
if (BUILD10.isDev && !elm.isConnected) {
|
|
1875
1888
|
consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
|
|
1876
1889
|
}
|
|
1877
1890
|
return emitEvent(elm, name, {
|
|
@@ -1890,7 +1903,7 @@ var emitEvent = (elm, name, opts) => {
|
|
|
1890
1903
|
};
|
|
1891
1904
|
|
|
1892
1905
|
// src/runtime/styles.ts
|
|
1893
|
-
import { BUILD as
|
|
1906
|
+
import { BUILD as BUILD11 } from "@stencil/core/internal/app-data";
|
|
1894
1907
|
var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
|
|
1895
1908
|
var registerStyle = (scopeId2, cssText, allowCS) => {
|
|
1896
1909
|
let style = styles.get(scopeId2);
|
|
@@ -1910,7 +1923,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1910
1923
|
var _a;
|
|
1911
1924
|
const scopeId2 = getScopeId(cmpMeta, mode);
|
|
1912
1925
|
const style = styles.get(scopeId2);
|
|
1913
|
-
if (!
|
|
1926
|
+
if (!BUILD11.attachStyles || !win.document) {
|
|
1914
1927
|
return scopeId2;
|
|
1915
1928
|
}
|
|
1916
1929
|
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
|
|
@@ -1923,7 +1936,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1923
1936
|
rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
|
|
1924
1937
|
}
|
|
1925
1938
|
if (!appliedStyles.has(scopeId2)) {
|
|
1926
|
-
if (
|
|
1939
|
+
if (BUILD11.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
|
|
1927
1940
|
styleElm.innerHTML = style;
|
|
1928
1941
|
} else {
|
|
1929
1942
|
styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || win.document.createElement("style");
|
|
@@ -1932,7 +1945,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1932
1945
|
if (nonce != null) {
|
|
1933
1946
|
styleElm.setAttribute("nonce", nonce);
|
|
1934
1947
|
}
|
|
1935
|
-
if ((
|
|
1948
|
+
if ((BUILD11.hydrateServerSide || BUILD11.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) {
|
|
1936
1949
|
styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
|
|
1937
1950
|
}
|
|
1938
1951
|
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
|
|
@@ -1971,7 +1984,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1971
1984
|
appliedStyles.add(scopeId2);
|
|
1972
1985
|
}
|
|
1973
1986
|
}
|
|
1974
|
-
} else if (
|
|
1987
|
+
} else if (BUILD11.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
1975
1988
|
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
1976
1989
|
}
|
|
1977
1990
|
}
|
|
@@ -1983,17 +1996,17 @@ var attachStyles = (hostRef) => {
|
|
|
1983
1996
|
const flags = cmpMeta.$flags$;
|
|
1984
1997
|
const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
|
|
1985
1998
|
const scopeId2 = addStyle(
|
|
1986
|
-
|
|
1999
|
+
BUILD11.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
|
|
1987
2000
|
cmpMeta,
|
|
1988
2001
|
hostRef.$modeName$
|
|
1989
2002
|
);
|
|
1990
|
-
if ((
|
|
2003
|
+
if ((BUILD11.shadowDom || BUILD11.scoped) && BUILD11.cssAnnotations && flags & 10 /* needsScopedEncapsulation */) {
|
|
1991
2004
|
elm["s-sc"] = scopeId2;
|
|
1992
2005
|
elm.classList.add(scopeId2 + "-h");
|
|
1993
2006
|
}
|
|
1994
2007
|
endAttachStyles();
|
|
1995
2008
|
};
|
|
1996
|
-
var getScopeId = (cmp, mode) => "sc-" + (
|
|
2009
|
+
var getScopeId = (cmp, mode) => "sc-" + (BUILD11.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
|
|
1997
2010
|
var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
|
|
1998
2011
|
var hydrateScopedToShadow = () => {
|
|
1999
2012
|
if (!win.document) {
|
|
@@ -2007,24 +2020,24 @@ var hydrateScopedToShadow = () => {
|
|
|
2007
2020
|
};
|
|
2008
2021
|
|
|
2009
2022
|
// src/runtime/vdom/vdom-render.ts
|
|
2010
|
-
import { BUILD as
|
|
2023
|
+
import { BUILD as BUILD14 } from "@stencil/core/internal/app-data";
|
|
2011
2024
|
|
|
2012
2025
|
// src/runtime/vdom/update-element.ts
|
|
2013
|
-
import { BUILD as
|
|
2026
|
+
import { BUILD as BUILD13 } from "@stencil/core/internal/app-data";
|
|
2014
2027
|
|
|
2015
2028
|
// src/runtime/vdom/set-accessor.ts
|
|
2016
|
-
import { BUILD as
|
|
2029
|
+
import { BUILD as BUILD12 } from "@stencil/core/internal/app-data";
|
|
2017
2030
|
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
|
|
2018
2031
|
if (oldValue === newValue) {
|
|
2019
2032
|
return;
|
|
2020
2033
|
}
|
|
2021
2034
|
let isProp = isMemberInElement(elm, memberName);
|
|
2022
2035
|
let ln = memberName.toLowerCase();
|
|
2023
|
-
if (
|
|
2036
|
+
if (BUILD12.vdomClass && memberName === "class") {
|
|
2024
2037
|
const classList = elm.classList;
|
|
2025
2038
|
const oldClasses = parseClassList(oldValue);
|
|
2026
2039
|
let newClasses = parseClassList(newValue);
|
|
2027
|
-
if (
|
|
2040
|
+
if (BUILD12.hydrateClientSide && elm["s-si"] && initialRender) {
|
|
2028
2041
|
newClasses.push(elm["s-si"]);
|
|
2029
2042
|
oldClasses.forEach((c) => {
|
|
2030
2043
|
if (c.startsWith(elm["s-si"])) newClasses.push(c);
|
|
@@ -2035,11 +2048,11 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
|
|
|
2035
2048
|
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
2036
2049
|
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
2037
2050
|
}
|
|
2038
|
-
} else if (
|
|
2039
|
-
if (
|
|
2051
|
+
} else if (BUILD12.vdomStyle && memberName === "style") {
|
|
2052
|
+
if (BUILD12.updatable) {
|
|
2040
2053
|
for (const prop in oldValue) {
|
|
2041
2054
|
if (!newValue || newValue[prop] == null) {
|
|
2042
|
-
if (!
|
|
2055
|
+
if (!BUILD12.hydrateServerSide && prop.includes("-")) {
|
|
2043
2056
|
elm.style.removeProperty(prop);
|
|
2044
2057
|
} else {
|
|
2045
2058
|
elm.style[prop] = "";
|
|
@@ -2049,19 +2062,19 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
|
|
|
2049
2062
|
}
|
|
2050
2063
|
for (const prop in newValue) {
|
|
2051
2064
|
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
2052
|
-
if (!
|
|
2065
|
+
if (!BUILD12.hydrateServerSide && prop.includes("-")) {
|
|
2053
2066
|
elm.style.setProperty(prop, newValue[prop]);
|
|
2054
2067
|
} else {
|
|
2055
2068
|
elm.style[prop] = newValue[prop];
|
|
2056
2069
|
}
|
|
2057
2070
|
}
|
|
2058
2071
|
}
|
|
2059
|
-
} else if (
|
|
2060
|
-
} else if (
|
|
2072
|
+
} else if (BUILD12.vdomKey && memberName === "key") {
|
|
2073
|
+
} else if (BUILD12.vdomRef && memberName === "ref") {
|
|
2061
2074
|
if (newValue) {
|
|
2062
2075
|
newValue(elm);
|
|
2063
2076
|
}
|
|
2064
|
-
} else if (
|
|
2077
|
+
} else if (BUILD12.vdomListener && (BUILD12.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
|
|
2065
2078
|
if (memberName[2] === "-") {
|
|
2066
2079
|
memberName = memberName.slice(3);
|
|
2067
2080
|
} else if (isMemberInElement(win, ln)) {
|
|
@@ -2079,7 +2092,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
|
|
|
2079
2092
|
plt.ael(elm, memberName, newValue, capture);
|
|
2080
2093
|
}
|
|
2081
2094
|
}
|
|
2082
|
-
} else if (
|
|
2095
|
+
} else if (BUILD12.vdomPropOrAttr) {
|
|
2083
2096
|
const isComplex = isComplexType(newValue);
|
|
2084
2097
|
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
|
2085
2098
|
try {
|
|
@@ -2101,7 +2114,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
|
|
|
2101
2114
|
}
|
|
2102
2115
|
}
|
|
2103
2116
|
let xlink = false;
|
|
2104
|
-
if (
|
|
2117
|
+
if (BUILD12.vdomXlink) {
|
|
2105
2118
|
if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
|
|
2106
2119
|
memberName = ln;
|
|
2107
2120
|
xlink = true;
|
|
@@ -2109,7 +2122,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
|
|
|
2109
2122
|
}
|
|
2110
2123
|
if (newValue == null || newValue === false) {
|
|
2111
2124
|
if (newValue !== false || elm.getAttribute(memberName) === "") {
|
|
2112
|
-
if (
|
|
2125
|
+
if (BUILD12.vdomXlink && xlink) {
|
|
2113
2126
|
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
2114
2127
|
} else {
|
|
2115
2128
|
elm.removeAttribute(memberName);
|
|
@@ -2117,7 +2130,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
|
|
|
2117
2130
|
}
|
|
2118
2131
|
} else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
|
|
2119
2132
|
newValue = newValue === true ? "" : newValue;
|
|
2120
|
-
if (
|
|
2133
|
+
if (BUILD12.vdomXlink && xlink) {
|
|
2121
2134
|
elm.setAttributeNS(XLINK_NS, memberName, newValue);
|
|
2122
2135
|
} else {
|
|
2123
2136
|
elm.setAttribute(memberName, newValue);
|
|
@@ -2143,7 +2156,7 @@ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
|
|
|
2143
2156
|
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
|
|
2144
2157
|
const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
|
|
2145
2158
|
const newVnodeAttrs = newVnode.$attrs$ || {};
|
|
2146
|
-
if (
|
|
2159
|
+
if (BUILD13.updatable) {
|
|
2147
2160
|
for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
|
|
2148
2161
|
if (!(memberName in newVnodeAttrs)) {
|
|
2149
2162
|
setAccessor(
|
|
@@ -2195,7 +2208,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2195
2208
|
let elm;
|
|
2196
2209
|
let childNode;
|
|
2197
2210
|
let oldVNode;
|
|
2198
|
-
if (
|
|
2211
|
+
if (BUILD14.slotRelocation && !useNativeShadowDom) {
|
|
2199
2212
|
checkSlotRelocate = true;
|
|
2200
2213
|
if (newVNode2.$tag$ === "slot") {
|
|
2201
2214
|
newVNode2.$flags$ |= newVNode2.$children$ ? (
|
|
@@ -2210,20 +2223,20 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2210
2223
|
);
|
|
2211
2224
|
}
|
|
2212
2225
|
}
|
|
2213
|
-
if (
|
|
2226
|
+
if (BUILD14.isDev && newVNode2.$elm$) {
|
|
2214
2227
|
consoleDevError(
|
|
2215
2228
|
`The JSX ${newVNode2.$text$ !== null ? `"${newVNode2.$text$}" text` : `"${newVNode2.$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`
|
|
2216
2229
|
);
|
|
2217
2230
|
}
|
|
2218
|
-
if (
|
|
2231
|
+
if (BUILD14.vdomText && newVNode2.$text$ !== null) {
|
|
2219
2232
|
elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
|
|
2220
|
-
} else if (
|
|
2221
|
-
elm = newVNode2.$elm$ =
|
|
2222
|
-
if (
|
|
2233
|
+
} else if (BUILD14.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
|
|
2234
|
+
elm = newVNode2.$elm$ = BUILD14.isDebug || BUILD14.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : win.document.createTextNode("");
|
|
2235
|
+
if (BUILD14.vdomAttribute) {
|
|
2223
2236
|
updateElement(null, newVNode2, isSvgMode);
|
|
2224
2237
|
}
|
|
2225
2238
|
} else {
|
|
2226
|
-
if (
|
|
2239
|
+
if (BUILD14.svg && !isSvgMode) {
|
|
2227
2240
|
isSvgMode = newVNode2.$tag$ === "svg";
|
|
2228
2241
|
}
|
|
2229
2242
|
if (!win.document) {
|
|
@@ -2231,19 +2244,19 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2231
2244
|
"You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component."
|
|
2232
2245
|
);
|
|
2233
2246
|
}
|
|
2234
|
-
elm = newVNode2.$elm$ =
|
|
2247
|
+
elm = newVNode2.$elm$ = BUILD14.svg ? win.document.createElementNS(
|
|
2235
2248
|
isSvgMode ? SVG_NS : HTML_NS,
|
|
2236
|
-
!useNativeShadowDom &&
|
|
2249
|
+
!useNativeShadowDom && BUILD14.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
2237
2250
|
) : win.document.createElement(
|
|
2238
|
-
!useNativeShadowDom &&
|
|
2251
|
+
!useNativeShadowDom && BUILD14.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
|
|
2239
2252
|
);
|
|
2240
|
-
if (
|
|
2253
|
+
if (BUILD14.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
|
|
2241
2254
|
isSvgMode = false;
|
|
2242
2255
|
}
|
|
2243
|
-
if (
|
|
2256
|
+
if (BUILD14.vdomAttribute) {
|
|
2244
2257
|
updateElement(null, newVNode2, isSvgMode);
|
|
2245
2258
|
}
|
|
2246
|
-
if ((
|
|
2259
|
+
if ((BUILD14.scoped || BUILD14.hydrateServerSide && 128 /* shadowNeedsScopedCss */) && isDef(scopeId) && elm["s-si"] !== scopeId) {
|
|
2247
2260
|
elm.classList.add(elm["s-si"] = scopeId);
|
|
2248
2261
|
}
|
|
2249
2262
|
if (newVNode2.$children$) {
|
|
@@ -2254,7 +2267,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2254
2267
|
}
|
|
2255
2268
|
}
|
|
2256
2269
|
}
|
|
2257
|
-
if (
|
|
2270
|
+
if (BUILD14.svg) {
|
|
2258
2271
|
if (newVNode2.$tag$ === "svg") {
|
|
2259
2272
|
isSvgMode = false;
|
|
2260
2273
|
} else if (elm.tagName === "foreignObject") {
|
|
@@ -2263,7 +2276,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2263
2276
|
}
|
|
2264
2277
|
}
|
|
2265
2278
|
elm["s-hn"] = hostTagName;
|
|
2266
|
-
if (
|
|
2279
|
+
if (BUILD14.slotRelocation) {
|
|
2267
2280
|
if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
|
|
2268
2281
|
elm["s-sr"] = true;
|
|
2269
2282
|
elm["s-cr"] = contentRef;
|
|
@@ -2272,13 +2285,13 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2272
2285
|
patchSlotNode(elm);
|
|
2273
2286
|
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
2274
2287
|
if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
|
|
2275
|
-
if (
|
|
2288
|
+
if (BUILD14.experimentalSlotFixes) {
|
|
2276
2289
|
relocateToHostRoot(oldParentVNode.$elm$);
|
|
2277
2290
|
} else {
|
|
2278
2291
|
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
|
2279
2292
|
}
|
|
2280
2293
|
}
|
|
2281
|
-
if (
|
|
2294
|
+
if (BUILD14.scoped || BUILD14.hydrateServerSide && 128 /* shadowNeedsScopedCss */) {
|
|
2282
2295
|
addRemoveSlotScopedClass(contentRef, elm, newParentVNode.$elm$, oldParentVNode == null ? void 0 : oldParentVNode.$elm$);
|
|
2283
2296
|
}
|
|
2284
2297
|
}
|
|
@@ -2308,7 +2321,7 @@ var relocateToHostRoot = (parentElm) => {
|
|
|
2308
2321
|
var putBackInOriginalLocation = (parentElm, recursive) => {
|
|
2309
2322
|
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
2310
2323
|
const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
|
|
2311
|
-
if (parentElm["s-sr"] &&
|
|
2324
|
+
if (parentElm["s-sr"] && BUILD14.experimentalSlotFixes) {
|
|
2312
2325
|
let node = parentElm;
|
|
2313
2326
|
while (node = node.nextSibling) {
|
|
2314
2327
|
if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
|
|
@@ -2332,9 +2345,9 @@ var putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
2332
2345
|
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
2333
2346
|
};
|
|
2334
2347
|
var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
2335
|
-
let containerElm =
|
|
2348
|
+
let containerElm = BUILD14.slotRelocation && parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
|
|
2336
2349
|
let childNode;
|
|
2337
|
-
if (
|
|
2350
|
+
if (BUILD14.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
2338
2351
|
containerElm = containerElm.shadowRoot;
|
|
2339
2352
|
}
|
|
2340
2353
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
@@ -2342,7 +2355,7 @@ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
|
2342
2355
|
childNode = createElm(null, parentVNode, startIdx);
|
|
2343
2356
|
if (childNode) {
|
|
2344
2357
|
vnodes[startIdx].$elm$ = childNode;
|
|
2345
|
-
insertBefore(containerElm, childNode,
|
|
2358
|
+
insertBefore(containerElm, childNode, BUILD14.slotRelocation ? referenceNode(before) : before);
|
|
2346
2359
|
}
|
|
2347
2360
|
}
|
|
2348
2361
|
}
|
|
@@ -2354,7 +2367,7 @@ var removeVnodes = (vnodes, startIdx, endIdx) => {
|
|
|
2354
2367
|
const elm = vnode.$elm$;
|
|
2355
2368
|
nullifyVNodeRefs(vnode);
|
|
2356
2369
|
if (elm) {
|
|
2357
|
-
if (
|
|
2370
|
+
if (BUILD14.slotRelocation) {
|
|
2358
2371
|
checkSlotFallbackVisibility = true;
|
|
2359
2372
|
if (elm["s-ol"]) {
|
|
2360
2373
|
elm["s-ol"].remove();
|
|
@@ -2398,7 +2411,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
2398
2411
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
2399
2412
|
newEndVnode = newCh[--newEndIdx];
|
|
2400
2413
|
} else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
|
|
2401
|
-
if (
|
|
2414
|
+
if (BUILD14.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
|
|
2402
2415
|
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
2403
2416
|
}
|
|
2404
2417
|
patch(oldStartVnode, newEndVnode, isInitialRender);
|
|
@@ -2406,7 +2419,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
2406
2419
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
2407
2420
|
newEndVnode = newCh[--newEndIdx];
|
|
2408
2421
|
} else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
|
|
2409
|
-
if (
|
|
2422
|
+
if (BUILD14.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
|
|
2410
2423
|
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
2411
2424
|
}
|
|
2412
2425
|
patch(oldEndVnode, newStartVnode, isInitialRender);
|
|
@@ -2415,7 +2428,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
2415
2428
|
newStartVnode = newCh[++newStartIdx];
|
|
2416
2429
|
} else {
|
|
2417
2430
|
idxInOld = -1;
|
|
2418
|
-
if (
|
|
2431
|
+
if (BUILD14.vdomKey) {
|
|
2419
2432
|
for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
|
|
2420
2433
|
if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
|
|
2421
2434
|
idxInOld = i2;
|
|
@@ -2423,7 +2436,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
2423
2436
|
}
|
|
2424
2437
|
}
|
|
2425
2438
|
}
|
|
2426
|
-
if (
|
|
2439
|
+
if (BUILD14.vdomKey && idxInOld >= 0) {
|
|
2427
2440
|
elmToMove = oldCh[idxInOld];
|
|
2428
2441
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
2429
2442
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
|
|
@@ -2438,7 +2451,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
2438
2451
|
newStartVnode = newCh[++newStartIdx];
|
|
2439
2452
|
}
|
|
2440
2453
|
if (node) {
|
|
2441
|
-
if (
|
|
2454
|
+
if (BUILD14.slotRelocation) {
|
|
2442
2455
|
insertBefore(
|
|
2443
2456
|
referenceNode(oldStartVnode.$elm$).parentNode,
|
|
2444
2457
|
node,
|
|
@@ -2459,16 +2472,16 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
2459
2472
|
newStartIdx,
|
|
2460
2473
|
newEndIdx
|
|
2461
2474
|
);
|
|
2462
|
-
} else if (
|
|
2475
|
+
} else if (BUILD14.updatable && newStartIdx > newEndIdx) {
|
|
2463
2476
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
2464
2477
|
}
|
|
2465
2478
|
};
|
|
2466
2479
|
var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
|
|
2467
2480
|
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
2468
|
-
if (
|
|
2481
|
+
if (BUILD14.slotRelocation && leftVNode.$tag$ === "slot") {
|
|
2469
2482
|
return leftVNode.$name$ === rightVNode.$name$;
|
|
2470
2483
|
}
|
|
2471
|
-
if (
|
|
2484
|
+
if (BUILD14.vdomKey && !isInitialRender) {
|
|
2472
2485
|
return leftVNode.$key$ === rightVNode.$key$;
|
|
2473
2486
|
}
|
|
2474
2487
|
if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
|
|
@@ -2486,38 +2499,38 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
2486
2499
|
const tag = newVNode2.$tag$;
|
|
2487
2500
|
const text = newVNode2.$text$;
|
|
2488
2501
|
let defaultHolder;
|
|
2489
|
-
if (!
|
|
2490
|
-
if (
|
|
2502
|
+
if (!BUILD14.vdomText || text === null) {
|
|
2503
|
+
if (BUILD14.svg) {
|
|
2491
2504
|
isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
|
|
2492
2505
|
}
|
|
2493
|
-
if (
|
|
2494
|
-
if (
|
|
2495
|
-
if (
|
|
2506
|
+
if (BUILD14.vdomAttribute || BUILD14.reflect) {
|
|
2507
|
+
if (BUILD14.slot && tag === "slot" && !useNativeShadowDom) {
|
|
2508
|
+
if (BUILD14.experimentalSlotFixes && oldVNode.$name$ !== newVNode2.$name$) {
|
|
2496
2509
|
newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
|
|
2497
2510
|
relocateToHostRoot(newVNode2.$elm$.parentElement);
|
|
2498
2511
|
}
|
|
2499
2512
|
}
|
|
2500
2513
|
updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
|
|
2501
2514
|
}
|
|
2502
|
-
if (
|
|
2515
|
+
if (BUILD14.updatable && oldChildren !== null && newChildren !== null) {
|
|
2503
2516
|
updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
|
|
2504
2517
|
} else if (newChildren !== null) {
|
|
2505
|
-
if (
|
|
2518
|
+
if (BUILD14.updatable && BUILD14.vdomText && oldVNode.$text$ !== null) {
|
|
2506
2519
|
elm.textContent = "";
|
|
2507
2520
|
}
|
|
2508
2521
|
addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
|
|
2509
2522
|
} else if (
|
|
2510
2523
|
// don't do this on initial render as it can cause non-hydrated content to be removed
|
|
2511
|
-
!isInitialRender &&
|
|
2524
|
+
!isInitialRender && BUILD14.updatable && oldChildren !== null
|
|
2512
2525
|
) {
|
|
2513
2526
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
2514
2527
|
}
|
|
2515
|
-
if (
|
|
2528
|
+
if (BUILD14.svg && isSvgMode && tag === "svg") {
|
|
2516
2529
|
isSvgMode = false;
|
|
2517
2530
|
}
|
|
2518
|
-
} else if (
|
|
2531
|
+
} else if (BUILD14.vdomText && BUILD14.slotRelocation && (defaultHolder = elm["s-cr"])) {
|
|
2519
2532
|
defaultHolder.parentNode.textContent = text;
|
|
2520
|
-
} else if (
|
|
2533
|
+
} else if (BUILD14.vdomText && oldVNode.$text$ !== text) {
|
|
2521
2534
|
elm.data = text;
|
|
2522
2535
|
}
|
|
2523
2536
|
};
|
|
@@ -2533,7 +2546,7 @@ var markSlotContentForRelocation = (elm) => {
|
|
|
2533
2546
|
const slotName = childNode["s-sn"];
|
|
2534
2547
|
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
2535
2548
|
node = hostContentNodes[j];
|
|
2536
|
-
if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!
|
|
2549
|
+
if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!BUILD14.experimentalSlotFixes || !node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
|
|
2537
2550
|
if (isNodeLocatedInSlot(node, slotName)) {
|
|
2538
2551
|
let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
2539
2552
|
checkSlotFallbackVisibility = true;
|
|
@@ -2572,15 +2585,15 @@ var markSlotContentForRelocation = (elm) => {
|
|
|
2572
2585
|
}
|
|
2573
2586
|
};
|
|
2574
2587
|
var nullifyVNodeRefs = (vNode) => {
|
|
2575
|
-
if (
|
|
2588
|
+
if (BUILD14.vdomRef) {
|
|
2576
2589
|
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
|
2577
2590
|
vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
|
|
2578
2591
|
}
|
|
2579
2592
|
};
|
|
2580
2593
|
var insertBefore = (parent, newNode, reference) => {
|
|
2581
|
-
if (
|
|
2594
|
+
if (BUILD14.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) {
|
|
2582
2595
|
addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
|
|
2583
|
-
} else if (
|
|
2596
|
+
} else if (BUILD14.experimentalSlotFixes && typeof newNode["s-sn"] === "string") {
|
|
2584
2597
|
if (parent.getRootNode().nodeType !== 11 /* DOCUMENT_FRAGMENT_NODE */) {
|
|
2585
2598
|
patchParentNode(newNode);
|
|
2586
2599
|
}
|
|
@@ -2589,7 +2602,7 @@ var insertBefore = (parent, newNode, reference) => {
|
|
|
2589
2602
|
if (slotNode) dispatchSlotChangeEvent(slotNode);
|
|
2590
2603
|
return newNode;
|
|
2591
2604
|
}
|
|
2592
|
-
if (
|
|
2605
|
+
if (BUILD14.experimentalSlotFixes && parent.__insertBefore) {
|
|
2593
2606
|
return parent.__insertBefore(newNode, reference);
|
|
2594
2607
|
} else {
|
|
2595
2608
|
return parent == null ? void 0 : parent.insertBefore(newNode, reference);
|
|
@@ -2624,7 +2637,7 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
2624
2637
|
const isHostElement = isHost(renderFnResults);
|
|
2625
2638
|
const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
|
|
2626
2639
|
hostTagName = hostElm.tagName;
|
|
2627
|
-
if (
|
|
2640
|
+
if (BUILD14.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
|
|
2628
2641
|
throw new Error(`The <Host> must be the single root component.
|
|
2629
2642
|
Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
|
|
2630
2643
|
|
|
@@ -2638,7 +2651,7 @@ render() {
|
|
|
2638
2651
|
}
|
|
2639
2652
|
`);
|
|
2640
2653
|
}
|
|
2641
|
-
if (
|
|
2654
|
+
if (BUILD14.reflect && cmpMeta.$attrsToReflect$) {
|
|
2642
2655
|
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
|
2643
2656
|
cmpMeta.$attrsToReflect$.map(
|
|
2644
2657
|
([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName]
|
|
@@ -2654,24 +2667,24 @@ render() {
|
|
|
2654
2667
|
rootVnode.$tag$ = null;
|
|
2655
2668
|
rootVnode.$flags$ |= 4 /* isHost */;
|
|
2656
2669
|
hostRef.$vnode$ = rootVnode;
|
|
2657
|
-
rootVnode.$elm$ = oldVNode.$elm$ =
|
|
2658
|
-
if (
|
|
2670
|
+
rootVnode.$elm$ = oldVNode.$elm$ = BUILD14.shadowDom ? hostElm.shadowRoot || hostElm : hostElm;
|
|
2671
|
+
if (BUILD14.scoped || BUILD14.shadowDom) {
|
|
2659
2672
|
scopeId = hostElm["s-sc"];
|
|
2660
2673
|
}
|
|
2661
2674
|
useNativeShadowDom = supportsShadow && !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */);
|
|
2662
|
-
if (
|
|
2675
|
+
if (BUILD14.slotRelocation) {
|
|
2663
2676
|
contentRef = hostElm["s-cr"];
|
|
2664
2677
|
checkSlotFallbackVisibility = false;
|
|
2665
2678
|
}
|
|
2666
2679
|
patch(oldVNode, rootVnode, isInitialLoad);
|
|
2667
|
-
if (
|
|
2680
|
+
if (BUILD14.slotRelocation) {
|
|
2668
2681
|
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
2669
2682
|
if (checkSlotRelocate) {
|
|
2670
2683
|
markSlotContentForRelocation(rootVnode.$elm$);
|
|
2671
2684
|
for (const relocateData of relocateNodes) {
|
|
2672
2685
|
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
2673
2686
|
if (!nodeToRelocate["s-ol"] && win.document) {
|
|
2674
|
-
const orgLocationNode =
|
|
2687
|
+
const orgLocationNode = BUILD14.isDebug || BUILD14.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : win.document.createTextNode("");
|
|
2675
2688
|
orgLocationNode["s-nr"] = nodeToRelocate;
|
|
2676
2689
|
insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
|
|
2677
2690
|
}
|
|
@@ -2682,7 +2695,7 @@ render() {
|
|
|
2682
2695
|
if (slotRefNode) {
|
|
2683
2696
|
const parentNodeRef = slotRefNode.parentNode;
|
|
2684
2697
|
let insertBeforeNode = slotRefNode.nextSibling;
|
|
2685
|
-
if (!
|
|
2698
|
+
if (!BUILD14.hydrateServerSide && (!BUILD14.experimentalSlotFixes || insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */)) {
|
|
2686
2699
|
let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling;
|
|
2687
2700
|
while (orgLocationNode) {
|
|
2688
2701
|
let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null;
|
|
@@ -2703,7 +2716,7 @@ render() {
|
|
|
2703
2716
|
const nextSibling = nodeToRelocate.__nextSibling || nodeToRelocate.nextSibling;
|
|
2704
2717
|
if (!insertBeforeNode && parentNodeRef !== parent || nextSibling !== insertBeforeNode) {
|
|
2705
2718
|
if (nodeToRelocate !== insertBeforeNode) {
|
|
2706
|
-
if (!
|
|
2719
|
+
if (!BUILD14.experimentalSlotFixes && !nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
|
|
2707
2720
|
nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
|
|
2708
2721
|
}
|
|
2709
2722
|
insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
|
|
@@ -2729,7 +2742,7 @@ render() {
|
|
|
2729
2742
|
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
2730
2743
|
relocateNodes.length = 0;
|
|
2731
2744
|
}
|
|
2732
|
-
if (
|
|
2745
|
+
if (BUILD14.experimentalScopedSlotChanges && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
2733
2746
|
const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
|
|
2734
2747
|
for (const childNode of children) {
|
|
2735
2748
|
if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
|
|
@@ -2757,7 +2770,7 @@ var originalLocationDebugNode = (nodeToRelocate) => {
|
|
|
2757
2770
|
|
|
2758
2771
|
// src/runtime/update-component.ts
|
|
2759
2772
|
var attachToAncestor = (hostRef, ancestorComponent) => {
|
|
2760
|
-
if (
|
|
2773
|
+
if (BUILD15.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
|
|
2761
2774
|
const index = ancestorComponent["s-p"].push(
|
|
2762
2775
|
new Promise(
|
|
2763
2776
|
(r) => hostRef.$onRenderResolve$ = () => {
|
|
@@ -2769,21 +2782,21 @@ var attachToAncestor = (hostRef, ancestorComponent) => {
|
|
|
2769
2782
|
}
|
|
2770
2783
|
};
|
|
2771
2784
|
var scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
2772
|
-
if (
|
|
2785
|
+
if (BUILD15.taskQueue && BUILD15.updatable) {
|
|
2773
2786
|
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
2774
2787
|
}
|
|
2775
|
-
if (
|
|
2788
|
+
if (BUILD15.asyncLoading && hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
2776
2789
|
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
2777
2790
|
return;
|
|
2778
2791
|
}
|
|
2779
2792
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
2780
2793
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
2781
|
-
return
|
|
2794
|
+
return BUILD15.taskQueue ? writeTask(dispatch) : dispatch();
|
|
2782
2795
|
};
|
|
2783
2796
|
var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
2784
2797
|
const elm = hostRef.$hostElement$;
|
|
2785
2798
|
const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
|
|
2786
|
-
const instance =
|
|
2799
|
+
const instance = BUILD15.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
2787
2800
|
if (!instance) {
|
|
2788
2801
|
throw new Error(
|
|
2789
2802
|
`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`
|
|
@@ -2791,7 +2804,7 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
2791
2804
|
}
|
|
2792
2805
|
let maybePromise;
|
|
2793
2806
|
if (isInitialLoad) {
|
|
2794
|
-
if (
|
|
2807
|
+
if (BUILD15.lazyLoad && BUILD15.hostListener) {
|
|
2795
2808
|
hostRef.$flags$ |= 256 /* isListenReady */;
|
|
2796
2809
|
if (hostRef.$queuedListeners$) {
|
|
2797
2810
|
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event, elm));
|
|
@@ -2819,23 +2832,23 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
2819
2832
|
const elm = hostRef.$hostElement$;
|
|
2820
2833
|
const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
|
|
2821
2834
|
const rc = elm["s-rc"];
|
|
2822
|
-
if (
|
|
2835
|
+
if (BUILD15.style && isInitialLoad) {
|
|
2823
2836
|
attachStyles(hostRef);
|
|
2824
2837
|
}
|
|
2825
2838
|
const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
|
|
2826
|
-
if (
|
|
2839
|
+
if (BUILD15.isDev) {
|
|
2827
2840
|
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
2828
2841
|
}
|
|
2829
|
-
if (
|
|
2842
|
+
if (BUILD15.hydrateServerSide) {
|
|
2830
2843
|
await callRender(hostRef, instance, elm, isInitialLoad);
|
|
2831
2844
|
} else {
|
|
2832
2845
|
callRender(hostRef, instance, elm, isInitialLoad);
|
|
2833
2846
|
}
|
|
2834
|
-
if (
|
|
2847
|
+
if (BUILD15.isDev) {
|
|
2835
2848
|
hostRef.$renderCount$ = hostRef.$renderCount$ === void 0 ? 1 : hostRef.$renderCount$ + 1;
|
|
2836
2849
|
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2837
2850
|
}
|
|
2838
|
-
if (
|
|
2851
|
+
if (BUILD15.hydrateServerSide) {
|
|
2839
2852
|
try {
|
|
2840
2853
|
serverSideConnected(elm);
|
|
2841
2854
|
if (isInitialLoad) {
|
|
@@ -2849,13 +2862,13 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
2849
2862
|
consoleError(e, elm);
|
|
2850
2863
|
}
|
|
2851
2864
|
}
|
|
2852
|
-
if (
|
|
2865
|
+
if (BUILD15.asyncLoading && rc) {
|
|
2853
2866
|
rc.map((cb) => cb());
|
|
2854
2867
|
elm["s-rc"] = void 0;
|
|
2855
2868
|
}
|
|
2856
2869
|
endRender();
|
|
2857
2870
|
endUpdate();
|
|
2858
|
-
if (
|
|
2871
|
+
if (BUILD15.asyncLoading) {
|
|
2859
2872
|
const childrenPromises = (_a = elm["s-p"]) != null ? _a : [];
|
|
2860
2873
|
const postUpdate = () => postUpdateComponent(hostRef);
|
|
2861
2874
|
if (childrenPromises.length === 0) {
|
|
@@ -2871,10 +2884,10 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
2871
2884
|
};
|
|
2872
2885
|
var renderingRef = null;
|
|
2873
2886
|
var callRender = (hostRef, instance, elm, isInitialLoad) => {
|
|
2874
|
-
const allRenderFn =
|
|
2875
|
-
const lazyLoad =
|
|
2876
|
-
const taskQueue =
|
|
2877
|
-
const updatable =
|
|
2887
|
+
const allRenderFn = BUILD15.allRenderFn ? true : false;
|
|
2888
|
+
const lazyLoad = BUILD15.lazyLoad ? true : false;
|
|
2889
|
+
const taskQueue = BUILD15.taskQueue ? true : false;
|
|
2890
|
+
const updatable = BUILD15.updatable ? true : false;
|
|
2878
2891
|
try {
|
|
2879
2892
|
renderingRef = instance;
|
|
2880
2893
|
instance = allRenderFn ? instance.render() : instance.render && instance.render();
|
|
@@ -2884,9 +2897,9 @@ var callRender = (hostRef, instance, elm, isInitialLoad) => {
|
|
|
2884
2897
|
if (updatable || lazyLoad) {
|
|
2885
2898
|
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
2886
2899
|
}
|
|
2887
|
-
if (
|
|
2888
|
-
if (
|
|
2889
|
-
if (
|
|
2900
|
+
if (BUILD15.hasRenderFn || BUILD15.reflect) {
|
|
2901
|
+
if (BUILD15.vdomRender || BUILD15.reflect) {
|
|
2902
|
+
if (BUILD15.hydrateServerSide) {
|
|
2890
2903
|
return Promise.resolve(instance).then((value) => renderVdom(hostRef, value, isInitialLoad));
|
|
2891
2904
|
} else {
|
|
2892
2905
|
renderVdom(hostRef, instance, isInitialLoad);
|
|
@@ -2911,51 +2924,51 @@ var postUpdateComponent = (hostRef) => {
|
|
|
2911
2924
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
2912
2925
|
const elm = hostRef.$hostElement$;
|
|
2913
2926
|
const endPostUpdate = createTime("postUpdate", tagName);
|
|
2914
|
-
const instance =
|
|
2927
|
+
const instance = BUILD15.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
2915
2928
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
2916
|
-
if (
|
|
2929
|
+
if (BUILD15.isDev) {
|
|
2917
2930
|
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
2918
2931
|
}
|
|
2919
2932
|
safeCall(instance, "componentDidRender", void 0, elm);
|
|
2920
|
-
if (
|
|
2933
|
+
if (BUILD15.isDev) {
|
|
2921
2934
|
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2922
2935
|
}
|
|
2923
2936
|
emitLifecycleEvent(elm, "componentDidRender");
|
|
2924
2937
|
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
2925
2938
|
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
2926
|
-
if (
|
|
2939
|
+
if (BUILD15.asyncLoading && BUILD15.cssAnnotations) {
|
|
2927
2940
|
addHydratedFlag(elm);
|
|
2928
2941
|
}
|
|
2929
|
-
if (
|
|
2942
|
+
if (BUILD15.isDev) {
|
|
2930
2943
|
hostRef.$flags$ |= 2048 /* devOnDidLoad */;
|
|
2931
2944
|
}
|
|
2932
2945
|
safeCall(instance, "componentDidLoad", void 0, elm);
|
|
2933
|
-
if (
|
|
2946
|
+
if (BUILD15.isDev) {
|
|
2934
2947
|
hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
|
|
2935
2948
|
}
|
|
2936
2949
|
emitLifecycleEvent(elm, "componentDidLoad");
|
|
2937
2950
|
endPostUpdate();
|
|
2938
|
-
if (
|
|
2951
|
+
if (BUILD15.asyncLoading) {
|
|
2939
2952
|
hostRef.$onReadyResolve$(elm);
|
|
2940
2953
|
if (!ancestorComponent) {
|
|
2941
2954
|
appDidLoad(tagName);
|
|
2942
2955
|
}
|
|
2943
2956
|
}
|
|
2944
2957
|
} else {
|
|
2945
|
-
if (
|
|
2958
|
+
if (BUILD15.isDev) {
|
|
2946
2959
|
hostRef.$flags$ |= 1024 /* devOnRender */;
|
|
2947
2960
|
}
|
|
2948
2961
|
safeCall(instance, "componentDidUpdate", void 0, elm);
|
|
2949
|
-
if (
|
|
2962
|
+
if (BUILD15.isDev) {
|
|
2950
2963
|
hostRef.$flags$ &= ~1024 /* devOnRender */;
|
|
2951
2964
|
}
|
|
2952
2965
|
emitLifecycleEvent(elm, "componentDidUpdate");
|
|
2953
2966
|
endPostUpdate();
|
|
2954
2967
|
}
|
|
2955
|
-
if (
|
|
2968
|
+
if (BUILD15.method && BUILD15.lazyLoad) {
|
|
2956
2969
|
hostRef.$onInstanceResolve$(elm);
|
|
2957
2970
|
}
|
|
2958
|
-
if (
|
|
2971
|
+
if (BUILD15.asyncLoading) {
|
|
2959
2972
|
if (hostRef.$onRenderResolve$) {
|
|
2960
2973
|
hostRef.$onRenderResolve$();
|
|
2961
2974
|
hostRef.$onRenderResolve$ = void 0;
|
|
@@ -2967,7 +2980,7 @@ var postUpdateComponent = (hostRef) => {
|
|
|
2967
2980
|
}
|
|
2968
2981
|
};
|
|
2969
2982
|
var forceUpdate = (ref) => {
|
|
2970
|
-
if (
|
|
2983
|
+
if (BUILD15.updatable && (Build.isBrowser || Build.isTesting)) {
|
|
2971
2984
|
const hostRef = getHostRef(ref);
|
|
2972
2985
|
const isConnected = hostRef.$hostElement$.isConnected;
|
|
2973
2986
|
if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
@@ -2978,11 +2991,11 @@ var forceUpdate = (ref) => {
|
|
|
2978
2991
|
return false;
|
|
2979
2992
|
};
|
|
2980
2993
|
var appDidLoad = (who) => {
|
|
2981
|
-
if (
|
|
2994
|
+
if (BUILD15.asyncQueue) {
|
|
2982
2995
|
plt.$flags$ |= 2 /* appLoaded */;
|
|
2983
2996
|
}
|
|
2984
2997
|
nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
|
|
2985
|
-
if (
|
|
2998
|
+
if (BUILD15.profile && performance.measure) {
|
|
2986
2999
|
performance.measure(`[Stencil] ${NAMESPACE} initial load (by ${who})`, "st:app:start");
|
|
2987
3000
|
}
|
|
2988
3001
|
};
|
|
@@ -2997,7 +3010,7 @@ var safeCall = (instance, method, arg, elm) => {
|
|
|
2997
3010
|
return void 0;
|
|
2998
3011
|
};
|
|
2999
3012
|
var emitLifecycleEvent = (elm, lifecycleName) => {
|
|
3000
|
-
if (
|
|
3013
|
+
if (BUILD15.lifecycleDOMEvents) {
|
|
3001
3014
|
emitEvent(elm, "stencil_" + lifecycleName, {
|
|
3002
3015
|
bubbles: true,
|
|
3003
3016
|
composed: true,
|
|
@@ -3009,7 +3022,7 @@ var emitLifecycleEvent = (elm, lifecycleName) => {
|
|
|
3009
3022
|
};
|
|
3010
3023
|
var addHydratedFlag = (elm) => {
|
|
3011
3024
|
var _a, _b;
|
|
3012
|
-
return
|
|
3025
|
+
return BUILD15.hydratedClass ? elm.classList.add((_a = BUILD15.hydratedSelectorName) != null ? _a : "hydrated") : BUILD15.hydratedAttribute ? elm.setAttribute((_b = BUILD15.hydratedSelectorName) != null ? _b : "hydrated", "") : void 0;
|
|
3013
3026
|
};
|
|
3014
3027
|
var serverSideConnected = (elm) => {
|
|
3015
3028
|
const children = elm.children;
|
|
@@ -3028,21 +3041,21 @@ var serverSideConnected = (elm) => {
|
|
|
3028
3041
|
var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
3029
3042
|
var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
3030
3043
|
const hostRef = getHostRef(ref);
|
|
3031
|
-
if (
|
|
3044
|
+
if (BUILD16.lazyLoad && !hostRef) {
|
|
3032
3045
|
throw new Error(
|
|
3033
3046
|
`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/stenciljs/core/issues/5457).`
|
|
3034
3047
|
);
|
|
3035
3048
|
}
|
|
3036
|
-
const elm =
|
|
3049
|
+
const elm = BUILD16.lazyLoad ? hostRef.$hostElement$ : ref;
|
|
3037
3050
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
3038
3051
|
const flags = hostRef.$flags$;
|
|
3039
|
-
const instance =
|
|
3052
|
+
const instance = BUILD16.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
3040
3053
|
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
|
3041
3054
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
3042
3055
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
3043
|
-
if ((!
|
|
3056
|
+
if ((!BUILD16.lazyLoad || !(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
|
|
3044
3057
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
3045
|
-
if (
|
|
3058
|
+
if (BUILD16.isDev) {
|
|
3046
3059
|
if (hostRef.$flags$ & 1024 /* devOnRender */) {
|
|
3047
3060
|
consoleDevWarn(
|
|
3048
3061
|
`The state/prop "${propName}" changed during rendering. This can potentially lead to infinite-loops and other bugs.`,
|
|
@@ -3065,8 +3078,8 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3065
3078
|
);
|
|
3066
3079
|
}
|
|
3067
3080
|
}
|
|
3068
|
-
if (!
|
|
3069
|
-
if (
|
|
3081
|
+
if (!BUILD16.lazyLoad || instance) {
|
|
3082
|
+
if (BUILD16.watchCallback && cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
3070
3083
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
3071
3084
|
if (watchMethods) {
|
|
3072
3085
|
watchMethods.map((watchMethodName) => {
|
|
@@ -3078,7 +3091,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3078
3091
|
});
|
|
3079
3092
|
}
|
|
3080
3093
|
}
|
|
3081
|
-
if (
|
|
3094
|
+
if (BUILD16.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
3082
3095
|
if (instance.componentShouldUpdate) {
|
|
3083
3096
|
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
3084
3097
|
return;
|
|
@@ -3094,46 +3107,46 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3094
3107
|
var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
3095
3108
|
var _a, _b;
|
|
3096
3109
|
const prototype = Cstr.prototype;
|
|
3097
|
-
if (
|
|
3110
|
+
if (BUILD17.isTesting) {
|
|
3098
3111
|
if (prototype.__stencilAugmented) {
|
|
3099
3112
|
return;
|
|
3100
3113
|
}
|
|
3101
3114
|
prototype.__stencilAugmented = true;
|
|
3102
3115
|
}
|
|
3103
|
-
if (
|
|
3116
|
+
if (BUILD17.formAssociated && cmpMeta.$flags$ & 64 /* formAssociated */ && flags & 1 /* isElementConstructor */) {
|
|
3104
3117
|
FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS.forEach((cbName) => {
|
|
3105
3118
|
const originalFormAssociatedCallback = prototype[cbName];
|
|
3106
3119
|
Object.defineProperty(prototype, cbName, {
|
|
3107
3120
|
value(...args) {
|
|
3108
3121
|
const hostRef = getHostRef(this);
|
|
3109
|
-
const instance =
|
|
3122
|
+
const instance = BUILD17.lazyLoad ? hostRef.$lazyInstance$ : this;
|
|
3110
3123
|
if (!instance) {
|
|
3111
3124
|
hostRef.$onReadyPromise$.then((asyncInstance) => {
|
|
3112
3125
|
const cb = asyncInstance[cbName];
|
|
3113
3126
|
typeof cb === "function" && cb.call(asyncInstance, ...args);
|
|
3114
3127
|
});
|
|
3115
3128
|
} else {
|
|
3116
|
-
const cb =
|
|
3129
|
+
const cb = BUILD17.lazyLoad ? instance[cbName] : originalFormAssociatedCallback;
|
|
3117
3130
|
typeof cb === "function" && cb.call(instance, ...args);
|
|
3118
3131
|
}
|
|
3119
3132
|
}
|
|
3120
3133
|
});
|
|
3121
3134
|
});
|
|
3122
3135
|
}
|
|
3123
|
-
if (
|
|
3124
|
-
if (
|
|
3136
|
+
if (BUILD17.member && cmpMeta.$members$ || BUILD17.watchCallback && (cmpMeta.$watchers$ || Cstr.watchers)) {
|
|
3137
|
+
if (BUILD17.watchCallback && Cstr.watchers && !cmpMeta.$watchers$) {
|
|
3125
3138
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
3126
3139
|
}
|
|
3127
3140
|
const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
|
|
3128
3141
|
members.map(([memberName, [memberFlags]]) => {
|
|
3129
|
-
if ((
|
|
3142
|
+
if ((BUILD17.prop || BUILD17.state) && (memberFlags & 31 /* Prop */ || (!BUILD17.lazyLoad || flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
|
|
3130
3143
|
const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
|
|
3131
3144
|
if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
|
|
3132
3145
|
if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
|
|
3133
3146
|
if (flags & 1 /* isElementConstructor */ || !origGetter) {
|
|
3134
3147
|
Object.defineProperty(prototype, memberName, {
|
|
3135
3148
|
get() {
|
|
3136
|
-
if (
|
|
3149
|
+
if (BUILD17.lazyLoad) {
|
|
3137
3150
|
if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
|
|
3138
3151
|
return getValue(this, memberName);
|
|
3139
3152
|
}
|
|
@@ -3142,7 +3155,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
3142
3155
|
if (!instance) return;
|
|
3143
3156
|
return instance[memberName];
|
|
3144
3157
|
}
|
|
3145
|
-
if (!
|
|
3158
|
+
if (!BUILD17.lazyLoad) {
|
|
3146
3159
|
return origGetter ? origGetter.apply(this) : getValue(this, memberName);
|
|
3147
3160
|
}
|
|
3148
3161
|
},
|
|
@@ -3153,7 +3166,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
3153
3166
|
Object.defineProperty(prototype, memberName, {
|
|
3154
3167
|
set(newValue) {
|
|
3155
3168
|
const ref = getHostRef(this);
|
|
3156
|
-
if (
|
|
3169
|
+
if (BUILD17.isDev) {
|
|
3157
3170
|
if (
|
|
3158
3171
|
// we are proxying the instance (not element)
|
|
3159
3172
|
(flags & 1 /* isElementConstructor */) === 0 && // if the class has a setter, then the Element can update instance values, so ignore
|
|
@@ -3180,11 +3193,11 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
|
3180
3193
|
setValue(this, memberName, newValue, cmpMeta);
|
|
3181
3194
|
return;
|
|
3182
3195
|
}
|
|
3183
|
-
if (!
|
|
3196
|
+
if (!BUILD17.lazyLoad) {
|
|
3184
3197
|
setValue(this, memberName, newValue, cmpMeta);
|
|
3185
3198
|
return;
|
|
3186
3199
|
}
|
|
3187
|
-
if (
|
|
3200
|
+
if (BUILD17.lazyLoad) {
|
|
3188
3201
|
if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
|
|
3189
3202
|
setValue(this, memberName, newValue, cmpMeta);
|
|
3190
3203
|
if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
|
|
@@ -3212,7 +3225,7 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
|
3212
3225
|
}
|
|
3213
3226
|
}
|
|
3214
3227
|
});
|
|
3215
|
-
} else if (
|
|
3228
|
+
} else if (BUILD17.lazyLoad && BUILD17.method && flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
|
|
3216
3229
|
Object.defineProperty(prototype, memberName, {
|
|
3217
3230
|
value(...args) {
|
|
3218
3231
|
var _a2;
|
|
@@ -3225,13 +3238,13 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
|
3225
3238
|
});
|
|
3226
3239
|
}
|
|
3227
3240
|
});
|
|
3228
|
-
if (
|
|
3241
|
+
if (BUILD17.observeAttribute && (!BUILD17.lazyLoad || flags & 1 /* isElementConstructor */)) {
|
|
3229
3242
|
const attrNameToPropName = /* @__PURE__ */ new Map();
|
|
3230
3243
|
prototype.attributeChangedCallback = function(attrName, oldValue, newValue) {
|
|
3231
3244
|
plt.jmp(() => {
|
|
3232
3245
|
var _a2;
|
|
3233
3246
|
const propName = attrNameToPropName.get(attrName);
|
|
3234
|
-
if (this.hasOwnProperty(propName) &&
|
|
3247
|
+
if (this.hasOwnProperty(propName) && BUILD17.lazyLoad) {
|
|
3235
3248
|
newValue = this[propName];
|
|
3236
3249
|
delete this[propName];
|
|
3237
3250
|
} else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
|
|
@@ -3241,8 +3254,8 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
|
3241
3254
|
const hostRef = getHostRef(this);
|
|
3242
3255
|
const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
|
|
3243
3256
|
if (flags2 && !(flags2 & 8 /* isConstructingInstance */) && flags2 & 128 /* isWatchReady */ && newValue !== oldValue) {
|
|
3244
|
-
const elm =
|
|
3245
|
-
const instance =
|
|
3257
|
+
const elm = BUILD17.lazyLoad ? hostRef.$hostElement$ : this;
|
|
3258
|
+
const instance = BUILD17.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
3246
3259
|
const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
|
|
3247
3260
|
entry == null ? void 0 : entry.forEach((callbackName) => {
|
|
3248
3261
|
if (instance[callbackName] != null) {
|
|
@@ -3266,7 +3279,7 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
|
3266
3279
|
var _a2;
|
|
3267
3280
|
const attrName = m[1] || propName;
|
|
3268
3281
|
attrNameToPropName.set(attrName, propName);
|
|
3269
|
-
if (
|
|
3282
|
+
if (BUILD17.reflect && m[0] & 512 /* ReflectAttr */) {
|
|
3270
3283
|
(_a2 = cmpMeta.$attrsToReflect$) == null ? void 0 : _a2.push([propName, attrName]);
|
|
3271
3284
|
}
|
|
3272
3285
|
return attrName;
|
|
@@ -3284,7 +3297,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
3284
3297
|
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
3285
3298
|
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
3286
3299
|
const bundleId = cmpMeta.$lazyBundleId$;
|
|
3287
|
-
if (
|
|
3300
|
+
if (BUILD18.lazyLoad && bundleId) {
|
|
3288
3301
|
const CstrImport = loadModule(cmpMeta, hostRef, hmrVersionId);
|
|
3289
3302
|
if (CstrImport && "then" in CstrImport) {
|
|
3290
3303
|
const endLoad = uniqueTime(
|
|
@@ -3299,15 +3312,15 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
3299
3312
|
if (!Cstr) {
|
|
3300
3313
|
throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
|
|
3301
3314
|
}
|
|
3302
|
-
if (
|
|
3303
|
-
if (
|
|
3315
|
+
if (BUILD18.member && !Cstr.isProxied) {
|
|
3316
|
+
if (BUILD18.watchCallback) {
|
|
3304
3317
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
3305
3318
|
}
|
|
3306
3319
|
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
3307
3320
|
Cstr.isProxied = true;
|
|
3308
3321
|
}
|
|
3309
3322
|
const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
|
|
3310
|
-
if (
|
|
3323
|
+
if (BUILD18.member) {
|
|
3311
3324
|
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
|
3312
3325
|
}
|
|
3313
3326
|
try {
|
|
@@ -3315,10 +3328,10 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
3315
3328
|
} catch (e) {
|
|
3316
3329
|
consoleError(e, elm);
|
|
3317
3330
|
}
|
|
3318
|
-
if (
|
|
3331
|
+
if (BUILD18.member) {
|
|
3319
3332
|
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
3320
3333
|
}
|
|
3321
|
-
if (
|
|
3334
|
+
if (BUILD18.watchCallback) {
|
|
3322
3335
|
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
3323
3336
|
}
|
|
3324
3337
|
endNewInstance();
|
|
@@ -3328,23 +3341,23 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
3328
3341
|
const cmpTag = elm.localName;
|
|
3329
3342
|
customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
|
|
3330
3343
|
}
|
|
3331
|
-
if (
|
|
3344
|
+
if (BUILD18.style && Cstr && Cstr.style) {
|
|
3332
3345
|
let style;
|
|
3333
3346
|
if (typeof Cstr.style === "string") {
|
|
3334
3347
|
style = Cstr.style;
|
|
3335
|
-
} else if (
|
|
3348
|
+
} else if (BUILD18.mode && typeof Cstr.style !== "string") {
|
|
3336
3349
|
hostRef.$modeName$ = computeMode(elm);
|
|
3337
3350
|
if (hostRef.$modeName$) {
|
|
3338
3351
|
style = Cstr.style[hostRef.$modeName$];
|
|
3339
3352
|
}
|
|
3340
|
-
if (
|
|
3353
|
+
if (BUILD18.hydrateServerSide && hostRef.$modeName$) {
|
|
3341
3354
|
elm.setAttribute("s-mode", hostRef.$modeName$);
|
|
3342
3355
|
}
|
|
3343
3356
|
}
|
|
3344
3357
|
const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
|
|
3345
3358
|
if (!styles.has(scopeId2)) {
|
|
3346
3359
|
const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
|
|
3347
|
-
if (
|
|
3360
|
+
if (BUILD18.hydrateServerSide && BUILD18.shadowDom && cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */) {
|
|
3348
3361
|
style = scopeCss(style, scopeId2, true);
|
|
3349
3362
|
}
|
|
3350
3363
|
registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
@@ -3354,14 +3367,14 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
3354
3367
|
}
|
|
3355
3368
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
3356
3369
|
const schedule = () => scheduleUpdate(hostRef, true);
|
|
3357
|
-
if (
|
|
3370
|
+
if (BUILD18.asyncLoading && ancestorComponent && ancestorComponent["s-rc"]) {
|
|
3358
3371
|
ancestorComponent["s-rc"].push(schedule);
|
|
3359
3372
|
} else {
|
|
3360
3373
|
schedule();
|
|
3361
3374
|
}
|
|
3362
3375
|
};
|
|
3363
3376
|
var fireConnectedCallback = (instance, elm) => {
|
|
3364
|
-
if (
|
|
3377
|
+
if (BUILD18.lazyLoad) {
|
|
3365
3378
|
safeCall(instance, "connectedCallback", void 0, elm);
|
|
3366
3379
|
}
|
|
3367
3380
|
};
|
|
@@ -3372,41 +3385,41 @@ var connectedCallback = (elm) => {
|
|
|
3372
3385
|
const hostRef = getHostRef(elm);
|
|
3373
3386
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
3374
3387
|
const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
|
|
3375
|
-
if (
|
|
3388
|
+
if (BUILD19.hostListenerTargetParent) {
|
|
3376
3389
|
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
|
|
3377
3390
|
}
|
|
3378
3391
|
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
3379
3392
|
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
3380
3393
|
let hostId;
|
|
3381
|
-
if (
|
|
3394
|
+
if (BUILD19.hydrateClientSide) {
|
|
3382
3395
|
hostId = elm.getAttribute(HYDRATE_ID);
|
|
3383
3396
|
if (hostId) {
|
|
3384
|
-
if (
|
|
3385
|
-
const scopeId2 =
|
|
3397
|
+
if (BUILD19.shadowDom && supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
3398
|
+
const scopeId2 = BUILD19.mode ? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute("s-mode")) : addStyle(elm.shadowRoot, cmpMeta);
|
|
3386
3399
|
elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s");
|
|
3387
|
-
} else if (
|
|
3388
|
-
const scopeId2 = getScopeId(cmpMeta,
|
|
3400
|
+
} else if (BUILD19.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
3401
|
+
const scopeId2 = getScopeId(cmpMeta, BUILD19.mode ? elm.getAttribute("s-mode") : void 0);
|
|
3389
3402
|
elm["s-sc"] = scopeId2;
|
|
3390
3403
|
}
|
|
3391
3404
|
initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
|
|
3392
3405
|
}
|
|
3393
3406
|
}
|
|
3394
|
-
if (
|
|
3395
|
-
if (
|
|
3407
|
+
if (BUILD19.slotRelocation && !hostId) {
|
|
3408
|
+
if (BUILD19.hydrateServerSide || (BUILD19.slot || BUILD19.shadowDom) && // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
|
|
3396
3409
|
cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
|
|
3397
3410
|
setContentReference(elm);
|
|
3398
3411
|
}
|
|
3399
3412
|
}
|
|
3400
|
-
if (
|
|
3413
|
+
if (BUILD19.asyncLoading) {
|
|
3401
3414
|
let ancestorComponent = elm;
|
|
3402
3415
|
while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
|
|
3403
|
-
if (
|
|
3416
|
+
if (BUILD19.hydrateClientSide && ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
|
|
3404
3417
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
|
|
3405
3418
|
break;
|
|
3406
3419
|
}
|
|
3407
3420
|
}
|
|
3408
3421
|
}
|
|
3409
|
-
if (
|
|
3422
|
+
if (BUILD19.prop && !BUILD19.hydrateServerSide && cmpMeta.$members$) {
|
|
3410
3423
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
3411
3424
|
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
3412
3425
|
const value = elm[memberName];
|
|
@@ -3415,7 +3428,7 @@ var connectedCallback = (elm) => {
|
|
|
3415
3428
|
}
|
|
3416
3429
|
});
|
|
3417
3430
|
}
|
|
3418
|
-
if (
|
|
3431
|
+
if (BUILD19.initializeNextTick) {
|
|
3419
3432
|
nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
|
|
3420
3433
|
} else {
|
|
3421
3434
|
initializeComponent(elm, hostRef, cmpMeta);
|
|
@@ -3436,29 +3449,29 @@ var setContentReference = (elm) => {
|
|
|
3436
3449
|
return;
|
|
3437
3450
|
}
|
|
3438
3451
|
const contentRefElm = elm["s-cr"] = win.document.createComment(
|
|
3439
|
-
|
|
3452
|
+
BUILD19.isDebug ? `content-ref (host=${elm.localName})` : ""
|
|
3440
3453
|
);
|
|
3441
3454
|
contentRefElm["s-cn"] = true;
|
|
3442
3455
|
insertBefore(elm, contentRefElm, elm.firstChild);
|
|
3443
3456
|
};
|
|
3444
3457
|
|
|
3445
3458
|
// src/runtime/disconnected-callback.ts
|
|
3446
|
-
import { BUILD as
|
|
3459
|
+
import { BUILD as BUILD20 } from "@stencil/core/internal/app-data";
|
|
3447
3460
|
var disconnectInstance = (instance, elm) => {
|
|
3448
|
-
if (
|
|
3461
|
+
if (BUILD20.lazyLoad) {
|
|
3449
3462
|
safeCall(instance, "disconnectedCallback", void 0, elm || instance);
|
|
3450
3463
|
}
|
|
3451
3464
|
};
|
|
3452
3465
|
var disconnectedCallback = async (elm) => {
|
|
3453
3466
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
3454
3467
|
const hostRef = getHostRef(elm);
|
|
3455
|
-
if (
|
|
3468
|
+
if (BUILD20.hostListener) {
|
|
3456
3469
|
if (hostRef.$rmListeners$) {
|
|
3457
3470
|
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
3458
3471
|
hostRef.$rmListeners$ = void 0;
|
|
3459
3472
|
}
|
|
3460
3473
|
}
|
|
3461
|
-
if (!
|
|
3474
|
+
if (!BUILD20.lazyLoad) {
|
|
3462
3475
|
disconnectInstance(elm);
|
|
3463
3476
|
} else if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
|
|
3464
3477
|
disconnectInstance(hostRef.$lazyInstance$, elm);
|
|
@@ -3483,40 +3496,40 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
3483
3496
|
$flags$: compactMeta[0],
|
|
3484
3497
|
$tagName$: compactMeta[1]
|
|
3485
3498
|
};
|
|
3486
|
-
if (
|
|
3499
|
+
if (BUILD21.member) {
|
|
3487
3500
|
cmpMeta.$members$ = compactMeta[2];
|
|
3488
3501
|
}
|
|
3489
|
-
if (
|
|
3502
|
+
if (BUILD21.hostListener) {
|
|
3490
3503
|
cmpMeta.$listeners$ = compactMeta[3];
|
|
3491
3504
|
}
|
|
3492
|
-
if (
|
|
3505
|
+
if (BUILD21.watchCallback) {
|
|
3493
3506
|
cmpMeta.$watchers$ = Cstr.$watchers$;
|
|
3494
3507
|
}
|
|
3495
|
-
if (
|
|
3508
|
+
if (BUILD21.reflect) {
|
|
3496
3509
|
cmpMeta.$attrsToReflect$ = [];
|
|
3497
3510
|
}
|
|
3498
|
-
if (
|
|
3511
|
+
if (BUILD21.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
3499
3512
|
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
|
|
3500
3513
|
}
|
|
3501
|
-
if (
|
|
3502
|
-
if (
|
|
3514
|
+
if (BUILD21.experimentalSlotFixes) {
|
|
3515
|
+
if (BUILD21.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
3503
3516
|
patchPseudoShadowDom(Cstr.prototype);
|
|
3504
3517
|
}
|
|
3505
3518
|
} else {
|
|
3506
|
-
if (
|
|
3519
|
+
if (BUILD21.slotChildNodesFix) {
|
|
3507
3520
|
patchChildSlotNodes(Cstr.prototype);
|
|
3508
3521
|
}
|
|
3509
|
-
if (
|
|
3522
|
+
if (BUILD21.cloneNodeFix) {
|
|
3510
3523
|
patchCloneNode(Cstr.prototype);
|
|
3511
3524
|
}
|
|
3512
|
-
if (
|
|
3525
|
+
if (BUILD21.appendChildSlotFix) {
|
|
3513
3526
|
patchSlotAppendChild(Cstr.prototype);
|
|
3514
3527
|
}
|
|
3515
|
-
if (
|
|
3528
|
+
if (BUILD21.scopedSlotTextContentFix && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
3516
3529
|
patchTextContent(Cstr.prototype);
|
|
3517
3530
|
}
|
|
3518
3531
|
}
|
|
3519
|
-
if (
|
|
3532
|
+
if (BUILD21.hydrateClientSide && BUILD21.shadowDom) {
|
|
3520
3533
|
hydrateScopedToShadow();
|
|
3521
3534
|
}
|
|
3522
3535
|
const originalConnectedCallback = Cstr.prototype.connectedCallback;
|
|
@@ -3546,14 +3559,7 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
3546
3559
|
__attachShadow() {
|
|
3547
3560
|
if (supportsShadow) {
|
|
3548
3561
|
if (!this.shadowRoot) {
|
|
3549
|
-
|
|
3550
|
-
this.attachShadow({
|
|
3551
|
-
mode: "open",
|
|
3552
|
-
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
|
|
3553
|
-
});
|
|
3554
|
-
} else {
|
|
3555
|
-
this.attachShadow({ mode: "open" });
|
|
3556
|
-
}
|
|
3562
|
+
createShadowRoot.call(this, cmpMeta);
|
|
3557
3563
|
} else {
|
|
3558
3564
|
if (this.shadowRoot.mode !== "open") {
|
|
3559
3565
|
throw new Error(
|
|
@@ -3570,7 +3576,7 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
3570
3576
|
return proxyComponent(Cstr, cmpMeta, 1 /* isElementConstructor */ | 2 /* proxyState */);
|
|
3571
3577
|
};
|
|
3572
3578
|
var forceModeUpdate = (elm) => {
|
|
3573
|
-
if (
|
|
3579
|
+
if (BUILD21.style && BUILD21.mode && !BUILD21.lazyLoad) {
|
|
3574
3580
|
const mode = computeMode(elm);
|
|
3575
3581
|
const hostRef = getHostRef(elm);
|
|
3576
3582
|
if (hostRef.$modeName$ !== mode) {
|
|
@@ -3593,7 +3599,7 @@ var forceModeUpdate = (elm) => {
|
|
|
3593
3599
|
};
|
|
3594
3600
|
|
|
3595
3601
|
// src/runtime/bootstrap-lazy.ts
|
|
3596
|
-
import { BUILD as
|
|
3602
|
+
import { BUILD as BUILD22 } from "@stencil/core/internal/app-data";
|
|
3597
3603
|
|
|
3598
3604
|
// src/runtime/hmr-component.ts
|
|
3599
3605
|
var hmrStart = (hostElement, cmpMeta, hmrVersionId) => {
|
|
@@ -3605,7 +3611,7 @@ var hmrStart = (hostElement, cmpMeta, hmrVersionId) => {
|
|
|
3605
3611
|
// src/runtime/bootstrap-lazy.ts
|
|
3606
3612
|
var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
3607
3613
|
var _a;
|
|
3608
|
-
if (
|
|
3614
|
+
if (BUILD22.profile && performance.mark) {
|
|
3609
3615
|
performance.mark("st:app:start");
|
|
3610
3616
|
}
|
|
3611
3617
|
installDevTools();
|
|
@@ -3625,15 +3631,15 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3625
3631
|
let isBootstrapping = true;
|
|
3626
3632
|
Object.assign(plt, options);
|
|
3627
3633
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
|
|
3628
|
-
if (
|
|
3634
|
+
if (BUILD22.asyncQueue) {
|
|
3629
3635
|
if (options.syncQueue) {
|
|
3630
3636
|
plt.$flags$ |= 4 /* queueSync */;
|
|
3631
3637
|
}
|
|
3632
3638
|
}
|
|
3633
|
-
if (
|
|
3639
|
+
if (BUILD22.hydrateClientSide) {
|
|
3634
3640
|
plt.$flags$ |= 2 /* appLoaded */;
|
|
3635
3641
|
}
|
|
3636
|
-
if (
|
|
3642
|
+
if (BUILD22.hydrateClientSide && BUILD22.shadowDom) {
|
|
3637
3643
|
hydrateScopedToShadow();
|
|
3638
3644
|
}
|
|
3639
3645
|
let hasSlotRelocation = false;
|
|
@@ -3649,22 +3655,22 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3649
3655
|
if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
|
|
3650
3656
|
hasSlotRelocation = true;
|
|
3651
3657
|
}
|
|
3652
|
-
if (
|
|
3658
|
+
if (BUILD22.member) {
|
|
3653
3659
|
cmpMeta.$members$ = compactMeta[2];
|
|
3654
3660
|
}
|
|
3655
|
-
if (
|
|
3661
|
+
if (BUILD22.hostListener) {
|
|
3656
3662
|
cmpMeta.$listeners$ = compactMeta[3];
|
|
3657
3663
|
}
|
|
3658
|
-
if (
|
|
3664
|
+
if (BUILD22.reflect) {
|
|
3659
3665
|
cmpMeta.$attrsToReflect$ = [];
|
|
3660
3666
|
}
|
|
3661
|
-
if (
|
|
3667
|
+
if (BUILD22.watchCallback) {
|
|
3662
3668
|
cmpMeta.$watchers$ = (_a2 = compactMeta[4]) != null ? _a2 : {};
|
|
3663
3669
|
}
|
|
3664
|
-
if (
|
|
3670
|
+
if (BUILD22.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
3665
3671
|
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
|
|
3666
3672
|
}
|
|
3667
|
-
const tagName =
|
|
3673
|
+
const tagName = BUILD22.transformTagName && options.transformTagName ? options.transformTagName(cmpMeta.$tagName$) : cmpMeta.$tagName$;
|
|
3668
3674
|
const HostElement = class extends HTMLElement {
|
|
3669
3675
|
// StencilLazyHost
|
|
3670
3676
|
constructor(self) {
|
|
@@ -3672,17 +3678,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3672
3678
|
this.hasRegisteredEventListeners = false;
|
|
3673
3679
|
self = this;
|
|
3674
3680
|
registerHost(self, cmpMeta);
|
|
3675
|
-
if (
|
|
3681
|
+
if (BUILD22.shadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
3676
3682
|
if (supportsShadow) {
|
|
3677
3683
|
if (!self.shadowRoot) {
|
|
3678
|
-
|
|
3679
|
-
self.attachShadow({
|
|
3680
|
-
mode: "open",
|
|
3681
|
-
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
|
|
3682
|
-
});
|
|
3683
|
-
} else {
|
|
3684
|
-
self.attachShadow({ mode: "open" });
|
|
3685
|
-
}
|
|
3684
|
+
createShadowRoot.call(self, cmpMeta);
|
|
3686
3685
|
} else {
|
|
3687
3686
|
if (self.shadowRoot.mode !== "open") {
|
|
3688
3687
|
throw new Error(
|
|
@@ -3690,7 +3689,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3690
3689
|
);
|
|
3691
3690
|
}
|
|
3692
3691
|
}
|
|
3693
|
-
} else if (!
|
|
3692
|
+
} else if (!BUILD22.hydrateServerSide && !("shadowRoot" in self)) {
|
|
3694
3693
|
self.shadowRoot = self;
|
|
3695
3694
|
}
|
|
3696
3695
|
}
|
|
@@ -3729,28 +3728,28 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3729
3728
|
return getHostRef(this).$onReadyPromise$;
|
|
3730
3729
|
}
|
|
3731
3730
|
};
|
|
3732
|
-
if (
|
|
3733
|
-
if (
|
|
3731
|
+
if (BUILD22.experimentalSlotFixes) {
|
|
3732
|
+
if (BUILD22.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
3734
3733
|
patchPseudoShadowDom(HostElement.prototype);
|
|
3735
3734
|
}
|
|
3736
3735
|
} else {
|
|
3737
|
-
if (
|
|
3736
|
+
if (BUILD22.slotChildNodesFix) {
|
|
3738
3737
|
patchChildSlotNodes(HostElement.prototype);
|
|
3739
3738
|
}
|
|
3740
|
-
if (
|
|
3739
|
+
if (BUILD22.cloneNodeFix) {
|
|
3741
3740
|
patchCloneNode(HostElement.prototype);
|
|
3742
3741
|
}
|
|
3743
|
-
if (
|
|
3742
|
+
if (BUILD22.appendChildSlotFix) {
|
|
3744
3743
|
patchSlotAppendChild(HostElement.prototype);
|
|
3745
3744
|
}
|
|
3746
|
-
if (
|
|
3745
|
+
if (BUILD22.scopedSlotTextContentFix && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
|
|
3747
3746
|
patchTextContent(HostElement.prototype);
|
|
3748
3747
|
}
|
|
3749
3748
|
}
|
|
3750
|
-
if (
|
|
3749
|
+
if (BUILD22.formAssociated && cmpMeta.$flags$ & 64 /* formAssociated */) {
|
|
3751
3750
|
HostElement.formAssociated = true;
|
|
3752
3751
|
}
|
|
3753
|
-
if (
|
|
3752
|
+
if (BUILD22.hotModuleReplacement) {
|
|
3754
3753
|
HostElement.prototype["s-hmr"] = function(hmrVersionId) {
|
|
3755
3754
|
hmrStart(this, cmpMeta, hmrVersionId);
|
|
3756
3755
|
};
|
|
@@ -3769,7 +3768,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3769
3768
|
if (hasSlotRelocation) {
|
|
3770
3769
|
dataStyles.textContent += SLOT_FB_CSS;
|
|
3771
3770
|
}
|
|
3772
|
-
if (
|
|
3771
|
+
if (BUILD22.invisiblePrehydration && (BUILD22.hydratedClass || BUILD22.hydratedAttribute)) {
|
|
3773
3772
|
dataStyles.textContent += cmpTags.sort() + HYDRATED_CSS;
|
|
3774
3773
|
}
|
|
3775
3774
|
if (dataStyles.innerHTML.length) {
|
|
@@ -3785,7 +3784,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3785
3784
|
if (deferredConnectedCallbacks.length) {
|
|
3786
3785
|
deferredConnectedCallbacks.map((host) => host.connectedCallback());
|
|
3787
3786
|
} else {
|
|
3788
|
-
if (
|
|
3787
|
+
if (BUILD22.profile) {
|
|
3789
3788
|
plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30, "timeout"));
|
|
3790
3789
|
} else {
|
|
3791
3790
|
plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30));
|
|
@@ -3798,10 +3797,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3798
3797
|
var Fragment = (_, children) => children;
|
|
3799
3798
|
|
|
3800
3799
|
// src/runtime/host-listener.ts
|
|
3801
|
-
import { BUILD as
|
|
3800
|
+
import { BUILD as BUILD23 } from "@stencil/core/internal/app-data";
|
|
3802
3801
|
var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
3803
|
-
if (
|
|
3804
|
-
if (
|
|
3802
|
+
if (BUILD23.hostListener && listeners && win.document) {
|
|
3803
|
+
if (BUILD23.hostListenerTargetParent) {
|
|
3805
3804
|
if (attachParentListeners) {
|
|
3806
3805
|
listeners = listeners.filter(([flags]) => flags & 32 /* TargetParent */);
|
|
3807
3806
|
} else {
|
|
@@ -3809,7 +3808,7 @@ var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =>
|
|
|
3809
3808
|
}
|
|
3810
3809
|
}
|
|
3811
3810
|
listeners.map(([flags, name, method]) => {
|
|
3812
|
-
const target =
|
|
3811
|
+
const target = BUILD23.hostListenerTarget ? getHostListenerTarget(win.document, elm, flags) : elm;
|
|
3813
3812
|
const handler = hostListenerProxy(hostRef, method);
|
|
3814
3813
|
const opts = hostListenerOpts(flags);
|
|
3815
3814
|
plt.ael(target, name, handler, opts);
|
|
@@ -3820,7 +3819,7 @@ var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =>
|
|
|
3820
3819
|
var hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
3821
3820
|
var _a;
|
|
3822
3821
|
try {
|
|
3823
|
-
if (
|
|
3822
|
+
if (BUILD23.lazyLoad) {
|
|
3824
3823
|
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
|
3825
3824
|
(_a = hostRef.$lazyInstance$) == null ? void 0 : _a[methodName](ev);
|
|
3826
3825
|
} else {
|
|
@@ -3834,16 +3833,16 @@ var hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
3834
3833
|
}
|
|
3835
3834
|
};
|
|
3836
3835
|
var getHostListenerTarget = (doc, elm, flags) => {
|
|
3837
|
-
if (
|
|
3836
|
+
if (BUILD23.hostListenerTargetDocument && flags & 4 /* TargetDocument */) {
|
|
3838
3837
|
return doc;
|
|
3839
3838
|
}
|
|
3840
|
-
if (
|
|
3839
|
+
if (BUILD23.hostListenerTargetWindow && flags & 8 /* TargetWindow */) {
|
|
3841
3840
|
return win;
|
|
3842
3841
|
}
|
|
3843
|
-
if (
|
|
3842
|
+
if (BUILD23.hostListenerTargetBody && flags & 16 /* TargetBody */) {
|
|
3844
3843
|
return doc.body;
|
|
3845
3844
|
}
|
|
3846
|
-
if (
|
|
3845
|
+
if (BUILD23.hostListenerTargetParent && flags & 32 /* TargetParent */ && elm.parentElement) {
|
|
3847
3846
|
return elm.parentElement;
|
|
3848
3847
|
}
|
|
3849
3848
|
return elm;
|
|
@@ -4022,7 +4021,6 @@ var hAsync = (nodeName, vnodeData, ...children) => {
|
|
|
4022
4021
|
import { globalScripts } from "@stencil/core/internal/app-globals";
|
|
4023
4022
|
|
|
4024
4023
|
// src/hydrate/platform/proxy-host-element.ts
|
|
4025
|
-
import { BUILD as BUILD23 } from "@stencil/core/internal/app-data";
|
|
4026
4024
|
function proxyHostElement(elm, cstr) {
|
|
4027
4025
|
const cmpMeta = cstr.cmpMeta;
|
|
4028
4026
|
if (typeof elm.componentOnReady !== "function") {
|
|
@@ -4032,14 +4030,7 @@ function proxyHostElement(elm, cstr) {
|
|
|
4032
4030
|
elm.forceUpdate = forceUpdate2;
|
|
4033
4031
|
}
|
|
4034
4032
|
if (!elm.shadowRoot && !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) {
|
|
4035
|
-
|
|
4036
|
-
elm.attachShadow({
|
|
4037
|
-
mode: "open",
|
|
4038
|
-
delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
|
|
4039
|
-
});
|
|
4040
|
-
} else {
|
|
4041
|
-
elm.attachShadow({ mode: "open" });
|
|
4042
|
-
}
|
|
4033
|
+
createShadowRoot.call(elm, cmpMeta);
|
|
4043
4034
|
}
|
|
4044
4035
|
if (cmpMeta.$members$ != null) {
|
|
4045
4036
|
const hostRef = getHostRef(elm);
|