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