ooxml-core 1.1.0 → 1.2.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 +18 -18
- package/dist/{PptxHandler-75LOVF7I.mjs → PptxHandler-SJTINPU4.mjs} +3 -3
- package/dist/automation/index.cjs +6550 -4115
- package/dist/automation/index.mjs +6550 -4115
- package/dist/chart/color-palettes.d.ts +2 -2
- package/dist/chart/color-palettes.d.ts.map +1 -1
- package/dist/chart/data-cache.d.ts +6 -0
- package/dist/chart/data-cache.d.ts.map +1 -0
- package/dist/chart/gradient-coincident-stops.d.ts +17 -0
- package/dist/chart/gradient-coincident-stops.d.ts.map +1 -0
- package/dist/chart/gradient-definition.d.ts +3 -3
- package/dist/chart/gradient-definition.d.ts.map +1 -1
- package/dist/chart/index.cjs +3065 -139
- package/dist/chart/index.d.ts +7 -0
- package/dist/chart/index.d.ts.map +1 -1
- package/dist/chart/index.mjs +3045 -140
- package/dist/chart/model-chrome.d.ts +39 -0
- package/dist/chart/model-chrome.d.ts.map +1 -0
- package/dist/chart/model-series.d.ts +189 -0
- package/dist/chart/model-series.d.ts.map +1 -0
- package/dist/chart/model.d.ts +202 -0
- package/dist/chart/model.d.ts.map +1 -0
- package/dist/chart/parse-chrome.d.ts +16 -0
- package/dist/chart/parse-chrome.d.ts.map +1 -0
- package/dist/chart/parse-plot.d.ts +11 -0
- package/dist/chart/parse-plot.d.ts.map +1 -0
- package/dist/chart/parse-series.d.ts +8 -0
- package/dist/chart/parse-series.d.ts.map +1 -0
- package/dist/chart/parse-space.d.ts +8 -0
- package/dist/chart/parse-space.d.ts.map +1 -0
- package/dist/chart/parse-text.d.ts +12 -0
- package/dist/chart/parse-text.d.ts.map +1 -0
- package/dist/chart/parse-util.d.ts +42 -0
- package/dist/chart/parse-util.d.ts.map +1 -0
- package/dist/{xlsx/layout → chart/render}/chart-appearance.d.ts +4 -4
- package/dist/chart/render/chart-appearance.d.ts.map +1 -0
- package/dist/chart/render/chart-colors.d.ts +9 -0
- package/dist/chart/render/chart-colors.d.ts.map +1 -0
- package/dist/chart/render/chart-scale.d.ts.map +1 -0
- package/dist/chart/render/chart-spacing.d.ts +6 -0
- package/dist/chart/render/chart-spacing.d.ts.map +1 -0
- package/dist/{xlsx/layout → chart/render}/chart-svg-appearance.d.ts +1 -1
- package/dist/chart/render/chart-svg-appearance.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-bars.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-cartesian.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-legend.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-radial.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-text-metrics.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-title-text.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-util.d.ts.map +1 -0
- package/dist/chart/render/chart-svg.d.ts.map +1 -0
- package/dist/chart/render/chart-title-text.d.ts +14 -0
- package/dist/chart/render/chart-title-text.d.ts.map +1 -0
- package/dist/chart/render/chart-value-axis.d.ts +6 -0
- package/dist/chart/render/chart-value-axis.d.ts.map +1 -0
- package/dist/chart/render/chart-view.d.ts +71 -0
- package/dist/chart/render/chart-view.d.ts.map +1 -0
- package/dist/chart/render/index.d.ts +9 -0
- package/dist/chart/render/index.d.ts.map +1 -0
- package/dist/chart/render/render-space.d.ts +34 -0
- package/dist/chart/render/render-space.d.ts.map +1 -0
- package/dist/chart/render/summary-from-space.d.ts +15 -0
- package/dist/chart/render/summary-from-space.d.ts.map +1 -0
- package/dist/chart/render/summary.d.ts +51 -0
- package/dist/chart/render/summary.d.ts.map +1 -0
- package/dist/chart/render/theme-palette.d.ts +8 -0
- package/dist/chart/render/theme-palette.d.ts.map +1 -0
- package/dist/chart/style-definition.d.ts +7 -7
- package/dist/chart/style-definition.d.ts.map +1 -1
- package/dist/chart/write-axes.d.ts +5 -0
- package/dist/chart/write-axes.d.ts.map +1 -0
- package/dist/chart/write-chrome.d.ts +9 -0
- package/dist/chart/write-chrome.d.ts.map +1 -0
- package/dist/chart/write-plot.d.ts +7 -0
- package/dist/chart/write-plot.d.ts.map +1 -0
- package/dist/chart/write-series.d.ts +7 -0
- package/dist/chart/write-series.d.ts.map +1 -0
- package/dist/chart/write-shape.d.ts +21 -0
- package/dist/chart/write-shape.d.ts.map +1 -0
- package/dist/chart/write-space.d.ts +15 -0
- package/dist/chart/write-space.d.ts.map +1 -0
- package/dist/chart/write-text-body.d.ts +6 -0
- package/dist/chart/write-text-body.d.ts.map +1 -0
- package/dist/chart/write-text.d.ts +15 -0
- package/dist/chart/write-text.d.ts.map +1 -0
- package/dist/chart/write-util.d.ts +24 -0
- package/dist/chart/write-util.d.ts.map +1 -0
- package/dist/chart/xml-fragment.d.ts +13 -0
- package/dist/chart/xml-fragment.d.ts.map +1 -0
- package/dist/{chunk-HUBK4EOT.mjs → chunk-3IT6ZD7K.mjs} +2 -0
- package/dist/{chunk-TS3E27NK.mjs → chunk-3UMDVJRN.mjs} +12 -1
- package/dist/{chunk-P22OKTRK.mjs → chunk-54S5A5PZ.mjs} +208 -159
- package/dist/{chunk-75LA7H3F.mjs → chunk-CQQAPUAG.mjs} +27440 -27402
- package/dist/{chunk-Q27H4HFS.mjs → chunk-FI4RSJ24.mjs} +1 -1
- package/dist/{chunk-OJI3N5AY.cjs → chunk-FRUB573B.cjs} +2 -0
- package/dist/{chunk-OMGH6IKY.mjs → chunk-TEOAOAIF.mjs} +42 -5
- package/dist/{chunk-RFX7AJDZ.mjs → chunk-VYTA2OUN.mjs} +2 -2
- package/dist/{chunk-LA7D6ZYQ.mjs → chunk-XCZ7U3GZ.mjs} +3569 -2075
- package/dist/{chunk-2C72N64G.cjs → chunk-XROY25LN.cjs} +12 -0
- package/dist/collab/index.cjs +1 -0
- package/dist/collab/index.mjs +1 -0
- package/dist/collab/transport-provider.d.ts.map +1 -1
- package/dist/color/hex-rgb.d.ts +5 -0
- package/dist/color/hex-rgb.d.ts.map +1 -0
- package/dist/color/index.cjs +12 -0
- package/dist/color/index.d.ts +1 -0
- package/dist/color/index.d.ts.map +1 -1
- package/dist/color/index.mjs +11 -1
- package/dist/diagram/engine/alg-composite.d.ts +18 -0
- package/dist/diagram/engine/alg-composite.d.ts.map +1 -0
- package/dist/diagram/engine/alg-connector.d.ts +17 -0
- package/dist/diagram/engine/alg-connector.d.ts.map +1 -0
- package/dist/diagram/engine/alg-cycle.d.ts +28 -0
- package/dist/diagram/engine/alg-cycle.d.ts.map +1 -0
- package/dist/diagram/engine/alg-hier.d.ts +33 -0
- package/dist/diagram/engine/alg-hier.d.ts.map +1 -0
- package/dist/diagram/engine/alg-linear.d.ts +24 -0
- package/dist/diagram/engine/alg-linear.d.ts.map +1 -0
- package/dist/diagram/engine/alg-pyra.d.ts +117 -0
- package/dist/diagram/engine/alg-pyra.d.ts.map +1 -0
- package/dist/diagram/engine/alg-snake.d.ts +21 -0
- package/dist/diagram/engine/alg-snake.d.ts.map +1 -0
- package/dist/diagram/engine/axis.d.ts +24 -0
- package/dist/diagram/engine/axis.d.ts.map +1 -0
- package/dist/diagram/engine/conditions.d.ts +12 -0
- package/dist/diagram/engine/conditions.d.ts.map +1 -0
- package/dist/diagram/engine/connector-shape.d.ts +25 -0
- package/dist/diagram/engine/connector-shape.d.ts.map +1 -0
- package/dist/diagram/engine/connector-size.d.ts +30 -0
- package/dist/diagram/engine/connector-size.d.ts.map +1 -0
- package/dist/diagram/engine/constraint-eval.d.ts +37 -0
- package/dist/diagram/engine/constraint-eval.d.ts.map +1 -0
- package/dist/diagram/engine/constraint-fill-idiom.d.ts +61 -0
- package/dist/diagram/engine/constraint-fill-idiom.d.ts.map +1 -0
- package/dist/diagram/engine/constraint-units.d.ts +35 -0
- package/dist/diagram/engine/constraint-units.d.ts.map +1 -0
- package/dist/diagram/engine/data-points.d.ts +48 -0
- package/dist/diagram/engine/data-points.d.ts.map +1 -0
- package/dist/diagram/engine/engine-context.d.ts +21 -0
- package/dist/diagram/engine/engine-context.d.ts.map +1 -0
- package/dist/diagram/engine/engine-first-allowlist.d.ts +31 -0
- package/dist/diagram/engine/engine-first-allowlist.d.ts.map +1 -0
- package/dist/diagram/engine/engine-fonts.d.ts +26 -0
- package/dist/diagram/engine/engine-fonts.d.ts.map +1 -0
- package/dist/diagram/engine/engine-node.d.ts +72 -0
- package/dist/diagram/engine/engine-node.d.ts.map +1 -0
- package/dist/diagram/engine/engine-to-result.d.ts +43 -0
- package/dist/diagram/engine/engine-to-result.d.ts.map +1 -0
- package/dist/diagram/engine/engine.d.ts +18 -0
- package/dist/diagram/engine/engine.d.ts.map +1 -0
- package/dist/diagram/engine/font-groups.d.ts +33 -0
- package/dist/diagram/engine/font-groups.d.ts.map +1 -0
- package/dist/diagram/engine/font-length.d.ts +26 -0
- package/dist/diagram/engine/font-length.d.ts.map +1 -0
- package/dist/diagram/engine/font-search.d.ts +38 -0
- package/dist/diagram/engine/font-search.d.ts.map +1 -0
- package/dist/diagram/engine/hier-assistants.d.ts +47 -0
- package/dist/diagram/engine/hier-assistants.d.ts.map +1 -0
- package/dist/diagram/engine/hier-hang.d.ts +28 -0
- package/dist/diagram/engine/hier-hang.d.ts.map +1 -0
- package/dist/diagram/engine/hier-measure.d.ts +33 -0
- package/dist/diagram/engine/hier-measure.d.ts.map +1 -0
- package/dist/diagram/engine/hier-node-size.d.ts +23 -0
- package/dist/diagram/engine/hier-node-size.d.ts.map +1 -0
- package/dist/diagram/engine/hier-shape.d.ts +31 -0
- package/dist/diagram/engine/hier-shape.d.ts.map +1 -0
- package/dist/diagram/engine/index.d.ts +6 -0
- package/dist/diagram/engine/index.d.ts.map +1 -0
- package/dist/diagram/engine/layout-def-parse.d.ts +13 -0
- package/dist/diagram/engine/layout-def-parse.d.ts.map +1 -0
- package/dist/diagram/engine/layout-def-types.d.ts +118 -0
- package/dist/diagram/engine/layout-def-types.d.ts.map +1 -0
- package/dist/diagram/engine/layout-driver.d.ts +41 -0
- package/dist/diagram/engine/layout-driver.d.ts.map +1 -0
- package/dist/diagram/engine/layout-font.d.ts +27 -0
- package/dist/diagram/engine/layout-font.d.ts.map +1 -0
- package/dist/diagram/engine/move-with-merge.d.ts +49 -0
- package/dist/diagram/engine/move-with-merge.d.ts.map +1 -0
- package/dist/diagram/engine/node-text.d.ts +20 -0
- package/dist/diagram/engine/node-text.d.ts.map +1 -0
- package/dist/diagram/engine/ordered-xml.d.ts +30 -0
- package/dist/diagram/engine/ordered-xml.d.ts.map +1 -0
- package/dist/diagram/engine/preferred-size.d.ts +28 -0
- package/dist/diagram/engine/preferred-size.d.ts.map +1 -0
- package/dist/diagram/engine/pres-tree.d.ts +58 -0
- package/dist/diagram/engine/pres-tree.d.ts.map +1 -0
- package/dist/diagram/engine/registry.d.ts +7 -0
- package/dist/diagram/engine/registry.d.ts.map +1 -0
- package/dist/diagram/engine/render-filter.d.ts +43 -0
- package/dist/diagram/engine/render-filter.d.ts.map +1 -0
- package/dist/diagram/engine/shape-adjust.d.ts +16 -0
- package/dist/diagram/engine/shape-adjust.d.ts.map +1 -0
- package/dist/diagram/engine/shape-transform.d.ts +14 -0
- package/dist/diagram/engine/shape-transform.d.ts.map +1 -0
- package/dist/diagram/engine/snake-rule-fit.d.ts +34 -0
- package/dist/diagram/engine/snake-rule-fit.d.ts.map +1 -0
- package/dist/diagram/engine/style-label.d.ts +24 -0
- package/dist/diagram/engine/style-label.d.ts.map +1 -0
- package/dist/diagram/engine/text-fit.d.ts +61 -0
- package/dist/diagram/engine/text-fit.d.ts.map +1 -0
- package/dist/diagram/engine/text-grow.d.ts +33 -0
- package/dist/diagram/engine/text-grow.d.ts.map +1 -0
- package/dist/diagram/engine/text-measure.d.ts +77 -0
- package/dist/diagram/engine/text-measure.d.ts.map +1 -0
- package/dist/diagram/hierarchy/index.d.ts +5 -0
- package/dist/diagram/hierarchy/index.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-axis-pitch.d.ts +65 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-axis-pitch.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-axis-swap-orientation.d.ts +68 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-axis-swap-orientation.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-branch-mode.d.ts +54 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-branch-mode.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-cascade.d.ts +58 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-cascade.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-centered-fan-axis.d.ts +63 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-centered-fan-axis.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-child-order.d.ts +41 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-child-order.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-composite-child.d.ts +129 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-composite-child.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-constraint-lookup.d.ts +76 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-constraint-lookup.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-corner-plan.d.ts +49 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-corner-plan.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-dispatch-lindir.d.ts +58 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-dispatch-lindir.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fan-aware-width.d.ts +48 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fan-aware-width.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fan.d.ts +97 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fan.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fanned-hang-geometry.d.ts +42 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fanned-hang-geometry.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fanned-hang.d.ts +74 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fanned-hang.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fit-item-box.d.ts +111 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fit-item-box.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fold-depth.d.ts +44 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fold-depth.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-generation-gap.d.ts +60 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-generation-gap.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-generation-templates.d.ts +106 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-generation-templates.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hang-depth.d.ts +133 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hang-depth.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hang-dispatch.d.ts +28 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hang-dispatch.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hanging-arrange.d.ts +28 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hanging-arrange.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hanging-box.d.ts +86 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hanging-box.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hanging-fold.d.ts +36 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hanging-fold.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hanging.d.ts +118 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hanging.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-item-template.d.ts +64 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-item-template.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-orgchart-tree.d.ts +53 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-orgchart-tree.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-orientation-resolve.d.ts +36 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-orientation-resolve.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-orientation-types.d.ts +81 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-orientation-types.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-orientation.d.ts +78 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-orientation.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-pitch.d.ts +140 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-pitch.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-shared.d.ts +131 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-shared.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-standard-options.d.ts +91 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-standard-options.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-standard-rows.d.ts +21 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-standard-rows.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-standard.d.ts +36 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-standard.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-tailed-placer.d.ts +20 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-tailed-placer.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-tailed-transpose.d.ts +50 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-tailed-transpose.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-transpose.d.ts +23 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-transpose.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-transposed-orientation.d.ts +22 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-transposed-orientation.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-wrapped-groups.d.ts +93 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-wrapped-groups.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-layout-interpreter-hierarchy.d.ts +49 -0
- package/dist/diagram/hierarchy/smartart-layout-interpreter-hierarchy.d.ts.map +1 -0
- package/dist/diagram/index.cjs +22537 -80
- package/dist/diagram/index.d.ts +4 -0
- package/dist/diagram/index.d.ts.map +1 -1
- package/dist/diagram/index.mjs +22453 -81
- package/dist/diagram/layout/index.d.ts +38 -0
- package/dist/diagram/layout/index.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-choose-xml.d.ts +32 -0
- package/dist/diagram/layout/smartart-choose-xml.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-constraint-branch-index.d.ts +49 -0
- package/dist/diagram/layout/smartart-constraint-branch-index.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-constraint-declared-by.d.ts +64 -0
- package/dist/diagram/layout/smartart-constraint-declared-by.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-constraint-ratio-fallback.d.ts +18 -0
- package/dist/diagram/layout/smartart-constraint-ratio-fallback.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-constraint-resolve.d.ts +24 -0
- package/dist/diagram/layout/smartart-constraint-resolve.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-constraint-rules.d.ts +26 -0
- package/dist/diagram/layout/smartart-constraint-rules.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-constraint-sibling-roles.d.ts +100 -0
- package/dist/diagram/layout/smartart-constraint-sibling-roles.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-constraint-solver.d.ts +133 -0
- package/dist/diagram/layout/smartart-constraint-solver.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-constraint-values.d.ts +5 -0
- package/dist/diagram/layout/smartart-constraint-values.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-font-table.d.ts +14 -0
- package/dist/diagram/layout/smartart-font-table.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-interpreter-fold-text.d.ts +75 -0
- package/dist/diagram/layout/smartart-interpreter-fold-text.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-control-flow.d.ts +25 -0
- package/dist/diagram/layout/smartart-layout-control-flow.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-arranged-selection.d.ts +56 -0
- package/dist/diagram/layout/smartart-layout-interpreter-arranged-selection.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-arrangement-kind.d.ts +37 -0
- package/dist/diagram/layout/smartart-layout-interpreter-arrangement-kind.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-aux.d.ts +66 -0
- package/dist/diagram/layout/smartart-layout-interpreter-aux.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-axis-count.d.ts +128 -0
- package/dist/diagram/layout/smartart-layout-interpreter-axis-count.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-axis-depth.d.ts +73 -0
- package/dist/diagram/layout/smartart-layout-interpreter-axis-depth.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-axis-hop.d.ts +48 -0
- package/dist/diagram/layout/smartart-layout-interpreter-axis-hop.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-axis-range.d.ts +19 -0
- package/dist/diagram/layout/smartart-layout-interpreter-axis-range.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-choose-algorithm.d.ts +60 -0
- package/dist/diagram/layout/smartart-layout-interpreter-choose-algorithm.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-choose-branch.d.ts +36 -0
- package/dist/diagram/layout/smartart-layout-interpreter-choose-branch.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-choose-composite.d.ts +42 -0
- package/dist/diagram/layout/smartart-layout-interpreter-choose-composite.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-choose-depth.d.ts +102 -0
- package/dist/diagram/layout/smartart-layout-interpreter-choose-depth.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-choose-resolve.d.ts +32 -0
- package/dist/diagram/layout/smartart-layout-interpreter-choose-resolve.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-alternative.d.ts +33 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-alternative.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-anchor.d.ts +95 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-anchor.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-aspect.d.ts +84 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-aspect.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-candidates.d.ts +60 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-candidates.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-children.d.ts +86 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-children.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-choose-groups.d.ts +44 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-choose-groups.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-choose.d.ts +109 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-choose.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-detect.d.ts +182 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-detect.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-fontfit.d.ts +60 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-fontfit.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-foreach.d.ts +36 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-foreach.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-group-slots.d.ts +92 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-group-slots.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-iteration.d.ts +45 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-iteration.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-nested-cycle.d.ts +57 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-nested-cycle.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-order-fallback.d.ts +24 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-order-fallback.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-order.d.ts +41 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-order.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-pairs.d.ts +34 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-pairs.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-render.d.ts +29 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-render.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-ring.d.ts +40 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-ring.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-slot-dim.d.ts +22 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-slot-dim.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-slots.d.ts +69 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-slots.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite.d.ts +56 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-conn-path.d.ts +42 -0
- package/dist/diagram/layout/smartart-layout-interpreter-conn-path.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-connector-order.d.ts +23 -0
- package/dist/diagram/layout/smartart-layout-interpreter-connector-order.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-constraints.d.ts +28 -0
- package/dist/diagram/layout/smartart-layout-interpreter-constraints.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-custom.d.ts +31 -0
- package/dist/diagram/layout/smartart-layout-interpreter-custom.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-boxes.d.ts +36 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-boxes.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-connectors.d.ts +21 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-connectors.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-constraints.d.ts +116 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-constraints.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-extension.d.ts +110 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-extension.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-fontfit.d.ts +50 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-fontfit.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-hub-detect.d.ts +66 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-hub-detect.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-hub-ratio-usersize.d.ts +81 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-hub-ratio-usersize.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-hub-ratio.d.ts +109 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-hub-ratio.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-item-aspect.d.ts +121 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-item-aspect.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-item-node.d.ts +57 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-item-node.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-ring-bulge.d.ts +34 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-ring-bulge.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-ring-item.d.ts +39 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-ring-item.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-ring-nested-hub.d.ts +22 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-ring-nested-hub.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-ring-offset.d.ts +43 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-ring-offset.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-ring.d.ts +76 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-ring.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-sibtrans.d.ts +40 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-sibtrans.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle.d.ts +69 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-dispatch.d.ts +18 -0
- package/dist/diagram/layout/smartart-layout-interpreter-dispatch.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-flow-direction.d.ts +29 -0
- package/dist/diagram/layout/smartart-layout-interpreter-flow-direction.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-flow.d.ts +49 -0
- package/dist/diagram/layout/smartart-layout-interpreter-flow.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-hierarchy-descendant.d.ts +60 -0
- package/dist/diagram/layout/smartart-layout-interpreter-hierarchy-descendant.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-hierarchy-fontfit.d.ts +45 -0
- package/dist/diagram/layout/smartart-layout-interpreter-hierarchy-fontfit.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-hub-detect.d.ts +26 -0
- package/dist/diagram/layout/smartart-layout-interpreter-hub-detect.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-hub.d.ts +62 -0
- package/dist/diagram/layout/smartart-layout-interpreter-hub.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-compound.d.ts +36 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-compound.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-orientation.d.ts +80 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-orientation.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-shared.d.ts +102 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-shared.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-stack-columns.d.ts +23 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-stack-columns.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-stack-fields.d.ts +77 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-stack-fields.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-stack-rect.d.ts +20 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-stack-rect.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-stack.d.ts +53 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-stack.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-transition.d.ts +50 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-transition.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-roles-recursive.d.ts +87 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-roles-recursive.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-roles-unwrap.d.ts +57 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-roles-unwrap.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-roles.d.ts +109 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-roles.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear-content-size.d.ts +42 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear-content-size.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear-item-aspect.d.ts +94 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear-item-aspect.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear-main-axis.d.ts +17 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear-main-axis.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear-shared.d.ts +21 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear-shared.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear-table.d.ts +76 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear-table.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear.d.ts +20 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-model.d.ts +77 -0
- package/dist/diagram/layout/smartart-layout-interpreter-model.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-named-rules.d.ts +93 -0
- package/dist/diagram/layout/smartart-layout-interpreter-named-rules.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-position-family.d.ts +58 -0
- package/dist/diagram/layout/smartart-layout-interpreter-position-family.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-preset-node.d.ts +61 -0
- package/dist/diagram/layout/smartart-layout-interpreter-preset-node.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-presof-choose.d.ts +29 -0
- package/dist/diagram/layout/smartart-layout-interpreter-presof-choose.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-pyramid-bands.d.ts +41 -0
- package/dist/diagram/layout/smartart-layout-interpreter-pyramid-bands.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-pyramid.d.ts +100 -0
- package/dist/diagram/layout/smartart-layout-interpreter-pyramid.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-render.d.ts +86 -0
- package/dist/diagram/layout/smartart-layout-interpreter-render.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-snake.d.ts +18 -0
- package/dist/diagram/layout/smartart-layout-interpreter-snake.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-tree-location.d.ts +28 -0
- package/dist/diagram/layout/smartart-layout-interpreter-tree-location.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-when-numeric.d.ts +15 -0
- package/dist/diagram/layout/smartart-layout-interpreter-when-numeric.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-when-var.d.ts +12 -0
- package/dist/diagram/layout/smartart-layout-interpreter-when-var.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-when.d.ts +69 -0
- package/dist/diagram/layout/smartart-layout-interpreter-when.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter.d.ts +80 -0
- package/dist/diagram/layout/smartart-layout-interpreter.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-item-font-role.d.ts +80 -0
- package/dist/diagram/layout/smartart-layout-item-font-role.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-item-font-size.d.ts +129 -0
- package/dist/diagram/layout/smartart-layout-item-font-size.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-item-font-tier-fit.d.ts +70 -0
- package/dist/diagram/layout/smartart-layout-item-font-tier-fit.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-item-font-tier.d.ts +139 -0
- package/dist/diagram/layout/smartart-layout-item-font-tier.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-item-tx-anchor.d.ts +105 -0
- package/dist/diagram/layout/smartart-layout-item-tx-anchor.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-shape-polygon.d.ts +17 -0
- package/dist/diagram/layout/smartart-layout-shape-polygon.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-shape-preset.d.ts +127 -0
- package/dist/diagram/layout/smartart-layout-shape-preset.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-snake-grid.d.ts +43 -0
- package/dist/diagram/layout/smartart-layout-snake-grid.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-style-helpers.d.ts +84 -0
- package/dist/diagram/layout/smartart-layout-style-helpers.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-types.d.ts +253 -0
- package/dist/diagram/layout/smartart-layout-types.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-line-pitch.d.ts +29 -0
- package/dist/diagram/layout/smartart-line-pitch.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-node-role-colors.d.ts +30 -0
- package/dist/diagram/layout/smartart-node-role-colors.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-node-tree-axis.d.ts +91 -0
- package/dist/diagram/layout/smartart-node-tree-axis.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-text-wrap-fit.d.ts +84 -0
- package/dist/diagram/layout/smartart-text-wrap-fit.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-tree.d.ts +33 -0
- package/dist/diagram/layout/smartart-tree.d.ts.map +1 -0
- package/dist/diagram/model/constraint-rules.d.ts +31 -0
- package/dist/diagram/model/constraint-rules.d.ts.map +1 -0
- package/dist/diagram/model/data.d.ts +109 -0
- package/dist/diagram/model/data.d.ts.map +1 -0
- package/dist/diagram/model/index.d.ts +7 -0
- package/dist/diagram/model/index.d.ts.map +1 -0
- package/dist/diagram/model/layout-definition.d.ts +276 -0
- package/dist/diagram/model/layout-definition.d.ts.map +1 -0
- package/dist/diagram/model/layout-primitives.d.ts +82 -0
- package/dist/diagram/model/layout-primitives.d.ts.map +1 -0
- package/dist/diagram/model/node.d.ts +194 -0
- package/dist/diagram/model/node.d.ts.map +1 -0
- package/dist/diagram/model/style-definition.d.ts +131 -0
- package/dist/diagram/model/style-definition.d.ts.map +1 -0
- package/dist/docx/chart-paint.d.ts +14 -0
- package/dist/docx/chart-paint.d.ts.map +1 -0
- package/dist/docx/chart.d.ts +43 -0
- package/dist/docx/chart.d.ts.map +1 -0
- package/dist/docx/drawing.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +1393 -326
- package/dist/docx/embedded.mjs +1393 -326
- package/dist/docx/index.cjs +4042 -683
- package/dist/docx/index.d.ts +2 -0
- package/dist/docx/index.d.ts.map +1 -1
- package/dist/docx/index.mjs +4038 -684
- package/dist/docx/inline-model.d.ts +3 -0
- package/dist/docx/inline-model.d.ts.map +1 -1
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +2672 -88
- package/dist/docx/layout/index.mjs +2673 -89
- package/dist/docx/layout/input.d.ts +5 -0
- package/dist/docx/layout/input.d.ts.map +1 -1
- package/dist/docx/load/index.cjs +1616 -549
- package/dist/docx/load/index.mjs +1616 -549
- package/dist/docx/parse.d.ts.map +1 -1
- package/dist/docx/ui/chart-spec.d.ts +10 -0
- package/dist/docx/ui/chart-spec.d.ts.map +1 -0
- package/dist/docx/ui/index.cjs +2600 -186
- package/dist/docx/ui/index.d.ts +1 -0
- package/dist/docx/ui/index.d.ts.map +1 -1
- package/dist/docx/ui/index.mjs +2599 -188
- package/dist/docx/ui/inline-content-schema.d.ts.map +1 -1
- package/dist/docx/ui/run-adapter.d.ts.map +1 -1
- package/dist/drawingml/write-line.d.ts +7 -0
- package/dist/drawingml/write-line.d.ts.map +1 -0
- package/dist/geometry/ooxml-arc.d.ts +31 -0
- package/dist/geometry/ooxml-arc.d.ts.map +1 -0
- package/dist/geometry/preset-shape-evaluator.d.ts +73 -0
- package/dist/geometry/preset-shape-evaluator.d.ts.map +1 -0
- package/dist/index.cjs +34835 -18367
- package/dist/index.mjs +34831 -18367
- package/dist/opc/embedded-packages.d.ts +11 -0
- package/dist/opc/embedded-packages.d.ts.map +1 -0
- package/dist/opc/index.cjs +365 -70
- package/dist/opc/index.d.ts +1 -0
- package/dist/opc/index.d.ts.map +1 -1
- package/dist/opc/index.mjs +353 -71
- package/dist/opc/properties/app.d.ts +9 -3
- package/dist/opc/properties/app.d.ts.map +1 -1
- package/dist/opc/properties/core.d.ts +5 -1
- package/dist/opc/properties/core.d.ts.map +1 -1
- package/dist/opc/properties/custom.d.ts +19 -0
- package/dist/opc/properties/custom.d.ts.map +1 -1
- package/dist/opc/properties/index.d.ts +6 -3
- package/dist/opc/properties/index.d.ts.map +1 -1
- package/dist/opc/properties/patch.d.ts +38 -0
- package/dist/opc/properties/patch.d.ts.map +1 -0
- package/dist/opc/properties/title-groups.d.ts +30 -0
- package/dist/opc/properties/title-groups.d.ts.map +1 -0
- package/dist/opc/properties/types.d.ts +15 -0
- package/dist/opc/properties/types.d.ts.map +1 -1
- package/dist/pptx/automation/index.cjs +9023 -7151
- package/dist/pptx/automation/index.d.ts +4 -4
- package/dist/pptx/automation/index.mjs +6 -6
- package/dist/pptx/chunks/{index-BYkdcS8J.d.ts → index-EZJZ7USt.d.ts} +907 -962
- package/dist/pptx/chunks/index-EZJZ7USt.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-BHqL5KXH.d.ts → index-JNv7AJx5.d.ts} +163 -210
- package/dist/pptx/chunks/index-JNv7AJx5.d.ts.map +1 -0
- package/dist/pptx/chunks/{smart-art-CO2jmJFf.d.ts → smart-art-Q2kZQtHh.d.ts} +436 -374
- package/dist/pptx/chunks/smart-art-Q2kZQtHh.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-DEJ7alZR.d.ts → text-operations-DtCxXrMh.d.ts} +55 -4
- package/dist/pptx/chunks/text-operations-DtCxXrMh.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +8702 -6830
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +5 -5
- package/dist/pptx/converter/index.cjs +7124 -7136
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +3 -3
- package/dist/pptx/editor/render/table-cell-edit.cjs +7 -3
- package/dist/pptx/editor/render/table-cell-edit.d.ts +16 -1
- package/dist/pptx/editor/render/table-cell-edit.d.ts.map +1 -1
- package/dist/pptx/editor/render/table-cell-edit.mjs +1 -1
- package/dist/pptx/editor/render/table-cell-merge.cjs +3 -3
- package/dist/pptx/editor/render/table-cell-merge.mjs +1 -1
- package/dist/pptx/editor/render/table-data-grid-ops.cjs +7 -7
- package/dist/pptx/editor/render/table-data-grid-ops.mjs +2 -2
- package/dist/pptx/editor/render/table-layout.cjs +6 -6
- package/dist/pptx/editor/render/table-layout.d.ts.map +1 -1
- package/dist/pptx/editor/render/table-layout.mjs +1 -1
- package/dist/pptx/editor/render/table-merge.cjs +5 -5
- package/dist/pptx/editor/render/table-merge.mjs +1 -1
- package/dist/pptx/index.cjs +9345 -7304
- package/dist/pptx/index.d.ts +5 -5
- package/dist/pptx/index.mjs +6 -6
- package/dist/pptx/smartart-layouts/index.cjs +135 -106
- package/dist/pptx/smartart-layouts/index.d.ts +1 -1
- package/dist/pptx/smartart-layouts/index.mjs +1 -1
- package/dist/teams/content.d.ts.map +1 -1
- package/dist/teams/index.cjs +3778 -1999
- package/dist/teams/index.d.ts +1 -0
- package/dist/teams/index.d.ts.map +1 -1
- package/dist/teams/index.mjs +3777 -1999
- package/dist/teams/server-file-storage.d.ts +11 -0
- package/dist/teams/server-file-storage.d.ts.map +1 -0
- package/dist/teams/store.d.ts +2 -0
- package/dist/teams/store.d.ts.map +1 -1
- package/dist/teams/stored-file.d.ts.map +1 -1
- package/dist/{xlsx/layout/font-family.d.ts → text/css-font-family.d.ts} +1 -1
- package/dist/text/css-font-family.d.ts.map +1 -0
- package/dist/text/font-metrics/font-advance-widths-aptos-display.generated.d.ts +10 -0
- package/dist/text/font-metrics/font-advance-widths-aptos-display.generated.d.ts.map +1 -0
- package/dist/text/font-metrics/font-advance-widths-aptos.generated.d.ts +10 -0
- package/dist/text/font-metrics/font-advance-widths-aptos.generated.d.ts.map +1 -0
- package/dist/text/font-metrics/font-advance-widths-arial.generated.d.ts +10 -0
- package/dist/text/font-metrics/font-advance-widths-arial.generated.d.ts.map +1 -0
- package/dist/text/font-metrics/font-advance-widths-calibri-light.generated.d.ts +10 -0
- package/dist/text/font-metrics/font-advance-widths-calibri-light.generated.d.ts.map +1 -0
- package/dist/text/font-metrics/font-advance-widths-calibri.generated.d.ts +10 -0
- package/dist/text/font-metrics/font-advance-widths-calibri.generated.d.ts.map +1 -0
- package/dist/text/font-metrics/font-advance-widths-segoe-ui.generated.d.ts +10 -0
- package/dist/text/font-metrics/font-advance-widths-segoe-ui.generated.d.ts.map +1 -0
- package/dist/text/font-metrics/font-advance-widths-times-new-roman.generated.d.ts +10 -0
- package/dist/text/font-metrics/font-advance-widths-times-new-roman.generated.d.ts.map +1 -0
- package/dist/text/font-metrics/font-advance-widths.generated.d.ts +48 -0
- package/dist/text/font-metrics/font-advance-widths.generated.d.ts.map +1 -0
- package/dist/text/font-metrics/font-kerning.d.ts +19 -0
- package/dist/text/font-metrics/font-kerning.d.ts.map +1 -0
- package/dist/visio/index.cjs +645 -119
- package/dist/visio/index.mjs +645 -119
- package/dist/visio/theme-color.d.ts +13 -3
- package/dist/visio/theme-color.d.ts.map +1 -1
- package/dist/visio/theme-resolve.d.ts +2 -1
- package/dist/visio/theme-resolve.d.ts.map +1 -1
- package/dist/visio/theme.d.ts +5 -2
- package/dist/visio/theme.d.ts.map +1 -1
- package/dist/xlsx/collab/adapter.d.ts +18 -0
- package/dist/xlsx/collab/adapter.d.ts.map +1 -0
- package/dist/xlsx/collab/apply.d.ts +8 -0
- package/dist/xlsx/collab/apply.d.ts.map +1 -0
- package/dist/xlsx/collab/bind.d.ts +34 -0
- package/dist/xlsx/collab/bind.d.ts.map +1 -0
- package/dist/xlsx/collab/codec.d.ts +35 -0
- package/dist/xlsx/collab/codec.d.ts.map +1 -0
- package/dist/xlsx/collab/dirty.d.ts +23 -0
- package/dist/xlsx/collab/dirty.d.ts.map +1 -0
- package/dist/xlsx/collab/index.cjs +1245 -0
- package/dist/xlsx/collab/index.d.ts +10 -0
- package/dist/xlsx/collab/index.d.ts.map +1 -0
- package/dist/xlsx/collab/index.mjs +1207 -0
- package/dist/xlsx/collab/lines.d.ts +22 -0
- package/dist/xlsx/collab/lines.d.ts.map +1 -0
- package/dist/xlsx/collab/names.d.ts +16 -0
- package/dist/xlsx/collab/names.d.ts.map +1 -0
- package/dist/xlsx/collab/presence.d.ts +31 -0
- package/dist/xlsx/collab/presence.d.ts.map +1 -0
- package/dist/xlsx/collab/schema.d.ts +30 -0
- package/dist/xlsx/collab/schema.d.ts.map +1 -0
- package/dist/xlsx/collab/sheets.d.ts +34 -0
- package/dist/xlsx/collab/sheets.d.ts.map +1 -0
- package/dist/xlsx/collab/styles.d.ts +26 -0
- package/dist/xlsx/collab/styles.d.ts.map +1 -0
- package/dist/xlsx/collab/write.d.ts +14 -0
- package/dist/xlsx/collab/write.d.ts.map +1 -0
- package/dist/xlsx/edit/chart-colors.d.ts +2 -2
- package/dist/xlsx/edit/chart-colors.d.ts.map +1 -1
- package/dist/xlsx/edit/chart-element-fill.d.ts +3 -3
- package/dist/xlsx/edit/chart-element-fill.d.ts.map +1 -1
- package/dist/xlsx/edit/chart-series-fill.d.ts +2 -2
- package/dist/xlsx/edit/chart-series-fill.d.ts.map +1 -1
- package/dist/xlsx/edit/chart-series-gradient.d.ts +3 -3
- package/dist/xlsx/edit/chart-series-gradient.d.ts.map +1 -1
- package/dist/xlsx/edit/chart-series-target.d.ts +15 -0
- package/dist/xlsx/edit/chart-series-target.d.ts.map +1 -0
- package/dist/xlsx/edit/chart-series-transparency.d.ts +2 -2
- package/dist/xlsx/edit/chart-series-transparency.d.ts.map +1 -1
- package/dist/xlsx/edit/external.d.ts +28 -0
- package/dist/xlsx/edit/external.d.ts.map +1 -0
- package/dist/xlsx/edit/index.d.ts +1 -0
- package/dist/xlsx/edit/index.d.ts.map +1 -1
- package/dist/xlsx/edit/session-calc.d.ts +7 -0
- package/dist/xlsx/edit/session-calc.d.ts.map +1 -1
- package/dist/xlsx/edit/session.d.ts.map +1 -1
- package/dist/xlsx/edit/types.d.ts +14 -1
- package/dist/xlsx/edit/types.d.ts.map +1 -1
- package/dist/xlsx/formula/engine.d.ts.map +1 -1
- package/dist/xlsx/formula/lexemes.d.ts +6 -0
- package/dist/xlsx/formula/lexemes.d.ts.map +1 -1
- package/dist/xlsx/formula/tokenizer.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +4599 -2399
- package/dist/xlsx/index.mjs +4589 -2400
- package/dist/xlsx/layout/cell-view.d.ts.map +1 -1
- package/dist/xlsx/layout/chart-view.d.ts +3 -54
- package/dist/xlsx/layout/chart-view.d.ts.map +1 -1
- package/dist/xlsx/layout/colors.d.ts +1 -4
- package/dist/xlsx/layout/colors.d.ts.map +1 -1
- package/dist/xlsx/layout/index.d.ts +7 -4
- package/dist/xlsx/layout/index.d.ts.map +1 -1
- package/dist/xlsx/layout/remote-selections.d.ts +40 -0
- package/dist/xlsx/layout/remote-selections.d.ts.map +1 -0
- package/dist/xlsx/layout/sparkline-data.d.ts +19 -0
- package/dist/xlsx/layout/sparkline-data.d.ts.map +1 -0
- package/dist/xlsx/layout/sparkline-view.d.ts +52 -0
- package/dist/xlsx/layout/sparkline-view.d.ts.map +1 -0
- package/dist/xlsx/layout/tint.d.ts +3 -12
- package/dist/xlsx/layout/tint.d.ts.map +1 -1
- package/dist/xlsx/layout/types.d.ts +3 -0
- package/dist/xlsx/layout/types.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +3036 -1286
- package/dist/xlsx/load/index.mjs +3036 -1286
- package/dist/xlsx/model-sparklines.d.ts +52 -0
- package/dist/xlsx/model-sparklines.d.ts.map +1 -0
- package/dist/xlsx/model.d.ts +10 -47
- package/dist/xlsx/model.d.ts.map +1 -1
- package/dist/xlsx/read/chart.d.ts +1 -4
- package/dist/xlsx/read/chart.d.ts.map +1 -1
- package/dist/xlsx/read/index.d.ts +1 -0
- package/dist/xlsx/read/index.d.ts.map +1 -1
- package/dist/xlsx/read/sheet-data-source.d.ts +10 -0
- package/dist/xlsx/read/sheet-data-source.d.ts.map +1 -0
- package/dist/xlsx/read/sparklines.d.ts +12 -0
- package/dist/xlsx/read/sparklines.d.ts.map +1 -0
- package/dist/xlsx/read/worksheet.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
- package/dist/xlsx/ui/context.d.ts +15 -1
- package/dist/xlsx/ui/context.d.ts.map +1 -1
- package/dist/xlsx/ui/grid/cell-items.d.ts.map +1 -1
- package/dist/xlsx/ui/grid/cell-paint.d.ts +1 -1
- package/dist/xlsx/ui/grid/cell-paint.d.ts.map +1 -1
- package/dist/xlsx/ui/grid/view-cache.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +1127 -559
- package/dist/xlsx/ui/index.mjs +1127 -560
- package/dist/xlsx/ui/locales/de/collab.d.ts +2 -0
- package/dist/xlsx/ui/locales/de/collab.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/de/index.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/en/collab.d.ts +2 -0
- package/dist/xlsx/ui/locales/en/collab.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/en/index.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/es/collab.d.ts +2 -0
- package/dist/xlsx/ui/locales/es/collab.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/es/index.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/fr/collab.d.ts +2 -0
- package/dist/xlsx/ui/locales/fr/collab.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/fr/index.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/zh-CN/collab.d.ts +2 -0
- package/dist/xlsx/ui/locales/zh-CN/collab.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/zh-CN/index.d.ts.map +1 -1
- package/dist/xlsx/ui/ribbon/icon-paths.d.ts.map +1 -1
- package/dist/xlsx/write/chart-colors.d.ts +3 -0
- package/dist/xlsx/write/chart-colors.d.ts.map +1 -1
- package/dist/xlsx/write/chart-space.d.ts +5 -0
- package/dist/xlsx/write/chart-space.d.ts.map +1 -0
- package/dist/xlsx/write/chart-title.d.ts +4 -1
- package/dist/xlsx/write/chart-title.d.ts.map +1 -1
- package/dist/xlsx/write/chart.d.ts +4 -1
- package/dist/xlsx/write/chart.d.ts.map +1 -1
- package/dist/xml/index.cjs +162 -0
- package/dist/xml/index.d.ts +1 -0
- package/dist/xml/index.d.ts.map +1 -1
- package/dist/xml/index.mjs +161 -1
- package/dist/xml/lite.d.ts +30 -0
- package/dist/xml/lite.d.ts.map +1 -0
- package/package.json +6 -1
- package/dist/pptx/chunks/index-BHqL5KXH.d.ts.map +0 -1
- package/dist/pptx/chunks/index-BYkdcS8J.d.ts.map +0 -1
- package/dist/pptx/chunks/smart-art-CO2jmJFf.d.ts.map +0 -1
- package/dist/pptx/chunks/text-operations-DEJ7alZR.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-appearance.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-colors.d.ts +0 -9
- package/dist/xlsx/layout/chart-colors.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-scale.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-spacing.d.ts +0 -6
- package/dist/xlsx/layout/chart-spacing.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-appearance.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-bars.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-cartesian.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-legend.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-radial.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-text-metrics.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-title-text.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-util.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-title-text.d.ts +0 -14
- package/dist/xlsx/layout/chart-title-text.d.ts.map +0 -1
- package/dist/xlsx/layout/font-family.d.ts.map +0 -1
- /package/dist/{xlsx/layout → chart/render}/chart-scale.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-bars.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-cartesian.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-legend.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-radial.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-text-metrics.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-title-text.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-util.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg.d.ts +0 -0
package/dist/chart/index.cjs
CHANGED
|
@@ -4,46 +4,46 @@ var xmldom = require('@xmldom/xmldom');
|
|
|
4
4
|
|
|
5
5
|
// chart/regression.ts
|
|
6
6
|
function computeLinearRegression(xVals, yVals) {
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
7
|
+
const n2 = xVals.length;
|
|
8
|
+
if (n2 < 2) {
|
|
9
9
|
return { slope: 0, intercept: 0, rSquared: 0 };
|
|
10
10
|
}
|
|
11
11
|
let sumX = 0;
|
|
12
12
|
let sumY = 0;
|
|
13
13
|
let sumXY = 0;
|
|
14
14
|
let sumXX = 0;
|
|
15
|
-
for (let i = 0; i <
|
|
15
|
+
for (let i = 0; i < n2; i++) {
|
|
16
16
|
sumX += xVals[i];
|
|
17
17
|
sumY += yVals[i];
|
|
18
18
|
sumXY += xVals[i] * yVals[i];
|
|
19
19
|
sumXX += xVals[i] * xVals[i];
|
|
20
20
|
}
|
|
21
|
-
const denom =
|
|
21
|
+
const denom = n2 * sumXX - sumX * sumX;
|
|
22
22
|
if (Math.abs(denom) < 1e-12) {
|
|
23
|
-
return { slope: 0, intercept: sumY /
|
|
23
|
+
return { slope: 0, intercept: sumY / n2, rSquared: 0 };
|
|
24
24
|
}
|
|
25
|
-
const slope = (
|
|
26
|
-
const intercept = (sumY - slope * sumX) /
|
|
25
|
+
const slope = (n2 * sumXY - sumX * sumY) / denom;
|
|
26
|
+
const intercept = (sumY - slope * sumX) / n2;
|
|
27
27
|
const ssRes = yVals.reduce((s, y, i) => s + (y - (slope * xVals[i] + intercept)) ** 2, 0);
|
|
28
|
-
const meanY = sumY /
|
|
28
|
+
const meanY = sumY / n2;
|
|
29
29
|
const ssTot = yVals.reduce((s, y) => s + (y - meanY) ** 2, 0);
|
|
30
30
|
const rSquared = ssTot > 0 ? 1 - ssRes / ssTot : 0;
|
|
31
31
|
return { slope, intercept, rSquared };
|
|
32
32
|
}
|
|
33
33
|
function fitPolynomial(xVals, yVals, order) {
|
|
34
|
-
const
|
|
34
|
+
const n2 = xVals.length;
|
|
35
35
|
const m = order + 1;
|
|
36
36
|
const matrix = Array.from({ length: m }, () => Array(m + 1).fill(0));
|
|
37
37
|
for (let i = 0; i < m; i++) {
|
|
38
38
|
for (let j = 0; j < m; j++) {
|
|
39
39
|
let sum2 = 0;
|
|
40
|
-
for (let k = 0; k <
|
|
40
|
+
for (let k = 0; k < n2; k++) {
|
|
41
41
|
sum2 += xVals[k] ** (i + j);
|
|
42
42
|
}
|
|
43
43
|
matrix[i][j] = sum2;
|
|
44
44
|
}
|
|
45
45
|
let sum = 0;
|
|
46
|
-
for (let k = 0; k <
|
|
46
|
+
for (let k = 0; k < n2; k++) {
|
|
47
47
|
sum += yVals[k] * xVals[k] ** i;
|
|
48
48
|
}
|
|
49
49
|
matrix[i][m] = sum;
|
|
@@ -76,14 +76,14 @@ function fitPolynomial(xVals, yVals, order) {
|
|
|
76
76
|
return matrix.map((row) => row[m]);
|
|
77
77
|
}
|
|
78
78
|
function computeRSquared(xVals, yVals, evalFn) {
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
79
|
+
const n2 = xVals.length;
|
|
80
|
+
if (n2 === 0) {
|
|
81
81
|
return 0;
|
|
82
82
|
}
|
|
83
|
-
const meanY = yVals.reduce((s, y) => s + y, 0) /
|
|
83
|
+
const meanY = yVals.reduce((s, y) => s + y, 0) / n2;
|
|
84
84
|
let ssRes = 0;
|
|
85
85
|
let ssTot = 0;
|
|
86
|
-
for (let i = 0; i <
|
|
86
|
+
for (let i = 0; i < n2; i++) {
|
|
87
87
|
ssRes += (yVals[i] - evalFn(xVals[i])) ** 2;
|
|
88
88
|
ssTot += (yVals[i] - meanY) ** 2;
|
|
89
89
|
}
|
|
@@ -207,7 +207,7 @@ function computeStackedSeriesPlots(seriesValues, catCount, percent) {
|
|
|
207
207
|
return seriesValues.map((values) => {
|
|
208
208
|
const cumulative = [], base = [], own = [];
|
|
209
209
|
for (let ci = 0; ci < catCount; ci++) {
|
|
210
|
-
const
|
|
210
|
+
const raw2 = values[ci] ?? 0, total = totals?.[ci] ?? 0, val = percent ? total > 0 ? raw2 / total * 100 : 0 : raw2, isNeg = val < 0, from = isNeg ? negRunning[ci] : posRunning[ci], to = from + val;
|
|
211
211
|
base.push(from);
|
|
212
212
|
cumulative.push(to);
|
|
213
213
|
own.push(val);
|
|
@@ -235,8 +235,8 @@ function axisTargetIntervals(plotHeightPx) {
|
|
|
235
235
|
return DEFAULT_TARGET_INTERVALS;
|
|
236
236
|
}
|
|
237
237
|
const plotHeightPt = plotHeightPx / PX_PER_POINT;
|
|
238
|
-
const
|
|
239
|
-
return Math.min(MAX_TARGET_INTERVALS, Math.max(MIN_TARGET_INTERVALS,
|
|
238
|
+
const raw2 = Math.round(plotHeightPt / POINTS_PER_GRIDLINE);
|
|
239
|
+
return Math.min(MAX_TARGET_INTERVALS, Math.max(MIN_TARGET_INTERVALS, raw2));
|
|
240
240
|
}
|
|
241
241
|
function niceAxisStep(value) {
|
|
242
242
|
if (!Number.isFinite(value) || value <= 0) {
|
|
@@ -397,10 +397,10 @@ function squarify(nodes, box) {
|
|
|
397
397
|
const scale = total > 0 ? box.w * box.h / total : box.w * box.h / sorted.length;
|
|
398
398
|
const items = sorted.map((node) => ({ node, area: (total > 0 ? node.weight : 1) * scale }));
|
|
399
399
|
const result = [];
|
|
400
|
-
let
|
|
400
|
+
let rect2 = { ...box };
|
|
401
401
|
let remaining = items;
|
|
402
402
|
for (let first2 = remaining[0]; first2 !== void 0; first2 = remaining[0]) {
|
|
403
|
-
const side = Math.min(
|
|
403
|
+
const side = Math.min(rect2.w, rect2.h);
|
|
404
404
|
let row = [first2];
|
|
405
405
|
let rowAreas = [first2.area];
|
|
406
406
|
let worst = worstAspectRatio(rowAreas, side);
|
|
@@ -418,18 +418,18 @@ function squarify(nodes, box) {
|
|
|
418
418
|
}
|
|
419
419
|
const rowTotalArea = rowAreas.reduce((sum, area) => sum + area, 0);
|
|
420
420
|
const thickness = side > 0 ? rowTotalArea / side : 0;
|
|
421
|
-
const layoutVertically =
|
|
422
|
-
let offset = layoutVertically ?
|
|
421
|
+
const layoutVertically = rect2.w >= rect2.h;
|
|
422
|
+
let offset = layoutVertically ? rect2.y : rect2.x;
|
|
423
423
|
for (const item of row) {
|
|
424
424
|
const length = thickness > 0 ? item.area / thickness : 0;
|
|
425
425
|
if (layoutVertically) {
|
|
426
|
-
result.push([item.node, { x:
|
|
426
|
+
result.push([item.node, { x: rect2.x, y: offset, w: thickness, h: length }]);
|
|
427
427
|
} else {
|
|
428
|
-
result.push([item.node, { x: offset, y:
|
|
428
|
+
result.push([item.node, { x: offset, y: rect2.y, w: length, h: thickness }]);
|
|
429
429
|
}
|
|
430
430
|
offset += length;
|
|
431
431
|
}
|
|
432
|
-
|
|
432
|
+
rect2 = layoutVertically ? { ...rect2, x: rect2.x + thickness, w: rect2.w - thickness } : { ...rect2, y: rect2.y + thickness, h: rect2.h - thickness };
|
|
433
433
|
remaining = remaining.slice(row.length);
|
|
434
434
|
}
|
|
435
435
|
return result;
|
|
@@ -475,8 +475,8 @@ function formatPolynomialEquation(coeffsAscending) {
|
|
|
475
475
|
|
|
476
476
|
// chart/radar-geometry.ts
|
|
477
477
|
function radarAngle(index, catCount) {
|
|
478
|
-
const
|
|
479
|
-
return Math.PI * 2 * index /
|
|
478
|
+
const n2 = Math.max(catCount, 1);
|
|
479
|
+
return Math.PI * 2 * index / n2 - Math.PI / 2;
|
|
480
480
|
}
|
|
481
481
|
function computeRadarPoints(values, maxVal, radius, cx, cy, catCount) {
|
|
482
482
|
const denom = maxVal > 0 ? maxVal : 1;
|
|
@@ -486,9 +486,9 @@ function computeRadarPoints(values, maxVal, radius, cx, cy, catCount) {
|
|
|
486
486
|
});
|
|
487
487
|
}
|
|
488
488
|
function radarRingPoints(cx, cy, rr, catCount) {
|
|
489
|
-
const
|
|
490
|
-
return Array.from({ length:
|
|
491
|
-
const angle = radarAngle(i,
|
|
489
|
+
const n2 = Math.max(catCount, 1);
|
|
490
|
+
return Array.from({ length: n2 }, (_, i) => {
|
|
491
|
+
const angle = radarAngle(i, n2);
|
|
492
492
|
return `${(cx + rr * Math.cos(angle)).toFixed(2)},${(cy + rr * Math.sin(angle)).toFixed(2)}`;
|
|
493
493
|
}).join(" ");
|
|
494
494
|
}
|
|
@@ -623,13 +623,13 @@ function hexToRgbChannels(color) {
|
|
|
623
623
|
b: Number.parseInt(normalized.slice(4, 6), 16)
|
|
624
624
|
};
|
|
625
625
|
}
|
|
626
|
-
function percentDivisorFor(
|
|
627
|
-
return
|
|
626
|
+
function percentDivisorFor(text2) {
|
|
627
|
+
return text2.endsWith("%") ? 100 : 1e5;
|
|
628
628
|
}
|
|
629
629
|
function parseOoxmlPercent(value) {
|
|
630
|
-
const
|
|
631
|
-
const divisor = percentDivisorFor(
|
|
632
|
-
const magnitude = Number.parseFloat(divisor === 100 ?
|
|
630
|
+
const text2 = String(value ?? "").trim();
|
|
631
|
+
const divisor = percentDivisorFor(text2);
|
|
632
|
+
const magnitude = Number.parseFloat(divisor === 100 ? text2.slice(0, -1) : text2);
|
|
633
633
|
if (!Number.isFinite(magnitude)) {
|
|
634
634
|
return void 0;
|
|
635
635
|
}
|
|
@@ -675,7 +675,7 @@ function rgbToHsl(r, g, b) {
|
|
|
675
675
|
return { h, s: clampUnitInterval(s), l: clampUnitInterval(l) };
|
|
676
676
|
}
|
|
677
677
|
function hslToRgb(h, s, l, roundChannel = Math.round, options) {
|
|
678
|
-
const sC = clampUnitInterval(s);
|
|
678
|
+
const sC = options?.clampSaturation === false ? s : clampUnitInterval(s);
|
|
679
679
|
const lC = clampUnitInterval(l);
|
|
680
680
|
const hN = (h % 360 + 360) % 360;
|
|
681
681
|
const c2 = (1 - Math.abs(2 * lC - 1)) * sC;
|
|
@@ -1014,6 +1014,16 @@ function sigmaGradientStops(stops) {
|
|
|
1014
1014
|
});
|
|
1015
1015
|
}
|
|
1016
1016
|
|
|
1017
|
+
// color/hex-rgb.ts
|
|
1018
|
+
function parseArgbHex(hex) {
|
|
1019
|
+
const clean2 = hex.replace(/^#/, "");
|
|
1020
|
+
const rgb = clean2.length === 8 ? clean2.slice(2) : clean2;
|
|
1021
|
+
if (!/^[0-9a-fA-F]{6}$/.test(rgb)) return void 0;
|
|
1022
|
+
return [0, 2, 4].map((i) => parseInt(rgb.slice(i, i + 2), 16));
|
|
1023
|
+
}
|
|
1024
|
+
var clamp255 = (v) => Math.max(0, Math.min(255, v));
|
|
1025
|
+
var rgbToUpperHex = (rgb) => `#${rgb.map((v) => clamp255(Math.round(v)).toString(16).padStart(2, "0")).join("").toUpperCase()}`;
|
|
1026
|
+
|
|
1017
1027
|
// xml/namespaces.ts
|
|
1018
1028
|
var NS = {
|
|
1019
1029
|
/** DrawingML main. */
|
|
@@ -1057,6 +1067,10 @@ function named(element, local, ns, lenient = true) {
|
|
|
1057
1067
|
}
|
|
1058
1068
|
var children = (parent, local, ns, lenient = true) => elements(parent).filter((element) => named(element, local, ns, lenient));
|
|
1059
1069
|
var first = (parent, local, ns, lenient = true) => parent ? children(parent, local, ns, lenient)[0] : void 0;
|
|
1070
|
+
function attr(element, local, ns, prefix) {
|
|
1071
|
+
return element?.getAttributeNS(ns, local) ?? element?.getAttribute(`${prefix}:${local}`) ?? void 0;
|
|
1072
|
+
}
|
|
1073
|
+
var relAttr = (element, local) => attr(element, local, NS.r, "r");
|
|
1060
1074
|
|
|
1061
1075
|
// drawingml/dom.ts
|
|
1062
1076
|
function attributeReader(element) {
|
|
@@ -1079,6 +1093,54 @@ function booleanAttribute(element, name) {
|
|
|
1079
1093
|
return void 0;
|
|
1080
1094
|
}
|
|
1081
1095
|
|
|
1096
|
+
// drawingml/ordered-color-transforms.ts
|
|
1097
|
+
function orderedColorTransforms(channels, transforms) {
|
|
1098
|
+
let { r, g, b } = channels;
|
|
1099
|
+
let alpha = 1;
|
|
1100
|
+
const wrap2 = (value) => (value % 360 + 360) % 360;
|
|
1101
|
+
for (const transform of transforms) {
|
|
1102
|
+
const { name, value } = transform;
|
|
1103
|
+
const fraction = parseDrawingFraction(value);
|
|
1104
|
+
if (name === "alpha" && fraction !== void 0) alpha = clampUnitInterval(fraction);
|
|
1105
|
+
else if (name === "alphaMod" && fraction !== void 0)
|
|
1106
|
+
alpha = clampUnitInterval(alpha * fraction);
|
|
1107
|
+
else if (name === "alphaOff" && fraction !== void 0)
|
|
1108
|
+
alpha = clampUnitInterval(alpha + fraction);
|
|
1109
|
+
else if (name === "inv") [r, g, b] = [255 - r, 255 - g, 255 - b];
|
|
1110
|
+
else if (name === "gray") r = g = b = 0.299 * r + 0.587 * g + 0.114 * b;
|
|
1111
|
+
else if ((name === "shade" || name === "tint") && fraction !== void 0) {
|
|
1112
|
+
const mix = (channel) => linearToSrgb255(
|
|
1113
|
+
name === "shade" ? srgb255ToLinear(channel) * fraction : 1 - (1 - srgb255ToLinear(channel)) * fraction
|
|
1114
|
+
);
|
|
1115
|
+
[r, g, b] = [mix(r), mix(g), mix(b)];
|
|
1116
|
+
} else {
|
|
1117
|
+
const hsl = rgbToHsl(r, g, b);
|
|
1118
|
+
if (name === "comp") hsl.h = wrap2(hsl.h + 180);
|
|
1119
|
+
else if (name === "hue") {
|
|
1120
|
+
const hue = parseDrawingHueDegrees(value);
|
|
1121
|
+
if (hue !== void 0) hsl.h = wrap2(hue);
|
|
1122
|
+
} else if (name === "hueOff") {
|
|
1123
|
+
const hue = parseDrawingHueDegrees(value);
|
|
1124
|
+
if (hue !== void 0) hsl.h = wrap2(hsl.h + hue);
|
|
1125
|
+
} else if (name === "hueMod" && fraction !== void 0) hsl.h = wrap2(hsl.h * fraction);
|
|
1126
|
+
else if (name === "sat" && fraction !== void 0) hsl.s = clampUnitInterval(fraction);
|
|
1127
|
+
else if (name === "satMod" && fraction !== void 0) hsl.s *= fraction;
|
|
1128
|
+
else if (name === "satOff" && fraction !== void 0)
|
|
1129
|
+
hsl.s = clampUnitInterval(hsl.s + fraction);
|
|
1130
|
+
else if (name === "lum" && fraction !== void 0) hsl.l = clampUnitInterval(fraction);
|
|
1131
|
+
else if (name === "lumMod" && fraction !== void 0)
|
|
1132
|
+
hsl.l = clampUnitInterval(hsl.l * fraction);
|
|
1133
|
+
else if (name === "lumOff" && fraction !== void 0)
|
|
1134
|
+
hsl.l = clampUnitInterval(hsl.l + fraction);
|
|
1135
|
+
else continue;
|
|
1136
|
+
({ r, g, b } = hslToRgb(hsl.h, hsl.s, hsl.l, (channel) => channel, {
|
|
1137
|
+
clampSaturation: false
|
|
1138
|
+
}));
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
return { r, g, b, alpha };
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1082
1144
|
// drawingml/drawing-color.ts
|
|
1083
1145
|
var COLOR_ELEMENTS = {
|
|
1084
1146
|
srgbClr: "srgb",
|
|
@@ -1089,10 +1151,10 @@ var COLOR_ELEMENTS = {
|
|
|
1089
1151
|
hslClr: "hsl"
|
|
1090
1152
|
};
|
|
1091
1153
|
function colorValue(kind, element) {
|
|
1092
|
-
const
|
|
1093
|
-
if (kind === "scrgb") return `${
|
|
1094
|
-
if (kind === "hsl") return `${
|
|
1095
|
-
return
|
|
1154
|
+
const attribute2 = (name) => element.getAttribute(name) ?? "";
|
|
1155
|
+
if (kind === "scrgb") return `${attribute2("r")},${attribute2("g")},${attribute2("b")}`;
|
|
1156
|
+
if (kind === "hsl") return `${attribute2("hue")},${attribute2("sat")},${attribute2("lum")}`;
|
|
1157
|
+
return attribute2("val");
|
|
1096
1158
|
}
|
|
1097
1159
|
function parseDrawingColorIn(container) {
|
|
1098
1160
|
if (!container) return void 0;
|
|
@@ -1177,6 +1239,17 @@ function resolveDrawingColor(color, theme, options) {
|
|
|
1177
1239
|
const base = baseHex(color, theme);
|
|
1178
1240
|
const rgb = base ? hexToRgbChannels(base) : null;
|
|
1179
1241
|
if (!rgb) return void 0;
|
|
1242
|
+
if (options?.transformOrder === "document") {
|
|
1243
|
+
const value = orderedColorTransforms(rgb, color.transforms);
|
|
1244
|
+
const round = options.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
|
|
1245
|
+
return {
|
|
1246
|
+
hex: `#${toHex(round(value.r))}${toHex(round(value.g))}${toHex(round(value.b))}`,
|
|
1247
|
+
alpha: value.alpha,
|
|
1248
|
+
unapplied: [...new Set(color.transforms.map((transform) => transform.name))].filter(
|
|
1249
|
+
(name) => !APPLIED.has(name)
|
|
1250
|
+
)
|
|
1251
|
+
};
|
|
1252
|
+
}
|
|
1180
1253
|
let { r, g, b } = rgb;
|
|
1181
1254
|
const find = (name) => color.transforms.find((entry3) => entry3.name === name)?.value;
|
|
1182
1255
|
const has = (name) => color.transforms.some((entry3) => entry3.name === name);
|
|
@@ -1200,13 +1273,13 @@ function resolveDrawingColor(color, theme, options) {
|
|
|
1200
1273
|
}
|
|
1201
1274
|
if (["hue", "hueMod", "hueOff", "sat", "satMod", "satOff", "lum", "lumMod", "lumOff"].some(has)) {
|
|
1202
1275
|
const hsl = rgbToHsl(r, g, b);
|
|
1203
|
-
const
|
|
1276
|
+
const wrap2 = (degrees) => (degrees % 360 + 360) % 360;
|
|
1204
1277
|
const hueAbs = parseDrawingHueDegrees(find("hue"));
|
|
1205
|
-
if (hueAbs !== void 0) hsl.h =
|
|
1278
|
+
if (hueAbs !== void 0) hsl.h = wrap2(hueAbs);
|
|
1206
1279
|
const hueMod = parseDrawingFraction(find("hueMod"));
|
|
1207
|
-
if (hueMod !== void 0) hsl.h =
|
|
1280
|
+
if (hueMod !== void 0) hsl.h = wrap2(hsl.h * hueMod);
|
|
1208
1281
|
const hueOff = parseDrawingHueDegrees(find("hueOff"));
|
|
1209
|
-
if (hueOff !== void 0) hsl.h =
|
|
1282
|
+
if (hueOff !== void 0) hsl.h = wrap2(hsl.h + hueOff);
|
|
1210
1283
|
const satAbs = parseDrawingFraction(find("sat"));
|
|
1211
1284
|
if (satAbs !== void 0) hsl.s = clampUnitInterval(satAbs);
|
|
1212
1285
|
const satMod = parseDrawingFraction(find("satMod"));
|
|
@@ -1219,7 +1292,7 @@ function resolveDrawingColor(color, theme, options) {
|
|
|
1219
1292
|
if (lumMod !== void 0) hsl.l = clampUnitInterval(hsl.l * lumMod);
|
|
1220
1293
|
const lumOff = parseDrawingFraction(find("lumOff"));
|
|
1221
1294
|
if (lumOff !== void 0) hsl.l = clampUnitInterval(hsl.l + lumOff);
|
|
1222
|
-
const round = Math.round;
|
|
1295
|
+
const round = options?.hslRounding === "halfDown" ? (value) => Math.ceil(value - 0.5) : Math.round;
|
|
1223
1296
|
({ r, g, b } = hslToRgb(hsl.h, hsl.s, hsl.l, round));
|
|
1224
1297
|
}
|
|
1225
1298
|
let alpha = parseDrawingPercent(find("alpha")) ?? 1;
|
|
@@ -1283,12 +1356,12 @@ var CHART_COLOR_PALETTES = [
|
|
|
1283
1356
|
function findChartColorPalette(id) {
|
|
1284
1357
|
return CHART_COLOR_PALETTES.find((palette) => palette.id === id);
|
|
1285
1358
|
}
|
|
1286
|
-
function withinLinearTransform(i,
|
|
1287
|
-
if (
|
|
1359
|
+
function withinLinearTransform(i, n2) {
|
|
1360
|
+
if (n2 <= 1) {
|
|
1288
1361
|
return {};
|
|
1289
1362
|
}
|
|
1290
|
-
const step = 140 / (
|
|
1291
|
-
const centre = (
|
|
1363
|
+
const step = 140 / (n2 + 1);
|
|
1364
|
+
const centre = (n2 - 1) / 2;
|
|
1292
1365
|
const value = 100 - step * Math.abs(i - centre);
|
|
1293
1366
|
if (i < centre) {
|
|
1294
1367
|
return { shade: Math.floor(value + 1e-9) * 1e3 };
|
|
@@ -1298,7 +1371,7 @@ function withinLinearTransform(i, n) {
|
|
|
1298
1371
|
}
|
|
1299
1372
|
return {};
|
|
1300
1373
|
}
|
|
1301
|
-
function chartPaletteSeriesColorChoice(palette, i,
|
|
1374
|
+
function chartPaletteSeriesColorChoice(palette, i, n2) {
|
|
1302
1375
|
let base;
|
|
1303
1376
|
let transform;
|
|
1304
1377
|
if (palette.meth === "cycle") {
|
|
@@ -1306,9 +1379,9 @@ function chartPaletteSeriesColorChoice(palette, i, n) {
|
|
|
1306
1379
|
const round = Math.floor(i / palette.base.length);
|
|
1307
1380
|
transform = (palette.variations.length ? palette.variations[round % palette.variations.length] : {}) ?? {};
|
|
1308
1381
|
} else {
|
|
1309
|
-
const index = palette.meth === "withinLinearReversed" ?
|
|
1382
|
+
const index = palette.meth === "withinLinearReversed" ? n2 - 1 - i : i;
|
|
1310
1383
|
base = palette.base[0];
|
|
1311
|
-
transform = withinLinearTransform(index,
|
|
1384
|
+
transform = withinLinearTransform(index, n2);
|
|
1312
1385
|
}
|
|
1313
1386
|
if (!base) throw new RangeError("A chart palette must have a base color");
|
|
1314
1387
|
return {
|
|
@@ -1317,12 +1390,12 @@ function chartPaletteSeriesColorChoice(palette, i, n) {
|
|
|
1317
1390
|
transforms: Object.entries(transform).map(([name, value]) => ({ name, value: String(value) }))
|
|
1318
1391
|
};
|
|
1319
1392
|
}
|
|
1320
|
-
function chartPaletteSeriesColor(palette, i,
|
|
1321
|
-
const choice = chartPaletteSeriesColorChoice(palette, i,
|
|
1393
|
+
function chartPaletteSeriesColor(palette, i, n2, scheme) {
|
|
1394
|
+
const choice = chartPaletteSeriesColorChoice(palette, i, n2);
|
|
1322
1395
|
return (resolveDrawingColor(choice, { scheme: (name) => scheme[name] })?.hex ?? scheme[choice.value]).toUpperCase();
|
|
1323
1396
|
}
|
|
1324
|
-
function chartPaletteColors(palette,
|
|
1325
|
-
return Array.from({ length:
|
|
1397
|
+
function chartPaletteColors(palette, n2, scheme) {
|
|
1398
|
+
return Array.from({ length: n2 }, (_, i) => chartPaletteSeriesColor(palette, i, n2, scheme));
|
|
1326
1399
|
}
|
|
1327
1400
|
|
|
1328
1401
|
// chart/color-style.ts
|
|
@@ -1393,11 +1466,11 @@ function resolveChartStyleDefinition(style, resolve) {
|
|
|
1393
1466
|
const value = source[key];
|
|
1394
1467
|
if (value !== void 0) Object.assign(entry3, { [key]: value });
|
|
1395
1468
|
}
|
|
1396
|
-
const
|
|
1469
|
+
const line2 = fillColor(source.line?.fill) ?? (source.lineRef?.color && resolve(source.lineRef.color));
|
|
1397
1470
|
const fill = fillColor(source.fill) ?? (source.fillRef?.color && resolve(source.fillRef.color));
|
|
1398
1471
|
const color = (source.textColor && resolve(source.textColor)) ?? (source.fontRef?.color && resolve(source.fontRef.color));
|
|
1399
1472
|
if (color !== void 0) entry3.color = color;
|
|
1400
|
-
if (
|
|
1473
|
+
if (line2 !== void 0) entry3.lineColor = line2;
|
|
1401
1474
|
if (fill !== void 0) entry3.fillColor = fill;
|
|
1402
1475
|
if (source.line?.widthEmu !== void 0 && source.line.widthEmu > 0)
|
|
1403
1476
|
entry3.lineWidth = source.line.widthEmu / 12700;
|
|
@@ -1464,13 +1537,13 @@ var FILL_ELEMENTS = /* @__PURE__ */ new Set([
|
|
|
1464
1537
|
"blipFill",
|
|
1465
1538
|
"grpFill"
|
|
1466
1539
|
]);
|
|
1467
|
-
function fillElementOf(
|
|
1468
|
-
return
|
|
1540
|
+
function fillElementOf(properties2) {
|
|
1541
|
+
return properties2 ? elements(properties2).find(
|
|
1469
1542
|
(element) => FILL_ELEMENTS.has(element.localName) && (!element.namespaceURI || element.namespaceURI === NS.a)
|
|
1470
1543
|
) : void 0;
|
|
1471
1544
|
}
|
|
1472
|
-
function parseDrawingFill(
|
|
1473
|
-
const fill = fillElementOf(
|
|
1545
|
+
function parseDrawingFill(properties2) {
|
|
1546
|
+
const fill = fillElementOf(properties2);
|
|
1474
1547
|
if (!fill) return void 0;
|
|
1475
1548
|
switch (fill.localName) {
|
|
1476
1549
|
case "noFill":
|
|
@@ -1487,7 +1560,7 @@ function parseDrawingFill(properties) {
|
|
|
1487
1560
|
});
|
|
1488
1561
|
const angle = Number.parseInt(first(fill, "lin", NS.a)?.getAttribute("ang") ?? "", 10);
|
|
1489
1562
|
const scaled = first(fill, "lin", NS.a)?.getAttribute("scaled");
|
|
1490
|
-
const
|
|
1563
|
+
const path2 = first(fill, "path", NS.a)?.getAttribute("path");
|
|
1491
1564
|
const focus = first(first(fill, "path", NS.a), "fillToRect", NS.a);
|
|
1492
1565
|
const tile = first(fill, "tileRect", NS.a);
|
|
1493
1566
|
const tileRect = tile ? {
|
|
@@ -1509,7 +1582,7 @@ function parseDrawingFill(properties) {
|
|
|
1509
1582
|
...Number.isFinite(angle) ? { angle: angle / 6e4 } : {},
|
|
1510
1583
|
...scaled === "1" || scaled === "true" ? { scaled: true } : {},
|
|
1511
1584
|
...scaled === "0" || scaled === "false" ? { scaled: false } : {},
|
|
1512
|
-
...
|
|
1585
|
+
...path2 ? { path: path2 } : {},
|
|
1513
1586
|
...fillToRect && Object.values(fillToRect).every(Number.isFinite) ? { fillToRect } : {},
|
|
1514
1587
|
...tileRect && Object.values(tileRect).every(Number.isFinite) ? { tileRect } : {}
|
|
1515
1588
|
};
|
|
@@ -1535,41 +1608,41 @@ function parseDrawingFill(properties) {
|
|
|
1535
1608
|
}
|
|
1536
1609
|
function parseDrawingLine(ln) {
|
|
1537
1610
|
if (!ln) return void 0;
|
|
1538
|
-
const
|
|
1611
|
+
const line2 = {};
|
|
1539
1612
|
const width = Number.parseInt(ln.getAttribute("w") ?? "", 10);
|
|
1540
|
-
if (Number.isFinite(width))
|
|
1613
|
+
if (Number.isFinite(width)) line2.widthEmu = width;
|
|
1541
1614
|
const fill = parseDrawingFill(ln);
|
|
1542
|
-
if (fill)
|
|
1615
|
+
if (fill) line2.fill = fill;
|
|
1543
1616
|
const dash = first(ln, "prstDash", NS.a)?.getAttribute("val");
|
|
1544
|
-
if (dash)
|
|
1617
|
+
if (dash) line2.dash = dash;
|
|
1545
1618
|
const cap = ln.getAttribute("cap");
|
|
1546
|
-
if (cap)
|
|
1547
|
-
return
|
|
1619
|
+
if (cap) line2.cap = cap;
|
|
1620
|
+
return line2;
|
|
1548
1621
|
}
|
|
1549
1622
|
|
|
1550
1623
|
// chart/read-appearance.ts
|
|
1551
|
-
function readChartAppearance(
|
|
1624
|
+
function readChartAppearance(text2, properties2) {
|
|
1552
1625
|
const out = {};
|
|
1553
|
-
const size = Number(
|
|
1626
|
+
const size = Number(text2?.getAttribute("sz") ?? NaN);
|
|
1554
1627
|
if (Number.isFinite(size) && size > 0) out.fontSize = size / 100;
|
|
1555
|
-
for (const [
|
|
1628
|
+
for (const [attribute2, key] of [
|
|
1556
1629
|
["b", "bold"],
|
|
1557
1630
|
["i", "italic"]
|
|
1558
1631
|
]) {
|
|
1559
|
-
const value =
|
|
1632
|
+
const value = text2?.getAttribute(attribute2);
|
|
1560
1633
|
if (value !== null && value !== void 0) out[key] = value === "1" || value === "true";
|
|
1561
1634
|
}
|
|
1562
|
-
const
|
|
1563
|
-
const underline =
|
|
1635
|
+
const typeface2 = first(text2, "latin", NS.a)?.getAttribute("typeface");
|
|
1636
|
+
const underline = text2?.getAttribute("u");
|
|
1564
1637
|
if (underline) out.underline = underline !== "none";
|
|
1565
|
-
if (
|
|
1566
|
-
const color = parseDrawingColorIn(first(
|
|
1638
|
+
if (typeface2) out.typeface = typeface2;
|
|
1639
|
+
const color = parseDrawingColorIn(first(text2, "solidFill", NS.a));
|
|
1567
1640
|
if (color) out.textColor = color;
|
|
1568
|
-
const fill = parseDrawingFill(
|
|
1569
|
-
const
|
|
1641
|
+
const fill = parseDrawingFill(properties2);
|
|
1642
|
+
const line2 = parseDrawingLine(first(properties2, "ln", NS.a));
|
|
1570
1643
|
if (fill) out.fill = fill;
|
|
1571
|
-
if (
|
|
1572
|
-
const effects = first(
|
|
1644
|
+
if (line2) out.line = line2;
|
|
1645
|
+
const effects = first(text2, "effectLst", NS.a);
|
|
1573
1646
|
if (effects) out.textEffectsXml = buildXml(effects);
|
|
1574
1647
|
return out;
|
|
1575
1648
|
}
|
|
@@ -1631,46 +1704,46 @@ function parseSpacing(parent) {
|
|
|
1631
1704
|
["spcPts", "points", 100],
|
|
1632
1705
|
["spcPct", "percent", 1e5]
|
|
1633
1706
|
]) {
|
|
1634
|
-
const
|
|
1635
|
-
if (
|
|
1636
|
-
const value = Number(
|
|
1707
|
+
const raw2 = first(parent, name, NS.a)?.getAttribute("val");
|
|
1708
|
+
if (raw2 == null || !/^\d+$/.test(raw2)) continue;
|
|
1709
|
+
const value = Number(raw2) / divisor;
|
|
1637
1710
|
if (Number.isFinite(value)) return { unit, value };
|
|
1638
1711
|
}
|
|
1639
1712
|
return void 0;
|
|
1640
1713
|
}
|
|
1641
|
-
function parseProperties(
|
|
1714
|
+
function parseProperties(properties2) {
|
|
1642
1715
|
const parsed = {};
|
|
1643
|
-
const size = Number.parseInt(
|
|
1716
|
+
const size = Number.parseInt(properties2?.getAttribute("sz") ?? "", 10);
|
|
1644
1717
|
if (Number.isFinite(size)) parsed.sizePt = size / 100;
|
|
1645
|
-
const bold = booleanAttribute(
|
|
1718
|
+
const bold = booleanAttribute(properties2, "b");
|
|
1646
1719
|
if (bold !== void 0) parsed.bold = bold;
|
|
1647
|
-
const italic = booleanAttribute(
|
|
1720
|
+
const italic = booleanAttribute(properties2, "i");
|
|
1648
1721
|
if (italic !== void 0) parsed.italic = italic;
|
|
1649
|
-
const underline =
|
|
1722
|
+
const underline = properties2?.getAttribute("u");
|
|
1650
1723
|
if (underline) parsed.underline = underline !== "none";
|
|
1651
|
-
const color = parseDrawingColorIn(first(
|
|
1724
|
+
const color = parseDrawingColorIn(first(properties2, "solidFill", NS.a));
|
|
1652
1725
|
if (color) parsed.color = color;
|
|
1653
|
-
const
|
|
1654
|
-
if (
|
|
1726
|
+
const typeface2 = first(properties2, "latin", NS.a)?.getAttribute("typeface");
|
|
1727
|
+
if (typeface2) parsed.typeface = typeface2;
|
|
1655
1728
|
return parsed;
|
|
1656
1729
|
}
|
|
1657
|
-
function parseRun(
|
|
1730
|
+
function parseRun(run2) {
|
|
1658
1731
|
return {
|
|
1659
|
-
text:
|
|
1660
|
-
...parseProperties(first(
|
|
1732
|
+
text: run2.localName === "br" ? "\n" : first(run2, "t", NS.a)?.textContent ?? "",
|
|
1733
|
+
...parseProperties(first(run2, "rPr", NS.a))
|
|
1661
1734
|
};
|
|
1662
1735
|
}
|
|
1663
|
-
function parseParagraph(
|
|
1736
|
+
function parseParagraph(paragraph2) {
|
|
1664
1737
|
const runs = [];
|
|
1665
|
-
for (const child2 of elements(
|
|
1738
|
+
for (const child2 of elements(paragraph2))
|
|
1666
1739
|
if (child2.namespaceURI === NS.a && ["r", "fld", "br"].includes(child2.localName))
|
|
1667
1740
|
runs.push(parseRun(child2));
|
|
1668
|
-
const
|
|
1669
|
-
const align =
|
|
1670
|
-
const defaults = parseProperties(first(
|
|
1671
|
-
const lineSpacing = parseSpacing(first(
|
|
1672
|
-
const spaceBefore = parseSpacing(first(
|
|
1673
|
-
const spaceAfter = parseSpacing(first(
|
|
1741
|
+
const properties2 = first(paragraph2, "pPr", NS.a);
|
|
1742
|
+
const align = properties2?.getAttribute("algn");
|
|
1743
|
+
const defaults = parseProperties(first(properties2, "defRPr", NS.a));
|
|
1744
|
+
const lineSpacing = parseSpacing(first(properties2, "lnSpc", NS.a));
|
|
1745
|
+
const spaceBefore = parseSpacing(first(properties2, "spcBef", NS.a));
|
|
1746
|
+
const spaceAfter = parseSpacing(first(properties2, "spcAft", NS.a));
|
|
1674
1747
|
return {
|
|
1675
1748
|
...align ? { align } : {},
|
|
1676
1749
|
...Object.keys(defaults).length ? { defaultProperties: defaults } : {},
|
|
@@ -1682,22 +1755,22 @@ function parseParagraph(paragraph) {
|
|
|
1682
1755
|
}
|
|
1683
1756
|
function parseDrawingTextBody(body) {
|
|
1684
1757
|
if (!body) return void 0;
|
|
1685
|
-
const
|
|
1758
|
+
const properties2 = first(body, "bodyPr", NS.a);
|
|
1686
1759
|
const paragraphs = children(body, "p", NS.a).map(parseParagraph);
|
|
1687
1760
|
const result = {
|
|
1688
1761
|
paragraphs,
|
|
1689
|
-
text: paragraphs.map((
|
|
1762
|
+
text: paragraphs.map((paragraph2) => paragraph2.runs.map((run2) => run2.text).join("")).join("\n")
|
|
1690
1763
|
};
|
|
1691
|
-
const anchor =
|
|
1764
|
+
const anchor = properties2?.getAttribute("anchor");
|
|
1692
1765
|
if (anchor) result.anchor = anchor;
|
|
1693
1766
|
const insets = {};
|
|
1694
|
-
for (const [key,
|
|
1767
|
+
for (const [key, attribute2] of [
|
|
1695
1768
|
["left", "lIns"],
|
|
1696
1769
|
["top", "tIns"],
|
|
1697
1770
|
["right", "rIns"],
|
|
1698
1771
|
["bottom", "bIns"]
|
|
1699
1772
|
]) {
|
|
1700
|
-
const value = Number.parseInt(
|
|
1773
|
+
const value = Number.parseInt(properties2?.getAttribute(attribute2) ?? "", 10);
|
|
1701
1774
|
if (Number.isFinite(value)) insets[key] = value;
|
|
1702
1775
|
}
|
|
1703
1776
|
if (Object.keys(insets).length > 0) result.insetsEmu = insets;
|
|
@@ -1708,8 +1781,8 @@ function parseDrawingTextBody(body) {
|
|
|
1708
1781
|
function readChartManualLayoutValues(value) {
|
|
1709
1782
|
const result = {};
|
|
1710
1783
|
const enumeration = (name, values) => {
|
|
1711
|
-
const
|
|
1712
|
-
return values.includes(
|
|
1784
|
+
const raw2 = value(name);
|
|
1785
|
+
return values.includes(raw2) ? raw2 : void 0;
|
|
1713
1786
|
};
|
|
1714
1787
|
const target = enumeration("layoutTarget", ["inner", "outer"]);
|
|
1715
1788
|
if (target) result.layoutTarget = target;
|
|
@@ -1728,10 +1801,10 @@ function readChartManualLayoutValues(value) {
|
|
|
1728
1801
|
["w", "width"],
|
|
1729
1802
|
["h", "height"]
|
|
1730
1803
|
]) {
|
|
1731
|
-
const
|
|
1732
|
-
if (typeof
|
|
1804
|
+
const raw2 = value(xml);
|
|
1805
|
+
if (typeof raw2 !== "string" && typeof raw2 !== "number" || typeof raw2 === "string" && !raw2.trim())
|
|
1733
1806
|
continue;
|
|
1734
|
-
const number = Number(
|
|
1807
|
+
const number = Number(raw2);
|
|
1735
1808
|
if (Number.isFinite(number)) result[key] = number;
|
|
1736
1809
|
}
|
|
1737
1810
|
return Object.keys(result).length ? result : void 0;
|
|
@@ -1753,8 +1826,8 @@ var c = (parent, name) => first(parent, name, NS.c);
|
|
|
1753
1826
|
var a = (parent, name) => first(parent, name, NS.a);
|
|
1754
1827
|
function entry2(node) {
|
|
1755
1828
|
const body = c(node, "txPr");
|
|
1756
|
-
const
|
|
1757
|
-
const defaults = a(a(
|
|
1829
|
+
const paragraph2 = a(body, "p");
|
|
1830
|
+
const defaults = a(a(paragraph2, "pPr"), "defRPr");
|
|
1758
1831
|
const rich = c(c(node, "tx"), "rich");
|
|
1759
1832
|
const richParagraph = a(rich, "p");
|
|
1760
1833
|
const textBody = parseDrawingTextBody(rich);
|
|
@@ -1903,26 +1976,26 @@ function drawingColorXml(color) {
|
|
|
1903
1976
|
}
|
|
1904
1977
|
|
|
1905
1978
|
// drawingml/write-fill.ts
|
|
1906
|
-
function setDrawingFillXml(
|
|
1907
|
-
const doc =
|
|
1979
|
+
function setDrawingFillXml(properties2, xml) {
|
|
1980
|
+
const doc = properties2.ownerDocument;
|
|
1908
1981
|
const wrapper = parseXml(`<w xmlns:a="${NS.a}">${xml}</w>`);
|
|
1909
1982
|
const fill = elements(wrapper.documentElement)[0];
|
|
1910
1983
|
const names = ["solidFill", "gradFill", "pattFill", "blipFill", "grpFill", "noFill"];
|
|
1911
1984
|
if (elements(wrapper.documentElement).length !== 1 || !fill || fill.namespaceURI !== NS.a || !names.includes(fill.localName))
|
|
1912
1985
|
throw new Error("Invalid DrawingML fill XML");
|
|
1913
|
-
const existing = elements(
|
|
1986
|
+
const existing = elements(properties2).filter(
|
|
1914
1987
|
(node) => node.namespaceURI === NS.a && names.includes(node.localName)
|
|
1915
1988
|
);
|
|
1916
1989
|
const next = doc.importNode(fill, true);
|
|
1917
|
-
if (existing[0])
|
|
1990
|
+
if (existing[0]) properties2.replaceChild(next, existing[0]);
|
|
1918
1991
|
else
|
|
1919
|
-
|
|
1992
|
+
properties2.insertBefore(
|
|
1920
1993
|
next,
|
|
1921
|
-
elements(
|
|
1994
|
+
elements(properties2).find(
|
|
1922
1995
|
(node) => node.namespaceURI === NS.a && ["ln", "effectLst", "effectDag", "scene3d", "sp3d", "extLst"].includes(node.localName)
|
|
1923
1996
|
) ?? null
|
|
1924
1997
|
);
|
|
1925
|
-
for (const extra of existing.slice(1))
|
|
1998
|
+
for (const extra of existing.slice(1)) properties2.removeChild(extra);
|
|
1926
1999
|
}
|
|
1927
2000
|
function drawingFillXml(fill) {
|
|
1928
2001
|
if (fill.kind === "none") return "<a:noFill/>";
|
|
@@ -1966,20 +2039,20 @@ function drawingFillXml(fill) {
|
|
|
1966
2039
|
if (fill.scaled !== void 0) linear.setAttribute("scaled", fill.scaled ? "1" : "0");
|
|
1967
2040
|
}
|
|
1968
2041
|
if (fill.path !== void 0) {
|
|
1969
|
-
let
|
|
1970
|
-
if (!
|
|
1971
|
-
|
|
1972
|
-
root.insertBefore(
|
|
2042
|
+
let path2 = first(root, "path", NS.a);
|
|
2043
|
+
if (!path2) {
|
|
2044
|
+
path2 = doc.createElementNS(NS.a, "a:path");
|
|
2045
|
+
root.insertBefore(path2, first(root, "tileRect", NS.a) ?? first(root, "extLst", NS.a) ?? null);
|
|
1973
2046
|
}
|
|
1974
|
-
|
|
2047
|
+
path2.setAttribute("path", fill.path);
|
|
1975
2048
|
if (!fill.fillToRect) {
|
|
1976
|
-
const old = first(
|
|
1977
|
-
if (old)
|
|
2049
|
+
const old = first(path2, "fillToRect", NS.a);
|
|
2050
|
+
if (old) path2.removeChild(old);
|
|
1978
2051
|
} else {
|
|
1979
|
-
let focus = first(
|
|
2052
|
+
let focus = first(path2, "fillToRect", NS.a);
|
|
1980
2053
|
if (!focus) {
|
|
1981
2054
|
focus = doc.createElementNS(NS.a, "a:fillToRect");
|
|
1982
|
-
|
|
2055
|
+
path2.appendChild(focus);
|
|
1983
2056
|
}
|
|
1984
2057
|
for (const [key, value] of Object.entries(fill.fillToRect))
|
|
1985
2058
|
focus.setAttribute(key, String(Math.round(value * 1e5)));
|
|
@@ -2004,12 +2077,12 @@ function writeChartFillFormatting(root, formatting) {
|
|
|
2004
2077
|
for (const [part, node] of Object.entries(chartFormattingNodes(root))) {
|
|
2005
2078
|
const fill = formatting.entries[part]?.fill;
|
|
2006
2079
|
if (!node || !fill) continue;
|
|
2007
|
-
let
|
|
2008
|
-
if (JSON.stringify(parseDrawingFill(
|
|
2080
|
+
let properties2 = first(node, "spPr", NS.c);
|
|
2081
|
+
if (JSON.stringify(parseDrawingFill(properties2)) === JSON.stringify(fill)) continue;
|
|
2009
2082
|
const xml = drawingFillXml(fill);
|
|
2010
2083
|
if (xml === void 0) continue;
|
|
2011
|
-
if (!
|
|
2012
|
-
|
|
2084
|
+
if (!properties2) {
|
|
2085
|
+
properties2 = root.ownerDocument.createElementNS(NS.c, "c:spPr");
|
|
2013
2086
|
const successors = [
|
|
2014
2087
|
"txPr",
|
|
2015
2088
|
"crossAx",
|
|
@@ -2028,13 +2101,13 @@ function writeChartFillFormatting(root, formatting) {
|
|
|
2028
2101
|
"extLst"
|
|
2029
2102
|
];
|
|
2030
2103
|
node.insertBefore(
|
|
2031
|
-
|
|
2104
|
+
properties2,
|
|
2032
2105
|
elements(node).find(
|
|
2033
2106
|
(child2) => child2.namespaceURI === NS.c && successors.includes(child2.localName)
|
|
2034
2107
|
) ?? null
|
|
2035
2108
|
);
|
|
2036
2109
|
}
|
|
2037
|
-
setDrawingFillXml(
|
|
2110
|
+
setDrawingFillXml(properties2, xml);
|
|
2038
2111
|
changed = true;
|
|
2039
2112
|
}
|
|
2040
2113
|
return changed;
|
|
@@ -2051,6 +2124,27 @@ function removeGradientStop(stops, index) {
|
|
|
2051
2124
|
return stops.length <= 2 ? void 0 : stops.filter((_, i) => i !== index);
|
|
2052
2125
|
}
|
|
2053
2126
|
|
|
2127
|
+
// chart/gradient-coincident-stops.ts
|
|
2128
|
+
var NATIVE_COINCIDENT_STOP_RAMP = 1 / 256;
|
|
2129
|
+
function spreadCoincidentStops(stops) {
|
|
2130
|
+
const out = [];
|
|
2131
|
+
for (const [index, stop] of stops.entries()) {
|
|
2132
|
+
const source = stops[index - 1];
|
|
2133
|
+
const previous = out.at(-1);
|
|
2134
|
+
const next = stops[index + 1];
|
|
2135
|
+
if (!source || !previous || stop.offset !== source.offset || stop.color === source.color && (stop.opacity ?? 1) === (source.opacity ?? 1)) {
|
|
2136
|
+
out.push(stop);
|
|
2137
|
+
continue;
|
|
2138
|
+
}
|
|
2139
|
+
const limit = Math.min(1, next ? next.offset : 1);
|
|
2140
|
+
out.push({
|
|
2141
|
+
...stop,
|
|
2142
|
+
offset: Math.max(stop.offset, Math.min(previous.offset + NATIVE_COINCIDENT_STOP_RAMP, limit))
|
|
2143
|
+
});
|
|
2144
|
+
}
|
|
2145
|
+
return out;
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2054
2148
|
// drawingml/gradient-geometry.ts
|
|
2055
2149
|
var RECT_GRADIENT_DIRECTIONS = [
|
|
2056
2150
|
{ id: "center", label: "From Center", x: 0.5, y: 0.5 },
|
|
@@ -2238,7 +2332,7 @@ function buildChartGradientDef(id, fill, bounds) {
|
|
|
2238
2332
|
y1: round(0.5 - dy),
|
|
2239
2333
|
x2: round(0.5 + dx),
|
|
2240
2334
|
y2: round(0.5 + dy),
|
|
2241
|
-
stops
|
|
2335
|
+
stops: spreadCoincidentStops(stops)
|
|
2242
2336
|
};
|
|
2243
2337
|
}
|
|
2244
2338
|
|
|
@@ -2311,6 +2405,2817 @@ function writeChartLayoutFormatting(root, formatting) {
|
|
|
2311
2405
|
return changed;
|
|
2312
2406
|
}
|
|
2313
2407
|
|
|
2408
|
+
// chart/data-cache.ts
|
|
2409
|
+
function chartCacheValues(cache) {
|
|
2410
|
+
if (!cache) return [];
|
|
2411
|
+
const numeric = cache.type === "number";
|
|
2412
|
+
const out = [];
|
|
2413
|
+
for (const point of cache.points) {
|
|
2414
|
+
const text2 = point.value;
|
|
2415
|
+
out[point.index ?? out.length] = numeric && text2.trim() !== "" && Number.isFinite(Number(text2)) ? Number(text2) : text2;
|
|
2416
|
+
}
|
|
2417
|
+
const size = Math.max(cache.pointCount ?? 0, out.length);
|
|
2418
|
+
for (let index = 0; index < size; index++) if (out[index] === void 0) out[index] = "";
|
|
2419
|
+
return out;
|
|
2420
|
+
}
|
|
2421
|
+
var chartSourceValues = (source) => chartCacheValues(source?.cache ?? source?.levels?.[0]);
|
|
2422
|
+
|
|
2423
|
+
// chart/xml-fragment.ts
|
|
2424
|
+
var CHART_ROOT_BINDINGS = /* @__PURE__ */ new Map([
|
|
2425
|
+
["c", NS.c],
|
|
2426
|
+
["a", NS.a],
|
|
2427
|
+
["r", NS.r]
|
|
2428
|
+
]);
|
|
2429
|
+
var DECLARATION = / xmlns:([A-Za-z_][\w.-]*)="([^"]*)"/g;
|
|
2430
|
+
function stripDeclarations(xml, bindings) {
|
|
2431
|
+
const conflicting = /* @__PURE__ */ new Set();
|
|
2432
|
+
for (const [, prefix, uri] of xml.matchAll(DECLARATION))
|
|
2433
|
+
if (prefix !== void 0 && bindings.has(prefix) && bindings.get(prefix) !== uri)
|
|
2434
|
+
conflicting.add(prefix);
|
|
2435
|
+
return xml.replace(
|
|
2436
|
+
DECLARATION,
|
|
2437
|
+
(match, prefix, uri) => bindings.get(prefix) === uri && !conflicting.has(prefix) ? "" : match
|
|
2438
|
+
);
|
|
2439
|
+
}
|
|
2440
|
+
var innerXml = (element) => stripDeclarations(elements(element).map(buildXml).join(""), CHART_ROOT_BINDINGS);
|
|
2441
|
+
|
|
2442
|
+
// chart/parse-util.ts
|
|
2443
|
+
var cChild = (parent, local) => first(parent, local, NS.c);
|
|
2444
|
+
var attribute = (element, name) => element?.hasAttribute(name) ? element.getAttribute(name) ?? void 0 : void 0;
|
|
2445
|
+
var cVal = (parent, local) => attribute(cChild(parent, local), "val");
|
|
2446
|
+
var path = (element) => `c:${element.parentNode?.localName ?? ""}/c:${element.localName}`;
|
|
2447
|
+
function malformed(context, element, value) {
|
|
2448
|
+
context.issues.push({
|
|
2449
|
+
code: "CHART_VALUE_INVALID",
|
|
2450
|
+
message: `${path(element)} has an unreadable value "${value}".`
|
|
2451
|
+
});
|
|
2452
|
+
}
|
|
2453
|
+
function cBool(context, parent, local) {
|
|
2454
|
+
const element = cChild(parent, local);
|
|
2455
|
+
if (!element) return void 0;
|
|
2456
|
+
const raw2 = attribute(element, "val");
|
|
2457
|
+
if (raw2 === void 0) return true;
|
|
2458
|
+
const value = raw2.trim().toLowerCase();
|
|
2459
|
+
if (value === "1" || value === "true") return true;
|
|
2460
|
+
if (value === "0" || value === "false") return false;
|
|
2461
|
+
malformed(context, element, raw2);
|
|
2462
|
+
return void 0;
|
|
2463
|
+
}
|
|
2464
|
+
function cNumber(context, parent, local) {
|
|
2465
|
+
const element = cChild(parent, local);
|
|
2466
|
+
const raw2 = attribute(element, "val");
|
|
2467
|
+
if (!element || raw2 === void 0) return void 0;
|
|
2468
|
+
const value = raw2.trim() ? Number(raw2) : Number.NaN;
|
|
2469
|
+
if (Number.isFinite(value)) return value;
|
|
2470
|
+
malformed(context, element, raw2);
|
|
2471
|
+
return void 0;
|
|
2472
|
+
}
|
|
2473
|
+
function reportUnmodelled(context, element, handled) {
|
|
2474
|
+
for (const child2 of elements(element)) {
|
|
2475
|
+
if (handled.has(child2.localName)) continue;
|
|
2476
|
+
context.issues.push({
|
|
2477
|
+
code: "CHART_ELEMENT_NOT_MODELLED",
|
|
2478
|
+
message: `${path(child2)} is not modelled; it is kept only in the source part.`
|
|
2479
|
+
});
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2482
|
+
function extensionList(parent) {
|
|
2483
|
+
const extLst = cChild(parent, "extLst");
|
|
2484
|
+
return extLst ? buildXml(extLst) : void 0;
|
|
2485
|
+
}
|
|
2486
|
+
function readShapeFields(spPr) {
|
|
2487
|
+
const out = {};
|
|
2488
|
+
const fill = parseDrawingFill(spPr);
|
|
2489
|
+
if (fill) out.fill = fill;
|
|
2490
|
+
const line2 = parseDrawingLine(first(spPr, "ln", NS.a));
|
|
2491
|
+
if (line2) out.line = line2;
|
|
2492
|
+
const effects = first(spPr, "effectLst", NS.a);
|
|
2493
|
+
if (effects) out.effectsXml = buildXml(effects);
|
|
2494
|
+
return out;
|
|
2495
|
+
}
|
|
2496
|
+
function shapeProperties(parent) {
|
|
2497
|
+
const spPr = cChild(parent, "spPr");
|
|
2498
|
+
if (!spPr) return void 0;
|
|
2499
|
+
const out = readShapeFields(spPr);
|
|
2500
|
+
const source = innerXml(spPr);
|
|
2501
|
+
if (source) out.sourceXml = source;
|
|
2502
|
+
return out;
|
|
2503
|
+
}
|
|
2504
|
+
function chartTextBody(element) {
|
|
2505
|
+
const body = parseDrawingTextBody(element);
|
|
2506
|
+
if (!body || !element) return body;
|
|
2507
|
+
const source = innerXml(element);
|
|
2508
|
+
if (source) body.sourceXml = source;
|
|
2509
|
+
return body;
|
|
2510
|
+
}
|
|
2511
|
+
var textProperties = (parent) => chartTextBody(cChild(parent, "txPr"));
|
|
2512
|
+
function chartLines(parent, local) {
|
|
2513
|
+
const element = cChild(parent, local);
|
|
2514
|
+
if (!element) return void 0;
|
|
2515
|
+
const spPr = shapeProperties(element);
|
|
2516
|
+
return spPr ? { spPr } : {};
|
|
2517
|
+
}
|
|
2518
|
+
function numberFormat(parent) {
|
|
2519
|
+
const element = cChild(parent, "numFmt");
|
|
2520
|
+
const formatCode = attribute(element, "formatCode");
|
|
2521
|
+
if (formatCode === void 0) return void 0;
|
|
2522
|
+
const linked = attribute(element, "sourceLinked");
|
|
2523
|
+
return {
|
|
2524
|
+
formatCode,
|
|
2525
|
+
...linked === "1" || linked === "true" ? { sourceLinked: true } : {},
|
|
2526
|
+
...linked === "0" || linked === "false" ? { sourceLinked: false } : {}
|
|
2527
|
+
};
|
|
2528
|
+
}
|
|
2529
|
+
function readLayoutFields(layout) {
|
|
2530
|
+
const manual = cChild(layout, "manualLayout");
|
|
2531
|
+
return (manual && readChartManualLayoutValues((name) => cVal(manual, name))) ?? {};
|
|
2532
|
+
}
|
|
2533
|
+
function manualLayout(parent) {
|
|
2534
|
+
const layout = cChild(parent, "layout");
|
|
2535
|
+
if (!layout) return void 0;
|
|
2536
|
+
const out = readLayoutFields(layout);
|
|
2537
|
+
const source = innerXml(layout);
|
|
2538
|
+
if (source) out.sourceXml = source;
|
|
2539
|
+
return out;
|
|
2540
|
+
}
|
|
2541
|
+
function assignDefined(target, values) {
|
|
2542
|
+
for (const [key, value] of Object.entries(values))
|
|
2543
|
+
if (value !== void 0) target[key] = value;
|
|
2544
|
+
return target;
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2547
|
+
// chart/parse-text.ts
|
|
2548
|
+
function parseCache(node) {
|
|
2549
|
+
const cache = {
|
|
2550
|
+
type: node.localName === "numCache" || node.localName === "numLit" ? "number" : "string",
|
|
2551
|
+
points: children(node, "pt", NS.c).map((pt) => {
|
|
2552
|
+
const point = { value: cChild(pt, "v")?.textContent ?? "" };
|
|
2553
|
+
const index = Number(attribute(pt, "idx") ?? Number.NaN);
|
|
2554
|
+
if (Number.isInteger(index) && index >= 0) point.index = index;
|
|
2555
|
+
const formatCode2 = attribute(pt, "formatCode");
|
|
2556
|
+
if (formatCode2 !== void 0) point.formatCode = formatCode2;
|
|
2557
|
+
return point;
|
|
2558
|
+
})
|
|
2559
|
+
};
|
|
2560
|
+
const count = Number(cVal(node, "ptCount") ?? Number.NaN);
|
|
2561
|
+
if (Number.isInteger(count) && count >= 0) cache.pointCount = count;
|
|
2562
|
+
const formatCode = cChild(node, "formatCode")?.textContent;
|
|
2563
|
+
if (formatCode) cache.formatCode = formatCode;
|
|
2564
|
+
return cache;
|
|
2565
|
+
}
|
|
2566
|
+
function parseDataSource(element) {
|
|
2567
|
+
if (!element) return void 0;
|
|
2568
|
+
const source = {};
|
|
2569
|
+
const ref = cChild(element, "numRef") ?? cChild(element, "strRef") ?? cChild(element, "multiLvlStrRef");
|
|
2570
|
+
if (ref) {
|
|
2571
|
+
source.kind = ref.localName;
|
|
2572
|
+
const formula = cChild(ref, "f")?.textContent;
|
|
2573
|
+
if (formula) source.formula = formula;
|
|
2574
|
+
const cache = cChild(ref, "numCache") ?? cChild(ref, "strCache");
|
|
2575
|
+
if (cache) source.cache = parseCache(cache);
|
|
2576
|
+
const levels = cChild(ref, "multiLvlStrCache");
|
|
2577
|
+
if (levels) {
|
|
2578
|
+
source.levels = children(levels, "lvl", NS.c).map(parseCache);
|
|
2579
|
+
const count = Number(cVal(levels, "ptCount") ?? Number.NaN);
|
|
2580
|
+
if (Number.isInteger(count) && count >= 0) source.levelPointCount = count;
|
|
2581
|
+
}
|
|
2582
|
+
return source;
|
|
2583
|
+
}
|
|
2584
|
+
const literal = cChild(element, "numLit") ?? cChild(element, "strLit");
|
|
2585
|
+
if (literal) {
|
|
2586
|
+
source.kind = literal.localName;
|
|
2587
|
+
source.cache = parseCache(literal);
|
|
2588
|
+
}
|
|
2589
|
+
return source;
|
|
2590
|
+
}
|
|
2591
|
+
function parseChartText(context, tx, allowValue) {
|
|
2592
|
+
if (!tx) return void 0;
|
|
2593
|
+
const text2 = {};
|
|
2594
|
+
const rich = chartTextBody(cChild(tx, "rich"));
|
|
2595
|
+
if (rich) text2.rich = rich;
|
|
2596
|
+
if (cChild(tx, "strRef")) {
|
|
2597
|
+
const reference2 = parseDataSource(tx);
|
|
2598
|
+
if (reference2) text2.reference = reference2;
|
|
2599
|
+
}
|
|
2600
|
+
const value = allowValue ? cChild(tx, "v")?.textContent : void 0;
|
|
2601
|
+
if (value !== void 0 && value !== null) text2.value = value;
|
|
2602
|
+
const cached = chartCacheValues(text2.reference?.cache)[0];
|
|
2603
|
+
const flat = text2.value ?? (rich ? rich.text : cached === void 0 ? void 0 : String(cached));
|
|
2604
|
+
if (flat !== void 0) text2.text = flat;
|
|
2605
|
+
reportUnmodelled(context, tx, new Set(allowValue ? ["strRef", "v"] : ["rich", "strRef"]));
|
|
2606
|
+
return text2;
|
|
2607
|
+
}
|
|
2608
|
+
var TITLE = /* @__PURE__ */ new Set(["tx", "layout", "overlay", "spPr", "txPr", "extLst"]);
|
|
2609
|
+
function parseTitle(context, element) {
|
|
2610
|
+
const tx = parseChartText(context, cChild(element, "tx"), false);
|
|
2611
|
+
reportUnmodelled(context, element, TITLE);
|
|
2612
|
+
return assignDefined(
|
|
2613
|
+
{},
|
|
2614
|
+
{
|
|
2615
|
+
tx,
|
|
2616
|
+
text: tx?.text,
|
|
2617
|
+
overlay: cBool(context, element, "overlay"),
|
|
2618
|
+
layout: manualLayout(element),
|
|
2619
|
+
spPr: shapeProperties(element),
|
|
2620
|
+
txPr: textProperties(element),
|
|
2621
|
+
extLst: extensionList(element)
|
|
2622
|
+
}
|
|
2623
|
+
);
|
|
2624
|
+
}
|
|
2625
|
+
var LABEL_OPTIONS = [
|
|
2626
|
+
"delete",
|
|
2627
|
+
"showLegendKey",
|
|
2628
|
+
"showVal",
|
|
2629
|
+
"showCatName",
|
|
2630
|
+
"showSerName",
|
|
2631
|
+
"showPercent",
|
|
2632
|
+
"showBubbleSize",
|
|
2633
|
+
"separator",
|
|
2634
|
+
"dLblPos",
|
|
2635
|
+
"numFmt",
|
|
2636
|
+
"spPr",
|
|
2637
|
+
"txPr",
|
|
2638
|
+
"extLst"
|
|
2639
|
+
];
|
|
2640
|
+
function labelOptions(context, element) {
|
|
2641
|
+
const flag = (local) => cBool(context, element, local);
|
|
2642
|
+
return assignDefined(
|
|
2643
|
+
{},
|
|
2644
|
+
{
|
|
2645
|
+
deleted: flag("delete"),
|
|
2646
|
+
showLegendKey: flag("showLegendKey"),
|
|
2647
|
+
showValue: flag("showVal"),
|
|
2648
|
+
showCategoryName: flag("showCatName"),
|
|
2649
|
+
showSeriesName: flag("showSerName"),
|
|
2650
|
+
showPercent: flag("showPercent"),
|
|
2651
|
+
showBubbleSize: flag("showBubbleSize"),
|
|
2652
|
+
separator: cChild(element, "separator")?.textContent ?? void 0,
|
|
2653
|
+
position: cVal(element, "dLblPos"),
|
|
2654
|
+
numberFormat: numberFormat(element),
|
|
2655
|
+
spPr: shapeProperties(element),
|
|
2656
|
+
txPr: textProperties(element),
|
|
2657
|
+
extLst: extensionList(element)
|
|
2658
|
+
}
|
|
2659
|
+
);
|
|
2660
|
+
}
|
|
2661
|
+
var LABEL = /* @__PURE__ */ new Set([...LABEL_OPTIONS, "idx", "layout", "tx"]);
|
|
2662
|
+
var LABELS = /* @__PURE__ */ new Set([...LABEL_OPTIONS, "dLbl", "showLeaderLines", "leaderLines"]);
|
|
2663
|
+
function parseDataLabels(context, element) {
|
|
2664
|
+
if (!element) return void 0;
|
|
2665
|
+
const labels = children(element, "dLbl", NS.c).map((node) => {
|
|
2666
|
+
reportUnmodelled(context, node, LABEL);
|
|
2667
|
+
return assignDefined(labelOptions(context, node), {
|
|
2668
|
+
index: cNumber(context, node, "idx"),
|
|
2669
|
+
tx: parseChartText(context, cChild(node, "tx"), false),
|
|
2670
|
+
layout: manualLayout(node)
|
|
2671
|
+
});
|
|
2672
|
+
});
|
|
2673
|
+
reportUnmodelled(context, element, LABELS);
|
|
2674
|
+
return assignDefined(
|
|
2675
|
+
{ ...labelOptions(context, element), labels },
|
|
2676
|
+
{
|
|
2677
|
+
showLeaderLines: cBool(context, element, "showLeaderLines"),
|
|
2678
|
+
leaderLines: chartLines(element, "leaderLines")
|
|
2679
|
+
}
|
|
2680
|
+
);
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2683
|
+
// chart/parse-chrome.ts
|
|
2684
|
+
var SURFACE = /* @__PURE__ */ new Set(["thickness", "spPr", "pictureOptions", "extLst"]);
|
|
2685
|
+
function parseSurface(context, element) {
|
|
2686
|
+
if (!element) return void 0;
|
|
2687
|
+
reportUnmodelled(context, element, SURFACE);
|
|
2688
|
+
const pictureOptions = cChild(element, "pictureOptions");
|
|
2689
|
+
return assignDefined(
|
|
2690
|
+
{},
|
|
2691
|
+
{
|
|
2692
|
+
thickness: cNumber(context, element, "thickness"),
|
|
2693
|
+
spPr: shapeProperties(element),
|
|
2694
|
+
pictureOptionsXml: pictureOptions ? buildXml(pictureOptions) : void 0,
|
|
2695
|
+
extLst: extensionList(element)
|
|
2696
|
+
}
|
|
2697
|
+
);
|
|
2698
|
+
}
|
|
2699
|
+
var DATA_TABLE = /* @__PURE__ */ new Set([
|
|
2700
|
+
"showHorzBorder",
|
|
2701
|
+
"showVertBorder",
|
|
2702
|
+
"showOutline",
|
|
2703
|
+
"showKeys",
|
|
2704
|
+
"spPr",
|
|
2705
|
+
"txPr",
|
|
2706
|
+
"extLst"
|
|
2707
|
+
]);
|
|
2708
|
+
function parseDataTable(context, element) {
|
|
2709
|
+
if (!element) return void 0;
|
|
2710
|
+
reportUnmodelled(context, element, DATA_TABLE);
|
|
2711
|
+
return assignDefined(
|
|
2712
|
+
{},
|
|
2713
|
+
{
|
|
2714
|
+
showHorizontalBorder: cBool(context, element, "showHorzBorder"),
|
|
2715
|
+
showVerticalBorder: cBool(context, element, "showVertBorder"),
|
|
2716
|
+
showOutline: cBool(context, element, "showOutline"),
|
|
2717
|
+
showKeys: cBool(context, element, "showKeys"),
|
|
2718
|
+
spPr: shapeProperties(element),
|
|
2719
|
+
txPr: textProperties(element),
|
|
2720
|
+
extLst: extensionList(element)
|
|
2721
|
+
}
|
|
2722
|
+
);
|
|
2723
|
+
}
|
|
2724
|
+
var DISPLAY_UNITS = /* @__PURE__ */ new Set(["custUnit", "builtInUnit", "dispUnitsLbl", "extLst"]);
|
|
2725
|
+
var DISPLAY_UNITS_LABEL = /* @__PURE__ */ new Set(["layout", "tx", "spPr", "txPr"]);
|
|
2726
|
+
function parseDisplayUnits(context, element) {
|
|
2727
|
+
if (!element) return void 0;
|
|
2728
|
+
reportUnmodelled(context, element, DISPLAY_UNITS);
|
|
2729
|
+
const labelElement = cChild(element, "dispUnitsLbl");
|
|
2730
|
+
let label;
|
|
2731
|
+
if (labelElement) {
|
|
2732
|
+
reportUnmodelled(context, labelElement, DISPLAY_UNITS_LABEL);
|
|
2733
|
+
label = assignDefined(
|
|
2734
|
+
{},
|
|
2735
|
+
{
|
|
2736
|
+
layout: manualLayout(labelElement),
|
|
2737
|
+
tx: parseChartText(context, cChild(labelElement, "tx"), false),
|
|
2738
|
+
spPr: shapeProperties(labelElement),
|
|
2739
|
+
txPr: textProperties(labelElement)
|
|
2740
|
+
}
|
|
2741
|
+
);
|
|
2742
|
+
}
|
|
2743
|
+
return assignDefined(
|
|
2744
|
+
{},
|
|
2745
|
+
{
|
|
2746
|
+
builtInUnit: cVal(element, "builtInUnit"),
|
|
2747
|
+
customUnit: cNumber(context, element, "custUnit"),
|
|
2748
|
+
label,
|
|
2749
|
+
extLst: extensionList(element)
|
|
2750
|
+
}
|
|
2751
|
+
);
|
|
2752
|
+
}
|
|
2753
|
+
var DATA_DISPLAY_OPTIONS_URI = "{56B9EC1D-385E-4148-901F-78D8002777C0}";
|
|
2754
|
+
var C16R3 = "http://schemas.microsoft.com/office/drawing/2017/03/chart";
|
|
2755
|
+
function readDisplayNaAsBlank(chartExtLst) {
|
|
2756
|
+
if (!chartExtLst?.includes(DATA_DISPLAY_OPTIONS_URI)) return void 0;
|
|
2757
|
+
let root;
|
|
2758
|
+
try {
|
|
2759
|
+
root = parseXml(chartExtLst, { label: "Chart extension list" }).documentElement;
|
|
2760
|
+
} catch {
|
|
2761
|
+
return void 0;
|
|
2762
|
+
}
|
|
2763
|
+
for (const ext of elements(root)) {
|
|
2764
|
+
if (ext.localName !== "ext" || attribute(ext, "uri") !== DATA_DISPLAY_OPTIONS_URI) continue;
|
|
2765
|
+
const flag = first(first(ext, "dataDisplayOptions16", C16R3), "dispNaAsBlank", C16R3);
|
|
2766
|
+
if (!flag) continue;
|
|
2767
|
+
const raw2 = attribute(flag, "val")?.trim().toLowerCase();
|
|
2768
|
+
return raw2 === void 0 || raw2 === "1" || raw2 === "true";
|
|
2769
|
+
}
|
|
2770
|
+
return void 0;
|
|
2771
|
+
}
|
|
2772
|
+
|
|
2773
|
+
// chart/parse-series.ts
|
|
2774
|
+
var MARKER = /* @__PURE__ */ new Set(["symbol", "size", "spPr", "extLst"]);
|
|
2775
|
+
function parseMarker(context, element) {
|
|
2776
|
+
if (!element) return void 0;
|
|
2777
|
+
reportUnmodelled(context, element, MARKER);
|
|
2778
|
+
return assignDefined(
|
|
2779
|
+
{},
|
|
2780
|
+
{
|
|
2781
|
+
symbol: cVal(element, "symbol"),
|
|
2782
|
+
size: cNumber(context, element, "size"),
|
|
2783
|
+
spPr: shapeProperties(element),
|
|
2784
|
+
extLst: extensionList(element)
|
|
2785
|
+
}
|
|
2786
|
+
);
|
|
2787
|
+
}
|
|
2788
|
+
var POINT = /* @__PURE__ */ new Set([
|
|
2789
|
+
"idx",
|
|
2790
|
+
"invertIfNegative",
|
|
2791
|
+
"marker",
|
|
2792
|
+
"bubble3D",
|
|
2793
|
+
"explosion",
|
|
2794
|
+
"spPr",
|
|
2795
|
+
"extLst"
|
|
2796
|
+
]);
|
|
2797
|
+
function parseDataPoint(context, element) {
|
|
2798
|
+
reportUnmodelled(context, element, POINT);
|
|
2799
|
+
const index = cNumber(context, element, "idx");
|
|
2800
|
+
return assignDefined(
|
|
2801
|
+
{},
|
|
2802
|
+
{
|
|
2803
|
+
index: index !== void 0 && Number.isInteger(index) && index >= 0 ? index : void 0,
|
|
2804
|
+
invertIfNegative: cBool(context, element, "invertIfNegative"),
|
|
2805
|
+
bubble3D: cBool(context, element, "bubble3D"),
|
|
2806
|
+
explosion: cNumber(context, element, "explosion"),
|
|
2807
|
+
marker: parseMarker(context, cChild(element, "marker")),
|
|
2808
|
+
spPr: shapeProperties(element),
|
|
2809
|
+
extLst: extensionList(element)
|
|
2810
|
+
}
|
|
2811
|
+
);
|
|
2812
|
+
}
|
|
2813
|
+
var SERIES = /* @__PURE__ */ new Set([
|
|
2814
|
+
"idx",
|
|
2815
|
+
"order",
|
|
2816
|
+
"tx",
|
|
2817
|
+
"spPr",
|
|
2818
|
+
"invertIfNegative",
|
|
2819
|
+
"dPt",
|
|
2820
|
+
"dLbls",
|
|
2821
|
+
"cat",
|
|
2822
|
+
"val",
|
|
2823
|
+
"xVal",
|
|
2824
|
+
"yVal",
|
|
2825
|
+
"smooth",
|
|
2826
|
+
"marker",
|
|
2827
|
+
"explosion",
|
|
2828
|
+
"bubbleSize",
|
|
2829
|
+
"bubble3D",
|
|
2830
|
+
"shape",
|
|
2831
|
+
"extLst"
|
|
2832
|
+
]);
|
|
2833
|
+
function parseSeries(context, element) {
|
|
2834
|
+
reportUnmodelled(context, element, SERIES);
|
|
2835
|
+
return assignDefined(
|
|
2836
|
+
{ dataPoints: children(element, "dPt", NS.c).map((point) => parseDataPoint(context, point)) },
|
|
2837
|
+
{
|
|
2838
|
+
index: cNumber(context, element, "idx"),
|
|
2839
|
+
order: cNumber(context, element, "order"),
|
|
2840
|
+
tx: parseChartText(context, cChild(element, "tx"), true),
|
|
2841
|
+
spPr: shapeProperties(element),
|
|
2842
|
+
marker: parseMarker(context, cChild(element, "marker")),
|
|
2843
|
+
dataLabels: parseDataLabels(context, cChild(element, "dLbls")),
|
|
2844
|
+
categories: parseDataSource(cChild(element, "cat")),
|
|
2845
|
+
values: parseDataSource(cChild(element, "val")),
|
|
2846
|
+
xValues: parseDataSource(cChild(element, "xVal")),
|
|
2847
|
+
yValues: parseDataSource(cChild(element, "yVal")),
|
|
2848
|
+
bubbleSizes: parseDataSource(cChild(element, "bubbleSize")),
|
|
2849
|
+
smooth: cBool(context, element, "smooth"),
|
|
2850
|
+
invertIfNegative: cBool(context, element, "invertIfNegative"),
|
|
2851
|
+
explosion: cNumber(context, element, "explosion"),
|
|
2852
|
+
bubble3D: cBool(context, element, "bubble3D"),
|
|
2853
|
+
shape: cVal(element, "shape"),
|
|
2854
|
+
extLst: extensionList(element)
|
|
2855
|
+
}
|
|
2856
|
+
);
|
|
2857
|
+
}
|
|
2858
|
+
|
|
2859
|
+
// chart/parse-plot.ts
|
|
2860
|
+
var CHART_GROUP_ELEMENTS = {
|
|
2861
|
+
barChart: { kind: "bar", is3D: false },
|
|
2862
|
+
bar3DChart: { kind: "bar", is3D: true },
|
|
2863
|
+
lineChart: { kind: "line", is3D: false },
|
|
2864
|
+
line3DChart: { kind: "line", is3D: true },
|
|
2865
|
+
areaChart: { kind: "area", is3D: false },
|
|
2866
|
+
area3DChart: { kind: "area", is3D: true },
|
|
2867
|
+
pieChart: { kind: "pie", is3D: false },
|
|
2868
|
+
pie3DChart: { kind: "pie", is3D: true },
|
|
2869
|
+
ofPieChart: { kind: "ofPie", is3D: false },
|
|
2870
|
+
doughnutChart: { kind: "doughnut", is3D: false },
|
|
2871
|
+
scatterChart: { kind: "scatter", is3D: false },
|
|
2872
|
+
radarChart: { kind: "radar", is3D: false },
|
|
2873
|
+
bubbleChart: { kind: "bubble", is3D: false },
|
|
2874
|
+
stockChart: { kind: "stock", is3D: false },
|
|
2875
|
+
surfaceChart: { kind: "surface", is3D: false },
|
|
2876
|
+
surface3DChart: { kind: "surface", is3D: true }
|
|
2877
|
+
};
|
|
2878
|
+
var AXIS_ELEMENTS = {
|
|
2879
|
+
catAx: "cat",
|
|
2880
|
+
valAx: "val",
|
|
2881
|
+
dateAx: "date",
|
|
2882
|
+
serAx: "ser"
|
|
2883
|
+
};
|
|
2884
|
+
var GROUP = /* @__PURE__ */ new Set([
|
|
2885
|
+
"ser",
|
|
2886
|
+
"axId",
|
|
2887
|
+
"varyColors",
|
|
2888
|
+
"dLbls",
|
|
2889
|
+
"barDir",
|
|
2890
|
+
"grouping",
|
|
2891
|
+
"gapWidth",
|
|
2892
|
+
"overlap",
|
|
2893
|
+
"gapDepth",
|
|
2894
|
+
"shape",
|
|
2895
|
+
"marker",
|
|
2896
|
+
"smooth",
|
|
2897
|
+
"dropLines",
|
|
2898
|
+
"hiLowLines",
|
|
2899
|
+
"upDownBars",
|
|
2900
|
+
"serLines",
|
|
2901
|
+
"firstSliceAng",
|
|
2902
|
+
"holeSize",
|
|
2903
|
+
"ofPieType",
|
|
2904
|
+
"scatterStyle",
|
|
2905
|
+
"radarStyle",
|
|
2906
|
+
"bubble3D",
|
|
2907
|
+
"bubbleScale",
|
|
2908
|
+
"showNegBubbles",
|
|
2909
|
+
"sizeRepresents",
|
|
2910
|
+
"wireframe",
|
|
2911
|
+
"extLst"
|
|
2912
|
+
]);
|
|
2913
|
+
function parseGroup(context, element) {
|
|
2914
|
+
const { kind, is3D } = CHART_GROUP_ELEMENTS[element.localName] ?? { kind: "bar", is3D: false };
|
|
2915
|
+
reportUnmodelled(context, element, GROUP);
|
|
2916
|
+
const number = (local) => cNumber(context, element, local);
|
|
2917
|
+
const flag = (local) => cBool(context, element, local);
|
|
2918
|
+
const barDir = cVal(element, "barDir");
|
|
2919
|
+
const present = (local) => cChild(element, local) ? true : void 0;
|
|
2920
|
+
const linesShape = (local) => chartLines(element, local)?.spPr;
|
|
2921
|
+
const bars2 = cChild(element, "upDownBars");
|
|
2922
|
+
return assignDefined(
|
|
2923
|
+
{
|
|
2924
|
+
kind,
|
|
2925
|
+
element: element.localName,
|
|
2926
|
+
is3D,
|
|
2927
|
+
series: children(element, "ser", NS.c).map((ser) => parseSeries(context, ser)),
|
|
2928
|
+
axisIds: children(element, "axId", NS.c).flatMap((axis) => {
|
|
2929
|
+
const raw2 = attribute(axis, "val")?.trim();
|
|
2930
|
+
const id = raw2 ? Number(raw2) : Number.NaN;
|
|
2931
|
+
return Number.isFinite(id) ? [id] : [];
|
|
2932
|
+
})
|
|
2933
|
+
},
|
|
2934
|
+
{
|
|
2935
|
+
varyColors: flag("varyColors"),
|
|
2936
|
+
dataLabels: parseDataLabels(context, cChild(element, "dLbls")),
|
|
2937
|
+
barDirection: barDir === "bar" || barDir === "col" ? barDir : void 0,
|
|
2938
|
+
grouping: cVal(element, "grouping"),
|
|
2939
|
+
gapWidth: number("gapWidth"),
|
|
2940
|
+
overlap: number("overlap"),
|
|
2941
|
+
gapDepth: number("gapDepth"),
|
|
2942
|
+
shape: cVal(element, "shape"),
|
|
2943
|
+
marker: flag("marker"),
|
|
2944
|
+
smooth: flag("smooth"),
|
|
2945
|
+
dropLines: present("dropLines"),
|
|
2946
|
+
hiLowLines: present("hiLowLines"),
|
|
2947
|
+
upDownBars: present("upDownBars"),
|
|
2948
|
+
seriesLines: present("serLines"),
|
|
2949
|
+
dropLinesSpPr: linesShape("dropLines"),
|
|
2950
|
+
hiLowLinesSpPr: linesShape("hiLowLines"),
|
|
2951
|
+
seriesLinesSpPr: linesShape("serLines"),
|
|
2952
|
+
upDownBarsGapWidth: cNumber(context, bars2, "gapWidth"),
|
|
2953
|
+
upBars: chartLines(bars2, "upBars"),
|
|
2954
|
+
downBars: chartLines(bars2, "downBars"),
|
|
2955
|
+
firstSliceAngle: number("firstSliceAng"),
|
|
2956
|
+
holeSize: number("holeSize"),
|
|
2957
|
+
ofPieType: cVal(element, "ofPieType"),
|
|
2958
|
+
scatterStyle: cVal(element, "scatterStyle"),
|
|
2959
|
+
radarStyle: cVal(element, "radarStyle"),
|
|
2960
|
+
bubble3D: flag("bubble3D"),
|
|
2961
|
+
bubbleScale: number("bubbleScale"),
|
|
2962
|
+
showNegativeBubbles: flag("showNegBubbles"),
|
|
2963
|
+
sizeRepresents: cVal(element, "sizeRepresents"),
|
|
2964
|
+
wireframe: flag("wireframe"),
|
|
2965
|
+
extLst: extensionList(element)
|
|
2966
|
+
}
|
|
2967
|
+
);
|
|
2968
|
+
}
|
|
2969
|
+
var SCALING = /* @__PURE__ */ new Set(["orientation", "logBase", "min", "max", "extLst"]);
|
|
2970
|
+
var AXIS = /* @__PURE__ */ new Set([
|
|
2971
|
+
"axId",
|
|
2972
|
+
"scaling",
|
|
2973
|
+
"delete",
|
|
2974
|
+
"axPos",
|
|
2975
|
+
"majorGridlines",
|
|
2976
|
+
"minorGridlines",
|
|
2977
|
+
"title",
|
|
2978
|
+
"numFmt",
|
|
2979
|
+
"majorTickMark",
|
|
2980
|
+
"minorTickMark",
|
|
2981
|
+
"tickLblPos",
|
|
2982
|
+
"spPr",
|
|
2983
|
+
"txPr",
|
|
2984
|
+
"crossAx",
|
|
2985
|
+
"crosses",
|
|
2986
|
+
"crossesAt",
|
|
2987
|
+
"crossBetween",
|
|
2988
|
+
"majorUnit",
|
|
2989
|
+
"minorUnit",
|
|
2990
|
+
"auto",
|
|
2991
|
+
"lblAlgn",
|
|
2992
|
+
"lblOffset",
|
|
2993
|
+
"tickLblSkip",
|
|
2994
|
+
"tickMarkSkip",
|
|
2995
|
+
"noMultiLvlLbl",
|
|
2996
|
+
"baseTimeUnit",
|
|
2997
|
+
"dispUnits",
|
|
2998
|
+
"extLst"
|
|
2999
|
+
]);
|
|
3000
|
+
function parseAxis(context, element, kind) {
|
|
3001
|
+
reportUnmodelled(context, element, AXIS);
|
|
3002
|
+
const number = (local) => cNumber(context, element, local);
|
|
3003
|
+
const scalingElement = cChild(element, "scaling");
|
|
3004
|
+
if (scalingElement) reportUnmodelled(context, scalingElement, SCALING);
|
|
3005
|
+
const scaling = assignDefined(
|
|
3006
|
+
{},
|
|
3007
|
+
{
|
|
3008
|
+
orientation: cVal(scalingElement, "orientation"),
|
|
3009
|
+
min: cNumber(context, scalingElement, "min"),
|
|
3010
|
+
max: cNumber(context, scalingElement, "max"),
|
|
3011
|
+
logBase: cNumber(context, scalingElement, "logBase")
|
|
3012
|
+
}
|
|
3013
|
+
);
|
|
3014
|
+
const title = cChild(element, "title");
|
|
3015
|
+
return assignDefined(
|
|
3016
|
+
{
|
|
3017
|
+
kind,
|
|
3018
|
+
scaling,
|
|
3019
|
+
majorGridlines: cChild(element, "majorGridlines") !== void 0,
|
|
3020
|
+
minorGridlines: cChild(element, "minorGridlines") !== void 0
|
|
3021
|
+
},
|
|
3022
|
+
{
|
|
3023
|
+
majorGridlinesSpPr: chartLines(element, "majorGridlines")?.spPr,
|
|
3024
|
+
minorGridlinesSpPr: chartLines(element, "minorGridlines")?.spPr,
|
|
3025
|
+
id: number("axId"),
|
|
3026
|
+
crossAxisId: number("crossAx"),
|
|
3027
|
+
position: cVal(element, "axPos"),
|
|
3028
|
+
deleted: cBool(context, element, "delete"),
|
|
3029
|
+
title: title ? parseTitle(context, title) : void 0,
|
|
3030
|
+
numberFormat: numberFormat(element),
|
|
3031
|
+
majorTickMark: cVal(element, "majorTickMark"),
|
|
3032
|
+
minorTickMark: cVal(element, "minorTickMark"),
|
|
3033
|
+
tickLabelPosition: cVal(element, "tickLblPos"),
|
|
3034
|
+
crosses: cVal(element, "crosses"),
|
|
3035
|
+
crossesAt: number("crossesAt"),
|
|
3036
|
+
crossBetween: cVal(element, "crossBetween"),
|
|
3037
|
+
majorUnit: number("majorUnit"),
|
|
3038
|
+
minorUnit: number("minorUnit"),
|
|
3039
|
+
auto: cBool(context, element, "auto"),
|
|
3040
|
+
labelAlign: cVal(element, "lblAlgn"),
|
|
3041
|
+
labelOffset: number("lblOffset"),
|
|
3042
|
+
tickLabelSkip: number("tickLblSkip"),
|
|
3043
|
+
tickMarkSkip: number("tickMarkSkip"),
|
|
3044
|
+
noMultiLevelLabels: cBool(context, element, "noMultiLvlLbl"),
|
|
3045
|
+
baseTimeUnit: cVal(element, "baseTimeUnit"),
|
|
3046
|
+
displayUnits: parseDisplayUnits(context, cChild(element, "dispUnits")),
|
|
3047
|
+
spPr: shapeProperties(element),
|
|
3048
|
+
txPr: textProperties(element),
|
|
3049
|
+
extLst: extensionList(element)
|
|
3050
|
+
}
|
|
3051
|
+
);
|
|
3052
|
+
}
|
|
3053
|
+
var PLOT_AREA = /* @__PURE__ */ new Set(["layout", "dTable", "spPr", "extLst"]);
|
|
3054
|
+
function parsePlotArea(context, element) {
|
|
3055
|
+
const plotArea = { groups: [], axes: [] };
|
|
3056
|
+
if (!element) {
|
|
3057
|
+
context.issues.push({
|
|
3058
|
+
code: "CHART_PLOT_AREA_MISSING",
|
|
3059
|
+
message: "The chart has no c:plotArea."
|
|
3060
|
+
});
|
|
3061
|
+
return plotArea;
|
|
3062
|
+
}
|
|
3063
|
+
const handled = new Set(PLOT_AREA);
|
|
3064
|
+
for (const child2 of elements(element)) {
|
|
3065
|
+
if (CHART_GROUP_ELEMENTS[child2.localName]) {
|
|
3066
|
+
plotArea.groups.push(parseGroup(context, child2));
|
|
3067
|
+
handled.add(child2.localName);
|
|
3068
|
+
}
|
|
3069
|
+
const axis = AXIS_ELEMENTS[child2.localName];
|
|
3070
|
+
if (axis) {
|
|
3071
|
+
plotArea.axes.push(parseAxis(context, child2, axis));
|
|
3072
|
+
handled.add(child2.localName);
|
|
3073
|
+
}
|
|
3074
|
+
}
|
|
3075
|
+
reportUnmodelled(context, element, handled);
|
|
3076
|
+
return assignDefined(plotArea, {
|
|
3077
|
+
layout: manualLayout(element),
|
|
3078
|
+
dataTable: parseDataTable(context, cChild(element, "dTable")),
|
|
3079
|
+
spPr: shapeProperties(element),
|
|
3080
|
+
extLst: extensionList(element)
|
|
3081
|
+
});
|
|
3082
|
+
}
|
|
3083
|
+
|
|
3084
|
+
// chart/parse-space.ts
|
|
3085
|
+
var LEGEND = /* @__PURE__ */ new Set(["legendPos", "legendEntry", "layout", "overlay", "spPr", "txPr", "extLst"]);
|
|
3086
|
+
function parseLegend(context, element) {
|
|
3087
|
+
reportUnmodelled(context, element, LEGEND);
|
|
3088
|
+
const entries = children(element, "legendEntry", NS.c).map(
|
|
3089
|
+
(entry3) => assignDefined(
|
|
3090
|
+
{},
|
|
3091
|
+
{
|
|
3092
|
+
index: cNumber(context, entry3, "idx"),
|
|
3093
|
+
deleted: cBool(context, entry3, "delete"),
|
|
3094
|
+
txPr: textProperties(entry3)
|
|
3095
|
+
}
|
|
3096
|
+
)
|
|
3097
|
+
);
|
|
3098
|
+
return assignDefined(
|
|
3099
|
+
{ entries },
|
|
3100
|
+
{
|
|
3101
|
+
position: cVal(element, "legendPos"),
|
|
3102
|
+
overlay: cBool(context, element, "overlay"),
|
|
3103
|
+
layout: manualLayout(element),
|
|
3104
|
+
spPr: shapeProperties(element),
|
|
3105
|
+
txPr: textProperties(element),
|
|
3106
|
+
extLst: extensionList(element)
|
|
3107
|
+
}
|
|
3108
|
+
);
|
|
3109
|
+
}
|
|
3110
|
+
var VIEW_3D = /* @__PURE__ */ new Set(["rotX", "rotY", "depthPercent", "hPercent", "rAngAx", "perspective"]);
|
|
3111
|
+
function parseView3D(context, element) {
|
|
3112
|
+
reportUnmodelled(context, element, VIEW_3D);
|
|
3113
|
+
return assignDefined(
|
|
3114
|
+
{},
|
|
3115
|
+
{
|
|
3116
|
+
rotX: cNumber(context, element, "rotX"),
|
|
3117
|
+
rotY: cNumber(context, element, "rotY"),
|
|
3118
|
+
depthPercent: cNumber(context, element, "depthPercent"),
|
|
3119
|
+
heightPercent: cNumber(context, element, "hPercent"),
|
|
3120
|
+
rightAngleAxes: cBool(context, element, "rAngAx"),
|
|
3121
|
+
perspective: cNumber(context, element, "perspective")
|
|
3122
|
+
}
|
|
3123
|
+
);
|
|
3124
|
+
}
|
|
3125
|
+
function chartStyle(context, space) {
|
|
3126
|
+
const direct = cNumber(context, space, "style");
|
|
3127
|
+
if (direct !== void 0) return direct;
|
|
3128
|
+
for (const alternate of children(space, "AlternateContent", NS.mc)) {
|
|
3129
|
+
const style = cNumber(context, first(alternate, "Fallback", NS.mc), "style");
|
|
3130
|
+
if (style !== void 0) return style;
|
|
3131
|
+
}
|
|
3132
|
+
return void 0;
|
|
3133
|
+
}
|
|
3134
|
+
function c14Style(space) {
|
|
3135
|
+
for (const alternate of children(space, "AlternateContent", NS.mc)) {
|
|
3136
|
+
const raw2 = attribute(first(first(alternate, "Choice", NS.mc), "style", NS.c14, false), "val");
|
|
3137
|
+
const value = raw2?.trim() ? Number(raw2) : Number.NaN;
|
|
3138
|
+
if (Number.isFinite(value)) return value;
|
|
3139
|
+
}
|
|
3140
|
+
return void 0;
|
|
3141
|
+
}
|
|
3142
|
+
function namespaceDeclarations(root) {
|
|
3143
|
+
const out = [];
|
|
3144
|
+
for (const item of Array.from(root.attributes)) {
|
|
3145
|
+
if (item.prefix !== "xmlns" || CHART_ROOT_BINDINGS.get(item.localName) === item.value) continue;
|
|
3146
|
+
out.push({ prefix: item.localName, uri: item.value });
|
|
3147
|
+
}
|
|
3148
|
+
return out.length ? out : void 0;
|
|
3149
|
+
}
|
|
3150
|
+
var CHART = /* @__PURE__ */ new Set([
|
|
3151
|
+
"title",
|
|
3152
|
+
"autoTitleDeleted",
|
|
3153
|
+
"view3D",
|
|
3154
|
+
"floor",
|
|
3155
|
+
"sideWall",
|
|
3156
|
+
"backWall",
|
|
3157
|
+
"plotArea",
|
|
3158
|
+
"legend",
|
|
3159
|
+
"plotVisOnly",
|
|
3160
|
+
"dispBlanksAs",
|
|
3161
|
+
"showDLblsOverMax",
|
|
3162
|
+
"extLst"
|
|
3163
|
+
]);
|
|
3164
|
+
var SPACE = /* @__PURE__ */ new Set([
|
|
3165
|
+
"date1904",
|
|
3166
|
+
"lang",
|
|
3167
|
+
"roundedCorners",
|
|
3168
|
+
"AlternateContent",
|
|
3169
|
+
"style",
|
|
3170
|
+
"chart",
|
|
3171
|
+
"spPr",
|
|
3172
|
+
"txPr",
|
|
3173
|
+
"externalData",
|
|
3174
|
+
"printSettings",
|
|
3175
|
+
"userShapes",
|
|
3176
|
+
"extLst"
|
|
3177
|
+
]);
|
|
3178
|
+
function parseChartSpace(source) {
|
|
3179
|
+
const context = { issues: [] };
|
|
3180
|
+
const root = typeof source === "string" ? parseXml(source, { label: "Chart part" }).documentElement : source;
|
|
3181
|
+
if (root.localName !== "chartSpace" || root.namespaceURI && root.namespaceURI !== NS.c) {
|
|
3182
|
+
context.issues.push({
|
|
3183
|
+
code: "CHART_ROOT_UNEXPECTED",
|
|
3184
|
+
message: `The part root is {${root.namespaceURI ?? ""}}${root.localName}, not c:chartSpace (chartex parts are not modelled).`
|
|
3185
|
+
});
|
|
3186
|
+
return { chartSpace: { plotArea: { groups: [], axes: [] } }, issues: context.issues };
|
|
3187
|
+
}
|
|
3188
|
+
reportUnmodelled(context, root, SPACE);
|
|
3189
|
+
const chart = cChild(root, "chart");
|
|
3190
|
+
if (!chart)
|
|
3191
|
+
context.issues.push({ code: "CHART_CHART_MISSING", message: "The part has no c:chart." });
|
|
3192
|
+
else reportUnmodelled(context, chart, CHART);
|
|
3193
|
+
const title = cChild(chart, "title");
|
|
3194
|
+
const legend = cChild(chart, "legend");
|
|
3195
|
+
const view3D = cChild(chart, "view3D");
|
|
3196
|
+
const printSettings = cChild(root, "printSettings");
|
|
3197
|
+
const chartSpace = assignDefined(
|
|
3198
|
+
{ plotArea: parsePlotArea(context, cChild(chart, "plotArea")) },
|
|
3199
|
+
{
|
|
3200
|
+
date1904: cBool(context, root, "date1904"),
|
|
3201
|
+
language: cVal(root, "lang"),
|
|
3202
|
+
roundedCorners: cBool(context, root, "roundedCorners"),
|
|
3203
|
+
style: chartStyle(context, root),
|
|
3204
|
+
c14Style: c14Style(root),
|
|
3205
|
+
title: title ? parseTitle(context, title) : void 0,
|
|
3206
|
+
autoTitleDeleted: cBool(context, chart, "autoTitleDeleted"),
|
|
3207
|
+
view3D: view3D ? parseView3D(context, view3D) : void 0,
|
|
3208
|
+
floor: parseSurface(context, cChild(chart, "floor")),
|
|
3209
|
+
sideWall: parseSurface(context, cChild(chart, "sideWall")),
|
|
3210
|
+
backWall: parseSurface(context, cChild(chart, "backWall")),
|
|
3211
|
+
legend: legend ? parseLegend(context, legend) : void 0,
|
|
3212
|
+
plotVisibleOnly: cBool(context, chart, "plotVisOnly"),
|
|
3213
|
+
displayBlanksAs: cVal(chart, "dispBlanksAs"),
|
|
3214
|
+
showDataLabelsOverMax: cBool(context, chart, "showDLblsOverMax"),
|
|
3215
|
+
spPr: shapeProperties(root),
|
|
3216
|
+
txPr: textProperties(root),
|
|
3217
|
+
externalDataRelId: relAttr(cChild(root, "externalData"), "id") || void 0,
|
|
3218
|
+
externalDataAutoUpdate: cBool(context, cChild(root, "externalData"), "autoUpdate"),
|
|
3219
|
+
printSettings: printSettings ? buildXml(printSettings) : void 0,
|
|
3220
|
+
userShapesRelId: relAttr(cChild(root, "userShapes"), "id") || void 0,
|
|
3221
|
+
chartExtLst: extensionList(chart),
|
|
3222
|
+
extLst: extensionList(root),
|
|
3223
|
+
namespaceDeclarations: namespaceDeclarations(root)
|
|
3224
|
+
}
|
|
3225
|
+
);
|
|
3226
|
+
return { chartSpace, issues: context.issues };
|
|
3227
|
+
}
|
|
3228
|
+
|
|
3229
|
+
// drawingml/write-line.ts
|
|
3230
|
+
var FILLS = /* @__PURE__ */ new Set(["noFill", "solidFill", "gradFill", "pattFill"]);
|
|
3231
|
+
function dropDrawingDeclarations(element) {
|
|
3232
|
+
if (element.getAttribute("xmlns:a") === NS.a) element.removeAttribute("xmlns:a");
|
|
3233
|
+
for (const child2 of elements(element)) dropDrawingDeclarations(child2);
|
|
3234
|
+
}
|
|
3235
|
+
function patchDrawingLine(ln, line2) {
|
|
3236
|
+
if (line2.widthEmu === void 0) ln.removeAttribute("w");
|
|
3237
|
+
else ln.setAttribute("w", String(Math.round(line2.widthEmu)));
|
|
3238
|
+
if (line2.cap === void 0) ln.removeAttribute("cap");
|
|
3239
|
+
else ln.setAttribute("cap", line2.cap);
|
|
3240
|
+
const fill = line2.fill && drawingFillXml(line2.fill);
|
|
3241
|
+
if (fill || !line2.fill) {
|
|
3242
|
+
for (const node of elements(ln))
|
|
3243
|
+
if (node.namespaceURI === NS.a && FILLS.has(node.localName)) ln.removeChild(node);
|
|
3244
|
+
}
|
|
3245
|
+
if (fill) {
|
|
3246
|
+
const parsed = parseXml(`<w xmlns:a="${NS.a}">${fill}</w>`).documentElement;
|
|
3247
|
+
for (const node of elements(parsed).reverse()) {
|
|
3248
|
+
const imported = ln.ownerDocument.importNode(node, true);
|
|
3249
|
+
dropDrawingDeclarations(imported);
|
|
3250
|
+
ln.insertBefore(imported, ln.firstChild);
|
|
3251
|
+
}
|
|
3252
|
+
}
|
|
3253
|
+
const dashes = elements(ln).filter(
|
|
3254
|
+
(node) => node.namespaceURI === NS.a && (node.localName === "prstDash" || node.localName === "custDash")
|
|
3255
|
+
);
|
|
3256
|
+
if (line2.dash === void 0) {
|
|
3257
|
+
for (const node of dashes) if (node.localName === "prstDash") ln.removeChild(node);
|
|
3258
|
+
return;
|
|
3259
|
+
}
|
|
3260
|
+
const dash = ln.ownerDocument.createElementNS(NS.a, "a:prstDash");
|
|
3261
|
+
dash.setAttribute("val", line2.dash);
|
|
3262
|
+
for (const node of dashes) ln.removeChild(node);
|
|
3263
|
+
const afterFill = elements(ln).find(
|
|
3264
|
+
(node) => node.namespaceURI !== NS.a || !FILLS.has(node.localName)
|
|
3265
|
+
);
|
|
3266
|
+
ln.insertBefore(dash, afterFill ?? null);
|
|
3267
|
+
}
|
|
3268
|
+
function drawingLineXml(line2) {
|
|
3269
|
+
const doc = parseXml(`<a:ln xmlns:a="${NS.a}"/>`);
|
|
3270
|
+
patchDrawingLine(doc.documentElement, line2);
|
|
3271
|
+
return buildXml(doc);
|
|
3272
|
+
}
|
|
3273
|
+
|
|
3274
|
+
// chart/write-util.ts
|
|
3275
|
+
var INVALID_XML = /[\u0000-\u0008\u000B\u000C\u000E-\u001F\uFFFE\uFFFF]/g;
|
|
3276
|
+
var escapeText = (value) => value.replace(INVALID_XML, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
3277
|
+
var escapeAttribute = (value) => escapeText(value).replace(/"/g, """).replace(/\r/g, " ").replace(/\n/g, " ").replace(/\t/g, "	");
|
|
3278
|
+
function chartNumber(value) {
|
|
3279
|
+
if (!Number.isFinite(value)) throw new Error(`Chart number ${value} is not finite`);
|
|
3280
|
+
const text2 = String(value);
|
|
3281
|
+
const match = /^(-?)(\d+)(?:\.(\d+))?e([+-]\d+)$/i.exec(text2);
|
|
3282
|
+
if (!match) return text2;
|
|
3283
|
+
const [, sign = "", whole = "", fraction = "", exponent = "0"] = match;
|
|
3284
|
+
const digits = whole + fraction;
|
|
3285
|
+
const point = whole.length + Number(exponent);
|
|
3286
|
+
const body = point <= 0 ? `0.${"0".repeat(-point)}${digits}` : point >= digits.length ? digits + "0".repeat(point - digits.length) : `${digits.slice(0, point)}.${digits.slice(point)}`;
|
|
3287
|
+
return sign + body.replace(/^0+(?=\d)/, "");
|
|
3288
|
+
}
|
|
3289
|
+
function valXml(local, value) {
|
|
3290
|
+
if (value === void 0) return "";
|
|
3291
|
+
const text2 = typeof value === "boolean" ? value ? "1" : "0" : typeof value === "number" ? chartNumber(value) : escapeAttribute(value);
|
|
3292
|
+
return `<c:${local} val="${text2}"/>`;
|
|
3293
|
+
}
|
|
3294
|
+
var elementXml = (local, content, attributes = "") => content ? `<c:${local}${attributes}>${content}</c:${local}>` : `<c:${local}${attributes}/>`;
|
|
3295
|
+
var raw = (context, xml) => xml ? stripDeclarations(xml, context.bindings) : "";
|
|
3296
|
+
function sameValue(left, right) {
|
|
3297
|
+
if (left === right) return true;
|
|
3298
|
+
if (typeof left !== "object" || typeof right !== "object" || !left || !right) return false;
|
|
3299
|
+
if (Array.isArray(left) !== Array.isArray(right)) return false;
|
|
3300
|
+
const entries = (value) => Object.entries(value).filter(([, item]) => item !== void 0);
|
|
3301
|
+
const a2 = entries(left);
|
|
3302
|
+
const b = new Map(entries(right));
|
|
3303
|
+
return a2.length === b.size && a2.every(([key, item]) => b.has(key) && sameValue(item, b.get(key)));
|
|
3304
|
+
}
|
|
3305
|
+
|
|
3306
|
+
// chart/write-text-body.ts
|
|
3307
|
+
function runProperties(local, properties2) {
|
|
3308
|
+
const p = properties2 ?? {};
|
|
3309
|
+
const attributes = [
|
|
3310
|
+
p.sizePt === void 0 ? "" : ` sz="${Math.round(p.sizePt * 100)}"`,
|
|
3311
|
+
p.bold === void 0 ? "" : ` b="${p.bold ? 1 : 0}"`,
|
|
3312
|
+
p.italic === void 0 ? "" : ` i="${p.italic ? 1 : 0}"`,
|
|
3313
|
+
p.underline === void 0 ? "" : ` u="${p.underline ? "sng" : "none"}"`
|
|
3314
|
+
].join("");
|
|
3315
|
+
const children2 = (p.color ? `<a:solidFill>${drawingColorXml(p.color)}</a:solidFill>` : "") + (p.typeface ? `<a:latin typeface="${escapeAttribute(p.typeface)}"/>` : "");
|
|
3316
|
+
return children2 ? `<a:${local}${attributes}>${children2}</a:${local}>` : `<a:${local}${attributes}/>`;
|
|
3317
|
+
}
|
|
3318
|
+
function spacing(local, value) {
|
|
3319
|
+
if (!value) return "";
|
|
3320
|
+
const inner = value.unit === "points" ? `<a:spcPts val="${Math.round(value.value * 100)}"/>` : `<a:spcPct val="${Math.round(value.value * 1e5)}"/>`;
|
|
3321
|
+
return `<a:${local}>${inner}</a:${local}>`;
|
|
3322
|
+
}
|
|
3323
|
+
function run(value) {
|
|
3324
|
+
const { text: text2, ...properties2 } = value;
|
|
3325
|
+
const hasProperties = Object.keys(properties2).length > 0;
|
|
3326
|
+
if (text2 === "\n")
|
|
3327
|
+
return hasProperties ? `<a:br>${runProperties("rPr", properties2)}</a:br>` : "<a:br/>";
|
|
3328
|
+
return `<a:r>${hasProperties ? runProperties("rPr", properties2) : ""}<a:t>${escapeText(text2)}</a:t></a:r>`;
|
|
3329
|
+
}
|
|
3330
|
+
function paragraph(value) {
|
|
3331
|
+
const align = value.align ? ` algn="${escapeAttribute(value.align)}"` : "";
|
|
3332
|
+
const properties2 = spacing("lnSpc", value.lineSpacing) + spacing("spcBef", value.spaceBefore) + spacing("spcAft", value.spaceAfter) + runProperties("defRPr", value.defaultProperties);
|
|
3333
|
+
return `<a:p><a:pPr${align}>${properties2}</a:pPr>${value.runs.map(run).join("")}</a:p>`;
|
|
3334
|
+
}
|
|
3335
|
+
function writeTextBody(body) {
|
|
3336
|
+
const insets = body.insetsEmu ?? {};
|
|
3337
|
+
const attributes = [
|
|
3338
|
+
["lIns", insets.left],
|
|
3339
|
+
["tIns", insets.top],
|
|
3340
|
+
["rIns", insets.right],
|
|
3341
|
+
["bIns", insets.bottom]
|
|
3342
|
+
].map(([name, value]) => value === void 0 ? "" : ` ${name}="${Math.round(Number(value))}"`).join("");
|
|
3343
|
+
const anchor = body.anchor ? ` anchor="${escapeAttribute(body.anchor)}"` : "";
|
|
3344
|
+
const paragraphs = body.paragraphs.length ? body.paragraphs.map(paragraph).join("") : paragraph({ runs: [] });
|
|
3345
|
+
return `<a:bodyPr${attributes}${anchor}/><a:lstStyle/>${paragraphs}`;
|
|
3346
|
+
}
|
|
3347
|
+
|
|
3348
|
+
// chart/write-shape.ts
|
|
3349
|
+
var ROOT_DECLARATIONS = [...CHART_ROOT_BINDINGS].map(([prefix, uri]) => ` xmlns:${prefix}="${uri}"`).join("");
|
|
3350
|
+
var wrap = (local, xml) => parseXml(`<c:${local}${ROOT_DECLARATIONS}>${xml}</c:${local}>`, { label: "Chart" }).documentElement;
|
|
3351
|
+
function chartFillXml(fill) {
|
|
3352
|
+
if (fill.kind !== "pattern") return drawingFillXml(fill);
|
|
3353
|
+
const color = (local, value) => {
|
|
3354
|
+
const choice = local === "fgClr" ? value.foreground : value.background;
|
|
3355
|
+
return choice ? `<a:${local}>${drawingColorXml(choice)}</a:${local}>` : "";
|
|
3356
|
+
};
|
|
3357
|
+
return `<a:pattFill prst="${escapeAttribute(fill.preset)}">${color("fgClr", fill)}${color("bgClr", fill)}</a:pattFill>`;
|
|
3358
|
+
}
|
|
3359
|
+
var AFTER_LINE = ["effectLst", "effectDag", "scene3d", "sp3d", "extLst"];
|
|
3360
|
+
var AFTER_EFFECTS = ["effectDag", "scene3d", "sp3d", "extLst"];
|
|
3361
|
+
var firstOf = (parent, names) => elements(parent).find((node) => node.namespaceURI === NS.a && names.includes(node.localName)) ?? null;
|
|
3362
|
+
function patchShape(root, shape, read) {
|
|
3363
|
+
const doc = root.ownerDocument;
|
|
3364
|
+
if (!sameValue(read.fill, shape.fill)) {
|
|
3365
|
+
const xml = shape.fill && chartFillXml(shape.fill);
|
|
3366
|
+
if (xml) setDrawingFillXml(root, xml);
|
|
3367
|
+
else if (!shape.fill)
|
|
3368
|
+
for (let fill = fillElementOf(root); fill; fill = fillElementOf(root)) root.removeChild(fill);
|
|
3369
|
+
}
|
|
3370
|
+
if (!sameValue(read.line, shape.line)) {
|
|
3371
|
+
let ln = first(root, "ln", NS.a);
|
|
3372
|
+
if (!shape.line) {
|
|
3373
|
+
if (ln) root.removeChild(ln);
|
|
3374
|
+
} else {
|
|
3375
|
+
if (!ln) {
|
|
3376
|
+
ln = doc.createElementNS(NS.a, "a:ln");
|
|
3377
|
+
root.insertBefore(ln, firstOf(root, AFTER_LINE));
|
|
3378
|
+
}
|
|
3379
|
+
patchDrawingLine(ln, shape.line);
|
|
3380
|
+
}
|
|
3381
|
+
}
|
|
3382
|
+
if (read.effectsXml !== shape.effectsXml) {
|
|
3383
|
+
const old = first(root, "effectLst", NS.a);
|
|
3384
|
+
if (old) root.removeChild(old);
|
|
3385
|
+
if (shape.effectsXml) {
|
|
3386
|
+
const effects = elements(wrap("w", shape.effectsXml))[0];
|
|
3387
|
+
if (effects?.namespaceURI !== NS.a || effects.localName !== "effectLst")
|
|
3388
|
+
throw new Error("Invalid chart effects XML");
|
|
3389
|
+
root.insertBefore(doc.importNode(effects, true), firstOf(root, AFTER_EFFECTS));
|
|
3390
|
+
}
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3393
|
+
function shapePropertiesXml(context, shape) {
|
|
3394
|
+
if (!shape) return "";
|
|
3395
|
+
const { sourceXml, ...fields } = shape;
|
|
3396
|
+
let inner;
|
|
3397
|
+
if (sourceXml !== void 0) {
|
|
3398
|
+
const root = wrap("spPr", sourceXml);
|
|
3399
|
+
const read = readShapeFields(root);
|
|
3400
|
+
if (sameValue(read, fields)) inner = sourceXml;
|
|
3401
|
+
else {
|
|
3402
|
+
patchShape(root, fields, read);
|
|
3403
|
+
inner = innerXml(root);
|
|
3404
|
+
}
|
|
3405
|
+
} else {
|
|
3406
|
+
const fill = fields.fill && chartFillXml(fields.fill);
|
|
3407
|
+
inner = (fill ?? "") + (fields.line ? drawingLineXml(fields.line) : "") + (fields.effectsXml ?? "");
|
|
3408
|
+
}
|
|
3409
|
+
return elementXml("spPr", raw(context, inner));
|
|
3410
|
+
}
|
|
3411
|
+
function textBodyInnerXml(context, body) {
|
|
3412
|
+
const { sourceXml, ...fields } = body;
|
|
3413
|
+
if (sourceXml !== void 0) {
|
|
3414
|
+
const read = parseDrawingTextBody(wrap("txPr", sourceXml));
|
|
3415
|
+
if (sameValue(read, fields)) return raw(context, sourceXml);
|
|
3416
|
+
}
|
|
3417
|
+
return raw(context, writeTextBody(fields));
|
|
3418
|
+
}
|
|
3419
|
+
var textBodyXml = (context, body, local = "txPr") => body ? elementXml(local, textBodyInnerXml(context, body)) : "";
|
|
3420
|
+
var LAYOUT_FIELDS = [
|
|
3421
|
+
["layoutTarget", "layoutTarget"],
|
|
3422
|
+
["xMode", "xMode"],
|
|
3423
|
+
["yMode", "yMode"],
|
|
3424
|
+
["wMode", "widthMode"],
|
|
3425
|
+
["hMode", "heightMode"],
|
|
3426
|
+
["x", "x"],
|
|
3427
|
+
["y", "y"],
|
|
3428
|
+
["w", "width"],
|
|
3429
|
+
["h", "height"]
|
|
3430
|
+
];
|
|
3431
|
+
function layoutXml(context, value) {
|
|
3432
|
+
if (!value) return "";
|
|
3433
|
+
const { sourceXml, ...layout } = value;
|
|
3434
|
+
if (sourceXml !== void 0 && sameValue(readLayoutFields(wrap("layout", sourceXml)), layout))
|
|
3435
|
+
return elementXml("layout", raw(context, sourceXml));
|
|
3436
|
+
const manual = LAYOUT_FIELDS.map(([local, key]) => {
|
|
3437
|
+
const value2 = layout[key];
|
|
3438
|
+
if (value2 === void 0) return "";
|
|
3439
|
+
const text2 = typeof value2 === "number" ? chartNumber(value2) : value2;
|
|
3440
|
+
return `<c:${local} val="${text2}"/>`;
|
|
3441
|
+
}).join("");
|
|
3442
|
+
return elementXml("layout", manual ? `<c:manualLayout>${manual}</c:manualLayout>` : "");
|
|
3443
|
+
}
|
|
3444
|
+
function numberFormatXml(format) {
|
|
3445
|
+
if (!format) return "";
|
|
3446
|
+
const linked = format.sourceLinked === void 0 ? "" : ` sourceLinked="${format.sourceLinked ? 1 : 0}"`;
|
|
3447
|
+
return `<c:numFmt formatCode="${escapeAttribute(format.formatCode)}"${linked}/>`;
|
|
3448
|
+
}
|
|
3449
|
+
|
|
3450
|
+
// chart/write-text.ts
|
|
3451
|
+
var textElement = (local, value) => `<c:${local}>${escapeText(value)}</c:${local}>`;
|
|
3452
|
+
function cachePoints(cache) {
|
|
3453
|
+
return cache.points.map((point, position) => {
|
|
3454
|
+
const format = point.formatCode === void 0 ? "" : ` formatCode="${escapeAttribute(point.formatCode)}"`;
|
|
3455
|
+
return `<c:pt idx="${point.index ?? position}"${format}>${textElement("v", point.value)}</c:pt>`;
|
|
3456
|
+
}).join("");
|
|
3457
|
+
}
|
|
3458
|
+
function cacheXml(local, cache, withFormat) {
|
|
3459
|
+
if (!cache) return "";
|
|
3460
|
+
const format = withFormat && cache.formatCode !== void 0 ? textElement("formatCode", cache.formatCode) : "";
|
|
3461
|
+
return elementXml(local, format + valXml("ptCount", cache.pointCount) + cachePoints(cache));
|
|
3462
|
+
}
|
|
3463
|
+
function dataSourceInner(source) {
|
|
3464
|
+
const formula = textElement("f", source.formula ?? "");
|
|
3465
|
+
switch (source.kind) {
|
|
3466
|
+
case "numRef":
|
|
3467
|
+
return `<c:numRef>${formula}${cacheXml("numCache", source.cache, true)}</c:numRef>`;
|
|
3468
|
+
case "strRef":
|
|
3469
|
+
return `<c:strRef>${formula}${cacheXml("strCache", source.cache, false)}</c:strRef>`;
|
|
3470
|
+
case "multiLvlStrRef": {
|
|
3471
|
+
const levels = source.levels ? elementXml(
|
|
3472
|
+
"multiLvlStrCache",
|
|
3473
|
+
valXml("ptCount", source.levelPointCount) + source.levels.map((level) => elementXml("lvl", cachePoints(level))).join("")
|
|
3474
|
+
) : "";
|
|
3475
|
+
return `<c:multiLvlStrRef>${formula}${levels}</c:multiLvlStrRef>`;
|
|
3476
|
+
}
|
|
3477
|
+
case "numLit":
|
|
3478
|
+
return cacheXml("numLit", source.cache ?? { points: [] }, true);
|
|
3479
|
+
case "strLit":
|
|
3480
|
+
return cacheXml("strLit", source.cache ?? { points: [] }, false);
|
|
3481
|
+
default:
|
|
3482
|
+
return "";
|
|
3483
|
+
}
|
|
3484
|
+
}
|
|
3485
|
+
var dataSourceXml = (local, source) => source ? elementXml(local, dataSourceInner(source)) : "";
|
|
3486
|
+
function chartTextXml(context, text2, seriesName2) {
|
|
3487
|
+
if (!text2) return "";
|
|
3488
|
+
if (text2.reference) return elementXml("tx", dataSourceInner(text2.reference));
|
|
3489
|
+
if (seriesName2) {
|
|
3490
|
+
const value = text2.value ?? text2.text;
|
|
3491
|
+
return elementXml("tx", value === void 0 ? "" : textElement("v", value));
|
|
3492
|
+
}
|
|
3493
|
+
if (text2.rich) return elementXml("tx", textBodyXml(context, text2.rich, "rich"));
|
|
3494
|
+
if (text2.text === void 0) return "<c:tx/>";
|
|
3495
|
+
const paragraphs = text2.text.split("\n").map((line2) => ({ runs: [{ text: line2 }] }));
|
|
3496
|
+
return `<c:tx><c:rich>${writeTextBody({ paragraphs })}</c:rich></c:tx>`;
|
|
3497
|
+
}
|
|
3498
|
+
function titleXml(context, title) {
|
|
3499
|
+
if (!title) return "";
|
|
3500
|
+
const tx = title.tx ?? (title.text === void 0 ? void 0 : { text: title.text });
|
|
3501
|
+
return elementXml(
|
|
3502
|
+
"title",
|
|
3503
|
+
chartTextXml(context, tx, false) + layoutXml(context, title.layout) + valXml("overlay", title.overlay) + shapePropertiesXml(context, title.spPr) + textBodyXml(context, title.txPr) + raw(context, title.extLst)
|
|
3504
|
+
);
|
|
3505
|
+
}
|
|
3506
|
+
function labelOptionsXml(context, options) {
|
|
3507
|
+
return numberFormatXml(options.numberFormat) + shapePropertiesXml(context, options.spPr) + textBodyXml(context, options.txPr) + valXml("dLblPos", options.position) + valXml("showLegendKey", options.showLegendKey) + valXml("showVal", options.showValue) + valXml("showCatName", options.showCategoryName) + valXml("showSerName", options.showSeriesName) + valXml("showPercent", options.showPercent) + valXml("showBubbleSize", options.showBubbleSize) + (options.separator === void 0 ? "" : textElement("separator", options.separator));
|
|
3508
|
+
}
|
|
3509
|
+
function labelXml(context, label) {
|
|
3510
|
+
return elementXml(
|
|
3511
|
+
"dLbl",
|
|
3512
|
+
valXml("idx", label.index) + valXml("delete", label.deleted) + layoutXml(context, label.layout) + chartTextXml(context, label.tx, false) + labelOptionsXml(context, label) + raw(context, label.extLst)
|
|
3513
|
+
);
|
|
3514
|
+
}
|
|
3515
|
+
function dataLabelsXml(context, labels) {
|
|
3516
|
+
if (!labels) return "";
|
|
3517
|
+
const leaderLines = labels.leaderLines ? elementXml("leaderLines", shapePropertiesXml(context, labels.leaderLines.spPr)) : "";
|
|
3518
|
+
return elementXml(
|
|
3519
|
+
"dLbls",
|
|
3520
|
+
labels.labels.map((label) => labelXml(context, label)).join("") + valXml("delete", labels.deleted) + labelOptionsXml(context, labels) + valXml("showLeaderLines", labels.showLeaderLines) + leaderLines + raw(context, labels.extLst)
|
|
3521
|
+
);
|
|
3522
|
+
}
|
|
3523
|
+
|
|
3524
|
+
// chart/write-chrome.ts
|
|
3525
|
+
function surfaceXml(context, local, surface) {
|
|
3526
|
+
if (!surface) return "";
|
|
3527
|
+
return elementXml(
|
|
3528
|
+
local,
|
|
3529
|
+
valXml("thickness", surface.thickness) + shapePropertiesXml(context, surface.spPr) + raw(context, surface.pictureOptionsXml) + raw(context, surface.extLst)
|
|
3530
|
+
);
|
|
3531
|
+
}
|
|
3532
|
+
function dataTableXml(context, table) {
|
|
3533
|
+
if (!table) return "";
|
|
3534
|
+
return elementXml(
|
|
3535
|
+
"dTable",
|
|
3536
|
+
valXml("showHorzBorder", table.showHorizontalBorder) + valXml("showVertBorder", table.showVerticalBorder) + valXml("showOutline", table.showOutline) + valXml("showKeys", table.showKeys) + shapePropertiesXml(context, table.spPr) + textBodyXml(context, table.txPr) + raw(context, table.extLst)
|
|
3537
|
+
);
|
|
3538
|
+
}
|
|
3539
|
+
function displayUnitsXml(context, units2) {
|
|
3540
|
+
if (!units2) return "";
|
|
3541
|
+
const label = units2.label;
|
|
3542
|
+
return elementXml(
|
|
3543
|
+
"dispUnits",
|
|
3544
|
+
valXml("custUnit", units2.customUnit) + (units2.customUnit === void 0 ? valXml("builtInUnit", units2.builtInUnit) : "") + (label ? elementXml(
|
|
3545
|
+
"dispUnitsLbl",
|
|
3546
|
+
layoutXml(context, label.layout) + chartTextXml(context, label.tx, false) + shapePropertiesXml(context, label.spPr) + textBodyXml(context, label.txPr)
|
|
3547
|
+
) : "") + raw(context, units2.extLst)
|
|
3548
|
+
);
|
|
3549
|
+
}
|
|
3550
|
+
|
|
3551
|
+
// chart/write-axes.ts
|
|
3552
|
+
var AXIS_ELEMENTS2 = {
|
|
3553
|
+
cat: "catAx",
|
|
3554
|
+
val: "valAx",
|
|
3555
|
+
date: "dateAx",
|
|
3556
|
+
ser: "serAx"
|
|
3557
|
+
};
|
|
3558
|
+
var gridlinesXml = (context, local, present, shape) => present ? elementXml(local, shapePropertiesXml(context, shape)) : "";
|
|
3559
|
+
function axisXml(context, axis) {
|
|
3560
|
+
const { scaling } = axis;
|
|
3561
|
+
return elementXml(
|
|
3562
|
+
AXIS_ELEMENTS2[axis.kind],
|
|
3563
|
+
valXml("axId", axis.id) + elementXml(
|
|
3564
|
+
"scaling",
|
|
3565
|
+
valXml("logBase", scaling.logBase) + valXml("orientation", scaling.orientation) + valXml("max", scaling.max) + valXml("min", scaling.min)
|
|
3566
|
+
) + valXml("delete", axis.deleted) + valXml("axPos", axis.position) + gridlinesXml(context, "majorGridlines", axis.majorGridlines, axis.majorGridlinesSpPr) + gridlinesXml(context, "minorGridlines", axis.minorGridlines, axis.minorGridlinesSpPr) + titleXml(context, axis.title) + numberFormatXml(axis.numberFormat) + valXml("majorTickMark", axis.majorTickMark) + valXml("minorTickMark", axis.minorTickMark) + valXml("tickLblPos", axis.tickLabelPosition) + shapePropertiesXml(context, axis.spPr) + textBodyXml(context, axis.txPr) + valXml("crossAx", axis.crossAxisId) + valXml("crosses", axis.crosses) + valXml("crossesAt", axis.crossesAt) + valXml("crossBetween", axis.crossBetween) + valXml("auto", axis.auto) + valXml("lblAlgn", axis.labelAlign) + valXml("lblOffset", axis.labelOffset) + valXml("baseTimeUnit", axis.baseTimeUnit) + valXml("majorUnit", axis.majorUnit) + valXml("minorUnit", axis.minorUnit) + displayUnitsXml(context, axis.displayUnits) + valXml("tickLblSkip", axis.tickLabelSkip) + valXml("tickMarkSkip", axis.tickMarkSkip) + valXml("noMultiLvlLbl", axis.noMultiLevelLabels) + raw(context, axis.extLst)
|
|
3567
|
+
);
|
|
3568
|
+
}
|
|
3569
|
+
|
|
3570
|
+
// chart/write-series.ts
|
|
3571
|
+
function markerXml(context, marker) {
|
|
3572
|
+
if (!marker) return "";
|
|
3573
|
+
return elementXml(
|
|
3574
|
+
"marker",
|
|
3575
|
+
valXml("symbol", marker.symbol) + valXml("size", marker.size) + shapePropertiesXml(context, marker.spPr) + raw(context, marker.extLst)
|
|
3576
|
+
);
|
|
3577
|
+
}
|
|
3578
|
+
function dataPointXml(context, point) {
|
|
3579
|
+
return elementXml(
|
|
3580
|
+
"dPt",
|
|
3581
|
+
valXml("idx", point.index) + valXml("invertIfNegative", point.invertIfNegative) + markerXml(context, point.marker) + valXml("bubble3D", point.bubble3D) + valXml("explosion", point.explosion) + shapePropertiesXml(context, point.spPr) + raw(context, point.extLst)
|
|
3582
|
+
);
|
|
3583
|
+
}
|
|
3584
|
+
function seriesXml(context, series, position) {
|
|
3585
|
+
return elementXml(
|
|
3586
|
+
"ser",
|
|
3587
|
+
valXml("idx", series.index ?? position) + valXml("order", series.order ?? position) + chartTextXml(context, series.tx, true) + shapePropertiesXml(context, series.spPr) + valXml("invertIfNegative", series.invertIfNegative) + markerXml(context, series.marker) + valXml("explosion", series.explosion) + series.dataPoints.map((point) => dataPointXml(context, point)).join("") + dataLabelsXml(context, series.dataLabels) + dataSourceXml("cat", series.categories) + dataSourceXml("val", series.values) + dataSourceXml("xVal", series.xValues) + dataSourceXml("yVal", series.yValues) + dataSourceXml("bubbleSize", series.bubbleSizes) + valXml("smooth", series.smooth) + valXml("shape", series.shape) + valXml("bubble3D", series.bubble3D) + raw(context, series.extLst)
|
|
3588
|
+
);
|
|
3589
|
+
}
|
|
3590
|
+
|
|
3591
|
+
// chart/write-plot.ts
|
|
3592
|
+
var linesXml = (context, local, present, shape) => present ? elementXml(local, shapePropertiesXml(context, shape)) : "";
|
|
3593
|
+
var barsXml = (context, local, bars2) => bars2 ? elementXml(local, shapePropertiesXml(context, bars2.spPr)) : "";
|
|
3594
|
+
function upDownBarsXml(context, group) {
|
|
3595
|
+
if (!group.upDownBars) return "";
|
|
3596
|
+
return elementXml(
|
|
3597
|
+
"upDownBars",
|
|
3598
|
+
valXml("gapWidth", group.upDownBarsGapWidth) + barsXml(context, "upBars", group.upBars) + barsXml(context, "downBars", group.downBars)
|
|
3599
|
+
);
|
|
3600
|
+
}
|
|
3601
|
+
function groupElement(group) {
|
|
3602
|
+
if (Object.hasOwn(CHART_GROUP_ELEMENTS, group.element)) return group.element;
|
|
3603
|
+
const match = Object.entries(CHART_GROUP_ELEMENTS).find(
|
|
3604
|
+
([, value]) => value.kind === group.kind && value.is3D === group.is3D
|
|
3605
|
+
);
|
|
3606
|
+
if (!match) throw new Error(`No chart group element for ${group.kind}`);
|
|
3607
|
+
return match[0];
|
|
3608
|
+
}
|
|
3609
|
+
function groupXml(context, group) {
|
|
3610
|
+
return elementXml(
|
|
3611
|
+
groupElement(group),
|
|
3612
|
+
valXml("ofPieType", group.ofPieType) + valXml("scatterStyle", group.scatterStyle) + valXml("radarStyle", group.radarStyle) + valXml("wireframe", group.wireframe) + valXml("barDir", group.barDirection) + valXml("grouping", group.grouping) + valXml("varyColors", group.varyColors) + group.series.map((series, position) => seriesXml(context, series, position)).join("") + dataLabelsXml(context, group.dataLabels) + valXml("gapWidth", group.gapWidth) + valXml("overlap", group.overlap) + linesXml(context, "dropLines", group.dropLines, group.dropLinesSpPr) + linesXml(context, "hiLowLines", group.hiLowLines, group.hiLowLinesSpPr) + upDownBarsXml(context, group) + valXml("marker", group.marker) + valXml("smooth", group.smooth) + valXml("gapDepth", group.gapDepth) + valXml("shape", group.shape) + valXml("firstSliceAng", group.firstSliceAngle) + valXml("holeSize", group.holeSize) + valXml("bubble3D", group.bubble3D) + valXml("bubbleScale", group.bubbleScale) + valXml("showNegBubbles", group.showNegativeBubbles) + valXml("sizeRepresents", group.sizeRepresents) + linesXml(context, "serLines", group.seriesLines, group.seriesLinesSpPr) + group.axisIds.map((id) => valXml("axId", id)).join("") + raw(context, group.extLst)
|
|
3613
|
+
);
|
|
3614
|
+
}
|
|
3615
|
+
function plotAreaXml(context, plotArea) {
|
|
3616
|
+
return elementXml(
|
|
3617
|
+
"plotArea",
|
|
3618
|
+
layoutXml(context, plotArea.layout) + plotArea.groups.map((group) => groupXml(context, group)).join("") + plotArea.axes.map((axis) => axisXml(context, axis)).join("") + dataTableXml(context, plotArea.dataTable) + shapePropertiesXml(context, plotArea.spPr) + raw(context, plotArea.extLst)
|
|
3619
|
+
);
|
|
3620
|
+
}
|
|
3621
|
+
|
|
3622
|
+
// chart/write-space.ts
|
|
3623
|
+
var DECLARATION2 = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
|
3624
|
+
function view3DXml(view) {
|
|
3625
|
+
if (!view) return "";
|
|
3626
|
+
return elementXml(
|
|
3627
|
+
"view3D",
|
|
3628
|
+
valXml("rotX", view.rotX) + valXml("hPercent", view.heightPercent) + valXml("rotY", view.rotY) + valXml("depthPercent", view.depthPercent) + valXml("rAngAx", view.rightAngleAxes) + valXml("perspective", view.perspective)
|
|
3629
|
+
);
|
|
3630
|
+
}
|
|
3631
|
+
function legendXml(context, legend) {
|
|
3632
|
+
if (!legend) return "";
|
|
3633
|
+
const entries = legend.entries.map(
|
|
3634
|
+
(entry3) => elementXml(
|
|
3635
|
+
"legendEntry",
|
|
3636
|
+
valXml("idx", entry3.index) + valXml("delete", entry3.deleted) + textBodyXml(context, entry3.txPr)
|
|
3637
|
+
)
|
|
3638
|
+
).join("");
|
|
3639
|
+
return elementXml(
|
|
3640
|
+
"legend",
|
|
3641
|
+
valXml("legendPos", legend.position) + entries + layoutXml(context, legend.layout) + valXml("overlay", legend.overlay) + shapePropertiesXml(context, legend.spPr) + textBodyXml(context, legend.txPr) + raw(context, legend.extLst)
|
|
3642
|
+
);
|
|
3643
|
+
}
|
|
3644
|
+
function styleXml(context, space) {
|
|
3645
|
+
const style = valXml("style", space.style);
|
|
3646
|
+
if (space.c14Style === void 0) return style;
|
|
3647
|
+
const choice = `<mc:Choice Requires="c14" xmlns:c14="${NS.c14}"><c14:style val="${space.c14Style}"/></mc:Choice>`;
|
|
3648
|
+
const fallback = style ? `<mc:Fallback>${style}</mc:Fallback>` : "<mc:Fallback/>";
|
|
3649
|
+
return raw(
|
|
3650
|
+
context,
|
|
3651
|
+
`<mc:AlternateContent xmlns:mc="${NS.mc}">${choice}${fallback}</mc:AlternateContent>`
|
|
3652
|
+
);
|
|
3653
|
+
}
|
|
3654
|
+
var relationship = (local, id, content = "") => id === void 0 ? "" : elementXml(local, content, ` r:id="${escapeAttribute(id)}"`);
|
|
3655
|
+
function writeChartSpace(space, options = {}) {
|
|
3656
|
+
const bindings = new Map(CHART_ROOT_BINDINGS);
|
|
3657
|
+
for (const { prefix, uri } of space.namespaceDeclarations ?? [])
|
|
3658
|
+
if (!bindings.has(prefix) && /^[A-Za-z_][\w.-]*$/.test(prefix)) bindings.set(prefix, uri);
|
|
3659
|
+
const context = { bindings };
|
|
3660
|
+
const declarations = [...bindings].map(([prefix, uri]) => ` xmlns:${prefix}="${escapeAttribute(uri)}"`).join("");
|
|
3661
|
+
const chart = elementXml(
|
|
3662
|
+
"chart",
|
|
3663
|
+
titleXml(context, space.title) + valXml("autoTitleDeleted", space.autoTitleDeleted) + view3DXml(space.view3D) + surfaceXml(context, "floor", space.floor) + surfaceXml(context, "sideWall", space.sideWall) + surfaceXml(context, "backWall", space.backWall) + plotAreaXml(context, space.plotArea) + legendXml(context, space.legend) + valXml("plotVisOnly", space.plotVisibleOnly) + valXml("dispBlanksAs", space.displayBlanksAs) + valXml("showDLblsOverMax", space.showDataLabelsOverMax) + raw(context, space.chartExtLst)
|
|
3664
|
+
);
|
|
3665
|
+
const body = valXml("date1904", space.date1904) + valXml("lang", space.language) + valXml("roundedCorners", space.roundedCorners) + styleXml(context, space) + chart + shapePropertiesXml(context, space.spPr) + textBodyXml(context, space.txPr) + relationship(
|
|
3666
|
+
"externalData",
|
|
3667
|
+
space.externalDataRelId,
|
|
3668
|
+
valXml("autoUpdate", space.externalDataAutoUpdate)
|
|
3669
|
+
) + raw(context, space.printSettings) + relationship("userShapes", space.userShapesRelId) + raw(context, space.extLst);
|
|
3670
|
+
const breakAfter = options.declarationBreak ?? "\r\n";
|
|
3671
|
+
return `${DECLARATION2}${breakAfter}<c:chartSpace${declarations}>${body}</c:chartSpace>`;
|
|
3672
|
+
}
|
|
3673
|
+
|
|
3674
|
+
// chart/render/summary-from-space.ts
|
|
3675
|
+
var solidColor = (fill) => fill?.kind === "solid" ? fill.color : void 0;
|
|
3676
|
+
var isSolidFill = (fill) => fill?.kind === "solid" || fill?.kind === "unsupported" && fill.element === "solidFill";
|
|
3677
|
+
var GROUP_TYPES = {
|
|
3678
|
+
bar: "bar",
|
|
3679
|
+
line: "line",
|
|
3680
|
+
area: "area",
|
|
3681
|
+
pie: "pie",
|
|
3682
|
+
ofPie: "pie",
|
|
3683
|
+
doughnut: "doughnut",
|
|
3684
|
+
scatter: "scatter",
|
|
3685
|
+
radar: "radar",
|
|
3686
|
+
bubble: "bubble",
|
|
3687
|
+
stock: "stock",
|
|
3688
|
+
surface: "surface"
|
|
3689
|
+
};
|
|
3690
|
+
var GROUPINGS = /* @__PURE__ */ new Set(["clustered", "stacked", "percentStacked", "standard"]);
|
|
3691
|
+
function chartSummarySeries(source, chartType) {
|
|
3692
|
+
const categories = source.categories ?? source.xValues;
|
|
3693
|
+
const values = source.values ?? source.yValues;
|
|
3694
|
+
const out = {
|
|
3695
|
+
categories: chartSourceValues(categories),
|
|
3696
|
+
values: chartSourceValues(values).map(
|
|
3697
|
+
(v) => typeof v === "number" ? v : v === "" ? null : Number.isFinite(Number(v)) ? Number(v) : null
|
|
3698
|
+
)
|
|
3699
|
+
};
|
|
3700
|
+
if (source.tx?.text !== void 0) out.name = source.tx.text;
|
|
3701
|
+
const nameRef = source.tx?.reference?.formula;
|
|
3702
|
+
if (nameRef) out.nameRef = nameRef;
|
|
3703
|
+
if (categories?.formula) out.categoriesRef = categories.formula;
|
|
3704
|
+
if (values?.formula) out.valuesRef = values.formula;
|
|
3705
|
+
if (source.spPr?.effectsXml) out.effectsXml = source.spPr.effectsXml;
|
|
3706
|
+
const primary = ["line", "scatter", "radar"].includes(chartType) ? source.spPr?.line?.fill : source.spPr?.fill;
|
|
3707
|
+
const fill = chartType === "scatter" && !isSolidFill(primary) ? source.marker?.spPr?.fill : primary;
|
|
3708
|
+
const drawingColor = solidColor(fill);
|
|
3709
|
+
if (drawingColor) out.drawingColor = drawingColor;
|
|
3710
|
+
if (fill && fill.kind !== "solid" && !(chartType === "scatter" && fill.kind === "none"))
|
|
3711
|
+
out.fill = fill;
|
|
3712
|
+
const points = {};
|
|
3713
|
+
const pointFills = {};
|
|
3714
|
+
for (const point of source.dataPoints) {
|
|
3715
|
+
const properties2 = point.spPr ?? point.marker?.spPr;
|
|
3716
|
+
if (point.index === void 0) continue;
|
|
3717
|
+
const pointColor = solidColor(properties2?.fill);
|
|
3718
|
+
if (pointColor) points[point.index] = pointColor;
|
|
3719
|
+
if (properties2?.fill && properties2.fill.kind !== "solid")
|
|
3720
|
+
pointFills[point.index] = properties2.fill;
|
|
3721
|
+
}
|
|
3722
|
+
if (Object.keys(points).length) out.pointColors = points;
|
|
3723
|
+
if (Object.keys(pointFills).length) out.pointFills = pointFills;
|
|
3724
|
+
return out;
|
|
3725
|
+
}
|
|
3726
|
+
function chartSummaryFromSpace(chartSpace, extras = {}) {
|
|
3727
|
+
const group = chartSpace.plotArea.groups[0];
|
|
3728
|
+
let chartType = group ? GROUP_TYPES[group.kind] : "column";
|
|
3729
|
+
if (chartType === "bar" && group?.barDirection !== "bar") chartType = "column";
|
|
3730
|
+
const series = (group?.series ?? []).map((source) => chartSummarySeries(source, chartType));
|
|
3731
|
+
const summary = {
|
|
3732
|
+
chartType,
|
|
3733
|
+
series,
|
|
3734
|
+
showLegend: chartSpace.legend !== void 0
|
|
3735
|
+
};
|
|
3736
|
+
const grouping = group?.grouping;
|
|
3737
|
+
if (grouping && GROUPINGS.has(grouping))
|
|
3738
|
+
summary.grouping = grouping;
|
|
3739
|
+
if (chartType === "bar" || chartType === "column") {
|
|
3740
|
+
for (const [value, field, fallback, min, max] of [
|
|
3741
|
+
[group?.gapWidth, "barGapWidth", 150, 0, 500],
|
|
3742
|
+
[group?.overlap, "barOverlap", 0, -100, 100]
|
|
3743
|
+
]) {
|
|
3744
|
+
const resolved = value ?? fallback;
|
|
3745
|
+
if (Number.isInteger(resolved) && resolved >= min && resolved <= max)
|
|
3746
|
+
summary[field] = resolved;
|
|
3747
|
+
}
|
|
3748
|
+
}
|
|
3749
|
+
if (chartSpace.title && chartSpace.autoTitleDeleted !== true) {
|
|
3750
|
+
const title = chartSpace.title.text;
|
|
3751
|
+
if (title !== void 0) summary.title = title;
|
|
3752
|
+
else if (series.length === 1 && series[0]?.name) summary.title = series[0].name;
|
|
3753
|
+
}
|
|
3754
|
+
const legendPos = chartSpace.legend?.position;
|
|
3755
|
+
if (legendPos && ["r", "l", "t", "b", "tr"].includes(legendPos))
|
|
3756
|
+
summary.legendPosition = legendPos;
|
|
3757
|
+
if (extras.formatting) summary.formatting = extras.formatting;
|
|
3758
|
+
if (extras.colorPalette !== void 0) summary.colorPalette = extras.colorPalette;
|
|
3759
|
+
if (extras.styleDefinition) summary.styleDefinition = extras.styleDefinition;
|
|
3760
|
+
return summary;
|
|
3761
|
+
}
|
|
3762
|
+
|
|
3763
|
+
// drawingml/theme-color.ts
|
|
3764
|
+
function themeSlotHex(color) {
|
|
3765
|
+
if (!color) return void 0;
|
|
3766
|
+
const value = color.kind === "srgb" ? color.value : color.kind === "system" ? color.fallback : void 0;
|
|
3767
|
+
return value ? value.toUpperCase() : void 0;
|
|
3768
|
+
}
|
|
3769
|
+
|
|
3770
|
+
// chart/render/chart-scale.ts
|
|
3771
|
+
var clean = (n2) => Number(n2.toPrecision(12));
|
|
3772
|
+
function* units(raw2) {
|
|
3773
|
+
let exp = Math.floor(Math.log10(raw2)) - 1;
|
|
3774
|
+
for (; ; ) {
|
|
3775
|
+
const base = 10 ** exp;
|
|
3776
|
+
for (const m of [1, 2, 5]) yield clean(m * base);
|
|
3777
|
+
exp++;
|
|
3778
|
+
}
|
|
3779
|
+
}
|
|
3780
|
+
function niceScale(dataMin, dataMax, options = {}) {
|
|
3781
|
+
const maxIntervals = Math.max(1, options.maxIntervals ?? 10);
|
|
3782
|
+
let lo = Number.isFinite(dataMin) ? dataMin : 0;
|
|
3783
|
+
let hi = Number.isFinite(dataMax) ? dataMax : 0;
|
|
3784
|
+
if (lo > hi) [lo, hi] = [hi, lo];
|
|
3785
|
+
if (lo === hi) {
|
|
3786
|
+
if (lo === 0) hi = 1;
|
|
3787
|
+
else if (options.noZero) {
|
|
3788
|
+
const pad = Math.abs(lo) * 0.1 || 1;
|
|
3789
|
+
lo -= pad;
|
|
3790
|
+
hi += pad;
|
|
3791
|
+
} else if (lo > 0) lo = 0;
|
|
3792
|
+
else hi = 0;
|
|
3793
|
+
}
|
|
3794
|
+
let fixedLo = false;
|
|
3795
|
+
let fixedHi = false;
|
|
3796
|
+
if (!options.noZero) {
|
|
3797
|
+
if (lo >= 0 && hi - lo >= hi / 6) {
|
|
3798
|
+
lo = 0;
|
|
3799
|
+
fixedLo = true;
|
|
3800
|
+
} else if (hi <= 0 && hi - lo >= -lo / 6) {
|
|
3801
|
+
hi = 0;
|
|
3802
|
+
fixedHi = true;
|
|
3803
|
+
}
|
|
3804
|
+
}
|
|
3805
|
+
const range = hi - lo;
|
|
3806
|
+
const top = fixedHi ? hi : hi + range * 0.05;
|
|
3807
|
+
const bottom = fixedLo ? lo : lo - range * 0.05;
|
|
3808
|
+
for (const unit of units(range / maxIntervals)) {
|
|
3809
|
+
const min = fixedLo ? lo : Math.floor(clean(bottom / unit)) * unit;
|
|
3810
|
+
const max = fixedHi ? hi : Math.ceil(clean(top / unit)) * unit;
|
|
3811
|
+
const intervals = Math.round((max - min) / unit);
|
|
3812
|
+
if (intervals <= maxIntervals && intervals > 0) {
|
|
3813
|
+
const ticks = [];
|
|
3814
|
+
for (let i = 0; i <= intervals; i++) ticks.push(clean(min + i * unit));
|
|
3815
|
+
return { min: clean(min), max: clean(max), majorUnit: unit, ticks };
|
|
3816
|
+
}
|
|
3817
|
+
}
|
|
3818
|
+
return { min: lo, max: hi, majorUnit: range, ticks: [lo, hi] };
|
|
3819
|
+
}
|
|
3820
|
+
var PERCENT_SCALE = {
|
|
3821
|
+
min: 0,
|
|
3822
|
+
max: 1,
|
|
3823
|
+
majorUnit: 0.1,
|
|
3824
|
+
ticks: [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]
|
|
3825
|
+
};
|
|
3826
|
+
function formatAxisValue(value, percent = false) {
|
|
3827
|
+
if (percent) return `${clean(value * 100)}%`;
|
|
3828
|
+
const v = clean(value);
|
|
3829
|
+
if (Math.abs(v) >= 1e15 || v !== 0 && Math.abs(v) < 1e-6)
|
|
3830
|
+
return v.toExponential(2).replace("e+", "E+").replace("e-", "E-");
|
|
3831
|
+
const [int = "0", frac] = String(Math.abs(v)).split(".");
|
|
3832
|
+
const grouped = int.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
3833
|
+
return `${v < 0 ? "-" : ""}${grouped}${frac ? `.${frac}` : ""}`;
|
|
3834
|
+
}
|
|
3835
|
+
|
|
3836
|
+
// chart/render/chart-svg-util.ts
|
|
3837
|
+
var TEXT_COLOR = "#595959";
|
|
3838
|
+
var GRID_COLOR = "#D9D9D9";
|
|
3839
|
+
var AXIS_COLOR = "#BFBFBF";
|
|
3840
|
+
var FONT_SIZE = 10;
|
|
3841
|
+
function esc(text2) {
|
|
3842
|
+
return text2.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
3843
|
+
}
|
|
3844
|
+
var n = (value) => String(Math.round(value * 100) / 100);
|
|
3845
|
+
var textWidth = (text2, size = FONT_SIZE) => text2.length * size * 0.55;
|
|
3846
|
+
function text(x, y, content, attrs = {}) {
|
|
3847
|
+
const parts = [`x="${n(x)}"`, `y="${n(y)}"`];
|
|
3848
|
+
parts.push(`font-size="${attrs.size ?? FONT_SIZE}"`);
|
|
3849
|
+
parts.push(`fill="${esc(attrs.fill ?? TEXT_COLOR)}"`);
|
|
3850
|
+
if (attrs.anchor && attrs.anchor !== "start") parts.push(`text-anchor="${attrs.anchor}"`);
|
|
3851
|
+
if (attrs.weight) parts.push(`font-weight="${attrs.weight}"`);
|
|
3852
|
+
if (attrs.baseline) parts.push(`dominant-baseline="${attrs.baseline}"`);
|
|
3853
|
+
if (attrs.family) parts.push(`font-family="${esc(attrs.family)}"`);
|
|
3854
|
+
if (attrs.filter) parts.push(`filter="${esc(attrs.filter)}"`);
|
|
3855
|
+
if (attrs.italic !== void 0) parts.push(`font-style="${attrs.italic ? "italic" : "normal"}"`);
|
|
3856
|
+
if (attrs.underline !== void 0)
|
|
3857
|
+
parts.push(`text-decoration="${attrs.underline ? "underline" : "none"}"`);
|
|
3858
|
+
return `<text ${parts.join(" ")}>${esc(content)}</text>`;
|
|
3859
|
+
}
|
|
3860
|
+
var line = (x1, y1, x2, y2, stroke, width = 1) => `<line x1="${n(x1)}" y1="${n(y1)}" x2="${n(x2)}" y2="${n(y2)}" stroke="${stroke}" stroke-width="${width}"/>`;
|
|
3861
|
+
var rect = (x, y, w, h, fill, filter) => `<rect x="${n(x)}" y="${n(y)}" width="${n(Math.max(0, w))}" height="${n(Math.max(0, h))}" fill="${fill}"${filter ? ` filter="${esc(filter)}"` : ""}/>`;
|
|
3862
|
+
function fit(content, maxWidth, size = FONT_SIZE) {
|
|
3863
|
+
if (textWidth(content, size) <= maxWidth) return content;
|
|
3864
|
+
const chars = Math.max(1, Math.floor(maxWidth / (size * 0.55)) - 1);
|
|
3865
|
+
return `${content.slice(0, chars)}\u2026`;
|
|
3866
|
+
}
|
|
3867
|
+
|
|
3868
|
+
// chart/render/theme-palette.ts
|
|
3869
|
+
var THEME_SLOTS = [
|
|
3870
|
+
"lt1",
|
|
3871
|
+
"dk1",
|
|
3872
|
+
"lt2",
|
|
3873
|
+
"dk2",
|
|
3874
|
+
"accent1",
|
|
3875
|
+
"accent2",
|
|
3876
|
+
"accent3",
|
|
3877
|
+
"accent4",
|
|
3878
|
+
"accent5",
|
|
3879
|
+
"accent6",
|
|
3880
|
+
"hlink",
|
|
3881
|
+
"folHlink"
|
|
3882
|
+
];
|
|
3883
|
+
var DEFAULT_THEME_COLORS = [
|
|
3884
|
+
"FFFFFF",
|
|
3885
|
+
"000000",
|
|
3886
|
+
"E7E6E6",
|
|
3887
|
+
"44546A",
|
|
3888
|
+
"4472C4",
|
|
3889
|
+
"ED7D31",
|
|
3890
|
+
"A5A5A5",
|
|
3891
|
+
"FFC000",
|
|
3892
|
+
"5B9BD5",
|
|
3893
|
+
"70AD47",
|
|
3894
|
+
"0563C1",
|
|
3895
|
+
"954F72"
|
|
3896
|
+
];
|
|
3897
|
+
function themeColor(theme, index) {
|
|
3898
|
+
const hex = theme.colors[index] ?? DEFAULT_THEME_COLORS[index];
|
|
3899
|
+
return hex && parseArgbHex(hex) ? hex.replace(/^#/, "") : void 0;
|
|
3900
|
+
}
|
|
3901
|
+
|
|
3902
|
+
// chart/render/chart-colors.ts
|
|
3903
|
+
function chartColorScheme(theme) {
|
|
3904
|
+
const slots = Object.fromEntries(
|
|
3905
|
+
THEME_SLOTS.map((slot, index) => [slot, `#${themeColor(theme, index) ?? "000000"}`])
|
|
3906
|
+
);
|
|
3907
|
+
return {
|
|
3908
|
+
...slots,
|
|
3909
|
+
bg1: slots.lt1,
|
|
3910
|
+
tx1: slots.dk1,
|
|
3911
|
+
bg2: slots.lt2,
|
|
3912
|
+
tx2: slots.dk2
|
|
3913
|
+
};
|
|
3914
|
+
}
|
|
3915
|
+
function modulateLuminance(hex, lumMod, lumOff = 0) {
|
|
3916
|
+
const rgb = parseArgbHex(hex);
|
|
3917
|
+
if (!rgb) return "#000000";
|
|
3918
|
+
if (lumMod === 1 && lumOff === 0) return rgbToUpperHex(rgb);
|
|
3919
|
+
const hsl = rgbToHsl(...rgb);
|
|
3920
|
+
const l = Math.max(0, Math.min(1, hsl.l * lumMod + lumOff));
|
|
3921
|
+
const out = hslToRgb(hsl.h, hsl.s, l);
|
|
3922
|
+
return rgbToUpperHex([out.r, out.g, out.b]);
|
|
3923
|
+
}
|
|
3924
|
+
function autoSeriesColor(theme, index) {
|
|
3925
|
+
const i = Math.max(0, Math.floor(index));
|
|
3926
|
+
return chartPaletteSeriesColor(findChartColorPalette(10), i, i + 1, chartColorScheme(theme));
|
|
3927
|
+
}
|
|
3928
|
+
|
|
3929
|
+
// drawingml/drawing-color-css.ts
|
|
3930
|
+
function drawingColorCss(value) {
|
|
3931
|
+
if (!value || value.alpha === 1) return value?.hex;
|
|
3932
|
+
const channels = [1, 3, 5].map(
|
|
3933
|
+
(offset) => Number.parseInt(value.hex.slice(offset, offset + 2), 16)
|
|
3934
|
+
);
|
|
3935
|
+
return `rgba(${channels.join(",")},${value.alpha})`;
|
|
3936
|
+
}
|
|
3937
|
+
|
|
3938
|
+
// chart/render/chart-value-axis.ts
|
|
3939
|
+
function valueAxis(model) {
|
|
3940
|
+
const stackable = model.type === "bar" || model.type === "column" || model.type === "line" || model.type === "area";
|
|
3941
|
+
if (stackable && model.grouping === "percentStacked")
|
|
3942
|
+
return { ...PERCENT_SCALE, ticks: [...PERCENT_SCALE.ticks], percent: true };
|
|
3943
|
+
let min = Infinity;
|
|
3944
|
+
let max = -Infinity;
|
|
3945
|
+
if (stackable && model.grouping === "stacked") {
|
|
3946
|
+
for (let i = 0; i < model.categories.length; i++) {
|
|
3947
|
+
let pos = 0;
|
|
3948
|
+
let neg = 0;
|
|
3949
|
+
for (const s of model.series) {
|
|
3950
|
+
const v = s.values[i] ?? 0;
|
|
3951
|
+
if (v >= 0) pos += v;
|
|
3952
|
+
else neg += v;
|
|
3953
|
+
}
|
|
3954
|
+
min = Math.min(min, neg);
|
|
3955
|
+
max = Math.max(max, pos);
|
|
3956
|
+
}
|
|
3957
|
+
} else {
|
|
3958
|
+
for (const s of model.series)
|
|
3959
|
+
for (const v of s.values)
|
|
3960
|
+
if (v !== null) {
|
|
3961
|
+
min = Math.min(min, v);
|
|
3962
|
+
max = Math.max(max, v);
|
|
3963
|
+
}
|
|
3964
|
+
}
|
|
3965
|
+
if (min === Infinity) {
|
|
3966
|
+
min = 0;
|
|
3967
|
+
max = 1;
|
|
3968
|
+
}
|
|
3969
|
+
return { ...niceScale(min, max), percent: false };
|
|
3970
|
+
}
|
|
3971
|
+
function categoryTotals(model) {
|
|
3972
|
+
return model.categories.map(
|
|
3973
|
+
(_, i) => model.series.reduce((sum, s) => sum + Math.abs(s.values[i] ?? 0), 0)
|
|
3974
|
+
);
|
|
3975
|
+
}
|
|
3976
|
+
|
|
3977
|
+
// units/constants.ts
|
|
3978
|
+
var EMU_PER_PIXEL = 9525;
|
|
3979
|
+
var EMU_PER_POINT = 12700;
|
|
3980
|
+
|
|
3981
|
+
// drawingml/drawing-shadow.ts
|
|
3982
|
+
function resolveDrawingShadow(effects, theme) {
|
|
3983
|
+
const node = first(effects, "outerShdw", NS.a);
|
|
3984
|
+
if (!node) return void 0;
|
|
3985
|
+
const value = (key, fallback) => Number(node.getAttribute(key) ?? fallback);
|
|
3986
|
+
if (value("sx", 1e5) !== 1e5 || value("sy", 1e5) !== 1e5 || value("kx", 0) !== 0 || value("ky", 0) !== 0)
|
|
3987
|
+
return void 0;
|
|
3988
|
+
const color = parseDrawingColorIn(node);
|
|
3989
|
+
const resolved = color && resolveDrawingColor(color, theme, { transformOrder: "document" });
|
|
3990
|
+
const blur = value("blurRad", 0) / EMU_PER_PIXEL;
|
|
3991
|
+
const distance = value("dist", 0) / EMU_PER_PIXEL;
|
|
3992
|
+
const angle = value("dir", 0) / 6e4 * Math.PI / 180;
|
|
3993
|
+
if (!resolved || ![blur, distance, angle].every(Number.isFinite) || blur < 0 || distance < 0)
|
|
3994
|
+
return void 0;
|
|
3995
|
+
return {
|
|
3996
|
+
color: resolved.hex,
|
|
3997
|
+
opacity: resolved.alpha,
|
|
3998
|
+
blur,
|
|
3999
|
+
dx: Math.cos(angle) * distance,
|
|
4000
|
+
dy: Math.sin(angle) * distance
|
|
4001
|
+
};
|
|
4002
|
+
}
|
|
4003
|
+
function resolveDrawingShadowXml(xml, theme) {
|
|
4004
|
+
return xml ? resolveDrawingShadow(parseXml(xml).documentElement, theme) : void 0;
|
|
4005
|
+
}
|
|
4006
|
+
function svgDropShadowElement(s, format) {
|
|
4007
|
+
const num = format.number;
|
|
4008
|
+
return `<feDropShadow dx="${num(s.dx)}" dy="${num(s.dy)}" stdDeviation="${num(s.blur / 2)}" flood-color="${format.color(s.color, "#000000")}" flood-opacity="${num(s.opacity)}" result="shadow"/>`;
|
|
4009
|
+
}
|
|
4010
|
+
|
|
4011
|
+
// chart/text-inheritance.ts
|
|
4012
|
+
var TEXT_KEYS = [
|
|
4013
|
+
"fontSize",
|
|
4014
|
+
"bold",
|
|
4015
|
+
"italic",
|
|
4016
|
+
"underline",
|
|
4017
|
+
"typeface",
|
|
4018
|
+
"textColor",
|
|
4019
|
+
"fontRef"
|
|
4020
|
+
];
|
|
4021
|
+
var TEXT_PARTS = [
|
|
4022
|
+
"title",
|
|
4023
|
+
"axisTitle",
|
|
4024
|
+
"categoryAxis",
|
|
4025
|
+
"valueAxis",
|
|
4026
|
+
"legend",
|
|
4027
|
+
"dataLabel"
|
|
4028
|
+
];
|
|
4029
|
+
function inheritChartText(part, entry3, builtIn, root) {
|
|
4030
|
+
if (!root || !TEXT_PARTS.includes(part)) return entry3;
|
|
4031
|
+
const out = { ...entry3 };
|
|
4032
|
+
for (const key of TEXT_KEYS) {
|
|
4033
|
+
delete out[key];
|
|
4034
|
+
const value = root[key] ?? builtIn?.[key];
|
|
4035
|
+
if (value !== void 0) Object.assign(out, { [key]: value });
|
|
4036
|
+
}
|
|
4037
|
+
if (part === "title" && root.fontSize !== void 0) out.fontSize = root.fontSize * 1.2;
|
|
4038
|
+
if (root.textEffectsXml !== void 0) out.textEffectsXml = root.textEffectsXml;
|
|
4039
|
+
return out;
|
|
4040
|
+
}
|
|
4041
|
+
|
|
4042
|
+
// chart/render/chart-appearance.ts
|
|
4043
|
+
var chartPointsToPixels = (points) => points * EMU_PER_POINT / EMU_PER_PIXEL;
|
|
4044
|
+
function typeface(entry3, theme) {
|
|
4045
|
+
const name = entry3.typeface;
|
|
4046
|
+
if (name?.startsWith("+mj-")) return theme.majorFont;
|
|
4047
|
+
if (name?.startsWith("+mn-")) return theme.minorFont;
|
|
4048
|
+
return name ?? (entry3.fontRef?.index === "major" ? theme.majorFont : entry3.fontRef?.index === "minor" ? theme.minorFont : void 0);
|
|
4049
|
+
}
|
|
4050
|
+
function chartAppearance(chart, theme) {
|
|
4051
|
+
const defaults = builtInChartTextStyle(effectiveBuiltInChartStyle(chart.formatting));
|
|
4052
|
+
const entries = {};
|
|
4053
|
+
for (const part of CHART_STYLE_PARTS) {
|
|
4054
|
+
const base = chart.styleDefinition?.entries[part];
|
|
4055
|
+
const direct = chart.formatting?.entries[part];
|
|
4056
|
+
if (!defaults[part] && !base && !direct) continue;
|
|
4057
|
+
const entry3 = {
|
|
4058
|
+
...inheritChartText(
|
|
4059
|
+
part,
|
|
4060
|
+
{ ...defaults[part], ...base, sourceXml: base?.sourceXml ?? "" },
|
|
4061
|
+
defaults[part],
|
|
4062
|
+
chart.formatting?.textDefaults
|
|
4063
|
+
),
|
|
4064
|
+
...direct,
|
|
4065
|
+
sourceXml: direct?.sourceXml ?? base?.sourceXml ?? ""
|
|
4066
|
+
};
|
|
4067
|
+
if (base?.line || direct?.line) entry3.line = { ...base?.line, ...direct?.line };
|
|
4068
|
+
entries[part] = entry3;
|
|
4069
|
+
}
|
|
4070
|
+
const scheme = chartColorScheme(theme);
|
|
4071
|
+
const resolve = (color) => resolveDrawingColor(
|
|
4072
|
+
color,
|
|
4073
|
+
{ scheme: (name) => scheme[name] },
|
|
4074
|
+
{ hslRounding: "halfDown", transformOrder: "document" }
|
|
4075
|
+
);
|
|
4076
|
+
const out = resolveChartStyleDefinition(
|
|
4077
|
+
{ entries},
|
|
4078
|
+
(color) => drawingColorCss(resolve(color))
|
|
4079
|
+
) ?? {};
|
|
4080
|
+
for (const part of CHART_STYLE_PARTS) {
|
|
4081
|
+
const entry3 = entries[part];
|
|
4082
|
+
if (!entry3) continue;
|
|
4083
|
+
const family = typeface(entry3, theme);
|
|
4084
|
+
const shadow = resolveDrawingShadowXml(entry3.textEffectsXml, {
|
|
4085
|
+
scheme: (name) => scheme[name]
|
|
4086
|
+
});
|
|
4087
|
+
if (shadow) (out[part] ??= {}).textShadow = shadow;
|
|
4088
|
+
if (family) (out[part] ??= {}).typeface = family;
|
|
4089
|
+
if (entry3.axisVisible !== void 0) (out[part] ??= {}).axisVisible = entry3.axisVisible;
|
|
4090
|
+
if (entry3.labelsVisible !== void 0) (out[part] ??= {}).labelsVisible = entry3.labelsVisible;
|
|
4091
|
+
if (entry3.line?.widthEmu === 0) (out[part] ??= {}).lineWidth = 0;
|
|
4092
|
+
if (entry3.fill?.kind === "gradient") {
|
|
4093
|
+
(out[part] ??= {}).gradient = resolveChartGradient(entry3.fill, resolve);
|
|
4094
|
+
}
|
|
4095
|
+
}
|
|
4096
|
+
return out;
|
|
4097
|
+
}
|
|
4098
|
+
|
|
4099
|
+
// chart/render/chart-title-text.ts
|
|
4100
|
+
function properties(run2) {
|
|
4101
|
+
return {
|
|
4102
|
+
...run2.sizePt === void 0 ? {} : { fontSize: run2.sizePt },
|
|
4103
|
+
...run2.bold === void 0 ? {} : { bold: run2.bold },
|
|
4104
|
+
...run2.italic === void 0 ? {} : { italic: run2.italic },
|
|
4105
|
+
...run2.underline === void 0 ? {} : { underline: run2.underline },
|
|
4106
|
+
...run2.typeface === void 0 ? {} : { typeface: run2.typeface },
|
|
4107
|
+
...run2.color === void 0 ? {} : { textColor: run2.color }
|
|
4108
|
+
};
|
|
4109
|
+
}
|
|
4110
|
+
function chartTitleText(chart, theme) {
|
|
4111
|
+
const formatting = chart.formatting;
|
|
4112
|
+
const entry3 = formatting?.entries.title;
|
|
4113
|
+
const body = entry3?.textBody;
|
|
4114
|
+
if (!formatting || !body || body.text !== chart.title) return void 0;
|
|
4115
|
+
if (body.paragraphs.length === 1 && body.paragraphs[0].runs.length <= 1 && !body.text.includes("\n") && !body.paragraphs[0].lineSpacing && !body.paragraphs[0].spaceBefore && !body.paragraphs[0].spaceAfter)
|
|
4116
|
+
return void 0;
|
|
4117
|
+
return {
|
|
4118
|
+
paragraphs: body.paragraphs.map((paragraph2) => ({
|
|
4119
|
+
...paragraph2.align ? { align: paragraph2.align } : {},
|
|
4120
|
+
...paragraph2.lineSpacing ? { lineSpacing: paragraph2.lineSpacing } : {},
|
|
4121
|
+
...paragraph2.spaceBefore ? { spaceBefore: paragraph2.spaceBefore } : {},
|
|
4122
|
+
...paragraph2.spaceAfter ? { spaceAfter: paragraph2.spaceAfter } : {},
|
|
4123
|
+
runs: paragraph2.runs.map((run2) => {
|
|
4124
|
+
const direct = {
|
|
4125
|
+
sourceXml: "",
|
|
4126
|
+
...entry3.textBodyStyle,
|
|
4127
|
+
...properties(paragraph2.defaultProperties ?? {}),
|
|
4128
|
+
...properties(run2)
|
|
4129
|
+
};
|
|
4130
|
+
const appearance = chartAppearance(
|
|
4131
|
+
{
|
|
4132
|
+
...chart,
|
|
4133
|
+
formatting: { ...formatting, entries: { ...formatting.entries, title: direct } }
|
|
4134
|
+
},
|
|
4135
|
+
theme
|
|
4136
|
+
)?.title ?? {};
|
|
4137
|
+
return { text: run2.text, appearance };
|
|
4138
|
+
})
|
|
4139
|
+
}))
|
|
4140
|
+
};
|
|
4141
|
+
}
|
|
4142
|
+
|
|
4143
|
+
// chart/render/chart-view.ts
|
|
4144
|
+
var isRefError = (value) => typeof value === "object" && value !== null && "error" in value;
|
|
4145
|
+
var SUPPORTED = /* @__PURE__ */ new Set([
|
|
4146
|
+
"bar",
|
|
4147
|
+
"column",
|
|
4148
|
+
"line",
|
|
4149
|
+
"area",
|
|
4150
|
+
"pie",
|
|
4151
|
+
"doughnut",
|
|
4152
|
+
"scatter",
|
|
4153
|
+
"radar"
|
|
4154
|
+
]);
|
|
4155
|
+
function toText(value) {
|
|
4156
|
+
if (value === null) return "";
|
|
4157
|
+
if (typeof value === "boolean") return value ? "TRUE" : "FALSE";
|
|
4158
|
+
if (isRefError(value)) return value.error;
|
|
4159
|
+
return String(value);
|
|
4160
|
+
}
|
|
4161
|
+
var toNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
4162
|
+
function resolveRef(ref, evaluateRef) {
|
|
4163
|
+
if (!ref) return void 0;
|
|
4164
|
+
try {
|
|
4165
|
+
const values = evaluateRef(ref);
|
|
4166
|
+
return values.length ? values : void 0;
|
|
4167
|
+
} catch {
|
|
4168
|
+
return void 0;
|
|
4169
|
+
}
|
|
4170
|
+
}
|
|
4171
|
+
function seriesName(series, index, evaluateRef) {
|
|
4172
|
+
const fromRef = resolveRef(series.nameRef, evaluateRef)?.map(toText).filter((t) => t !== "").join(" ");
|
|
4173
|
+
return fromRef || series.name || `Series${index + 1}`;
|
|
4174
|
+
}
|
|
4175
|
+
function chartSummaryView(chart, theme, options = {}) {
|
|
4176
|
+
const evaluateRef = options.evaluateRef ?? (() => []);
|
|
4177
|
+
const type = chart.chartType;
|
|
4178
|
+
const radial = type === "pie" || type === "doughnut";
|
|
4179
|
+
const palette = chart.colorPalette === void 0 ? void 0 : findChartColorPalette(chart.colorPalette);
|
|
4180
|
+
const scheme = chartColorScheme(theme);
|
|
4181
|
+
const drawingColor = (color) => color && drawingColorCss(
|
|
4182
|
+
resolveDrawingColor(
|
|
4183
|
+
color,
|
|
4184
|
+
{
|
|
4185
|
+
scheme: (name) => scheme[name]
|
|
4186
|
+
},
|
|
4187
|
+
{ transformOrder: "document" }
|
|
4188
|
+
)
|
|
4189
|
+
);
|
|
4190
|
+
const gradient = (fill) => fill?.kind === "gradient" ? resolveChartGradient(
|
|
4191
|
+
fill,
|
|
4192
|
+
(color) => resolveDrawingColor(
|
|
4193
|
+
color,
|
|
4194
|
+
{
|
|
4195
|
+
scheme: (name) => scheme[name]
|
|
4196
|
+
},
|
|
4197
|
+
{ transformOrder: "document" }
|
|
4198
|
+
)
|
|
4199
|
+
) : void 0;
|
|
4200
|
+
const grouping = chart.grouping ?? (type === "bar" || type === "column" ? "clustered" : "standard");
|
|
4201
|
+
let categories = [];
|
|
4202
|
+
const rawCategories = [];
|
|
4203
|
+
const series = chart.series.map((s, i) => {
|
|
4204
|
+
const values = resolveRef(s.valuesRef, evaluateRef)?.map(toNumber) ?? s.values.map(toNumber);
|
|
4205
|
+
const cats = resolveRef(s.categoriesRef, evaluateRef) ?? s.categories;
|
|
4206
|
+
rawCategories.push(cats);
|
|
4207
|
+
const paletteColor = palette && chartPaletteSeriesColor(palette, i, chart.series.length, scheme);
|
|
4208
|
+
const color = s.fill?.kind === "none" ? "none" : drawingColor(s.fill?.kind === "solid" ? s.fill.color : s.drawingColor) ?? options.seriesColor?.(s, i) ?? paletteColor ?? autoSeriesColor(theme, i);
|
|
4209
|
+
const view = { name: seriesName(s, i, evaluateRef), values, color };
|
|
4210
|
+
const shadow = resolveDrawingShadowXml(s.effectsXml, {
|
|
4211
|
+
scheme: (name) => scheme[name]
|
|
4212
|
+
});
|
|
4213
|
+
if (shadow) view.shadow = shadow;
|
|
4214
|
+
const resolvedGradient = gradient(s.fill);
|
|
4215
|
+
if (resolvedGradient) view.gradient = resolvedGradient;
|
|
4216
|
+
const points = Object.fromEntries(
|
|
4217
|
+
Object.entries(s.pointFills ?? {}).flatMap(([key, fill]) => {
|
|
4218
|
+
const value = gradient(fill);
|
|
4219
|
+
return value ? [[key, value]] : [];
|
|
4220
|
+
})
|
|
4221
|
+
);
|
|
4222
|
+
if (Object.keys(points).length) view.pointGradients = points;
|
|
4223
|
+
return view;
|
|
4224
|
+
});
|
|
4225
|
+
const longest = Math.max(0, ...series.map((s) => s.values.length));
|
|
4226
|
+
const firstCats = rawCategories.find((c2) => c2.length > 0) ?? [];
|
|
4227
|
+
categories = Array.from(
|
|
4228
|
+
{ length: Math.max(longest, firstCats.length) },
|
|
4229
|
+
(_, i) => firstCats[i] !== void 0 ? toText(firstCats[i] ?? null) : String(i + 1)
|
|
4230
|
+
);
|
|
4231
|
+
if (radial) {
|
|
4232
|
+
series.forEach((s, seriesIndex) => {
|
|
4233
|
+
s.pointColors = s.values.map((_, i) => {
|
|
4234
|
+
const explicit = drawingColor(chart.series[seriesIndex]?.pointColors?.[i]);
|
|
4235
|
+
return explicit ?? (palette ? chartPaletteSeriesColor(palette, i, s.values.length, scheme) : autoSeriesColor(theme, i));
|
|
4236
|
+
});
|
|
4237
|
+
});
|
|
4238
|
+
} else
|
|
4239
|
+
series.forEach((s, seriesIndex) => {
|
|
4240
|
+
const points = chart.series[seriesIndex]?.pointColors;
|
|
4241
|
+
if (points) s.pointColors = s.values.map((_, i) => drawingColor(points[i]) ?? s.color);
|
|
4242
|
+
});
|
|
4243
|
+
series.forEach((s, index) => {
|
|
4244
|
+
const source = chart.series[index];
|
|
4245
|
+
if (s.gradient && !radial && s.pointColors) {
|
|
4246
|
+
for (let i = 0; i < s.pointColors.length; i++)
|
|
4247
|
+
if (!source.pointColors?.[i]) delete s.pointColors[i];
|
|
4248
|
+
}
|
|
4249
|
+
for (const [key, fill] of Object.entries(source.pointFills ?? {})) {
|
|
4250
|
+
if (fill.kind === "none") (s.pointColors ??= [])[Number(key)] = "none";
|
|
4251
|
+
else if (fill.kind === "solid") {
|
|
4252
|
+
const paint = drawingColor(fill.color);
|
|
4253
|
+
if (paint) (s.pointColors ??= [])[Number(key)] = paint;
|
|
4254
|
+
}
|
|
4255
|
+
}
|
|
4256
|
+
});
|
|
4257
|
+
const model = {
|
|
4258
|
+
...chart.barGapWidth === void 0 ? {} : { barGapWidth: chart.barGapWidth },
|
|
4259
|
+
...chart.barOverlap === void 0 ? {} : { barOverlap: chart.barOverlap },
|
|
4260
|
+
type,
|
|
4261
|
+
grouping,
|
|
4262
|
+
showLegend: chart.showLegend,
|
|
4263
|
+
legendPosition: chart.legendPosition ?? "r",
|
|
4264
|
+
categories,
|
|
4265
|
+
series,
|
|
4266
|
+
horizontal: type === "bar",
|
|
4267
|
+
supported: SUPPORTED.has(type)
|
|
4268
|
+
};
|
|
4269
|
+
if (chart.title) model.title = chart.title;
|
|
4270
|
+
const titleFormatting = chart.formatting?.entries.title;
|
|
4271
|
+
if (titleFormatting?.layout) model.titleLayout = titleFormatting.layout;
|
|
4272
|
+
if (titleFormatting?.overlay !== void 0) model.titleOverlay = titleFormatting.overlay;
|
|
4273
|
+
const legendFormatting = chart.formatting?.entries.legend;
|
|
4274
|
+
if (legendFormatting?.layout) model.legendLayout = legendFormatting.layout;
|
|
4275
|
+
if (legendFormatting?.overlay !== void 0) model.legendOverlay = legendFormatting.overlay;
|
|
4276
|
+
const titleText = chartTitleText(chart, theme);
|
|
4277
|
+
if (titleText) model.titleText = titleText;
|
|
4278
|
+
const appearance = chartAppearance(chart, theme);
|
|
4279
|
+
if (appearance) model.appearance = appearance;
|
|
4280
|
+
if (type === "scatter") {
|
|
4281
|
+
series.forEach((s, i) => {
|
|
4282
|
+
const cats = rawCategories[i] ?? [];
|
|
4283
|
+
const numeric = cats.length > 0 && cats.every((c2) => typeof c2 === "number");
|
|
4284
|
+
s.xValues = s.values.map((_, k) => numeric ? toNumber(cats[k] ?? null) : k + 1);
|
|
4285
|
+
});
|
|
4286
|
+
const xs = series.flatMap((s) => s.xValues ?? []).filter((x) => x !== null);
|
|
4287
|
+
model.xAxis = xs.length ? niceScale(Math.min(...xs), Math.max(...xs)) : niceScale(0, 1);
|
|
4288
|
+
}
|
|
4289
|
+
if (!radial) model.valueAxis = valueAxis(model);
|
|
4290
|
+
return model;
|
|
4291
|
+
}
|
|
4292
|
+
|
|
4293
|
+
// text/css-font-family.ts
|
|
4294
|
+
var FALLBACKS = {
|
|
4295
|
+
calibri: '"Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
|
|
4296
|
+
"calibri light": '"Calibri Light", "Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
|
|
4297
|
+
cambria: '"Cambria", "Caladea", Georgia, serif',
|
|
4298
|
+
arial: 'Arial, "Liberation Sans", Helvetica, sans-serif',
|
|
4299
|
+
"times new roman": '"Times New Roman", "Liberation Serif", Times, serif',
|
|
4300
|
+
"courier new": '"Courier New", "Liberation Mono", monospace',
|
|
4301
|
+
aptos: '"Aptos", "Calibri", "Carlito", "Segoe UI", sans-serif'
|
|
4302
|
+
};
|
|
4303
|
+
function cssFontFamily(name) {
|
|
4304
|
+
const known = FALLBACKS[name.toLowerCase()];
|
|
4305
|
+
if (known) return known;
|
|
4306
|
+
const quoted = `"${name.replace(/["\\]/g, "")}"`;
|
|
4307
|
+
return `${quoted}, "Calibri", "Carlito", "Segoe UI", sans-serif`;
|
|
4308
|
+
}
|
|
4309
|
+
|
|
4310
|
+
// chart/render/chart-svg-appearance.ts
|
|
4311
|
+
var nextPaintId = 0;
|
|
4312
|
+
function chartGradientPaint(model, width = 1024, height = 768) {
|
|
4313
|
+
const prefix = `xlsx-chart-${++nextPaintId}`;
|
|
4314
|
+
const appearance = { ...model.appearance };
|
|
4315
|
+
const defs = [];
|
|
4316
|
+
const shadowPaint = (shadow, suffix) => {
|
|
4317
|
+
const id = `${prefix}-${suffix}`;
|
|
4318
|
+
const pad = Math.max(4, shadow.blur * 3 + Math.abs(shadow.dx) + Math.abs(shadow.dy));
|
|
4319
|
+
defs.push(
|
|
4320
|
+
`<filter id="${id}" filterUnits="userSpaceOnUse" x="${n(-pad)}" y="${n(-pad)}" width="${n(width + pad * 2)}" height="${n(height + pad * 2)}" color-interpolation-filters="sRGB">${svgDropShadowElement(shadow, { number: n, color: (value) => esc(value) })}</filter>`
|
|
4321
|
+
);
|
|
4322
|
+
return `url(#${id})`;
|
|
4323
|
+
};
|
|
4324
|
+
for (const [part, entry3] of Object.entries(appearance)) {
|
|
4325
|
+
if (entry3?.textShadow)
|
|
4326
|
+
appearance[part] = {
|
|
4327
|
+
...entry3,
|
|
4328
|
+
textShadowFilter: shadowPaint(entry3.textShadow, `${part}-text-shadow`)
|
|
4329
|
+
};
|
|
4330
|
+
}
|
|
4331
|
+
const paint = (gradient, suffix, bounds) => {
|
|
4332
|
+
const def = buildChartGradientDef(`${prefix}-${suffix}`, gradient, bounds);
|
|
4333
|
+
defs.push(chartGradientMarkup(def));
|
|
4334
|
+
return `url(#${def.id})`;
|
|
4335
|
+
};
|
|
4336
|
+
for (const part of ["chartArea", "plotArea"]) {
|
|
4337
|
+
const entry3 = appearance[part];
|
|
4338
|
+
if (!entry3?.gradient) continue;
|
|
4339
|
+
if (part === "plotArea" && ["circle", "shape"].includes(entry3.gradient.path ?? "")) continue;
|
|
4340
|
+
appearance[part] = {
|
|
4341
|
+
...entry3,
|
|
4342
|
+
fillColor: paint(entry3.gradient, part, { width, height, shape: "rect" })
|
|
4343
|
+
};
|
|
4344
|
+
}
|
|
4345
|
+
const series = model.series.map((source, index) => {
|
|
4346
|
+
const view = { ...source };
|
|
4347
|
+
if (source.shadow) view.shadowFilter = shadowPaint(source.shadow, `s${index}-shadow`);
|
|
4348
|
+
const bounds = model.type === "bar" || model.type === "column" ? { width: 1, height: 1, shape: "rect" } : void 0;
|
|
4349
|
+
if (source.gradient) view.color = paint(source.gradient, `s${index}`, bounds);
|
|
4350
|
+
if (source.pointGradients) {
|
|
4351
|
+
view.pointColors = [...source.pointColors ?? []];
|
|
4352
|
+
for (const [key, gradient] of Object.entries(source.pointGradients))
|
|
4353
|
+
view.pointColors[Number(key)] = paint(gradient, `s${index}-p${key}`, bounds);
|
|
4354
|
+
}
|
|
4355
|
+
return view;
|
|
4356
|
+
});
|
|
4357
|
+
return defs.length ? { model: { ...model, appearance, series }, defs: `<defs>${defs.join("")}</defs>` } : { model, defs: "" };
|
|
4358
|
+
}
|
|
4359
|
+
function chartTextAttributes(model, part, fallbackSize = FONT_SIZE) {
|
|
4360
|
+
const entry3 = model.appearance?.[part];
|
|
4361
|
+
return {
|
|
4362
|
+
size: entry3?.fontSize === void 0 ? fallbackSize : chartPointsToPixels(entry3.fontSize),
|
|
4363
|
+
...entry3?.color === void 0 ? {} : { fill: entry3.color },
|
|
4364
|
+
...entry3?.bold === void 0 ? {} : { weight: entry3.bold ? "bold" : "normal" },
|
|
4365
|
+
...entry3?.italic === void 0 ? {} : { italic: entry3.italic },
|
|
4366
|
+
...entry3?.underline === void 0 ? {} : { underline: entry3.underline },
|
|
4367
|
+
...entry3?.typeface === void 0 ? {} : { family: cssFontFamily(entry3.typeface) },
|
|
4368
|
+
...entry3?.textShadowFilter === void 0 ? {} : { filter: entry3.textShadowFilter }
|
|
4369
|
+
};
|
|
4370
|
+
}
|
|
4371
|
+
function chartStroke(model, part) {
|
|
4372
|
+
const entry3 = model.appearance?.[part];
|
|
4373
|
+
return {
|
|
4374
|
+
color: entry3?.axisVisible === false ? "none" : entry3?.lineColor ?? (part === "gridlineMajor" ? GRID_COLOR : AXIS_COLOR),
|
|
4375
|
+
width: entry3?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry3.lineWidth)
|
|
4376
|
+
};
|
|
4377
|
+
}
|
|
4378
|
+
function chartAreaRect(model, part, area) {
|
|
4379
|
+
if (area.w <= 0 || area.h <= 0) return "";
|
|
4380
|
+
const entry3 = model.appearance?.[part];
|
|
4381
|
+
let fill = entry3?.fillColor ?? (part === "chartArea" ? "#FFFFFF" : "none");
|
|
4382
|
+
let defs = "";
|
|
4383
|
+
if (part !== "chartArea" && entry3?.gradient && (part !== "plotArea" || ["circle", "shape"].includes(entry3.gradient.path ?? ""))) {
|
|
4384
|
+
const def = buildChartGradientDef(`xlsx-chart-${++nextPaintId}-${part}`, entry3.gradient, {
|
|
4385
|
+
width: area.w,
|
|
4386
|
+
height: area.h,
|
|
4387
|
+
shape: "rect"
|
|
4388
|
+
});
|
|
4389
|
+
defs = `<defs>${chartGradientMarkup(def)}</defs>`;
|
|
4390
|
+
fill = `url(#${def.id})`;
|
|
4391
|
+
}
|
|
4392
|
+
const stroke = entry3?.lineColor ?? "none";
|
|
4393
|
+
if (fill === "none" && stroke === "none") return "";
|
|
4394
|
+
const width = entry3?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry3.lineWidth);
|
|
4395
|
+
return `${defs}<rect x="${n(area.x)}" y="${n(area.y)}" width="${n(area.w)}" height="${n(area.h)}" fill="${esc(fill)}" stroke="${esc(stroke)}" stroke-width="${n(width)}" data-chart-part="${part}"/>`;
|
|
4396
|
+
}
|
|
4397
|
+
|
|
4398
|
+
// chart/render/chart-spacing.ts
|
|
4399
|
+
function chartBarSpacing(chart) {
|
|
4400
|
+
const stacked = chart.grouping === "stacked" || chart.grouping === "percentStacked";
|
|
4401
|
+
return {
|
|
4402
|
+
barGapWidth: chart.barGapWidth ?? 150,
|
|
4403
|
+
barOverlap: chart.barOverlap ?? (stacked ? 100 : 0)
|
|
4404
|
+
};
|
|
4405
|
+
}
|
|
4406
|
+
|
|
4407
|
+
// chart/render/chart-svg-bars.ts
|
|
4408
|
+
function bars(model, frame, out, values) {
|
|
4409
|
+
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
4410
|
+
const count = Math.max(1, model.series.length);
|
|
4411
|
+
const geometry = clusteredBarGeometry(frame.bandSize, count, chartBarSpacing(model));
|
|
4412
|
+
const barSize = geometry.singleBarWidth;
|
|
4413
|
+
const base = frame.value(0);
|
|
4414
|
+
const pos = new Array(model.categories.length).fill(0);
|
|
4415
|
+
const neg = new Array(model.categories.length).fill(0);
|
|
4416
|
+
model.series.forEach((s, si) => {
|
|
4417
|
+
values[si]?.forEach((v, i) => {
|
|
4418
|
+
if (v === null || i >= model.categories.length) return;
|
|
4419
|
+
let from = 0;
|
|
4420
|
+
let to = v;
|
|
4421
|
+
if (stacked) {
|
|
4422
|
+
const acc = v >= 0 ? pos : neg;
|
|
4423
|
+
from = acc[i] ?? 0;
|
|
4424
|
+
to = from + v;
|
|
4425
|
+
acc[i] = to;
|
|
4426
|
+
}
|
|
4427
|
+
const a2 = stacked ? frame.value(from) : base;
|
|
4428
|
+
const b = frame.value(to);
|
|
4429
|
+
const offset = model.horizontal ? geometry.clusterWidth / 2 - barSize - si * geometry.step : -geometry.clusterWidth / 2 + si * geometry.step;
|
|
4430
|
+
const center = frame.band(i);
|
|
4431
|
+
const width = model.horizontal ? Math.abs(b - a2) : barSize;
|
|
4432
|
+
const height = model.horizontal ? barSize : Math.abs(b - a2);
|
|
4433
|
+
let color = s.pointColors?.[i] ?? s.color;
|
|
4434
|
+
const gradient = s.pointGradients?.[i] ?? (s.pointColors?.[i] === void 0 ? s.gradient : void 0);
|
|
4435
|
+
if (gradient && (gradient.path === "circle" || gradient.path === "shape")) {
|
|
4436
|
+
const baseId = color.match(/^url\(#(.+)\)$/)?.[1];
|
|
4437
|
+
if (baseId) {
|
|
4438
|
+
const id = baseId.replace(/(-s\d+(?:-p\d+)?)$/, `-mark${i}$1`);
|
|
4439
|
+
const def = buildChartGradientDef(id, gradient, {
|
|
4440
|
+
width: Number(n(width)),
|
|
4441
|
+
height: Number(n(height)),
|
|
4442
|
+
shape: "rect"
|
|
4443
|
+
});
|
|
4444
|
+
out.push(`<defs>${chartGradientMarkup(def)}</defs>`);
|
|
4445
|
+
color = `url(#${id})`;
|
|
4446
|
+
}
|
|
4447
|
+
}
|
|
4448
|
+
out.push(`<g data-chart-series="${si}" data-chart-point="${i}">`);
|
|
4449
|
+
if (model.horizontal)
|
|
4450
|
+
out.push(
|
|
4451
|
+
rect(Math.min(a2, b), center + offset, Math.abs(b - a2), barSize, color, s.shadowFilter)
|
|
4452
|
+
);
|
|
4453
|
+
else
|
|
4454
|
+
out.push(
|
|
4455
|
+
rect(center + offset, Math.min(a2, b), barSize, Math.abs(b - a2), color, s.shadowFilter)
|
|
4456
|
+
);
|
|
4457
|
+
out.push("</g>");
|
|
4458
|
+
});
|
|
4459
|
+
});
|
|
4460
|
+
}
|
|
4461
|
+
|
|
4462
|
+
// chart/render/chart-svg-cartesian.ts
|
|
4463
|
+
function axes(model, area, out) {
|
|
4464
|
+
const scale = model.valueAxis;
|
|
4465
|
+
if (!scale) return void 0;
|
|
4466
|
+
const labels = scale.ticks.map((t) => formatAxisValue(t, scale.percent));
|
|
4467
|
+
const valueAttrs = chartTextAttributes(model, "valueAxis");
|
|
4468
|
+
const categoryAttrs = chartTextAttributes(model, "categoryAxis");
|
|
4469
|
+
const valueSize = valueAttrs.size ?? 10;
|
|
4470
|
+
const categorySize = categoryAttrs.size ?? 10;
|
|
4471
|
+
const grid = chartStroke(model, "gridlineMajor");
|
|
4472
|
+
const axis = chartStroke(model, "categoryAxis");
|
|
4473
|
+
const valueLabels = model.appearance?.valueAxis?.labelsVisible !== false;
|
|
4474
|
+
const categoryLabels = model.appearance?.categoryAxis?.labelsVisible !== false;
|
|
4475
|
+
const labelW = valueLabels ? Math.max(...labels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
|
|
4476
|
+
const horizontal = model.horizontal;
|
|
4477
|
+
const cats = Math.max(1, model.categories.length);
|
|
4478
|
+
const catW = Math.min(
|
|
4479
|
+
area.w * 0.3,
|
|
4480
|
+
Math.max(...model.categories.map((c2) => textWidth(c2, categorySize)), 8) + 6
|
|
4481
|
+
);
|
|
4482
|
+
const plot = horizontal ? {
|
|
4483
|
+
x: area.x + catW,
|
|
4484
|
+
y: area.y,
|
|
4485
|
+
w: Math.max(1, area.w - catW - 4),
|
|
4486
|
+
h: Math.max(1, area.h - Math.max(16, valueSize * 1.5))
|
|
4487
|
+
} : {
|
|
4488
|
+
x: area.x + labelW,
|
|
4489
|
+
y: area.y + 4,
|
|
4490
|
+
w: Math.max(1, area.w - labelW - 4),
|
|
4491
|
+
h: Math.max(1, area.h - Math.max(20, categorySize * 1.5))
|
|
4492
|
+
};
|
|
4493
|
+
const span = scale.max - scale.min || 1;
|
|
4494
|
+
const value = horizontal ? (v) => plot.x + (v - scale.min) / span * plot.w : (v) => plot.y + plot.h - (v - scale.min) / span * plot.h;
|
|
4495
|
+
const bandSize = (horizontal ? plot.h : plot.w) / cats;
|
|
4496
|
+
const band = horizontal ? (i) => plot.y + plot.h - bandSize * (i + 0.5) : (i) => plot.x + bandSize * (i + 0.5);
|
|
4497
|
+
out.push(chartAreaRect(model, "plotArea", plot));
|
|
4498
|
+
scale.ticks.forEach((t, i) => {
|
|
4499
|
+
const p = value(t);
|
|
4500
|
+
const label = labels[i] ?? "";
|
|
4501
|
+
if (horizontal) {
|
|
4502
|
+
out.push(line(p, plot.y, p, plot.y + plot.h, grid.color, grid.width));
|
|
4503
|
+
if (valueLabels)
|
|
4504
|
+
out.push(
|
|
4505
|
+
text(p, plot.y + plot.h + valueSize + 2, label, { anchor: "middle", ...valueAttrs })
|
|
4506
|
+
);
|
|
4507
|
+
} else {
|
|
4508
|
+
out.push(line(plot.x, p, plot.x + plot.w, p, grid.color, grid.width));
|
|
4509
|
+
if (valueLabels)
|
|
4510
|
+
out.push(text(plot.x - 4, p + valueSize * 0.3, label, { anchor: "end", ...valueAttrs }));
|
|
4511
|
+
}
|
|
4512
|
+
});
|
|
4513
|
+
const zero = value(Math.min(Math.max(0, scale.min), scale.max));
|
|
4514
|
+
if (horizontal) out.push(line(zero, plot.y, zero, plot.y + plot.h, axis.color, axis.width));
|
|
4515
|
+
else out.push(line(plot.x, zero, plot.x + plot.w, zero, axis.color, axis.width));
|
|
4516
|
+
const step = Math.max(
|
|
4517
|
+
1,
|
|
4518
|
+
Math.ceil(cats / Math.max(1, Math.floor((horizontal ? plot.h : plot.w) / 14)))
|
|
4519
|
+
);
|
|
4520
|
+
model.categories.forEach((c2, i) => {
|
|
4521
|
+
if (!categoryLabels || i % step !== 0) return;
|
|
4522
|
+
const p = band(i);
|
|
4523
|
+
if (horizontal)
|
|
4524
|
+
out.push(
|
|
4525
|
+
text(plot.x - 4, p + categorySize * 0.3, fit(c2, catW - 6, categorySize), {
|
|
4526
|
+
anchor: "end",
|
|
4527
|
+
...categoryAttrs
|
|
4528
|
+
})
|
|
4529
|
+
);
|
|
4530
|
+
else
|
|
4531
|
+
out.push(
|
|
4532
|
+
text(p, plot.y + plot.h + categorySize + 3, fit(c2, bandSize * step, categorySize), {
|
|
4533
|
+
anchor: "middle",
|
|
4534
|
+
...categoryAttrs
|
|
4535
|
+
})
|
|
4536
|
+
);
|
|
4537
|
+
});
|
|
4538
|
+
return { plot, value, band, bandSize };
|
|
4539
|
+
}
|
|
4540
|
+
function plotted(model) {
|
|
4541
|
+
if (model.grouping !== "percentStacked") return model.series.map((s) => s.values);
|
|
4542
|
+
const totals = categoryTotals(model);
|
|
4543
|
+
return model.series.map(
|
|
4544
|
+
(s) => s.values.map((v, i) => v === null ? null : v / (totals[i] || 1))
|
|
4545
|
+
);
|
|
4546
|
+
}
|
|
4547
|
+
function linesAndAreas(model, frame, out) {
|
|
4548
|
+
const values = plotted(model);
|
|
4549
|
+
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
4550
|
+
const acc = new Array(model.categories.length).fill(0);
|
|
4551
|
+
const area = model.type === "area";
|
|
4552
|
+
const layers = [];
|
|
4553
|
+
model.series.forEach((s, si) => {
|
|
4554
|
+
const points = [];
|
|
4555
|
+
const lower = [];
|
|
4556
|
+
model.categories.forEach((_, i) => {
|
|
4557
|
+
const v = values[si]?.[i] ?? null;
|
|
4558
|
+
if (v === null && !area) {
|
|
4559
|
+
points.push([NaN, NaN]);
|
|
4560
|
+
return;
|
|
4561
|
+
}
|
|
4562
|
+
const below = stacked ? acc[i] ?? 0 : 0;
|
|
4563
|
+
const top = below + (v ?? 0);
|
|
4564
|
+
if (stacked) acc[i] = top;
|
|
4565
|
+
points.push([frame.band(i), frame.value(top)]);
|
|
4566
|
+
lower.push([frame.band(i), frame.value(below)]);
|
|
4567
|
+
});
|
|
4568
|
+
layers.push({
|
|
4569
|
+
points,
|
|
4570
|
+
lower,
|
|
4571
|
+
color: s.color,
|
|
4572
|
+
filter: s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""
|
|
4573
|
+
});
|
|
4574
|
+
});
|
|
4575
|
+
for (const { points, lower, color, filter } of area ? [...layers].reverse() : layers) {
|
|
4576
|
+
if (area) {
|
|
4577
|
+
const poly = [...points, ...[...lower].reverse()].map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
|
|
4578
|
+
out.push(`<polygon points="${poly}" fill="${color}" fill-opacity="0.85"${filter}/>`);
|
|
4579
|
+
continue;
|
|
4580
|
+
}
|
|
4581
|
+
let segment = [];
|
|
4582
|
+
const flush = () => {
|
|
4583
|
+
if (segment.length > 1)
|
|
4584
|
+
out.push(
|
|
4585
|
+
`<polyline points="${segment.join(" ")}" fill="none" stroke="${color}" stroke-width="2.25" stroke-linejoin="round"${filter}/>`
|
|
4586
|
+
);
|
|
4587
|
+
segment = [];
|
|
4588
|
+
};
|
|
4589
|
+
for (const [x, y] of points) {
|
|
4590
|
+
if (Number.isNaN(x)) flush();
|
|
4591
|
+
else segment.push(`${n(x)},${n(y)}`);
|
|
4592
|
+
}
|
|
4593
|
+
flush();
|
|
4594
|
+
for (const [x, y] of points)
|
|
4595
|
+
if (!Number.isNaN(x))
|
|
4596
|
+
out.push(`<circle cx="${n(x)}" cy="${n(y)}" r="2.5" fill="${color}"${filter}/>`);
|
|
4597
|
+
}
|
|
4598
|
+
}
|
|
4599
|
+
function scatter(model, area, out) {
|
|
4600
|
+
const ys = model.valueAxis;
|
|
4601
|
+
const xs = model.xAxis;
|
|
4602
|
+
if (!ys || !xs) return;
|
|
4603
|
+
const yLabels = ys.ticks.map((t) => formatAxisValue(t));
|
|
4604
|
+
const valueAttrs = chartTextAttributes(model, "valueAxis");
|
|
4605
|
+
const categoryAttrs = chartTextAttributes(model, "categoryAxis");
|
|
4606
|
+
const valueSize = valueAttrs.size ?? 10;
|
|
4607
|
+
const categorySize = categoryAttrs.size ?? 10;
|
|
4608
|
+
const grid = chartStroke(model, "gridlineMajor");
|
|
4609
|
+
const xAxis = chartStroke(model, "categoryAxis");
|
|
4610
|
+
const yAxis = chartStroke(model, "valueAxis");
|
|
4611
|
+
const valueLabels = model.appearance?.valueAxis?.labelsVisible !== false;
|
|
4612
|
+
const categoryLabels = model.appearance?.categoryAxis?.labelsVisible !== false;
|
|
4613
|
+
const labelW = valueLabels ? Math.max(...yLabels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
|
|
4614
|
+
const plot = {
|
|
4615
|
+
x: area.x + labelW,
|
|
4616
|
+
y: area.y + 4,
|
|
4617
|
+
w: Math.max(1, area.w - labelW - 8),
|
|
4618
|
+
h: Math.max(1, area.h - Math.max(20, categorySize * 1.5))
|
|
4619
|
+
};
|
|
4620
|
+
const px = (v, s) => plot.x + (v - s.min) / (s.max - s.min || 1) * plot.w;
|
|
4621
|
+
const py = (v, s) => plot.y + plot.h - (v - s.min) / (s.max - s.min || 1) * plot.h;
|
|
4622
|
+
out.push(chartAreaRect(model, "plotArea", plot));
|
|
4623
|
+
ys.ticks.forEach((t, i) => {
|
|
4624
|
+
out.push(line(plot.x, py(t, ys), plot.x + plot.w, py(t, ys), grid.color, grid.width));
|
|
4625
|
+
if (valueLabels)
|
|
4626
|
+
out.push(
|
|
4627
|
+
text(plot.x - 4, py(t, ys) + valueSize * 0.3, yLabels[i] ?? "", {
|
|
4628
|
+
anchor: "end",
|
|
4629
|
+
...valueAttrs
|
|
4630
|
+
})
|
|
4631
|
+
);
|
|
4632
|
+
});
|
|
4633
|
+
for (const t of xs.ticks) {
|
|
4634
|
+
out.push(
|
|
4635
|
+
line(px(t, xs), plot.y + plot.h, px(t, xs), plot.y + plot.h + 3, xAxis.color, xAxis.width)
|
|
4636
|
+
);
|
|
4637
|
+
if (categoryLabels)
|
|
4638
|
+
out.push(
|
|
4639
|
+
text(px(t, xs), plot.y + plot.h + categorySize + 3, formatAxisValue(t), {
|
|
4640
|
+
anchor: "middle",
|
|
4641
|
+
...categoryAttrs
|
|
4642
|
+
})
|
|
4643
|
+
);
|
|
4644
|
+
}
|
|
4645
|
+
out.push(
|
|
4646
|
+
line(plot.x, plot.y + plot.h, plot.x + plot.w, plot.y + plot.h, xAxis.color, xAxis.width)
|
|
4647
|
+
);
|
|
4648
|
+
out.push(line(plot.x, plot.y, plot.x, plot.y + plot.h, yAxis.color, yAxis.width));
|
|
4649
|
+
for (const s of model.series)
|
|
4650
|
+
s.values.forEach((v, i) => {
|
|
4651
|
+
const x = s.xValues?.[i] ?? null;
|
|
4652
|
+
if (v === null || x === null) return;
|
|
4653
|
+
out.push(
|
|
4654
|
+
`<circle cx="${n(px(x, xs))}" cy="${n(py(v, ys))}" r="3" fill="${s.pointColors?.[i] ?? s.color}"${s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""}/>`
|
|
4655
|
+
);
|
|
4656
|
+
});
|
|
4657
|
+
}
|
|
4658
|
+
function cartesianSvg(model, area) {
|
|
4659
|
+
const out = [];
|
|
4660
|
+
if (model.type === "scatter") {
|
|
4661
|
+
scatter(model, area, out);
|
|
4662
|
+
return out.join("");
|
|
4663
|
+
}
|
|
4664
|
+
const frame = axes(model, area, out);
|
|
4665
|
+
if (!frame) return "";
|
|
4666
|
+
if (model.type === "bar" || model.type === "column") bars(model, frame, out, plotted(model));
|
|
4667
|
+
else linesAndAreas(model, frame, out);
|
|
4668
|
+
return out.join("");
|
|
4669
|
+
}
|
|
4670
|
+
|
|
4671
|
+
// chart/render/chart-svg-radial.ts
|
|
4672
|
+
var polar = (cx, cy, r, angle) => [
|
|
4673
|
+
cx + r * Math.sin(angle),
|
|
4674
|
+
cy - r * Math.cos(angle)
|
|
4675
|
+
];
|
|
4676
|
+
function slicePath(cx, cy, r, inner, a0, a1) {
|
|
4677
|
+
const sweep = a1 - a0;
|
|
4678
|
+
if (sweep >= Math.PI * 2 - 1e-9) {
|
|
4679
|
+
const mid = a0 + Math.PI;
|
|
4680
|
+
return slicePath(cx, cy, r, inner, a0, mid) + slicePath(cx, cy, r, inner, mid, a1);
|
|
4681
|
+
}
|
|
4682
|
+
const large = sweep > Math.PI ? 1 : 0;
|
|
4683
|
+
const [x0, y0] = polar(cx, cy, r, a0);
|
|
4684
|
+
const [x1, y1] = polar(cx, cy, r, a1);
|
|
4685
|
+
if (inner <= 0)
|
|
4686
|
+
return `M${n(cx)},${n(cy)} L${n(x0)},${n(y0)} A${n(r)},${n(r)} 0 ${large} 1 ${n(x1)},${n(y1)} Z`;
|
|
4687
|
+
const [ix1, iy1] = polar(cx, cy, inner, a1);
|
|
4688
|
+
const [ix0, iy0] = polar(cx, cy, inner, a0);
|
|
4689
|
+
return `M${n(x0)},${n(y0)} A${n(r)},${n(r)} 0 ${large} 1 ${n(x1)},${n(y1)} L${n(ix1)},${n(iy1)} A${n(inner)},${n(inner)} 0 ${large} 0 ${n(ix0)},${n(iy0)} Z`;
|
|
4690
|
+
}
|
|
4691
|
+
function pieSvg(model, area) {
|
|
4692
|
+
const out = [chartAreaRect(model, "plotArea", area)];
|
|
4693
|
+
const cx = area.x + area.w / 2;
|
|
4694
|
+
const cy = area.y + area.h / 2;
|
|
4695
|
+
const radius = Math.max(1, Math.min(area.w, area.h) / 2 - 4);
|
|
4696
|
+
const rings = model.type === "doughnut" ? model.series : model.series.slice(0, 1);
|
|
4697
|
+
const hole = model.type === "doughnut" ? radius * 0.5 : 0;
|
|
4698
|
+
const ringSize = (radius - hole) / Math.max(1, rings.length);
|
|
4699
|
+
rings.forEach((s, ri) => {
|
|
4700
|
+
const outer = radius - ri * ringSize;
|
|
4701
|
+
const inner = model.type === "doughnut" ? outer - ringSize : 0;
|
|
4702
|
+
const total = s.values.reduce((sum, v) => sum + (v !== null && v > 0 ? v : 0), 0);
|
|
4703
|
+
if (total <= 0) return;
|
|
4704
|
+
let angle = 0;
|
|
4705
|
+
s.values.forEach((v, i) => {
|
|
4706
|
+
if (v === null || v <= 0) return;
|
|
4707
|
+
const sweep = v / total * Math.PI * 2;
|
|
4708
|
+
const color = s.pointColors?.[i] ?? s.color;
|
|
4709
|
+
out.push(
|
|
4710
|
+
`<path d="${slicePath(cx, cy, outer, inner, angle, angle + sweep)}" fill="${color}" stroke="#FFFFFF" stroke-width="1"${s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""}/>`
|
|
4711
|
+
);
|
|
4712
|
+
angle += sweep;
|
|
4713
|
+
});
|
|
4714
|
+
});
|
|
4715
|
+
return out.join("");
|
|
4716
|
+
}
|
|
4717
|
+
function radarSvg(model, area) {
|
|
4718
|
+
const out = [chartAreaRect(model, "plotArea", area)];
|
|
4719
|
+
const scale = model.valueAxis;
|
|
4720
|
+
const count = model.categories.length;
|
|
4721
|
+
if (!scale || count < 1) return "";
|
|
4722
|
+
const valueAttrs = chartTextAttributes(model, "valueAxis", 9);
|
|
4723
|
+
const categoryAttrs = chartTextAttributes(model, "categoryAxis");
|
|
4724
|
+
const valueSize = valueAttrs.size ?? 9;
|
|
4725
|
+
const categorySize = categoryAttrs.size ?? 10;
|
|
4726
|
+
const grid = chartStroke(model, "gridlineMajor");
|
|
4727
|
+
const axis = chartStroke(model, "categoryAxis");
|
|
4728
|
+
const cx = area.x + area.w / 2;
|
|
4729
|
+
const cy = area.y + area.h / 2 + 4;
|
|
4730
|
+
const radius = Math.max(1, Math.min(area.w, area.h) / 2 - Math.max(18, categorySize * 1.8));
|
|
4731
|
+
const angle = (i) => i / count * Math.PI * 2;
|
|
4732
|
+
const r = (v) => (v - scale.min) / (scale.max - scale.min || 1) * radius;
|
|
4733
|
+
const labelEvery = Math.max(
|
|
4734
|
+
1,
|
|
4735
|
+
Math.ceil(12 / Math.max(1, radius / Math.max(1, scale.ticks.length - 1)))
|
|
4736
|
+
);
|
|
4737
|
+
for (const [k, t] of scale.ticks.entries()) {
|
|
4738
|
+
const ring = Array.from({ length: count }, (_, i) => polar(cx, cy, r(t), angle(i))).map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
|
|
4739
|
+
out.push(
|
|
4740
|
+
`<polygon points="${ring}" fill="none" stroke="${grid.color}" stroke-width="${n(grid.width)}"/>`
|
|
4741
|
+
);
|
|
4742
|
+
if (model.appearance?.valueAxis?.labelsVisible !== false && k % labelEvery === 0)
|
|
4743
|
+
out.push(
|
|
4744
|
+
text(cx + 3, cy - r(t) + valueSize * 0.3, formatAxisValue(t, scale.percent), valueAttrs)
|
|
4745
|
+
);
|
|
4746
|
+
}
|
|
4747
|
+
model.categories.forEach((c2, i) => {
|
|
4748
|
+
const [x, y] = polar(cx, cy, radius, angle(i));
|
|
4749
|
+
out.push(line(cx, cy, x, y, axis.color, axis.width));
|
|
4750
|
+
const [lx, ly] = polar(cx, cy, radius + 10, angle(i));
|
|
4751
|
+
const anchor = Math.abs(lx - cx) < 2 ? "middle" : lx > cx ? "start" : "end";
|
|
4752
|
+
if (model.appearance?.categoryAxis?.labelsVisible !== false)
|
|
4753
|
+
out.push(
|
|
4754
|
+
text(lx, ly + categorySize * 0.3, fit(c2, area.w / 4, categorySize), {
|
|
4755
|
+
anchor,
|
|
4756
|
+
...categoryAttrs
|
|
4757
|
+
})
|
|
4758
|
+
);
|
|
4759
|
+
});
|
|
4760
|
+
for (const s of model.series) {
|
|
4761
|
+
const points = s.values.slice(0, count).map((v, i) => polar(cx, cy, r(v ?? scale.min), angle(i))).map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
|
|
4762
|
+
out.push(
|
|
4763
|
+
`<polygon points="${points}" fill="none" stroke="${s.color}" stroke-width="2"${s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""}/>`
|
|
4764
|
+
);
|
|
4765
|
+
}
|
|
4766
|
+
return out.join("");
|
|
4767
|
+
}
|
|
4768
|
+
|
|
4769
|
+
// chart/render/chart-svg-text-metrics.ts
|
|
4770
|
+
var CHART_FONT_FAMILY = "Calibri, Carlito, Arial, sans-serif";
|
|
4771
|
+
function cssFont(attrs) {
|
|
4772
|
+
return `${attrs.italic ? "italic" : "normal"} ${attrs.weight ?? "normal"} ${attrs.size ?? 10}px ${attrs.family ?? CHART_FONT_FAMILY}`;
|
|
4773
|
+
}
|
|
4774
|
+
function chartFontMetrics(attrs, options) {
|
|
4775
|
+
const metrics = options.measureFont?.(cssFont(attrs));
|
|
4776
|
+
return metrics && Number.isFinite(metrics.ascent) && Number.isFinite(metrics.descent) && metrics.ascent >= 0 && metrics.descent >= 0 && metrics.ascent + metrics.descent > 0 ? metrics : void 0;
|
|
4777
|
+
}
|
|
4778
|
+
function chartTextWidth(content, attrs, options) {
|
|
4779
|
+
const width = options.measureText?.(content, cssFont(attrs));
|
|
4780
|
+
return width !== void 0 && Number.isFinite(width) && width >= 0 ? width : textWidth(content, attrs.size);
|
|
4781
|
+
}
|
|
4782
|
+
function fitChartText(content, maxWidth, attrs, options) {
|
|
4783
|
+
if (!options.measureText) return fit(content, maxWidth, attrs.size);
|
|
4784
|
+
if (chartTextWidth(content, attrs, options) <= maxWidth) return content;
|
|
4785
|
+
const points = [...content];
|
|
4786
|
+
let low = 0;
|
|
4787
|
+
let high = points.length;
|
|
4788
|
+
while (low < high) {
|
|
4789
|
+
const mid = Math.ceil((low + high) / 2);
|
|
4790
|
+
if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`, attrs, options) <= maxWidth) low = mid;
|
|
4791
|
+
else high = mid - 1;
|
|
4792
|
+
}
|
|
4793
|
+
return `${points.slice(0, low).join("")}\u2026`;
|
|
4794
|
+
}
|
|
4795
|
+
|
|
4796
|
+
// chart/render/chart-svg-legend.ts
|
|
4797
|
+
function chartLegendSvg(model, area, frame, options) {
|
|
4798
|
+
const automatic = [];
|
|
4799
|
+
const bounds = {};
|
|
4800
|
+
const reserved = automaticLegend(model, area, automatic, options, bounds);
|
|
4801
|
+
const plot = model.legendOverlay ? area : reserved;
|
|
4802
|
+
const box = bounds.box;
|
|
4803
|
+
if (!box) return { plot, markup: "", foreground: false };
|
|
4804
|
+
const manual = resolveManualLayoutRect(model.legendLayout, frame, {
|
|
4805
|
+
x: box.x,
|
|
4806
|
+
y: box.y,
|
|
4807
|
+
width: box.w,
|
|
4808
|
+
height: box.h
|
|
4809
|
+
});
|
|
4810
|
+
if (!manual) return { plot, markup: automatic.join(""), foreground: !!model.legendOverlay };
|
|
4811
|
+
const entries = legendEntries(model);
|
|
4812
|
+
const attrs = chartTextAttributes(model, "legend");
|
|
4813
|
+
const size = attrs.size ?? 10;
|
|
4814
|
+
const font = chartFontMetrics(attrs, options);
|
|
4815
|
+
const keySize = size / 2;
|
|
4816
|
+
const keyGap = size / 4;
|
|
4817
|
+
const widths = entries.map(
|
|
4818
|
+
(entry3) => chartTextWidth(entry3.label, attrs, options) + keySize + keyGap
|
|
4819
|
+
);
|
|
4820
|
+
const horizontal = manual.width > manual.height && widths.reduce((sum, width) => sum + width, 0) + size <= manual.width;
|
|
4821
|
+
const rowWidth = horizontal ? manual.width / entries.length : manual.width;
|
|
4822
|
+
const rowHeight = horizontal ? manual.height : manual.height / entries.length;
|
|
4823
|
+
const horizontalGap = Math.max(
|
|
4824
|
+
0,
|
|
4825
|
+
(manual.width - widths.reduce((sum, width) => sum + width, 0)) / (entries.length + 1)
|
|
4826
|
+
);
|
|
4827
|
+
let horizontalX = manual.x + horizontalGap;
|
|
4828
|
+
const markup = [
|
|
4829
|
+
chartAreaRect(model, "legend", { x: manual.x, y: manual.y, w: manual.width, h: manual.height })
|
|
4830
|
+
];
|
|
4831
|
+
const baselineOffset = font ? (font.ascent - font.descent) / 2 : size * 0.35;
|
|
4832
|
+
entries.forEach((entry3, i) => {
|
|
4833
|
+
const available = horizontal ? chartTextWidth(entry3.label, attrs, options) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
|
|
4834
|
+
const label = fitChartText(entry3.label, available, attrs, options);
|
|
4835
|
+
const contentWidth = Math.min(
|
|
4836
|
+
horizontal ? widths[i] ?? 0 : Math.max(...widths),
|
|
4837
|
+
rowWidth - size / 2
|
|
4838
|
+
);
|
|
4839
|
+
const x = horizontal ? horizontalX : manual.x + Math.max(size / 4, (rowWidth - contentWidth) / 2);
|
|
4840
|
+
const centerY = manual.y + (horizontal ? 0 : i * rowHeight) + rowHeight / 2;
|
|
4841
|
+
markup.push(rect(x, centerY - keySize / 2, keySize, keySize, entry3.color));
|
|
4842
|
+
markup.push(text(x + keySize + keyGap, centerY + baselineOffset, label, attrs));
|
|
4843
|
+
if (horizontal) horizontalX += (widths[i] ?? 0) + horizontalGap;
|
|
4844
|
+
});
|
|
4845
|
+
return {
|
|
4846
|
+
plot,
|
|
4847
|
+
markup: `<g data-chart-legend-layout="true">${markup.join("")}</g>`,
|
|
4848
|
+
foreground: true
|
|
4849
|
+
};
|
|
4850
|
+
}
|
|
4851
|
+
function legendEntries(model) {
|
|
4852
|
+
if (model.type === "pie" || model.type === "doughnut") {
|
|
4853
|
+
const first2 = model.series[0];
|
|
4854
|
+
return model.categories.map((label, i) => ({
|
|
4855
|
+
label,
|
|
4856
|
+
color: first2?.pointColors?.[i] ?? first2?.color ?? "#4472C4"
|
|
4857
|
+
}));
|
|
4858
|
+
}
|
|
4859
|
+
return model.series.map((s) => ({ label: s.name, color: s.color }));
|
|
4860
|
+
}
|
|
4861
|
+
function automaticLegend(model, area, out, options, bounds) {
|
|
4862
|
+
const entries = legendEntries(model);
|
|
4863
|
+
if (!model.showLegend || entries.length === 0) return area;
|
|
4864
|
+
const pos = model.legendPosition;
|
|
4865
|
+
const attrs = chartTextAttributes(model, "legend");
|
|
4866
|
+
const size = attrs.size ?? 10;
|
|
4867
|
+
const rowH = Math.max(16, size * 1.4);
|
|
4868
|
+
if (pos === "t" || pos === "b") {
|
|
4869
|
+
const widths = entries.map(
|
|
4870
|
+
(e) => Math.min(chartTextWidth(e.label, attrs, options) + 20, area.w / 2)
|
|
4871
|
+
);
|
|
4872
|
+
const total = widths.reduce((a2, b) => a2 + b, 0);
|
|
4873
|
+
let x2 = area.x + Math.max(0, (area.w - total) / 2);
|
|
4874
|
+
const y = pos === "t" ? area.y + 4 : area.y + area.h - rowH + 4;
|
|
4875
|
+
bounds.box = { x: x2 - 4, y: y - 4, w: Math.min(total, area.w) + 8, h: rowH + 4 };
|
|
4876
|
+
out.push(
|
|
4877
|
+
chartAreaRect(model, "legend", {
|
|
4878
|
+
x: x2 - 4,
|
|
4879
|
+
y: y - 4,
|
|
4880
|
+
w: Math.min(total, area.w) + 8,
|
|
4881
|
+
h: rowH + 4
|
|
4882
|
+
})
|
|
4883
|
+
);
|
|
4884
|
+
entries.forEach((e, i) => {
|
|
4885
|
+
const w = widths[i] ?? 0;
|
|
4886
|
+
out.push(rect(x2, y, 8, 8, e.color));
|
|
4887
|
+
out.push(text(x2 + 12, y + 8, fitChartText(e.label, w - 16, attrs, options), attrs));
|
|
4888
|
+
x2 += w;
|
|
4889
|
+
});
|
|
4890
|
+
return pos === "t" ? { x: area.x, y: area.y + rowH + 4, w: area.w, h: area.h - rowH - 4 } : { x: area.x, y: area.y, w: area.w, h: area.h - rowH - 4 };
|
|
4891
|
+
}
|
|
4892
|
+
const width = Math.min(
|
|
4893
|
+
area.w * 0.35,
|
|
4894
|
+
Math.max(...entries.map((e) => chartTextWidth(e.label, attrs, options))) + 22
|
|
4895
|
+
);
|
|
4896
|
+
const height = entries.length * rowH;
|
|
4897
|
+
const x = pos === "l" ? area.x + 4 : area.x + area.w - width;
|
|
4898
|
+
const y0 = pos === "tr" ? area.y + 4 : area.y + Math.max(0, (area.h - height) / 2);
|
|
4899
|
+
bounds.box = { x: x - 4, y: y0, w: width + 4, h: Math.min(height, area.y + area.h - y0) };
|
|
4900
|
+
out.push(
|
|
4901
|
+
chartAreaRect(model, "legend", {
|
|
4902
|
+
x: x - 4,
|
|
4903
|
+
y: y0,
|
|
4904
|
+
w: width + 4,
|
|
4905
|
+
h: Math.min(height, area.y + area.h - y0)
|
|
4906
|
+
})
|
|
4907
|
+
);
|
|
4908
|
+
entries.forEach((e, i) => {
|
|
4909
|
+
const y = y0 + i * rowH;
|
|
4910
|
+
if (y + rowH > area.y + area.h + 2) return;
|
|
4911
|
+
out.push(rect(x, y + 3, 8, 8, e.color));
|
|
4912
|
+
out.push(text(x + 12, y + 11, fitChartText(e.label, width - 16, attrs, options), attrs));
|
|
4913
|
+
});
|
|
4914
|
+
return pos === "l" ? { x: area.x + width + 8, y: area.y, w: area.w - width - 8, h: area.h } : { x: area.x, y: area.y, w: area.w - width - 8, h: area.h };
|
|
4915
|
+
}
|
|
4916
|
+
|
|
4917
|
+
// text/wrap-styled-runs.ts
|
|
4918
|
+
var graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
4919
|
+
function wrapStyledRuns(runs, maxWidth, measure, options = {}) {
|
|
4920
|
+
const groups = [];
|
|
4921
|
+
for (const [source, run2] of runs.entries()) {
|
|
4922
|
+
for (const token of run2.text.split(/(\r\n|[\r\n]|[ \t]+)/u).filter(Boolean)) {
|
|
4923
|
+
const kind = /^[\r\n]+$/u.test(token) ? "break" : /^[ \t]+$/u.test(token) ? "space" : "word";
|
|
4924
|
+
let group = groups.at(-1);
|
|
4925
|
+
if (!group || group.kind !== kind || kind === "break") {
|
|
4926
|
+
group = { kind, pieces: [] };
|
|
4927
|
+
groups.push(group);
|
|
4928
|
+
}
|
|
4929
|
+
if (kind !== "break") group.pieces.push({ run: run2, source, text: token });
|
|
4930
|
+
}
|
|
4931
|
+
}
|
|
4932
|
+
const merged = (left, right) => {
|
|
4933
|
+
const result2 = left.map((piece) => ({ ...piece }));
|
|
4934
|
+
for (const piece of right) {
|
|
4935
|
+
const last = result2.at(-1);
|
|
4936
|
+
if (last?.source === piece.source) last.text += piece.text;
|
|
4937
|
+
else result2.push({ ...piece });
|
|
4938
|
+
}
|
|
4939
|
+
return result2;
|
|
4940
|
+
};
|
|
4941
|
+
const width = (pieces) => pieces.reduce((sum, piece) => {
|
|
4942
|
+
const advance = measure(piece.text, piece.run);
|
|
4943
|
+
return sum + (Number.isFinite(advance) && advance >= 0 ? advance : 0);
|
|
4944
|
+
}, 0);
|
|
4945
|
+
const result = [];
|
|
4946
|
+
let line2 = [];
|
|
4947
|
+
let spaces = [];
|
|
4948
|
+
const flush = () => {
|
|
4949
|
+
result.push(line2.map((piece) => ({ ...piece.run, text: piece.text })));
|
|
4950
|
+
line2 = [];
|
|
4951
|
+
spaces = [];
|
|
4952
|
+
};
|
|
4953
|
+
for (const group of groups) {
|
|
4954
|
+
if (group.kind === "break") {
|
|
4955
|
+
flush();
|
|
4956
|
+
continue;
|
|
4957
|
+
}
|
|
4958
|
+
if (group.kind === "space") {
|
|
4959
|
+
spaces = group.pieces;
|
|
4960
|
+
continue;
|
|
4961
|
+
}
|
|
4962
|
+
const separator = line2.length ? spaces : [];
|
|
4963
|
+
const wordWidth = width(group.pieces);
|
|
4964
|
+
if (line2.length && width(merged(line2, [...separator, ...group.pieces])) > maxWidth) flush();
|
|
4965
|
+
else line2 = merged(line2, separator);
|
|
4966
|
+
spaces = [];
|
|
4967
|
+
if (options.breakWords && wordWidth > maxWidth) {
|
|
4968
|
+
for (const piece of group.pieces) {
|
|
4969
|
+
for (const { segment } of graphemes.segment(piece.text)) {
|
|
4970
|
+
const next = { ...piece, text: segment };
|
|
4971
|
+
if (line2.length && width(merged(line2, [next])) > maxWidth) flush();
|
|
4972
|
+
line2 = merged(line2, [next]);
|
|
4973
|
+
}
|
|
4974
|
+
}
|
|
4975
|
+
} else line2 = merged(line2, group.pieces);
|
|
4976
|
+
}
|
|
4977
|
+
flush();
|
|
4978
|
+
return result;
|
|
4979
|
+
}
|
|
4980
|
+
|
|
4981
|
+
// chart/render/chart-svg-title-text.ts
|
|
4982
|
+
function spacing2(value, naturalHeight, fallback) {
|
|
4983
|
+
return value ? value.unit === "points" ? chartPointsToPixels(value.value) : naturalHeight * value.value : fallback;
|
|
4984
|
+
}
|
|
4985
|
+
function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
|
|
4986
|
+
if (!model.title) return void 0;
|
|
4987
|
+
const base = chartTextAttributes(model, "title", 14);
|
|
4988
|
+
const capacity = Math.max(1, width * 0.8 - 8);
|
|
4989
|
+
if (!model.titleText && !hasManualLayoutFields(model.titleLayout) && !model.titleOverlay && !model.title.includes("\n") && chartTextWidth(model.title, base, options) <= capacity)
|
|
4990
|
+
return void 0;
|
|
4991
|
+
const paragraphs = model.titleText?.paragraphs ?? [
|
|
4992
|
+
{
|
|
4993
|
+
runs: [{ text: model.title, appearance: model.appearance?.title ?? {} }]
|
|
4994
|
+
}
|
|
4995
|
+
];
|
|
4996
|
+
const hardLines = [];
|
|
4997
|
+
for (const paragraph2 of paragraphs) {
|
|
4998
|
+
let line2 = {
|
|
4999
|
+
...paragraph2,
|
|
5000
|
+
runs: []
|
|
5001
|
+
};
|
|
5002
|
+
hardLines.push(line2);
|
|
5003
|
+
for (const run2 of paragraph2.runs) {
|
|
5004
|
+
const pieces = run2.text.split("\n");
|
|
5005
|
+
for (const [index, piece] of pieces.entries()) {
|
|
5006
|
+
if (index) {
|
|
5007
|
+
line2 = { ...paragraph2, runs: [] };
|
|
5008
|
+
hardLines.push(line2);
|
|
5009
|
+
}
|
|
5010
|
+
if (piece) line2.runs.push({ ...run2, text: piece });
|
|
5011
|
+
}
|
|
5012
|
+
}
|
|
5013
|
+
}
|
|
5014
|
+
const lines = hardLines.flatMap((line2) => {
|
|
5015
|
+
const wrapped = wrapStyledRuns(
|
|
5016
|
+
line2.runs,
|
|
5017
|
+
capacity,
|
|
5018
|
+
(content, run2) => chartTextWidth(
|
|
5019
|
+
content,
|
|
5020
|
+
chartTextAttributes(
|
|
5021
|
+
{ ...model, appearance: { title: run2.appearance } },
|
|
5022
|
+
"title",
|
|
5023
|
+
base.size
|
|
5024
|
+
),
|
|
5025
|
+
options
|
|
5026
|
+
),
|
|
5027
|
+
{ breakWords: true }
|
|
5028
|
+
);
|
|
5029
|
+
const { spaceBefore, spaceAfter, ...properties2 } = line2;
|
|
5030
|
+
return wrapped.map((runs, index) => ({
|
|
5031
|
+
...properties2,
|
|
5032
|
+
runs,
|
|
5033
|
+
...index === 0 && spaceBefore ? { spaceBefore } : {},
|
|
5034
|
+
...index === wrapped.length - 1 && spaceAfter ? { spaceAfter } : {}
|
|
5035
|
+
}));
|
|
5036
|
+
});
|
|
5037
|
+
const metrics = lines.map((line2) => {
|
|
5038
|
+
const runs = line2.runs.map((run2) => ({
|
|
5039
|
+
...run2,
|
|
5040
|
+
attrs: chartTextAttributes(
|
|
5041
|
+
{ ...model, appearance: { title: run2.appearance } },
|
|
5042
|
+
"title",
|
|
5043
|
+
base.size
|
|
5044
|
+
)
|
|
5045
|
+
}));
|
|
5046
|
+
return {
|
|
5047
|
+
...line2,
|
|
5048
|
+
runs,
|
|
5049
|
+
width: runs.reduce((sum, run2) => sum + chartTextWidth(run2.text, run2.attrs, options), 0),
|
|
5050
|
+
size: runs.length ? Math.max(...runs.map((run2) => run2.attrs.size ?? 14)) : base.size ?? 14,
|
|
5051
|
+
fontMetrics: (runs.length ? runs.map((run2) => run2.attrs) : [base]).map(
|
|
5052
|
+
(attrs) => chartFontMetrics(attrs, options)
|
|
5053
|
+
)
|
|
5054
|
+
};
|
|
5055
|
+
});
|
|
5056
|
+
const measured = metrics.every((line2) => line2.fontMetrics.every((font) => font !== void 0));
|
|
5057
|
+
const vertical = metrics.map((line2) => {
|
|
5058
|
+
const ascent = measured ? Math.max(...line2.fontMetrics.map((font) => font.ascent)) : line2.size;
|
|
5059
|
+
const descent = measured ? Math.max(...line2.fontMetrics.map((font) => font.descent)) : line2.size * 0.4 + 4;
|
|
5060
|
+
const natural = ascent + descent;
|
|
5061
|
+
const height2 = spacing2(line2.lineSpacing, natural, natural);
|
|
5062
|
+
const leading = (height2 - natural) / 2;
|
|
5063
|
+
return {
|
|
5064
|
+
ascent: ascent + leading,
|
|
5065
|
+
descent: descent + leading,
|
|
5066
|
+
height: height2,
|
|
5067
|
+
before: spacing2(line2.spaceBefore, natural, 0),
|
|
5068
|
+
after: spacing2(line2.spaceAfter, natural, 0),
|
|
5069
|
+
leading
|
|
5070
|
+
};
|
|
5071
|
+
});
|
|
5072
|
+
const boxWidth = Math.min(width - 16, Math.max(0, ...metrics.map((line2) => line2.width)) + 8);
|
|
5073
|
+
const height = vertical.reduce(
|
|
5074
|
+
(sum, line2) => sum + line2.height + line2.before + line2.after,
|
|
5075
|
+
measured ? 4 : 0
|
|
5076
|
+
);
|
|
5077
|
+
let baseline = 8 + (metrics[0]?.size ?? base.size ?? 14) + (vertical[0]?.before ?? 0) + (vertical[0]?.leading ?? 0);
|
|
5078
|
+
const spans = [];
|
|
5079
|
+
for (const [index, line2] of metrics.entries()) {
|
|
5080
|
+
if (index)
|
|
5081
|
+
baseline += vertical[index - 1].descent + vertical[index - 1].after + vertical[index].before + vertical[index].ascent;
|
|
5082
|
+
let x = line2.align === "l" ? (width - boxWidth) / 2 + 4 : line2.align === "r" ? (width + boxWidth) / 2 - 4 - line2.width : (width - line2.width) / 2;
|
|
5083
|
+
for (const run2 of line2.runs) {
|
|
5084
|
+
spans.push(
|
|
5085
|
+
text(x, baseline, run2.text, {
|
|
5086
|
+
...run2.attrs,
|
|
5087
|
+
anchor: "start"
|
|
5088
|
+
}).replace("<text ", '<tspan data-chart-title-run="true" ').replace("</text>", "</tspan>")
|
|
5089
|
+
);
|
|
5090
|
+
x += chartTextWidth(run2.text, run2.attrs, options);
|
|
5091
|
+
}
|
|
5092
|
+
}
|
|
5093
|
+
const parent = text(0, 0, "", { ...base, underline: false }).replace(
|
|
5094
|
+
"</text>",
|
|
5095
|
+
`${spans.join("")}</text>`
|
|
5096
|
+
);
|
|
5097
|
+
const markup = chartAreaRect(model, "title", {
|
|
5098
|
+
x: (width - boxWidth) / 2,
|
|
5099
|
+
y: 4,
|
|
5100
|
+
w: Math.max(0, boxWidth),
|
|
5101
|
+
h: height
|
|
5102
|
+
}) + parent;
|
|
5103
|
+
const automatic = { x: (width - boxWidth) / 2, y: 4, width: boxWidth, height };
|
|
5104
|
+
const manual = resolveManualLayoutRect(
|
|
5105
|
+
model.titleLayout,
|
|
5106
|
+
{ width, height: frameHeight },
|
|
5107
|
+
automatic
|
|
5108
|
+
);
|
|
5109
|
+
return {
|
|
5110
|
+
markup: manual ? `<g data-chart-title-layout="true" transform="translate(${n(manual.x - automatic.x)} ${n(manual.y - automatic.y)})">${markup}</g>` : markup,
|
|
5111
|
+
height: Math.max(24, height)
|
|
5112
|
+
};
|
|
5113
|
+
}
|
|
5114
|
+
|
|
5115
|
+
// chart/render/chart-svg.ts
|
|
5116
|
+
function renderChartSvg(model, width, height, options = {}) {
|
|
5117
|
+
const paint = chartGradientPaint(model, Math.max(1, width), Math.max(1, height));
|
|
5118
|
+
model = paint.model;
|
|
5119
|
+
const w = Math.max(1, width);
|
|
5120
|
+
const h = Math.max(1, height);
|
|
5121
|
+
const out = [];
|
|
5122
|
+
let foregroundTitle = "";
|
|
5123
|
+
out.push(
|
|
5124
|
+
`<svg xmlns="http://www.w3.org/2000/svg" width="${n(w)}" height="${n(h)}" viewBox="0 0 ${n(w)} ${n(h)}" font-family="${esc(CHART_FONT_FAMILY)}" role="img">`
|
|
5125
|
+
);
|
|
5126
|
+
if (model.title) out.push(`<title>${esc(model.title)}</title>`);
|
|
5127
|
+
if (paint.defs) out.push(paint.defs);
|
|
5128
|
+
out.push(chartAreaRect(model, "chartArea", { x: 0, y: 0, w, h }));
|
|
5129
|
+
let area = { x: 8, y: 8, w: w - 16, h: h - 16 };
|
|
5130
|
+
const richTitle = chartRichTitleSvg(model, w, options, h);
|
|
5131
|
+
if (richTitle) {
|
|
5132
|
+
if (model.titleLayout || model.titleOverlay) foregroundTitle = richTitle.markup;
|
|
5133
|
+
else out.push(richTitle.markup);
|
|
5134
|
+
if (!model.titleOverlay)
|
|
5135
|
+
area = { ...area, y: area.y + richTitle.height, h: area.h - richTitle.height };
|
|
5136
|
+
} else if (model.title) {
|
|
5137
|
+
const attrs = chartTextAttributes(model, "title", 14);
|
|
5138
|
+
const size = attrs.size ?? 14;
|
|
5139
|
+
const label = fitChartText(model.title, w - 16, attrs, options);
|
|
5140
|
+
const titleWidth = Math.min(w - 16, chartTextWidth(label, attrs, options) + 8);
|
|
5141
|
+
const font = chartFontMetrics(attrs, options);
|
|
5142
|
+
const titleHeight = Math.max(24, font ? font.ascent + font.descent + 4 : size * 1.4 + 4);
|
|
5143
|
+
out.push(
|
|
5144
|
+
chartAreaRect(model, "title", {
|
|
5145
|
+
x: (w - titleWidth) / 2,
|
|
5146
|
+
y: 4,
|
|
5147
|
+
w: Math.max(0, titleWidth),
|
|
5148
|
+
h: font ? font.ascent + font.descent + 4 : size * 1.4 + 4
|
|
5149
|
+
})
|
|
5150
|
+
);
|
|
5151
|
+
out.push(
|
|
5152
|
+
text(w / 2, 8 + size, label, {
|
|
5153
|
+
anchor: "middle",
|
|
5154
|
+
fill: "#404040",
|
|
5155
|
+
...attrs
|
|
5156
|
+
})
|
|
5157
|
+
);
|
|
5158
|
+
if (!model.titleOverlay)
|
|
5159
|
+
area = { x: area.x, y: area.y + titleHeight, w: area.w, h: area.h - titleHeight };
|
|
5160
|
+
}
|
|
5161
|
+
if (!model.supported) {
|
|
5162
|
+
out.push(
|
|
5163
|
+
text(w / 2, area.y + area.h / 2, `${model.type} charts are not drawn`, { anchor: "middle" })
|
|
5164
|
+
);
|
|
5165
|
+
if (foregroundTitle) out.push(foregroundTitle);
|
|
5166
|
+
out.push("</svg>");
|
|
5167
|
+
return out.join("");
|
|
5168
|
+
}
|
|
5169
|
+
const legend = chartLegendSvg(model, area, { width: w, height: h }, options);
|
|
5170
|
+
area = legend.plot;
|
|
5171
|
+
if (!legend.foreground) out.push(legend.markup);
|
|
5172
|
+
if (area.w > 4 && area.h > 4) {
|
|
5173
|
+
if (model.type === "pie" || model.type === "doughnut") out.push(pieSvg(model, area));
|
|
5174
|
+
else if (model.type === "radar") out.push(radarSvg(model, area));
|
|
5175
|
+
else out.push(cartesianSvg(model, area));
|
|
5176
|
+
}
|
|
5177
|
+
if (legend.foreground) out.push(legend.markup);
|
|
5178
|
+
if (foregroundTitle) out.push(foregroundTitle);
|
|
5179
|
+
out.push("</svg>");
|
|
5180
|
+
return out.join("");
|
|
5181
|
+
}
|
|
5182
|
+
|
|
5183
|
+
// chart/render/render-space.ts
|
|
5184
|
+
var DRAWN_CHART_TYPES = /* @__PURE__ */ new Set([
|
|
5185
|
+
"bar",
|
|
5186
|
+
"column",
|
|
5187
|
+
"line",
|
|
5188
|
+
"area",
|
|
5189
|
+
"pie",
|
|
5190
|
+
"doughnut",
|
|
5191
|
+
"scatter",
|
|
5192
|
+
"radar"
|
|
5193
|
+
]);
|
|
5194
|
+
function chartThemePalette(theme, fonts = {}) {
|
|
5195
|
+
return {
|
|
5196
|
+
colors: THEME_SLOTS.map(
|
|
5197
|
+
(slot, index) => themeSlotHex(theme?.colors[slot]) ?? DEFAULT_THEME_COLORS[index] ?? "000000"
|
|
5198
|
+
),
|
|
5199
|
+
majorFont: fonts.major ?? "Calibri Light",
|
|
5200
|
+
minorFont: fonts.minor ?? "Calibri"
|
|
5201
|
+
};
|
|
5202
|
+
}
|
|
5203
|
+
function chartSpaceKind(space) {
|
|
5204
|
+
if (!space.plotArea.groups.length) return { drawn: false };
|
|
5205
|
+
const type = chartSummaryFromSpace(space).chartType;
|
|
5206
|
+
return { type, drawn: DRAWN_CHART_TYPES.has(type) };
|
|
5207
|
+
}
|
|
5208
|
+
function renderChartSpaceSvg(space, options) {
|
|
5209
|
+
const { width, height, theme, fonts, formatting, colorPalette, styleDefinition, ...svg } = options;
|
|
5210
|
+
const summary = chartSummaryFromSpace(space, {
|
|
5211
|
+
...formatting ? { formatting } : {},
|
|
5212
|
+
...colorPalette !== void 0 ? { colorPalette } : {},
|
|
5213
|
+
...styleDefinition ? { styleDefinition } : {}
|
|
5214
|
+
});
|
|
5215
|
+
const view = chartSummaryView(summary, chartThemePalette(theme, fonts));
|
|
5216
|
+
return renderChartSvg(view, width, height, svg);
|
|
5217
|
+
}
|
|
5218
|
+
|
|
2314
5219
|
exports.BEST_FIT_EDGE_TOLERANCE = BEST_FIT_EDGE_TOLERANCE;
|
|
2315
5220
|
exports.BEST_FIT_OUTSIDE_GAP = BEST_FIT_OUTSIDE_GAP;
|
|
2316
5221
|
exports.BEST_FIT_RIM_INSET = BEST_FIT_RIM_INSET;
|
|
@@ -2318,20 +5223,34 @@ exports.CHART_COLOR_PALETTES = CHART_COLOR_PALETTES;
|
|
|
2318
5223
|
exports.CHART_COLOR_STYLE_CONTENT_TYPE = CHART_COLOR_STYLE_CONTENT_TYPE;
|
|
2319
5224
|
exports.CHART_COLOR_STYLE_NS = CHART_COLOR_STYLE_NS;
|
|
2320
5225
|
exports.CHART_COLOR_STYLE_REL = CHART_COLOR_STYLE_REL;
|
|
5226
|
+
exports.CHART_GROUP_ELEMENTS = CHART_GROUP_ELEMENTS;
|
|
2321
5227
|
exports.CHART_STYLE_PARTS = CHART_STYLE_PARTS;
|
|
5228
|
+
exports.DEFAULT_THEME_COLORS = DEFAULT_THEME_COLORS;
|
|
5229
|
+
exports.DRAWN_CHART_TYPES = DRAWN_CHART_TYPES;
|
|
2322
5230
|
exports.LABEL_COLLISION_GAP = LABEL_COLLISION_GAP;
|
|
5231
|
+
exports.THEME_SLOTS = THEME_SLOTS;
|
|
2323
5232
|
exports.aggregateByCategory = aggregateByCategory;
|
|
2324
5233
|
exports.assertBarClusterOptions = assertBarClusterOptions;
|
|
5234
|
+
exports.autoSeriesColor = autoSeriesColor;
|
|
2325
5235
|
exports.axisTargetIntervals = axisTargetIntervals;
|
|
2326
5236
|
exports.buildChartGradientDef = buildChartGradientDef;
|
|
2327
5237
|
exports.builtInChartStyleXml = builtInChartStyleXml;
|
|
2328
5238
|
exports.builtInChartTextStyle = builtInChartTextStyle;
|
|
5239
|
+
exports.categoryTotals = categoryTotals;
|
|
5240
|
+
exports.chartCacheValues = chartCacheValues;
|
|
5241
|
+
exports.chartColorScheme = chartColorScheme;
|
|
2329
5242
|
exports.chartColorStyleId = chartColorStyleId;
|
|
2330
5243
|
exports.chartColorStyleXml = chartColorStyleXml;
|
|
2331
5244
|
exports.chartGradientMarkup = chartGradientMarkup;
|
|
2332
5245
|
exports.chartPaletteColors = chartPaletteColors;
|
|
2333
5246
|
exports.chartPaletteSeriesColor = chartPaletteSeriesColor;
|
|
2334
5247
|
exports.chartPaletteSeriesColorChoice = chartPaletteSeriesColorChoice;
|
|
5248
|
+
exports.chartSourceValues = chartSourceValues;
|
|
5249
|
+
exports.chartSpaceKind = chartSpaceKind;
|
|
5250
|
+
exports.chartSummaryFromSpace = chartSummaryFromSpace;
|
|
5251
|
+
exports.chartSummarySeries = chartSummarySeries;
|
|
5252
|
+
exports.chartSummaryView = chartSummaryView;
|
|
5253
|
+
exports.chartThemePalette = chartThemePalette;
|
|
2335
5254
|
exports.clusteredBarGeometry = clusteredBarGeometry;
|
|
2336
5255
|
exports.computeBoxStats = computeBoxStats;
|
|
2337
5256
|
exports.computeHistogramBins = computeHistogramBins;
|
|
@@ -2350,9 +5269,11 @@ exports.formatPowerEquation = formatPowerEquation;
|
|
|
2350
5269
|
exports.formatTrendlineCoefficient = formatTrendlineCoefficient;
|
|
2351
5270
|
exports.groupRowsByCategory = groupRowsByCategory;
|
|
2352
5271
|
exports.hasManualLayoutFields = hasManualLayoutFields;
|
|
5272
|
+
exports.modulateLuminance = modulateLuminance;
|
|
2353
5273
|
exports.niceAxisStep = niceAxisStep;
|
|
2354
5274
|
exports.niceValueAxisBounds = niceValueAxisBounds;
|
|
2355
5275
|
exports.nudgeOutsideLabels = nudgeOutsideLabels;
|
|
5276
|
+
exports.parseChartSpace = parseChartSpace;
|
|
2356
5277
|
exports.placeBestFitLabel = placeBestFitLabel;
|
|
2357
5278
|
exports.radarAngle = radarAngle;
|
|
2358
5279
|
exports.radarRingPoints = radarRingPoints;
|
|
@@ -2360,7 +5281,10 @@ exports.readBuiltInChartStyle = readBuiltInChartStyle;
|
|
|
2360
5281
|
exports.readChartFormatting = readChartFormatting;
|
|
2361
5282
|
exports.readChartManualLayoutValues = readChartManualLayoutValues;
|
|
2362
5283
|
exports.readChartStyle = readChartStyle;
|
|
5284
|
+
exports.readDisplayNaAsBlank = readDisplayNaAsBlank;
|
|
2363
5285
|
exports.removeGradientStop = removeGradientStop;
|
|
5286
|
+
exports.renderChartSpaceSvg = renderChartSpaceSvg;
|
|
5287
|
+
exports.renderChartSvg = renderChartSvg;
|
|
2364
5288
|
exports.resolveBlankDisplay = resolveBlankDisplay;
|
|
2365
5289
|
exports.resolveChartGradient = resolveChartGradient;
|
|
2366
5290
|
exports.resolveChartStyleDefinition = resolveChartStyleDefinition;
|
|
@@ -2368,6 +5292,7 @@ exports.resolveManualLayoutRect = resolveManualLayoutRect;
|
|
|
2368
5292
|
exports.scottBinCount = scottBinCount;
|
|
2369
5293
|
exports.sortGradientStops = sortGradientStops;
|
|
2370
5294
|
exports.squarify = squarify;
|
|
5295
|
+
exports.themeColor = themeColor;
|
|
2371
5296
|
exports.updateGradientStop = updateGradientStop;
|
|
2372
5297
|
exports.visibleRuns = visibleRuns;
|
|
2373
5298
|
exports.withChartGradientDirection = withChartGradientDirection;
|
|
@@ -2375,3 +5300,4 @@ exports.withinLinearTransform = withinLinearTransform;
|
|
|
2375
5300
|
exports.writeChartAxisFormatting = writeChartAxisFormatting;
|
|
2376
5301
|
exports.writeChartFillFormatting = writeChartFillFormatting;
|
|
2377
5302
|
exports.writeChartLayoutFormatting = writeChartLayoutFormatting;
|
|
5303
|
+
exports.writeChartSpace = writeChartSpace;
|