@stencil/core 4.35.0 → 4.35.1-dev.1750222948.dcb189d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Client Patch Browser v4.35.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Client Patch Browser v4.35.1-dev.1750222948.dcb189d | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
 
5
5
  // src/client/client-patch-browser.ts
@@ -18,6 +18,12 @@ var escapeRegExpSpecialCharacters = (text) => {
18
18
  var safeSelector = (selector) => {
19
19
  const placeholders = [];
20
20
  let index = 0;
21
+ selector = selector.replace(/(\[\s*part~=\s*("[^"]*"|'[^']*')\s*\])/g, (_, keep) => {
22
+ const replaceBy = `__part-${index}__`;
23
+ placeholders.push(keep);
24
+ index++;
25
+ return replaceBy;
26
+ });
21
27
  selector = selector.replace(/(\[[^\]]*\])/g, (_, keep) => {
22
28
  const replaceBy = `__ph-${index}__`;
23
29
  placeholders.push(keep);
@@ -37,6 +43,7 @@ var safeSelector = (selector) => {
37
43
  return ss;
38
44
  };
39
45
  var restoreSafeSelector = (placeholders, content) => {
46
+ content = content.replace(/__part-(\d+)__/g, (_, index) => placeholders[+index]);
40
47
  return content.replace(/__ph-(\d+)__/g, (_, index) => placeholders[+index]);
41
48
  };
42
49
  var _polyfillHost = "-shadowcsshost";
@@ -49,6 +56,7 @@ var _cssColonSlottedRe = new RegExp("(" + _polyfillSlotted + _parenSuffix, "gim"
49
56
  var _polyfillHostNoCombinator = _polyfillHost + "-no-combinator";
50
57
  var _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
51
58
  var _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
59
+ var _safePartRe = /__part-(\d+)__/g;
52
60
  var _selectorReSuffix = "([>\\s~+[.,{:][\\s\\S]*)?$";
53
61
  var _polyfillHostRe = /-shadowcsshost/gim;
54
62
  var createSupportsRuleRe = (selector) => {
@@ -263,7 +271,7 @@ var applyStrictSelectorScope = (selector, scopeSelector2, hostSelector) => {
263
271
  let scopedSelector = "";
264
272
  let startIndex = 0;
265
273
  let res;
266
- const sep = /( |>|\+|~(?!=))\s*/g;
274
+ const sep = /( |>|\+|~(?!=))(?=(?:[^()]*\([^()]*\))*[^()]*$)\s*/g;
267
275
  const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
268
276
  let shouldScope = !hasHost;
269
277
  while ((res = sep.exec(selector)) !== null) {
@@ -275,7 +283,7 @@ var applyStrictSelectorScope = (selector, scopeSelector2, hostSelector) => {
275
283
  startIndex = sep.lastIndex;
276
284
  }
277
285
  const part = selector.substring(startIndex);
278
- shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
286
+ shouldScope = !part.match(_safePartRe) && (shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1);
279
287
  scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
280
288
  return restoreSafeSelector(safeContent.placeholders, scopedSelector);
281
289
  };
@@ -332,6 +340,36 @@ var scopeCssText = (cssText, scopeId, hostScopeId, slotScopeId, commentOriginalS
332
340
  var replaceShadowCssHost = (cssText, hostScopeId) => {
333
341
  return cssText.replace(/-shadowcsshost-no-combinator/g, `.${hostScopeId}`);
334
342
  };
343
+ var expandPartSelectors = (cssText) => {
344
+ const partSelectorRe = /([^\s,{][^,{]*?)::part\(\s*([^)]+?)\s*\)((?:[:.][^,{]*)*)/g;
345
+ return processRules(cssText, (rule) => {
346
+ if (rule.selector[0] === "@") {
347
+ return rule;
348
+ }
349
+ const selectors = rule.selector.split(",").map((sel) => {
350
+ const out = [sel.trim()];
351
+ let m;
352
+ while ((m = partSelectorRe.exec(sel)) !== null) {
353
+ const before = m[1].trimEnd();
354
+ const partNames = m[2].trim().split(/\s+/);
355
+ const after = m[3] || "";
356
+ const partAttr = partNames.flatMap((p) => {
357
+ if (!rule.selector.includes(`[part~="${p}"]`)) {
358
+ return [`[part~="${p}"]`];
359
+ }
360
+ return [];
361
+ }).join("");
362
+ const expanded = `${before} ${partAttr}${after}`;
363
+ if (!!partAttr && expanded !== sel.trim()) {
364
+ out.push(expanded);
365
+ }
366
+ }
367
+ return out.join(", ");
368
+ });
369
+ rule.selector = selectors.join(", ");
370
+ return rule;
371
+ });
372
+ };
335
373
  var scopeCss = (cssText, scopeId, commentOriginalSelector) => {
336
374
  const hostScopeId = scopeId + "-h";
337
375
  const slotScopeId = scopeId + "-s";
@@ -367,8 +405,10 @@ var scopeCss = (cssText, scopeId, commentOriginalSelector) => {
367
405
  const regex = new RegExp(escapeRegExpSpecialCharacters(slottedSelector.orgSelector), "g");
368
406
  cssText = cssText.replace(regex, slottedSelector.updatedSelector);
369
407
  });
408
+ cssText = expandPartSelectors(cssText);
370
409
  return cssText;
371
410
  };
372
411
  export {
412
+ expandPartSelectors,
373
413
  scopeCss
374
414
  };
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Hydrate Platform v4.35.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Hydrate Platform v4.35.1-dev.1750222948.dcb189d | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -1425,7 +1425,7 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1425
1425
  if (parentNodeId && parentNodeId !== childVNode.$hostId$) {
1426
1426
  parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1427
1427
  } else {
1428
- node.parentNode.insertBefore(childVNode.$elm$, node);
1428
+ node.parentNode.insertBefore(slot, node);
1429
1429
  }
1430
1430
  addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
1431
1431
  node.remove();
@@ -1440,8 +1440,8 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1440
1440
  if (shouldMove) {
1441
1441
  parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1442
1442
  }
1443
- childRenderNodes.push(childVNode);
1444
1443
  }
1444
+ childRenderNodes.push(childVNode);
1445
1445
  slotNodes.push(childVNode);
1446
1446
  if (!parentVNode.$children$) {
1447
1447
  parentVNode.$children$ = [];
@@ -1483,6 +1483,12 @@ import { BUILD as BUILD18 } from "@stencil/core/internal/app-data";
1483
1483
  var safeSelector = (selector) => {
1484
1484
  const placeholders = [];
1485
1485
  let index = 0;
1486
+ selector = selector.replace(/(\[\s*part~=\s*("[^"]*"|'[^']*')\s*\])/g, (_, keep) => {
1487
+ const replaceBy = `__part-${index}__`;
1488
+ placeholders.push(keep);
1489
+ index++;
1490
+ return replaceBy;
1491
+ });
1486
1492
  selector = selector.replace(/(\[[^\]]*\])/g, (_, keep) => {
1487
1493
  const replaceBy = `__ph-${index}__`;
1488
1494
  placeholders.push(keep);
@@ -1502,6 +1508,7 @@ var safeSelector = (selector) => {
1502
1508
  return ss;
1503
1509
  };
1504
1510
  var restoreSafeSelector = (placeholders, content) => {
1511
+ content = content.replace(/__part-(\d+)__/g, (_, index) => placeholders[+index]);
1505
1512
  return content.replace(/__ph-(\d+)__/g, (_, index) => placeholders[+index]);
1506
1513
  };
1507
1514
  var _polyfillHost = "-shadowcsshost";
@@ -1514,6 +1521,7 @@ var _cssColonSlottedRe = new RegExp("(" + _polyfillSlotted + _parenSuffix, "gim"
1514
1521
  var _polyfillHostNoCombinator = _polyfillHost + "-no-combinator";
1515
1522
  var _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
1516
1523
  var _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
1524
+ var _safePartRe = /__part-(\d+)__/g;
1517
1525
  var _selectorReSuffix = "([>\\s~+[.,{:][\\s\\S]*)?$";
1518
1526
  var _polyfillHostRe = /-shadowcsshost/gim;
1519
1527
  var createSupportsRuleRe = (selector) => {
@@ -1728,7 +1736,7 @@ var applyStrictSelectorScope = (selector, scopeSelector2, hostSelector) => {
1728
1736
  let scopedSelector = "";
1729
1737
  let startIndex = 0;
1730
1738
  let res;
1731
- const sep = /( |>|\+|~(?!=))\s*/g;
1739
+ const sep = /( |>|\+|~(?!=))(?=(?:[^()]*\([^()]*\))*[^()]*$)\s*/g;
1732
1740
  const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
1733
1741
  let shouldScope = !hasHost;
1734
1742
  while ((res = sep.exec(selector)) !== null) {
@@ -1740,7 +1748,7 @@ var applyStrictSelectorScope = (selector, scopeSelector2, hostSelector) => {
1740
1748
  startIndex = sep.lastIndex;
1741
1749
  }
1742
1750
  const part = selector.substring(startIndex);
1743
- shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
1751
+ shouldScope = !part.match(_safePartRe) && (shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1);
1744
1752
  scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
1745
1753
  return restoreSafeSelector(safeContent.placeholders, scopedSelector);
1746
1754
  };
@@ -1797,6 +1805,36 @@ var scopeCssText = (cssText, scopeId2, hostScopeId, slotScopeId, commentOriginal
1797
1805
  var replaceShadowCssHost = (cssText, hostScopeId) => {
1798
1806
  return cssText.replace(/-shadowcsshost-no-combinator/g, `.${hostScopeId}`);
1799
1807
  };
1808
+ var expandPartSelectors = (cssText) => {
1809
+ const partSelectorRe = /([^\s,{][^,{]*?)::part\(\s*([^)]+?)\s*\)((?:[:.][^,{]*)*)/g;
1810
+ return processRules(cssText, (rule) => {
1811
+ if (rule.selector[0] === "@") {
1812
+ return rule;
1813
+ }
1814
+ const selectors = rule.selector.split(",").map((sel) => {
1815
+ const out = [sel.trim()];
1816
+ let m;
1817
+ while ((m = partSelectorRe.exec(sel)) !== null) {
1818
+ const before = m[1].trimEnd();
1819
+ const partNames = m[2].trim().split(/\s+/);
1820
+ const after = m[3] || "";
1821
+ const partAttr = partNames.flatMap((p) => {
1822
+ if (!rule.selector.includes(`[part~="${p}"]`)) {
1823
+ return [`[part~="${p}"]`];
1824
+ }
1825
+ return [];
1826
+ }).join("");
1827
+ const expanded = `${before} ${partAttr}${after}`;
1828
+ if (!!partAttr && expanded !== sel.trim()) {
1829
+ out.push(expanded);
1830
+ }
1831
+ }
1832
+ return out.join(", ");
1833
+ });
1834
+ rule.selector = selectors.join(", ");
1835
+ return rule;
1836
+ });
1837
+ };
1800
1838
  var scopeCss = (cssText, scopeId2, commentOriginalSelector) => {
1801
1839
  const hostScopeId = scopeId2 + "-h";
1802
1840
  const slotScopeId = scopeId2 + "-s";
@@ -1832,6 +1870,7 @@ var scopeCss = (cssText, scopeId2, commentOriginalSelector) => {
1832
1870
  const regex = new RegExp(escapeRegExpSpecialCharacters(slottedSelector.orgSelector), "g");
1833
1871
  cssText = cssText.replace(regex, slottedSelector.updatedSelector);
1834
1872
  });
1873
+ cssText = expandPartSelectors(cssText);
1835
1874
  return cssText;
1836
1875
  };
1837
1876
 
@@ -3381,8 +3420,12 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
3381
3420
  const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
3382
3421
  if (!styles.has(scopeId2)) {
3383
3422
  const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
3384
- if (BUILD18.hydrateServerSide && BUILD18.shadowDom && cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */) {
3385
- style = scopeCss(style, scopeId2, true);
3423
+ if (BUILD18.hydrateServerSide && BUILD18.shadowDom) {
3424
+ if (cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */) {
3425
+ style = scopeCss(style, scopeId2, true);
3426
+ } else if (needsScopedSSR()) {
3427
+ style = expandPartSelectors(style);
3428
+ }
3386
3429
  }
3387
3430
  registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
3388
3431
  endRegisterStyles();
@@ -4141,6 +4184,7 @@ function hydrateApp(win2, opts, results, afterHydrate, resolve) {
4141
4184
  const orgDocumentCreateElement = win2.document.createElement;
4142
4185
  const orgDocumentCreateElementNS = win2.document.createElementNS;
4143
4186
  const resolved2 = Promise.resolve();
4187
+ setScopedSSR(opts);
4144
4188
  let tmrId;
4145
4189
  let ranCompleted = false;
4146
4190
  function hydratedComplete() {
@@ -4535,6 +4579,11 @@ var Build = {
4535
4579
  };
4536
4580
  var styles = /* @__PURE__ */ new Map();
4537
4581
  var modeResolutionChain = [];
4582
+ var setScopedSSR = (opts) => {
4583
+ scopedSSR = BUILD24.shadowDom && opts.serializeShadowRoot !== false && opts.serializeShadowRoot !== "declarative-shadow-dom";
4584
+ };
4585
+ var needsScopedSSR = () => scopedSSR;
4586
+ var scopedSSR = false;
4538
4587
  export {
4539
4588
  BUILD25 as BUILD,
4540
4589
  Build,
@@ -4567,6 +4616,7 @@ export {
4567
4616
  isMemberInElement,
4568
4617
  loadModule,
4569
4618
  modeResolutionChain,
4619
+ needsScopedSSR,
4570
4620
  nextTick,
4571
4621
  parsePropertyValue,
4572
4622
  plt,
@@ -4583,6 +4633,7 @@ export {
4583
4633
  setMode,
4584
4634
  setNonce,
4585
4635
  setPlatformHelpers,
4636
+ setScopedSSR,
4586
4637
  setValue,
4587
4638
  styles,
4588
4639
  supportsConstructableStylesheets,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/hydrate",
3
- "version": "4.35.0",
3
+ "version": "4.35.1-dev.1750222948.dcb189d",
4
4
  "description": "Stencil internal hydrate platform to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "private": true
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Hydrate Runner v4.35.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Hydrate Runner v4.35.1-dev.1750222948.dcb189d | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -724,9 +724,22 @@ function triggerEventListener(elm, ev) {
724
724
  } else if (elm.parentElement == null && elm.tagName === "HTML") {
725
725
  triggerEventListener(elm.ownerDocument, ev);
726
726
  } else {
727
- triggerEventListener(elm.parentElement, ev);
727
+ const nextTarget = getNextEventTarget(elm, ev);
728
+ triggerEventListener(nextTarget, ev);
728
729
  }
729
730
  }
731
+ function getNextEventTarget(elm, ev) {
732
+ if (elm.parentElement) {
733
+ return elm.parentElement;
734
+ }
735
+ if (elm.host && ev.composed) {
736
+ return elm.host;
737
+ }
738
+ if (ev.composed && elm.parentNode && elm.parentNode.host) {
739
+ return elm.parentNode.host;
740
+ }
741
+ return null;
742
+ }
730
743
  function dispatchEvent(currentTarget, ev) {
731
744
  ev.target = currentTarget;
732
745
  triggerEventListener(currentTarget, ev);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal",
3
- "version": "4.35.0",
3
+ "version": "4.35.1-dev.1750222948.dcb189d",
4
4
  "description": "Stencil internals only to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -51,6 +51,7 @@ __export(index_exports, {
51
51
  isMemberInElement: () => isMemberInElement,
52
52
  loadModule: () => loadModule,
53
53
  modeResolutionChain: () => modeResolutionChain,
54
+ needsScopedSSR: () => needsScopedSSR,
54
55
  nextTick: () => nextTick,
55
56
  parsePropertyValue: () => parsePropertyValue,
56
57
  plt: () => plt,
@@ -71,6 +72,7 @@ __export(index_exports, {
71
72
  setNonce: () => setNonce,
72
73
  setPlatformHelpers: () => setPlatformHelpers,
73
74
  setPlatformOptions: () => setPlatformOptions,
75
+ setScopedSSR: () => setScopedSSR,
74
76
  setSupportsShadowDom: () => setSupportsShadowDom,
75
77
  setValue: () => setValue,
76
78
  startAutoApplyChanges: () => startAutoApplyChanges,
@@ -1768,7 +1770,7 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1768
1770
  if (parentNodeId && parentNodeId !== childVNode.$hostId$) {
1769
1771
  parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1770
1772
  } else {
1771
- node.parentNode.insertBefore(childVNode.$elm$, node);
1773
+ node.parentNode.insertBefore(slot, node);
1772
1774
  }
1773
1775
  addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
1774
1776
  node.remove();
@@ -1783,8 +1785,8 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1783
1785
  if (shouldMove) {
1784
1786
  parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1785
1787
  }
1786
- childRenderNodes.push(childVNode);
1787
1788
  }
1789
+ childRenderNodes.push(childVNode);
1788
1790
  slotNodes.push(childVNode);
1789
1791
  if (!parentVNode.$children$) {
1790
1792
  parentVNode.$children$ = [];
@@ -1826,6 +1828,12 @@ var import_app_data17 = require("@stencil/core/internal/app-data");
1826
1828
  var safeSelector = (selector) => {
1827
1829
  const placeholders = [];
1828
1830
  let index = 0;
1831
+ selector = selector.replace(/(\[\s*part~=\s*("[^"]*"|'[^']*')\s*\])/g, (_, keep) => {
1832
+ const replaceBy = `__part-${index}__`;
1833
+ placeholders.push(keep);
1834
+ index++;
1835
+ return replaceBy;
1836
+ });
1829
1837
  selector = selector.replace(/(\[[^\]]*\])/g, (_, keep) => {
1830
1838
  const replaceBy = `__ph-${index}__`;
1831
1839
  placeholders.push(keep);
@@ -1845,6 +1853,7 @@ var safeSelector = (selector) => {
1845
1853
  return ss;
1846
1854
  };
1847
1855
  var restoreSafeSelector = (placeholders, content) => {
1856
+ content = content.replace(/__part-(\d+)__/g, (_, index) => placeholders[+index]);
1848
1857
  return content.replace(/__ph-(\d+)__/g, (_, index) => placeholders[+index]);
1849
1858
  };
1850
1859
  var _polyfillHost = "-shadowcsshost";
@@ -1857,6 +1866,7 @@ var _cssColonSlottedRe = new RegExp("(" + _polyfillSlotted + _parenSuffix, "gim"
1857
1866
  var _polyfillHostNoCombinator = _polyfillHost + "-no-combinator";
1858
1867
  var _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
1859
1868
  var _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
1869
+ var _safePartRe = /__part-(\d+)__/g;
1860
1870
  var _selectorReSuffix = "([>\\s~+[.,{:][\\s\\S]*)?$";
1861
1871
  var _polyfillHostRe = /-shadowcsshost/gim;
1862
1872
  var createSupportsRuleRe = (selector) => {
@@ -2071,7 +2081,7 @@ var applyStrictSelectorScope = (selector, scopeSelector2, hostSelector) => {
2071
2081
  let scopedSelector = "";
2072
2082
  let startIndex = 0;
2073
2083
  let res;
2074
- const sep = /( |>|\+|~(?!=))\s*/g;
2084
+ const sep = /( |>|\+|~(?!=))(?=(?:[^()]*\([^()]*\))*[^()]*$)\s*/g;
2075
2085
  const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
2076
2086
  let shouldScope = !hasHost;
2077
2087
  while ((res = sep.exec(selector)) !== null) {
@@ -2083,7 +2093,7 @@ var applyStrictSelectorScope = (selector, scopeSelector2, hostSelector) => {
2083
2093
  startIndex = sep.lastIndex;
2084
2094
  }
2085
2095
  const part = selector.substring(startIndex);
2086
- shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
2096
+ shouldScope = !part.match(_safePartRe) && (shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1);
2087
2097
  scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
2088
2098
  return restoreSafeSelector(safeContent.placeholders, scopedSelector);
2089
2099
  };
@@ -2140,6 +2150,36 @@ var scopeCssText = (cssText, scopeId2, hostScopeId, slotScopeId, commentOriginal
2140
2150
  var replaceShadowCssHost = (cssText, hostScopeId) => {
2141
2151
  return cssText.replace(/-shadowcsshost-no-combinator/g, `.${hostScopeId}`);
2142
2152
  };
2153
+ var expandPartSelectors = (cssText) => {
2154
+ const partSelectorRe = /([^\s,{][^,{]*?)::part\(\s*([^)]+?)\s*\)((?:[:.][^,{]*)*)/g;
2155
+ return processRules(cssText, (rule) => {
2156
+ if (rule.selector[0] === "@") {
2157
+ return rule;
2158
+ }
2159
+ const selectors = rule.selector.split(",").map((sel) => {
2160
+ const out = [sel.trim()];
2161
+ let m;
2162
+ while ((m = partSelectorRe.exec(sel)) !== null) {
2163
+ const before = m[1].trimEnd();
2164
+ const partNames = m[2].trim().split(/\s+/);
2165
+ const after = m[3] || "";
2166
+ const partAttr = partNames.flatMap((p) => {
2167
+ if (!rule.selector.includes(`[part~="${p}"]`)) {
2168
+ return [`[part~="${p}"]`];
2169
+ }
2170
+ return [];
2171
+ }).join("");
2172
+ const expanded = `${before} ${partAttr}${after}`;
2173
+ if (!!partAttr && expanded !== sel.trim()) {
2174
+ out.push(expanded);
2175
+ }
2176
+ }
2177
+ return out.join(", ");
2178
+ });
2179
+ rule.selector = selectors.join(", ");
2180
+ return rule;
2181
+ });
2182
+ };
2143
2183
  var scopeCss = (cssText, scopeId2, commentOriginalSelector) => {
2144
2184
  const hostScopeId = scopeId2 + "-h";
2145
2185
  const slotScopeId = scopeId2 + "-s";
@@ -2175,6 +2215,7 @@ var scopeCss = (cssText, scopeId2, commentOriginalSelector) => {
2175
2215
  const regex = new RegExp(escapeRegExpSpecialCharacters(slottedSelector.orgSelector), "g");
2176
2216
  cssText = cssText.replace(regex, slottedSelector.updatedSelector);
2177
2217
  });
2218
+ cssText = expandPartSelectors(cssText);
2178
2219
  return cssText;
2179
2220
  };
2180
2221
 
@@ -3724,8 +3765,12 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
3724
3765
  const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
3725
3766
  if (!styles.has(scopeId2)) {
3726
3767
  const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
3727
- if (import_app_data17.BUILD.hydrateServerSide && import_app_data17.BUILD.shadowDom && cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */) {
3728
- style = scopeCss(style, scopeId2, true);
3768
+ if (import_app_data17.BUILD.hydrateServerSide && import_app_data17.BUILD.shadowDom) {
3769
+ if (cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */) {
3770
+ style = scopeCss(style, scopeId2, true);
3771
+ } else if (needsScopedSSR()) {
3772
+ style = expandPartSelectors(style);
3773
+ }
3729
3774
  }
3730
3775
  registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
3731
3776
  endRegisterStyles();
@@ -4383,6 +4428,13 @@ var insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, inde
4383
4428
  });
4384
4429
  }
4385
4430
  };
4431
+
4432
+ // src/testing/platform/index.ts
4433
+ var setScopedSSR = (scoped) => {
4434
+ scopedSSR = scoped;
4435
+ };
4436
+ var needsScopedSSR = () => scopedSSR;
4437
+ var scopedSSR = false;
4386
4438
  // Annotate the CommonJS export names for ESM import in node:
4387
4439
  0 && (module.exports = {
4388
4440
  Build,
@@ -4416,6 +4468,7 @@ var insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, inde
4416
4468
  isMemberInElement,
4417
4469
  loadModule,
4418
4470
  modeResolutionChain,
4471
+ needsScopedSSR,
4419
4472
  nextTick,
4420
4473
  parsePropertyValue,
4421
4474
  plt,
@@ -4436,6 +4489,7 @@ var insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, inde
4436
4489
  setNonce,
4437
4490
  setPlatformHelpers,
4438
4491
  setPlatformOptions,
4492
+ setScopedSSR,
4439
4493
  setSupportsShadowDom,
4440
4494
  setValue,
4441
4495
  startAutoApplyChanges,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/testing",
3
- "version": "4.35.0",
3
+ "version": "4.35.1-dev.1750222948.dcb189d",
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
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Mock Doc (CommonJS) v4.35.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc (CommonJS) v4.35.1-dev.1750222948.dcb189d | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __defProp = Object.defineProperty;
@@ -787,9 +787,22 @@ function triggerEventListener(elm, ev) {
787
787
  } else if (elm.parentElement == null && elm.tagName === "HTML") {
788
788
  triggerEventListener(elm.ownerDocument, ev);
789
789
  } else {
790
- triggerEventListener(elm.parentElement, ev);
790
+ const nextTarget = getNextEventTarget(elm, ev);
791
+ triggerEventListener(nextTarget, ev);
791
792
  }
792
793
  }
794
+ function getNextEventTarget(elm, ev) {
795
+ if (elm.parentElement) {
796
+ return elm.parentElement;
797
+ }
798
+ if (elm.host && ev.composed) {
799
+ return elm.host;
800
+ }
801
+ if (ev.composed && elm.parentNode && elm.parentNode.host) {
802
+ return elm.parentNode.host;
803
+ }
804
+ return null;
805
+ }
793
806
  function dispatchEvent(currentTarget, ev) {
794
807
  ev.target = currentTarget;
795
808
  triggerEventListener(currentTarget, ev);
package/mock-doc/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Mock Doc v4.35.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc v4.35.1-dev.1750222948.dcb189d | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
 
5
5
  // src/runtime/runtime-constants.ts
@@ -734,9 +734,22 @@ function triggerEventListener(elm, ev) {
734
734
  } else if (elm.parentElement == null && elm.tagName === "HTML") {
735
735
  triggerEventListener(elm.ownerDocument, ev);
736
736
  } else {
737
- triggerEventListener(elm.parentElement, ev);
737
+ const nextTarget = getNextEventTarget(elm, ev);
738
+ triggerEventListener(nextTarget, ev);
738
739
  }
739
740
  }
741
+ function getNextEventTarget(elm, ev) {
742
+ if (elm.parentElement) {
743
+ return elm.parentElement;
744
+ }
745
+ if (elm.host && ev.composed) {
746
+ return elm.host;
747
+ }
748
+ if (ev.composed && elm.parentNode && elm.parentNode.host) {
749
+ return elm.parentNode.host;
750
+ }
751
+ return null;
752
+ }
740
753
  function dispatchEvent(currentTarget, ev) {
741
754
  ev.target = currentTarget;
742
755
  triggerEventListener(currentTarget, ev);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/mock-doc",
3
- "version": "4.35.0",
3
+ "version": "4.35.1-dev.1750222948.dcb189d",
4
4
  "description": "Mock window, document and DOM outside of a browser environment.",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core",
3
- "version": "4.35.0",
3
+ "version": "4.35.1-dev.1750222948.dcb189d",
4
4
  "license": "MIT",
5
5
  "main": "./internal/stencil-core/index.cjs",
6
6
  "module": "./internal/stencil-core/index.js",
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Screenshot v4.35.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Screenshot v4.35.1-dev.1750222948.dcb189d | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __create = Object.create;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/screenshot",
3
- "version": "4.35.0",
3
+ "version": "4.35.1-dev.1750222948.dcb189d",
4
4
  "description": "Stencil Screenshot.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Screenshot Pixel Match v4.35.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Screenshot Pixel Match v4.35.1-dev.1750222948.dcb189d | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __create = Object.create;