@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
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Client Platform v4.35.1 | MIT Licensed | https://stenciljs.com
2
+ Stencil Client Platform v4.35.3-dev.1751519082.58bc2b5 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -507,16 +507,25 @@ function deserializeProperty(value) {
507
507
  // src/utils/shadow-root.ts
508
508
  import { BUILD as BUILD8 } from "@stencil/core/internal/app-data";
509
509
  import { globalStyles } from "@stencil/core/internal/app-globals";
510
+
511
+ // src/utils/style.ts
512
+ function createStyleSheetIfNeededAndSupported(styles2) {
513
+ if (!styles2 || !supportsConstructableStylesheets) return void 0;
514
+ const sheet = new CSSStyleSheet();
515
+ sheet.replaceSync(styles2);
516
+ return sheet;
517
+ }
518
+
519
+ // src/utils/shadow-root.ts
520
+ var globalStyleSheet;
510
521
  function createShadowRoot(cmpMeta) {
522
+ var _a;
511
523
  const shadowRoot = BUILD8.shadowDelegatesFocus ? this.attachShadow({
512
524
  mode: "open",
513
525
  delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
514
526
  }) : this.attachShadow({ mode: "open" });
515
- if (supportsConstructableStylesheets) {
516
- const sheet = new CSSStyleSheet();
517
- sheet.replaceSync(globalStyles);
518
- shadowRoot.adoptedStyleSheets.push(sheet);
519
- }
527
+ if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported(globalStyles)) != null ? _a : null;
528
+ if (globalStyleSheet) shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
520
529
  }
521
530
 
522
531
  // src/utils/util.ts
@@ -537,7 +546,7 @@ var isJsFile = lowerPathParam((p) => p.endsWith(".js") || p.endsWith(".mjs") ||
537
546
  import { BUILD as BUILD25 } from "@stencil/core/internal/app-data";
538
547
 
539
548
  // src/runtime/client-hydrate.ts
540
- import { BUILD as BUILD13 } from "@stencil/core/internal/app-data";
549
+ import { BUILD as BUILD14 } from "@stencil/core/internal/app-data";
541
550
 
542
551
  // src/runtime/dom-extras.ts
543
552
  import { BUILD as BUILD10 } from "@stencil/core/internal/app-data";
@@ -1144,8 +1153,125 @@ var installDevTools = () => {
1144
1153
  }
1145
1154
  };
1146
1155
 
1147
- // src/runtime/vdom/h.ts
1156
+ // src/runtime/styles.ts
1148
1157
  import { BUILD as BUILD12 } from "@stencil/core/internal/app-data";
