@stencil/core 4.18.0-dev.1715576505.d345412 → 4.18.1-dev.1715662900.e420eb6

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/app-data",
3
- "version": "4.18.0-dev.1715576505.d345412",
3
+ "version": "4.18.1-dev.1715662900.e420eb6",
4
4
  "description": "Used for default app data and build conditionals within builds.",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Client Platform v4.18.0-dev.1715576505.d345412 | MIT Licensed | https://stenciljs.com
2
+ Stencil Client Platform v4.18.1-dev.1715662900.e420eb6 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -833,7 +833,7 @@ var checkSlotFallbackVisibility = false;
833
833
  var checkSlotRelocate = false;
834
834
  var isSvgMode = false;
835
835
  var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
836
- var _a, _b, _c, _d;
836
+ var _a;
837
837
  const newVNode2 = newParentVNode.$children$[childIndex];
838
838
  let i2 = 0;
839
839
  let elm;
@@ -885,13 +885,6 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
885
885
  if ((BUILD11.shadowDom || BUILD11.scoped) && isDef(scopeId) && elm["s-si"] !== scopeId) {
886
886
  elm.classList.add(elm["s-si"] = scopeId);
887
887
  }
888
- if (BUILD11.scoped) {
889
- const rootScopeId = ((_a = newParentVNode.$elm$) == null ? void 0 : _a["s-rsc"]) || ((_b = newParentVNode.$elm$) == null ? void 0 : _b["s-si"]) || ((_c = newParentVNode.$elm$) == null ? void 0 : _c["s-sc"]);
890
- if (rootScopeId) {
891
- elm["s-rsc"] = rootScopeId;
892
- !elm.classList.contains(rootScopeId) && elm.classList.add(rootScopeId);
893
- }
894
- }
895
888
  if (newVNode2.$children$) {
896
889
  for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
897
890
  childNode = createElm(oldParentVNode, newVNode2, i2, elm);
@@ -914,7 +907,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
914
907
  elm["s-sr"] = true;
915
908
  elm["s-cr"] = contentRef;
916
909
  elm["s-sn"] = newVNode2.$name$ || "";
917
- elm["s-rf"] = (_d = newVNode2.$attrs$) == null ? void 0 : _d.ref;
910
+ elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
918
911
  oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
919
912
  if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
920
913
  if (BUILD11.experimentalSlotFixes) {
@@ -935,7 +928,7 @@ var relocateToHostRoot = (parentElm) => {
935
928
  const childNodeArray = Array.from(parentElm.childNodes);
936
929
  for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
937
930
  if (childNode["s-sh"] != null) {
938
- host.insertBefore(childNode, contentRefNode != null ? contentRefNode : null);
931
+ insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
939
932
  childNode["s-sh"] = void 0;
940
933
  checkSlotRelocate = true;
941
934
  }
@@ -957,7 +950,7 @@ var putBackInOriginalLocation = (parentElm, recursive) => {
957
950
  for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
958
951
  const childNode = oldSlotChildNodes[i2];
959
952
  if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
960
- parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
953
+ insertBefore(parentReferenceNode(childNode), childNode, referenceNode(childNode));
961
954
  childNode["s-ol"].remove();
962
955
  childNode["s-ol"] = void 0;
963
956
  childNode["s-sh"] = void 0;
@@ -980,7 +973,7 @@ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
980
973
  childNode = createElm(null, parentVNode, startIdx, parentElm);
981
974
  if (childNode) {
982
975
  vnodes[startIdx].$elm$ = childNode;
983
- containerElm.insertBefore(childNode, BUILD11.slotRelocation ? referenceNode(before) : before);
976
+ insertBefore(containerElm, childNode, BUILD11.slotRelocation ? referenceNode(before) : before);
984
977
  }
985
978
  }
986
979
  }
@@ -1040,7 +1033,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
1040
1033
  putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
1041
1034
  }
1042
1035
  patch(oldStartVnode, newEndVnode, isInitialRender);
1043
- parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
1036
+ insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
1044
1037
  oldStartVnode = oldCh[++oldStartIdx];
1045
1038
  newEndVnode = newCh[--newEndIdx];
1046
1039
  } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
