@stencil/core 4.35.3-dev.1752161791.11e6f9d → 4.35.3-dev.1752210255.bfbd683

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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Hydrate Platform v4.35.3-dev.1752161791.11e6f9d | MIT Licensed | https://stenciljs.com
2
+ Stencil Hydrate Platform v4.35.3-dev.1752210255.bfbd683 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -293,7 +293,7 @@ var isJsFile = lowerPathParam((p) => p.endsWith(".js") || p.endsWith(".mjs") ||
293
293
  import { BUILD as BUILD19 } from "@stencil/core/internal/app-data";
294
294
 
295
295
  // src/runtime/client-hydrate.ts
296
- import { BUILD as BUILD7 } from "@stencil/core/internal/app-data";
296
+ import { BUILD as BUILD8 } from "@stencil/core/internal/app-data";
297
297
 
298
298
  // src/runtime/dom-extras.ts
299
299
  import { BUILD as BUILD4 } from "@stencil/core/internal/app-data";
@@ -819,6 +819,9 @@ var validNodesPatches = [
819
819
  "parentNode"
820
820
  ];
821
821
  function patchHostOriginalAccessor(accessorName, node) {
822
+ if (!globalThis.Node || !globalThis.Element) {
823
+ return;
824
+ }
822
825
  let accessor;
823
826
  if (validElementPatches.includes(accessorName)) {
824
827
  accessor = Object.getOwnPropertyDescriptor(Element.prototype, accessorName);
@@ -927,8 +930,133 @@ var installDevTools = () => {
927
930
  }
928
931
  };
929
932
 
930
- // src/runtime/vdom/h.ts
933
+ // src/runtime/styles.ts
931
934
  import { BUILD as BUILD6 } from "@stencil/core/internal/app-data";
935
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
936
+ var registerStyle = (scopeId2, cssText, allowCS) => {
937
+ let style = styles.get(scopeId2);
938
+ if (supportsConstructableStylesheets && allowCS) {
939
+ style = style || new CSSStyleSheet();
940
+ if (typeof style === "string") {
941
+ style = cssText;
942
+ } else {
943
+ style.replaceSync(cssText);
944
+ }
945
+ } else {
946
+ style = cssText;
947
+ }
948
+ styles.set(scopeId2, style);
949
+ };
950
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
951
+ var _a;
952
+ const scopeId2 = getScopeId(cmpMeta, mode);
953
+ const style = styles.get(scopeId2);
954
+ if (!BUILD6.attachStyles || !win.document) {
955
+ return scopeId2;
956
+ }
957
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
958
+ if (style) {
959
+ if (typeof style === "string") {
960
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
961
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
962
+ let styleElm;
963
+ if (!appliedStyles) {
964
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
965
+ }
966
+ if (!appliedStyles.has(scopeId2)) {
967
+ if (BUILD6.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
968
+ styleElm.innerHTML = style;
969
+ } else {
970
+ styleElm = win.document.createElement("style");
971
+ styleElm.innerHTML = style;
972
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
973
+ if (nonce != null) {
974
+ styleElm.setAttribute("nonce", nonce);
975
+ }
976
+ if ((BUILD6.hydrateServerSide || BUILD6.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) {
977
+ styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
978
+ }
979
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
980
+ if (styleContainerNode.nodeName === "HEAD") {
981
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
982
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
983
+ styleContainerNode.insertBefore(
984
+ styleElm,
985
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
986
+ );
987
+ } else if ("host" in styleContainerNode) {
988
+ if (supportsConstructableStylesheets) {
989
+ const stylesheet = new CSSStyleSheet();
990
+ stylesheet.replaceSync(style);
991
+ if (supportsMutableAdoptedStyleSheets) {
992
+ styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
993
+ } else {
994
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
995
+ }
996
+ } else {
997
+ const existingStyleContainer = styleContainerNode.querySelector("style");
998
+ if (existingStyleContainer) {
999
+ existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
1000
+ } else {
1001
+ styleContainerNode.prepend(styleElm);
1002
+ }
1003
+ }
1004
+ } else {
1005
+ styleContainerNode.append(styleElm);
1006
+ }
1007
+ }
1008
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1009
+ styleContainerNode.insertBefore(styleElm, null);
1010
+ }
1011
+ }
1012
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
1013
+ styleElm.innerHTML += SLOT_FB_CSS;
1014
+ }
1015
+ if (appliedStyles) {
1016
+ appliedStyles.add(scopeId2);
1017
+ }
1018
+ }
1019
+ } else if (BUILD6.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
1020
+ if (supportsMutableAdoptedStyleSheets) {
1021
+ styleContainerNode.adoptedStyleSheets.push(style);
1022
+ } else {
1023
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
1024
+ }
1025
+ }
1026
+ }
1027
+ return scopeId2;
1028
+ };
1029
+ var attachStyles = (hostRef) => {
1030
+ const cmpMeta = hostRef.$cmpMeta$;
1031
+ const elm = hostRef.$hostElement$;
1032
+ const flags = cmpMeta.$flags$;
1033
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
1034
+ const scopeId2 = addStyle(
1035
+ BUILD6.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
1036
+ cmpMeta,
1037
+ hostRef.$modeName$
1038
+ );
1039
+ if ((BUILD6.shadowDom || BUILD6.scoped) && BUILD6.cssAnnotations && flags & 10 /* needsScopedEncapsulation */) {
1040
+ elm["s-sc"] = scopeId2;
1041
+ elm.classList.add(scopeId2 + "-h");
1042
+ }
1043
+ endAttachStyles();
1044
+ };
1045
+ var getScopeId = (cmp, mode) => "sc-" + (BUILD6.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
1046
+ var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
1047
+ var hydrateScopedToShadow = () => {
1048
+ if (!win.document) {
1049
+ return;
1050
+ }
1051
+ const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
1052
+ let i2 = 0;
1053
+ for (; i2 < styles2.length; i2++) {
1054
+ registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
1055
+ }
1056
+ };
1057
+
1058
+ // src/runtime/vdom/h.ts
1059
+ import { BUILD as BUILD7 } from "@stencil/core/internal/app-data";
932
1060
  var h = (nodeName, vnodeData, ...children) => {
933
1061
  let child = null;
934
1062
  let key = null;
@@ -944,7 +1072,7 @@ var h = (nodeName, vnodeData, ...children) => {
944
1072
  } else if (child != null && typeof child !== "boolean") {
945
1073
  if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
946
1074
  child = String(child);
947
- } else if (BUILD6.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
1075
+ } else if (BUILD7.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
948
1076
  consoleDevError(`vNode passed as children has unexpected type.
949
1077
  Make sure it's using the correct h() function.
950
1078
  Empty objects can also be the cause, look for JSX comments that became objects.`);
@@ -960,28 +1088,28 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
960
1088
  };
961
1089
  walk(children);
962
1090
  if (vnodeData) {
963
- if (BUILD6.isDev && nodeName === "input") {
1091
+ if (BUILD7.isDev && nodeName === "input") {
964
1092
  validateInputProperties(vnodeData);
965
1093
  }
966
- if (BUILD6.vdomKey && vnodeData.key) {
1094
+ if (BUILD7.vdomKey && vnodeData.key) {
967
1095
  key = vnodeData.key;
968
1096
  }
969
- if (BUILD6.slotRelocation && vnodeData.name) {
1097
+ if (BUILD7.slotRelocation && vnodeData.name) {
970
1098
  slotName = vnodeData.name;
971
1099
  }
972
- if (BUILD6.vdomClass) {
1100
+ if (BUILD7.vdomClass) {
973
1101
  const classData = vnodeData.className || vnodeData.class;
974
1102
  if (classData) {
975
1103
  vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
976
1104
  }
977
1105
  }
978
1106
  }
979
- if (BUILD6.isDev && vNodeChildren.some(isHost)) {
1107
+ if (BUILD7.isDev && vNodeChildren.some(isHost)) {
980
1108
  consoleDevError(`The <Host> must be the single root component. Make sure:
981
1109
  - You are NOT using hostData() and <Host> in the same component.
982
1110
  - <Host> is used once, and it's the single root component of the render() function.`);
983
1111
  }
984
- if (BUILD6.vdomFunctional && typeof nodeName === "function") {
1112
+ if (BUILD7.vdomFunctional && typeof nodeName === "function") {
985
1113
  return nodeName(
986
1114
  vnodeData === null ? {} : vnodeData,
987
1115
  vNodeChildren,
@@ -993,10 +1121,10 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
993
1121
  if (vNodeChildren.length > 0) {
994
1122
  vnode.$children$ = vNodeChildren;
995
1123
  }
996
- if (BUILD6.vdomKey) {
1124
+ if (BUILD7.vdomKey) {
997
1125
  vnode.$key$ = key;
998
1126
  }
999
- if (BUILD6.slotRelocation) {
1127
+ if (BUILD7.slotRelocation) {
1000
1128
  vnode.$name$ = slotName;
1001
1129
  }
1002
1130
  return vnode;
@@ -1009,13 +1137,13 @@ var newVNode = (tag, text) => {
1009
1137
  $elm$: null,
1010
1138
  $children$: null
1011
1139
  };
1012
- if (BUILD6.vdomAttribute) {
1140
+ if (BUILD7.vdomAttribute) {
1013
1141
  vnode.$attrs$ = null;
1014
1142
  }
1015
- if (BUILD6.vdomKey) {
1143
+ if (BUILD7.vdomKey) {
1016
1144
  vnode.$key$ = null;
1017
1145
  }
1018
- if (BUILD6.slotRelocation) {
1146
+ if (BUILD7.slotRelocation) {
1019
1147
  vnode.$name$ = null;
1020
1148
  }
1021
1149
  return vnode;
@@ -1069,18 +1197,18 @@ var validateInputProperties = (inputElm) => {
1069
1197
 
1070
1198
  // src/runtime/client-hydrate.ts
1071
1199
  var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1072
- var _a;
1200
+ var _a, _b;
1073
1201
  const endHydrate = createTime("hydrateClient", tagName);
1074
1202
  const shadowRoot = hostElm.shadowRoot;
1075
1203
  const childRenderNodes = [];
1076
1204
  const slotNodes = [];
1077
1205
  const slottedNodes = [];
1078
- const shadowRootNodes = BUILD7.shadowDom && shadowRoot ? [] : null;
1206
+ const shadowRootNodes = BUILD8.shadowDom && shadowRoot ? [] : null;
1079
1207
  const vnode = newVNode(tagName, null);
1080
1208
  vnode.$elm$ = hostElm;
1081
1209
  const members = Object.entries(((_a = hostRef.$cmpMeta$) == null ? void 0 : _a.$members$) || {});
1082
1210
  members.forEach(([memberName, [memberFlags, metaAttributeName]]) => {
1083
- var _a2, _b;
1211
+ var _a2, _b2;
1084
1212
  if (!(memberFlags & 31 /* Prop */)) {
1085
1213
  return;
1086
1214
  }
@@ -1090,13 +1218,13 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1090
1218
  const attrPropVal = parsePropertyValue(
1091
1219
  attrVal,
1092
1220
  memberFlags,
1093
- BUILD7.formAssociated && !!(((_a2 = hostRef.$cmpMeta$) == null ? void 0 : _a2.$flags$) & 64 /* formAssociated */)
1221
+ BUILD8.formAssociated && !!(((_a2 = hostRef.$cmpMeta$) == null ? void 0 : _a2.$flags$) & 64 /* formAssociated */)
1094
1222
  );
1095
- (_b = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _b.set(memberName, attrPropVal);
1223
+ (_b2 = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _b2.set(memberName, attrPropVal);
1096
1224
  }
1097
1225
  });
1098
1226
  let scopeId2;
1099
- if (BUILD7.scoped) {
1227
+ if (BUILD8.scoped) {
1100
1228
  const cmpMeta = hostRef.$cmpMeta$;
1101
1229
  if (cmpMeta && cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */ && hostElm["s-sc"]) {
1102
1230
  scopeId2 = hostElm["s-sc"];
@@ -1133,6 +1261,16 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1133
1261
  if (childRenderNode.$tag$ === "slot") {
1134
1262
  node["s-cr"] = hostElm["s-cr"];
1135
1263
  }
1264
+ } else if (((_b = childRenderNode.$tag$) == null ? void 0 : _b.toString().includes("-")) && !childRenderNode.$elm$.shadowRoot) {
1265
+ const cmpMeta = getHostRef(childRenderNode.$elm$);
1266
+ const scopeId3 = getScopeId(
1267
+ cmpMeta.$cmpMeta$,
1268
+ BUILD8.mode ? childRenderNode.$elm$.getAttribute("s-mode") : void 0
1269
+ );
1270
+ const styleSheet = win.document.querySelector(`style[sty-id="${scopeId3}"]`);
1271
+ if (styleSheet) {
1272
+ hostElm.shadowRoot.append(styleSheet.cloneNode(true));
1273
+ }
1136
1274
  }
1137
1275
  if (childRenderNode.$tag$ === "slot") {
1138
1276
  childRenderNode.$name$ = childRenderNode.$elm$["s-sn"] || childRenderNode.$elm$["name"] || null;
@@ -1148,7 +1286,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1148
1286
  }
1149
1287
  }
1150
1288
  if (orgLocationNode && orgLocationNode.isConnected) {
1151
- if (shadowRoot && orgLocationNode["s-en"] === "") {
1289
+ if (orgLocationNode.parentElement.shadowRoot && orgLocationNode["s-en"] === "") {
1152
1290
  orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
1153
1291
  }
1154
1292
  orgLocationNode.parentNode.removeChild(orgLocationNode);
@@ -1156,7 +1294,9 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1156
1294
  node["s-oo"] = parseInt(childRenderNode.$nodeId$);
1157
1295
  }
1158
1296
  }
1159
- plt.$orgLocNodes$.delete(orgLocationId);
1297
+ if (orgLocationNode && !orgLocationNode["s-id"]) {
1298
+ plt.$orgLocNodes$.delete(orgLocationId);
1299
+ }
1160
1300
  }
1161
1301
  const hosts = [];
1162
1302
  const snLen = slottedNodes.length;
@@ -1178,14 +1318,16 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1178
1318
  if (!hosts[slottedItem.hostId]) continue;
1179
1319
  const hostEle = hosts[slottedItem.hostId];
1180
1320
  if (!hostEle.shadowRoot || !shadowRoot) {
1181
- slottedItem.slot["s-cr"] = hostEle["s-cr"];
1182
- if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
1183
- slottedItem.slot["s-cr"] = hostEle;
1184
- } else {
1185
- slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1321
+ if (!slottedItem.slot["s-cr"]) {
1322
+ slottedItem.slot["s-cr"] = hostEle["s-cr"];
1323
+ if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
1324
+ slottedItem.slot["s-cr"] = hostEle;
1325
+ } else {
1326
+ slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1327
+ }
1186
1328
  }
1187
1329
  addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
1188
- if (BUILD7.experimentalSlotFixes) {
1330
+ if (BUILD8.experimentalSlotFixes) {
1189
1331
  patchSlottedNode(slottedItem.node);
1190
1332
  }
1191
1333
  }
@@ -1194,12 +1336,12 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1194
1336
  }
1195
1337
  }
1196
1338
  }
1197
- if (BUILD7.scoped && scopeId2 && slotNodes.length) {
1339
+ if (BUILD8.scoped && scopeId2 && slotNodes.length) {
1198
1340
  slotNodes.forEach((slot) => {
1199
1341
  slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
1200
1342
  });
1201
1343
  }
1202
- if (BUILD7.shadowDom && shadowRoot && !shadowRoot.childNodes.length) {
1344
+ if (BUILD8.shadowDom && shadowRoot) {
1203
1345
  let rnIdex = 0;
1204
1346
  const rnLen = shadowRootNodes.length;
1205
1347
  if (rnLen) {
@@ -1210,14 +1352,13 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1210
1352
  if (typeof node["s-en"] !== "string" && typeof node["s-sn"] !== "string") {
1211
1353
  if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
1212
1354
  node.removeAttribute("hidden");
1213
- } else if (node.nodeType === 8 /* CommentNode */ || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1355
+ } else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1214
1356
  node.parentNode.removeChild(node);
1215
1357
  }
1216
1358
  }
1217
1359
  });
1218
1360
  }
1219
1361
  }
1220
- plt.$orgLocNodes$.delete(hostElm["s-id"]);
1221
1362
  hostRef.$hostElement$ = hostElm;
1222
1363
  endHydrate();
1223
1364
  };
@@ -1249,7 +1390,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1249
1390
  if (!parentVNode.$children$) {
1250
1391
  parentVNode.$children$ = [];
1251
1392
  }
1252
- if (BUILD7.scoped && scopeId2) {
1393
+ if (BUILD8.scoped && scopeId2 && childIdSplt[0] === hostId) {
1253
1394
  node["s-si"] = scopeId2;
1254
1395
  childVNode.$attrs$.class += " " + scopeId2;
1255
1396
  }
@@ -1267,7 +1408,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1267
1408
  shadowRootNodes,
1268
1409
  slottedNodes
1269
1410
  );
1270
- if (BUILD7.scoped && scopeId2) {
1411
+ if (BUILD8.scoped && scopeId2) {
1271
1412
  node.classList.add(scopeId2);
1272
1413
  }
1273
1414
  }
@@ -1364,9 +1505,9 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1364
1505
  slottedNodes
1365
1506
  );
1366
1507
  } else if (childNodeType === CONTENT_REF_ID) {
1367
- if (BUILD7.shadowDom && shadowRootNodes) {
1508
+ if (BUILD8.shadowDom && shadowRootNodes) {
1368
1509
  node.remove();
1369
- } else if (BUILD7.slotRelocation) {
1510
+ } else if (BUILD8.slotRelocation) {
1370
1511
  hostElm["s-cr"] = node;
1371
1512
  node["s-cn"] = true;
1372
1513
  }
@@ -1379,7 +1520,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1379
1520
  vnode.$index$ = "0";
1380
1521
  parentVNode.$children$ = [vnode];
1381
1522
  } else {
1382
- if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1523
+ if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim() && !node["s-nr"]) {
1383
1524
  node.remove();
1384
1525
  }
1385
1526
  }
@@ -1432,15 +1573,15 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1432
1573
  childVNode.$name$ = slotName || null;
1433
1574
  childVNode.$tag$ = "slot";
1434
1575
  const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
1435
- if (BUILD7.shadowDom && shadowRootNodes && win.document) {
1576
+ if (BUILD8.shadowDom && shadowRootNodes && win.document) {
1436
1577
  const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$);
1437
1578
  if (childVNode.$name$) {
1438
1579
  childVNode.$elm$.setAttribute("name", slotName);
1439
1580
  }
1440
- if (parentNodeId && parentNodeId !== childVNode.$hostId$) {
1441
- parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1581
+ if (parentVNode.$elm$.shadowRoot && parentNodeId && parentNodeId !== childVNode.$hostId$) {
1582
+ internalCall(parentVNode.$elm$, "insertBefore")(slot, internalCall(parentVNode.$elm$, "children")[0]);
1442
1583
  } else {
1443
- node.parentNode.insertBefore(slot, node);
1584
+ internalCall(internalCall(node, "parentNode"), "insertBefore")(slot, node);
1444
1585
  }
1445
1586
  addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
1446
1587
  node.remove();
@@ -1466,7 +1607,7 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1466
1607
  var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
1467
1608
  let slottedNode = slotNode.nextSibling;
1468
1609
  slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
1469
- while (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (slottedNode.nodeType === 8 /* CommentNode */ && slottedNode.nodeValue.indexOf(".") !== 1 || slottedNode.nodeType === 3 /* TextNode */))) {
1610
+ while (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (slottedNode.nodeType === 8 /* CommentNode */ || slottedNode.nodeType === 3 /* TextNode */ || slottedNode.tagName === "SLOT"))) {
1470
1611
  slottedNode["s-sn"] = slotName;
1471
1612
  slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
1472
1613
  slottedNode = slottedNode.nextSibling;
@@ -1901,31 +2042,31 @@ import { BUILD as BUILD17 } from "@stencil/core/internal/app-data";
1901
2042
  import { BUILD as BUILD16 } from "@stencil/core/internal/app-data";
1902
2043
 
1903
2044
  // src/runtime/parse-property-value.ts
1904
- import { BUILD as BUILD8 } from "@stencil/core/internal/app-data";
2045
+ import { BUILD as BUILD9 } from "@stencil/core/internal/app-data";
1905
2046
  var parsePropertyValue = (propValue, propType, isFormAssociated) => {
1906
- if ((BUILD8.hydrateClientSide || BUILD8.hydrateServerSide) && typeof propValue === "string" && (propValue.startsWith("{") && propValue.endsWith("}") || propValue.startsWith("[") && propValue.endsWith("]"))) {
2047
+ if ((BUILD9.hydrateClientSide || BUILD9.hydrateServerSide) && typeof propValue === "string" && (propValue.startsWith("{") && propValue.endsWith("}") || propValue.startsWith("[") && propValue.endsWith("]"))) {
1907
2048
  try {
1908
2049
  propValue = JSON.parse(propValue);
1909
2050
  return propValue;
1910
2051
  } catch (e) {
1911
2052
  }
1912
2053
  }
1913
- if ((BUILD8.hydrateClientSide || BUILD8.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2054
+ if ((BUILD9.hydrateClientSide || BUILD9.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
1914
2055
  propValue = deserializeProperty(propValue);
1915
2056
  return propValue;
1916
2057
  }
1917
2058
  if (propValue != null && !isComplexType(propValue)) {
1918
- if (BUILD8.propBoolean && propType & 4 /* Boolean */) {
1919
- if (BUILD8.formAssociated && isFormAssociated && typeof propValue === "string") {
2059
+ if (BUILD9.propBoolean && propType & 4 /* Boolean */) {
2060
+ if (BUILD9.formAssociated && isFormAssociated && typeof propValue === "string") {
1920
2061
  return propValue === "" || !!propValue;
1921
2062
  } else {
1922
2063
  return propValue === "false" ? false : propValue === "" || !!propValue;
1923
2064
  }
1924
2065
  }
1925
- if (BUILD8.propNumber && propType & 2 /* Number */) {
2066
+ if (BUILD9.propNumber && propType & 2 /* Number */) {
1926
2067
  return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
1927
2068
  }
1928
- if (BUILD8.propString && propType & 1 /* String */) {
2069
+ if (BUILD9.propString && propType & 1 /* String */) {
1929
2070
  return String(propValue);
1930
2071
  }
1931
2072
  return propValue;
@@ -1937,18 +2078,18 @@ var parsePropertyValue = (propValue, propType, isFormAssociated) => {
1937
2078
  import { BUILD as BUILD15, NAMESPACE } from "@stencil/core/internal/app-data";
1938
2079
 
1939
2080
  // src/runtime/event-emitter.ts
1940
- import { BUILD as BUILD10 } from "@stencil/core/internal/app-data";
2081
+ import { BUILD as BUILD11 } from "@stencil/core/internal/app-data";
1941
2082
 
1942
2083
  // src/runtime/element.ts
1943
- import { BUILD as BUILD9 } from "@stencil/core/internal/app-data";
1944
- var getElement = (ref) => BUILD9.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
2084
+ import { BUILD as BUILD10 } from "@stencil/core/internal/app-data";
2085
+ var getElement = (ref) => BUILD10.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
1945
2086
 
1946
2087
  // src/runtime/event-emitter.ts
1947
2088
  var createEvent = (ref, name, flags) => {
1948
2089
  const elm = getElement(ref);
1949
2090
  return {
1950
2091
  emit: (detail) => {
1951
- if (BUILD10.isDev && !elm.isConnected) {
2092
+ if (BUILD11.isDev && !elm.isConnected) {
1952
2093
  consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
1953
2094
  }
1954
2095
  return emitEvent(elm, name, {
@@ -1966,131 +2107,6 @@ var emitEvent = (elm, name, opts) => {
1966
2107
  return ev;
1967
2108
  };
1968
2109
 
1969
- // src/runtime/styles.ts
1970
- import { BUILD as BUILD11 } from "@stencil/core/internal/app-data";
1971
- var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
1972
- var registerStyle = (scopeId2, cssText, allowCS) => {
1973
- let style = styles.get(scopeId2);
1974
- if (supportsConstructableStylesheets && allowCS) {
1975
- style = style || new CSSStyleSheet();
1976
- if (typeof style === "string") {
1977
- style = cssText;
1978
- } else {
1979
- style.replaceSync(cssText);
1980
- }
1981
- } else {
1982
- style = cssText;
1983
- }
1984
- styles.set(scopeId2, style);
1985
- };
1986
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
1987
- var _a;
1988
- const scopeId2 = getScopeId(cmpMeta, mode);
1989
- const style = styles.get(scopeId2);
1990
- if (!BUILD11.attachStyles || !win.document) {
1991
- return scopeId2;
1992
- }
1993
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
1994
- if (style) {
1995
- if (typeof style === "string") {
1996
- styleContainerNode = styleContainerNode.head || styleContainerNode;
1997
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
1998
- let styleElm;
1999
- if (!appliedStyles) {
2000
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
2001
- }
2002
- if (!appliedStyles.has(scopeId2)) {
2003
- if (BUILD11.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
2004
- styleElm.innerHTML = style;
2005
- } else {
2006
- styleElm = win.document.createElement("style");
2007
- styleElm.innerHTML = style;
2008
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
2009
- if (nonce != null) {
2010
- styleElm.setAttribute("nonce", nonce);
2011
- }
2012
- if ((BUILD11.hydrateServerSide || BUILD11.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) {
2013
- styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
2014
- }
2015
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
2016
- if (styleContainerNode.nodeName === "HEAD") {
2017
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
2018
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
2019
- styleContainerNode.insertBefore(
2020
- styleElm,
2021
- (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
2022
- );
2023
- } else if ("host" in styleContainerNode) {
2024
- if (supportsConstructableStylesheets) {
2025
- const stylesheet = new CSSStyleSheet();
2026
- stylesheet.replaceSync(style);
2027
- if (supportsMutableAdoptedStyleSheets) {
2028
- styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
2029
- } else {
2030
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
2031
- }
2032
- } else {
2033
- const existingStyleContainer = styleContainerNode.querySelector("style");
2034
- if (existingStyleContainer) {
2035
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
2036
- } else {
2037
- styleContainerNode.prepend(styleElm);
2038
- }
2039
- }
2040
- } else {
2041
- styleContainerNode.append(styleElm);
2042
- }
2043
- }
2044
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2045
- styleContainerNode.insertBefore(styleElm, null);
2046
- }
2047
- }
2048
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
2049
- styleElm.innerHTML += SLOT_FB_CSS;
2050
- }
2051
- if (appliedStyles) {
2052
- appliedStyles.add(scopeId2);
2053
- }
2054
- }
2055
- } else if (BUILD11.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
2056
- if (supportsMutableAdoptedStyleSheets) {
2057
- styleContainerNode.adoptedStyleSheets.push(style);
2058
- } else {
2059
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
2060
- }
2061
- }
2062
- }
2063
- return scopeId2;
2064
- };
2065
- var attachStyles = (hostRef) => {
2066
- const cmpMeta = hostRef.$cmpMeta$;
2067
- const elm = hostRef.$hostElement$;
2068
- const flags = cmpMeta.$flags$;
2069
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
2070
- const scopeId2 = addStyle(
2071
- BUILD11.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
2072
- cmpMeta,
2073
- hostRef.$modeName$
2074
- );
2075
- if ((BUILD11.shadowDom || BUILD11.scoped) && BUILD11.cssAnnotations && flags & 10 /* needsScopedEncapsulation */) {
2076
- elm["s-sc"] = scopeId2;
2077
- elm.classList.add(scopeId2 + "-h");
2078
- }
2079
- endAttachStyles();
2080
- };
2081
- var getScopeId = (cmp, mode) => "sc-" + (BUILD11.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
2082
- var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
2083
- var hydrateScopedToShadow = () => {
2084
- if (!win.document) {
2085
- return;
2086
- }
2087
- const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2088
- let i2 = 0;
2089
- for (; i2 < styles2.length; i2++) {
2090
- registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
2091
- }
2092
- };
2093
-
2094
2110
  // src/runtime/vdom/vdom-render.ts
2095
2111
  import { BUILD as BUILD14 } from "@stencil/core/internal/app-data";
2096
2112
 
@@ -2109,12 +2125,13 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
2109
2125
  const classList = elm.classList;
2110
2126
  const oldClasses = parseClassList(oldValue);
2111
2127
  let newClasses = parseClassList(newValue);
2112
- if (BUILD12.hydrateClientSide && elm["s-si"] && initialRender) {
2113
- newClasses.push(elm["s-si"]);
2128
+ if (BUILD12.hydrateClientSide && (elm["s-si"] || elm["s-sc"]) && initialRender) {
2129
+ const scopeId2 = elm["s-sc"] || elm["s-si"];
2130
+ newClasses.push(scopeId2);
2114
2131
  oldClasses.forEach((c) => {
2115
- if (c.startsWith(elm["s-si"])) newClasses.push(c);
2132
+ if (c.startsWith(scopeId2)) newClasses.push(c);
2116
2133
  });
2117
- newClasses = [...new Set(newClasses)];
2134
+ newClasses = [...new Set(newClasses)].filter((c) => c);
2118
2135
  classList.add(...newClasses);
2119
2136
  } else {
2120
2137
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
@@ -3065,10 +3082,16 @@ var forceUpdate = (ref) => {
3065
3082
  return false;
3066
3083
  };
3067
3084
  var appDidLoad = (who) => {
3085
+ var _a;
3068
3086
  if (BUILD15.asyncQueue) {
3069
3087
  plt.$flags$ |= 2 /* appLoaded */;
3070
3088
  }
3071
3089
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
3090
+ if (BUILD15.hydrateClientSide) {
3091
+ if ((_a = plt.$orgLocNodes$) == null ? void 0 : _a.size) {
3092
+ plt.$orgLocNodes$.clear();
3093
+ }
3094
+ }
3072
3095
  if (BUILD15.profile && performance.measure) {
3073
3096
  performance.measure(`[Stencil] ${NAMESPACE} initial load (by ${who})`, "st:app:start");
3074
3097
  }
@@ -3500,6 +3523,11 @@ var connectedCallback = (elm) => {
3500
3523
  if (BUILD19.hydrateServerSide || (BUILD19.slot || BUILD19.shadowDom) && // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
3501
3524
  cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
3502
3525
  setContentReference(elm);
3526
+ } else if (BUILD19.hydrateClientSide && !(cmpMeta.$flags$ & 4 /* hasSlotRelocation */)) {
3527
+ const commendPlaceholder = elm.firstChild;
3528
+ if ((commendPlaceholder == null ? void 0 : commendPlaceholder.nodeType) === 8 /* CommentNode */ && !commendPlaceholder["s-cn"] && !commendPlaceholder.nodeValue) {
3529
+ elm.removeChild(commendPlaceholder);
3530
+ }
3503
3531
  }
3504
3532
  }
3505
3533
  if (BUILD19.asyncLoading) {
@@ -3604,7 +3632,7 @@ var proxyCustomElement = (Cstr, compactMeta) => {
3604
3632
  cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
3605
3633
  }
3606
3634
  if (BUILD21.experimentalSlotFixes) {
3607
- if (BUILD21.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
3635
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
3608
3636
  patchPseudoShadowDom(Cstr.prototype);
3609
3637
  }
3610
3638
  } else {
@@ -3821,7 +3849,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3821
3849
  }
3822
3850
  };
3823
3851
  if (BUILD22.experimentalSlotFixes) {
3824
- if (BUILD22.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
3852
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
3825
3853
  patchPseudoShadowDom(HostElement.prototype);
3826
3854
  }
3827
3855
  } else {