@stencil/core 4.35.3-dev.1752112116.e504206 → 4.35.3-dev.1752123834.56fe6e3

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.
@@ -638,7 +638,7 @@ var isJsFile = lowerPathParam((p) => p.endsWith(".js") || p.endsWith(".mjs") ||
638
638
  var import_app_data18 = require("@stencil/core/internal/app-data");
639
639
 
640
640
  // src/runtime/client-hydrate.ts
641
- var import_app_data6 = require("@stencil/core/internal/app-data");
641
+ var import_app_data7 = require("@stencil/core/internal/app-data");
642
642
 
643
643
  // src/runtime/dom-extras.ts
644
644
  var import_app_data3 = require("@stencil/core/internal/app-data");
@@ -1272,8 +1272,133 @@ var installDevTools = () => {
1272
1272
  }
1273
1273
  };
1274
1274
 
1275
- // src/runtime/vdom/h.ts
1275
+ // src/runtime/styles.ts
1276
1276
  var import_app_data5 = require("@stencil/core/internal/app-data");
1277
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
1278
+ var registerStyle = (scopeId2, cssText, allowCS) => {
1279
+ let style = styles.get(scopeId2);
1280
+ if (supportsConstructableStylesheets && allowCS) {
1281
+ style = style || new CSSStyleSheet();
1282
+ if (typeof style === "string") {
1283
+ style = cssText;
1284
+ } else {
1285
+ style.replaceSync(cssText);
1286
+ }
1287
+ } else {
1288
+ style = cssText;
1289
+ }
1290
+ styles.set(scopeId2, style);
1291
+ };
1292
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
1293
+ var _a;
1294
+ const scopeId2 = getScopeId(cmpMeta, mode);
1295
+ const style = styles.get(scopeId2);
1296
+ if (!import_app_data5.BUILD.attachStyles || !win.document) {
1297
+ return scopeId2;
1298
+ }
1299
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
1300
+ if (style) {
1301
+ if (typeof style === "string") {
1302
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
1303
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
1304
+ let styleElm;
1305
+ if (!appliedStyles) {
1306
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
1307
+ }
1308
+ if (!appliedStyles.has(scopeId2)) {
1309
+ if (import_app_data5.BUILD.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
1310
+ styleElm.innerHTML = style;
1311
+ } else {
1312
+ styleElm = win.document.createElement("style");
1313
+ styleElm.innerHTML = style;
1314
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1315
+ if (nonce != null) {
1316
+ styleElm.setAttribute("nonce", nonce);
1317
+ }
1318
+ if ((import_app_data5.BUILD.hydrateServerSide || import_app_data5.BUILD.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) {
1319
+ styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
1320
+ }
1321
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
1322
+ if (styleContainerNode.nodeName === "HEAD") {
1323
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
1324
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
1325
+ styleContainerNode.insertBefore(
1326
+ styleElm,
1327
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
1328
+ );
1329
+ } else if ("host" in styleContainerNode) {
1330
+ if (supportsConstructableStylesheets) {
1331
+ const stylesheet = new CSSStyleSheet();
1332
+ stylesheet.replaceSync(style);
1333
+ if (supportsMutableAdoptedStyleSheets) {
1334
+ styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
1335
+ } else {
1336
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
1337
+ }
1338
+ } else {
1339
+ const existingStyleContainer = styleContainerNode.querySelector("style");
1340
+ if (existingStyleContainer) {
1341
+ existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
1342
+ } else {
1343
+ styleContainerNode.prepend(styleElm);
1344
+ }
1345
+ }
1346
+ } else {
1347
+ styleContainerNode.append(styleElm);
1348
+ }
1349
+ }
1350
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1351
+ styleContainerNode.insertBefore(styleElm, null);
1352
+ }
1353
+ }
1354
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
1355
+ styleElm.innerHTML += SLOT_FB_CSS;
1356
+ }
1357
+ if (appliedStyles) {
1358
+ appliedStyles.add(scopeId2);
1359
+ }
1360
+ }
1361
+ } else if (import_app_data5.BUILD.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
1362
+ if (supportsMutableAdoptedStyleSheets) {
1363
+ styleContainerNode.adoptedStyleSheets.push(style);
1364
+ } else {
1365
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
1366
+ }
1367
+ }
1368
+ }
1369
+ return scopeId2;
1370
+ };
1371
+ var attachStyles = (hostRef) => {
1372
+ const cmpMeta = hostRef.$cmpMeta$;
1373
+ const elm = hostRef.$hostElement$;
1374
+ const flags = cmpMeta.$flags$;
1375
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
1376
+ const scopeId2 = addStyle(
1377
+ import_app_data5.BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
1378
+ cmpMeta,
1379
+ hostRef.$modeName$
1380
+ );
1381
+ if ((import_app_data5.BUILD.shadowDom || import_app_data5.BUILD.scoped) && import_app_data5.BUILD.cssAnnotations && flags & 10 /* needsScopedEncapsulation */) {
1382
+ elm["s-sc"] = scopeId2;
1383
+ elm.classList.add(scopeId2 + "-h");
1384
+ }
1385
+ endAttachStyles();
1386
+ };
1387
+ var getScopeId = (cmp, mode) => "sc-" + (import_app_data5.BUILD.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
1388
+ var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
1389
+ var hydrateScopedToShadow = () => {
1390
+ if (!win.document) {
1391
+ return;
1392
+ }
1393
+ const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
1394
+ let i2 = 0;
1395
+ for (; i2 < styles2.length; i2++) {
1396
+ registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
1397
+ }
1398
+ };
1399
+
1400
+ // src/runtime/vdom/h.ts
1401
+ var import_app_data6 = require("@stencil/core/internal/app-data");
1277
1402
  var h = (nodeName, vnodeData, ...children) => {
1278
1403
  let child = null;
1279
1404
  let key = null;
@@ -1289,7 +1414,7 @@ var h = (nodeName, vnodeData, ...children) => {
1289
1414
  } else if (child != null && typeof child !== "boolean") {
1290
1415
  if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
1291
1416
  child = String(child);
1292
- } else if (import_app_data5.BUILD.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
1417
+ } else if (import_app_data6.BUILD.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
1293
1418
  consoleDevError(`vNode passed as children has unexpected type.
1294
1419
  Make sure it's using the correct h() function.
1295
1420
  Empty objects can also be the cause, look for JSX comments that became objects.`);
@@ -1305,28 +1430,28 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
1305
1430
  };
1306
1431
  walk(children);
1307
1432
  if (vnodeData) {
1308
- if (import_app_data5.BUILD.isDev && nodeName === "input") {
1433
+ if (import_app_data6.BUILD.isDev && nodeName === "input") {
1309
1434
  validateInputProperties(vnodeData);
1310
1435
  }
1311
- if (import_app_data5.BUILD.vdomKey && vnodeData.key) {
1436
+ if (import_app_data6.BUILD.vdomKey && vnodeData.key) {
1312
1437
  key = vnodeData.key;
1313
1438
  }
1314
- if (import_app_data5.BUILD.slotRelocation && vnodeData.name) {
1439
+ if (import_app_data6.BUILD.slotRelocation && vnodeData.name) {
1315
1440
  slotName = vnodeData.name;
1316
1441
  }
1317
- if (import_app_data5.BUILD.vdomClass) {
1442
+ if (import_app_data6.BUILD.vdomClass) {
1318
1443
  const classData = vnodeData.className || vnodeData.class;
1319
1444
  if (classData) {
1320
1445
  vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
1321
1446
  }
1322
1447
  }
1323
1448
  }
1324
- if (import_app_data5.BUILD.isDev && vNodeChildren.some(isHost)) {
1449
+ if (import_app_data6.BUILD.isDev && vNodeChildren.some(isHost)) {
1325
1450
  consoleDevError(`The <Host> must be the single root component. Make sure:
1326
1451
  - You are NOT using hostData() and <Host> in the same component.
1327
1452
  - <Host> is used once, and it's the single root component of the render() function.`);
1328
1453
  }
1329
- if (import_app_data5.BUILD.vdomFunctional && typeof nodeName === "function") {
1454
+ if (import_app_data6.BUILD.vdomFunctional && typeof nodeName === "function") {
1330
1455
  return nodeName(
1331
1456
  vnodeData === null ? {} : vnodeData,
1332
1457
  vNodeChildren,
@@ -1338,10 +1463,10 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
1338
1463
  if (vNodeChildren.length > 0) {
1339
1464
  vnode.$children$ = vNodeChildren;
1340
1465
  }
1341
- if (import_app_data5.BUILD.vdomKey) {
1466
+ if (import_app_data6.BUILD.vdomKey) {
1342
1467
  vnode.$key$ = key;
1343
1468
  }
1344
- if (import_app_data5.BUILD.slotRelocation) {
1469
+ if (import_app_data6.BUILD.slotRelocation) {
1345
1470
  vnode.$name$ = slotName;
1346
1471
  }
1347
1472
  return vnode;
@@ -1354,13 +1479,13 @@ var newVNode = (tag, text) => {
1354
1479
  $elm$: null,
1355
1480
  $children$: null
1356
1481
  };
1357
- if (import_app_data5.BUILD.vdomAttribute) {
1482
+ if (import_app_data6.BUILD.vdomAttribute) {
1358
1483
  vnode.$attrs$ = null;
1359
1484
  }
1360
- if (import_app_data5.BUILD.vdomKey) {
1485
+ if (import_app_data6.BUILD.vdomKey) {
1361
1486
  vnode.$key$ = null;
1362
1487
  }
1363
- if (import_app_data5.BUILD.slotRelocation) {
1488
+ if (import_app_data6.BUILD.slotRelocation) {
1364
1489
  vnode.$name$ = null;
1365
1490
  }
1366
1491
  return vnode;
@@ -1414,18 +1539,18 @@ var validateInputProperties = (inputElm) => {
1414
1539
 
1415
1540
  // src/runtime/client-hydrate.ts
1416
1541
  var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1417
- var _a;
1542
+ var _a, _b;
1418
1543
  const endHydrate = createTime("hydrateClient", tagName);
1419
1544
  const shadowRoot = hostElm.shadowRoot;
1420
1545
  const childRenderNodes = [];
1421
1546
  const slotNodes = [];
1422
1547
  const slottedNodes = [];
1423
- const shadowRootNodes = import_app_data6.BUILD.shadowDom && shadowRoot ? [] : null;
1548
+ const shadowRootNodes = import_app_data7.BUILD.shadowDom && shadowRoot ? [] : null;
1424
1549
  const vnode = newVNode(tagName, null);
1425
1550
  vnode.$elm$ = hostElm;
1426
1551
  const members = Object.entries(((_a = hostRef.$cmpMeta$) == null ? void 0 : _a.$members$) || {});
1427
1552
  members.forEach(([memberName, [memberFlags, metaAttributeName]]) => {
1428
- var _a2, _b;
1553
+ var _a2, _b2;
1429
1554
  if (!(memberFlags & 31 /* Prop */)) {
1430
1555
  return;
1431
1556
  }
@@ -1435,13 +1560,13 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1435
1560
  const attrPropVal = parsePropertyValue(
1436
1561
  attrVal,
1437
1562
  memberFlags,
1438
- import_app_data6.BUILD.formAssociated && !!(((_a2 = hostRef.$cmpMeta$) == null ? void 0 : _a2.$flags$) & 64 /* formAssociated */)
1563
+ import_app_data7.BUILD.formAssociated && !!(((_a2 = hostRef.$cmpMeta$) == null ? void 0 : _a2.$flags$) & 64 /* formAssociated */)
1439
1564
  );
1440
- (_b = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _b.set(memberName, attrPropVal);
1565
+ (_b2 = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _b2.set(memberName, attrPropVal);
1441
1566
  }
1442
1567
  });
1443
1568
  let scopeId2;
1444
- if (import_app_data6.BUILD.scoped) {
1569
+ if (import_app_data7.BUILD.scoped) {
1445
1570
  const cmpMeta = hostRef.$cmpMeta$;
1446
1571
  if (cmpMeta && cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */ && hostElm["s-sc"]) {
1447
1572
  scopeId2 = hostElm["s-sc"];
@@ -1478,6 +1603,16 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1478
1603
  if (childRenderNode.$tag$ === "slot") {
1479
1604
  node["s-cr"] = hostElm["s-cr"];
1480
1605
  }
1606
+ } else if (((_b = childRenderNode.$tag$) == null ? void 0 : _b.toString().includes("-")) && !childRenderNode.$elm$.shadowRoot) {
1607
+ const cmpMeta = getHostRef(childRenderNode.$elm$);
1608
+ const scopeId3 = getScopeId(
1609
+ cmpMeta.$cmpMeta$,
1610
+ import_app_data7.BUILD.mode ? childRenderNode.$elm$.getAttribute("s-mode") : void 0
1611
+ );
1612
+ const styleSheet = win.document.querySelector(`style[sty-id="${scopeId3}"]`);
1613
+ if (styleSheet) {
1614
+ hostElm.shadowRoot.append(styleSheet.cloneNode(true));
1615
+ }
1481
1616
  }
1482
1617
  if (childRenderNode.$tag$ === "slot") {
1483
1618
  childRenderNode.$name$ = childRenderNode.$elm$["s-sn"] || childRenderNode.$elm$["name"] || null;
@@ -1493,7 +1628,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1493
1628
  }
1494
1629
  }
1495
1630
  if (orgLocationNode && orgLocationNode.isConnected) {
1496
- if (shadowRoot && orgLocationNode["s-en"] === "") {
1631
+ if (orgLocationNode.parentElement.shadowRoot && orgLocationNode["s-en"] === "") {
1497
1632
  orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
1498
1633
  }
1499
1634
  orgLocationNode.parentNode.removeChild(orgLocationNode);
@@ -1501,7 +1636,9 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1501
1636
  node["s-oo"] = parseInt(childRenderNode.$nodeId$);
1502
1637
  }
1503
1638
  }
1504
- plt.$orgLocNodes$.delete(orgLocationId);
1639
+ if (orgLocationNode && !orgLocationNode["s-id"]) {
1640
+ plt.$orgLocNodes$.delete(orgLocationId);
1641
+ }
1505
1642
  }
1506
1643
  const hosts = [];
1507
1644
  const snLen = slottedNodes.length;
@@ -1523,14 +1660,16 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1523
1660
  if (!hosts[slottedItem.hostId]) continue;
1524
1661
  const hostEle = hosts[slottedItem.hostId];
1525
1662
  if (!hostEle.shadowRoot || !shadowRoot) {
1526
- slottedItem.slot["s-cr"] = hostEle["s-cr"];
1527
- if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
1528
- slottedItem.slot["s-cr"] = hostEle;
1529
- } else {
1530
- slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1663
+ if (!slottedItem.slot["s-cr"]) {
1664
+ slottedItem.slot["s-cr"] = hostEle["s-cr"];
1665
+ if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
1666
+ slottedItem.slot["s-cr"] = hostEle;
1667
+ } else {
1668
+ slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1669
+ }
1531
1670
  }
1532
1671
  addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
1533
- if (import_app_data6.BUILD.experimentalSlotFixes) {
1672
+ if (import_app_data7.BUILD.experimentalSlotFixes) {
1534
1673
  patchSlottedNode(slottedItem.node);
1535
1674
  }
1536
1675
  }
@@ -1539,12 +1678,12 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1539
1678
  }
1540
1679
  }
1541
1680
  }
1542
- if (import_app_data6.BUILD.scoped && scopeId2 && slotNodes.length) {
1681
+ if (import_app_data7.BUILD.scoped && scopeId2 && slotNodes.length) {
1543
1682
  slotNodes.forEach((slot) => {
1544
1683
  slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
1545
1684
  });
1546
1685
  }
1547
- if (import_app_data6.BUILD.shadowDom && shadowRoot && !shadowRoot.childNodes.length) {
1686
+ if (import_app_data7.BUILD.shadowDom && shadowRoot) {
1548
1687
  let rnIdex = 0;
1549
1688
  const rnLen = shadowRootNodes.length;
1550
1689
  if (rnLen) {
@@ -1555,14 +1694,13 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1555
1694
  if (typeof node["s-en"] !== "string" && typeof node["s-sn"] !== "string") {
1556
1695
  if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
1557
1696
  node.removeAttribute("hidden");
1558
- } else if (node.nodeType === 8 /* CommentNode */ || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1697
+ } else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1559
1698
  node.parentNode.removeChild(node);
1560
1699
  }
1561
1700
  }
1562
1701
  });
1563
1702
  }
1564
1703
  }
1565
- plt.$orgLocNodes$.delete(hostElm["s-id"]);
1566
1704
  hostRef.$hostElement$ = hostElm;
1567
1705
  endHydrate();
1568
1706
  };
@@ -1594,7 +1732,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1594
1732
  if (!parentVNode.$children$) {
1595
1733
  parentVNode.$children$ = [];
1596
1734
  }
1597
- if (import_app_data6.BUILD.scoped && scopeId2) {
1735
+ if (import_app_data7.BUILD.scoped && scopeId2 && childIdSplt[0] === hostId) {
1598
1736
  node["s-si"] = scopeId2;
1599
1737
  childVNode.$attrs$.class += " " + scopeId2;
1600
1738
  }
@@ -1612,7 +1750,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1612
1750
  shadowRootNodes,
1613
1751
  slottedNodes
1614
1752
  );
1615
- if (import_app_data6.BUILD.scoped && scopeId2) {
1753
+ if (import_app_data7.BUILD.scoped && scopeId2) {
1616
1754
  node.classList.add(scopeId2);
1617
1755
  }
1618
1756
  }
@@ -1709,9 +1847,9 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1709
1847
  slottedNodes
1710
1848
  );
1711
1849
  } else if (childNodeType === CONTENT_REF_ID) {
1712
- if (import_app_data6.BUILD.shadowDom && shadowRootNodes) {
1850
+ if (import_app_data7.BUILD.shadowDom && shadowRootNodes) {
1713
1851
  node.remove();
1714
- } else if (import_app_data6.BUILD.slotRelocation) {
1852
+ } else if (import_app_data7.BUILD.slotRelocation) {
1715
1853
  hostElm["s-cr"] = node;
1716
1854
  node["s-cn"] = true;
1717
1855
  }
@@ -1724,7 +1862,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1724
1862
  vnode.$index$ = "0";
1725
1863
  parentVNode.$children$ = [vnode];
1726
1864
  } else {
1727
- if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1865
+ if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim() && !node["s-nr"]) {
1728
1866
  node.remove();
1729
1867
  }
1730
1868
  }
@@ -1777,15 +1915,15 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1777
1915
  childVNode.$name$ = slotName || null;
1778
1916
  childVNode.$tag$ = "slot";
1779
1917
  const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
1780
- if (import_app_data6.BUILD.shadowDom && shadowRootNodes && win.document) {
1918
+ if (import_app_data7.BUILD.shadowDom && shadowRootNodes && win.document) {
1781
1919
  const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$);
1782
1920
  if (childVNode.$name$) {
1783
1921
  childVNode.$elm$.setAttribute("name", slotName);
1784
1922
  }
1785
- if (parentNodeId && parentNodeId !== childVNode.$hostId$) {
1786
- parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1923
+ if (parentVNode.$elm$.shadowRoot && parentNodeId && parentNodeId !== childVNode.$hostId$) {
1924
+ internalCall(parentVNode.$elm$, "insertBefore")(slot, internalCall(parentVNode.$elm$, "children")[0]);
1787
1925
  } else {
1788
- node.parentNode.insertBefore(slot, node);
1926
+ internalCall(internalCall(node, "parentNode"), "insertBefore")(slot, node);
1789
1927
  }
1790
1928
  addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
1791
1929
  node.remove();
@@ -1811,7 +1949,7 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1811
1949
  var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
1812
1950
  let slottedNode = slotNode.nextSibling;
1813
1951
  slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
1814
- 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 */))) {
1952
+ 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"))) {
1815
1953
  slottedNode["s-sn"] = slotName;
1816
1954
  slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
1817
1955
  slottedNode = slottedNode.nextSibling;
@@ -2246,31 +2384,31 @@ var import_app_data16 = require("@stencil/core/internal/app-data");
2246
2384
  var import_app_data15 = require("@stencil/core/internal/app-data");
2247
2385
 
2248
2386
  // src/runtime/parse-property-value.ts
2249
- var import_app_data7 = require("@stencil/core/internal/app-data");
2387
+ var import_app_data8 = require("@stencil/core/internal/app-data");
2250
2388
  var parsePropertyValue = (propValue, propType, isFormAssociated) => {
2251
- if ((import_app_data7.BUILD.hydrateClientSide || import_app_data7.BUILD.hydrateServerSide) && typeof propValue === "string" && (propValue.startsWith("{") && propValue.endsWith("}") || propValue.startsWith("[") && propValue.endsWith("]"))) {
2389
+ if ((import_app_data8.BUILD.hydrateClientSide || import_app_data8.BUILD.hydrateServerSide) && typeof propValue === "string" && (propValue.startsWith("{") && propValue.endsWith("}") || propValue.startsWith("[") && propValue.endsWith("]"))) {
2252
2390
  try {
2253
2391
  propValue = JSON.parse(propValue);
2254
2392
  return propValue;
2255
2393
  } catch (e) {
2256
2394
  }
2257
2395
  }
2258
- if ((import_app_data7.BUILD.hydrateClientSide || import_app_data7.BUILD.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2396
+ if ((import_app_data8.BUILD.hydrateClientSide || import_app_data8.BUILD.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2259
2397
  propValue = deserializeProperty(propValue);
2260
2398
  return propValue;
2261
2399
  }
2262
2400
  if (propValue != null && !isComplexType(propValue)) {
2263
- if (import_app_data7.BUILD.propBoolean && propType & 4 /* Boolean */) {
2264
- if (import_app_data7.BUILD.formAssociated && isFormAssociated && typeof propValue === "string") {
2401
+ if (import_app_data8.BUILD.propBoolean && propType & 4 /* Boolean */) {
2402
+ if (import_app_data8.BUILD.formAssociated && isFormAssociated && typeof propValue === "string") {
2265
2403
  return propValue === "" || !!propValue;
2266
2404
  } else {
2267
2405
  return propValue === "false" ? false : propValue === "" || !!propValue;
2268
2406
  }
2269
2407
  }
2270
- if (import_app_data7.BUILD.propNumber && propType & 2 /* Number */) {
2408
+ if (import_app_data8.BUILD.propNumber && propType & 2 /* Number */) {
2271
2409
  return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
2272
2410
  }
2273
- if (import_app_data7.BUILD.propString && propType & 1 /* String */) {
2411
+ if (import_app_data8.BUILD.propString && propType & 1 /* String */) {
2274
2412
  return String(propValue);
2275
2413
  }
2276
2414
  return propValue;
@@ -2282,18 +2420,18 @@ var parsePropertyValue = (propValue, propType, isFormAssociated) => {
2282
2420
  var import_app_data14 = require("@stencil/core/internal/app-data");
2283
2421
 
2284
2422
  // src/runtime/event-emitter.ts
2285
- var import_app_data9 = require("@stencil/core/internal/app-data");
2423
+ var import_app_data10 = require("@stencil/core/internal/app-data");
2286
2424
 
2287
2425
  // src/runtime/element.ts
2288
- var import_app_data8 = require("@stencil/core/internal/app-data");
2289
- var getElement = (ref) => import_app_data8.BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
2426
+ var import_app_data9 = require("@stencil/core/internal/app-data");
2427
+ var getElement = (ref) => import_app_data9.BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
2290
2428
 
2291
2429
  // src/runtime/event-emitter.ts
2292
2430
  var createEvent = (ref, name, flags) => {
2293
2431
  const elm = getElement(ref);
2294
2432
  return {
2295
2433
  emit: (detail) => {
2296
- if (import_app_data9.BUILD.isDev && !elm.isConnected) {
2434
+ if (import_app_data10.BUILD.isDev && !elm.isConnected) {
2297
2435
  consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
2298
2436
  }
2299
2437
  return emitEvent(elm, name, {
@@ -2311,131 +2449,6 @@ var emitEvent = (elm, name, opts) => {
2311
2449
  return ev;
2312
2450
  };
2313
2451
 
2314
- // src/runtime/styles.ts
2315
- var import_app_data10 = require("@stencil/core/internal/app-data");
2316
- var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
2317
- var registerStyle = (scopeId2, cssText, allowCS) => {
2318
- let style = styles.get(scopeId2);
2319
- if (supportsConstructableStylesheets && allowCS) {
2320
- style = style || new CSSStyleSheet();
2321
- if (typeof style === "string") {
2322
- style = cssText;
2323
- } else {
2324
- style.replaceSync(cssText);
2325
- }
2326
- } else {
2327
- style = cssText;
2328
- }
2329
- styles.set(scopeId2, style);
2330
- };
2331
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
2332
- var _a;
2333
- const scopeId2 = getScopeId(cmpMeta, mode);
2334
- const style = styles.get(scopeId2);
2335
- if (!import_app_data10.BUILD.attachStyles || !win.document) {
2336
- return scopeId2;
2337
- }
2338
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
2339
- if (style) {
2340
- if (typeof style === "string") {
2341
- styleContainerNode = styleContainerNode.head || styleContainerNode;
2342
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
2343
- let styleElm;
2344
- if (!appliedStyles) {
2345
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
2346
- }
2347
- if (!appliedStyles.has(scopeId2)) {
2348
- if (import_app_data10.BUILD.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
2349
- styleElm.innerHTML = style;
2350
- } else {
2351
- styleElm = win.document.createElement("style");
2352
- styleElm.innerHTML = style;
2353
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
2354
- if (nonce != null) {
2355
- styleElm.setAttribute("nonce", nonce);
2356
- }
2357
- if ((import_app_data10.BUILD.hydrateServerSide || import_app_data10.BUILD.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) {
2358
- styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
2359
- }
2360
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
2361
- if (styleContainerNode.nodeName === "HEAD") {
2362
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
2363
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
2364
- styleContainerNode.insertBefore(
2365
- styleElm,
2366
- (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
2367
- );
2368
- } else if ("host" in styleContainerNode) {
2369
- if (supportsConstructableStylesheets) {
2370
- const stylesheet = new CSSStyleSheet();
2371
- stylesheet.replaceSync(style);
2372
- if (supportsMutableAdoptedStyleSheets) {
2373
- styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
2374
- } else {
2375
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
2376
- }
2377
- } else {
2378
- const existingStyleContainer = styleContainerNode.querySelector("style");
2379
- if (existingStyleContainer) {
2380
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
2381
- } else {
2382
- styleContainerNode.prepend(styleElm);
2383
- }
2384
- }
2385
- } else {
2386
- styleContainerNode.append(styleElm);
2387
- }
2388
- }
2389
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2390
- styleContainerNode.insertBefore(styleElm, null);
2391
- }
2392
- }
2393
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
2394
- styleElm.innerHTML += SLOT_FB_CSS;
2395
- }
2396
- if (appliedStyles) {
2397
- appliedStyles.add(scopeId2);
2398
- }
2399
- }
2400
- } else if (import_app_data10.BUILD.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
2401
- if (supportsMutableAdoptedStyleSheets) {
2402
- styleContainerNode.adoptedStyleSheets.push(style);
2403
- } else {
2404
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
2405
- }
2406
- }
2407
- }
2408
- return scopeId2;
2409
- };
2410
- var attachStyles = (hostRef) => {
2411
- const cmpMeta = hostRef.$cmpMeta$;
2412
- const elm = hostRef.$hostElement$;
2413
- const flags = cmpMeta.$flags$;
2414
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
2415
- const scopeId2 = addStyle(
2416
- import_app_data10.BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
2417
- cmpMeta,
2418
- hostRef.$modeName$
2419
- );
2420
- if ((import_app_data10.BUILD.shadowDom || import_app_data10.BUILD.scoped) && import_app_data10.BUILD.cssAnnotations && flags & 10 /* needsScopedEncapsulation */) {
2421
- elm["s-sc"] = scopeId2;
2422
- elm.classList.add(scopeId2 + "-h");
2423
- }
2424
- endAttachStyles();
2425
- };
2426
- var getScopeId = (cmp, mode) => "sc-" + (import_app_data10.BUILD.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
2427
- var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
2428
- var hydrateScopedToShadow = () => {
2429
- if (!win.document) {
2430
- return;
2431
- }
2432
- const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2433
- let i2 = 0;
2434
- for (; i2 < styles2.length; i2++) {
2435
- registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
2436
- }
2437
- };
2438
-
2439
2452
  // src/runtime/vdom/vdom-render.ts
2440
2453
  var import_app_data13 = require("@stencil/core/internal/app-data");
2441
2454
 
@@ -2454,12 +2467,13 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
2454
2467
  const classList = elm.classList;
2455
2468
  const oldClasses = parseClassList(oldValue);
2456
2469
  let newClasses = parseClassList(newValue);
2457
- if (import_app_data11.BUILD.hydrateClientSide && elm["s-si"] && initialRender) {
2458
- newClasses.push(elm["s-si"]);
2470
+ if (import_app_data11.BUILD.hydrateClientSide && (elm["s-si"] || elm["s-sc"]) && initialRender) {
2471
+ const scopeId2 = elm["s-sc"] || elm["s-si"];
2472
+ newClasses.push(scopeId2);
2459
2473
  oldClasses.forEach((c) => {
2460
- if (c.startsWith(elm["s-si"])) newClasses.push(c);
2474
+ if (c.startsWith(scopeId2)) newClasses.push(c);
2461
2475
  });
2462
- newClasses = [...new Set(newClasses)];
2476
+ newClasses = [...new Set(newClasses)].filter((c) => c);
2463
2477
  classList.add(...newClasses);
2464
2478
  } else {
2465
2479
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
@@ -2941,6 +2955,8 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
2941
2955
  !isInitialRender && import_app_data13.BUILD.updatable && oldChildren !== null
2942
2956
  ) {
2943
2957
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
2958
+ } else if (import_app_data13.BUILD.hydrateClientSide && isInitialRender && import_app_data13.BUILD.updatable && oldChildren !== null && newChildren === null) {
2959
+ newVNode2.$children$ = oldChildren;
2944
2960
  }
2945
2961
  if (import_app_data13.BUILD.svg && isSvgMode && tag === "svg") {
2946
2962
  isSvgMode = false;
@@ -3408,10 +3424,16 @@ var forceUpdate = (ref) => {
3408
3424
  return false;
3409
3425
  };
3410
3426
  var appDidLoad = (who) => {
3427
+ var _a;
3411
3428
  if (import_app_data14.BUILD.asyncQueue) {
3412
3429
  plt.$flags$ |= 2 /* appLoaded */;
3413
3430
  }
3414
3431
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: import_app_data14.NAMESPACE } }));
3432
+ if (import_app_data14.BUILD.hydrateClientSide) {
3433
+ if ((_a = plt.$orgLocNodes$) == null ? void 0 : _a.size) {
3434
+ plt.$orgLocNodes$.clear();
3435
+ }
3436
+ }
3415
3437
  if (import_app_data14.BUILD.profile && performance.measure) {
3416
3438
  performance.measure(`[Stencil] ${import_app_data14.NAMESPACE} initial load (by ${who})`, "st:app:start");
3417
3439
  }
@@ -3843,6 +3865,11 @@ var connectedCallback = (elm) => {
3843
3865
  if (import_app_data18.BUILD.hydrateServerSide || (import_app_data18.BUILD.slot || import_app_data18.BUILD.shadowDom) && // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
3844
3866
  cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
3845
3867
  setContentReference(elm);
3868
+ } else if (import_app_data18.BUILD.hydrateClientSide && !(cmpMeta.$flags$ & 4 /* hasSlotRelocation */)) {
3869
+ const commendPlaceholder = elm.firstChild;
3870
+ if ((commendPlaceholder == null ? void 0 : commendPlaceholder.nodeType) === 8 /* CommentNode */ && !commendPlaceholder["s-cn"] && !commendPlaceholder.nodeValue) {
3871
+ elm.removeChild(commendPlaceholder);
3872
+ }
3846
3873
  }
3847
3874
  }
3848
3875
  if (import_app_data18.BUILD.asyncLoading) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/testing",
3
- "version": "4.35.3-dev.1752112116.e504206",
3
+ "version": "4.35.3-dev.1752123834.56fe6e3",
4
4
  "description": "Stencil internal testing platform to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "private": true