@stencil/core 4.35.1 → 4.35.3-dev.1751519082.58bc2b5

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.
Files changed (38) hide show
  1. package/cli/index.cjs +1 -1
  2. package/cli/index.js +1 -1
  3. package/cli/package.json +1 -1
  4. package/compiler/package.json +1 -1
  5. package/compiler/stencil.js +7 -7
  6. package/dev-server/client/index.js +1 -1
  7. package/dev-server/client/package.json +1 -1
  8. package/dev-server/connector.html +2 -2
  9. package/dev-server/index.js +1 -1
  10. package/dev-server/package.json +1 -1
  11. package/dev-server/server-process.js +2 -2
  12. package/internal/app-data/package.json +1 -1
  13. package/internal/app-globals/package.json +1 -1
  14. package/internal/client/index.js +216 -180
  15. package/internal/client/package.json +1 -1
  16. package/internal/client/patch-browser.js +1 -1
  17. package/internal/hydrate/index.js +216 -180
  18. package/internal/hydrate/package.json +1 -1
  19. package/internal/hydrate/runner.js +43 -13
  20. package/internal/package.json +1 -1
  21. package/internal/stencil-public-compiler.d.ts +1 -0
  22. package/internal/stencil-public-runtime.d.ts +12 -5
  23. package/internal/testing/index.js +213 -179
  24. package/internal/testing/package.json +1 -1
  25. package/mock-doc/index.cjs +35 -5
  26. package/mock-doc/index.d.ts +16 -0
  27. package/mock-doc/index.js +35 -5
  28. package/mock-doc/package.json +1 -1
  29. package/package.json +1 -1
  30. package/screenshot/index.js +1 -1
  31. package/screenshot/package.json +1 -1
  32. package/screenshot/pixel-match.js +1 -1
  33. package/sys/node/index.js +14 -14
  34. package/sys/node/package.json +1 -1
  35. package/sys/node/worker.js +1 -1
  36. package/testing/index.js +5 -5
  37. package/testing/package.json +1 -1
  38. package/testing/puppeteer/puppeteer-browser.d.ts +5 -5
@@ -592,17 +592,24 @@ var globalStyles = (
592
592
  ""
593
593
  );
594
594
 
595
+ // src/utils/style.ts
596
+ function createStyleSheetIfNeededAndSupported(styles2) {
597
+ if (!styles2 || !supportsConstructableStylesheets) return void 0;
598
+ const sheet = new CSSStyleSheet();
599
+ sheet.replaceSync(styles2);
600
+ return sheet;
601
+ }
602
+
595
603
  // src/utils/shadow-root.ts
604
+ var globalStyleSheet;
596
605
  function createShadowRoot(cmpMeta) {
606
+ var _a;
597
607
  const shadowRoot = import_app_data.BUILD.shadowDelegatesFocus ? this.attachShadow({
598
608
  mode: "open",
599
609
  delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
600
610
  }) : this.attachShadow({ mode: "open" });
601
- if (supportsConstructableStylesheets) {
602
- const sheet = new CSSStyleSheet();
603
- sheet.replaceSync(globalStyles);
604
- shadowRoot.adoptedStyleSheets.push(sheet);
605
- }
611
+ if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported(globalStyles)) != null ? _a : null;
612
+ if (globalStyleSheet) shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
606
613
  }
607
614
 
608
615
  // src/utils/util.ts
@@ -623,7 +630,7 @@ var isJsFile = lowerPathParam((p) => p.endsWith(".js") || p.endsWith(".mjs") ||
623
630
  var import_app_data18 = require("@stencil/core/internal/app-data");
624
631
 
625
632
  // src/runtime/client-hydrate.ts
626
- var import_app_data6 = require("@stencil/core/internal/app-data");
633
+ var import_app_data7 = require("@stencil/core/internal/app-data");
627
634
 
628
635
  // src/runtime/dom-extras.ts
629
636
  var import_app_data3 = require("@stencil/core/internal/app-data");
@@ -1257,8 +1264,125 @@ var installDevTools = () => {
1257
1264
  }
1258
1265
  };
1259
1266
 
1260
- // src/runtime/vdom/h.ts
1267
+ // src/runtime/styles.ts
1261
1268
  var import_app_data5 = require("@stencil/core/internal/app-data");
