@stencil/core 4.35.1-dev.1750455125.b359bb3 → 4.35.1-dev.1750741417.3f80413

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.1-dev.1750455125.b359bb3 | MIT Licensed | https://stenciljs.com
2
+ Stencil Hydrate Platform v4.35.1-dev.1750741417.3f80413 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -278,7 +278,7 @@ var isJsFile = lowerPathParam((p) => p.endsWith(".js") || p.endsWith(".mjs") ||
278
278
  import { BUILD as BUILD19 } from "@stencil/core/internal/app-data";
279
279
 
280
280
  // src/runtime/client-hydrate.ts
281
- import { BUILD as BUILD7 } from "@stencil/core/internal/app-data";
281
+ import { BUILD as BUILD8 } from "@stencil/core/internal/app-data";
282
282
 
283
283
  // src/runtime/dom-extras.ts
284
284
  import { BUILD as BUILD4 } from "@stencil/core/internal/app-data";
@@ -411,19 +411,8 @@ var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
411
411
  };
412
412
  var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
413
413
  function patchSlotNode(node) {
414
- console.log("\u{1F527} patchSlotNode called for:", node);
415
- if (node.assignedElements || node.assignedNodes || !node["s-sr"]) {
416
- console.log("\u274C patchSlotNode: already patched or not a slot reference");
417
- return;
418
- }
419
- console.log("\u2705 patchSlotNode: proceeding with patching");
414
+ if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
420
415
  const assignedFactory = (elementsOnly) => (function(opts) {
421
- var _a, _b;
422
- console.log("\u{1F3ED} assignedFactory called:", {
423
- elementsOnly,
424
- slotName: this["s-sn"],
425
- parentElement: (_b = (_a = this["s-cr"]) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.tagName
426
- });
427
416
  const toReturn = [];
428
417
  const slotName = this["s-sn"];
429
418
  if (opts == null ? void 0 : opts.flatten) {
@@ -435,30 +424,11 @@ function patchSlotNode(node) {
435
424
  }
436
425
  const parent = this["s-cr"].parentElement;
437
426
  const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
438
- console.log("\u{1F50D} Processing slotted nodes:", {
439
- count: slottedNodes.length,
440
- nodes: Array.from(slottedNodes).map((n) => ({ tagName: n.tagName, nodeType: n.nodeType }))
441
- });
442
427
  slottedNodes.forEach((n) => {
443
- console.log("\u{1F50D} Checking node:", {
444
- tagName: n.tagName,
445
- nodeType: n.nodeType,
446
- slotName: getSlotName(n),
447
- targetSlotName: slotName
448
- });
449
428
  if (slotName === getSlotName(n)) {
450
- console.log("\u2705 Node matches slot, adding to return array");
451
429
  toReturn.push(n);
452
- patchSlottedShadowDomEvents(n, parent);
453
- } else {
454
- console.log("\u274C Node does not match slot");
455
430
  }
456
431
  });
457
- console.log("\u{1F3ED} assignedFactory returning:", {
458
- count: toReturn.length,
459
- elementsOnly,
460
- nodes: toReturn.map((n) => ({ tagName: n.tagName, nodeType: n.nodeType }))
461
- });
462
432
  if (elementsOnly) {
463
433
  return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
464
434
  }
@@ -467,70 +437,6 @@ function patchSlotNode(node) {
467
437
  node.assignedElements = assignedFactory(true);
468
438
  node.assignedNodes = assignedFactory(false);
469
439
  }
470
- function patchSlottedShadowDomEvents(slottedNode, parentHost) {
471
- var _a, _b, _c;
472
- console.log("\u{1F50D} patchSlottedShadowDomEvents called:", {
473
- slottedNode: slottedNode.tagName,
474
- parentHost: parentHost.tagName,
475
- nodeType: slottedNode.nodeType,
476
- isElement: slottedNode.nodeType === 1 /* ElementNode */
477
- });
478
- if (slottedNode.nodeType !== 1 /* ElementNode */) {
479
- console.log("\u274C Not an element node, skipping");
480
- return;
481
- }
482
- const element = slottedNode;
483
- console.log("\u{1F50D} Element details:", {
484
- tagName: element.tagName,
485
- hasHyphen: (_a = element.tagName) == null ? void 0 : _a.includes("-"),
486
- hasShadowRoot: !!element.shadowRoot,
487
- parentHasShadowRoot: !!parentHost.shadowRoot
488
- });
489
- if (!((_b = element.tagName) == null ? void 0 : _b.includes("-")) || !element.shadowRoot || parentHost.shadowRoot) {
490
- console.log("\u274C Conditions not met for patching:", {
491
- hasHyphen: (_c = element.tagName) == null ? void 0 : _c.includes("-"),
492
- hasShadowRoot: !!element.shadowRoot,
493
- parentHasShadowRoot: !!parentHost.shadowRoot
494
- });
495
- return;
496
- }
497
- if (element.__stencilSlotEventPatched) {
498
- console.log("\u26A0\uFE0F Already patched, skipping");
499
- return;
500
- }
501
- console.log("\u2705 Patching element:", element.tagName);
502
- element.__stencilSlotEventPatched = true;
503
- const originalDispatchEvent = element.dispatchEvent;
504
- element.dispatchEvent = function(event) {
505
- var _a2;
506
- console.log("\u{1F3AF} dispatchEvent called:", {
507
- type: event.type,
508
- target: (_a2 = event.target) == null ? void 0 : _a2.tagName,
509
- bubbles: event.bubbles,
510
- composed: event.composed
511
- });
512
- if ((event.type === "focus" || event.type === "blur") && event.bubbles) {
513
- console.log("\u{1F6D1} Intercepting focus/blur event, creating non-bubbling version");
514
- const nonBubblingEvent = new event.constructor(event.type, {
515
- ...event,
516
- bubbles: false,
517
- composed: event.composed
518
- });
519
- Object.keys(event).forEach((key) => {
520
- if (key !== "bubbles" && key !== "type") {
521
- try {
522
- nonBubblingEvent[key] = event[key];
523
- } catch (e) {
524
- }
525
- }
526
- });
527
- console.log("\u{1F4E4} Dispatching non-bubbling event");
528
- return originalDispatchEvent.call(this, nonBubblingEvent);
529
- }
530
- console.log("\u{1F4E4} Dispatching original event");
531
- return originalDispatchEvent.call(this, event);
532
- };
533
- }
534
440
  function dispatchSlotChangeEvent(elm) {
535
441
  elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false }));
536
442
  }
@@ -875,67 +781,17 @@ var patchPreviousElementSibling = (element) => {
875
781
  });
876
782
  };