1158
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
1159
+ var registerStyle = (scopeId2, cssText, allowCS) => {
1160
+ let style = styles.get(scopeId2);
1161
+ if (supportsConstructableStylesheets && allowCS) {
1162
+ style = style || new CSSStyleSheet();
1163
+ if (typeof style === "string") {
1164
+ style = cssText;
1165
+ } else {
1166
+ style.replaceSync(cssText);
1167
+ }
1168
+ } else {
1169
+ style = cssText;
1170
+ }
1171
+ styles.set(scopeId2, style);
1172
+ };
1173
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
1174
+ var _a;
1175
+ const scopeId2 = getScopeId(cmpMeta, mode);
1176
+ const style = styles.get(scopeId2);
1177
+ if (!BUILD12.attachStyles || !win.document) {
1178
+ return scopeId2;
1179
+ }
1180
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
1181
+ if (style) {
1182
+ if (typeof style === "string") {
1183
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
1184
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
1185
+ let styleElm;
1186
+ if (!appliedStyles) {
1187
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
1188
+ }
1189
+ if (!appliedStyles.has(scopeId2)) {
1190
+ if (BUILD12.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
1191
+ styleElm.innerHTML = style;
1192
+ } else {
1193
+ styleElm = win.document.createElement("style");
1194
+ styleElm.innerHTML = style;
1195
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1196
+ if (nonce != null) {
1197
+ styleElm.setAttribute("nonce", nonce);
1198
+ }
1199
+ if ((BUILD12.hydrateServerSide || BUILD12.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) {
1200
+ styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
1201
+ }
1202
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
1203
+ if (styleContainerNode.nodeName === "HEAD") {
1204
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
1205
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
1206
+ styleContainerNode.insertBefore(
1207
+ styleElm,
1208
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
1209
+ );
1210
+ } else if ("host" in styleContainerNode) {
1211
+ if (supportsConstructableStylesheets) {
1212
+ const stylesheet = new CSSStyleSheet();
1213
+ stylesheet.replaceSync(style);
1214
+ styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
1215
+ } else {
1216
+ const existingStyleContainer = styleContainerNode.querySelector("style");
1217
+ if (existingStyleContainer) {
1218
+ existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
1219
+ } else {
1220
+ styleContainerNode.prepend(styleElm);
1221
+ }
1222
+ }
1223
+ } else {
1224
+ styleContainerNode.append(styleElm);
1225
+ }
1226
+ }
1227
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1228
+ styleContainerNode.insertBefore(styleElm, null);
1229
+ }
1230
+ }
1231
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
1232
+ styleElm.innerHTML += SLOT_FB_CSS;
1233
+ }
1234
+ if (appliedStyles) {
1235
+ appliedStyles.add(scopeId2);
1236
+ }
1237
+ }
1238
+ } else if (BUILD12.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
1239
+ styleContainerNode.adoptedStyleSheets.push(style);
1240
+ }
1241
+ }
1242
+ return scopeId2;
1243
+ };
1244
+ var attachStyles = (hostRef) => {
1245
+ const cmpMeta = hostRef.$cmpMeta$;
1246
+ const elm = hostRef.$hostElement$;
1247
+ const flags = cmpMeta.$flags$;
1248
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
1249
+ const scopeId2 = addStyle(
1250
+ BUILD12.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
1251
+ cmpMeta,
1252
+ hostRef.$modeName$
1253
+ );
1254
+ if ((BUILD12.shadowDom || BUILD12.scoped) && BUILD12.cssAnnotations && flags & 10 /* needsScopedEncapsulation */) {
1255
+ elm["s-sc"] = scopeId2;
1256
+ elm.classList.add(scopeId2 + "-h");
1257
+ }
1258
+ endAttachStyles();
1259
+ };
1260
+ var getScopeId = (cmp, mode) => "sc-" + (BUILD12.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
1261
+ var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
1262
+ var hydrateScopedToShadow = () => {
1263
+ if (!win.document) {
1264
+ return;
1265
+ }
1266
+ const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
1267
+ let i2 = 0;
1268
+ for (; i2 < styles2.length; i2++) {
1269
+ registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
1270
+ }
1271
+ };
1272
+
1273
+ // src/runtime/vdom/h.ts
1274
+ import { BUILD as BUILD13 } from "@stencil/core/internal/app-data";
1149
1275
  var h = (nodeName, vnodeData, ...children) => {
1150
1276
  let child = null;
1151
1277
  let key = null;
@@ -1161,7 +1287,7 @@ var h = (nodeName, vnodeData, ...children) => {
1161
1287
  } else if (child != null && typeof child !== "boolean") {
1162
1288
  if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
1163
1289
  child = String(child);
1164
- } else if (BUILD12.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
1290
+ } else if (BUILD13.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
1165
1291
  consoleDevError(`vNode passed as children has unexpected type.
1166
1292
  Make sure it's using the correct h() function.
1167
1293
  Empty objects can also be the cause, look for JSX comments that became objects.`);
@@ -1177,28 +1303,28 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
1177
1303
  };
1178
1304
  walk(children);
1179
1305
  if (vnodeData) {
1180
- if (BUILD12.isDev && nodeName === "input") {
1306
+ if (BUILD13.isDev && nodeName === "input") {
1181
1307
  validateInputProperties(vnodeData);
1182
1308
  }
1183
- if (BUILD12.vdomKey && vnodeData.key) {
1309
+ if (BUILD13.vdomKey && vnodeData.key) {
1184
1310
  key = vnodeData.key;
1185
1311
  }
1186
- if (BUILD12.slotRelocation && vnodeData.name) {
1312
+ if (BUILD13.slotRelocation && vnodeData.name) {
1187
1313
  slotName = vnodeData.name;
1188
1314
  }
1189
- if (BUILD12.vdomClass) {
1315
+ if (BUILD13.vdomClass) {
1190
1316
  const classData = vnodeData.className || vnodeData.class;
1191
1317
  if (classData) {
1192
1318
  vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
1193
1319
  }
1194
1320
  }
1195
1321
  }
1196
- if (BUILD12.isDev && vNodeChildren.some(isHost)) {
1322
+ if (BUILD13.isDev && vNodeChildren.some(isHost)) {
1197
1323
  consoleDevError(`The <Host> must be the single root component. Make sure:
1198
1324
  - You are NOT using hostData() and <Host> in the same component.
1199
1325
  - <Host> is used once, and it's the single root component of the render() function.`);
1200
1326
  }
1201
- if (BUILD12.vdomFunctional && typeof nodeName === "function") {
1327
+ if (BUILD13.vdomFunctional && typeof nodeName === "function") {
1202
1328
  return nodeName(
1203
1329
  vnodeData === null ? {} : vnodeData,
1204
1330
  vNodeChildren,
@@ -1210,10 +1336,10 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
1210
1336
  if (vNodeChildren.length > 0) {
1211
1337
  vnode.$children$ = vNodeChildren;
1212
1338
  }
1213
- if (BUILD12.vdomKey) {
1339
+ if (BUILD13.vdomKey) {
1214
1340
  vnode.$key$ = key;
1215
1341
  }
1216
- if (BUILD12.slotRelocation) {
1342
+ if (BUILD13.slotRelocation) {
1217
1343
  vnode.$name$ = slotName;
1218
1344
  }
1219
1345
  return vnode;
@@ -1226,13 +1352,13 @@ var newVNode = (tag, text) => {
1226
1352
  $elm$: null,
1227
1353
  $children$: null
1228
1354
  };
1229
- if (BUILD12.vdomAttribute) {
1355
+ if (BUILD13.vdomAttribute) {
1230
1356
  vnode.$attrs$ = null;
1231
1357
  }
1232
- if (BUILD12.vdomKey) {
1358
+ if (BUILD13.vdomKey) {
1233
1359
  vnode.$key$ = null;
1234
1360
  }
1235
- if (BUILD12.slotRelocation) {
1361
+ if (BUILD13.slotRelocation) {
1236
1362
  vnode.$name$ = null;
1237
1363
  }
1238
1364
  return vnode;
@@ -1286,18 +1412,18 @@ var validateInputProperties = (inputElm) => {
1286
1412
 
1287
1413
  // src/runtime/client-hydrate.ts
1288
1414
  var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1289
- var _a;
1415
+ var _a, _b;
1290
1416
  const endHydrate = createTime("hydrateClient", tagName);
1291
1417
  const shadowRoot = hostElm.shadowRoot;
1292
1418
  const childRenderNodes = [];
1293
1419
  const slotNodes = [];
1294
1420
  const slottedNodes = [];
1295
- const shadowRootNodes = BUILD13.shadowDom && shadowRoot ? [] : null;
1421
+ const shadowRootNodes = BUILD14.shadowDom && shadowRoot ? [] : null;
1296
1422
  const vnode = newVNode(tagName, null);
1297
1423
  vnode.$elm$ = hostElm;
1298
1424
  const members = Object.entries(((_a = hostRef.$cmpMeta$) == null ? void 0 : _a.$members$) || {});
1299
1425
  members.forEach(([memberName, [memberFlags, metaAttributeName]]) => {
1300
- var _a2, _b;
1426
+ var _a2, _b2;
1301
1427
  if (!(memberFlags & 31 /* Prop */)) {
1302
1428
  return;
1303
1429
  }
@@ -1307,13 +1433,13 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1307
1433
  const attrPropVal = parsePropertyValue(
1308
1434
  attrVal,
1309
1435
  memberFlags,
1310
- BUILD13.formAssociated && !!(((_a2 = hostRef.$cmpMeta$) == null ? void 0 : _a2.$flags$) & 64 /* formAssociated */)
1436
+ BUILD14.formAssociated && !!(((_a2 = hostRef.$cmpMeta$) == null ? void 0 : _a2.$flags$) & 64 /* formAssociated */)
1311
1437
  );
1312
- (_b = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _b.set(memberName, attrPropVal);
1438
+ (_b2 = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _b2.set(memberName, attrPropVal);
1313
1439
  }
1314
1440
  });
1315
1441
  let scopeId2;
1316
- if (BUILD13.scoped) {
1442
+ if (BUILD14.scoped) {
1317
1443
  const cmpMeta = hostRef.$cmpMeta$;
1318
1444
  if (cmpMeta && cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */ && hostElm["s-sc"]) {
1319
1445
  scopeId2 = hostElm["s-sc"];
@@ -1350,6 +1476,16 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1350
1476
  if (childRenderNode.$tag$ === "slot") {
1351
1477
  node["s-cr"] = hostElm["s-cr"];
1352
1478
  }
1479
+ } else if (((_b = childRenderNode.$tag$) == null ? void 0 : _b.toString().includes("-")) && !childRenderNode.$elm$.shadowRoot) {
1480
+ const cmpMeta = getHostRef(childRenderNode.$elm$);
1481
+ const scopeId3 = getScopeId(
1482
+ cmpMeta.$cmpMeta$,
1483
+ BUILD14.mode ? childRenderNode.$elm$.getAttribute("s-mode") : void 0
1484
+ );
1485
+ const styleSheet = win.document.querySelector(`style[sty-id="${scopeId3}"]`);
1486
+ if (styleSheet) {
1487
+ hostElm.shadowRoot.append(styleSheet.cloneNode(true));
1488
+ }
1353
1489
  }
1354
1490
  if (childRenderNode.$tag$ === "slot") {
1355
1491
  childRenderNode.$name$ = childRenderNode.$elm$["s-sn"] || childRenderNode.$elm$["name"] || null;
@@ -1365,7 +1501,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1365
1501
  }
1366
1502
  }
1367
1503
  if (orgLocationNode && orgLocationNode.isConnected) {
1368
- if (shadowRoot && orgLocationNode["s-en"] === "") {
1504
+ if (orgLocationNode.parentElement.shadowRoot && orgLocationNode["s-en"] === "") {
1369
1505
  orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
1370
1506
  }
1371
1507
  orgLocationNode.parentNode.removeChild(orgLocationNode);
@@ -1373,7 +1509,9 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1373
1509
  node["s-oo"] = parseInt(childRenderNode.$nodeId$);
1374
1510
  }
1375
1511
  }
1376
- plt.$orgLocNodes$.delete(orgLocationId);
1512
+ if (orgLocationNode && !orgLocationNode["s-id"]) {
1513
+ plt.$orgLocNodes$.delete(orgLocationId);
1514
+ }
1377
1515
  }
1378
1516
  const hosts = [];
1379
1517
  const snLen = slottedNodes.length;
@@ -1395,14 +1533,16 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1395
1533
  if (!hosts[slottedItem.hostId]) continue;
1396
1534
  const hostEle = hosts[slottedItem.hostId];
1397
1535
  if (!hostEle.shadowRoot || !shadowRoot) {
1398
- slottedItem.slot["s-cr"] = hostEle["s-cr"];
1399
- if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
1400
- slottedItem.slot["s-cr"] = hostEle;
1401
- } else {
1402
- slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1536
+ if (!slottedItem.slot["s-cr"]) {
1537
+ slottedItem.slot["s-cr"] = hostEle["s-cr"];
1538
+ if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
1539
+ slottedItem.slot["s-cr"] = hostEle;
1540
+ } else {
1541
+ slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1542
+ }
1403
1543
  }
1404
1544
  addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
1405
- if (BUILD13.experimentalSlotFixes) {
1545
+ if (BUILD14.experimentalSlotFixes) {
1406
1546
  patchSlottedNode(slottedItem.node);
1407
1547
  }
1408
1548
  }
@@ -1411,12 +1551,12 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1411
1551
  }
1412
1552
  }
1413
1553
  }
1414
- if (BUILD13.scoped && scopeId2 && slotNodes.length) {
1554
+ if (BUILD14.scoped && scopeId2 && slotNodes.length) {
1415
1555
  slotNodes.forEach((slot) => {
1416
1556
  slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
1417
1557
  });
1418
1558
  }
1419
- if (BUILD13.shadowDom && shadowRoot && !shadowRoot.childNodes.length) {
1559
+ if (BUILD14.shadowDom && shadowRoot) {
1420
1560
  let rnIdex = 0;
1421
1561
  const rnLen = shadowRootNodes.length;
1422
1562
  if (rnLen) {
@@ -1427,14 +1567,13 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1427
1567
  if (typeof node["s-en"] !== "string" && typeof node["s-sn"] !== "string") {
1428
1568
  if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
1429
1569
  node.removeAttribute("hidden");
1430
- } else if (node.nodeType === 8 /* CommentNode */ || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1570
+ } else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1431
1571
  node.parentNode.removeChild(node);
1432
1572
  }
1433
1573
  }
1434
1574
  });
1435
1575
  }
1436
1576
  }
1437
- plt.$orgLocNodes$.delete(hostElm["s-id"]);
1438
1577
  hostRef.$hostElement$ = hostElm;
1439
1578
  endHydrate();
1440
1579
  };
@@ -1466,7 +1605,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1466
1605
  if (!parentVNode.$children$) {
1467
1606
  parentVNode.$children$ = [];
1468
1607
  }
1469
- if (BUILD13.scoped && scopeId2) {
1608
+ if (BUILD14.scoped && scopeId2 && childIdSplt[0] === hostId) {
1470
1609
  node["s-si"] = scopeId2;
1471
1610
  childVNode.$attrs$.class += " " + scopeId2;
1472
1611
  }
@@ -1484,7 +1623,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1484
1623
  shadowRootNodes,
1485
1624
  slottedNodes
1486
1625
  );
1487
- if (BUILD13.scoped && scopeId2) {
1626
+ if (BUILD14.scoped && scopeId2) {
1488
1627
  node.classList.add(scopeId2);
1489
1628
  }
1490
1629
  }
@@ -1581,9 +1720,9 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1581
1720
  slottedNodes
1582
1721
  );
1583
1722
  } else if (childNodeType === CONTENT_REF_ID) {
1584
- if (BUILD13.shadowDom && shadowRootNodes) {
1723
+ if (BUILD14.shadowDom && shadowRootNodes) {
1585
1724
  node.remove();
1586
- } else if (BUILD13.slotRelocation) {
1725
+ } else if (BUILD14.slotRelocation) {
1587
1726
  hostElm["s-cr"] = node;
1588
1727
  node["s-cn"] = true;
1589
1728
  }
@@ -1596,7 +1735,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1596
1735
  vnode.$index$ = "0";
1597
1736
  parentVNode.$children$ = [vnode];
1598
1737
  } else {
1599
- if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1738
+ if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim() && !node["s-nr"]) {
1600
1739
  node.remove();
1601
1740
  }
1602
1741
  }
@@ -1649,15 +1788,15 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1649
1788
  childVNode.$name$ = slotName || null;
1650
1789
  childVNode.$tag$ = "slot";
1651
1790
  const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
1652
- if (BUILD13.shadowDom && shadowRootNodes && win.document) {
1791
+ if (BUILD14.shadowDom && shadowRootNodes && win.document) {
1653
1792
  const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$);
1654
1793
  if (childVNode.$name$) {
1655
1794
  childVNode.$elm$.setAttribute("name", slotName);
1656
1795
  }
1657
- if (parentNodeId && parentNodeId !== childVNode.$hostId$) {
1658
- parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1796
+ if (parentVNode.$elm$.shadowRoot && parentNodeId && parentNodeId !== childVNode.$hostId$) {
1797
+ internalCall(parentVNode.$elm$, "insertBefore")(slot, internalCall(parentVNode.$elm$, "children")[0]);
1659
1798
  } else {
1660
- node.parentNode.insertBefore(slot, node);
1799
+ internalCall(internalCall(node, "parentNode"), "insertBefore")(slot, node);
1661
1800
  }
1662
1801
  addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
1663
1802
  node.remove();
@@ -1683,7 +1822,7 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1683
1822
  var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
1684
1823
  let slottedNode = slotNode.nextSibling;
1685
1824
  slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
1686
- 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 */))) {
1825
+ 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"))) {
1687
1826
  slottedNode["s-sn"] = slotName;
1688
1827
  slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
1689
1828
  slottedNode = slottedNode.nextSibling;
@@ -2118,31 +2257,31 @@ import { BUILD as BUILD23 } from "@stencil/core/internal/app-data";
2118
2257
  import { BUILD as BUILD22 } from "@stencil/core/internal/app-data";
2119
2258
 
2120
2259
  // src/runtime/parse-property-value.ts
2121
- import { BUILD as BUILD14 } from "@stencil/core/internal/app-data";
2260
+ import { BUILD as BUILD15 } from "@stencil/core/internal/app-data";
2122
2261
  var parsePropertyValue = (propValue, propType, isFormAssociated) => {
2123
- if ((BUILD14.hydrateClientSide || BUILD14.hydrateServerSide) && typeof propValue === "string" && (propValue.startsWith("{") && propValue.endsWith("}") || propValue.startsWith("[") && propValue.endsWith("]"))) {
2262
+ if ((BUILD15.hydrateClientSide || BUILD15.hydrateServerSide) && typeof propValue === "string" && (propValue.startsWith("{") && propValue.endsWith("}") || propValue.startsWith("[") && propValue.endsWith("]"))) {
2124
2263
  try {
2125
2264
  propValue = JSON.parse(propValue);
2126
2265
  return propValue;
2127
2266
  } catch (e) {
2128
2267
  }
2129
2268
  }
2130
- if ((BUILD14.hydrateClientSide || BUILD14.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2269
+ if ((BUILD15.hydrateClientSide || BUILD15.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2131
2270
  propValue = deserializeProperty(propValue);
2132
2271
  return propValue;
2133
2272
  }
2134
2273
  if (propValue != null && !isComplexType(propValue)) {
2135
- if (BUILD14.propBoolean && propType & 4 /* Boolean */) {
2136
- if (BUILD14.formAssociated && isFormAssociated && typeof propValue === "string") {
2274
+ if (BUILD15.propBoolean && propType & 4 /* Boolean */) {
2275
+ if (BUILD15.formAssociated && isFormAssociated && typeof propValue === "string") {
2137
2276
  return propValue === "" || !!propValue;
2138
2277
  } else {
2139
2278
  return propValue === "false" ? false : propValue === "" || !!propValue;
2140
2279
  }
2141
2280
  }
2142
- if (BUILD14.propNumber && propType & 2 /* Number */) {
2281
+ if (BUILD15.propNumber && propType & 2 /* Number */) {
2143
2282
  return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
2144
2283
  }
2145
- if (BUILD14.propString && propType & 1 /* String */) {
2284
+ if (BUILD15.propString && propType & 1 /* String */) {
2146
2285
  return String(propValue);
2147
2286
  }
2148
2287
  return propValue;
@@ -2154,18 +2293,18 @@ var parsePropertyValue = (propValue, propType, isFormAssociated) => {
2154
2293
  import { BUILD as BUILD21, NAMESPACE } from "@stencil/core/internal/app-data";
2155
2294
 
2156
2295
  // src/runtime/event-emitter.ts
2157
- import { BUILD as BUILD16 } from "@stencil/core/internal/app-data";
2296
+ import { BUILD as BUILD17 } from "@stencil/core/internal/app-data";
2158
2297
 
2159
2298
  // src/runtime/element.ts
2160
- import { BUILD as BUILD15 } from "@stencil/core/internal/app-data";
2161
- var getElement = (ref) => BUILD15.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
2299
+ import { BUILD as BUILD16 } from "@stencil/core/internal/app-data";
2300
+ var getElement = (ref) => BUILD16.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
2162
2301
 
2163
2302
  // src/runtime/event-emitter.ts
2164
2303
  var createEvent = (ref, name, flags) => {
2165
2304
  const elm = getElement(ref);
2166
2305
  return {
2167
2306
  emit: (detail) => {
2168
- if (BUILD16.isDev && !elm.isConnected) {
2307
+ if (BUILD17.isDev && !elm.isConnected) {
2169
2308
  consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
2170
2309
  }
2171
2310
  return emitEvent(elm, name, {
@@ -2183,123 +2322,6 @@ var emitEvent = (elm, name, opts) => {
2183
2322
  return ev;
2184
2323
  };
2185
2324
 
2186
- // src/runtime/styles.ts
2187
- import { BUILD as BUILD17 } from "@stencil/core/internal/app-data";
2188
- var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
2189
- var registerStyle = (scopeId2, cssText, allowCS) => {
2190
- let style = styles.get(scopeId2);
2191
- if (supportsConstructableStylesheets && allowCS) {
2192
- style = style || new CSSStyleSheet();
2193
- if (typeof style === "string") {
2194
- style = cssText;
2195
- } else {
2196
- style.replaceSync(cssText);
2197
- }
2198
- } else {
2199
- style = cssText;
2200
- }
2201
- styles.set(scopeId2, style);
2202
- };
2203
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
2204
- var _a;
2205
- const scopeId2 = getScopeId(cmpMeta, mode);
2206
- const style = styles.get(scopeId2);
2207
- if (!BUILD17.attachStyles || !win.document) {
2208
- return scopeId2;
2209
- }
2210
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
2211
- if (style) {
2212
- if (typeof style === "string") {
2213
- styleContainerNode = styleContainerNode.head || styleContainerNode;
2214
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
2215
- let styleElm;
2216
- if (!appliedStyles) {
2217
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
2218
- }
2219
- if (!appliedStyles.has(scopeId2)) {
2220
- if (BUILD17.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
2221
- styleElm.innerHTML = style;
2222
- } else {
2223
- styleElm = win.document.createElement("style");
2224
- styleElm.innerHTML = style;
2225
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
2226
- if (nonce != null) {
2227
- styleElm.setAttribute("nonce", nonce);
2228
- }
2229
- if ((BUILD17.hydrateServerSide || BUILD17.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) {
2230
- styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
2231
- }
2232
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
2233
- if (styleContainerNode.nodeName === "HEAD") {
2234
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
2235
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
2236
- styleContainerNode.insertBefore(
2237
- styleElm,
2238
- (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
2239
- );
2240
- } else if ("host" in styleContainerNode) {
2241
- if (supportsConstructableStylesheets) {
2242
- const stylesheet = new CSSStyleSheet();
2243
- stylesheet.replaceSync(style);
2244
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
2245
- } else {
2246
- const existingStyleContainer = styleContainerNode.querySelector("style");
2247
- if (existingStyleContainer) {
2248
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
2249
- } else {
2250
- styleContainerNode.prepend(styleElm);
2251
- }
2252
- }
2253
- } else {
2254
- styleContainerNode.append(styleElm);
2255
- }
2256
- }
2257
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2258
- styleContainerNode.insertBefore(styleElm, null);
2259
- }
2260
- }
2261
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
2262
- styleElm.innerHTML += SLOT_FB_CSS;
2263
- }
2264
- if (appliedStyles) {
2265
- appliedStyles.add(scopeId2);
2266
- }
2267
- }
2268
- } else if (BUILD17.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
2269
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
2270
- }
2271
- }
2272
- return scopeId2;
2273
- };
2274
- var attachStyles = (hostRef) => {
2275
- const cmpMeta = hostRef.$cmpMeta$;
2276
- const elm = hostRef.$hostElement$;
2277
- const flags = cmpMeta.$flags$;
2278
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
2279
- const scopeId2 = addStyle(
2280
- BUILD17.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
2281
- cmpMeta,
2282
- hostRef.$modeName$
2283
- );
2284
- if ((BUILD17.shadowDom || BUILD17.scoped) && BUILD17.cssAnnotations && flags & 10 /* needsScopedEncapsulation */) {
2285
- elm["s-sc"] = scopeId2;
2286
- elm.classList.add(scopeId2 + "-h");
2287
- }
2288
- endAttachStyles();
2289
- };
2290
- var getScopeId = (cmp, mode) => "sc-" + (BUILD17.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
2291
- var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
2292
- var hydrateScopedToShadow = () => {
2293
- if (!win.document) {
2294
- return;
2295
- }
2296
- const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2297
- let i2 = 0;
2298
- for (; i2 < styles2.length; i2++) {
2299
- registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
2300
- }
2301
- };
2302
-
2303
2325
  // src/runtime/vdom/vdom-render.ts
2304
2326
  import { BUILD as BUILD20 } from "@stencil/core/internal/app-data";
2305
2327
 
@@ -2318,12 +2340,13 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
2318
2340
  const classList = elm.classList;
2319
2341
  const oldClasses = parseClassList(oldValue);
2320
2342
  let newClasses = parseClassList(newValue);
2321
- if (BUILD18.hydrateClientSide && elm["s-si"] && initialRender) {
2322
- newClasses.push(elm["s-si"]);
2343
+ if (BUILD18.hydrateClientSide && (elm["s-si"] || elm["s-sc"]) && initialRender) {
2344
+ const scopeId2 = elm["s-sc"] || elm["s-si"];
2345
+ newClasses.push(scopeId2);
2323
2346
  oldClasses.forEach((c) => {
2324
- if (c.startsWith(elm["s-si"])) newClasses.push(c);
2347
+ if (c.startsWith(scopeId2)) newClasses.push(c);
2325
2348
  });
2326
- newClasses = [...new Set(newClasses)];
2349
+ newClasses = [...new Set(newClasses)].filter((c) => c);
2327
2350
  classList.add(...newClasses);
2328
2351
  } else {
2329
2352
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
@@ -2805,6 +2828,8 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
2805
2828
  !isInitialRender && BUILD20.updatable && oldChildren !== null
2806
2829
  ) {
2807
2830
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
2831
+ } else if (BUILD20.hydrateClientSide && isInitialRender && BUILD20.updatable && oldChildren !== null && newChildren === null) {
2832
+ newVNode2.$children$ = oldChildren;
2808
2833
  }
2809
2834
  if (BUILD20.svg && isSvgMode && tag === "svg") {
2810
2835
  isSvgMode = false;
@@ -3272,10 +3297,16 @@ var forceUpdate = (ref) => {
3272
3297
  return false;
3273
3298
  };
3274
3299
  var appDidLoad = (who) => {
3300
+ var _a;
3275
3301
  if (BUILD21.asyncQueue) {
3276
3302
  plt.$flags$ |= 2 /* appLoaded */;
3277
3303
  }
3278
3304
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
3305
+ if (BUILD21.hydrateClientSide) {
3306
+ if ((_a = plt.$orgLocNodes$) == null ? void 0 : _a.size) {
3307
+ plt.$orgLocNodes$.clear();
3308
+ }
3309
+ }
3279
3310
  if (BUILD21.profile && performance.measure) {
3280
3311
  performance.measure(`[Stencil] ${NAMESPACE} initial load (by ${who})`, "st:app:start");
3281
3312
  }
@@ -3707,6 +3738,11 @@ var connectedCallback = (elm) => {
3707
3738
  if (BUILD25.hydrateServerSide || (BUILD25.slot || BUILD25.shadowDom) && // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
3708
3739
  cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
3709
3740
  setContentReference(elm);
3741
+ } else if (BUILD25.hydrateClientSide && !(cmpMeta.$flags$ & 4 /* hasSlotRelocation */)) {
3742
+ const commendPlaceholder = elm.firstChild;
3743
+ if ((commendPlaceholder == null ? void 0 : commendPlaceholder.nodeType) === 8 /* CommentNode */ && !commendPlaceholder["s-cn"] && !commendPlaceholder.nodeValue) {
3744
+ elm.removeChild(commendPlaceholder);
3745
+ }
3710
3746
  }
3711
3747
  }
3712
3748
  if (BUILD25.asyncLoading) {