@@ -1048,7 +1041,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
1048
1041
  putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
1049
1042
  }
1050
1043
  patch(oldEndVnode, newStartVnode, isInitialRender);
1051
- parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
1044
+ insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
1052
1045
  oldEndVnode = oldCh[--oldEndIdx];
1053
1046
  newStartVnode = newCh[++newStartIdx];
1054
1047
  } else {
@@ -1077,9 +1070,9 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
1077
1070
  }
1078
1071
  if (node) {
1079
1072
  if (BUILD11.slotRelocation) {
1080
- parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
1073
+ insertBefore(parentReferenceNode(oldStartVnode.$elm$), node, referenceNode(oldStartVnode.$elm$));
1081
1074
  } else {
1082
- oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
1075
+ insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
1083
1076
  }
1084
1077
  }
1085
1078
  }
@@ -1250,6 +1243,28 @@ var nullifyVNodeRefs = (vNode) => {
1250
1243
  vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
1251
1244
  }
1252
1245
  };
1246
+ var insertBefore = (parent, newNode, reference) => {
1247
+ const inserted = parent == null ? void 0 : parent.insertBefore(newNode, reference);
1248
+ if (BUILD11.scoped) {
1249
+ setParentScopeIdAsClassName(newNode, parent);
1250
+ }
1251
+ return inserted;
1252
+ };
1253
+ var findParentScopeId = (element) => {
1254
+ return element ? element["s-rsc"] || element["s-si"] || element["s-sc"] || findParentScopeId(element.parentElement) : void 0;
1255
+ };
1256
+ var setParentScopeIdAsClassName = (element, parent) => {
1257
+ var _a, _b, _c;
1258
+ if (element && parent) {
1259
+ const oldRootScopeId = element["s-rsc"];
1260
+ const newRootScopeId = findParentScopeId(parent);
1261
+ oldRootScopeId && ((_a = element.classList) == null ? void 0 : _a.contains(oldRootScopeId)) && element.classList.remove(oldRootScopeId);
1262
+ if (newRootScopeId) {
1263
+ element["s-rsc"] = newRootScopeId;
1264
+ !((_b = element.classList) == null ? void 0 : _b.contains(newRootScopeId)) && ((_c = element.classList) == null ? void 0 : _c.add(newRootScopeId));
1265
+ }
1266
+ }
1267
+ };
1253
1268
  var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1254
1269
  var _a, _b, _c, _d, _e;
1255
1270
  const hostElm = hostRef.$hostElement$;
