ooxml-ui 1.2.0 → 1.3.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 (109) hide show
  1. package/custom-elements.json +161 -0
  2. package/dist/{chunk-XNCWB2X6.js → chunk-2WLRFPMW.js} +4 -0
  3. package/dist/{chunk-JAJFLFAV.js → chunk-56A2JK63.js} +1 -1
  4. package/dist/{chunk-AYXFLBSV.js → chunk-5OFAJDMQ.js} +6 -6
  5. package/dist/{chunk-7FNDOWTX.js → chunk-723JC3OC.js} +72 -5
  6. package/dist/{chunk-YK2DPYMU.js → chunk-IY7QJLQG.js} +1 -1
  7. package/dist/{chunk-BOX43CZD.js → chunk-M6GF5ED2.js} +2 -1
  8. package/dist/{chunk-Y2E22JVO.js → chunk-NYRRH2MD.js} +1 -1
  9. package/dist/{chunk-VUB44CAJ.js → chunk-TWQ45BFL.js} +1 -1
  10. package/dist/{chunk-YP5S7DTT.js → chunk-V6P6KZCO.js} +6 -5
  11. package/dist/controls.d.ts +4 -2
  12. package/dist/controls.d.ts.map +1 -1
  13. package/dist/controls.js +5 -5
  14. package/dist/docx/editor-chrome.d.ts +8 -1
  15. package/dist/docx/file-commands.d.ts +1 -1
  16. package/dist/docx/locales/en-app.d.ts +1 -0
  17. package/dist/docx/locales/en.d.ts +1 -0
  18. package/dist/docx/localization-strings.d.ts +1 -0
  19. package/dist/docx/ribbon-actions.d.ts +22 -0
  20. package/dist/docx/title-bar.d.ts +3 -5
  21. package/dist/docx.js +66 -46
  22. package/dist/icons.d.ts.map +1 -1
  23. package/dist/icons.js +1 -1
  24. package/dist/index.d.ts +1 -1
  25. package/dist/index.js +9 -9
  26. package/dist/pptx/{chart-3d-view-scene-6B5TOWB6.mjs → chart-3d-view-scene-OYJ4CDCO.mjs} +3 -4
  27. package/dist/pptx/{chart-3d-view-scene-MJ6YNT56.cjs → chart-3d-view-scene-SE2Y6QRE.cjs} +38 -39
  28. package/dist/pptx/{chunk-AWKKC3VW.mjs → chunk-CIVA3MLN.mjs} +1 -1
  29. package/dist/pptx/{chunk-ZK344LOB.cjs → chunk-FPE5PZMI.cjs} +303 -155
  30. package/dist/pptx/{chunk-YRHK45AB.cjs → chunk-IURZJAWP.cjs} +233 -127
  31. package/dist/pptx/{chunk-XIQMFSNG.cjs → chunk-KRMMJUCO.cjs} +83 -1
  32. package/dist/pptx/{chunk-YI5LH5NN.mjs → chunk-MWHGUEIJ.mjs} +162 -16
  33. package/dist/pptx/{chunk-XQVKQD5Z.mjs → chunk-STLXPKJJ.mjs} +230 -128
  34. package/dist/pptx/{chunk-YMTQLZ2I.mjs → chunk-TC7HCF5M.mjs} +76 -2
  35. package/dist/pptx/{chunk-STKGUT5S.cjs → chunk-WKLHJEPD.cjs} +13 -13
  36. package/dist/pptx/dom/element-styles.d.ts.map +1 -1
  37. package/dist/pptx/dom/elements/connector.d.ts.map +1 -1
  38. package/dist/pptx/dom/elements/shape-filter-defs.d.ts.map +1 -1
  39. package/dist/pptx/dom/elements/table.d.ts.map +1 -1
  40. package/dist/pptx/dom/index.cjs +254 -254
  41. package/dist/pptx/dom/index.mjs +26 -26
  42. package/dist/pptx/dom/slide-stage.d.ts.map +1 -1
  43. package/dist/pptx/export/html2canvas-clone.cjs +2 -2
  44. package/dist/pptx/export/html2canvas-clone.mjs +1 -1
  45. package/dist/pptx/index.cjs +3041 -3001
  46. package/dist/pptx/index.mjs +4 -4
  47. package/dist/pptx/render/chart-3d-oblique-layout.d.ts.map +1 -1
  48. package/dist/pptx/render/chart-3d-persp-bars.d.ts.map +1 -1
  49. package/dist/pptx/render/chart-3d-persp-layout.d.ts.map +1 -1
  50. package/dist/pptx/render/chart-bar-cluster-geometry.d.ts +1 -1
  51. package/dist/pptx/render/chart-bar-cluster-geometry.d.ts.map +1 -1
  52. package/dist/pptx/render/chart-cartesian-area.d.ts.map +1 -1
  53. package/dist/pptx/render/chart-cartesian-bars.d.ts.map +1 -1
  54. package/dist/pptx/render/chart-cartesian-line-area.d.ts.map +1 -1
  55. package/dist/pptx/render/chart-cartesian-stacked-labels.d.ts +11 -7
  56. package/dist/pptx/render/chart-cartesian-stacked-labels.d.ts.map +1 -1
  57. package/dist/pptx/render/chart-combo-stock.cjs +3 -3
  58. package/dist/pptx/render/chart-combo-stock.mjs +1 -1
  59. package/dist/pptx/render/chart-data-label-anchor.d.ts +4 -1
  60. package/dist/pptx/render/chart-data-label-anchor.d.ts.map +1 -1
  61. package/dist/pptx/render/chart-horizontal-bars.d.ts.map +1 -1
  62. package/dist/pptx/render/chart-line-path.d.ts +9 -0
  63. package/dist/pptx/render/chart-line-path.d.ts.map +1 -1
  64. package/dist/pptx/render/chart-overlays.cjs +7 -7
  65. package/dist/pptx/render/chart-overlays.mjs +1 -1
  66. package/dist/pptx/render/chart-plot-clip.d.ts +37 -0
  67. package/dist/pptx/render/chart-plot-clip.d.ts.map +1 -0
  68. package/dist/pptx/render/chart-surface-treemap.cjs +4 -4
  69. package/dist/pptx/render/chart-surface-treemap.mjs +1 -1
  70. package/dist/pptx/render/chart-view-model-bars.d.ts +3 -2
  71. package/dist/pptx/render/chart-view-model-bars.d.ts.map +1 -1
  72. package/dist/pptx/render/chart-view-model.cjs +44 -44
  73. package/dist/pptx/render/chart-view-model.mjs +1 -1
  74. package/dist/pptx/render/chart-waterfall-map.cjs +6 -6
  75. package/dist/pptx/render/chart-waterfall-map.mjs +1 -1
  76. package/dist/pptx/render/device-pixel-stroke.d.ts +101 -0
  77. package/dist/pptx/render/device-pixel-stroke.d.ts.map +1 -0
  78. package/dist/pptx/render/export-clone.d.ts +4 -0
  79. package/dist/pptx/render/export-clone.d.ts.map +1 -1
  80. package/dist/pptx/render/foreign-object-svg-document.d.ts.map +1 -1
  81. package/dist/pptx/render/index.d.ts +2 -0
  82. package/dist/pptx/render/index.d.ts.map +1 -1
  83. package/dist/pptx/render/stroke-outline.d.ts +6 -0
  84. package/dist/pptx/render/stroke-outline.d.ts.map +1 -1
  85. package/dist/pptx/render/stroke-style.d.ts +8 -2
  86. package/dist/pptx/render/stroke-style.d.ts.map +1 -1
  87. package/dist/pptx/render/tab-row-actions.d.ts +40 -0
  88. package/dist/pptx/render/tab-row-actions.d.ts.map +1 -0
  89. package/dist/pptx/render/table-style-borders.d.ts.map +1 -1
  90. package/dist/pptx/render/table-style.d.ts.map +1 -1
  91. package/dist/pptx/web-components/index.d.ts.map +1 -1
  92. package/dist/pptx/web-components/office-token-bridge.d.ts +1 -1
  93. package/dist/pptx/web-components/office-token-bridge.d.ts.map +1 -1
  94. package/dist/pptx/web-components/ribbon-actions.d.ts +8 -0
  95. package/dist/pptx/web-components/ribbon-actions.d.ts.map +1 -0
  96. package/dist/presence.js +3 -3
  97. package/dist/ribbon/ribbon-actions.d.ts +119 -0
  98. package/dist/ribbon/ribbon-actions.d.ts.map +1 -0
  99. package/dist/smartart.js +3 -3
  100. package/dist/teams.js +7 -7
  101. package/dist/theme.js +2 -2
  102. package/dist/tokens.d.ts +4 -0
  103. package/dist/tokens.d.ts.map +1 -1
  104. package/dist/visio.js +6 -6
  105. package/dist/xlsx/calc-preparation.d.ts +44 -0
  106. package/dist/xlsx/editor-core.d.ts +3 -0
  107. package/dist/xlsx/ribbon-actions.d.ts +5 -4
  108. package/dist/xlsx.js +131 -44
  109. package/package.json +2 -2