877
783
  var patchParentNode = (node) => {
878
- var _a;
879
784
  if (!node || node.__parentNode) return;
880
785
  patchHostOriginalAccessor("parentNode", node);
881
786
  Object.defineProperty(node, "parentNode", {
882
787
  get: function() {
883
- var _a2;
884
- return ((_a2 = this["s-ol"]) == null ? void 0 : _a2.parentNode) || this.__parentNode;
788
+ var _a;
789
+ return ((_a = this["s-ol"]) == null ? void 0 : _a.parentNode) || this.__parentNode;
885
790
  },
886
791
  set: function(value) {
887
792
  this.__parentNode = value;
888
793
  }
889
794
  });
890
- if (node.nodeType === 1 /* ELEMENT_NODE */) {
891
- const element = node;
892
- if (((_a = element.tagName) == null ? void 0 : _a.includes("-")) && element.shadowRoot) {
893
- if (BUILD4.isDev) {
894
- console.log("\u{1F527} Patching focus method for slotted shadow DOM element:", element.tagName);
895
- }
896
- const originalFocus = element.focus.bind(element);
897
- const originalDispatchEvent = element.dispatchEvent.bind(element);
898
- const originalAddEventListener = element.addEventListener.bind(element);
899
- let lastFocusTime = 0;
900
- const blurSuppressionWindow = 200;
901
- const blurListeners = [];
902
- element.focus = function(options) {
903
- lastFocusTime = Date.now();
904
- originalFocus(options);
905
- };
906
- element.addEventListener = function(type, listener, options) {
907
- if (type === "blur") {
908
- const wrappedListener = function(event) {
909
- const now = Date.now();
910
- const timeSinceFocus = now - lastFocusTime;
911
- if (timeSinceFocus < blurSuppressionWindow && lastFocusTime > 0) {
912
- if (BUILD4.isDev) {
913
- console.log("\u{1F6D1} Suppressing erroneous blur event - happened too soon after focus");
914
- }
915
- return;
916
- }
917
- listener.call(this, event);
918
- };
919
- blurListeners.push({ listener, options });
920
- return originalAddEventListener.call(this, type, wrappedListener, options);
921
- }
922
- return originalAddEventListener.call(this, type, listener, options);
923
- };
924
- element.dispatchEvent = function(event) {
925
- if (event.type === "blur") {
926
- const now = Date.now();
927
- const timeSinceFocus = now - lastFocusTime;
928
- if (timeSinceFocus < blurSuppressionWindow && lastFocusTime > 0) {
929
- if (BUILD4.isDev) {
930
- console.log("\u{1F6D1} Preventing erroneous blur dispatchEvent - happened too soon after focus");
931
- }
932
- return true;
933
- }
934
- }
935
- return originalDispatchEvent(event);
936
- };
937
- }
938
- }
939
795
  };
940
796
  var validElementPatches = ["children", "nextElementSibling", "previousElementSibling"];
941
797
  var validNodesPatches = [
@@ -1056,8 +912,125 @@ var installDevTools = () => {
1056
912
  }
1057
913
  };
1058
914
 
