ooxml-ui 1.0.0 → 1.2.0

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 (169) hide show
  1. package/README.md +40 -36
  2. package/custom-elements.json +211 -4
  3. package/dist/chrome/ruler.d.ts +60 -2
  4. package/dist/chrome/ruler.d.ts.map +1 -1
  5. package/dist/chrome/status-bar.d.ts +3 -1
  6. package/dist/chrome/status-bar.d.ts.map +1 -1
  7. package/dist/{chunk-T3HB5LMH.js → chunk-7FNDOWTX.js} +393 -15
  8. package/dist/{chunk-FLHM5Q4O.js → chunk-AYXFLBSV.js} +92 -13
  9. package/dist/{chunk-X7RINDJQ.js → chunk-JAJFLFAV.js} +1 -1
  10. package/dist/{chunk-OXKWNNNJ.js → chunk-VUB44CAJ.js} +1 -1
  11. package/dist/{chunk-JFJXBYRD.js → chunk-XNCWB2X6.js} +5 -0
  12. package/dist/{chunk-XDUYS4KK.js → chunk-Y2E22JVO.js} +1 -1
  13. package/dist/{chunk-ZV2Z4IWH.js → chunk-YK2DPYMU.js} +5 -2
  14. package/dist/{chunk-4QQASR5A.js → chunk-YP5S7DTT.js} +6 -5
  15. package/dist/comments/comments-pane.d.ts +116 -0
  16. package/dist/comments/comments-pane.d.ts.map +1 -0
  17. package/dist/comments/types.d.ts +80 -0
  18. package/dist/comments/types.d.ts.map +1 -0
  19. package/dist/controls.d.ts +4 -2
  20. package/dist/controls.d.ts.map +1 -1
  21. package/dist/controls.js +4 -4
  22. package/dist/docx/comments-panel.d.ts +8 -1
  23. package/dist/docx/image-media.d.ts +1 -1
  24. package/dist/docx/locales/en-ribbon.d.ts +1 -0
  25. package/dist/docx/locales/en.d.ts +1 -0
  26. package/dist/docx/localization-strings.d.ts +2 -1
  27. package/dist/docx/localization.d.ts +7 -1
  28. package/dist/docx/print-layout.d.ts +2 -2
  29. package/dist/docx/print-picture.d.ts +12 -0
  30. package/dist/docx/review-controller.d.ts +2 -0
  31. package/dist/docx/ruler.d.ts +7 -10
  32. package/dist/docx.js +289 -339
  33. package/dist/form/gradient-preset-gallery.d.ts +2 -2
  34. package/dist/index.d.ts +1 -1
  35. package/dist/index.js +8 -8
  36. package/dist/pptx/{chart-3d-view-scene-2KRQ5667.mjs → chart-3d-view-scene-6B5TOWB6.mjs} +3 -3
  37. package/dist/pptx/{chart-3d-view-scene-36DMZWZ3.cjs → chart-3d-view-scene-MJ6YNT56.cjs} +37 -37
  38. package/dist/pptx/{chunk-YOGDIDPB.mjs → chunk-AWKKC3VW.mjs} +8 -2
  39. package/dist/pptx/{chunk-XQZWZMGZ.cjs → chunk-SM3CWDIQ.cjs} +7 -17
  40. package/dist/pptx/{chunk-CJU4P5FT.cjs → chunk-STKGUT5S.cjs} +18 -12
  41. package/dist/pptx/{chunk-JSBGBVBH.mjs → chunk-VRFNAF3Q.mjs} +7 -17
  42. package/dist/pptx/{chunk-YHA6XAB3.cjs → chunk-XIQMFSNG.cjs} +1 -1
  43. package/dist/pptx/{chunk-YARCML7O.mjs → chunk-XQVKQD5Z.mjs} +294 -265
  44. package/dist/pptx/{chunk-XWE5GSE7.mjs → chunk-YI5LH5NN.mjs} +533 -428
  45. package/dist/pptx/{chunk-ADOC5JLI.mjs → chunk-YMTQLZ2I.mjs} +1 -1
  46. package/dist/pptx/{chunk-AIL3BNZS.cjs → chunk-YRHK45AB.cjs} +301 -265
  47. package/dist/pptx/{chunk-FEFQTZDM.cjs → chunk-ZK344LOB.cjs} +689 -574
  48. package/dist/pptx/dom/elements/chart.d.ts +2 -3
  49. package/dist/pptx/dom/elements/chart.d.ts.map +1 -1
  50. package/dist/pptx/dom/elements/table.d.ts.map +1 -1
  51. package/dist/pptx/dom/index.cjs +257 -246
  52. package/dist/pptx/dom/index.mjs +28 -17
  53. package/dist/pptx/export/html2canvas-clone.cjs +2 -2
  54. package/dist/pptx/export/html2canvas-clone.mjs +1 -1
  55. package/dist/pptx/i18n/index.cjs +6 -6
  56. package/dist/pptx/i18n/index.mjs +1 -1
  57. package/dist/pptx/i18n/translator.d.ts.map +1 -1
  58. package/dist/pptx/index.cjs +3035 -2991
  59. package/dist/pptx/index.mjs +5 -5
  60. package/dist/pptx/render/chart-axis-range.d.ts +7 -0
  61. package/dist/pptx/render/chart-axis-range.d.ts.map +1 -1
  62. package/dist/pptx/render/chart-axis-render.d.ts +3 -1
  63. package/dist/pptx/render/chart-axis-render.d.ts.map +1 -1
  64. package/dist/pptx/render/chart-axis-style.d.ts +5 -0
  65. package/dist/pptx/render/chart-axis-style.d.ts.map +1 -1
  66. package/dist/pptx/render/chart-axis.d.ts +1 -1
  67. package/dist/pptx/render/chart-axis.d.ts.map +1 -1
  68. package/dist/pptx/render/chart-cartesian-axes.d.ts.map +1 -1
  69. package/dist/pptx/render/chart-cartesian-bars.d.ts +3 -3
  70. package/dist/pptx/render/chart-cartesian-bars.d.ts.map +1 -1
  71. package/dist/pptx/render/chart-cartesian-percent-stacked.d.ts.map +1 -1
  72. package/dist/pptx/render/chart-cartesian.d.ts.map +1 -1
  73. package/dist/pptx/render/chart-combo-stock.cjs +3 -3
  74. package/dist/pptx/render/chart-combo-stock.mjs +1 -1
  75. package/dist/pptx/render/chart-combo.d.ts.map +1 -1
  76. package/dist/pptx/render/chart-gridlines-toggle.d.ts +13 -1
  77. package/dist/pptx/render/chart-gridlines-toggle.d.ts.map +1 -1
  78. package/dist/pptx/render/chart-helpers.d.ts +13 -13
  79. package/dist/pptx/render/chart-helpers.d.ts.map +1 -1
  80. package/dist/pptx/render/chart-horizontal-bars-helpers.d.ts +7 -3
  81. package/dist/pptx/render/chart-horizontal-bars-helpers.d.ts.map +1 -1
  82. package/dist/pptx/render/chart-horizontal-bars.d.ts.map +1 -1
  83. package/dist/pptx/render/chart-interaction-stacked.d.ts.map +1 -1
  84. package/dist/pptx/render/chart-overlays.cjs +7 -7
  85. package/dist/pptx/render/chart-overlays.mjs +1 -1
  86. package/dist/pptx/render/chart-palette.d.ts +5 -14
  87. package/dist/pptx/render/chart-palette.d.ts.map +1 -1
  88. package/dist/pptx/render/chart-quick-action-styles.d.ts +5 -3
  89. package/dist/pptx/render/chart-quick-action-styles.d.ts.map +1 -1
  90. package/dist/pptx/render/chart-scatter-x-axis.d.ts.map +1 -1
  91. package/dist/pptx/render/chart-style-palette.d.ts +52 -0
  92. package/dist/pptx/render/chart-style-palette.d.ts.map +1 -0
  93. package/dist/pptx/render/chart-surface-treemap.cjs +4 -4
  94. package/dist/pptx/render/chart-surface-treemap.mjs +1 -1
  95. package/dist/pptx/render/chart-view-model-bars.d.ts +31 -1
  96. package/dist/pptx/render/chart-view-model-bars.d.ts.map +1 -1
  97. package/dist/pptx/render/chart-view-model-build.d.ts.map +1 -1
  98. package/dist/pptx/render/chart-view-model.cjs +53 -41
  99. package/dist/pptx/render/chart-view-model.mjs +1 -1
  100. package/dist/pptx/render/chart-waterfall-map.cjs +6 -6
  101. package/dist/pptx/render/chart-waterfall-map.mjs +1 -1
  102. package/dist/pptx/render/connector-elbow-geometry.d.ts +7 -43
  103. package/dist/pptx/render/connector-elbow-geometry.d.ts.map +1 -1
  104. package/dist/pptx/render/foreign-object-svg-document.d.ts +12 -0
  105. package/dist/pptx/render/foreign-object-svg-document.d.ts.map +1 -1
  106. package/dist/pptx/render/index.d.ts +2 -0
  107. package/dist/pptx/render/index.d.ts.map +1 -1
  108. package/dist/pptx/render/table-cell-css.d.ts +3 -2
  109. package/dist/pptx/render/table-cell-css.d.ts.map +1 -1
  110. package/dist/pptx/render/table-cell-edit.d.ts +1 -1
  111. package/dist/pptx/render/table-cell-edit.d.ts.map +1 -1
  112. package/dist/pptx/render/table-cell-paragraphs.d.ts +29 -0
  113. package/dist/pptx/render/table-cell-paragraphs.d.ts.map +1 -0
  114. package/dist/pptx/render/table-style.d.ts +2 -0
  115. package/dist/pptx/render/table-style.d.ts.map +1 -1
  116. package/dist/pptx/render/title-bar.d.ts +5 -0
  117. package/dist/pptx/render/title-bar.d.ts.map +1 -1
  118. package/dist/pptx/render/viewer-root-options.d.ts +54 -0
  119. package/dist/pptx/render/viewer-root-options.d.ts.map +1 -0
  120. package/dist/pptx/web-components/office-token-bridge.d.ts.map +1 -1
  121. package/dist/pptx/web-components/registration-contract.d.ts.map +1 -1
  122. package/dist/presence.js +3 -3
  123. package/dist/registry.d.ts +2 -0
  124. package/dist/registry.d.ts.map +1 -1
  125. package/dist/ribbon/ribbon-tabs.d.ts +2 -1
  126. package/dist/ribbon/ribbon-tabs.d.ts.map +1 -1
  127. package/dist/smartart/smartart-svg.d.ts +3 -2
  128. package/dist/smartart.js +3 -3
  129. package/dist/suite/attachment-store.d.ts +13 -0
  130. package/dist/suite/document-store.d.ts +31 -0
  131. package/dist/suite/index.d.ts +2 -0
  132. package/dist/suite.js +132 -1
  133. package/dist/teams/app/channel-tab.d.ts +5 -0
  134. package/dist/teams/chat-composer.d.ts +3 -0
  135. package/dist/teams.js +6 -6
  136. package/dist/theme.js +2 -2
  137. package/dist/tokens.d.ts +5 -0
  138. package/dist/tokens.d.ts.map +1 -1
  139. package/dist/visio/styles/index.d.ts +2 -0
  140. package/dist/visio/styles/theme.d.ts +11 -0
  141. package/dist/visio/styles.d.ts +2 -2
  142. package/dist/visio.js +76 -25
  143. package/dist/xlsx/backstage/index.d.ts +4 -1
  144. package/dist/xlsx/backstage/pages-share.d.ts +19 -0
  145. package/dist/xlsx/backstage/parts.d.ts +3 -0
  146. package/dist/xlsx/chart-fill-binding.d.ts +2 -2
  147. package/dist/xlsx/chart-series-gradient-type.d.ts +3 -2
  148. package/dist/xlsx/collaboration-session.d.ts +9 -0
  149. package/dist/xlsx/collaboration-types.d.ts +41 -0
  150. package/dist/xlsx/collaboration.d.ts +56 -0
  151. package/dist/xlsx/component.d.ts +8 -0
  152. package/dist/xlsx/dialogs/comments-list.d.ts +4 -0
  153. package/dist/xlsx/dialogs/help-dialogs.d.ts +1 -1
  154. package/dist/xlsx/editor-core.d.ts +3 -0
  155. package/dist/xlsx/element-api.d.ts +19 -1
  156. package/dist/xlsx/events.d.ts +4 -1
  157. package/dist/xlsx/grid/remote-layer.d.ts +3 -0
  158. package/dist/xlsx/grid/sparkline.d.ts +3 -0
  159. package/dist/xlsx/grid/styles.d.ts +1 -1
  160. package/dist/xlsx/index.d.ts +1 -0
  161. package/dist/xlsx/ribbon-actions.d.ts +21 -0
  162. package/dist/xlsx/shell-commands.d.ts +1 -1
  163. package/dist/xlsx/title-bar.d.ts +4 -2
  164. package/dist/xlsx.js +712 -90
  165. package/package.json +3 -3
  166. package/dist/pptx/web-components/status-bar-styles.d.ts +0 -3
  167. package/dist/pptx/web-components/status-bar-styles.d.ts.map +0 -1
  168. package/dist/pptx/web-components/title-bar-styles.d.ts +0 -7
  169. package/dist/pptx/web-components/title-bar-styles.d.ts.map +0 -1