@@ -1306,7 +1321,7 @@ render() {
1306
1321
  if (!nodeToRelocate["s-ol"]) {
1307
1322
  const orgLocationNode = BUILD11.isDebug || BUILD11.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode("");
1308
1323
  orgLocationNode["s-nr"] = nodeToRelocate;
1309
- nodeToRelocate.parentNode.insertBefore(nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
1324
+ insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
1310
1325
  }
1311
1326
  }
1312
1327
  for (const relocateData of relocateNodes) {
@@ -1337,7 +1352,7 @@ render() {
1337
1352
  if (!BUILD11.experimentalSlotFixes && !nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
1338
1353
  nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
1339
1354
  }
1340
- parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
1355
+ insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
1341
1356
  if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1342
1357
  nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false;
1343
1358
  }
@@ -1976,7 +1991,7 @@ var setContentReference = (elm) => {
1976
1991
  BUILD16.isDebug ? `content-ref (host=${elm.localName})` : ""
1977
1992
  );
1978
1993
  contentRefElm["s-cn"] = true;
1979
- elm.insertBefore(contentRefElm, elm.firstChild);
1994
+ insertBefore(elm, contentRefElm, elm.firstChild);
1980
1995
  };
1981
1996
 
1982
1997
  // src/runtime/disconnected-callback.ts
@@ -2045,7 +2060,8 @@ var patchCloneNode = (HostElementPrototype) => {
2045
2060
  "s-ol",
2046
2061
  "s-nr",
2047
2062
  "s-si",
2048
- "s-rf"
2063
+ "s-rf",
2064
+ "s-rsc"
2049
2065
  ];
2050
2066
  for (; i2 < srcNode.childNodes.length; i2++) {
2051
2067
  slotted = srcNode.childNodes[i2]["s-nr"];
@@ -2073,7 +2089,7 @@ var patchSlotAppendChild = (HostElementPrototype) => {
2073
2089
  if (slotNode) {
2074
2090
  const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
2075
2091
  const appendAfter = slotChildNodes[slotChildNodes.length - 1];
2076
- const insertedNode = appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
2092
+ const insertedNode = insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
2077
2093
  updateFallbackSlotVisibility(this);
2078
2094
  return insertedNode;
2079
2095
  }
@@ -2114,7 +2130,7 @@ var patchSlotPrepend = (HostElementPrototype) => {
2114
2130
  newChild["s-ol"] = slotPlaceholder;
2115
2131
  const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
2116
2132
  const appendAfter = slotChildNodes[0];
2117
- return appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
2133
+ return insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
2118
2134
  }
2119
2135
  if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
2120
2136
  newChild.hidden = true;
@@ -2212,7 +2228,7 @@ var patchTextContent = (hostElementPrototype) => {
2212
2228
  if (node["s-sn"] === "") {
2213
2229
  const textNode = this.ownerDocument.createTextNode(value);
2214
2230
  textNode["s-sn"] = "";
2215
- node.parentElement.insertBefore(textNode, node.nextSibling);
2231
+ insertBefore(node.parentElement, textNode, node.nextSibling);
2216
2232
  } else {
2217
2233
  node.remove();
2218
2234
  }
@@ -2243,7 +2259,7 @@ var patchTextContent = (hostElementPrototype) => {
2243
2259
  this.__textContent = value;
2244
2260
  const contentRefElm = this["s-cr"];
2245
2261
  if (contentRefElm) {
2246
- this.insertBefore(contentRefElm, this.firstChild);
2262
+ insertBefore(this, contentRefElm, this.firstChild);
2247
2263
  }
2248
2264
  }
2249
2265
  }
@@ -2637,14 +2653,10 @@ var hostListenerProxy = (hostRef, methodName) => (ev) => {
2637
2653
  }
2638
2654
  };
2639
2655
  var getHostListenerTarget = (elm, flags) => {
2640
- if (BUILD21.hostListenerTargetDocument && flags & 4 /* TargetDocument */)
2641
- return doc;
2642
- if (BUILD21.hostListenerTargetWindow && flags & 8 /* TargetWindow */)
2643
- return win;
2644
- if (BUILD21.hostListenerTargetBody && flags & 16 /* TargetBody */)
2645
- return doc.body;
2646
- if (BUILD21.hostListenerTargetParent && flags & 32 /* TargetParent */)
2647
- return elm.parentElement;
2656
+ if (BUILD21.hostListenerTargetDocument && flags & 4 /* TargetDocument */) return doc;
2657
+ if (BUILD21.hostListenerTargetWindow && flags & 8 /* TargetWindow */) return win;
2658
+ if (BUILD21.hostListenerTargetBody && flags & 16 /* TargetBody */) return doc.body;
2659
+ if (BUILD21.hostListenerTargetParent && flags & 32 /* TargetParent */) return elm.parentElement;
2648
2660
  return elm;
2649
2661
  };
2650
2662
  var hostListenerOpts = (flags) => supportsListenerOptions ? {
@@ -2669,7 +2681,7 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
2669
2681
  const orgLocationNodes = [];
2670
2682
  parseVNodeAnnotations(doc2, doc2.body, docData, orgLocationNodes);
2671
2683
  orgLocationNodes.forEach((orgLocationNode) => {
2672
- var _a, _b;
2684
+ var _a;
2673
2685
  if (orgLocationNode != null && orgLocationNode["s-nr"]) {
2674
2686
  const nodeRef = orgLocationNode["s-nr"];
2675
2687
  let hostId = nodeRef["s-host-id"];
@@ -2692,7 +2704,7 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
2692
2704
  }
2693
2705
  const commentBeforeTextNode = doc2.createComment(childId);
2694
2706
  commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
2695
- (_b = nodeRef.parentNode) == null ? void 0 : _b.insertBefore(commentBeforeTextNode, nodeRef);
2707
+ insertBefore(nodeRef.parentNode, commentBeforeTextNode, nodeRef);
2696
2708
  }
2697
2709
  }
2698
2710
  let orgLocationNodeId = `${ORG_LOCATION_ID}.${childId}`;
@@ -2777,7 +2789,7 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
2777
2789
  if (nodeName !== "STYLE" && nodeName !== "SCRIPT") {
2778
2790
  const textNodeId = `${TEXT_NODE_ID}.${childId}`;
2779
2791
  const commentBeforeTextNode = doc2.createComment(textNodeId);
2780
- parentNode == null ? void 0 : parentNode.insertBefore(commentBeforeTextNode, childElm);
2792
+ insertBefore(parentNode, commentBeforeTextNode, childElm);
2781
2793
  }
2782
2794
  } else if (childElm.nodeType === 8 /* CommentNode */) {
2783
2795
  if (childElm["s-sr"]) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/client",
3
- "version": "4.18.0-dev.1715576505.d345412",
3
+ "version": "4.18.1-dev.1715662900.e420eb6",
4
4
  "description": "Stencil internal client platform to be imported by the Stencil Compiler and internal runtime. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "private": true,
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Client Patch Browser v4.18.0-dev.1715576505.d345412 | MIT Licensed | https://stenciljs.com
2
+ Stencil Client Patch Browser v4.18.1-dev.1715662900.e420eb6 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
 
5
5
  // src/client/client-patch-browser.ts
@@ -136,8 +136,7 @@ var convertColonRule = (cssText, regExp, partReplacer) => {
136
136
  const r = [];
137
137
  for (let i = 0; i < parts.length; i++) {
138
138
  const p = parts[i].trim();
139
- if (!p)
140
- break;
139
+ if (!p) break;
141
140
  r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
142
141
  }
143
142
  return r.join(",");
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Hydrate Platform v4.18.0-dev.1715576505.d345412 | MIT Licensed | https://stenciljs.com
2
+ Stencil Hydrate Platform v4.18.1-dev.1715662900.e420eb6 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -822,7 +822,7 @@ var checkSlotFallbackVisibility = false;
822
822
  var checkSlotRelocate = false;
823
823
  var isSvgMode = false;
824
824
  var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
825
- var _a, _b, _c, _d;
825
+ var _a;
826
826
  const newVNode2 = newParentVNode.$children$[childIndex];
827
827
  let i2 = 0;
828
828
  let elm;
@@ -874,13 +874,6 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
874
874
  if ((BUILD10.shadowDom || BUILD10.scoped) && isDef(scopeId) && elm["s-si"] !== scopeId) {
875
875
  elm.classList.add(elm["s-si"] = scopeId);
876
876
  }
877
- if (BUILD10.scoped) {
878
- const rootScopeId = ((_a = newParentVNode.$elm$) == null ? void 0 : _a["s-rsc"]) || ((_b = newParentVNode.$elm$) == null ? void 0 : _b["s-si"]) || ((_c = newParentVNode.$elm$) == null ? void 0 : _c["s-sc"]);
879
- if (rootScopeId) {
880
- elm["s-rsc"] = rootScopeId;
881
- !elm.classList.contains(rootScopeId) && elm.classList.add(rootScopeId);
882
- }
883
- }
884
877
  if (newVNode2.$children$) {
885
878
  for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
886
879
  childNode = createElm(oldParentVNode, newVNode2, i2, elm);
@@ -903,7 +896,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
903
896
  elm["s-sr"] = true;
904
897
  elm["s-cr"] = contentRef;
905
898
  elm["s-sn"] = newVNode2.$name$ || "";
906
- elm["s-rf"] = (_d = newVNode2.$attrs$) == null ? void 0 : _d.ref;
899
+ elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
907
900
  oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
908
901
  if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
909
902
  if (BUILD10.experimentalSlotFixes) {
@@ -924,7 +917,7 @@ var relocateToHostRoot = (parentElm) => {
924
917
  const childNodeArray = Array.from(parentElm.childNodes);
925
918
  for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
926
919
  if (childNode["s-sh"] != null) {
927
- host.insertBefore(childNode, contentRefNode != null ? contentRefNode : null);
920
+ insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
928
921
  childNode["s-sh"] = void 0;
929
922
  checkSlotRelocate = true;
930
923
  }
@@ -946,7 +939,7 @@ var putBackInOriginalLocation = (parentElm, recursive) => {
946
939
  for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
947
940
  const childNode = oldSlotChildNodes[i2];
948
941
  if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
949
- parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
942
+ insertBefore(parentReferenceNode(childNode), childNode, referenceNode(childNode));
950
943
  childNode["s-ol"].remove();
951
944
  childNode["s-ol"] = void 0;
952
945
  childNode["s-sh"] = void 0;
@@ -969,7 +962,7 @@ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
969
962
  childNode = createElm(null, parentVNode, startIdx, parentElm);
970
963
  if (childNode) {
971
964
  vnodes[startIdx].$elm$ = childNode;
972
- containerElm.insertBefore(childNode, BUILD10.slotRelocation ? referenceNode(before) : before);
965
+ insertBefore(containerElm, childNode, BUILD10.slotRelocation ? referenceNode(before) : before);
973
966
  }
974
967
  }
975
968
  }
@@ -1029,7 +1022,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
1029
1022
  putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
1030
1023
  }
1031
1024
  patch(oldStartVnode, newEndVnode, isInitialRender);
1032
- parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
1025
+ insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
1033
1026
  oldStartVnode = oldCh[++oldStartIdx];
1034
1027
  newEndVnode = newCh[--newEndIdx];
1035
1028
  } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
@@ -1037,7 +1030,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
1037
1030
  putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
1038
1031
  }
1039
1032
  patch(oldEndVnode, newStartVnode, isInitialRender);
1040
- parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
1033
+ insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
1041
1034
  oldEndVnode = oldCh[--oldEndIdx];
1042
1035
  newStartVnode = newCh[++newStartIdx];
1043
1036
  } else {
@@ -1066,9 +1059,9 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
1066
1059
  }
1067
1060
  if (node) {
1068
1061
  if (BUILD10.slotRelocation) {
1069
- parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
1062
+ insertBefore(parentReferenceNode(oldStartVnode.$elm$), node, referenceNode(oldStartVnode.$elm$));
1070
1063
  } else {
1071
- oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
1064
+ insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
1072
1065
  }
1073
1066
  }
1074
1067
  }
@@ -1239,6 +1232,28 @@ var nullifyVNodeRefs = (vNode) => {
1239
1232
  vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
1240
1233
  }
1241
1234
  };