@@ -2064,7 +2064,7 @@ function buildLegend(series, colorPalette, svgWidth, legendPos, svgHeight, plotT
2064
2064
 
2065
2065
  // src/pptx/render/chart-view-model-bars.ts
2066
2066
  function computeBarRects(series, catCount, layout, range, colorPalette) {
2067
- const rects = [], seriesCount = Math.max(series.length, 1), barGroupWidth = layout.plotWidth / Math.max(catCount, 1), singleBarWidth = barGroupWidth * 0.7 / seriesCount, groupOffset = (barGroupWidth - singleBarWidth * seriesCount) / 2;
2067
+ const rects = [], seriesCount = Math.max(series.length, 1), barGroupWidth = layout.plotWidth / Math.max(catCount, 1), { singleBarWidth, clusterWidth } = chart.clusteredBarGeometry(barGroupWidth, seriesCount, {}), groupOffset = (barGroupWidth - clusterWidth) / 2;
2068
2068
  for (let ci = 0; ci < catCount; ci++) {
2069
2069
  for (let si = 0; si < series.length; si++) {
2070
2070
  const val = series[si].values[ci] ?? 0, x = layout.plotLeft + barGroupWidth * ci + groupOffset + singleBarWidth * si, zeroY = valueToY2(0, range, layout.plotTop, layout.plotBottom), valY = valueToY2(val, range, layout.plotTop, layout.plotBottom), y = Math.min(zeroY, valY), h = Math.max(Math.abs(zeroY - valY), 1);
@@ -2079,8 +2079,8 @@ function computeBarRects(series, catCount, layout, range, colorPalette) {
2079
2079
  }
2080
2080
  return rects;
2081
2081
  }
2082
- function stackedBarWidth(slotWidth, gapWidth, fallbackFraction) {
2083
- return gapWidth === void 0 ? slotWidth * fallbackFraction : chart.clusteredBarGeometry(slotWidth, 1, { barGapWidth: gapWidth }).singleBarWidth;
2082
+ function stackedBarWidth(slotWidth, gapWidth) {
2083
+ return chart.clusteredBarGeometry(slotWidth, 1, gapWidth === void 0 ? {} : { barGapWidth: gapWidth }).singleBarWidth;
2084
2084
  }
2085
2085
  function clipStackedSegment(base, value, range) {
2086
2086
  const low = Math.max(Math.min(base, base + value), range.min), high = Math.min(Math.max(base, base + value), range.max);
@@ -2091,7 +2091,7 @@ function stackedSegmentExtent(baseCoord, tipCoord, minSize) {
2091
2091
  return { start: tipCoord < baseCoord ? baseCoord - size : baseCoord, size };
2092
2092
  }
2093
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;
2094
+ const rects = [], slot = layout.plotWidth / Math.max(catCount, 1), barW = stackedBarWidth(slot, gapWidth), barOffset = (slot - barW) / 2;
2095
2095
  for (let ci = 0; ci < catCount; ci++) {
2096
2096
  let posTotal = 0, negTotal = 0;
2097
2097
  for (let si = 0; si < series.length; si++) {
@@ -3172,8 +3172,8 @@ function resolveMarkerLabelAnchor(position, point, offset = 7) {
3172
3172
  return { x: point.x, y: point.y - offset, textAnchor: "middle" };
3173
3173
  }
3174
3174
  }
3175
- function resolveBarLabelPlacement(chartData, series, pointIndex, rect, value, orientation, frame) {
3176
- const point = findPointLabel(series, pointIndex), position = point?.position ?? series.dataLabelOptions?.position ?? chartData.style?.dataLabels?.position, anchor = resolveBarLabelAnchor(position, rect, value, orientation), shifted = applyLabelManualLayout(point?.layout, frame, anchor);
3175
+ function resolveBarLabelPlacement(chartData, series, pointIndex, rect, value, orientation, frame, defaultPosition) {
3176
+ const point = findPointLabel(series, pointIndex), position = point?.position ?? series.dataLabelOptions?.position ?? chartData.style?.dataLabels?.position ?? defaultPosition, anchor = resolveBarLabelAnchor(position, rect, value, orientation), shifted = applyLabelManualLayout(point?.layout, frame, anchor);
3177
3177
  return { ...anchor, x: shifted.x, y: shifted.y };
3178
3178
  }
3179
3179
  function resolveMarkerLabelPlacement(chartData, series, pointIndex, point, frame, offset = 7, defaultPosition) {
@@ -3499,18 +3499,46 @@ function smoothLinePath(points) {
3499
3499
  }
3500
3500
  let d = `M${points[0].x.toFixed(2)},${points[0].y.toFixed(2)}`;
3501
3501
  for (let i = 0; i < points.length - 1; i++) {
3502
- const p0 = points[i - 1] ?? points[i];
3503
- const p1 = points[i];
3504
- const p2 = points[i + 1];
3505
- const p3 = points[i + 2] ?? p2;
3506
- const cp1x = p1.x + (p2.x - p0.x) / 6;
3507
- const cp1y = p1.y + (p2.y - p0.y) / 6;
3508
- const cp2x = p2.x - (p3.x - p1.x) / 6;
3509
- const cp2y = p2.y - (p3.y - p1.y) / 6;
3510
- d += ` C${cp1x.toFixed(2)},${cp1y.toFixed(2)} ${cp2x.toFixed(2)},${cp2y.toFixed(2)} ${p2.x.toFixed(2)},${p2.y.toFixed(2)}`;
3502
+ const [cp1, cp2, end] = smoothSegment(points, i);
3503
+ d += ` C${cp1.x.toFixed(2)},${cp1.y.toFixed(2)} ${cp2.x.toFixed(2)},${cp2.y.toFixed(2)} ${end.x.toFixed(2)},${end.y.toFixed(2)}`;
3511
3504
  }
3512
3505
  return d;
3513
3506
  }
3507
+ function smoothSegment(points, i) {
3508
+ const p0 = points[i - 1] ?? points[i];
3509
+ const p1 = points[i];
3510
+ const p2 = points[i + 1];
3511
+ const p3 = points[i + 2] ?? p2;
3512
+ return [
3513
+ { x: p1.x + (p2.x - p0.x) / 6, y: p1.y + (p2.y - p0.y) / 6 },
3514
+ { x: p2.x - (p3.x - p1.x) / 6, y: p2.y - (p3.y - p1.y) / 6 },
3515
+ p2
3516
+ ];
3517
+ }
3518
+ function sampleSmoothLine(points, stepsPerSegment = 16) {
3519
+ if (points.length < 3) {
3520
+ return [...points];
3521
+ }
3522
+ const out = [points[0]];
3523
+ for (let i = 0; i < points.length - 1; i++) {
3524
+ const start = points[i], [cp1, cp2, end] = smoothSegment(points, i);
3525
+ for (let step = 1; step <= stepsPerSegment; step++) {
3526
+ const t = step / stepsPerSegment, u = 1 - t, a = u * u * u, b = 3 * u * u * t, c = 3 * u * t * t, d = t * t * t;
3527
+ out.push(
3528
+ step === stepsPerSegment ? end : {
3529
+ x: a * start.x + b * cp1.x + c * cp2.x + d * end.x,
3530
+ y: a * start.y + b * cp1.y + c * cp2.y + d * end.y
3531
+ }
3532
+ );
3533
+ }
3534
+ }
3535
+ return out;
3536
+ }
3537
+ function polylineRunsPath(runs) {
3538
+ return runs.map(
3539
+ (run) => run.map((p, i) => `${i === 0 ? "M" : "L"}${p.x.toFixed(2)},${p.y.toFixed(2)}`).join(" ")
3540
+ ).join(" ");
3541
+ }
3514
3542
 
3515
3543
  // src/pptx/render/chart-axis-style.ts
3516
3544
  var DEFAULT_COLOR = "#64748b";
@@ -3989,9 +4017,113 @@ function buildScatter(chartData, layout, range) {
3989
4017
  return { primitives: [...primitives, ...labelBoxes], dataLabels };
3990
4018
  }
3991
4019
 
4020
+ // src/pptx/render/chart-plot-clip.ts
4021
+ var EPSILON = 1e-6;
4022
+ function plotBand(layout) {
4023
+ return {
4024
+ top: Math.min(layout.plotTop, layout.plotBottom),
4025
+ bottom: Math.max(layout.plotTop, layout.plotBottom)
4026
+ };
4027
+ }
4028
+ function insideBand(point, band) {
4029
+ return point.y >= band.top - EPSILON && point.y <= band.bottom + EPSILON;
4030
+ }
4031
+ function clipSegment(a, b, band) {
4032
+ const dy = b.y - a.y;
4033
+ if (Math.abs(dy) < EPSILON) {
4034
+ return insideBand(a, band) ? [a, b] : void 0;
4035
+ }
4036
+ const tTop = (band.top - a.y) / dy, tBottom = (band.bottom - a.y) / dy, low = Math.max(0, Math.min(tTop, tBottom)), high = Math.min(1, Math.max(tTop, tBottom));
4037
+ if (high - low < EPSILON) {
4038
+ return void 0;
4039
+ }
4040
+ const at = (t) => t <= 0 ? a : t >= 1 ? b : { x: a.x + (b.x - a.x) * t, y: a.y + dy * t };
4041
+ return [insideBand(a, band) ? a : at(low), insideBand(b, band) ? b : at(high)];
4042
+ }
4043
+ function clipPolylineToBand(points, band) {
4044
+ if (points.every((point) => insideBand(point, band))) {
4045
+ return points.length >= 2 ? [[...points]] : [];
4046
+ }
4047
+ const runs = [];
4048
+ let run = [];
4049
+ const flush = () => {
4050
+ if (run.length >= 2) {
4051
+ runs.push(run);
4052
+ }
4053
+ run = [];
4054
+ };
4055
+ for (let i = 0; i + 1 < points.length; i++) {
4056
+ const clipped = clipSegment(points[i], points[i + 1], band);
4057
+ if (!clipped) {
4058
+ flush();
4059
+ continue;
4060
+ }
4061
+ const [start, end] = clipped;
4062
+ if (run[run.length - 1] !== start) {
4063
+ flush();
4064
+ run.push(start);
4065
+ }
4066
+ run.push(end);
4067
+ if (end !== points[i + 1]) {
4068
+ flush();
4069
+ }
4070
+ }
4071
+ flush();
4072
+ return runs;
4073
+ }
4074
+ function crossAt(a, b, y) {
4075
+ const t = (y - a.y) / (b.y - a.y);
4076
+ return { x: a.x + (b.x - a.x) * t, y };
4077
+ }
4078
+ function clipPolygonEdge(polygon, keep, y) {
4079
+ const out = [];
4080
+ for (let i = 0; i < polygon.length; i++) {
4081
+ const current = polygon[i], previous = polygon[(i + polygon.length - 1) % polygon.length];
4082
+ if (keep(current)) {
4083
+ if (!keep(previous)) {
4084
+ out.push(crossAt(previous, current, y));
4085
+ }
4086
+ out.push(current);
4087
+ } else if (keep(previous)) {
4088
+ out.push(crossAt(previous, current, y));
4089
+ }
4090
+ }
4091
+ return out;
4092
+ }
4093
+ function clipPolygonToBand(polygon, band) {
4094
+ if (polygon.every((point) => insideBand(point, band))) {
4095
+ return [...polygon];
4096
+ }
4097
+ const top = clipPolygonEdge(polygon, (point) => point.y >= band.top - EPSILON, band.top);
4098
+ return clipPolygonEdge(top, (point) => point.y <= band.bottom + EPSILON, band.bottom);
4099
+ }
4100
+ function visibleSpanCentre(y1, y2, band) {
4101
+ const low = Math.max(Math.min(y1, y2), band.top), high = Math.min(Math.max(y1, y2), band.bottom);
4102
+ if (high < low - EPSILON) {
4103
+ return void 0;
4104
+ }
4105
+ return (low + high) / 2;
4106
+ }
4107
+ function clippedSeriesLine(points, smooth, style, band) {
4108
+ if (points.every((point) => insideBand(point, band))) {
4109
+ return [
4110
+ smooth ? { kind: "path", d: smoothLinePath(points), ...style } : { kind: "polyline", points: linePointsToSvgString(points), ...style }
4111
+ ];
4112
+ }
4113
+ if (smooth) {
4114
+ const runs = clipPolylineToBand(sampleSmoothLine(points), band);
4115
+ return runs.length > 0 ? [{ kind: "path", d: polylineRunsPath(runs), ...style }] : [];
4116
+ }
4117
+ return clipPolylineToBand(points, band).map((run) => ({
4118
+ kind: "polyline",
4119
+ points: linePointsToSvgString(run),
4120
+ ...style
4121
+ }));
4122
+ }
4123
+
3992
4124
  // src/pptx/render/chart-cartesian-area.ts
3993
4125
  function buildAreas(chartData, catCount, layout, range, sourceIndices2, xPositions, stacking = "clustered") {
3994
- const primitives = [], dataLabels = [], labelBoxes = [], showLabels = chartData.style?.hasDataLabels, isStackedMode = stacking !== "clustered", isPercent = stacking === "percentStacked", baselineY = valueToY2(0, range, layout.plotTop, layout.plotBottom), allDisplayValues = chartData.series.map(
4126
+ const primitives = [], dataLabels = [], labelBoxes = [], showLabels = chartData.style?.hasDataLabels, isStackedMode = stacking !== "clustered", isPercent = stacking === "percentStacked", baselineY = valueToY2(0, range, layout.plotTop, layout.plotBottom), band = plotBand(layout), allDisplayValues = chartData.series.map(
3995
4127
  (series) => series.values.length === 0 ? void 0 : sourceIndices2.map((sourceIndex) => series.values[sourceIndex] ?? 0)
3996
4128
  ), stackedPlots = isStackedMode ? chart.computeStackedSeriesPlots(
3997
4129
  allDisplayValues.map((values) => values ?? []),
@@ -4006,44 +4138,33 @@ function buildAreas(chartData, catCount, layout, range, sourceIndices2, xPositio
4006
4138
  const plot = stackedPlots?.[si], topValues = plot ? plot.cumulative : displayValues, pts = computeLinePoints(topValues, catCount, layout, range).map((point, index) => ({
4007
4139
  ...point,
4008
4140
  x: xPositions?.[index] ?? point.x
4009
- })), c = seriesColor2(series, si, chartData.colorPalette), lineStr = linePointsToSvgString(pts), firstPt = pts[0], lastPt = pts[pts.length - 1];
4010
- if (plot) {
4011
- const baseStr = linePointsToSvgString(
4012
- [
4013
- ...computeLinePoints(plot.base, catCount, layout, range).map((point, index) => ({
4014
- ...point,
4015
- x: xPositions?.[index] ?? point.x
4016
- }))
4017
- ].reverse()
4018
- );
4019
- primitives.push({
4020
- kind: "polyline",
4021
- points: `${lineStr} ${baseStr}`,
4022
- stroke: "none",
4023
- strokeWidth: 0,
4024
- fill: c,
4025
- part: { role: "series", seriesIndex: si }
4026
- });
4027
- } else if (firstPt && lastPt) {
4141
+ })), c = seriesColor2(series, si, chartData.colorPalette), firstPt = pts[0], lastPt = pts[pts.length - 1], fillPolygon = plot ? [
4142
+ ...pts,
4143
+ ...computeLinePoints(plot.base, catCount, layout, range).map((point, index) => ({ ...point, x: xPositions?.[index] ?? point.x })).reverse()
4144
+ ] : firstPt && lastPt ? [{ x: firstPt.x, y: baselineY }, ...pts, { x: lastPt.x, y: baselineY }] : [], clippedFill = clipPolygonToBand(fillPolygon, band);
4145
+ if (clippedFill.length > 0) {
4028
4146
  primitives.push({
4029
4147
  kind: "polyline",
4030
- points: `${firstPt.x.toFixed(2)},${baselineY.toFixed(2)} ${lineStr} ${lastPt.x.toFixed(2)},${baselineY.toFixed(2)}`,
4148
+ points: linePointsToSvgString(clippedFill),
4031
4149
  stroke: "none",
4032
4150
  strokeWidth: 0,
4033
4151
  fill: c,
4034
- opacity: 0.25,
4152
+ ...plot ? {} : { opacity: 0.25 },
4035
4153
  part: { role: "series", seriesIndex: si }
4036
4154
  });
4037
4155
  }
4038
- primitives.push({
4039
- kind: "polyline",
4040
- points: lineStr,
4041
- stroke: c,
4042
- strokeWidth: 2,
4043
- fill: "none",
4044
- part: { role: "series", seriesIndex: si }
4045
- });
4156
+ primitives.push(
4157
+ ...clippedSeriesLine(
4158
+ pts,
4159
+ false,
4160
+ { stroke: c, strokeWidth: 2, fill: "none", part: { role: "series", seriesIndex: si } },
4161
+ band
4162
+ )
4163
+ );
4046
4164
  pts.forEach((pt, displayIndex) => {
4165
+ if (!insideBand(pt, band)) {
4166
+ return;
4167
+ }
4047
4168
  const idx = sourceIndices2[displayIndex] ?? displayIndex, part = { role: "dataPoint", seriesIndex: si, pointIndex: idx };
4048
4169
  pushMarker(
4049
4170
  primitives,
@@ -4074,11 +4195,18 @@ function buildAreas(chartData, catCount, layout, range, sourceIndices2, xPositio
4074
4195
  if (val === 0) {
4075
4196
  return;
4076
4197
  }
4077
- const baseVal = plot?.base[displayIndex] ?? 0, topVal = plot?.cumulative[displayIndex] ?? val, baseY = valueToY2(baseVal, range, layout.plotTop, layout.plotBottom), topY = valueToY2(topVal, range, layout.plotTop, layout.plotBottom);
4198
+ const baseVal = plot?.base[displayIndex] ?? 0, topVal = plot?.cumulative[displayIndex] ?? val, centreY = visibleSpanCentre(
4199
+ valueToY2(baseVal, range, layout.plotTop, layout.plotBottom),
4200
+ valueToY2(topVal, range, layout.plotTop, layout.plotBottom),
4201
+ band
4202
+ );
4203
+ if (centreY === void 0) {
4204
+ return;
4205
+ }
4078
4206
  dataLabels.push({
4079
4207
  kind: "text",
4080
4208
  x: pt.x,
4081
- y: (baseY + topY) / 2,
4209
+ y: centreY,
4082
4210
  text: `${Math.round(val)}%`,
4083
4211
  fontSize: DEFAULT_CHART_DATA_LABEL_PX,
4084
4212
  fill: "#ffffff",
@@ -4099,7 +4227,11 @@ function buildAreas(chartData, catCount, layout, range, sourceIndices2, xPositio
4099
4227
  if (label === void 0) {
4100
4228
  return;
4101
4229
  }
4102
- const bandBase = plot ? valueToY2(plot.base[displayIndex] ?? 0, range, layout.plotTop, layout.plotBottom) : baselineY, mid = { x: pt.x, y: (pt.y + bandBase) / 2 }, anchor = resolveMarkerLabelPlacement(
4230
+ const bandBase = plot ? valueToY2(plot.base[displayIndex] ?? 0, range, layout.plotTop, layout.plotBottom) : baselineY, midY = visibleSpanCentre(pt.y, bandBase, band);
4231
+ if (midY === void 0) {
4232
+ return;
4233
+ }
4234
+ const mid = { x: pt.x, y: midY }, anchor = resolveMarkerLabelPlacement(
4103
4235
  chartData,
4104
4236
  series,
4105
4237
  pointIndex,
@@ -4457,7 +4589,7 @@ function categoryTotals(series, catCount) {
4457
4589
  );
4458
4590
  }
4459
4591
  function buildPercentStackedBars(chartData, catCount, layout, primaryRange, sourceIndices2, invertNegativeFill2) {
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) => ({
4592
+ 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), barOffset = (barGroupWidth - barW) / 2, displaySeries = series.map((entry) => ({
4461
4593
  ...entry,
4462
4594
  values: sourceIndices2.map((sourceIndex) => entry.values[sourceIndex] ?? 0)
4463
4595
  })), totals = categoryTotals(displaySeries, catCount);
@@ -4510,41 +4642,37 @@ function buildPercentStackedBars(chartData, catCount, layout, primaryRange, sour
4510
4642
  }
4511
4643
 
4512
4644
  // src/pptx/render/chart-cartesian-stacked-labels.ts
4513
- function pushClusteredStackedLabels(chartData, series, sourceIndices2, catCount, layout, range, dataLabels) {
4514
- const barGroupWidth = layout.plotWidth / catCount, seriesCount = Math.max(series.length, 1), singleBarWidth = barGroupWidth * 0.7 / seriesCount, groupOffset = (barGroupWidth - singleBarWidth * seriesCount) / 2;
4515
- for (let ci = 0; ci < catCount; ci++) {
4516
- const sourceIndex = sourceIndices2[ci] ?? ci;
4517
- for (let si = 0; si < series.length; si++) {
4518
- const val = series[si].values[sourceIndex] ?? 0, barX = layout.plotLeft + barGroupWidth * ci + groupOffset + singleBarWidth * si, zeroY = valueToY2(0, range, layout.plotTop, layout.plotBottom), valY = valueToY2(val, range, layout.plotTop, layout.plotBottom), barY = Math.min(zeroY, valY), barH = Math.max(Math.abs(zeroY - valY), 1), label = buildDataLabelText({
4519
- chartData,
4520
- series: series[si],
4521
- pointIndex: sourceIndex,
4522
- value: val
4523
- });
4524
- if (label === void 0) {
4525
- continue;
4526
- }
4527
- const anchor = resolveBarLabelPlacement(
4528
- chartData,
4529
- series[si],
4530
- sourceIndex,
4531
- { x: barX, y: barY, width: singleBarWidth, height: barH },
4532
- val,
4533
- "vertical",
4534
- { width: layout.svgWidth, height: layout.svgHeight }
4535
- );
4536
- dataLabels.push({
4537
- kind: "text",
4538
- x: anchor.x,
4539
- y: anchor.y,
4540
- text: label.text,
4541
- fontSize: DEFAULT_CHART_DATA_LABEL_PX,
4542
- fill: label.color ?? "#334155",
4543
- textAnchor: anchor.textAnchor,
4544
- ...anchor.dominantBaseline ? { dominantBaseline: anchor.dominantBaseline } : {},
4545
- ...dataLabelFontOverride(resolveDataLabelTextStyle(chartData, series[si], sourceIndex))
4546
- });
4645
+ function pushStackedBarLabels(chartData, series, sourceIndices2, rects, layout, dataLabels) {
4646
+ for (const rect of rects) {
4647
+ const entry = rect.seriesIndex === void 0 ? void 0 : series[rect.seriesIndex];
4648
+ if (!entry || rect.pointIndex === void 0) {
4649
+ continue;
4650
+ }
4651
+ const sourceIndex = sourceIndices2[rect.pointIndex] ?? rect.pointIndex, val = entry.values[sourceIndex] ?? 0, label = buildDataLabelText({ chartData, series: entry, pointIndex: sourceIndex, value: val });
4652
+ if (label === void 0) {
4653
+ continue;
4547
4654
  }
4655
+ const anchor = resolveBarLabelPlacement(
4656
+ chartData,
4657
+ entry,
4658
+ sourceIndex,
4659
+ { x: rect.x, y: rect.y, width: rect.w, height: rect.h },
4660
+ val,
4661
+ "vertical",
4662
+ { width: layout.svgWidth, height: layout.svgHeight },
4663
+ "ctr"
4664
+ );
4665
+ dataLabels.push({
4666
+ kind: "text",
4667
+ x: anchor.x,
4668
+ y: anchor.y,
4669
+ text: label.text,
4670
+ fontSize: DEFAULT_CHART_DATA_LABEL_PX,
4671
+ fill: label.color ?? "#334155",
4672
+ textAnchor: anchor.textAnchor,
4673
+ ...anchor.dominantBaseline ? { dominantBaseline: anchor.dominantBaseline } : {},
4674
+ ...dataLabelFontOverride(resolveDataLabelTextStyle(chartData, entry, sourceIndex))
4675
+ });
4548
4676
  }
4549
4677
  }
4550
4678
 
@@ -4675,15 +4803,7 @@ function buildBars(chartData, catCount, layout, primaryRange, secondaryRange, se
4675
4803
  primitives.push({ kind: "rect", x: r.x, y: r.y, w: r.w, h: r.h, fill, rx: 1, part, title });
4676
4804
  }
4677
4805
  if (showLabels) {
4678
- pushClusteredStackedLabels(
4679
- chartData,
4680
- series,
4681
- sourceIndices2,
4682
- catCount,
4683
- layout,
4684
- primaryRange,
4685
- dataLabels
4686
- );
4806
+ pushStackedBarLabels(chartData, series, sourceIndices2, rects, layout, dataLabels);
4687
4807
  }
4688
4808
  return { primitives, dataLabels };
4689
4809
  }
@@ -4773,7 +4893,7 @@ function seriesLineStroke(chartData, series) {
4773
4893
 
4774
4894
  // src/pptx/render/chart-cartesian-line-area.ts
4775
4895
  function buildLines(chartData, catCount, layout, primaryRange, secondaryRange, secondaryIdx, sourceIndices2, xPositions, stacking = "clustered") {
4776
- const primitives = [], dataLabels = [], labelBoxes = [], showLabels = chartData.style?.hasDataLabels, isStackedMode = stacking !== "clustered", isPercent = stacking === "percentStacked", resolved = chartData.series.map((series) => {
4896
+ const primitives = [], dataLabels = [], labelBoxes = [], showLabels = chartData.style?.hasDataLabels, isStackedMode = stacking !== "clustered", isPercent = stacking === "percentStacked", band = plotBand(layout), resolved = chartData.series.map((series) => {
4777
4897
  if (series.values.length === 0) {
4778
4898
  return void 0;
4779
4899
  }
@@ -4797,41 +4917,21 @@ function buildLines(chartData, catCount, layout, primaryRange, secondaryRange, s
4797
4917
  ...point,
4798
4918
  x: xPositions?.[index] ?? point.x
4799
4919
  })), c = seriesColor2(series, si, chartData.colorPalette), seriesPart = { role: "series", seriesIndex: si }, allVisible = visible.every(Boolean);
4800
- if (allVisible) {
4920
+ for (const run of allVisible ? [pts] : chart.visibleRuns(visible).map((r) => r.map((i) => pts[i]))) {
4921
+ if (!allVisible && run.length < 2) {
4922
+ continue;
4923
+ }
4801
4924
  primitives.push(
4802
- series.smooth ? {
4803
- kind: "path",
4804
- d: smoothLinePath(pts),
4805
- stroke: c,
4806
- ...lineStroke,
4807
- fill: "none",
4808
- part: seriesPart
4809
- } : {
4810
- kind: "polyline",
4811
- points: linePointsToSvgString(pts),
4812
- stroke: c,
4813
- ...lineStroke,
4814
- fill: "none",
4815
- part: seriesPart
4816
- }
4925
+ ...clippedSeriesLine(
4926
+ run,
4927
+ allVisible && Boolean(series.smooth),
4928
+ { stroke: c, ...lineStroke, fill: "none", part: seriesPart },
4929
+ band
4930
+ )
4817
4931
  );
4818
- } else {
4819
- for (const run of chart.visibleRuns(visible)) {
4820
- if (run.length < 2) {
4821
- continue;
4822
- }
4823
- primitives.push({
4824
- kind: "polyline",
4825
- points: linePointsToSvgString(run.map((i) => pts[i])),
4826
- stroke: c,
4827
- ...lineStroke,
4828
- fill: "none",
4829
- part: seriesPart
4830
- });
4831
- }
4832
4932
  }
4833
4933
  pts.forEach((pt, displayIndex) => {
4834
- if (!visible[displayIndex]) {
4934
+ if (!visible[displayIndex] || !insideBand(pt, band)) {
4835
4935
  return;
4836
4936
  }
4837
4937
  const idx = sourceIndices2[displayIndex] ?? displayIndex, part = { role: "dataPoint", seriesIndex: si, pointIndex: idx };
@@ -4857,7 +4957,7 @@ function buildLines(chartData, catCount, layout, primaryRange, secondaryRange, s
4857
4957
  const labelValues = stackedPlots ? stackedPlots[si].own : displayValues;
4858
4958
  labelValues.forEach((val, displayIndex) => {
4859
4959
  const pt = pts[displayIndex];
4860
- if (!pt || !visible[displayIndex]) {
4960
+ if (!pt || !visible[displayIndex] || !insideBand(pt, band)) {
4861
4961
  return;
4862
4962
  }
4863
4963
  if (isPercent) {
@@ -5770,7 +5870,7 @@ function buildHorizontalBarViewModel(element, chartData, categoryLabels) {
5770
5870
  }
5771
5871
  }
5772
5872
  } else {
5773
- const totals = isPercent ? categoryTotals2(series, catCount) : [], barH = stackedBarWidth(band, chartData.barGapWidth, isPercent ? 0.6 : 0.7), barOffset = (band - barH) / 2;
5873
+ const totals = isPercent ? categoryTotals2(series, catCount) : [], barH = stackedBarWidth(band, chartData.barGapWidth), barOffset = (band - barH) / 2;
5774
5874
  for (let ci = 0; ci < catCount; ci++) {
5775
5875
  let posRunning = 0, negRunning = 0;
5776
5876
  const catTotal = isPercent ? totals[ci] || 1 : 1;
@@ -5832,7 +5932,9 @@ function buildHorizontalBarViewModel(element, chartData, categoryLabels) {
5832
5932
  { x, y, width: w, height: barH },
5833
5933
  rawVal,
5834
5934
  "horizontal",
5835
- { width: layout.svgWidth, height: layout.svgHeight }
5935
+ { width: layout.svgWidth, height: layout.svgHeight },
5936
+ // A stacked segment's label is centred unless c:dLblPos says otherwise.
5937
+ "ctr"
5836
5938
  );
5837
5939
  dataLabels.push({
5838
5940
  kind: "text",
@@ -10792,6 +10894,10 @@ Object.defineProperty(exports, "buildRectPathGradientSvg", {
10792
10894
  enumerable: true,
10793
10895
  get: function () { return diagram.buildRectPathGradientSvg; }
10794
10896
  });
10897
+ Object.defineProperty(exports, "DEFAULT_BAR_GAP_WIDTH", {
10898
+ enumerable: true,
10899
+ get: function () { return chart.DEFAULT_BAR_GAP_WIDTH; }
10900
+ });
10795
10901
  Object.defineProperty(exports, "axisTargetIntervals", {
10796
10902
  enumerable: true,
10797
10903
  get: function () { return chart.axisTargetIntervals; }
@@ -3,11 +3,85 @@
3
3
  var chunkG4WRLFMJ_cjs = require('./chunk-G4WRLFMJ.cjs');
4
4
  var chunkHJ3JZXOL_cjs = require('./chunk-HJ3JZXOL.cjs');
5
5
 
6
+ // src/pptx/render/device-pixel-stroke.ts
7
+ var DEVICE_PX_VAR = "--pptx-device-px";
8
+ var DEVICE_PIXEL_RATIO_VAR = "--pptx-dpr";
9
+ function cssPx(width) {
10
+ const rounded = Number(width.toFixed(4));
11
+ return `${rounded > 0 ? rounded : 1e-4}px`;
12
+ }
13
+ function screenStrokeWidth(width) {
14
+ if (typeof width !== "number" || !Number.isFinite(width) || width <= 0) {
15
+ return "0px";
16
+ }
17
+ return `max(${cssPx(width)}, var(${DEVICE_PX_VAR}, 0px))`;
18
+ }
19
+ function screenBorder(width, style, color) {
20
+ return `${screenStrokeWidth(width)} ${style ?? "solid"} ${color}`;
21
+ }
22
+ var watchedWindows = /* @__PURE__ */ new WeakSet();
23
+ function watchDevicePixelRatio(win = typeof window === "undefined" ? void 0 : window) {
24
+ if (!win || watchedWindows.has(win)) {
25
+ return;
26
+ }
27
+ const style = win.document?.documentElement?.style;
28
+ if (!style) {
29
+ return;
30
+ }
31
+ watchedWindows.add(win);
32
+ const publish = () => {
33
+ const ratio = win.devicePixelRatio;
34
+ const safe = typeof ratio === "number" && Number.isFinite(ratio) && ratio > 0 ? ratio : 1;
35
+ style.setProperty(DEVICE_PIXEL_RATIO_VAR, String(safe));
36
+ win.matchMedia?.(`(resolution: ${safe}dppx)`).addEventListener?.("change", publish, {
37
+ once: true
38
+ });
39
+ };
40
+ publish();
41
+ }
42
+ function deviceStrokeStageStyle(scale) {
43
+ if (!Number.isFinite(scale) || scale <= 0) {
44
+ return {};
45
+ }
46
+ watchDevicePixelRatio();
47
+ return {
48
+ [DEVICE_PX_VAR]: `calc(1px / (${Number(scale.toFixed(6))} * var(${DEVICE_PIXEL_RATIO_VAR}, 1)))`
49
+ };
50
+ }
51
+ var CARRIER_SELECTOR = `[style*="${DEVICE_PX_VAR}:"]`;
52
+ function carriers(root) {
53
+ const nested = [...root.querySelectorAll(CARRIER_SELECTOR)];
54
+ return root.closest(CARRIER_SELECTOR) ? [root, ...nested.filter((el) => el !== root)] : nested;
55
+ }
56
+ function neutralizeDeviceStrokes(root) {
57
+ for (const el of carriers(root)) {
58
+ el.style?.setProperty(DEVICE_PX_VAR, "0px");
59
+ }
60
+ }
61
+ function withAuthoredStrokeWidths(root, read) {
62
+ const saved = carriers(root).map((el) => ({ el, style: el.getAttribute("style") }));
63
+ for (const { el } of saved) {
64
+ el.style?.setProperty(DEVICE_PX_VAR, "0px");
65
+ }
66
+ try {
67
+ return read();
68
+ } finally {
69
+ for (const { el, style } of saved) {
70
+ if (style === null) {
71
+ el.removeAttribute("style");
72
+ } else {
73
+ el.setAttribute("style", style);
74
+ }
75
+ }
76
+ }
77
+ }
78
+
6
79
  // src/pptx/render/export-clone.ts
7
80
  function isExportIgnoredElement(element) {
8
81
  return element.getAttribute("data-export-ignore") === "true";
9
82
  }
10
83
  function prepareExportClone(root) {
84
+ neutralizeDeviceStrokes(root);
11
85
  for (const overlay of root.querySelectorAll('[data-export-ignore="true"]')) {
12
86
  overlay.remove();
13
87
  }
@@ -32,7 +106,7 @@ async function loadChart3DThree() {
32
106
 
33
107
  // src/pptx/three-view/scene-registry.ts
34
108
  var loaders = {
35
- chart: async () => (await import('./chart-3d-view-scene-MJ6YNT56.cjs')).mountChart3DView,
109
+ chart: async () => (await import('./chart-3d-view-scene-SE2Y6QRE.cjs')).mountChart3DView,
36
110
  smartart: async () => (await import('./view-scene-4ZFUCP6S.cjs')).mountSmartArt3DView
37
111
  };
38
112
  async function loadThreeViewScene(kind) {
@@ -879,6 +953,8 @@ async function prepareHtml2CanvasClone(original, doc, clonedEl) {
879
953
  preprocessCssForCapture(clonedEl);
880
954
  }
881
955
 
956
+ exports.DEVICE_PIXEL_RATIO_VAR = DEVICE_PIXEL_RATIO_VAR;
957
+ exports.DEVICE_PX_VAR = DEVICE_PX_VAR;
882
958
  exports.MAX_DEVICE_PIXEL_RATIO = MAX_DEVICE_PIXEL_RATIO;
883
959
  exports.THREE_VIEW_MARKER_ATTR = THREE_VIEW_MARKER_ATTR;
884
960
  exports.THREE_VIEW_SETTLE_TIMEOUT_MS = THREE_VIEW_SETTLE_TIMEOUT_MS;
@@ -886,17 +962,23 @@ exports.THREE_VIEW_SNAPSHOT_ATTR = THREE_VIEW_SNAPSHOT_ATTR;
886
962
  exports.THREE_VIEW_TAG = THREE_VIEW_TAG;
887
963
  exports.computeThreeViewSize = computeThreeViewSize;
888
964
  exports.defineThreeViewElement = defineThreeViewElement;
965
+ exports.deviceStrokeStageStyle = deviceStrokeStageStyle;
889
966
  exports.flatten3dTransform = flatten3dTransform;
890
967
  exports.flatten3dTransforms = flatten3dTransforms;
891
968
  exports.flattenBackdropFilter = flattenBackdropFilter;
892
969
  exports.flattenMixBlendMode = flattenMixBlendMode;
893
970
  exports.has3dTransform = has3dTransform;
894
971
  exports.isExportIgnoredElement = isExportIgnoredElement;
972
+ exports.neutralizeDeviceStrokes = neutralizeDeviceStrokes;
895
973
  exports.parseBlurValue = parseBlurValue;
896
974
  exports.prepareExportClone = prepareExportClone;
897
975
  exports.prepareHtml2CanvasClone = prepareHtml2CanvasClone;
898
976
  exports.preprocessCssForCapture = preprocessCssForCapture;
899
977
  exports.removeUnsupportedFeatures = removeUnsupportedFeatures;
900
978
  exports.resolveCustomProperties = resolveCustomProperties;
979
+ exports.screenBorder = screenBorder;
980
+ exports.screenStrokeWidth = screenStrokeWidth;
901
981
  exports.settleThreeViews = settleThreeViews;
902
982
  exports.snapshotThreeViewsIntoClone = snapshotThreeViewsIntoClone;
983
+ exports.watchDevicePixelRatio = watchDevicePixelRatio;
984
+ exports.withAuthoredStrokeWidths = withAuthoredStrokeWidths;