1269
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
1270
+ var registerStyle = (scopeId2, cssText, allowCS) => {
1271
+ let style = styles.get(scopeId2);
1272
+ if (supportsConstructableStylesheets && allowCS) {
1273
+ style = style || new CSSStyleSheet();
1274
+ if (typeof style === "string") {
1275
+ style = cssText;
1276
+ } else {
1277
+ style.replaceSync(cssText);
1278
+ }
1279
+ } else {
1280
+ style = cssText;
1281
+ }
1282
+ styles.set(scopeId2, style);
1283
+ };
1284
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
1285
+ var _a;
1286
+ const scopeId2 = getScopeId(cmpMeta, mode);
1287
+ const style = styles.get(scopeId2);
1288
+ if (!import_app_data5.BUILD.attachStyles || !win.document) {
1289
+ return scopeId2;
1290
+ }
1291
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
1292
+ if (style) {
1293
+ if (typeof style === "string") {
1294
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
1295
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
1296
+ let styleElm;
1297
+ if (!appliedStyles) {
1298
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
1299
+ }
1300
+ if (!appliedStyles.has(scopeId2)) {
1301
+ if (import_app_data5.BUILD.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
1302
+ styleElm.innerHTML = style;
1303
+ } else {
1304
+ styleElm = win.document.createElement("style");
1305
+ styleElm.innerHTML = style;
1306
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1307
+ if (nonce != null) {
1308
+ styleElm.setAttribute("nonce", nonce);
1309
+ }
1310
+ if ((import_app_data5.BUILD.hydrateServerSide || import_app_data5.BUILD.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) {
1311
+ styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
1312
+ }
1313
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
1314
+ if (styleContainerNode.nodeName === "HEAD") {
1315
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
1316
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
1317
+ styleContainerNode.insertBefore(
1318
+ styleElm,
1319
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
1320
+ );
1321
+ } else if ("host" in styleContainerNode) {
1322
+ if (supportsConstructableStylesheets) {
1323
+ const stylesheet = new CSSStyleSheet();
1324
+ stylesheet.replaceSync(style);
1325
+ styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
1326
+ } else {
1327
+ const existingStyleContainer = styleContainerNode.querySelector("style");
1328
+ if (existingStyleContainer) {
1329
+ existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
1330
+ } else {
1331
+ styleContainerNode.prepend(styleElm);
1332
+ }
1333
+ }
1334
+ } else {
1335
+ styleContainerNode.append(styleElm);
1336
+ }
1337
+ }
1338
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1339
+ styleContainerNode.insertBefore(styleElm, null);
1340
+ }
1341
+ }
1342
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
1343
+ styleElm.innerHTML += SLOT_FB_CSS;
1344
+ }
1345
+ if (appliedStyles) {
1346
+ appliedStyles.add(scopeId2);
1347
+ }
1348
+ }
1349
+ } else if (import_app_data5.BUILD.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
1350
+ styleContainerNode.adoptedStyleSheets.push(style);
1351
+ }
1352
+ }
1353
+ return scopeId2;
1354
+ };
1355
+ var attachStyles = (hostRef) => {
1356
+ const cmpMeta = hostRef.$cmpMeta$;
1357
+ const elm = hostRef.$hostElement$;
1358
+ const flags = cmpMeta.$flags$;
1359
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
1360
+ const scopeId2 = addStyle(
1361
+ import_app_data5.BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
1362
+ cmpMeta,
1363
+ hostRef.$modeName$
1364
+ );
1365
+ if ((import_app_data5.BUILD.shadowDom || import_app_data5.BUILD.scoped) && import_app_data5.BUILD.cssAnnotations && flags & 10 /* needsScopedEncapsulation */) {
1366
+ elm["s-sc"] = scopeId2;
1367
+ elm.classList.add(scopeId2 + "-h");
1368
+ }
1369
+ endAttachStyles();
1370
+ };
1371
+ var getScopeId = (cmp, mode) => "sc-" + (import_app_data5.BUILD.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
1372
+ var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
1373
+ var hydrateScopedToShadow = () => {
1374
+ if (!win.document) {
1375
+ return;
1376
+ }
1377
+ const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
1378
+ let i2 = 0;
1379
+ for (; i2 < styles2.length; i2++) {
1380
+ registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
1381
+ }
1382
+ };
1383
+
1384
+ // src/runtime/vdom/h.ts
1385
+ var import_app_data6 = require("@stencil/core/internal/app-data");
1262
1386
  var h = (nodeName, vnodeData, ...children) => {
1263
1387
  let child = null;
1264
1388
  let key = null;
@@ -1274,7 +1398,7 @@ var h = (nodeName, vnodeData, ...children) => {
1274
1398
  } else if (child != null && typeof child !== "boolean") {
1275
1399
  if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
1276
1400
  child = String(child);
1277
- } else if (import_app_data5.BUILD.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
1401
+ } else if (import_app_data6.BUILD.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
1278
1402
  consoleDevError(`vNode passed as children has unexpected type.
1279
1403
  Make sure it's using the correct h() function.
1280
1404
  Empty objects can also be the cause, look for JSX comments that became objects.`);
@@ -1290,28 +1414,28 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
1290
1414
  };
1291
1415
  walk(children);
1292
1416
  if (vnodeData) {
1293
- if (import_app_data5.BUILD.isDev && nodeName === "input") {
1417
+ if (import_app_data6.BUILD.isDev && nodeName === "input") {
1294
1418
  validateInputProperties(vnodeData);
1295
1419
  }
1296
- if (import_app_data5.BUILD.vdomKey && vnodeData.key) {
1420
+ if (import_app_data6.BUILD.vdomKey && vnodeData.key) {
1297
1421
  key = vnodeData.key;
1298
1422
  }
1299
- if (import_app_data5.BUILD.slotRelocation && vnodeData.name) {
1423
+ if (import_app_data6.BUILD.slotRelocation && vnodeData.name) {
1300
1424
  slotName = vnodeData.name;
1301
1425
  }
1302
- if (import_app_data5.BUILD.vdomClass) {
1426
+ if (import_app_data6.BUILD.vdomClass) {
1303
1427
  const classData = vnodeData.className || vnodeData.class;
1304
1428
  if (classData) {
1305
1429
  vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
1306
1430
  }
1307
1431
  }
1308
1432
  }
1309
- if (import_app_data5.BUILD.isDev && vNodeChildren.some(isHost)) {
1433
+ if (import_app_data6.BUILD.isDev && vNodeChildren.some(isHost)) {
1310
1434
  consoleDevError(`The <Host> must be the single root component. Make sure:
1311
1435
  - You are NOT using hostData() and <Host> in the same component.
1312
1436
  - <Host> is used once, and it's the single root component of the render() function.`);
1313
1437
  }
1314
- if (import_app_data5.BUILD.vdomFunctional && typeof nodeName === "function") {
1438
+ if (import_app_data6.BUILD.vdomFunctional && typeof nodeName === "function") {
1315
1439
  return nodeName(
1316
1440
  vnodeData === null ? {} : vnodeData,
1317
1441
  vNodeChildren,
@@ -1323,10 +1447,10 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
1323
1447
  if (vNodeChildren.length > 0) {
1324
1448
  vnode.$children$ = vNodeChildren;
1325
1449
  }
1326
- if (import_app_data5.BUILD.vdomKey) {
1450
+ if (import_app_data6.BUILD.vdomKey) {
1327
1451
  vnode.$key$ = key;
1328
1452
  }
1329
- if (import_app_data5.BUILD.slotRelocation) {
1453
+ if (import_app_data6.BUILD.slotRelocation) {
1330
1454
  vnode.$name$ = slotName;
1331
1455
  }
1332
1456
  return vnode;
@@ -1339,13 +1463,13 @@ var newVNode = (tag, text) => {
1339
1463
  $elm$: null,
1340
1464
  $children$: null
1341
1465
  };
1342
- if (import_app_data5.BUILD.vdomAttribute) {
1466
+ if (import_app_data6.BUILD.vdomAttribute) {
1343
1467
  vnode.$attrs$ = null;
1344
1468
  }
1345
- if (import_app_data5.BUILD.vdomKey) {
1469
+ if (import_app_data6.BUILD.vdomKey) {
1346
1470
  vnode.$key$ = null;
1347
1471
  }
1348
- if (import_app_data5.BUILD.slotRelocation) {
1472
+ if (import_app_data6.BUILD.slotRelocation) {
1349
1473
  vnode.$name$ = null;
1350
1474
  }
1351
1475
  return vnode;
@@ -1399,18 +1523,18 @@ var validateInputProperties = (inputElm) => {
1399
1523
 
1400
1524
  // src/runtime/client-hydrate.ts
1401
1525
  var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1402
- var _a;
1526
+ var _a, _b;
1403
1527
  const endHydrate = createTime("hydrateClient", tagName);
1404
1528
  const shadowRoot = hostElm.shadowRoot;
1405
1529
  const childRenderNodes = [];
1406
1530
  const slotNodes = [];
1407
1531
  const slottedNodes = [];
1408
- const shadowRootNodes = import_app_data6.BUILD.shadowDom && shadowRoot ? [] : null;
1532
+ const shadowRootNodes = import_app_data7.BUILD.shadowDom && shadowRoot ? [] : null;
1409
1533
  const vnode = newVNode(tagName, null);
1410
1534
  vnode.$elm$ = hostElm;
1411
1535
  const members = Object.entries(((_a = hostRef.$cmpMeta$) == null ? void 0 : _a.$members$) || {});
1412
1536
  members.forEach(([memberName, [memberFlags, metaAttributeName]]) => {
1413
- var _a2, _b;
1537
+ var _a2, _b2;
1414
1538
  if (!(memberFlags & 31 /* Prop */)) {
1415
1539
  return;
1416
1540
  }
@@ -1420,13 +1544,13 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1420
1544
  const attrPropVal = parsePropertyValue(
1421
1545
  attrVal,
1422
1546
  memberFlags,
1423
- import_app_data6.BUILD.formAssociated && !!(((_a2 = hostRef.$cmpMeta$) == null ? void 0 : _a2.$flags$) & 64 /* formAssociated */)
1547
+ import_app_data7.BUILD.formAssociated && !!(((_a2 = hostRef.$cmpMeta$) == null ? void 0 : _a2.$flags$) & 64 /* formAssociated */)
1424
1548
  );
1425
- (_b = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _b.set(memberName, attrPropVal);
1549
+ (_b2 = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _b2.set(memberName, attrPropVal);
1426
1550
  }
1427
1551
  });
1428
1552
  let scopeId2;
1429
- if (import_app_data6.BUILD.scoped) {
1553
+ if (import_app_data7.BUILD.scoped) {
1430
1554
  const cmpMeta = hostRef.$cmpMeta$;
1431
1555
  if (cmpMeta && cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */ && hostElm["s-sc"]) {
1432
1556
  scopeId2 = hostElm["s-sc"];
@@ -1463,6 +1587,16 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1463
1587
  if (childRenderNode.$tag$ === "slot") {
1464
1588
  node["s-cr"] = hostElm["s-cr"];
1465
1589
  }
1590
+ } else if (((_b = childRenderNode.$tag$) == null ? void 0 : _b.toString().includes("-")) && !childRenderNode.$elm$.shadowRoot) {
1591
+ const cmpMeta = getHostRef(childRenderNode.$elm$);
1592
+ const scopeId3 = getScopeId(
1593
+ cmpMeta.$cmpMeta$,
1594
+ import_app_data7.BUILD.mode ? childRenderNode.$elm$.getAttribute("s-mode") : void 0
1595
+ );
1596
+ const styleSheet = win.document.querySelector(`style[sty-id="${scopeId3}"]`);
1597
+ if (styleSheet) {
1598
+ hostElm.shadowRoot.append(styleSheet.cloneNode(true));
1599
+ }
1466
1600
  }
1467
1601
  if (childRenderNode.$tag$ === "slot") {
1468
1602
  childRenderNode.$name$ = childRenderNode.$elm$["s-sn"] || childRenderNode.$elm$["name"] || null;
@@ -1478,7 +1612,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1478
1612
  }
1479
1613
  }
1480
1614
  if (orgLocationNode && orgLocationNode.isConnected) {
1481
- if (shadowRoot && orgLocationNode["s-en"] === "") {
1615
+ if (orgLocationNode.parentElement.shadowRoot && orgLocationNode["s-en"] === "") {
1482
1616
  orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
1483
1617
  }
1484
1618
  orgLocationNode.parentNode.removeChild(orgLocationNode);
@@ -1486,7 +1620,9 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1486
1620
  node["s-oo"] = parseInt(childRenderNode.$nodeId$);
1487
1621
  }
1488
1622
  }
1489
- plt.$orgLocNodes$.delete(orgLocationId);
1623
+ if (orgLocationNode && !orgLocationNode["s-id"]) {
1624
+ plt.$orgLocNodes$.delete(orgLocationId);
1625
+ }
1490
1626
  }
1491
1627
  const hosts = [];
1492
1628
  const snLen = slottedNodes.length;
@@ -1508,14 +1644,16 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1508
1644
  if (!hosts[slottedItem.hostId]) continue;
1509
1645
  const hostEle = hosts[slottedItem.hostId];
1510
1646
  if (!hostEle.shadowRoot || !shadowRoot) {
1511
- slottedItem.slot["s-cr"] = hostEle["s-cr"];
1512
- if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
1513
- slottedItem.slot["s-cr"] = hostEle;
1514
- } else {
1515
- slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1647
+ if (!slottedItem.slot["s-cr"]) {
1648
+ slottedItem.slot["s-cr"] = hostEle["s-cr"];
1649
+ if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
1650
+ slottedItem.slot["s-cr"] = hostEle;
1651
+ } else {
1652
+ slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1653
+ }
1516
1654
  }
1517
1655
  addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
1518
- if (import_app_data6.BUILD.experimentalSlotFixes) {
1656
+ if (import_app_data7.BUILD.experimentalSlotFixes) {
1519
1657
  patchSlottedNode(slottedItem.node);
1520
1658
  }
1521
1659
  }
@@ -1524,12 +1662,12 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1524
1662
  }
1525
1663
  }
1526
1664
  }
1527
- if (import_app_data6.BUILD.scoped && scopeId2 && slotNodes.length) {
1665
+ if (import_app_data7.BUILD.scoped && scopeId2 && slotNodes.length) {
1528
1666
  slotNodes.forEach((slot) => {
1529
1667
  slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
1530
1668
  });
1531
1669
  }
1532
- if (import_app_data6.BUILD.shadowDom && shadowRoot && !shadowRoot.childNodes.length) {
1670
+ if (import_app_data7.BUILD.shadowDom && shadowRoot) {
1533
1671
  let rnIdex = 0;
1534
1672
  const rnLen = shadowRootNodes.length;
1535
1673
  if (rnLen) {
@@ -1540,14 +1678,13 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1540
1678
  if (typeof node["s-en"] !== "string" && typeof node["s-sn"] !== "string") {
1541
1679
  if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
1542
1680
  node.removeAttribute("hidden");
1543
- } else if (node.nodeType === 8 /* CommentNode */ || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1681
+ } else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1544
1682
  node.parentNode.removeChild(node);
1545
1683
  }
1546
1684
  }
1547
1685
  });
1548
1686
  }
1549
1687
  }
1550
- plt.$orgLocNodes$.delete(hostElm["s-id"]);
1551
1688
  hostRef.$hostElement$ = hostElm;
1552
1689
  endHydrate();
1553
1690
  };
@@ -1579,7 +1716,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1579
1716
  if (!parentVNode.$children$) {
1580
1717
  parentVNode.$children$ = [];
1581
1718
  }
1582
- if (import_app_data6.BUILD.scoped && scopeId2) {
1719
+ if (import_app_data7.BUILD.scoped && scopeId2 && childIdSplt[0] === hostId) {
1583
1720
  node["s-si"] = scopeId2;
1584
1721
  childVNode.$attrs$.class += " " + scopeId2;
1585
1722
  }
@@ -1597,7 +1734,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1597
1734
  shadowRootNodes,
1598
1735
  slottedNodes
1599
1736
  );
1600
- if (import_app_data6.BUILD.scoped && scopeId2) {
1737
+ if (import_app_data7.BUILD.scoped && scopeId2) {
1601
1738
  node.classList.add(scopeId2);
1602
1739
  }
1603
1740
  }
@@ -1694,9 +1831,9 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1694
1831
  slottedNodes
1695
1832
  );
1696
1833
  } else if (childNodeType === CONTENT_REF_ID) {
1697
- if (import_app_data6.BUILD.shadowDom && shadowRootNodes) {
1834
+ if (import_app_data7.BUILD.shadowDom && shadowRootNodes) {
1698
1835
  node.remove();
1699
- } else if (import_app_data6.BUILD.slotRelocation) {
1836
+ } else if (import_app_data7.BUILD.slotRelocation) {
1700
1837
  hostElm["s-cr"] = node;
1701
1838
  node["s-cn"] = true;
1702
1839
  }
@@ -1709,7 +1846,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1709
1846
  vnode.$index$ = "0";
1710
1847
  parentVNode.$children$ = [vnode];
1711
1848
  } else {
1712
- if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1849
+ if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim() && !node["s-nr"]) {
1713
1850
  node.remove();
1714
1851
  }
1715
1852
  }
@@ -1762,15 +1899,15 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1762
1899
  childVNode.$name$ = slotName || null;
1763
1900
  childVNode.$tag$ = "slot";
1764
1901
  const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
1765
- if (import_app_data6.BUILD.shadowDom && shadowRootNodes && win.document) {
1902
+ if (import_app_data7.BUILD.shadowDom && shadowRootNodes && win.document) {
1766
1903
  const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$);
1767
1904
  if (childVNode.$name$) {
1768
1905
  childVNode.$elm$.setAttribute("name", slotName);
1769
1906
  }
1770
- if (parentNodeId && parentNodeId !== childVNode.$hostId$) {
1771
- parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1907
+ if (parentVNode.$elm$.shadowRoot && parentNodeId && parentNodeId !== childVNode.$hostId$) {
1908
+ internalCall(parentVNode.$elm$, "insertBefore")(slot, internalCall(parentVNode.$elm$, "children")[0]);
1772
1909
  } else {
1773
- node.parentNode.insertBefore(slot, node);
1910
+ internalCall(internalCall(node, "parentNode"), "insertBefore")(slot, node);
1774
1911
  }
1775
1912
  addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
1776
1913
  node.remove();
@@ -1796,7 +1933,7 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1796
1933
  var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
1797
1934
  let slottedNode = slotNode.nextSibling;
1798
1935
  slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
1799
- 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 */))) {
1936
+ 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"))) {
1800
1937
  slottedNode["s-sn"] = slotName;
1801
1938
  slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
1802
1939
  slottedNode = slottedNode.nextSibling;
@@ -2231,31 +2368,31 @@ var import_app_data16 = require("@stencil/core/internal/app-data");
2231
2368
  var import_app_data15 = require("@stencil/core/internal/app-data");
2232
2369
 
2233
2370
  // src/runtime/parse-property-value.ts
2234
- var import_app_data7 = require("@stencil/core/internal/app-data");
2371
+ var import_app_data8 = require("@stencil/core/internal/app-data");
2235
2372
  var parsePropertyValue = (propValue, propType, isFormAssociated) => {
2236
- if ((import_app_data7.BUILD.hydrateClientSide || import_app_data7.BUILD.hydrateServerSide) && typeof propValue === "string" && (propValue.startsWith("{") && propValue.endsWith("}") || propValue.startsWith("[") && propValue.endsWith("]"))) {
2373
+ if ((import_app_data8.BUILD.hydrateClientSide || import_app_data8.BUILD.hydrateServerSide) && typeof propValue === "string" && (propValue.startsWith("{") && propValue.endsWith("}") || propValue.startsWith("[") && propValue.endsWith("]"))) {
2237
2374
  try {
2238
2375
  propValue = JSON.parse(propValue);
2239
2376
  return propValue;
2240
2377
  } catch (e) {
2241
2378
  }
2242
2379
  }
2243
- if ((import_app_data7.BUILD.hydrateClientSide || import_app_data7.BUILD.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2380
+ if ((import_app_data8.BUILD.hydrateClientSide || import_app_data8.BUILD.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2244
2381
  propValue = deserializeProperty(propValue);
2245
2382
  return propValue;
2246
2383
  }
2247
2384
  if (propValue != null && !isComplexType(propValue)) {
2248
- if (import_app_data7.BUILD.propBoolean && propType & 4 /* Boolean */) {
2249
- if (import_app_data7.BUILD.formAssociated && isFormAssociated && typeof propValue === "string") {
2385
+ if (import_app_data8.BUILD.propBoolean && propType & 4 /* Boolean */) {
2386
+ if (import_app_data8.BUILD.formAssociated && isFormAssociated && typeof propValue === "string") {
2250
2387
  return propValue === "" || !!propValue;
2251
2388
  } else {
2252
2389
  return propValue === "false" ? false : propValue === "" || !!propValue;
2253
2390
  }
2254
2391
  }
2255
- if (import_app_data7.BUILD.propNumber && propType & 2 /* Number */) {
2392
+ if (import_app_data8.BUILD.propNumber && propType & 2 /* Number */) {
2256
2393
  return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
2257
2394
  }
2258
- if (import_app_data7.BUILD.propString && propType & 1 /* String */) {
2395
+ if (import_app_data8.BUILD.propString && propType & 1 /* String */) {
2259
2396
  return String(propValue);
2260
2397
  }
2261
2398
  return propValue;
@@ -2267,18 +2404,18 @@ var parsePropertyValue = (propValue, propType, isFormAssociated) => {
2267
2404
  var import_app_data14 = require("@stencil/core/internal/app-data");
2268
2405
 
2269
2406
  // src/runtime/event-emitter.ts
2270
- var import_app_data9 = require("@stencil/core/internal/app-data");
2407
+ var import_app_data10 = require("@stencil/core/internal/app-data");
2271
2408
 
2272
2409
  // src/runtime/element.ts
2273
- var import_app_data8 = require("@stencil/core/internal/app-data");
2274
- var getElement = (ref) => import_app_data8.BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
2410
+ var import_app_data9 = require("@stencil/core/internal/app-data");
2411
+ var getElement = (ref) => import_app_data9.BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
2275
2412
 
2276
2413
  // src/runtime/event-emitter.ts
2277
2414
  var createEvent = (ref, name, flags) => {
2278
2415
  const elm = getElement(ref);
2279
2416
  return {
2280
2417
  emit: (detail) => {
2281
- if (import_app_data9.BUILD.isDev && !elm.isConnected) {
2418
+ if (import_app_data10.BUILD.isDev && !elm.isConnected) {
2282
2419
  consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
2283
2420
  }
2284
2421
  return emitEvent(elm, name, {
@@ -2296,123 +2433,6 @@ var emitEvent = (elm, name, opts) => {
2296
2433
  return ev;
2297
2434
  };
2298
2435
 
2299
- // src/runtime/styles.ts
2300
- var import_app_data10 = require("@stencil/core/internal/app-data");
2301
- var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
2302
- var registerStyle = (scopeId2, cssText, allowCS) => {
2303
- let style = styles.get(scopeId2);
2304
- if (supportsConstructableStylesheets && allowCS) {
2305
- style = style || new CSSStyleSheet();
2306
- if (typeof style === "string") {
2307
- style = cssText;
2308
- } else {
2309
- style.replaceSync(cssText);
2310
- }
2311
- } else {
2312
- style = cssText;
2313
- }
2314
- styles.set(scopeId2, style);
2315
- };
2316
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
2317
- var _a;
2318
- const scopeId2 = getScopeId(cmpMeta, mode);
2319
- const style = styles.get(scopeId2);
2320
- if (!import_app_data10.BUILD.attachStyles || !win.document) {
2321
- return scopeId2;
2322
- }
2323
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
2324
- if (style) {
2325
- if (typeof style === "string") {
2326
- styleContainerNode = styleContainerNode.head || styleContainerNode;
2327
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
2328
- let styleElm;
2329
- if (!appliedStyles) {
2330
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
2331
- }
2332
- if (!appliedStyles.has(scopeId2)) {
2333
- if (import_app_data10.BUILD.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
2334
- styleElm.innerHTML = style;
2335
- } else {
2336
- styleElm = win.document.createElement("style");
2337
- styleElm.innerHTML = style;
2338
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
2339
- if (nonce != null) {
2340
- styleElm.setAttribute("nonce", nonce);
2341
- }
2342
- if ((import_app_data10.BUILD.hydrateServerSide || import_app_data10.BUILD.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) {
2343
- styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
2344
- }
2345
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
2346
- if (styleContainerNode.nodeName === "HEAD") {
2347
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
2348
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
2349
- styleContainerNode.insertBefore(
2350
- styleElm,
2351
- (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
2352
- );
2353
- } else if ("host" in styleContainerNode) {
2354
- if (supportsConstructableStylesheets) {
2355
- const stylesheet = new CSSStyleSheet();
2356
- stylesheet.replaceSync(style);
2357
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
2358
- } else {
2359
- const existingStyleContainer = styleContainerNode.querySelector("style");
2360
- if (existingStyleContainer) {
2361
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
2362
- } else {
2363
- styleContainerNode.prepend(styleElm);
2364
- }
2365
- }
2366
- } else {
2367
- styleContainerNode.append(styleElm);
2368
- }
2369
- }
2370
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2371
- styleContainerNode.insertBefore(styleElm, null);
2372
- }
2373
- }
2374
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
2375
- styleElm.innerHTML += SLOT_FB_CSS;
2376
- }
2377
- if (appliedStyles) {
2378
- appliedStyles.add(scopeId2);
2379
- }
2380
- }
2381
- } else if (import_app_data10.BUILD.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
2382
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
2383
- }
2384
- }
2385
- return scopeId2;
2386
- };
2387
- var attachStyles = (hostRef) => {
2388
- const cmpMeta = hostRef.$cmpMeta$;
2389
- const elm = hostRef.$hostElement$;
2390
- const flags = cmpMeta.$flags$;
2391
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
2392
- const scopeId2 = addStyle(
2393
- import_app_data10.BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
2394
- cmpMeta,
2395
- hostRef.$modeName$
2396
- );
2397
- if ((import_app_data10.BUILD.shadowDom || import_app_data10.BUILD.scoped) && import_app_data10.BUILD.cssAnnotations && flags & 10 /* needsScopedEncapsulation */) {
2398
- elm["s-sc"] = scopeId2;
2399
- elm.classList.add(scopeId2 + "-h");
2400
- }
2401
- endAttachStyles();
2402
- };
2403
- var getScopeId = (cmp, mode) => "sc-" + (import_app_data10.BUILD.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
2404
- var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
2405
- var hydrateScopedToShadow = () => {
2406
- if (!win.document) {
2407
- return;
2408
- }
2409
- const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2410
- let i2 = 0;
2411
- for (; i2 < styles2.length; i2++) {
2412
- registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
2413
- }
2414
- };
2415
-
2416
2436
  // src/runtime/vdom/vdom-render.ts
2417
2437
  var import_app_data13 = require("@stencil/core/internal/app-data");
2418
2438
 
@@ -2431,12 +2451,13 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
2431
2451
  const classList = elm.classList;
2432
2452
  const oldClasses = parseClassList(oldValue);
2433
2453
  let newClasses = parseClassList(newValue);
2434
- if (import_app_data11.BUILD.hydrateClientSide && elm["s-si"] && initialRender) {
2435
- newClasses.push(elm["s-si"]);
2454
+ if (import_app_data11.BUILD.hydrateClientSide && (elm["s-si"] || elm["s-sc"]) && initialRender) {
2455
+ const scopeId2 = elm["s-sc"] || elm["s-si"];
2456
+ newClasses.push(scopeId2);
2436
2457
  oldClasses.forEach((c) => {
2437
- if (c.startsWith(elm["s-si"])) newClasses.push(c);
2458
+ if (c.startsWith(scopeId2)) newClasses.push(c);
2438
2459
  });
2439
- newClasses = [...new Set(newClasses)];
2460
+ newClasses = [...new Set(newClasses)].filter((c) => c);
2440
2461
  classList.add(...newClasses);
2441
2462
  } else {
2442
2463
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
@@ -2918,6 +2939,8 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
2918
2939
  !isInitialRender && import_app_data13.BUILD.updatable && oldChildren !== null
2919
2940
  ) {
2920
2941
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
2942
+ } else if (import_app_data13.BUILD.hydrateClientSide && isInitialRender && import_app_data13.BUILD.updatable && oldChildren !== null && newChildren === null) {
2943
+ newVNode2.$children$ = oldChildren;
2921
2944
  }
2922
2945
  if (import_app_data13.BUILD.svg && isSvgMode && tag === "svg") {
2923
2946
  isSvgMode = false;
@@ -3385,10 +3408,16 @@ var forceUpdate = (ref) => {
3385
3408
  return false;
3386
3409
  };
3387
3410
  var appDidLoad = (who) => {
3411
+ var _a;
3388
3412
  if (import_app_data14.BUILD.asyncQueue) {
3389
3413
  plt.$flags$ |= 2 /* appLoaded */;
3390
3414
  }
3391
3415
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: import_app_data14.NAMESPACE } }));
3416
+ if (import_app_data14.BUILD.hydrateClientSide) {
3417
+ if ((_a = plt.$orgLocNodes$) == null ? void 0 : _a.size) {
3418
+ plt.$orgLocNodes$.clear();
3419
+ }
3420
+ }
3392
3421
  if (import_app_data14.BUILD.profile && performance.measure) {
3393
3422
  performance.measure(`[Stencil] ${import_app_data14.NAMESPACE} initial load (by ${who})`, "st:app:start");
3394
3423
  }
@@ -3820,6 +3849,11 @@ var connectedCallback = (elm) => {
3820
3849
  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
3821
3850
  cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
3822
3851
  setContentReference(elm);
3852
+ } else if (import_app_data18.BUILD.hydrateClientSide && !(cmpMeta.$flags$ & 4 /* hasSlotRelocation */)) {
3853
+ const commendPlaceholder = elm.firstChild;
3854
+ if ((commendPlaceholder == null ? void 0 : commendPlaceholder.nodeType) === 8 /* CommentNode */ && !commendPlaceholder["s-cn"] && !commendPlaceholder.nodeValue) {
3855
+ elm.removeChild(commendPlaceholder);
3856
+ }
3823
3857
  }
3824
3858
  }
3825
3859
  if (import_app_data18.BUILD.asyncLoading) {