1059
- // src/runtime/vdom/h.ts
915
+ // src/runtime/styles.ts
1060
916
  import { BUILD as BUILD6 } from "@stencil/core/internal/app-data";
917
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
918
+ var registerStyle = (scopeId2, cssText, allowCS) => {
919
+ let style = styles.get(scopeId2);
920
+ if (supportsConstructableStylesheets && allowCS) {
921
+ style = style || new CSSStyleSheet();
922
+ if (typeof style === "string") {
923
+ style = cssText;
924
+ } else {
925
+ style.replaceSync(cssText);
926
+ }
927
+ } else {
928
+ style = cssText;
929
+ }
930
+ styles.set(scopeId2, style);
931
+ };
932
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
933
+ var _a;
934
+ const scopeId2 = getScopeId(cmpMeta, mode);
935
+ const style = styles.get(scopeId2);
936
+ if (!BUILD6.attachStyles || !win.document) {
937
+ return scopeId2;
938
+ }
939
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
940
+ if (style) {
941
+ if (typeof style === "string") {
942
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
943
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
944
+ let styleElm;
945
+ if (!appliedStyles) {
946
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
947
+ }
948
+ if (!appliedStyles.has(scopeId2)) {
949
+ if (BUILD6.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
950
+ styleElm.innerHTML = style;
951
+ } else {
952
+ styleElm = win.document.createElement("style");
953
+ styleElm.innerHTML = style;
954
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
955
+ if (nonce != null) {
956
+ styleElm.setAttribute("nonce", nonce);
957
+ }
958
+ if ((BUILD6.hydrateServerSide || BUILD6.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) {
959
+ styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
960
+ }
961
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
962
+ if (styleContainerNode.nodeName === "HEAD") {
963
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
964
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
965
+ styleContainerNode.insertBefore(
966
+ styleElm,
967
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
968
+ );
969
+ } else if ("host" in styleContainerNode) {
970
+ if (supportsConstructableStylesheets) {
971
+ const stylesheet = new CSSStyleSheet();
972
+ stylesheet.replaceSync(style);
973
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
974
+ } else {
975
+ const existingStyleContainer = styleContainerNode.querySelector("style");
976
+ if (existingStyleContainer) {
977
+ existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
978
+ } else {
979
+ styleContainerNode.prepend(styleElm);
980
+ }
981
+ }
982
+ } else {
983
+ styleContainerNode.append(styleElm);
984
+ }
985
+ }
986
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
987
+ styleContainerNode.insertBefore(styleElm, null);
988
+ }
989
+ }
990
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
991
+ styleElm.innerHTML += SLOT_FB_CSS;
992
+ }
993
+ if (appliedStyles) {
994
+ appliedStyles.add(scopeId2);
995
+ }
996
+ }
997
+ } else if (BUILD6.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
998
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
999
+ }
1000
+ }
1001
+ return scopeId2;
1002
+ };
1003
+ var attachStyles = (hostRef) => {
1004
+ const cmpMeta = hostRef.$cmpMeta$;
1005
+ const elm = hostRef.$hostElement$;
1006
+ const flags = cmpMeta.$flags$;
1007
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
1008
+ const scopeId2 = addStyle(
1009
+ BUILD6.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
1010
+ cmpMeta,
1011
+ hostRef.$modeName$
1012
+ );
1013
+ if ((BUILD6.shadowDom || BUILD6.scoped) && BUILD6.cssAnnotations && flags & 10 /* needsScopedEncapsulation */) {
1014
+ elm["s-sc"] = scopeId2;
1015
+ elm.classList.add(scopeId2 + "-h");
1016
+ }
1017
+ endAttachStyles();
1018
+ };
1019
+ var getScopeId = (cmp, mode) => "sc-" + (BUILD6.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
1020
+ var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
1021
+ var hydrateScopedToShadow = () => {
1022
+ if (!win.document) {
1023
+ return;
1024
+ }
1025
+ const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
1026
+ let i2 = 0;
1027
+ for (; i2 < styles2.length; i2++) {
1028
+ registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
1029
+ }
1030
+ };
1031
+
1032
+ // src/runtime/vdom/h.ts
1033
+ import { BUILD as BUILD7 } from "@stencil/core/internal/app-data";
1061
1034
  var h = (nodeName, vnodeData, ...children) => {
1062
1035
  let child = null;
1063
1036
  let key = null;
@@ -1073,7 +1046,7 @@ var h = (nodeName, vnodeData, ...children) => {
1073
1046
  } else if (child != null && typeof child !== "boolean") {
1074
1047
  if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
1075
1048
  child = String(child);
1076
- } else if (BUILD6.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
1049
+ } else if (BUILD7.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
1077
1050
  consoleDevError(`vNode passed as children has unexpected type.
1078
1051
  Make sure it's using the correct h() function.
1079
1052
  Empty objects can also be the cause, look for JSX comments that became objects.`);
@@ -1089,28 +1062,28 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
1089
1062
  };
1090
1063
  walk(children);
1091
1064
  if (vnodeData) {
1092
- if (BUILD6.isDev && nodeName === "input") {
1065
+ if (BUILD7.isDev && nodeName === "input") {
1093
1066
  validateInputProperties(vnodeData);
1094
1067
  }
1095
- if (BUILD6.vdomKey && vnodeData.key) {
1068
+ if (BUILD7.vdomKey && vnodeData.key) {
1096
1069
  key = vnodeData.key;
1097
1070
  }
1098
- if (BUILD6.slotRelocation && vnodeData.name) {
1071
+ if (BUILD7.slotRelocation && vnodeData.name) {
1099
1072
  slotName = vnodeData.name;
1100
1073
  }
1101
- if (BUILD6.vdomClass) {
1074
+ if (BUILD7.vdomClass) {
1102
1075
  const classData = vnodeData.className || vnodeData.class;
1103
1076
  if (classData) {
1104
1077
  vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
1105
1078
  }
1106
1079
  }
1107
1080
  }
1108
- if (BUILD6.isDev && vNodeChildren.some(isHost)) {
1081
+ if (BUILD7.isDev && vNodeChildren.some(isHost)) {
1109
1082
  consoleDevError(`The <Host> must be the single root component. Make sure:
1110
1083
  - You are NOT using hostData() and <Host> in the same component.
1111
1084
  - <Host> is used once, and it's the single root component of the render() function.`);
1112
1085
  }
1113
- if (BUILD6.vdomFunctional && typeof nodeName === "function") {
1086
+ if (BUILD7.vdomFunctional && typeof nodeName === "function") {
1114
1087
  return nodeName(
1115
1088
  vnodeData === null ? {} : vnodeData,
1116
1089
  vNodeChildren,
@@ -1122,10 +1095,10 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
1122
1095
  if (vNodeChildren.length > 0) {
1123
1096
  vnode.$children$ = vNodeChildren;
1124
1097
  }
1125
- if (BUILD6.vdomKey) {
1098
+ if (BUILD7.vdomKey) {
1126
1099
  vnode.$key$ = key;
1127
1100
  }
1128
- if (BUILD6.slotRelocation) {
1101
+ if (BUILD7.slotRelocation) {
1129
1102
  vnode.$name$ = slotName;
1130
1103
  }
1131
1104
  return vnode;
@@ -1138,13 +1111,13 @@ var newVNode = (tag, text) => {
1138
1111
  $elm$: null,
1139
1112
  $children$: null
1140
1113
  };
1141
- if (BUILD6.vdomAttribute) {
1114
+ if (BUILD7.vdomAttribute) {
1142
1115
  vnode.$attrs$ = null;
1143
1116
  }
1144
- if (BUILD6.vdomKey) {
1117
+ if (BUILD7.vdomKey) {
1145
1118
  vnode.$key$ = null;
1146
1119
  }
1147
- if (BUILD6.slotRelocation) {
1120
+ if (BUILD7.slotRelocation) {
1148
1121
  vnode.$name$ = null;
1149
1122
  }
1150
1123
  return vnode;
@@ -1198,18 +1171,18 @@ var validateInputProperties = (inputElm) => {
1198
1171
 
1199
1172
  // src/runtime/client-hydrate.ts
1200
1173
  var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1201
- var _a;
1174
+ var _a, _b;
1202
1175
  const endHydrate = createTime("hydrateClient", tagName);
1203
1176
  const shadowRoot = hostElm.shadowRoot;
1204
1177
  const childRenderNodes = [];
1205
1178
  const slotNodes = [];
1206
1179
  const slottedNodes = [];
1207
- const shadowRootNodes = BUILD7.shadowDom && shadowRoot ? [] : null;
1180
+ const shadowRootNodes = BUILD8.shadowDom && shadowRoot ? [] : null;
1208
1181
  const vnode = newVNode(tagName, null);
1209
1182
  vnode.$elm$ = hostElm;
1210
1183
  const members = Object.entries(((_a = hostRef.$cmpMeta$) == null ? void 0 : _a.$members$) || {});
1211
1184
  members.forEach(([memberName, [memberFlags, metaAttributeName]]) => {
1212
- var _a2, _b;
1185
+ var _a2, _b2;
1213
1186
  if (!(memberFlags & 31 /* Prop */)) {
1214
1187
  return;
1215
1188
  }
@@ -1219,13 +1192,13 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1219
1192
  const attrPropVal = parsePropertyValue(
1220
1193
  attrVal,
1221
1194
  memberFlags,
1222
- BUILD7.formAssociated && !!(((_a2 = hostRef.$cmpMeta$) == null ? void 0 : _a2.$flags$) & 64 /* formAssociated */)
1195
+ BUILD8.formAssociated && !!(((_a2 = hostRef.$cmpMeta$) == null ? void 0 : _a2.$flags$) & 64 /* formAssociated */)
1223
1196
  );
1224
- (_b = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _b.set(memberName, attrPropVal);
1197
+ (_b2 = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _b2.set(memberName, attrPropVal);
1225
1198
  }
1226
1199
  });
1227
1200
  let scopeId2;
1228
- if (BUILD7.scoped) {
1201
+ if (BUILD8.scoped) {
1229
1202
  const cmpMeta = hostRef.$cmpMeta$;
1230
1203
  if (cmpMeta && cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */ && hostElm["s-sc"]) {
1231
1204
  scopeId2 = hostElm["s-sc"];
@@ -1262,6 +1235,16 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1262
1235
  if (childRenderNode.$tag$ === "slot") {
1263
1236
  node["s-cr"] = hostElm["s-cr"];
1264
1237
  }
1238
+ } else if (((_b = childRenderNode.$tag$) == null ? void 0 : _b.toString().includes("-")) && !childRenderNode.$elm$.shadowRoot) {
1239
+ const cmpMeta = getHostRef(childRenderNode.$elm$);
1240
+ const scopeId3 = getScopeId(
1241
+ cmpMeta.$cmpMeta$,
1242
+ BUILD8.mode ? childRenderNode.$elm$.getAttribute("s-mode") : void 0
1243
+ );
1244
+ const styleSheet = win.document.querySelector(`style[sty-id="${scopeId3}"]`);
1245
+ if (styleSheet) {
1246
+ hostElm.shadowRoot.append(styleSheet.cloneNode(true));
1247
+ }
1265
1248
  }
1266
1249
  if (childRenderNode.$tag$ === "slot") {
1267
1250
  childRenderNode.$name$ = childRenderNode.$elm$["s-sn"] || childRenderNode.$elm$["name"] || null;
@@ -1277,7 +1260,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1277
1260
  }
1278
1261
  }
1279
1262
  if (orgLocationNode && orgLocationNode.isConnected) {
1280
- if (shadowRoot && orgLocationNode["s-en"] === "") {
1263
+ if (orgLocationNode.parentElement.shadowRoot && orgLocationNode["s-en"] === "") {
1281
1264
  orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
1282
1265
  }
1283
1266
  orgLocationNode.parentNode.removeChild(orgLocationNode);
@@ -1285,7 +1268,9 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1285
1268
  node["s-oo"] = parseInt(childRenderNode.$nodeId$);
1286
1269
  }
1287
1270
  }
1288
- plt.$orgLocNodes$.delete(orgLocationId);
1271
+ if (orgLocationNode && !orgLocationNode["s-id"]) {
1272
+ plt.$orgLocNodes$.delete(orgLocationId);
1273
+ }
1289
1274
  }
1290
1275
  const hosts = [];
1291
1276
  const snLen = slottedNodes.length;
@@ -1307,14 +1292,16 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1307
1292
  if (!hosts[slottedItem.hostId]) continue;
1308
1293
  const hostEle = hosts[slottedItem.hostId];
1309
1294
  if (!hostEle.shadowRoot || !shadowRoot) {
1310
- slottedItem.slot["s-cr"] = hostEle["s-cr"];
1311
- if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
1312
- slottedItem.slot["s-cr"] = hostEle;
1313
- } else {
1314
- slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1295
+ if (!slottedItem.slot["s-cr"]) {
1296
+ slottedItem.slot["s-cr"] = hostEle["s-cr"];
1297
+ if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
1298
+ slottedItem.slot["s-cr"] = hostEle;
1299
+ } else {
1300
+ slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1301
+ }
1315
1302
  }
1316
1303
  addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
1317
- if (BUILD7.experimentalSlotFixes) {
1304
+ if (BUILD8.experimentalSlotFixes) {
1318
1305
  patchSlottedNode(slottedItem.node);
1319
1306
  }
1320
1307
  }
@@ -1323,12 +1310,12 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1323
1310
  }
1324
1311
  }
1325
1312
  }
1326
- if (BUILD7.scoped && scopeId2 && slotNodes.length) {
1313
+ if (BUILD8.scoped && scopeId2 && slotNodes.length) {
1327
1314
  slotNodes.forEach((slot) => {
1328
1315
  slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
1329
1316
  });
1330
1317
  }
1331
- if (BUILD7.shadowDom && shadowRoot && !shadowRoot.childNodes.length) {
1318
+ if (BUILD8.shadowDom && shadowRoot) {
1332
1319
  let rnIdex = 0;
1333
1320
  const rnLen = shadowRootNodes.length;
1334
1321
  if (rnLen) {
@@ -1339,14 +1326,13 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1339
1326
  if (typeof node["s-en"] !== "string" && typeof node["s-sn"] !== "string") {
1340
1327
  if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
1341
1328
  node.removeAttribute("hidden");
1342
- } else if (node.nodeType === 8 /* CommentNode */ || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1329
+ } else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1343
1330
  node.parentNode.removeChild(node);
1344
1331
  }
1345
1332
  }
1346
1333
  });
1347
1334
  }
1348
1335
  }
1349
- plt.$orgLocNodes$.delete(hostElm["s-id"]);
1350
1336
  hostRef.$hostElement$ = hostElm;
1351
1337
  endHydrate();
1352
1338
  };
@@ -1378,7 +1364,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1378
1364
  if (!parentVNode.$children$) {
1379
1365
  parentVNode.$children$ = [];
1380
1366
  }
1381
- if (BUILD7.scoped && scopeId2) {
1367
+ if (BUILD8.scoped && scopeId2 && childIdSplt[0] === hostId) {
1382
1368
  node["s-si"] = scopeId2;
1383
1369
  childVNode.$attrs$.class += " " + scopeId2;
1384
1370
  }
@@ -1396,7 +1382,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1396
1382
  shadowRootNodes,
1397
1383
  slottedNodes
1398
1384
  );
1399
- if (BUILD7.scoped && scopeId2) {
1385
+ if (BUILD8.scoped && scopeId2) {
1400
1386
  node.classList.add(scopeId2);
1401
1387
  }
1402
1388
  }
@@ -1493,9 +1479,9 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1493
1479
  slottedNodes
1494
1480
  );
1495
1481
  } else if (childNodeType === CONTENT_REF_ID) {
1496
- if (BUILD7.shadowDom && shadowRootNodes) {
1482
+ if (BUILD8.shadowDom && shadowRootNodes) {
1497
1483
  node.remove();
1498
- } else if (BUILD7.slotRelocation) {
1484
+ } else if (BUILD8.slotRelocation) {
1499
1485
  hostElm["s-cr"] = node;
1500
1486
  node["s-cn"] = true;
1501
1487
  }
@@ -1508,7 +1494,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1508
1494
  vnode.$index$ = "0";
1509
1495
  parentVNode.$children$ = [vnode];
1510
1496
  } else {
1511
- if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1497
+ if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim() && !node["s-nr"]) {
1512
1498
  node.remove();
1513
1499
  }
1514
1500
  }
@@ -1561,15 +1547,15 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1561
1547
  childVNode.$name$ = slotName || null;
1562
1548
  childVNode.$tag$ = "slot";
1563
1549
  const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
1564
- if (BUILD7.shadowDom && shadowRootNodes && win.document) {
1550
+ if (BUILD8.shadowDom && shadowRootNodes && win.document) {
1565
1551
  const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$);
1566
1552
  if (childVNode.$name$) {
1567
1553
  childVNode.$elm$.setAttribute("name", slotName);
1568
1554
  }
1569
- if (parentNodeId && parentNodeId !== childVNode.$hostId$) {
1570
- parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1555
+ if (parentVNode.$elm$.shadowRoot && parentNodeId && parentNodeId !== childVNode.$hostId$) {
1556
+ internalCall(parentVNode.$elm$, "insertBefore")(slot, internalCall(parentVNode.$elm$, "children")[0]);
1571
1557
  } else {
1572
- node.parentNode.insertBefore(slot, node);
1558
+ internalCall(internalCall(node, "parentNode"), "insertBefore")(slot, node);
1573
1559
  }
1574
1560
  addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
1575
1561
  node.remove();
@@ -1595,7 +1581,7 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1595
1581
  var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
1596
1582
  let slottedNode = slotNode.nextSibling;
1597
1583
  slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
1598
- 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 */))) {
1584
+ 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"))) {
1599
1585
  slottedNode["s-sn"] = slotName;
1600
1586
  slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
1601
1587
  slottedNode = slottedNode.nextSibling;
@@ -2030,31 +2016,31 @@ import { BUILD as BUILD17 } from "@stencil/core/internal/app-data";
2030
2016
  import { BUILD as BUILD16 } from "@stencil/core/internal/app-data";
2031
2017
 
2032
2018
  // src/runtime/parse-property-value.ts
2033
- import { BUILD as BUILD8 } from "@stencil/core/internal/app-data";
2019
+ import { BUILD as BUILD9 } from "@stencil/core/internal/app-data";
2034
2020
  var parsePropertyValue = (propValue, propType, isFormAssociated) => {
2035
- if ((BUILD8.hydrateClientSide || BUILD8.hydrateServerSide) && typeof propValue === "string" && (propValue.startsWith("{") && propValue.endsWith("}") || propValue.startsWith("[") && propValue.endsWith("]"))) {
2021
+ if ((BUILD9.hydrateClientSide || BUILD9.hydrateServerSide) && typeof propValue === "string" && (propValue.startsWith("{") && propValue.endsWith("}") || propValue.startsWith("[") && propValue.endsWith("]"))) {
2036
2022
  try {
2037
2023
  propValue = JSON.parse(propValue);
2038
2024
  return propValue;
2039
2025
  } catch (e) {
2040
2026
  }
2041
2027
  }
2042
- if ((BUILD8.hydrateClientSide || BUILD8.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2028
+ if ((BUILD9.hydrateClientSide || BUILD9.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2043
2029
  propValue = deserializeProperty(propValue);
2044
2030
  return propValue;
2045
2031
  }
2046
2032
  if (propValue != null && !isComplexType(propValue)) {
2047
- if (BUILD8.propBoolean && propType & 4 /* Boolean */) {
2048
- if (BUILD8.formAssociated && isFormAssociated && typeof propValue === "string") {
2033
+ if (BUILD9.propBoolean && propType & 4 /* Boolean */) {
2034
+ if (BUILD9.formAssociated && isFormAssociated && typeof propValue === "string") {
2049
2035
  return propValue === "" || !!propValue;
2050
2036
  } else {
2051
2037
  return propValue === "false" ? false : propValue === "" || !!propValue;
2052
2038
  }
2053
2039
  }
2054
- if (BUILD8.propNumber && propType & 2 /* Number */) {
2040
+ if (BUILD9.propNumber && propType & 2 /* Number */) {
2055
2041
  return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
2056
2042
  }
2057
- if (BUILD8.propString && propType & 1 /* String */) {
2043
+ if (BUILD9.propString && propType & 1 /* String */) {
2058
2044
  return String(propValue);
2059
2045
  }
2060
2046
  return propValue;
@@ -2066,18 +2052,18 @@ var parsePropertyValue = (propValue, propType, isFormAssociated) => {
2066
2052
  import { BUILD as BUILD15, NAMESPACE } from "@stencil/core/internal/app-data";
2067
2053
 
2068
2054
  // src/runtime/event-emitter.ts
2069
- import { BUILD as BUILD10 } from "@stencil/core/internal/app-data";
2055
+ import { BUILD as BUILD11 } from "@stencil/core/internal/app-data";
2070
2056
 
2071
2057
  // src/runtime/element.ts
2072
- import { BUILD as BUILD9 } from "@stencil/core/internal/app-data";
2073
- var getElement = (ref) => BUILD9.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
2058
+ import { BUILD as BUILD10 } from "@stencil/core/internal/app-data";
2059
+ var getElement = (ref) => BUILD10.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
2074
2060
 
2075
2061
  // src/runtime/event-emitter.ts
2076
2062
  var createEvent = (ref, name, flags) => {
2077
2063
  const elm = getElement(ref);
2078
2064
  return {
2079
2065
  emit: (detail) => {
2080
- if (BUILD10.isDev && !elm.isConnected) {
2066
+ if (BUILD11.isDev && !elm.isConnected) {
2081
2067
  consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
2082
2068
  }
2083
2069
  return emitEvent(elm, name, {
@@ -2095,123 +2081,6 @@ var emitEvent = (elm, name, opts) => {
2095
2081
  return ev;
2096
2082
  };
2097
2083
 
2098
- // src/runtime/styles.ts
2099
- import { BUILD as BUILD11 } from "@stencil/core/internal/app-data";
2100
- var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
2101
- var registerStyle = (scopeId2, cssText, allowCS) => {
2102
- let style = styles.get(scopeId2);
2103
- if (supportsConstructableStylesheets && allowCS) {
2104
- style = style || new CSSStyleSheet();
2105
- if (typeof style === "string") {
2106
- style = cssText;
2107
- } else {
2108
- style.replaceSync(cssText);
2109
- }
2110
- } else {
2111
- style = cssText;
2112
- }
2113
- styles.set(scopeId2, style);
2114
- };
2115
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
2116
- var _a;
2117
- const scopeId2 = getScopeId(cmpMeta, mode);
2118
- const style = styles.get(scopeId2);
2119
- if (!BUILD11.attachStyles || !win.document) {
2120
- return scopeId2;
2121
- }
2122
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
2123
- if (style) {
2124
- if (typeof style === "string") {
2125
- styleContainerNode = styleContainerNode.head || styleContainerNode;
2126
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
2127
- let styleElm;
2128
- if (!appliedStyles) {
2129
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
2130
- }
2131
- if (!appliedStyles.has(scopeId2)) {
2132
- if (BUILD11.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
2133
- styleElm.innerHTML = style;
2134
- } else {
2135
- styleElm = win.document.createElement("style");
2136
- styleElm.innerHTML = style;
2137
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
2138
- if (nonce != null) {
2139
- styleElm.setAttribute("nonce", nonce);
2140
- }
2141
- if ((BUILD11.hydrateServerSide || BUILD11.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) {
2142
- styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
2143
- }
2144
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
2145
- if (styleContainerNode.nodeName === "HEAD") {
2146
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
2147
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
2148
- styleContainerNode.insertBefore(
2149
- styleElm,
2150
- (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
2151
- );
2152
- } else if ("host" in styleContainerNode) {
2153
- if (supportsConstructableStylesheets) {
2154
- const stylesheet = new CSSStyleSheet();
2155
- stylesheet.replaceSync(style);
2156
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
2157
- } else {
2158
- const existingStyleContainer = styleContainerNode.querySelector("style");
2159
- if (existingStyleContainer) {
2160
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
2161
- } else {
2162
- styleContainerNode.prepend(styleElm);
2163
- }
2164
- }
2165
- } else {
2166
- styleContainerNode.append(styleElm);
2167
- }
2168
- }
2169
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2170
- styleContainerNode.insertBefore(styleElm, null);
2171
- }
2172
- }
2173
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
2174
- styleElm.innerHTML += SLOT_FB_CSS;
2175
- }
2176
- if (appliedStyles) {
2177
- appliedStyles.add(scopeId2);
2178
- }
2179
- }
2180
- } else if (BUILD11.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
2181
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
2182
- }
2183
- }
2184
- return scopeId2;
2185
- };
2186
- var attachStyles = (hostRef) => {
2187
- const cmpMeta = hostRef.$cmpMeta$;
2188
- const elm = hostRef.$hostElement$;
2189
- const flags = cmpMeta.$flags$;
2190
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
2191
- const scopeId2 = addStyle(
2192
- BUILD11.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
2193
- cmpMeta,
2194
- hostRef.$modeName$
2195
- );
2196
- if ((BUILD11.shadowDom || BUILD11.scoped) && BUILD11.cssAnnotations && flags & 10 /* needsScopedEncapsulation */) {
2197
- elm["s-sc"] = scopeId2;
2198
- elm.classList.add(scopeId2 + "-h");
2199
- }
2200
- endAttachStyles();
2201
- };
2202
- var getScopeId = (cmp, mode) => "sc-" + (BUILD11.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
2203
- var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
2204
- var hydrateScopedToShadow = () => {
2205
- if (!win.document) {
2206
- return;
2207
- }
2208
- const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2209
- let i2 = 0;
2210
- for (; i2 < styles2.length; i2++) {
2211
- registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
2212
- }
2213
- };
2214
-
2215
2084
  // src/runtime/vdom/vdom-render.ts
2216
2085
  import { BUILD as BUILD14 } from "@stencil/core/internal/app-data";
2217
2086
 
@@ -2230,12 +2099,13 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
2230
2099
  const classList = elm.classList;
2231
2100
  const oldClasses = parseClassList(oldValue);
2232
2101
  let newClasses = parseClassList(newValue);
2233
- if (BUILD12.hydrateClientSide && elm["s-si"] && initialRender) {
2234
- newClasses.push(elm["s-si"]);
2102
+ if (BUILD12.hydrateClientSide && (elm["s-si"] || elm["s-sc"]) && initialRender) {
2103
+ const scopeId2 = elm["s-sc"] || elm["s-si"];
2104
+ newClasses.push(scopeId2);
2235
2105
  oldClasses.forEach((c) => {
2236
- if (c.startsWith(elm["s-si"])) newClasses.push(c);
2106
+ if (c.startsWith(scopeId2)) newClasses.push(c);
2237
2107
  });
2238
- newClasses = [...new Set(newClasses)];
2108
+ newClasses = [...new Set(newClasses)].filter((c) => c);
2239
2109
  classList.add(...newClasses);
2240
2110
  } else {
2241
2111
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
@@ -3184,10 +3054,16 @@ var forceUpdate = (ref) => {
3184
3054
  return false;
3185
3055
  };
3186
3056
  var appDidLoad = (who) => {
3057
+ var _a;
3187
3058
  if (BUILD15.asyncQueue) {
3188
3059
  plt.$flags$ |= 2 /* appLoaded */;
3189
3060
  }
3190
3061
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
3062
+ if (BUILD15.hydrateClientSide) {
3063
+ if ((_a = plt.$orgLocNodes$) == null ? void 0 : _a.size) {
3064
+ plt.$orgLocNodes$.clear();
3065
+ }
3066
+ }
3191
3067
  if (BUILD15.profile && performance.measure) {
3192
3068
  performance.measure(`[Stencil] ${NAMESPACE} initial load (by ${who})`, "st:app:start");
3193
3069
  }
@@ -3619,6 +3495,11 @@ var connectedCallback = (elm) => {
3619
3495
  if (BUILD19.hydrateServerSide || (BUILD19.slot || BUILD19.shadowDom) && // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
3620
3496
  cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
3621
3497
  setContentReference(elm);
3498
+ } else if (BUILD19.hydrateClientSide && !(cmpMeta.$flags$ & 4 /* hasSlotRelocation */)) {
3499
+ const commendPlaceholder = elm.firstChild;
3500
+ if ((commendPlaceholder == null ? void 0 : commendPlaceholder.nodeType) === 8 /* CommentNode */ && !commendPlaceholder["s-cn"] && !commendPlaceholder.nodeValue) {
3501
+ elm.removeChild(commendPlaceholder);
3502
+ }
3622
3503
  }
3623
3504
  }
3624
3505
  if (BUILD19.asyncLoading) {