@jxsuite/runtime 5.2.0 → 6.0.1

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.
package/dist/runtime.js CHANGED
@@ -1548,14 +1548,55 @@ function resolveNestedSelector(scope, key) {
1548
1548
  return resolved.join(", ");
1549
1549
  }
1550
1550
  function resolveOneNestedSelector(scope, key) {
1551
- if (key.startsWith("&")) {
1552
- return key.replaceAll("&", scope);
1551
+ const spliced = spliceNestingSelector(key, scope);
1552
+ if (spliced !== null) {
1553
+ return spliced;
1553
1554
  }
1554
1555
  if (key.startsWith("[") || key.startsWith(":") || key.startsWith(".")) {
1555
1556
  return `${scope}${key}`;
1556
1557
  }
1557
1558
  return `${scope} ${key}`;
1558
1559
  }
1560
+ function nestingIndexes(member) {
1561
+ const found = [];
1562
+ let quote = null;
1563
+ let brackets = 0;
1564
+ for (let i = 0;i < member.length; i += 1) {
1565
+ const ch = member[i];
1566
+ if (quote) {
1567
+ if (ch === "\\") {
1568
+ i += 1;
1569
+ } else if (ch === quote) {
1570
+ quote = null;
1571
+ }
1572
+ continue;
1573
+ }
1574
+ if (ch === "\\") {
1575
+ i += 1;
1576
+ } else if (ch === '"' || ch === "'") {
1577
+ quote = ch;
1578
+ } else if (ch === "[") {
1579
+ brackets += 1;
1580
+ } else if (ch === "]") {
1581
+ brackets = Math.max(0, brackets - 1);
1582
+ } else if (ch === "&" && brackets === 0) {
1583
+ found.push(i);
1584
+ }
1585
+ }
1586
+ return found;
1587
+ }
1588
+ function spliceNestingSelector(member, scope) {
1589
+ return nestingIndexes(member).length > 0 ? spliceScope(member, scope) : null;
1590
+ }
1591
+ function spliceScope(member, scope) {
1592
+ let out = "";
1593
+ let from = 0;
1594
+ for (const at of nestingIndexes(member)) {
1595
+ out += member.slice(from, at) + scope;
1596
+ from = at + 1;
1597
+ }
1598
+ return out + member.slice(from);
1599
+ }
1559
1600
  function splitSelectorList(selector) {
1560
1601
  const members = [];
1561
1602
  let depth = 0;
@@ -1679,7 +1720,9 @@ function withoutKeyframes(block) {
1679
1720
  return rest;
1680
1721
  }
1681
1722
  function compoundsOntoScope(key) {
1682
- const rest = key.startsWith("&") ? key.slice(1) : key;
1723
+ const nesting = nestingIndexes(key);
1724
+ const last = nesting.at(-1);
1725
+ const rest = last === undefined ? key : key.slice(last + 1);
1683
1726
  return rest === "" || rest.startsWith(":") || rest.startsWith(".") || rest.startsWith("[");
1684
1727
  }
1685
1728
  function buildStyleRules(style, options = {}) {
@@ -5210,6 +5253,7 @@ export {
5210
5253
  setSkipServerFunctions,
5211
5254
  setStampPropBindings,
5212
5255
  setTemplateErrorHandler,
5256
+ spliceNestingSelector,
5213
5257
  splitSelectorList,
5214
5258
  toCSSText,
5215
5259
  transposeCanvasOverlaySelector,
@@ -5217,5 +5261,5 @@ export {
5217
5261
  transposeCanvasUnits
5218
5262
  };
5219
5263
 
5220
- //# debugId=4EE9F58BD84E1FEB64756E2164756E21
5264
+ //# debugId=938A15203F1CC52664756E2164756E21
5221
5265
  //# sourceMappingURL=runtime.js.map