@office-kit/pptx-preview 0.9.7 → 0.9.9

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/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as MONO, c as TIMES, d as substituteFamily, l as defaultMeasurer, n as renderSlideSvg, o as SANS, r as ARIAL, s as SERIF, t as auditTextLayout } from "./src-BCN48I0D.js";
1
+ import { a as MONO, c as TIMES, d as substituteFamily, l as defaultMeasurer, n as renderSlideSvg, o as SANS, r as ARIAL, s as SERIF, t as auditTextLayout } from "./src-DRrBZ3XZ.js";
2
2
  export { ARIAL, MONO, SANS, SERIF, TIMES, auditTextLayout, defaultMeasurer, renderSlideSvg as renderSlideToSvg, substituteFamily };
package/dist/node.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as MONO, c as TIMES, d as substituteFamily, i as AVG_GLYPH_W_RATIO, l as defaultMeasurer, n as renderSlideSvg, o as SANS, r as ARIAL, s as SERIF, t as auditTextLayout, u as isCjk } from "./src-BCN48I0D.js";
1
+ import { a as MONO, c as TIMES, d as substituteFamily, i as AVG_GLYPH_W_RATIO, l as defaultMeasurer, n as renderSlideSvg, o as SANS, r as ARIAL, s as SERIF, t as auditTextLayout, u as isCjk } from "./src-DRrBZ3XZ.js";
2
2
  import { getSlideSize } from "@office-kit/pptx";
3
3
  import { Resvg } from "@resvg/resvg-js";
4
4
  import * as fontkit from "fontkit";