1235
+ var insertBefore = (parent, newNode, reference) => {
1236
+ const inserted = parent == null ? void 0 : parent.insertBefore(newNode, reference);
1237
+ if (BUILD10.scoped) {
1238
+ setParentScopeIdAsClassName(newNode, parent);
1239
+ }
1240
+ return inserted;
1241
+ };
1242
+ var findParentScopeId = (element) => {
1243
+ return element ? element["s-rsc"] || element["s-si"] || element["s-sc"] || findParentScopeId(element.parentElement) : void 0;
1244
+ };
1245
+ var setParentScopeIdAsClassName = (element, parent) => {
1246
+ var _a, _b, _c;
1247
+ if (element && parent) {
1248
+ const oldRootScopeId = element["s-rsc"];
1249
+ const newRootScopeId = findParentScopeId(parent);
1250
+ oldRootScopeId && ((_a = element.classList) == null ? void 0 : _a.contains(oldRootScopeId)) && element.classList.remove(oldRootScopeId);
1251
+ if (newRootScopeId) {
1252
+ element["s-rsc"] = newRootScopeId;
1253
+ !((_b = element.classList) == null ? void 0 : _b.contains(newRootScopeId)) && ((_c = element.classList) == null ? void 0 : _c.add(newRootScopeId));
1254
+ }
1255
+ }
1256
+ };
1242
1257
  var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1243
