ooxml-ui 1.43.0 → 1.45.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/README.md +4 -0
- package/dist/{chunk-NH5ZSZMI.js → chunk-2YRHRV4H.js} +1 -1
- package/dist/{chunk-JWBWLGEY.js → chunk-LPI7LT4B.js} +2 -2
- package/dist/{chunk-2ZYRZANE.js → chunk-MWDG776V.js} +1 -1
- package/dist/{chunk-I57TCM2Q.js → chunk-UEFVC6V4.js} +1 -1
- package/dist/{chunk-M4ARYL3L.js → chunk-ZTLP52FH.js} +1 -1
- package/dist/controls.js +1 -1
- package/dist/docx.js +4 -4
- package/dist/index.js +4 -4
- package/dist/pptx/{chart-3d-view-scene-CGLU6ISD.mjs → chart-3d-view-scene-7LIMCTEM.mjs} +3 -2
- package/dist/pptx/{chart-3d-view-scene-C7QUQTXD.cjs → chart-3d-view-scene-RCWYLVC3.cjs} +38 -37
- package/dist/pptx/{chunk-W2QJX2ON.mjs → chunk-2P6TH4ZE.mjs} +3 -0
- package/dist/pptx/{chunk-DH6EKOVI.mjs → chunk-3DJZBAQ2.mjs} +1 -1
- package/dist/pptx/{chunk-5BINBXFV.mjs → chunk-6JTQ7AG6.mjs} +3 -3
- package/dist/pptx/{chunk-P4NVINSK.cjs → chunk-CWBVJ4DC.cjs} +9257 -8918
- package/dist/pptx/chunk-FI2ATACZ.cjs +147 -0
- package/dist/pptx/chunk-G5NEBI7N.mjs +135 -0
- package/dist/pptx/{chunk-CK6RYGB4.cjs → chunk-GYI2TFSW.cjs} +3 -126
- package/dist/pptx/{chunk-7FTP7OOA.mjs → chunk-HGT3CA36.mjs} +6221 -5845
- package/dist/pptx/{chunk-YZWKNFPU.cjs → chunk-HTFYAGHG.cjs} +2864 -167
- package/dist/pptx/{chunk-JP26TA3Q.cjs → chunk-LOUVYGWX.cjs} +12 -12
- package/dist/pptx/{chunk-UGSMMZU6.cjs → chunk-MZCAYJ7H.cjs} +49 -49
- package/dist/pptx/{chunk-BA4CJI4U.mjs → chunk-S6P7UWGZ.mjs} +3 -115
- package/dist/pptx/{chunk-ZHVKGGLQ.cjs → chunk-UFJBHFSD.cjs} +3 -0
- package/dist/pptx/{chunk-TW5UQCZS.mjs → chunk-XL5AF4U3.mjs} +2750 -175
- package/dist/pptx/dom/elements/connector.d.ts.map +1 -1
- package/dist/pptx/dom/elements/equation.d.ts.map +1 -1
- package/dist/pptx/dom/elements/media.d.ts.map +1 -1
- package/dist/pptx/dom/elements/ole.d.ts.map +1 -1
- package/dist/pptx/dom/elements/reflection-mirror-content.d.ts.map +1 -1
- package/dist/pptx/dom/elements/shape-filter-defs.d.ts +5 -0
- 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/elements/text-shape.d.ts.map +1 -1
- package/dist/pptx/dom/elements/text-warp.d.ts.map +1 -1
- package/dist/pptx/dom/index.cjs +546 -459
- package/dist/pptx/dom/index.mjs +136 -50
- package/dist/pptx/export/html2canvas-clone.cjs +7 -6
- package/dist/pptx/export/html2canvas-clone.mjs +2 -1
- package/dist/pptx/i18n/index.cjs +6 -6
- package/dist/pptx/i18n/index.mjs +1 -1
- package/dist/pptx/i18n/translations-en.d.ts.map +1 -1
- package/dist/pptx/index.cjs +3917 -3664
- package/dist/pptx/index.mjs +6 -5
- package/dist/pptx/render/chart-combo-stock.cjs +4 -3
- package/dist/pptx/render/chart-combo-stock.mjs +2 -1
- package/dist/pptx/render/chart-overlays.cjs +8 -7
- package/dist/pptx/render/chart-overlays.mjs +2 -1
- package/dist/pptx/render/chart-surface-treemap.cjs +5 -4
- package/dist/pptx/render/chart-surface-treemap.mjs +2 -1
- package/dist/pptx/render/chart-view-model.cjs +45 -44
- package/dist/pptx/render/chart-view-model.mjs +2 -1
- package/dist/pptx/render/chart-waterfall-map.cjs +7 -6
- package/dist/pptx/render/chart-waterfall-map.mjs +2 -1
- package/dist/pptx/render/connector-dash.d.ts +17 -1
- package/dist/pptx/render/connector-dash.d.ts.map +1 -1
- package/dist/pptx/render/connector-path.d.ts +2 -2
- package/dist/pptx/render/connector-path.d.ts.map +1 -1
- package/dist/pptx/render/connector-style.d.ts +4 -2
- package/dist/pptx/render/connector-style.d.ts.map +1 -1
- package/dist/pptx/render/customization/customization-controller.d.ts +8 -0
- package/dist/pptx/render/customization/customization-controller.d.ts.map +1 -1
- package/dist/pptx/render/dash-path-start.d.ts +38 -0
- package/dist/pptx/render/dash-path-start.d.ts.map +1 -0
- package/dist/pptx/render/dash-pattern.d.ts +10 -0
- package/dist/pptx/render/dash-pattern.d.ts.map +1 -0
- package/dist/pptx/render/dash-square-cap.d.ts +34 -0
- package/dist/pptx/render/dash-square-cap.d.ts.map +1 -0
- package/dist/pptx/render/deck-webfont-outlines.d.ts +25 -0
- package/dist/pptx/render/deck-webfont-outlines.d.ts.map +1 -0
- package/dist/pptx/render/deck-webfont-readiness.d.ts +59 -0
- package/dist/pptx/render/deck-webfont-readiness.d.ts.map +1 -0
- package/dist/pptx/render/device-pixel-exact.d.ts +34 -0
- package/dist/pptx/render/device-pixel-exact.d.ts.map +1 -0
- package/dist/pptx/render/device-pixel-group.d.ts +42 -0
- package/dist/pptx/render/device-pixel-group.d.ts.map +1 -0
- package/dist/pptx/render/device-pixel-stroke.d.ts +21 -3
- package/dist/pptx/render/device-pixel-stroke.d.ts.map +1 -1
- package/dist/pptx/render/element-style-transform.d.ts +6 -5
- package/dist/pptx/render/element-style-transform.d.ts.map +1 -1
- package/dist/pptx/render/embedded-fonts-sheet.d.ts +6 -0
- package/dist/pptx/render/embedded-fonts-sheet.d.ts.map +1 -1
- package/dist/pptx/render/equation-box-style.d.ts +23 -0
- package/dist/pptx/render/equation-box-style.d.ts.map +1 -0
- package/dist/pptx/render/fill-style.d.ts +22 -1
- package/dist/pptx/render/fill-style.d.ts.map +1 -1
- package/dist/pptx/render/font-line-gap.d.ts +0 -18
- package/dist/pptx/render/font-line-gap.d.ts.map +1 -1
- package/dist/pptx/render/google-webfonts.d.ts +11 -1
- package/dist/pptx/render/google-webfonts.d.ts.map +1 -1
- package/dist/pptx/render/gradient-svg-image.d.ts +29 -0
- package/dist/pptx/render/gradient-svg-image.d.ts.map +1 -0
- package/dist/pptx/render/group-fill.d.ts.map +1 -1
- package/dist/pptx/render/hollow-shape-hit-test.d.ts +23 -1
- package/dist/pptx/render/hollow-shape-hit-test.d.ts.map +1 -1
- package/dist/pptx/render/index.d.ts +15 -0
- package/dist/pptx/render/index.d.ts.map +1 -1
- package/dist/pptx/render/linked-text-box-overflow.d.ts +20 -5
- package/dist/pptx/render/linked-text-box-overflow.d.ts.map +1 -1
- package/dist/pptx/render/media-control-bar.d.ts +41 -0
- package/dist/pptx/render/media-control-bar.d.ts.map +1 -0
- package/dist/pptx/render/media-playback.d.ts +6 -6
- package/dist/pptx/render/media-playback.d.ts.map +1 -1
- package/dist/pptx/render/morph-animation.d.ts.map +1 -1
- package/dist/pptx/render/morph-carry.d.ts.map +1 -1
- package/dist/pptx/render/morph-connector-carry.d.ts +43 -0
- package/dist/pptx/render/morph-connector-carry.d.ts.map +1 -0
- package/dist/pptx/render/morph-effect-carry.d.ts +2 -0
- package/dist/pptx/render/morph-effect-carry.d.ts.map +1 -1
- package/dist/pptx/render/morph-effect-silhouette.d.ts +23 -0
- package/dist/pptx/render/morph-effect-silhouette.d.ts.map +1 -0
- package/dist/pptx/render/morph-geometry-key.d.ts.map +1 -1
- package/dist/pptx/render/morph-line-carry.d.ts +27 -0
- package/dist/pptx/render/morph-line-carry.d.ts.map +1 -1
- package/dist/pptx/render/morph-line-ends.d.ts +27 -0
- package/dist/pptx/render/morph-line-ends.d.ts.map +1 -0
- package/dist/pptx/render/morph-line-reach.d.ts +72 -0
- package/dist/pptx/render/morph-line-reach.d.ts.map +1 -0
- package/dist/pptx/render/morph-overlay-order.d.ts.map +1 -1
- package/dist/pptx/render/morph-plan-css.d.ts +0 -7
- package/dist/pptx/render/morph-plan-css.d.ts.map +1 -1
- package/dist/pptx/render/morph-predicates.d.ts.map +1 -1
- package/dist/pptx/render/morph-shape-carry.d.ts.map +1 -1
- package/dist/pptx/render/options/font-download-policy.d.ts +52 -0
- package/dist/pptx/render/options/font-download-policy.d.ts.map +1 -0
- package/dist/pptx/render/options/index.d.ts +1 -0
- package/dist/pptx/render/options/index.d.ts.map +1 -1
- package/dist/pptx/render/options/viewer-options-tabs-advanced.d.ts.map +1 -1
- package/dist/pptx/render/options/viewer-options.d.ts +2 -0
- package/dist/pptx/render/options/viewer-options.d.ts.map +1 -1
- package/dist/pptx/render/paragraph-baseline.d.ts +46 -2
- package/dist/pptx/render/paragraph-baseline.d.ts.map +1 -1
- package/dist/pptx/render/paragraph-run-build.d.ts.map +1 -1
- package/dist/pptx/render/paragraph-trailing-break.d.ts +15 -0
- package/dist/pptx/render/paragraph-trailing-break.d.ts.map +1 -0
- package/dist/pptx/render/path-gradient-rect.d.ts +1 -1
- package/dist/pptx/render/path-gradient-rect.d.ts.map +1 -1
- package/dist/pptx/render/shape-geometry-base.d.ts +73 -0
- package/dist/pptx/render/shape-geometry-base.d.ts.map +1 -0
- package/dist/pptx/render/shape-geometry-cascade.d.ts +7 -37
- package/dist/pptx/render/shape-geometry-cascade.d.ts.map +1 -1
- package/dist/pptx/render/shape-path-gradient-fill.d.ts +20 -0
- package/dist/pptx/render/shape-path-gradient-fill.d.ts.map +1 -0
- package/dist/pptx/render/silhouette-effects.d.ts +118 -0
- package/dist/pptx/render/silhouette-effects.d.ts.map +1 -0
- package/dist/pptx/render/silhouette-fill-layer.d.ts +19 -0
- package/dist/pptx/render/silhouette-fill-layer.d.ts.map +1 -0
- package/dist/pptx/render/silhouette-morph-refresh.d.ts +6 -0
- package/dist/pptx/render/silhouette-morph-refresh.d.ts.map +1 -0
- package/dist/pptx/render/silhouette-morph-registry.d.ts +36 -0
- package/dist/pptx/render/silhouette-morph-registry.d.ts.map +1 -0
- package/dist/pptx/render/stroke-only-preset.d.ts +22 -0
- package/dist/pptx/render/stroke-only-preset.d.ts.map +1 -1
- package/dist/pptx/render/stroke-outline.d.ts.map +1 -1
- package/dist/pptx/render/subpath-fill-overlay.d.ts +11 -5
- package/dist/pptx/render/subpath-fill-overlay.d.ts.map +1 -1
- package/dist/pptx/render/subpath-geometry.d.ts +38 -0
- package/dist/pptx/render/subpath-geometry.d.ts.map +1 -0
- package/dist/pptx/render/svg-attr-escape.d.ts +30 -0
- package/dist/pptx/render/svg-attr-escape.d.ts.map +1 -0
- package/dist/pptx/render/svg-gradient-paint.d.ts +6 -1
- package/dist/pptx/render/svg-gradient-paint.d.ts.map +1 -1
- package/dist/pptx/render/svg-id-scope.d.ts +8 -0
- package/dist/pptx/render/svg-id-scope.d.ts.map +1 -0
- package/dist/pptx/render/table-cell-baseline.d.ts +37 -0
- package/dist/pptx/render/table-cell-baseline.d.ts.map +1 -0
- package/dist/pptx/render/table-cell-border-inset.d.ts +21 -0
- package/dist/pptx/render/table-cell-border-inset.d.ts.map +1 -0
- package/dist/pptx/render/table-cell-css.d.ts.map +1 -1
- package/dist/pptx/render/table-cell-paragraphs.d.ts +13 -1
- package/dist/pptx/render/table-cell-paragraphs.d.ts.map +1 -1
- package/dist/pptx/render/table-style-bg-settle.d.ts +43 -0
- package/dist/pptx/render/table-style-bg-settle.d.ts.map +1 -0
- package/dist/pptx/render/table-style-bg-span.d.ts +26 -0
- package/dist/pptx/render/table-style-bg-span.d.ts.map +1 -0
- package/dist/pptx/render/table-style-borders.d.ts.map +1 -1
- package/dist/pptx/render/table-style-builtins-data.d.ts +1 -1
- package/dist/pptx/render/table-style-builtins-data.d.ts.map +1 -1
- package/dist/pptx/render/table-style-fill.d.ts.map +1 -1
- package/dist/pptx/render/table-style-shadow.d.ts +20 -0
- package/dist/pptx/render/table-style-shadow.d.ts.map +1 -0
- package/dist/pptx/render/table-style-theme-refs.d.ts.map +1 -1
- package/dist/pptx/render/table-style.d.ts +9 -0
- package/dist/pptx/render/table-style.d.ts.map +1 -1
- package/dist/pptx/render/text-block-style.d.ts +5 -0
- package/dist/pptx/render/text-block-style.d.ts.map +1 -1
- package/dist/pptx/render/text-body-top-snap.d.ts +43 -0
- package/dist/pptx/render/text-body-top-snap.d.ts.map +1 -0
- package/dist/pptx/render/text-design-tracking.d.ts +20 -0
- package/dist/pptx/render/text-design-tracking.d.ts.map +1 -0
- package/dist/pptx/render/text-line-height.d.ts +8 -0
- package/dist/pptx/render/text-line-height.d.ts.map +1 -1
- package/dist/pptx/render/text-metric-tracking.d.ts.map +1 -1
- package/dist/pptx/render/text-paragraphs.d.ts +11 -1
- package/dist/pptx/render/text-paragraphs.d.ts.map +1 -1
- package/dist/pptx/render/text-warp-arch-fit.d.ts +51 -0
- package/dist/pptx/render/text-warp-arch-fit.d.ts.map +1 -0
- package/dist/pptx/render/text-warp-arch.d.ts +65 -0
- package/dist/pptx/render/text-warp-arch.d.ts.map +1 -0
- package/dist/pptx/render/text-warp-closed-paths.d.ts +53 -0
- package/dist/pptx/render/text-warp-closed-paths.d.ts.map +1 -0
- package/dist/pptx/render/text-warp-envelope-curves.d.ts.map +1 -1
- package/dist/pptx/render/text-warp-envelope-map.d.ts +12 -0
- package/dist/pptx/render/text-warp-envelope-map.d.ts.map +1 -1
- package/dist/pptx/render/text-warp-envelope-measure.d.ts +5 -0
- package/dist/pptx/render/text-warp-envelope-measure.d.ts.map +1 -1
- package/dist/pptx/render/text-warp-glyph-outline.d.ts.map +1 -1
- package/dist/pptx/render/text-warp-outline-webfont-fetch.d.ts.map +1 -1
- package/dist/pptx/render/text-warp-polygon-clip.d.ts +21 -0
- package/dist/pptx/render/text-warp-polygon-clip.d.ts.map +1 -0
- package/dist/pptx/render/text-warp-preset-definitions-extra.d.ts +21 -0
- package/dist/pptx/render/text-warp-preset-definitions-extra.d.ts.map +1 -0
- package/dist/pptx/render/text-warp-preset-definitions.d.ts +19 -0
- package/dist/pptx/render/text-warp-preset-definitions.d.ts.map +1 -1
- package/dist/pptx/render/text-warp-preset-sampler.d.ts.map +1 -1
- package/dist/pptx/render/text-warp-run-paint.d.ts +19 -0
- package/dist/pptx/render/text-warp-run-paint.d.ts.map +1 -0
- package/dist/pptx/render/text-warp.d.ts +3 -1
- package/dist/pptx/render/text-warp.d.ts.map +1 -1
- package/dist/pptx/render/visual-effects.d.ts +11 -21
- package/dist/pptx/render/visual-effects.d.ts.map +1 -1
- package/dist/pptx/{smartart-insert-preview-UP6DYY42.cjs → smartart-insert-preview-R7USUBIX.cjs} +8 -7
- package/dist/pptx/{smartart-insert-preview-DXFDFDSC.mjs → smartart-insert-preview-ZKVFXFSI.mjs} +7 -6
- package/dist/teams.js +2 -2
- package/dist/visio.js +23 -6
- package/dist/xlsx.js +7 -7
- package/package.json +2 -2
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { screenBorderWidth, screenStrokeWidth, screenBorder, DEVICE_PX_VAR, snappedStrokeTransform } from './chunk-G5NEBI7N.mjs';
|
|
2
|
+
import { getSubstituteFonts, buildFontFamilyString, evaluateCustomGeometryPathData, getShapeClipPath, getAdjustmentAwareClipPath, getShapeClipPathFromPreset, getCloudPathForRendering, hasShapeProperties, evaluatePresetShape, getShapeType, getRoundRectRadiusPx, isImageLikeElement, ooxmlGradientAngleToCssDegrees, chartDataChangeType, isParetoChartData, resolveDisplayedChartTypeName, evaluateCustomGeometryPaths, customGeometryPathsToSvgSubpaths, parseDataUrlToBytes, sampleFirstPixelColorFromBytes, flattenChartUserShapes } from 'ooxml-core/pptx';
|
|
2
3
|
import { DEFAULT_CHART_PALETTE, computeAxisStackedValueRange, computeAxisValueRange, formatCompactAxisValue, automaticMarkerSymbol, markerOutline, getChartStylePalette, formatChartNumber, clusteredBarGeometry, tint, shade, hasManualLayoutFields, resolveManualLayoutRect, applyLabelManualLayout, resolveDataLabelFlags, composeDataLabelText, generateAxisTicks, generateMinorAxisTicks, computeStackedValueRangeForAxis, computeValueRangeForChart, computeValueRangeForAxis, groupRowsByCategory, boxWhiskerDistribution, computeHistogramBins as computeHistogramBins$1, aggregateByCategory, computeSunburstArcs as computeSunburstArcs$1, computeHierarchicalSunburstArcs as computeHierarchicalSunburstArcs$1, computeFunnelGeometry, resolveManualPlotRect, radarRingPoints, radarAngle, computeRadarPoints, buildWaterfallSteps, computeWaterfallRange, buildMarkerPrimitive as buildMarkerPrimitive$1, chartDataTableMetrics, resolveBlankDisplay, computeStackedSeriesPlots, visibleRuns, smoothLinePath, maxBubbleSize, medianBubbleRadius, computeBubbleRadius, resolveAutoTitleText, STOCK_DEFAULT_WICK_COLOR, stockCandle, STOCK_DEFAULT_UP_FILL, STOCK_DEFAULT_DOWN_FILL, STOCK_TICK_WIDTH, boxMeanMarkerPath, buildHierarchyRoots, layoutTreemap, hierarchyBranchLabels, placeBestFitLabel, nudgeOutsideLabels, impliesAutoTitle, buildChartGradientDef, chartErrorBarAmount, fitChartTrendline, chartLineDashArray, calendarTicks, formatDate, excelSerialToDate, sampleSmoothLine, polylineRunsPath } from 'ooxml-core/chart';
|
|
3
4
|
export { DEFAULT_BAR_GAP_WIDTH, DEFAULT_CHART_PALETTE, applyLabelManualLayout, computeBoxStats, computeBubbleRadius, computeLinearRegression, computeLogValueRange, computeRSquared, computeRadarPoints, computeStackedSeriesPlots, computeStackedValueRangeForAxis, computeValueRangeForAxis, computeValueRangeForChart, findLogAxis, fitPolynomial, generateAxisTicks, generateLogTicks, generateMinorAxisTicks, getChartStylePalette, hasManualLayoutFields, radarAngle, radarRingPoints, resolveManualLayoutRect, shade, tint, valueToYLog } from 'ooxml-core/chart';
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
6
|
-
import {
|
|
7
|
-
export {
|
|
5
|
+
import { isDashedStroke, dashPatternUnits, capCompensatedDashArray, dashPenWidth } from 'ooxml-core/drawingml';
|
|
6
|
+
export { capCompensatedDashArray, dashPatternUnits, dashPenWidth, isDashedStroke } from 'ooxml-core/drawingml';
|
|
7
|
+
import { colorWithOpacity, normalizeHexColor, hexToRgbUnit, clampUnitInterval as clampUnitInterval$1, officeGradientStops, officeTwoStopGradientStops, hexToRgbChannels as hexToRgbChannels$1 } from 'ooxml-core/color';
|
|
8
|
+
export { clampUnitInterval, colorWithOpacity, hexToRgbChannels, hexToRgbUnit, normalizeHexColor } from 'ooxml-core/color';
|
|
9
|
+
import { buildRectPathGradientImage, shapePathGradientField, buildOutlinePathGradientSvg, buildRectPathGradientExactSvg, closedSubpaths } from 'ooxml-core/diagram';
|
|
10
|
+
export { buildRectPathGradientExactSvg, buildRectPathGradientImage, buildRectPathGradientSvg } from 'ooxml-core/diagram';
|
|
8
11
|
import { regionMapGeometry, buildRegionMapEntries, resolveValueColorStops, buildValueColorScale, sequentialColorScale, regionViewBounds, normalizeValue, scalePathD, regionBounds, shouldRenderRegionLabel, resolveRegionCode } from 'ooxml-core/chart/region-map';
|
|
9
12
|
export { buildRegionMapEntries, formatRegionMapValue, normalizeValue, resolveRegionCode, resolveRegionEntityCode, sequentialColorScale, shouldRenderRegionLabel } from 'ooxml-core/chart/region-map';
|
|
10
13
|
|
|
11
|
-
// src/pptx/render/chart-font.ts
|
|
12
14
|
var CHART_PX_PER_PT = 4 / 3;
|
|
13
15
|
function chartFontPx(sizePt) {
|
|
14
16
|
return sizePt * CHART_PX_PER_PT;
|
|
@@ -165,15 +167,2508 @@ var DEFAULT_TEXT_FONT_SIZE = 24;
|
|
|
165
167
|
var DEFAULT_BODY_INSET_LR_PX = 91440 / 9525;
|
|
166
168
|
var DEFAULT_BODY_INSET_TB_PX = 45720 / 9525;
|
|
167
169
|
|
|
170
|
+
// src/pptx/render/chart-format/chart-area-outer-effects.ts
|
|
171
|
+
var PX_PER_PT = 96 / 72;
|
|
172
|
+
function chartAreaEffectStyle(data) {
|
|
173
|
+
const format = data?.elementFormats?.chartArea;
|
|
174
|
+
const effects = format && !format.reset ? format.effects : void 0;
|
|
175
|
+
if (!effects || !effects.shadow && !(effects.glow && effects.glow.radius > 0)) {
|
|
176
|
+
return void 0;
|
|
177
|
+
}
|
|
178
|
+
const fill = format?.fill?.kind ?? (data?.style?.chartAreaFill === "none" ? "none" : "automatic");
|
|
179
|
+
const line2 = format?.line?.kind ?? (data?.style?.chartAreaBorder ? "solid" : "automatic");
|
|
180
|
+
if (fill === "none" && line2 !== "solid" && line2 !== "gradient") {
|
|
181
|
+
return void 0;
|
|
182
|
+
}
|
|
183
|
+
const style = {};
|
|
184
|
+
if (effects.shadow) {
|
|
185
|
+
const s = effects.shadow;
|
|
186
|
+
style.shadowColor = s.color;
|
|
187
|
+
style.shadowOpacity = 1 - (s.transparency ?? 0) / 100;
|
|
188
|
+
style.shadowBlur = s.blur * PX_PER_PT;
|
|
189
|
+
style.shadowDistance = s.distance * PX_PER_PT;
|
|
190
|
+
style.shadowAngle = s.angle;
|
|
191
|
+
style.outerShadowXml = {};
|
|
192
|
+
}
|
|
193
|
+
if (effects.glow && effects.glow.radius > 0) {
|
|
194
|
+
style.glowColor = effects.glow.color;
|
|
195
|
+
style.glowRadius = effects.glow.radius * PX_PER_PT;
|
|
196
|
+
style.glowOpacity = 1 - (effects.glow.transparency ?? 0) / 100;
|
|
197
|
+
}
|
|
198
|
+
return style;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// src/pptx/render/effect-profile.ts
|
|
202
|
+
var SHADOW_BLUR_TO_CSS = 0.654;
|
|
203
|
+
var GLOW_GROW_FRACTION = 0.417;
|
|
204
|
+
var GLOW_SIGMA_FRACTION = 1 / 6;
|
|
205
|
+
function shadowBlurToCss(blurRadius) {
|
|
206
|
+
return Math.max(0, blurRadius) * SHADOW_BLUR_TO_CSS;
|
|
207
|
+
}
|
|
208
|
+
function glowCssLengths(radius) {
|
|
209
|
+
const r = Math.max(0, radius);
|
|
210
|
+
return { spread: r * GLOW_GROW_FRACTION, blur: r * GLOW_SIGMA_FRACTION * 2 };
|
|
211
|
+
}
|
|
212
|
+
var GLOW_FILTER_LAYERS = 3;
|
|
213
|
+
var GLOW_FILTER_BLUR_FRACTION = 0.38;
|
|
214
|
+
function glowFilterLengths(radius) {
|
|
215
|
+
const blur = Math.max(0, radius) * GLOW_FILTER_BLUR_FRACTION;
|
|
216
|
+
return Array.from({ length: GLOW_FILTER_LAYERS }, () => Math.round(blur * 100) / 100);
|
|
217
|
+
}
|
|
218
|
+
var TEXT_SHADOW_BLUR_TO_CSS = 0.72;
|
|
219
|
+
|
|
220
|
+
// src/pptx/render/reflection.ts
|
|
221
|
+
function clampUnit(value) {
|
|
222
|
+
return value < 0 ? 0 : value > 1 ? 1 : value;
|
|
223
|
+
}
|
|
224
|
+
var ALGN_TRANSFORM_ORIGIN = {
|
|
225
|
+
tl: "left top",
|
|
226
|
+
t: "center top",
|
|
227
|
+
tr: "right top",
|
|
228
|
+
l: "left top",
|
|
229
|
+
ctr: "center top",
|
|
230
|
+
r: "right top",
|
|
231
|
+
bl: "left bottom",
|
|
232
|
+
b: "center bottom",
|
|
233
|
+
br: "right bottom"
|
|
234
|
+
};
|
|
235
|
+
function buildReflectionMaskGradient(cssAngleDeg, startOpacity, endOpacity, fadeLength, blurRadius, holdPx) {
|
|
236
|
+
const effectiveFadeLength = fadeLength + blurRadius * 2;
|
|
237
|
+
const midOpacity = (startOpacity + endOpacity) / 2;
|
|
238
|
+
const midPoint = Math.round(effectiveFadeLength * 0.5);
|
|
239
|
+
const holdStop = holdPx > 0 ? `, rgba(0,0,0,${startOpacity}) ${holdPx}px` : "";
|
|
240
|
+
if (blurRadius > 0) {
|
|
241
|
+
return `linear-gradient(${cssAngleDeg}deg, rgba(0,0,0,${startOpacity}) 0px${holdStop}, rgba(0,0,0,${midOpacity}) ${midPoint}px, rgba(0,0,0,${endOpacity}) ${effectiveFadeLength}px)`;
|
|
242
|
+
}
|
|
243
|
+
return `linear-gradient(${cssAngleDeg}deg, rgba(0,0,0,${startOpacity}) 0px${holdStop}, rgba(0,0,0,${endOpacity}) ${fadeLength}px)`;
|
|
244
|
+
}
|
|
245
|
+
function getReflectionWrapperStyle(style, elementHeight) {
|
|
246
|
+
if (!style) {
|
|
247
|
+
return void 0;
|
|
248
|
+
}
|
|
249
|
+
const hasReflection = typeof style.reflectionStartOpacity === "number" && style.reflectionStartOpacity > 0 || typeof style.reflectionDistance === "number" && style.reflectionDistance > 0 || typeof style.reflectionBlurRadius === "number" && style.reflectionBlurRadius > 0;
|
|
250
|
+
if (!hasReflection) {
|
|
251
|
+
return void 0;
|
|
252
|
+
}
|
|
253
|
+
const distance = style.reflectionDistance ?? 0;
|
|
254
|
+
const startOpacity = clampUnit(
|
|
255
|
+
typeof style.reflectionStartOpacity === "number" ? style.reflectionStartOpacity : 0.5
|
|
256
|
+
);
|
|
257
|
+
const endOpacity = clampUnit(
|
|
258
|
+
typeof style.reflectionEndOpacity === "number" ? style.reflectionEndOpacity : 0
|
|
259
|
+
);
|
|
260
|
+
const fadeLength = typeof style.reflectionEndPosition === "number" ? Math.round(style.reflectionEndPosition * Math.max(elementHeight, 1)) : 100;
|
|
261
|
+
const blurRadius = typeof style.reflectionBlurRadius === "number" ? Math.max(0, style.reflectionBlurRadius) : 0;
|
|
262
|
+
const holdPx = typeof style.reflectionStartPosition === "number" && style.reflectionStartPosition > 0 ? Math.round(Math.min(clampUnit(style.reflectionStartPosition) * fadeLength, fadeLength - 1)) : 0;
|
|
263
|
+
const fadeDirectionDeg = style.reflectionFadeDirection ?? 90;
|
|
264
|
+
const cssAngleDeg = ((fadeDirectionDeg + 90) % 360 + 360) % 360;
|
|
265
|
+
const scaleX = (style.reflectionScaleX ?? 1e5) / 1e5;
|
|
266
|
+
const scaleY = (style.reflectionScaleY ?? -1e5) / 1e5;
|
|
267
|
+
const skewX = (style.reflectionSkewX ?? 0) / 6e4;
|
|
268
|
+
const skewY = (style.reflectionSkewY ?? 0) / 6e4;
|
|
269
|
+
const rotation = (style.reflectionRotation ?? 0) / 6e4;
|
|
270
|
+
const transformParts = [`scale(${scaleX}, ${scaleY})`];
|
|
271
|
+
if (skewX !== 0 || skewY !== 0) {
|
|
272
|
+
transformParts.push(`skew(${skewX}deg, ${skewY}deg)`);
|
|
273
|
+
}
|
|
274
|
+
if (rotation !== 0) {
|
|
275
|
+
transformParts.push(`rotate(${rotation}deg)`);
|
|
276
|
+
}
|
|
277
|
+
const maskImage = buildReflectionMaskGradient(
|
|
278
|
+
cssAngleDeg,
|
|
279
|
+
startOpacity,
|
|
280
|
+
endOpacity,
|
|
281
|
+
fadeLength,
|
|
282
|
+
blurRadius,
|
|
283
|
+
holdPx
|
|
284
|
+
);
|
|
285
|
+
return {
|
|
286
|
+
position: "absolute",
|
|
287
|
+
left: "0",
|
|
288
|
+
top: `calc(100% + ${Math.round(distance)}px)`,
|
|
289
|
+
width: "100%",
|
|
290
|
+
height: "100%",
|
|
291
|
+
transform: transformParts.join(" "),
|
|
292
|
+
transformOrigin: ALGN_TRANSFORM_ORIGIN[style.reflectionAlignment ?? "ctr"] ?? "center top",
|
|
293
|
+
maskImage,
|
|
294
|
+
WebkitMaskImage: maskImage,
|
|
295
|
+
pointerEvents: "none"
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
function getTextReflectionWrapperStyle(style, elementHeight) {
|
|
299
|
+
if (!style?.textReflection) {
|
|
300
|
+
return void 0;
|
|
301
|
+
}
|
|
302
|
+
return getReflectionWrapperStyle(
|
|
303
|
+
{
|
|
304
|
+
reflectionStartOpacity: style.textReflectionStartOpacity ?? 0.5,
|
|
305
|
+
reflectionEndOpacity: style.textReflectionEndOpacity ?? 0,
|
|
306
|
+
reflectionDistance: style.textReflectionOffset ?? 0,
|
|
307
|
+
reflectionBlurRadius: style.textReflectionBlur ?? 0,
|
|
308
|
+
reflectionFadeDirection: style.textReflectionFadeDirection,
|
|
309
|
+
reflectionScaleX: style.textReflectionScaleX,
|
|
310
|
+
reflectionScaleY: style.textReflectionScaleY,
|
|
311
|
+
reflectionSkewX: style.textReflectionSkewX,
|
|
312
|
+
reflectionSkewY: style.textReflectionSkewY,
|
|
313
|
+
reflectionRotation: style.textReflectionRotation,
|
|
314
|
+
reflectionAlignment: style.textReflectionAlignment
|
|
315
|
+
},
|
|
316
|
+
elementHeight
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
function resolveLiveCustomGeometryPath(element) {
|
|
320
|
+
const el = element;
|
|
321
|
+
if (!el.pathData || !el.pathWidth || !el.pathHeight) {
|
|
322
|
+
return void 0;
|
|
323
|
+
}
|
|
324
|
+
const overrides = el.shapeAdjustments;
|
|
325
|
+
if (overrides && Object.keys(overrides).length > 0 && el.customGeometryRawData) {
|
|
326
|
+
const live = evaluateCustomGeometryPathData(
|
|
327
|
+
el.customGeometryRawData,
|
|
328
|
+
el.pathWidth,
|
|
329
|
+
el.pathHeight,
|
|
330
|
+
overrides
|
|
331
|
+
);
|
|
332
|
+
if (live) {
|
|
333
|
+
return live;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
return { pathData: el.pathData, pathWidth: el.pathWidth, pathHeight: el.pathHeight };
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// src/pptx/render/shape-geometry.ts
|
|
340
|
+
function getResolvedShapeClipPathFor(shapeType, width, height, adjustments) {
|
|
341
|
+
if (!shapeType) {
|
|
342
|
+
return void 0;
|
|
343
|
+
}
|
|
344
|
+
if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) {
|
|
345
|
+
return getShapeClipPath(shapeType);
|
|
346
|
+
}
|
|
347
|
+
if (adjustments && Object.keys(adjustments).length > 0) {
|
|
348
|
+
const adjusted = getAdjustmentAwareClipPath(shapeType, width, height, adjustments);
|
|
349
|
+
if (adjusted !== void 0) {
|
|
350
|
+
return adjusted;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
const fromPreset = getShapeClipPathFromPreset(shapeType, width, height, adjustments);
|
|
354
|
+
if (fromPreset !== void 0) {
|
|
355
|
+
return fromPreset;
|
|
356
|
+
}
|
|
357
|
+
const cloud = getCloudPathForRendering(shapeType, width, height);
|
|
358
|
+
if (cloud !== void 0) {
|
|
359
|
+
return cloud;
|
|
360
|
+
}
|
|
361
|
+
return getShapeClipPath(shapeType);
|
|
362
|
+
}
|
|
363
|
+
function buildCustomGeometryClipPath(pathData, pathWidth, pathHeight, elemWidth, elemHeight) {
|
|
364
|
+
if (!pathData || !Number.isFinite(pathWidth) || !Number.isFinite(pathHeight) || pathWidth <= 0 || pathHeight <= 0 || !Number.isFinite(elemWidth) || !Number.isFinite(elemHeight) || elemWidth <= 0 || elemHeight <= 0) {
|
|
365
|
+
return void 0;
|
|
366
|
+
}
|
|
367
|
+
const sx = elemWidth / pathWidth;
|
|
368
|
+
const sy = elemHeight / pathHeight;
|
|
369
|
+
const round = (n) => {
|
|
370
|
+
const r = Math.round(n * 100) / 100;
|
|
371
|
+
return Object.is(r, -0) ? "0" : String(r);
|
|
372
|
+
};
|
|
373
|
+
const tokens = pathData.match(/[MLCQZAHVmlcqzahv][^MLCQZAHVmlcqzahv]*/g) ?? [];
|
|
374
|
+
const out = [];
|
|
375
|
+
for (const token of tokens) {
|
|
376
|
+
const cmd = token[0];
|
|
377
|
+
const upper = cmd.toUpperCase();
|
|
378
|
+
if (upper === "Z") {
|
|
379
|
+
out.push("Z");
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
const nums = (token.slice(1).match(/-?[\d.]+(?:e-?\d+)?/gi) ?? []).map(Number);
|
|
383
|
+
if (upper === "A") {
|
|
384
|
+
const parts = [];
|
|
385
|
+
for (let i = 0; i + 6 < nums.length; i += 7) {
|
|
386
|
+
parts.push(
|
|
387
|
+
round(nums[i] * sx),
|
|
388
|
+
round(nums[i + 1] * sy),
|
|
389
|
+
String(nums[i + 2]),
|
|
390
|
+
String(nums[i + 3]),
|
|
391
|
+
String(nums[i + 4]),
|
|
392
|
+
round(nums[i + 5] * sx),
|
|
393
|
+
round(nums[i + 6] * sy)
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
out.push(`A ${parts.join(" ")}`);
|
|
397
|
+
continue;
|
|
398
|
+
}
|
|
399
|
+
const scaled = nums.map((n, i) => round(n * (i % 2 === 0 ? sx : sy)));
|
|
400
|
+
out.push(`${upper} ${scaled.join(" ")}`);
|
|
401
|
+
}
|
|
402
|
+
if (out.length === 0) {
|
|
403
|
+
return void 0;
|
|
404
|
+
}
|
|
405
|
+
return `path('${out.join(" ")}')`;
|
|
406
|
+
}
|
|
407
|
+
function getResolvedShapeClipPath(element, width, height) {
|
|
408
|
+
const w = typeof width === "number" ? width : element.width;
|
|
409
|
+
const h = typeof height === "number" ? height : element.height;
|
|
410
|
+
const live = resolveLiveCustomGeometryPath(element);
|
|
411
|
+
if (live) {
|
|
412
|
+
const customClip = buildCustomGeometryClipPath(
|
|
413
|
+
live.pathData,
|
|
414
|
+
live.pathWidth,
|
|
415
|
+
live.pathHeight,
|
|
416
|
+
w,
|
|
417
|
+
h
|
|
418
|
+
);
|
|
419
|
+
if (customClip) {
|
|
420
|
+
return customClip;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
const shapeType = element.shapeType;
|
|
424
|
+
if (!shapeType) {
|
|
425
|
+
return void 0;
|
|
426
|
+
}
|
|
427
|
+
const adjustments = element.shapeAdjustments;
|
|
428
|
+
return getResolvedShapeClipPathFor(shapeType, w, h, adjustments);
|
|
429
|
+
}
|
|
430
|
+
var IDENTITY_RECT_PRESETS = /* @__PURE__ */ new Set(["rect", "flowchartprocess"]);
|
|
431
|
+
function isIdentityRectClip(element) {
|
|
432
|
+
const custom = element;
|
|
433
|
+
if (custom.pathData && custom.pathWidth && custom.pathHeight) {
|
|
434
|
+
return false;
|
|
435
|
+
}
|
|
436
|
+
const shapeType = element.shapeType;
|
|
437
|
+
return shapeType !== void 0 && IDENTITY_RECT_PRESETS.has(shapeType.toLowerCase());
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// src/pptx/render/connector-style.ts
|
|
441
|
+
var COMPOUND_BANDS = {
|
|
442
|
+
dbl: [1 / 3, 1 / 3, 1 / 3],
|
|
443
|
+
thickThin: [0.6, 0.2, 0.2],
|
|
444
|
+
thinThick: [0.2, 0.2, 0.6],
|
|
445
|
+
tri: [1 / 6, 1 / 6, 1 / 3, 1 / 6, 1 / 6]
|
|
446
|
+
};
|
|
447
|
+
function compoundStrands(compoundLine) {
|
|
448
|
+
const bands = compoundLine ? COMPOUND_BANDS[compoundLine] : void 0;
|
|
449
|
+
if (!bands) {
|
|
450
|
+
return void 0;
|
|
451
|
+
}
|
|
452
|
+
const strands = [];
|
|
453
|
+
let edge = -0.5;
|
|
454
|
+
bands.forEach((band2, index) => {
|
|
455
|
+
if (index % 2 === 0) {
|
|
456
|
+
strands.push([edge + band2 / 2, band2]);
|
|
457
|
+
}
|
|
458
|
+
edge += band2;
|
|
459
|
+
});
|
|
460
|
+
return strands;
|
|
461
|
+
}
|
|
462
|
+
function getCompoundLineOffsets(compoundLine, strokeWidth) {
|
|
463
|
+
const base = Math.max(strokeWidth, 1);
|
|
464
|
+
const exact = (value) => Math.round(value * 1e6) / 1e6 + 0;
|
|
465
|
+
return compoundStrands(compoundLine)?.map(([offset]) => exact(offset * base)) ?? [0];
|
|
466
|
+
}
|
|
467
|
+
function getCompoundLineWidths(compoundLine, strokeWidth) {
|
|
468
|
+
const base = Math.max(strokeWidth, 1);
|
|
469
|
+
return compoundStrands(compoundLine)?.map(([, width]) => width * base) ?? [base];
|
|
470
|
+
}
|
|
471
|
+
function connectorStrandScreenWidth(widths, strokeWidth, idx) {
|
|
472
|
+
return widths.length > 1 ? screenBorderWidth(widths[idx] ?? strokeWidth) : screenStrokeWidth(strokeWidth, 1);
|
|
473
|
+
}
|
|
474
|
+
function svgLineCap(lineCap, dashed = false) {
|
|
475
|
+
switch (lineCap) {
|
|
476
|
+
case "flat":
|
|
477
|
+
return "butt";
|
|
478
|
+
case "sq":
|
|
479
|
+
return dashed ? "butt" : "square";
|
|
480
|
+
case "rnd":
|
|
481
|
+
return "round";
|
|
482
|
+
default:
|
|
483
|
+
return "butt";
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
function connectorKind(shapeType) {
|
|
487
|
+
const t = (shapeType ?? "").toLowerCase();
|
|
488
|
+
if (t.includes("bentconnector")) {
|
|
489
|
+
return "bent";
|
|
490
|
+
}
|
|
491
|
+
if (t.includes("curvedconnector")) {
|
|
492
|
+
return "curved";
|
|
493
|
+
}
|
|
494
|
+
return "straight";
|
|
495
|
+
}
|
|
496
|
+
function connectorNeedsPath(shapeType) {
|
|
497
|
+
return connectorKind(shapeType) !== "straight";
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// src/pptx/render/device-pixel-exact.ts
|
|
501
|
+
var EMU_PER_PX = 9525;
|
|
502
|
+
var EMU_PER_MASTER_UNIT = 1587.5;
|
|
503
|
+
var MASTER_UNITS_PER_PX = EMU_PER_PX / EMU_PER_MASTER_UNIT;
|
|
504
|
+
function exactPx(model, emu) {
|
|
505
|
+
if (typeof emu !== "number" || !Number.isFinite(emu)) {
|
|
506
|
+
return model;
|
|
507
|
+
}
|
|
508
|
+
return Math.round(emu / EMU_PER_PX) === Math.round(model) ? Math.round(emu / EMU_PER_MASTER_UNIT) / MASTER_UNITS_PER_PX : model;
|
|
509
|
+
}
|
|
510
|
+
function exactDeviceBox(element) {
|
|
511
|
+
return {
|
|
512
|
+
x: exactPx(element.x, element.xEmu),
|
|
513
|
+
y: exactPx(element.y, element.yEmu),
|
|
514
|
+
width: exactPx(element.width, element.widthEmu),
|
|
515
|
+
height: exactPx(element.height, element.heightEmu)
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// src/pptx/render/device-pixel-group.ts
|
|
520
|
+
var parents = /* @__PURE__ */ new WeakMap();
|
|
521
|
+
function registerGroupChildren(group) {
|
|
522
|
+
if (group.type !== "group") {
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
for (const child of group.children) {
|
|
526
|
+
parents.set(child, group);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
var EMU_PER_PX2 = 9525;
|
|
530
|
+
function exactOrigin(group) {
|
|
531
|
+
const emuX = group.xEmu;
|
|
532
|
+
const emuY = group.yEmu;
|
|
533
|
+
return {
|
|
534
|
+
x: typeof emuX === "number" && Math.round(emuX / EMU_PER_PX2) === Math.round(group.x) ? emuX / EMU_PER_PX2 : group.x,
|
|
535
|
+
y: typeof emuY === "number" && Math.round(emuY / EMU_PER_PX2) === Math.round(group.y) ? emuY / EMU_PER_PX2 : group.y
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
function snapPlacement(element) {
|
|
539
|
+
const own = exactDeviceBox(element);
|
|
540
|
+
let group = parents.get(element);
|
|
541
|
+
if (!group) {
|
|
542
|
+
return { x: element.x, y: element.y, exact: own };
|
|
543
|
+
}
|
|
544
|
+
let shownX = 0;
|
|
545
|
+
let shownY = 0;
|
|
546
|
+
let trueX = 0;
|
|
547
|
+
let trueY = 0;
|
|
548
|
+
for (let depth = 0; group && depth < 64; depth++) {
|
|
549
|
+
if (group.rotation || group.flipHorizontal || group.flipVertical) {
|
|
550
|
+
return void 0;
|
|
551
|
+
}
|
|
552
|
+
const origin = exactOrigin(group);
|
|
553
|
+
shownX += group.x;
|
|
554
|
+
shownY += group.y;
|
|
555
|
+
trueX += origin.x;
|
|
556
|
+
trueY += origin.y;
|
|
557
|
+
group = parents.get(group);
|
|
558
|
+
}
|
|
559
|
+
return {
|
|
560
|
+
// Chromium snaps an inline `<svg>` root (every stroke overlay and connector)
|
|
561
|
+
// to a whole stage pixel, so that is where the painted stroke really starts.
|
|
562
|
+
x: Math.round(shownX + element.x),
|
|
563
|
+
y: Math.round(shownY + element.y),
|
|
564
|
+
exact: {
|
|
565
|
+
x: trueX + element.x,
|
|
566
|
+
y: trueY + element.y,
|
|
567
|
+
width: element.width,
|
|
568
|
+
height: element.height
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
// src/pptx/render/connector-markers.ts
|
|
574
|
+
var ARROW_MARKER_SIZE = { sm: 2, med: 3, lg: 5 };
|
|
575
|
+
function markerPath(type, arrowWidth, arrowLength) {
|
|
576
|
+
const markerWidth = ARROW_MARKER_SIZE[arrowLength ?? "med"] ?? 3;
|
|
577
|
+
const markerHeight = ARROW_MARKER_SIZE[arrowWidth ?? "med"] ?? 3;
|
|
578
|
+
const box = { markerWidth, markerHeight, refX: 10 };
|
|
579
|
+
switch (type) {
|
|
580
|
+
case "diamond":
|
|
581
|
+
return { shape: "path", d: "M5 0 L10 5 L5 10 L0 5 Z", ...box, refX: 5 };
|
|
582
|
+
case "oval":
|
|
583
|
+
return { shape: "circle", ...box, refX: 5 };
|
|
584
|
+
case "stealth":
|
|
585
|
+
return { shape: "path", d: "M0 0 L10 5 L0 10 L3 5 Z", ...box };
|
|
586
|
+
case "arrow":
|
|
587
|
+
return { shape: "path", d: "M1 1 L9 5 L1 9", strokeOnly: true, ...box, refX: 9 };
|
|
588
|
+
// triangle / fallback
|
|
589
|
+
default:
|
|
590
|
+
return { shape: "path", d: "M0 0 L10 5 L0 10 Z", ...box };
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
function normalizeArrow(a) {
|
|
594
|
+
return a && a !== "none" ? a : void 0;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
// src/pptx/render/stroke-paint.ts
|
|
598
|
+
function hasStrokePaint(style) {
|
|
599
|
+
if (!style || Math.max(0, style.strokeWidth ?? 0) <= 0) {
|
|
600
|
+
return false;
|
|
601
|
+
}
|
|
602
|
+
return style.strokeColor !== void 0 || style.strokeFillMode !== void 0;
|
|
603
|
+
}
|
|
604
|
+
function paintedStrokeWidth(style) {
|
|
605
|
+
return hasStrokePaint(style) ? Math.max(0, style?.strokeWidth ?? 0) : 0;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
// src/pptx/render/custom-path-markers.ts
|
|
609
|
+
function isArrowedCustomPath(element) {
|
|
610
|
+
if (element.type !== "shape" || !element.pathData || !element.pathWidth || !element.pathHeight) {
|
|
611
|
+
return false;
|
|
612
|
+
}
|
|
613
|
+
const style = element.shapeStyle;
|
|
614
|
+
if (!hasStrokePaint(style) || (style?.strokeWidth ?? 0) <= 0) return false;
|
|
615
|
+
return !/[zZ]/u.test(element.pathData) && (style?.fillMode === "none" || style?.fillColor === "transparent") && Boolean(normalizeArrow(style?.connectorStartArrow) || normalizeArrow(style?.connectorEndArrow));
|
|
616
|
+
}
|
|
617
|
+
function buildCustomPathMarkers(element, stroke) {
|
|
618
|
+
if (!isArrowedCustomPath(element) || !hasShapeProperties(element)) return void 0;
|
|
619
|
+
const style = element.shapeStyle ?? {};
|
|
620
|
+
const seed = [...element.id].map((char) => char.codePointAt(0).toString(16)).join("-");
|
|
621
|
+
const markup = [];
|
|
622
|
+
const add = (end2) => {
|
|
623
|
+
const arrow = normalizeArrow(style[`connector${end2}Arrow`]);
|
|
624
|
+
if (!arrow) return void 0;
|
|
625
|
+
const shape = markerPath(
|
|
626
|
+
arrow,
|
|
627
|
+
style[`connector${end2}ArrowWidth`],
|
|
628
|
+
style[`connector${end2}ArrowLength`]
|
|
629
|
+
);
|
|
630
|
+
const id = `freeform-${seed}-${end2}`;
|
|
631
|
+
const color = escapeSvgAttr(stroke);
|
|
632
|
+
const body = shape.shape === "circle" ? `<circle cx="5" cy="5" r="4" fill="${color}"/>` : `<path d="${escapeSvgAttr(shape.d ?? "")}" fill="${shape.strokeOnly ? "none" : color}"${shape.strokeOnly ? ` stroke="${color}"` : ""}/>`;
|
|
633
|
+
markup.push(
|
|
634
|
+
`<marker id="${id}" viewBox="0 0 10 10" refX="${shape.refX}" refY="5" markerWidth="${shape.markerWidth}" markerHeight="${shape.markerHeight}" markerUnits="strokeWidth" orient="auto-start-reverse" preserveAspectRatio="none">${body}</marker>`
|
|
635
|
+
);
|
|
636
|
+
return `url(#${id})`;
|
|
637
|
+
};
|
|
638
|
+
const start = add("Start");
|
|
639
|
+
const end = add("End");
|
|
640
|
+
return { markup: markup.join(""), start, end };
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
// src/pptx/render/dash-path-start.ts
|
|
644
|
+
var ARGS_PER_COMMAND = { M: 2, L: 2, C: 6, Q: 4, A: 7 };
|
|
645
|
+
var COUNTER_CLOCKWISE_PRESETS = /* @__PURE__ */ new Set(["ellipse", "oval", "flowchartconnector"]);
|
|
646
|
+
function parseFigure(d) {
|
|
647
|
+
const tokens = d.match(/[A-Za-z]|-?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?/giu);
|
|
648
|
+
if (!tokens) return void 0;
|
|
649
|
+
let start;
|
|
650
|
+
const segments = [];
|
|
651
|
+
let closed = false;
|
|
652
|
+
let cmd = "";
|
|
653
|
+
let i = 0;
|
|
654
|
+
while (i < tokens.length) {
|
|
655
|
+
const token = tokens[i];
|
|
656
|
+
if (/^[A-Za-z]$/u.test(token)) {
|
|
657
|
+
cmd = token;
|
|
658
|
+
i += 1;
|
|
659
|
+
if (cmd === "Z") {
|
|
660
|
+
closed = true;
|
|
661
|
+
if (i < tokens.length) return void 0;
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
const count = ARGS_PER_COMMAND[cmd];
|
|
666
|
+
if (count === void 0 || closed) return void 0;
|
|
667
|
+
const args = tokens.slice(i, i + count).map(Number);
|
|
668
|
+
i += count;
|
|
669
|
+
if (args.length < count || args.some((n) => !Number.isFinite(n))) return void 0;
|
|
670
|
+
const end = [args[count - 2], args[count - 1]];
|
|
671
|
+
if (cmd === "M") {
|
|
672
|
+
if (start) return void 0;
|
|
673
|
+
start = end;
|
|
674
|
+
} else {
|
|
675
|
+
if (!start) return void 0;
|
|
676
|
+
segments.push({ cmd, args, end });
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
return start && closed && segments.length > 0 ? { start, segments, closed } : void 0;
|
|
680
|
+
}
|
|
681
|
+
var num = (n) => String(Number(n.toFixed(5)));
|
|
682
|
+
function writeSegment(segment) {
|
|
683
|
+
return `${segment.cmd} ${segment.args.map(num).join(" ")}`;
|
|
684
|
+
}
|
|
685
|
+
function reverseSegments(figure) {
|
|
686
|
+
const points = [figure.start, ...figure.segments.map((s) => s.end)];
|
|
687
|
+
const out = [];
|
|
688
|
+
for (let i = figure.segments.length - 1; i >= 0; i -= 1) {
|
|
689
|
+
const segment = figure.segments[i];
|
|
690
|
+
const to = points[i];
|
|
691
|
+
const a = segment.args;
|
|
692
|
+
if (segment.cmd === "L") {
|
|
693
|
+
out.push(`L ${num(to[0])} ${num(to[1])}`);
|
|
694
|
+
} else if (segment.cmd === "C") {
|
|
695
|
+
const c = a;
|
|
696
|
+
out.push(`C ${[c[2], c[3], c[0], c[1], to[0], to[1]].map(num).join(" ")}`);
|
|
697
|
+
} else if (segment.cmd === "Q") {
|
|
698
|
+
out.push(`Q ${[a[0], a[1], to[0], to[1]].map((n) => num(n)).join(" ")}`);
|
|
699
|
+
} else {
|
|
700
|
+
const sweep = a[4] === 0 ? 1 : 0;
|
|
701
|
+
out.push(
|
|
702
|
+
`A ${[a[0], a[1], a[2], a[3], sweep, to[0], to[1]].map((n) => num(n)).join(" ")}`
|
|
703
|
+
);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
return out;
|
|
707
|
+
}
|
|
708
|
+
function dashStartPathData(d, shapeType) {
|
|
709
|
+
const figure = parseFigure(d);
|
|
710
|
+
if (!figure) return d;
|
|
711
|
+
const lastEnd = figure.segments[figure.segments.length - 1].end;
|
|
712
|
+
const selfClosing = Math.abs(lastEnd[0] - figure.start[0]) < 1e-3 && Math.abs(lastEnd[1] - figure.start[1]) < 1e-3;
|
|
713
|
+
if (selfClosing) {
|
|
714
|
+
if (!COUNTER_CLOCKWISE_PRESETS.has((shapeType ?? "").toLowerCase())) return d;
|
|
715
|
+
return `M ${num(figure.start[0])} ${num(figure.start[1])} ${reverseSegments(figure).join(" ")} Z`;
|
|
716
|
+
}
|
|
717
|
+
return [
|
|
718
|
+
`M ${num(lastEnd[0])} ${num(lastEnd[1])}`,
|
|
719
|
+
`L ${num(figure.start[0])} ${num(figure.start[1])}`,
|
|
720
|
+
...figure.segments.map(writeSegment),
|
|
721
|
+
"Z"
|
|
722
|
+
].join(" ");
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
// src/pptx/render/stroke-clip-edge.ts
|
|
726
|
+
var ROUND_JOIN_STEPS = 8;
|
|
727
|
+
var fmt = (n) => String(Math.round(n * 1e3) / 1e3);
|
|
728
|
+
function signedArea(pts) {
|
|
729
|
+
let area = 0;
|
|
730
|
+
for (let k = 0; k < pts.length; k++) {
|
|
731
|
+
const a = pts[k];
|
|
732
|
+
const b = pts[(k + 1) % pts.length];
|
|
733
|
+
area += a[0] * b[1] - b[0] * a[1];
|
|
734
|
+
}
|
|
735
|
+
return area;
|
|
736
|
+
}
|
|
737
|
+
function offsetRing(pts, half, join, away) {
|
|
738
|
+
let last = [0, 0];
|
|
739
|
+
const normals = pts.map((a, k) => {
|
|
740
|
+
const b = pts[(k + 1) % pts.length];
|
|
741
|
+
const len = Math.hypot(b[0] - a[0], b[1] - a[1]);
|
|
742
|
+
if (len >= 1e-6) {
|
|
743
|
+
last = [away * -(b[1] - a[1]) / len, away * (b[0] - a[0]) / len];
|
|
744
|
+
}
|
|
745
|
+
return last;
|
|
746
|
+
});
|
|
747
|
+
const ring = [];
|
|
748
|
+
for (let k = 0; k < pts.length; k++) {
|
|
749
|
+
const v = pts[k];
|
|
750
|
+
const n1 = normals[(k - 1 + pts.length) % pts.length];
|
|
751
|
+
const n2 = normals[k];
|
|
752
|
+
const p1 = [v[0] + n1[0] * half, v[1] + n1[1] * half];
|
|
753
|
+
const p2 = [v[0] + n2[0] * half, v[1] + n2[1] * half];
|
|
754
|
+
const cosHalf = Math.sqrt(Math.max(0, (1 + n1[0] * n2[0] + n1[1] * n2[1]) / 2));
|
|
755
|
+
const bx = n1[0] + n2[0];
|
|
756
|
+
const by = n1[1] + n2[1];
|
|
757
|
+
const blen = Math.hypot(bx, by);
|
|
758
|
+
const miter = cosHalf > 1e-6 && blen > 1e-9 ? [v[0] + bx / blen * (half / cosHalf), v[1] + by / blen * (half / cosHalf)] : void 0;
|
|
759
|
+
const turn = n1[0] * n2[1] - n1[1] * n2[0];
|
|
760
|
+
const opensOutward = away * turn < 0;
|
|
761
|
+
if (!opensOutward || Math.abs(turn) < 1e-9) {
|
|
762
|
+
ring.push(miter ?? p2);
|
|
763
|
+
} else if (join.join === "miter" && miter && 1 / cosHalf <= join.miterLimit) {
|
|
764
|
+
ring.push(miter);
|
|
765
|
+
} else if (join.join === "round") {
|
|
766
|
+
const a1 = Math.atan2(n1[1], n1[0]);
|
|
767
|
+
let sweep = Math.atan2(n2[1], n2[0]) - a1;
|
|
768
|
+
while (sweep > Math.PI) sweep -= 2 * Math.PI;
|
|
769
|
+
while (sweep < -Math.PI) sweep += 2 * Math.PI;
|
|
770
|
+
for (let i = 0; i <= ROUND_JOIN_STEPS; i++) {
|
|
771
|
+
const t = a1 + sweep * i / ROUND_JOIN_STEPS;
|
|
772
|
+
ring.push([v[0] + Math.cos(t) * half, v[1] + Math.sin(t) * half]);
|
|
773
|
+
}
|
|
774
|
+
} else {
|
|
775
|
+
ring.push(p1, p2);
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
return ring;
|
|
779
|
+
}
|
|
780
|
+
function outerStrokeEdgePath(d, strokeWidth, join) {
|
|
781
|
+
if (!(strokeWidth > 0)) {
|
|
782
|
+
return void 0;
|
|
783
|
+
}
|
|
784
|
+
const subpaths = flattenPath(d);
|
|
785
|
+
if (!subpaths || subpaths.length === 0) {
|
|
786
|
+
return void 0;
|
|
787
|
+
}
|
|
788
|
+
const reference = Math.sign(signedArea(subpaths[0])) || 1;
|
|
789
|
+
return subpaths.filter((sub) => sub.length > 2).map((sub) => {
|
|
790
|
+
const sign = Math.sign(signedArea(sub)) || reference;
|
|
791
|
+
const away = sign > 0 ? -1 : 1;
|
|
792
|
+
const ring = offsetRing(
|
|
793
|
+
sub,
|
|
794
|
+
strokeWidth / 2,
|
|
795
|
+
join,
|
|
796
|
+
sign === reference ? away : away === 1 ? -1 : 1
|
|
797
|
+
);
|
|
798
|
+
return `M ${ring.map(([x, y]) => `${fmt(x)} ${fmt(y)}`).join(" L ")} Z`;
|
|
799
|
+
}).join(" ");
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
// src/pptx/render/stroke-compound-strands.ts
|
|
803
|
+
var fmt2 = (n) => String(Math.round(n * 1e3) / 1e3);
|
|
804
|
+
function offsetPolyline(points, distance) {
|
|
805
|
+
const normals = points.slice(1).map((b, k) => {
|
|
806
|
+
const a = points[k] ?? b;
|
|
807
|
+
const len = Math.hypot(b[0] - a[0], b[1] - a[1]) || 1;
|
|
808
|
+
return [-(b[1] - a[1]) / len, (b[0] - a[0]) / len];
|
|
809
|
+
});
|
|
810
|
+
return points.map((p, k) => {
|
|
811
|
+
const n1 = normals[Math.max(0, k - 1)] ?? [0, 0];
|
|
812
|
+
const n2 = normals[Math.min(normals.length - 1, k)] ?? n1;
|
|
813
|
+
const bx = n1[0] + n2[0];
|
|
814
|
+
const by = n1[1] + n2[1];
|
|
815
|
+
const blen = Math.hypot(bx, by);
|
|
816
|
+
const cos = blen / 2;
|
|
817
|
+
const reach = cos > 0.25 ? distance / cos : distance;
|
|
818
|
+
return blen > 1e-9 ? [p[0] + bx / blen * reach, p[1] + by / blen * reach] : p;
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
function compoundStrandPath(d, offset, join) {
|
|
822
|
+
const subpaths = flattenPath(d);
|
|
823
|
+
if (!subpaths || subpaths.length === 0) {
|
|
824
|
+
return void 0;
|
|
825
|
+
}
|
|
826
|
+
const closedCount = (d.match(/[zZ]/gu) ?? []).length;
|
|
827
|
+
return subpaths.map((sub, index) => {
|
|
828
|
+
const closed = index < closedCount;
|
|
829
|
+
const points = closed ? offsetRing(sub, Math.abs(offset), join, offset < 0 ? -1 : 1) : offsetPolyline(sub, offset);
|
|
830
|
+
const body = points.map(([x, y]) => `${fmt2(x)} ${fmt2(y)}`).join(" L ");
|
|
831
|
+
return `M ${body}${closed ? " Z" : ""}`;
|
|
832
|
+
}).join(" ");
|
|
833
|
+
}
|
|
834
|
+
function traceCompoundStrands(strands, d, join) {
|
|
835
|
+
if (strands.length < 2) {
|
|
836
|
+
return [...strands];
|
|
837
|
+
}
|
|
838
|
+
return strands.map((strand) => {
|
|
839
|
+
if (strand.offset === 0 || strand.d !== void 0) {
|
|
840
|
+
return strand;
|
|
841
|
+
}
|
|
842
|
+
const traced = compoundStrandPath(d, strand.offset, join);
|
|
843
|
+
return traced ? { ...strand, d: traced, offset: 0 } : strand;
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
function getStrokeOnlyPresetPaths(element) {
|
|
847
|
+
if (element.type !== "shape" || !hasShapeProperties(element)) {
|
|
848
|
+
return void 0;
|
|
849
|
+
}
|
|
850
|
+
const shapeType = element.shapeType;
|
|
851
|
+
if (!shapeType || shapeType === "custom") {
|
|
852
|
+
return void 0;
|
|
853
|
+
}
|
|
854
|
+
if (element.pathData) {
|
|
855
|
+
return void 0;
|
|
856
|
+
}
|
|
857
|
+
const result = evaluatePresetShape(
|
|
858
|
+
shapeType,
|
|
859
|
+
Math.max(element.width, 0),
|
|
860
|
+
Math.max(element.height, 0),
|
|
861
|
+
element.shapeAdjustments
|
|
862
|
+
);
|
|
863
|
+
if (!result || !result.fillNone) {
|
|
864
|
+
return void 0;
|
|
865
|
+
}
|
|
866
|
+
const drawable = result.paths.filter((path) => path.d !== "");
|
|
867
|
+
return drawable.length > 0 ? drawable : void 0;
|
|
868
|
+
}
|
|
869
|
+
function isStrokeOnlyPresetElement(element) {
|
|
870
|
+
return getStrokeOnlyPresetPaths(element) !== void 0;
|
|
871
|
+
}
|
|
872
|
+
function strokeOnlyPresetPathData(element) {
|
|
873
|
+
const paths = getStrokeOnlyPresetPaths(element);
|
|
874
|
+
if (!paths) {
|
|
875
|
+
return void 0;
|
|
876
|
+
}
|
|
877
|
+
const stroked = paths.filter((path) => path.stroke !== false).map((path) => path.d);
|
|
878
|
+
return stroked.length > 0 ? stroked.join(" ") : void 0;
|
|
879
|
+
}
|
|
880
|
+
function getSplitStrokePresetPaths(element) {
|
|
881
|
+
if (element.type !== "shape" || !hasShapeProperties(element) || element.pathData) {
|
|
882
|
+
return void 0;
|
|
883
|
+
}
|
|
884
|
+
const shapeType = element.shapeType;
|
|
885
|
+
if (!shapeType || shapeType === "custom") {
|
|
886
|
+
return void 0;
|
|
887
|
+
}
|
|
888
|
+
const result = evaluatePresetShape(
|
|
889
|
+
shapeType,
|
|
890
|
+
Math.max(element.width, 0),
|
|
891
|
+
Math.max(element.height, 0),
|
|
892
|
+
element.shapeAdjustments
|
|
893
|
+
);
|
|
894
|
+
if (!result || result.fillNone || !result.paths.some((path) => path.stroke === false)) {
|
|
895
|
+
return void 0;
|
|
896
|
+
}
|
|
897
|
+
return result.paths;
|
|
898
|
+
}
|
|
899
|
+
function splitStrokePresetPathData(element) {
|
|
900
|
+
const stroked = getSplitStrokePresetPaths(element)?.filter(
|
|
901
|
+
(path) => path.stroke !== false && path.d !== ""
|
|
902
|
+
);
|
|
903
|
+
return stroked && stroked.length > 0 ? stroked.map((path) => path.d).join(" ") : void 0;
|
|
904
|
+
}
|
|
905
|
+
var NO_STROKE = {
|
|
906
|
+
borderWidth: 0,
|
|
907
|
+
cssBorderWidth: "0px",
|
|
908
|
+
borderStyle: void 0,
|
|
909
|
+
borderColor: void 0,
|
|
910
|
+
border: void 0,
|
|
911
|
+
strokeLinejoin: void 0,
|
|
912
|
+
strokeLinecap: void 0,
|
|
913
|
+
strokeMiterlimit: void 0
|
|
914
|
+
};
|
|
915
|
+
function svgLineJoin(join) {
|
|
916
|
+
switch (join) {
|
|
917
|
+
case "round":
|
|
918
|
+
return "round";
|
|
919
|
+
case "bevel":
|
|
920
|
+
return "bevel";
|
|
921
|
+
case "miter":
|
|
922
|
+
return "miter";
|
|
923
|
+
default:
|
|
924
|
+
return void 0;
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
function svgStrokeLineCap(cap) {
|
|
928
|
+
switch (cap) {
|
|
929
|
+
case "rnd":
|
|
930
|
+
return "round";
|
|
931
|
+
case "sq":
|
|
932
|
+
return "square";
|
|
933
|
+
case "flat":
|
|
934
|
+
return "butt";
|
|
935
|
+
default:
|
|
936
|
+
return void 0;
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
function strokeMiterLimit(style) {
|
|
940
|
+
if (style?.lineJoin !== "miter" || typeof style.miterLimit !== "number") {
|
|
941
|
+
return void 0;
|
|
942
|
+
}
|
|
943
|
+
if (!Number.isFinite(style.miterLimit)) {
|
|
944
|
+
return void 0;
|
|
945
|
+
}
|
|
946
|
+
return Math.max(style.miterLimit / 1e5, 1);
|
|
947
|
+
}
|
|
948
|
+
function getComputedStrokeStyle(element) {
|
|
949
|
+
if (!hasShapeProperties(element)) {
|
|
950
|
+
return NO_STROKE;
|
|
951
|
+
}
|
|
952
|
+
const style = element.shapeStyle;
|
|
953
|
+
const width = suppressesCssBorder(element) ? 0 : paintedStrokeWidth(style);
|
|
954
|
+
const joins = {
|
|
955
|
+
strokeLinejoin: svgLineJoin(style?.lineJoin),
|
|
956
|
+
strokeLinecap: svgStrokeLineCap(style?.lineCap),
|
|
957
|
+
strokeMiterlimit: strokeMiterLimit(style)
|
|
958
|
+
};
|
|
959
|
+
if (width <= 0 || !style) {
|
|
960
|
+
return { ...NO_STROKE, ...joins };
|
|
961
|
+
}
|
|
962
|
+
const borderWidth = width;
|
|
963
|
+
const borderStyle = getCssBorderDashStyle(
|
|
964
|
+
normalizeStrokeDashType(style.strokeDash),
|
|
965
|
+
style.compoundLine
|
|
966
|
+
);
|
|
967
|
+
const rawColor = style.strokeColor ?? DEFAULT_STROKE_COLOR;
|
|
968
|
+
const borderColor = style.strokeOpacity === void 0 ? rawColor : colorWithOpacity(normalizeHexColor(rawColor, DEFAULT_STROKE_COLOR), style.strokeOpacity);
|
|
969
|
+
return {
|
|
970
|
+
borderWidth,
|
|
971
|
+
cssBorderWidth: screenBorderWidth(borderWidth),
|
|
972
|
+
borderStyle,
|
|
973
|
+
borderColor,
|
|
974
|
+
border: screenBorder(borderWidth, borderStyle ?? "solid", borderColor),
|
|
975
|
+
...joins
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
// src/pptx/render/svg-gradient-rect-path.ts
|
|
980
|
+
function buildRectPathGradientDef(stops, id, focalPoint, fillToRect) {
|
|
981
|
+
const rectStops = stops.map((stop) => ({
|
|
982
|
+
position: Math.round(stop.offset * 100 * 1e4) / 1e4,
|
|
983
|
+
color: stop.color,
|
|
984
|
+
...typeof stop.opacity === "number" ? { opacity: stop.opacity } : {}
|
|
985
|
+
}));
|
|
986
|
+
const markup = buildRectPathGradientExactSvg(rectStops, focalPoint, fillToRect);
|
|
987
|
+
return { kind: "rectPath", id, href: `data:image/svg+xml,${encodeURIComponent(markup)}` };
|
|
988
|
+
}
|
|
989
|
+
function rectPathGradientMarkup(def) {
|
|
990
|
+
const id = escapeSvgAttr(def.id);
|
|
991
|
+
const href = escapeSvgAttr(def.href);
|
|
992
|
+
return `<pattern id="${id}" patternUnits="objectBoundingBox" patternContentUnits="objectBoundingBox" width="1" height="1"><image href="${href}" x="0" y="0" width="1" height="1" preserveAspectRatio="none"/></pattern>`;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
// src/pptx/render/svg-stroke-pattern-paint.ts
|
|
996
|
+
function buildSvgStrokePatternDef(style, elementId) {
|
|
997
|
+
if (!style || style.strokeFillMode !== "pattern" || !style.strokePatternPreset) {
|
|
998
|
+
return void 0;
|
|
999
|
+
}
|
|
1000
|
+
const fg = normalizeHexColor(style.strokeColor, "#000000");
|
|
1001
|
+
const bg = normalizeHexColor(style.strokePatternBackgroundColor, "#ffffff");
|
|
1002
|
+
const tile = getPatternTile(style.strokePatternPreset, fg, bg);
|
|
1003
|
+
if (!tile) {
|
|
1004
|
+
return void 0;
|
|
1005
|
+
}
|
|
1006
|
+
const markup = `<svg xmlns="http://www.w3.org/2000/svg" width="${tile.w}" height="${tile.h}">${tile.inner}</svg>`;
|
|
1007
|
+
return {
|
|
1008
|
+
kind: "pattern",
|
|
1009
|
+
id: svgGradientId(elementId, "strokepat"),
|
|
1010
|
+
width: tile.w,
|
|
1011
|
+
height: tile.h,
|
|
1012
|
+
href: `data:image/svg+xml,${encodeURIComponent(markup)}`
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
// src/pptx/render/svg-gradient-paint.ts
|
|
1017
|
+
function round4(value) {
|
|
1018
|
+
return Math.round(value * 1e4) / 1e4;
|
|
1019
|
+
}
|
|
1020
|
+
function svgGradientId(elementId, suffix = "grad") {
|
|
1021
|
+
const seed = String(elementId).replace(/[^a-zA-Z0-9_-]/gu, "_");
|
|
1022
|
+
return `pptx-${suffix}-${seed}`;
|
|
1023
|
+
}
|
|
1024
|
+
function toSvgStops(stops) {
|
|
1025
|
+
const sanitized = sanitizeGradientStops(stops);
|
|
1026
|
+
return (officeTwoStopGradientStops(sanitized) ?? sanitized).map((stop) => ({
|
|
1027
|
+
offset: round4(stop.position / 100),
|
|
1028
|
+
color: stop.color,
|
|
1029
|
+
...typeof stop.opacity === "number" ? { opacity: round4(stop.opacity) } : {}
|
|
1030
|
+
}));
|
|
1031
|
+
}
|
|
1032
|
+
function linearEndpoints(angleDegrees) {
|
|
1033
|
+
const radians = angleDegrees * Math.PI / 180;
|
|
1034
|
+
const dx = Math.cos(radians);
|
|
1035
|
+
const dy = Math.sin(radians);
|
|
1036
|
+
const span = (Math.abs(dx) + Math.abs(dy)) / 2;
|
|
1037
|
+
return {
|
|
1038
|
+
x1: round4(0.5 - dx * span),
|
|
1039
|
+
y1: round4(0.5 - dy * span),
|
|
1040
|
+
x2: round4(0.5 + dx * span),
|
|
1041
|
+
y2: round4(0.5 + dy * span)
|
|
1042
|
+
};
|
|
1043
|
+
}
|
|
1044
|
+
function imageDef(id, svg) {
|
|
1045
|
+
return { kind: "rectPath", id, href: `data:image/svg+xml,${encodeURIComponent(svg)}` };
|
|
1046
|
+
}
|
|
1047
|
+
function buildFromSource(source, id) {
|
|
1048
|
+
const { stops } = source;
|
|
1049
|
+
if (stops.length === 0) {
|
|
1050
|
+
return void 0;
|
|
1051
|
+
}
|
|
1052
|
+
if ((source.type || "linear") === "radial") {
|
|
1053
|
+
if ((source.pathType || "circle") === "rect") {
|
|
1054
|
+
return buildRectPathGradientDef(stops, id, source.focalPoint, source.fillToRect);
|
|
1055
|
+
}
|
|
1056
|
+
const { cx, cy } = computeGradientCenter(source.fillToRect, source.focalPoint);
|
|
1057
|
+
const fx = cx / 100;
|
|
1058
|
+
const fy = cy / 100;
|
|
1059
|
+
if (source.bounds) {
|
|
1060
|
+
const { width, height } = source.bounds;
|
|
1061
|
+
const imageStops = stops.map((stop) => ({
|
|
1062
|
+
color: stop.color,
|
|
1063
|
+
position: stop.offset * 100,
|
|
1064
|
+
...typeof stop.opacity === "number" ? { opacity: stop.opacity } : {}
|
|
1065
|
+
}));
|
|
1066
|
+
return imageDef(id, buildFocalCircleGradientSvg(imageStops, fx, fy, width, height));
|
|
1067
|
+
}
|
|
1068
|
+
const r = Math.hypot(Math.max(fx, 1 - fx), Math.max(fy, 1 - fy));
|
|
1069
|
+
return { kind: "radial", id, cx: round4(fx), cy: round4(fy), r: round4(r), stops };
|
|
1070
|
+
}
|
|
1071
|
+
const angle = typeof source.angle === "number" && Number.isFinite(source.angle) ? source.angle : 90;
|
|
1072
|
+
const { bounds } = source;
|
|
1073
|
+
if (bounds && source.scaled === false && Math.abs(bounds.width - bounds.height) >= 0.5 && Math.abs(angle % 90) > 0.01) {
|
|
1074
|
+
const imageStops = stops.map((stop) => ({
|
|
1075
|
+
color: stop.color,
|
|
1076
|
+
position: stop.offset * 100,
|
|
1077
|
+
...typeof stop.opacity === "number" ? { opacity: stop.opacity } : {}
|
|
1078
|
+
}));
|
|
1079
|
+
return imageDef(
|
|
1080
|
+
id,
|
|
1081
|
+
buildTrueAngleLinearGradientSvg(imageStops, angle, bounds.width, bounds.height)
|
|
1082
|
+
);
|
|
1083
|
+
}
|
|
1084
|
+
return { kind: "linear", id, ...linearEndpoints(angle), stops };
|
|
1085
|
+
}
|
|
1086
|
+
function buildSvgGradientDef(style, elementId, bounds) {
|
|
1087
|
+
if (!style || style.fillMode !== "gradient") {
|
|
1088
|
+
return void 0;
|
|
1089
|
+
}
|
|
1090
|
+
return buildFromSource(
|
|
1091
|
+
{
|
|
1092
|
+
stops: toSvgStops(style.fillGradientStops),
|
|
1093
|
+
type: style.fillGradientType,
|
|
1094
|
+
pathType: style.fillGradientPathType,
|
|
1095
|
+
angle: style.fillGradientAngle,
|
|
1096
|
+
fillToRect: style.fillGradientFillToRect,
|
|
1097
|
+
focalPoint: style.fillGradientFocalPoint,
|
|
1098
|
+
scaled: style.fillGradientScaled,
|
|
1099
|
+
bounds: bounds && bounds.width > 0 && bounds.height > 0 ? bounds : void 0
|
|
1100
|
+
},
|
|
1101
|
+
svgGradientId(elementId)
|
|
1102
|
+
);
|
|
1103
|
+
}
|
|
1104
|
+
function buildSvgStrokeGradientDef(style, elementId) {
|
|
1105
|
+
if (!style || style.strokeFillMode !== "gradient") {
|
|
1106
|
+
return void 0;
|
|
1107
|
+
}
|
|
1108
|
+
return buildFromSource(
|
|
1109
|
+
{
|
|
1110
|
+
stops: toSvgStops(style.strokeGradientStops),
|
|
1111
|
+
type: style.strokeGradientType,
|
|
1112
|
+
pathType: style.strokeGradientPathType,
|
|
1113
|
+
angle: style.strokeGradientAngle
|
|
1114
|
+
},
|
|
1115
|
+
svgGradientId(elementId, "stroke")
|
|
1116
|
+
);
|
|
1117
|
+
}
|
|
1118
|
+
function svgGradientFillRef(def) {
|
|
1119
|
+
return `url(#${def.id})`;
|
|
1120
|
+
}
|
|
1121
|
+
function numAttr(value) {
|
|
1122
|
+
return escapeSvgAttr(String(Number.isFinite(value) ? value : 0));
|
|
1123
|
+
}
|
|
1124
|
+
function svgGradientMarkup(def) {
|
|
1125
|
+
if (def.kind === "rectPath") {
|
|
1126
|
+
return rectPathGradientMarkup(def);
|
|
1127
|
+
}
|
|
1128
|
+
const id = escapeSvgAttr(def.id);
|
|
1129
|
+
const stops = def.stops.map(
|
|
1130
|
+
(stop) => `<stop offset="${numAttr(stop.offset)}" stop-color="${escapeSvgAttr(stop.color)}"${typeof stop.opacity === "number" ? ` stop-opacity="${numAttr(stop.opacity)}"` : ""}/>`
|
|
1131
|
+
).join("");
|
|
1132
|
+
if (def.kind === "radial") {
|
|
1133
|
+
return `<radialGradient id="${id}" cx="${numAttr(def.cx)}" cy="${numAttr(def.cy)}" r="${numAttr(def.r)}">${stops}</radialGradient>`;
|
|
1134
|
+
}
|
|
1135
|
+
return `<linearGradient id="${id}" x1="${numAttr(def.x1)}" y1="${numAttr(def.y1)}" x2="${numAttr(def.x2)}" y2="${numAttr(def.y2)}">${stops}</linearGradient>`;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
// src/pptx/render/stroke-outline.ts
|
|
1139
|
+
var DEFAULT_OPEN_PRESET_STROKE_WIDTH = 2;
|
|
1140
|
+
function isPatternPaint(paint) {
|
|
1141
|
+
return paint?.kind === "pattern";
|
|
1142
|
+
}
|
|
1143
|
+
function outlinePathData(clipPath, width, height) {
|
|
1144
|
+
if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) {
|
|
1145
|
+
return void 0;
|
|
1146
|
+
}
|
|
1147
|
+
const rect = `M 0 0 L ${width} 0 L ${width} ${height} L 0 ${height} Z`;
|
|
1148
|
+
if (!clipPath) {
|
|
1149
|
+
return rect;
|
|
1150
|
+
}
|
|
1151
|
+
const asPath = /^path\('(.*)'\)$/su.exec(clipPath.trim());
|
|
1152
|
+
if (asPath) {
|
|
1153
|
+
return asPath[1];
|
|
1154
|
+
}
|
|
1155
|
+
const asPolygon = /^polygon\((.*)\)$/su.exec(clipPath.trim());
|
|
1156
|
+
if (asPolygon) {
|
|
1157
|
+
const points = asPolygon[1].split(",").map((pair) => pair.trim().split(/\s+/u)).filter((parts) => parts.length === 2).map(([rawX, rawY]) => {
|
|
1158
|
+
const toPx = (token, extent) => token.endsWith("%") ? Number.parseFloat(token) / 100 * extent : Number.parseFloat(token);
|
|
1159
|
+
return [toPx(rawX, width), toPx(rawY, height)];
|
|
1160
|
+
}).filter(([x, y]) => Number.isFinite(x) && Number.isFinite(y));
|
|
1161
|
+
if (points.length < 3) {
|
|
1162
|
+
return rect;
|
|
1163
|
+
}
|
|
1164
|
+
const [first, ...rest] = points;
|
|
1165
|
+
return `M ${first[0]} ${first[1]} ${rest.map(([x, y]) => `L ${x} ${y}`).join(" ")} Z`;
|
|
1166
|
+
}
|
|
1167
|
+
return rect;
|
|
1168
|
+
}
|
|
1169
|
+
var WEDGE_CALLOUT_PRESET_NAMES = /* @__PURE__ */ new Set([
|
|
1170
|
+
"wedgerectcallout",
|
|
1171
|
+
"wedgeroundrectcallout",
|
|
1172
|
+
"wedgeellipsecallout"
|
|
1173
|
+
]);
|
|
1174
|
+
function isWedgeCalloutPresetShape(shapeType) {
|
|
1175
|
+
return typeof shapeType === "string" && WEDGE_CALLOUT_PRESET_NAMES.has(shapeType.toLowerCase());
|
|
1176
|
+
}
|
|
1177
|
+
function clipPathPolygonPoints(clipPath, width, height) {
|
|
1178
|
+
const asPolygon = /^polygon\((.*)\)$/su.exec(clipPath.trim());
|
|
1179
|
+
if (!asPolygon) {
|
|
1180
|
+
return [];
|
|
1181
|
+
}
|
|
1182
|
+
const toPx = (token, extent) => token.endsWith("%") ? Number.parseFloat(token) / 100 * extent : Number.parseFloat(token);
|
|
1183
|
+
return asPolygon[1].split(",").map((pair) => pair.trim().split(/\s+/u)).filter((parts) => parts.length === 2).map(([rawX, rawY]) => [toPx(rawX, width), toPx(rawY, height)]).filter(([x, y]) => Number.isFinite(x) && Number.isFinite(y));
|
|
1184
|
+
}
|
|
1185
|
+
function getPresetShapeVectorGeometry(shapeType, width, height, adjustments) {
|
|
1186
|
+
const normalizedWidth = Math.max(Number.isFinite(width) ? width : 0, 1);
|
|
1187
|
+
const normalizedHeight = Math.max(Number.isFinite(height) ? height : 0, 1);
|
|
1188
|
+
const clipPath = getResolvedShapeClipPathFor(
|
|
1189
|
+
shapeType,
|
|
1190
|
+
normalizedWidth,
|
|
1191
|
+
normalizedHeight,
|
|
1192
|
+
adjustments
|
|
1193
|
+
);
|
|
1194
|
+
const d = outlinePathData(clipPath, normalizedWidth, normalizedHeight);
|
|
1195
|
+
if (!d) {
|
|
1196
|
+
return void 0;
|
|
1197
|
+
}
|
|
1198
|
+
let minX = 0;
|
|
1199
|
+
let minY = 0;
|
|
1200
|
+
let maxX = normalizedWidth;
|
|
1201
|
+
let maxY = normalizedHeight;
|
|
1202
|
+
for (const [x, y] of clipPath ? clipPathPolygonPoints(clipPath, normalizedWidth, normalizedHeight) : []) {
|
|
1203
|
+
minX = Math.min(minX, x);
|
|
1204
|
+
minY = Math.min(minY, y);
|
|
1205
|
+
maxX = Math.max(maxX, x);
|
|
1206
|
+
maxY = Math.max(maxY, y);
|
|
1207
|
+
}
|
|
1208
|
+
return {
|
|
1209
|
+
d,
|
|
1210
|
+
minX,
|
|
1211
|
+
minY,
|
|
1212
|
+
maxX,
|
|
1213
|
+
maxY,
|
|
1214
|
+
viewWidth: Math.max(maxX - minX, 1),
|
|
1215
|
+
viewHeight: Math.max(maxY - minY, 1)
|
|
1216
|
+
};
|
|
1217
|
+
}
|
|
1218
|
+
function outlineStrands(compoundLine, strokeWidth) {
|
|
1219
|
+
const offsets = getCompoundLineOffsets(compoundLine, strokeWidth);
|
|
1220
|
+
if (offsets.length <= 1) {
|
|
1221
|
+
return [{ strokeWidth, cssStrokeWidth: screenStrokeWidth(strokeWidth), offset: 0 }];
|
|
1222
|
+
}
|
|
1223
|
+
const widths = getCompoundLineWidths(compoundLine, strokeWidth);
|
|
1224
|
+
return offsets.map((offset, idx) => {
|
|
1225
|
+
const width = widths[idx] ?? strokeWidth;
|
|
1226
|
+
return { strokeWidth: width, cssStrokeWidth: screenBorderWidth(width), offset };
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1229
|
+
function needsCenteredStrokeOverlay(element, style, declaredWidth) {
|
|
1230
|
+
if (!style || declaredWidth <= 0 || element.type === "connector" || !hasStrokePaint(style)) {
|
|
1231
|
+
return false;
|
|
1232
|
+
}
|
|
1233
|
+
const shapeType = getShapeType(element.shapeType);
|
|
1234
|
+
if (shapeType === "line") {
|
|
1235
|
+
return false;
|
|
1236
|
+
}
|
|
1237
|
+
return style.lineAlignment !== "in";
|
|
1238
|
+
}
|
|
1239
|
+
function clipEdgeBleed(element, d, style) {
|
|
1240
|
+
if ((style?.strokeOpacity ?? 1) < 1 || element.type === "picture" || element.type === "image" || isArrowedCustomPath(element) || // A silhouette shape keeps no clip on its container (its fill is the SVG
|
|
1241
|
+
// overlay's), so there is no cut to cover; and the filter shadows the painted
|
|
1242
|
+
// alpha, which the hairline would thicken (a hollow triangle's shadow read
|
|
1243
|
+
// 25 % darker than PowerPoint's).
|
|
1244
|
+
usesSilhouetteEffects(element)) {
|
|
1245
|
+
return void 0;
|
|
1246
|
+
}
|
|
1247
|
+
const width = straddlingStrokeWidth(element);
|
|
1248
|
+
const shapeType = getShapeType(element.shapeType);
|
|
1249
|
+
if (width <= 0 || shapeType === "roundRect" || shapeType === "ellipse" || isIdentityRectClip(element) || getResolvedShapeClipPath(element) === void 0) {
|
|
1250
|
+
return void 0;
|
|
1251
|
+
}
|
|
1252
|
+
const edge = outerStrokeEdgePath(d, width, outlineStrokeJoin(element));
|
|
1253
|
+
return edge ? {
|
|
1254
|
+
d: edge,
|
|
1255
|
+
strokeWidth: 1,
|
|
1256
|
+
cssStrokeWidth: `max(1px, calc(2 * var(${DEVICE_PX_VAR}, 0px)))`,
|
|
1257
|
+
offset: 0
|
|
1258
|
+
} : void 0;
|
|
1259
|
+
}
|
|
1260
|
+
function insetLineOnClippedShape(element, style, declaredWidth) {
|
|
1261
|
+
if (!style || style.lineAlignment !== "in" || declaredWidth <= 0 || element.type === "connector" || element.type === "picture" || element.type === "image" || !hasStrokePaint(style)) {
|
|
1262
|
+
return false;
|
|
1263
|
+
}
|
|
1264
|
+
const shapeType = getShapeType(element.shapeType);
|
|
1265
|
+
if (shapeType === "line" || shapeType === "roundRect" || shapeType === "ellipse") {
|
|
1266
|
+
return false;
|
|
1267
|
+
}
|
|
1268
|
+
return !isIdentityRectClip(element) && getResolvedShapeClipPath(element) !== void 0;
|
|
1269
|
+
}
|
|
1270
|
+
function straddlingStrokeWidth(element) {
|
|
1271
|
+
if (!hasShapeProperties(element)) {
|
|
1272
|
+
return 0;
|
|
1273
|
+
}
|
|
1274
|
+
const style = element.shapeStyle;
|
|
1275
|
+
const width = Math.max(0, style?.strokeWidth ?? 0);
|
|
1276
|
+
if (!needsCenteredStrokeOverlay(element, style, width)) {
|
|
1277
|
+
return 0;
|
|
1278
|
+
}
|
|
1279
|
+
const dash = normalizeStrokeDashType(style?.strokeDash);
|
|
1280
|
+
return !dash || dash === "solid" ? width : 0;
|
|
1281
|
+
}
|
|
1282
|
+
function outlineStrokeJoin(element) {
|
|
1283
|
+
const style = hasShapeProperties(element) ? element.shapeStyle : void 0;
|
|
1284
|
+
const join = style?.lineJoin === "bevel" ? "bevel" : style?.lineJoin === "miter" ? "miter" : "round";
|
|
1285
|
+
return { join, miterLimit: strokeMiterLimit(style) ?? 4 };
|
|
1286
|
+
}
|
|
1287
|
+
function snapTransform(element, isOpenPreset, strokeWidth) {
|
|
1288
|
+
if (element.rotation) {
|
|
1289
|
+
return void 0;
|
|
1290
|
+
}
|
|
1291
|
+
const place = snapPlacement(element);
|
|
1292
|
+
if (!place) {
|
|
1293
|
+
return void 0;
|
|
1294
|
+
}
|
|
1295
|
+
const shapeType = getShapeType(element.shapeType);
|
|
1296
|
+
if (isOpenPreset) {
|
|
1297
|
+
if (shapeType !== "line") {
|
|
1298
|
+
return void 0;
|
|
1299
|
+
}
|
|
1300
|
+
const axis = element.height === 0 ? "h" : element.width === 0 ? "v" : void 0;
|
|
1301
|
+
return axis ? snappedStrokeTransform(
|
|
1302
|
+
axis,
|
|
1303
|
+
place.x,
|
|
1304
|
+
place.y,
|
|
1305
|
+
strokeWidth,
|
|
1306
|
+
void 0,
|
|
1307
|
+
place.exact,
|
|
1308
|
+
isDashedStroke(hasShapeProperties(element) ? element.shapeStyle?.strokeDash : void 0)
|
|
1309
|
+
) : void 0;
|
|
1310
|
+
}
|
|
1311
|
+
return shapeType === "rect" ? snappedStrokeTransform(
|
|
1312
|
+
"box",
|
|
1313
|
+
place.x,
|
|
1314
|
+
place.y,
|
|
1315
|
+
strokeWidth,
|
|
1316
|
+
{ width: element.width, height: element.height },
|
|
1317
|
+
place.exact
|
|
1318
|
+
) : void 0;
|
|
1319
|
+
}
|
|
1320
|
+
function buildStrokeOutline(element) {
|
|
1321
|
+
if (!hasShapeProperties(element)) {
|
|
1322
|
+
return void 0;
|
|
1323
|
+
}
|
|
1324
|
+
const style = element.shapeStyle;
|
|
1325
|
+
const declaredWidth = Math.max(0, style?.strokeWidth ?? 0);
|
|
1326
|
+
const openPresetD = strokeOnlyPresetPathData(element);
|
|
1327
|
+
if (!openPresetD && (!style || declaredWidth <= 0)) {
|
|
1328
|
+
return void 0;
|
|
1329
|
+
}
|
|
1330
|
+
const paint = style && declaredWidth > 0 ? buildSvgStrokeGradientDef(style, element.id) ?? buildSvgStrokePatternDef(style, element.id) : void 0;
|
|
1331
|
+
const splitD = !openPresetD && declaredWidth > 0 ? splitStrokePresetPathData(element) : void 0;
|
|
1332
|
+
const ownPathD = openPresetD ?? splitD;
|
|
1333
|
+
const insetOnClip = !ownPathD && insetLineOnClippedShape(element, style, declaredWidth);
|
|
1334
|
+
const centeredFlatStroke = !paint && !ownPathD && (isArrowedCustomPath(element) || needsCenteredStrokeOverlay(element, style, declaredWidth));
|
|
1335
|
+
if (!paint && !ownPathD && !centeredFlatStroke && !insetOnClip) {
|
|
1336
|
+
return void 0;
|
|
1337
|
+
}
|
|
1338
|
+
const d = ownPathD ?? outlinePathData(getResolvedShapeClipPath(element), element.width, element.height);
|
|
1339
|
+
if (!d) {
|
|
1340
|
+
return void 0;
|
|
1341
|
+
}
|
|
1342
|
+
const lineWidth = declaredWidth > 0 ? declaredWidth : DEFAULT_OPEN_PRESET_STROKE_WIDTH;
|
|
1343
|
+
const strokeWidth = insetOnClip ? lineWidth * 2 : lineWidth;
|
|
1344
|
+
const stroke = paint ? svgGradientFillRef(paint) : colorWithOpacity(style?.strokeColor ?? DEFAULT_STROKE_COLOR, style?.strokeOpacity);
|
|
1345
|
+
const strands = traceCompoundStrands(
|
|
1346
|
+
outlineStrands(style?.compoundLine, strokeWidth),
|
|
1347
|
+
d,
|
|
1348
|
+
outlineStrokeJoin(element)
|
|
1349
|
+
);
|
|
1350
|
+
const bleed = !ownPathD ? clipEdgeBleed(element, d, style) : void 0;
|
|
1351
|
+
const snap = paint || strands.length !== 1 ? void 0 : snapTransform(element, !!openPresetD, strokeWidth);
|
|
1352
|
+
const snapped = snap ? strands.map((strand) => ({ ...strand, cssTransform: snap })) : strands;
|
|
1353
|
+
const dashStartD = !ownPathD && isDashedStroke(style?.strokeDash) ? dashStartPathData(d, element.shapeType) : d;
|
|
1354
|
+
const markers = buildCustomPathMarkers(element, stroke);
|
|
1355
|
+
const dashedD = ownPathD && !markers && isDashedStroke(style?.strokeDash) ? squareCapDashedPathData(
|
|
1356
|
+
dashStartD,
|
|
1357
|
+
Math.max(lineWidth, 1),
|
|
1358
|
+
style?.strokeDash,
|
|
1359
|
+
style?.lineCap,
|
|
1360
|
+
style?.customDashSegments
|
|
1361
|
+
) : dashStartD;
|
|
1362
|
+
return {
|
|
1363
|
+
markers,
|
|
1364
|
+
d: dashedD,
|
|
1365
|
+
paint,
|
|
1366
|
+
stroke,
|
|
1367
|
+
strokeWidth,
|
|
1368
|
+
strands: bleed ? [...snapped, bleed] : snapped,
|
|
1369
|
+
dashArray: getSvgStrokeDasharray(
|
|
1370
|
+
normalizeStrokeDashType(style?.strokeDash),
|
|
1371
|
+
Math.max(lineWidth, 1),
|
|
1372
|
+
style?.customDashSegments,
|
|
1373
|
+
style?.lineCap
|
|
1374
|
+
),
|
|
1375
|
+
lineCap: svgLineCap(style?.lineCap, isDashedStroke(style?.strokeDash)),
|
|
1376
|
+
lineJoin: outlineStrokeJoin(element).join
|
|
1377
|
+
};
|
|
1378
|
+
}
|
|
1379
|
+
function strokeOutlineViewBox(element) {
|
|
1380
|
+
const width = Math.max(element.width, 0);
|
|
1381
|
+
const height = Math.max(element.height, 0);
|
|
1382
|
+
if (width < 1 || height < 1) {
|
|
1383
|
+
return void 0;
|
|
1384
|
+
}
|
|
1385
|
+
return `0 0 ${width} ${height}`;
|
|
1386
|
+
}
|
|
1387
|
+
function suppressesCssBorder(element) {
|
|
1388
|
+
return buildStrokeOutline(element) !== void 0;
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
// src/pptx/render/stroke-clip-outset.ts
|
|
1392
|
+
var SVG_DEFAULT_JOIN = { join: "miter", miterLimit: 4 };
|
|
1393
|
+
var ROUND_JOIN_STEPS2 = 16;
|
|
1394
|
+
var CURVE_STEPS = 16;
|
|
1395
|
+
function flattenArc(from, rx, ry, rotationDeg, largeArc, sweep, to) {
|
|
1396
|
+
if (rx === 0 || ry === 0 || from[0] === to[0] && from[1] === to[1]) {
|
|
1397
|
+
return [to];
|
|
1398
|
+
}
|
|
1399
|
+
const phi = rotationDeg * Math.PI / 180;
|
|
1400
|
+
const cosPhi = Math.cos(phi);
|
|
1401
|
+
const sinPhi = Math.sin(phi);
|
|
1402
|
+
const dx = (from[0] - to[0]) / 2;
|
|
1403
|
+
const dy = (from[1] - to[1]) / 2;
|
|
1404
|
+
const x1 = cosPhi * dx + sinPhi * dy;
|
|
1405
|
+
const y1 = -sinPhi * dx + cosPhi * dy;
|
|
1406
|
+
let radiusX = Math.abs(rx);
|
|
1407
|
+
let radiusY = Math.abs(ry);
|
|
1408
|
+
const lambda = x1 * x1 / (radiusX * radiusX) + y1 * y1 / (radiusY * radiusY);
|
|
1409
|
+
if (lambda > 1) {
|
|
1410
|
+
const scale = Math.sqrt(lambda);
|
|
1411
|
+
radiusX *= scale;
|
|
1412
|
+
radiusY *= scale;
|
|
1413
|
+
}
|
|
1414
|
+
const numerator = radiusX * radiusX * radiusY * radiusY - radiusX * radiusX * y1 * y1 - radiusY * radiusY * x1 * x1;
|
|
1415
|
+
const denominator = radiusX * radiusX * y1 * y1 + radiusY * radiusY * x1 * x1;
|
|
1416
|
+
const coefficient = (largeArc === sweep ? -1 : 1) * Math.sqrt(Math.max(0, numerator / denominator));
|
|
1417
|
+
const cxp = coefficient * radiusX * y1 / radiusY;
|
|
1418
|
+
const cyp = -coefficient * radiusY * x1 / radiusX;
|
|
1419
|
+
const cx = cosPhi * cxp - sinPhi * cyp + (from[0] + to[0]) / 2;
|
|
1420
|
+
const cy = sinPhi * cxp + cosPhi * cyp + (from[1] + to[1]) / 2;
|
|
1421
|
+
const angle = (ux, uy, vx, vy) => {
|
|
1422
|
+
const sign = ux * vy - uy * vx < 0 ? -1 : 1;
|
|
1423
|
+
const dot = (ux * vx + uy * vy) / (Math.hypot(ux, uy) * Math.hypot(vx, vy));
|
|
1424
|
+
return sign * Math.acos(Math.max(-1, Math.min(1, dot)));
|
|
1425
|
+
};
|
|
1426
|
+
const theta1 = angle(1, 0, (x1 - cxp) / radiusX, (y1 - cyp) / radiusY);
|
|
1427
|
+
let delta = angle(
|
|
1428
|
+
(x1 - cxp) / radiusX,
|
|
1429
|
+
(y1 - cyp) / radiusY,
|
|
1430
|
+
(-x1 - cxp) / radiusX,
|
|
1431
|
+
(-y1 - cyp) / radiusY
|
|
1432
|
+
);
|
|
1433
|
+
if (!sweep && delta > 0) {
|
|
1434
|
+
delta -= 2 * Math.PI;
|
|
1435
|
+
} else if (sweep && delta < 0) {
|
|
1436
|
+
delta += 2 * Math.PI;
|
|
1437
|
+
}
|
|
1438
|
+
const out = [];
|
|
1439
|
+
for (let step = 1; step <= CURVE_STEPS; step++) {
|
|
1440
|
+
const t = theta1 + delta * step / CURVE_STEPS;
|
|
1441
|
+
const px2 = radiusX * Math.cos(t);
|
|
1442
|
+
const py = radiusY * Math.sin(t);
|
|
1443
|
+
out.push([cosPhi * px2 - sinPhi * py + cx, sinPhi * px2 + cosPhi * py + cy]);
|
|
1444
|
+
}
|
|
1445
|
+
return out;
|
|
1446
|
+
}
|
|
1447
|
+
function flattenPath(d) {
|
|
1448
|
+
const tokens = d.match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/giu);
|
|
1449
|
+
if (!tokens) {
|
|
1450
|
+
return void 0;
|
|
1451
|
+
}
|
|
1452
|
+
const subpaths = [];
|
|
1453
|
+
let current = [];
|
|
1454
|
+
let pos = [0, 0];
|
|
1455
|
+
let start = [0, 0];
|
|
1456
|
+
let i = 0;
|
|
1457
|
+
let command = "";
|
|
1458
|
+
const num3 = () => Number.parseFloat(tokens[i++] ?? "NaN");
|
|
1459
|
+
while (i < tokens.length) {
|
|
1460
|
+
const token = tokens[i];
|
|
1461
|
+
if (/^[A-Za-z]$/u.test(token)) {
|
|
1462
|
+
command = token;
|
|
1463
|
+
i++;
|
|
1464
|
+
if (command === "Z" || command === "z") {
|
|
1465
|
+
if (current.length > 1) {
|
|
1466
|
+
subpaths.push(current);
|
|
1467
|
+
}
|
|
1468
|
+
current = [];
|
|
1469
|
+
pos = start;
|
|
1470
|
+
continue;
|
|
1471
|
+
}
|
|
1472
|
+
} else if (command === "M") {
|
|
1473
|
+
command = "L";
|
|
1474
|
+
}
|
|
1475
|
+
switch (command) {
|
|
1476
|
+
case "M":
|
|
1477
|
+
if (current.length > 1) {
|
|
1478
|
+
subpaths.push(current);
|
|
1479
|
+
}
|
|
1480
|
+
pos = [num3(), num3()];
|
|
1481
|
+
start = pos;
|
|
1482
|
+
current = [pos];
|
|
1483
|
+
break;
|
|
1484
|
+
case "L":
|
|
1485
|
+
pos = [num3(), num3()];
|
|
1486
|
+
current.push(pos);
|
|
1487
|
+
break;
|
|
1488
|
+
case "H":
|
|
1489
|
+
pos = [num3(), pos[1]];
|
|
1490
|
+
current.push(pos);
|
|
1491
|
+
break;
|
|
1492
|
+
case "V":
|
|
1493
|
+
pos = [pos[0], num3()];
|
|
1494
|
+
current.push(pos);
|
|
1495
|
+
break;
|
|
1496
|
+
case "C": {
|
|
1497
|
+
const p1 = [num3(), num3()];
|
|
1498
|
+
const p2 = [num3(), num3()];
|
|
1499
|
+
const p3 = [num3(), num3()];
|
|
1500
|
+
for (let step = 1; step <= CURVE_STEPS; step++) {
|
|
1501
|
+
const t = step / CURVE_STEPS;
|
|
1502
|
+
const u = 1 - t;
|
|
1503
|
+
current.push([
|
|
1504
|
+
u * u * u * pos[0] + 3 * u * u * t * p1[0] + 3 * u * t * t * p2[0] + t * t * t * p3[0],
|
|
1505
|
+
u * u * u * pos[1] + 3 * u * u * t * p1[1] + 3 * u * t * t * p2[1] + t * t * t * p3[1]
|
|
1506
|
+
]);
|
|
1507
|
+
}
|
|
1508
|
+
pos = p3;
|
|
1509
|
+
break;
|
|
1510
|
+
}
|
|
1511
|
+
case "Q": {
|
|
1512
|
+
const p1 = [num3(), num3()];
|
|
1513
|
+
const p2 = [num3(), num3()];
|
|
1514
|
+
for (let step = 1; step <= CURVE_STEPS; step++) {
|
|
1515
|
+
const t = step / CURVE_STEPS;
|
|
1516
|
+
const u = 1 - t;
|
|
1517
|
+
current.push([
|
|
1518
|
+
u * u * pos[0] + 2 * u * t * p1[0] + t * t * p2[0],
|
|
1519
|
+
u * u * pos[1] + 2 * u * t * p1[1] + t * t * p2[1]
|
|
1520
|
+
]);
|
|
1521
|
+
}
|
|
1522
|
+
pos = p2;
|
|
1523
|
+
break;
|
|
1524
|
+
}
|
|
1525
|
+
case "A": {
|
|
1526
|
+
const rx = num3();
|
|
1527
|
+
const ry = num3();
|
|
1528
|
+
const rotation = num3();
|
|
1529
|
+
const largeArc = num3() !== 0;
|
|
1530
|
+
const sweep = num3() !== 0;
|
|
1531
|
+
const to = [num3(), num3()];
|
|
1532
|
+
current.push(...flattenArc(pos, rx, ry, rotation, largeArc, sweep, to));
|
|
1533
|
+
pos = to;
|
|
1534
|
+
break;
|
|
1535
|
+
}
|
|
1536
|
+
default:
|
|
1537
|
+
return void 0;
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
if (current.length > 1) {
|
|
1541
|
+
subpaths.push(current);
|
|
1542
|
+
}
|
|
1543
|
+
return subpaths.every((sub) => sub.every(([x, y]) => Number.isFinite(x) && Number.isFinite(y))) ? subpaths : void 0;
|
|
1544
|
+
}
|
|
1545
|
+
var fmt3 = (n) => String(Math.round(n * 1e3) / 1e3);
|
|
1546
|
+
function outsetClipPathForStroke(clipPath, strokeWidth, width, height, join = SVG_DEFAULT_JOIN) {
|
|
1547
|
+
if (!(strokeWidth > 0)) {
|
|
1548
|
+
return clipPath;
|
|
1549
|
+
}
|
|
1550
|
+
const d = outlinePathData(clipPath, width, height);
|
|
1551
|
+
const subpaths = d ? flattenPath(d) : void 0;
|
|
1552
|
+
if (!d || !subpaths || subpaths.length === 0) {
|
|
1553
|
+
return clipPath;
|
|
1554
|
+
}
|
|
1555
|
+
const half = strokeWidth / 2;
|
|
1556
|
+
const signedArea2 = (pts) => {
|
|
1557
|
+
let area = 0;
|
|
1558
|
+
for (let k = 0; k < pts.length; k++) {
|
|
1559
|
+
const a = pts[k];
|
|
1560
|
+
const b = pts[(k + 1) % pts.length];
|
|
1561
|
+
area += a[0] * b[1] - b[0] * a[1];
|
|
1562
|
+
}
|
|
1563
|
+
return area;
|
|
1564
|
+
};
|
|
1565
|
+
const reference = Math.sign(signedArea2(subpaths[0])) || 1;
|
|
1566
|
+
const quads = [];
|
|
1567
|
+
const push = (poly) => {
|
|
1568
|
+
const wound = Math.sign(signedArea2(poly)) === reference ? poly : [...poly].reverse();
|
|
1569
|
+
quads.push(`M ${wound.map(([x, y]) => `${fmt3(x)} ${fmt3(y)}`).join(" L ")} Z`);
|
|
1570
|
+
};
|
|
1571
|
+
for (const sub of subpaths) {
|
|
1572
|
+
const pts = sub;
|
|
1573
|
+
let last = [0, 0];
|
|
1574
|
+
const normals = pts.map((a, k) => {
|
|
1575
|
+
const b = pts[(k + 1) % pts.length];
|
|
1576
|
+
const len = Math.hypot(b[0] - a[0], b[1] - a[1]);
|
|
1577
|
+
if (len >= 1e-6) {
|
|
1578
|
+
last = [-(b[1] - a[1]) / len, (b[0] - a[0]) / len];
|
|
1579
|
+
}
|
|
1580
|
+
return last;
|
|
1581
|
+
});
|
|
1582
|
+
for (let k = 0; k < pts.length; k++) {
|
|
1583
|
+
const a = pts[k];
|
|
1584
|
+
const b = pts[(k + 1) % pts.length];
|
|
1585
|
+
const [nx, ny] = normals[k];
|
|
1586
|
+
push([
|
|
1587
|
+
[a[0] + nx * half, a[1] + ny * half],
|
|
1588
|
+
[b[0] + nx * half, b[1] + ny * half],
|
|
1589
|
+
[b[0] - nx * half, b[1] - ny * half],
|
|
1590
|
+
[a[0] - nx * half, a[1] - ny * half]
|
|
1591
|
+
]);
|
|
1592
|
+
push(joinPiece(b, normals[k], normals[(k + 1) % pts.length]));
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
function joinPiece(v, n1, n2) {
|
|
1596
|
+
if (join.join === "round") {
|
|
1597
|
+
const r = half / Math.cos(Math.PI / ROUND_JOIN_STEPS2);
|
|
1598
|
+
return Array.from({ length: ROUND_JOIN_STEPS2 }, (_, i) => {
|
|
1599
|
+
const t = 2 * Math.PI * i / ROUND_JOIN_STEPS2;
|
|
1600
|
+
return [v[0] + r * Math.cos(t), v[1] + r * Math.sin(t)];
|
|
1601
|
+
});
|
|
1602
|
+
}
|
|
1603
|
+
const turn = n1[0] * n2[1] - n1[1] * n2[0];
|
|
1604
|
+
if (Math.abs(turn) < 1e-9) {
|
|
1605
|
+
return [v, v, v, v];
|
|
1606
|
+
}
|
|
1607
|
+
const side = turn > 0 ? -1 : 1;
|
|
1608
|
+
const p1 = [v[0] + side * n1[0] * half, v[1] + side * n1[1] * half];
|
|
1609
|
+
const p2 = [v[0] + side * n2[0] * half, v[1] + side * n2[1] * half];
|
|
1610
|
+
const cosHalf = Math.sqrt(Math.max(0, (1 + n1[0] * n2[0] + n1[1] * n2[1]) / 2));
|
|
1611
|
+
if (join.join === "miter" && cosHalf > 0 && 1 / cosHalf <= join.miterLimit) {
|
|
1612
|
+
const bx = n1[0] + n2[0];
|
|
1613
|
+
const by = n1[1] + n2[1];
|
|
1614
|
+
const blen = Math.hypot(bx, by);
|
|
1615
|
+
const reach = half / cosHalf / blen;
|
|
1616
|
+
return [v, p1, [v[0] + side * bx * reach, v[1] + side * by * reach], p2];
|
|
1617
|
+
}
|
|
1618
|
+
return [v, p1, p2, p2];
|
|
1619
|
+
}
|
|
1620
|
+
return `path('${d} ${quads.join(" ")}')`;
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
// src/pptx/render/shape-geometry-base.ts
|
|
1624
|
+
var CYLINDER_RADIUS = "48% / 12%";
|
|
1625
|
+
var MIN_ROUND_RECT_RADIUS_PX = 0.01;
|
|
1626
|
+
function resolveBaseShapeGeometry(element) {
|
|
1627
|
+
const shapeType = getShapeType(element.shapeType);
|
|
1628
|
+
if (element.type === "connector" || shapeType === "connector") {
|
|
1629
|
+
return { kind: "bare" };
|
|
1630
|
+
}
|
|
1631
|
+
if (isStrokeOnlyPresetElement(element) || isArrowedCustomPath(element)) {
|
|
1632
|
+
return { kind: "strokeOnly" };
|
|
1633
|
+
}
|
|
1634
|
+
if (shapeType === "roundRect" && hasShapeProperties(element)) {
|
|
1635
|
+
const radiusPx = getRoundRectRadiusPx(element);
|
|
1636
|
+
return radiusPx > MIN_ROUND_RECT_RADIUS_PX ? { kind: "borderRadius", radius: `${radiusPx}px` } : { kind: "none" };
|
|
1637
|
+
}
|
|
1638
|
+
if (shapeType === "ellipse") {
|
|
1639
|
+
return { kind: "borderRadius", radius: "50%" };
|
|
1640
|
+
}
|
|
1641
|
+
const clipPath = isIdentityRectClip(element) ? void 0 : getResolvedShapeClipPath(element);
|
|
1642
|
+
if (clipPath) {
|
|
1643
|
+
const stroke = straddlingStrokeWidth(element);
|
|
1644
|
+
return {
|
|
1645
|
+
kind: "clipPath",
|
|
1646
|
+
clipPath: stroke > 0 ? outsetClipPathForStroke(
|
|
1647
|
+
clipPath,
|
|
1648
|
+
stroke,
|
|
1649
|
+
element.width,
|
|
1650
|
+
element.height,
|
|
1651
|
+
outlineStrokeJoin(element)
|
|
1652
|
+
) : clipPath
|
|
1653
|
+
};
|
|
1654
|
+
}
|
|
1655
|
+
if (shapeType === "line") {
|
|
1656
|
+
const authored = element.shapeStyle?.strokeWidth;
|
|
1657
|
+
return { kind: "lineEdge", strokeWidth: Math.max(Math.max(0, authored ?? 0), 2) };
|
|
1658
|
+
}
|
|
1659
|
+
if (shapeType === "cylinder") {
|
|
1660
|
+
return { kind: "borderRadius", radius: CYLINDER_RADIUS };
|
|
1661
|
+
}
|
|
1662
|
+
return { kind: "none" };
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
// src/pptx/render/silhouette-morph-registry.ts
|
|
1666
|
+
var entries = /* @__PURE__ */ new Map();
|
|
1667
|
+
function registerSilhouetteMorph(elementId, own, out, size) {
|
|
1668
|
+
entries.set(elementId, { params: own, ...size, own: JSON.stringify(own), out });
|
|
1669
|
+
}
|
|
1670
|
+
function silhouetteMorphEntry(elementId) {
|
|
1671
|
+
return entries.get(elementId);
|
|
1672
|
+
}
|
|
1673
|
+
function silhouetteMorphFor(elementId, own) {
|
|
1674
|
+
const entry = entries.get(elementId);
|
|
1675
|
+
return entry && entry.own === JSON.stringify(own) ? entry.out : void 0;
|
|
1676
|
+
}
|
|
1677
|
+
function paintedSize(element) {
|
|
1678
|
+
return {
|
|
1679
|
+
width: Math.max(element.width, 0),
|
|
1680
|
+
height: Math.max(element.height, 0)
|
|
1681
|
+
};
|
|
1682
|
+
}
|
|
1683
|
+
function needsPerSubpathPaint(subpaths) {
|
|
1684
|
+
return subpaths.some(
|
|
1685
|
+
(sp) => sp.fillMode !== void 0 && sp.fillMode !== "norm" || sp.stroke === false
|
|
1686
|
+
);
|
|
1687
|
+
}
|
|
1688
|
+
function asSubpathCapable(element) {
|
|
1689
|
+
if (element.type === "shape" || element.type === "image" || element.type === "picture") {
|
|
1690
|
+
return element;
|
|
1691
|
+
}
|
|
1692
|
+
return void 0;
|
|
1693
|
+
}
|
|
1694
|
+
function getSubpathGeometry(element, force = false) {
|
|
1695
|
+
const slots = asSubpathCapable(element);
|
|
1696
|
+
if (!slots) {
|
|
1697
|
+
return void 0;
|
|
1698
|
+
}
|
|
1699
|
+
if (slots.pathData && slots.pathWidth && slots.pathHeight) {
|
|
1700
|
+
const structured = evaluateCustomGeometryPaths(
|
|
1701
|
+
slots.customGeometryRawData,
|
|
1702
|
+
slots.pathWidth,
|
|
1703
|
+
slots.pathHeight,
|
|
1704
|
+
slots.shapeAdjustments
|
|
1705
|
+
) ?? slots.customGeometryPaths;
|
|
1706
|
+
if (!structured || structured.length === 0) {
|
|
1707
|
+
return void 0;
|
|
1708
|
+
}
|
|
1709
|
+
const subpaths2 = customGeometryPathsToSvgSubpaths(
|
|
1710
|
+
structured,
|
|
1711
|
+
slots.pathWidth,
|
|
1712
|
+
slots.pathHeight
|
|
1713
|
+
);
|
|
1714
|
+
return force || needsPerSubpathPaint(subpaths2) ? { subpaths: subpaths2, width: slots.pathWidth, height: slots.pathHeight } : void 0;
|
|
1715
|
+
}
|
|
1716
|
+
if (!slots.shapeType) {
|
|
1717
|
+
return void 0;
|
|
1718
|
+
}
|
|
1719
|
+
const { width, height } = paintedSize(element);
|
|
1720
|
+
const result = evaluatePresetShape(slots.shapeType, width, height, slots.shapeAdjustments);
|
|
1721
|
+
if (!result || result.fillNone || result.paths.length === 0) {
|
|
1722
|
+
return void 0;
|
|
1723
|
+
}
|
|
1724
|
+
const subpaths = result.paths.map((p) => ({
|
|
1725
|
+
d: p.d,
|
|
1726
|
+
fillMode: p.fill,
|
|
1727
|
+
stroke: p.stroke
|
|
1728
|
+
}));
|
|
1729
|
+
return force || needsPerSubpathPaint(subpaths) ? { subpaths, width, height } : void 0;
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
// src/pptx/render/svg-attr-escape.ts
|
|
1733
|
+
function escapeSvgAttr(value) {
|
|
1734
|
+
return String(value).replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
// src/pptx/render/silhouette-effects.ts
|
|
1738
|
+
var DEFAULT_SHADOW = "#000000";
|
|
1739
|
+
var DEFAULT_GLOW = "#ffff00";
|
|
1740
|
+
var GLOW_RING_STEPS = 24;
|
|
1741
|
+
var GLOW_INNER_RING_STEPS = 12;
|
|
1742
|
+
function unit(value) {
|
|
1743
|
+
return Math.min(1, Math.max(0, value));
|
|
1744
|
+
}
|
|
1745
|
+
function hex(value, fallback) {
|
|
1746
|
+
if (!value || value === "transparent") {
|
|
1747
|
+
return fallback;
|
|
1748
|
+
}
|
|
1749
|
+
const candidate = value.startsWith("#") ? value : `#${value}`;
|
|
1750
|
+
return /^#[0-9A-Fa-f]{6}$/u.test(candidate) ? candidate : fallback;
|
|
1751
|
+
}
|
|
1752
|
+
function finite(value) {
|
|
1753
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
1754
|
+
}
|
|
1755
|
+
function getSilhouetteFilterId(elementId) {
|
|
1756
|
+
return `shape-fx-${elementId.replace(/[^A-Za-z0-9_.-]/gu, "_")}`;
|
|
1757
|
+
}
|
|
1758
|
+
function resolveOuterShadowLayers(style, rotation) {
|
|
1759
|
+
const layers = [];
|
|
1760
|
+
if (style.shadows && style.shadows.length > 0) {
|
|
1761
|
+
for (const shadow of style.shadows) {
|
|
1762
|
+
if (!shadow.color || shadow.color === "transparent") {
|
|
1763
|
+
continue;
|
|
1764
|
+
}
|
|
1765
|
+
const angle = (shadow.angle ?? 0) * Math.PI / 180;
|
|
1766
|
+
const distance = shadow.distance ?? 0;
|
|
1767
|
+
layers.push({
|
|
1768
|
+
offsetX: Math.cos(angle) * distance,
|
|
1769
|
+
offsetY: Math.sin(angle) * distance,
|
|
1770
|
+
blur: Math.max(0, shadow.blur ?? 6),
|
|
1771
|
+
color: hex(shadow.color, DEFAULT_SHADOW),
|
|
1772
|
+
opacity: unit(shadow.opacity ?? 0.35)
|
|
1773
|
+
});
|
|
1774
|
+
}
|
|
1775
|
+
return layers;
|
|
1776
|
+
}
|
|
1777
|
+
if (!style.shadowColor || style.shadowColor === "transparent") {
|
|
1778
|
+
return layers;
|
|
1779
|
+
}
|
|
1780
|
+
const ooxml = style.outerShadowXml !== void 0;
|
|
1781
|
+
let offsetX;
|
|
1782
|
+
let offsetY;
|
|
1783
|
+
if (finite(style.shadowAngle) && finite(style.shadowDistance)) {
|
|
1784
|
+
const angle = style.shadowRotateWithShape === false && typeof rotation === "number" ? style.shadowAngle - rotation : style.shadowAngle;
|
|
1785
|
+
offsetX = Math.cos(angle * Math.PI / 180) * style.shadowDistance;
|
|
1786
|
+
offsetY = Math.sin(angle * Math.PI / 180) * style.shadowDistance;
|
|
1787
|
+
} else {
|
|
1788
|
+
offsetX = finite(style.shadowOffsetX) ? style.shadowOffsetX : ooxml ? 0 : 4;
|
|
1789
|
+
offsetY = finite(style.shadowOffsetY) ? style.shadowOffsetY : ooxml ? 0 : 4;
|
|
1790
|
+
}
|
|
1791
|
+
const rawBlur = finite(style.shadowBlur) ? Math.max(0, style.shadowBlur) : ooxml ? 0 : 6;
|
|
1792
|
+
layers.push({
|
|
1793
|
+
offsetX,
|
|
1794
|
+
offsetY,
|
|
1795
|
+
blur: ooxml ? shadowBlurToCss(rawBlur) : rawBlur,
|
|
1796
|
+
color: hex(style.shadowColor, DEFAULT_SHADOW),
|
|
1797
|
+
opacity: finite(style.shadowOpacity) ? unit(style.shadowOpacity) : ooxml ? 1 : 0.35
|
|
1798
|
+
});
|
|
1799
|
+
return layers;
|
|
1800
|
+
}
|
|
1801
|
+
function resolveGlow(style) {
|
|
1802
|
+
if (!style.glowColor || style.glowColor === "transparent" || !style.glowRadius) {
|
|
1803
|
+
return void 0;
|
|
1804
|
+
}
|
|
1805
|
+
if (!(style.glowRadius > 0)) {
|
|
1806
|
+
return void 0;
|
|
1807
|
+
}
|
|
1808
|
+
const { spread, blur } = glowCssLengths(style.glowRadius);
|
|
1809
|
+
return {
|
|
1810
|
+
spread,
|
|
1811
|
+
blur,
|
|
1812
|
+
color: hex(style.glowColor, DEFAULT_GLOW),
|
|
1813
|
+
opacity: finite(style.glowOpacity) ? unit(style.glowOpacity) : 0.75
|
|
1814
|
+
};
|
|
1815
|
+
}
|
|
1816
|
+
function resolveInnerShadow(style) {
|
|
1817
|
+
if (!style.innerShadowColor || style.innerShadowColor === "transparent") {
|
|
1818
|
+
return void 0;
|
|
1819
|
+
}
|
|
1820
|
+
return {
|
|
1821
|
+
offsetX: finite(style.innerShadowOffsetX) ? style.innerShadowOffsetX : 0,
|
|
1822
|
+
offsetY: finite(style.innerShadowOffsetY) ? style.innerShadowOffsetY : 0,
|
|
1823
|
+
blur: shadowBlurToCss(finite(style.innerShadowBlur) ? Math.max(0, style.innerShadowBlur) : 6),
|
|
1824
|
+
color: hex(style.innerShadowColor, DEFAULT_SHADOW),
|
|
1825
|
+
opacity: finite(style.innerShadowOpacity) ? unit(style.innerShadowOpacity) : 0.5
|
|
1826
|
+
};
|
|
1827
|
+
}
|
|
1828
|
+
function paintsNoFill(style) {
|
|
1829
|
+
return !style || !style.fillColor || style.fillColor === "transparent" || style.fillMode === "none";
|
|
1830
|
+
}
|
|
1831
|
+
function overlayCanPaintFill(style) {
|
|
1832
|
+
const mode = style?.fillMode;
|
|
1833
|
+
return mode === void 0 || mode === "solid" || mode === "none";
|
|
1834
|
+
}
|
|
1835
|
+
function isLayerFillMode(style) {
|
|
1836
|
+
const mode = style?.fillMode;
|
|
1837
|
+
return mode === "gradient" || mode === "pattern" || mode === "image";
|
|
1838
|
+
}
|
|
1839
|
+
function getSilhouetteEffectParams(element) {
|
|
1840
|
+
if (element.type !== "shape" || !hasShapeProperties(element)) {
|
|
1841
|
+
return void 0;
|
|
1842
|
+
}
|
|
1843
|
+
const style = element.shapeStyle;
|
|
1844
|
+
if (!style) {
|
|
1845
|
+
return void 0;
|
|
1846
|
+
}
|
|
1847
|
+
const shadows = resolveOuterShadowLayers(style, element.rotation);
|
|
1848
|
+
const glow = resolveGlow(style);
|
|
1849
|
+
const innerShadow = resolveInnerShadow(style);
|
|
1850
|
+
if (shadows.length === 0 && !glow && !innerShadow) {
|
|
1851
|
+
return void 0;
|
|
1852
|
+
}
|
|
1853
|
+
if (style.lineShadowColor || style.lineGlowColor || style.shape3d || style.scene3d) {
|
|
1854
|
+
return void 0;
|
|
1855
|
+
}
|
|
1856
|
+
const layerFill = isLayerFillMode(style);
|
|
1857
|
+
if (!layerFill && !overlayCanPaintFill(style)) {
|
|
1858
|
+
return void 0;
|
|
1859
|
+
}
|
|
1860
|
+
const geometry = resolveBaseShapeGeometry(element);
|
|
1861
|
+
if (layerFill && geometry.kind !== "clipPath") {
|
|
1862
|
+
return void 0;
|
|
1863
|
+
}
|
|
1864
|
+
if (geometry.kind === "bare" || geometry.kind === "strokeOnly" || geometry.kind === "lineEdge") {
|
|
1865
|
+
return void 0;
|
|
1866
|
+
}
|
|
1867
|
+
const translucent = typeof style.fillOpacity === "number" && style.fillOpacity < 0.999;
|
|
1868
|
+
if (geometry.kind !== "clipPath" && !paintsNoFill(style) && !translucent) {
|
|
1869
|
+
return void 0;
|
|
1870
|
+
}
|
|
1871
|
+
if (geometry.kind === "clipPath" && !layerFill && !paintsNoFill(style) && !getSubpathGeometry(element, true)) {
|
|
1872
|
+
return void 0;
|
|
1873
|
+
}
|
|
1874
|
+
const inner = innerShadow && geometry.kind === "clipPath" && !paintsNoFill(style) ? innerShadow : void 0;
|
|
1875
|
+
if (shadows.length === 0 && !glow && !inner) {
|
|
1876
|
+
return void 0;
|
|
1877
|
+
}
|
|
1878
|
+
return { shadows, ...glow ? { glow } : {}, ...inner ? { inner } : {} };
|
|
1879
|
+
}
|
|
1880
|
+
function px(value) {
|
|
1881
|
+
return String(Math.round(value * 100) / 100);
|
|
1882
|
+
}
|
|
1883
|
+
function scaledAlpha(input, result, opacity) {
|
|
1884
|
+
return `<feComponentTransfer in="${input}" result="${result}"><feFuncA type="linear" slope="${px(opacity)}"/></feComponentTransfer>`;
|
|
1885
|
+
}
|
|
1886
|
+
var MORPH_PROGRESS_VAR = "--pptx-morph-p";
|
|
1887
|
+
function flood(color, result, opacity, side) {
|
|
1888
|
+
if (!side) {
|
|
1889
|
+
return `<feFlood flood-color="${color}" result="${result}"/>`;
|
|
1890
|
+
}
|
|
1891
|
+
const k = side === "out" ? `(1 - var(${MORPH_PROGRESS_VAR}, 1))` : `var(${MORPH_PROGRESS_VAR}, 1)`;
|
|
1892
|
+
return `<feFlood flood-color="${color}" flood-opacity="${side === "out" ? 0 : px(opacity)}" style="flood-opacity:calc(${px(opacity)} * ${k})" result="${result}"/>`;
|
|
1893
|
+
}
|
|
1894
|
+
function alpha(input, result, opacity, side) {
|
|
1895
|
+
return side ? { markup: "", mask: input } : { markup: scaledAlpha(input, result, opacity), mask: result };
|
|
1896
|
+
}
|
|
1897
|
+
function glowMarkup(glow, tag, side) {
|
|
1898
|
+
const parts = [];
|
|
1899
|
+
const names = [];
|
|
1900
|
+
const ring = (radius, steps, ringTag) => {
|
|
1901
|
+
for (let i = 0; i < steps; i++) {
|
|
1902
|
+
const angle = 2 * Math.PI * i / steps;
|
|
1903
|
+
const name = `${tag}${ringTag}${i}`;
|
|
1904
|
+
names.push(name);
|
|
1905
|
+
parts.push(
|
|
1906
|
+
`<feOffset in="SourceAlpha" dx="${px(Math.cos(angle) * radius)}" dy="${px(Math.sin(angle) * radius)}" result="${name}"/>`
|
|
1907
|
+
);
|
|
1908
|
+
}
|
|
1909
|
+
};
|
|
1910
|
+
if (glow.spread > 0.01) {
|
|
1911
|
+
ring(glow.spread, GLOW_RING_STEPS, "gr");
|
|
1912
|
+
ring(glow.spread / 2, GLOW_INNER_RING_STEPS, "gi");
|
|
1913
|
+
}
|
|
1914
|
+
const merge = [
|
|
1915
|
+
...names.map((n) => `<feMergeNode in="${n}"/>`),
|
|
1916
|
+
'<feMergeNode in="SourceAlpha"/>'
|
|
1917
|
+
];
|
|
1918
|
+
parts.push(`<feMerge result="${tag}glowGrown">${merge.join("")}</feMerge>`);
|
|
1919
|
+
parts.push(
|
|
1920
|
+
`<feGaussianBlur in="${tag}glowGrown" stdDeviation="${px(glow.blur / 2)}" result="${tag}glowBlur"/>`
|
|
1921
|
+
);
|
|
1922
|
+
const scaled = alpha(`${tag}glowBlur`, `${tag}glowMask`, glow.opacity, side);
|
|
1923
|
+
parts.push(
|
|
1924
|
+
scaled.markup,
|
|
1925
|
+
flood(glow.color, `${tag}glowColor`, glow.opacity, side),
|
|
1926
|
+
`<feComposite in="${tag}glowColor" in2="${scaled.mask}" operator="in" result="${tag}glowLayer"/>`
|
|
1927
|
+
);
|
|
1928
|
+
return parts.join("");
|
|
1929
|
+
}
|
|
1930
|
+
function effectReach(params) {
|
|
1931
|
+
let reach = 0;
|
|
1932
|
+
for (const s of params.shadows) {
|
|
1933
|
+
reach = Math.max(reach, Math.hypot(s.offsetX, s.offsetY) + 1.5 * s.blur);
|
|
1934
|
+
}
|
|
1935
|
+
if (params.glow) {
|
|
1936
|
+
reach = Math.max(reach, params.glow.spread + 1.5 * params.glow.blur);
|
|
1937
|
+
}
|
|
1938
|
+
if (params.inner) {
|
|
1939
|
+
reach = Math.max(
|
|
1940
|
+
reach,
|
|
1941
|
+
Math.hypot(params.inner.offsetX, params.inner.offsetY) + 1.5 * params.inner.blur
|
|
1942
|
+
);
|
|
1943
|
+
}
|
|
1944
|
+
return reach;
|
|
1945
|
+
}
|
|
1946
|
+
function effectLayers(params, tag, side) {
|
|
1947
|
+
const out = { parts: [], glow: [], shadows: [], inner: [] };
|
|
1948
|
+
if (params.glow) {
|
|
1949
|
+
out.parts.push(glowMarkup(params.glow, tag, side));
|
|
1950
|
+
out.glow.push(`${tag}glowLayer`);
|
|
1951
|
+
}
|
|
1952
|
+
params.shadows.forEach((s, i) => {
|
|
1953
|
+
const name = `${tag}shadow${i}`;
|
|
1954
|
+
const scaled = alpha(`${name}Off`, `${name}Mask`, s.opacity, side);
|
|
1955
|
+
out.parts.push(
|
|
1956
|
+
`<feGaussianBlur in="SourceAlpha" stdDeviation="${px(s.blur / 2)}" result="${name}Blur"/>`,
|
|
1957
|
+
`<feOffset in="${name}Blur" dx="${px(s.offsetX)}" dy="${px(s.offsetY)}" result="${name}Off"/>`,
|
|
1958
|
+
scaled.markup,
|
|
1959
|
+
flood(s.color, `${name}Color`, s.opacity, side),
|
|
1960
|
+
`<feComposite in="${name}Color" in2="${scaled.mask}" operator="in" result="${name}"/>`
|
|
1961
|
+
);
|
|
1962
|
+
out.shadows.push(name);
|
|
1963
|
+
});
|
|
1964
|
+
if (params.inner) {
|
|
1965
|
+
const i = params.inner;
|
|
1966
|
+
const name = `${tag}inner`;
|
|
1967
|
+
const scaled = alpha(`${name}Blur`, `${name}Mask`, i.opacity, side);
|
|
1968
|
+
out.parts.push(
|
|
1969
|
+
`<feComponentTransfer in="SourceAlpha" result="${name}Inv"><feFuncA type="table" tableValues="1 0"/></feComponentTransfer>`,
|
|
1970
|
+
`<feOffset in="${name}Inv" dx="${px(-i.offsetX)}" dy="${px(-i.offsetY)}" result="${name}Off"/>`,
|
|
1971
|
+
`<feGaussianBlur in="${name}Off" stdDeviation="${px(i.blur / 2)}" result="${name}Blur"/>`,
|
|
1972
|
+
scaled.markup,
|
|
1973
|
+
flood(i.color, `${name}Flood`, i.opacity, side),
|
|
1974
|
+
`<feComposite in="${name}Flood" in2="${scaled.mask}" operator="in" result="${name}Color"/>`,
|
|
1975
|
+
`<feComposite in="${name}Color" in2="SourceAlpha" operator="in" result="${name}Layer"/>`
|
|
1976
|
+
);
|
|
1977
|
+
out.inner.push(`${name}Layer`);
|
|
1978
|
+
}
|
|
1979
|
+
return out;
|
|
1980
|
+
}
|
|
1981
|
+
function pairLayers(a, b, tag, parts) {
|
|
1982
|
+
const names = [];
|
|
1983
|
+
for (let i = 0; i < Math.max(a.length, b.length); i++) {
|
|
1984
|
+
const x = a[i];
|
|
1985
|
+
const y = b[i];
|
|
1986
|
+
if (x && y) {
|
|
1987
|
+
parts.push(
|
|
1988
|
+
`<feComposite in="${x}" in2="${y}" operator="arithmetic" k1="0" k2="1" k3="1" k4="0" result="${tag}${i}"/>`
|
|
1989
|
+
);
|
|
1990
|
+
names.push(`${tag}${i}`);
|
|
1991
|
+
} else {
|
|
1992
|
+
names.push(x ?? y);
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
return names;
|
|
1996
|
+
}
|
|
1997
|
+
function buildSilhouetteFilterMarkup(filterId, width, height, params, outgoing) {
|
|
1998
|
+
const pad = Math.ceil(Math.max(effectReach(params), outgoing ? effectReach(outgoing) : 0)) + 4;
|
|
1999
|
+
const parts = [
|
|
2000
|
+
`<filter id="${escapeSvgAttr(filterId)}" filterUnits="userSpaceOnUse" x="${-pad}" y="${-pad}" width="${px(Math.max(width, 1) + 2 * pad)}" height="${px(Math.max(height, 1) + 2 * pad)}" color-interpolation-filters="sRGB">`
|
|
2001
|
+
];
|
|
2002
|
+
const into = effectLayers(params, "", outgoing ? "in" : void 0);
|
|
2003
|
+
parts.push(...into.parts);
|
|
2004
|
+
let { glow, shadows, inner } = into;
|
|
2005
|
+
if (outgoing) {
|
|
2006
|
+
const out = effectLayers(outgoing, "o", "out");
|
|
2007
|
+
parts.push(...out.parts);
|
|
2008
|
+
glow = pairLayers(out.glow, into.glow, "sumglow", parts);
|
|
2009
|
+
shadows = pairLayers(out.shadows, into.shadows, "sumshadow", parts);
|
|
2010
|
+
inner = pairLayers(out.inner, into.inner, "suminner", parts);
|
|
2011
|
+
}
|
|
2012
|
+
const stack = [...glow, ...[...shadows].reverse()];
|
|
2013
|
+
parts.push(
|
|
2014
|
+
`<feMerge>${[...stack, "SourceGraphic", ...inner].map((n) => `<feMergeNode in="${n}"/>`).join("")}</feMerge>`,
|
|
2015
|
+
"</filter>"
|
|
2016
|
+
);
|
|
2017
|
+
return parts.join("");
|
|
2018
|
+
}
|
|
2019
|
+
function getSilhouetteEffects(element) {
|
|
2020
|
+
const params = getSilhouetteEffectParams(element);
|
|
2021
|
+
if (!params) {
|
|
2022
|
+
return void 0;
|
|
2023
|
+
}
|
|
2024
|
+
const filterId = getSilhouetteFilterId(element.id);
|
|
2025
|
+
return {
|
|
2026
|
+
filterId,
|
|
2027
|
+
cssReference: `url(#${filterId})`,
|
|
2028
|
+
filterMarkup: buildSilhouetteFilterMarkup(
|
|
2029
|
+
filterId,
|
|
2030
|
+
element.width,
|
|
2031
|
+
element.height,
|
|
2032
|
+
params,
|
|
2033
|
+
silhouetteMorphFor(element.id, params)
|
|
2034
|
+
),
|
|
2035
|
+
paintsInnerShadow: params.inner !== void 0
|
|
2036
|
+
};
|
|
2037
|
+
}
|
|
2038
|
+
function silhouetteFillsOverlay(element) {
|
|
2039
|
+
if (!usesSilhouetteEffects(element) || !hasShapeProperties(element)) {
|
|
2040
|
+
return false;
|
|
2041
|
+
}
|
|
2042
|
+
return resolveBaseShapeGeometry(element).kind === "clipPath" && !paintsNoFill(element.shapeStyle) && !isLayerFillMode(element.shapeStyle);
|
|
2043
|
+
}
|
|
2044
|
+
function silhouetteFillsLayer(element) {
|
|
2045
|
+
return hasShapeProperties(element) && isLayerFillMode(element.shapeStyle) && usesSilhouetteEffects(element);
|
|
2046
|
+
}
|
|
2047
|
+
function usesSilhouetteEffects(element) {
|
|
2048
|
+
return getSilhouetteEffectParams(element) !== void 0;
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
// src/pptx/render/visual-effects.ts
|
|
2052
|
+
var DEFAULT_SHADOW_COLOR = "#000000";
|
|
2053
|
+
var DEFAULT_GLOW_COLOR = "#ffff00";
|
|
2054
|
+
function clampUnitInterval(value) {
|
|
2055
|
+
return Math.min(1, Math.max(0, value));
|
|
2056
|
+
}
|
|
2057
|
+
function normalizeHexColor2(value, fallback) {
|
|
2058
|
+
if (!value || value === "transparent") {
|
|
2059
|
+
return fallback;
|
|
2060
|
+
}
|
|
2061
|
+
const candidate = value.startsWith("#") ? value : `#${value}`;
|
|
2062
|
+
return /^#[0-9A-Fa-f]{6}$/u.test(candidate) ? candidate : fallback;
|
|
2063
|
+
}
|
|
2064
|
+
function hexToRgbChannels(color) {
|
|
2065
|
+
const normalized = color.replace("#", "");
|
|
2066
|
+
if (!/^[0-9a-fA-F]{6}$/u.test(normalized)) {
|
|
2067
|
+
return null;
|
|
2068
|
+
}
|
|
2069
|
+
return {
|
|
2070
|
+
r: Number.parseInt(normalized.slice(0, 2), 16),
|
|
2071
|
+
g: Number.parseInt(normalized.slice(2, 4), 16),
|
|
2072
|
+
b: Number.parseInt(normalized.slice(4, 6), 16)
|
|
2073
|
+
};
|
|
2074
|
+
}
|
|
2075
|
+
function colorWithOpacity2(color, opacity) {
|
|
2076
|
+
if (opacity === void 0) {
|
|
2077
|
+
return color;
|
|
2078
|
+
}
|
|
2079
|
+
const rgb = hexToRgbChannels(color);
|
|
2080
|
+
if (!rgb) {
|
|
2081
|
+
return color;
|
|
2082
|
+
}
|
|
2083
|
+
return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${clampUnitInterval(opacity)})`;
|
|
2084
|
+
}
|
|
2085
|
+
function getOuterShadowCss(style, context) {
|
|
2086
|
+
if (!style?.shadowColor || style.shadowColor === "transparent") {
|
|
2087
|
+
return void 0;
|
|
2088
|
+
}
|
|
2089
|
+
const usesOoxmlDefaults = style.outerShadowXml !== void 0;
|
|
2090
|
+
let offsetX;
|
|
2091
|
+
let offsetY;
|
|
2092
|
+
if (typeof style.shadowAngle === "number" && typeof style.shadowDistance === "number") {
|
|
2093
|
+
const angle = style.shadowRotateWithShape === false && typeof context?.rotation === "number" ? style.shadowAngle - context.rotation : style.shadowAngle;
|
|
2094
|
+
const angleRad = angle * Math.PI / 180;
|
|
2095
|
+
offsetX = Math.cos(angleRad) * style.shadowDistance;
|
|
2096
|
+
offsetY = Math.sin(angleRad) * style.shadowDistance;
|
|
2097
|
+
} else {
|
|
2098
|
+
offsetX = typeof style.shadowOffsetX === "number" && Number.isFinite(style.shadowOffsetX) ? style.shadowOffsetX : usesOoxmlDefaults ? 0 : 4;
|
|
2099
|
+
offsetY = typeof style.shadowOffsetY === "number" && Number.isFinite(style.shadowOffsetY) ? style.shadowOffsetY : usesOoxmlDefaults ? 0 : 4;
|
|
2100
|
+
}
|
|
2101
|
+
const rawBlur = typeof style.shadowBlur === "number" && Number.isFinite(style.shadowBlur) ? Math.max(0, style.shadowBlur) : usesOoxmlDefaults ? 0 : 6;
|
|
2102
|
+
const blur = usesOoxmlDefaults ? shadowBlurToCss(rawBlur) : rawBlur;
|
|
2103
|
+
const opacity = typeof style.shadowOpacity === "number" && Number.isFinite(style.shadowOpacity) ? clampUnitInterval(style.shadowOpacity) : usesOoxmlDefaults ? 1 : 0.35;
|
|
2104
|
+
const spread = getShadowScaleSpread(style.shadowScaleX, style.shadowScaleY, blur);
|
|
2105
|
+
const color = colorWithOpacity2(
|
|
2106
|
+
normalizeHexColor2(style.shadowColor, DEFAULT_SHADOW_COLOR),
|
|
2107
|
+
opacity
|
|
2108
|
+
);
|
|
2109
|
+
const geometry = `${Math.round(offsetX)}px ${Math.round(offsetY)}px ${Math.round(blur)}px`;
|
|
2110
|
+
return spread === 0 ? `${geometry} ${color}` : `${geometry} ${spread}px ${color}`;
|
|
2111
|
+
}
|
|
2112
|
+
function getCompositeOuterShadowFilterCss(style, context) {
|
|
2113
|
+
if (!style) {
|
|
2114
|
+
return void 0;
|
|
2115
|
+
}
|
|
2116
|
+
const usesOoxmlDefaults = style.outerShadowXml !== void 0;
|
|
2117
|
+
const shadows = style.shadows && style.shadows.length > 0 ? style.shadows : style.shadowColor && style.shadowColor !== "transparent" ? [
|
|
2118
|
+
{
|
|
2119
|
+
angle: style.shadowAngle,
|
|
2120
|
+
distance: style.shadowDistance,
|
|
2121
|
+
offsetX: style.shadowOffsetX,
|
|
2122
|
+
offsetY: style.shadowOffsetY,
|
|
2123
|
+
blur: style.shadowBlur,
|
|
2124
|
+
color: style.shadowColor,
|
|
2125
|
+
opacity: style.shadowOpacity
|
|
2126
|
+
}
|
|
2127
|
+
] : [];
|
|
2128
|
+
const parts = [];
|
|
2129
|
+
for (const shadow of shadows) {
|
|
2130
|
+
if (!shadow.color || shadow.color === "transparent") {
|
|
2131
|
+
continue;
|
|
2132
|
+
}
|
|
2133
|
+
let offsetX;
|
|
2134
|
+
let offsetY;
|
|
2135
|
+
if (typeof shadow.angle === "number" && typeof shadow.distance === "number") {
|
|
2136
|
+
const angle = style.shadowRotateWithShape === false && typeof context?.rotation === "number" ? shadow.angle - context.rotation : shadow.angle;
|
|
2137
|
+
const angleRad = angle * Math.PI / 180;
|
|
2138
|
+
offsetX = Math.cos(angleRad) * shadow.distance;
|
|
2139
|
+
offsetY = Math.sin(angleRad) * shadow.distance;
|
|
2140
|
+
} else {
|
|
2141
|
+
offsetX = typeof shadow.offsetX === "number" && Number.isFinite(shadow.offsetX) ? shadow.offsetX : usesOoxmlDefaults ? 0 : 4;
|
|
2142
|
+
offsetY = typeof shadow.offsetY === "number" && Number.isFinite(shadow.offsetY) ? shadow.offsetY : usesOoxmlDefaults ? 0 : 4;
|
|
2143
|
+
}
|
|
2144
|
+
const rawBlur = typeof shadow.blur === "number" && Number.isFinite(shadow.blur) ? Math.max(0, shadow.blur) : usesOoxmlDefaults ? 0 : 6;
|
|
2145
|
+
const blur = usesOoxmlDefaults ? shadowBlurToCss(rawBlur) : rawBlur;
|
|
2146
|
+
const opacity = typeof shadow.opacity === "number" && Number.isFinite(shadow.opacity) ? clampUnitInterval(shadow.opacity) : usesOoxmlDefaults ? 1 : 0.35;
|
|
2147
|
+
const color = colorWithOpacity2(normalizeHexColor2(shadow.color, DEFAULT_SHADOW_COLOR), opacity);
|
|
2148
|
+
parts.push(
|
|
2149
|
+
`drop-shadow(${Math.round(offsetX)}px ${Math.round(offsetY)}px ${Math.round(blur)}px ${color})`
|
|
2150
|
+
);
|
|
2151
|
+
}
|
|
2152
|
+
return parts.length > 0 ? parts.join(" ") : void 0;
|
|
2153
|
+
}
|
|
2154
|
+
function getShadowScaleSpread(scaleX, scaleY, blur) {
|
|
2155
|
+
const sx = typeof scaleX === "number" && Number.isFinite(scaleX) ? scaleX / 1e5 : 1;
|
|
2156
|
+
const sy = typeof scaleY === "number" && Number.isFinite(scaleY) ? scaleY / 1e5 : 1;
|
|
2157
|
+
const avgScale = (sx + sy) / 2;
|
|
2158
|
+
if (avgScale === 1) {
|
|
2159
|
+
return 0;
|
|
2160
|
+
}
|
|
2161
|
+
const base = Math.max(blur, 4);
|
|
2162
|
+
return Math.round(base * (avgScale - 1));
|
|
2163
|
+
}
|
|
2164
|
+
function getInnerShadowCss(style) {
|
|
2165
|
+
if (!style?.innerShadowColor || style.innerShadowColor === "transparent") {
|
|
2166
|
+
return void 0;
|
|
2167
|
+
}
|
|
2168
|
+
const offsetX = typeof style.innerShadowOffsetX === "number" && Number.isFinite(style.innerShadowOffsetX) ? style.innerShadowOffsetX : 0;
|
|
2169
|
+
const offsetY = typeof style.innerShadowOffsetY === "number" && Number.isFinite(style.innerShadowOffsetY) ? style.innerShadowOffsetY : 0;
|
|
2170
|
+
const blur = typeof style.innerShadowBlur === "number" && Number.isFinite(style.innerShadowBlur) ? Math.max(0, style.innerShadowBlur) : 6;
|
|
2171
|
+
const opacity = typeof style.innerShadowOpacity === "number" && Number.isFinite(style.innerShadowOpacity) ? clampUnitInterval(style.innerShadowOpacity) : 0.5;
|
|
2172
|
+
return `inset ${Math.round(-offsetX) + 0}px ${Math.round(-offsetY) + 0}px ${Math.round(shadowBlurToCss(blur))}px ${colorWithOpacity2(
|
|
2173
|
+
normalizeHexColor2(style.innerShadowColor, DEFAULT_SHADOW_COLOR),
|
|
2174
|
+
opacity
|
|
2175
|
+
)}`;
|
|
2176
|
+
}
|
|
2177
|
+
function getMultiLayerShadowCss(style) {
|
|
2178
|
+
if (!style?.shadows || style.shadows.length === 0) {
|
|
2179
|
+
return void 0;
|
|
2180
|
+
}
|
|
2181
|
+
const parts = [];
|
|
2182
|
+
for (const shadow of style.shadows) {
|
|
2183
|
+
if (!shadow.color || shadow.color === "transparent") {
|
|
2184
|
+
continue;
|
|
2185
|
+
}
|
|
2186
|
+
const angleRad = (shadow.angle ?? 0) * Math.PI / 180;
|
|
2187
|
+
const dist = shadow.distance ?? 0;
|
|
2188
|
+
const offsetX = Math.round(Math.cos(angleRad) * dist);
|
|
2189
|
+
const offsetY = Math.round(Math.sin(angleRad) * dist);
|
|
2190
|
+
const blur = Math.round(Math.max(0, shadow.blur ?? 6));
|
|
2191
|
+
const opacity = clampUnitInterval(shadow.opacity ?? 0.35);
|
|
2192
|
+
const color = colorWithOpacity2(normalizeHexColor2(shadow.color, DEFAULT_SHADOW_COLOR), opacity);
|
|
2193
|
+
parts.push(`${offsetX}px ${offsetY}px ${blur}px ${color}`);
|
|
2194
|
+
}
|
|
2195
|
+
return parts.length > 0 ? parts.join(", ") : void 0;
|
|
2196
|
+
}
|
|
2197
|
+
function getGlowBoxShadowCss(color, radius, opacity) {
|
|
2198
|
+
if (!color || color === "transparent" || !radius || radius <= 0) {
|
|
2199
|
+
return void 0;
|
|
2200
|
+
}
|
|
2201
|
+
const baseOpacity = typeof opacity === "number" ? clampUnitInterval(opacity) : 0.75;
|
|
2202
|
+
const normalizedColor = normalizeHexColor2(color, DEFAULT_GLOW_COLOR);
|
|
2203
|
+
const { spread, blur } = glowCssLengths(radius);
|
|
2204
|
+
const glowColor = colorWithOpacity2(normalizedColor, baseOpacity);
|
|
2205
|
+
return `0 0 ${Math.round(blur * 10) / 10}px ${Math.round(spread * 10) / 10}px ${glowColor}`;
|
|
2206
|
+
}
|
|
2207
|
+
function getBoxShadowCss(style, options = {}, context) {
|
|
2208
|
+
if (!style) {
|
|
2209
|
+
return void 0;
|
|
2210
|
+
}
|
|
2211
|
+
const parts = [];
|
|
2212
|
+
const multiLayer = options.includeOuter === false ? void 0 : getMultiLayerShadowCss(style);
|
|
2213
|
+
if (multiLayer) {
|
|
2214
|
+
parts.push(multiLayer);
|
|
2215
|
+
} else if (options.includeOuter !== false) {
|
|
2216
|
+
const outer = getOuterShadowCss(style, context);
|
|
2217
|
+
if (outer) {
|
|
2218
|
+
parts.push(outer);
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
const inner = options.includeInner === false ? void 0 : getInnerShadowCss(style);
|
|
2222
|
+
if (inner) {
|
|
2223
|
+
parts.push(inner);
|
|
2224
|
+
}
|
|
2225
|
+
if (options.includeGlow !== false) {
|
|
2226
|
+
const glow = getGlowBoxShadowCss(style.glowColor, style.glowRadius, style.glowOpacity);
|
|
2227
|
+
if (glow) {
|
|
2228
|
+
parts.push(glow);
|
|
2229
|
+
}
|
|
2230
|
+
}
|
|
2231
|
+
return parts.length > 0 ? parts.join(", ") : void 0;
|
|
2232
|
+
}
|
|
2233
|
+
var buildShadowCssFromShapeStyle = getOuterShadowCss;
|
|
2234
|
+
var buildInnerShadowCssFromShapeStyle = getInnerShadowCss;
|
|
2235
|
+
var buildMultiLayerShadowCss = getMultiLayerShadowCss;
|
|
2236
|
+
var buildGlowBoxShadow = getGlowBoxShadowCss;
|
|
2237
|
+
function getLineShadowParams(style) {
|
|
2238
|
+
if (!style?.lineShadowColor || style.lineShadowColor === "transparent") {
|
|
2239
|
+
return void 0;
|
|
2240
|
+
}
|
|
2241
|
+
return {
|
|
2242
|
+
offsetX: typeof style.lineShadowOffsetX === "number" ? style.lineShadowOffsetX : 2,
|
|
2243
|
+
offsetY: typeof style.lineShadowOffsetY === "number" ? style.lineShadowOffsetY : 2,
|
|
2244
|
+
blur: typeof style.lineShadowBlur === "number" ? Math.max(0, style.lineShadowBlur) : 4,
|
|
2245
|
+
color: normalizeHexColor2(style.lineShadowColor, DEFAULT_SHADOW_COLOR),
|
|
2246
|
+
opacity: typeof style.lineShadowOpacity === "number" ? clampUnitInterval(style.lineShadowOpacity) : 0.35
|
|
2247
|
+
};
|
|
2248
|
+
}
|
|
2249
|
+
function getLineShadowCss(style) {
|
|
2250
|
+
const p = getLineShadowParams(style);
|
|
2251
|
+
if (!p) {
|
|
2252
|
+
return void 0;
|
|
2253
|
+
}
|
|
2254
|
+
return `${Math.round(p.offsetX)}px ${Math.round(p.offsetY)}px ${Math.round(
|
|
2255
|
+
p.blur
|
|
2256
|
+
)}px ${colorWithOpacity2(p.color, p.opacity)}`;
|
|
2257
|
+
}
|
|
2258
|
+
function getLineGlowFilterCss(style) {
|
|
2259
|
+
if (!style?.lineGlowColor || style.lineGlowColor === "transparent" || !style.lineGlowRadius) {
|
|
2260
|
+
return void 0;
|
|
2261
|
+
}
|
|
2262
|
+
const glowOpacity = typeof style.lineGlowOpacity === "number" ? style.lineGlowOpacity : 0.75;
|
|
2263
|
+
const glowRad = Math.round(Math.max(0, style.lineGlowRadius));
|
|
2264
|
+
const glowCol = colorWithOpacity2(
|
|
2265
|
+
normalizeHexColor2(style.lineGlowColor, DEFAULT_GLOW_COLOR),
|
|
2266
|
+
glowOpacity
|
|
2267
|
+
);
|
|
2268
|
+
return `drop-shadow(0 0 ${glowRad}px ${glowCol})`;
|
|
2269
|
+
}
|
|
2270
|
+
var buildLineShadowCss = getLineShadowCss;
|
|
2271
|
+
var buildLineGlowFilter = getLineGlowFilterCss;
|
|
2272
|
+
function getEffectDagCssFilter(style, elementId) {
|
|
2273
|
+
if (!style) {
|
|
2274
|
+
return void 0;
|
|
2275
|
+
}
|
|
2276
|
+
const filters = [];
|
|
2277
|
+
if (style.dagGrayscale) {
|
|
2278
|
+
filters.push("grayscale(1)");
|
|
2279
|
+
}
|
|
2280
|
+
if (typeof style.dagBiLevel === "number") {
|
|
2281
|
+
const thresh = Math.max(0, Math.min(100, style.dagBiLevel));
|
|
2282
|
+
filters.push(thresh > 50 ? "contrast(1000)" : "contrast(0.01)");
|
|
2283
|
+
}
|
|
2284
|
+
if (typeof style.dagLumBrightness === "number" || typeof style.dagLumContrast === "number") {
|
|
2285
|
+
const bright = style.dagLumBrightness ?? 0;
|
|
2286
|
+
const contrast = style.dagLumContrast ?? 0;
|
|
2287
|
+
if (bright !== 0) {
|
|
2288
|
+
filters.push(`brightness(${1 + bright / 100})`);
|
|
2289
|
+
}
|
|
2290
|
+
if (contrast !== 0) {
|
|
2291
|
+
filters.push(`contrast(${1 + contrast / 100})`);
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
if (typeof style.dagHslHue === "number" && style.dagHslHue !== 0) {
|
|
2295
|
+
filters.push(`hue-rotate(${style.dagHslHue}deg)`);
|
|
2296
|
+
}
|
|
2297
|
+
if (typeof style.dagHslSaturation === "number" && style.dagHslSaturation !== 100) {
|
|
2298
|
+
filters.push(`saturate(${style.dagHslSaturation / 100})`);
|
|
2299
|
+
}
|
|
2300
|
+
if (typeof style.dagHslLuminance === "number" && style.dagHslLuminance !== 0) {
|
|
2301
|
+
filters.push(`brightness(${1 + style.dagHslLuminance / 100})`);
|
|
2302
|
+
}
|
|
2303
|
+
if (typeof style.dagAlphaModFix === "number") {
|
|
2304
|
+
const alpha2 = clampUnitInterval(style.dagAlphaModFix / 100);
|
|
2305
|
+
filters.push(`opacity(${alpha2})`);
|
|
2306
|
+
}
|
|
2307
|
+
if (typeof style.dagTintHue === "number" || typeof style.dagTintAmount === "number") {
|
|
2308
|
+
const hue = style.dagTintHue ?? 0;
|
|
2309
|
+
const amt = Math.max(0, Math.min(100, style.dagTintAmount ?? 50));
|
|
2310
|
+
filters.push(`sepia(${amt / 100}) hue-rotate(${hue}deg)`);
|
|
2311
|
+
}
|
|
2312
|
+
if (style.dagDuotone && elementId) {
|
|
2313
|
+
filters.push(`url(#${getDuotoneFilterId(elementId)})`);
|
|
2314
|
+
}
|
|
2315
|
+
return filters.length > 0 ? filters.join(" ") : void 0;
|
|
2316
|
+
}
|
|
2317
|
+
var getEffectDagFilter = getEffectDagCssFilter;
|
|
2318
|
+
function hasEffectDagProperties(style) {
|
|
2319
|
+
if (!style) {
|
|
2320
|
+
return false;
|
|
2321
|
+
}
|
|
2322
|
+
return Boolean(
|
|
2323
|
+
style.dagGrayscale || typeof style.dagBiLevel === "number" || typeof style.dagLumBrightness === "number" || typeof style.dagLumContrast === "number" || typeof style.dagHslHue === "number" || typeof style.dagHslSaturation === "number" || typeof style.dagHslLuminance === "number" || typeof style.dagAlphaModFix === "number" || typeof style.dagTintHue === "number" || typeof style.dagTintAmount === "number" || style.dagDuotone || style.dagFillOverlayBlend || style.dagFillOverlayColor
|
|
2324
|
+
);
|
|
2325
|
+
}
|
|
2326
|
+
function getEffectFilterCss(style, elementId, options = {}) {
|
|
2327
|
+
if (!style) {
|
|
2328
|
+
return void 0;
|
|
2329
|
+
}
|
|
2330
|
+
const parts = [];
|
|
2331
|
+
if (options.glow !== false && style.glowColor && style.glowColor !== "transparent" && style.glowRadius) {
|
|
2332
|
+
const glowOpacity = typeof style.glowOpacity === "number" ? style.glowOpacity : 0.75;
|
|
2333
|
+
const glowCol = colorWithOpacity2(
|
|
2334
|
+
normalizeHexColor2(style.glowColor, DEFAULT_GLOW_COLOR),
|
|
2335
|
+
glowOpacity
|
|
2336
|
+
);
|
|
2337
|
+
for (const blur of glowFilterLengths(style.glowRadius)) {
|
|
2338
|
+
parts.push(`drop-shadow(0 0 ${blur}px ${glowCol})`);
|
|
2339
|
+
}
|
|
2340
|
+
}
|
|
2341
|
+
if (typeof style.softEdgeRadius === "number" && style.softEdgeRadius > 0) {
|
|
2342
|
+
if (elementId) {
|
|
2343
|
+
parts.push(`url(#${getSoftEdgeFilterId(elementId)})`);
|
|
2344
|
+
} else {
|
|
2345
|
+
parts.push(`blur(${Math.min(2, Math.round(style.softEdgeRadius))}px)`);
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
if (typeof style.blurRadius === "number" && style.blurRadius > 0) {
|
|
2349
|
+
parts.push(`blur(${Math.round(style.blurRadius)}px)`);
|
|
2350
|
+
}
|
|
2351
|
+
const dagFilter = getEffectDagCssFilter(style, elementId);
|
|
2352
|
+
if (dagFilter) {
|
|
2353
|
+
parts.push(dagFilter);
|
|
2354
|
+
}
|
|
2355
|
+
return parts.length > 0 ? parts.join(" ") : void 0;
|
|
2356
|
+
}
|
|
2357
|
+
function getEffectDagOpacity(style) {
|
|
2358
|
+
if (!style || typeof style.dagAlphaModFix !== "number") {
|
|
2359
|
+
return void 0;
|
|
2360
|
+
}
|
|
2361
|
+
return clampUnitInterval(style.dagAlphaModFix / 100);
|
|
2362
|
+
}
|
|
2363
|
+
function getEffectDagBlendMode(blend) {
|
|
2364
|
+
switch (blend) {
|
|
2365
|
+
case "mult":
|
|
2366
|
+
return "multiply";
|
|
2367
|
+
case "screen":
|
|
2368
|
+
return "screen";
|
|
2369
|
+
case "darken":
|
|
2370
|
+
return "darken";
|
|
2371
|
+
case "lighten":
|
|
2372
|
+
return "lighten";
|
|
2373
|
+
default:
|
|
2374
|
+
return void 0;
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
function getEffectDagFillOverlay(style) {
|
|
2378
|
+
if (!style?.dagFillOverlayColor || style.dagFillOverlayColor === "transparent") {
|
|
2379
|
+
return void 0;
|
|
2380
|
+
}
|
|
2381
|
+
const blendMode = getEffectDagBlendMode(style.dagFillOverlayBlend) ?? "normal";
|
|
2382
|
+
const color = colorWithOpacity2(
|
|
2383
|
+
normalizeHexColor2(style.dagFillOverlayColor, DEFAULT_SHADOW_COLOR),
|
|
2384
|
+
style.dagFillOverlayOpacity
|
|
2385
|
+
);
|
|
2386
|
+
return { color, blendMode };
|
|
2387
|
+
}
|
|
2388
|
+
function getShapeFillOverlay(style) {
|
|
2389
|
+
if (!style?.shapeFillOverlayColor || style.shapeFillOverlayColor === "transparent") {
|
|
2390
|
+
return void 0;
|
|
2391
|
+
}
|
|
2392
|
+
const blendMode = getEffectDagBlendMode(style.shapeFillOverlayBlend) ?? "normal";
|
|
2393
|
+
const color = colorWithOpacity2(
|
|
2394
|
+
normalizeHexColor2(style.shapeFillOverlayColor, DEFAULT_SHADOW_COLOR),
|
|
2395
|
+
style.shapeFillOverlayOpacity
|
|
2396
|
+
);
|
|
2397
|
+
return { color, blendMode };
|
|
2398
|
+
}
|
|
2399
|
+
function getDuotoneFilterId(elementId) {
|
|
2400
|
+
return `dag-duotone-${elementId}`;
|
|
2401
|
+
}
|
|
2402
|
+
function getDuotoneSvgFilter(style, elementId) {
|
|
2403
|
+
if (!style?.dagDuotone) {
|
|
2404
|
+
return void 0;
|
|
2405
|
+
}
|
|
2406
|
+
const id = getDuotoneFilterId(elementId);
|
|
2407
|
+
const c1 = hexToRgbUnit(style.dagDuotone.color1);
|
|
2408
|
+
const c2 = hexToRgbUnit(style.dagDuotone.color2);
|
|
2409
|
+
const grayscaleMatrix = [
|
|
2410
|
+
0.2126,
|
|
2411
|
+
0.7152,
|
|
2412
|
+
0.0722,
|
|
2413
|
+
0,
|
|
2414
|
+
0,
|
|
2415
|
+
0.2126,
|
|
2416
|
+
0.7152,
|
|
2417
|
+
0.0722,
|
|
2418
|
+
0,
|
|
2419
|
+
0,
|
|
2420
|
+
0.2126,
|
|
2421
|
+
0.7152,
|
|
2422
|
+
0.0722,
|
|
2423
|
+
0,
|
|
2424
|
+
0,
|
|
2425
|
+
0,
|
|
2426
|
+
0,
|
|
2427
|
+
0,
|
|
2428
|
+
1,
|
|
2429
|
+
0
|
|
2430
|
+
].join(" ");
|
|
2431
|
+
const slopeR = c2.r - c1.r;
|
|
2432
|
+
const slopeG = c2.g - c1.g;
|
|
2433
|
+
const slopeB = c2.b - c1.b;
|
|
2434
|
+
const filterMarkup = [
|
|
2435
|
+
`<filter id="${escapeSvgAttr(id)}" color-interpolation-filters="sRGB">`,
|
|
2436
|
+
`<feColorMatrix type="matrix" values="${grayscaleMatrix}"/>`,
|
|
2437
|
+
`<feComponentTransfer>`,
|
|
2438
|
+
`<feFuncR type="linear" slope="${slopeR}" intercept="${c1.r}"/>`,
|
|
2439
|
+
`<feFuncG type="linear" slope="${slopeG}" intercept="${c1.g}"/>`,
|
|
2440
|
+
`<feFuncB type="linear" slope="${slopeB}" intercept="${c1.b}"/>`,
|
|
2441
|
+
`</feComponentTransfer>`,
|
|
2442
|
+
`</filter>`
|
|
2443
|
+
].join("");
|
|
2444
|
+
return { id, cssReference: `url(#${id})`, filterMarkup };
|
|
2445
|
+
}
|
|
2446
|
+
function getSoftEdgeFilterId(elementId) {
|
|
2447
|
+
return `soft-edge-${elementId}`;
|
|
2448
|
+
}
|
|
2449
|
+
var SOFT_EDGE_ERODE_FACTOR = 0.9;
|
|
2450
|
+
var SOFT_EDGE_BLUR_FACTOR = 0.3;
|
|
2451
|
+
function getSoftEdgeSvgFilter(style, elementId) {
|
|
2452
|
+
if (!style || typeof style.softEdgeRadius !== "number" || style.softEdgeRadius <= 0) {
|
|
2453
|
+
return void 0;
|
|
2454
|
+
}
|
|
2455
|
+
const id = getSoftEdgeFilterId(elementId);
|
|
2456
|
+
const radius = style.softEdgeRadius;
|
|
2457
|
+
const erode = (radius * SOFT_EDGE_ERODE_FACTOR).toFixed(2);
|
|
2458
|
+
const blur = (radius * SOFT_EDGE_BLUR_FACTOR).toFixed(2);
|
|
2459
|
+
const filterMarkup = [
|
|
2460
|
+
`<filter id="${escapeSvgAttr(id)}" x="-20%" y="-20%" width="140%" height="140%" color-interpolation-filters="sRGB">`,
|
|
2461
|
+
`<feMorphology in="SourceAlpha" operator="erode" radius="${erode}" result="softEdgeEroded"/>`,
|
|
2462
|
+
`<feGaussianBlur in="softEdgeEroded" stdDeviation="${blur}" result="softEdgeAlpha"/>`,
|
|
2463
|
+
`<feComposite in="SourceGraphic" in2="softEdgeAlpha" operator="in"/>`,
|
|
2464
|
+
`</filter>`
|
|
2465
|
+
].join("");
|
|
2466
|
+
return { id, cssReference: `url(#${id})`, filterMarkup };
|
|
2467
|
+
}
|
|
2468
|
+
function getShapeEffectFilterDefs(element) {
|
|
2469
|
+
const softEdge = getSoftEdgeSvgFilter(getEffectStyleSource(element), element.id);
|
|
2470
|
+
const silhouette = getSilhouetteEffects(element);
|
|
2471
|
+
if (!softEdge && !silhouette) {
|
|
2472
|
+
return void 0;
|
|
2473
|
+
}
|
|
2474
|
+
const base = softEdge ?? {
|
|
2475
|
+
id: silhouette?.filterId ?? "",
|
|
2476
|
+
cssReference: silhouette?.cssReference ?? "",
|
|
2477
|
+
filterMarkup: ""
|
|
2478
|
+
};
|
|
2479
|
+
return {
|
|
2480
|
+
...base,
|
|
2481
|
+
filterMarkup: `${softEdge?.filterMarkup ?? ""}${silhouette?.filterMarkup ?? ""}`
|
|
2482
|
+
};
|
|
2483
|
+
}
|
|
2484
|
+
function getDuotoneSvgFilterMarkup(filterId, color1, color2) {
|
|
2485
|
+
const c1 = hexToRgbUnit(color1);
|
|
2486
|
+
const c2 = hexToRgbUnit(color2);
|
|
2487
|
+
const grayscaleMatrix = [
|
|
2488
|
+
0.2126,
|
|
2489
|
+
0.7152,
|
|
2490
|
+
0.0722,
|
|
2491
|
+
0,
|
|
2492
|
+
0,
|
|
2493
|
+
0.2126,
|
|
2494
|
+
0.7152,
|
|
2495
|
+
0.0722,
|
|
2496
|
+
0,
|
|
2497
|
+
0,
|
|
2498
|
+
0.2126,
|
|
2499
|
+
0.7152,
|
|
2500
|
+
0.0722,
|
|
2501
|
+
0,
|
|
2502
|
+
0,
|
|
2503
|
+
0,
|
|
2504
|
+
0,
|
|
2505
|
+
0,
|
|
2506
|
+
1,
|
|
2507
|
+
0
|
|
2508
|
+
].join(" ");
|
|
2509
|
+
const slopeR = c2.r - c1.r;
|
|
2510
|
+
const slopeG = c2.g - c1.g;
|
|
2511
|
+
const slopeB = c2.b - c1.b;
|
|
2512
|
+
return [
|
|
2513
|
+
`<svg width="0" height="0" style="position:absolute;overflow:hidden" aria-hidden="true">`,
|
|
2514
|
+
`<defs>`,
|
|
2515
|
+
`<filter id="${escapeSvgAttr(filterId)}" color-interpolation-filters="sRGB">`,
|
|
2516
|
+
`<feColorMatrix type="matrix" values="${grayscaleMatrix}"/>`,
|
|
2517
|
+
`<feComponentTransfer>`,
|
|
2518
|
+
`<feFuncR type="linear" slope="${slopeR}" intercept="${c1.r}"/>`,
|
|
2519
|
+
`<feFuncG type="linear" slope="${slopeG}" intercept="${c1.g}"/>`,
|
|
2520
|
+
`<feFuncB type="linear" slope="${slopeB}" intercept="${c1.b}"/>`,
|
|
2521
|
+
`</feComponentTransfer>`,
|
|
2522
|
+
`</filter>`,
|
|
2523
|
+
`</defs>`,
|
|
2524
|
+
`</svg>`
|
|
2525
|
+
].join("");
|
|
2526
|
+
}
|
|
2527
|
+
function getEffectStyleSource(element) {
|
|
2528
|
+
if ("shapeStyle" in element) {
|
|
2529
|
+
return element.shapeStyle;
|
|
2530
|
+
}
|
|
2531
|
+
if (element.type === "chart") {
|
|
2532
|
+
return chartAreaEffectStyle(element.chartData);
|
|
2533
|
+
}
|
|
2534
|
+
return element.type === "group" ? element.groupEffectStyle : void 0;
|
|
2535
|
+
}
|
|
2536
|
+
function getComputedEffectStyle(element, options = {}) {
|
|
2537
|
+
const style = getEffectStyleSource(element);
|
|
2538
|
+
const result = {};
|
|
2539
|
+
if (!style) {
|
|
2540
|
+
return result;
|
|
2541
|
+
}
|
|
2542
|
+
const paintsLineEffectsItself = element.type === "connector" || getShapeType("shapeType" in element ? element.shapeType : void 0) === "connector";
|
|
2543
|
+
const shadowsCompositePixels = element.type === "group" || element.type === "text" || element.type === "image" || element.type === "picture";
|
|
2544
|
+
const compositeShadow = shadowsCompositePixels ? getCompositeOuterShadowFilterCss(style, { rotation: element.rotation }) : void 0;
|
|
2545
|
+
const silhouette = shadowsCompositePixels ? void 0 : getSilhouetteEffects(element);
|
|
2546
|
+
const boxShadow = shadowsCompositePixels ? void 0 : getBoxShadowCss(
|
|
2547
|
+
style,
|
|
2548
|
+
{
|
|
2549
|
+
includeGlow: silhouette ? false : options.includeGlowBoxShadow,
|
|
2550
|
+
includeOuter: !silhouette,
|
|
2551
|
+
includeInner: !silhouette?.paintsInnerShadow
|
|
2552
|
+
},
|
|
2553
|
+
{ rotation: element.rotation }
|
|
2554
|
+
);
|
|
2555
|
+
const lineShadow = paintsLineEffectsItself ? void 0 : getLineShadowCss(style);
|
|
2556
|
+
const shadowParts = [boxShadow, lineShadow].filter(
|
|
2557
|
+
(part) => part !== void 0 && part !== ""
|
|
2558
|
+
);
|
|
2559
|
+
if (shadowParts.length > 0) {
|
|
2560
|
+
result.boxShadow = shadowParts.join(", ");
|
|
2561
|
+
}
|
|
2562
|
+
const glowInBoxShadow = !shadowsCompositePixels && (options.includeGlowBoxShadow !== false || silhouette !== void 0);
|
|
2563
|
+
const filter = getEffectFilterCss(style, element.id, { glow: !glowInBoxShadow });
|
|
2564
|
+
const lineGlow = paintsLineEffectsItself ? void 0 : getLineGlowFilterCss(style);
|
|
2565
|
+
const filterParts = [silhouette?.cssReference, compositeShadow, filter, lineGlow].filter(
|
|
2566
|
+
(part) => part !== void 0 && part !== ""
|
|
2567
|
+
);
|
|
2568
|
+
if (filterParts.length > 0) {
|
|
2569
|
+
result.filter = filterParts.join(" ");
|
|
2570
|
+
}
|
|
2571
|
+
const reflection = getReflectionWrapperStyle(style, element.height);
|
|
2572
|
+
if (reflection) {
|
|
2573
|
+
result.reflection = reflection;
|
|
2574
|
+
}
|
|
2575
|
+
const opacity = getEffectDagOpacity(style);
|
|
2576
|
+
if (opacity !== void 0) {
|
|
2577
|
+
result.opacity = opacity;
|
|
2578
|
+
}
|
|
2579
|
+
const overlay = getEffectDagFillOverlay(style) ?? getShapeFillOverlay(style);
|
|
2580
|
+
if (overlay) {
|
|
2581
|
+
result.fillOverlay = overlay;
|
|
2582
|
+
} else {
|
|
2583
|
+
const blend = getEffectDagBlendMode(style.dagFillOverlayBlend);
|
|
2584
|
+
if (blend) {
|
|
2585
|
+
result.mixBlendMode = blend;
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
if (style.blurGrow && typeof style.blurRadius === "number" && style.blurRadius > 0) {
|
|
2589
|
+
result.overflowVisible = true;
|
|
2590
|
+
}
|
|
2591
|
+
return result;
|
|
2592
|
+
}
|
|
2593
|
+
function hasImageEffects(element) {
|
|
2594
|
+
return isImageLikeElement(element) && Boolean(element.imageEffects);
|
|
2595
|
+
}
|
|
2596
|
+
|
|
2597
|
+
// src/pptx/render/gradient-svg-image.ts
|
|
2598
|
+
function num2(value) {
|
|
2599
|
+
return String(Math.round(value * 1e4) / 1e4);
|
|
2600
|
+
}
|
|
2601
|
+
function stopMarkup(stops) {
|
|
2602
|
+
return stops.map(
|
|
2603
|
+
(stop) => `<stop offset="${num2(Math.min(Math.max(stop.position, 0), 100) / 100)}" stop-color="${escapeSvgAttr(
|
|
2604
|
+
stop.color
|
|
2605
|
+
)}"${typeof stop.opacity === "number" ? ` stop-opacity="${num2(stop.opacity)}"` : ""}/>`
|
|
2606
|
+
).join("");
|
|
2607
|
+
}
|
|
2608
|
+
function toCssUrl(svg) {
|
|
2609
|
+
return `url("data:image/svg+xml,${encodeURIComponent(svg).replace(/[()]/gu, (c) => c === "(" ? "%28" : "%29")}")`;
|
|
2610
|
+
}
|
|
2611
|
+
function buildScaledLinearGradientImage(stops, ooxmlAngleDegrees) {
|
|
2612
|
+
const radians = ooxmlAngleDegrees * Math.PI / 180;
|
|
2613
|
+
const dx = Math.cos(radians);
|
|
2614
|
+
const dy = Math.sin(radians);
|
|
2615
|
+
const span = (Math.abs(dx) + Math.abs(dy)) / 2;
|
|
2616
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1 1" preserveAspectRatio="none"><defs><linearGradient id="g" x1="${num2(0.5 - dx * span)}" y1="${num2(0.5 - dy * span)}" x2="${num2(
|
|
2617
|
+
0.5 + dx * span
|
|
2618
|
+
)}" y2="${num2(0.5 + dy * span)}">${stopMarkup(stops)}</linearGradient></defs><rect width="1" height="1" fill="url(#g)"/></svg>`;
|
|
2619
|
+
return toCssUrl(svg);
|
|
2620
|
+
}
|
|
2621
|
+
function buildFocalCircleGradientImage(stops, fx, fy, width, height) {
|
|
2622
|
+
return toCssUrl(buildFocalCircleGradientSvg(stops, fx, fy, width, height));
|
|
2623
|
+
}
|
|
2624
|
+
function buildFocalCircleGradientSvg(stops, fx, fy, width, height) {
|
|
2625
|
+
const radius = Math.hypot(width, height) / 2;
|
|
2626
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${num2(width)} ${num2(height)}" preserveAspectRatio="none"><defs><radialGradient id="g" gradientUnits="userSpaceOnUse" cx="${num2(width / 2)}" cy="${num2(
|
|
2627
|
+
height / 2
|
|
2628
|
+
)}" r="${num2(radius)}" fx="${num2(fx * width)}" fy="${num2(fy * height)}">${stopMarkup(stops)}</radialGradient></defs><rect width="${num2(width)}" height="${num2(height)}" fill="url(#g)"/></svg>`;
|
|
2629
|
+
}
|
|
2630
|
+
function buildTrueAngleLinearGradientSvg(stops, ooxmlAngleDegrees, width, height) {
|
|
2631
|
+
const radians = ooxmlAngleDegrees * Math.PI / 180;
|
|
2632
|
+
const dx = Math.cos(radians);
|
|
2633
|
+
const dy = Math.sin(radians);
|
|
2634
|
+
const half = (Math.abs(dx) * width + Math.abs(dy) * height) / 2;
|
|
2635
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${num2(width)} ${num2(height)}" preserveAspectRatio="none"><defs><linearGradient id="g" gradientUnits="userSpaceOnUse" x1="${num2(width / 2 - dx * half)}" y1="${num2(
|
|
2636
|
+
height / 2 - dy * half
|
|
2637
|
+
)}" x2="${num2(width / 2 + dx * half)}" y2="${num2(height / 2 + dy * half)}">${stopMarkup(stops)}</linearGradient></defs><rect width="${num2(width)}" height="${num2(height)}" fill="url(#g)"/></svg>`;
|
|
2638
|
+
}
|
|
2639
|
+
var CACHE_LIMIT = 64;
|
|
2640
|
+
var cache = /* @__PURE__ */ new Map();
|
|
2641
|
+
function toCssUrl2(svg) {
|
|
2642
|
+
return `url("data:image/svg+xml,${encodeURIComponent(svg).replace(/[()]/gu, (c) => c === "(" ? "%28" : "%29")}")`;
|
|
2643
|
+
}
|
|
2644
|
+
function bodyPath(geometry) {
|
|
2645
|
+
const { shapeType, width, height, adjustments } = geometry;
|
|
2646
|
+
const evaluated = evaluatePresetShape(shapeType, width, height, adjustments) ?? evaluatePresetShape(getShapeType(shapeType), width, height, adjustments);
|
|
2647
|
+
const body = evaluated?.paths.find((path) => !path.fill || path.fill === "norm");
|
|
2648
|
+
return body ? closedSubpaths(body.d) : void 0;
|
|
2649
|
+
}
|
|
2650
|
+
function buildOutlineShapePathGradient(stops, geometry, focus) {
|
|
2651
|
+
if (!(geometry.width > 0) || !(geometry.height > 0)) return void 0;
|
|
2652
|
+
const key = JSON.stringify([stops, geometry, focus]);
|
|
2653
|
+
const known = cache.get(key);
|
|
2654
|
+
if (known !== void 0) return known ?? void 0;
|
|
2655
|
+
const d = bodyPath(geometry);
|
|
2656
|
+
const svg = d ? buildOutlinePathGradientSvg(stops, d, geometry.width, geometry.height, focus.x, focus.y) : void 0;
|
|
2657
|
+
const result = svg ? toCssUrl2(svg) : null;
|
|
2658
|
+
if (cache.size >= CACHE_LIMIT) cache.delete(cache.keys().next().value);
|
|
2659
|
+
cache.set(key, result);
|
|
2660
|
+
return result ?? void 0;
|
|
2661
|
+
}
|
|
2662
|
+
|
|
168
2663
|
// src/pptx/render/vector-subpath-paint.ts
|
|
169
2664
|
function toHexByte(value) {
|
|
170
2665
|
const clamped = Math.max(0, Math.min(255, Math.round(value)));
|
|
171
2666
|
return clamped.toString(16).padStart(2, "0");
|
|
172
2667
|
}
|
|
173
|
-
function shiftHex(
|
|
174
|
-
const channels = hexToRgbChannels(
|
|
2668
|
+
function shiftHex(hex2, factor, towardsWhite) {
|
|
2669
|
+
const channels = hexToRgbChannels$1(hex2);
|
|
175
2670
|
if (!channels) {
|
|
176
|
-
return
|
|
2671
|
+
return hex2;
|
|
177
2672
|
}
|
|
178
2673
|
const shift = (c) => towardsWhite ? c + (255 - c) * factor : c * (1 - factor);
|
|
179
2674
|
return `#${toHexByte(shift(channels.r))}${toHexByte(shift(channels.g))}${toHexByte(shift(channels.b))}`;
|
|
@@ -204,75 +2699,53 @@ function buildSubpathPaints(subpaths, hasFill, fillColor, fillOpacity) {
|
|
|
204
2699
|
}
|
|
205
2700
|
|
|
206
2701
|
// src/pptx/render/subpath-fill-overlay.ts
|
|
207
|
-
function
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
2702
|
+
function hasReproducibleFillMode(element) {
|
|
2703
|
+
if (!hasShapeProperties(element)) {
|
|
2704
|
+
return false;
|
|
2705
|
+
}
|
|
2706
|
+
const mode = element.shapeStyle?.fillMode;
|
|
2707
|
+
return mode === void 0 || mode === "solid" || mode === "none";
|
|
212
2708
|
}
|
|
213
|
-
function
|
|
214
|
-
return
|
|
215
|
-
(sp) => sp.fillMode !== void 0 && sp.fillMode !== "norm" || sp.stroke === false
|
|
216
|
-
);
|
|
2709
|
+
function suppressesCssFill(element) {
|
|
2710
|
+
return hasReproducibleFillMode(element) && getSubpathGeometry(element, silhouetteFillsOverlay(element)) !== void 0;
|
|
217
2711
|
}
|
|
218
|
-
function
|
|
219
|
-
|
|
220
|
-
|
|
2712
|
+
function shadeVeil(mode, opacity) {
|
|
2713
|
+
const strength = mode === "lighten" || mode === "darken" ? 0.4 : mode === "lightenLess" || mode === "darkenLess" ? 0.2 : 0;
|
|
2714
|
+
if (strength === 0) {
|
|
2715
|
+
return void 0;
|
|
221
2716
|
}
|
|
222
|
-
|
|
2717
|
+
const channel = mode?.startsWith("lighten") ? 255 : 0;
|
|
2718
|
+
return `rgba(${channel},${channel},${channel},${Math.round(strength * opacity * 1e3) / 1e3})`;
|
|
223
2719
|
}
|
|
224
|
-
function
|
|
225
|
-
|
|
226
|
-
if (!slots) {
|
|
2720
|
+
function buildShadingOverlay(element) {
|
|
2721
|
+
if (!hasShapeProperties(element)) {
|
|
227
2722
|
return void 0;
|
|
228
2723
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
slots.customGeometryRawData,
|
|
232
|
-
slots.pathWidth,
|
|
233
|
-
slots.pathHeight,
|
|
234
|
-
slots.shapeAdjustments
|
|
235
|
-
) ?? slots.customGeometryPaths;
|
|
236
|
-
if (!structured || structured.length === 0) {
|
|
237
|
-
return void 0;
|
|
238
|
-
}
|
|
239
|
-
const subpaths2 = customGeometryPathsToSvgSubpaths(
|
|
240
|
-
structured,
|
|
241
|
-
slots.pathWidth,
|
|
242
|
-
slots.pathHeight
|
|
243
|
-
);
|
|
244
|
-
return needsPerSubpathPaint(subpaths2) ? { subpaths: subpaths2, width: slots.pathWidth, height: slots.pathHeight } : void 0;
|
|
245
|
-
}
|
|
246
|
-
if (!slots.shapeType) {
|
|
2724
|
+
const ss = element.shapeStyle;
|
|
2725
|
+
if (ss?.fillMode !== "gradient" && ss?.fillMode !== "pattern" && ss?.fillMode !== "image") {
|
|
247
2726
|
return void 0;
|
|
248
2727
|
}
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
if (!result || result.fillNone || result.paths.length === 0) {
|
|
2728
|
+
const geometry = getSubpathGeometry(element);
|
|
2729
|
+
if (!geometry) {
|
|
252
2730
|
return void 0;
|
|
253
2731
|
}
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
2732
|
+
const opacity = ss.fillOpacity ?? 1;
|
|
2733
|
+
const paints2 = geometry.subpaths.map((subpath) => ({
|
|
2734
|
+
d: subpath.d,
|
|
2735
|
+
fill: shadeVeil(subpath.fillMode, opacity) ?? "none",
|
|
2736
|
+
stroked: subpath.stroke !== false
|
|
258
2737
|
}));
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
function hasReproducibleFillMode(element) {
|
|
262
|
-
if (!hasShapeProperties(element)) {
|
|
263
|
-
return false;
|
|
2738
|
+
if (paints2.every((paint) => paint.fill === "none")) {
|
|
2739
|
+
return void 0;
|
|
264
2740
|
}
|
|
265
|
-
|
|
266
|
-
return mode === void 0 || mode === "solid" || mode === "none";
|
|
267
|
-
}
|
|
268
|
-
function suppressesCssFill(element) {
|
|
269
|
-
return hasReproducibleFillMode(element) && getSubpathGeometry(element) !== void 0;
|
|
2741
|
+
return { paints: paints2, viewBoxWidth: geometry.width, viewBoxHeight: geometry.height };
|
|
270
2742
|
}
|
|
271
2743
|
function buildSubpathFillOverlay(element) {
|
|
272
2744
|
if (!hasReproducibleFillMode(element)) {
|
|
273
|
-
return
|
|
2745
|
+
return buildShadingOverlay(element);
|
|
274
2746
|
}
|
|
275
|
-
const
|
|
2747
|
+
const silhouette = silhouetteFillsOverlay(element);
|
|
2748
|
+
const geometry = getSubpathGeometry(element, silhouette);
|
|
276
2749
|
if (!geometry) {
|
|
277
2750
|
return void 0;
|
|
278
2751
|
}
|
|
@@ -282,7 +2755,8 @@ function buildSubpathFillOverlay(element) {
|
|
|
282
2755
|
return {
|
|
283
2756
|
paints: buildSubpathPaints(geometry.subpaths, hasFill, fillColor, ss?.fillOpacity),
|
|
284
2757
|
viewBoxWidth: geometry.width,
|
|
285
|
-
viewBoxHeight: geometry.height
|
|
2758
|
+
viewBoxHeight: geometry.height,
|
|
2759
|
+
...silhouette ? { silhouette: true } : {}
|
|
286
2760
|
};
|
|
287
2761
|
}
|
|
288
2762
|
function clampCropValue(value) {
|
|
@@ -306,7 +2780,7 @@ function sanitizeGradientStops(stops) {
|
|
|
306
2780
|
).map((stop) => ({
|
|
307
2781
|
color: normalizeHexColor(String(stop.color), DEFAULT_FILL_COLOR),
|
|
308
2782
|
position: Math.max(0, Math.min(100, stop.position)),
|
|
309
|
-
opacity: typeof stop.opacity === "number" && Number.isFinite(stop.opacity) ? clampUnitInterval(stop.opacity) : void 0,
|
|
2783
|
+
opacity: typeof stop.opacity === "number" && Number.isFinite(stop.opacity) ? clampUnitInterval$1(stop.opacity) : void 0,
|
|
310
2784
|
colorRef: stop.colorRef
|
|
311
2785
|
})).sort((left, right) => left.position - right.position);
|
|
312
2786
|
}
|
|
@@ -338,16 +2812,20 @@ function computeGradientCenter(fillToRect, focalPoint) {
|
|
|
338
2812
|
}
|
|
339
2813
|
return { cx: 50, cy: 50 };
|
|
340
2814
|
}
|
|
341
|
-
function buildCirclePathGradient(stops, focalPoint, fillToRect) {
|
|
2815
|
+
function buildCirclePathGradient(stops, focalPoint, fillToRect, bounds) {
|
|
342
2816
|
const stopStr = stops.map(toCssGradientStop).join(", ");
|
|
343
2817
|
const { cx, cy } = computeGradientCenter(fillToRect, focalPoint);
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
2818
|
+
if (Math.abs(cx - 50) < 0.5 && Math.abs(cy - 50) < 0.5) {
|
|
2819
|
+
return `radial-gradient(circle farthest-corner at 50% 50%, ${stopStr})`;
|
|
2820
|
+
}
|
|
2821
|
+
const { width, height } = bounds ?? {};
|
|
2822
|
+
if (typeof width === "number" && typeof height === "number" && width > 0 && height > 0) {
|
|
2823
|
+
return buildFocalCircleGradientImage(stops, cx / 100, cy / 100, width, height);
|
|
349
2824
|
}
|
|
350
|
-
|
|
2825
|
+
const posX = `${Math.round(cx)}%`;
|
|
2826
|
+
const posY = `${Math.round(cy)}%`;
|
|
2827
|
+
const radius = Math.round(Math.max(cx, 100 - cx, cy, 100 - cy));
|
|
2828
|
+
return `radial-gradient(ellipse ${radius}% ${radius}% at ${posX} ${posY}, ${stopStr})`;
|
|
351
2829
|
}
|
|
352
2830
|
function buildRectPathGradient(stops, focalPoint, fillToRect) {
|
|
353
2831
|
return buildRectPathGradientImage(stops, focalPoint, fillToRect);
|
|
@@ -449,6 +2927,16 @@ function adjustLinearGradientAngle(angle, gradient, context) {
|
|
|
449
2927
|
}
|
|
450
2928
|
return result;
|
|
451
2929
|
}
|
|
2930
|
+
function isStretchedLinear(gradient, angle, context) {
|
|
2931
|
+
const { width, height } = context ?? {};
|
|
2932
|
+
if (gradient.fillGradientScaled === false || !width || !height) {
|
|
2933
|
+
return false;
|
|
2934
|
+
}
|
|
2935
|
+
if (Math.abs(width - height) < 0.5) {
|
|
2936
|
+
return false;
|
|
2937
|
+
}
|
|
2938
|
+
return Math.abs(angle % 90) > 0.01 && Math.abs(angle % 90 - 90) > 0.01;
|
|
2939
|
+
}
|
|
452
2940
|
function buildGradientCss(gradient, context) {
|
|
453
2941
|
if (!gradient || gradient.fillMode !== "gradient") {
|
|
454
2942
|
return void 0;
|
|
@@ -457,21 +2945,43 @@ function buildGradientCss(gradient, context) {
|
|
|
457
2945
|
if (sanitized.length === 0) {
|
|
458
2946
|
return gradient.fillGradient;
|
|
459
2947
|
}
|
|
460
|
-
const stops =
|
|
2948
|
+
const stops = officeGradientStops(sanitized);
|
|
461
2949
|
const gradientType = gradient.fillGradientType || "linear";
|
|
462
2950
|
if (gradientType === "radial") {
|
|
463
2951
|
const pathType = gradient.fillGradientPathType || "circle";
|
|
464
2952
|
const fp = gradient.fillGradientFocalPoint;
|
|
465
2953
|
const ftr = gradient.fillGradientFillToRect;
|
|
466
|
-
if (pathType === "rect") {
|
|
2954
|
+
if (pathType === "rect" || pathType === "shape" && context?.rectangular) {
|
|
467
2955
|
return buildRectPathGradient(stops, fp, ftr);
|
|
468
2956
|
}
|
|
469
2957
|
if (pathType === "shape") {
|
|
2958
|
+
const field = context?.freeform ? "circle" : context?.shapeType ? shapePathGradientField(context.shapeType) : "legacy";
|
|
2959
|
+
if (field === "circle") {
|
|
2960
|
+
return buildCirclePathGradient(stops, fp, ftr, context);
|
|
2961
|
+
}
|
|
2962
|
+
if (field === "outline" && context?.shapeType) {
|
|
2963
|
+
const { cx, cy } = computeGradientCenter(ftr, fp);
|
|
2964
|
+
const scaled = buildOutlineShapePathGradient(
|
|
2965
|
+
stops,
|
|
2966
|
+
{
|
|
2967
|
+
shapeType: context.shapeType,
|
|
2968
|
+
width: context.width ?? 0,
|
|
2969
|
+
height: context.height ?? 0,
|
|
2970
|
+
adjustments: context.shapeAdjustments
|
|
2971
|
+
},
|
|
2972
|
+
{ x: cx / 100, y: cy / 100 }
|
|
2973
|
+
);
|
|
2974
|
+
if (scaled) return scaled;
|
|
2975
|
+
}
|
|
470
2976
|
return buildShapePathGradient(stops, fp, ftr);
|
|
471
2977
|
}
|
|
472
|
-
return buildCirclePathGradient(stops, fp, ftr);
|
|
2978
|
+
return buildCirclePathGradient(stops, fp, ftr, context);
|
|
473
2979
|
}
|
|
474
2980
|
const normalizedAngle = typeof gradient.fillGradientAngle === "number" && Number.isFinite(gradient.fillGradientAngle) ? gradient.fillGradientAngle : 90;
|
|
2981
|
+
const flipped = gradient.fillGradientFlip && gradient.fillGradientFlip !== "none";
|
|
2982
|
+
if (isStretchedLinear(gradient, normalizedAngle, context) && !flipped && gradient.fillGradientRotWithShape !== false) {
|
|
2983
|
+
return buildScaledLinearGradientImage(stops, normalizedAngle);
|
|
2984
|
+
}
|
|
475
2985
|
const effectiveAngle = convertOoxmlAngleToCss(
|
|
476
2986
|
adjustLinearGradientAngle(normalizedAngle, gradient, context)
|
|
477
2987
|
);
|
|
@@ -841,7 +3351,7 @@ function getComputedFillStyle(element, parentGroupFill) {
|
|
|
841
3351
|
if (!ss) {
|
|
842
3352
|
return {};
|
|
843
3353
|
}
|
|
844
|
-
if (suppressesCssFill(element)) {
|
|
3354
|
+
if (suppressesCssFill(element) || silhouetteFillsLayer(element)) {
|
|
845
3355
|
return { backgroundColor: "transparent" };
|
|
846
3356
|
}
|
|
847
3357
|
if (ss.fillMode === "group") {
|
|
@@ -860,10 +3370,19 @@ function resolveComputedFill(ss, element) {
|
|
|
860
3370
|
backgroundSize: tile ? "auto" : "100% 100%"
|
|
861
3371
|
};
|
|
862
3372
|
}
|
|
3373
|
+
const freeform = element.type === "shape" && (Boolean(element.pathData) || (element.customGeometryPaths?.length ?? 0) > 0);
|
|
863
3374
|
const geometry = {
|
|
864
3375
|
rotation: element.rotation,
|
|
865
3376
|
width: element.width,
|
|
866
|
-
height: element.height
|
|
3377
|
+
height: element.height,
|
|
3378
|
+
// `getShapeType` folds every preset it does not model onto `rect`, so the
|
|
3379
|
+
// raw name decides: only a real rectangle follows the box.
|
|
3380
|
+
rectangular: element.type === "shape" && !freeform && (!element.shapeType || element.shapeType.toLowerCase() === "rect"),
|
|
3381
|
+
...element.type === "shape" ? {
|
|
3382
|
+
freeform,
|
|
3383
|
+
...element.shapeType ? { shapeType: element.shapeType } : {},
|
|
3384
|
+
shapeAdjustments: element.shapeAdjustments
|
|
3385
|
+
} : {}
|
|
867
3386
|
};
|
|
868
3387
|
const gradient = buildGradientCss(ss, geometry) ?? (ss.fillMode === "gradient" ? ss.fillGradient : void 0);
|
|
869
3388
|
if (gradient) {
|
|
@@ -885,8 +3404,8 @@ function resolveComputedFill(ss, element) {
|
|
|
885
3404
|
backgroundRepeat: tileRect.backgroundRepeat
|
|
886
3405
|
};
|
|
887
3406
|
}
|
|
888
|
-
const
|
|
889
|
-
if (
|
|
3407
|
+
const isSvgImage = gradient.startsWith("url(");
|
|
3408
|
+
if (isSvgImage) {
|
|
890
3409
|
return {
|
|
891
3410
|
backgroundImage: gradient,
|
|
892
3411
|
backgroundSize: "100% 100%",
|
|
@@ -989,36 +3508,9 @@ function getCompoundLineStyle(compoundLine, strokeColor, strokeWidth) {
|
|
|
989
3508
|
borderStyle: "double"
|
|
990
3509
|
};
|
|
991
3510
|
}
|
|
992
|
-
function getSvgStrokeDasharray(dashType, strokeWidth, customDashSegments) {
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
}
|
|
996
|
-
const stroke = Math.max(strokeWidth, 1);
|
|
997
|
-
if (dashType === "custom" && customDashSegments && customDashSegments.length > 0) {
|
|
998
|
-
return customDashSegments.flatMap((seg) => [seg.dash / 1e3 * stroke, seg.space / 1e3 * stroke]).join(" ");
|
|
999
|
-
}
|
|
1000
|
-
switch (dashType) {
|
|
1001
|
-
case "dot":
|
|
1002
|
-
case "sysDot":
|
|
1003
|
-
return `${stroke} ${stroke * 2}`;
|
|
1004
|
-
case "dash":
|
|
1005
|
-
case "sysDash":
|
|
1006
|
-
return `${stroke * 4} ${stroke * 2}`;
|
|
1007
|
-
case "lgDash":
|
|
1008
|
-
return `${stroke * 7} ${stroke * 2.5}`;
|
|
1009
|
-
case "dashDot":
|
|
1010
|
-
case "sysDashDot":
|
|
1011
|
-
return `${stroke * 4} ${stroke * 2} ${stroke} ${stroke * 2}`;
|
|
1012
|
-
case "lgDashDot":
|
|
1013
|
-
return `${stroke * 7} ${stroke * 2.5} ${stroke} ${stroke * 2.5}`;
|
|
1014
|
-
case "lgDashDotDot":
|
|
1015
|
-
case "sysDashDotDot":
|
|
1016
|
-
return `${stroke * 7} ${stroke * 2.5} ${stroke} ${stroke * 2} ${stroke} ${stroke * 2}`;
|
|
1017
|
-
case "custom":
|
|
1018
|
-
return `${stroke * 3} ${stroke * 2}`;
|
|
1019
|
-
default:
|
|
1020
|
-
return void 0;
|
|
1021
|
-
}
|
|
3511
|
+
function getSvgStrokeDasharray(dashType, strokeWidth, customDashSegments, lineCap) {
|
|
3512
|
+
const pattern = dashPatternUnits(dashType, customDashSegments);
|
|
3513
|
+
return pattern ? capCompensatedDashArray(pattern, strokeWidth, lineCap) : void 0;
|
|
1022
3514
|
}
|
|
1023
3515
|
function getElementTransform(element) {
|
|
1024
3516
|
const transforms = [];
|
|
@@ -1084,14 +3576,97 @@ function parseDrawingPercent(value) {
|
|
|
1084
3576
|
if (!Number.isFinite(parsed)) {
|
|
1085
3577
|
return void 0;
|
|
1086
3578
|
}
|
|
1087
|
-
return clampUnitInterval(parsed / 1e5);
|
|
3579
|
+
return clampUnitInterval$1(parsed / 1e5);
|
|
3580
|
+
}
|
|
3581
|
+
|
|
3582
|
+
// src/pptx/render/dash-square-cap.ts
|
|
3583
|
+
function parsePolyline(d) {
|
|
3584
|
+
const tokens = d.match(/[A-Za-z]|-?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?/giu);
|
|
3585
|
+
if (!tokens || tokens[0] !== "M") return void 0;
|
|
3586
|
+
const points = [];
|
|
3587
|
+
let cmd = "";
|
|
3588
|
+
let i = 0;
|
|
3589
|
+
while (i < tokens.length) {
|
|
3590
|
+
const token = tokens[i];
|
|
3591
|
+
if (/^[A-Za-z]$/u.test(token)) {
|
|
3592
|
+
cmd = token;
|
|
3593
|
+
i += 1;
|
|
3594
|
+
if (cmd !== "M" && cmd !== "L") return void 0;
|
|
3595
|
+
if (cmd === "M" && points.length > 0) return void 0;
|
|
3596
|
+
continue;
|
|
3597
|
+
}
|
|
3598
|
+
const x = Number(token);
|
|
3599
|
+
const y = Number(tokens[i + 1]);
|
|
3600
|
+
if (!Number.isFinite(x) || !Number.isFinite(y)) return void 0;
|
|
3601
|
+
points.push([x, y]);
|
|
3602
|
+
i += 2;
|
|
3603
|
+
}
|
|
3604
|
+
return points.length >= 2 ? points : void 0;
|
|
3605
|
+
}
|
|
3606
|
+
var fmt4 = (n) => String(Number(n.toFixed(4)));
|
|
3607
|
+
function endsInDash(lengths, length) {
|
|
3608
|
+
const period = lengths.reduce((a, b) => a + b, 0);
|
|
3609
|
+
if (period <= 0) return false;
|
|
3610
|
+
let at = length % period;
|
|
3611
|
+
for (let i = 0; i < lengths.length; i += 1) {
|
|
3612
|
+
const len = lengths[i];
|
|
3613
|
+
if (at < len) return i % 2 === 0 && at > 0;
|
|
3614
|
+
at -= len;
|
|
3615
|
+
}
|
|
3616
|
+
return false;
|
|
3617
|
+
}
|
|
3618
|
+
function squareCapDashedPathData(d, strokeWidth, dashType, lineCap, customSegments) {
|
|
3619
|
+
if (lineCap !== "sq") return d;
|
|
3620
|
+
const pattern = dashPatternUnits(
|
|
3621
|
+
customSegments && customSegments.length > 0 ? "custom" : normalizeStrokeDashType(dashType),
|
|
3622
|
+
customSegments
|
|
3623
|
+
);
|
|
3624
|
+
const points = parsePolyline(d);
|
|
3625
|
+
if (!pattern || !points || !(strokeWidth > 0)) return d;
|
|
3626
|
+
const pen = dashPenWidth(strokeWidth);
|
|
3627
|
+
const half = pen / 2;
|
|
3628
|
+
const unit2 = pattern.map((n) => n * pen);
|
|
3629
|
+
const lengths = unit2.length % 2 === 1 ? [...unit2, ...unit2] : unit2;
|
|
3630
|
+
if ((lengths[0] ?? 0) < half) return d;
|
|
3631
|
+
let total = 0;
|
|
3632
|
+
let first;
|
|
3633
|
+
let last;
|
|
3634
|
+
for (let i = 1; i < points.length; i += 1) {
|
|
3635
|
+
const a = points[i - 1];
|
|
3636
|
+
const b = points[i];
|
|
3637
|
+
const len = Math.hypot(b[0] - a[0], b[1] - a[1]);
|
|
3638
|
+
if (len === 0) continue;
|
|
3639
|
+
total += len;
|
|
3640
|
+
first ??= [(b[0] - a[0]) / len, (b[1] - a[1]) / len];
|
|
3641
|
+
last = [(b[0] - a[0]) / len, (b[1] - a[1]) / len];
|
|
3642
|
+
}
|
|
3643
|
+
if (!first || !last || total === 0) return d;
|
|
3644
|
+
const p0 = points[0];
|
|
3645
|
+
const pn = points[points.length - 1];
|
|
3646
|
+
let out = `M${fmt4(p0[0] - first[0] * half)},${fmt4(p0[1] - first[1] * half)} L${fmt4(p0[0])},${fmt4(p0[1])} ${d}`;
|
|
3647
|
+
if (endsInDash(lengths, total)) {
|
|
3648
|
+
out += ` M${fmt4(pn[0])},${fmt4(pn[1])} L${fmt4(pn[0] + last[0] * half)},${fmt4(pn[1] + last[1] * half)}`;
|
|
3649
|
+
}
|
|
3650
|
+
return out;
|
|
1088
3651
|
}
|
|
1089
3652
|
|
|
1090
3653
|
// src/pptx/render/connector-dash.ts
|
|
1091
|
-
function buildDashArray(dash, strokeWidth, customDashSegments) {
|
|
3654
|
+
function buildDashArray(dash, strokeWidth, customDashSegments, lineCap) {
|
|
1092
3655
|
const segments = customDashSegments && customDashSegments.length > 0 ? customDashSegments.map((seg) => ({ dash: seg.dash, space: seg.space })) : void 0;
|
|
1093
3656
|
const dashType = segments ? "custom" : normalizeStrokeDashType(dash);
|
|
1094
|
-
return getSvgStrokeDasharray(dashType, strokeWidth, segments);
|
|
3657
|
+
return getSvgStrokeDasharray(dashType, strokeWidth, segments, lineCap);
|
|
3658
|
+
}
|
|
3659
|
+
function connectorSquareCapPath(d, style, strokeWidth, hasMarkersOrStrands) {
|
|
3660
|
+
if (hasMarkersOrStrands || style?.lineCap !== "sq" || !style.strokeDash) return void 0;
|
|
3661
|
+
if (normalizeStrokeDashType(style.strokeDash) === "solid") return void 0;
|
|
3662
|
+
const out = squareCapDashedPathData(
|
|
3663
|
+
d,
|
|
3664
|
+
Math.max(strokeWidth, 1),
|
|
3665
|
+
style.strokeDash,
|
|
3666
|
+
style.lineCap,
|
|
3667
|
+
style.customDashSegments
|
|
3668
|
+
);
|
|
3669
|
+
return out === d ? void 0 : out;
|
|
1095
3670
|
}
|
|
1096
3671
|
|
|
1097
3672
|
// src/pptx/render/chart-legend-swatch.ts
|
|
@@ -1756,7 +4331,7 @@ function shadowMarkup(shapes, shadow) {
|
|
|
1756
4331
|
).join("");
|
|
1757
4332
|
return `<filter id="${id}" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur stdDeviation="${r2(blur)}"/></filter><g filter="url(#${id})" opacity="${r2(opacityOf(shadow.transparency))}" transform="translate(${r2(dist * Math.cos(rad))} ${r2(dist * Math.sin(rad))})">${body}</g>`;
|
|
1758
4333
|
}
|
|
1759
|
-
function
|
|
4334
|
+
function glowMarkup2(shapes, glow) {
|
|
1760
4335
|
const id = uid("g");
|
|
1761
4336
|
const radius = ptToPx(glow.radius);
|
|
1762
4337
|
const color = safeColor(glow.color, "#FFFFFF");
|
|
@@ -1780,7 +4355,7 @@ function effectsBehind(shapes, effects) {
|
|
|
1780
4355
|
if (!effects || shapes.length === 0) {
|
|
1781
4356
|
return "";
|
|
1782
4357
|
}
|
|
1783
|
-
return (effects.shadow ? shadowMarkup(shapes, effects.shadow) : "") + (effects.glow && effects.glow.radius > 0 ?
|
|
4358
|
+
return (effects.shadow ? shadowMarkup(shapes, effects.shadow) : "") + (effects.glow && effects.glow.radius > 0 ? glowMarkup2(shapes, effects.glow) : "");
|
|
1784
4359
|
}
|
|
1785
4360
|
function paintedShapes(shapes, paint, softEdge) {
|
|
1786
4361
|
const inner = shapes.map(paint).join("");
|
|
@@ -2011,9 +4586,9 @@ function needsLineDecoration(line2) {
|
|
|
2011
4586
|
function arrowHead(type, tip, ux, uy, width, paint) {
|
|
2012
4587
|
const length = Math.max(6, width * 3);
|
|
2013
4588
|
const half = Math.max(3, width * 1.5);
|
|
2014
|
-
const
|
|
4589
|
+
const px2 = -uy;
|
|
2015
4590
|
const py = ux;
|
|
2016
|
-
const at = (along, across) => `${r23(tip.x + ux * along +
|
|
4591
|
+
const at = (along, across) => `${r23(tip.x + ux * along + px2 * across)},${r23(tip.y + uy * along + py * across)}`;
|
|
2017
4592
|
switch (type) {
|
|
2018
4593
|
case "triangle":
|
|
2019
4594
|
return `<polygon points="${at(0, 0)} ${at(-length, half)} ${at(-length, -half)}" fill="${paint}"/>`;
|
|
@@ -2769,18 +5344,18 @@ function build3DSurfacePanels(prims, surfaces, depth) {
|
|
|
2769
5344
|
|
|
2770
5345
|
// src/render-cache.ts
|
|
2771
5346
|
var RENDER_CACHE_MAX_BYTES = 8 * 1024 * 1024;
|
|
2772
|
-
function setBoundedRenderCache(
|
|
5347
|
+
function setBoundedRenderCache(cache2, key, value, maxEntries) {
|
|
2773
5348
|
const bytesOf = (entryKey, entryValue) => (entryKey.length + (typeof entryValue === "string" ? entryValue.length : 0)) * 2;
|
|
2774
|
-
|
|
5349
|
+
cache2.delete(key);
|
|
2775
5350
|
if (bytesOf(key, value) > RENDER_CACHE_MAX_BYTES) return;
|
|
2776
|
-
|
|
5351
|
+
cache2.set(key, value);
|
|
2777
5352
|
let bytes = 0;
|
|
2778
|
-
for (const [entryKey, entryValue] of
|
|
2779
|
-
while (
|
|
2780
|
-
const first =
|
|
5353
|
+
for (const [entryKey, entryValue] of cache2) bytes += bytesOf(entryKey, entryValue);
|
|
5354
|
+
while (cache2.size > maxEntries || bytes > RENDER_CACHE_MAX_BYTES) {
|
|
5355
|
+
const first = cache2.entries().next().value;
|
|
2781
5356
|
if (!first) break;
|
|
2782
5357
|
bytes -= bytesOf(first[0], first[1]);
|
|
2783
|
-
|
|
5358
|
+
cache2.delete(first[0]);
|
|
2784
5359
|
}
|
|
2785
5360
|
}
|
|
2786
5361
|
|
|
@@ -3219,8 +5794,8 @@ function ribbonExtrusion(prims, depth) {
|
|
|
3219
5794
|
}
|
|
3220
5795
|
function shiftPoints(points, dx, dy) {
|
|
3221
5796
|
return points.trim().split(/\s+/u).map((pair) => {
|
|
3222
|
-
const [
|
|
3223
|
-
return `${
|
|
5797
|
+
const [px2, py] = pair.split(",").map(Number);
|
|
5798
|
+
return `${px2 + dx},${py + dy}`;
|
|
3224
5799
|
}).join(" ");
|
|
3225
5800
|
}
|
|
3226
5801
|
function applyChart3DDepth(vm, chartType, view3D, surfaces, grouping, pieCenter, picture) {
|
|
@@ -3328,16 +5903,16 @@ var DISPLAY_UNIT_LABELS = {
|
|
|
3328
5903
|
billions: "Billions",
|
|
3329
5904
|
trillions: "Trillions"
|
|
3330
5905
|
};
|
|
3331
|
-
function getDisplayUnitDivisor(
|
|
3332
|
-
if (!
|
|
5906
|
+
function getDisplayUnitDivisor(unit2, customValue) {
|
|
5907
|
+
if (!unit2) {
|
|
3333
5908
|
return 1;
|
|
3334
5909
|
}
|
|
3335
|
-
if (
|
|
5910
|
+
if (unit2 === "custom" && customValue) {
|
|
3336
5911
|
return customValue;
|
|
3337
5912
|
}
|
|
3338
|
-
return DISPLAY_UNIT_DIVISORS[
|
|
5913
|
+
return DISPLAY_UNIT_DIVISORS[unit2] ?? 1;
|
|
3339
5914
|
}
|
|
3340
|
-
function getDisplayUnitLabel(
|
|
5915
|
+
function getDisplayUnitLabel(unit2, customLabel) {
|
|
3341
5916
|
if (typeof customLabel === "string") {
|
|
3342
5917
|
return customLabel;
|
|
3343
5918
|
}
|
|
@@ -3347,10 +5922,10 @@ function getDisplayUnitLabel(unit, customLabel) {
|
|
|
3347
5922
|
if (customLabel?.text) {
|
|
3348
5923
|
return customLabel.text;
|
|
3349
5924
|
}
|
|
3350
|
-
if (!
|
|
5925
|
+
if (!unit2 || unit2 === "custom") {
|
|
3351
5926
|
return "";
|
|
3352
5927
|
}
|
|
3353
|
-
return DISPLAY_UNIT_LABELS[
|
|
5928
|
+
return DISPLAY_UNIT_LABELS[unit2] ?? "";
|
|
3354
5929
|
}
|
|
3355
5930
|
function formatAxisValueWithUnits(value, axis) {
|
|
3356
5931
|
if (!axis?.displayUnits) {
|
|
@@ -3596,9 +6171,9 @@ function resolveMarkerLabelPlacement(chartData, series, pointIndex, point, frame
|
|
|
3596
6171
|
}
|
|
3597
6172
|
|
|
3598
6173
|
// src/pptx/render/chart-label-measure.ts
|
|
3599
|
-
var
|
|
3600
|
-
var DATA_LABEL_PAD_X = 3 *
|
|
3601
|
-
var DATA_LABEL_PAD_Y = 1.5 *
|
|
6174
|
+
var PX_PER_PT2 = 4 / 3;
|
|
6175
|
+
var DATA_LABEL_PAD_X = 3 * PX_PER_PT2;
|
|
6176
|
+
var DATA_LABEL_PAD_Y = 1.5 * PX_PER_PT2;
|
|
3602
6177
|
var DATA_LABEL_LINE_HEIGHT = 1.2207;
|
|
3603
6178
|
var ASCENT = 0.952;
|
|
3604
6179
|
var injected;
|
|
@@ -3672,7 +6247,7 @@ function calloutPoints(box, target) {
|
|
|
3672
6247
|
[x, y + h]
|
|
3673
6248
|
];
|
|
3674
6249
|
if (!target) {
|
|
3675
|
-
return corners.map(([
|
|
6250
|
+
return corners.map(([px2, py]) => `${r25(px2)},${r25(py)}`).join(" ");
|
|
3676
6251
|
}
|
|
3677
6252
|
const below = target.y > y + h;
|
|
3678
6253
|
const above = target.y < y;
|
|
@@ -3721,7 +6296,7 @@ function calloutPoints(box, target) {
|
|
|
3721
6296
|
[x, cy - base / 4]
|
|
3722
6297
|
);
|
|
3723
6298
|
}
|
|
3724
|
-
return pts.map(([
|
|
6299
|
+
return pts.map(([px2, py]) => `${r25(px2)},${r25(py)}`).join(" ");
|
|
3725
6300
|
}
|
|
3726
6301
|
function calloutLabelLift(chartData, series, fontSize, moved) {
|
|
3727
6302
|
const opts = series.dataLabelOptions ?? chartData.style?.dataLabels;
|
|
@@ -5617,12 +8192,12 @@ function buildDateAxisPlan(chartData, layout, selectedAxis, axisY) {
|
|
|
5617
8192
|
const x = serialToX(value, min, max, layout);
|
|
5618
8193
|
return axis.orientation === "maxMin" ? layout.plotLeft + layout.plotWidth - (x - layout.plotLeft) : x;
|
|
5619
8194
|
});
|
|
5620
|
-
const
|
|
8195
|
+
const unit2 = axis.majorTimeUnit ?? axis.baseTimeUnit ?? "days";
|
|
5621
8196
|
const ticks = calendarTicks(
|
|
5622
8197
|
min,
|
|
5623
8198
|
max,
|
|
5624
8199
|
dates.date1904 ?? false,
|
|
5625
|
-
|
|
8200
|
+
unit2,
|
|
5626
8201
|
Math.max(1, axis.majorUnit ?? 1)
|
|
5627
8202
|
);
|
|
5628
8203
|
const y = axisY ?? (axis.axPos === "t" ? layout.plotTop : layout.plotBottom);
|
|
@@ -5645,7 +8220,7 @@ function buildDateAxisPlan(chartData, layout, selectedAxis, axisY) {
|
|
|
5645
8220
|
y: labelsAbove ? labelY - offset : labelY + offset,
|
|
5646
8221
|
text: formatDate(
|
|
5647
8222
|
excelSerialToDate(serial5, dates.date1904),
|
|
5648
|
-
|
|
8223
|
+
unit2,
|
|
5649
8224
|
axis.numFmt?.formatCode ?? dates.formatCode
|
|
5650
8225
|
),
|
|
5651
8226
|
...chartAxisTextStyle(axis),
|
|
@@ -5676,7 +8251,7 @@ function buildDateAxisPlan(chartData, layout, selectedAxis, axisY) {
|
|
|
5676
8251
|
});
|
|
5677
8252
|
}
|
|
5678
8253
|
if (!axis.deleted && axis.minorTickMark && axis.minorTickMark !== "none") {
|
|
5679
|
-
const minorUnit = axis.minorTimeUnit ?? axis.baseTimeUnit ??
|
|
8254
|
+
const minorUnit = axis.minorTimeUnit ?? axis.baseTimeUnit ?? unit2;
|
|
5680
8255
|
for (const serial5 of calendarTicks(
|
|
5681
8256
|
min,
|
|
5682
8257
|
max,
|
|
@@ -5827,25 +8402,25 @@ function wrapTextByEstimatedWidth(text, maxWidth, fontSize, options = {}) {
|
|
|
5827
8402
|
}
|
|
5828
8403
|
let current = "";
|
|
5829
8404
|
let pendingWhitespace = false;
|
|
5830
|
-
for (const
|
|
5831
|
-
if (/^\s+$/u.test(
|
|
8405
|
+
for (const unit2 of estimatedWrapUnits(paragraph)) {
|
|
8406
|
+
if (/^\s+$/u.test(unit2)) {
|
|
5832
8407
|
pendingWhitespace = current.length > 0;
|
|
5833
8408
|
continue;
|
|
5834
8409
|
}
|
|
5835
8410
|
const separator = pendingWhitespace && current.length > 0 ? " " : "";
|
|
5836
|
-
const candidate = `${current}${separator}${
|
|
8411
|
+
const candidate = `${current}${separator}${unit2}`;
|
|
5837
8412
|
if (current.length === 0 || estimatedTextWidth(Array.from(candidate), fontSize) <= maxWidth) {
|
|
5838
8413
|
current = candidate;
|
|
5839
8414
|
pendingWhitespace = false;
|
|
5840
8415
|
continue;
|
|
5841
8416
|
}
|
|
5842
|
-
if (HANGING_PUNCTUATION_RE.test(
|
|
5843
|
-
current +=
|
|
8417
|
+
if (HANGING_PUNCTUATION_RE.test(unit2)) {
|
|
8418
|
+
current += unit2;
|
|
5844
8419
|
pendingWhitespace = false;
|
|
5845
8420
|
continue;
|
|
5846
8421
|
}
|
|
5847
8422
|
lines.push(current);
|
|
5848
|
-
current =
|
|
8423
|
+
current = unit2;
|
|
5849
8424
|
pendingWhitespace = false;
|
|
5850
8425
|
}
|
|
5851
8426
|
const completed = current.trimEnd();
|
|
@@ -7320,22 +9895,22 @@ function applyParetoConversion(data) {
|
|
|
7320
9895
|
]
|
|
7321
9896
|
};
|
|
7322
9897
|
}
|
|
7323
|
-
function orderParetoEntries(
|
|
7324
|
-
return [...
|
|
9898
|
+
function orderParetoEntries(entries2) {
|
|
9899
|
+
return [...entries2].sort(
|
|
7325
9900
|
(left, right) => Math.max(right.value, 0) - Math.max(left.value, 0) || left.sourcePointIndex - right.sourcePointIndex
|
|
7326
9901
|
);
|
|
7327
9902
|
}
|
|
7328
|
-
function buildParetoPrimitives(
|
|
7329
|
-
const total =
|
|
9903
|
+
function buildParetoPrimitives(entries2, layout, series, seriesIndex) {
|
|
9904
|
+
const total = entries2.reduce((sum, entry) => sum + Math.max(entry.value, 0), 0);
|
|
7330
9905
|
if (total <= 0) {
|
|
7331
9906
|
return [];
|
|
7332
9907
|
}
|
|
7333
9908
|
let cumulative = 0;
|
|
7334
|
-
const points =
|
|
9909
|
+
const points = entries2.map((entry, displayIndex) => {
|
|
7335
9910
|
cumulative += Math.max(entry.value, 0);
|
|
7336
|
-
const percentage = displayIndex ===
|
|
9911
|
+
const percentage = displayIndex === entries2.length - 1 ? 100 : cumulative / total * 100;
|
|
7337
9912
|
return {
|
|
7338
|
-
x: layout.plotLeft + layout.plotWidth * (displayIndex + 0.5) /
|
|
9913
|
+
x: layout.plotLeft + layout.plotWidth * (displayIndex + 0.5) / entries2.length,
|
|
7339
9914
|
y: layout.plotBottom - layout.plotHeight * percentage / 100,
|
|
7340
9915
|
pointIndex: entry.sourcePointIndex
|
|
7341
9916
|
};
|
|
@@ -7421,9 +9996,9 @@ function buildHistogramViewModel(element, chartData, categoryLabels) {
|
|
|
7421
9996
|
value,
|
|
7422
9997
|
label: categoryLabels[index] ?? ""
|
|
7423
9998
|
}))).map((entry, sourcePointIndex) => ({ ...entry, sourcePointIndex }));
|
|
7424
|
-
const
|
|
7425
|
-
const values =
|
|
7426
|
-
const labels =
|
|
9999
|
+
const entries2 = paretoIndex >= 0 ? orderParetoEntries(baseEntries) : baseEntries;
|
|
10000
|
+
const values = entries2.map((entry) => entry.value);
|
|
10001
|
+
const labels = entries2.map((entry) => entry.label);
|
|
7427
10002
|
const range = distributionRange([{ name: series?.name ?? "", values }]);
|
|
7428
10003
|
const bars = computeHistogramBars(
|
|
7429
10004
|
values,
|
|
@@ -7446,14 +10021,14 @@ function buildHistogramViewModel(element, chartData, categoryLabels) {
|
|
|
7446
10021
|
part: {
|
|
7447
10022
|
role: "dataPoint",
|
|
7448
10023
|
seriesIndex: histogramIndex,
|
|
7449
|
-
pointIndex:
|
|
10024
|
+
pointIndex: entries2[displayIndex]?.sourcePointIndex ?? displayIndex
|
|
7450
10025
|
}
|
|
7451
10026
|
}
|
|
7452
10027
|
})
|
|
7453
10028
|
);
|
|
7454
10029
|
if (paretoIndex >= 0) {
|
|
7455
10030
|
primitives.push(
|
|
7456
|
-
...buildParetoPrimitives(
|
|
10031
|
+
...buildParetoPrimitives(entries2, layout, chartData.series[paretoIndex], paretoIndex)
|
|
7457
10032
|
);
|
|
7458
10033
|
}
|
|
7459
10034
|
const dataLabels = chartData.style?.hasDataLabels ? bars.map((bar, index) => ({
|
|
@@ -7468,7 +10043,7 @@ function buildHistogramViewModel(element, chartData, categoryLabels) {
|
|
|
7468
10043
|
resolveDataLabelTextStyle(
|
|
7469
10044
|
chartData,
|
|
7470
10045
|
series,
|
|
7471
|
-
|
|
10046
|
+
entries2[index]?.sourcePointIndex ?? index
|
|
7472
10047
|
)
|
|
7473
10048
|
) : {}
|
|
7474
10049
|
})) : [];
|
|
@@ -7828,11 +10403,11 @@ function splitLabelLines(label) {
|
|
|
7828
10403
|
}
|
|
7829
10404
|
|
|
7830
10405
|
// src/pptx/render/chart-legend-entries.ts
|
|
7831
|
-
function applyLegendEntryOverrides(legend,
|
|
7832
|
-
if ((!
|
|
10406
|
+
function applyLegendEntryOverrides(legend, entries2, defaultTextStyle) {
|
|
10407
|
+
if ((!entries2 || entries2.length === 0) && !defaultTextStyle) {
|
|
7833
10408
|
return legend;
|
|
7834
10409
|
}
|
|
7835
|
-
const byIndex = new Map((
|
|
10410
|
+
const byIndex = new Map((entries2 ?? []).map((entry) => [entry.index, entry]));
|
|
7836
10411
|
const result = [];
|
|
7837
10412
|
legend.forEach((item, index) => {
|
|
7838
10413
|
const override = byIndex.get(index);
|
|
@@ -8084,11 +10659,11 @@ var AXIS_LABEL_COLOR = "#64748b";
|
|
|
8084
10659
|
var ZERO_LINE_COLOR = "#94a3b8";
|
|
8085
10660
|
var TICK_COUNT3 = 5;
|
|
8086
10661
|
function axisTickValues(range) {
|
|
8087
|
-
const
|
|
8088
|
-
if (
|
|
8089
|
-
const steps = Math.round((range.max - range.min) /
|
|
10662
|
+
const unit2 = range.majorUnit;
|
|
10663
|
+
if (unit2 !== void 0 && Number.isFinite(unit2) && unit2 > 0 && !range.logScale) {
|
|
10664
|
+
const steps = Math.round((range.max - range.min) / unit2);
|
|
8090
10665
|
if (steps >= 1 && steps <= 100) {
|
|
8091
|
-
return Array.from({ length: steps + 1 }, (_unused, index) => range.min +
|
|
10666
|
+
return Array.from({ length: steps + 1 }, (_unused, index) => range.min + unit2 * index);
|
|
8092
10667
|
}
|
|
8093
10668
|
}
|
|
8094
10669
|
return Array.from(
|
|
@@ -9099,19 +11674,19 @@ function seriesXValues(chartData, series) {
|
|
|
9099
11674
|
return fromCategories.length > 0 ? fromCategories : void 0;
|
|
9100
11675
|
}
|
|
9101
11676
|
function computeScatterXDomain(perSeriesXValues) {
|
|
9102
|
-
const
|
|
11677
|
+
const finite2 = [];
|
|
9103
11678
|
for (const values of perSeriesXValues) {
|
|
9104
11679
|
for (const value of values ?? []) {
|
|
9105
11680
|
if (Number.isFinite(value)) {
|
|
9106
|
-
|
|
11681
|
+
finite2.push(value);
|
|
9107
11682
|
}
|
|
9108
11683
|
}
|
|
9109
11684
|
}
|
|
9110
|
-
if (
|
|
11685
|
+
if (finite2.length === 0) {
|
|
9111
11686
|
return void 0;
|
|
9112
11687
|
}
|
|
9113
|
-
const min = Math.min(...
|
|
9114
|
-
return { min, span: Math.max(Math.max(...
|
|
11688
|
+
const min = Math.min(...finite2);
|
|
11689
|
+
return { min, span: Math.max(Math.max(...finite2) - min, 1) };
|
|
9115
11690
|
}
|
|
9116
11691
|
function computeScatterDots(values, maxXIndex, layout, range, xValues, xDomain) {
|
|
9117
11692
|
const finiteX = xValues?.slice(0, values.length).filter(Number.isFinite), minX = xDomain ? xDomain.min : finiteX?.length ? Math.min(...finiteX) : 0, spanX = xDomain ? xDomain.span : finiteX?.length ? Math.max(Math.max(...finiteX) - minX, 1) : maxXIndex;
|
|
@@ -9646,8 +12221,8 @@ function buildRegionMapViewModel(element, chartData, categoryLabels) {
|
|
|
9646
12221
|
const resolve2 = (label) => regions.find(
|
|
9647
12222
|
(r) => r.entityId === label || r.code === label || r.name.toLowerCase() === label.toLowerCase()
|
|
9648
12223
|
)?.code ?? resolveRegionCode(label);
|
|
9649
|
-
const
|
|
9650
|
-
const values =
|
|
12224
|
+
const entries2 = buildRegionMapEntries(categories, series?.values ?? [], options, resolve2);
|
|
12225
|
+
const values = entries2.map((entry) => entry.value);
|
|
9651
12226
|
const finiteVals = values.filter((v) => Number.isFinite(v));
|
|
9652
12227
|
const minVal = finiteVals.length > 0 ? Math.min(...finiteVals) : 0;
|
|
9653
12228
|
const maxVal = finiteVals.length > 0 ? Math.max(...finiteVals) : 1;
|
|
@@ -9660,7 +12235,7 @@ function buildRegionMapViewModel(element, chartData, categoryLabels) {
|
|
|
9660
12235
|
const colorScale = valueColorStops ? buildValueColorScale(valueColorStops) : (t) => sequentialColorScale(t, series?.color ?? "#4472C4");
|
|
9661
12236
|
const regionValueMap = /* @__PURE__ */ new Map();
|
|
9662
12237
|
const unmatchedRows = [];
|
|
9663
|
-
for (const entry of
|
|
12238
|
+
for (const entry of entries2) {
|
|
9664
12239
|
if (entry.code !== void 0) {
|
|
9665
12240
|
regionValueMap.set(entry.code, {
|
|
9666
12241
|
value: entry.value,
|
|
@@ -10318,4 +12893,4 @@ function computeTrendlinePrimitives(chartData, catCount, layout, range, mode = "
|
|
|
10318
12893
|
return out;
|
|
10319
12894
|
}
|
|
10320
12895
|
|
|
10321
|
-
export { AXIS_LABEL_COLOR, CHART_PX_PER_PT, CHART_TITLE_FONT_PX, CHART_TITLE_TOP_INSET_PX, DATA_LABEL_LINE_HEIGHT, DATA_LABEL_PAD_X, DATA_LABEL_PAD_Y, DATA_TABLE_HEADER_H, DATA_TABLE_KEY_W, DATA_TABLE_PADDING, DATA_TABLE_ROW_H, DEFAULT_BODY_INSET_LR_PX, DEFAULT_BODY_INSET_TB_PX, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, DEFAULT_CHART_AREA_FILL, DEFAULT_CHART_DATA_LABEL_PX, DEFAULT_CHART_TEXT_PX, DEFAULT_FILL_COLOR, DEFAULT_FONT_FAMILY, DEFAULT_PALETTE, DEFAULT_STROKE_COLOR, DEFAULT_TEXT_COLOR, DEFAULT_TEXT_FONT_SIZE, GRIDLINE_COLOR3 as GRIDLINE_COLOR, HYPERLINK_COLOR, LEGACY_CHART_TITLE_BAND_PX, LEGEND_LINE_SWATCH_WIDTH, LEGEND_MARKER_RADIUS, OOXML_PATTERN_PRESETS, PIE_AUTO_INSET_PX, TEXT_ORIENTATION_IDENTITY, ZERO_LINE_COLOR, adjustFillForMode, applyDataPointPictureFills, applyLegendEntryOverrides, applyParetoConversion, axisShowsMajorGridlines, axisTickValues, buildBoxWhiskerViewModel, buildCartesianViewModel, buildCategoryLabels, buildChartViewModel, buildCirclePathGradient, buildComboViewModel, buildCssGradientFromShapeStyle, buildDashArray, buildDataLabelText, buildFallbackViewModel, buildFunnelViewModel, buildGradientCss, buildGridlinesAndLabels, buildHistogramViewModel, buildLegend, buildLineLegendSwatch, buildMarkTooltip, buildPatternFill, buildPatternFillCss, buildPieViewModel, buildPrimaryAxis, buildRadarViewModel, buildRectPathGradient, buildReflectedGradientStops, buildRegionMapViewModel, buildSecondaryAxis, buildShapePathGradient, buildStockCloseLabel, buildStockViewModel, buildSubpathFillOverlay, buildSubpathPaints, buildSunburstViewModel, buildSurfaceViewModel, buildTreemapViewModel, buildTrendlineLegendSwatch, buildValueAxisGridlinesAndLabels, buildWaterfallViewModel, buildZeroLine, canvasFontFamily, chartAreaCornerRadius, chartAreaFill, chartAxisIndex, chartFontPx, chartFrameToViewOffset, chartGridlinesPatch, chartGridlinesState, chartPlotBounds, chartPreserveAspectRatio, chartTextBox, chartTextFontFamily, chartTitleBand, chartTitleBandFor, chartTitleFontPx, chartTitleReservePx, clampCropValue, clearBarFacePicturePixelCache, clipStackedSegment, collapseChartTitleRunsForEdit, computeAxisTitlePrimitives, computeBarRects, computeBoxWhiskerGeometry, computeChartLegendLayout, computeDataTableHeight, computeDataTablePrimitives, computeErrorBarPrimitives, computeFunnelSegments, computeGradientCenter, computeHierarchicalSunburstArcs, computeHistogramBars, computeHistogramBins, computeLayout, computeLayoutOptions, computeLinePoints, computePieLayout, computePieSlicePath, computePieSlices, computePlotLayout, computeScatterDots, computeScatterXDomain, computeStackedBarRects, computeStackedValueRange, computeSunburstArcs, computeTrendlinePrimitives, computeValueRange, computeValueRange2, convertOoxmlAngleToCss, createArrayBufferCopy, cumulativePercentOfTotal, dataLabelBox, dataLabelBoxSize, dataLabelFontOverride, decodeFirstPixelColor, ensureBarFacePicturePixelSampled, estimateChartTextWidth, estimateTextWidth, findDataPoint, findPointLabel, findValueAxis, fitTitleBand, formatAxisValue, formatAxisValue2, formatAxisValueWithUnits, getBarFacePicturePixelSampleVersion, getCachedBarFacePicturePixelColor, getCompoundLineBorderWidth, getCompoundLineBoxShadow, getCompoundLineStyle, getComputedFillStyle, getCssBorderDashStyle, getDisplayUnitDivisor, getDisplayUnitLabel, getElementOrientationMatrix, getElementTransform, getElementTransformWithoutRotation, getGradientTileFlipCss, getGradientTileRectCss, getPatternSvg, getPatternTile, getPptxRenderCacheEpoch, getPrimaryValueAxis, getPrimaryValueAxisId, getSecondaryCategoryAxis, getSecondaryValueAxis, getSecondaryValueAxisId, getSvgStrokeDasharray, getTextCompensationTransform, hasSecondaryCategoryAxis, hasSecondaryValueAxis, invalidatePptxRenderCacheEpoch, isParetoChart, isPrimaryCategoryAxisAtTop, isSeriesOnSecondaryAxis, isTextOrientationMatrix, linePointsToSvgString, manualLayoutOf, manualLegendAnchor, manualTitleAnchor, measureChartTextWidth, multiplyTextOrientationMatrices, normalizeStrokeDashType, orderParetoEntries, paletteColor, paletteColor2, parseDrawingPercent, plotAreaFill, primaryValueAxis, reserveLegendSpace, resetBarFacePicturePixelCacheForTests, resolveActiveDataPointPicture, resolveBarFacePicturePixelColor, resolveBarFaceTargets, resolveBarLabelAnchor, resolveBarLabelPlacement, resolveCategoryLabels, resolveChartKind, resolveChartPalette, resolveChartStyleDefaults, resolveChartTitleRunSpans, resolveChartTitleTextStyle, resolveDataLabelContent, resolveDataLabelTextStyle, resolveDataPointExplosion, resolveDataPointFill, resolveDataPointMarker, resolveDataPointPictureFill, resolveDisplayedChartType, resolveExtrusionFaceFill, resolveLabelPosition, resolveLegendAnchorPosition, resolveLegendPlacement, resolveLegendSwatchKind, resolveMarkerLabelAnchor, resolveMarkerLabelPlacement, resolveUntargetedBarFaceFill, resolveVaryColorFill, sanitizeGradientStops, seriesColor, seriesColor2, seriesXValues, setBoundedRenderCache, setChartTextMeasurer, shouldRenderMajorGridlines, splitLabelLines, splitSeriesByAxis, stackedBarWidth, stackedSegmentExtent, subscribeBarFacePicturePixelSamples, suppressesCssFill, surfaceColor, titleBaselineFor, toCssGradientStop, unitsCaptionOffset, upsertDataPoint, valueToY, valueToY2, withChartTitleBand, withManualLayouts, withResolvedPalette, wrapTextByEstimatedWidth };
|
|
12896
|
+
export { AXIS_LABEL_COLOR, CHART_PX_PER_PT, CHART_TITLE_FONT_PX, CHART_TITLE_TOP_INSET_PX, DATA_LABEL_LINE_HEIGHT, DATA_LABEL_PAD_X, DATA_LABEL_PAD_Y, DATA_TABLE_HEADER_H, DATA_TABLE_KEY_W, DATA_TABLE_PADDING, DATA_TABLE_ROW_H, DEFAULT_BODY_INSET_LR_PX, DEFAULT_BODY_INSET_TB_PX, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, DEFAULT_CHART_AREA_FILL, DEFAULT_CHART_DATA_LABEL_PX, DEFAULT_CHART_TEXT_PX, DEFAULT_FILL_COLOR, DEFAULT_FONT_FAMILY, DEFAULT_PALETTE, DEFAULT_STROKE_COLOR, DEFAULT_TEXT_COLOR, DEFAULT_TEXT_FONT_SIZE, GRIDLINE_COLOR3 as GRIDLINE_COLOR, HYPERLINK_COLOR, LEGACY_CHART_TITLE_BAND_PX, LEGEND_LINE_SWATCH_WIDTH, LEGEND_MARKER_RADIUS, MORPH_PROGRESS_VAR, OOXML_PATTERN_PRESETS, PIE_AUTO_INSET_PX, TEXT_ORIENTATION_IDENTITY, TEXT_SHADOW_BLUR_TO_CSS, ZERO_LINE_COLOR, adjustFillForMode, applyDataPointPictureFills, applyLegendEntryOverrides, applyParetoConversion, axisShowsMajorGridlines, axisTickValues, buildBoxWhiskerViewModel, buildCartesianViewModel, buildCategoryLabels, buildChartViewModel, buildCirclePathGradient, buildComboViewModel, buildCssGradientFromShapeStyle, buildCustomGeometryClipPath, buildCustomPathMarkers, buildDashArray, buildDataLabelText, buildFallbackViewModel, buildFunnelViewModel, buildGlowBoxShadow, buildGradientCss, buildGridlinesAndLabels, buildHistogramViewModel, buildInnerShadowCssFromShapeStyle, buildLegend, buildLineGlowFilter, buildLineLegendSwatch, buildLineShadowCss, buildMarkTooltip, buildMultiLayerShadowCss, buildPatternFill, buildPatternFillCss, buildPieViewModel, buildPrimaryAxis, buildRadarViewModel, buildRectPathGradient, buildReflectedGradientStops, buildRegionMapViewModel, buildSecondaryAxis, buildShadowCssFromShapeStyle, buildShapePathGradient, buildSilhouetteFilterMarkup, buildStockCloseLabel, buildStockViewModel, buildStrokeOutline, buildSubpathFillOverlay, buildSubpathPaints, buildSunburstViewModel, buildSurfaceViewModel, buildSvgGradientDef, buildSvgStrokeGradientDef, buildSvgStrokePatternDef, buildTreemapViewModel, buildTrendlineLegendSwatch, buildValueAxisGridlinesAndLabels, buildWaterfallViewModel, buildZeroLine, canvasFontFamily, chartAreaCornerRadius, chartAreaFill, chartAxisIndex, chartFontPx, chartFrameToViewOffset, chartGridlinesPatch, chartGridlinesState, chartPlotBounds, chartPreserveAspectRatio, chartTextBox, chartTextFontFamily, chartTitleBand, chartTitleBandFor, chartTitleFontPx, chartTitleReservePx, clampCropValue, clearBarFacePicturePixelCache, clipStackedSegment, collapseChartTitleRunsForEdit, compoundStrandPath, computeAxisTitlePrimitives, computeBarRects, computeBoxWhiskerGeometry, computeChartLegendLayout, computeDataTableHeight, computeDataTablePrimitives, computeErrorBarPrimitives, computeFunnelSegments, computeGradientCenter, computeHierarchicalSunburstArcs, computeHistogramBars, computeHistogramBins, computeLayout, computeLayoutOptions, computeLinePoints, computePieLayout, computePieSlicePath, computePieSlices, computePlotLayout, computeScatterDots, computeScatterXDomain, computeStackedBarRects, computeStackedValueRange, computeSunburstArcs, computeTrendlinePrimitives, computeValueRange, computeValueRange2, connectorKind, connectorNeedsPath, connectorSquareCapPath, connectorStrandScreenWidth, convertOoxmlAngleToCss, createArrayBufferCopy, cumulativePercentOfTotal, dashStartPathData, dataLabelBox, dataLabelBoxSize, dataLabelFontOverride, decodeFirstPixelColor, ensureBarFacePicturePixelSampled, escapeSvgAttr, estimateChartTextWidth, estimateTextWidth, findDataPoint, findPointLabel, findValueAxis, fitTitleBand, flattenPath, formatAxisValue, formatAxisValue2, formatAxisValueWithUnits, getBarFacePicturePixelSampleVersion, getBoxShadowCss, getCachedBarFacePicturePixelColor, getCompositeOuterShadowFilterCss, getCompoundLineBorderWidth, getCompoundLineBoxShadow, getCompoundLineOffsets, getCompoundLineStyle, getCompoundLineWidths, getComputedEffectStyle, getComputedFillStyle, getComputedStrokeStyle, getCssBorderDashStyle, getDisplayUnitDivisor, getDisplayUnitLabel, getDuotoneFilterId, getDuotoneSvgFilter, getDuotoneSvgFilterMarkup, getEffectDagBlendMode, getEffectDagCssFilter, getEffectDagFillOverlay, getEffectDagFilter, getEffectDagOpacity, getEffectFilterCss, getEffectStyleSource, getElementOrientationMatrix, getElementTransform, getElementTransformWithoutRotation, getGlowBoxShadowCss, getGradientTileFlipCss, getGradientTileRectCss, getInnerShadowCss, getLineGlowFilterCss, getLineShadowCss, getLineShadowParams, getMultiLayerShadowCss, getOuterShadowCss, getPatternSvg, getPatternTile, getPptxRenderCacheEpoch, getPresetShapeVectorGeometry, getPrimaryValueAxis, getPrimaryValueAxisId, getReflectionWrapperStyle, getResolvedShapeClipPath, getResolvedShapeClipPathFor, getSecondaryCategoryAxis, getSecondaryValueAxis, getSecondaryValueAxisId, getShapeEffectFilterDefs, getShapeFillOverlay, getSilhouetteEffectParams, getSilhouetteEffects, getSilhouetteFilterId, getSoftEdgeFilterId, getSoftEdgeSvgFilter, getSplitStrokePresetPaths, getStrokeOnlyPresetPaths, getSvgStrokeDasharray, getTextCompensationTransform, getTextReflectionWrapperStyle, glowFilterLengths, hasEffectDagProperties, hasImageEffects, hasSecondaryCategoryAxis, hasSecondaryValueAxis, hasStrokePaint, invalidatePptxRenderCacheEpoch, isArrowedCustomPath, isIdentityRectClip, isParetoChart, isPatternPaint, isPrimaryCategoryAxisAtTop, isSeriesOnSecondaryAxis, isStrokeOnlyPresetElement, isTextOrientationMatrix, isWedgeCalloutPresetShape, linePointsToSvgString, manualLayoutOf, manualLegendAnchor, manualTitleAnchor, markerPath, measureChartTextWidth, multiplyTextOrientationMatrices, normalizeArrow, normalizeStrokeDashType, orderParetoEntries, outlinePathData, outlineStrokeJoin, outsetClipPathForStroke, paintedStrokeWidth, paletteColor, paletteColor2, parseDrawingPercent, plotAreaFill, primaryValueAxis, registerGroupChildren, registerSilhouetteMorph, reserveLegendSpace, resetBarFacePicturePixelCacheForTests, resolveActiveDataPointPicture, resolveBarFacePicturePixelColor, resolveBarFaceTargets, resolveBarLabelAnchor, resolveBarLabelPlacement, resolveBaseShapeGeometry, resolveCategoryLabels, resolveChartKind, resolveChartPalette, resolveChartStyleDefaults, resolveChartTitleRunSpans, resolveChartTitleTextStyle, resolveComputedFill, resolveDataLabelContent, resolveDataLabelTextStyle, resolveDataPointExplosion, resolveDataPointFill, resolveDataPointMarker, resolveDataPointPictureFill, resolveDisplayedChartType, resolveExtrusionFaceFill, resolveGlow, resolveInnerShadow, resolveLabelPosition, resolveLegendAnchorPosition, resolveLegendPlacement, resolveLegendSwatchKind, resolveLiveCustomGeometryPath, resolveMarkerLabelAnchor, resolveMarkerLabelPlacement, resolveOuterShadowLayers, resolveUntargetedBarFaceFill, resolveVaryColorFill, sanitizeGradientStops, seriesColor, seriesColor2, seriesXValues, setBoundedRenderCache, setChartTextMeasurer, shouldRenderMajorGridlines, silhouetteFillsLayer, silhouetteFillsOverlay, silhouetteMorphEntry, snapPlacement, splitLabelLines, splitSeriesByAxis, splitStrokePresetPathData, squareCapDashedPathData, stackedBarWidth, stackedSegmentExtent, straddlingStrokeWidth, strokeMiterLimit, strokeOnlyPresetPathData, strokeOutlineViewBox, subscribeBarFacePicturePixelSamples, suppressesCssBorder, suppressesCssFill, surfaceColor, svgGradientFillRef, svgGradientId, svgGradientMarkup, svgLineCap, titleBaselineFor, toCssGradientStop, unitsCaptionOffset, upsertDataPoint, usesSilhouetteEffects, valueToY, valueToY2, withChartTitleBand, withManualLayouts, withResolvedPalette, wrapTextByEstimatedWidth };
|