@@ -2298,7 +2298,7 @@ const buildBullet = (a, para, pi) => {
2298
2298
  const char = para.bulletIsPicture ? "■" : numberLabel ?? explicitChar ?? bulletChar(para.level);
2299
2299
  const baseSizePx = (para.runs.find((r) => r.text !== "\n" && r.text !== "")?.sizePt ?? a.defaultPt) * PX_PER_PT * a.autoFitScale;
2300
2300
  const sizePx = para.bulletDetail.sizePct !== null ? baseSizePx * para.bulletDetail.sizePct : para.bulletDetail.sizePts !== null ? para.bulletDetail.sizePts * PX_PER_PT * a.autoFitScale : baseSizePx;
2301
- const fillHex = para.bulletDetail.color ? resolveColor(para.bulletDetail.color, a.theme, "#000000") : a.defaultColor;
2301
+ const fillHex = bulletFillOf(para, a.theme, a.defaultColor);
2302
2302
  return {
2303
2303
  text: char,
2304
2304
  family: (a.resolveFamily ?? substituteFamily)(para.bulletDetail.font ?? DEFAULT_BULLET_FONT),
@@ -2307,6 +2307,11 @@ const buildBullet = (a, para, pi) => {
2307
2307
  ...para.bulletImageHref ? { imageHref: para.bulletImageHref } : {}
2308
2308
  };
2309
2309
  };
2310
+ const bulletFillOf = (para, theme, defaultColor) => {
2311
+ if (para.bulletDetail.color) return resolveColor(para.bulletDetail.color, theme, "#000000");
2312
+ const runColor = para.runs.find((r) => r.text !== "\n" && r.text !== "")?.fmt?.color;
2313
+ return runColor === void 0 || runColor === null ? defaultColor : resolveColor(runColor, theme, defaultColor);
2314
+ };
2310
2315
  const presetTextRect = (preset) => {
2311
2316
  switch (preset) {
2312
2317
  case "triangle": return {
@@ -2618,6 +2623,7 @@ const renderTextBody = (pres, shape, bounds, theme, phType, ctx) => {
2618
2623
  const model = resolveTextBodyModel(pres, shape, bounds, theme, phType, ctx.measure, activeDeckTextColor);
2619
2624
  if (model === null) return "";
2620
2625
  const { paraData, numberLabels, authoredAutofit, autoFitScale, defaultPt, themeFace, effectiveDefaultFont, effectiveBody, anchor, innerX, innerY, innerW, innerH, svgTextRect } = model;
2626
+ const defaultColor = activeDeckTextColor;
2621
2627
  const paragraphs = [];
2622
2628
  for (let pi = 0; pi < paraData.length; pi++) {
2623
2629
  const para = paraData[pi];
@@ -2673,7 +2679,7 @@ const renderTextBody = (pres, shape, bounds, theme, phType, ctx) => {
2673
2679
  } else if (showBullet) {
2674
2680
  const char = para.bulletIsPicture ? "■" : numberLabel ?? explicitChar ?? bulletChar(para.level);
2675
2681
  const bulletStyles = [`margin-right:${(.4 * defaultPt * PX_PER_PT * autoFitScale).toFixed(2)}px`];
2676
- if (para.bulletDetail.color) bulletStyles.push(`color:${resolveColor(para.bulletDetail.color, theme, "#000000")}`);
2682
+ bulletStyles.push(`color:${bulletFillOf(para, theme, defaultColor)}`);
2677
2683
  if (para.bulletDetail.sizePct !== null) bulletStyles.push(`font-size:${(para.bulletDetail.sizePct * 100).toFixed(1)}%`);
2678
2684
  else if (para.bulletDetail.sizePts !== null) bulletStyles.push(`font-size:${(para.bulletDetail.sizePts * PX_PER_PT * autoFitScale).toFixed(2)}px`);
2679
2685
  else bulletStyles.push(`font-size:${baseBulletPx.toFixed(2)}px`);
@@ -2683,7 +2689,6 @@ const renderTextBody = (pres, shape, bounds, theme, phType, ctx) => {
2683
2689
  paragraphs.push(`<p style="${pStyles.join(";")}">${prefix}${runHtmls.join("") || "&#8203;"}</p>`);
2684
2690
  }
2685
2691
  const justify = ANCHOR_TO_CSS[anchor] ?? "flex-start";
2686
- const defaultColor = activeDeckTextColor;
2687
2692
  if (ctx.mode === "svg") {
2688
2693
  const svgLineScale = 1 - (authoredAutofit?.lnSpcReduction ?? 0);
2689
2694
  const svgVert = verticalLayoutOf(effectiveBody.vert ?? getShapeTextDirection(shape));
@@ -2776,7 +2781,7 @@ const accentSequence = (theme) => {
2776
2781
  return hexes.length > 0 ? hexes : fallbacks;
2777
2782
  };
2778
2783
  const DEFAULT_CHART_TITLE_PT = 13;
2779
- const layoutChart = (xEmu, yEmu, wEmu, hEmu, hasTitle, hasAxes, titleOverlay = false, legendOverlay = false, hasLegend = true, titlePx = DEFAULT_CHART_TITLE_PT * PX_PER_PT) => {
2784
+ const layoutChart = (xEmu, yEmu, wEmu, hEmu, hasTitle, hasAxes, titleOverlay = false, legendOverlay = false, hasLegend = true, titlePx = DEFAULT_CHART_TITLE_PT * PX_PER_PT, plotAreaLayout) => {
2780
2785
  const x = xEmu / EMU_PER_PX;
2781
2786
  const y = yEmu / EMU_PER_PX;
2782
2787
  const w = wEmu / EMU_PER_PX;
@@ -2786,15 +2791,18 @@ const layoutChart = (xEmu, yEmu, wEmu, hEmu, hasTitle, hasAxes, titleOverlay = f
2786
2791
  const padding = 8;
2787
2792
  const yAxisGutter = hasAxes ? 32 : 0;
2788
2793
  const xAxisGutter = hasAxes ? 18 : 0;
2794
+ const inner = plotAreaLayout?.target === "inner" ? plotAreaLayout : void 0;
2795
+ const plotX = inner ? x + Math.max(0, Math.min(1, inner.x)) * w : x + padding + yAxisGutter;
2796
+ const plotY = inner ? y + Math.max(0, Math.min(1, inner.y)) * h : y + titleStrip + padding;
2789
2797
  return {
2790
2798
  x,
2791
2799
  y,
2792
2800
  w,
2793
2801
  h,
2794
- plotX: x + padding + yAxisGutter,
2795
- plotY: y + titleStrip + padding,
2796
- plotW: Math.max(0, w - 2 * padding - yAxisGutter),
2797
- plotH: Math.max(0, h - titleStrip - legendStrip - xAxisGutter - 2 * padding),
2802
+ plotX,
2803
+ plotY,
2804
+ plotW: inner ? Math.max(0, Math.min(x + w, x + (inner.x + inner.w) * w) - plotX) : Math.max(0, w - 2 * padding - yAxisGutter),
2805
+ plotH: inner ? Math.max(0, Math.min(y + h, y + (inner.y + inner.h) * h) - plotY) : Math.max(0, h - titleStrip - legendStrip - xAxisGutter - 2 * padding),
2798
2806
  titleY: y + (titleOverlay ? 14 : padding + titlePx * .7),
2799
2807
  legendY: y + h - (legendOverlay ? 18 : legendStrip / 2)
2800
2808
  };
@@ -2883,6 +2891,7 @@ const DISPLAY_UNIT_LABEL = {
2883
2891
  const DEFAULT_AXIS_COLOR = "#000000";
2884
2892
  const DEFAULT_GRID_COLOR = "#D9D9D9";
2885
2893
  const AXIS_TICK_LEN = 5;
2894
+ const AXIS_MINOR_TICK_LEN = 3;
2886
2895
  const chartFontPx = (sizePt) => (sizePt * PX_PER_PT).toFixed(1);
2887
2896
  const axisTickAttrs = (style) => {
2888
2897
  const sz = style?.sizePt ?? 10;
@@ -2944,7 +2953,7 @@ const renderValueAxis = (f, axis) => {
2944
2953
  out.push(`<text x="${px(lblX)}" y="${px(lblY)}" text-anchor="middle" font-family="sans-serif" font-size="9" fill="#6B7280" font-style="italic" transform="rotate(-90 ${px(lblX)} ${px(lblY)})">${escapeXml(lbl)}</text>`);
2945
2954
  } else out.push(`<text x="${px(f.plotX + f.plotW)}" y="${px(f.plotY + f.plotH + 22)}" text-anchor="end" font-family="sans-serif" font-size="9" fill="#6B7280" font-style="italic">${escapeXml(lbl)}</text>`);
2946
2955
  }
2947
- if (axis.orientation === "vertical") out.push(`<line x1="${px(f.plotX)}" y1="${px(f.plotY)}" x2="${px(f.plotX)}" y2="${px(f.plotY + f.plotH)}" stroke="${axisColor}" stroke-width="1"/>`);
2956
+ if (!axis.lineHidden) if (axis.orientation === "vertical") out.push(`<line x1="${px(f.plotX)}" y1="${px(f.plotY)}" x2="${px(f.plotX)}" y2="${px(f.plotY + f.plotH)}" stroke="${axisColor}" stroke-width="1"/>`);
2948
2957
  else {
2949
2958
  const zeroY = f.plotY + f.plotH - (0 - axis.min) / range * f.plotH;
2950
2959
  const spineY = axis.min <= 0 && axis.max >= 0 ? zeroY : f.plotY + f.plotH;
@@ -2952,7 +2961,7 @@ const renderValueAxis = (f, axis) => {
2952
2961
  }
2953
2962
  return out.join("");
2954
2963
  };
2955
- const renderCategoryAxis = (f, orientation, cats, pointCount, skip = 1, labelStyle, labelRotationDeg, labelAlign, lineColor) => {
2964
+ const renderCategoryAxis = (f, orientation, cats, pointCount, skip = 1, labelStyle, labelRotationDeg, labelAlign, lineColor, lineHidden = false, majorTickMark = "out", minorTickMark = "none") => {
2956
2965
  const labels = [];
2957
2966
  for (let i = 0; i < pointCount; i++) labels.push(cats[i] ?? (i + 1).toString());
2958
2967
  const out = [];
@@ -2981,22 +2990,23 @@ const renderCategoryAxis = (f, orientation, cats, pointCount, skip = 1, labelSty
2981
2990
  }
2982
2991
  }
2983
2992
  const axisColor = lineColor ?? DEFAULT_AXIS_COLOR;
2984
- if (orientation === "horizontal") {
2985
- const baseY = f.plotY + f.plotH;
2986
- out.push(`<line x1="${px(f.plotX)}" y1="${px(baseY)}" x2="${px(f.plotX + f.plotW)}" y2="${px(baseY)}" stroke="${axisColor}" stroke-width="1"/>`);
2987
- const stepB = pointCount > 0 ? f.plotW / pointCount : 0;
2988
- for (let i = 0; i <= pointCount; i++) {
2989
- const bx = f.plotX + i * stepB;
2990
- out.push(`<line x1="${px(bx)}" y1="${px(baseY)}" x2="${px(bx)}" y2="${px(baseY + AXIS_TICK_LEN)}" stroke="${axisColor}" stroke-width="1"/>`);
2993
+ const horizontal = orientation === "horizontal";
2994
+ const edge = horizontal ? f.plotY + f.plotH : f.plotX;
2995
+ const start = horizontal ? f.plotX : f.plotY;
2996
+ const span = horizontal ? f.plotW : f.plotH;
2997
+ if (!lineHidden) out.push(horizontal ? `<line x1="${px(start)}" y1="${px(edge)}" x2="${px(start + span)}" y2="${px(edge)}" stroke="${axisColor}" stroke-width="1"/>` : `<line x1="${px(edge)}" y1="${px(start)}" x2="${px(edge)}" y2="${px(start + span)}" stroke="${axisColor}" stroke-width="1"/>`);
2998
+ const step = pointCount > 0 ? span / pointCount : 0;
2999
+ const ticks = (mark, length, offset) => {
3000
+ if (mark === "none") return;
3001
+ const outward = mark === "in" ? 0 : length;
3002
+ const inward = mark === "out" ? 0 : -length;
3003
+ for (let i = offset; i <= pointCount; i++) {
3004
+ const pos = start + i * step;
3005
+ out.push(horizontal ? `<line x1="${px(pos)}" y1="${px(edge + outward)}" x2="${px(pos)}" y2="${px(edge + inward)}" stroke="${axisColor}" stroke-width="1"/>` : `<line x1="${px(edge - outward)}" y1="${px(pos)}" x2="${px(edge - inward)}" y2="${px(pos)}" stroke="${axisColor}" stroke-width="1"/>`);
2991
3006
  }
2992
- } else {
2993
- out.push(`<line x1="${px(f.plotX)}" y1="${px(f.plotY)}" x2="${px(f.plotX)}" y2="${px(f.plotY + f.plotH)}" stroke="${axisColor}" stroke-width="1"/>`);
2994
- const stepB = pointCount > 0 ? f.plotH / pointCount : 0;
2995
- for (let i = 0; i <= pointCount; i++) {
2996
- const by = f.plotY + i * stepB;
2997
- out.push(`<line x1="${px(f.plotX - AXIS_TICK_LEN)}" y1="${px(by)}" x2="${px(f.plotX)}" y2="${px(by)}" stroke="${axisColor}" stroke-width="1"/>`);
2998
- }
2999
- }
3007
+ };
3008
+ ticks(majorTickMark, AXIS_TICK_LEN, 0);
3009
+ ticks(minorTickMark, AXIS_MINOR_TICK_LEN, .5);
3000
3010
  return out.join("");
3001
3011
  };
3002
3012
  const seriesMinMax = (spec) => {
@@ -3108,6 +3118,7 @@ const pointCount = (spec) => {
3108
3118
  for (const s of spec.series) if (s.values.length > n) n = s.values.length;
3109
3119
  return n;
3110
3120
  };
3121
+ const chartFillOpacityAttr = (opacity = 1) => opacity === 1 ? "" : ` fill-opacity="${opacity.toFixed(3)}"`;
3111
3122
  const renderColumnChart = (f, spec, colors) => {
3112
3123
  const N = pointCount(spec);
3113
3124
  if (N === 0 || spec.series.length === 0) return "";
@@ -3143,7 +3154,7 @@ const renderColumnChart = (f, spec, colors) => {
3143
3154
  const y0 = f.plotY + f.plotH - (Math.max(stackedTop, stackedBase) - min) / range * f.plotH;
3144
3155
  const y1 = f.plotY + f.plotH - (Math.min(stackedTop, stackedBase) - min) / range * f.plotH;
3145
3156
  const h = Math.abs(y1 - y0);
3146
- out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(barW)}" height="${px(h)}" fill="${spec.series[s]?.color ?? colors[s % colors.length]}"/>`);
3157
+ out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(barW)}" height="${px(h)}" fill="${spec.series[s]?.color ?? colors[s % colors.length]}"${chartFillOpacityAttr(spec.series[s]?.fillOpacity)}/>`);
3147
3158
  if (showLabelFor(s) && Math.abs(v) > 0) {
3148
3159
  const labelY = (y0 + y1) / 2 + 3;
3149
3160
  const labelText = isPercent ? `${Math.round(v * 100)}%` : formatDataLabelValue(spec, s, v);
@@ -3164,7 +3175,7 @@ const renderColumnChart = (f, spec, colors) => {
3164
3175
  const h = Math.abs(top - baseY);
3165
3176
  const baseColor = spec.series[s]?.pointColors?.[c] ?? (spec.varyColors && spec.series.length === 1 ? colors[c % colors.length] : spec.series[s]?.color ?? colors[s % colors.length]);
3166
3177
  const fillColor = v < 0 && spec.series[s]?.invertIfNegative ? mixHex(baseColor, "#000000", .55) : baseColor;
3167
- out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(barW)}" height="${px(h)}" fill="${fillColor}"/>`);
3178
+ out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(barW)}" height="${px(h)}" fill="${fillColor}"${chartFillOpacityAttr(spec.series[s]?.fillOpacity)}/>`);
3168
3179
  if (showLabelFor(s)) {
3169
3180
  const pos = spec.series[s]?.dataLabels?.position ?? spec.dataLabels?.position;
3170
3181
  let labelY;
@@ -3183,7 +3194,7 @@ const renderColumnChart = (f, spec, colors) => {
3183
3194
  }
3184
3195
  }
3185
3196
  }
3186
- out.push(`<line x1="${px(f.plotX)}" y1="${px(baseY)}" x2="${px(f.plotX + f.plotW)}" y2="${px(baseY)}" stroke="#9CA3AF" stroke-width="0.5"/>`);
3197
+ if (!(spec.categoryAxisHidden || spec.categoryAxisLineHidden)) out.push(`<line x1="${px(f.plotX)}" y1="${px(baseY)}" x2="${px(f.plotX + f.plotW)}" y2="${px(baseY)}" stroke="#9CA3AF" stroke-width="0.5"/>`);
3187
3198
  for (let s = 0; s < spec.series.length; s++) {
3188
3199
  const series = spec.series[s];
3189
3200
  if (!series?.trendline) continue;
@@ -3386,7 +3397,7 @@ const renderBarChart = (f, spec, colors) => {
3386
3397
  const x0 = f.plotX + (Math.min(base, stackedTop) - min) / range * f.plotW;
3387
3398
  const x1 = f.plotX + (Math.max(base, stackedTop) - min) / range * f.plotW;
3388
3399
  const w = Math.abs(x1 - x0);
3389
- out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(w)}" height="${px(barH)}" fill="${spec.series[s]?.color ?? colors[s % colors.length]}"/>`);
3400
+ out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(w)}" height="${px(barH)}" fill="${spec.series[s]?.color ?? colors[s % colors.length]}"${chartFillOpacityAttr(spec.series[s]?.fillOpacity)}/>`);
3390
3401
  if (showLabelForBar(s) && Math.abs(v) > 0) {
3391
3402
  const labelX = (x0 + x1) / 2;
3392
3403
  const labelText = isPercent ? `${Math.round(v * 100)}%` : formatDataLabelValue(spec, s, v);
@@ -3407,7 +3418,7 @@ const renderBarChart = (f, spec, colors) => {
3407
3418
  const w = Math.abs(tip - baseX);
3408
3419
  const baseColor = spec.series[s]?.pointColors?.[c] ?? (spec.varyColors && spec.series.length === 1 ? colors[c % colors.length] : spec.series[s]?.color ?? colors[s % colors.length]);
3409
3420
  const fillColor = v < 0 && spec.series[s]?.invertIfNegative ? mixHex(baseColor, "#000000", .55) : baseColor;
3410
- out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(w)}" height="${px(barH)}" fill="${fillColor}"/>`);
3421
+ out.push(`<rect x="${px(x0)}" y="${px(y0)}" width="${px(w)}" height="${px(barH)}" fill="${fillColor}"${chartFillOpacityAttr(spec.series[s]?.fillOpacity)}/>`);
3411
3422
  if (showLabelForBar(s)) {
3412
3423
  const pos = spec.series[s]?.dataLabels?.position ?? spec.dataLabels?.position;
3413
3424
  let labelX;
@@ -3433,7 +3444,7 @@ const renderBarChart = (f, spec, colors) => {
3433
3444
  }
3434
3445
  }
3435
3446
  }
3436
- out.push(`<line x1="${px(baseX)}" y1="${px(f.plotY)}" x2="${px(baseX)}" y2="${px(f.plotY + f.plotH)}" stroke="#9CA3AF" stroke-width="0.5"/>`);
3447
+ if (!(spec.categoryAxisHidden || spec.categoryAxisLineHidden)) out.push(`<line x1="${px(baseX)}" y1="${px(f.plotY)}" x2="${px(baseX)}" y2="${px(f.plotY + f.plotH)}" stroke="#9CA3AF" stroke-width="0.5"/>`);
3437
3448
  return out.join("");
3438
3449
  };
3439
3450
  const renderLineChart = (f, spec, colors, fill) => {
@@ -3448,7 +3459,7 @@ const renderLineChart = (f, spec, colors, fill) => {
3448
3459
  const xAt = (c) => fill ? f.plotX + c * band : f.plotX + (c + .5) * band;
3449
3460
  const baseY = f.plotY + f.plotH - (0 - min) / range * f.plotH;
3450
3461
  const out = [];
3451
- out.push(`<line x1="${px(f.plotX)}" y1="${px(baseY)}" x2="${px(f.plotX + f.plotW)}" y2="${px(baseY)}" stroke="#E5E7EB" stroke-width="0.5"/>`);
3462
+ if (!(spec.categoryAxisHidden || spec.categoryAxisLineHidden)) out.push(`<line x1="${px(f.plotX)}" y1="${px(baseY)}" x2="${px(f.plotX + f.plotW)}" y2="${px(baseY)}" stroke="#E5E7EB" stroke-width="0.5"/>`);
3452
3463
  const accumulated = Array.from({ length: N }, () => 0);
3453
3464
  const perSeries = [];
3454
3465
  for (let s = 0; s < spec.series.length; s++) {
@@ -3723,14 +3734,16 @@ const renderScatterAxes = (f, spec, xB, yB) => {
3723
3734
  orientation: "vertical",
3724
3735
  min: yB.min,
3725
3736
  max: yB.max,
3737
+ ...spec.valueAxisLineHidden !== void 0 ? { lineHidden: spec.valueAxisLineHidden } : {},
3726
3738
  ...spec.valueAxis?.numberFormat !== void 0 ? { numberFormat: spec.valueAxis.numberFormat } : {}
3727
3739
  };
3728
3740
  const xAxis = {
3729
3741
  orientation: "horizontal",
3730
3742
  min: xB.min,
3731
- max: xB.max
3743
+ max: xB.max,
3744
+ ...spec.categoryAxisLineHidden !== void 0 ? { lineHidden: spec.categoryAxisLineHidden } : {}
3732
3745
  };
3733
- return renderValueAxis(f, yAxis) + renderValueAxis(f, xAxis);
3746
+ return (spec.valueAxisHidden ? "" : renderValueAxis(f, yAxis)) + (spec.categoryAxisHidden ? "" : renderValueAxis(f, xAxis));
3734
3747
  };
3735
3748
  const renderScatterChart = (f, spec, colors) => {
3736
3749
  const perSeries = spec.series.map((s) => xyPoints(s));
@@ -3905,7 +3918,7 @@ const renderChart = (shape, x, y, w, h, transform, theme) => {
3905
3918
  const isCartesian = spec.kind === "column" || spec.kind === "bar" || spec.kind === "line" || spec.kind === "area";
3906
3919
  const hasAxes = isCartesian || spec.kind === "scatter" || spec.kind === "bubble";
3907
3920
  const hasLegend = spec.legend !== void 0 && spec.legend.position !== null;
3908
- const f = layoutChart(x, y, w, h, !!spec.title, hasAxes, spec.titleOverlay ?? false, spec.legend?.overlay ?? false, hasLegend, (spec.titleStyle?.sizePt ?? DEFAULT_CHART_TITLE_PT) * PX_PER_PT);
3921
+ const f = layoutChart(x, y, w, h, !!spec.title, hasAxes, spec.titleOverlay ?? false, spec.legend?.overlay ?? false, hasLegend, (spec.titleStyle?.sizePt ?? DEFAULT_CHART_TITLE_PT) * PX_PER_PT, spec.plotAreaLayout);
3909
3922
  const allNamesForLegend = spec.kind === "pie" || spec.kind === "doughnut" ? Array.from(spec.categories) : spec.series.map((s) => s.name);
3910
3923
  const allColorsForLegend = spec.kind === "pie" || spec.kind === "doughnut" ? spec.categories.map((_, i) => spec.series[0]?.pointColors?.[i] ?? spec.series[0]?.color ?? colors[i % colors.length] ?? "#888") : spec.series.map((s, i) => s.color ?? colors[i % colors.length] ?? "#888");
3911
3924
  const hiddenSet = new Set(spec.legend?.hiddenIndices ?? []);
@@ -3940,6 +3953,9 @@ const renderChart = (shape, x, y, w, h, transform, theme) => {
3940
3953
  min: primaryScale.min,
3941
3954
  max: primaryScale.max,
3942
3955
  majorUnit: spec.valueAxis?.majorUnit ?? primaryScale.step,
3956
+ ...spec.valueAxisLineHidden !== void 0 ? { lineHidden: spec.valueAxisLineHidden } : {},
3957
+ ...spec.valueAxisLineColor !== void 0 ? { lineColor: spec.valueAxisLineColor } : {},
3958
+ ...spec.valueAxisMajorTickMark !== void 0 ? { majorTickMark: spec.valueAxisMajorTickMark } : {},
3943
3959
  ...spec.valueAxis?.numberFormat !== void 0 ? { numberFormat: spec.valueAxis.numberFormat } : {},
3944
3960
  ...spec.valueAxisMajorGridlines !== void 0 ? { majorGridlines: spec.valueAxisMajorGridlines } : {},
3945
3961
  ...spec.valueAxisLabelStyle !== void 0 ? { labelStyle: spec.valueAxisLabelStyle } : {}
@@ -3953,7 +3969,7 @@ const renderChart = (shape, x, y, w, h, transform, theme) => {
3953
3969
  majorGridlines: false,
3954
3970
  ...spec.valueAxisLabelStyle !== void 0 ? { labelStyle: spec.valueAxisLabelStyle } : {}
3955
3971
  });
3956
- if (N > 0 && !(spec.categoryAxisHidden || spec.categoryAxisTickLabelPos === "none")) axes += renderCategoryAxis(f, "horizontal", spec.categories, N, spec.categoryAxisTickLabelSkip ?? 1, spec.categoryAxisLabelStyle, spec.categoryAxisLabelRotationDeg, spec.categoryAxisLabelAlign, spec.categoryAxisLineColor);
3972
+ if (N > 0 && !(spec.categoryAxisHidden || spec.categoryAxisTickLabelPos === "none")) axes += renderCategoryAxis(f, "horizontal", spec.categories, N, spec.categoryAxisTickLabelSkip ?? 1, spec.categoryAxisLabelStyle, spec.categoryAxisLabelRotationDeg, spec.categoryAxisLabelAlign, spec.categoryAxisLineColor, spec.categoryAxisLineHidden, spec.categoryAxisMajorTickMark, spec.categoryAxisMinorTickMark);
3957
3973
  const groups = /* @__PURE__ */ new Map();
3958
3974
  for (const s of baked) {
3959
3975
  const kind = s.chartKind ?? spec.kind;
@@ -3988,6 +4004,7 @@ const renderChart = (shape, x, y, w, h, transform, theme) => {
3988
4004
  const majorUnit = spec.valueAxis?.majorUnit ?? step;
3989
4005
  const numberFormat = spec.valueAxis?.numberFormat;
3990
4006
  const axisExtras = {
4007
+ ...spec.valueAxisLineHidden !== void 0 ? { lineHidden: spec.valueAxisLineHidden } : {},
3991
4008
  ...majorUnit !== void 0 ? { majorUnit } : {},
3992
4009
  ...numberFormat !== void 0 ? { numberFormat } : {},
3993
4010
  ...spec.valueAxisMajorGridlines !== void 0 ? { majorGridlines: spec.valueAxisMajorGridlines } : {},
@@ -4014,7 +4031,7 @@ const renderChart = (shape, x, y, w, h, transform, theme) => {
4014
4031
  };
4015
4032
  if (!spec.valueAxisHidden) axes = renderValueAxis(f, valueAxis);
4016
4033
  const labelsHidden = spec.categoryAxisHidden || spec.categoryAxisTickLabelPos === "none";
4017
- if (N > 0 && !labelsHidden) axes += renderCategoryAxis(f, spec.kind === "bar" ? "vertical" : "horizontal", spec.categories, N, spec.categoryAxisTickLabelSkip ?? 1, spec.categoryAxisLabelStyle, spec.categoryAxisLabelRotationDeg, spec.categoryAxisLabelAlign, spec.categoryAxisLineColor);
4034
+ if (N > 0 && !labelsHidden) axes += renderCategoryAxis(f, spec.kind === "bar" ? "vertical" : "horizontal", spec.categories, N, spec.categoryAxisTickLabelSkip ?? 1, spec.categoryAxisLabelStyle, spec.categoryAxisLabelRotationDeg, spec.categoryAxisLabelAlign, spec.categoryAxisLineColor, spec.categoryAxisLineHidden, spec.categoryAxisMajorTickMark, spec.categoryAxisMinorTickMark);
4018
4035
  }
4019
4036
  if (!isCombo) switch (spec.kind) {
4020
4037
  case "column":
@@ -4405,12 +4422,21 @@ const renderShape = (shape, pres, theme, ctx) => {
4405
4422
  const transform = transforms.length > 0 ? ` transform="${transforms.join(" ")}"` : "";
4406
4423
  const textRotation = (flip.vertical ? rotation + 180 : rotation) % 360;
4407
4424
  const textTransform = textRotation !== 0 ? ` transform="rotate(${textRotation} ${E(cx)} ${E(cy)})"` : "";
4408
- const textOverlay = kind === "shape" || kind === "graphicFrame" ? renderTextBody(pres, shape, {
4425
+ const { sx: gsx, sy: gsy } = ctx.groupScale;
4426
+ const groupScaled = gsx !== 1 || gsy !== 1;
4427
+ const textBounds = groupScaled ? {
4428
+ x: x * gsx,
4429
+ y: y * gsy,
4430
+ w: w * gsx,
4431
+ h: h * gsy
4432
+ } : {
4409
4433
  x,
4410
4434
  y,
4411
4435
  w,
4412
4436
  h
4413
- }, theme, phType, ctx) : "";
4437
+ };
4438
+ const rawTextOverlay = kind === "shape" || kind === "graphicFrame" ? renderTextBody(pres, shape, textBounds, theme, phType, ctx) : "";
4439
+ const textOverlay = rawTextOverlay !== "" && groupScaled ? `<g transform="scale(${(1 / gsx).toFixed(6)} ${(1 / gsy).toFixed(6)})">${rawTextOverlay}</g>` : rawTextOverlay;
4414
4440
  if (kind === "picture") return renderPicture(shape, pres, x, y, w, h, transform, textOverlay, getShapeImageBytes(shape), getShapeImageFormat(shape));
4415
4441
  if (kind === "shape" && fill.kind === "image") return renderPicture(shape, pres, x, y, w, h, transform, textOverlay, getShapeImageFillBytes(shape), getShapeImageFormat(shape));
4416
4442
  if (kind === "connector") {
@@ -4467,6 +4493,8 @@ const renderShape = (shape, pres, theme, ctx) => {
4467
4493
  const children = getGroupChildren(shape);
4468
4494
  if (children.length === 0) return "";
4469
4495
  const tParts = [];
4496
+ let groupScaleX = 1;
4497
+ let groupScaleY = 1;
4470
4498
  if (xform && rotation !== 0) {
4471
4499
  const cxG = (xform.outer.x + xform.outer.w / 2) / EMU_PER_PX;
4472
4500
  const cyG = (xform.outer.y + xform.outer.h / 2) / EMU_PER_PX;
@@ -4489,13 +4517,23 @@ const renderShape = (shape, pres, theme, ctx) => {
4489
4517
  const iy = xform.inner.y;
4490
4518
  const iw = xform.inner.w || 1;
4491
4519
  const ih = xform.inner.h || 1;
4492
- const sx = (ow / iw).toFixed(6);
4493
- const sy = (oh / ih).toFixed(6);
4520
+ groupScaleX = ow / iw;
4521
+ groupScaleY = oh / ih;
4522
+ const sx = groupScaleX.toFixed(6);
4523
+ const sy = groupScaleY.toFixed(6);
4494
4524
  const tx = ((ox - ix * (ow / iw)) / EMU_PER_PX).toFixed(2);
4495
4525
  const ty = ((oy - iy * (oh / ih)) / EMU_PER_PX).toFixed(2);
4496
4526
  tParts.push(`translate(${tx} ${ty})`, `scale(${sx} ${sy})`);
4497
4527
  }
4498
- return `<g${tParts.length > 0 ? ` transform="${tParts.join(" ")}"` : ""}>${children.map((c) => renderShape(c, pres, theme, ctx)).join("")}</g>`;
4528
+ const groupTransform = tParts.length > 0 ? ` transform="${tParts.join(" ")}"` : "";
4529
+ const childCtx = groupScaleX === 1 && groupScaleY === 1 ? ctx : {
4530
+ ...ctx,
4531
+ groupScale: {
4532
+ sx: ctx.groupScale.sx * groupScaleX,
4533
+ sy: ctx.groupScale.sy * groupScaleY
4534
+ }
4535
+ };
4536
+ return `<g${groupTransform}>${children.map((c) => renderShape(c, pres, theme, childCtx)).join("")}</g>`;
4499
4537
  }
4500
4538
  const p = paint(shape, fill, stroke, theme, phType !== null, pres);
4501
4539
  if (kind === "graphicFrame") {
@@ -4714,6 +4752,10 @@ const renderSlideSvg = (pres, slide, opts = {}) => {
4714
4752
  activeColorMap = getEffectiveColorMap(slide);
4715
4753
  activeDeckTextColor = resolveDeckBodyTextColor(slide) ?? "#000000";
4716
4754
  const ctx = {
4755
+ groupScale: {
4756
+ sx: 1,
4757
+ sy: 1
4758
+ },
4717
4759
  mode: opts.textLayout ?? "foreignObject",
4718
4760
  measure: opts.measureText ?? defaultMeasurer
4719
4761
  };
@@ -4961,4 +5003,4 @@ const auditTextLayout = (pres, options = {}) => {
4961
5003
  //#endregion
4962
5004
  export { MONO as a, TIMES as c, substituteFamily as d, AVG_GLYPH_W_RATIO as i, defaultMeasurer as l, renderSlideSvg as n, SANS as o, ARIAL as r, SERIF as s, auditTextLayout as t, isCjk as u };
4963
5005
 
4964
- //# sourceMappingURL=src-BCN48I0D.js.map
5006
+ //# sourceMappingURL=src-DRrBZ3XZ.js.map