1258
  var _a, _b, _c, _d, _e;
1244
1259
  const hostElm = hostRef.$hostElement$;
@@ -1295,7 +1310,7 @@ render() {
1295
1310
  if (!nodeToRelocate["s-ol"]) {
1296
1311
  const orgLocationNode = BUILD10.isDebug || BUILD10.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode("");
1297
1312
  orgLocationNode["s-nr"] = nodeToRelocate;
1298
- nodeToRelocate.parentNode.insertBefore(nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
1313
+ insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
1299
1314
  }
1300
1315
  }
1301
1316
  for (const relocateData of relocateNodes) {
@@ -1326,7 +1341,7 @@ render() {
1326
1341
  if (!BUILD10.experimentalSlotFixes && !nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
1327
1342
  nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
1328
1343
  }
1329
- parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
1344
+ insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
1330
1345
  if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1331
1346
  nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false;
1332
1347
  }
@@ -1965,7 +1980,7 @@ var setContentReference = (elm) => {
1965
1980
  BUILD15.isDebug ? `content-ref (host=${elm.localName})` : ""
1966
1981
  );
1967
1982
  contentRefElm["s-cn"] = true;
1968
- elm.insertBefore(contentRefElm, elm.firstChild);
1983
+ insertBefore(elm, contentRefElm, elm.firstChild);
1969
1984
  };
1970
1985
 
1971
1986
  // src/runtime/disconnected-callback.ts
@@ -2034,7 +2049,8 @@ var patchCloneNode = (HostElementPrototype) => {
2034
2049
  "s-ol",
2035
2050
  "s-nr",
2036
2051
  "s-si",
2037
- "s-rf"
2052
+ "s-rf",
2053
+ "s-rsc"
2038
2054
  ];
2039
2055
  for (; i2 < srcNode.childNodes.length; i2++) {
2040
2056
  slotted = srcNode.childNodes[i2]["s-nr"];
@@ -2062,7 +2078,7 @@ var patchSlotAppendChild = (HostElementPrototype) => {
2062
2078
  if (slotNode) {
2063
2079
  const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
2064
2080
  const appendAfter = slotChildNodes[slotChildNodes.length - 1];
2065
- const insertedNode = appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
2081
+ const insertedNode = insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
2066
2082
  updateFallbackSlotVisibility(this);
2067
2083
  return insertedNode;
2068
2084
  }
@@ -2103,7 +2119,7 @@ var patchSlotPrepend = (HostElementPrototype) => {
2103
2119
  newChild["s-ol"] = slotPlaceholder;
2104
2120
  const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
2105
2121
  const appendAfter = slotChildNodes[0];
2106
- return appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
2122
+ return insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
2107
2123
  }
2108
2124
  if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
2109
2125
  newChild.hidden = true;
@@ -2201,7 +2217,7 @@ var patchTextContent = (hostElementPrototype) => {
2201
2217
  if (node["s-sn"] === "") {
2202
2218
  const textNode = this.ownerDocument.createTextNode(value);
2203
2219
  textNode["s-sn"] = "";
2204
- node.parentElement.insertBefore(textNode, node.nextSibling);
2220
+ insertBefore(node.parentElement, textNode, node.nextSibling);
2205
2221
  } else {
2206
2222
  node.remove();
2207
2223
  }
@@ -2232,7 +2248,7 @@ var patchTextContent = (hostElementPrototype) => {
2232
2248
  this.__textContent = value;
2233
2249
  const contentRefElm = this["s-cr"];
2234
2250
  if (contentRefElm) {
2235
- this.insertBefore(contentRefElm, this.firstChild);
2251
+ insertBefore(this, contentRefElm, this.firstChild);
2236
2252
  }
2237
2253
  }
2238
2254
  }
@@ -2626,14 +2642,10 @@ var hostListenerProxy = (hostRef, methodName) => (ev) => {
2626
2642
  }
2627
2643
  };
2628
2644
  var getHostListenerTarget = (elm, flags) => {
2629
- if (BUILD20.hostListenerTargetDocument && flags & 4 /* TargetDocument */)
2630
- return doc;
2631
- if (BUILD20.hostListenerTargetWindow && flags & 8 /* TargetWindow */)
2632
- return win;
2633
- if (BUILD20.hostListenerTargetBody && flags & 16 /* TargetBody */)
2634
- return doc.body;
2635
- if (BUILD20.hostListenerTargetParent && flags & 32 /* TargetParent */)
2636
- return elm.parentElement;
2645
+ if (BUILD20.hostListenerTargetDocument && flags & 4 /* TargetDocument */) return doc;
2646
+ if (BUILD20.hostListenerTargetWindow && flags & 8 /* TargetWindow */) return win;
2647
+ if (BUILD20.hostListenerTargetBody && flags & 16 /* TargetBody */) return doc.body;
2648
+ if (BUILD20.hostListenerTargetParent && flags & 32 /* TargetParent */) return elm.parentElement;
2637
2649
  return elm;
2638
2650
  };
2639
2651
  var hostListenerOpts = (flags) => supportsListenerOptions ? {
@@ -2655,7 +2667,7 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
2655
2667
  const orgLocationNodes = [];
2656
2668
  parseVNodeAnnotations(doc2, doc2.body, docData, orgLocationNodes);
2657
2669
  orgLocationNodes.forEach((orgLocationNode) => {
2658
- var _a, _b;
2670
+ var _a;
2659
2671
  if (orgLocationNode != null && orgLocationNode["s-nr"]) {
2660
2672
  const nodeRef = orgLocationNode["s-nr"];
2661
2673
  let hostId = nodeRef["s-host-id"];
@@ -2678,7 +2690,7 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
2678
2690
  }
2679
2691
  const commentBeforeTextNode = doc2.createComment(childId);
2680
2692
  commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
2681
- (_b = nodeRef.parentNode) == null ? void 0 : _b.insertBefore(commentBeforeTextNode, nodeRef);
2693
+ insertBefore(nodeRef.parentNode, commentBeforeTextNode, nodeRef);
2682
2694
  }
2683
2695
  }
2684
2696
  let orgLocationNodeId = `${ORG_LOCATION_ID}.${childId}`;
@@ -2763,7 +2775,7 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
2763
2775
  if (nodeName !== "STYLE" && nodeName !== "SCRIPT") {
2764
2776
  const textNodeId = `${TEXT_NODE_ID}.${childId}`;
2765
2777
  const commentBeforeTextNode = doc2.createComment(textNodeId);
2766
- parentNode == null ? void 0 : parentNode.insertBefore(commentBeforeTextNode, childElm);
2778
+ insertBefore(parentNode, commentBeforeTextNode, childElm);
2767
2779
  }
2768
2780
  } else if (childElm.nodeType === 8 /* CommentNode */) {
2769
2781
  if (childElm["s-sr"]) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/hydrate",
3
- "version": "4.18.0-dev.1715576505.d345412",
3
+ "version": "4.18.1-dev.1715662900.e420eb6",
4
4
  "description": "Stencil internal hydrate platform to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "private": true