@@ -1532,6 +1532,88 @@ function formatChartNumber(value, formatCode) {
1532
1532
  return formatChartNumberWithColor(value, formatCode)?.text;
1533
1533
  }
1534
1534
 
1535
+ // src/pptx/render/chart-style-palette.ts
1536
+ function hexToRgb(hex) {
1537
+ const h = hex.replace("#", "");
1538
+ return [
1539
+ parseInt(h.substring(0, 2), 16),
1540
+ parseInt(h.substring(2, 4), 16),
1541
+ parseInt(h.substring(4, 6), 16)
1542
+ ];
1543
+ }
1544
+ function rgbToHex(r, g, b) {
1545
+ const clamp3 = (v) => Math.max(0, Math.min(255, Math.round(v)));
1546
+ return `#${clamp3(r).toString(16).padStart(2, "0")}${clamp3(g).toString(16).padStart(2, "0")}${clamp3(b).toString(16).padStart(2, "0")}`;
1547
+ }
1548
+ function tint(hex, amount) {
1549
+ const [r, g, b] = hexToRgb(hex);
1550
+ return rgbToHex(r + (255 - r) * amount, g + (255 - g) * amount, b + (255 - b) * amount);
1551
+ }
1552
+ function shade(hex, amount) {
1553
+ const [r, g, b] = hexToRgb(hex);
1554
+ return rgbToHex(r * (1 - amount), g * (1 - amount), b * (1 - amount));
1555
+ }
1556
+ var OFFICE_ACCENTS = [
1557
+ "#4472C4",
1558
+ "#ED7D31",
1559
+ "#A5A5A5",
1560
+ "#FFC000",
1561
+ "#5B9BD5",
1562
+ "#70AD47"
1563
+ ];
1564
+ var DEFAULT_EXTRAS = ["#FF0000", "#00B0F0"];
1565
+ var DEFAULT_CHART_PALETTE = [...OFFICE_ACCENTS, ...DEFAULT_EXTRAS];
1566
+ function monochromaticRamp(base) {
1567
+ return [
1568
+ shade(base, 0.5),
1569
+ shade(base, 0.35),
1570
+ shade(base, 0.15),
1571
+ base,
1572
+ tint(base, 0.2),
1573
+ tint(base, 0.4),
1574
+ tint(base, 0.6),
1575
+ tint(base, 0.8)
1576
+ ];
1577
+ }
1578
+ var GREY = "#7F7F7F";
1579
+ function buildPalette(column, accents) {
1580
+ if (column === 0) {
1581
+ return monochromaticRamp(GREY);
1582
+ }
1583
+ if (column === 1) {
1584
+ return [...accents, ...accents.map((accent) => shade(accent, 0.4))];
1585
+ }
1586
+ return monochromaticRamp(accents[column - 2]);
1587
+ }
1588
+ function usableAccents(accents) {
1589
+ return accents?.length === 6 && accents.every((accent) => /^#[0-9a-f]{6}$/iu.test(accent)) ? accents : OFFICE_ACCENTS;
1590
+ }
1591
+ var paletteCache = /* @__PURE__ */ new Map();
1592
+ function getChartStylePalette(styleId, themeAccents) {
1593
+ const accents = usableAccents(themeAccents);
1594
+ const valid = styleId !== void 0 && styleId >= 1 && styleId <= 48;
1595
+ if (!valid && accents === OFFICE_ACCENTS) {
1596
+ return DEFAULT_CHART_PALETTE;
1597
+ }
1598
+ const column = valid ? (Math.trunc(styleId) - 1) % 8 : -1;
1599
+ const key = `${column}:${accents.join(",")}`;
1600
+ let palette = paletteCache.get(key);
1601
+ if (!palette) {
1602
+ palette = column < 0 ? [...accents, ...DEFAULT_EXTRAS] : buildPalette(column, accents);
1603
+ paletteCache.set(key, palette);
1604
+ }
1605
+ return palette;
1606
+ }
1607
+ function resolveChartPalette(chartData) {
1608
+ if (chartData.colorPalette && chartData.colorPalette.length > 0) {
1609
+ return [...chartData.colorPalette];
1610
+ }
1611
+ return [...getChartStylePalette(chartData.style?.styleId, chartData.themeAccentColors)];
1612
+ }
1613
+ function withResolvedPalette(chartData) {
1614
+ return chartData.colorPalette && chartData.colorPalette.length > 0 ? chartData : { ...chartData, colorPalette: resolveChartPalette(chartData) };
1615
+ }
1616
+
1535
1617
  // src/pptx/render/chart-style-defaults.ts
1536
1618
  var DEFAULT_LABEL_COLOR = "#334155";
1537
1619
  var DEFAULT_TITLE_TEXT_PX = 12;
@@ -1716,114 +1798,6 @@ function withChartTitleBand(vm, chartData) {
1716
1798
  }
1717
1799
 
1718
1800
  // src/pptx/render/chart-helpers.ts
1719
- var ACCENT1 = "#4472C4";
1720
- var ACCENT2 = "#ED7D31";
1721
- var ACCENT3 = "#A5A5A5";
1722
- var ACCENT4 = "#FFC000";
1723
- var ACCENT5 = "#5B9BD5";
1724
- var ACCENT6 = "#70AD47";
1725
- var ACCENTS = [ACCENT1, ACCENT2, ACCENT3, ACCENT4, ACCENT5, ACCENT6];
1726
- var DEFAULT_CHART_PALETTE = [
1727
- "#4472C4",
1728
- "#ED7D31",
1729
- "#A5A5A5",
1730
- "#FFC000",
1731
- "#5B9BD5",
1732
- "#70AD47",
1733
- "#FF0000",
1734
- "#00B0F0"
1735
- ];
1736
- function hexToRgb(hex) {
1737
- const h = hex.replace("#", "");
1738
- return [
1739
- parseInt(h.substring(0, 2), 16),
1740
- parseInt(h.substring(2, 4), 16),
1741
- parseInt(h.substring(4, 6), 16)
1742
- ];
1743
- }
1744
- function rgbToHex(r, g, b) {
1745
- const clamp3 = (v) => Math.max(0, Math.min(255, Math.round(v)));
1746
- return `#${clamp3(r).toString(16).padStart(2, "0")}${clamp3(g).toString(16).padStart(2, "0")}${clamp3(b).toString(16).padStart(2, "0")}`;
1747
- }
1748
- function tint(hex, amount) {
1749
- const [r, g, b] = hexToRgb(hex);
1750
- return rgbToHex(r + (255 - r) * amount, g + (255 - g) * amount, b + (255 - b) * amount);
1751
- }
1752
- function shade(hex, amount) {
1753
- const [r, g, b] = hexToRgb(hex);
1754
- return rgbToHex(r * (1 - amount), g * (1 - amount), b * (1 - amount));
1755
- }
1756
- function colorfulSequential(offset) {
1757
- const out = [];
1758
- for (let i = 0; i < 8; i++) {
1759
- out.push(ACCENTS[(i + offset) % ACCENTS.length]);
1760
- }
1761
- return out;
1762
- }
1763
- function monochromaticRamp(base) {
1764
- return [
1765
- shade(base, 0.5),
1766
- shade(base, 0.35),
1767
- shade(base, 0.15),
1768
- base,
1769
- tint(base, 0.2),
1770
- tint(base, 0.4),
1771
- tint(base, 0.6),
1772
- tint(base, 0.8)
1773
- ];
1774
- }
1775
- function colorfulVariant(offset, tintAmount) {
1776
- return ACCENTS.map((_, i) => {
1777
- const idx = (i + offset) % ACCENTS.length;
1778
- return tintAmount > 0 ? tint(ACCENTS[idx], tintAmount) : shade(ACCENTS[idx], -tintAmount);
1779
- }).concat([
1780
- tint(ACCENTS[offset % ACCENTS.length], 0.4),
1781
- shade(ACCENTS[(offset + 1) % ACCENTS.length], 0.2)
1782
- ]);
1783
- }
1784
- function darkPalette(offset, shadeAmount) {
1785
- return colorfulSequential(offset).map((c) => shade(c, shadeAmount));
1786
- }
1787
- function tonedPalette(offset, tintAmount) {
1788
- return colorfulSequential(offset).map((c) => tint(c, tintAmount));
1789
- }
1790
- function buildPalette(styleId) {
1791
- const id = Math.max(1, Math.min(48, styleId));
1792
- if (id <= 8) {
1793
- return colorfulSequential(id - 1);
1794
- }
1795
- if (id <= 16) {
1796
- const accentIdx = (id - 9) % ACCENTS.length;
1797
- return monochromaticRamp(ACCENTS[accentIdx]);
1798
- }
1799
- if (id <= 24) {
1800
- const sub2 = id - 17;
1801
- const tintAmt = sub2 < 4 ? sub2 * 0.1 : -(sub2 - 4) * 0.1;
1802
- return colorfulVariant(sub2, tintAmt);
1803
- }
1804
- if (id <= 32) {
1805
- const sub2 = id - 25;
1806
- return darkPalette(sub2, 0.25 + sub2 % 4 * 0.1);
1807
- }
1808
- if (id <= 40) {
1809
- const sub2 = id - 33;
1810
- return tonedPalette(sub2, 0.15 + sub2 % 4 * 0.08);
1811
- }
1812
- const sub = id - 41;
1813
- return tonedPalette(sub, 0.4 + sub % 4 * 0.1);
1814
- }
1815
- var paletteCache = /* @__PURE__ */ new Map();
1816
- function getChartStylePalette(styleId) {
1817
- if (styleId === void 0 || styleId < 1 || styleId > 48) {
1818
- return DEFAULT_CHART_PALETTE;
1819
- }
1820
- let palette = paletteCache.get(styleId);
1821
- if (!palette) {
1822
- palette = buildPalette(styleId);
1823
- paletteCache.set(styleId, palette);
1824
- }
1825
- return palette;
1826
- }
1827
1801
  function seriesColor(series, index, styleId, colorPalette) {
1828
1802
  const explicit = series.color ?? series.marker?.spPr?.fillColor;
1829
1803
  if (explicit) {
@@ -2105,46 +2079,56 @@ function computeBarRects(series, catCount, layout, range, colorPalette) {
2105
2079
  }
2106
2080
  return rects;
2107
2081
  }
2108
- function computeStackedBarRects(series, catCount, layout, range, colorPalette) {
2109
- const rects = [], barW = layout.plotWidth / Math.max(catCount, 1) * 0.7, barOffset = (layout.plotWidth / Math.max(catCount, 1) - barW) / 2, zeroY = valueToY2(0, range, layout.plotTop, layout.plotBottom);
2082
+ function stackedBarWidth(slotWidth, gapWidth, fallbackFraction) {
2083
+ return gapWidth === void 0 ? slotWidth * fallbackFraction : chart.clusteredBarGeometry(slotWidth, 1, { barGapWidth: gapWidth }).singleBarWidth;
2084
+ }
2085
+ function clipStackedSegment(base, value, range) {
2086
+ const low = Math.max(Math.min(base, base + value), range.min), high = Math.min(Math.max(base, base + value), range.max);
2087
+ return high > low ? { low, high } : void 0;
2088
+ }
2089
+ function stackedSegmentExtent(baseCoord, tipCoord, minSize) {
2090
+ const size = Math.max(Math.abs(tipCoord - baseCoord), minSize);
2091
+ return { start: tipCoord < baseCoord ? baseCoord - size : baseCoord, size };
2092
+ }
2093
+ function computeStackedBarRects(series, catCount, layout, range, colorPalette, gapWidth) {
2094
+ const rects = [], slot = layout.plotWidth / Math.max(catCount, 1), barW = stackedBarWidth(slot, gapWidth, 0.7), barOffset = (slot - barW) / 2;
2110
2095
  for (let ci = 0; ci < catCount; ci++) {
2111
- let posTop = zeroY, negBottom = zeroY;
2096
+ let posTotal = 0, negTotal = 0;
2112
2097
  for (let si = 0; si < series.length; si++) {
2113
2098
  const val = series[si].values[ci] ?? 0;
2114
2099
  if (val === 0) {
2115
2100
  continue;
2116
2101
  }
2117
- const x = layout.plotLeft + layout.plotWidth / Math.max(catCount, 1) * ci + barOffset, h = Math.max(
2118
- Math.abs(
2119
- valueToY2(val, range, layout.plotTop, layout.plotBottom) - valueToY2(0, range, layout.plotTop, layout.plotBottom)
2120
- ),
2121
- 1
2122
- );
2102
+ const base = val > 0 ? posTotal : negTotal;
2123
2103
  if (val > 0) {
2124
- const y = posTop - h;
2125
- rects.push({
2126
- x,
2127
- y,
2128
- w: barW,
2129
- h,
2130
- fill: seriesColor2(series[si], si, colorPalette),
2131
- seriesIndex: si,
2132
- pointIndex: ci
2133
- });
2134
- posTop = y;
2104
+ posTotal += val;
2135
2105
  } else {
2136
- const y = negBottom;
2137
- rects.push({
2138
- x,
2139
- y,
2140
- w: barW,
2141
- h,
2142
- fill: seriesColor2(series[si], si, colorPalette),
2143
- seriesIndex: si,
2144
- pointIndex: ci
2145
- });
2146
- negBottom = y + h;
2106
+ negTotal += val;
2107
+ }
2108
+ const segment = clipStackedSegment(base, val, range);
2109
+ if (!segment) {
2110
+ continue;
2147
2111
  }
2112
+ const baseY = valueToY2(
2113
+ val > 0 ? segment.low : segment.high,
2114
+ range,
2115
+ layout.plotTop,
2116
+ layout.plotBottom
2117
+ ), tipY = valueToY2(
2118
+ val > 0 ? segment.high : segment.low,
2119
+ range,
2120
+ layout.plotTop,
2121
+ layout.plotBottom
2122
+ ), { start, size } = stackedSegmentExtent(baseY, tipY, 1);
2123
+ rects.push({
2124
+ x: layout.plotLeft + slot * ci + barOffset,
2125
+ y: start,
2126
+ w: barW,
2127
+ h: size,
2128
+ fill: seriesColor2(series[si], si, colorPalette),
2129
+ seriesIndex: si,
2130
+ pointIndex: ci
2131
+ });
2148
2132
  }
2149
2133
  }
2150
2134
  return rects;
@@ -2383,28 +2367,6 @@ function resolveDataPointPictureFill(series, pointIndex, seriesIndex, face) {
2383
2367
  };
2384
2368
  }
2385
2369
 
2386
- // src/pptx/render/chart-palette.ts
2387
- function hexToRgb2(hex) {
2388
- const h = hex.replace("#", "");
2389
- return [
2390
- parseInt(h.substring(0, 2), 16),
2391
- parseInt(h.substring(2, 4), 16),
2392
- parseInt(h.substring(4, 6), 16)
2393
- ];
2394
- }
2395
- function rgbToHex2(r, g, b) {
2396
- const clamp3 = (v) => Math.max(0, Math.min(255, Math.round(v)));
2397
- return `#${clamp3(r).toString(16).padStart(2, "0")}${clamp3(g).toString(16).padStart(2, "0")}${clamp3(b).toString(16).padStart(2, "0")}`;
2398
- }
2399
- function tint2(hex, amount) {
2400
- const [r, g, b] = hexToRgb2(hex);
2401
- return rgbToHex2(r + (255 - r) * amount, g + (255 - g) * amount, b + (255 - b) * amount);
2402
- }
2403
- function shade2(hex, amount) {
2404
- const [r, g, b] = hexToRgb2(hex);
2405
- return rgbToHex2(r * (1 - amount), g * (1 - amount), b * (1 - amount));
2406
- }
2407
-
2408
2370
  // src/pptx/render/chart-picture-pattern-def.ts
2409
2371
  function polygonBoundingBox(points) {
2410
2372
  const coords = points.trim().split(/\s+/u).map((pair) => pair.split(",").map(Number));
@@ -2433,7 +2395,7 @@ function buildPictureFillPatternDef(id, href, format, box, tileHeightPx) {
2433
2395
 
2434
2396
  // src/pptx/render/chart-bar3d-face-picture.ts
2435
2397
  function resolveUntargetedBarFaceFill(face, baseColor) {
2436
- return face === "end" ? tint2(baseColor, 0.22) : shade2(baseColor, 0.25);
2398
+ return face === "end" ? tint(baseColor, 0.22) : shade(baseColor, 0.25);
2437
2399
  }
2438
2400
  function resolveExtrusionFaceFill(facePoints, face, resolvedColor, rect, picture, defs) {
2439
2401
  const fallback = resolveUntargetedBarFaceFill(face, resolvedColor);
@@ -2633,8 +2595,8 @@ function pieExtrusion(paths, depth) {
2633
2595
  return paths.map((p) => ({
2634
2596
  kind: "path",
2635
2597
  d: translateSlicePath(p.d, 0, offsetY),
2636
- fill: shade2(p.fill, 0.32),
2637
- stroke: shade2(p.fill, 0.4),
2598
+ fill: shade(p.fill, 0.32),
2599
+ stroke: shade(p.fill, 0.4),
2638
2600
  strokeWidth: 0.5
2639
2601
  }));
2640
2602
  }
@@ -2646,7 +2608,7 @@ function ribbonExtrusion(prims, depth) {
2646
2608
  out.push({
2647
2609
  ...pl,
2648
2610
  points: shiftPoints(pl.points, depth.dx, depth.dy),
2649
- stroke: shade2(pl.stroke, 0.3),
2611
+ stroke: shade(pl.stroke, 0.3),
2650
2612
  fill: "none",
2651
2613
  part: void 0
2652
2614
  });
@@ -2655,7 +2617,7 @@ function ribbonExtrusion(prims, depth) {
2655
2617
  out.push({
2656
2618
  ...pg,
2657
2619
  points: shiftPoints(pg.points, depth.dx, depth.dy),
2658
- fill: shade2(pg.fill === "none" ? "#888888" : pg.fill, 0.3),
2620
+ fill: shade(pg.fill === "none" ? "#888888" : pg.fill, 0.3),
2659
2621
  part: void 0
2660
2622
  });
2661
2623
  }
@@ -2793,6 +2755,39 @@ function computeValueRangeForAxis(series, axis, plotHeightPx) {
2793
2755
  const requestedLogBase = axis?.logBase ?? 10;
2794
2756
  const logBase = axis?.logScale && Number.isFinite(requestedLogBase) && requestedLogBase > 1 ? requestedLogBase : axis?.logScale ? 10 : void 0;
2795
2757
  const automatic = logBase ? computeLogValueRange(series, logBase) : computeValueRange(series, plotHeightPx);
2758
+ return withAxisBounds(automatic, axis, logBase);
2759
+ }
2760
+ function computeStackedValueRangeForAxis(series, catCount, axis, isPercent, plotSizePx) {
2761
+ if (isPercent) {
2762
+ return {
2763
+ ...percentStackedRange(series, catCount, plotSizePx),
2764
+ ...axis?.orientation === "maxMin" ? { reverseOrder: true } : {}
2765
+ };
2766
+ }
2767
+ return withAxisBounds(computeStackedValueRange(series, catCount, plotSizePx), axis);
2768
+ }
2769
+ function percentStackedRange(series, catCount, plotSizePx) {
2770
+ const shares = series.map((entry) => ({
2771
+ ...entry,
2772
+ values: Array.from({ length: catCount }, (_, ci) => {
2773
+ const total = series.reduce((sum, s) => sum + Math.abs(s.values[ci] ?? 0), 0);
2774
+ return total > 0 ? (entry.values[ci] ?? 0) / total * 100 : 0;
2775
+ })
2776
+ }));
2777
+ const automatic = computeStackedValueRange(shares, catCount, plotSizePx);
2778
+ if (automatic.min >= 0) {
2779
+ return { min: 0, max: 100, span: 100 };
2780
+ }
2781
+ const min = Math.max(automatic.min, -100);
2782
+ const unit = automatic.majorUnit;
2783
+ return {
2784
+ min,
2785
+ max: 100,
2786
+ span: 100 - min,
2787
+ ...unit !== void 0 && 100 % unit === 0 && min % unit === 0 ? { majorUnit: unit } : {}
2788
+ };
2789
+ }
2790
+ function withAxisBounds(automatic, axis, logBase) {
2796
2791
  const validMin = typeof axis?.min === "number" && Number.isFinite(axis.min) && (!logBase || axis.min > 0) ? axis.min : void 0;
2797
2792
  const validMax = typeof axis?.max === "number" && Number.isFinite(axis.max) && (!logBase || axis.max > 0) ? axis.max : void 0;
2798
2793
  const min = validMin ?? automatic.min;
@@ -3554,6 +3549,9 @@ function unitsLabelTextStyle(axis, baseStyle) {
3554
3549
  ...fontFamily ? { fontFamily } : {}
3555
3550
  };
3556
3551
  }
3552
+ function isNoLine(shape) {
3553
+ return shape?.lineNoFill === true && shape.strokeColor === void 0;
3554
+ }
3557
3555
  function chartLineStyle(shape, fallbackColor = DEFAULT_COLOR, fallbackWidth = 1) {
3558
3556
  const strokeWidth = shape?.strokeWidth ?? fallbackWidth;
3559
3557
  return {
@@ -3565,7 +3563,7 @@ function chartLineStyle(shape, fallbackColor = DEFAULT_COLOR, fallbackWidth = 1)
3565
3563
 
3566
3564
  // src/pptx/render/chart-axis-primitives.ts
3567
3565
  function buildVerticalTickMark(axisX, y, placement, side, length, shape) {
3568
- if (!placement || placement === "none") {
3566
+ if (!placement || placement === "none" || isNoLine(shape)) {
3569
3567
  return void 0;
3570
3568
  }
3571
3569
  const inward = side === "left" ? 1 : -1;
@@ -3581,7 +3579,7 @@ function buildVerticalTickMark(axisX, y, placement, side, length, shape) {
3581
3579
  };
3582
3580
  }
3583
3581
  function buildVerticalAxisLine(axis, axisX, layout) {
3584
- return axis?.spPr ? {
3582
+ return axis?.spPr && !isNoLine(axis.spPr) ? {
3585
3583
  kind: "line",
3586
3584
  x1: axisX,
3587
3585
  y1: layout.plotTop,
@@ -3677,7 +3675,7 @@ function primaryCategoryAxis(axes) {
3677
3675
  return categoryAxes2?.find((axis) => axis.axPos !== "t") ?? categoryAxes2?.[0];
3678
3676
  }
3679
3677
  function tickLine(x, y, placement, topAxis, length, axis) {
3680
- if (!placement || placement === "none") {
3678
+ if (!placement || placement === "none" || isNoLine(axis.spPr)) {
3681
3679
  return void 0;
3682
3680
  }
3683
3681
  const inward = topAxis ? length : -length;
@@ -3699,7 +3697,7 @@ function buildTickMarks(axis, sourceCount, layout, spacing, axisY) {
3699
3697
  const result = [];
3700
3698
  const topAxis = axis.axPos === "t";
3701
3699
  const y = axisY ?? (topAxis ? layout.plotTop : layout.plotBottom);
3702
- if (axis.spPr) {
3700
+ if (axis.spPr && !isNoLine(axis.spPr)) {
3703
3701
  result.push({
3704
3702
  kind: "line",
3705
3703
  x1: layout.plotLeft,
@@ -3786,6 +3784,41 @@ function chartDataInCategoryOrder(chartData, sourceIndices2) {
3786
3784
  };
3787
3785
  }
3788
3786
 
3787
+ // src/pptx/render/chart-gridlines-toggle.ts
3788
+ function primaryValueAxis(axes) {
3789
+ if (!axes) {
3790
+ return void 0;
3791
+ }
3792
+ return axes.find((axis) => axis.axisType === "valAx" && axis.axPos === "l") ?? axes.find((axis) => axis.axisType === "valAx");
3793
+ }
3794
+ function chartGridlinesState(chartData) {
3795
+ const axis = primaryValueAxis(chartData.axes);
3796
+ if (axis) {
3797
+ return axis.majorGridlines ?? false;
3798
+ }
3799
+ return chartData.style?.hasGridlines ?? true;
3800
+ }
3801
+ var shouldRenderMajorGridlines = chartGridlinesState;
3802
+ function axisShowsMajorGridlines(axis) {
3803
+ return axis ? axis.majorGridlines === true : true;
3804
+ }
3805
+ function chartGridlinesPatch(chartData, show) {
3806
+ const axes = chartData.axes ? [...chartData.axes] : [];
3807
+ let index = axes.findIndex((axis) => axis.axisType === "valAx" && axis.axPos === "l");
3808
+ if (index === -1) {
3809
+ index = axes.findIndex((axis) => axis.axisType === "valAx");
3810
+ }
3811
+ if (index === -1) {
3812
+ axes.push({ axisType: "valAx", majorGridlines: show });
3813
+ } else {
3814
+ axes[index] = { ...axes[index], majorGridlines: show };
3815
+ }
3816
+ return {
3817
+ axes,
3818
+ style: { ...chartData.style, hasGridlines: show }
3819
+ };
3820
+ }
3821
+
3789
3822
  // src/pptx/render/chart-scatter-x-axis.ts
3790
3823
  var GRIDLINE_COLOR = "#e2e8f0";
3791
3824
  var TICK_COUNT = 5;
@@ -3806,7 +3839,7 @@ function buildScatterXAxisPlan(chartData, layout) {
3806
3839
  }));
3807
3840
  const range = computeValueRangeForAxis(pseudoSeries, xAxis, layout.plotWidth);
3808
3841
  const toPixelX = (value) => valueToY2(value, range, layout.plotRight, layout.plotLeft);
3809
- const showGridlines = xAxis ? xAxis.majorGridlines === true : true;
3842
+ const showGridlines = axisShowsMajorGridlines(xAxis) && !isNoLine(xAxis?.majorGridlinesSpPr);
3810
3843
  const gridlines = [];
3811
3844
  const labels = [];
3812
3845
  const textStyle = chartAxisTextStyle(xAxis, DEFAULT_CHART_TEXT_PX);
@@ -4160,10 +4193,11 @@ function buildPrimaryAxis(range, layout, axis, axisX = layout.plotLeft, showMajo
4160
4193
  const tickVals = generateAxisTicks(range, axis, TICK_COUNT2);
4161
4194
  const minorTickVals = generateMinorAxisTicks(range, axis);
4162
4195
  const axisLine = buildVerticalAxisLine(axis, axisX, layout);
4196
+ const drawMajorGridlines = showMajorGridlines && !isNoLine(axis?.majorGridlinesSpPr);
4163
4197
  if (axisLine) {
4164
4198
  gridlines.push(axisLine);
4165
4199
  }
4166
- if (axis?.minorGridlines) {
4200
+ if (axis?.minorGridlines && !isNoLine(axis.minorGridlinesSpPr)) {
4167
4201
  for (const val of minorTickVals) {
4168
4202
  const y = valueToY2(val, range, layout.plotTop, layout.plotBottom);
4169
4203
  gridlines.push(
@@ -4187,7 +4221,7 @@ function buildPrimaryAxis(range, layout, axis, axisX = layout.plotLeft, showMajo
4187
4221
  }
4188
4222
  for (const val of tickVals) {
4189
4223
  const y = valueToY2(val, range, layout.plotTop, layout.plotBottom);
4190
- if (showMajorGridlines) {
4224
+ if (drawMajorGridlines) {
4191
4225
  gridlines.push(
4192
4226
  buildStyledGridline(
4193
4227
  y,
@@ -4243,18 +4277,19 @@ function buildPrimaryAxis(range, layout, axis, axisX = layout.plotLeft, showMajo
4243
4277
  }
4244
4278
  return { gridlines, axisLabels };
4245
4279
  }
4246
- function buildSecondaryAxis(range, layout, axis, axisX = layout.plotRight) {
4280
+ function buildSecondaryAxis(range, layout, axis, axisX = layout.plotRight, showMajorGridlines = true) {
4247
4281
  const gridlines = [];
4248
4282
  const axisLabels = [];
4249
4283
  const textStyle = chartAxisTextStyle(axis);
4250
4284
  const captionStyle = chartAxisTextStyle(axis);
4251
4285
  const axisLine = buildVerticalAxisLine(axis, axisX, layout);
4286
+ const drawMajorGridlines = showMajorGridlines && !isNoLine(axis?.majorGridlinesSpPr);
4252
4287
  if (axisLine) {
4253
4288
  gridlines.push(axisLine);
4254
4289
  }
4255
4290
  const tickValues = generateAxisTicks(range, axis, TICK_COUNT2 - 1);
4256
4291
  const minorTickValues = generateMinorAxisTicks(range, axis);
4257
- if (axis?.minorGridlines) {
4292
+ if (axis?.minorGridlines && !isNoLine(axis.minorGridlinesSpPr)) {
4258
4293
  for (const val of minorTickValues) {
4259
4294
  const y = valueToY2(val, range, layout.plotTop, layout.plotBottom);
4260
4295
  gridlines.push(
@@ -4286,17 +4321,19 @@ function buildSecondaryAxis(range, layout, axis, axisX = layout.plotRight) {
4286
4321
  }
4287
4322
  for (const val of tickValues) {
4288
4323
  const y = valueToY2(val, range, layout.plotTop, layout.plotBottom);
4289
- gridlines.push(
4290
- buildStyledGridline(
4291
- y,
4292
- layout,
4293
- axis?.majorGridlinesSpPr,
4294
- SECONDARY_GRID_COLOR,
4295
- 0.5,
4296
- "2 3",
4297
- 0.5
4298
- )
4299
- );
4324
+ if (drawMajorGridlines) {
4325
+ gridlines.push(
4326
+ buildStyledGridline(
4327
+ y,
4328
+ layout,
4329
+ axis?.majorGridlinesSpPr,
4330
+ SECONDARY_GRID_COLOR,
4331
+ 0.5,
4332
+ "2 3",
4333
+ 0.5
4334
+ )
4335
+ );
4336
+ }
4300
4337
  const tick = buildVerticalTickMark(
4301
4338
  axisX,
4302
4339
  y,
@@ -4351,38 +4388,6 @@ function buildSecondaryAxis(range, layout, axis, axisX = layout.plotRight) {
4351
4388
  return { gridlines, axisLabels };
4352
4389
  }
4353
4390
 
4354
- // src/pptx/render/chart-gridlines-toggle.ts
4355
- function primaryValueAxis(axes) {
4356
- if (!axes) {
4357
- return void 0;
4358
- }
4359
- return axes.find((axis) => axis.axisType === "valAx" && axis.axPos === "l") ?? axes.find((axis) => axis.axisType === "valAx");
4360
- }
4361
- function chartGridlinesState(chartData) {
4362
- const axis = primaryValueAxis(chartData.axes);
4363
- if (axis) {
4364
- return axis.majorGridlines ?? false;
4365
- }
4366
- return chartData.style?.hasGridlines ?? true;
4367
- }
4368
- var shouldRenderMajorGridlines = chartGridlinesState;
4369
- function chartGridlinesPatch(chartData, show) {
4370
- const axes = chartData.axes ? [...chartData.axes] : [];
4371
- let index = axes.findIndex((axis) => axis.axisType === "valAx" && axis.axPos === "l");
4372
- if (index === -1) {
4373
- index = axes.findIndex((axis) => axis.axisType === "valAx");
4374
- }
4375
- if (index === -1) {
4376
- axes.push({ axisType: "valAx", majorGridlines: show });
4377
- } else {
4378
- axes[index] = { ...axes[index], majorGridlines: show };
4379
- }
4380
- return {
4381
- axes,
4382
- style: { ...chartData.style, hasGridlines: show }
4383
- };
4384
- }
4385
-
4386
4391
  // src/pptx/render/chart-cartesian-axes.ts
4387
4392
  function hasRicherAxisFeatures(chartData) {
4388
4393
  return Boolean(
@@ -4434,7 +4439,8 @@ function buildCartesianAxes(chartData, layout, primaryRange, secondaryRange, cat
4434
4439
  secondaryRange,
4435
4440
  layout,
4436
4441
  secondaryAxis,
4437
- axisX(secondaryAxis?.crossAxisId, "right")
4442
+ axisX(secondaryAxis?.crossAxisId, "right"),
4443
+ axisShowsMajorGridlines(secondaryAxis)
4438
4444
  );
4439
4445
  return {
4440
4446
  ...primary,
@@ -4451,7 +4457,7 @@ function categoryTotals(series, catCount) {
4451
4457
  );
4452
4458
  }
4453
4459
  function buildPercentStackedBars(chartData, catCount, layout, primaryRange, sourceIndices2, invertNegativeFill2) {
4454
- const primitives = [], dataLabels = [], series = chartData.series, palette = chartData.colorPalette, showLabels = chartData.style?.hasDataLabels, barGroupWidth = layout.plotWidth / Math.max(catCount, 1), barW = barGroupWidth * 0.6, barOffset = (barGroupWidth - barW) / 2, displaySeries = series.map((entry) => ({
4460
+ const primitives = [], dataLabels = [], series = chartData.series, palette = chartData.colorPalette, showLabels = chartData.style?.hasDataLabels, barGroupWidth = layout.plotWidth / Math.max(catCount, 1), barW = stackedBarWidth(barGroupWidth, chartData.barGapWidth, 0.6), barOffset = (barGroupWidth - barW) / 2, displaySeries = series.map((entry) => ({
4455
4461
  ...entry,
4456
4462
  values: sourceIndices2.map((sourceIndex) => entry.values[sourceIndex] ?? 0)
4457
4463
  })), totals = categoryTotals(displaySeries, catCount);
@@ -4459,7 +4465,17 @@ function buildPercentStackedBars(chartData, catCount, layout, primaryRange, sour
4459
4465
  let posRunning = 0, negRunning = 0;
4460
4466
  const catTotal = totals[ci] || 1;
4461
4467
  for (let si = 0; si < series.length; si++) {
4462
- const sourceIndex = sourceIndices2[ci] ?? ci, rawVal = series[si].values[sourceIndex] ?? 0, val = catTotal > 0 ? rawVal / catTotal * 100 : 0, isNeg = val < 0, base = isNeg ? negRunning : posRunning, top = base + val, x = layout.plotLeft + barGroupWidth * ci + barOffset, baseY = valueToY2(base, primaryRange, layout.plotTop, layout.plotBottom), topY = valueToY2(top, primaryRange, layout.plotTop, layout.plotBottom), y = Math.min(baseY, topY), h = Math.max(Math.abs(baseY - topY), 0.5), pctBaseFill = resolveDataPointFill(series[si], sourceIndex, paletteColor2(si, palette)) ?? seriesColor2(series[si], si, palette);
4468
+ const sourceIndex = sourceIndices2[ci] ?? ci, rawVal = series[si].values[sourceIndex] ?? 0, val = catTotal > 0 ? rawVal / catTotal * 100 : 0, base = val < 0 ? negRunning : posRunning;
4469
+ if (val < 0) {
4470
+ negRunning += val;
4471
+ } else {
4472
+ posRunning += val;
4473
+ }
4474
+ const segment = clipStackedSegment(base, val, primaryRange);
4475
+ if (!segment) {
4476
+ continue;
4477
+ }
4478
+ const x = layout.plotLeft + barGroupWidth * ci + barOffset, toY = (value) => valueToY2(value, primaryRange, layout.plotTop, layout.plotBottom), { start: y, size: h } = val < 0 ? stackedSegmentExtent(toY(segment.high), toY(segment.low), 0.5) : stackedSegmentExtent(toY(segment.low), toY(segment.high), 0.5), pctBaseFill = resolveDataPointFill(series[si], sourceIndex, paletteColor2(si, palette)) ?? seriesColor2(series[si], si, palette);
4463
4479
  primitives.push({
4464
4480
  kind: "rect",
4465
4481
  x,
@@ -4488,11 +4504,6 @@ function buildPercentStackedBars(chartData, catCount, layout, primaryRange, sour
4488
4504
  ...dataLabelFontOverride(resolveDataLabelTextStyle(chartData, series[si], sourceIndex))
4489
4505
  });
4490
4506
  }
4491
- if (isNeg) {
4492
- negRunning += val;
4493
- } else {
4494
- posRunning += val;
4495
- }
4496
4507
  }
4497
4508
  }
4498
4509
  return { primitives, dataLabels };
@@ -4638,7 +4649,14 @@ function buildBars(chartData, catCount, layout, primaryRange, secondaryRange, se
4638
4649
  const displaySeries = series.map((entry) => ({
4639
4650
  ...entry,
4640
4651
  values: sourceIndices2.map((sourceIndex) => entry.values[sourceIndex] ?? 0)
4641
- })), rects = computeStackedBarRects(displaySeries, catCount, layout, primaryRange, palette);
4652
+ })), rects = computeStackedBarRects(
4653
+ displaySeries,
4654
+ catCount,
4655
+ layout,
4656
+ primaryRange,
4657
+ palette,
4658
+ chartData.barGapWidth
4659
+ );
4642
4660
  for (const r of rects) {
4643
4661
  let fill = r.fill, part, title;
4644
4662
  if (r.seriesIndex !== void 0 && r.pointIndex !== void 0) {
@@ -5328,7 +5346,7 @@ function addUnit(date, amount, unit) {
5328
5346
  }
5329
5347
  function tickLine2(x, y, axis, minor) {
5330
5348
  const placement = minor ? axis.minorTickMark : axis.majorTickMark;
5331
- if (!placement || placement === "none") {
5349
+ if (!placement || placement === "none" || isNoLine(axis.spPr)) {
5332
5350
  return void 0;
5333
5351
  }
5334
5352
  const length = minor ? 2.5 : 4;
@@ -5421,7 +5439,7 @@ function buildDateAxisPlan(chartData, layout, selectedAxis, axisY) {
5421
5439
  const line2 = tickLine2(x, y, axis, false);
5422
5440
  return line2 ? [line2] : [];
5423
5441
  });
5424
- if (!axis.deleted && axis.spPr) {
5442
+ if (!axis.deleted && axis.spPr && !isNoLine(axis.spPr)) {
5425
5443
  tickMarks.unshift({
5426
5444
  kind: "line",
5427
5445
  x1: layout.plotLeft,
@@ -5624,19 +5642,21 @@ function valueToX(val, range, leftX, rightX) {
5624
5642
  }
5625
5643
  return range.reverseOrder ? rightX - ratio * usable : leftX + ratio * usable;
5626
5644
  }
5627
- function buildTransposedValueAxis(range, layout) {
5628
- const gridlines = [], axisLabels = [];
5645
+ function buildTransposedValueAxis(range, layout, axis, showMajorGridlines = true) {
5646
+ const gridlines = [], axisLabels = [], drawGridlines = showMajorGridlines && !isNoLine(axis?.majorGridlinesSpPr);
5629
5647
  for (const val of axisTickValues(range)) {
5630
5648
  const x = valueToX(val, range, layout.plotLeft, layout.plotRight);
5631
- gridlines.push({
5632
- kind: "line",
5633
- x1: x,
5634
- y1: layout.plotTop,
5635
- x2: x,
5636
- y2: layout.plotBottom,
5637
- stroke: GRIDLINE_COLOR3,
5638
- strokeWidth: 1
5639
- });
5649
+ if (drawGridlines) {
5650
+ gridlines.push(
5651
+ buildVerticalStyledGridline(
5652
+ x,
5653
+ layout,
5654
+ axis?.majorGridlinesSpPr,
5655
+ GRIDLINE_COLOR3,
5656
+ 1,
5657
+ void 0)
5658
+ );
5659
+ }
5640
5660
  axisLabels.push({
5641
5661
  kind: "text",
5642
5662
  x,
@@ -5686,7 +5706,12 @@ function barFill(chartData, series, seriesIndex, pointIndex) {
5686
5706
  function buildHorizontalBarViewModel(element, chartData, categoryLabels) {
5687
5707
  const layout = computePlotLayout(element.width, element.height, chartData, true, {
5688
5708
  leftCategoryLabelWidth: widestCategoryLabelWidth(categoryLabels, DEFAULT_CHART_TEXT_PX)
5689
- }), catCount = Math.max(categoryLabels.length, 1), series = chartData.series, grouping = chartData.grouping ?? "clustered", isStacked = grouping === "stacked" || grouping === "percentStacked", isPercent = grouping === "percentStacked", range = isPercent ? { min: 0, max: 100, span: 100 } : isStacked ? computeStackedValueRange(series, catCount, layout.plotWidth) : computeValueRangeForChart(series, chartData.axes, layout.plotWidth), { gridlines, axisLabels } = buildTransposedValueAxis(range, layout), zeroX = valueToX(0, range, layout.plotLeft, layout.plotRight), zeroLine = range.min < 0 && range.max > 0 ? {
5709
+ }), catCount = Math.max(categoryLabels.length, 1), series = chartData.series, grouping = chartData.grouping ?? "clustered", isStacked = grouping === "stacked" || grouping === "percentStacked", isPercent = grouping === "percentStacked", valueAxis = primaryValueAxis(chartData.axes), range = isStacked ? computeStackedValueRangeForAxis(series, catCount, valueAxis, isPercent, layout.plotWidth) : computeValueRangeForChart(series, chartData.axes, layout.plotWidth), { gridlines, axisLabels } = buildTransposedValueAxis(
5710
+ range,
5711
+ layout,
5712
+ valueAxis,
5713
+ shouldRenderMajorGridlines(chartData)
5714
+ ), zeroX = valueToX(0, range, layout.plotLeft, layout.plotRight), zeroLine = range.min < 0 && range.max > 0 ? {
5690
5715
  kind: "line",
5691
5716
  x1: zeroX,
5692
5717
  y1: layout.plotTop,
@@ -5745,7 +5770,7 @@ function buildHorizontalBarViewModel(element, chartData, categoryLabels) {
5745
5770
  }
5746
5771
  }
5747
5772
  } else {
5748
- const totals = isPercent ? categoryTotals2(series, catCount) : [], barH = band * (isPercent ? 0.6 : 0.7), barOffset = (band - barH) / 2;
5773
+ const totals = isPercent ? categoryTotals2(series, catCount) : [], barH = stackedBarWidth(band, chartData.barGapWidth, isPercent ? 0.6 : 0.7), barOffset = (band - barH) / 2;
5749
5774
  for (let ci = 0; ci < catCount; ci++) {
5750
5775
  let posRunning = 0, negRunning = 0;
5751
5776
  const catTotal = isPercent ? totals[ci] || 1 : 1;
@@ -5754,7 +5779,21 @@ function buildHorizontalBarViewModel(element, chartData, categoryLabels) {
5754
5779
  if (val === 0) {
5755
5780
  continue;
5756
5781
  }
5757
- const isNeg = val < 0, base = isNeg ? negRunning : posRunning, top = base + val, y = layout.plotTop + band * ci + barOffset, baseX = valueToX(base, range, layout.plotLeft, layout.plotRight), topX = valueToX(top, range, layout.plotLeft, layout.plotRight), x = Math.min(baseX, topX), w = Math.max(Math.abs(topX - baseX), 0.5);
5782
+ const isNeg = val < 0, base = isNeg ? negRunning : posRunning;
5783
+ if (isNeg) {
5784
+ negRunning += val;
5785
+ } else {
5786
+ posRunning += val;
5787
+ }
5788
+ const segment = clipStackedSegment(base, val, range);
5789
+ if (!segment) {
5790
+ continue;
5791
+ }
5792
+ const y = layout.plotTop + band * ci + barOffset, { start: x, size: w } = stackedSegmentExtent(
5793
+ valueToX(isNeg ? segment.high : segment.low, range, layout.plotLeft, layout.plotRight),
5794
+ valueToX(isNeg ? segment.low : segment.high, range, layout.plotLeft, layout.plotRight),
5795
+ 0.5
5796
+ );
5758
5797
  primitives.push({
5759
5798
  kind: "rect",
5760
5799
  x,
@@ -5808,11 +5847,6 @@ function buildHorizontalBarViewModel(element, chartData, categoryLabels) {
5808
5847
  });
5809
5848
  }
5810
5849
  }
5811
- if (isNeg) {
5812
- negRunning += val;
5813
- } else {
5814
- posRunning += val;
5815
- }
5816
5850
  }
5817
5851
  }
5818
5852
  }
@@ -5844,12 +5878,6 @@ function buildHorizontalBarViewModel(element, chartData, categoryLabels) {
5844
5878
  }
5845
5879
 
5846
5880
  // src/pptx/render/chart-cartesian.ts
5847
- function stackedRange(chartData, catCount, isPercent, plotHeightPx) {
5848
- if (isPercent) {
5849
- return { min: 0, max: 100, span: 100 };
5850
- }
5851
- return computeStackedValueRange(chartData.series, catCount, plotHeightPx);
5852
- }
5853
5881
  function buildCartesianViewModel(element, chartData, categoryLabels, kind) {
5854
5882
  if (kind === "bar" && chartData.barDirection === "bar") {
5855
5883
  return buildHorizontalBarViewModel(element, chartData, categoryLabels);
@@ -5865,13 +5893,13 @@ function buildCartesianViewModel(element, chartData, categoryLabels, kind) {
5865
5893
  const useSecondary = !isStacked && secondaryIdx.size > 0;
5866
5894
  const primaryPlotSeries = useSecondary ? chartData.series.filter((_s, i) => !secondaryIdx.has(i)) : chartData.series;
5867
5895
  const secondaryPlotSeries = useSecondary ? chartData.series.filter((_s, i) => secondaryIdx.has(i)) : [];
5868
- const primaryAxis = chartData.axes?.find(
5869
- (axis) => axis.axisType === "valAx" && axis.axPos !== "r"
5870
- );
5871
- const primaryRange = isStacked ? {
5872
- ...stackedRange(chartData, catCount, isPercent, layout.autoPlotHeight),
5873
- ...primaryAxis?.orientation === "maxMin" ? { reverseOrder: true } : {}
5874
- } : computeValueRangeForChart(
5896
+ const primaryRange = isStacked ? computeStackedValueRangeForAxis(
5897
+ chartData.series,
5898
+ catCount,
5899
+ primaryValueAxis(chartData.axes),
5900
+ isPercent,
5901
+ layout.autoPlotHeight
5902
+ ) : computeValueRangeForChart(
5875
5903
  primaryPlotSeries.length > 0 ? primaryPlotSeries : chartData.series,
5876
5904
  chartData.axes,
5877
5905
  layout.autoPlotHeight
@@ -6432,7 +6460,8 @@ function buildComboViewModel(element, chartData, categoryLabels) {
6432
6460
  layout,
6433
6461
  "right",
6434
6462
  chartData.dateCategories?.values
6435
- )
6463
+ ),
6464
+ axisShowsMajorGridlines(secondaryAxisFormatting)
6436
6465
  ) : void 0;
6437
6466
  const zeroLine = primaryRange.logScale ? void 0 : buildZeroLine(primaryRange, layout);
6438
6467
  const horizontalAxis = buildCartesianHorizontalAxis(
@@ -10264,7 +10293,7 @@ function buildChartViewModelInner(element) {
10264
10293
  if (element.type !== "chart") {
10265
10294
  return buildFallbackViewModel(element.width, element.height, "Chart");
10266
10295
  }
10267
- const chartEl = element, chartData = chartEl.chartData ? withChartTextDefaults(withAutoTitle(chartEl.chartData)) : chartEl.chartData;
10296
+ const chartEl = element, chartData = chartEl.chartData ? withResolvedPalette(withChartTextDefaults(withAutoTitle(chartEl.chartData))) : chartEl.chartData;
10268
10297
  if (!chartData || chartData.series.length === 0) {
10269
10298
  return buildFallbackViewModel(element.width, element.height, chartData?.title ?? "Chart");
10270
10299
  }
@@ -10850,6 +10879,7 @@ exports.applyDataPointPictureFills = applyDataPointPictureFills;
10850
10879
  exports.applyLabelManualLayout = applyLabelManualLayout;
10851
10880
  exports.applyLegendEntryOverrides = applyLegendEntryOverrides;
10852
10881
  exports.applyParetoConversion = applyParetoConversion;
10882
+ exports.axisShowsMajorGridlines = axisShowsMajorGridlines;
10853
10883
  exports.axisTickValues = axisTickValues;
10854
10884
  exports.buildBoxWhiskerViewModel = buildBoxWhiskerViewModel;
10855
10885
  exports.buildCartesianViewModel = buildCartesianViewModel;
@@ -10904,6 +10934,7 @@ exports.chartTitleBandFor = chartTitleBandFor;
10904
10934
  exports.chartTitleFontPx = chartTitleFontPx;
10905
10935
  exports.chartTitleReservePx = chartTitleReservePx;
10906
10936
  exports.clampCropValue = clampCropValue;
10937
+ exports.clipStackedSegment = clipStackedSegment;
10907
10938
  exports.collapseChartTitleRunsForEdit = collapseChartTitleRunsForEdit;
10908
10939
  exports.computeAxisTitlePrimitives = computeAxisTitlePrimitives;
10909
10940
  exports.computeBarRects = computeBarRects;
@@ -10929,6 +10960,7 @@ exports.computeScatterDots = computeScatterDots;
10929
10960
  exports.computeScatterXDomain = computeScatterXDomain;
10930
10961
  exports.computeStackedBarRects = computeStackedBarRects;
10931
10962
  exports.computeStackedValueRange = computeStackedValueRange;
10963
+ exports.computeStackedValueRangeForAxis = computeStackedValueRangeForAxis;
10932
10964
  exports.computeSunburstArcs = computeSunburstArcs;
10933
10965
  exports.computeTrendlinePrimitives = computeTrendlinePrimitives;
10934
10966
  exports.computeValueRange = computeValueRange;
@@ -11002,6 +11034,7 @@ exports.paletteColor = paletteColor;
11002
11034
  exports.paletteColor2 = paletteColor2;
11003
11035
  exports.parseDrawingPercent = parseDrawingPercent;
11004
11036
  exports.plotAreaFill = plotAreaFill;
11037
+ exports.primaryValueAxis = primaryValueAxis;
11005
11038
  exports.reserveLegendSpace = reserveLegendSpace;
11006
11039
  exports.resetBarFacePicturePixelCacheForTests = resetBarFacePicturePixelCacheForTests;
11007
11040
  exports.resolveActiveDataPointPicture = resolveActiveDataPointPicture;
@@ -11011,6 +11044,7 @@ exports.resolveBarLabelAnchor = resolveBarLabelAnchor;
11011
11044
  exports.resolveBarLabelPlacement = resolveBarLabelPlacement;
11012
11045
  exports.resolveCategoryLabels = resolveCategoryLabels;
11013
11046
  exports.resolveChartKind = resolveChartKind;
11047
+ exports.resolveChartPalette = resolveChartPalette;
11014
11048
  exports.resolveChartStyleDefaults = resolveChartStyleDefaults;
11015
11049
  exports.resolveChartTitleRunSpans = resolveChartTitleRunSpans;
11016
11050
  exports.resolveChartTitleTextStyle = resolveChartTitleTextStyle;
@@ -11038,15 +11072,17 @@ exports.seriesColor = seriesColor;
11038
11072
  exports.seriesColor2 = seriesColor2;
11039
11073
  exports.seriesXValues = seriesXValues;
11040
11074
  exports.setChartTextMeasurer = setChartTextMeasurer;
11041
- exports.shade = shade2;
11075
+ exports.shade = shade;
11042
11076
  exports.shouldRenderMajorGridlines = shouldRenderMajorGridlines;
11043
11077
  exports.shouldRenderRegionLabel = shouldRenderRegionLabel;
11044
11078
  exports.splitLabelLines = splitLabelLines;
11045
11079
  exports.splitSeriesByAxis = splitSeriesByAxis;
11080
+ exports.stackedBarWidth = stackedBarWidth;
11081
+ exports.stackedSegmentExtent = stackedSegmentExtent;
11046
11082
  exports.subscribeBarFacePicturePixelSamples = subscribeBarFacePicturePixelSamples;
11047
11083
  exports.suppressesCssFill = suppressesCssFill;
11048
11084
  exports.surfaceColor = surfaceColor;
11049
- exports.tint = tint2;
11085
+ exports.tint = tint;
11050
11086
  exports.titleBaselineFor = titleBaselineFor;
11051
11087
  exports.toCssGradientStop = toCssGradientStop;
11052
11088
  exports.unitsCaptionOffset = unitsCaptionOffset;