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