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
|
@@ -5,7 +5,9 @@ var xmldom = require('@xmldom/xmldom');
|
|
|
5
5
|
// xml/namespaces.ts
|
|
6
6
|
var NS = {
|
|
7
7
|
/** WordprocessingML main. */
|
|
8
|
-
w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
|
|
8
|
+
w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
|
|
9
|
+
/** DrawingML main. */
|
|
10
|
+
a: "http://schemas.openxmlformats.org/drawingml/2006/main"};
|
|
9
11
|
function parseXml(xml, options = {}) {
|
|
10
12
|
const label = options.label ?? "OOXML";
|
|
11
13
|
if (/<!DOCTYPE|<!ENTITY/i.test(xml))
|
|
@@ -103,6 +105,10 @@ var eighthPoints = (value) => integer("eighthPoints", value);
|
|
|
103
105
|
var roundSignedTwips = (value) => integer("twips", roundAway("twips", value));
|
|
104
106
|
var twipsToPixels = (value) => value / 15;
|
|
105
107
|
|
|
108
|
+
// units/constants.ts
|
|
109
|
+
var EMU_PER_PIXEL = 9525;
|
|
110
|
+
var EMU_PER_POINT = 12700;
|
|
111
|
+
|
|
106
112
|
// docx/simple-types.ts
|
|
107
113
|
function parseOnOff(value) {
|
|
108
114
|
switch (value) {
|
|
@@ -144,8 +150,8 @@ function universalMeasureToTwips(value) {
|
|
|
144
150
|
}
|
|
145
151
|
function parseSignedTwips(value) {
|
|
146
152
|
if (value === null || value === void 0) return void 0;
|
|
147
|
-
const
|
|
148
|
-
const parsed = SAFE_INTEGER.test(
|
|
153
|
+
const text2 = value.trim();
|
|
154
|
+
const parsed = SAFE_INTEGER.test(text2) ? parseInteger(text2) : universalMeasureToTwips(text2);
|
|
149
155
|
return parsed === void 0 ? void 0 : signedTwips(parsed);
|
|
150
156
|
}
|
|
151
157
|
function parseTwips(value) {
|
|
@@ -154,26 +160,26 @@ function parseTwips(value) {
|
|
|
154
160
|
}
|
|
155
161
|
function parseHalfPoints(value) {
|
|
156
162
|
if (value === null || value === void 0) return void 0;
|
|
157
|
-
const
|
|
158
|
-
if (/^\d+$/.test(
|
|
159
|
-
const parsed = parseInteger(
|
|
163
|
+
const text2 = value.trim();
|
|
164
|
+
if (/^\d+$/.test(text2)) {
|
|
165
|
+
const parsed = parseInteger(text2);
|
|
160
166
|
return parsed === void 0 ? void 0 : halfPoints(parsed);
|
|
161
167
|
}
|
|
162
|
-
const asTwips = UNIVERSAL_MEASURE.test(
|
|
168
|
+
const asTwips = UNIVERSAL_MEASURE.test(text2) ? universalMeasureToTwips(text2) : void 0;
|
|
163
169
|
return asTwips !== void 0 && asTwips >= 0 ? halfPoints(Math.round(asTwips / 10)) : void 0;
|
|
164
170
|
}
|
|
165
171
|
function parseSignedHalfPoints(value) {
|
|
166
172
|
if (value === null || value === void 0) return void 0;
|
|
167
|
-
const
|
|
168
|
-
const integer2 = parseInteger(
|
|
173
|
+
const text2 = value.trim();
|
|
174
|
+
const integer2 = parseInteger(text2);
|
|
169
175
|
if (integer2 !== void 0) return halfPoints(integer2);
|
|
170
|
-
const twips2 = universalMeasureToTwips(
|
|
176
|
+
const twips2 = universalMeasureToTwips(text2);
|
|
171
177
|
return twips2 === void 0 ? void 0 : halfPoints(Math.sign(twips2) * Math.round(Math.abs(twips2) / 10));
|
|
172
178
|
}
|
|
173
179
|
function parseTextScale(value) {
|
|
174
|
-
const
|
|
175
|
-
if (
|
|
176
|
-
const parsed = parseUnsignedInteger(
|
|
180
|
+
const text2 = value?.trim();
|
|
181
|
+
if (text2?.endsWith("%") && !/^\d+%$/.test(text2)) return void 0;
|
|
182
|
+
const parsed = parseUnsignedInteger(text2?.endsWith("%") ? text2.slice(0, -1) : text2);
|
|
177
183
|
return parsed !== void 0 && parsed <= 600 ? parsed : void 0;
|
|
178
184
|
}
|
|
179
185
|
function parseEighthPoints(value) {
|
|
@@ -332,16 +338,16 @@ function parseRunProperties(props) {
|
|
|
332
338
|
const color = first2(props, "color");
|
|
333
339
|
const hex = parseRgbColor(getW(color, "val"));
|
|
334
340
|
if (hex) result.color = hex;
|
|
335
|
-
const
|
|
336
|
-
if (
|
|
337
|
-
result.colorTheme = { token:
|
|
341
|
+
const themeColor2 = enumValue(isStThemeColor, getW(color, "themeColor"));
|
|
342
|
+
if (themeColor2) {
|
|
343
|
+
result.colorTheme = { token: themeColor2 };
|
|
338
344
|
const tint = parseTintShade(getW(color, "themeTint"));
|
|
339
345
|
const shade = parseTintShade(getW(color, "themeShade"));
|
|
340
346
|
if (tint !== void 0) result.colorTheme.tint = tint;
|
|
341
347
|
if (shade !== void 0) result.colorTheme.shade = shade;
|
|
342
348
|
}
|
|
343
|
-
const
|
|
344
|
-
if (
|
|
349
|
+
const spacing2 = parseSignedTwips(getW(first2(props, "spacing"), "val"));
|
|
350
|
+
if (spacing2 !== void 0) result.characterSpacingTwips = spacing2;
|
|
345
351
|
const scaleElement = first2(props, "w");
|
|
346
352
|
const scale = scaleElement ? parseTextScale(getW(scaleElement, "val") ?? "100") : void 0;
|
|
347
353
|
if (scale !== void 0) result.textScalePercent = scale;
|
|
@@ -369,13 +375,13 @@ function borderSide(element) {
|
|
|
369
375
|
const style = enumValue(isStBorder, getW(element, "val"));
|
|
370
376
|
const size = parseEighthPoints(getW(element, "sz"));
|
|
371
377
|
const color = parseRgbColor(getW(element, "color"));
|
|
372
|
-
const
|
|
373
|
-
if (!style && size === void 0 && !color && !
|
|
378
|
+
const themeColor2 = enumValue(isStThemeColor, getW(element, "themeColor"));
|
|
379
|
+
if (!style && size === void 0 && !color && !themeColor2) return void 0;
|
|
374
380
|
const side = {};
|
|
375
381
|
if (style) side.style = style;
|
|
376
382
|
if (size !== void 0) side.sizeEighthPoints = size;
|
|
377
383
|
if (color) side.color = color;
|
|
378
|
-
if (
|
|
384
|
+
if (themeColor2) side.themeColor = themeColor2;
|
|
379
385
|
return side;
|
|
380
386
|
}
|
|
381
387
|
function parseShadingFill(shd) {
|
|
@@ -693,9 +699,119 @@ function resolveRunFormatting(run, context = {}) {
|
|
|
693
699
|
function clampUnitInterval(value) {
|
|
694
700
|
return Math.min(1, Math.max(0, value));
|
|
695
701
|
}
|
|
702
|
+
function hexToRgbChannels(color) {
|
|
703
|
+
const normalized = color.replace("#", "");
|
|
704
|
+
if (!/^[0-9a-fA-F]{6}$/.test(normalized)) {
|
|
705
|
+
return null;
|
|
706
|
+
}
|
|
707
|
+
return {
|
|
708
|
+
r: Number.parseInt(normalized.slice(0, 2), 16),
|
|
709
|
+
g: Number.parseInt(normalized.slice(2, 4), 16),
|
|
710
|
+
b: Number.parseInt(normalized.slice(4, 6), 16)
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
function percentDivisorFor(text2) {
|
|
714
|
+
return text2.endsWith("%") ? 100 : 1e5;
|
|
715
|
+
}
|
|
716
|
+
function parseOoxmlPercent(value) {
|
|
717
|
+
const text2 = String(value ?? "").trim();
|
|
718
|
+
const divisor = percentDivisorFor(text2);
|
|
719
|
+
const magnitude = Number.parseFloat(divisor === 100 ? text2.slice(0, -1) : text2);
|
|
720
|
+
if (!Number.isFinite(magnitude)) {
|
|
721
|
+
return void 0;
|
|
722
|
+
}
|
|
723
|
+
return magnitude / divisor;
|
|
724
|
+
}
|
|
725
|
+
function parseDrawingPercent(value) {
|
|
726
|
+
const parsed = parseOoxmlPercent(value);
|
|
727
|
+
return parsed === void 0 ? void 0 : clampUnitInterval(parsed);
|
|
728
|
+
}
|
|
729
|
+
function scrgbLinearToSrgb8(linear) {
|
|
730
|
+
const l = Math.min(1, Math.max(0, linear));
|
|
731
|
+
const companded = l <= 31308e-7 ? 12.92 * l : 1.055 * l ** (1 / 2.4) - 0.055;
|
|
732
|
+
return Math.min(255, Math.max(0, Math.round(companded * 255)));
|
|
733
|
+
}
|
|
696
734
|
function toHex(value) {
|
|
697
735
|
return Math.min(255, Math.max(0, Math.round(value))).toString(16).padStart(2, "0").toUpperCase();
|
|
698
736
|
}
|
|
737
|
+
function rgbToHsl(r, g, b) {
|
|
738
|
+
const rN = r / 255;
|
|
739
|
+
const gN = g / 255;
|
|
740
|
+
const bN = b / 255;
|
|
741
|
+
const cMax = Math.max(rN, gN, bN);
|
|
742
|
+
const cMin = Math.min(rN, gN, bN);
|
|
743
|
+
const delta = cMax - cMin;
|
|
744
|
+
const l = (cMax + cMin) / 2;
|
|
745
|
+
let s = 0;
|
|
746
|
+
if (delta !== 0) {
|
|
747
|
+
s = delta / (1 - Math.abs(2 * l - 1));
|
|
748
|
+
}
|
|
749
|
+
let h = 0;
|
|
750
|
+
if (delta !== 0) {
|
|
751
|
+
if (cMax === rN) {
|
|
752
|
+
h = 60 * ((gN - bN) / delta % 6);
|
|
753
|
+
} else if (cMax === gN) {
|
|
754
|
+
h = 60 * ((bN - rN) / delta + 2);
|
|
755
|
+
} else {
|
|
756
|
+
h = 60 * ((rN - gN) / delta + 4);
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
if (h < 0) {
|
|
760
|
+
h += 360;
|
|
761
|
+
}
|
|
762
|
+
return { h, s: clampUnitInterval(s), l: clampUnitInterval(l) };
|
|
763
|
+
}
|
|
764
|
+
function hslToRgb(h, s, l, roundChannel = Math.round, options) {
|
|
765
|
+
const sC = options?.clampSaturation === false ? s : clampUnitInterval(s);
|
|
766
|
+
const lC = clampUnitInterval(l);
|
|
767
|
+
const hN = (h % 360 + 360) % 360;
|
|
768
|
+
const c = (1 - Math.abs(2 * lC - 1)) * sC;
|
|
769
|
+
const x = c * (1 - Math.abs(hN / 60 % 2 - 1));
|
|
770
|
+
const m = lC - c / 2;
|
|
771
|
+
let rP = 0;
|
|
772
|
+
let gP = 0;
|
|
773
|
+
let bP = 0;
|
|
774
|
+
if (hN < 60) {
|
|
775
|
+
rP = c;
|
|
776
|
+
gP = x;
|
|
777
|
+
bP = 0;
|
|
778
|
+
} else if (hN < 120) {
|
|
779
|
+
rP = x;
|
|
780
|
+
gP = c;
|
|
781
|
+
bP = 0;
|
|
782
|
+
} else if (hN < 180) {
|
|
783
|
+
rP = 0;
|
|
784
|
+
gP = c;
|
|
785
|
+
bP = x;
|
|
786
|
+
} else if (hN < 240) {
|
|
787
|
+
rP = 0;
|
|
788
|
+
gP = x;
|
|
789
|
+
bP = c;
|
|
790
|
+
} else if (hN < 300) {
|
|
791
|
+
rP = x;
|
|
792
|
+
gP = 0;
|
|
793
|
+
bP = c;
|
|
794
|
+
} else {
|
|
795
|
+
rP = c;
|
|
796
|
+
gP = 0;
|
|
797
|
+
bP = x;
|
|
798
|
+
}
|
|
799
|
+
return {
|
|
800
|
+
r: roundChannel((rP + m) * 255),
|
|
801
|
+
g: roundChannel((gP + m) * 255),
|
|
802
|
+
b: roundChannel((bP + m) * 255)
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
function parseDrawingFraction(value) {
|
|
806
|
+
return parseOoxmlPercent(value);
|
|
807
|
+
}
|
|
808
|
+
function parseDrawingHueDegrees(value) {
|
|
809
|
+
const parsed = Number.parseFloat(String(value ?? "").trim());
|
|
810
|
+
if (!Number.isFinite(parsed)) {
|
|
811
|
+
return void 0;
|
|
812
|
+
}
|
|
813
|
+
return parsed / 6e4;
|
|
814
|
+
}
|
|
699
815
|
|
|
700
816
|
// color/color-linear.ts
|
|
701
817
|
function srgb255ToLinear(channel) {
|
|
@@ -707,6 +823,508 @@ function linearToSrgb255(linear) {
|
|
|
707
823
|
return 255 * (c <= 31308e-7 ? c * 12.92 : 1.055 * c ** (1 / 2.4) - 0.055);
|
|
708
824
|
}
|
|
709
825
|
|
|
826
|
+
// color/native-gradient-curve.ts
|
|
827
|
+
var OFFICE_SIGMA_FACTORS = [
|
|
828
|
+
0,
|
|
829
|
+
59,
|
|
830
|
+
120,
|
|
831
|
+
182,
|
|
832
|
+
247,
|
|
833
|
+
314,
|
|
834
|
+
383,
|
|
835
|
+
454,
|
|
836
|
+
527,
|
|
837
|
+
602,
|
|
838
|
+
680,
|
|
839
|
+
759,
|
|
840
|
+
841,
|
|
841
|
+
926,
|
|
842
|
+
1013,
|
|
843
|
+
1102,
|
|
844
|
+
1194,
|
|
845
|
+
1288,
|
|
846
|
+
1385,
|
|
847
|
+
1485,
|
|
848
|
+
1587,
|
|
849
|
+
1692,
|
|
850
|
+
1800,
|
|
851
|
+
1911,
|
|
852
|
+
2024,
|
|
853
|
+
2141,
|
|
854
|
+
2260,
|
|
855
|
+
2383,
|
|
856
|
+
2508,
|
|
857
|
+
2637,
|
|
858
|
+
2769,
|
|
859
|
+
2904,
|
|
860
|
+
3042,
|
|
861
|
+
3183,
|
|
862
|
+
3328,
|
|
863
|
+
3477,
|
|
864
|
+
3628,
|
|
865
|
+
3783,
|
|
866
|
+
3942,
|
|
867
|
+
4104,
|
|
868
|
+
4270,
|
|
869
|
+
4439,
|
|
870
|
+
4612,
|
|
871
|
+
4789,
|
|
872
|
+
4969,
|
|
873
|
+
5153,
|
|
874
|
+
5341,
|
|
875
|
+
5533,
|
|
876
|
+
5728,
|
|
877
|
+
5928,
|
|
878
|
+
6131,
|
|
879
|
+
6338,
|
|
880
|
+
6549,
|
|
881
|
+
6764,
|
|
882
|
+
6983,
|
|
883
|
+
7206,
|
|
884
|
+
7434,
|
|
885
|
+
7665,
|
|
886
|
+
7900,
|
|
887
|
+
8139,
|
|
888
|
+
8382,
|
|
889
|
+
8630,
|
|
890
|
+
8881,
|
|
891
|
+
9136,
|
|
892
|
+
9396,
|
|
893
|
+
9660,
|
|
894
|
+
9927,
|
|
895
|
+
10199,
|
|
896
|
+
10475,
|
|
897
|
+
10755,
|
|
898
|
+
11039,
|
|
899
|
+
11327,
|
|
900
|
+
11619,
|
|
901
|
+
11916,
|
|
902
|
+
12216,
|
|
903
|
+
12520,
|
|
904
|
+
12828,
|
|
905
|
+
13140,
|
|
906
|
+
13456,
|
|
907
|
+
13776,
|
|
908
|
+
14099,
|
|
909
|
+
14427,
|
|
910
|
+
14758,
|
|
911
|
+
15093,
|
|
912
|
+
15431,
|
|
913
|
+
15774,
|
|
914
|
+
16119,
|
|
915
|
+
16469,
|
|
916
|
+
16822,
|
|
917
|
+
17178,
|
|
918
|
+
17538,
|
|
919
|
+
17901,
|
|
920
|
+
18267,
|
|
921
|
+
18637,
|
|
922
|
+
19009,
|
|
923
|
+
19385,
|
|
924
|
+
19764,
|
|
925
|
+
20146,
|
|
926
|
+
20530,
|
|
927
|
+
20918,
|
|
928
|
+
21308,
|
|
929
|
+
21701,
|
|
930
|
+
22096,
|
|
931
|
+
22494,
|
|
932
|
+
22894,
|
|
933
|
+
23297,
|
|
934
|
+
23702,
|
|
935
|
+
24109,
|
|
936
|
+
24518,
|
|
937
|
+
24929,
|
|
938
|
+
25342,
|
|
939
|
+
25756,
|
|
940
|
+
26173,
|
|
941
|
+
26591,
|
|
942
|
+
27010,
|
|
943
|
+
27431,
|
|
944
|
+
27853,
|
|
945
|
+
28276,
|
|
946
|
+
28701,
|
|
947
|
+
29126,
|
|
948
|
+
29552,
|
|
949
|
+
29979,
|
|
950
|
+
30407,
|
|
951
|
+
30836,
|
|
952
|
+
31264,
|
|
953
|
+
31694,
|
|
954
|
+
32123,
|
|
955
|
+
32553,
|
|
956
|
+
32983,
|
|
957
|
+
33413,
|
|
958
|
+
33842,
|
|
959
|
+
34272,
|
|
960
|
+
34700,
|
|
961
|
+
35129,
|
|
962
|
+
35557,
|
|
963
|
+
35984,
|
|
964
|
+
36410,
|
|
965
|
+
36835,
|
|
966
|
+
37260,
|
|
967
|
+
37683,
|
|
968
|
+
38105,
|
|
969
|
+
38526,
|
|
970
|
+
38945,
|
|
971
|
+
39363,
|
|
972
|
+
39780,
|
|
973
|
+
40194,
|
|
974
|
+
40607,
|
|
975
|
+
41018,
|
|
976
|
+
41427,
|
|
977
|
+
41834,
|
|
978
|
+
42239,
|
|
979
|
+
42642,
|
|
980
|
+
43042,
|
|
981
|
+
43440,
|
|
982
|
+
43835,
|
|
983
|
+
44228,
|
|
984
|
+
44618,
|
|
985
|
+
45006,
|
|
986
|
+
45390,
|
|
987
|
+
45772,
|
|
988
|
+
46151,
|
|
989
|
+
46527,
|
|
990
|
+
46899,
|
|
991
|
+
47269,
|
|
992
|
+
47635,
|
|
993
|
+
47998,
|
|
994
|
+
48358,
|
|
995
|
+
48714,
|
|
996
|
+
49067,
|
|
997
|
+
49417,
|
|
998
|
+
49762,
|
|
999
|
+
50105,
|
|
1000
|
+
50443,
|
|
1001
|
+
50778,
|
|
1002
|
+
51109,
|
|
1003
|
+
51437,
|
|
1004
|
+
51760,
|
|
1005
|
+
52080,
|
|
1006
|
+
52396,
|
|
1007
|
+
52708,
|
|
1008
|
+
53016,
|
|
1009
|
+
53320,
|
|
1010
|
+
53620,
|
|
1011
|
+
53917,
|
|
1012
|
+
54209,
|
|
1013
|
+
54497,
|
|
1014
|
+
54781,
|
|
1015
|
+
55061,
|
|
1016
|
+
55337,
|
|
1017
|
+
55609,
|
|
1018
|
+
55876,
|
|
1019
|
+
56140,
|
|
1020
|
+
56400,
|
|
1021
|
+
56655,
|
|
1022
|
+
56906,
|
|
1023
|
+
57154,
|
|
1024
|
+
57397,
|
|
1025
|
+
57636,
|
|
1026
|
+
57871,
|
|
1027
|
+
58102,
|
|
1028
|
+
58330,
|
|
1029
|
+
58553,
|
|
1030
|
+
58772,
|
|
1031
|
+
58987,
|
|
1032
|
+
59198,
|
|
1033
|
+
59405,
|
|
1034
|
+
59608,
|
|
1035
|
+
59808,
|
|
1036
|
+
60003,
|
|
1037
|
+
60195,
|
|
1038
|
+
60383,
|
|
1039
|
+
60567,
|
|
1040
|
+
60747,
|
|
1041
|
+
60924,
|
|
1042
|
+
61097,
|
|
1043
|
+
61266,
|
|
1044
|
+
61432,
|
|
1045
|
+
61594,
|
|
1046
|
+
61753,
|
|
1047
|
+
61908,
|
|
1048
|
+
62059,
|
|
1049
|
+
62208,
|
|
1050
|
+
62353,
|
|
1051
|
+
62494,
|
|
1052
|
+
62632,
|
|
1053
|
+
62767,
|
|
1054
|
+
62899,
|
|
1055
|
+
63028,
|
|
1056
|
+
63153,
|
|
1057
|
+
63276,
|
|
1058
|
+
63395,
|
|
1059
|
+
63512,
|
|
1060
|
+
63625,
|
|
1061
|
+
63736,
|
|
1062
|
+
63844,
|
|
1063
|
+
63949,
|
|
1064
|
+
64051,
|
|
1065
|
+
64151,
|
|
1066
|
+
64248,
|
|
1067
|
+
64342,
|
|
1068
|
+
64434,
|
|
1069
|
+
64523,
|
|
1070
|
+
64610,
|
|
1071
|
+
64695,
|
|
1072
|
+
64777,
|
|
1073
|
+
64856,
|
|
1074
|
+
64934,
|
|
1075
|
+
65009,
|
|
1076
|
+
65082,
|
|
1077
|
+
65153,
|
|
1078
|
+
65222,
|
|
1079
|
+
65289,
|
|
1080
|
+
65354,
|
|
1081
|
+
65416,
|
|
1082
|
+
65477,
|
|
1083
|
+
65536
|
|
1084
|
+
];
|
|
1085
|
+
|
|
1086
|
+
// color/sigma-gradient-stops.ts
|
|
1087
|
+
function sigmaGradientStops(stops) {
|
|
1088
|
+
if (stops.length !== 2 || stops[0]?.offset !== 0 || stops[1]?.offset !== 1) return void 0;
|
|
1089
|
+
if (stops.some((stop) => (stop.opacity ?? 1) !== 1)) return void 0;
|
|
1090
|
+
const front = hexToRgbChannels(stops[0].color);
|
|
1091
|
+
const back = hexToRgbChannels(stops[1].color);
|
|
1092
|
+
if (!front || !back) return void 0;
|
|
1093
|
+
return OFFICE_SIGMA_FACTORS.map((value, index) => {
|
|
1094
|
+
const factor = value / 65536;
|
|
1095
|
+
const mix = (a, b) => toHex(255 * ((a / 255) ** 2.2 * (1 - factor) + (b / 255) ** 2.2 * factor) ** (1 / 2.2));
|
|
1096
|
+
return {
|
|
1097
|
+
offset: Math.fround(index / 255),
|
|
1098
|
+
color: `#${mix(front.r, back.r)}${mix(front.g, back.g)}${mix(front.b, back.b)}`,
|
|
1099
|
+
opacity: 1
|
|
1100
|
+
};
|
|
1101
|
+
});
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
// color/hex-rgb.ts
|
|
1105
|
+
function parseArgbHex(hex) {
|
|
1106
|
+
const clean2 = hex.replace(/^#/, "");
|
|
1107
|
+
const rgb = clean2.length === 8 ? clean2.slice(2) : clean2;
|
|
1108
|
+
if (!/^[0-9a-fA-F]{6}$/.test(rgb)) return void 0;
|
|
1109
|
+
return [0, 2, 4].map((i) => parseInt(rgb.slice(i, i + 2), 16));
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
// drawingml/ordered-color-transforms.ts
|
|
1113
|
+
function orderedColorTransforms(channels, transforms) {
|
|
1114
|
+
let { r, g, b } = channels;
|
|
1115
|
+
let alpha = 1;
|
|
1116
|
+
const wrap = (value) => (value % 360 + 360) % 360;
|
|
1117
|
+
for (const transform of transforms) {
|
|
1118
|
+
const { name, value } = transform;
|
|
1119
|
+
const fraction = parseDrawingFraction(value);
|
|
1120
|
+
if (name === "alpha" && fraction !== void 0) alpha = clampUnitInterval(fraction);
|
|
1121
|
+
else if (name === "alphaMod" && fraction !== void 0)
|
|
1122
|
+
alpha = clampUnitInterval(alpha * fraction);
|
|
1123
|
+
else if (name === "alphaOff" && fraction !== void 0)
|
|
1124
|
+
alpha = clampUnitInterval(alpha + fraction);
|
|
1125
|
+
else if (name === "inv") [r, g, b] = [255 - r, 255 - g, 255 - b];
|
|
1126
|
+
else if (name === "gray") r = g = b = 0.299 * r + 0.587 * g + 0.114 * b;
|
|
1127
|
+
else if ((name === "shade" || name === "tint") && fraction !== void 0) {
|
|
1128
|
+
const mix = (channel) => linearToSrgb255(
|
|
1129
|
+
name === "shade" ? srgb255ToLinear(channel) * fraction : 1 - (1 - srgb255ToLinear(channel)) * fraction
|
|
1130
|
+
);
|
|
1131
|
+
[r, g, b] = [mix(r), mix(g), mix(b)];
|
|
1132
|
+
} else {
|
|
1133
|
+
const hsl = rgbToHsl(r, g, b);
|
|
1134
|
+
if (name === "comp") hsl.h = wrap(hsl.h + 180);
|
|
1135
|
+
else if (name === "hue") {
|
|
1136
|
+
const hue = parseDrawingHueDegrees(value);
|
|
1137
|
+
if (hue !== void 0) hsl.h = wrap(hue);
|
|
1138
|
+
} else if (name === "hueOff") {
|
|
1139
|
+
const hue = parseDrawingHueDegrees(value);
|
|
1140
|
+
if (hue !== void 0) hsl.h = wrap(hsl.h + hue);
|
|
1141
|
+
} else if (name === "hueMod" && fraction !== void 0) hsl.h = wrap(hsl.h * fraction);
|
|
1142
|
+
else if (name === "sat" && fraction !== void 0) hsl.s = clampUnitInterval(fraction);
|
|
1143
|
+
else if (name === "satMod" && fraction !== void 0) hsl.s *= fraction;
|
|
1144
|
+
else if (name === "satOff" && fraction !== void 0)
|
|
1145
|
+
hsl.s = clampUnitInterval(hsl.s + fraction);
|
|
1146
|
+
else if (name === "lum" && fraction !== void 0) hsl.l = clampUnitInterval(fraction);
|
|
1147
|
+
else if (name === "lumMod" && fraction !== void 0)
|
|
1148
|
+
hsl.l = clampUnitInterval(hsl.l * fraction);
|
|
1149
|
+
else if (name === "lumOff" && fraction !== void 0)
|
|
1150
|
+
hsl.l = clampUnitInterval(hsl.l + fraction);
|
|
1151
|
+
else continue;
|
|
1152
|
+
({ r, g, b } = hslToRgb(hsl.h, hsl.s, hsl.l, (channel) => channel, {
|
|
1153
|
+
clampSaturation: false
|
|
1154
|
+
}));
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
return { r, g, b, alpha };
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
// drawingml/drawing-color.ts
|
|
1161
|
+
var COLOR_ELEMENTS = {
|
|
1162
|
+
srgbClr: "srgb",
|
|
1163
|
+
schemeClr: "scheme",
|
|
1164
|
+
sysClr: "system",
|
|
1165
|
+
prstClr: "preset",
|
|
1166
|
+
scrgbClr: "scrgb",
|
|
1167
|
+
hslClr: "hsl"
|
|
1168
|
+
};
|
|
1169
|
+
function colorValue(kind, element) {
|
|
1170
|
+
const attribute = (name) => element.getAttribute(name) ?? "";
|
|
1171
|
+
if (kind === "scrgb") return `${attribute("r")},${attribute("g")},${attribute("b")}`;
|
|
1172
|
+
if (kind === "hsl") return `${attribute("hue")},${attribute("sat")},${attribute("lum")}`;
|
|
1173
|
+
return attribute("val");
|
|
1174
|
+
}
|
|
1175
|
+
function parseDrawingColorIn(container) {
|
|
1176
|
+
if (!container) return void 0;
|
|
1177
|
+
for (const element of elements(container)) {
|
|
1178
|
+
const kind = COLOR_ELEMENTS[element.localName];
|
|
1179
|
+
if (!kind || element.namespaceURI && element.namespaceURI !== NS.a) continue;
|
|
1180
|
+
return parseDrawingColor(element);
|
|
1181
|
+
}
|
|
1182
|
+
return void 0;
|
|
1183
|
+
}
|
|
1184
|
+
function parseDrawingColor(element) {
|
|
1185
|
+
const kind = COLOR_ELEMENTS[element.localName];
|
|
1186
|
+
if (!kind) return void 0;
|
|
1187
|
+
const color = {
|
|
1188
|
+
kind,
|
|
1189
|
+
value: colorValue(kind, element),
|
|
1190
|
+
transforms: elements(element).map((child) => ({
|
|
1191
|
+
name: child.localName,
|
|
1192
|
+
value: child.getAttribute("val") ?? ""
|
|
1193
|
+
}))
|
|
1194
|
+
};
|
|
1195
|
+
const fallback = kind === "system" ? element.getAttribute("lastClr") : null;
|
|
1196
|
+
if (fallback) color.fallback = fallback;
|
|
1197
|
+
return color;
|
|
1198
|
+
}
|
|
1199
|
+
var PRESET_COLORS = {
|
|
1200
|
+
black: "#000000",
|
|
1201
|
+
white: "#FFFFFF",
|
|
1202
|
+
red: "#FF0000",
|
|
1203
|
+
green: "#008000",
|
|
1204
|
+
blue: "#0000FF",
|
|
1205
|
+
yellow: "#FFFF00",
|
|
1206
|
+
gray: "#808080",
|
|
1207
|
+
grey: "#808080"
|
|
1208
|
+
};
|
|
1209
|
+
function baseHex(color, theme) {
|
|
1210
|
+
switch (color.kind) {
|
|
1211
|
+
case "srgb":
|
|
1212
|
+
return /^[0-9a-f]{6}$/i.test(color.value) ? `#${color.value.toUpperCase()}` : void 0;
|
|
1213
|
+
case "scheme":
|
|
1214
|
+
return theme?.scheme(color.value);
|
|
1215
|
+
case "system":
|
|
1216
|
+
return color.fallback && /^[0-9a-f]{6}$/i.test(color.fallback) ? `#${color.fallback.toUpperCase()}` : void 0;
|
|
1217
|
+
case "preset":
|
|
1218
|
+
return PRESET_COLORS[color.value];
|
|
1219
|
+
case "scrgb": {
|
|
1220
|
+
const [r, g, b] = color.value.split(",").map((part) => parseDrawingFraction(part));
|
|
1221
|
+
if (r === void 0 || g === void 0 || b === void 0) return void 0;
|
|
1222
|
+
return `#${toHex(scrgbLinearToSrgb8(r))}${toHex(scrgbLinearToSrgb8(g))}${toHex(scrgbLinearToSrgb8(b))}`;
|
|
1223
|
+
}
|
|
1224
|
+
case "hsl": {
|
|
1225
|
+
const [h, s, l] = color.value.split(",");
|
|
1226
|
+
const hue = parseDrawingHueDegrees(h);
|
|
1227
|
+
const sat = parseDrawingFraction(s);
|
|
1228
|
+
const lum = parseDrawingFraction(l);
|
|
1229
|
+
if (hue === void 0 || sat === void 0 || lum === void 0) return void 0;
|
|
1230
|
+
const { r, g, b } = hslToRgb(hue, sat, lum);
|
|
1231
|
+
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
var APPLIED = /* @__PURE__ */ new Set([
|
|
1236
|
+
"alpha",
|
|
1237
|
+
"alphaMod",
|
|
1238
|
+
"alphaOff",
|
|
1239
|
+
"comp",
|
|
1240
|
+
"inv",
|
|
1241
|
+
"gray",
|
|
1242
|
+
"shade",
|
|
1243
|
+
"tint",
|
|
1244
|
+
"hue",
|
|
1245
|
+
"hueMod",
|
|
1246
|
+
"hueOff",
|
|
1247
|
+
"sat",
|
|
1248
|
+
"satMod",
|
|
1249
|
+
"satOff",
|
|
1250
|
+
"lum",
|
|
1251
|
+
"lumMod",
|
|
1252
|
+
"lumOff"
|
|
1253
|
+
]);
|
|
1254
|
+
function resolveDrawingColor(color, theme, options) {
|
|
1255
|
+
const base = baseHex(color, theme);
|
|
1256
|
+
const rgb = base ? hexToRgbChannels(base) : null;
|
|
1257
|
+
if (!rgb) return void 0;
|
|
1258
|
+
if (options?.transformOrder === "document") {
|
|
1259
|
+
const value = orderedColorTransforms(rgb, color.transforms);
|
|
1260
|
+
const round = options.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
|
|
1261
|
+
return {
|
|
1262
|
+
hex: `#${toHex(round(value.r))}${toHex(round(value.g))}${toHex(round(value.b))}`,
|
|
1263
|
+
alpha: value.alpha,
|
|
1264
|
+
unapplied: [...new Set(color.transforms.map((transform) => transform.name))].filter(
|
|
1265
|
+
(name) => !APPLIED.has(name)
|
|
1266
|
+
)
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
let { r, g, b } = rgb;
|
|
1270
|
+
const find = (name) => color.transforms.find((entry) => entry.name === name)?.value;
|
|
1271
|
+
const has = (name) => color.transforms.some((entry) => entry.name === name);
|
|
1272
|
+
if (has("comp")) {
|
|
1273
|
+
const hsl = rgbToHsl(r, g, b);
|
|
1274
|
+
({ r, g, b } = hslToRgb((hsl.h + 180) % 360, hsl.s, hsl.l));
|
|
1275
|
+
}
|
|
1276
|
+
if (has("inv")) [r, g, b] = [255 - r, 255 - g, 255 - b];
|
|
1277
|
+
if (has("gray")) r = g = b = Math.round(0.299 * r + 0.587 * g + 0.114 * b);
|
|
1278
|
+
const shade = parseDrawingPercent(find("shade"));
|
|
1279
|
+
if (shade !== void 0) {
|
|
1280
|
+
r = linearToSrgb255(srgb255ToLinear(r) * shade);
|
|
1281
|
+
g = linearToSrgb255(srgb255ToLinear(g) * shade);
|
|
1282
|
+
b = linearToSrgb255(srgb255ToLinear(b) * shade);
|
|
1283
|
+
}
|
|
1284
|
+
const tint = parseDrawingPercent(find("tint"));
|
|
1285
|
+
if (tint !== void 0) {
|
|
1286
|
+
r = linearToSrgb255(1 - (1 - srgb255ToLinear(r)) * tint);
|
|
1287
|
+
g = linearToSrgb255(1 - (1 - srgb255ToLinear(g)) * tint);
|
|
1288
|
+
b = linearToSrgb255(1 - (1 - srgb255ToLinear(b)) * tint);
|
|
1289
|
+
}
|
|
1290
|
+
if (["hue", "hueMod", "hueOff", "sat", "satMod", "satOff", "lum", "lumMod", "lumOff"].some(has)) {
|
|
1291
|
+
const hsl = rgbToHsl(r, g, b);
|
|
1292
|
+
const wrap = (degrees) => (degrees % 360 + 360) % 360;
|
|
1293
|
+
const hueAbs = parseDrawingHueDegrees(find("hue"));
|
|
1294
|
+
if (hueAbs !== void 0) hsl.h = wrap(hueAbs);
|
|
1295
|
+
const hueMod = parseDrawingFraction(find("hueMod"));
|
|
1296
|
+
if (hueMod !== void 0) hsl.h = wrap(hsl.h * hueMod);
|
|
1297
|
+
const hueOff = parseDrawingHueDegrees(find("hueOff"));
|
|
1298
|
+
if (hueOff !== void 0) hsl.h = wrap(hsl.h + hueOff);
|
|
1299
|
+
const satAbs = parseDrawingFraction(find("sat"));
|
|
1300
|
+
if (satAbs !== void 0) hsl.s = clampUnitInterval(satAbs);
|
|
1301
|
+
const satMod = parseDrawingFraction(find("satMod"));
|
|
1302
|
+
if (satMod !== void 0) hsl.s = clampUnitInterval(hsl.s * satMod);
|
|
1303
|
+
const satOff = parseDrawingFraction(find("satOff"));
|
|
1304
|
+
if (satOff !== void 0) hsl.s = clampUnitInterval(hsl.s + satOff);
|
|
1305
|
+
const lumAbs = parseDrawingFraction(find("lum"));
|
|
1306
|
+
if (lumAbs !== void 0) hsl.l = clampUnitInterval(lumAbs);
|
|
1307
|
+
const lumMod = parseDrawingFraction(find("lumMod"));
|
|
1308
|
+
if (lumMod !== void 0) hsl.l = clampUnitInterval(hsl.l * lumMod);
|
|
1309
|
+
const lumOff = parseDrawingFraction(find("lumOff"));
|
|
1310
|
+
if (lumOff !== void 0) hsl.l = clampUnitInterval(hsl.l + lumOff);
|
|
1311
|
+
const round = options?.hslRounding === "halfDown" ? (value) => Math.ceil(value - 0.5) : Math.round;
|
|
1312
|
+
({ r, g, b } = hslToRgb(hsl.h, hsl.s, hsl.l, round));
|
|
1313
|
+
}
|
|
1314
|
+
let alpha = parseDrawingPercent(find("alpha")) ?? 1;
|
|
1315
|
+
const alphaMod = parseDrawingFraction(find("alphaMod"));
|
|
1316
|
+
if (alphaMod !== void 0) alpha = clampUnitInterval(alpha * alphaMod);
|
|
1317
|
+
const alphaOff = parseDrawingFraction(find("alphaOff"));
|
|
1318
|
+
if (alphaOff !== void 0) alpha = clampUnitInterval(alpha + alphaOff);
|
|
1319
|
+
return {
|
|
1320
|
+
hex: `#${toHex(r)}${toHex(g)}${toHex(b)}`,
|
|
1321
|
+
alpha,
|
|
1322
|
+
unapplied: [...new Set(color.transforms.map((entry) => entry.name))].filter(
|
|
1323
|
+
(name) => !APPLIED.has(name)
|
|
1324
|
+
)
|
|
1325
|
+
};
|
|
1326
|
+
}
|
|
1327
|
+
|
|
710
1328
|
// drawingml/theme-model.ts
|
|
711
1329
|
var DEFAULT_THEME_COLOR_MAP = {
|
|
712
1330
|
bg1: "lt1",
|
|
@@ -715,6 +1333,13 @@ var DEFAULT_THEME_COLOR_MAP = {
|
|
|
715
1333
|
tx2: "dk2"
|
|
716
1334
|
};
|
|
717
1335
|
|
|
1336
|
+
// drawingml/theme-color.ts
|
|
1337
|
+
function themeSlotHex(color) {
|
|
1338
|
+
if (!color) return void 0;
|
|
1339
|
+
const value = color.kind === "srgb" ? color.value : color.kind === "system" ? color.fallback : void 0;
|
|
1340
|
+
return value ? value.toUpperCase() : void 0;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
718
1343
|
// docx/theme-color.ts
|
|
719
1344
|
function isThemeColorToken(value) {
|
|
720
1345
|
return isStThemeColor(value);
|
|
@@ -778,6 +1403,11 @@ function resolveThemeColorReference(ref, theme) {
|
|
|
778
1403
|
return hex;
|
|
779
1404
|
}
|
|
780
1405
|
|
|
1406
|
+
// opc/signature/xml-utils.ts
|
|
1407
|
+
function escapeXmlAttr(value) {
|
|
1408
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1409
|
+
}
|
|
1410
|
+
|
|
781
1411
|
// docx/expect-defined.ts
|
|
782
1412
|
function expectDefined(value, context) {
|
|
783
1413
|
if (value === void 0 || value === null) {
|
|
@@ -935,10 +1565,10 @@ function hasUnexpectedAttributes(element, allowed, allowDateUtc = false) {
|
|
|
935
1565
|
}
|
|
936
1566
|
return false;
|
|
937
1567
|
}
|
|
938
|
-
function runPropertiesHaveUnknownContent(
|
|
939
|
-
if (!
|
|
940
|
-
if (hasUnexpectedAttributes(
|
|
941
|
-
for (const node of Array.from(
|
|
1568
|
+
function runPropertiesHaveUnknownContent(properties2) {
|
|
1569
|
+
if (!properties2) return false;
|
|
1570
|
+
if (hasUnexpectedAttributes(properties2, [])) return true;
|
|
1571
|
+
for (const node of Array.from(properties2.childNodes)) {
|
|
942
1572
|
if (node.nodeType !== 1) {
|
|
943
1573
|
if (node.nodeType === 3 && node.textContent?.trim()) return true;
|
|
944
1574
|
continue;
|
|
@@ -1003,6 +1633,1928 @@ function definedProps(source) {
|
|
|
1003
1633
|
return Object.fromEntries(Object.entries(source).filter(([, value]) => value !== void 0));
|
|
1004
1634
|
}
|
|
1005
1635
|
|
|
1636
|
+
// drawingml/drawing-color-css.ts
|
|
1637
|
+
function drawingColorCss(value) {
|
|
1638
|
+
if (!value || value.alpha === 1) return value?.hex;
|
|
1639
|
+
const channels = [1, 3, 5].map(
|
|
1640
|
+
(offset) => Number.parseInt(value.hex.slice(offset, offset + 2), 16)
|
|
1641
|
+
);
|
|
1642
|
+
return `rgba(${channels.join(",")},${value.alpha})`;
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
// drawingml/drawing-shadow.ts
|
|
1646
|
+
function resolveDrawingShadow(effects, theme) {
|
|
1647
|
+
const node = first(effects, "outerShdw", NS.a);
|
|
1648
|
+
if (!node) return void 0;
|
|
1649
|
+
const value = (key, fallback) => Number(node.getAttribute(key) ?? fallback);
|
|
1650
|
+
if (value("sx", 1e5) !== 1e5 || value("sy", 1e5) !== 1e5 || value("kx", 0) !== 0 || value("ky", 0) !== 0)
|
|
1651
|
+
return void 0;
|
|
1652
|
+
const color = parseDrawingColorIn(node);
|
|
1653
|
+
const resolved = color && resolveDrawingColor(color, theme, { transformOrder: "document" });
|
|
1654
|
+
const blur = value("blurRad", 0) / EMU_PER_PIXEL;
|
|
1655
|
+
const distance = value("dist", 0) / EMU_PER_PIXEL;
|
|
1656
|
+
const angle = value("dir", 0) / 6e4 * Math.PI / 180;
|
|
1657
|
+
if (!resolved || ![blur, distance, angle].every(Number.isFinite) || blur < 0 || distance < 0)
|
|
1658
|
+
return void 0;
|
|
1659
|
+
return {
|
|
1660
|
+
color: resolved.hex,
|
|
1661
|
+
opacity: resolved.alpha,
|
|
1662
|
+
blur,
|
|
1663
|
+
dx: Math.cos(angle) * distance,
|
|
1664
|
+
dy: Math.sin(angle) * distance
|
|
1665
|
+
};
|
|
1666
|
+
}
|
|
1667
|
+
function resolveDrawingShadowXml(xml, theme) {
|
|
1668
|
+
return xml ? resolveDrawingShadow(parseXml(xml).documentElement, theme) : void 0;
|
|
1669
|
+
}
|
|
1670
|
+
function svgDropShadowElement(s, format) {
|
|
1671
|
+
const num = format.number;
|
|
1672
|
+
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"/>`;
|
|
1673
|
+
}
|
|
1674
|
+
function hexToRgb2(color) {
|
|
1675
|
+
const parsed = hexToRgbChannels(color);
|
|
1676
|
+
if (parsed) return parsed;
|
|
1677
|
+
const hex = color.replace("#", "");
|
|
1678
|
+
return {
|
|
1679
|
+
r: Number.parseInt(hex.slice(0, 2), 16) || 0,
|
|
1680
|
+
g: Number.parseInt(hex.slice(2, 4), 16) || 0,
|
|
1681
|
+
b: Number.parseInt(hex.slice(4, 6), 16) || 0
|
|
1682
|
+
};
|
|
1683
|
+
}
|
|
1684
|
+
function toHexChannel(value) {
|
|
1685
|
+
return toHex(value).toLowerCase();
|
|
1686
|
+
}
|
|
1687
|
+
function lerpStops(a, b, t) {
|
|
1688
|
+
const ca = hexToRgb2(a.color);
|
|
1689
|
+
const cb = hexToRgb2(b.color);
|
|
1690
|
+
const oa = a.opacity ?? 1;
|
|
1691
|
+
const ob = b.opacity ?? 1;
|
|
1692
|
+
return {
|
|
1693
|
+
color: `#${toHexChannel(ca.r + (cb.r - ca.r) * t)}${toHexChannel(ca.g + (cb.g - ca.g) * t)}${toHexChannel(ca.b + (cb.b - ca.b) * t)}`,
|
|
1694
|
+
opacity: oa + (ob - oa) * t
|
|
1695
|
+
};
|
|
1696
|
+
}
|
|
1697
|
+
function colorAt(stops, position) {
|
|
1698
|
+
const first3 = stops[0];
|
|
1699
|
+
const last = stops[stops.length - 1];
|
|
1700
|
+
if (position <= first3.position) {
|
|
1701
|
+
return { color: first3.color, opacity: first3.opacity ?? 1 };
|
|
1702
|
+
}
|
|
1703
|
+
if (position >= last.position) {
|
|
1704
|
+
return { color: last.color, opacity: last.opacity ?? 1 };
|
|
1705
|
+
}
|
|
1706
|
+
for (let i = 0; i < stops.length - 1; i += 1) {
|
|
1707
|
+
const from = stops[i];
|
|
1708
|
+
const to = stops[i + 1];
|
|
1709
|
+
if (position >= from.position && position <= to.position) {
|
|
1710
|
+
const span = to.position - from.position;
|
|
1711
|
+
const t = span > 0 ? (position - from.position) / span : 0;
|
|
1712
|
+
return lerpStops(from, to, t);
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
return { color: last.color, opacity: last.opacity ?? 1 };
|
|
1716
|
+
}
|
|
1717
|
+
function resolveInnerRect(fillToRect, focalPoint) {
|
|
1718
|
+
let centerX = 50;
|
|
1719
|
+
let centerY = 50;
|
|
1720
|
+
let width = 0;
|
|
1721
|
+
let height = 0;
|
|
1722
|
+
if (fillToRect) {
|
|
1723
|
+
const { l, t, r, b } = fillToRect;
|
|
1724
|
+
centerX = (l + (1 - r)) / 2 * 100;
|
|
1725
|
+
centerY = (t + (1 - b)) / 2 * 100;
|
|
1726
|
+
width = Math.max(0, Math.min(1, 1 - l - r)) * 100;
|
|
1727
|
+
height = Math.max(0, Math.min(1, 1 - t - b)) * 100;
|
|
1728
|
+
}
|
|
1729
|
+
return {
|
|
1730
|
+
left: centerX - width / 2,
|
|
1731
|
+
top: centerY - height / 2,
|
|
1732
|
+
right: centerX + width / 2,
|
|
1733
|
+
bottom: centerY + height / 2
|
|
1734
|
+
};
|
|
1735
|
+
}
|
|
1736
|
+
function lerpEdge(inner, outer, t) {
|
|
1737
|
+
return inner + (outer - inner) * t;
|
|
1738
|
+
}
|
|
1739
|
+
function buildRectPathGradientSvg(stops, focalPoint, fillToRect, options) {
|
|
1740
|
+
if (stops.length === 0) {
|
|
1741
|
+
return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"/>';
|
|
1742
|
+
}
|
|
1743
|
+
const sorted = [...stops].sort((a, b) => a.position - b.position);
|
|
1744
|
+
const inner = resolveInnerRect(fillToRect);
|
|
1745
|
+
const rects = [];
|
|
1746
|
+
const alphaRects = [];
|
|
1747
|
+
const masked = sorted.some((stop) => (stop.opacity ?? 1) < 1);
|
|
1748
|
+
const bands = options?.bands;
|
|
1749
|
+
if (!Number.isInteger(bands) || bands < 1) throw new RangeError("Invalid gradient band count");
|
|
1750
|
+
for (let i = bands; i >= 0; i -= 1) {
|
|
1751
|
+
const t = i / bands;
|
|
1752
|
+
const { color, opacity } = colorAt(sorted, t * 100);
|
|
1753
|
+
const left = lerpEdge(inner.left, 0, t);
|
|
1754
|
+
const top = lerpEdge(inner.top, 0, t);
|
|
1755
|
+
const right = lerpEdge(inner.right, 100, t);
|
|
1756
|
+
const bottom = lerpEdge(inner.bottom, 100, t);
|
|
1757
|
+
const opacityAttr = !masked && opacity < 1 ? ` fill-opacity="${Math.max(0, opacity).toFixed(3)}"` : "";
|
|
1758
|
+
rects.push(
|
|
1759
|
+
`<rect x="${left.toFixed(2)}" y="${top.toFixed(2)}" width="${(right - left).toFixed(2)}" height="${(bottom - top).toFixed(2)}" fill="${color}"${opacityAttr}/>`
|
|
1760
|
+
);
|
|
1761
|
+
if (masked) {
|
|
1762
|
+
const channel = toHexChannel(opacity * 255);
|
|
1763
|
+
alphaRects.push(
|
|
1764
|
+
`<rect x="${left.toFixed(2)}" y="${top.toFixed(2)}" width="${(right - left).toFixed(2)}" height="${(bottom - top).toFixed(2)}" fill="#${channel}${channel}${channel}"/>`
|
|
1765
|
+
);
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
const paint = masked ? `<defs><mask id="alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="100" height="100" mask-type="luminance" color-interpolation="sRGB">${alphaRects.join("")}</mask></defs><g mask="url(#alpha)">${rects.join("")}</g>` : rects.join("");
|
|
1769
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none">${paint}</svg>`;
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
// chart/color-palettes.ts
|
|
1773
|
+
var COLORFUL_VARIATIONS = [
|
|
1774
|
+
{},
|
|
1775
|
+
{ lumMod: 6e4 },
|
|
1776
|
+
{ lumMod: 8e4, lumOff: 2e4 },
|
|
1777
|
+
{ lumMod: 8e4 },
|
|
1778
|
+
{ lumMod: 6e4, lumOff: 4e4 },
|
|
1779
|
+
{ lumMod: 5e4 },
|
|
1780
|
+
{ lumMod: 7e4, lumOff: 3e4 },
|
|
1781
|
+
{ lumMod: 7e4 },
|
|
1782
|
+
{ lumMod: 5e4, lumOff: 5e4 }
|
|
1783
|
+
];
|
|
1784
|
+
var GRAY_VARIATIONS = [
|
|
1785
|
+
{ tint: 88500 },
|
|
1786
|
+
{ tint: 55e3 },
|
|
1787
|
+
{ tint: 75e3 },
|
|
1788
|
+
{ tint: 98500 },
|
|
1789
|
+
{ tint: 3e4 },
|
|
1790
|
+
{ tint: 6e4 },
|
|
1791
|
+
{ tint: 8e4 }
|
|
1792
|
+
];
|
|
1793
|
+
var ACCENTS = ["accent1", "accent2", "accent3", "accent4", "accent5", "accent6"];
|
|
1794
|
+
function colorful(id, index, base) {
|
|
1795
|
+
return { id, group: "colorful", index, meth: "cycle", base, variations: COLORFUL_VARIATIONS };
|
|
1796
|
+
}
|
|
1797
|
+
function mono(id, index, accent, meth) {
|
|
1798
|
+
return { id, group: "monochromatic", index, meth, base: [accent], variations: [] };
|
|
1799
|
+
}
|
|
1800
|
+
var CHART_COLOR_PALETTES = [
|
|
1801
|
+
colorful(10, 1, ACCENTS),
|
|
1802
|
+
colorful(11, 2, ["accent1", "accent3", "accent5"]),
|
|
1803
|
+
colorful(12, 3, ["accent2", "accent4", "accent6"]),
|
|
1804
|
+
colorful(13, 4, ["accent6", "accent5", "accent4"]),
|
|
1805
|
+
...ACCENTS.map((accent, i) => mono(14 + i, 1 + i, accent, "withinLinear")),
|
|
1806
|
+
{
|
|
1807
|
+
id: 20,
|
|
1808
|
+
group: "monochromatic",
|
|
1809
|
+
index: 7,
|
|
1810
|
+
meth: "cycle",
|
|
1811
|
+
base: ["dk1"],
|
|
1812
|
+
variations: GRAY_VARIATIONS
|
|
1813
|
+
},
|
|
1814
|
+
...ACCENTS.map((accent, i) => mono(21 + i, 8 + i, accent, "withinLinearReversed"))
|
|
1815
|
+
];
|
|
1816
|
+
function findChartColorPalette(id) {
|
|
1817
|
+
return CHART_COLOR_PALETTES.find((palette) => palette.id === id);
|
|
1818
|
+
}
|
|
1819
|
+
function withinLinearTransform(i, n2) {
|
|
1820
|
+
if (n2 <= 1) {
|
|
1821
|
+
return {};
|
|
1822
|
+
}
|
|
1823
|
+
const step = 140 / (n2 + 1);
|
|
1824
|
+
const centre = (n2 - 1) / 2;
|
|
1825
|
+
const value = 100 - step * Math.abs(i - centre);
|
|
1826
|
+
if (i < centre) {
|
|
1827
|
+
return { shade: Math.floor(value + 1e-9) * 1e3 };
|
|
1828
|
+
}
|
|
1829
|
+
if (i > centre) {
|
|
1830
|
+
return { tint: Math.ceil(value - 1e-9) * 1e3 };
|
|
1831
|
+
}
|
|
1832
|
+
return {};
|
|
1833
|
+
}
|
|
1834
|
+
function chartPaletteSeriesColorChoice(palette, i, n2) {
|
|
1835
|
+
let base;
|
|
1836
|
+
let transform;
|
|
1837
|
+
if (palette.meth === "cycle") {
|
|
1838
|
+
base = palette.base[i % palette.base.length];
|
|
1839
|
+
const round = Math.floor(i / palette.base.length);
|
|
1840
|
+
transform = (palette.variations.length ? palette.variations[round % palette.variations.length] : {}) ?? {};
|
|
1841
|
+
} else {
|
|
1842
|
+
const index = palette.meth === "withinLinearReversed" ? n2 - 1 - i : i;
|
|
1843
|
+
base = palette.base[0];
|
|
1844
|
+
transform = withinLinearTransform(index, n2);
|
|
1845
|
+
}
|
|
1846
|
+
if (!base) throw new RangeError("A chart palette must have a base color");
|
|
1847
|
+
return {
|
|
1848
|
+
kind: "scheme",
|
|
1849
|
+
value: base,
|
|
1850
|
+
transforms: Object.entries(transform).map(([name, value]) => ({ name, value: String(value) }))
|
|
1851
|
+
};
|
|
1852
|
+
}
|
|
1853
|
+
function chartPaletteSeriesColor(palette, i, n2, scheme) {
|
|
1854
|
+
const choice = chartPaletteSeriesColorChoice(palette, i, n2);
|
|
1855
|
+
return (resolveDrawingColor(choice, { scheme: (name) => scheme[name] })?.hex ?? scheme[choice.value]).toUpperCase();
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1858
|
+
// chart/style-definition.ts
|
|
1859
|
+
var CHART_STYLE_PARTS = [
|
|
1860
|
+
"title",
|
|
1861
|
+
"axisTitle",
|
|
1862
|
+
"categoryAxis",
|
|
1863
|
+
"valueAxis",
|
|
1864
|
+
"legend",
|
|
1865
|
+
"dataLabel",
|
|
1866
|
+
"dataPoint",
|
|
1867
|
+
"dataPointLine",
|
|
1868
|
+
"gridlineMajor",
|
|
1869
|
+
"gridlineMinor",
|
|
1870
|
+
"chartArea",
|
|
1871
|
+
"plotArea"
|
|
1872
|
+
];
|
|
1873
|
+
function resolveChartStyleDefinition(style, resolve) {
|
|
1874
|
+
const out = {};
|
|
1875
|
+
const fillColor = (fill) => fill?.kind === "none" ? "none" : fill?.kind === "solid" ? resolve(fill.color) : void 0;
|
|
1876
|
+
for (const name of CHART_STYLE_PARTS) {
|
|
1877
|
+
const source = style.entries[name];
|
|
1878
|
+
if (!source) continue;
|
|
1879
|
+
const entry = {};
|
|
1880
|
+
for (const key of ["fontSize", "bold", "italic", "underline"]) {
|
|
1881
|
+
const value = source[key];
|
|
1882
|
+
if (value !== void 0) Object.assign(entry, { [key]: value });
|
|
1883
|
+
}
|
|
1884
|
+
const line2 = fillColor(source.line?.fill) ?? (source.lineRef?.color && resolve(source.lineRef.color));
|
|
1885
|
+
const fill = fillColor(source.fill) ?? (source.fillRef?.color && resolve(source.fillRef.color));
|
|
1886
|
+
const color = (source.textColor && resolve(source.textColor)) ?? (source.fontRef?.color && resolve(source.fontRef.color));
|
|
1887
|
+
if (color !== void 0) entry.color = color;
|
|
1888
|
+
if (line2 !== void 0) entry.lineColor = line2;
|
|
1889
|
+
if (fill !== void 0) entry.fillColor = fill;
|
|
1890
|
+
if (source.line?.widthEmu !== void 0 && source.line.widthEmu > 0)
|
|
1891
|
+
entry.lineWidth = source.line.widthEmu / 12700;
|
|
1892
|
+
if (Object.keys(entry).length) out[name] = entry;
|
|
1893
|
+
}
|
|
1894
|
+
return Object.keys(out).length ? out : void 0;
|
|
1895
|
+
}
|
|
1896
|
+
function effectiveBuiltInChartStyle(formatting) {
|
|
1897
|
+
return formatting?.builtInStyle ?? (formatting?.sourceXml ? void 0 : 102);
|
|
1898
|
+
}
|
|
1899
|
+
function builtInChartTextStyle(id) {
|
|
1900
|
+
if (id === void 0 || !Number.isInteger(id) || !(id >= 1 && id <= 48 || id >= 101 && id <= 148))
|
|
1901
|
+
return {};
|
|
1902
|
+
const legacy = id > 100 ? id - 100 : id;
|
|
1903
|
+
const common = {
|
|
1904
|
+
sourceXml: "",
|
|
1905
|
+
fontSize: 10,
|
|
1906
|
+
bold: false,
|
|
1907
|
+
italic: false,
|
|
1908
|
+
fontRef: {
|
|
1909
|
+
index: "minor",
|
|
1910
|
+
color: { kind: "scheme", value: legacy >= 41 ? "lt1" : "tx1", transforms: [] }
|
|
1911
|
+
}
|
|
1912
|
+
};
|
|
1913
|
+
return {
|
|
1914
|
+
title: { ...common, fontSize: id > 100 ? 18 : 10, bold: true },
|
|
1915
|
+
categoryAxis: { ...common },
|
|
1916
|
+
valueAxis: { ...common },
|
|
1917
|
+
legend: { ...common }
|
|
1918
|
+
};
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
// chart/manual-layout.ts
|
|
1922
|
+
function hasManualLayoutFields(layout) {
|
|
1923
|
+
return layout != null && (layout.x !== void 0 || layout.y !== void 0 || layout.width !== void 0 || layout.height !== void 0);
|
|
1924
|
+
}
|
|
1925
|
+
function resolveManualLayoutRect(layout, frame, auto) {
|
|
1926
|
+
if (!hasManualLayoutFields(layout)) return void 0;
|
|
1927
|
+
const x = layout.x === void 0 ? auto.x : layout.xMode === "edge" ? layout.x * frame.width : auto.x + layout.x * frame.width;
|
|
1928
|
+
const y = layout.y === void 0 ? auto.y : layout.yMode === "edge" ? layout.y * frame.height : auto.y + layout.y * frame.height;
|
|
1929
|
+
const width = layout.width === void 0 ? auto.width : layout.widthMode === "edge" ? layout.width * frame.width - x : layout.width * frame.width;
|
|
1930
|
+
const height = layout.height === void 0 ? auto.height : layout.heightMode === "edge" ? layout.height * frame.height - y : layout.height * frame.height;
|
|
1931
|
+
return { x, y, width: Math.max(width, 1), height: Math.max(height, 1) };
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
// chart/gradient-stop-edit.ts
|
|
1935
|
+
function sortGradientStops(stops) {
|
|
1936
|
+
return stops.slice().sort((a, b) => a.position - b.position);
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
// chart/gradient-coincident-stops.ts
|
|
1940
|
+
var NATIVE_COINCIDENT_STOP_RAMP = 1 / 256;
|
|
1941
|
+
function spreadCoincidentStops(stops) {
|
|
1942
|
+
const out = [];
|
|
1943
|
+
for (const [index, stop] of stops.entries()) {
|
|
1944
|
+
const source = stops[index - 1];
|
|
1945
|
+
const previous = out.at(-1);
|
|
1946
|
+
const next = stops[index + 1];
|
|
1947
|
+
if (!source || !previous || stop.offset !== source.offset || stop.color === source.color && (stop.opacity ?? 1) === (source.opacity ?? 1)) {
|
|
1948
|
+
out.push(stop);
|
|
1949
|
+
continue;
|
|
1950
|
+
}
|
|
1951
|
+
const limit = Math.min(1, next ? next.offset : 1);
|
|
1952
|
+
out.push({
|
|
1953
|
+
...stop,
|
|
1954
|
+
offset: Math.max(stop.offset, Math.min(previous.offset + NATIVE_COINCIDENT_STOP_RAMP, limit))
|
|
1955
|
+
});
|
|
1956
|
+
}
|
|
1957
|
+
return out;
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
// chart/gradient-definition.ts
|
|
1961
|
+
function resolveChartGradient(fill, resolve) {
|
|
1962
|
+
const focus = fill.fillToRect;
|
|
1963
|
+
const stops = fill.stops.flatMap((stop) => {
|
|
1964
|
+
const color = resolve(stop.color);
|
|
1965
|
+
return color ? [{ position: stop.position, color: color.hex, opacity: color.alpha }] : [];
|
|
1966
|
+
});
|
|
1967
|
+
return {
|
|
1968
|
+
type: fill.path ? "radial" : "linear",
|
|
1969
|
+
stops,
|
|
1970
|
+
...fill.angle === void 0 ? {} : { angle: fill.angle },
|
|
1971
|
+
...fill.scaled === void 0 ? {} : { scaled: fill.scaled },
|
|
1972
|
+
...fill.path === void 0 ? {} : { path: fill.path },
|
|
1973
|
+
...focus === void 0 ? {} : { fillToRect: { ...focus } },
|
|
1974
|
+
// Native opaque endpoint-pair linear, rect, circle and rectangular-shape profiles.
|
|
1975
|
+
...(!fill.path && fill.scaled === true || ["rect", "circle", "shape"].includes(fill.path ?? "")) && fill.stops.length === 2 && stops.length === 2 && stops.every((stop) => stop.opacity === 1) && stops.some((stop) => stop.position === 0) && stops.some((stop) => stop.position === 100) ? { interpolation: "sigma-gamma22" } : {},
|
|
1976
|
+
...focus ? { focalPoint: { x: (1 + focus.l - focus.r) / 2, y: (1 + focus.t - focus.b) / 2 } } : {}
|
|
1977
|
+
};
|
|
1978
|
+
}
|
|
1979
|
+
function buildChartGradientDef(id, fill, bounds) {
|
|
1980
|
+
const sourceStops = sortGradientStops(fill.stops).map((stop) => ({
|
|
1981
|
+
offset: Math.min(Math.max(stop.position / 100, 0), 1),
|
|
1982
|
+
color: stop.color,
|
|
1983
|
+
...stop.opacity !== void 0 ? { opacity: stop.opacity } : {}
|
|
1984
|
+
}));
|
|
1985
|
+
const stops = fill.interpolation === "sigma-gamma22" ? sigmaGradientStops(sourceStops) ?? sourceStops : sourceStops;
|
|
1986
|
+
if (fill.type === "radial" && (fill.path === "rect" || fill.path === "shape" && bounds?.shape === "rect")) {
|
|
1987
|
+
const markup = buildRectPathGradientSvg(
|
|
1988
|
+
stops.map((stop) => ({
|
|
1989
|
+
position: stop.offset * 100,
|
|
1990
|
+
color: stop.color,
|
|
1991
|
+
...stop.opacity === void 0 ? {} : { opacity: stop.opacity }
|
|
1992
|
+
})),
|
|
1993
|
+
void 0,
|
|
1994
|
+
fill.fillToRect,
|
|
1995
|
+
{ bands: 1024}
|
|
1996
|
+
);
|
|
1997
|
+
return {
|
|
1998
|
+
kind: "rectPath",
|
|
1999
|
+
id,
|
|
2000
|
+
href: `data:image/svg+xml,${encodeURIComponent(markup)}`,
|
|
2001
|
+
stops
|
|
2002
|
+
};
|
|
2003
|
+
}
|
|
2004
|
+
if (fill.type === "radial") {
|
|
2005
|
+
const cx = fill.focalPoint?.x ?? 0.5;
|
|
2006
|
+
const cy = fill.focalPoint?.y ?? 0.5;
|
|
2007
|
+
const aspect = fill.path === "circle" && bounds && Number.isFinite(bounds.width) && Number.isFinite(bounds.height) && bounds.width > 0 && bounds.height > 0 ? bounds.height / bounds.width : 1;
|
|
2008
|
+
return {
|
|
2009
|
+
kind: "radialGradient",
|
|
2010
|
+
id,
|
|
2011
|
+
cx,
|
|
2012
|
+
cy,
|
|
2013
|
+
r: Math.max(
|
|
2014
|
+
...[0, 1].flatMap((x) => [0, 1].map((y) => Math.hypot(x - cx, (y - cy) * aspect)))
|
|
2015
|
+
),
|
|
2016
|
+
...aspect === 1 ? {} : { gradientTransform: `matrix(1 0 0 ${1 / aspect} 0 ${cy * (1 - 1 / aspect)})` },
|
|
2017
|
+
stops
|
|
2018
|
+
};
|
|
2019
|
+
}
|
|
2020
|
+
const rad = (fill.angle ?? 0) * Math.PI / 180;
|
|
2021
|
+
const span = fill.scaled ? Math.abs(Math.cos(rad)) + Math.abs(Math.sin(rad)) : 1;
|
|
2022
|
+
const dx = Math.cos(rad) * span / 2;
|
|
2023
|
+
const dy = Math.sin(rad) * span / 2;
|
|
2024
|
+
const round = (value) => Math.round(value * 1e4) / 1e4;
|
|
2025
|
+
return {
|
|
2026
|
+
kind: "linearGradient",
|
|
2027
|
+
id,
|
|
2028
|
+
x1: round(0.5 - dx),
|
|
2029
|
+
y1: round(0.5 - dy),
|
|
2030
|
+
x2: round(0.5 + dx),
|
|
2031
|
+
y2: round(0.5 + dy),
|
|
2032
|
+
stops: spreadCoincidentStops(stops)
|
|
2033
|
+
};
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
// chart/gradient-markup.ts
|
|
2037
|
+
function chartGradientMarkup(def) {
|
|
2038
|
+
if (def.kind === "rectPath")
|
|
2039
|
+
return `<pattern id="${escapeXmlAttr(def.id)}" patternUnits="objectBoundingBox" patternContentUnits="objectBoundingBox" width="1" height="1"><image href="${escapeXmlAttr(def.href)}" width="1" height="1" preserveAspectRatio="none"/></pattern>`;
|
|
2040
|
+
const geometry = def.kind === "linearGradient" ? `x1="${def.x1}" y1="${def.y1}" x2="${def.x2}" y2="${def.y2}"` : `cx="${def.cx}" cy="${def.cy}" r="${def.r}"`;
|
|
2041
|
+
const stops = def.stops.map(
|
|
2042
|
+
(stop) => `<stop offset="${stop.offset}" stop-color="${escapeXmlAttr(stop.color)}" stop-opacity="${stop.opacity ?? 1}"/>`
|
|
2043
|
+
).join("");
|
|
2044
|
+
const transform = def.kind === "radialGradient" && def.gradientTransform ? ` gradientTransform="${escapeXmlAttr(def.gradientTransform)}"` : "";
|
|
2045
|
+
return `<${def.kind} id="${escapeXmlAttr(def.id)}" ${geometry}${transform}>${stops}</${def.kind}>`;
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
// chart/bar-cluster-geometry.ts
|
|
2049
|
+
function clusteredBarGeometry(barGroupWidth, seriesCount, chartData) {
|
|
2050
|
+
const overlap = chartData.barOverlap ?? 0;
|
|
2051
|
+
const overlapSpan = 1 + (seriesCount - 1) * (1 - overlap / 100);
|
|
2052
|
+
const singleBarWidth = chartData.barGapWidth !== void 0 ? barGroupWidth / (overlapSpan + Math.max(chartData.barGapWidth, 0) / 100) : barGroupWidth * 0.7 / seriesCount;
|
|
2053
|
+
const step = singleBarWidth * (1 - overlap / 100);
|
|
2054
|
+
return { singleBarWidth, step, clusterWidth: singleBarWidth + step * (seriesCount - 1) };
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
// chart/data-cache.ts
|
|
2058
|
+
function chartCacheValues(cache) {
|
|
2059
|
+
if (!cache) return [];
|
|
2060
|
+
const numeric = cache.type === "number";
|
|
2061
|
+
const out = [];
|
|
2062
|
+
for (const point of cache.points) {
|
|
2063
|
+
const text2 = point.value;
|
|
2064
|
+
out[point.index ?? out.length] = numeric && text2.trim() !== "" && Number.isFinite(Number(text2)) ? Number(text2) : text2;
|
|
2065
|
+
}
|
|
2066
|
+
const size = Math.max(cache.pointCount ?? 0, out.length);
|
|
2067
|
+
for (let index = 0; index < size; index++) if (out[index] === void 0) out[index] = "";
|
|
2068
|
+
return out;
|
|
2069
|
+
}
|
|
2070
|
+
var chartSourceValues = (source) => chartCacheValues(source?.cache ?? source?.levels?.[0]);
|
|
2071
|
+
|
|
2072
|
+
// chart/render/summary-from-space.ts
|
|
2073
|
+
var solidColor = (fill) => fill?.kind === "solid" ? fill.color : void 0;
|
|
2074
|
+
var isSolidFill = (fill) => fill?.kind === "solid" || fill?.kind === "unsupported" && fill.element === "solidFill";
|
|
2075
|
+
var GROUP_TYPES = {
|
|
2076
|
+
bar: "bar",
|
|
2077
|
+
line: "line",
|
|
2078
|
+
area: "area",
|
|
2079
|
+
pie: "pie",
|
|
2080
|
+
ofPie: "pie",
|
|
2081
|
+
doughnut: "doughnut",
|
|
2082
|
+
scatter: "scatter",
|
|
2083
|
+
radar: "radar",
|
|
2084
|
+
bubble: "bubble",
|
|
2085
|
+
stock: "stock",
|
|
2086
|
+
surface: "surface"
|
|
2087
|
+
};
|
|
2088
|
+
var GROUPINGS = /* @__PURE__ */ new Set(["clustered", "stacked", "percentStacked", "standard"]);
|
|
2089
|
+
function chartSummarySeries(source, chartType) {
|
|
2090
|
+
const categories = source.categories ?? source.xValues;
|
|
2091
|
+
const values = source.values ?? source.yValues;
|
|
2092
|
+
const out = {
|
|
2093
|
+
categories: chartSourceValues(categories),
|
|
2094
|
+
values: chartSourceValues(values).map(
|
|
2095
|
+
(v) => typeof v === "number" ? v : v === "" ? null : Number.isFinite(Number(v)) ? Number(v) : null
|
|
2096
|
+
)
|
|
2097
|
+
};
|
|
2098
|
+
if (source.tx?.text !== void 0) out.name = source.tx.text;
|
|
2099
|
+
const nameRef = source.tx?.reference?.formula;
|
|
2100
|
+
if (nameRef) out.nameRef = nameRef;
|
|
2101
|
+
if (categories?.formula) out.categoriesRef = categories.formula;
|
|
2102
|
+
if (values?.formula) out.valuesRef = values.formula;
|
|
2103
|
+
if (source.spPr?.effectsXml) out.effectsXml = source.spPr.effectsXml;
|
|
2104
|
+
const primary = ["line", "scatter", "radar"].includes(chartType) ? source.spPr?.line?.fill : source.spPr?.fill;
|
|
2105
|
+
const fill = chartType === "scatter" && !isSolidFill(primary) ? source.marker?.spPr?.fill : primary;
|
|
2106
|
+
const drawingColor = solidColor(fill);
|
|
2107
|
+
if (drawingColor) out.drawingColor = drawingColor;
|
|
2108
|
+
if (fill && fill.kind !== "solid" && !(chartType === "scatter" && fill.kind === "none"))
|
|
2109
|
+
out.fill = fill;
|
|
2110
|
+
const points = {};
|
|
2111
|
+
const pointFills = {};
|
|
2112
|
+
for (const point of source.dataPoints) {
|
|
2113
|
+
const properties2 = point.spPr ?? point.marker?.spPr;
|
|
2114
|
+
if (point.index === void 0) continue;
|
|
2115
|
+
const pointColor = solidColor(properties2?.fill);
|
|
2116
|
+
if (pointColor) points[point.index] = pointColor;
|
|
2117
|
+
if (properties2?.fill && properties2.fill.kind !== "solid")
|
|
2118
|
+
pointFills[point.index] = properties2.fill;
|
|
2119
|
+
}
|
|
2120
|
+
if (Object.keys(points).length) out.pointColors = points;
|
|
2121
|
+
if (Object.keys(pointFills).length) out.pointFills = pointFills;
|
|
2122
|
+
return out;
|
|
2123
|
+
}
|
|
2124
|
+
function chartSummaryFromSpace(chartSpace, extras = {}) {
|
|
2125
|
+
const group = chartSpace.plotArea.groups[0];
|
|
2126
|
+
let chartType = group ? GROUP_TYPES[group.kind] : "column";
|
|
2127
|
+
if (chartType === "bar" && group?.barDirection !== "bar") chartType = "column";
|
|
2128
|
+
const series = (group?.series ?? []).map((source) => chartSummarySeries(source, chartType));
|
|
2129
|
+
const summary = {
|
|
2130
|
+
chartType,
|
|
2131
|
+
series,
|
|
2132
|
+
showLegend: chartSpace.legend !== void 0
|
|
2133
|
+
};
|
|
2134
|
+
const grouping = group?.grouping;
|
|
2135
|
+
if (grouping && GROUPINGS.has(grouping))
|
|
2136
|
+
summary.grouping = grouping;
|
|
2137
|
+
if (chartType === "bar" || chartType === "column") {
|
|
2138
|
+
for (const [value, field, fallback, min, max] of [
|
|
2139
|
+
[group?.gapWidth, "barGapWidth", 150, 0, 500],
|
|
2140
|
+
[group?.overlap, "barOverlap", 0, -100, 100]
|
|
2141
|
+
]) {
|
|
2142
|
+
const resolved = value ?? fallback;
|
|
2143
|
+
if (Number.isInteger(resolved) && resolved >= min && resolved <= max)
|
|
2144
|
+
summary[field] = resolved;
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
if (chartSpace.title && chartSpace.autoTitleDeleted !== true) {
|
|
2148
|
+
const title = chartSpace.title.text;
|
|
2149
|
+
if (title !== void 0) summary.title = title;
|
|
2150
|
+
else if (series.length === 1 && series[0]?.name) summary.title = series[0].name;
|
|
2151
|
+
}
|
|
2152
|
+
const legendPos = chartSpace.legend?.position;
|
|
2153
|
+
if (legendPos && ["r", "l", "t", "b", "tr"].includes(legendPos))
|
|
2154
|
+
summary.legendPosition = legendPos;
|
|
2155
|
+
if (extras.formatting) summary.formatting = extras.formatting;
|
|
2156
|
+
if (extras.colorPalette !== void 0) summary.colorPalette = extras.colorPalette;
|
|
2157
|
+
if (extras.styleDefinition) summary.styleDefinition = extras.styleDefinition;
|
|
2158
|
+
return summary;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
// chart/render/chart-scale.ts
|
|
2162
|
+
var clean = (n2) => Number(n2.toPrecision(12));
|
|
2163
|
+
function* units(raw) {
|
|
2164
|
+
let exp = Math.floor(Math.log10(raw)) - 1;
|
|
2165
|
+
for (; ; ) {
|
|
2166
|
+
const base = 10 ** exp;
|
|
2167
|
+
for (const m of [1, 2, 5]) yield clean(m * base);
|
|
2168
|
+
exp++;
|
|
2169
|
+
}
|
|
2170
|
+
}
|
|
2171
|
+
function niceScale(dataMin, dataMax, options = {}) {
|
|
2172
|
+
const maxIntervals = Math.max(1, options.maxIntervals ?? 10);
|
|
2173
|
+
let lo = Number.isFinite(dataMin) ? dataMin : 0;
|
|
2174
|
+
let hi = Number.isFinite(dataMax) ? dataMax : 0;
|
|
2175
|
+
if (lo > hi) [lo, hi] = [hi, lo];
|
|
2176
|
+
if (lo === hi) {
|
|
2177
|
+
if (lo === 0) hi = 1;
|
|
2178
|
+
else if (options.noZero) {
|
|
2179
|
+
const pad = Math.abs(lo) * 0.1 || 1;
|
|
2180
|
+
lo -= pad;
|
|
2181
|
+
hi += pad;
|
|
2182
|
+
} else if (lo > 0) lo = 0;
|
|
2183
|
+
else hi = 0;
|
|
2184
|
+
}
|
|
2185
|
+
let fixedLo = false;
|
|
2186
|
+
let fixedHi = false;
|
|
2187
|
+
if (!options.noZero) {
|
|
2188
|
+
if (lo >= 0 && hi - lo >= hi / 6) {
|
|
2189
|
+
lo = 0;
|
|
2190
|
+
fixedLo = true;
|
|
2191
|
+
} else if (hi <= 0 && hi - lo >= -lo / 6) {
|
|
2192
|
+
hi = 0;
|
|
2193
|
+
fixedHi = true;
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
const range = hi - lo;
|
|
2197
|
+
const top = fixedHi ? hi : hi + range * 0.05;
|
|
2198
|
+
const bottom = fixedLo ? lo : lo - range * 0.05;
|
|
2199
|
+
for (const unit of units(range / maxIntervals)) {
|
|
2200
|
+
const min = fixedLo ? lo : Math.floor(clean(bottom / unit)) * unit;
|
|
2201
|
+
const max = fixedHi ? hi : Math.ceil(clean(top / unit)) * unit;
|
|
2202
|
+
const intervals = Math.round((max - min) / unit);
|
|
2203
|
+
if (intervals <= maxIntervals && intervals > 0) {
|
|
2204
|
+
const ticks = [];
|
|
2205
|
+
for (let i = 0; i <= intervals; i++) ticks.push(clean(min + i * unit));
|
|
2206
|
+
return { min: clean(min), max: clean(max), majorUnit: unit, ticks };
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
return { min: lo, max: hi, majorUnit: range, ticks: [lo, hi] };
|
|
2210
|
+
}
|
|
2211
|
+
var PERCENT_SCALE = {
|
|
2212
|
+
min: 0,
|
|
2213
|
+
max: 1,
|
|
2214
|
+
majorUnit: 0.1,
|
|
2215
|
+
ticks: [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]
|
|
2216
|
+
};
|
|
2217
|
+
function formatAxisValue(value, percent = false) {
|
|
2218
|
+
if (percent) return `${clean(value * 100)}%`;
|
|
2219
|
+
const v = clean(value);
|
|
2220
|
+
if (Math.abs(v) >= 1e15 || v !== 0 && Math.abs(v) < 1e-6)
|
|
2221
|
+
return v.toExponential(2).replace("e+", "E+").replace("e-", "E-");
|
|
2222
|
+
const [int = "0", frac] = String(Math.abs(v)).split(".");
|
|
2223
|
+
const grouped = int.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
2224
|
+
return `${v < 0 ? "-" : ""}${grouped}${frac ? `.${frac}` : ""}`;
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2227
|
+
// chart/render/chart-svg-util.ts
|
|
2228
|
+
var TEXT_COLOR = "#595959";
|
|
2229
|
+
var GRID_COLOR = "#D9D9D9";
|
|
2230
|
+
var AXIS_COLOR = "#BFBFBF";
|
|
2231
|
+
var FONT_SIZE = 10;
|
|
2232
|
+
function esc(text2) {
|
|
2233
|
+
return text2.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
2234
|
+
}
|
|
2235
|
+
var n = (value) => String(Math.round(value * 100) / 100);
|
|
2236
|
+
var textWidth = (text2, size = FONT_SIZE) => text2.length * size * 0.55;
|
|
2237
|
+
function text(x, y, content, attrs = {}) {
|
|
2238
|
+
const parts = [`x="${n(x)}"`, `y="${n(y)}"`];
|
|
2239
|
+
parts.push(`font-size="${attrs.size ?? FONT_SIZE}"`);
|
|
2240
|
+
parts.push(`fill="${esc(attrs.fill ?? TEXT_COLOR)}"`);
|
|
2241
|
+
if (attrs.anchor && attrs.anchor !== "start") parts.push(`text-anchor="${attrs.anchor}"`);
|
|
2242
|
+
if (attrs.weight) parts.push(`font-weight="${attrs.weight}"`);
|
|
2243
|
+
if (attrs.baseline) parts.push(`dominant-baseline="${attrs.baseline}"`);
|
|
2244
|
+
if (attrs.family) parts.push(`font-family="${esc(attrs.family)}"`);
|
|
2245
|
+
if (attrs.filter) parts.push(`filter="${esc(attrs.filter)}"`);
|
|
2246
|
+
if (attrs.italic !== void 0) parts.push(`font-style="${attrs.italic ? "italic" : "normal"}"`);
|
|
2247
|
+
if (attrs.underline !== void 0)
|
|
2248
|
+
parts.push(`text-decoration="${attrs.underline ? "underline" : "none"}"`);
|
|
2249
|
+
return `<text ${parts.join(" ")}>${esc(content)}</text>`;
|
|
2250
|
+
}
|
|
2251
|
+
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}"/>`;
|
|
2252
|
+
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)}"` : ""}/>`;
|
|
2253
|
+
function fit(content, maxWidth, size = FONT_SIZE) {
|
|
2254
|
+
if (textWidth(content, size) <= maxWidth) return content;
|
|
2255
|
+
const chars = Math.max(1, Math.floor(maxWidth / (size * 0.55)) - 1);
|
|
2256
|
+
return `${content.slice(0, chars)}\u2026`;
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
// chart/render/theme-palette.ts
|
|
2260
|
+
var THEME_SLOTS = [
|
|
2261
|
+
"lt1",
|
|
2262
|
+
"dk1",
|
|
2263
|
+
"lt2",
|
|
2264
|
+
"dk2",
|
|
2265
|
+
"accent1",
|
|
2266
|
+
"accent2",
|
|
2267
|
+
"accent3",
|
|
2268
|
+
"accent4",
|
|
2269
|
+
"accent5",
|
|
2270
|
+
"accent6",
|
|
2271
|
+
"hlink",
|
|
2272
|
+
"folHlink"
|
|
2273
|
+
];
|
|
2274
|
+
var DEFAULT_THEME_COLORS = [
|
|
2275
|
+
"FFFFFF",
|
|
2276
|
+
"000000",
|
|
2277
|
+
"E7E6E6",
|
|
2278
|
+
"44546A",
|
|
2279
|
+
"4472C4",
|
|
2280
|
+
"ED7D31",
|
|
2281
|
+
"A5A5A5",
|
|
2282
|
+
"FFC000",
|
|
2283
|
+
"5B9BD5",
|
|
2284
|
+
"70AD47",
|
|
2285
|
+
"0563C1",
|
|
2286
|
+
"954F72"
|
|
2287
|
+
];
|
|
2288
|
+
function themeColor(theme, index) {
|
|
2289
|
+
const hex = theme.colors[index] ?? DEFAULT_THEME_COLORS[index];
|
|
2290
|
+
return hex && parseArgbHex(hex) ? hex.replace(/^#/, "") : void 0;
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
// chart/render/chart-colors.ts
|
|
2294
|
+
function chartColorScheme(theme) {
|
|
2295
|
+
const slots = Object.fromEntries(
|
|
2296
|
+
THEME_SLOTS.map((slot, index) => [slot, `#${themeColor(theme, index) ?? "000000"}`])
|
|
2297
|
+
);
|
|
2298
|
+
return {
|
|
2299
|
+
...slots,
|
|
2300
|
+
bg1: slots.lt1,
|
|
2301
|
+
tx1: slots.dk1,
|
|
2302
|
+
bg2: slots.lt2,
|
|
2303
|
+
tx2: slots.dk2
|
|
2304
|
+
};
|
|
2305
|
+
}
|
|
2306
|
+
function autoSeriesColor(theme, index) {
|
|
2307
|
+
const i = Math.max(0, Math.floor(index));
|
|
2308
|
+
return chartPaletteSeriesColor(findChartColorPalette(10), i, i + 1, chartColorScheme(theme));
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
// chart/render/chart-value-axis.ts
|
|
2312
|
+
function valueAxis(model) {
|
|
2313
|
+
const stackable = model.type === "bar" || model.type === "column" || model.type === "line" || model.type === "area";
|
|
2314
|
+
if (stackable && model.grouping === "percentStacked")
|
|
2315
|
+
return { ...PERCENT_SCALE, ticks: [...PERCENT_SCALE.ticks], percent: true };
|
|
2316
|
+
let min = Infinity;
|
|
2317
|
+
let max = -Infinity;
|
|
2318
|
+
if (stackable && model.grouping === "stacked") {
|
|
2319
|
+
for (let i = 0; i < model.categories.length; i++) {
|
|
2320
|
+
let pos = 0;
|
|
2321
|
+
let neg = 0;
|
|
2322
|
+
for (const s of model.series) {
|
|
2323
|
+
const v = s.values[i] ?? 0;
|
|
2324
|
+
if (v >= 0) pos += v;
|
|
2325
|
+
else neg += v;
|
|
2326
|
+
}
|
|
2327
|
+
min = Math.min(min, neg);
|
|
2328
|
+
max = Math.max(max, pos);
|
|
2329
|
+
}
|
|
2330
|
+
} else {
|
|
2331
|
+
for (const s of model.series)
|
|
2332
|
+
for (const v of s.values)
|
|
2333
|
+
if (v !== null) {
|
|
2334
|
+
min = Math.min(min, v);
|
|
2335
|
+
max = Math.max(max, v);
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
if (min === Infinity) {
|
|
2339
|
+
min = 0;
|
|
2340
|
+
max = 1;
|
|
2341
|
+
}
|
|
2342
|
+
return { ...niceScale(min, max), percent: false };
|
|
2343
|
+
}
|
|
2344
|
+
function categoryTotals(model) {
|
|
2345
|
+
return model.categories.map(
|
|
2346
|
+
(_, i) => model.series.reduce((sum, s) => sum + Math.abs(s.values[i] ?? 0), 0)
|
|
2347
|
+
);
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
// chart/text-inheritance.ts
|
|
2351
|
+
var TEXT_KEYS = [
|
|
2352
|
+
"fontSize",
|
|
2353
|
+
"bold",
|
|
2354
|
+
"italic",
|
|
2355
|
+
"underline",
|
|
2356
|
+
"typeface",
|
|
2357
|
+
"textColor",
|
|
2358
|
+
"fontRef"
|
|
2359
|
+
];
|
|
2360
|
+
var TEXT_PARTS = [
|
|
2361
|
+
"title",
|
|
2362
|
+
"axisTitle",
|
|
2363
|
+
"categoryAxis",
|
|
2364
|
+
"valueAxis",
|
|
2365
|
+
"legend",
|
|
2366
|
+
"dataLabel"
|
|
2367
|
+
];
|
|
2368
|
+
function inheritChartText(part, entry, builtIn, root) {
|
|
2369
|
+
if (!root || !TEXT_PARTS.includes(part)) return entry;
|
|
2370
|
+
const out = { ...entry };
|
|
2371
|
+
for (const key of TEXT_KEYS) {
|
|
2372
|
+
delete out[key];
|
|
2373
|
+
const value = root[key] ?? builtIn?.[key];
|
|
2374
|
+
if (value !== void 0) Object.assign(out, { [key]: value });
|
|
2375
|
+
}
|
|
2376
|
+
if (part === "title" && root.fontSize !== void 0) out.fontSize = root.fontSize * 1.2;
|
|
2377
|
+
if (root.textEffectsXml !== void 0) out.textEffectsXml = root.textEffectsXml;
|
|
2378
|
+
return out;
|
|
2379
|
+
}
|
|
2380
|
+
|
|
2381
|
+
// chart/render/chart-appearance.ts
|
|
2382
|
+
var chartPointsToPixels = (points) => points * EMU_PER_POINT / EMU_PER_PIXEL;
|
|
2383
|
+
function typeface(entry, theme) {
|
|
2384
|
+
const name = entry.typeface;
|
|
2385
|
+
if (name?.startsWith("+mj-")) return theme.majorFont;
|
|
2386
|
+
if (name?.startsWith("+mn-")) return theme.minorFont;
|
|
2387
|
+
return name ?? (entry.fontRef?.index === "major" ? theme.majorFont : entry.fontRef?.index === "minor" ? theme.minorFont : void 0);
|
|
2388
|
+
}
|
|
2389
|
+
function chartAppearance(chart, theme) {
|
|
2390
|
+
const defaults = builtInChartTextStyle(effectiveBuiltInChartStyle(chart.formatting));
|
|
2391
|
+
const entries = {};
|
|
2392
|
+
for (const part of CHART_STYLE_PARTS) {
|
|
2393
|
+
const base = chart.styleDefinition?.entries[part];
|
|
2394
|
+
const direct = chart.formatting?.entries[part];
|
|
2395
|
+
if (!defaults[part] && !base && !direct) continue;
|
|
2396
|
+
const entry = {
|
|
2397
|
+
...inheritChartText(
|
|
2398
|
+
part,
|
|
2399
|
+
{ ...defaults[part], ...base, sourceXml: base?.sourceXml ?? "" },
|
|
2400
|
+
defaults[part],
|
|
2401
|
+
chart.formatting?.textDefaults
|
|
2402
|
+
),
|
|
2403
|
+
...direct,
|
|
2404
|
+
sourceXml: direct?.sourceXml ?? base?.sourceXml ?? ""
|
|
2405
|
+
};
|
|
2406
|
+
if (base?.line || direct?.line) entry.line = { ...base?.line, ...direct?.line };
|
|
2407
|
+
entries[part] = entry;
|
|
2408
|
+
}
|
|
2409
|
+
const scheme = chartColorScheme(theme);
|
|
2410
|
+
const resolve = (color) => resolveDrawingColor(
|
|
2411
|
+
color,
|
|
2412
|
+
{ scheme: (name) => scheme[name] },
|
|
2413
|
+
{ hslRounding: "halfDown", transformOrder: "document" }
|
|
2414
|
+
);
|
|
2415
|
+
const out = resolveChartStyleDefinition(
|
|
2416
|
+
{ entries},
|
|
2417
|
+
(color) => drawingColorCss(resolve(color))
|
|
2418
|
+
) ?? {};
|
|
2419
|
+
for (const part of CHART_STYLE_PARTS) {
|
|
2420
|
+
const entry = entries[part];
|
|
2421
|
+
if (!entry) continue;
|
|
2422
|
+
const family = typeface(entry, theme);
|
|
2423
|
+
const shadow = resolveDrawingShadowXml(entry.textEffectsXml, {
|
|
2424
|
+
scheme: (name) => scheme[name]
|
|
2425
|
+
});
|
|
2426
|
+
if (shadow) (out[part] ??= {}).textShadow = shadow;
|
|
2427
|
+
if (family) (out[part] ??= {}).typeface = family;
|
|
2428
|
+
if (entry.axisVisible !== void 0) (out[part] ??= {}).axisVisible = entry.axisVisible;
|
|
2429
|
+
if (entry.labelsVisible !== void 0) (out[part] ??= {}).labelsVisible = entry.labelsVisible;
|
|
2430
|
+
if (entry.line?.widthEmu === 0) (out[part] ??= {}).lineWidth = 0;
|
|
2431
|
+
if (entry.fill?.kind === "gradient") {
|
|
2432
|
+
(out[part] ??= {}).gradient = resolveChartGradient(entry.fill, resolve);
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
return out;
|
|
2436
|
+
}
|
|
2437
|
+
|
|
2438
|
+
// chart/render/chart-title-text.ts
|
|
2439
|
+
function properties(run) {
|
|
2440
|
+
return {
|
|
2441
|
+
...run.sizePt === void 0 ? {} : { fontSize: run.sizePt },
|
|
2442
|
+
...run.bold === void 0 ? {} : { bold: run.bold },
|
|
2443
|
+
...run.italic === void 0 ? {} : { italic: run.italic },
|
|
2444
|
+
...run.underline === void 0 ? {} : { underline: run.underline },
|
|
2445
|
+
...run.typeface === void 0 ? {} : { typeface: run.typeface },
|
|
2446
|
+
...run.color === void 0 ? {} : { textColor: run.color }
|
|
2447
|
+
};
|
|
2448
|
+
}
|
|
2449
|
+
function chartTitleText(chart, theme) {
|
|
2450
|
+
const formatting = chart.formatting;
|
|
2451
|
+
const entry = formatting?.entries.title;
|
|
2452
|
+
const body = entry?.textBody;
|
|
2453
|
+
if (!formatting || !body || body.text !== chart.title) return void 0;
|
|
2454
|
+
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)
|
|
2455
|
+
return void 0;
|
|
2456
|
+
return {
|
|
2457
|
+
paragraphs: body.paragraphs.map((paragraph) => ({
|
|
2458
|
+
...paragraph.align ? { align: paragraph.align } : {},
|
|
2459
|
+
...paragraph.lineSpacing ? { lineSpacing: paragraph.lineSpacing } : {},
|
|
2460
|
+
...paragraph.spaceBefore ? { spaceBefore: paragraph.spaceBefore } : {},
|
|
2461
|
+
...paragraph.spaceAfter ? { spaceAfter: paragraph.spaceAfter } : {},
|
|
2462
|
+
runs: paragraph.runs.map((run) => {
|
|
2463
|
+
const direct = {
|
|
2464
|
+
sourceXml: "",
|
|
2465
|
+
...entry.textBodyStyle,
|
|
2466
|
+
...properties(paragraph.defaultProperties ?? {}),
|
|
2467
|
+
...properties(run)
|
|
2468
|
+
};
|
|
2469
|
+
const appearance = chartAppearance(
|
|
2470
|
+
{
|
|
2471
|
+
...chart,
|
|
2472
|
+
formatting: { ...formatting, entries: { ...formatting.entries, title: direct } }
|
|
2473
|
+
},
|
|
2474
|
+
theme
|
|
2475
|
+
)?.title ?? {};
|
|
2476
|
+
return { text: run.text, appearance };
|
|
2477
|
+
})
|
|
2478
|
+
}))
|
|
2479
|
+
};
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
// chart/render/chart-view.ts
|
|
2483
|
+
var isRefError = (value) => typeof value === "object" && value !== null && "error" in value;
|
|
2484
|
+
var SUPPORTED = /* @__PURE__ */ new Set([
|
|
2485
|
+
"bar",
|
|
2486
|
+
"column",
|
|
2487
|
+
"line",
|
|
2488
|
+
"area",
|
|
2489
|
+
"pie",
|
|
2490
|
+
"doughnut",
|
|
2491
|
+
"scatter",
|
|
2492
|
+
"radar"
|
|
2493
|
+
]);
|
|
2494
|
+
function toText(value) {
|
|
2495
|
+
if (value === null) return "";
|
|
2496
|
+
if (typeof value === "boolean") return value ? "TRUE" : "FALSE";
|
|
2497
|
+
if (isRefError(value)) return value.error;
|
|
2498
|
+
return String(value);
|
|
2499
|
+
}
|
|
2500
|
+
var toNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
2501
|
+
function resolveRef(ref, evaluateRef) {
|
|
2502
|
+
if (!ref) return void 0;
|
|
2503
|
+
try {
|
|
2504
|
+
const values = evaluateRef(ref);
|
|
2505
|
+
return values.length ? values : void 0;
|
|
2506
|
+
} catch {
|
|
2507
|
+
return void 0;
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
function seriesName(series, index, evaluateRef) {
|
|
2511
|
+
const fromRef = resolveRef(series.nameRef, evaluateRef)?.map(toText).filter((t) => t !== "").join(" ");
|
|
2512
|
+
return fromRef || series.name || `Series${index + 1}`;
|
|
2513
|
+
}
|
|
2514
|
+
function chartSummaryView(chart, theme, options = {}) {
|
|
2515
|
+
const evaluateRef = options.evaluateRef ?? (() => []);
|
|
2516
|
+
const type = chart.chartType;
|
|
2517
|
+
const radial = type === "pie" || type === "doughnut";
|
|
2518
|
+
const palette = chart.colorPalette === void 0 ? void 0 : findChartColorPalette(chart.colorPalette);
|
|
2519
|
+
const scheme = chartColorScheme(theme);
|
|
2520
|
+
const drawingColor = (color) => color && drawingColorCss(
|
|
2521
|
+
resolveDrawingColor(
|
|
2522
|
+
color,
|
|
2523
|
+
{
|
|
2524
|
+
scheme: (name) => scheme[name]
|
|
2525
|
+
},
|
|
2526
|
+
{ transformOrder: "document" }
|
|
2527
|
+
)
|
|
2528
|
+
);
|
|
2529
|
+
const gradient = (fill) => fill?.kind === "gradient" ? resolveChartGradient(
|
|
2530
|
+
fill,
|
|
2531
|
+
(color) => resolveDrawingColor(
|
|
2532
|
+
color,
|
|
2533
|
+
{
|
|
2534
|
+
scheme: (name) => scheme[name]
|
|
2535
|
+
},
|
|
2536
|
+
{ transformOrder: "document" }
|
|
2537
|
+
)
|
|
2538
|
+
) : void 0;
|
|
2539
|
+
const grouping = chart.grouping ?? (type === "bar" || type === "column" ? "clustered" : "standard");
|
|
2540
|
+
let categories = [];
|
|
2541
|
+
const rawCategories = [];
|
|
2542
|
+
const series = chart.series.map((s, i) => {
|
|
2543
|
+
const values = resolveRef(s.valuesRef, evaluateRef)?.map(toNumber) ?? s.values.map(toNumber);
|
|
2544
|
+
const cats = resolveRef(s.categoriesRef, evaluateRef) ?? s.categories;
|
|
2545
|
+
rawCategories.push(cats);
|
|
2546
|
+
const paletteColor = palette && chartPaletteSeriesColor(palette, i, chart.series.length, scheme);
|
|
2547
|
+
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);
|
|
2548
|
+
const view = { name: seriesName(s, i, evaluateRef), values, color };
|
|
2549
|
+
const shadow = resolveDrawingShadowXml(s.effectsXml, {
|
|
2550
|
+
scheme: (name) => scheme[name]
|
|
2551
|
+
});
|
|
2552
|
+
if (shadow) view.shadow = shadow;
|
|
2553
|
+
const resolvedGradient = gradient(s.fill);
|
|
2554
|
+
if (resolvedGradient) view.gradient = resolvedGradient;
|
|
2555
|
+
const points = Object.fromEntries(
|
|
2556
|
+
Object.entries(s.pointFills ?? {}).flatMap(([key, fill]) => {
|
|
2557
|
+
const value = gradient(fill);
|
|
2558
|
+
return value ? [[key, value]] : [];
|
|
2559
|
+
})
|
|
2560
|
+
);
|
|
2561
|
+
if (Object.keys(points).length) view.pointGradients = points;
|
|
2562
|
+
return view;
|
|
2563
|
+
});
|
|
2564
|
+
const longest = Math.max(0, ...series.map((s) => s.values.length));
|
|
2565
|
+
const firstCats = rawCategories.find((c) => c.length > 0) ?? [];
|
|
2566
|
+
categories = Array.from(
|
|
2567
|
+
{ length: Math.max(longest, firstCats.length) },
|
|
2568
|
+
(_, i) => firstCats[i] !== void 0 ? toText(firstCats[i] ?? null) : String(i + 1)
|
|
2569
|
+
);
|
|
2570
|
+
if (radial) {
|
|
2571
|
+
series.forEach((s, seriesIndex) => {
|
|
2572
|
+
s.pointColors = s.values.map((_, i) => {
|
|
2573
|
+
const explicit = drawingColor(chart.series[seriesIndex]?.pointColors?.[i]);
|
|
2574
|
+
return explicit ?? (palette ? chartPaletteSeriesColor(palette, i, s.values.length, scheme) : autoSeriesColor(theme, i));
|
|
2575
|
+
});
|
|
2576
|
+
});
|
|
2577
|
+
} else
|
|
2578
|
+
series.forEach((s, seriesIndex) => {
|
|
2579
|
+
const points = chart.series[seriesIndex]?.pointColors;
|
|
2580
|
+
if (points) s.pointColors = s.values.map((_, i) => drawingColor(points[i]) ?? s.color);
|
|
2581
|
+
});
|
|
2582
|
+
series.forEach((s, index) => {
|
|
2583
|
+
const source = chart.series[index];
|
|
2584
|
+
if (s.gradient && !radial && s.pointColors) {
|
|
2585
|
+
for (let i = 0; i < s.pointColors.length; i++)
|
|
2586
|
+
if (!source.pointColors?.[i]) delete s.pointColors[i];
|
|
2587
|
+
}
|
|
2588
|
+
for (const [key, fill] of Object.entries(source.pointFills ?? {})) {
|
|
2589
|
+
if (fill.kind === "none") (s.pointColors ??= [])[Number(key)] = "none";
|
|
2590
|
+
else if (fill.kind === "solid") {
|
|
2591
|
+
const paint = drawingColor(fill.color);
|
|
2592
|
+
if (paint) (s.pointColors ??= [])[Number(key)] = paint;
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
});
|
|
2596
|
+
const model = {
|
|
2597
|
+
...chart.barGapWidth === void 0 ? {} : { barGapWidth: chart.barGapWidth },
|
|
2598
|
+
...chart.barOverlap === void 0 ? {} : { barOverlap: chart.barOverlap },
|
|
2599
|
+
type,
|
|
2600
|
+
grouping,
|
|
2601
|
+
showLegend: chart.showLegend,
|
|
2602
|
+
legendPosition: chart.legendPosition ?? "r",
|
|
2603
|
+
categories,
|
|
2604
|
+
series,
|
|
2605
|
+
horizontal: type === "bar",
|
|
2606
|
+
supported: SUPPORTED.has(type)
|
|
2607
|
+
};
|
|
2608
|
+
if (chart.title) model.title = chart.title;
|
|
2609
|
+
const titleFormatting = chart.formatting?.entries.title;
|
|
2610
|
+
if (titleFormatting?.layout) model.titleLayout = titleFormatting.layout;
|
|
2611
|
+
if (titleFormatting?.overlay !== void 0) model.titleOverlay = titleFormatting.overlay;
|
|
2612
|
+
const legendFormatting = chart.formatting?.entries.legend;
|
|
2613
|
+
if (legendFormatting?.layout) model.legendLayout = legendFormatting.layout;
|
|
2614
|
+
if (legendFormatting?.overlay !== void 0) model.legendOverlay = legendFormatting.overlay;
|
|
2615
|
+
const titleText = chartTitleText(chart, theme);
|
|
2616
|
+
if (titleText) model.titleText = titleText;
|
|
2617
|
+
const appearance = chartAppearance(chart, theme);
|
|
2618
|
+
if (appearance) model.appearance = appearance;
|
|
2619
|
+
if (type === "scatter") {
|
|
2620
|
+
series.forEach((s, i) => {
|
|
2621
|
+
const cats = rawCategories[i] ?? [];
|
|
2622
|
+
const numeric = cats.length > 0 && cats.every((c) => typeof c === "number");
|
|
2623
|
+
s.xValues = s.values.map((_, k) => numeric ? toNumber(cats[k] ?? null) : k + 1);
|
|
2624
|
+
});
|
|
2625
|
+
const xs = series.flatMap((s) => s.xValues ?? []).filter((x) => x !== null);
|
|
2626
|
+
model.xAxis = xs.length ? niceScale(Math.min(...xs), Math.max(...xs)) : niceScale(0, 1);
|
|
2627
|
+
}
|
|
2628
|
+
if (!radial) model.valueAxis = valueAxis(model);
|
|
2629
|
+
return model;
|
|
2630
|
+
}
|
|
2631
|
+
|
|
2632
|
+
// text/css-font-family.ts
|
|
2633
|
+
var FALLBACKS = {
|
|
2634
|
+
calibri: '"Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
|
|
2635
|
+
"calibri light": '"Calibri Light", "Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
|
|
2636
|
+
cambria: '"Cambria", "Caladea", Georgia, serif',
|
|
2637
|
+
arial: 'Arial, "Liberation Sans", Helvetica, sans-serif',
|
|
2638
|
+
"times new roman": '"Times New Roman", "Liberation Serif", Times, serif',
|
|
2639
|
+
"courier new": '"Courier New", "Liberation Mono", monospace',
|
|
2640
|
+
aptos: '"Aptos", "Calibri", "Carlito", "Segoe UI", sans-serif'
|
|
2641
|
+
};
|
|
2642
|
+
function cssFontFamily(name) {
|
|
2643
|
+
const known = FALLBACKS[name.toLowerCase()];
|
|
2644
|
+
if (known) return known;
|
|
2645
|
+
const quoted = `"${name.replace(/["\\]/g, "")}"`;
|
|
2646
|
+
return `${quoted}, "Calibri", "Carlito", "Segoe UI", sans-serif`;
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
// chart/render/chart-svg-appearance.ts
|
|
2650
|
+
var nextPaintId = 0;
|
|
2651
|
+
function chartGradientPaint(model, width = 1024, height = 768) {
|
|
2652
|
+
const prefix = `xlsx-chart-${++nextPaintId}`;
|
|
2653
|
+
const appearance = { ...model.appearance };
|
|
2654
|
+
const defs = [];
|
|
2655
|
+
const shadowPaint = (shadow, suffix) => {
|
|
2656
|
+
const id = `${prefix}-${suffix}`;
|
|
2657
|
+
const pad = Math.max(4, shadow.blur * 3 + Math.abs(shadow.dx) + Math.abs(shadow.dy));
|
|
2658
|
+
defs.push(
|
|
2659
|
+
`<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>`
|
|
2660
|
+
);
|
|
2661
|
+
return `url(#${id})`;
|
|
2662
|
+
};
|
|
2663
|
+
for (const [part, entry] of Object.entries(appearance)) {
|
|
2664
|
+
if (entry?.textShadow)
|
|
2665
|
+
appearance[part] = {
|
|
2666
|
+
...entry,
|
|
2667
|
+
textShadowFilter: shadowPaint(entry.textShadow, `${part}-text-shadow`)
|
|
2668
|
+
};
|
|
2669
|
+
}
|
|
2670
|
+
const paint = (gradient, suffix, bounds) => {
|
|
2671
|
+
const def = buildChartGradientDef(`${prefix}-${suffix}`, gradient, bounds);
|
|
2672
|
+
defs.push(chartGradientMarkup(def));
|
|
2673
|
+
return `url(#${def.id})`;
|
|
2674
|
+
};
|
|
2675
|
+
for (const part of ["chartArea", "plotArea"]) {
|
|
2676
|
+
const entry = appearance[part];
|
|
2677
|
+
if (!entry?.gradient) continue;
|
|
2678
|
+
if (part === "plotArea" && ["circle", "shape"].includes(entry.gradient.path ?? "")) continue;
|
|
2679
|
+
appearance[part] = {
|
|
2680
|
+
...entry,
|
|
2681
|
+
fillColor: paint(entry.gradient, part, { width, height, shape: "rect" })
|
|
2682
|
+
};
|
|
2683
|
+
}
|
|
2684
|
+
const series = model.series.map((source, index) => {
|
|
2685
|
+
const view = { ...source };
|
|
2686
|
+
if (source.shadow) view.shadowFilter = shadowPaint(source.shadow, `s${index}-shadow`);
|
|
2687
|
+
const bounds = model.type === "bar" || model.type === "column" ? { width: 1, height: 1, shape: "rect" } : void 0;
|
|
2688
|
+
if (source.gradient) view.color = paint(source.gradient, `s${index}`, bounds);
|
|
2689
|
+
if (source.pointGradients) {
|
|
2690
|
+
view.pointColors = [...source.pointColors ?? []];
|
|
2691
|
+
for (const [key, gradient] of Object.entries(source.pointGradients))
|
|
2692
|
+
view.pointColors[Number(key)] = paint(gradient, `s${index}-p${key}`, bounds);
|
|
2693
|
+
}
|
|
2694
|
+
return view;
|
|
2695
|
+
});
|
|
2696
|
+
return defs.length ? { model: { ...model, appearance, series }, defs: `<defs>${defs.join("")}</defs>` } : { model, defs: "" };
|
|
2697
|
+
}
|
|
2698
|
+
function chartTextAttributes(model, part, fallbackSize = FONT_SIZE) {
|
|
2699
|
+
const entry = model.appearance?.[part];
|
|
2700
|
+
return {
|
|
2701
|
+
size: entry?.fontSize === void 0 ? fallbackSize : chartPointsToPixels(entry.fontSize),
|
|
2702
|
+
...entry?.color === void 0 ? {} : { fill: entry.color },
|
|
2703
|
+
...entry?.bold === void 0 ? {} : { weight: entry.bold ? "bold" : "normal" },
|
|
2704
|
+
...entry?.italic === void 0 ? {} : { italic: entry.italic },
|
|
2705
|
+
...entry?.underline === void 0 ? {} : { underline: entry.underline },
|
|
2706
|
+
...entry?.typeface === void 0 ? {} : { family: cssFontFamily(entry.typeface) },
|
|
2707
|
+
...entry?.textShadowFilter === void 0 ? {} : { filter: entry.textShadowFilter }
|
|
2708
|
+
};
|
|
2709
|
+
}
|
|
2710
|
+
function chartStroke(model, part) {
|
|
2711
|
+
const entry = model.appearance?.[part];
|
|
2712
|
+
return {
|
|
2713
|
+
color: entry?.axisVisible === false ? "none" : entry?.lineColor ?? (part === "gridlineMajor" ? GRID_COLOR : AXIS_COLOR),
|
|
2714
|
+
width: entry?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry.lineWidth)
|
|
2715
|
+
};
|
|
2716
|
+
}
|
|
2717
|
+
function chartAreaRect(model, part, area) {
|
|
2718
|
+
if (area.w <= 0 || area.h <= 0) return "";
|
|
2719
|
+
const entry = model.appearance?.[part];
|
|
2720
|
+
let fill = entry?.fillColor ?? (part === "chartArea" ? "#FFFFFF" : "none");
|
|
2721
|
+
let defs = "";
|
|
2722
|
+
if (part !== "chartArea" && entry?.gradient && (part !== "plotArea" || ["circle", "shape"].includes(entry.gradient.path ?? ""))) {
|
|
2723
|
+
const def = buildChartGradientDef(`xlsx-chart-${++nextPaintId}-${part}`, entry.gradient, {
|
|
2724
|
+
width: area.w,
|
|
2725
|
+
height: area.h,
|
|
2726
|
+
shape: "rect"
|
|
2727
|
+
});
|
|
2728
|
+
defs = `<defs>${chartGradientMarkup(def)}</defs>`;
|
|
2729
|
+
fill = `url(#${def.id})`;
|
|
2730
|
+
}
|
|
2731
|
+
const stroke = entry?.lineColor ?? "none";
|
|
2732
|
+
if (fill === "none" && stroke === "none") return "";
|
|
2733
|
+
const width = entry?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry.lineWidth);
|
|
2734
|
+
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}"/>`;
|
|
2735
|
+
}
|
|
2736
|
+
|
|
2737
|
+
// chart/render/chart-spacing.ts
|
|
2738
|
+
function chartBarSpacing(chart) {
|
|
2739
|
+
const stacked = chart.grouping === "stacked" || chart.grouping === "percentStacked";
|
|
2740
|
+
return {
|
|
2741
|
+
barGapWidth: chart.barGapWidth ?? 150,
|
|
2742
|
+
barOverlap: chart.barOverlap ?? (stacked ? 100 : 0)
|
|
2743
|
+
};
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2746
|
+
// chart/render/chart-svg-bars.ts
|
|
2747
|
+
function bars(model, frame, out, values) {
|
|
2748
|
+
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
2749
|
+
const count = Math.max(1, model.series.length);
|
|
2750
|
+
const geometry = clusteredBarGeometry(frame.bandSize, count, chartBarSpacing(model));
|
|
2751
|
+
const barSize = geometry.singleBarWidth;
|
|
2752
|
+
const base = frame.value(0);
|
|
2753
|
+
const pos = new Array(model.categories.length).fill(0);
|
|
2754
|
+
const neg = new Array(model.categories.length).fill(0);
|
|
2755
|
+
model.series.forEach((s, si) => {
|
|
2756
|
+
values[si]?.forEach((v, i) => {
|
|
2757
|
+
if (v === null || i >= model.categories.length) return;
|
|
2758
|
+
let from = 0;
|
|
2759
|
+
let to = v;
|
|
2760
|
+
if (stacked) {
|
|
2761
|
+
const acc = v >= 0 ? pos : neg;
|
|
2762
|
+
from = acc[i] ?? 0;
|
|
2763
|
+
to = from + v;
|
|
2764
|
+
acc[i] = to;
|
|
2765
|
+
}
|
|
2766
|
+
const a = stacked ? frame.value(from) : base;
|
|
2767
|
+
const b = frame.value(to);
|
|
2768
|
+
const offset = model.horizontal ? geometry.clusterWidth / 2 - barSize - si * geometry.step : -geometry.clusterWidth / 2 + si * geometry.step;
|
|
2769
|
+
const center = frame.band(i);
|
|
2770
|
+
const width = model.horizontal ? Math.abs(b - a) : barSize;
|
|
2771
|
+
const height = model.horizontal ? barSize : Math.abs(b - a);
|
|
2772
|
+
let color = s.pointColors?.[i] ?? s.color;
|
|
2773
|
+
const gradient = s.pointGradients?.[i] ?? (s.pointColors?.[i] === void 0 ? s.gradient : void 0);
|
|
2774
|
+
if (gradient && (gradient.path === "circle" || gradient.path === "shape")) {
|
|
2775
|
+
const baseId = color.match(/^url\(#(.+)\)$/)?.[1];
|
|
2776
|
+
if (baseId) {
|
|
2777
|
+
const id = baseId.replace(/(-s\d+(?:-p\d+)?)$/, `-mark${i}$1`);
|
|
2778
|
+
const def = buildChartGradientDef(id, gradient, {
|
|
2779
|
+
width: Number(n(width)),
|
|
2780
|
+
height: Number(n(height)),
|
|
2781
|
+
shape: "rect"
|
|
2782
|
+
});
|
|
2783
|
+
out.push(`<defs>${chartGradientMarkup(def)}</defs>`);
|
|
2784
|
+
color = `url(#${id})`;
|
|
2785
|
+
}
|
|
2786
|
+
}
|
|
2787
|
+
out.push(`<g data-chart-series="${si}" data-chart-point="${i}">`);
|
|
2788
|
+
if (model.horizontal)
|
|
2789
|
+
out.push(
|
|
2790
|
+
rect(Math.min(a, b), center + offset, Math.abs(b - a), barSize, color, s.shadowFilter)
|
|
2791
|
+
);
|
|
2792
|
+
else
|
|
2793
|
+
out.push(
|
|
2794
|
+
rect(center + offset, Math.min(a, b), barSize, Math.abs(b - a), color, s.shadowFilter)
|
|
2795
|
+
);
|
|
2796
|
+
out.push("</g>");
|
|
2797
|
+
});
|
|
2798
|
+
});
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
// chart/render/chart-svg-cartesian.ts
|
|
2802
|
+
function axes(model, area, out) {
|
|
2803
|
+
const scale = model.valueAxis;
|
|
2804
|
+
if (!scale) return void 0;
|
|
2805
|
+
const labels = scale.ticks.map((t) => formatAxisValue(t, scale.percent));
|
|
2806
|
+
const valueAttrs = chartTextAttributes(model, "valueAxis");
|
|
2807
|
+
const categoryAttrs = chartTextAttributes(model, "categoryAxis");
|
|
2808
|
+
const valueSize = valueAttrs.size ?? 10;
|
|
2809
|
+
const categorySize = categoryAttrs.size ?? 10;
|
|
2810
|
+
const grid = chartStroke(model, "gridlineMajor");
|
|
2811
|
+
const axis = chartStroke(model, "categoryAxis");
|
|
2812
|
+
const valueLabels = model.appearance?.valueAxis?.labelsVisible !== false;
|
|
2813
|
+
const categoryLabels = model.appearance?.categoryAxis?.labelsVisible !== false;
|
|
2814
|
+
const labelW = valueLabels ? Math.max(...labels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
|
|
2815
|
+
const horizontal = model.horizontal;
|
|
2816
|
+
const cats = Math.max(1, model.categories.length);
|
|
2817
|
+
const catW = Math.min(
|
|
2818
|
+
area.w * 0.3,
|
|
2819
|
+
Math.max(...model.categories.map((c) => textWidth(c, categorySize)), 8) + 6
|
|
2820
|
+
);
|
|
2821
|
+
const plot = horizontal ? {
|
|
2822
|
+
x: area.x + catW,
|
|
2823
|
+
y: area.y,
|
|
2824
|
+
w: Math.max(1, area.w - catW - 4),
|
|
2825
|
+
h: Math.max(1, area.h - Math.max(16, valueSize * 1.5))
|
|
2826
|
+
} : {
|
|
2827
|
+
x: area.x + labelW,
|
|
2828
|
+
y: area.y + 4,
|
|
2829
|
+
w: Math.max(1, area.w - labelW - 4),
|
|
2830
|
+
h: Math.max(1, area.h - Math.max(20, categorySize * 1.5))
|
|
2831
|
+
};
|
|
2832
|
+
const span = scale.max - scale.min || 1;
|
|
2833
|
+
const value = horizontal ? (v) => plot.x + (v - scale.min) / span * plot.w : (v) => plot.y + plot.h - (v - scale.min) / span * plot.h;
|
|
2834
|
+
const bandSize = (horizontal ? plot.h : plot.w) / cats;
|
|
2835
|
+
const band = horizontal ? (i) => plot.y + plot.h - bandSize * (i + 0.5) : (i) => plot.x + bandSize * (i + 0.5);
|
|
2836
|
+
out.push(chartAreaRect(model, "plotArea", plot));
|
|
2837
|
+
scale.ticks.forEach((t, i) => {
|
|
2838
|
+
const p = value(t);
|
|
2839
|
+
const label = labels[i] ?? "";
|
|
2840
|
+
if (horizontal) {
|
|
2841
|
+
out.push(line(p, plot.y, p, plot.y + plot.h, grid.color, grid.width));
|
|
2842
|
+
if (valueLabels)
|
|
2843
|
+
out.push(
|
|
2844
|
+
text(p, plot.y + plot.h + valueSize + 2, label, { anchor: "middle", ...valueAttrs })
|
|
2845
|
+
);
|
|
2846
|
+
} else {
|
|
2847
|
+
out.push(line(plot.x, p, plot.x + plot.w, p, grid.color, grid.width));
|
|
2848
|
+
if (valueLabels)
|
|
2849
|
+
out.push(text(plot.x - 4, p + valueSize * 0.3, label, { anchor: "end", ...valueAttrs }));
|
|
2850
|
+
}
|
|
2851
|
+
});
|
|
2852
|
+
const zero = value(Math.min(Math.max(0, scale.min), scale.max));
|
|
2853
|
+
if (horizontal) out.push(line(zero, plot.y, zero, plot.y + plot.h, axis.color, axis.width));
|
|
2854
|
+
else out.push(line(plot.x, zero, plot.x + plot.w, zero, axis.color, axis.width));
|
|
2855
|
+
const step = Math.max(
|
|
2856
|
+
1,
|
|
2857
|
+
Math.ceil(cats / Math.max(1, Math.floor((horizontal ? plot.h : plot.w) / 14)))
|
|
2858
|
+
);
|
|
2859
|
+
model.categories.forEach((c, i) => {
|
|
2860
|
+
if (!categoryLabels || i % step !== 0) return;
|
|
2861
|
+
const p = band(i);
|
|
2862
|
+
if (horizontal)
|
|
2863
|
+
out.push(
|
|
2864
|
+
text(plot.x - 4, p + categorySize * 0.3, fit(c, catW - 6, categorySize), {
|
|
2865
|
+
anchor: "end",
|
|
2866
|
+
...categoryAttrs
|
|
2867
|
+
})
|
|
2868
|
+
);
|
|
2869
|
+
else
|
|
2870
|
+
out.push(
|
|
2871
|
+
text(p, plot.y + plot.h + categorySize + 3, fit(c, bandSize * step, categorySize), {
|
|
2872
|
+
anchor: "middle",
|
|
2873
|
+
...categoryAttrs
|
|
2874
|
+
})
|
|
2875
|
+
);
|
|
2876
|
+
});
|
|
2877
|
+
return { plot, value, band, bandSize };
|
|
2878
|
+
}
|
|
2879
|
+
function plotted(model) {
|
|
2880
|
+
if (model.grouping !== "percentStacked") return model.series.map((s) => s.values);
|
|
2881
|
+
const totals = categoryTotals(model);
|
|
2882
|
+
return model.series.map(
|
|
2883
|
+
(s) => s.values.map((v, i) => v === null ? null : v / (totals[i] || 1))
|
|
2884
|
+
);
|
|
2885
|
+
}
|
|
2886
|
+
function linesAndAreas(model, frame, out) {
|
|
2887
|
+
const values = plotted(model);
|
|
2888
|
+
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
2889
|
+
const acc = new Array(model.categories.length).fill(0);
|
|
2890
|
+
const area = model.type === "area";
|
|
2891
|
+
const layers = [];
|
|
2892
|
+
model.series.forEach((s, si) => {
|
|
2893
|
+
const points = [];
|
|
2894
|
+
const lower = [];
|
|
2895
|
+
model.categories.forEach((_, i) => {
|
|
2896
|
+
const v = values[si]?.[i] ?? null;
|
|
2897
|
+
if (v === null && !area) {
|
|
2898
|
+
points.push([NaN, NaN]);
|
|
2899
|
+
return;
|
|
2900
|
+
}
|
|
2901
|
+
const below = stacked ? acc[i] ?? 0 : 0;
|
|
2902
|
+
const top = below + (v ?? 0);
|
|
2903
|
+
if (stacked) acc[i] = top;
|
|
2904
|
+
points.push([frame.band(i), frame.value(top)]);
|
|
2905
|
+
lower.push([frame.band(i), frame.value(below)]);
|
|
2906
|
+
});
|
|
2907
|
+
layers.push({
|
|
2908
|
+
points,
|
|
2909
|
+
lower,
|
|
2910
|
+
color: s.color,
|
|
2911
|
+
filter: s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""
|
|
2912
|
+
});
|
|
2913
|
+
});
|
|
2914
|
+
for (const { points, lower, color, filter } of area ? [...layers].reverse() : layers) {
|
|
2915
|
+
if (area) {
|
|
2916
|
+
const poly = [...points, ...[...lower].reverse()].map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
|
|
2917
|
+
out.push(`<polygon points="${poly}" fill="${color}" fill-opacity="0.85"${filter}/>`);
|
|
2918
|
+
continue;
|
|
2919
|
+
}
|
|
2920
|
+
let segment = [];
|
|
2921
|
+
const flush = () => {
|
|
2922
|
+
if (segment.length > 1)
|
|
2923
|
+
out.push(
|
|
2924
|
+
`<polyline points="${segment.join(" ")}" fill="none" stroke="${color}" stroke-width="2.25" stroke-linejoin="round"${filter}/>`
|
|
2925
|
+
);
|
|
2926
|
+
segment = [];
|
|
2927
|
+
};
|
|
2928
|
+
for (const [x, y] of points) {
|
|
2929
|
+
if (Number.isNaN(x)) flush();
|
|
2930
|
+
else segment.push(`${n(x)},${n(y)}`);
|
|
2931
|
+
}
|
|
2932
|
+
flush();
|
|
2933
|
+
for (const [x, y] of points)
|
|
2934
|
+
if (!Number.isNaN(x))
|
|
2935
|
+
out.push(`<circle cx="${n(x)}" cy="${n(y)}" r="2.5" fill="${color}"${filter}/>`);
|
|
2936
|
+
}
|
|
2937
|
+
}
|
|
2938
|
+
function scatter(model, area, out) {
|
|
2939
|
+
const ys = model.valueAxis;
|
|
2940
|
+
const xs = model.xAxis;
|
|
2941
|
+
if (!ys || !xs) return;
|
|
2942
|
+
const yLabels = ys.ticks.map((t) => formatAxisValue(t));
|
|
2943
|
+
const valueAttrs = chartTextAttributes(model, "valueAxis");
|
|
2944
|
+
const categoryAttrs = chartTextAttributes(model, "categoryAxis");
|
|
2945
|
+
const valueSize = valueAttrs.size ?? 10;
|
|
2946
|
+
const categorySize = categoryAttrs.size ?? 10;
|
|
2947
|
+
const grid = chartStroke(model, "gridlineMajor");
|
|
2948
|
+
const xAxis = chartStroke(model, "categoryAxis");
|
|
2949
|
+
const yAxis = chartStroke(model, "valueAxis");
|
|
2950
|
+
const valueLabels = model.appearance?.valueAxis?.labelsVisible !== false;
|
|
2951
|
+
const categoryLabels = model.appearance?.categoryAxis?.labelsVisible !== false;
|
|
2952
|
+
const labelW = valueLabels ? Math.max(...yLabels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
|
|
2953
|
+
const plot = {
|
|
2954
|
+
x: area.x + labelW,
|
|
2955
|
+
y: area.y + 4,
|
|
2956
|
+
w: Math.max(1, area.w - labelW - 8),
|
|
2957
|
+
h: Math.max(1, area.h - Math.max(20, categorySize * 1.5))
|
|
2958
|
+
};
|
|
2959
|
+
const px = (v, s) => plot.x + (v - s.min) / (s.max - s.min || 1) * plot.w;
|
|
2960
|
+
const py = (v, s) => plot.y + plot.h - (v - s.min) / (s.max - s.min || 1) * plot.h;
|
|
2961
|
+
out.push(chartAreaRect(model, "plotArea", plot));
|
|
2962
|
+
ys.ticks.forEach((t, i) => {
|
|
2963
|
+
out.push(line(plot.x, py(t, ys), plot.x + plot.w, py(t, ys), grid.color, grid.width));
|
|
2964
|
+
if (valueLabels)
|
|
2965
|
+
out.push(
|
|
2966
|
+
text(plot.x - 4, py(t, ys) + valueSize * 0.3, yLabels[i] ?? "", {
|
|
2967
|
+
anchor: "end",
|
|
2968
|
+
...valueAttrs
|
|
2969
|
+
})
|
|
2970
|
+
);
|
|
2971
|
+
});
|
|
2972
|
+
for (const t of xs.ticks) {
|
|
2973
|
+
out.push(
|
|
2974
|
+
line(px(t, xs), plot.y + plot.h, px(t, xs), plot.y + plot.h + 3, xAxis.color, xAxis.width)
|
|
2975
|
+
);
|
|
2976
|
+
if (categoryLabels)
|
|
2977
|
+
out.push(
|
|
2978
|
+
text(px(t, xs), plot.y + plot.h + categorySize + 3, formatAxisValue(t), {
|
|
2979
|
+
anchor: "middle",
|
|
2980
|
+
...categoryAttrs
|
|
2981
|
+
})
|
|
2982
|
+
);
|
|
2983
|
+
}
|
|
2984
|
+
out.push(
|
|
2985
|
+
line(plot.x, plot.y + plot.h, plot.x + plot.w, plot.y + plot.h, xAxis.color, xAxis.width)
|
|
2986
|
+
);
|
|
2987
|
+
out.push(line(plot.x, plot.y, plot.x, plot.y + plot.h, yAxis.color, yAxis.width));
|
|
2988
|
+
for (const s of model.series)
|
|
2989
|
+
s.values.forEach((v, i) => {
|
|
2990
|
+
const x = s.xValues?.[i] ?? null;
|
|
2991
|
+
if (v === null || x === null) return;
|
|
2992
|
+
out.push(
|
|
2993
|
+
`<circle cx="${n(px(x, xs))}" cy="${n(py(v, ys))}" r="3" fill="${s.pointColors?.[i] ?? s.color}"${s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""}/>`
|
|
2994
|
+
);
|
|
2995
|
+
});
|
|
2996
|
+
}
|
|
2997
|
+
function cartesianSvg(model, area) {
|
|
2998
|
+
const out = [];
|
|
2999
|
+
if (model.type === "scatter") {
|
|
3000
|
+
scatter(model, area, out);
|
|
3001
|
+
return out.join("");
|
|
3002
|
+
}
|
|
3003
|
+
const frame = axes(model, area, out);
|
|
3004
|
+
if (!frame) return "";
|
|
3005
|
+
if (model.type === "bar" || model.type === "column") bars(model, frame, out, plotted(model));
|
|
3006
|
+
else linesAndAreas(model, frame, out);
|
|
3007
|
+
return out.join("");
|
|
3008
|
+
}
|
|
3009
|
+
|
|
3010
|
+
// chart/render/chart-svg-radial.ts
|
|
3011
|
+
var polar = (cx, cy, r, angle) => [
|
|
3012
|
+
cx + r * Math.sin(angle),
|
|
3013
|
+
cy - r * Math.cos(angle)
|
|
3014
|
+
];
|
|
3015
|
+
function slicePath(cx, cy, r, inner, a0, a1) {
|
|
3016
|
+
const sweep = a1 - a0;
|
|
3017
|
+
if (sweep >= Math.PI * 2 - 1e-9) {
|
|
3018
|
+
const mid = a0 + Math.PI;
|
|
3019
|
+
return slicePath(cx, cy, r, inner, a0, mid) + slicePath(cx, cy, r, inner, mid, a1);
|
|
3020
|
+
}
|
|
3021
|
+
const large = sweep > Math.PI ? 1 : 0;
|
|
3022
|
+
const [x0, y0] = polar(cx, cy, r, a0);
|
|
3023
|
+
const [x1, y1] = polar(cx, cy, r, a1);
|
|
3024
|
+
if (inner <= 0)
|
|
3025
|
+
return `M${n(cx)},${n(cy)} L${n(x0)},${n(y0)} A${n(r)},${n(r)} 0 ${large} 1 ${n(x1)},${n(y1)} Z`;
|
|
3026
|
+
const [ix1, iy1] = polar(cx, cy, inner, a1);
|
|
3027
|
+
const [ix0, iy0] = polar(cx, cy, inner, a0);
|
|
3028
|
+
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`;
|
|
3029
|
+
}
|
|
3030
|
+
function pieSvg(model, area) {
|
|
3031
|
+
const out = [chartAreaRect(model, "plotArea", area)];
|
|
3032
|
+
const cx = area.x + area.w / 2;
|
|
3033
|
+
const cy = area.y + area.h / 2;
|
|
3034
|
+
const radius = Math.max(1, Math.min(area.w, area.h) / 2 - 4);
|
|
3035
|
+
const rings = model.type === "doughnut" ? model.series : model.series.slice(0, 1);
|
|
3036
|
+
const hole = model.type === "doughnut" ? radius * 0.5 : 0;
|
|
3037
|
+
const ringSize = (radius - hole) / Math.max(1, rings.length);
|
|
3038
|
+
rings.forEach((s, ri) => {
|
|
3039
|
+
const outer = radius - ri * ringSize;
|
|
3040
|
+
const inner = model.type === "doughnut" ? outer - ringSize : 0;
|
|
3041
|
+
const total = s.values.reduce((sum, v) => sum + (v !== null && v > 0 ? v : 0), 0);
|
|
3042
|
+
if (total <= 0) return;
|
|
3043
|
+
let angle = 0;
|
|
3044
|
+
s.values.forEach((v, i) => {
|
|
3045
|
+
if (v === null || v <= 0) return;
|
|
3046
|
+
const sweep = v / total * Math.PI * 2;
|
|
3047
|
+
const color = s.pointColors?.[i] ?? s.color;
|
|
3048
|
+
out.push(
|
|
3049
|
+
`<path d="${slicePath(cx, cy, outer, inner, angle, angle + sweep)}" fill="${color}" stroke="#FFFFFF" stroke-width="1"${s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""}/>`
|
|
3050
|
+
);
|
|
3051
|
+
angle += sweep;
|
|
3052
|
+
});
|
|
3053
|
+
});
|
|
3054
|
+
return out.join("");
|
|
3055
|
+
}
|
|
3056
|
+
function radarSvg(model, area) {
|
|
3057
|
+
const out = [chartAreaRect(model, "plotArea", area)];
|
|
3058
|
+
const scale = model.valueAxis;
|
|
3059
|
+
const count = model.categories.length;
|
|
3060
|
+
if (!scale || count < 1) return "";
|
|
3061
|
+
const valueAttrs = chartTextAttributes(model, "valueAxis", 9);
|
|
3062
|
+
const categoryAttrs = chartTextAttributes(model, "categoryAxis");
|
|
3063
|
+
const valueSize = valueAttrs.size ?? 9;
|
|
3064
|
+
const categorySize = categoryAttrs.size ?? 10;
|
|
3065
|
+
const grid = chartStroke(model, "gridlineMajor");
|
|
3066
|
+
const axis = chartStroke(model, "categoryAxis");
|
|
3067
|
+
const cx = area.x + area.w / 2;
|
|
3068
|
+
const cy = area.y + area.h / 2 + 4;
|
|
3069
|
+
const radius = Math.max(1, Math.min(area.w, area.h) / 2 - Math.max(18, categorySize * 1.8));
|
|
3070
|
+
const angle = (i) => i / count * Math.PI * 2;
|
|
3071
|
+
const r = (v) => (v - scale.min) / (scale.max - scale.min || 1) * radius;
|
|
3072
|
+
const labelEvery = Math.max(
|
|
3073
|
+
1,
|
|
3074
|
+
Math.ceil(12 / Math.max(1, radius / Math.max(1, scale.ticks.length - 1)))
|
|
3075
|
+
);
|
|
3076
|
+
for (const [k, t] of scale.ticks.entries()) {
|
|
3077
|
+
const ring = Array.from({ length: count }, (_, i) => polar(cx, cy, r(t), angle(i))).map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
|
|
3078
|
+
out.push(
|
|
3079
|
+
`<polygon points="${ring}" fill="none" stroke="${grid.color}" stroke-width="${n(grid.width)}"/>`
|
|
3080
|
+
);
|
|
3081
|
+
if (model.appearance?.valueAxis?.labelsVisible !== false && k % labelEvery === 0)
|
|
3082
|
+
out.push(
|
|
3083
|
+
text(cx + 3, cy - r(t) + valueSize * 0.3, formatAxisValue(t, scale.percent), valueAttrs)
|
|
3084
|
+
);
|
|
3085
|
+
}
|
|
3086
|
+
model.categories.forEach((c, i) => {
|
|
3087
|
+
const [x, y] = polar(cx, cy, radius, angle(i));
|
|
3088
|
+
out.push(line(cx, cy, x, y, axis.color, axis.width));
|
|
3089
|
+
const [lx, ly] = polar(cx, cy, radius + 10, angle(i));
|
|
3090
|
+
const anchor = Math.abs(lx - cx) < 2 ? "middle" : lx > cx ? "start" : "end";
|
|
3091
|
+
if (model.appearance?.categoryAxis?.labelsVisible !== false)
|
|
3092
|
+
out.push(
|
|
3093
|
+
text(lx, ly + categorySize * 0.3, fit(c, area.w / 4, categorySize), {
|
|
3094
|
+
anchor,
|
|
3095
|
+
...categoryAttrs
|
|
3096
|
+
})
|
|
3097
|
+
);
|
|
3098
|
+
});
|
|
3099
|
+
for (const s of model.series) {
|
|
3100
|
+
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(" ");
|
|
3101
|
+
out.push(
|
|
3102
|
+
`<polygon points="${points}" fill="none" stroke="${s.color}" stroke-width="2"${s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""}/>`
|
|
3103
|
+
);
|
|
3104
|
+
}
|
|
3105
|
+
return out.join("");
|
|
3106
|
+
}
|
|
3107
|
+
|
|
3108
|
+
// chart/render/chart-svg-text-metrics.ts
|
|
3109
|
+
var CHART_FONT_FAMILY = "Calibri, Carlito, Arial, sans-serif";
|
|
3110
|
+
function cssFont(attrs) {
|
|
3111
|
+
return `${attrs.italic ? "italic" : "normal"} ${attrs.weight ?? "normal"} ${attrs.size ?? 10}px ${attrs.family ?? CHART_FONT_FAMILY}`;
|
|
3112
|
+
}
|
|
3113
|
+
function chartFontMetrics(attrs, options) {
|
|
3114
|
+
const metrics = options.measureFont?.(cssFont(attrs));
|
|
3115
|
+
return metrics && Number.isFinite(metrics.ascent) && Number.isFinite(metrics.descent) && metrics.ascent >= 0 && metrics.descent >= 0 && metrics.ascent + metrics.descent > 0 ? metrics : void 0;
|
|
3116
|
+
}
|
|
3117
|
+
function chartTextWidth(content, attrs, options) {
|
|
3118
|
+
const width = options.measureText?.(content, cssFont(attrs));
|
|
3119
|
+
return width !== void 0 && Number.isFinite(width) && width >= 0 ? width : textWidth(content, attrs.size);
|
|
3120
|
+
}
|
|
3121
|
+
function fitChartText(content, maxWidth, attrs, options) {
|
|
3122
|
+
if (!options.measureText) return fit(content, maxWidth, attrs.size);
|
|
3123
|
+
if (chartTextWidth(content, attrs, options) <= maxWidth) return content;
|
|
3124
|
+
const points = [...content];
|
|
3125
|
+
let low = 0;
|
|
3126
|
+
let high = points.length;
|
|
3127
|
+
while (low < high) {
|
|
3128
|
+
const mid = Math.ceil((low + high) / 2);
|
|
3129
|
+
if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`, attrs, options) <= maxWidth) low = mid;
|
|
3130
|
+
else high = mid - 1;
|
|
3131
|
+
}
|
|
3132
|
+
return `${points.slice(0, low).join("")}\u2026`;
|
|
3133
|
+
}
|
|
3134
|
+
|
|
3135
|
+
// chart/render/chart-svg-legend.ts
|
|
3136
|
+
function chartLegendSvg(model, area, frame, options) {
|
|
3137
|
+
const automatic = [];
|
|
3138
|
+
const bounds = {};
|
|
3139
|
+
const reserved = automaticLegend(model, area, automatic, options, bounds);
|
|
3140
|
+
const plot = model.legendOverlay ? area : reserved;
|
|
3141
|
+
const box = bounds.box;
|
|
3142
|
+
if (!box) return { plot, markup: "", foreground: false };
|
|
3143
|
+
const manual = resolveManualLayoutRect(model.legendLayout, frame, {
|
|
3144
|
+
x: box.x,
|
|
3145
|
+
y: box.y,
|
|
3146
|
+
width: box.w,
|
|
3147
|
+
height: box.h
|
|
3148
|
+
});
|
|
3149
|
+
if (!manual) return { plot, markup: automatic.join(""), foreground: !!model.legendOverlay };
|
|
3150
|
+
const entries = legendEntries(model);
|
|
3151
|
+
const attrs = chartTextAttributes(model, "legend");
|
|
3152
|
+
const size = attrs.size ?? 10;
|
|
3153
|
+
const font = chartFontMetrics(attrs, options);
|
|
3154
|
+
const keySize = size / 2;
|
|
3155
|
+
const keyGap = size / 4;
|
|
3156
|
+
const widths = entries.map(
|
|
3157
|
+
(entry) => chartTextWidth(entry.label, attrs, options) + keySize + keyGap
|
|
3158
|
+
);
|
|
3159
|
+
const horizontal = manual.width > manual.height && widths.reduce((sum, width) => sum + width, 0) + size <= manual.width;
|
|
3160
|
+
const rowWidth = horizontal ? manual.width / entries.length : manual.width;
|
|
3161
|
+
const rowHeight = horizontal ? manual.height : manual.height / entries.length;
|
|
3162
|
+
const horizontalGap = Math.max(
|
|
3163
|
+
0,
|
|
3164
|
+
(manual.width - widths.reduce((sum, width) => sum + width, 0)) / (entries.length + 1)
|
|
3165
|
+
);
|
|
3166
|
+
let horizontalX = manual.x + horizontalGap;
|
|
3167
|
+
const markup = [
|
|
3168
|
+
chartAreaRect(model, "legend", { x: manual.x, y: manual.y, w: manual.width, h: manual.height })
|
|
3169
|
+
];
|
|
3170
|
+
const baselineOffset = font ? (font.ascent - font.descent) / 2 : size * 0.35;
|
|
3171
|
+
entries.forEach((entry, i) => {
|
|
3172
|
+
const available = horizontal ? chartTextWidth(entry.label, attrs, options) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
|
|
3173
|
+
const label = fitChartText(entry.label, available, attrs, options);
|
|
3174
|
+
const contentWidth = Math.min(
|
|
3175
|
+
horizontal ? widths[i] ?? 0 : Math.max(...widths),
|
|
3176
|
+
rowWidth - size / 2
|
|
3177
|
+
);
|
|
3178
|
+
const x = horizontal ? horizontalX : manual.x + Math.max(size / 4, (rowWidth - contentWidth) / 2);
|
|
3179
|
+
const centerY = manual.y + (horizontal ? 0 : i * rowHeight) + rowHeight / 2;
|
|
3180
|
+
markup.push(rect(x, centerY - keySize / 2, keySize, keySize, entry.color));
|
|
3181
|
+
markup.push(text(x + keySize + keyGap, centerY + baselineOffset, label, attrs));
|
|
3182
|
+
if (horizontal) horizontalX += (widths[i] ?? 0) + horizontalGap;
|
|
3183
|
+
});
|
|
3184
|
+
return {
|
|
3185
|
+
plot,
|
|
3186
|
+
markup: `<g data-chart-legend-layout="true">${markup.join("")}</g>`,
|
|
3187
|
+
foreground: true
|
|
3188
|
+
};
|
|
3189
|
+
}
|
|
3190
|
+
function legendEntries(model) {
|
|
3191
|
+
if (model.type === "pie" || model.type === "doughnut") {
|
|
3192
|
+
const first3 = model.series[0];
|
|
3193
|
+
return model.categories.map((label, i) => ({
|
|
3194
|
+
label,
|
|
3195
|
+
color: first3?.pointColors?.[i] ?? first3?.color ?? "#4472C4"
|
|
3196
|
+
}));
|
|
3197
|
+
}
|
|
3198
|
+
return model.series.map((s) => ({ label: s.name, color: s.color }));
|
|
3199
|
+
}
|
|
3200
|
+
function automaticLegend(model, area, out, options, bounds) {
|
|
3201
|
+
const entries = legendEntries(model);
|
|
3202
|
+
if (!model.showLegend || entries.length === 0) return area;
|
|
3203
|
+
const pos = model.legendPosition;
|
|
3204
|
+
const attrs = chartTextAttributes(model, "legend");
|
|
3205
|
+
const size = attrs.size ?? 10;
|
|
3206
|
+
const rowH = Math.max(16, size * 1.4);
|
|
3207
|
+
if (pos === "t" || pos === "b") {
|
|
3208
|
+
const widths = entries.map(
|
|
3209
|
+
(e) => Math.min(chartTextWidth(e.label, attrs, options) + 20, area.w / 2)
|
|
3210
|
+
);
|
|
3211
|
+
const total = widths.reduce((a, b) => a + b, 0);
|
|
3212
|
+
let x2 = area.x + Math.max(0, (area.w - total) / 2);
|
|
3213
|
+
const y = pos === "t" ? area.y + 4 : area.y + area.h - rowH + 4;
|
|
3214
|
+
bounds.box = { x: x2 - 4, y: y - 4, w: Math.min(total, area.w) + 8, h: rowH + 4 };
|
|
3215
|
+
out.push(
|
|
3216
|
+
chartAreaRect(model, "legend", {
|
|
3217
|
+
x: x2 - 4,
|
|
3218
|
+
y: y - 4,
|
|
3219
|
+
w: Math.min(total, area.w) + 8,
|
|
3220
|
+
h: rowH + 4
|
|
3221
|
+
})
|
|
3222
|
+
);
|
|
3223
|
+
entries.forEach((e, i) => {
|
|
3224
|
+
const w = widths[i] ?? 0;
|
|
3225
|
+
out.push(rect(x2, y, 8, 8, e.color));
|
|
3226
|
+
out.push(text(x2 + 12, y + 8, fitChartText(e.label, w - 16, attrs, options), attrs));
|
|
3227
|
+
x2 += w;
|
|
3228
|
+
});
|
|
3229
|
+
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 };
|
|
3230
|
+
}
|
|
3231
|
+
const width = Math.min(
|
|
3232
|
+
area.w * 0.35,
|
|
3233
|
+
Math.max(...entries.map((e) => chartTextWidth(e.label, attrs, options))) + 22
|
|
3234
|
+
);
|
|
3235
|
+
const height = entries.length * rowH;
|
|
3236
|
+
const x = pos === "l" ? area.x + 4 : area.x + area.w - width;
|
|
3237
|
+
const y0 = pos === "tr" ? area.y + 4 : area.y + Math.max(0, (area.h - height) / 2);
|
|
3238
|
+
bounds.box = { x: x - 4, y: y0, w: width + 4, h: Math.min(height, area.y + area.h - y0) };
|
|
3239
|
+
out.push(
|
|
3240
|
+
chartAreaRect(model, "legend", {
|
|
3241
|
+
x: x - 4,
|
|
3242
|
+
y: y0,
|
|
3243
|
+
w: width + 4,
|
|
3244
|
+
h: Math.min(height, area.y + area.h - y0)
|
|
3245
|
+
})
|
|
3246
|
+
);
|
|
3247
|
+
entries.forEach((e, i) => {
|
|
3248
|
+
const y = y0 + i * rowH;
|
|
3249
|
+
if (y + rowH > area.y + area.h + 2) return;
|
|
3250
|
+
out.push(rect(x, y + 3, 8, 8, e.color));
|
|
3251
|
+
out.push(text(x + 12, y + 11, fitChartText(e.label, width - 16, attrs, options), attrs));
|
|
3252
|
+
});
|
|
3253
|
+
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 };
|
|
3254
|
+
}
|
|
3255
|
+
|
|
3256
|
+
// text/wrap-styled-runs.ts
|
|
3257
|
+
var graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
3258
|
+
function wrapStyledRuns(runs, maxWidth, measure, options = {}) {
|
|
3259
|
+
const groups = [];
|
|
3260
|
+
for (const [source, run] of runs.entries()) {
|
|
3261
|
+
for (const token of run.text.split(/(\r\n|[\r\n]|[ \t]+)/u).filter(Boolean)) {
|
|
3262
|
+
const kind = /^[\r\n]+$/u.test(token) ? "break" : /^[ \t]+$/u.test(token) ? "space" : "word";
|
|
3263
|
+
let group = groups.at(-1);
|
|
3264
|
+
if (!group || group.kind !== kind || kind === "break") {
|
|
3265
|
+
group = { kind, pieces: [] };
|
|
3266
|
+
groups.push(group);
|
|
3267
|
+
}
|
|
3268
|
+
if (kind !== "break") group.pieces.push({ run, source, text: token });
|
|
3269
|
+
}
|
|
3270
|
+
}
|
|
3271
|
+
const merged = (left, right) => {
|
|
3272
|
+
const result2 = left.map((piece) => ({ ...piece }));
|
|
3273
|
+
for (const piece of right) {
|
|
3274
|
+
const last = result2.at(-1);
|
|
3275
|
+
if (last?.source === piece.source) last.text += piece.text;
|
|
3276
|
+
else result2.push({ ...piece });
|
|
3277
|
+
}
|
|
3278
|
+
return result2;
|
|
3279
|
+
};
|
|
3280
|
+
const width = (pieces) => pieces.reduce((sum, piece) => {
|
|
3281
|
+
const advance = measure(piece.text, piece.run);
|
|
3282
|
+
return sum + (Number.isFinite(advance) && advance >= 0 ? advance : 0);
|
|
3283
|
+
}, 0);
|
|
3284
|
+
const result = [];
|
|
3285
|
+
let line2 = [];
|
|
3286
|
+
let spaces = [];
|
|
3287
|
+
const flush = () => {
|
|
3288
|
+
result.push(line2.map((piece) => ({ ...piece.run, text: piece.text })));
|
|
3289
|
+
line2 = [];
|
|
3290
|
+
spaces = [];
|
|
3291
|
+
};
|
|
3292
|
+
for (const group of groups) {
|
|
3293
|
+
if (group.kind === "break") {
|
|
3294
|
+
flush();
|
|
3295
|
+
continue;
|
|
3296
|
+
}
|
|
3297
|
+
if (group.kind === "space") {
|
|
3298
|
+
spaces = group.pieces;
|
|
3299
|
+
continue;
|
|
3300
|
+
}
|
|
3301
|
+
const separator = line2.length ? spaces : [];
|
|
3302
|
+
const wordWidth = width(group.pieces);
|
|
3303
|
+
if (line2.length && width(merged(line2, [...separator, ...group.pieces])) > maxWidth) flush();
|
|
3304
|
+
else line2 = merged(line2, separator);
|
|
3305
|
+
spaces = [];
|
|
3306
|
+
if (options.breakWords && wordWidth > maxWidth) {
|
|
3307
|
+
for (const piece of group.pieces) {
|
|
3308
|
+
for (const { segment } of graphemes.segment(piece.text)) {
|
|
3309
|
+
const next = { ...piece, text: segment };
|
|
3310
|
+
if (line2.length && width(merged(line2, [next])) > maxWidth) flush();
|
|
3311
|
+
line2 = merged(line2, [next]);
|
|
3312
|
+
}
|
|
3313
|
+
}
|
|
3314
|
+
} else line2 = merged(line2, group.pieces);
|
|
3315
|
+
}
|
|
3316
|
+
flush();
|
|
3317
|
+
return result;
|
|
3318
|
+
}
|
|
3319
|
+
|
|
3320
|
+
// chart/render/chart-svg-title-text.ts
|
|
3321
|
+
function spacing(value, naturalHeight, fallback) {
|
|
3322
|
+
return value ? value.unit === "points" ? chartPointsToPixels(value.value) : naturalHeight * value.value : fallback;
|
|
3323
|
+
}
|
|
3324
|
+
function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
|
|
3325
|
+
if (!model.title) return void 0;
|
|
3326
|
+
const base = chartTextAttributes(model, "title", 14);
|
|
3327
|
+
const capacity = Math.max(1, width * 0.8 - 8);
|
|
3328
|
+
if (!model.titleText && !hasManualLayoutFields(model.titleLayout) && !model.titleOverlay && !model.title.includes("\n") && chartTextWidth(model.title, base, options) <= capacity)
|
|
3329
|
+
return void 0;
|
|
3330
|
+
const paragraphs = model.titleText?.paragraphs ?? [
|
|
3331
|
+
{
|
|
3332
|
+
runs: [{ text: model.title, appearance: model.appearance?.title ?? {} }]
|
|
3333
|
+
}
|
|
3334
|
+
];
|
|
3335
|
+
const hardLines = [];
|
|
3336
|
+
for (const paragraph of paragraphs) {
|
|
3337
|
+
let line2 = {
|
|
3338
|
+
...paragraph,
|
|
3339
|
+
runs: []
|
|
3340
|
+
};
|
|
3341
|
+
hardLines.push(line2);
|
|
3342
|
+
for (const run of paragraph.runs) {
|
|
3343
|
+
const pieces = run.text.split("\n");
|
|
3344
|
+
for (const [index, piece] of pieces.entries()) {
|
|
3345
|
+
if (index) {
|
|
3346
|
+
line2 = { ...paragraph, runs: [] };
|
|
3347
|
+
hardLines.push(line2);
|
|
3348
|
+
}
|
|
3349
|
+
if (piece) line2.runs.push({ ...run, text: piece });
|
|
3350
|
+
}
|
|
3351
|
+
}
|
|
3352
|
+
}
|
|
3353
|
+
const lines = hardLines.flatMap((line2) => {
|
|
3354
|
+
const wrapped = wrapStyledRuns(
|
|
3355
|
+
line2.runs,
|
|
3356
|
+
capacity,
|
|
3357
|
+
(content, run) => chartTextWidth(
|
|
3358
|
+
content,
|
|
3359
|
+
chartTextAttributes(
|
|
3360
|
+
{ ...model, appearance: { title: run.appearance } },
|
|
3361
|
+
"title",
|
|
3362
|
+
base.size
|
|
3363
|
+
),
|
|
3364
|
+
options
|
|
3365
|
+
),
|
|
3366
|
+
{ breakWords: true }
|
|
3367
|
+
);
|
|
3368
|
+
const { spaceBefore, spaceAfter, ...properties2 } = line2;
|
|
3369
|
+
return wrapped.map((runs, index) => ({
|
|
3370
|
+
...properties2,
|
|
3371
|
+
runs,
|
|
3372
|
+
...index === 0 && spaceBefore ? { spaceBefore } : {},
|
|
3373
|
+
...index === wrapped.length - 1 && spaceAfter ? { spaceAfter } : {}
|
|
3374
|
+
}));
|
|
3375
|
+
});
|
|
3376
|
+
const metrics = lines.map((line2) => {
|
|
3377
|
+
const runs = line2.runs.map((run) => ({
|
|
3378
|
+
...run,
|
|
3379
|
+
attrs: chartTextAttributes(
|
|
3380
|
+
{ ...model, appearance: { title: run.appearance } },
|
|
3381
|
+
"title",
|
|
3382
|
+
base.size
|
|
3383
|
+
)
|
|
3384
|
+
}));
|
|
3385
|
+
return {
|
|
3386
|
+
...line2,
|
|
3387
|
+
runs,
|
|
3388
|
+
width: runs.reduce((sum, run) => sum + chartTextWidth(run.text, run.attrs, options), 0),
|
|
3389
|
+
size: runs.length ? Math.max(...runs.map((run) => run.attrs.size ?? 14)) : base.size ?? 14,
|
|
3390
|
+
fontMetrics: (runs.length ? runs.map((run) => run.attrs) : [base]).map(
|
|
3391
|
+
(attrs) => chartFontMetrics(attrs, options)
|
|
3392
|
+
)
|
|
3393
|
+
};
|
|
3394
|
+
});
|
|
3395
|
+
const measured = metrics.every((line2) => line2.fontMetrics.every((font) => font !== void 0));
|
|
3396
|
+
const vertical = metrics.map((line2) => {
|
|
3397
|
+
const ascent = measured ? Math.max(...line2.fontMetrics.map((font) => font.ascent)) : line2.size;
|
|
3398
|
+
const descent = measured ? Math.max(...line2.fontMetrics.map((font) => font.descent)) : line2.size * 0.4 + 4;
|
|
3399
|
+
const natural = ascent + descent;
|
|
3400
|
+
const height2 = spacing(line2.lineSpacing, natural, natural);
|
|
3401
|
+
const leading = (height2 - natural) / 2;
|
|
3402
|
+
return {
|
|
3403
|
+
ascent: ascent + leading,
|
|
3404
|
+
descent: descent + leading,
|
|
3405
|
+
height: height2,
|
|
3406
|
+
before: spacing(line2.spaceBefore, natural, 0),
|
|
3407
|
+
after: spacing(line2.spaceAfter, natural, 0),
|
|
3408
|
+
leading
|
|
3409
|
+
};
|
|
3410
|
+
});
|
|
3411
|
+
const boxWidth = Math.min(width - 16, Math.max(0, ...metrics.map((line2) => line2.width)) + 8);
|
|
3412
|
+
const height = vertical.reduce(
|
|
3413
|
+
(sum, line2) => sum + line2.height + line2.before + line2.after,
|
|
3414
|
+
measured ? 4 : 0
|
|
3415
|
+
);
|
|
3416
|
+
let baseline = 8 + (metrics[0]?.size ?? base.size ?? 14) + (vertical[0]?.before ?? 0) + (vertical[0]?.leading ?? 0);
|
|
3417
|
+
const spans = [];
|
|
3418
|
+
for (const [index, line2] of metrics.entries()) {
|
|
3419
|
+
if (index)
|
|
3420
|
+
baseline += vertical[index - 1].descent + vertical[index - 1].after + vertical[index].before + vertical[index].ascent;
|
|
3421
|
+
let x = line2.align === "l" ? (width - boxWidth) / 2 + 4 : line2.align === "r" ? (width + boxWidth) / 2 - 4 - line2.width : (width - line2.width) / 2;
|
|
3422
|
+
for (const run of line2.runs) {
|
|
3423
|
+
spans.push(
|
|
3424
|
+
text(x, baseline, run.text, {
|
|
3425
|
+
...run.attrs,
|
|
3426
|
+
anchor: "start"
|
|
3427
|
+
}).replace("<text ", '<tspan data-chart-title-run="true" ').replace("</text>", "</tspan>")
|
|
3428
|
+
);
|
|
3429
|
+
x += chartTextWidth(run.text, run.attrs, options);
|
|
3430
|
+
}
|
|
3431
|
+
}
|
|
3432
|
+
const parent = text(0, 0, "", { ...base, underline: false }).replace(
|
|
3433
|
+
"</text>",
|
|
3434
|
+
`${spans.join("")}</text>`
|
|
3435
|
+
);
|
|
3436
|
+
const markup = chartAreaRect(model, "title", {
|
|
3437
|
+
x: (width - boxWidth) / 2,
|
|
3438
|
+
y: 4,
|
|
3439
|
+
w: Math.max(0, boxWidth),
|
|
3440
|
+
h: height
|
|
3441
|
+
}) + parent;
|
|
3442
|
+
const automatic = { x: (width - boxWidth) / 2, y: 4, width: boxWidth, height };
|
|
3443
|
+
const manual = resolveManualLayoutRect(
|
|
3444
|
+
model.titleLayout,
|
|
3445
|
+
{ width, height: frameHeight },
|
|
3446
|
+
automatic
|
|
3447
|
+
);
|
|
3448
|
+
return {
|
|
3449
|
+
markup: manual ? `<g data-chart-title-layout="true" transform="translate(${n(manual.x - automatic.x)} ${n(manual.y - automatic.y)})">${markup}</g>` : markup,
|
|
3450
|
+
height: Math.max(24, height)
|
|
3451
|
+
};
|
|
3452
|
+
}
|
|
3453
|
+
|
|
3454
|
+
// chart/render/chart-svg.ts
|
|
3455
|
+
function renderChartSvg(model, width, height, options = {}) {
|
|
3456
|
+
const paint = chartGradientPaint(model, Math.max(1, width), Math.max(1, height));
|
|
3457
|
+
model = paint.model;
|
|
3458
|
+
const w = Math.max(1, width);
|
|
3459
|
+
const h = Math.max(1, height);
|
|
3460
|
+
const out = [];
|
|
3461
|
+
let foregroundTitle = "";
|
|
3462
|
+
out.push(
|
|
3463
|
+
`<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">`
|
|
3464
|
+
);
|
|
3465
|
+
if (model.title) out.push(`<title>${esc(model.title)}</title>`);
|
|
3466
|
+
if (paint.defs) out.push(paint.defs);
|
|
3467
|
+
out.push(chartAreaRect(model, "chartArea", { x: 0, y: 0, w, h }));
|
|
3468
|
+
let area = { x: 8, y: 8, w: w - 16, h: h - 16 };
|
|
3469
|
+
const richTitle = chartRichTitleSvg(model, w, options, h);
|
|
3470
|
+
if (richTitle) {
|
|
3471
|
+
if (model.titleLayout || model.titleOverlay) foregroundTitle = richTitle.markup;
|
|
3472
|
+
else out.push(richTitle.markup);
|
|
3473
|
+
if (!model.titleOverlay)
|
|
3474
|
+
area = { ...area, y: area.y + richTitle.height, h: area.h - richTitle.height };
|
|
3475
|
+
} else if (model.title) {
|
|
3476
|
+
const attrs = chartTextAttributes(model, "title", 14);
|
|
3477
|
+
const size = attrs.size ?? 14;
|
|
3478
|
+
const label = fitChartText(model.title, w - 16, attrs, options);
|
|
3479
|
+
const titleWidth = Math.min(w - 16, chartTextWidth(label, attrs, options) + 8);
|
|
3480
|
+
const font = chartFontMetrics(attrs, options);
|
|
3481
|
+
const titleHeight = Math.max(24, font ? font.ascent + font.descent + 4 : size * 1.4 + 4);
|
|
3482
|
+
out.push(
|
|
3483
|
+
chartAreaRect(model, "title", {
|
|
3484
|
+
x: (w - titleWidth) / 2,
|
|
3485
|
+
y: 4,
|
|
3486
|
+
w: Math.max(0, titleWidth),
|
|
3487
|
+
h: font ? font.ascent + font.descent + 4 : size * 1.4 + 4
|
|
3488
|
+
})
|
|
3489
|
+
);
|
|
3490
|
+
out.push(
|
|
3491
|
+
text(w / 2, 8 + size, label, {
|
|
3492
|
+
anchor: "middle",
|
|
3493
|
+
fill: "#404040",
|
|
3494
|
+
...attrs
|
|
3495
|
+
})
|
|
3496
|
+
);
|
|
3497
|
+
if (!model.titleOverlay)
|
|
3498
|
+
area = { x: area.x, y: area.y + titleHeight, w: area.w, h: area.h - titleHeight };
|
|
3499
|
+
}
|
|
3500
|
+
if (!model.supported) {
|
|
3501
|
+
out.push(
|
|
3502
|
+
text(w / 2, area.y + area.h / 2, `${model.type} charts are not drawn`, { anchor: "middle" })
|
|
3503
|
+
);
|
|
3504
|
+
if (foregroundTitle) out.push(foregroundTitle);
|
|
3505
|
+
out.push("</svg>");
|
|
3506
|
+
return out.join("");
|
|
3507
|
+
}
|
|
3508
|
+
const legend = chartLegendSvg(model, area, { width: w, height: h }, options);
|
|
3509
|
+
area = legend.plot;
|
|
3510
|
+
if (!legend.foreground) out.push(legend.markup);
|
|
3511
|
+
if (area.w > 4 && area.h > 4) {
|
|
3512
|
+
if (model.type === "pie" || model.type === "doughnut") out.push(pieSvg(model, area));
|
|
3513
|
+
else if (model.type === "radar") out.push(radarSvg(model, area));
|
|
3514
|
+
else out.push(cartesianSvg(model, area));
|
|
3515
|
+
}
|
|
3516
|
+
if (legend.foreground) out.push(legend.markup);
|
|
3517
|
+
if (foregroundTitle) out.push(foregroundTitle);
|
|
3518
|
+
out.push("</svg>");
|
|
3519
|
+
return out.join("");
|
|
3520
|
+
}
|
|
3521
|
+
|
|
3522
|
+
// chart/render/render-space.ts
|
|
3523
|
+
var DRAWN_CHART_TYPES = /* @__PURE__ */ new Set([
|
|
3524
|
+
"bar",
|
|
3525
|
+
"column",
|
|
3526
|
+
"line",
|
|
3527
|
+
"area",
|
|
3528
|
+
"pie",
|
|
3529
|
+
"doughnut",
|
|
3530
|
+
"scatter",
|
|
3531
|
+
"radar"
|
|
3532
|
+
]);
|
|
3533
|
+
function chartThemePalette(theme, fonts = {}) {
|
|
3534
|
+
return {
|
|
3535
|
+
colors: THEME_SLOTS.map(
|
|
3536
|
+
(slot, index) => themeSlotHex(theme?.colors[slot]) ?? DEFAULT_THEME_COLORS[index] ?? "000000"
|
|
3537
|
+
),
|
|
3538
|
+
majorFont: fonts.major ?? "Calibri Light",
|
|
3539
|
+
minorFont: fonts.minor ?? "Calibri"
|
|
3540
|
+
};
|
|
3541
|
+
}
|
|
3542
|
+
function chartSpaceKind(space) {
|
|
3543
|
+
if (!space.plotArea.groups.length) return { drawn: false };
|
|
3544
|
+
const type = chartSummaryFromSpace(space).chartType;
|
|
3545
|
+
return { type, drawn: DRAWN_CHART_TYPES.has(type) };
|
|
3546
|
+
}
|
|
3547
|
+
function renderChartSpaceSvg(space, options) {
|
|
3548
|
+
const { width, height, theme, fonts, formatting, colorPalette, styleDefinition, ...svg } = options;
|
|
3549
|
+
const summary = chartSummaryFromSpace(space, {
|
|
3550
|
+
...formatting ? { formatting } : {},
|
|
3551
|
+
...colorPalette !== void 0 ? { colorPalette } : {},
|
|
3552
|
+
...styleDefinition ? { styleDefinition } : {}
|
|
3553
|
+
});
|
|
3554
|
+
const view = chartSummaryView(summary, chartThemePalette(theme, fonts));
|
|
3555
|
+
return renderChartSvg(view, width, height, svg);
|
|
3556
|
+
}
|
|
3557
|
+
|
|
1006
3558
|
// docx/restore-run-format.ts
|
|
1007
3559
|
function parseRunPropertiesSnapshot(xml) {
|
|
1008
3560
|
return parsePropertiesSnapshot(xml, "rPr");
|
|
@@ -1066,18 +3618,18 @@ function parseDirectParagraphProperties(props) {
|
|
|
1066
3618
|
if (shading) paragraph.shadingFill = shading;
|
|
1067
3619
|
const tabStops = parseTabStops(first2(props, "tabs"));
|
|
1068
3620
|
if (tabStops.length) paragraph.tabStops = tabStops;
|
|
1069
|
-
const
|
|
1070
|
-
const before = twipValue(getW(
|
|
1071
|
-
const after = twipValue(getW(
|
|
1072
|
-
const
|
|
3621
|
+
const spacing2 = first2(props, "spacing");
|
|
3622
|
+
const before = twipValue(getW(spacing2, "before"));
|
|
3623
|
+
const after = twipValue(getW(spacing2, "after"));
|
|
3624
|
+
const line2 = signedTwipValue(getW(spacing2, "line"));
|
|
1073
3625
|
if (before !== void 0) paragraph.spacingBeforeTwips = before;
|
|
1074
3626
|
if (after !== void 0) paragraph.spacingAfterTwips = after;
|
|
1075
|
-
if (
|
|
1076
|
-
paragraph.lineSpacingTwips =
|
|
3627
|
+
if (line2 !== void 0) {
|
|
3628
|
+
paragraph.lineSpacingTwips = line2;
|
|
1077
3629
|
}
|
|
1078
|
-
const rule = getW(
|
|
3630
|
+
const rule = getW(spacing2, "lineRule");
|
|
1079
3631
|
if (rule === "auto" || rule === "exact" || rule === "atLeast") paragraph.lineSpacingRule = rule;
|
|
1080
|
-
else if (
|
|
3632
|
+
else if (line2 !== void 0) paragraph.lineSpacingRule = "auto";
|
|
1081
3633
|
const indent = first2(props, "ind");
|
|
1082
3634
|
const indentLeft = signedTwipValue(getW(indent, "left"));
|
|
1083
3635
|
const indentRight = signedTwipValue(getW(indent, "right"));
|
|
@@ -1111,9 +3663,9 @@ function resolveNumberingLevel(catalog, numId, level) {
|
|
|
1111
3663
|
let base = override?.lvl ?? abstract;
|
|
1112
3664
|
if (!base) return void 0;
|
|
1113
3665
|
if (override?.lvl) {
|
|
1114
|
-
const { lvlRestart: _ignored, ...
|
|
3666
|
+
const { lvlRestart: _ignored, ...properties2 } = base;
|
|
1115
3667
|
base = {
|
|
1116
|
-
...
|
|
3668
|
+
...properties2,
|
|
1117
3669
|
...abstract?.lvlRestart !== void 0 ? { lvlRestart: abstract.lvlRestart } : {}
|
|
1118
3670
|
};
|
|
1119
3671
|
}
|
|
@@ -1249,8 +3801,39 @@ function numberNotesInOrder(blocks, kind) {
|
|
|
1249
3801
|
return order;
|
|
1250
3802
|
}
|
|
1251
3803
|
|
|
3804
|
+
// docx/chart-paint.ts
|
|
3805
|
+
function themeCatalogColorScheme(theme) {
|
|
3806
|
+
const colors = {};
|
|
3807
|
+
for (const [slot, value] of Object.entries(theme?.colors ?? {}))
|
|
3808
|
+
if (value) colors[slot] = { kind: "srgb", value: value.replace(/^#/, ""), transforms: [] };
|
|
3809
|
+
return { colors };
|
|
3810
|
+
}
|
|
3811
|
+
function docxChartPaint(chart, widthPx, heightPx, theme) {
|
|
3812
|
+
const space = chart?.chartSpace;
|
|
3813
|
+
if (!space) return { label: "Chart" };
|
|
3814
|
+
const kind = chartSpaceKind(space);
|
|
3815
|
+
if (!kind.drawn) return { label: kind.type ? `Chart (${kind.type})` : "Chart" };
|
|
3816
|
+
try {
|
|
3817
|
+
const fonts = {
|
|
3818
|
+
...theme?.fonts.major.latin ? { major: theme.fonts.major.latin } : {},
|
|
3819
|
+
...theme?.fonts.minor.latin ? { minor: theme.fonts.minor.latin } : {}
|
|
3820
|
+
};
|
|
3821
|
+
const svg = renderChartSpaceSvg(space, {
|
|
3822
|
+
width: Math.max(1, Math.round(widthPx)),
|
|
3823
|
+
height: Math.max(1, Math.round(heightPx)),
|
|
3824
|
+
theme: themeCatalogColorScheme(theme),
|
|
3825
|
+
fonts,
|
|
3826
|
+
...chart.formatting ? { formatting: chart.formatting } : {},
|
|
3827
|
+
...chart.colorPalette !== void 0 ? { colorPalette: chart.colorPalette } : {}
|
|
3828
|
+
});
|
|
3829
|
+
return { svg, label: chart.title ? `Chart: ${chart.title}` : "Chart" };
|
|
3830
|
+
} catch {
|
|
3831
|
+
return { label: kind.type ? `Chart (${kind.type})` : "Chart" };
|
|
3832
|
+
}
|
|
3833
|
+
}
|
|
3834
|
+
|
|
1252
3835
|
// docx/numbering-text.ts
|
|
1253
|
-
function romanNumeral(
|
|
3836
|
+
function romanNumeral(n2) {
|
|
1254
3837
|
const values = [1e3, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1];
|
|
1255
3838
|
const numerals = [
|
|
1256
3839
|
"M",
|
|
@@ -1267,7 +3850,7 @@ function romanNumeral(n) {
|
|
|
1267
3850
|
"IV",
|
|
1268
3851
|
"I"
|
|
1269
3852
|
];
|
|
1270
|
-
let remaining = Math.max(1, Math.min(Math.trunc(
|
|
3853
|
+
let remaining = Math.max(1, Math.min(Math.trunc(n2), 3999));
|
|
1271
3854
|
let result = "";
|
|
1272
3855
|
for (const [i, value] of values.entries()) {
|
|
1273
3856
|
while (remaining >= value) {
|
|
@@ -1278,13 +3861,13 @@ function romanNumeral(n) {
|
|
|
1278
3861
|
return result;
|
|
1279
3862
|
}
|
|
1280
3863
|
var LATIN_LOWER = Array.from("abcdefghijklmnopqrstuvwxyz");
|
|
1281
|
-
function letterLabel(
|
|
1282
|
-
const index = Math.max(0, Math.trunc(
|
|
3864
|
+
function letterLabel(n2) {
|
|
3865
|
+
const index = Math.max(0, Math.trunc(n2) - 1);
|
|
1283
3866
|
const letter = LATIN_LOWER[index % LATIN_LOWER.length] ?? "a";
|
|
1284
3867
|
return letter.repeat(Math.floor(index / LATIN_LOWER.length) + 1);
|
|
1285
3868
|
}
|
|
1286
|
-
var ORDINAL_SUFFIX = (
|
|
1287
|
-
const abs = Math.abs(Math.trunc(
|
|
3869
|
+
var ORDINAL_SUFFIX = (n2) => {
|
|
3870
|
+
const abs = Math.abs(Math.trunc(n2));
|
|
1288
3871
|
if (abs % 100 >= 11 && abs % 100 <= 13) return "th";
|
|
1289
3872
|
switch (abs % 10) {
|
|
1290
3873
|
case 1:
|
|
@@ -1297,8 +3880,8 @@ var ORDINAL_SUFFIX = (n) => {
|
|
|
1297
3880
|
return "th";
|
|
1298
3881
|
}
|
|
1299
3882
|
};
|
|
1300
|
-
function ordinalNumeral(
|
|
1301
|
-
return `${Math.trunc(
|
|
3883
|
+
function ordinalNumeral(n2) {
|
|
3884
|
+
return `${Math.trunc(n2)}${ORDINAL_SUFFIX(n2)}`;
|
|
1302
3885
|
}
|
|
1303
3886
|
var ONES = [
|
|
1304
3887
|
"",
|
|
@@ -1323,8 +3906,8 @@ var ONES = [
|
|
|
1323
3906
|
"nineteen"
|
|
1324
3907
|
];
|
|
1325
3908
|
var TENS = ["", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"];
|
|
1326
|
-
function cardinalWords(
|
|
1327
|
-
const value = Math.trunc(
|
|
3909
|
+
function cardinalWords(n2) {
|
|
3910
|
+
const value = Math.trunc(n2);
|
|
1328
3911
|
if (value < 0 || value > 999999) return String(value);
|
|
1329
3912
|
if (value === 0) return "zero";
|
|
1330
3913
|
const chunk = (v) => {
|
|
@@ -1356,8 +3939,8 @@ var ORDINAL_WORDS = {
|
|
|
1356
3939
|
nine: "ninth",
|
|
1357
3940
|
twelve: "twelfth"
|
|
1358
3941
|
};
|
|
1359
|
-
function ordinalWords(
|
|
1360
|
-
const value = Math.trunc(
|
|
3942
|
+
function ordinalWords(n2) {
|
|
3943
|
+
const value = Math.trunc(n2);
|
|
1361
3944
|
if (value < 0 || value > 999999) return ordinalNumeral(value);
|
|
1362
3945
|
const words = cardinalWords(value);
|
|
1363
3946
|
const splitAt = Math.max(words.lastIndexOf(" "), words.lastIndexOf("-"));
|
|
@@ -1497,11 +4080,11 @@ function computeListLabels(model) {
|
|
|
1497
4080
|
if (!def) continue;
|
|
1498
4081
|
if (def.numFmt === "none") continue;
|
|
1499
4082
|
counters.advance(numId, level, def, catalog);
|
|
1500
|
-
const
|
|
4083
|
+
const text2 = def.numFmt === "bullet" ? def.lvlText : substituteLvlText(def.lvlText, numId, level, catalog, counters, Boolean(def.isLgl));
|
|
1501
4084
|
labels.set(paragraph.id, {
|
|
1502
4085
|
numId,
|
|
1503
4086
|
level,
|
|
1504
|
-
text,
|
|
4087
|
+
text: text2,
|
|
1505
4088
|
suffix: def.suffix ?? "tab",
|
|
1506
4089
|
...definedProps({
|
|
1507
4090
|
alignment: def.lvlJc,
|
|
@@ -1526,8 +4109,8 @@ var SYMBOL_BULLETS = {
|
|
|
1526
4109
|
"\uF0E0": "\u27A9",
|
|
1527
4110
|
"\uF0B2": "\u25CB"
|
|
1528
4111
|
};
|
|
1529
|
-
function displayListLabel(
|
|
1530
|
-
return
|
|
4112
|
+
function displayListLabel(text2) {
|
|
4113
|
+
return text2.replace(/[-]/g, (char) => SYMBOL_BULLETS[char] ?? "\u2022");
|
|
1531
4114
|
}
|
|
1532
4115
|
|
|
1533
4116
|
// docx/restore-paragraph-format.ts
|
|
@@ -1565,20 +4148,20 @@ function restoreParagraphFormatting(paragraph) {
|
|
|
1565
4148
|
throw new Error(
|
|
1566
4149
|
"Cannot reject a paragraph formatting revision without its prior properties snapshot."
|
|
1567
4150
|
);
|
|
1568
|
-
const
|
|
4151
|
+
const properties2 = parsePropertiesSnapshot(xml, "pPr");
|
|
1569
4152
|
if (paragraph.sourceParagraphPropertiesXml) {
|
|
1570
4153
|
const current = parsePropertiesSnapshot(paragraph.sourceParagraphPropertiesXml, "pPr");
|
|
1571
4154
|
for (const name of ["rPr", "sectPr"]) {
|
|
1572
4155
|
const element = first2(current, name);
|
|
1573
|
-
if (element && !first2(
|
|
1574
|
-
|
|
4156
|
+
if (element && !first2(properties2, name))
|
|
4157
|
+
properties2.appendChild(properties2.ownerDocument.importNode(element, true));
|
|
1575
4158
|
}
|
|
1576
|
-
orderParagraphProperties(
|
|
4159
|
+
orderParagraphProperties(properties2);
|
|
1577
4160
|
}
|
|
1578
|
-
const previous = parseDirectParagraphProperties(
|
|
4161
|
+
const previous = parseDirectParagraphProperties(properties2);
|
|
1579
4162
|
for (const key of PARAGRAPH_FORMAT_KEYS) delete paragraph[key];
|
|
1580
4163
|
Object.assign(paragraph, previous);
|
|
1581
|
-
paragraph.restoredParagraphPropertiesXml = buildXml(
|
|
4164
|
+
paragraph.restoredParagraphPropertiesXml = buildXml(properties2);
|
|
1582
4165
|
if (paragraph.sourceParagraphPropertiesXml)
|
|
1583
4166
|
paragraph.sourceParagraphPropertiesXml = paragraph.restoredParagraphPropertiesXml;
|
|
1584
4167
|
delete paragraph.formatRevision;
|
|
@@ -1744,9 +4327,9 @@ function createFakeMeasurer(options = {}) {
|
|
|
1744
4327
|
const charWidthFactor = options.charWidthFactor ?? 0.6;
|
|
1745
4328
|
const lineHeightFactor = options.lineHeightFactor ?? 1.15;
|
|
1746
4329
|
return {
|
|
1747
|
-
widthOf(
|
|
4330
|
+
widthOf(text2, font) {
|
|
1748
4331
|
let width = 0;
|
|
1749
|
-
for (const ch of
|
|
4332
|
+
for (const ch of text2) {
|
|
1750
4333
|
if (ch === " " || ch === "\n") continue;
|
|
1751
4334
|
width += font.sizePx * charWidthFactor * (font.bold ? 1.08 : 1) * (ch === " " ? 0.6 : 1);
|
|
1752
4335
|
}
|
|
@@ -1769,7 +4352,7 @@ function isEastAsianChar(ch) {
|
|
|
1769
4352
|
const cp = ch.codePointAt(0) ?? 0;
|
|
1770
4353
|
return cp >= 4352 && cp <= 4607 || cp >= 11904 && cp <= 40959 || cp >= 43360 && cp <= 43391 || cp >= 44032 && cp <= 55295 || cp >= 63744 && cp <= 64255 || cp >= 65072 && cp <= 65103 || cp >= 65280 && cp <= 65519 || cp >= 131072 && cp <= 262143;
|
|
1771
4354
|
}
|
|
1772
|
-
function tokenizeRun(
|
|
4355
|
+
function tokenizeRun(text2, runIndex) {
|
|
1773
4356
|
const tokens = [];
|
|
1774
4357
|
let word = "";
|
|
1775
4358
|
let wordStart = 0;
|
|
@@ -1777,7 +4360,7 @@ function tokenizeRun(text, runIndex) {
|
|
|
1777
4360
|
if (word) tokens.push({ kind: "word", text: word, runIndex, sourceStart: wordStart });
|
|
1778
4361
|
word = "";
|
|
1779
4362
|
};
|
|
1780
|
-
const chars = [...new Intl.Segmenter(void 0, { granularity: "grapheme" }).segment(
|
|
4363
|
+
const chars = [...new Intl.Segmenter(void 0, { granularity: "grapheme" }).segment(text2)].map(
|
|
1781
4364
|
(part) => part.segment
|
|
1782
4365
|
);
|
|
1783
4366
|
let offset = 0;
|
|
@@ -1900,11 +4483,11 @@ function fontOf(run) {
|
|
|
1900
4483
|
}
|
|
1901
4484
|
};
|
|
1902
4485
|
}
|
|
1903
|
-
var
|
|
1904
|
-
function runTextWidth(
|
|
4486
|
+
var graphemes2 = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
4487
|
+
function runTextWidth(text2, run, measurer) {
|
|
1905
4488
|
return Math.max(
|
|
1906
4489
|
0,
|
|
1907
|
-
measurer.widthOf(
|
|
4490
|
+
measurer.widthOf(text2, fontOf(run)) * (run.textScalePercent ?? 100) / 100 + [...graphemes2.segment(text2)].length * (run.characterSpacingPx ?? 0)
|
|
1908
4491
|
);
|
|
1909
4492
|
}
|
|
1910
4493
|
function resolveIndents(paragraph) {
|
|
@@ -1982,9 +4565,9 @@ function buildFragments(tokensOnLine, paragraph) {
|
|
|
1982
4565
|
let x = 0;
|
|
1983
4566
|
for (const { token, widthPx, leader, xOffsetPx, advancePx } of tokensOnLine) {
|
|
1984
4567
|
const run = paragraph.runs[token.runIndex];
|
|
1985
|
-
const
|
|
4568
|
+
const text2 = token.kind === "word" || token.kind === "space" ? token.text : "";
|
|
1986
4569
|
fragments.push({
|
|
1987
|
-
text,
|
|
4570
|
+
text: text2,
|
|
1988
4571
|
xPx: x + (xOffsetPx ?? 0),
|
|
1989
4572
|
widthPx,
|
|
1990
4573
|
runIndex: token.runIndex,
|
|
@@ -2196,11 +4779,11 @@ function layoutParagraph(paragraph, contentWidthPx, measurer, note, lineBox, sta
|
|
|
2196
4779
|
}
|
|
2197
4780
|
flushLine(lines.length === 0, void 0);
|
|
2198
4781
|
const lastIndex = lines.length - 1;
|
|
2199
|
-
for (const [index,
|
|
4782
|
+
for (const [index, line2] of lines.entries()) {
|
|
2200
4783
|
lines[index] = {
|
|
2201
|
-
...
|
|
4784
|
+
...line2,
|
|
2202
4785
|
fragments: alignFragments(
|
|
2203
|
-
|
|
4786
|
+
line2.fragments,
|
|
2204
4787
|
availableWidth(index),
|
|
2205
4788
|
index === lastIndex,
|
|
2206
4789
|
effectiveAlign
|
|
@@ -2212,10 +4795,10 @@ function layoutParagraph(paragraph, contentWidthPx, measurer, note, lineBox, sta
|
|
|
2212
4795
|
const insetTopPx = extent("top");
|
|
2213
4796
|
const insetBottomPx = extent("bottom");
|
|
2214
4797
|
let y = insetTopPx;
|
|
2215
|
-
for (const
|
|
2216
|
-
y +=
|
|
2217
|
-
|
|
2218
|
-
y +=
|
|
4798
|
+
for (const line2 of lines) {
|
|
4799
|
+
y += line2.gapBeforePx ?? 0;
|
|
4800
|
+
line2.yPx = y;
|
|
4801
|
+
y += line2.heightPx;
|
|
2219
4802
|
}
|
|
2220
4803
|
const frame = borders || paragraph.shading ? {
|
|
2221
4804
|
leftPx: leftPx - extent("left"),
|
|
@@ -2268,7 +4851,7 @@ function stackParagraphs(paragraphs, widthPx, measurer, note, topPx = 0, startTo
|
|
|
2268
4851
|
);
|
|
2269
4852
|
y += layout.spacingBeforePx;
|
|
2270
4853
|
const top = y;
|
|
2271
|
-
const lines = layout.lines.map((
|
|
4854
|
+
const lines = layout.lines.map((line2) => ({ ...line2, yPx: line2.yPx + top }));
|
|
2272
4855
|
boxes.push({
|
|
2273
4856
|
kind: "paragraph",
|
|
2274
4857
|
blockId: paragraph.id,
|
|
@@ -2336,7 +4919,7 @@ function splitCellAtHeight(boxes, cutHeightPx) {
|
|
|
2336
4919
|
continue;
|
|
2337
4920
|
}
|
|
2338
4921
|
const beforeLines = box.lines.filter(
|
|
2339
|
-
(
|
|
4922
|
+
(line2) => box.yPx + line2.yPx + line2.heightPx <= cutHeightPx
|
|
2340
4923
|
);
|
|
2341
4924
|
const afterLines = box.lines.slice(beforeLines.length);
|
|
2342
4925
|
if (beforeLines.length) {
|
|
@@ -2351,7 +4934,7 @@ function splitCellAtHeight(boxes, cutHeightPx) {
|
|
|
2351
4934
|
...box,
|
|
2352
4935
|
yPx: 0,
|
|
2353
4936
|
heightPx: afterLines.at(-1).yPx + afterLines.at(-1).heightPx - shift,
|
|
2354
|
-
lines: afterLines.map((
|
|
4937
|
+
lines: afterLines.map((line2) => ({ ...line2, yPx: line2.yPx - shift }))
|
|
2355
4938
|
});
|
|
2356
4939
|
} else {
|
|
2357
4940
|
afterOrigin = box.yPx + box.heightPx;
|
|
@@ -2600,9 +5183,9 @@ function placeParagraph(cursor, placement, note) {
|
|
|
2600
5183
|
let end = lineCursor;
|
|
2601
5184
|
let forced;
|
|
2602
5185
|
for (let i = lineCursor; i < layout.lines.length; i++) {
|
|
2603
|
-
const
|
|
2604
|
-
const gap = i === lineCursor && !firstSegment ? 0 :
|
|
2605
|
-
const height =
|
|
5186
|
+
const line2 = expectDefined(layout.lines[i], "paragraph line index");
|
|
5187
|
+
const gap = i === lineCursor && !firstSegment ? 0 : line2.gapBeforePx ?? 0;
|
|
5188
|
+
const height = line2.heightPx + gap;
|
|
2606
5189
|
if (cumulative + height > budget && (end > lineCursor || !cursor.atColumnTop)) break;
|
|
2607
5190
|
cumulative += height;
|
|
2608
5191
|
end = i + 1;
|
|
@@ -2630,7 +5213,7 @@ function placeParagraph(cursor, placement, note) {
|
|
|
2630
5213
|
}
|
|
2631
5214
|
const first3 = expectDefined(layout.lines[lineCursor], "first line of paragraph segment");
|
|
2632
5215
|
const origin = first3.yPx - (firstSegment ? (first3.gapBeforePx ?? 0) + layout.insetTopPx : 0);
|
|
2633
|
-
const segmentLines = layout.lines.slice(lineCursor, lineCursor + placedCount).map((
|
|
5216
|
+
const segmentLines = layout.lines.slice(lineCursor, lineCursor + placedCount).map((line2) => ({ ...line2, yPx: line2.yPx - origin }));
|
|
2634
5217
|
const isFinal = lineCursor + placedCount >= layout.lines.length;
|
|
2635
5218
|
const lastLine = segmentLines.at(-1);
|
|
2636
5219
|
const isLastSegment = lineCursor + placedCount >= layout.lines.length;
|
|
@@ -3223,9 +5806,9 @@ function paragraphBox(formatting, theme) {
|
|
|
3223
5806
|
let betweenBorder;
|
|
3224
5807
|
for (const side of ["top", "bottom", "left", "right", "between"]) {
|
|
3225
5808
|
const source = formatting.borders?.[side];
|
|
3226
|
-
const
|
|
3227
|
-
if (!
|
|
3228
|
-
const resolved = { ...
|
|
5809
|
+
const line2 = border(source, theme);
|
|
5810
|
+
if (!line2) continue;
|
|
5811
|
+
const resolved = { ...line2, spacePx: pointsToPx(source?.spacePoints ?? 0) };
|
|
3229
5812
|
if (side === "between") betweenBorder = resolved;
|
|
3230
5813
|
else borders[side] = resolved;
|
|
3231
5814
|
}
|
|
@@ -3248,8 +5831,8 @@ function groupParagraphBorders(blocks, between) {
|
|
|
3248
5831
|
const borders = { ...block.borders };
|
|
3249
5832
|
if (sameAsNext) delete borders.bottom;
|
|
3250
5833
|
if (sameAsPrevious) {
|
|
3251
|
-
const
|
|
3252
|
-
if (
|
|
5834
|
+
const line2 = between.get(block);
|
|
5835
|
+
if (line2) borders.top = line2;
|
|
3253
5836
|
else delete borders.top;
|
|
3254
5837
|
}
|
|
3255
5838
|
block.borders = borders;
|
|
@@ -3364,7 +5947,7 @@ function adaptDocumentModel(model, note = () => {
|
|
|
3364
5947
|
if (run.equation) reportOnce(EQUATION_NOTE);
|
|
3365
5948
|
const name = run.field ? fieldName(run.field.instr) : "";
|
|
3366
5949
|
const noteText = run.noteReference ? noteLabel(run.noteReference.kind, run.noteReference.id) : run.noteMark ? markLabel ?? "" : void 0;
|
|
3367
|
-
const
|
|
5950
|
+
const text2 = noteText ?? (run.field && !isFieldLocked(run) && (name === "DATE" || name === "TIME") ? dateFieldResult(name, run.field.instr, now) : run.equation ? "[Equation]" : run.text);
|
|
3368
5951
|
const script = formatting.verticalAlign === "superscript" || noteText !== void 0 && formatting.verticalAlign === void 0 ? "super" : formatting.verticalAlign === "subscript" ? "sub" : void 0;
|
|
3369
5952
|
const image = run.image;
|
|
3370
5953
|
if (image?.unsupported === "Text box") reportOnce(TEXT_BOX_NOTE);
|
|
@@ -3372,11 +5955,12 @@ function adaptDocumentModel(model, note = () => {
|
|
|
3372
5955
|
partName: image.partName,
|
|
3373
5956
|
contentType: image.contentType,
|
|
3374
5957
|
widthPx: image.widthPx,
|
|
3375
|
-
heightPx: image.heightPx
|
|
5958
|
+
heightPx: image.heightPx,
|
|
5959
|
+
...image.chart ? { chart: docxChartPaint(image.chart, image.widthPx, image.heightPx, theme) } : {}
|
|
3376
5960
|
} : void 0;
|
|
3377
5961
|
return {
|
|
3378
5962
|
// Hidden text (`w:vanish`) takes no space when printed, as in Word by default.
|
|
3379
|
-
text: image || formatting.vanish ? "" : formatting.caps ?
|
|
5963
|
+
text: image || formatting.vanish ? "" : formatting.caps ? text2.toUpperCase() : text2,
|
|
3380
5964
|
...object ? { object } : {},
|
|
3381
5965
|
...definedProps({
|
|
3382
5966
|
bold: formatting.bold,
|