ooxml-core 1.1.0 → 1.2.1
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-VQQS4VS6.mjs} +3 -3
- package/dist/automation/index.cjs +7567 -4401
- package/dist/automation/index.mjs +7567 -4401
- package/dist/chart/bar-cluster-geometry.d.ts +6 -0
- package/dist/chart/bar-cluster-geometry.d.ts.map +1 -1
- 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 +3069 -140
- package/dist/chart/index.d.ts +7 -0
- package/dist/chart/index.d.ts.map +1 -1
- package/dist/chart/index.mjs +3048 -141
- 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-OMGH6IKY.mjs → chunk-5U27IVB7.mjs} +42 -5
- package/dist/{chunk-RFX7AJDZ.mjs → chunk-5VLNF4OX.mjs} +2 -2
- package/dist/{chunk-OJI3N5AY.cjs → chunk-FRUB573B.cjs} +2 -0
- package/dist/{chunk-75LA7H3F.mjs → chunk-V2BIGIH4.mjs} +27504 -27464
- package/dist/{chunk-Q27H4HFS.mjs → chunk-XBNSBDNT.mjs} +1 -1
- package/dist/{chunk-2C72N64G.cjs → chunk-XROY25LN.cjs} +12 -0
- package/dist/{chunk-LA7D6ZYQ.mjs → chunk-XSFHGZFH.mjs} +3579 -2083
- 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 +4044 -683
- package/dist/docx/index.d.ts +2 -0
- package/dist/docx/index.d.ts.map +1 -1
- package/dist/docx/index.mjs +4040 -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 +2674 -88
- package/dist/docx/layout/index.mjs +2675 -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 +2602 -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 +2601 -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 +34839 -18368
- package/dist/index.mjs +34835 -18368
- 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 +9049 -7167
- 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 +8728 -6846
- 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 +9300 -7249
- 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 +3931 -2077
- package/dist/teams/index.d.ts +1 -0
- package/dist/teams/index.d.ts.map +1 -1
- package/dist/teams/index.mjs +3930 -2077
- 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/context.d.ts +3 -1
- package/dist/xlsx/edit/context.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/history.d.ts +18 -0
- package/dist/xlsx/edit/history.d.ts.map +1 -1
- 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 +32 -3
- 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/sheets.d.ts.map +1 -1
- package/dist/xlsx/edit/types.d.ts +37 -4
- package/dist/xlsx/edit/types.d.ts.map +1 -1
- package/dist/xlsx/formula/engine-core.d.ts.map +1 -1
- package/dist/xlsx/formula/engine-host.d.ts +6 -2
- package/dist/xlsx/formula/engine-host.d.ts.map +1 -1
- package/dist/xlsx/formula/engine-prepare.d.ts +33 -0
- package/dist/xlsx/formula/engine-prepare.d.ts.map +1 -0
- package/dist/xlsx/formula/engine-structure.d.ts +40 -0
- package/dist/xlsx/formula/engine-structure.d.ts.map +1 -0
- package/dist/xlsx/formula/engine-types.d.ts +26 -0
- package/dist/xlsx/formula/engine-types.d.ts.map +1 -1
- package/dist/xlsx/formula/engine.d.ts.map +1 -1
- package/dist/xlsx/formula/formula-shape.d.ts +28 -0
- package/dist/xlsx/formula/formula-shape.d.ts.map +1 -0
- package/dist/xlsx/formula/graph-index.d.ts +3 -1
- package/dist/xlsx/formula/graph-index.d.ts.map +1 -1
- package/dist/xlsx/formula/graph.d.ts +5 -0
- package/dist/xlsx/formula/graph.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/parse-cache.d.ts +9 -0
- package/dist/xlsx/formula/parse-cache.d.ts.map +1 -0
- package/dist/xlsx/formula/parser.d.ts +3 -0
- package/dist/xlsx/formula/parser.d.ts.map +1 -1
- package/dist/xlsx/formula/ref-text.d.ts +14 -0
- package/dist/xlsx/formula/ref-text.d.ts.map +1 -0
- package/dist/xlsx/formula/references.d.ts.map +1 -1
- package/dist/xlsx/formula/shift-formula.d.ts +19 -0
- package/dist/xlsx/formula/shift-formula.d.ts.map +1 -0
- package/dist/xlsx/formula/shift-graph.d.ts +42 -0
- package/dist/xlsx/formula/shift-graph.d.ts.map +1 -0
- package/dist/xlsx/formula/tokenizer.d.ts.map +1 -1
- package/dist/xlsx/formula/transform.d.ts +2 -23
- package/dist/xlsx/formula/transform.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +5620 -2680
- package/dist/xlsx/index.mjs +5609 -2681
- 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 +8 -5
- 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/sheet-queries.d.ts +7 -0
- package/dist/xlsx/layout/sheet-queries.d.ts.map +1 -1
- 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 +3124 -1312
- package/dist/xlsx/load/index.mjs +3124 -1312
- 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 +2165 -866
- package/dist/xlsx/ui/index.mjs +2165 -867
- package/dist/xlsx/ui/locales/de/collab.d.ts +2 -0
- package/dist/xlsx/ui/locales/de/collab.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/de/index.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/en/collab.d.ts +2 -0
- package/dist/xlsx/ui/locales/en/collab.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/en/index.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/es/collab.d.ts +2 -0
- package/dist/xlsx/ui/locales/es/collab.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/es/index.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/fr/collab.d.ts +2 -0
- package/dist/xlsx/ui/locales/fr/collab.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/fr/index.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/zh-CN/collab.d.ts +2 -0
- package/dist/xlsx/ui/locales/zh-CN/collab.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/zh-CN/index.d.ts.map +1 -1
- package/dist/xlsx/ui/ribbon/icon-paths.d.ts.map +1 -1
- package/dist/xlsx/write/chart-colors.d.ts +3 -0
- package/dist/xlsx/write/chart-colors.d.ts.map +1 -1
- package/dist/xlsx/write/chart-space.d.ts +5 -0
- package/dist/xlsx/write/chart-space.d.ts.map +1 -0
- package/dist/xlsx/write/chart-title.d.ts +4 -1
- package/dist/xlsx/write/chart-title.d.ts.map +1 -1
- package/dist/xlsx/write/chart.d.ts +4 -1
- package/dist/xlsx/write/chart.d.ts.map +1 -1
- package/dist/xml/index.cjs +162 -0
- package/dist/xml/index.d.ts +1 -0
- package/dist/xml/index.d.ts.map +1 -1
- package/dist/xml/index.mjs +161 -1
- package/dist/xml/lite.d.ts +30 -0
- package/dist/xml/lite.d.ts.map +1 -0
- package/package.json +6 -1
- package/dist/pptx/chunks/index-BHqL5KXH.d.ts.map +0 -1
- package/dist/pptx/chunks/index-BYkdcS8J.d.ts.map +0 -1
- package/dist/pptx/chunks/smart-art-CO2jmJFf.d.ts.map +0 -1
- package/dist/pptx/chunks/text-operations-DEJ7alZR.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-appearance.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-colors.d.ts +0 -9
- package/dist/xlsx/layout/chart-colors.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-scale.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-spacing.d.ts +0 -6
- package/dist/xlsx/layout/chart-spacing.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-appearance.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-bars.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-cartesian.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-legend.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-radial.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-text-metrics.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-title-text.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-util.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-title-text.d.ts +0 -14
- package/dist/xlsx/layout/chart-title-text.d.ts.map +0 -1
- package/dist/xlsx/layout/font-family.d.ts.map +0 -1
- /package/dist/{xlsx/layout → chart/render}/chart-scale.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-bars.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-cartesian.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-legend.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-radial.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-text-metrics.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-title-text.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-util.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg.d.ts +0 -0
package/dist/docx/ui/index.cjs
CHANGED
|
@@ -171,25 +171,25 @@ var inlineRunFormattingAttrs = Object.fromEntries(
|
|
|
171
171
|
[...RUN_PROPERTY_ATTRIBUTES].map((name) => [name, { default: null }])
|
|
172
172
|
);
|
|
173
173
|
function inlineRunProperties(node) {
|
|
174
|
-
const
|
|
174
|
+
const properties4 = typeof node.attrs.format === "string" ? JSON.parse(node.attrs.format) : {};
|
|
175
175
|
for (const key of DIRECT_RUN_PROPERTY_KEYS) {
|
|
176
176
|
const override = node.attrs[attributeName(key)];
|
|
177
177
|
if (typeof override !== "string") continue;
|
|
178
178
|
const value = JSON.parse(override);
|
|
179
|
-
if (value === null) delete
|
|
180
|
-
else
|
|
179
|
+
if (value === null) delete properties4[key];
|
|
180
|
+
else properties4[key] = value;
|
|
181
181
|
}
|
|
182
182
|
const projection = node.marks.find((mark) => mark.type.name === "inlineCommentAnchors");
|
|
183
183
|
if (projection) {
|
|
184
184
|
const ids = projection.attrs.ids;
|
|
185
|
-
if (ids.length)
|
|
186
|
-
else delete
|
|
185
|
+
if (ids.length) properties4.commentIds = [...ids];
|
|
186
|
+
else delete properties4.commentIds;
|
|
187
187
|
}
|
|
188
|
-
return
|
|
188
|
+
return properties4;
|
|
189
189
|
}
|
|
190
190
|
function inlineRunPropertiesDomAttrs(node) {
|
|
191
|
-
const
|
|
192
|
-
return Object.keys(
|
|
191
|
+
const properties4 = inlineRunProperties(node);
|
|
192
|
+
return Object.keys(properties4).length ? { "data-run-properties": JSON.stringify(properties4) } : {};
|
|
193
193
|
}
|
|
194
194
|
function updatedInlineRunAttributes(node, format) {
|
|
195
195
|
if (!node.type.spec.attrs?.[attributeName("bold")]) return { ...node.attrs, format };
|
|
@@ -773,7 +773,9 @@ function commentIdsFromNode(node) {
|
|
|
773
773
|
// xml/namespaces.ts
|
|
774
774
|
var NS = {
|
|
775
775
|
/** WordprocessingML main. */
|
|
776
|
-
w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
|
|
776
|
+
w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
|
|
777
|
+
/** DrawingML main. */
|
|
778
|
+
a: "http://schemas.openxmlformats.org/drawingml/2006/main"};
|
|
777
779
|
function parseXml(xml, options = {}) {
|
|
778
780
|
const label = options.label ?? "OOXML";
|
|
779
781
|
if (/<!DOCTYPE|<!ENTITY/i.test(xml))
|
|
@@ -877,6 +879,7 @@ var signedTwipsFromPixels = (pixels) => roundSignedTwips(pixels * 15);
|
|
|
877
879
|
|
|
878
880
|
// units/constants.ts
|
|
879
881
|
var EMU_PER_PIXEL = 9525;
|
|
882
|
+
var EMU_PER_POINT = 12700;
|
|
880
883
|
|
|
881
884
|
// docx/simple-types.ts
|
|
882
885
|
function parseOnOff(value) {
|
|
@@ -919,8 +922,8 @@ function universalMeasureToTwips(value) {
|
|
|
919
922
|
}
|
|
920
923
|
function parseSignedTwips(value) {
|
|
921
924
|
if (value === null || value === void 0) return void 0;
|
|
922
|
-
const
|
|
923
|
-
const parsed = SAFE_INTEGER.test(
|
|
925
|
+
const text2 = value.trim();
|
|
926
|
+
const parsed = SAFE_INTEGER.test(text2) ? parseInteger(text2) : universalMeasureToTwips(text2);
|
|
924
927
|
return parsed === void 0 ? void 0 : signedTwips(parsed);
|
|
925
928
|
}
|
|
926
929
|
function parseTwips(value) {
|
|
@@ -929,26 +932,26 @@ function parseTwips(value) {
|
|
|
929
932
|
}
|
|
930
933
|
function parseHalfPoints(value) {
|
|
931
934
|
if (value === null || value === void 0) return void 0;
|
|
932
|
-
const
|
|
933
|
-
if (/^\d+$/.test(
|
|
934
|
-
const parsed = parseInteger(
|
|
935
|
+
const text2 = value.trim();
|
|
936
|
+
if (/^\d+$/.test(text2)) {
|
|
937
|
+
const parsed = parseInteger(text2);
|
|
935
938
|
return parsed === void 0 ? void 0 : halfPoints(parsed);
|
|
936
939
|
}
|
|
937
|
-
const asTwips = UNIVERSAL_MEASURE.test(
|
|
940
|
+
const asTwips = UNIVERSAL_MEASURE.test(text2) ? universalMeasureToTwips(text2) : void 0;
|
|
938
941
|
return asTwips !== void 0 && asTwips >= 0 ? halfPoints(Math.round(asTwips / 10)) : void 0;
|
|
939
942
|
}
|
|
940
943
|
function parseSignedHalfPoints(value) {
|
|
941
944
|
if (value === null || value === void 0) return void 0;
|
|
942
|
-
const
|
|
943
|
-
const integer2 = parseInteger(
|
|
945
|
+
const text2 = value.trim();
|
|
946
|
+
const integer2 = parseInteger(text2);
|
|
944
947
|
if (integer2 !== void 0) return halfPoints(integer2);
|
|
945
|
-
const twips2 = universalMeasureToTwips(
|
|
948
|
+
const twips2 = universalMeasureToTwips(text2);
|
|
946
949
|
return twips2 === void 0 ? void 0 : halfPoints(Math.sign(twips2) * Math.round(Math.abs(twips2) / 10));
|
|
947
950
|
}
|
|
948
951
|
function parseTextScale(value) {
|
|
949
|
-
const
|
|
950
|
-
if (
|
|
951
|
-
const parsed = parseUnsignedInteger(
|
|
952
|
+
const text2 = value?.trim();
|
|
953
|
+
if (text2?.endsWith("%") && !/^\d+%$/.test(text2)) return void 0;
|
|
954
|
+
const parsed = parseUnsignedInteger(text2?.endsWith("%") ? text2.slice(0, -1) : text2);
|
|
952
955
|
return parsed !== void 0 && parsed <= 600 ? parsed : void 0;
|
|
953
956
|
}
|
|
954
957
|
function parseEighthPoints(value) {
|
|
@@ -1134,16 +1137,16 @@ function parseRunProperties(props) {
|
|
|
1134
1137
|
const color = first2(props, "color");
|
|
1135
1138
|
const hex = parseRgbColor(getW(color, "val"));
|
|
1136
1139
|
if (hex) result.color = hex;
|
|
1137
|
-
const
|
|
1138
|
-
if (
|
|
1139
|
-
result.colorTheme = { token:
|
|
1140
|
+
const themeColor2 = enumValue(isStThemeColor, getW(color, "themeColor"));
|
|
1141
|
+
if (themeColor2) {
|
|
1142
|
+
result.colorTheme = { token: themeColor2 };
|
|
1140
1143
|
const tint = parseTintShade(getW(color, "themeTint"));
|
|
1141
1144
|
const shade = parseTintShade(getW(color, "themeShade"));
|
|
1142
1145
|
if (tint !== void 0) result.colorTheme.tint = tint;
|
|
1143
1146
|
if (shade !== void 0) result.colorTheme.shade = shade;
|
|
1144
1147
|
}
|
|
1145
|
-
const
|
|
1146
|
-
if (
|
|
1148
|
+
const spacing2 = parseSignedTwips(getW(first2(props, "spacing"), "val"));
|
|
1149
|
+
if (spacing2 !== void 0) result.characterSpacingTwips = spacing2;
|
|
1147
1150
|
const scaleElement = first2(props, "w");
|
|
1148
1151
|
const scale = scaleElement ? parseTextScale(getW(scaleElement, "val") ?? "100") : void 0;
|
|
1149
1152
|
if (scale !== void 0) result.textScalePercent = scale;
|
|
@@ -1229,13 +1232,13 @@ function borderSide(element) {
|
|
|
1229
1232
|
const style = enumValue(isStBorder, getW(element, "val"));
|
|
1230
1233
|
const size = parseEighthPoints(getW(element, "sz"));
|
|
1231
1234
|
const color = parseRgbColor(getW(element, "color"));
|
|
1232
|
-
const
|
|
1233
|
-
if (!style && size === void 0 && !color && !
|
|
1235
|
+
const themeColor2 = enumValue(isStThemeColor, getW(element, "themeColor"));
|
|
1236
|
+
if (!style && size === void 0 && !color && !themeColor2) return void 0;
|
|
1234
1237
|
const side = {};
|
|
1235
1238
|
if (style) side.style = style;
|
|
1236
1239
|
if (size !== void 0) side.sizeEighthPoints = size;
|
|
1237
1240
|
if (color) side.color = color;
|
|
1238
|
-
if (
|
|
1241
|
+
if (themeColor2) side.themeColor = themeColor2;
|
|
1239
1242
|
return side;
|
|
1240
1243
|
}
|
|
1241
1244
|
function parseTableBorders(bordersElement) {
|
|
@@ -1350,16 +1353,16 @@ function parseFormatting(pPr) {
|
|
|
1350
1353
|
if (borders) result.borders = borders;
|
|
1351
1354
|
const shading = parseShadingFill(first2(pPr, "shd"));
|
|
1352
1355
|
if (shading) result.shadingFill = shading;
|
|
1353
|
-
const
|
|
1354
|
-
const before = twipValue(getW(
|
|
1355
|
-
const after = twipValue(getW(
|
|
1356
|
-
const
|
|
1356
|
+
const spacing2 = first2(pPr, "spacing");
|
|
1357
|
+
const before = twipValue(getW(spacing2, "before"));
|
|
1358
|
+
const after = twipValue(getW(spacing2, "after"));
|
|
1359
|
+
const line2 = signedTwipValue(getW(spacing2, "line"));
|
|
1357
1360
|
if (before !== void 0) result.spacingBeforeTwips = before;
|
|
1358
1361
|
if (after !== void 0) result.spacingAfterTwips = after;
|
|
1359
|
-
if (
|
|
1360
|
-
const rule = getW(
|
|
1362
|
+
if (line2 !== void 0) result.lineSpacingTwips = line2;
|
|
1363
|
+
const rule = getW(spacing2, "lineRule");
|
|
1361
1364
|
if (rule === "auto" || rule === "exact" || rule === "atLeast") result.lineSpacingRule = rule;
|
|
1362
|
-
else if (
|
|
1365
|
+
else if (line2 !== void 0) result.lineSpacingRule = "auto";
|
|
1363
1366
|
const ind = first2(pPr, "ind");
|
|
1364
1367
|
for (const [xml, key] of [
|
|
1365
1368
|
["left", "indentLeftTwips"],
|
|
@@ -1643,13 +1646,13 @@ function hexToRgbChannels(color) {
|
|
|
1643
1646
|
b: Number.parseInt(normalized.slice(4, 6), 16)
|
|
1644
1647
|
};
|
|
1645
1648
|
}
|
|
1646
|
-
function percentDivisorFor(
|
|
1647
|
-
return
|
|
1649
|
+
function percentDivisorFor(text2) {
|
|
1650
|
+
return text2.endsWith("%") ? 100 : 1e5;
|
|
1648
1651
|
}
|
|
1649
1652
|
function parseOoxmlPercent(value) {
|
|
1650
|
-
const
|
|
1651
|
-
const divisor = percentDivisorFor(
|
|
1652
|
-
const magnitude = Number.parseFloat(divisor === 100 ?
|
|
1653
|
+
const text2 = String(value ?? "").trim();
|
|
1654
|
+
const divisor = percentDivisorFor(text2);
|
|
1655
|
+
const magnitude = Number.parseFloat(divisor === 100 ? text2.slice(0, -1) : text2);
|
|
1653
1656
|
if (!Number.isFinite(magnitude)) {
|
|
1654
1657
|
return void 0;
|
|
1655
1658
|
}
|
|
@@ -1695,7 +1698,7 @@ function rgbToHsl(r, g, b) {
|
|
|
1695
1698
|
return { h, s: clampUnitInterval(s), l: clampUnitInterval(l) };
|
|
1696
1699
|
}
|
|
1697
1700
|
function hslToRgb(h, s, l, roundChannel = Math.round, options) {
|
|
1698
|
-
const sC = clampUnitInterval(s);
|
|
1701
|
+
const sC = options?.clampSaturation === false ? s : clampUnitInterval(s);
|
|
1699
1702
|
const lC = clampUnitInterval(l);
|
|
1700
1703
|
const hN = (h % 360 + 360) % 360;
|
|
1701
1704
|
const c = (1 - Math.abs(2 * lC - 1)) * sC;
|
|
@@ -1756,7 +1759,379 @@ function linearToSrgb255(linear) {
|
|
|
1756
1759
|
return 255 * (c <= 31308e-7 ? c * 12.92 : 1.055 * c ** (1 / 2.4) - 0.055);
|
|
1757
1760
|
}
|
|
1758
1761
|
|
|
1762
|
+
// color/native-gradient-curve.ts
|
|
1763
|
+
var OFFICE_SIGMA_FACTORS = [
|
|
1764
|
+
0,
|
|
1765
|
+
59,
|
|
1766
|
+
120,
|
|
1767
|
+
182,
|
|
1768
|
+
247,
|
|
1769
|
+
314,
|
|
1770
|
+
383,
|
|
1771
|
+
454,
|
|
1772
|
+
527,
|
|
1773
|
+
602,
|
|
1774
|
+
680,
|
|
1775
|
+
759,
|
|
1776
|
+
841,
|
|
1777
|
+
926,
|
|
1778
|
+
1013,
|
|
1779
|
+
1102,
|
|
1780
|
+
1194,
|
|
1781
|
+
1288,
|
|
1782
|
+
1385,
|
|
1783
|
+
1485,
|
|
1784
|
+
1587,
|
|
1785
|
+
1692,
|
|
1786
|
+
1800,
|
|
1787
|
+
1911,
|
|
1788
|
+
2024,
|
|
1789
|
+
2141,
|
|
1790
|
+
2260,
|
|
1791
|
+
2383,
|
|
1792
|
+
2508,
|
|
1793
|
+
2637,
|
|
1794
|
+
2769,
|
|
1795
|
+
2904,
|
|
1796
|
+
3042,
|
|
1797
|
+
3183,
|
|
1798
|
+
3328,
|
|
1799
|
+
3477,
|
|
1800
|
+
3628,
|
|
1801
|
+
3783,
|
|
1802
|
+
3942,
|
|
1803
|
+
4104,
|
|
1804
|
+
4270,
|
|
1805
|
+
4439,
|
|
1806
|
+
4612,
|
|
1807
|
+
4789,
|
|
1808
|
+
4969,
|
|
1809
|
+
5153,
|
|
1810
|
+
5341,
|
|
1811
|
+
5533,
|
|
1812
|
+
5728,
|
|
1813
|
+
5928,
|
|
1814
|
+
6131,
|
|
1815
|
+
6338,
|
|
1816
|
+
6549,
|
|
1817
|
+
6764,
|
|
1818
|
+
6983,
|
|
1819
|
+
7206,
|
|
1820
|
+
7434,
|
|
1821
|
+
7665,
|
|
1822
|
+
7900,
|
|
1823
|
+
8139,
|
|
1824
|
+
8382,
|
|
1825
|
+
8630,
|
|
1826
|
+
8881,
|
|
1827
|
+
9136,
|
|
1828
|
+
9396,
|
|
1829
|
+
9660,
|
|
1830
|
+
9927,
|
|
1831
|
+
10199,
|
|
1832
|
+
10475,
|
|
1833
|
+
10755,
|
|
1834
|
+
11039,
|
|
1835
|
+
11327,
|
|
1836
|
+
11619,
|
|
1837
|
+
11916,
|
|
1838
|
+
12216,
|
|
1839
|
+
12520,
|
|
1840
|
+
12828,
|
|
1841
|
+
13140,
|
|
1842
|
+
13456,
|
|
1843
|
+
13776,
|
|
1844
|
+
14099,
|
|
1845
|
+
14427,
|
|
1846
|
+
14758,
|
|
1847
|
+
15093,
|
|
1848
|
+
15431,
|
|
1849
|
+
15774,
|
|
1850
|
+
16119,
|
|
1851
|
+
16469,
|
|
1852
|
+
16822,
|
|
1853
|
+
17178,
|
|
1854
|
+
17538,
|
|
1855
|
+
17901,
|
|
1856
|
+
18267,
|
|
1857
|
+
18637,
|
|
1858
|
+
19009,
|
|
1859
|
+
19385,
|
|
1860
|
+
19764,
|
|
1861
|
+
20146,
|
|
1862
|
+
20530,
|
|
1863
|
+
20918,
|
|
1864
|
+
21308,
|
|
1865
|
+
21701,
|
|
1866
|
+
22096,
|
|
1867
|
+
22494,
|
|
1868
|
+
22894,
|
|
1869
|
+
23297,
|
|
1870
|
+
23702,
|
|
1871
|
+
24109,
|
|
1872
|
+
24518,
|
|
1873
|
+
24929,
|
|
1874
|
+
25342,
|
|
1875
|
+
25756,
|
|
1876
|
+
26173,
|
|
1877
|
+
26591,
|
|
1878
|
+
27010,
|
|
1879
|
+
27431,
|
|
1880
|
+
27853,
|
|
1881
|
+
28276,
|
|
1882
|
+
28701,
|
|
1883
|
+
29126,
|
|
1884
|
+
29552,
|
|
1885
|
+
29979,
|
|
1886
|
+
30407,
|
|
1887
|
+
30836,
|
|
1888
|
+
31264,
|
|
1889
|
+
31694,
|
|
1890
|
+
32123,
|
|
1891
|
+
32553,
|
|
1892
|
+
32983,
|
|
1893
|
+
33413,
|
|
1894
|
+
33842,
|
|
1895
|
+
34272,
|
|
1896
|
+
34700,
|
|
1897
|
+
35129,
|
|
1898
|
+
35557,
|
|
1899
|
+
35984,
|
|
1900
|
+
36410,
|
|
1901
|
+
36835,
|
|
1902
|
+
37260,
|
|
1903
|
+
37683,
|
|
1904
|
+
38105,
|
|
1905
|
+
38526,
|
|
1906
|
+
38945,
|
|
1907
|
+
39363,
|
|
1908
|
+
39780,
|
|
1909
|
+
40194,
|
|
1910
|
+
40607,
|
|
1911
|
+
41018,
|
|
1912
|
+
41427,
|
|
1913
|
+
41834,
|
|
1914
|
+
42239,
|
|
1915
|
+
42642,
|
|
1916
|
+
43042,
|
|
1917
|
+
43440,
|
|
1918
|
+
43835,
|
|
1919
|
+
44228,
|
|
1920
|
+
44618,
|
|
1921
|
+
45006,
|
|
1922
|
+
45390,
|
|
1923
|
+
45772,
|
|
1924
|
+
46151,
|
|
1925
|
+
46527,
|
|
1926
|
+
46899,
|
|
1927
|
+
47269,
|
|
1928
|
+
47635,
|
|
1929
|
+
47998,
|
|
1930
|
+
48358,
|
|
1931
|
+
48714,
|
|
1932
|
+
49067,
|
|
1933
|
+
49417,
|
|
1934
|
+
49762,
|
|
1935
|
+
50105,
|
|
1936
|
+
50443,
|
|
1937
|
+
50778,
|
|
1938
|
+
51109,
|
|
1939
|
+
51437,
|
|
1940
|
+
51760,
|
|
1941
|
+
52080,
|
|
1942
|
+
52396,
|
|
1943
|
+
52708,
|
|
1944
|
+
53016,
|
|
1945
|
+
53320,
|
|
1946
|
+
53620,
|
|
1947
|
+
53917,
|
|
1948
|
+
54209,
|
|
1949
|
+
54497,
|
|
1950
|
+
54781,
|
|
1951
|
+
55061,
|
|
1952
|
+
55337,
|
|
1953
|
+
55609,
|
|
1954
|
+
55876,
|
|
1955
|
+
56140,
|
|
1956
|
+
56400,
|
|
1957
|
+
56655,
|
|
1958
|
+
56906,
|
|
1959
|
+
57154,
|
|
1960
|
+
57397,
|
|
1961
|
+
57636,
|
|
1962
|
+
57871,
|
|
1963
|
+
58102,
|
|
1964
|
+
58330,
|
|
1965
|
+
58553,
|
|
1966
|
+
58772,
|
|
1967
|
+
58987,
|
|
1968
|
+
59198,
|
|
1969
|
+
59405,
|
|
1970
|
+
59608,
|
|
1971
|
+
59808,
|
|
1972
|
+
60003,
|
|
1973
|
+
60195,
|
|
1974
|
+
60383,
|
|
1975
|
+
60567,
|
|
1976
|
+
60747,
|
|
1977
|
+
60924,
|
|
1978
|
+
61097,
|
|
1979
|
+
61266,
|
|
1980
|
+
61432,
|
|
1981
|
+
61594,
|
|
1982
|
+
61753,
|
|
1983
|
+
61908,
|
|
1984
|
+
62059,
|
|
1985
|
+
62208,
|
|
1986
|
+
62353,
|
|
1987
|
+
62494,
|
|
1988
|
+
62632,
|
|
1989
|
+
62767,
|
|
1990
|
+
62899,
|
|
1991
|
+
63028,
|
|
1992
|
+
63153,
|
|
1993
|
+
63276,
|
|
1994
|
+
63395,
|
|
1995
|
+
63512,
|
|
1996
|
+
63625,
|
|
1997
|
+
63736,
|
|
1998
|
+
63844,
|
|
1999
|
+
63949,
|
|
2000
|
+
64051,
|
|
2001
|
+
64151,
|
|
2002
|
+
64248,
|
|
2003
|
+
64342,
|
|
2004
|
+
64434,
|
|
2005
|
+
64523,
|
|
2006
|
+
64610,
|
|
2007
|
+
64695,
|
|
2008
|
+
64777,
|
|
2009
|
+
64856,
|
|
2010
|
+
64934,
|
|
2011
|
+
65009,
|
|
2012
|
+
65082,
|
|
2013
|
+
65153,
|
|
2014
|
+
65222,
|
|
2015
|
+
65289,
|
|
2016
|
+
65354,
|
|
2017
|
+
65416,
|
|
2018
|
+
65477,
|
|
2019
|
+
65536
|
|
2020
|
+
];
|
|
2021
|
+
|
|
2022
|
+
// color/sigma-gradient-stops.ts
|
|
2023
|
+
function sigmaGradientStops(stops) {
|
|
2024
|
+
if (stops.length !== 2 || stops[0]?.offset !== 0 || stops[1]?.offset !== 1) return void 0;
|
|
2025
|
+
if (stops.some((stop) => (stop.opacity ?? 1) !== 1)) return void 0;
|
|
2026
|
+
const front = hexToRgbChannels(stops[0].color);
|
|
2027
|
+
const back = hexToRgbChannels(stops[1].color);
|
|
2028
|
+
if (!front || !back) return void 0;
|
|
2029
|
+
return OFFICE_SIGMA_FACTORS.map((value, index) => {
|
|
2030
|
+
const factor = value / 65536;
|
|
2031
|
+
const mix = (a, b) => toHex(255 * ((a / 255) ** 2.2 * (1 - factor) + (b / 255) ** 2.2 * factor) ** (1 / 2.2));
|
|
2032
|
+
return {
|
|
2033
|
+
offset: Math.fround(index / 255),
|
|
2034
|
+
color: `#${mix(front.r, back.r)}${mix(front.g, back.g)}${mix(front.b, back.b)}`,
|
|
2035
|
+
opacity: 1
|
|
2036
|
+
};
|
|
2037
|
+
});
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
// color/hex-rgb.ts
|
|
2041
|
+
function parseArgbHex(hex) {
|
|
2042
|
+
const clean2 = hex.replace(/^#/, "");
|
|
2043
|
+
const rgb = clean2.length === 8 ? clean2.slice(2) : clean2;
|
|
2044
|
+
if (!/^[0-9a-fA-F]{6}$/.test(rgb)) return void 0;
|
|
2045
|
+
return [0, 2, 4].map((i) => parseInt(rgb.slice(i, i + 2), 16));
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
// drawingml/ordered-color-transforms.ts
|
|
2049
|
+
function orderedColorTransforms(channels, transforms) {
|
|
2050
|
+
let { r, g, b } = channels;
|
|
2051
|
+
let alpha = 1;
|
|
2052
|
+
const wrap = (value) => (value % 360 + 360) % 360;
|
|
2053
|
+
for (const transform of transforms) {
|
|
2054
|
+
const { name, value } = transform;
|
|
2055
|
+
const fraction = parseDrawingFraction(value);
|
|
2056
|
+
if (name === "alpha" && fraction !== void 0) alpha = clampUnitInterval(fraction);
|
|
2057
|
+
else if (name === "alphaMod" && fraction !== void 0)
|
|
2058
|
+
alpha = clampUnitInterval(alpha * fraction);
|
|
2059
|
+
else if (name === "alphaOff" && fraction !== void 0)
|
|
2060
|
+
alpha = clampUnitInterval(alpha + fraction);
|
|
2061
|
+
else if (name === "inv") [r, g, b] = [255 - r, 255 - g, 255 - b];
|
|
2062
|
+
else if (name === "gray") r = g = b = 0.299 * r + 0.587 * g + 0.114 * b;
|
|
2063
|
+
else if ((name === "shade" || name === "tint") && fraction !== void 0) {
|
|
2064
|
+
const mix = (channel) => linearToSrgb255(
|
|
2065
|
+
name === "shade" ? srgb255ToLinear(channel) * fraction : 1 - (1 - srgb255ToLinear(channel)) * fraction
|
|
2066
|
+
);
|
|
2067
|
+
[r, g, b] = [mix(r), mix(g), mix(b)];
|
|
2068
|
+
} else {
|
|
2069
|
+
const hsl = rgbToHsl(r, g, b);
|
|
2070
|
+
if (name === "comp") hsl.h = wrap(hsl.h + 180);
|
|
2071
|
+
else if (name === "hue") {
|
|
2072
|
+
const hue = parseDrawingHueDegrees(value);
|
|
2073
|
+
if (hue !== void 0) hsl.h = wrap(hue);
|
|
2074
|
+
} else if (name === "hueOff") {
|
|
2075
|
+
const hue = parseDrawingHueDegrees(value);
|
|
2076
|
+
if (hue !== void 0) hsl.h = wrap(hsl.h + hue);
|
|
2077
|
+
} else if (name === "hueMod" && fraction !== void 0) hsl.h = wrap(hsl.h * fraction);
|
|
2078
|
+
else if (name === "sat" && fraction !== void 0) hsl.s = clampUnitInterval(fraction);
|
|
2079
|
+
else if (name === "satMod" && fraction !== void 0) hsl.s *= fraction;
|
|
2080
|
+
else if (name === "satOff" && fraction !== void 0)
|
|
2081
|
+
hsl.s = clampUnitInterval(hsl.s + fraction);
|
|
2082
|
+
else if (name === "lum" && fraction !== void 0) hsl.l = clampUnitInterval(fraction);
|
|
2083
|
+
else if (name === "lumMod" && fraction !== void 0)
|
|
2084
|
+
hsl.l = clampUnitInterval(hsl.l * fraction);
|
|
2085
|
+
else if (name === "lumOff" && fraction !== void 0)
|
|
2086
|
+
hsl.l = clampUnitInterval(hsl.l + fraction);
|
|
2087
|
+
else continue;
|
|
2088
|
+
({ r, g, b } = hslToRgb(hsl.h, hsl.s, hsl.l, (channel) => channel, {
|
|
2089
|
+
clampSaturation: false
|
|
2090
|
+
}));
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
return { r, g, b, alpha };
|
|
2094
|
+
}
|
|
2095
|
+
|
|
1759
2096
|
// drawingml/drawing-color.ts
|
|
2097
|
+
var COLOR_ELEMENTS = {
|
|
2098
|
+
srgbClr: "srgb",
|
|
2099
|
+
schemeClr: "scheme",
|
|
2100
|
+
sysClr: "system",
|
|
2101
|
+
prstClr: "preset",
|
|
2102
|
+
scrgbClr: "scrgb",
|
|
2103
|
+
hslClr: "hsl"
|
|
2104
|
+
};
|
|
2105
|
+
function colorValue(kind, element) {
|
|
2106
|
+
const attribute = (name) => element.getAttribute(name) ?? "";
|
|
2107
|
+
if (kind === "scrgb") return `${attribute("r")},${attribute("g")},${attribute("b")}`;
|
|
2108
|
+
if (kind === "hsl") return `${attribute("hue")},${attribute("sat")},${attribute("lum")}`;
|
|
2109
|
+
return attribute("val");
|
|
2110
|
+
}
|
|
2111
|
+
function parseDrawingColorIn(container) {
|
|
2112
|
+
if (!container) return void 0;
|
|
2113
|
+
for (const element of elements(container)) {
|
|
2114
|
+
const kind = COLOR_ELEMENTS[element.localName];
|
|
2115
|
+
if (!kind || element.namespaceURI && element.namespaceURI !== NS.a) continue;
|
|
2116
|
+
return parseDrawingColor(element);
|
|
2117
|
+
}
|
|
2118
|
+
return void 0;
|
|
2119
|
+
}
|
|
2120
|
+
function parseDrawingColor(element) {
|
|
2121
|
+
const kind = COLOR_ELEMENTS[element.localName];
|
|
2122
|
+
if (!kind) return void 0;
|
|
2123
|
+
const color = {
|
|
2124
|
+
kind,
|
|
2125
|
+
value: colorValue(kind, element),
|
|
2126
|
+
transforms: elements(element).map((child) => ({
|
|
2127
|
+
name: child.localName,
|
|
2128
|
+
value: child.getAttribute("val") ?? ""
|
|
2129
|
+
}))
|
|
2130
|
+
};
|
|
2131
|
+
const fallback = kind === "system" ? element.getAttribute("lastClr") : null;
|
|
2132
|
+
if (fallback) color.fallback = fallback;
|
|
2133
|
+
return color;
|
|
2134
|
+
}
|
|
1760
2135
|
var PRESET_COLORS = {
|
|
1761
2136
|
black: "#000000",
|
|
1762
2137
|
white: "#FFFFFF",
|
|
@@ -1816,6 +2191,17 @@ function resolveDrawingColor(color, theme, options) {
|
|
|
1816
2191
|
const base = baseHex(color, theme);
|
|
1817
2192
|
const rgb = base ? hexToRgbChannels(base) : null;
|
|
1818
2193
|
if (!rgb) return void 0;
|
|
2194
|
+
if (options?.transformOrder === "document") {
|
|
2195
|
+
const value = orderedColorTransforms(rgb, color.transforms);
|
|
2196
|
+
const round = options.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
|
|
2197
|
+
return {
|
|
2198
|
+
hex: `#${toHex(round(value.r))}${toHex(round(value.g))}${toHex(round(value.b))}`,
|
|
2199
|
+
alpha: value.alpha,
|
|
2200
|
+
unapplied: [...new Set(color.transforms.map((transform) => transform.name))].filter(
|
|
2201
|
+
(name) => !APPLIED.has(name)
|
|
2202
|
+
)
|
|
2203
|
+
};
|
|
2204
|
+
}
|
|
1819
2205
|
let { r, g, b } = rgb;
|
|
1820
2206
|
const find = (name) => color.transforms.find((entry) => entry.name === name)?.value;
|
|
1821
2207
|
const has = (name) => color.transforms.some((entry) => entry.name === name);
|
|
@@ -1858,7 +2244,7 @@ function resolveDrawingColor(color, theme, options) {
|
|
|
1858
2244
|
if (lumMod !== void 0) hsl.l = clampUnitInterval(hsl.l * lumMod);
|
|
1859
2245
|
const lumOff = parseDrawingFraction(find("lumOff"));
|
|
1860
2246
|
if (lumOff !== void 0) hsl.l = clampUnitInterval(hsl.l + lumOff);
|
|
1861
|
-
const round = Math.round;
|
|
2247
|
+
const round = options?.hslRounding === "halfDown" ? (value) => Math.ceil(value - 0.5) : Math.round;
|
|
1862
2248
|
({ r, g, b } = hslToRgb(hsl.h, hsl.s, hsl.l, round));
|
|
1863
2249
|
}
|
|
1864
2250
|
let alpha = parseDrawingPercent(find("alpha")) ?? 1;
|
|
@@ -1913,6 +2299,11 @@ function themeColorSlotFor(name, colorMap = {}) {
|
|
|
1913
2299
|
if (name === "dk1" || name === "lt1" || name === "dk2" || name === "lt2") return name;
|
|
1914
2300
|
return colorMap[name] ?? name;
|
|
1915
2301
|
}
|
|
2302
|
+
function themeSlotHex(color) {
|
|
2303
|
+
if (!color) return void 0;
|
|
2304
|
+
const value = color.kind === "srgb" ? color.value : color.kind === "system" ? color.fallback : void 0;
|
|
2305
|
+
return value ? value.toUpperCase() : void 0;
|
|
2306
|
+
}
|
|
1916
2307
|
|
|
1917
2308
|
// docx/theme-color.ts
|
|
1918
2309
|
function isThemeColorToken(value) {
|
|
@@ -1922,6 +2313,11 @@ function fractionToThemeByte(fraction) {
|
|
|
1922
2313
|
return toHex(Math.round(Math.min(1, Math.max(0, fraction)) * 255));
|
|
1923
2314
|
}
|
|
1924
2315
|
|
|
2316
|
+
// opc/signature/xml-utils.ts
|
|
2317
|
+
function escapeXmlAttr(value) {
|
|
2318
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
2319
|
+
}
|
|
2320
|
+
|
|
1925
2321
|
// docx/comment-spans.ts
|
|
1926
2322
|
function rangeKeys(run) {
|
|
1927
2323
|
const keys = (run.commentIds ?? []).map((id) => `comment:${id}`);
|
|
@@ -2212,24 +2608,24 @@ function updateDirection(doc, props, paragraph, base) {
|
|
|
2212
2608
|
}
|
|
2213
2609
|
}
|
|
2214
2610
|
function updateSpacing(doc, props, paragraph, base) {
|
|
2215
|
-
let
|
|
2216
|
-
if (!
|
|
2217
|
-
|
|
2218
|
-
props.appendChild(
|
|
2611
|
+
let spacing2 = first2(props, "spacing");
|
|
2612
|
+
if (!spacing2) {
|
|
2613
|
+
spacing2 = makeW(doc, "spacing");
|
|
2614
|
+
props.appendChild(spacing2);
|
|
2219
2615
|
}
|
|
2220
2616
|
if (!base || paragraph.spacingBeforeTwips !== base.spacingBeforeTwips)
|
|
2221
|
-
setWordValue(
|
|
2617
|
+
setWordValue(spacing2, "before", paragraph.spacingBeforeTwips);
|
|
2222
2618
|
if (!base || paragraph.spacingAfterTwips !== base.spacingAfterTwips)
|
|
2223
|
-
setWordValue(
|
|
2619
|
+
setWordValue(spacing2, "after", paragraph.spacingAfterTwips);
|
|
2224
2620
|
if (!base || paragraph.lineSpacingTwips !== base.lineSpacingTwips || paragraph.lineSpacingRule !== base.lineSpacingRule) {
|
|
2225
|
-
setWordValue(
|
|
2621
|
+
setWordValue(spacing2, "line", paragraph.lineSpacingTwips);
|
|
2226
2622
|
setWordValue(
|
|
2227
|
-
|
|
2623
|
+
spacing2,
|
|
2228
2624
|
"lineRule",
|
|
2229
2625
|
paragraph.lineSpacingRule ?? (paragraph.lineSpacingTwips === void 0 ? void 0 : "auto")
|
|
2230
2626
|
);
|
|
2231
2627
|
}
|
|
2232
|
-
if (!
|
|
2628
|
+
if (!spacing2.attributes.length && !spacing2.childNodes.length) props.removeChild(spacing2);
|
|
2233
2629
|
}
|
|
2234
2630
|
function updateIndent(doc, props, paragraph, base) {
|
|
2235
2631
|
let indent = first2(props, "ind");
|
|
@@ -2552,10 +2948,10 @@ function hasUnexpectedAttributes(element, allowed, allowDateUtc = false) {
|
|
|
2552
2948
|
}
|
|
2553
2949
|
return false;
|
|
2554
2950
|
}
|
|
2555
|
-
function runPropertiesHaveUnknownContent(
|
|
2556
|
-
if (!
|
|
2557
|
-
if (hasUnexpectedAttributes(
|
|
2558
|
-
for (const node of Array.from(
|
|
2951
|
+
function runPropertiesHaveUnknownContent(properties4) {
|
|
2952
|
+
if (!properties4) return false;
|
|
2953
|
+
if (hasUnexpectedAttributes(properties4, [])) return true;
|
|
2954
|
+
for (const node of Array.from(properties4.childNodes)) {
|
|
2559
2955
|
if (node.nodeType !== 1) {
|
|
2560
2956
|
if (node.nodeType === 3 && node.textContent?.trim()) return true;
|
|
2561
2957
|
continue;
|
|
@@ -2659,9 +3055,9 @@ function setExtendedRunProperties(doc, props, run, base) {
|
|
|
2659
3055
|
if (changed("characterSpacingTwips")) {
|
|
2660
3056
|
removeChildren2(props, "spacing");
|
|
2661
3057
|
if (run.characterSpacingTwips !== void 0) {
|
|
2662
|
-
const
|
|
2663
|
-
setAttribute5(
|
|
2664
|
-
props.appendChild(
|
|
3058
|
+
const spacing2 = makeW(doc, "spacing");
|
|
3059
|
+
setAttribute5(spacing2, "val", String(Math.round(run.characterSpacingTwips)));
|
|
3060
|
+
props.appendChild(spacing2);
|
|
2665
3061
|
}
|
|
2666
3062
|
}
|
|
2667
3063
|
if (changed("shadingFill") || changed("shadingThemeFill")) {
|
|
@@ -2759,13 +3155,13 @@ function buildWatermarkRun(doc, spec, uniqueId) {
|
|
|
2759
3155
|
shape.setAttribute("stroked", "f");
|
|
2760
3156
|
const fill = v("fill");
|
|
2761
3157
|
fill.setAttribute("opacity", spec.semitransparent ? ".5" : "1");
|
|
2762
|
-
const
|
|
2763
|
-
|
|
2764
|
-
|
|
3158
|
+
const text2 = v("textpath");
|
|
3159
|
+
text2.setAttribute("style", `font-family:"${spec.fontFamily ?? "Calibri"}";font-size:1pt`);
|
|
3160
|
+
text2.setAttribute("string", spec.text);
|
|
2765
3161
|
const wrap = makeNS(doc, WORD10_NS, "w10:wrap");
|
|
2766
3162
|
wrap.setAttribute("anchorx", "margin");
|
|
2767
3163
|
wrap.setAttribute("anchory", "margin");
|
|
2768
|
-
for (const child of [fill,
|
|
3164
|
+
for (const child of [fill, text2, wrap]) shape.appendChild(child);
|
|
2769
3165
|
pict.appendChild(type);
|
|
2770
3166
|
pict.appendChild(shape);
|
|
2771
3167
|
run.appendChild(pict);
|
|
@@ -2785,15 +3181,15 @@ var add = (parent, ...items) => {
|
|
|
2785
3181
|
var emu = (px) => String(Math.max(1, Math.round(px * EMU_PER_PIXEL)));
|
|
2786
3182
|
var descendants = (root, ns, local) => Array.from(root.getElementsByTagNameNS(ns, local));
|
|
2787
3183
|
function paragraphsFor(doc, lines) {
|
|
2788
|
-
return (lines.length ? lines : [""]).map((
|
|
3184
|
+
return (lines.length ? lines : [""]).map((line2) => {
|
|
2789
3185
|
const paragraph = makeW(doc, "p");
|
|
2790
|
-
if (
|
|
3186
|
+
if (line2) {
|
|
2791
3187
|
const run = makeW(doc, "r");
|
|
2792
|
-
const
|
|
2793
|
-
if (/^\s|\s$/.test(
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
add(run,
|
|
3188
|
+
const text2 = makeW(doc, "t");
|
|
3189
|
+
if (/^\s|\s$/.test(line2))
|
|
3190
|
+
text2.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
|
|
3191
|
+
text2.textContent = line2;
|
|
3192
|
+
add(run, text2);
|
|
2797
3193
|
add(paragraph, run);
|
|
2798
3194
|
}
|
|
2799
3195
|
return paragraph;
|
|
@@ -2837,6 +3233,1962 @@ function patchTextBox(doc, drawing, image, base) {
|
|
|
2837
3233
|
}
|
|
2838
3234
|
}
|
|
2839
3235
|
|
|
3236
|
+
// drawingml/drawing-color-css.ts
|
|
3237
|
+
function drawingColorCss(value) {
|
|
3238
|
+
if (!value || value.alpha === 1) return value?.hex;
|
|
3239
|
+
const channels = [1, 3, 5].map(
|
|
3240
|
+
(offset) => Number.parseInt(value.hex.slice(offset, offset + 2), 16)
|
|
3241
|
+
);
|
|
3242
|
+
return `rgba(${channels.join(",")},${value.alpha})`;
|
|
3243
|
+
}
|
|
3244
|
+
|
|
3245
|
+
// drawingml/drawing-shadow.ts
|
|
3246
|
+
function resolveDrawingShadow(effects, theme) {
|
|
3247
|
+
const node = first(effects, "outerShdw", NS.a);
|
|
3248
|
+
if (!node) return void 0;
|
|
3249
|
+
const value = (key, fallback) => Number(node.getAttribute(key) ?? fallback);
|
|
3250
|
+
if (value("sx", 1e5) !== 1e5 || value("sy", 1e5) !== 1e5 || value("kx", 0) !== 0 || value("ky", 0) !== 0)
|
|
3251
|
+
return void 0;
|
|
3252
|
+
const color = parseDrawingColorIn(node);
|
|
3253
|
+
const resolved = color && resolveDrawingColor(color, theme, { transformOrder: "document" });
|
|
3254
|
+
const blur = value("blurRad", 0) / EMU_PER_PIXEL;
|
|
3255
|
+
const distance = value("dist", 0) / EMU_PER_PIXEL;
|
|
3256
|
+
const angle = value("dir", 0) / 6e4 * Math.PI / 180;
|
|
3257
|
+
if (!resolved || ![blur, distance, angle].every(Number.isFinite) || blur < 0 || distance < 0)
|
|
3258
|
+
return void 0;
|
|
3259
|
+
return {
|
|
3260
|
+
color: resolved.hex,
|
|
3261
|
+
opacity: resolved.alpha,
|
|
3262
|
+
blur,
|
|
3263
|
+
dx: Math.cos(angle) * distance,
|
|
3264
|
+
dy: Math.sin(angle) * distance
|
|
3265
|
+
};
|
|
3266
|
+
}
|
|
3267
|
+
function resolveDrawingShadowXml(xml, theme) {
|
|
3268
|
+
return xml ? resolveDrawingShadow(parseXml(xml).documentElement, theme) : void 0;
|
|
3269
|
+
}
|
|
3270
|
+
function svgDropShadowElement(s, format) {
|
|
3271
|
+
const num = format.number;
|
|
3272
|
+
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"/>`;
|
|
3273
|
+
}
|
|
3274
|
+
function hexToRgb(color) {
|
|
3275
|
+
const parsed = hexToRgbChannels(color);
|
|
3276
|
+
if (parsed) return parsed;
|
|
3277
|
+
const hex = color.replace("#", "");
|
|
3278
|
+
return {
|
|
3279
|
+
r: Number.parseInt(hex.slice(0, 2), 16) || 0,
|
|
3280
|
+
g: Number.parseInt(hex.slice(2, 4), 16) || 0,
|
|
3281
|
+
b: Number.parseInt(hex.slice(4, 6), 16) || 0
|
|
3282
|
+
};
|
|
3283
|
+
}
|
|
3284
|
+
function toHexChannel(value) {
|
|
3285
|
+
return toHex(value).toLowerCase();
|
|
3286
|
+
}
|
|
3287
|
+
function lerpStops(a, b, t) {
|
|
3288
|
+
const ca = hexToRgb(a.color);
|
|
3289
|
+
const cb = hexToRgb(b.color);
|
|
3290
|
+
const oa = a.opacity ?? 1;
|
|
3291
|
+
const ob = b.opacity ?? 1;
|
|
3292
|
+
return {
|
|
3293
|
+
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)}`,
|
|
3294
|
+
opacity: oa + (ob - oa) * t
|
|
3295
|
+
};
|
|
3296
|
+
}
|
|
3297
|
+
function colorAt(stops, position) {
|
|
3298
|
+
const first3 = stops[0];
|
|
3299
|
+
const last = stops[stops.length - 1];
|
|
3300
|
+
if (position <= first3.position) {
|
|
3301
|
+
return { color: first3.color, opacity: first3.opacity ?? 1 };
|
|
3302
|
+
}
|
|
3303
|
+
if (position >= last.position) {
|
|
3304
|
+
return { color: last.color, opacity: last.opacity ?? 1 };
|
|
3305
|
+
}
|
|
3306
|
+
for (let i = 0; i < stops.length - 1; i += 1) {
|
|
3307
|
+
const from = stops[i];
|
|
3308
|
+
const to = stops[i + 1];
|
|
3309
|
+
if (position >= from.position && position <= to.position) {
|
|
3310
|
+
const span = to.position - from.position;
|
|
3311
|
+
const t = span > 0 ? (position - from.position) / span : 0;
|
|
3312
|
+
return lerpStops(from, to, t);
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
return { color: last.color, opacity: last.opacity ?? 1 };
|
|
3316
|
+
}
|
|
3317
|
+
function resolveInnerRect(fillToRect, focalPoint) {
|
|
3318
|
+
let centerX = 50;
|
|
3319
|
+
let centerY = 50;
|
|
3320
|
+
let width = 0;
|
|
3321
|
+
let height = 0;
|
|
3322
|
+
if (fillToRect) {
|
|
3323
|
+
const { l, t, r, b } = fillToRect;
|
|
3324
|
+
centerX = (l + (1 - r)) / 2 * 100;
|
|
3325
|
+
centerY = (t + (1 - b)) / 2 * 100;
|
|
3326
|
+
width = Math.max(0, Math.min(1, 1 - l - r)) * 100;
|
|
3327
|
+
height = Math.max(0, Math.min(1, 1 - t - b)) * 100;
|
|
3328
|
+
}
|
|
3329
|
+
return {
|
|
3330
|
+
left: centerX - width / 2,
|
|
3331
|
+
top: centerY - height / 2,
|
|
3332
|
+
right: centerX + width / 2,
|
|
3333
|
+
bottom: centerY + height / 2
|
|
3334
|
+
};
|
|
3335
|
+
}
|
|
3336
|
+
function lerpEdge(inner, outer, t) {
|
|
3337
|
+
return inner + (outer - inner) * t;
|
|
3338
|
+
}
|
|
3339
|
+
function buildRectPathGradientSvg(stops, focalPoint, fillToRect, options) {
|
|
3340
|
+
if (stops.length === 0) {
|
|
3341
|
+
return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"/>';
|
|
3342
|
+
}
|
|
3343
|
+
const sorted = [...stops].sort((a, b) => a.position - b.position);
|
|
3344
|
+
const inner = resolveInnerRect(fillToRect);
|
|
3345
|
+
const rects = [];
|
|
3346
|
+
const alphaRects = [];
|
|
3347
|
+
const masked = sorted.some((stop) => (stop.opacity ?? 1) < 1);
|
|
3348
|
+
const bands = options?.bands;
|
|
3349
|
+
if (!Number.isInteger(bands) || bands < 1) throw new RangeError("Invalid gradient band count");
|
|
3350
|
+
for (let i = bands; i >= 0; i -= 1) {
|
|
3351
|
+
const t = i / bands;
|
|
3352
|
+
const { color, opacity } = colorAt(sorted, t * 100);
|
|
3353
|
+
const left = lerpEdge(inner.left, 0, t);
|
|
3354
|
+
const top = lerpEdge(inner.top, 0, t);
|
|
3355
|
+
const right = lerpEdge(inner.right, 100, t);
|
|
3356
|
+
const bottom = lerpEdge(inner.bottom, 100, t);
|
|
3357
|
+
const opacityAttr = !masked && opacity < 1 ? ` fill-opacity="${Math.max(0, opacity).toFixed(3)}"` : "";
|
|
3358
|
+
rects.push(
|
|
3359
|
+
`<rect x="${left.toFixed(2)}" y="${top.toFixed(2)}" width="${(right - left).toFixed(2)}" height="${(bottom - top).toFixed(2)}" fill="${color}"${opacityAttr}/>`
|
|
3360
|
+
);
|
|
3361
|
+
if (masked) {
|
|
3362
|
+
const channel = toHexChannel(opacity * 255);
|
|
3363
|
+
alphaRects.push(
|
|
3364
|
+
`<rect x="${left.toFixed(2)}" y="${top.toFixed(2)}" width="${(right - left).toFixed(2)}" height="${(bottom - top).toFixed(2)}" fill="#${channel}${channel}${channel}"/>`
|
|
3365
|
+
);
|
|
3366
|
+
}
|
|
3367
|
+
}
|
|
3368
|
+
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("");
|
|
3369
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none">${paint}</svg>`;
|
|
3370
|
+
}
|
|
3371
|
+
|
|
3372
|
+
// chart/color-palettes.ts
|
|
3373
|
+
var COLORFUL_VARIATIONS = [
|
|
3374
|
+
{},
|
|
3375
|
+
{ lumMod: 6e4 },
|
|
3376
|
+
{ lumMod: 8e4, lumOff: 2e4 },
|
|
3377
|
+
{ lumMod: 8e4 },
|
|
3378
|
+
{ lumMod: 6e4, lumOff: 4e4 },
|
|
3379
|
+
{ lumMod: 5e4 },
|
|
3380
|
+
{ lumMod: 7e4, lumOff: 3e4 },
|
|
3381
|
+
{ lumMod: 7e4 },
|
|
3382
|
+
{ lumMod: 5e4, lumOff: 5e4 }
|
|
3383
|
+
];
|
|
3384
|
+
var GRAY_VARIATIONS = [
|
|
3385
|
+
{ tint: 88500 },
|
|
3386
|
+
{ tint: 55e3 },
|
|
3387
|
+
{ tint: 75e3 },
|
|
3388
|
+
{ tint: 98500 },
|
|
3389
|
+
{ tint: 3e4 },
|
|
3390
|
+
{ tint: 6e4 },
|
|
3391
|
+
{ tint: 8e4 }
|
|
3392
|
+
];
|
|
3393
|
+
var ACCENTS = ["accent1", "accent2", "accent3", "accent4", "accent5", "accent6"];
|
|
3394
|
+
function colorful(id, index, base) {
|
|
3395
|
+
return { id, group: "colorful", index, meth: "cycle", base, variations: COLORFUL_VARIATIONS };
|
|
3396
|
+
}
|
|
3397
|
+
function mono(id, index, accent, meth) {
|
|
3398
|
+
return { id, group: "monochromatic", index, meth, base: [accent], variations: [] };
|
|
3399
|
+
}
|
|
3400
|
+
var CHART_COLOR_PALETTES = [
|
|
3401
|
+
colorful(10, 1, ACCENTS),
|
|
3402
|
+
colorful(11, 2, ["accent1", "accent3", "accent5"]),
|
|
3403
|
+
colorful(12, 3, ["accent2", "accent4", "accent6"]),
|
|
3404
|
+
colorful(13, 4, ["accent6", "accent5", "accent4"]),
|
|
3405
|
+
...ACCENTS.map((accent, i) => mono(14 + i, 1 + i, accent, "withinLinear")),
|
|
3406
|
+
{
|
|
3407
|
+
id: 20,
|
|
3408
|
+
group: "monochromatic",
|
|
3409
|
+
index: 7,
|
|
3410
|
+
meth: "cycle",
|
|
3411
|
+
base: ["dk1"],
|
|
3412
|
+
variations: GRAY_VARIATIONS
|
|
3413
|
+
},
|
|
3414
|
+
...ACCENTS.map((accent, i) => mono(21 + i, 8 + i, accent, "withinLinearReversed"))
|
|
3415
|
+
];
|
|
3416
|
+
function findChartColorPalette(id) {
|
|
3417
|
+
return CHART_COLOR_PALETTES.find((palette) => palette.id === id);
|
|
3418
|
+
}
|
|
3419
|
+
function withinLinearTransform(i, n2) {
|
|
3420
|
+
if (n2 <= 1) {
|
|
3421
|
+
return {};
|
|
3422
|
+
}
|
|
3423
|
+
const step = 140 / (n2 + 1);
|
|
3424
|
+
const centre = (n2 - 1) / 2;
|
|
3425
|
+
const value = 100 - step * Math.abs(i - centre);
|
|
3426
|
+
if (i < centre) {
|
|
3427
|
+
return { shade: Math.floor(value + 1e-9) * 1e3 };
|
|
3428
|
+
}
|
|
3429
|
+
if (i > centre) {
|
|
3430
|
+
return { tint: Math.ceil(value - 1e-9) * 1e3 };
|
|
3431
|
+
}
|
|
3432
|
+
return {};
|
|
3433
|
+
}
|
|
3434
|
+
function chartPaletteSeriesColorChoice(palette, i, n2) {
|
|
3435
|
+
let base;
|
|
3436
|
+
let transform;
|
|
3437
|
+
if (palette.meth === "cycle") {
|
|
3438
|
+
base = palette.base[i % palette.base.length];
|
|
3439
|
+
const round = Math.floor(i / palette.base.length);
|
|
3440
|
+
transform = (palette.variations.length ? palette.variations[round % palette.variations.length] : {}) ?? {};
|
|
3441
|
+
} else {
|
|
3442
|
+
const index = palette.meth === "withinLinearReversed" ? n2 - 1 - i : i;
|
|
3443
|
+
base = palette.base[0];
|
|
3444
|
+
transform = withinLinearTransform(index, n2);
|
|
3445
|
+
}
|
|
3446
|
+
if (!base) throw new RangeError("A chart palette must have a base color");
|
|
3447
|
+
return {
|
|
3448
|
+
kind: "scheme",
|
|
3449
|
+
value: base,
|
|
3450
|
+
transforms: Object.entries(transform).map(([name, value]) => ({ name, value: String(value) }))
|
|
3451
|
+
};
|
|
3452
|
+
}
|
|
3453
|
+
function chartPaletteSeriesColor(palette, i, n2, scheme) {
|
|
3454
|
+
const choice = chartPaletteSeriesColorChoice(palette, i, n2);
|
|
3455
|
+
return (resolveDrawingColor(choice, { scheme: (name) => scheme[name] })?.hex ?? scheme[choice.value]).toUpperCase();
|
|
3456
|
+
}
|
|
3457
|
+
|
|
3458
|
+
// chart/style-definition.ts
|
|
3459
|
+
var CHART_STYLE_PARTS = [
|
|
3460
|
+
"title",
|
|
3461
|
+
"axisTitle",
|
|
3462
|
+
"categoryAxis",
|
|
3463
|
+
"valueAxis",
|
|
3464
|
+
"legend",
|
|
3465
|
+
"dataLabel",
|
|
3466
|
+
"dataPoint",
|
|
3467
|
+
"dataPointLine",
|
|
3468
|
+
"gridlineMajor",
|
|
3469
|
+
"gridlineMinor",
|
|
3470
|
+
"chartArea",
|
|
3471
|
+
"plotArea"
|
|
3472
|
+
];
|
|
3473
|
+
function resolveChartStyleDefinition(style, resolve) {
|
|
3474
|
+
const out = {};
|
|
3475
|
+
const fillColor = (fill) => fill?.kind === "none" ? "none" : fill?.kind === "solid" ? resolve(fill.color) : void 0;
|
|
3476
|
+
for (const name of CHART_STYLE_PARTS) {
|
|
3477
|
+
const source = style.entries[name];
|
|
3478
|
+
if (!source) continue;
|
|
3479
|
+
const entry = {};
|
|
3480
|
+
for (const key of ["fontSize", "bold", "italic", "underline"]) {
|
|
3481
|
+
const value = source[key];
|
|
3482
|
+
if (value !== void 0) Object.assign(entry, { [key]: value });
|
|
3483
|
+
}
|
|
3484
|
+
const line2 = fillColor(source.line?.fill) ?? (source.lineRef?.color && resolve(source.lineRef.color));
|
|
3485
|
+
const fill = fillColor(source.fill) ?? (source.fillRef?.color && resolve(source.fillRef.color));
|
|
3486
|
+
const color = (source.textColor && resolve(source.textColor)) ?? (source.fontRef?.color && resolve(source.fontRef.color));
|
|
3487
|
+
if (color !== void 0) entry.color = color;
|
|
3488
|
+
if (line2 !== void 0) entry.lineColor = line2;
|
|
3489
|
+
if (fill !== void 0) entry.fillColor = fill;
|
|
3490
|
+
if (source.line?.widthEmu !== void 0 && source.line.widthEmu > 0)
|
|
3491
|
+
entry.lineWidth = source.line.widthEmu / 12700;
|
|
3492
|
+
if (Object.keys(entry).length) out[name] = entry;
|
|
3493
|
+
}
|
|
3494
|
+
return Object.keys(out).length ? out : void 0;
|
|
3495
|
+
}
|
|
3496
|
+
function effectiveBuiltInChartStyle(formatting) {
|
|
3497
|
+
return formatting?.builtInStyle ?? (formatting?.sourceXml ? void 0 : 102);
|
|
3498
|
+
}
|
|
3499
|
+
function builtInChartTextStyle(id) {
|
|
3500
|
+
if (id === void 0 || !Number.isInteger(id) || !(id >= 1 && id <= 48 || id >= 101 && id <= 148))
|
|
3501
|
+
return {};
|
|
3502
|
+
const legacy = id > 100 ? id - 100 : id;
|
|
3503
|
+
const common = {
|
|
3504
|
+
sourceXml: "",
|
|
3505
|
+
fontSize: 10,
|
|
3506
|
+
bold: false,
|
|
3507
|
+
italic: false,
|
|
3508
|
+
fontRef: {
|
|
3509
|
+
index: "minor",
|
|
3510
|
+
color: { kind: "scheme", value: legacy >= 41 ? "lt1" : "tx1", transforms: [] }
|
|
3511
|
+
}
|
|
3512
|
+
};
|
|
3513
|
+
return {
|
|
3514
|
+
title: { ...common, fontSize: id > 100 ? 18 : 10, bold: true },
|
|
3515
|
+
categoryAxis: { ...common },
|
|
3516
|
+
valueAxis: { ...common },
|
|
3517
|
+
legend: { ...common }
|
|
3518
|
+
};
|
|
3519
|
+
}
|
|
3520
|
+
|
|
3521
|
+
// chart/manual-layout.ts
|
|
3522
|
+
function hasManualLayoutFields(layout) {
|
|
3523
|
+
return layout != null && (layout.x !== void 0 || layout.y !== void 0 || layout.width !== void 0 || layout.height !== void 0);
|
|
3524
|
+
}
|
|
3525
|
+
function resolveManualLayoutRect(layout, frame, auto) {
|
|
3526
|
+
if (!hasManualLayoutFields(layout)) return void 0;
|
|
3527
|
+
const x = layout.x === void 0 ? auto.x : layout.xMode === "edge" ? layout.x * frame.width : auto.x + layout.x * frame.width;
|
|
3528
|
+
const y = layout.y === void 0 ? auto.y : layout.yMode === "edge" ? layout.y * frame.height : auto.y + layout.y * frame.height;
|
|
3529
|
+
const width = layout.width === void 0 ? auto.width : layout.widthMode === "edge" ? layout.width * frame.width - x : layout.width * frame.width;
|
|
3530
|
+
const height = layout.height === void 0 ? auto.height : layout.heightMode === "edge" ? layout.height * frame.height - y : layout.height * frame.height;
|
|
3531
|
+
return { x, y, width: Math.max(width, 1), height: Math.max(height, 1) };
|
|
3532
|
+
}
|
|
3533
|
+
|
|
3534
|
+
// chart/gradient-stop-edit.ts
|
|
3535
|
+
function sortGradientStops(stops) {
|
|
3536
|
+
return stops.slice().sort((a, b) => a.position - b.position);
|
|
3537
|
+
}
|
|
3538
|
+
|
|
3539
|
+
// chart/gradient-coincident-stops.ts
|
|
3540
|
+
var NATIVE_COINCIDENT_STOP_RAMP = 1 / 256;
|
|
3541
|
+
function spreadCoincidentStops(stops) {
|
|
3542
|
+
const out = [];
|
|
3543
|
+
for (const [index, stop] of stops.entries()) {
|
|
3544
|
+
const source = stops[index - 1];
|
|
3545
|
+
const previous = out.at(-1);
|
|
3546
|
+
const next = stops[index + 1];
|
|
3547
|
+
if (!source || !previous || stop.offset !== source.offset || stop.color === source.color && (stop.opacity ?? 1) === (source.opacity ?? 1)) {
|
|
3548
|
+
out.push(stop);
|
|
3549
|
+
continue;
|
|
3550
|
+
}
|
|
3551
|
+
const limit = Math.min(1, next ? next.offset : 1);
|
|
3552
|
+
out.push({
|
|
3553
|
+
...stop,
|
|
3554
|
+
offset: Math.max(stop.offset, Math.min(previous.offset + NATIVE_COINCIDENT_STOP_RAMP, limit))
|
|
3555
|
+
});
|
|
3556
|
+
}
|
|
3557
|
+
return out;
|
|
3558
|
+
}
|
|
3559
|
+
|
|
3560
|
+
// chart/gradient-definition.ts
|
|
3561
|
+
function resolveChartGradient(fill, resolve) {
|
|
3562
|
+
const focus = fill.fillToRect;
|
|
3563
|
+
const stops = fill.stops.flatMap((stop) => {
|
|
3564
|
+
const color = resolve(stop.color);
|
|
3565
|
+
return color ? [{ position: stop.position, color: color.hex, opacity: color.alpha }] : [];
|
|
3566
|
+
});
|
|
3567
|
+
return {
|
|
3568
|
+
type: fill.path ? "radial" : "linear",
|
|
3569
|
+
stops,
|
|
3570
|
+
...fill.angle === void 0 ? {} : { angle: fill.angle },
|
|
3571
|
+
...fill.scaled === void 0 ? {} : { scaled: fill.scaled },
|
|
3572
|
+
...fill.path === void 0 ? {} : { path: fill.path },
|
|
3573
|
+
...focus === void 0 ? {} : { fillToRect: { ...focus } },
|
|
3574
|
+
// Native opaque endpoint-pair linear, rect, circle and rectangular-shape profiles.
|
|
3575
|
+
...(!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" } : {},
|
|
3576
|
+
...focus ? { focalPoint: { x: (1 + focus.l - focus.r) / 2, y: (1 + focus.t - focus.b) / 2 } } : {}
|
|
3577
|
+
};
|
|
3578
|
+
}
|
|
3579
|
+
function buildChartGradientDef(id, fill, bounds) {
|
|
3580
|
+
const sourceStops = sortGradientStops(fill.stops).map((stop) => ({
|
|
3581
|
+
offset: Math.min(Math.max(stop.position / 100, 0), 1),
|
|
3582
|
+
color: stop.color,
|
|
3583
|
+
...stop.opacity !== void 0 ? { opacity: stop.opacity } : {}
|
|
3584
|
+
}));
|
|
3585
|
+
const stops = fill.interpolation === "sigma-gamma22" ? sigmaGradientStops(sourceStops) ?? sourceStops : sourceStops;
|
|
3586
|
+
if (fill.type === "radial" && (fill.path === "rect" || fill.path === "shape" && bounds?.shape === "rect")) {
|
|
3587
|
+
const markup = buildRectPathGradientSvg(
|
|
3588
|
+
stops.map((stop) => ({
|
|
3589
|
+
position: stop.offset * 100,
|
|
3590
|
+
color: stop.color,
|
|
3591
|
+
...stop.opacity === void 0 ? {} : { opacity: stop.opacity }
|
|
3592
|
+
})),
|
|
3593
|
+
void 0,
|
|
3594
|
+
fill.fillToRect,
|
|
3595
|
+
{ bands: 1024}
|
|
3596
|
+
);
|
|
3597
|
+
return {
|
|
3598
|
+
kind: "rectPath",
|
|
3599
|
+
id,
|
|
3600
|
+
href: `data:image/svg+xml,${encodeURIComponent(markup)}`,
|
|
3601
|
+
stops
|
|
3602
|
+
};
|
|
3603
|
+
}
|
|
3604
|
+
if (fill.type === "radial") {
|
|
3605
|
+
const cx = fill.focalPoint?.x ?? 0.5;
|
|
3606
|
+
const cy = fill.focalPoint?.y ?? 0.5;
|
|
3607
|
+
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;
|
|
3608
|
+
return {
|
|
3609
|
+
kind: "radialGradient",
|
|
3610
|
+
id,
|
|
3611
|
+
cx,
|
|
3612
|
+
cy,
|
|
3613
|
+
r: Math.max(
|
|
3614
|
+
...[0, 1].flatMap((x) => [0, 1].map((y) => Math.hypot(x - cx, (y - cy) * aspect)))
|
|
3615
|
+
),
|
|
3616
|
+
...aspect === 1 ? {} : { gradientTransform: `matrix(1 0 0 ${1 / aspect} 0 ${cy * (1 - 1 / aspect)})` },
|
|
3617
|
+
stops
|
|
3618
|
+
};
|
|
3619
|
+
}
|
|
3620
|
+
const rad = (fill.angle ?? 0) * Math.PI / 180;
|
|
3621
|
+
const span = fill.scaled ? Math.abs(Math.cos(rad)) + Math.abs(Math.sin(rad)) : 1;
|
|
3622
|
+
const dx = Math.cos(rad) * span / 2;
|
|
3623
|
+
const dy = Math.sin(rad) * span / 2;
|
|
3624
|
+
const round = (value) => Math.round(value * 1e4) / 1e4;
|
|
3625
|
+
return {
|
|
3626
|
+
kind: "linearGradient",
|
|
3627
|
+
id,
|
|
3628
|
+
x1: round(0.5 - dx),
|
|
3629
|
+
y1: round(0.5 - dy),
|
|
3630
|
+
x2: round(0.5 + dx),
|
|
3631
|
+
y2: round(0.5 + dy),
|
|
3632
|
+
stops: spreadCoincidentStops(stops)
|
|
3633
|
+
};
|
|
3634
|
+
}
|
|
3635
|
+
|
|
3636
|
+
// chart/gradient-markup.ts
|
|
3637
|
+
function chartGradientMarkup(def) {
|
|
3638
|
+
if (def.kind === "rectPath")
|
|
3639
|
+
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>`;
|
|
3640
|
+
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}"`;
|
|
3641
|
+
const stops = def.stops.map(
|
|
3642
|
+
(stop) => `<stop offset="${stop.offset}" stop-color="${escapeXmlAttr(stop.color)}" stop-opacity="${stop.opacity ?? 1}"/>`
|
|
3643
|
+
).join("");
|
|
3644
|
+
const transform = def.kind === "radialGradient" && def.gradientTransform ? ` gradientTransform="${escapeXmlAttr(def.gradientTransform)}"` : "";
|
|
3645
|
+
return `<${def.kind} id="${escapeXmlAttr(def.id)}" ${geometry}${transform}>${stops}</${def.kind}>`;
|
|
3646
|
+
}
|
|
3647
|
+
|
|
3648
|
+
// chart/bar-cluster-geometry.ts
|
|
3649
|
+
var DEFAULT_BAR_GAP_WIDTH = 150;
|
|
3650
|
+
function clusteredBarGeometry(barGroupWidth, seriesCount, chartData) {
|
|
3651
|
+
const overlap = chartData.barOverlap ?? 0;
|
|
3652
|
+
const overlapSpan = 1 + (seriesCount - 1) * (1 - overlap / 100);
|
|
3653
|
+
const gapWidth = chartData.barGapWidth ?? DEFAULT_BAR_GAP_WIDTH;
|
|
3654
|
+
const singleBarWidth = barGroupWidth / (overlapSpan + Math.max(gapWidth, 0) / 100);
|
|
3655
|
+
const step = singleBarWidth * (1 - overlap / 100);
|
|
3656
|
+
return { singleBarWidth, step, clusterWidth: singleBarWidth + step * (seriesCount - 1) };
|
|
3657
|
+
}
|
|
3658
|
+
|
|
3659
|
+
// chart/data-cache.ts
|
|
3660
|
+
function chartCacheValues(cache) {
|
|
3661
|
+
if (!cache) return [];
|
|
3662
|
+
const numeric = cache.type === "number";
|
|
3663
|
+
const out = [];
|
|
3664
|
+
for (const point of cache.points) {
|
|
3665
|
+
const text2 = point.value;
|
|
3666
|
+
out[point.index ?? out.length] = numeric && text2.trim() !== "" && Number.isFinite(Number(text2)) ? Number(text2) : text2;
|
|
3667
|
+
}
|
|
3668
|
+
const size = Math.max(cache.pointCount ?? 0, out.length);
|
|
3669
|
+
for (let index = 0; index < size; index++) if (out[index] === void 0) out[index] = "";
|
|
3670
|
+
return out;
|
|
3671
|
+
}
|
|
3672
|
+
var chartSourceValues = (source) => chartCacheValues(source?.cache ?? source?.levels?.[0]);
|
|
3673
|
+
|
|
3674
|
+
// chart/render/summary-from-space.ts
|
|
3675
|
+
var solidColor = (fill) => fill?.kind === "solid" ? fill.color : void 0;
|
|
3676
|
+
var isSolidFill = (fill) => fill?.kind === "solid" || fill?.kind === "unsupported" && fill.element === "solidFill";
|
|
3677
|
+
var GROUP_TYPES = {
|
|
3678
|
+
bar: "bar",
|
|
3679
|
+
line: "line",
|
|
3680
|
+
area: "area",
|
|
3681
|
+
pie: "pie",
|
|
3682
|
+
ofPie: "pie",
|
|
3683
|
+
doughnut: "doughnut",
|
|
3684
|
+
scatter: "scatter",
|
|
3685
|
+
radar: "radar",
|
|
3686
|
+
bubble: "bubble",
|
|
3687
|
+
stock: "stock",
|
|
3688
|
+
surface: "surface"
|
|
3689
|
+
};
|
|
3690
|
+
var GROUPINGS = /* @__PURE__ */ new Set(["clustered", "stacked", "percentStacked", "standard"]);
|
|
3691
|
+
function chartSummarySeries(source, chartType) {
|
|
3692
|
+
const categories = source.categories ?? source.xValues;
|
|
3693
|
+
const values = source.values ?? source.yValues;
|
|
3694
|
+
const out = {
|
|
3695
|
+
categories: chartSourceValues(categories),
|
|
3696
|
+
values: chartSourceValues(values).map(
|
|
3697
|
+
(v) => typeof v === "number" ? v : v === "" ? null : Number.isFinite(Number(v)) ? Number(v) : null
|
|
3698
|
+
)
|
|
3699
|
+
};
|
|
3700
|
+
if (source.tx?.text !== void 0) out.name = source.tx.text;
|
|
3701
|
+
const nameRef = source.tx?.reference?.formula;
|
|
3702
|
+
if (nameRef) out.nameRef = nameRef;
|
|
3703
|
+
if (categories?.formula) out.categoriesRef = categories.formula;
|
|
3704
|
+
if (values?.formula) out.valuesRef = values.formula;
|
|
3705
|
+
if (source.spPr?.effectsXml) out.effectsXml = source.spPr.effectsXml;
|
|
3706
|
+
const primary = ["line", "scatter", "radar"].includes(chartType) ? source.spPr?.line?.fill : source.spPr?.fill;
|
|
3707
|
+
const fill = chartType === "scatter" && !isSolidFill(primary) ? source.marker?.spPr?.fill : primary;
|
|
3708
|
+
const drawingColor = solidColor(fill);
|
|
3709
|
+
if (drawingColor) out.drawingColor = drawingColor;
|
|
3710
|
+
if (fill && fill.kind !== "solid" && !(chartType === "scatter" && fill.kind === "none"))
|
|
3711
|
+
out.fill = fill;
|
|
3712
|
+
const points = {};
|
|
3713
|
+
const pointFills = {};
|
|
3714
|
+
for (const point of source.dataPoints) {
|
|
3715
|
+
const properties4 = point.spPr ?? point.marker?.spPr;
|
|
3716
|
+
if (point.index === void 0) continue;
|
|
3717
|
+
const pointColor = solidColor(properties4?.fill);
|
|
3718
|
+
if (pointColor) points[point.index] = pointColor;
|
|
3719
|
+
if (properties4?.fill && properties4.fill.kind !== "solid")
|
|
3720
|
+
pointFills[point.index] = properties4.fill;
|
|
3721
|
+
}
|
|
3722
|
+
if (Object.keys(points).length) out.pointColors = points;
|
|
3723
|
+
if (Object.keys(pointFills).length) out.pointFills = pointFills;
|
|
3724
|
+
return out;
|
|
3725
|
+
}
|
|
3726
|
+
function chartSummaryFromSpace(chartSpace, extras = {}) {
|
|
3727
|
+
const group = chartSpace.plotArea.groups[0];
|
|
3728
|
+
let chartType = group ? GROUP_TYPES[group.kind] : "column";
|
|
3729
|
+
if (chartType === "bar" && group?.barDirection !== "bar") chartType = "column";
|
|
3730
|
+
const series = (group?.series ?? []).map((source) => chartSummarySeries(source, chartType));
|
|
3731
|
+
const summary = {
|
|
3732
|
+
chartType,
|
|
3733
|
+
series,
|
|
3734
|
+
showLegend: chartSpace.legend !== void 0
|
|
3735
|
+
};
|
|
3736
|
+
const grouping = group?.grouping;
|
|
3737
|
+
if (grouping && GROUPINGS.has(grouping))
|
|
3738
|
+
summary.grouping = grouping;
|
|
3739
|
+
if (chartType === "bar" || chartType === "column") {
|
|
3740
|
+
for (const [value, field, fallback, min, max] of [
|
|
3741
|
+
[group?.gapWidth, "barGapWidth", 150, 0, 500],
|
|
3742
|
+
[group?.overlap, "barOverlap", 0, -100, 100]
|
|
3743
|
+
]) {
|
|
3744
|
+
const resolved = value ?? fallback;
|
|
3745
|
+
if (Number.isInteger(resolved) && resolved >= min && resolved <= max)
|
|
3746
|
+
summary[field] = resolved;
|
|
3747
|
+
}
|
|
3748
|
+
}
|
|
3749
|
+
if (chartSpace.title && chartSpace.autoTitleDeleted !== true) {
|
|
3750
|
+
const title = chartSpace.title.text;
|
|
3751
|
+
if (title !== void 0) summary.title = title;
|
|
3752
|
+
else if (series.length === 1 && series[0]?.name) summary.title = series[0].name;
|
|
3753
|
+
}
|
|
3754
|
+
const legendPos = chartSpace.legend?.position;
|
|
3755
|
+
if (legendPos && ["r", "l", "t", "b", "tr"].includes(legendPos))
|
|
3756
|
+
summary.legendPosition = legendPos;
|
|
3757
|
+
if (extras.formatting) summary.formatting = extras.formatting;
|
|
3758
|
+
if (extras.colorPalette !== void 0) summary.colorPalette = extras.colorPalette;
|
|
3759
|
+
if (extras.styleDefinition) summary.styleDefinition = extras.styleDefinition;
|
|
3760
|
+
return summary;
|
|
3761
|
+
}
|
|
3762
|
+
|
|
3763
|
+
// chart/render/chart-scale.ts
|
|
3764
|
+
var clean = (n2) => Number(n2.toPrecision(12));
|
|
3765
|
+
function* units(raw) {
|
|
3766
|
+
let exp = Math.floor(Math.log10(raw)) - 1;
|
|
3767
|
+
for (; ; ) {
|
|
3768
|
+
const base = 10 ** exp;
|
|
3769
|
+
for (const m of [1, 2, 5]) yield clean(m * base);
|
|
3770
|
+
exp++;
|
|
3771
|
+
}
|
|
3772
|
+
}
|
|
3773
|
+
function niceScale(dataMin, dataMax, options = {}) {
|
|
3774
|
+
const maxIntervals = Math.max(1, options.maxIntervals ?? 10);
|
|
3775
|
+
let lo = Number.isFinite(dataMin) ? dataMin : 0;
|
|
3776
|
+
let hi = Number.isFinite(dataMax) ? dataMax : 0;
|
|
3777
|
+
if (lo > hi) [lo, hi] = [hi, lo];
|
|
3778
|
+
if (lo === hi) {
|
|
3779
|
+
if (lo === 0) hi = 1;
|
|
3780
|
+
else if (options.noZero) {
|
|
3781
|
+
const pad = Math.abs(lo) * 0.1 || 1;
|
|
3782
|
+
lo -= pad;
|
|
3783
|
+
hi += pad;
|
|
3784
|
+
} else if (lo > 0) lo = 0;
|
|
3785
|
+
else hi = 0;
|
|
3786
|
+
}
|
|
3787
|
+
let fixedLo = false;
|
|
3788
|
+
let fixedHi = false;
|
|
3789
|
+
if (!options.noZero) {
|
|
3790
|
+
if (lo >= 0 && hi - lo >= hi / 6) {
|
|
3791
|
+
lo = 0;
|
|
3792
|
+
fixedLo = true;
|
|
3793
|
+
} else if (hi <= 0 && hi - lo >= -lo / 6) {
|
|
3794
|
+
hi = 0;
|
|
3795
|
+
fixedHi = true;
|
|
3796
|
+
}
|
|
3797
|
+
}
|
|
3798
|
+
const range = hi - lo;
|
|
3799
|
+
const top = fixedHi ? hi : hi + range * 0.05;
|
|
3800
|
+
const bottom = fixedLo ? lo : lo - range * 0.05;
|
|
3801
|
+
for (const unit of units(range / maxIntervals)) {
|
|
3802
|
+
const min = fixedLo ? lo : Math.floor(clean(bottom / unit)) * unit;
|
|
3803
|
+
const max = fixedHi ? hi : Math.ceil(clean(top / unit)) * unit;
|
|
3804
|
+
const intervals = Math.round((max - min) / unit);
|
|
3805
|
+
if (intervals <= maxIntervals && intervals > 0) {
|
|
3806
|
+
const ticks = [];
|
|
3807
|
+
for (let i = 0; i <= intervals; i++) ticks.push(clean(min + i * unit));
|
|
3808
|
+
return { min: clean(min), max: clean(max), majorUnit: unit, ticks };
|
|
3809
|
+
}
|
|
3810
|
+
}
|
|
3811
|
+
return { min: lo, max: hi, majorUnit: range, ticks: [lo, hi] };
|
|
3812
|
+
}
|
|
3813
|
+
var PERCENT_SCALE = {
|
|
3814
|
+
min: 0,
|
|
3815
|
+
max: 1,
|
|
3816
|
+
majorUnit: 0.1,
|
|
3817
|
+
ticks: [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]
|
|
3818
|
+
};
|
|
3819
|
+
function formatAxisValue(value, percent = false) {
|
|
3820
|
+
if (percent) return `${clean(value * 100)}%`;
|
|
3821
|
+
const v = clean(value);
|
|
3822
|
+
if (Math.abs(v) >= 1e15 || v !== 0 && Math.abs(v) < 1e-6)
|
|
3823
|
+
return v.toExponential(2).replace("e+", "E+").replace("e-", "E-");
|
|
3824
|
+
const [int = "0", frac] = String(Math.abs(v)).split(".");
|
|
3825
|
+
const grouped = int.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
3826
|
+
return `${v < 0 ? "-" : ""}${grouped}${frac ? `.${frac}` : ""}`;
|
|
3827
|
+
}
|
|
3828
|
+
|
|
3829
|
+
// chart/render/chart-svg-util.ts
|
|
3830
|
+
var TEXT_COLOR = "#595959";
|
|
3831
|
+
var GRID_COLOR = "#D9D9D9";
|
|
3832
|
+
var AXIS_COLOR = "#BFBFBF";
|
|
3833
|
+
var FONT_SIZE = 10;
|
|
3834
|
+
function esc(text2) {
|
|
3835
|
+
return text2.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
3836
|
+
}
|
|
3837
|
+
var n = (value) => String(Math.round(value * 100) / 100);
|
|
3838
|
+
var textWidth = (text2, size = FONT_SIZE) => text2.length * size * 0.55;
|
|
3839
|
+
function text(x, y, content, attrs = {}) {
|
|
3840
|
+
const parts = [`x="${n(x)}"`, `y="${n(y)}"`];
|
|
3841
|
+
parts.push(`font-size="${attrs.size ?? FONT_SIZE}"`);
|
|
3842
|
+
parts.push(`fill="${esc(attrs.fill ?? TEXT_COLOR)}"`);
|
|
3843
|
+
if (attrs.anchor && attrs.anchor !== "start") parts.push(`text-anchor="${attrs.anchor}"`);
|
|
3844
|
+
if (attrs.weight) parts.push(`font-weight="${attrs.weight}"`);
|
|
3845
|
+
if (attrs.baseline) parts.push(`dominant-baseline="${attrs.baseline}"`);
|
|
3846
|
+
if (attrs.family) parts.push(`font-family="${esc(attrs.family)}"`);
|
|
3847
|
+
if (attrs.filter) parts.push(`filter="${esc(attrs.filter)}"`);
|
|
3848
|
+
if (attrs.italic !== void 0) parts.push(`font-style="${attrs.italic ? "italic" : "normal"}"`);
|
|
3849
|
+
if (attrs.underline !== void 0)
|
|
3850
|
+
parts.push(`text-decoration="${attrs.underline ? "underline" : "none"}"`);
|
|
3851
|
+
return `<text ${parts.join(" ")}>${esc(content)}</text>`;
|
|
3852
|
+
}
|
|
3853
|
+
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}"/>`;
|
|
3854
|
+
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)}"` : ""}/>`;
|
|
3855
|
+
function fit(content, maxWidth, size = FONT_SIZE) {
|
|
3856
|
+
if (textWidth(content, size) <= maxWidth) return content;
|
|
3857
|
+
const chars = Math.max(1, Math.floor(maxWidth / (size * 0.55)) - 1);
|
|
3858
|
+
return `${content.slice(0, chars)}\u2026`;
|
|
3859
|
+
}
|
|
3860
|
+
|
|
3861
|
+
// chart/render/theme-palette.ts
|
|
3862
|
+
var THEME_SLOTS = [
|
|
3863
|
+
"lt1",
|
|
3864
|
+
"dk1",
|
|
3865
|
+
"lt2",
|
|
3866
|
+
"dk2",
|
|
3867
|
+
"accent1",
|
|
3868
|
+
"accent2",
|
|
3869
|
+
"accent3",
|
|
3870
|
+
"accent4",
|
|
3871
|
+
"accent5",
|
|
3872
|
+
"accent6",
|
|
3873
|
+
"hlink",
|
|
3874
|
+
"folHlink"
|
|
3875
|
+
];
|
|
3876
|
+
var DEFAULT_THEME_COLORS = [
|
|
3877
|
+
"FFFFFF",
|
|
3878
|
+
"000000",
|
|
3879
|
+
"E7E6E6",
|
|
3880
|
+
"44546A",
|
|
3881
|
+
"4472C4",
|
|
3882
|
+
"ED7D31",
|
|
3883
|
+
"A5A5A5",
|
|
3884
|
+
"FFC000",
|
|
3885
|
+
"5B9BD5",
|
|
3886
|
+
"70AD47",
|
|
3887
|
+
"0563C1",
|
|
3888
|
+
"954F72"
|
|
3889
|
+
];
|
|
3890
|
+
function themeColor(theme, index) {
|
|
3891
|
+
const hex = theme.colors[index] ?? DEFAULT_THEME_COLORS[index];
|
|
3892
|
+
return hex && parseArgbHex(hex) ? hex.replace(/^#/, "") : void 0;
|
|
3893
|
+
}
|
|
3894
|
+
|
|
3895
|
+
// chart/render/chart-colors.ts
|
|
3896
|
+
function chartColorScheme(theme) {
|
|
3897
|
+
const slots = Object.fromEntries(
|
|
3898
|
+
THEME_SLOTS.map((slot, index) => [slot, `#${themeColor(theme, index) ?? "000000"}`])
|
|
3899
|
+
);
|
|
3900
|
+
return {
|
|
3901
|
+
...slots,
|
|
3902
|
+
bg1: slots.lt1,
|
|
3903
|
+
tx1: slots.dk1,
|
|
3904
|
+
bg2: slots.lt2,
|
|
3905
|
+
tx2: slots.dk2
|
|
3906
|
+
};
|
|
3907
|
+
}
|
|
3908
|
+
function autoSeriesColor(theme, index) {
|
|
3909
|
+
const i = Math.max(0, Math.floor(index));
|
|
3910
|
+
return chartPaletteSeriesColor(findChartColorPalette(10), i, i + 1, chartColorScheme(theme));
|
|
3911
|
+
}
|
|
3912
|
+
|
|
3913
|
+
// chart/render/chart-value-axis.ts
|
|
3914
|
+
function valueAxis(model) {
|
|
3915
|
+
const stackable = model.type === "bar" || model.type === "column" || model.type === "line" || model.type === "area";
|
|
3916
|
+
if (stackable && model.grouping === "percentStacked")
|
|
3917
|
+
return { ...PERCENT_SCALE, ticks: [...PERCENT_SCALE.ticks], percent: true };
|
|
3918
|
+
let min = Infinity;
|
|
3919
|
+
let max = -Infinity;
|
|
3920
|
+
if (stackable && model.grouping === "stacked") {
|
|
3921
|
+
for (let i = 0; i < model.categories.length; i++) {
|
|
3922
|
+
let pos = 0;
|
|
3923
|
+
let neg = 0;
|
|
3924
|
+
for (const s of model.series) {
|
|
3925
|
+
const v = s.values[i] ?? 0;
|
|
3926
|
+
if (v >= 0) pos += v;
|
|
3927
|
+
else neg += v;
|
|
3928
|
+
}
|
|
3929
|
+
min = Math.min(min, neg);
|
|
3930
|
+
max = Math.max(max, pos);
|
|
3931
|
+
}
|
|
3932
|
+
} else {
|
|
3933
|
+
for (const s of model.series)
|
|
3934
|
+
for (const v of s.values)
|
|
3935
|
+
if (v !== null) {
|
|
3936
|
+
min = Math.min(min, v);
|
|
3937
|
+
max = Math.max(max, v);
|
|
3938
|
+
}
|
|
3939
|
+
}
|
|
3940
|
+
if (min === Infinity) {
|
|
3941
|
+
min = 0;
|
|
3942
|
+
max = 1;
|
|
3943
|
+
}
|
|
3944
|
+
return { ...niceScale(min, max), percent: false };
|
|
3945
|
+
}
|
|
3946
|
+
function categoryTotals(model) {
|
|
3947
|
+
return model.categories.map(
|
|
3948
|
+
(_, i) => model.series.reduce((sum, s) => sum + Math.abs(s.values[i] ?? 0), 0)
|
|
3949
|
+
);
|
|
3950
|
+
}
|
|
3951
|
+
|
|
3952
|
+
// chart/text-inheritance.ts
|
|
3953
|
+
var TEXT_KEYS = [
|
|
3954
|
+
"fontSize",
|
|
3955
|
+
"bold",
|
|
3956
|
+
"italic",
|
|
3957
|
+
"underline",
|
|
3958
|
+
"typeface",
|
|
3959
|
+
"textColor",
|
|
3960
|
+
"fontRef"
|
|
3961
|
+
];
|
|
3962
|
+
var TEXT_PARTS = [
|
|
3963
|
+
"title",
|
|
3964
|
+
"axisTitle",
|
|
3965
|
+
"categoryAxis",
|
|
3966
|
+
"valueAxis",
|
|
3967
|
+
"legend",
|
|
3968
|
+
"dataLabel"
|
|
3969
|
+
];
|
|
3970
|
+
function inheritChartText(part, entry, builtIn, root) {
|
|
3971
|
+
if (!root || !TEXT_PARTS.includes(part)) return entry;
|
|
3972
|
+
const out = { ...entry };
|
|
3973
|
+
for (const key of TEXT_KEYS) {
|
|
3974
|
+
delete out[key];
|
|
3975
|
+
const value = root[key] ?? builtIn?.[key];
|
|
3976
|
+
if (value !== void 0) Object.assign(out, { [key]: value });
|
|
3977
|
+
}
|
|
3978
|
+
if (part === "title" && root.fontSize !== void 0) out.fontSize = root.fontSize * 1.2;
|
|
3979
|
+
if (root.textEffectsXml !== void 0) out.textEffectsXml = root.textEffectsXml;
|
|
3980
|
+
return out;
|
|
3981
|
+
}
|
|
3982
|
+
|
|
3983
|
+
// chart/render/chart-appearance.ts
|
|
3984
|
+
var chartPointsToPixels = (points) => points * EMU_PER_POINT / EMU_PER_PIXEL;
|
|
3985
|
+
function typeface(entry, theme) {
|
|
3986
|
+
const name = entry.typeface;
|
|
3987
|
+
if (name?.startsWith("+mj-")) return theme.majorFont;
|
|
3988
|
+
if (name?.startsWith("+mn-")) return theme.minorFont;
|
|
3989
|
+
return name ?? (entry.fontRef?.index === "major" ? theme.majorFont : entry.fontRef?.index === "minor" ? theme.minorFont : void 0);
|
|
3990
|
+
}
|
|
3991
|
+
function chartAppearance(chart, theme) {
|
|
3992
|
+
const defaults = builtInChartTextStyle(effectiveBuiltInChartStyle(chart.formatting));
|
|
3993
|
+
const entries = {};
|
|
3994
|
+
for (const part of CHART_STYLE_PARTS) {
|
|
3995
|
+
const base = chart.styleDefinition?.entries[part];
|
|
3996
|
+
const direct = chart.formatting?.entries[part];
|
|
3997
|
+
if (!defaults[part] && !base && !direct) continue;
|
|
3998
|
+
const entry = {
|
|
3999
|
+
...inheritChartText(
|
|
4000
|
+
part,
|
|
4001
|
+
{ ...defaults[part], ...base, sourceXml: base?.sourceXml ?? "" },
|
|
4002
|
+
defaults[part],
|
|
4003
|
+
chart.formatting?.textDefaults
|
|
4004
|
+
),
|
|
4005
|
+
...direct,
|
|
4006
|
+
sourceXml: direct?.sourceXml ?? base?.sourceXml ?? ""
|
|
4007
|
+
};
|
|
4008
|
+
if (base?.line || direct?.line) entry.line = { ...base?.line, ...direct?.line };
|
|
4009
|
+
entries[part] = entry;
|
|
4010
|
+
}
|
|
4011
|
+
const scheme = chartColorScheme(theme);
|
|
4012
|
+
const resolve = (color) => resolveDrawingColor(
|
|
4013
|
+
color,
|
|
4014
|
+
{ scheme: (name) => scheme[name] },
|
|
4015
|
+
{ hslRounding: "halfDown", transformOrder: "document" }
|
|
4016
|
+
);
|
|
4017
|
+
const out = resolveChartStyleDefinition(
|
|
4018
|
+
{ entries},
|
|
4019
|
+
(color) => drawingColorCss(resolve(color))
|
|
4020
|
+
) ?? {};
|
|
4021
|
+
for (const part of CHART_STYLE_PARTS) {
|
|
4022
|
+
const entry = entries[part];
|
|
4023
|
+
if (!entry) continue;
|
|
4024
|
+
const family = typeface(entry, theme);
|
|
4025
|
+
const shadow = resolveDrawingShadowXml(entry.textEffectsXml, {
|
|
4026
|
+
scheme: (name) => scheme[name]
|
|
4027
|
+
});
|
|
4028
|
+
if (shadow) (out[part] ??= {}).textShadow = shadow;
|
|
4029
|
+
if (family) (out[part] ??= {}).typeface = family;
|
|
4030
|
+
if (entry.axisVisible !== void 0) (out[part] ??= {}).axisVisible = entry.axisVisible;
|
|
4031
|
+
if (entry.labelsVisible !== void 0) (out[part] ??= {}).labelsVisible = entry.labelsVisible;
|
|
4032
|
+
if (entry.line?.widthEmu === 0) (out[part] ??= {}).lineWidth = 0;
|
|
4033
|
+
if (entry.fill?.kind === "gradient") {
|
|
4034
|
+
(out[part] ??= {}).gradient = resolveChartGradient(entry.fill, resolve);
|
|
4035
|
+
}
|
|
4036
|
+
}
|
|
4037
|
+
return out;
|
|
4038
|
+
}
|
|
4039
|
+
|
|
4040
|
+
// chart/render/chart-title-text.ts
|
|
4041
|
+
function properties(run) {
|
|
4042
|
+
return {
|
|
4043
|
+
...run.sizePt === void 0 ? {} : { fontSize: run.sizePt },
|
|
4044
|
+
...run.bold === void 0 ? {} : { bold: run.bold },
|
|
4045
|
+
...run.italic === void 0 ? {} : { italic: run.italic },
|
|
4046
|
+
...run.underline === void 0 ? {} : { underline: run.underline },
|
|
4047
|
+
...run.typeface === void 0 ? {} : { typeface: run.typeface },
|
|
4048
|
+
...run.color === void 0 ? {} : { textColor: run.color }
|
|
4049
|
+
};
|
|
4050
|
+
}
|
|
4051
|
+
function chartTitleText(chart, theme) {
|
|
4052
|
+
const formatting = chart.formatting;
|
|
4053
|
+
const entry = formatting?.entries.title;
|
|
4054
|
+
const body = entry?.textBody;
|
|
4055
|
+
if (!formatting || !body || body.text !== chart.title) return void 0;
|
|
4056
|
+
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)
|
|
4057
|
+
return void 0;
|
|
4058
|
+
return {
|
|
4059
|
+
paragraphs: body.paragraphs.map((paragraph) => ({
|
|
4060
|
+
...paragraph.align ? { align: paragraph.align } : {},
|
|
4061
|
+
...paragraph.lineSpacing ? { lineSpacing: paragraph.lineSpacing } : {},
|
|
4062
|
+
...paragraph.spaceBefore ? { spaceBefore: paragraph.spaceBefore } : {},
|
|
4063
|
+
...paragraph.spaceAfter ? { spaceAfter: paragraph.spaceAfter } : {},
|
|
4064
|
+
runs: paragraph.runs.map((run) => {
|
|
4065
|
+
const direct = {
|
|
4066
|
+
sourceXml: "",
|
|
4067
|
+
...entry.textBodyStyle,
|
|
4068
|
+
...properties(paragraph.defaultProperties ?? {}),
|
|
4069
|
+
...properties(run)
|
|
4070
|
+
};
|
|
4071
|
+
const appearance = chartAppearance(
|
|
4072
|
+
{
|
|
4073
|
+
...chart,
|
|
4074
|
+
formatting: { ...formatting, entries: { ...formatting.entries, title: direct } }
|
|
4075
|
+
},
|
|
4076
|
+
theme
|
|
4077
|
+
)?.title ?? {};
|
|
4078
|
+
return { text: run.text, appearance };
|
|
4079
|
+
})
|
|
4080
|
+
}))
|
|
4081
|
+
};
|
|
4082
|
+
}
|
|
4083
|
+
|
|
4084
|
+
// chart/render/chart-view.ts
|
|
4085
|
+
var isRefError = (value) => typeof value === "object" && value !== null && "error" in value;
|
|
4086
|
+
var SUPPORTED = /* @__PURE__ */ new Set([
|
|
4087
|
+
"bar",
|
|
4088
|
+
"column",
|
|
4089
|
+
"line",
|
|
4090
|
+
"area",
|
|
4091
|
+
"pie",
|
|
4092
|
+
"doughnut",
|
|
4093
|
+
"scatter",
|
|
4094
|
+
"radar"
|
|
4095
|
+
]);
|
|
4096
|
+
function toText(value) {
|
|
4097
|
+
if (value === null) return "";
|
|
4098
|
+
if (typeof value === "boolean") return value ? "TRUE" : "FALSE";
|
|
4099
|
+
if (isRefError(value)) return value.error;
|
|
4100
|
+
return String(value);
|
|
4101
|
+
}
|
|
4102
|
+
var toNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
4103
|
+
function resolveRef(ref, evaluateRef) {
|
|
4104
|
+
if (!ref) return void 0;
|
|
4105
|
+
try {
|
|
4106
|
+
const values = evaluateRef(ref);
|
|
4107
|
+
return values.length ? values : void 0;
|
|
4108
|
+
} catch {
|
|
4109
|
+
return void 0;
|
|
4110
|
+
}
|
|
4111
|
+
}
|
|
4112
|
+
function seriesName(series, index, evaluateRef) {
|
|
4113
|
+
const fromRef = resolveRef(series.nameRef, evaluateRef)?.map(toText).filter((t) => t !== "").join(" ");
|
|
4114
|
+
return fromRef || series.name || `Series${index + 1}`;
|
|
4115
|
+
}
|
|
4116
|
+
function chartSummaryView(chart, theme, options = {}) {
|
|
4117
|
+
const evaluateRef = options.evaluateRef ?? (() => []);
|
|
4118
|
+
const type = chart.chartType;
|
|
4119
|
+
const radial = type === "pie" || type === "doughnut";
|
|
4120
|
+
const palette = chart.colorPalette === void 0 ? void 0 : findChartColorPalette(chart.colorPalette);
|
|
4121
|
+
const scheme = chartColorScheme(theme);
|
|
4122
|
+
const drawingColor = (color) => color && drawingColorCss(
|
|
4123
|
+
resolveDrawingColor(
|
|
4124
|
+
color,
|
|
4125
|
+
{
|
|
4126
|
+
scheme: (name) => scheme[name]
|
|
4127
|
+
},
|
|
4128
|
+
{ transformOrder: "document" }
|
|
4129
|
+
)
|
|
4130
|
+
);
|
|
4131
|
+
const gradient = (fill) => fill?.kind === "gradient" ? resolveChartGradient(
|
|
4132
|
+
fill,
|
|
4133
|
+
(color) => resolveDrawingColor(
|
|
4134
|
+
color,
|
|
4135
|
+
{
|
|
4136
|
+
scheme: (name) => scheme[name]
|
|
4137
|
+
},
|
|
4138
|
+
{ transformOrder: "document" }
|
|
4139
|
+
)
|
|
4140
|
+
) : void 0;
|
|
4141
|
+
const grouping = chart.grouping ?? (type === "bar" || type === "column" ? "clustered" : "standard");
|
|
4142
|
+
let categories = [];
|
|
4143
|
+
const rawCategories = [];
|
|
4144
|
+
const series = chart.series.map((s, i) => {
|
|
4145
|
+
const values = resolveRef(s.valuesRef, evaluateRef)?.map(toNumber) ?? s.values.map(toNumber);
|
|
4146
|
+
const cats = resolveRef(s.categoriesRef, evaluateRef) ?? s.categories;
|
|
4147
|
+
rawCategories.push(cats);
|
|
4148
|
+
const paletteColor = palette && chartPaletteSeriesColor(palette, i, chart.series.length, scheme);
|
|
4149
|
+
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);
|
|
4150
|
+
const view = { name: seriesName(s, i, evaluateRef), values, color };
|
|
4151
|
+
const shadow = resolveDrawingShadowXml(s.effectsXml, {
|
|
4152
|
+
scheme: (name) => scheme[name]
|
|
4153
|
+
});
|
|
4154
|
+
if (shadow) view.shadow = shadow;
|
|
4155
|
+
const resolvedGradient = gradient(s.fill);
|
|
4156
|
+
if (resolvedGradient) view.gradient = resolvedGradient;
|
|
4157
|
+
const points = Object.fromEntries(
|
|
4158
|
+
Object.entries(s.pointFills ?? {}).flatMap(([key, fill]) => {
|
|
4159
|
+
const value = gradient(fill);
|
|
4160
|
+
return value ? [[key, value]] : [];
|
|
4161
|
+
})
|
|
4162
|
+
);
|
|
4163
|
+
if (Object.keys(points).length) view.pointGradients = points;
|
|
4164
|
+
return view;
|
|
4165
|
+
});
|
|
4166
|
+
const longest = Math.max(0, ...series.map((s) => s.values.length));
|
|
4167
|
+
const firstCats = rawCategories.find((c) => c.length > 0) ?? [];
|
|
4168
|
+
categories = Array.from(
|
|
4169
|
+
{ length: Math.max(longest, firstCats.length) },
|
|
4170
|
+
(_, i) => firstCats[i] !== void 0 ? toText(firstCats[i] ?? null) : String(i + 1)
|
|
4171
|
+
);
|
|
4172
|
+
if (radial) {
|
|
4173
|
+
series.forEach((s, seriesIndex) => {
|
|
4174
|
+
s.pointColors = s.values.map((_, i) => {
|
|
4175
|
+
const explicit = drawingColor(chart.series[seriesIndex]?.pointColors?.[i]);
|
|
4176
|
+
return explicit ?? (palette ? chartPaletteSeriesColor(palette, i, s.values.length, scheme) : autoSeriesColor(theme, i));
|
|
4177
|
+
});
|
|
4178
|
+
});
|
|
4179
|
+
} else
|
|
4180
|
+
series.forEach((s, seriesIndex) => {
|
|
4181
|
+
const points = chart.series[seriesIndex]?.pointColors;
|
|
4182
|
+
if (points) s.pointColors = s.values.map((_, i) => drawingColor(points[i]) ?? s.color);
|
|
4183
|
+
});
|
|
4184
|
+
series.forEach((s, index) => {
|
|
4185
|
+
const source = chart.series[index];
|
|
4186
|
+
if (s.gradient && !radial && s.pointColors) {
|
|
4187
|
+
for (let i = 0; i < s.pointColors.length; i++)
|
|
4188
|
+
if (!source.pointColors?.[i]) delete s.pointColors[i];
|
|
4189
|
+
}
|
|
4190
|
+
for (const [key, fill] of Object.entries(source.pointFills ?? {})) {
|
|
4191
|
+
if (fill.kind === "none") (s.pointColors ??= [])[Number(key)] = "none";
|
|
4192
|
+
else if (fill.kind === "solid") {
|
|
4193
|
+
const paint = drawingColor(fill.color);
|
|
4194
|
+
if (paint) (s.pointColors ??= [])[Number(key)] = paint;
|
|
4195
|
+
}
|
|
4196
|
+
}
|
|
4197
|
+
});
|
|
4198
|
+
const model = {
|
|
4199
|
+
...chart.barGapWidth === void 0 ? {} : { barGapWidth: chart.barGapWidth },
|
|
4200
|
+
...chart.barOverlap === void 0 ? {} : { barOverlap: chart.barOverlap },
|
|
4201
|
+
type,
|
|
4202
|
+
grouping,
|
|
4203
|
+
showLegend: chart.showLegend,
|
|
4204
|
+
legendPosition: chart.legendPosition ?? "r",
|
|
4205
|
+
categories,
|
|
4206
|
+
series,
|
|
4207
|
+
horizontal: type === "bar",
|
|
4208
|
+
supported: SUPPORTED.has(type)
|
|
4209
|
+
};
|
|
4210
|
+
if (chart.title) model.title = chart.title;
|
|
4211
|
+
const titleFormatting = chart.formatting?.entries.title;
|
|
4212
|
+
if (titleFormatting?.layout) model.titleLayout = titleFormatting.layout;
|
|
4213
|
+
if (titleFormatting?.overlay !== void 0) model.titleOverlay = titleFormatting.overlay;
|
|
4214
|
+
const legendFormatting = chart.formatting?.entries.legend;
|
|
4215
|
+
if (legendFormatting?.layout) model.legendLayout = legendFormatting.layout;
|
|
4216
|
+
if (legendFormatting?.overlay !== void 0) model.legendOverlay = legendFormatting.overlay;
|
|
4217
|
+
const titleText = chartTitleText(chart, theme);
|
|
4218
|
+
if (titleText) model.titleText = titleText;
|
|
4219
|
+
const appearance = chartAppearance(chart, theme);
|
|
4220
|
+
if (appearance) model.appearance = appearance;
|
|
4221
|
+
if (type === "scatter") {
|
|
4222
|
+
series.forEach((s, i) => {
|
|
4223
|
+
const cats = rawCategories[i] ?? [];
|
|
4224
|
+
const numeric = cats.length > 0 && cats.every((c) => typeof c === "number");
|
|
4225
|
+
s.xValues = s.values.map((_, k) => numeric ? toNumber(cats[k] ?? null) : k + 1);
|
|
4226
|
+
});
|
|
4227
|
+
const xs = series.flatMap((s) => s.xValues ?? []).filter((x) => x !== null);
|
|
4228
|
+
model.xAxis = xs.length ? niceScale(Math.min(...xs), Math.max(...xs)) : niceScale(0, 1);
|
|
4229
|
+
}
|
|
4230
|
+
if (!radial) model.valueAxis = valueAxis(model);
|
|
4231
|
+
return model;
|
|
4232
|
+
}
|
|
4233
|
+
|
|
4234
|
+
// text/css-font-family.ts
|
|
4235
|
+
var FALLBACKS = {
|
|
4236
|
+
calibri: '"Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
|
|
4237
|
+
"calibri light": '"Calibri Light", "Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
|
|
4238
|
+
cambria: '"Cambria", "Caladea", Georgia, serif',
|
|
4239
|
+
arial: 'Arial, "Liberation Sans", Helvetica, sans-serif',
|
|
4240
|
+
"times new roman": '"Times New Roman", "Liberation Serif", Times, serif',
|
|
4241
|
+
"courier new": '"Courier New", "Liberation Mono", monospace',
|
|
4242
|
+
aptos: '"Aptos", "Calibri", "Carlito", "Segoe UI", sans-serif'
|
|
4243
|
+
};
|
|
4244
|
+
function cssFontFamily(name) {
|
|
4245
|
+
const known = FALLBACKS[name.toLowerCase()];
|
|
4246
|
+
if (known) return known;
|
|
4247
|
+
const quoted = `"${name.replace(/["\\]/g, "")}"`;
|
|
4248
|
+
return `${quoted}, "Calibri", "Carlito", "Segoe UI", sans-serif`;
|
|
4249
|
+
}
|
|
4250
|
+
|
|
4251
|
+
// chart/render/chart-svg-appearance.ts
|
|
4252
|
+
var nextPaintId = 0;
|
|
4253
|
+
function chartGradientPaint(model, width = 1024, height = 768) {
|
|
4254
|
+
const prefix = `xlsx-chart-${++nextPaintId}`;
|
|
4255
|
+
const appearance = { ...model.appearance };
|
|
4256
|
+
const defs = [];
|
|
4257
|
+
const shadowPaint = (shadow, suffix) => {
|
|
4258
|
+
const id = `${prefix}-${suffix}`;
|
|
4259
|
+
const pad = Math.max(4, shadow.blur * 3 + Math.abs(shadow.dx) + Math.abs(shadow.dy));
|
|
4260
|
+
defs.push(
|
|
4261
|
+
`<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>`
|
|
4262
|
+
);
|
|
4263
|
+
return `url(#${id})`;
|
|
4264
|
+
};
|
|
4265
|
+
for (const [part, entry] of Object.entries(appearance)) {
|
|
4266
|
+
if (entry?.textShadow)
|
|
4267
|
+
appearance[part] = {
|
|
4268
|
+
...entry,
|
|
4269
|
+
textShadowFilter: shadowPaint(entry.textShadow, `${part}-text-shadow`)
|
|
4270
|
+
};
|
|
4271
|
+
}
|
|
4272
|
+
const paint = (gradient, suffix, bounds) => {
|
|
4273
|
+
const def = buildChartGradientDef(`${prefix}-${suffix}`, gradient, bounds);
|
|
4274
|
+
defs.push(chartGradientMarkup(def));
|
|
4275
|
+
return `url(#${def.id})`;
|
|
4276
|
+
};
|
|
4277
|
+
for (const part of ["chartArea", "plotArea"]) {
|
|
4278
|
+
const entry = appearance[part];
|
|
4279
|
+
if (!entry?.gradient) continue;
|
|
4280
|
+
if (part === "plotArea" && ["circle", "shape"].includes(entry.gradient.path ?? "")) continue;
|
|
4281
|
+
appearance[part] = {
|
|
4282
|
+
...entry,
|
|
4283
|
+
fillColor: paint(entry.gradient, part, { width, height, shape: "rect" })
|
|
4284
|
+
};
|
|
4285
|
+
}
|
|
4286
|
+
const series = model.series.map((source, index) => {
|
|
4287
|
+
const view = { ...source };
|
|
4288
|
+
if (source.shadow) view.shadowFilter = shadowPaint(source.shadow, `s${index}-shadow`);
|
|
4289
|
+
const bounds = model.type === "bar" || model.type === "column" ? { width: 1, height: 1, shape: "rect" } : void 0;
|
|
4290
|
+
if (source.gradient) view.color = paint(source.gradient, `s${index}`, bounds);
|
|
4291
|
+
if (source.pointGradients) {
|
|
4292
|
+
view.pointColors = [...source.pointColors ?? []];
|
|
4293
|
+
for (const [key, gradient] of Object.entries(source.pointGradients))
|
|
4294
|
+
view.pointColors[Number(key)] = paint(gradient, `s${index}-p${key}`, bounds);
|
|
4295
|
+
}
|
|
4296
|
+
return view;
|
|
4297
|
+
});
|
|
4298
|
+
return defs.length ? { model: { ...model, appearance, series }, defs: `<defs>${defs.join("")}</defs>` } : { model, defs: "" };
|
|
4299
|
+
}
|
|
4300
|
+
function chartTextAttributes(model, part, fallbackSize = FONT_SIZE) {
|
|
4301
|
+
const entry = model.appearance?.[part];
|
|
4302
|
+
return {
|
|
4303
|
+
size: entry?.fontSize === void 0 ? fallbackSize : chartPointsToPixels(entry.fontSize),
|
|
4304
|
+
...entry?.color === void 0 ? {} : { fill: entry.color },
|
|
4305
|
+
...entry?.bold === void 0 ? {} : { weight: entry.bold ? "bold" : "normal" },
|
|
4306
|
+
...entry?.italic === void 0 ? {} : { italic: entry.italic },
|
|
4307
|
+
...entry?.underline === void 0 ? {} : { underline: entry.underline },
|
|
4308
|
+
...entry?.typeface === void 0 ? {} : { family: cssFontFamily(entry.typeface) },
|
|
4309
|
+
...entry?.textShadowFilter === void 0 ? {} : { filter: entry.textShadowFilter }
|
|
4310
|
+
};
|
|
4311
|
+
}
|
|
4312
|
+
function chartStroke(model, part) {
|
|
4313
|
+
const entry = model.appearance?.[part];
|
|
4314
|
+
return {
|
|
4315
|
+
color: entry?.axisVisible === false ? "none" : entry?.lineColor ?? (part === "gridlineMajor" ? GRID_COLOR : AXIS_COLOR),
|
|
4316
|
+
width: entry?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry.lineWidth)
|
|
4317
|
+
};
|
|
4318
|
+
}
|
|
4319
|
+
function chartAreaRect(model, part, area) {
|
|
4320
|
+
if (area.w <= 0 || area.h <= 0) return "";
|
|
4321
|
+
const entry = model.appearance?.[part];
|
|
4322
|
+
let fill = entry?.fillColor ?? (part === "chartArea" ? "#FFFFFF" : "none");
|
|
4323
|
+
let defs = "";
|
|
4324
|
+
if (part !== "chartArea" && entry?.gradient && (part !== "plotArea" || ["circle", "shape"].includes(entry.gradient.path ?? ""))) {
|
|
4325
|
+
const def = buildChartGradientDef(`xlsx-chart-${++nextPaintId}-${part}`, entry.gradient, {
|
|
4326
|
+
width: area.w,
|
|
4327
|
+
height: area.h,
|
|
4328
|
+
shape: "rect"
|
|
4329
|
+
});
|
|
4330
|
+
defs = `<defs>${chartGradientMarkup(def)}</defs>`;
|
|
4331
|
+
fill = `url(#${def.id})`;
|
|
4332
|
+
}
|
|
4333
|
+
const stroke = entry?.lineColor ?? "none";
|
|
4334
|
+
if (fill === "none" && stroke === "none") return "";
|
|
4335
|
+
const width = entry?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry.lineWidth);
|
|
4336
|
+
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}"/>`;
|
|
4337
|
+
}
|
|
4338
|
+
|
|
4339
|
+
// chart/render/chart-spacing.ts
|
|
4340
|
+
function chartBarSpacing(chart) {
|
|
4341
|
+
const stacked = chart.grouping === "stacked" || chart.grouping === "percentStacked";
|
|
4342
|
+
return {
|
|
4343
|
+
barGapWidth: chart.barGapWidth ?? DEFAULT_BAR_GAP_WIDTH,
|
|
4344
|
+
barOverlap: chart.barOverlap ?? (stacked ? 100 : 0)
|
|
4345
|
+
};
|
|
4346
|
+
}
|
|
4347
|
+
|
|
4348
|
+
// chart/render/chart-svg-bars.ts
|
|
4349
|
+
function bars(model, frame, out, values) {
|
|
4350
|
+
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
4351
|
+
const count = Math.max(1, model.series.length);
|
|
4352
|
+
const geometry = clusteredBarGeometry(frame.bandSize, count, chartBarSpacing(model));
|
|
4353
|
+
const barSize = geometry.singleBarWidth;
|
|
4354
|
+
const base = frame.value(0);
|
|
4355
|
+
const pos = new Array(model.categories.length).fill(0);
|
|
4356
|
+
const neg = new Array(model.categories.length).fill(0);
|
|
4357
|
+
model.series.forEach((s, si) => {
|
|
4358
|
+
values[si]?.forEach((v, i) => {
|
|
4359
|
+
if (v === null || i >= model.categories.length) return;
|
|
4360
|
+
let from = 0;
|
|
4361
|
+
let to = v;
|
|
4362
|
+
if (stacked) {
|
|
4363
|
+
const acc = v >= 0 ? pos : neg;
|
|
4364
|
+
from = acc[i] ?? 0;
|
|
4365
|
+
to = from + v;
|
|
4366
|
+
acc[i] = to;
|
|
4367
|
+
}
|
|
4368
|
+
const a = stacked ? frame.value(from) : base;
|
|
4369
|
+
const b = frame.value(to);
|
|
4370
|
+
const offset = model.horizontal ? geometry.clusterWidth / 2 - barSize - si * geometry.step : -geometry.clusterWidth / 2 + si * geometry.step;
|
|
4371
|
+
const center = frame.band(i);
|
|
4372
|
+
const width = model.horizontal ? Math.abs(b - a) : barSize;
|
|
4373
|
+
const height = model.horizontal ? barSize : Math.abs(b - a);
|
|
4374
|
+
let color = s.pointColors?.[i] ?? s.color;
|
|
4375
|
+
const gradient = s.pointGradients?.[i] ?? (s.pointColors?.[i] === void 0 ? s.gradient : void 0);
|
|
4376
|
+
if (gradient && (gradient.path === "circle" || gradient.path === "shape")) {
|
|
4377
|
+
const baseId = color.match(/^url\(#(.+)\)$/)?.[1];
|
|
4378
|
+
if (baseId) {
|
|
4379
|
+
const id = baseId.replace(/(-s\d+(?:-p\d+)?)$/, `-mark${i}$1`);
|
|
4380
|
+
const def = buildChartGradientDef(id, gradient, {
|
|
4381
|
+
width: Number(n(width)),
|
|
4382
|
+
height: Number(n(height)),
|
|
4383
|
+
shape: "rect"
|
|
4384
|
+
});
|
|
4385
|
+
out.push(`<defs>${chartGradientMarkup(def)}</defs>`);
|
|
4386
|
+
color = `url(#${id})`;
|
|
4387
|
+
}
|
|
4388
|
+
}
|
|
4389
|
+
out.push(`<g data-chart-series="${si}" data-chart-point="${i}">`);
|
|
4390
|
+
if (model.horizontal)
|
|
4391
|
+
out.push(
|
|
4392
|
+
rect(Math.min(a, b), center + offset, Math.abs(b - a), barSize, color, s.shadowFilter)
|
|
4393
|
+
);
|
|
4394
|
+
else
|
|
4395
|
+
out.push(
|
|
4396
|
+
rect(center + offset, Math.min(a, b), barSize, Math.abs(b - a), color, s.shadowFilter)
|
|
4397
|
+
);
|
|
4398
|
+
out.push("</g>");
|
|
4399
|
+
});
|
|
4400
|
+
});
|
|
4401
|
+
}
|
|
4402
|
+
|
|
4403
|
+
// chart/render/chart-svg-cartesian.ts
|
|
4404
|
+
function axes(model, area, out) {
|
|
4405
|
+
const scale = model.valueAxis;
|
|
4406
|
+
if (!scale) return void 0;
|
|
4407
|
+
const labels = scale.ticks.map((t) => formatAxisValue(t, scale.percent));
|
|
4408
|
+
const valueAttrs = chartTextAttributes(model, "valueAxis");
|
|
4409
|
+
const categoryAttrs = chartTextAttributes(model, "categoryAxis");
|
|
4410
|
+
const valueSize = valueAttrs.size ?? 10;
|
|
4411
|
+
const categorySize = categoryAttrs.size ?? 10;
|
|
4412
|
+
const grid = chartStroke(model, "gridlineMajor");
|
|
4413
|
+
const axis = chartStroke(model, "categoryAxis");
|
|
4414
|
+
const valueLabels = model.appearance?.valueAxis?.labelsVisible !== false;
|
|
4415
|
+
const categoryLabels = model.appearance?.categoryAxis?.labelsVisible !== false;
|
|
4416
|
+
const labelW = valueLabels ? Math.max(...labels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
|
|
4417
|
+
const horizontal = model.horizontal;
|
|
4418
|
+
const cats = Math.max(1, model.categories.length);
|
|
4419
|
+
const catW = Math.min(
|
|
4420
|
+
area.w * 0.3,
|
|
4421
|
+
Math.max(...model.categories.map((c) => textWidth(c, categorySize)), 8) + 6
|
|
4422
|
+
);
|
|
4423
|
+
const plot = horizontal ? {
|
|
4424
|
+
x: area.x + catW,
|
|
4425
|
+
y: area.y,
|
|
4426
|
+
w: Math.max(1, area.w - catW - 4),
|
|
4427
|
+
h: Math.max(1, area.h - Math.max(16, valueSize * 1.5))
|
|
4428
|
+
} : {
|
|
4429
|
+
x: area.x + labelW,
|
|
4430
|
+
y: area.y + 4,
|
|
4431
|
+
w: Math.max(1, area.w - labelW - 4),
|
|
4432
|
+
h: Math.max(1, area.h - Math.max(20, categorySize * 1.5))
|
|
4433
|
+
};
|
|
4434
|
+
const span = scale.max - scale.min || 1;
|
|
4435
|
+
const value = horizontal ? (v) => plot.x + (v - scale.min) / span * plot.w : (v) => plot.y + plot.h - (v - scale.min) / span * plot.h;
|
|
4436
|
+
const bandSize = (horizontal ? plot.h : plot.w) / cats;
|
|
4437
|
+
const band = horizontal ? (i) => plot.y + plot.h - bandSize * (i + 0.5) : (i) => plot.x + bandSize * (i + 0.5);
|
|
4438
|
+
out.push(chartAreaRect(model, "plotArea", plot));
|
|
4439
|
+
scale.ticks.forEach((t, i) => {
|
|
4440
|
+
const p = value(t);
|
|
4441
|
+
const label = labels[i] ?? "";
|
|
4442
|
+
if (horizontal) {
|
|
4443
|
+
out.push(line(p, plot.y, p, plot.y + plot.h, grid.color, grid.width));
|
|
4444
|
+
if (valueLabels)
|
|
4445
|
+
out.push(
|
|
4446
|
+
text(p, plot.y + plot.h + valueSize + 2, label, { anchor: "middle", ...valueAttrs })
|
|
4447
|
+
);
|
|
4448
|
+
} else {
|
|
4449
|
+
out.push(line(plot.x, p, plot.x + plot.w, p, grid.color, grid.width));
|
|
4450
|
+
if (valueLabels)
|
|
4451
|
+
out.push(text(plot.x - 4, p + valueSize * 0.3, label, { anchor: "end", ...valueAttrs }));
|
|
4452
|
+
}
|
|
4453
|
+
});
|
|
4454
|
+
const zero = value(Math.min(Math.max(0, scale.min), scale.max));
|
|
4455
|
+
if (horizontal) out.push(line(zero, plot.y, zero, plot.y + plot.h, axis.color, axis.width));
|
|
4456
|
+
else out.push(line(plot.x, zero, plot.x + plot.w, zero, axis.color, axis.width));
|
|
4457
|
+
const step = Math.max(
|
|
4458
|
+
1,
|
|
4459
|
+
Math.ceil(cats / Math.max(1, Math.floor((horizontal ? plot.h : plot.w) / 14)))
|
|
4460
|
+
);
|
|
4461
|
+
model.categories.forEach((c, i) => {
|
|
4462
|
+
if (!categoryLabels || i % step !== 0) return;
|
|
4463
|
+
const p = band(i);
|
|
4464
|
+
if (horizontal)
|
|
4465
|
+
out.push(
|
|
4466
|
+
text(plot.x - 4, p + categorySize * 0.3, fit(c, catW - 6, categorySize), {
|
|
4467
|
+
anchor: "end",
|
|
4468
|
+
...categoryAttrs
|
|
4469
|
+
})
|
|
4470
|
+
);
|
|
4471
|
+
else
|
|
4472
|
+
out.push(
|
|
4473
|
+
text(p, plot.y + plot.h + categorySize + 3, fit(c, bandSize * step, categorySize), {
|
|
4474
|
+
anchor: "middle",
|
|
4475
|
+
...categoryAttrs
|
|
4476
|
+
})
|
|
4477
|
+
);
|
|
4478
|
+
});
|
|
4479
|
+
return { plot, value, band, bandSize };
|
|
4480
|
+
}
|
|
4481
|
+
function plotted(model) {
|
|
4482
|
+
if (model.grouping !== "percentStacked") return model.series.map((s) => s.values);
|
|
4483
|
+
const totals = categoryTotals(model);
|
|
4484
|
+
return model.series.map(
|
|
4485
|
+
(s) => s.values.map((v, i) => v === null ? null : v / (totals[i] || 1))
|
|
4486
|
+
);
|
|
4487
|
+
}
|
|
4488
|
+
function linesAndAreas(model, frame, out) {
|
|
4489
|
+
const values = plotted(model);
|
|
4490
|
+
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
4491
|
+
const acc = new Array(model.categories.length).fill(0);
|
|
4492
|
+
const area = model.type === "area";
|
|
4493
|
+
const layers = [];
|
|
4494
|
+
model.series.forEach((s, si) => {
|
|
4495
|
+
const points = [];
|
|
4496
|
+
const lower = [];
|
|
4497
|
+
model.categories.forEach((_, i) => {
|
|
4498
|
+
const v = values[si]?.[i] ?? null;
|
|
4499
|
+
if (v === null && !area) {
|
|
4500
|
+
points.push([NaN, NaN]);
|
|
4501
|
+
return;
|
|
4502
|
+
}
|
|
4503
|
+
const below = stacked ? acc[i] ?? 0 : 0;
|
|
4504
|
+
const top = below + (v ?? 0);
|
|
4505
|
+
if (stacked) acc[i] = top;
|
|
4506
|
+
points.push([frame.band(i), frame.value(top)]);
|
|
4507
|
+
lower.push([frame.band(i), frame.value(below)]);
|
|
4508
|
+
});
|
|
4509
|
+
layers.push({
|
|
4510
|
+
points,
|
|
4511
|
+
lower,
|
|
4512
|
+
color: s.color,
|
|
4513
|
+
filter: s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""
|
|
4514
|
+
});
|
|
4515
|
+
});
|
|
4516
|
+
for (const { points, lower, color, filter } of area ? [...layers].reverse() : layers) {
|
|
4517
|
+
if (area) {
|
|
4518
|
+
const poly = [...points, ...[...lower].reverse()].map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
|
|
4519
|
+
out.push(`<polygon points="${poly}" fill="${color}" fill-opacity="0.85"${filter}/>`);
|
|
4520
|
+
continue;
|
|
4521
|
+
}
|
|
4522
|
+
let segment = [];
|
|
4523
|
+
const flush = () => {
|
|
4524
|
+
if (segment.length > 1)
|
|
4525
|
+
out.push(
|
|
4526
|
+
`<polyline points="${segment.join(" ")}" fill="none" stroke="${color}" stroke-width="2.25" stroke-linejoin="round"${filter}/>`
|
|
4527
|
+
);
|
|
4528
|
+
segment = [];
|
|
4529
|
+
};
|
|
4530
|
+
for (const [x, y] of points) {
|
|
4531
|
+
if (Number.isNaN(x)) flush();
|
|
4532
|
+
else segment.push(`${n(x)},${n(y)}`);
|
|
4533
|
+
}
|
|
4534
|
+
flush();
|
|
4535
|
+
for (const [x, y] of points)
|
|
4536
|
+
if (!Number.isNaN(x))
|
|
4537
|
+
out.push(`<circle cx="${n(x)}" cy="${n(y)}" r="2.5" fill="${color}"${filter}/>`);
|
|
4538
|
+
}
|
|
4539
|
+
}
|
|
4540
|
+
function scatter(model, area, out) {
|
|
4541
|
+
const ys = model.valueAxis;
|
|
4542
|
+
const xs = model.xAxis;
|
|
4543
|
+
if (!ys || !xs) return;
|
|
4544
|
+
const yLabels = ys.ticks.map((t) => formatAxisValue(t));
|
|
4545
|
+
const valueAttrs = chartTextAttributes(model, "valueAxis");
|
|
4546
|
+
const categoryAttrs = chartTextAttributes(model, "categoryAxis");
|
|
4547
|
+
const valueSize = valueAttrs.size ?? 10;
|
|
4548
|
+
const categorySize = categoryAttrs.size ?? 10;
|
|
4549
|
+
const grid = chartStroke(model, "gridlineMajor");
|
|
4550
|
+
const xAxis = chartStroke(model, "categoryAxis");
|
|
4551
|
+
const yAxis = chartStroke(model, "valueAxis");
|
|
4552
|
+
const valueLabels = model.appearance?.valueAxis?.labelsVisible !== false;
|
|
4553
|
+
const categoryLabels = model.appearance?.categoryAxis?.labelsVisible !== false;
|
|
4554
|
+
const labelW = valueLabels ? Math.max(...yLabels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
|
|
4555
|
+
const plot = {
|
|
4556
|
+
x: area.x + labelW,
|
|
4557
|
+
y: area.y + 4,
|
|
4558
|
+
w: Math.max(1, area.w - labelW - 8),
|
|
4559
|
+
h: Math.max(1, area.h - Math.max(20, categorySize * 1.5))
|
|
4560
|
+
};
|
|
4561
|
+
const px = (v, s) => plot.x + (v - s.min) / (s.max - s.min || 1) * plot.w;
|
|
4562
|
+
const py = (v, s) => plot.y + plot.h - (v - s.min) / (s.max - s.min || 1) * plot.h;
|
|
4563
|
+
out.push(chartAreaRect(model, "plotArea", plot));
|
|
4564
|
+
ys.ticks.forEach((t, i) => {
|
|
4565
|
+
out.push(line(plot.x, py(t, ys), plot.x + plot.w, py(t, ys), grid.color, grid.width));
|
|
4566
|
+
if (valueLabels)
|
|
4567
|
+
out.push(
|
|
4568
|
+
text(plot.x - 4, py(t, ys) + valueSize * 0.3, yLabels[i] ?? "", {
|
|
4569
|
+
anchor: "end",
|
|
4570
|
+
...valueAttrs
|
|
4571
|
+
})
|
|
4572
|
+
);
|
|
4573
|
+
});
|
|
4574
|
+
for (const t of xs.ticks) {
|
|
4575
|
+
out.push(
|
|
4576
|
+
line(px(t, xs), plot.y + plot.h, px(t, xs), plot.y + plot.h + 3, xAxis.color, xAxis.width)
|
|
4577
|
+
);
|
|
4578
|
+
if (categoryLabels)
|
|
4579
|
+
out.push(
|
|
4580
|
+
text(px(t, xs), plot.y + plot.h + categorySize + 3, formatAxisValue(t), {
|
|
4581
|
+
anchor: "middle",
|
|
4582
|
+
...categoryAttrs
|
|
4583
|
+
})
|
|
4584
|
+
);
|
|
4585
|
+
}
|
|
4586
|
+
out.push(
|
|
4587
|
+
line(plot.x, plot.y + plot.h, plot.x + plot.w, plot.y + plot.h, xAxis.color, xAxis.width)
|
|
4588
|
+
);
|
|
4589
|
+
out.push(line(plot.x, plot.y, plot.x, plot.y + plot.h, yAxis.color, yAxis.width));
|
|
4590
|
+
for (const s of model.series)
|
|
4591
|
+
s.values.forEach((v, i) => {
|
|
4592
|
+
const x = s.xValues?.[i] ?? null;
|
|
4593
|
+
if (v === null || x === null) return;
|
|
4594
|
+
out.push(
|
|
4595
|
+
`<circle cx="${n(px(x, xs))}" cy="${n(py(v, ys))}" r="3" fill="${s.pointColors?.[i] ?? s.color}"${s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""}/>`
|
|
4596
|
+
);
|
|
4597
|
+
});
|
|
4598
|
+
}
|
|
4599
|
+
function cartesianSvg(model, area) {
|
|
4600
|
+
const out = [];
|
|
4601
|
+
if (model.type === "scatter") {
|
|
4602
|
+
scatter(model, area, out);
|
|
4603
|
+
return out.join("");
|
|
4604
|
+
}
|
|
4605
|
+
const frame = axes(model, area, out);
|
|
4606
|
+
if (!frame) return "";
|
|
4607
|
+
if (model.type === "bar" || model.type === "column") bars(model, frame, out, plotted(model));
|
|
4608
|
+
else linesAndAreas(model, frame, out);
|
|
4609
|
+
return out.join("");
|
|
4610
|
+
}
|
|
4611
|
+
|
|
4612
|
+
// chart/render/chart-svg-radial.ts
|
|
4613
|
+
var polar = (cx, cy, r, angle) => [
|
|
4614
|
+
cx + r * Math.sin(angle),
|
|
4615
|
+
cy - r * Math.cos(angle)
|
|
4616
|
+
];
|
|
4617
|
+
function slicePath(cx, cy, r, inner, a0, a1) {
|
|
4618
|
+
const sweep = a1 - a0;
|
|
4619
|
+
if (sweep >= Math.PI * 2 - 1e-9) {
|
|
4620
|
+
const mid = a0 + Math.PI;
|
|
4621
|
+
return slicePath(cx, cy, r, inner, a0, mid) + slicePath(cx, cy, r, inner, mid, a1);
|
|
4622
|
+
}
|
|
4623
|
+
const large = sweep > Math.PI ? 1 : 0;
|
|
4624
|
+
const [x0, y0] = polar(cx, cy, r, a0);
|
|
4625
|
+
const [x1, y1] = polar(cx, cy, r, a1);
|
|
4626
|
+
if (inner <= 0)
|
|
4627
|
+
return `M${n(cx)},${n(cy)} L${n(x0)},${n(y0)} A${n(r)},${n(r)} 0 ${large} 1 ${n(x1)},${n(y1)} Z`;
|
|
4628
|
+
const [ix1, iy1] = polar(cx, cy, inner, a1);
|
|
4629
|
+
const [ix0, iy0] = polar(cx, cy, inner, a0);
|
|
4630
|
+
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`;
|
|
4631
|
+
}
|
|
4632
|
+
function pieSvg(model, area) {
|
|
4633
|
+
const out = [chartAreaRect(model, "plotArea", area)];
|
|
4634
|
+
const cx = area.x + area.w / 2;
|
|
4635
|
+
const cy = area.y + area.h / 2;
|
|
4636
|
+
const radius = Math.max(1, Math.min(area.w, area.h) / 2 - 4);
|
|
4637
|
+
const rings = model.type === "doughnut" ? model.series : model.series.slice(0, 1);
|
|
4638
|
+
const hole = model.type === "doughnut" ? radius * 0.5 : 0;
|
|
4639
|
+
const ringSize = (radius - hole) / Math.max(1, rings.length);
|
|
4640
|
+
rings.forEach((s, ri) => {
|
|
4641
|
+
const outer = radius - ri * ringSize;
|
|
4642
|
+
const inner = model.type === "doughnut" ? outer - ringSize : 0;
|
|
4643
|
+
const total = s.values.reduce((sum, v) => sum + (v !== null && v > 0 ? v : 0), 0);
|
|
4644
|
+
if (total <= 0) return;
|
|
4645
|
+
let angle = 0;
|
|
4646
|
+
s.values.forEach((v, i) => {
|
|
4647
|
+
if (v === null || v <= 0) return;
|
|
4648
|
+
const sweep = v / total * Math.PI * 2;
|
|
4649
|
+
const color = s.pointColors?.[i] ?? s.color;
|
|
4650
|
+
out.push(
|
|
4651
|
+
`<path d="${slicePath(cx, cy, outer, inner, angle, angle + sweep)}" fill="${color}" stroke="#FFFFFF" stroke-width="1"${s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""}/>`
|
|
4652
|
+
);
|
|
4653
|
+
angle += sweep;
|
|
4654
|
+
});
|
|
4655
|
+
});
|
|
4656
|
+
return out.join("");
|
|
4657
|
+
}
|
|
4658
|
+
function radarSvg(model, area) {
|
|
4659
|
+
const out = [chartAreaRect(model, "plotArea", area)];
|
|
4660
|
+
const scale = model.valueAxis;
|
|
4661
|
+
const count = model.categories.length;
|
|
4662
|
+
if (!scale || count < 1) return "";
|
|
4663
|
+
const valueAttrs = chartTextAttributes(model, "valueAxis", 9);
|
|
4664
|
+
const categoryAttrs = chartTextAttributes(model, "categoryAxis");
|
|
4665
|
+
const valueSize = valueAttrs.size ?? 9;
|
|
4666
|
+
const categorySize = categoryAttrs.size ?? 10;
|
|
4667
|
+
const grid = chartStroke(model, "gridlineMajor");
|
|
4668
|
+
const axis = chartStroke(model, "categoryAxis");
|
|
4669
|
+
const cx = area.x + area.w / 2;
|
|
4670
|
+
const cy = area.y + area.h / 2 + 4;
|
|
4671
|
+
const radius = Math.max(1, Math.min(area.w, area.h) / 2 - Math.max(18, categorySize * 1.8));
|
|
4672
|
+
const angle = (i) => i / count * Math.PI * 2;
|
|
4673
|
+
const r = (v) => (v - scale.min) / (scale.max - scale.min || 1) * radius;
|
|
4674
|
+
const labelEvery = Math.max(
|
|
4675
|
+
1,
|
|
4676
|
+
Math.ceil(12 / Math.max(1, radius / Math.max(1, scale.ticks.length - 1)))
|
|
4677
|
+
);
|
|
4678
|
+
for (const [k, t] of scale.ticks.entries()) {
|
|
4679
|
+
const ring = Array.from({ length: count }, (_, i) => polar(cx, cy, r(t), angle(i))).map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
|
|
4680
|
+
out.push(
|
|
4681
|
+
`<polygon points="${ring}" fill="none" stroke="${grid.color}" stroke-width="${n(grid.width)}"/>`
|
|
4682
|
+
);
|
|
4683
|
+
if (model.appearance?.valueAxis?.labelsVisible !== false && k % labelEvery === 0)
|
|
4684
|
+
out.push(
|
|
4685
|
+
text(cx + 3, cy - r(t) + valueSize * 0.3, formatAxisValue(t, scale.percent), valueAttrs)
|
|
4686
|
+
);
|
|
4687
|
+
}
|
|
4688
|
+
model.categories.forEach((c, i) => {
|
|
4689
|
+
const [x, y] = polar(cx, cy, radius, angle(i));
|
|
4690
|
+
out.push(line(cx, cy, x, y, axis.color, axis.width));
|
|
4691
|
+
const [lx, ly] = polar(cx, cy, radius + 10, angle(i));
|
|
4692
|
+
const anchor = Math.abs(lx - cx) < 2 ? "middle" : lx > cx ? "start" : "end";
|
|
4693
|
+
if (model.appearance?.categoryAxis?.labelsVisible !== false)
|
|
4694
|
+
out.push(
|
|
4695
|
+
text(lx, ly + categorySize * 0.3, fit(c, area.w / 4, categorySize), {
|
|
4696
|
+
anchor,
|
|
4697
|
+
...categoryAttrs
|
|
4698
|
+
})
|
|
4699
|
+
);
|
|
4700
|
+
});
|
|
4701
|
+
for (const s of model.series) {
|
|
4702
|
+
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(" ");
|
|
4703
|
+
out.push(
|
|
4704
|
+
`<polygon points="${points}" fill="none" stroke="${s.color}" stroke-width="2"${s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""}/>`
|
|
4705
|
+
);
|
|
4706
|
+
}
|
|
4707
|
+
return out.join("");
|
|
4708
|
+
}
|
|
4709
|
+
|
|
4710
|
+
// chart/render/chart-svg-text-metrics.ts
|
|
4711
|
+
var CHART_FONT_FAMILY = "Calibri, Carlito, Arial, sans-serif";
|
|
4712
|
+
function cssFont(attrs) {
|
|
4713
|
+
return `${attrs.italic ? "italic" : "normal"} ${attrs.weight ?? "normal"} ${attrs.size ?? 10}px ${attrs.family ?? CHART_FONT_FAMILY}`;
|
|
4714
|
+
}
|
|
4715
|
+
function chartFontMetrics(attrs, options) {
|
|
4716
|
+
const metrics = options.measureFont?.(cssFont(attrs));
|
|
4717
|
+
return metrics && Number.isFinite(metrics.ascent) && Number.isFinite(metrics.descent) && metrics.ascent >= 0 && metrics.descent >= 0 && metrics.ascent + metrics.descent > 0 ? metrics : void 0;
|
|
4718
|
+
}
|
|
4719
|
+
function chartTextWidth(content, attrs, options) {
|
|
4720
|
+
const width = options.measureText?.(content, cssFont(attrs));
|
|
4721
|
+
return width !== void 0 && Number.isFinite(width) && width >= 0 ? width : textWidth(content, attrs.size);
|
|
4722
|
+
}
|
|
4723
|
+
function fitChartText(content, maxWidth, attrs, options) {
|
|
4724
|
+
if (!options.measureText) return fit(content, maxWidth, attrs.size);
|
|
4725
|
+
if (chartTextWidth(content, attrs, options) <= maxWidth) return content;
|
|
4726
|
+
const points = [...content];
|
|
4727
|
+
let low = 0;
|
|
4728
|
+
let high = points.length;
|
|
4729
|
+
while (low < high) {
|
|
4730
|
+
const mid = Math.ceil((low + high) / 2);
|
|
4731
|
+
if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`, attrs, options) <= maxWidth) low = mid;
|
|
4732
|
+
else high = mid - 1;
|
|
4733
|
+
}
|
|
4734
|
+
return `${points.slice(0, low).join("")}\u2026`;
|
|
4735
|
+
}
|
|
4736
|
+
|
|
4737
|
+
// chart/render/chart-svg-legend.ts
|
|
4738
|
+
function chartLegendSvg(model, area, frame, options) {
|
|
4739
|
+
const automatic = [];
|
|
4740
|
+
const bounds = {};
|
|
4741
|
+
const reserved = automaticLegend(model, area, automatic, options, bounds);
|
|
4742
|
+
const plot = model.legendOverlay ? area : reserved;
|
|
4743
|
+
const box = bounds.box;
|
|
4744
|
+
if (!box) return { plot, markup: "", foreground: false };
|
|
4745
|
+
const manual = resolveManualLayoutRect(model.legendLayout, frame, {
|
|
4746
|
+
x: box.x,
|
|
4747
|
+
y: box.y,
|
|
4748
|
+
width: box.w,
|
|
4749
|
+
height: box.h
|
|
4750
|
+
});
|
|
4751
|
+
if (!manual) return { plot, markup: automatic.join(""), foreground: !!model.legendOverlay };
|
|
4752
|
+
const entries = legendEntries(model);
|
|
4753
|
+
const attrs = chartTextAttributes(model, "legend");
|
|
4754
|
+
const size = attrs.size ?? 10;
|
|
4755
|
+
const font = chartFontMetrics(attrs, options);
|
|
4756
|
+
const keySize = size / 2;
|
|
4757
|
+
const keyGap = size / 4;
|
|
4758
|
+
const widths = entries.map(
|
|
4759
|
+
(entry) => chartTextWidth(entry.label, attrs, options) + keySize + keyGap
|
|
4760
|
+
);
|
|
4761
|
+
const horizontal = manual.width > manual.height && widths.reduce((sum, width) => sum + width, 0) + size <= manual.width;
|
|
4762
|
+
const rowWidth = horizontal ? manual.width / entries.length : manual.width;
|
|
4763
|
+
const rowHeight = horizontal ? manual.height : manual.height / entries.length;
|
|
4764
|
+
const horizontalGap = Math.max(
|
|
4765
|
+
0,
|
|
4766
|
+
(manual.width - widths.reduce((sum, width) => sum + width, 0)) / (entries.length + 1)
|
|
4767
|
+
);
|
|
4768
|
+
let horizontalX = manual.x + horizontalGap;
|
|
4769
|
+
const markup = [
|
|
4770
|
+
chartAreaRect(model, "legend", { x: manual.x, y: manual.y, w: manual.width, h: manual.height })
|
|
4771
|
+
];
|
|
4772
|
+
const baselineOffset = font ? (font.ascent - font.descent) / 2 : size * 0.35;
|
|
4773
|
+
entries.forEach((entry, i) => {
|
|
4774
|
+
const available = horizontal ? chartTextWidth(entry.label, attrs, options) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
|
|
4775
|
+
const label = fitChartText(entry.label, available, attrs, options);
|
|
4776
|
+
const contentWidth = Math.min(
|
|
4777
|
+
horizontal ? widths[i] ?? 0 : Math.max(...widths),
|
|
4778
|
+
rowWidth - size / 2
|
|
4779
|
+
);
|
|
4780
|
+
const x = horizontal ? horizontalX : manual.x + Math.max(size / 4, (rowWidth - contentWidth) / 2);
|
|
4781
|
+
const centerY = manual.y + (horizontal ? 0 : i * rowHeight) + rowHeight / 2;
|
|
4782
|
+
markup.push(rect(x, centerY - keySize / 2, keySize, keySize, entry.color));
|
|
4783
|
+
markup.push(text(x + keySize + keyGap, centerY + baselineOffset, label, attrs));
|
|
4784
|
+
if (horizontal) horizontalX += (widths[i] ?? 0) + horizontalGap;
|
|
4785
|
+
});
|
|
4786
|
+
return {
|
|
4787
|
+
plot,
|
|
4788
|
+
markup: `<g data-chart-legend-layout="true">${markup.join("")}</g>`,
|
|
4789
|
+
foreground: true
|
|
4790
|
+
};
|
|
4791
|
+
}
|
|
4792
|
+
function legendEntries(model) {
|
|
4793
|
+
if (model.type === "pie" || model.type === "doughnut") {
|
|
4794
|
+
const first3 = model.series[0];
|
|
4795
|
+
return model.categories.map((label, i) => ({
|
|
4796
|
+
label,
|
|
4797
|
+
color: first3?.pointColors?.[i] ?? first3?.color ?? "#4472C4"
|
|
4798
|
+
}));
|
|
4799
|
+
}
|
|
4800
|
+
return model.series.map((s) => ({ label: s.name, color: s.color }));
|
|
4801
|
+
}
|
|
4802
|
+
function automaticLegend(model, area, out, options, bounds) {
|
|
4803
|
+
const entries = legendEntries(model);
|
|
4804
|
+
if (!model.showLegend || entries.length === 0) return area;
|
|
4805
|
+
const pos = model.legendPosition;
|
|
4806
|
+
const attrs = chartTextAttributes(model, "legend");
|
|
4807
|
+
const size = attrs.size ?? 10;
|
|
4808
|
+
const rowH = Math.max(16, size * 1.4);
|
|
4809
|
+
if (pos === "t" || pos === "b") {
|
|
4810
|
+
const widths = entries.map(
|
|
4811
|
+
(e) => Math.min(chartTextWidth(e.label, attrs, options) + 20, area.w / 2)
|
|
4812
|
+
);
|
|
4813
|
+
const total = widths.reduce((a, b) => a + b, 0);
|
|
4814
|
+
let x2 = area.x + Math.max(0, (area.w - total) / 2);
|
|
4815
|
+
const y = pos === "t" ? area.y + 4 : area.y + area.h - rowH + 4;
|
|
4816
|
+
bounds.box = { x: x2 - 4, y: y - 4, w: Math.min(total, area.w) + 8, h: rowH + 4 };
|
|
4817
|
+
out.push(
|
|
4818
|
+
chartAreaRect(model, "legend", {
|
|
4819
|
+
x: x2 - 4,
|
|
4820
|
+
y: y - 4,
|
|
4821
|
+
w: Math.min(total, area.w) + 8,
|
|
4822
|
+
h: rowH + 4
|
|
4823
|
+
})
|
|
4824
|
+
);
|
|
4825
|
+
entries.forEach((e, i) => {
|
|
4826
|
+
const w = widths[i] ?? 0;
|
|
4827
|
+
out.push(rect(x2, y, 8, 8, e.color));
|
|
4828
|
+
out.push(text(x2 + 12, y + 8, fitChartText(e.label, w - 16, attrs, options), attrs));
|
|
4829
|
+
x2 += w;
|
|
4830
|
+
});
|
|
4831
|
+
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 };
|
|
4832
|
+
}
|
|
4833
|
+
const width = Math.min(
|
|
4834
|
+
area.w * 0.35,
|
|
4835
|
+
Math.max(...entries.map((e) => chartTextWidth(e.label, attrs, options))) + 22
|
|
4836
|
+
);
|
|
4837
|
+
const height = entries.length * rowH;
|
|
4838
|
+
const x = pos === "l" ? area.x + 4 : area.x + area.w - width;
|
|
4839
|
+
const y0 = pos === "tr" ? area.y + 4 : area.y + Math.max(0, (area.h - height) / 2);
|
|
4840
|
+
bounds.box = { x: x - 4, y: y0, w: width + 4, h: Math.min(height, area.y + area.h - y0) };
|
|
4841
|
+
out.push(
|
|
4842
|
+
chartAreaRect(model, "legend", {
|
|
4843
|
+
x: x - 4,
|
|
4844
|
+
y: y0,
|
|
4845
|
+
w: width + 4,
|
|
4846
|
+
h: Math.min(height, area.y + area.h - y0)
|
|
4847
|
+
})
|
|
4848
|
+
);
|
|
4849
|
+
entries.forEach((e, i) => {
|
|
4850
|
+
const y = y0 + i * rowH;
|
|
4851
|
+
if (y + rowH > area.y + area.h + 2) return;
|
|
4852
|
+
out.push(rect(x, y + 3, 8, 8, e.color));
|
|
4853
|
+
out.push(text(x + 12, y + 11, fitChartText(e.label, width - 16, attrs, options), attrs));
|
|
4854
|
+
});
|
|
4855
|
+
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 };
|
|
4856
|
+
}
|
|
4857
|
+
|
|
4858
|
+
// text/wrap-styled-runs.ts
|
|
4859
|
+
var graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
4860
|
+
function wrapStyledRuns(runs, maxWidth, measure, options = {}) {
|
|
4861
|
+
const groups = [];
|
|
4862
|
+
for (const [source, run] of runs.entries()) {
|
|
4863
|
+
for (const token of run.text.split(/(\r\n|[\r\n]|[ \t]+)/u).filter(Boolean)) {
|
|
4864
|
+
const kind = /^[\r\n]+$/u.test(token) ? "break" : /^[ \t]+$/u.test(token) ? "space" : "word";
|
|
4865
|
+
let group = groups.at(-1);
|
|
4866
|
+
if (!group || group.kind !== kind || kind === "break") {
|
|
4867
|
+
group = { kind, pieces: [] };
|
|
4868
|
+
groups.push(group);
|
|
4869
|
+
}
|
|
4870
|
+
if (kind !== "break") group.pieces.push({ run, source, text: token });
|
|
4871
|
+
}
|
|
4872
|
+
}
|
|
4873
|
+
const merged = (left, right) => {
|
|
4874
|
+
const result2 = left.map((piece) => ({ ...piece }));
|
|
4875
|
+
for (const piece of right) {
|
|
4876
|
+
const last = result2.at(-1);
|
|
4877
|
+
if (last?.source === piece.source) last.text += piece.text;
|
|
4878
|
+
else result2.push({ ...piece });
|
|
4879
|
+
}
|
|
4880
|
+
return result2;
|
|
4881
|
+
};
|
|
4882
|
+
const width = (pieces) => pieces.reduce((sum, piece) => {
|
|
4883
|
+
const advance = measure(piece.text, piece.run);
|
|
4884
|
+
return sum + (Number.isFinite(advance) && advance >= 0 ? advance : 0);
|
|
4885
|
+
}, 0);
|
|
4886
|
+
const result = [];
|
|
4887
|
+
let line2 = [];
|
|
4888
|
+
let spaces = [];
|
|
4889
|
+
const flush = () => {
|
|
4890
|
+
result.push(line2.map((piece) => ({ ...piece.run, text: piece.text })));
|
|
4891
|
+
line2 = [];
|
|
4892
|
+
spaces = [];
|
|
4893
|
+
};
|
|
4894
|
+
for (const group of groups) {
|
|
4895
|
+
if (group.kind === "break") {
|
|
4896
|
+
flush();
|
|
4897
|
+
continue;
|
|
4898
|
+
}
|
|
4899
|
+
if (group.kind === "space") {
|
|
4900
|
+
spaces = group.pieces;
|
|
4901
|
+
continue;
|
|
4902
|
+
}
|
|
4903
|
+
const separator = line2.length ? spaces : [];
|
|
4904
|
+
const wordWidth = width(group.pieces);
|
|
4905
|
+
if (line2.length && width(merged(line2, [...separator, ...group.pieces])) > maxWidth) flush();
|
|
4906
|
+
else line2 = merged(line2, separator);
|
|
4907
|
+
spaces = [];
|
|
4908
|
+
if (options.breakWords && wordWidth > maxWidth) {
|
|
4909
|
+
for (const piece of group.pieces) {
|
|
4910
|
+
for (const { segment } of graphemes.segment(piece.text)) {
|
|
4911
|
+
const next = { ...piece, text: segment };
|
|
4912
|
+
if (line2.length && width(merged(line2, [next])) > maxWidth) flush();
|
|
4913
|
+
line2 = merged(line2, [next]);
|
|
4914
|
+
}
|
|
4915
|
+
}
|
|
4916
|
+
} else line2 = merged(line2, group.pieces);
|
|
4917
|
+
}
|
|
4918
|
+
flush();
|
|
4919
|
+
return result;
|
|
4920
|
+
}
|
|
4921
|
+
|
|
4922
|
+
// chart/render/chart-svg-title-text.ts
|
|
4923
|
+
function spacing(value, naturalHeight, fallback) {
|
|
4924
|
+
return value ? value.unit === "points" ? chartPointsToPixels(value.value) : naturalHeight * value.value : fallback;
|
|
4925
|
+
}
|
|
4926
|
+
function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
|
|
4927
|
+
if (!model.title) return void 0;
|
|
4928
|
+
const base = chartTextAttributes(model, "title", 14);
|
|
4929
|
+
const capacity = Math.max(1, width * 0.8 - 8);
|
|
4930
|
+
if (!model.titleText && !hasManualLayoutFields(model.titleLayout) && !model.titleOverlay && !model.title.includes("\n") && chartTextWidth(model.title, base, options) <= capacity)
|
|
4931
|
+
return void 0;
|
|
4932
|
+
const paragraphs = model.titleText?.paragraphs ?? [
|
|
4933
|
+
{
|
|
4934
|
+
runs: [{ text: model.title, appearance: model.appearance?.title ?? {} }]
|
|
4935
|
+
}
|
|
4936
|
+
];
|
|
4937
|
+
const hardLines = [];
|
|
4938
|
+
for (const paragraph of paragraphs) {
|
|
4939
|
+
let line2 = {
|
|
4940
|
+
...paragraph,
|
|
4941
|
+
runs: []
|
|
4942
|
+
};
|
|
4943
|
+
hardLines.push(line2);
|
|
4944
|
+
for (const run of paragraph.runs) {
|
|
4945
|
+
const pieces = run.text.split("\n");
|
|
4946
|
+
for (const [index, piece] of pieces.entries()) {
|
|
4947
|
+
if (index) {
|
|
4948
|
+
line2 = { ...paragraph, runs: [] };
|
|
4949
|
+
hardLines.push(line2);
|
|
4950
|
+
}
|
|
4951
|
+
if (piece) line2.runs.push({ ...run, text: piece });
|
|
4952
|
+
}
|
|
4953
|
+
}
|
|
4954
|
+
}
|
|
4955
|
+
const lines = hardLines.flatMap((line2) => {
|
|
4956
|
+
const wrapped = wrapStyledRuns(
|
|
4957
|
+
line2.runs,
|
|
4958
|
+
capacity,
|
|
4959
|
+
(content, run) => chartTextWidth(
|
|
4960
|
+
content,
|
|
4961
|
+
chartTextAttributes(
|
|
4962
|
+
{ ...model, appearance: { title: run.appearance } },
|
|
4963
|
+
"title",
|
|
4964
|
+
base.size
|
|
4965
|
+
),
|
|
4966
|
+
options
|
|
4967
|
+
),
|
|
4968
|
+
{ breakWords: true }
|
|
4969
|
+
);
|
|
4970
|
+
const { spaceBefore, spaceAfter, ...properties4 } = line2;
|
|
4971
|
+
return wrapped.map((runs, index) => ({
|
|
4972
|
+
...properties4,
|
|
4973
|
+
runs,
|
|
4974
|
+
...index === 0 && spaceBefore ? { spaceBefore } : {},
|
|
4975
|
+
...index === wrapped.length - 1 && spaceAfter ? { spaceAfter } : {}
|
|
4976
|
+
}));
|
|
4977
|
+
});
|
|
4978
|
+
const metrics = lines.map((line2) => {
|
|
4979
|
+
const runs = line2.runs.map((run) => ({
|
|
4980
|
+
...run,
|
|
4981
|
+
attrs: chartTextAttributes(
|
|
4982
|
+
{ ...model, appearance: { title: run.appearance } },
|
|
4983
|
+
"title",
|
|
4984
|
+
base.size
|
|
4985
|
+
)
|
|
4986
|
+
}));
|
|
4987
|
+
return {
|
|
4988
|
+
...line2,
|
|
4989
|
+
runs,
|
|
4990
|
+
width: runs.reduce((sum, run) => sum + chartTextWidth(run.text, run.attrs, options), 0),
|
|
4991
|
+
size: runs.length ? Math.max(...runs.map((run) => run.attrs.size ?? 14)) : base.size ?? 14,
|
|
4992
|
+
fontMetrics: (runs.length ? runs.map((run) => run.attrs) : [base]).map(
|
|
4993
|
+
(attrs) => chartFontMetrics(attrs, options)
|
|
4994
|
+
)
|
|
4995
|
+
};
|
|
4996
|
+
});
|
|
4997
|
+
const measured = metrics.every((line2) => line2.fontMetrics.every((font) => font !== void 0));
|
|
4998
|
+
const vertical = metrics.map((line2) => {
|
|
4999
|
+
const ascent = measured ? Math.max(...line2.fontMetrics.map((font) => font.ascent)) : line2.size;
|
|
5000
|
+
const descent = measured ? Math.max(...line2.fontMetrics.map((font) => font.descent)) : line2.size * 0.4 + 4;
|
|
5001
|
+
const natural = ascent + descent;
|
|
5002
|
+
const height2 = spacing(line2.lineSpacing, natural, natural);
|
|
5003
|
+
const leading = (height2 - natural) / 2;
|
|
5004
|
+
return {
|
|
5005
|
+
ascent: ascent + leading,
|
|
5006
|
+
descent: descent + leading,
|
|
5007
|
+
height: height2,
|
|
5008
|
+
before: spacing(line2.spaceBefore, natural, 0),
|
|
5009
|
+
after: spacing(line2.spaceAfter, natural, 0),
|
|
5010
|
+
leading
|
|
5011
|
+
};
|
|
5012
|
+
});
|
|
5013
|
+
const boxWidth = Math.min(width - 16, Math.max(0, ...metrics.map((line2) => line2.width)) + 8);
|
|
5014
|
+
const height = vertical.reduce(
|
|
5015
|
+
(sum, line2) => sum + line2.height + line2.before + line2.after,
|
|
5016
|
+
measured ? 4 : 0
|
|
5017
|
+
);
|
|
5018
|
+
let baseline = 8 + (metrics[0]?.size ?? base.size ?? 14) + (vertical[0]?.before ?? 0) + (vertical[0]?.leading ?? 0);
|
|
5019
|
+
const spans = [];
|
|
5020
|
+
for (const [index, line2] of metrics.entries()) {
|
|
5021
|
+
if (index)
|
|
5022
|
+
baseline += vertical[index - 1].descent + vertical[index - 1].after + vertical[index].before + vertical[index].ascent;
|
|
5023
|
+
let x = line2.align === "l" ? (width - boxWidth) / 2 + 4 : line2.align === "r" ? (width + boxWidth) / 2 - 4 - line2.width : (width - line2.width) / 2;
|
|
5024
|
+
for (const run of line2.runs) {
|
|
5025
|
+
spans.push(
|
|
5026
|
+
text(x, baseline, run.text, {
|
|
5027
|
+
...run.attrs,
|
|
5028
|
+
anchor: "start"
|
|
5029
|
+
}).replace("<text ", '<tspan data-chart-title-run="true" ').replace("</text>", "</tspan>")
|
|
5030
|
+
);
|
|
5031
|
+
x += chartTextWidth(run.text, run.attrs, options);
|
|
5032
|
+
}
|
|
5033
|
+
}
|
|
5034
|
+
const parent = text(0, 0, "", { ...base, underline: false }).replace(
|
|
5035
|
+
"</text>",
|
|
5036
|
+
`${spans.join("")}</text>`
|
|
5037
|
+
);
|
|
5038
|
+
const markup = chartAreaRect(model, "title", {
|
|
5039
|
+
x: (width - boxWidth) / 2,
|
|
5040
|
+
y: 4,
|
|
5041
|
+
w: Math.max(0, boxWidth),
|
|
5042
|
+
h: height
|
|
5043
|
+
}) + parent;
|
|
5044
|
+
const automatic = { x: (width - boxWidth) / 2, y: 4, width: boxWidth, height };
|
|
5045
|
+
const manual = resolveManualLayoutRect(
|
|
5046
|
+
model.titleLayout,
|
|
5047
|
+
{ width, height: frameHeight },
|
|
5048
|
+
automatic
|
|
5049
|
+
);
|
|
5050
|
+
return {
|
|
5051
|
+
markup: manual ? `<g data-chart-title-layout="true" transform="translate(${n(manual.x - automatic.x)} ${n(manual.y - automatic.y)})">${markup}</g>` : markup,
|
|
5052
|
+
height: Math.max(24, height)
|
|
5053
|
+
};
|
|
5054
|
+
}
|
|
5055
|
+
|
|
5056
|
+
// chart/render/chart-svg.ts
|
|
5057
|
+
function renderChartSvg(model, width, height, options = {}) {
|
|
5058
|
+
const paint = chartGradientPaint(model, Math.max(1, width), Math.max(1, height));
|
|
5059
|
+
model = paint.model;
|
|
5060
|
+
const w = Math.max(1, width);
|
|
5061
|
+
const h = Math.max(1, height);
|
|
5062
|
+
const out = [];
|
|
5063
|
+
let foregroundTitle = "";
|
|
5064
|
+
out.push(
|
|
5065
|
+
`<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">`
|
|
5066
|
+
);
|
|
5067
|
+
if (model.title) out.push(`<title>${esc(model.title)}</title>`);
|
|
5068
|
+
if (paint.defs) out.push(paint.defs);
|
|
5069
|
+
out.push(chartAreaRect(model, "chartArea", { x: 0, y: 0, w, h }));
|
|
5070
|
+
let area = { x: 8, y: 8, w: w - 16, h: h - 16 };
|
|
5071
|
+
const richTitle = chartRichTitleSvg(model, w, options, h);
|
|
5072
|
+
if (richTitle) {
|
|
5073
|
+
if (model.titleLayout || model.titleOverlay) foregroundTitle = richTitle.markup;
|
|
5074
|
+
else out.push(richTitle.markup);
|
|
5075
|
+
if (!model.titleOverlay)
|
|
5076
|
+
area = { ...area, y: area.y + richTitle.height, h: area.h - richTitle.height };
|
|
5077
|
+
} else if (model.title) {
|
|
5078
|
+
const attrs = chartTextAttributes(model, "title", 14);
|
|
5079
|
+
const size = attrs.size ?? 14;
|
|
5080
|
+
const label = fitChartText(model.title, w - 16, attrs, options);
|
|
5081
|
+
const titleWidth = Math.min(w - 16, chartTextWidth(label, attrs, options) + 8);
|
|
5082
|
+
const font = chartFontMetrics(attrs, options);
|
|
5083
|
+
const titleHeight = Math.max(24, font ? font.ascent + font.descent + 4 : size * 1.4 + 4);
|
|
5084
|
+
out.push(
|
|
5085
|
+
chartAreaRect(model, "title", {
|
|
5086
|
+
x: (w - titleWidth) / 2,
|
|
5087
|
+
y: 4,
|
|
5088
|
+
w: Math.max(0, titleWidth),
|
|
5089
|
+
h: font ? font.ascent + font.descent + 4 : size * 1.4 + 4
|
|
5090
|
+
})
|
|
5091
|
+
);
|
|
5092
|
+
out.push(
|
|
5093
|
+
text(w / 2, 8 + size, label, {
|
|
5094
|
+
anchor: "middle",
|
|
5095
|
+
fill: "#404040",
|
|
5096
|
+
...attrs
|
|
5097
|
+
})
|
|
5098
|
+
);
|
|
5099
|
+
if (!model.titleOverlay)
|
|
5100
|
+
area = { x: area.x, y: area.y + titleHeight, w: area.w, h: area.h - titleHeight };
|
|
5101
|
+
}
|
|
5102
|
+
if (!model.supported) {
|
|
5103
|
+
out.push(
|
|
5104
|
+
text(w / 2, area.y + area.h / 2, `${model.type} charts are not drawn`, { anchor: "middle" })
|
|
5105
|
+
);
|
|
5106
|
+
if (foregroundTitle) out.push(foregroundTitle);
|
|
5107
|
+
out.push("</svg>");
|
|
5108
|
+
return out.join("");
|
|
5109
|
+
}
|
|
5110
|
+
const legend = chartLegendSvg(model, area, { width: w, height: h }, options);
|
|
5111
|
+
area = legend.plot;
|
|
5112
|
+
if (!legend.foreground) out.push(legend.markup);
|
|
5113
|
+
if (area.w > 4 && area.h > 4) {
|
|
5114
|
+
if (model.type === "pie" || model.type === "doughnut") out.push(pieSvg(model, area));
|
|
5115
|
+
else if (model.type === "radar") out.push(radarSvg(model, area));
|
|
5116
|
+
else out.push(cartesianSvg(model, area));
|
|
5117
|
+
}
|
|
5118
|
+
if (legend.foreground) out.push(legend.markup);
|
|
5119
|
+
if (foregroundTitle) out.push(foregroundTitle);
|
|
5120
|
+
out.push("</svg>");
|
|
5121
|
+
return out.join("");
|
|
5122
|
+
}
|
|
5123
|
+
|
|
5124
|
+
// chart/render/render-space.ts
|
|
5125
|
+
var DRAWN_CHART_TYPES = /* @__PURE__ */ new Set([
|
|
5126
|
+
"bar",
|
|
5127
|
+
"column",
|
|
5128
|
+
"line",
|
|
5129
|
+
"area",
|
|
5130
|
+
"pie",
|
|
5131
|
+
"doughnut",
|
|
5132
|
+
"scatter",
|
|
5133
|
+
"radar"
|
|
5134
|
+
]);
|
|
5135
|
+
function chartThemePalette(theme, fonts = {}) {
|
|
5136
|
+
return {
|
|
5137
|
+
colors: THEME_SLOTS.map(
|
|
5138
|
+
(slot, index) => themeSlotHex(theme?.colors[slot]) ?? DEFAULT_THEME_COLORS[index] ?? "000000"
|
|
5139
|
+
),
|
|
5140
|
+
majorFont: fonts.major ?? "Calibri Light",
|
|
5141
|
+
minorFont: fonts.minor ?? "Calibri"
|
|
5142
|
+
};
|
|
5143
|
+
}
|
|
5144
|
+
function chartSpaceKind(space) {
|
|
5145
|
+
if (!space.plotArea.groups.length) return { drawn: false };
|
|
5146
|
+
const type = chartSummaryFromSpace(space).chartType;
|
|
5147
|
+
return { type, drawn: DRAWN_CHART_TYPES.has(type) };
|
|
5148
|
+
}
|
|
5149
|
+
function renderChartSpaceSvg(space, options) {
|
|
5150
|
+
const { width, height, theme, fonts, formatting, colorPalette, styleDefinition, ...svg } = options;
|
|
5151
|
+
const summary = chartSummaryFromSpace(space, {
|
|
5152
|
+
...formatting ? { formatting } : {},
|
|
5153
|
+
...colorPalette !== void 0 ? { colorPalette } : {},
|
|
5154
|
+
...styleDefinition ? { styleDefinition } : {}
|
|
5155
|
+
});
|
|
5156
|
+
const view = chartSummaryView(summary, chartThemePalette(theme, fonts));
|
|
5157
|
+
return renderChartSvg(view, width, height, svg);
|
|
5158
|
+
}
|
|
5159
|
+
|
|
5160
|
+
// docx/breaks.ts
|
|
5161
|
+
function isCachedPageBreak(element) {
|
|
5162
|
+
return named2(element, "lastRenderedPageBreak") && !element.childNodes.length && Array.from(element.attributes).every(
|
|
5163
|
+
(attribute) => attribute.namespaceURI === "http://www.w3.org/2000/xmlns/"
|
|
5164
|
+
);
|
|
5165
|
+
}
|
|
5166
|
+
function hasSpecialBreak(element) {
|
|
5167
|
+
for (const attribute of Array.from(element.attributes)) {
|
|
5168
|
+
if (attribute.namespaceURI === "http://www.w3.org/2000/xmlns/") continue;
|
|
5169
|
+
if (attribute.namespaceURI !== WORD_NS) return true;
|
|
5170
|
+
if (attribute.localName === "type") {
|
|
5171
|
+
if (attribute.value !== "textWrapping") return true;
|
|
5172
|
+
} else if (attribute.localName === "clear") {
|
|
5173
|
+
if (attribute.value !== "none") return true;
|
|
5174
|
+
} else return true;
|
|
5175
|
+
}
|
|
5176
|
+
return false;
|
|
5177
|
+
}
|
|
5178
|
+
function classifyBreak(element) {
|
|
5179
|
+
const type = getW(element, "type");
|
|
5180
|
+
return type === "page" || type === "column" ? type : "textWrapping";
|
|
5181
|
+
}
|
|
5182
|
+
function isModeledBreak(element) {
|
|
5183
|
+
const kind = classifyBreak(element);
|
|
5184
|
+
if (kind === "textWrapping") return false;
|
|
5185
|
+
for (const attribute of Array.from(element.attributes)) {
|
|
5186
|
+
if (attribute.namespaceURI === "http://www.w3.org/2000/xmlns/") continue;
|
|
5187
|
+
if (attribute.namespaceURI !== WORD_NS || attribute.localName !== "type") return false;
|
|
5188
|
+
}
|
|
5189
|
+
return true;
|
|
5190
|
+
}
|
|
5191
|
+
|
|
2840
5192
|
// docx/write-drawing.ts
|
|
2841
5193
|
var A_NS2 = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
2842
5194
|
var WP_NS2 = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing";
|
|
@@ -3172,11 +5524,11 @@ function createRun(doc, run, base, old, allocator) {
|
|
|
3172
5524
|
if (piece === "\n") node.appendChild(makeW(doc, "br"));
|
|
3173
5525
|
else if (piece === " ") node.appendChild(makeW(doc, "tab"));
|
|
3174
5526
|
else if (piece) {
|
|
3175
|
-
const
|
|
5527
|
+
const text2 = makeW(doc, "t");
|
|
3176
5528
|
if (/^\s|\s$/.test(piece))
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
node.appendChild(
|
|
5529
|
+
text2.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
|
|
5530
|
+
text2.appendChild(doc.createTextNode(piece));
|
|
5531
|
+
node.appendChild(text2);
|
|
3180
5532
|
}
|
|
3181
5533
|
}
|
|
3182
5534
|
if (!run.text) node.appendChild(makeW(doc, "t"));
|
|
@@ -3243,38 +5595,6 @@ function preserveEquation(run, base, old) {
|
|
|
3243
5595
|
"Equation editing or insertion is unsupported; imported OMML must remain unchanged."
|
|
3244
5596
|
);
|
|
3245
5597
|
}
|
|
3246
|
-
|
|
3247
|
-
// docx/breaks.ts
|
|
3248
|
-
function isCachedPageBreak(element) {
|
|
3249
|
-
return named2(element, "lastRenderedPageBreak") && !element.childNodes.length && Array.from(element.attributes).every(
|
|
3250
|
-
(attribute) => attribute.namespaceURI === "http://www.w3.org/2000/xmlns/"
|
|
3251
|
-
);
|
|
3252
|
-
}
|
|
3253
|
-
function hasSpecialBreak(element) {
|
|
3254
|
-
for (const attribute of Array.from(element.attributes)) {
|
|
3255
|
-
if (attribute.namespaceURI === "http://www.w3.org/2000/xmlns/") continue;
|
|
3256
|
-
if (attribute.namespaceURI !== WORD_NS) return true;
|
|
3257
|
-
if (attribute.localName === "type") {
|
|
3258
|
-
if (attribute.value !== "textWrapping") return true;
|
|
3259
|
-
} else if (attribute.localName === "clear") {
|
|
3260
|
-
if (attribute.value !== "none") return true;
|
|
3261
|
-
} else return true;
|
|
3262
|
-
}
|
|
3263
|
-
return false;
|
|
3264
|
-
}
|
|
3265
|
-
function classifyBreak(element) {
|
|
3266
|
-
const type = getW(element, "type");
|
|
3267
|
-
return type === "page" || type === "column" ? type : "textWrapping";
|
|
3268
|
-
}
|
|
3269
|
-
function isModeledBreak(element) {
|
|
3270
|
-
const kind = classifyBreak(element);
|
|
3271
|
-
if (kind === "textWrapping") return false;
|
|
3272
|
-
for (const attribute of Array.from(element.attributes)) {
|
|
3273
|
-
if (attribute.namespaceURI === "http://www.w3.org/2000/xmlns/") continue;
|
|
3274
|
-
if (attribute.namespaceURI !== WORD_NS || attribute.localName !== "type") return false;
|
|
3275
|
-
}
|
|
3276
|
-
return true;
|
|
3277
|
-
}
|
|
3278
5598
|
function isCommentReferenceRun(run) {
|
|
3279
5599
|
const content = Array.from(run.childNodes).filter(
|
|
3280
5600
|
(child) => isElement(child) && !named2(child, "rPr")
|
|
@@ -3486,18 +5806,18 @@ function parseDirectParagraphProperties(props) {
|
|
|
3486
5806
|
if (shading) paragraph.shadingFill = shading;
|
|
3487
5807
|
const tabStops = parseTabStops(first2(props, "tabs"));
|
|
3488
5808
|
if (tabStops.length) paragraph.tabStops = tabStops;
|
|
3489
|
-
const
|
|
3490
|
-
const before = twipValue2(getW(
|
|
3491
|
-
const after = twipValue2(getW(
|
|
3492
|
-
const
|
|
5809
|
+
const spacing2 = first2(props, "spacing");
|
|
5810
|
+
const before = twipValue2(getW(spacing2, "before"));
|
|
5811
|
+
const after = twipValue2(getW(spacing2, "after"));
|
|
5812
|
+
const line2 = signedTwipValue2(getW(spacing2, "line"));
|
|
3493
5813
|
if (before !== void 0) paragraph.spacingBeforeTwips = before;
|
|
3494
5814
|
if (after !== void 0) paragraph.spacingAfterTwips = after;
|
|
3495
|
-
if (
|
|
3496
|
-
paragraph.lineSpacingTwips =
|
|
5815
|
+
if (line2 !== void 0) {
|
|
5816
|
+
paragraph.lineSpacingTwips = line2;
|
|
3497
5817
|
}
|
|
3498
|
-
const rule = getW(
|
|
5818
|
+
const rule = getW(spacing2, "lineRule");
|
|
3499
5819
|
if (rule === "auto" || rule === "exact" || rule === "atLeast") paragraph.lineSpacingRule = rule;
|
|
3500
|
-
else if (
|
|
5820
|
+
else if (line2 !== void 0) paragraph.lineSpacingRule = "auto";
|
|
3501
5821
|
const indent = first2(props, "ind");
|
|
3502
5822
|
const indentLeft = signedTwipValue2(getW(indent, "left"));
|
|
3503
5823
|
const indentRight = signedTwipValue2(getW(indent, "right"));
|
|
@@ -3629,9 +5949,9 @@ function resolveNumberingLevel(catalog, numId, level) {
|
|
|
3629
5949
|
let base = override?.lvl ?? abstract;
|
|
3630
5950
|
if (!base) return void 0;
|
|
3631
5951
|
if (override?.lvl) {
|
|
3632
|
-
const { lvlRestart: _ignored, ...
|
|
5952
|
+
const { lvlRestart: _ignored, ...properties4 } = base;
|
|
3633
5953
|
base = {
|
|
3634
|
-
...
|
|
5954
|
+
...properties4,
|
|
3635
5955
|
...abstract?.lvlRestart !== void 0 ? { lvlRestart: abstract.lvlRestart } : {}
|
|
3636
5956
|
};
|
|
3637
5957
|
}
|
|
@@ -3657,6 +5977,37 @@ function documentBlockLists(model) {
|
|
|
3657
5977
|
];
|
|
3658
5978
|
}
|
|
3659
5979
|
|
|
5980
|
+
// docx/chart-paint.ts
|
|
5981
|
+
function themeCatalogColorScheme(theme) {
|
|
5982
|
+
const colors = {};
|
|
5983
|
+
for (const [slot, value] of Object.entries(theme?.colors ?? {}))
|
|
5984
|
+
if (value) colors[slot] = { kind: "srgb", value: value.replace(/^#/, ""), transforms: [] };
|
|
5985
|
+
return { colors };
|
|
5986
|
+
}
|
|
5987
|
+
function docxChartPaint(chart, widthPx, heightPx, theme) {
|
|
5988
|
+
const space = chart?.chartSpace;
|
|
5989
|
+
if (!space) return { label: "Chart" };
|
|
5990
|
+
const kind = chartSpaceKind(space);
|
|
5991
|
+
if (!kind.drawn) return { label: kind.type ? `Chart (${kind.type})` : "Chart" };
|
|
5992
|
+
try {
|
|
5993
|
+
const fonts = {
|
|
5994
|
+
...theme?.fonts.major.latin ? { major: theme.fonts.major.latin } : {},
|
|
5995
|
+
...theme?.fonts.minor.latin ? { minor: theme.fonts.minor.latin } : {}
|
|
5996
|
+
};
|
|
5997
|
+
const svg = renderChartSpaceSvg(space, {
|
|
5998
|
+
width: Math.max(1, Math.round(widthPx)),
|
|
5999
|
+
height: Math.max(1, Math.round(heightPx)),
|
|
6000
|
+
theme: themeCatalogColorScheme(theme),
|
|
6001
|
+
fonts,
|
|
6002
|
+
...chart.formatting ? { formatting: chart.formatting } : {},
|
|
6003
|
+
...chart.colorPalette !== void 0 ? { colorPalette: chart.colorPalette } : {}
|
|
6004
|
+
});
|
|
6005
|
+
return { svg, label: chart.title ? `Chart: ${chart.title}` : "Chart" };
|
|
6006
|
+
} catch {
|
|
6007
|
+
return { label: kind.type ? `Chart (${kind.type})` : "Chart" };
|
|
6008
|
+
}
|
|
6009
|
+
}
|
|
6010
|
+
|
|
3660
6011
|
// docx/diagram-theme.ts
|
|
3661
6012
|
function diagramColorTheme(theme) {
|
|
3662
6013
|
return {
|
|
@@ -3724,20 +6075,20 @@ function restoreParagraphFormatting(paragraph) {
|
|
|
3724
6075
|
throw new Error(
|
|
3725
6076
|
"Cannot reject a paragraph formatting revision without its prior properties snapshot."
|
|
3726
6077
|
);
|
|
3727
|
-
const
|
|
6078
|
+
const properties4 = parsePropertiesSnapshot(xml, "pPr");
|
|
3728
6079
|
if (paragraph.sourceParagraphPropertiesXml) {
|
|
3729
6080
|
const current = parsePropertiesSnapshot(paragraph.sourceParagraphPropertiesXml, "pPr");
|
|
3730
6081
|
for (const name of ["rPr", "sectPr"]) {
|
|
3731
6082
|
const element = first2(current, name);
|
|
3732
|
-
if (element && !first2(
|
|
3733
|
-
|
|
6083
|
+
if (element && !first2(properties4, name))
|
|
6084
|
+
properties4.appendChild(properties4.ownerDocument.importNode(element, true));
|
|
3734
6085
|
}
|
|
3735
|
-
orderParagraphProperties(
|
|
6086
|
+
orderParagraphProperties(properties4);
|
|
3736
6087
|
}
|
|
3737
|
-
const previous = parseDirectParagraphProperties(
|
|
6088
|
+
const previous = parseDirectParagraphProperties(properties4);
|
|
3738
6089
|
for (const key of PARAGRAPH_FORMAT_KEYS) delete paragraph[key];
|
|
3739
6090
|
Object.assign(paragraph, previous);
|
|
3740
|
-
paragraph.restoredParagraphPropertiesXml = buildXml(
|
|
6091
|
+
paragraph.restoredParagraphPropertiesXml = buildXml(properties4);
|
|
3741
6092
|
if (paragraph.sourceParagraphPropertiesXml)
|
|
3742
6093
|
paragraph.sourceParagraphPropertiesXml = paragraph.restoredParagraphPropertiesXml;
|
|
3743
6094
|
delete paragraph.formatRevision;
|
|
@@ -4361,7 +6712,8 @@ function runToInlineNodes(run, schema, noteNumber) {
|
|
|
4361
6712
|
textBoxText: run.image.textBoxText ? JSON.stringify(run.image.textBoxText) : null,
|
|
4362
6713
|
textBoxEditable: run.image.textBoxEditable ?? null,
|
|
4363
6714
|
textBoxBorder: run.image.textBoxBorder ?? null,
|
|
4364
|
-
diagram: run.image.diagram ? JSON.stringify(run.image.diagram) : null
|
|
6715
|
+
diagram: run.image.diagram ? JSON.stringify(run.image.diagram) : null,
|
|
6716
|
+
chart: run.image.chart ? JSON.stringify(run.image.chart) : null
|
|
4365
6717
|
},
|
|
4366
6718
|
void 0,
|
|
4367
6719
|
marks2
|
|
@@ -4383,8 +6735,8 @@ function applyInlineFormat(run, child) {
|
|
|
4383
6735
|
Object.assign(run, inlineRunProperties(child));
|
|
4384
6736
|
const marks = { text: "", ...run.revision ? { revision: run.revision } : {} };
|
|
4385
6737
|
applyMarkFormatting(marks, child);
|
|
4386
|
-
const { text: _text, ...
|
|
4387
|
-
Object.assign(run,
|
|
6738
|
+
const { text: _text, ...properties4 } = marks;
|
|
6739
|
+
Object.assign(run, properties4);
|
|
4388
6740
|
const ids = commentIdsFromNode(child);
|
|
4389
6741
|
if (ids.length) run.commentIds = ids;
|
|
4390
6742
|
else delete run.commentIds;
|
|
@@ -4445,6 +6797,7 @@ function appendInlineNode(runs, child) {
|
|
|
4445
6797
|
// Same key order as the parser's run: the writer compares an unchanged placeholder run by JSON.
|
|
4446
6798
|
...child.attrs.unsupported ? { unsupported: child.attrs.unsupported } : {},
|
|
4447
6799
|
...typeof child.attrs.diagram === "string" ? { diagram: JSON.parse(child.attrs.diagram) } : {},
|
|
6800
|
+
...typeof child.attrs.chart === "string" ? { chart: JSON.parse(child.attrs.chart) } : {},
|
|
4448
6801
|
...typeof child.attrs.placement === "string" ? { placement: JSON.parse(child.attrs.placement) } : {},
|
|
4449
6802
|
...typeof child.attrs.textBoxText === "string" ? { textBoxText: JSON.parse(child.attrs.textBoxText) } : {},
|
|
4450
6803
|
...child.attrs.textBoxEditable ? { textBoxEditable: true } : {},
|
|
@@ -4546,9 +6899,9 @@ function fieldClipboardSlice(slice) {
|
|
|
4546
6899
|
});
|
|
4547
6900
|
return node.copy(prosemirrorModel.Fragment.fromArray(children4));
|
|
4548
6901
|
}
|
|
4549
|
-
const
|
|
6902
|
+
const properties4 = !node.isText && node.type.spec.attrs?.format ? inlineRunProperties(node) : void 0;
|
|
4550
6903
|
const field = node.marks.find((mark) => mark.type.name === "field");
|
|
4551
|
-
const cached2 =
|
|
6904
|
+
const cached2 = properties4?.field;
|
|
4552
6905
|
if (!field && !cached2) return node;
|
|
4553
6906
|
if (!(field?.attrs.simple ?? cached2?.simple) && complete.has(pos)) return node;
|
|
4554
6907
|
const marks = node.marks.flatMap((mark) => {
|
|
@@ -4557,8 +6910,8 @@ function fieldClipboardSlice(slice) {
|
|
|
4557
6910
|
const { fieldInstanceId: _identity, fieldFlags: _flags2, ...props } = mark.attrs.props ?? {};
|
|
4558
6911
|
return Object.keys(props).length ? [mark.type.create({ ...mark.attrs, props })] : [];
|
|
4559
6912
|
});
|
|
4560
|
-
if (!
|
|
4561
|
-
const { field: _field, fieldInstanceId: _id, fieldFlags: _flags, ...literal } =
|
|
6913
|
+
if (!properties4 || !cached2) return node.mark(marks);
|
|
6914
|
+
const { field: _field, fieldInstanceId: _id, fieldFlags: _flags, ...literal } = properties4;
|
|
4562
6915
|
return node.type.create(
|
|
4563
6916
|
updatedInlineRunAttributes(
|
|
4564
6917
|
node,
|
|
@@ -4609,7 +6962,7 @@ function fieldResultRanges(doc) {
|
|
|
4609
6962
|
}
|
|
4610
6963
|
|
|
4611
6964
|
// docx/ui/simple-field-input.ts
|
|
4612
|
-
var
|
|
6965
|
+
var graphemes2 = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
4613
6966
|
function targetField(state, from, to) {
|
|
4614
6967
|
return fieldResultRanges(state.doc).find(
|
|
4615
6968
|
(range) => range.mark.attrs.simple && from >= range.from && to <= range.to && (from !== to || from > range.from && from < range.to)
|
|
@@ -4623,14 +6976,14 @@ function resultMarks(node, field) {
|
|
|
4623
6976
|
...typeof id === "string" && { fieldInstanceId: id },
|
|
4624
6977
|
...source?.fieldFlags && { fieldFlags: source.fieldFlags }
|
|
4625
6978
|
};
|
|
4626
|
-
const
|
|
4627
|
-
if (
|
|
4628
|
-
const old =
|
|
6979
|
+
const properties4 = node.type.schema.marks.runProperties;
|
|
6980
|
+
if (properties4) {
|
|
6981
|
+
const old = properties4.isInSet(marks);
|
|
4629
6982
|
const { fieldInstanceId: _identity, fieldFlags: _flags, ...other } = old?.attrs.props ?? {};
|
|
4630
6983
|
const props = { ...other, ...state };
|
|
4631
|
-
marks =
|
|
6984
|
+
marks = properties4.removeFromSet(marks);
|
|
4632
6985
|
if (Object.keys(props).length)
|
|
4633
|
-
marks =
|
|
6986
|
+
marks = properties4.create({ ...old?.attrs ?? {}, props }).addToSet(marks);
|
|
4634
6987
|
}
|
|
4635
6988
|
return marks;
|
|
4636
6989
|
}
|
|
@@ -4656,19 +7009,19 @@ function simpleFieldPasteSlice(slice, state) {
|
|
|
4656
7009
|
slice.content.forEach((node) => children3.push(project(node)));
|
|
4657
7010
|
return new prosemirrorModel.Slice(prosemirrorModel.Fragment.fromArray(children3), slice.openStart, slice.openEnd);
|
|
4658
7011
|
}
|
|
4659
|
-
function replaceSimpleFieldResult(state, from, to,
|
|
7012
|
+
function replaceSimpleFieldResult(state, from, to, text2) {
|
|
4660
7013
|
const field = targetField(state, from, to);
|
|
4661
7014
|
if (!field) return null;
|
|
4662
|
-
if (!
|
|
7015
|
+
if (!text2) {
|
|
4663
7016
|
const tr2 = state.tr;
|
|
4664
7017
|
if (!emptySimpleFieldResult(tr2, from, to)) return null;
|
|
4665
7018
|
return tr2.setSelection(prosemirrorState.TextSelection.create(tr2.doc, from + 3));
|
|
4666
7019
|
}
|
|
4667
7020
|
const $from = state.doc.resolve(from);
|
|
4668
7021
|
const marks = state.storedMarks ?? (from === to ? $from.marks() : $from.marksAcross(state.doc.resolve(to)));
|
|
4669
|
-
const node = state.schema.text(
|
|
7022
|
+
const node = state.schema.text(text2, marks);
|
|
4670
7023
|
const tr = state.tr.replaceRangeWith(from, to, node.mark(resultMarks(node, field)));
|
|
4671
|
-
if (!tr.selection.empty && tr.selection.to === from +
|
|
7024
|
+
if (!tr.selection.empty && tr.selection.to === from + text2.length)
|
|
4672
7025
|
tr.setSelection(prosemirrorState.TextSelection.near(tr.selection.$to));
|
|
4673
7026
|
return tr;
|
|
4674
7027
|
}
|
|
@@ -4702,7 +7055,7 @@ function deleteSimpleFieldResult(state, backward) {
|
|
|
4702
7055
|
(range) => range.mark.attrs.simple && (backward ? range.to === from : range.from === from)
|
|
4703
7056
|
);
|
|
4704
7057
|
if (!field) return null;
|
|
4705
|
-
const segments =
|
|
7058
|
+
const segments = graphemes2.segment(field.text)[Symbol.iterator]();
|
|
4706
7059
|
if (segments.next().done || !segments.next().done) return null;
|
|
4707
7060
|
return replaceSimpleFieldResult(state, field.from, field.to, "");
|
|
4708
7061
|
}
|
|
@@ -4740,10 +7093,10 @@ function fieldGuardPlugin() {
|
|
|
4740
7093
|
if (!view.editable || !event.clipboardData) return false;
|
|
4741
7094
|
const tr = deleteFieldSelection(view.state);
|
|
4742
7095
|
if (!tr) return false;
|
|
4743
|
-
const { dom, text } = view.serializeForClipboard(view.state.selection.content());
|
|
7096
|
+
const { dom, text: text2 } = view.serializeForClipboard(view.state.selection.content());
|
|
4744
7097
|
event.clipboardData.clearData();
|
|
4745
7098
|
event.clipboardData.setData("text/html", dom.innerHTML);
|
|
4746
|
-
event.clipboardData.setData("text/plain",
|
|
7099
|
+
event.clipboardData.setData("text/plain", text2);
|
|
4747
7100
|
event.preventDefault();
|
|
4748
7101
|
view.dispatch(tr.scrollIntoView().setMeta("uiEvent", "cut"));
|
|
4749
7102
|
return true;
|
|
@@ -4751,8 +7104,8 @@ function fieldGuardPlugin() {
|
|
|
4751
7104
|
},
|
|
4752
7105
|
transformCopied: fieldClipboardSlice,
|
|
4753
7106
|
transformPasted: (slice, view) => simpleFieldPasteSlice(fieldClipboardSlice(slice), view?.state),
|
|
4754
|
-
handleTextInput: (view, from, to,
|
|
4755
|
-
const transaction = replaceAroundMarkers(view.state, from, to,
|
|
7107
|
+
handleTextInput: (view, from, to, text2) => {
|
|
7108
|
+
const transaction = replaceAroundMarkers(view.state, from, to, text2) ?? replaceSimpleFieldResult(view.state, from, to, text2);
|
|
4756
7109
|
if (transaction) view.dispatch(transaction);
|
|
4757
7110
|
return Boolean(transaction);
|
|
4758
7111
|
},
|
|
@@ -4844,7 +7197,7 @@ function markersIn(doc, from, to) {
|
|
|
4844
7197
|
});
|
|
4845
7198
|
return markers;
|
|
4846
7199
|
}
|
|
4847
|
-
function replaceAroundMarkers(state, from, to,
|
|
7200
|
+
function replaceAroundMarkers(state, from, to, text2) {
|
|
4848
7201
|
if (from === to) return null;
|
|
4849
7202
|
const markers = markersIn(state.doc, from, to);
|
|
4850
7203
|
if (!markers.length) return null;
|
|
@@ -4859,8 +7212,8 @@ function replaceAroundMarkers(state, from, to, text) {
|
|
|
4859
7212
|
end = marker.pos;
|
|
4860
7213
|
}
|
|
4861
7214
|
if (from < end) transaction.delete(from, end);
|
|
4862
|
-
if (
|
|
4863
|
-
return transaction.setSelection(prosemirrorState.TextSelection.create(transaction.doc, from +
|
|
7215
|
+
if (text2) transaction.insert(from, state.schema.text(text2, marks));
|
|
7216
|
+
return transaction.setSelection(prosemirrorState.TextSelection.create(transaction.doc, from + text2.length));
|
|
4864
7217
|
}
|
|
4865
7218
|
function deleteAroundMarkers(state, backward) {
|
|
4866
7219
|
const { selection, doc } = state;
|
|
@@ -4932,7 +7285,7 @@ var commentSerial = 0;
|
|
|
4932
7285
|
function nextCommentId(idGenerator) {
|
|
4933
7286
|
return idGenerator ? idGenerator("comment") : `dve-comment-${Date.now().toString(36)}-${++commentSerial}`;
|
|
4934
7287
|
}
|
|
4935
|
-
function addComment(view, author,
|
|
7288
|
+
function addComment(view, author, text2, idGenerator, inlineElements = true) {
|
|
4936
7289
|
if (!view.editable || !view.state.schema.marks.comment) return null;
|
|
4937
7290
|
const { from, to } = commentSelectionRange(
|
|
4938
7291
|
view.state.doc,
|
|
@@ -4961,7 +7314,7 @@ function addComment(view, author, text, idGenerator, inlineElements = true) {
|
|
|
4961
7314
|
tr = tr.addMark(start, end, view.state.schema.marks.comment.create({ ids: [id] }));
|
|
4962
7315
|
});
|
|
4963
7316
|
if (!tr.docChanged) return null;
|
|
4964
|
-
const comment = { id, author, text, resolved: false };
|
|
7317
|
+
const comment = { id, author, text: text2, resolved: false };
|
|
4965
7318
|
const threads = commentThreadsFromDoc(view.state.doc);
|
|
4966
7319
|
if (inlineElements && threads) setCommentThreads(tr, [...threads, comment]);
|
|
4967
7320
|
view.dispatch(prosemirrorHistory.closeHistory(tr));
|
|
@@ -5010,9 +7363,9 @@ function deleteComment(comments, id) {
|
|
|
5010
7363
|
function resolveComment(comments, id, resolved) {
|
|
5011
7364
|
return comments.map((comment) => comment.id === id ? { ...comment, resolved } : comment);
|
|
5012
7365
|
}
|
|
5013
|
-
function replyToComment(comments, parentId, author,
|
|
7366
|
+
function replyToComment(comments, parentId, author, text2, idGenerator) {
|
|
5014
7367
|
const id = nextCommentId(idGenerator);
|
|
5015
|
-
return [...comments, { id, author, text, parentId }];
|
|
7368
|
+
return [...comments, { id, author, text: text2, parentId }];
|
|
5016
7369
|
}
|
|
5017
7370
|
function commentIdsAtSelection(view) {
|
|
5018
7371
|
const { from, to, empty } = view.state.selection;
|
|
@@ -5306,7 +7659,7 @@ var WordYjsComments = class {
|
|
|
5306
7659
|
}
|
|
5307
7660
|
return true;
|
|
5308
7661
|
}
|
|
5309
|
-
add(view, author,
|
|
7662
|
+
add(view, author, text2, idGenerator) {
|
|
5310
7663
|
if (!view.editable || view.state.selection.empty || yProsemirror.ySyncPluginKey.getState(view.state)?.type !== this.fragment)
|
|
5311
7664
|
return null;
|
|
5312
7665
|
const id = idGenerator("comment");
|
|
@@ -5314,18 +7667,18 @@ var WordYjsComments = class {
|
|
|
5314
7667
|
let added = null;
|
|
5315
7668
|
this.change(() => {
|
|
5316
7669
|
const elements2 = this.inlineEnabled() && this.inlineAnchors.add(view.state, id);
|
|
5317
|
-
added = addComment(view, author,
|
|
5318
|
-
if (!added && elements2) added = { id, author, text, resolved: false };
|
|
7670
|
+
added = addComment(view, author, text2, () => id, false);
|
|
7671
|
+
if (!added && elements2) added = { id, author, text: text2, resolved: false };
|
|
5319
7672
|
if (added) this.records.set(id, added);
|
|
5320
7673
|
});
|
|
5321
7674
|
return added;
|
|
5322
7675
|
}
|
|
5323
|
-
reply(parentId, author,
|
|
7676
|
+
reply(parentId, author, text2, idGenerator) {
|
|
5324
7677
|
const root = this.records.get(parentId);
|
|
5325
7678
|
if (!root || root.parentId || this.deleted.get(parentId)) return false;
|
|
5326
7679
|
const id = idGenerator("comment");
|
|
5327
7680
|
if (!id || this.records.has(id)) return false;
|
|
5328
|
-
return this.change(() => this.records.set(id, { id, parentId, author, text }));
|
|
7681
|
+
return this.change(() => this.records.set(id, { id, parentId, author, text: text2 }));
|
|
5329
7682
|
}
|
|
5330
7683
|
resolve(id, resolved) {
|
|
5331
7684
|
const root = this.records.get(id);
|
|
@@ -5367,12 +7720,12 @@ function independentCommentAnchors(node) {
|
|
|
5367
7720
|
if (!node.isText && node.type.spec.attrs?.format && node.marks.some(
|
|
5368
7721
|
(mark) => mark.type.name === "comment" || mark.type.name === "inlineCommentAnchors"
|
|
5369
7722
|
)) {
|
|
5370
|
-
const
|
|
7723
|
+
const properties4 = inlineRunProperties(node);
|
|
5371
7724
|
const ids = commentIdsFromNode(node);
|
|
5372
|
-
if (ids.length)
|
|
5373
|
-
else delete
|
|
7725
|
+
if (ids.length) properties4.commentIds = ids;
|
|
7726
|
+
else delete properties4.commentIds;
|
|
5374
7727
|
return node.type.create(
|
|
5375
|
-
updatedInlineRunAttributes(node, JSON.stringify(
|
|
7728
|
+
updatedInlineRunAttributes(node, JSON.stringify(properties4)),
|
|
5376
7729
|
void 0,
|
|
5377
7730
|
marks.filter(
|
|
5378
7731
|
(mark) => mark.type.name !== "inlineCommentAnchors" && mark.type.name !== "comment"
|
|
@@ -5719,6 +8072,64 @@ var insertWordHardBreak = (state, dispatch, view) => {
|
|
|
5719
8072
|
return true;
|
|
5720
8073
|
};
|
|
5721
8074
|
|
|
8075
|
+
// docx/ui/chart-spec.ts
|
|
8076
|
+
var SVG_NS2 = "http://www.w3.org/2000/svg";
|
|
8077
|
+
function elementSpec(element, root) {
|
|
8078
|
+
const attrs = {};
|
|
8079
|
+
for (const attr2 of Array.from(element.attributes)) {
|
|
8080
|
+
if (attr2.name === "xmlns" || attr2.name.startsWith("xmlns:") || /^on/i.test(attr2.name)) continue;
|
|
8081
|
+
attrs[attr2.name] = attr2.value;
|
|
8082
|
+
}
|
|
8083
|
+
const children3 = [];
|
|
8084
|
+
for (const child of Array.from(element.childNodes)) {
|
|
8085
|
+
if (isElement(child)) children3.push(elementSpec(child, false));
|
|
8086
|
+
else if (child.nodeType === 3 && child.nodeValue) children3.push(child.nodeValue);
|
|
8087
|
+
}
|
|
8088
|
+
const tag = root ? `${SVG_NS2} ${element.localName}` : element.localName;
|
|
8089
|
+
return [tag, attrs, ...children3];
|
|
8090
|
+
}
|
|
8091
|
+
function svgMarkupSpec(svg) {
|
|
8092
|
+
return elementSpec(parseXml(svg, { label: "Chart SVG" }).documentElement, true);
|
|
8093
|
+
}
|
|
8094
|
+
function nodeChart(node) {
|
|
8095
|
+
const value = node.attrs.chart;
|
|
8096
|
+
if (typeof value !== "string") return void 0;
|
|
8097
|
+
try {
|
|
8098
|
+
return JSON.parse(value);
|
|
8099
|
+
} catch {
|
|
8100
|
+
return void 0;
|
|
8101
|
+
}
|
|
8102
|
+
}
|
|
8103
|
+
function chartNodeSpec(node, theme) {
|
|
8104
|
+
const width = Number(node.attrs.widthPx) || 96;
|
|
8105
|
+
const height = Number(node.attrs.heightPx) || 96;
|
|
8106
|
+
const paint = docxChartPaint(nodeChart(node), width, height, theme);
|
|
8107
|
+
const style = `width:${width}px;height:${height}px`;
|
|
8108
|
+
if (!paint.svg)
|
|
8109
|
+
return [
|
|
8110
|
+
"span",
|
|
8111
|
+
{
|
|
8112
|
+
"data-docx-image-placeholder": "1",
|
|
8113
|
+
"data-docx-chart": "frame",
|
|
8114
|
+
...inlineRunPropertiesDomAttrs(node),
|
|
8115
|
+
class: "dve-image-placeholder",
|
|
8116
|
+
style
|
|
8117
|
+
},
|
|
8118
|
+
paint.label
|
|
8119
|
+
];
|
|
8120
|
+
return [
|
|
8121
|
+
"span",
|
|
8122
|
+
{
|
|
8123
|
+
"data-docx-chart": "1",
|
|
8124
|
+
...inlineRunPropertiesDomAttrs(node),
|
|
8125
|
+
class: "dve-chart",
|
|
8126
|
+
style,
|
|
8127
|
+
title: paint.label
|
|
8128
|
+
},
|
|
8129
|
+
svgMarkupSpec(paint.svg)
|
|
8130
|
+
];
|
|
8131
|
+
}
|
|
8132
|
+
|
|
5722
8133
|
// docx/ui/inline-content-schema.ts
|
|
5723
8134
|
var safeAttrValue = (value) => String(value ?? "").replace(/[;{}"]/g, "");
|
|
5724
8135
|
function placementClass(value) {
|
|
@@ -5739,7 +8150,7 @@ function textBoxLines(value) {
|
|
|
5739
8150
|
if (typeof value !== "string") return [];
|
|
5740
8151
|
try {
|
|
5741
8152
|
const lines = JSON.parse(value);
|
|
5742
|
-
return Array.isArray(lines) ? lines.map((
|
|
8153
|
+
return Array.isArray(lines) ? lines.map((line2) => ["span", { class: "dve-textbox-line" }, String(line2)]) : [];
|
|
5743
8154
|
} catch {
|
|
5744
8155
|
return [];
|
|
5745
8156
|
}
|
|
@@ -5771,7 +8182,9 @@ var imageNodeSpec = {
|
|
|
5771
8182
|
textBoxEditable: { default: null },
|
|
5772
8183
|
textBoxBorder: { default: null },
|
|
5773
8184
|
/** A SmartArt graphic (`DocxDiagram`) as JSON; shown read-only by the SmartArt node view. */
|
|
5774
|
-
diagram: { default: null }
|
|
8185
|
+
diagram: { default: null },
|
|
8186
|
+
/** A chart (`DocxChart`) as JSON; painted read-only from its cached values (`chart-spec.ts`). */
|
|
8187
|
+
chart: { default: null }
|
|
5775
8188
|
},
|
|
5776
8189
|
parseDOM: [
|
|
5777
8190
|
{
|
|
@@ -5790,7 +8203,7 @@ var imageNodeSpec = {
|
|
|
5790
8203
|
})
|
|
5791
8204
|
}
|
|
5792
8205
|
],
|
|
5793
|
-
toDOM: (node) => node.attrs.unsupported ? [
|
|
8206
|
+
toDOM: (node) => node.attrs.chart ? chartNodeSpec(node) : node.attrs.unsupported ? [
|
|
5794
8207
|
"span",
|
|
5795
8208
|
{
|
|
5796
8209
|
"data-docx-image-placeholder": "1",
|
|
@@ -5947,10 +8360,10 @@ var removeWordLink = (state, dispatch, view) => {
|
|
|
5947
8360
|
function patchedRun(node, patch) {
|
|
5948
8361
|
const run = inlineNodeRun(node);
|
|
5949
8362
|
if (!run) return void 0;
|
|
5950
|
-
const
|
|
8363
|
+
const properties4 = run;
|
|
5951
8364
|
for (const [key, value] of Object.entries(patch)) {
|
|
5952
|
-
if (value === void 0) delete
|
|
5953
|
-
else
|
|
8365
|
+
if (value === void 0) delete properties4[key];
|
|
8366
|
+
else properties4[key] = value;
|
|
5954
8367
|
}
|
|
5955
8368
|
return run;
|
|
5956
8369
|
}
|
|
@@ -6362,14 +8775,14 @@ function resolveFormattingRange(tr, from, to, mode) {
|
|
|
6362
8775
|
setInlineRunFormatting(tr, piece.from, run2);
|
|
6363
8776
|
continue;
|
|
6364
8777
|
}
|
|
6365
|
-
const
|
|
8778
|
+
const properties4 = piece.node.marks.find((mark) => mark.type.name === "runProperties");
|
|
6366
8779
|
if (mode === "accept") {
|
|
6367
|
-
const props = { ...
|
|
8780
|
+
const props = { ...properties4.attrs.props };
|
|
6368
8781
|
if (props.formatRevision) delete props.formatRevision;
|
|
6369
8782
|
else delete props.revision;
|
|
6370
|
-
tr.removeMark(piece.from, piece.to,
|
|
8783
|
+
tr.removeMark(piece.from, piece.to, properties4);
|
|
6371
8784
|
if (Object.keys(props).length)
|
|
6372
|
-
tr.addMark(piece.from, piece.to,
|
|
8785
|
+
tr.addMark(piece.from, piece.to, properties4.type.create({ props }));
|
|
6373
8786
|
continue;
|
|
6374
8787
|
}
|
|
6375
8788
|
const run = { text: "", revision: piece.revision };
|
|
@@ -6381,7 +8794,7 @@ function resolveFormattingRange(tr, from, to, mode) {
|
|
|
6381
8794
|
}
|
|
6382
8795
|
|
|
6383
8796
|
// docx/ui/track-run-formatting.ts
|
|
6384
|
-
function
|
|
8797
|
+
function properties2(node) {
|
|
6385
8798
|
const run = inlineNodeRun(node) ?? { text: "" };
|
|
6386
8799
|
run.text = "";
|
|
6387
8800
|
delete run.image;
|
|
@@ -6417,8 +8830,8 @@ function trackRunFormatting(steps, oldState, newState, author, date, nextId) {
|
|
|
6417
8830
|
if (!previous.isInline || previous.type.name === "equation") return;
|
|
6418
8831
|
const start = Math.max(from, previousPos);
|
|
6419
8832
|
const end = Math.min(to, previousPos + previous.nodeSize);
|
|
6420
|
-
const before =
|
|
6421
|
-
const after =
|
|
8833
|
+
const before = properties2(previous);
|
|
8834
|
+
const after = properties2(node);
|
|
6422
8835
|
if (propertiesSignature(before) === propertiesSignature(after)) {
|
|
6423
8836
|
if (hasInlineRunAttributes(node) && node.marks.some((mark2) => RUN_FORMAT_MARKS.has(mark2.type.name)))
|
|
6424
8837
|
setInlineRunFormatting(tr, start, inlineNodeRun(node));
|
|
@@ -6505,7 +8918,7 @@ function paragraphProperties(element) {
|
|
|
6505
8918
|
for (const child of children2(element, name)) element.removeChild(child);
|
|
6506
8919
|
return element;
|
|
6507
8920
|
}
|
|
6508
|
-
function
|
|
8921
|
+
function properties3(node) {
|
|
6509
8922
|
const paragraph = paragraphFromAttrs(node.attrs, String(node.attrs.id), []);
|
|
6510
8923
|
delete paragraph.formatRevision;
|
|
6511
8924
|
delete paragraph.markRevision;
|
|
@@ -6523,8 +8936,8 @@ function trackParagraphFormatting(steps, oldState, newState, author, date, nextI
|
|
|
6523
8936
|
if (node.type.name !== "paragraph" || !node.type.spec.attrs?.formatRevision) return;
|
|
6524
8937
|
const previous = oldState.doc.nodeAt(pos);
|
|
6525
8938
|
if (previous === node) return;
|
|
6526
|
-
const before =
|
|
6527
|
-
const after =
|
|
8939
|
+
const before = properties3(previous);
|
|
8940
|
+
const after = properties3(node);
|
|
6528
8941
|
if (propertiesSignature(before) === propertiesSignature(after)) return;
|
|
6529
8942
|
const pending = paragraphFormattingRevision(previous);
|
|
6530
8943
|
const priorXml = pending?.previousParagraphPropertiesXml ?? buildXml(before);
|
|
@@ -6588,14 +9001,14 @@ function trackSimpleFieldDeletion(transform, from, to, slice, author, date, next
|
|
|
6588
9001
|
function sourceProperties(value) {
|
|
6589
9002
|
if (typeof value !== "string" || !value) return value;
|
|
6590
9003
|
try {
|
|
6591
|
-
const
|
|
6592
|
-
const run = first2(
|
|
9004
|
+
const properties4 = parsePropertiesSnapshot(value, "pPr");
|
|
9005
|
+
const run = first2(properties4, "rPr");
|
|
6593
9006
|
if (run) {
|
|
6594
9007
|
for (const name of ["ins", "del"])
|
|
6595
9008
|
for (const revision of children2(run, name)) run.removeChild(revision);
|
|
6596
|
-
if (!run.childNodes.length && !run.attributes.length)
|
|
9009
|
+
if (!run.childNodes.length && !run.attributes.length) properties4.removeChild(run);
|
|
6597
9010
|
}
|
|
6598
|
-
return propertiesSignature(
|
|
9011
|
+
return propertiesSignature(properties4);
|
|
6599
9012
|
} catch {
|
|
6600
9013
|
return value;
|
|
6601
9014
|
}
|
|
@@ -7938,10 +10351,10 @@ function paragraphBoxCss(borders, shadingFill) {
|
|
|
7938
10351
|
const parsed = typeof borders === "string" ? parseBordersJson(borders) : borders;
|
|
7939
10352
|
const css = [];
|
|
7940
10353
|
for (const side of ["top", "bottom", "left", "right"]) {
|
|
7941
|
-
const
|
|
7942
|
-
if (!
|
|
10354
|
+
const line2 = cssBorderSide(parsed?.[side]);
|
|
10355
|
+
if (!line2) continue;
|
|
7943
10356
|
css.push(
|
|
7944
|
-
`border-${side}:${
|
|
10357
|
+
`border-${side}:${line2}`,
|
|
7945
10358
|
`padding-${side}:${(parsed[side].spacePoints ?? 0) * 4 / 3}px`
|
|
7946
10359
|
);
|
|
7947
10360
|
}
|
|
@@ -8045,7 +10458,7 @@ function applyThemeColors(host, previous, colors) {
|
|
|
8045
10458
|
}
|
|
8046
10459
|
|
|
8047
10460
|
// docx/ui/word-count.ts
|
|
8048
|
-
function countWords(
|
|
10461
|
+
function countWords(text2, locale) {
|
|
8049
10462
|
if (typeof Intl.Segmenter === "function") {
|
|
8050
10463
|
let segmenter;
|
|
8051
10464
|
try {
|
|
@@ -8053,9 +10466,9 @@ function countWords(text, locale) {
|
|
|
8053
10466
|
} catch {
|
|
8054
10467
|
segmenter = new Intl.Segmenter(void 0, { granularity: "word" });
|
|
8055
10468
|
}
|
|
8056
|
-
return [...segmenter.segment(
|
|
10469
|
+
return [...segmenter.segment(text2)].filter((part) => part.isWordLike).length;
|
|
8057
10470
|
}
|
|
8058
|
-
return
|
|
10471
|
+
return text2.match(/[\p{L}\p{N}][\p{L}\p{M}\p{N}'’]*/gu)?.length ?? 0;
|
|
8059
10472
|
}
|
|
8060
10473
|
|
|
8061
10474
|
// docx/ui/zoom-fit.ts
|
|
@@ -8095,6 +10508,7 @@ exports.applyThemeColors = applyThemeColors;
|
|
|
8095
10508
|
exports.applyWordLink = applyWordLink;
|
|
8096
10509
|
exports.authorColor = authorColor;
|
|
8097
10510
|
exports.backstageFocus = backstageFocus;
|
|
10511
|
+
exports.chartNodeSpec = chartNodeSpec;
|
|
8098
10512
|
exports.clearDirectRunFormatting = clearDirectRunFormatting;
|
|
8099
10513
|
exports.collectRevisionRanges = collectRevisionRanges;
|
|
8100
10514
|
exports.commentAnchors = commentAnchors;
|
|
@@ -8144,6 +10558,7 @@ exports.linkMarkSpec = linkMarkSpec;
|
|
|
8144
10558
|
exports.markSpecs = markSpecs;
|
|
8145
10559
|
exports.marksForRun = marksForRun;
|
|
8146
10560
|
exports.moveName = moveName;
|
|
10561
|
+
exports.nodeChart = nodeChart;
|
|
8147
10562
|
exports.nodeNumbering = nodeNumbering;
|
|
8148
10563
|
exports.normalizeRibbonActions = normalizeRibbonActions;
|
|
8149
10564
|
exports.normalizeThemeMode = normalizeThemeMode;
|
|
@@ -8182,6 +10597,7 @@ exports.sameRuns = sameRuns;
|
|
|
8182
10597
|
exports.sectionPartsJson = sectionPartsJson;
|
|
8183
10598
|
exports.setCommentThreads = setCommentThreads;
|
|
8184
10599
|
exports.setReviewRecordingPreferences = setReviewRecordingPreferences;
|
|
10600
|
+
exports.svgMarkupSpec = svgMarkupSpec;
|
|
8185
10601
|
exports.swatchColor = swatchColor;
|
|
8186
10602
|
exports.tableCellStyle = tableCellStyle;
|
|
8187
10603
|
exports.tableStyle = tableStyle;
|