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.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { Step, Transform, DocAttrStep, StepMap, ReplaceStep, Mapping, AddMarkSte
|
|
|
2
2
|
import { collab, sendableSteps, receiveTransaction, getVersion } from 'prosemirror-collab';
|
|
3
3
|
import { closeHistory, isHistoryTransaction } from 'prosemirror-history';
|
|
4
4
|
import { PluginKey, Plugin, TextSelection, NodeSelection } from 'prosemirror-state';
|
|
5
|
-
import {
|
|
5
|
+
import { DOMParser, XMLSerializer } from '@xmldom/xmldom';
|
|
6
6
|
import { Slice, Fragment } from 'prosemirror-model';
|
|
7
7
|
import * as Y2 from 'yjs';
|
|
8
8
|
import { ySyncPluginKey, prosemirrorToYXmlFragment, initProseMirrorDoc, defaultDeleteFilter, ySyncPlugin, getRelativeSelection, yCursorPlugin, yCursorPluginKey, relativePositionToAbsolutePosition, absolutePositionToRelativePosition } from 'y-prosemirror';
|
|
@@ -149,25 +149,25 @@ var inlineRunFormattingAttrs = Object.fromEntries(
|
|
|
149
149
|
[...RUN_PROPERTY_ATTRIBUTES].map((name) => [name, { default: null }])
|
|
150
150
|
);
|
|
151
151
|
function inlineRunProperties(node) {
|
|
152
|
-
const
|
|
152
|
+
const properties4 = typeof node.attrs.format === "string" ? JSON.parse(node.attrs.format) : {};
|
|
153
153
|
for (const key of DIRECT_RUN_PROPERTY_KEYS) {
|
|
154
154
|
const override = node.attrs[attributeName(key)];
|
|
155
155
|
if (typeof override !== "string") continue;
|
|
156
156
|
const value = JSON.parse(override);
|
|
157
|
-
if (value === null) delete
|
|
158
|
-
else
|
|
157
|
+
if (value === null) delete properties4[key];
|
|
158
|
+
else properties4[key] = value;
|
|
159
159
|
}
|
|
160
160
|
const projection = node.marks.find((mark) => mark.type.name === "inlineCommentAnchors");
|
|
161
161
|
if (projection) {
|
|
162
162
|
const ids = projection.attrs.ids;
|
|
163
|
-
if (ids.length)
|
|
164
|
-
else delete
|
|
163
|
+
if (ids.length) properties4.commentIds = [...ids];
|
|
164
|
+
else delete properties4.commentIds;
|
|
165
165
|
}
|
|
166
|
-
return
|
|
166
|
+
return properties4;
|
|
167
167
|
}
|
|
168
168
|
function inlineRunPropertiesDomAttrs(node) {
|
|
169
|
-
const
|
|
170
|
-
return Object.keys(
|
|
169
|
+
const properties4 = inlineRunProperties(node);
|
|
170
|
+
return Object.keys(properties4).length ? { "data-run-properties": JSON.stringify(properties4) } : {};
|
|
171
171
|
}
|
|
172
172
|
function updatedInlineRunAttributes(node, format) {
|
|
173
173
|
if (!node.type.spec.attrs?.[attributeName("bold")]) return { ...node.attrs, format };
|
|
@@ -751,7 +751,9 @@ function commentIdsFromNode(node) {
|
|
|
751
751
|
// xml/namespaces.ts
|
|
752
752
|
var NS = {
|
|
753
753
|
/** WordprocessingML main. */
|
|
754
|
-
w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
|
|
754
|
+
w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
|
|
755
|
+
/** DrawingML main. */
|
|
756
|
+
a: "http://schemas.openxmlformats.org/drawingml/2006/main"};
|
|
755
757
|
function parseXml(xml, options = {}) {
|
|
756
758
|
const label = options.label ?? "OOXML";
|
|
757
759
|
if (/<!DOCTYPE|<!ENTITY/i.test(xml))
|
|
@@ -855,6 +857,7 @@ var signedTwipsFromPixels = (pixels) => roundSignedTwips(pixels * 15);
|
|
|
855
857
|
|
|
856
858
|
// units/constants.ts
|
|
857
859
|
var EMU_PER_PIXEL = 9525;
|
|
860
|
+
var EMU_PER_POINT = 12700;
|
|
858
861
|
|
|
859
862
|
// docx/simple-types.ts
|
|
860
863
|
function parseOnOff(value) {
|
|
@@ -897,8 +900,8 @@ function universalMeasureToTwips(value) {
|
|
|
897
900
|
}
|
|
898
901
|
function parseSignedTwips(value) {
|
|
899
902
|
if (value === null || value === void 0) return void 0;
|
|
900
|
-
const
|
|
901
|
-
const parsed = SAFE_INTEGER.test(
|
|
903
|
+
const text2 = value.trim();
|
|
904
|
+
const parsed = SAFE_INTEGER.test(text2) ? parseInteger(text2) : universalMeasureToTwips(text2);
|
|
902
905
|
return parsed === void 0 ? void 0 : signedTwips(parsed);
|
|
903
906
|
}
|
|
904
907
|
function parseTwips(value) {
|
|
@@ -907,26 +910,26 @@ function parseTwips(value) {
|
|
|
907
910
|
}
|
|
908
911
|
function parseHalfPoints(value) {
|
|
909
912
|
if (value === null || value === void 0) return void 0;
|
|
910
|
-
const
|
|
911
|
-
if (/^\d+$/.test(
|
|
912
|
-
const parsed = parseInteger(
|
|
913
|
+
const text2 = value.trim();
|
|
914
|
+
if (/^\d+$/.test(text2)) {
|
|
915
|
+
const parsed = parseInteger(text2);
|
|
913
916
|
return parsed === void 0 ? void 0 : halfPoints(parsed);
|
|
914
917
|
}
|
|
915
|
-
const asTwips = UNIVERSAL_MEASURE.test(
|
|
918
|
+
const asTwips = UNIVERSAL_MEASURE.test(text2) ? universalMeasureToTwips(text2) : void 0;
|
|
916
919
|
return asTwips !== void 0 && asTwips >= 0 ? halfPoints(Math.round(asTwips / 10)) : void 0;
|
|
917
920
|
}
|
|
918
921
|
function parseSignedHalfPoints(value) {
|
|
919
922
|
if (value === null || value === void 0) return void 0;
|
|
920
|
-
const
|
|
921
|
-
const integer2 = parseInteger(
|
|
923
|
+
const text2 = value.trim();
|
|
924
|
+
const integer2 = parseInteger(text2);
|
|
922
925
|
if (integer2 !== void 0) return halfPoints(integer2);
|
|
923
|
-
const twips2 = universalMeasureToTwips(
|
|
926
|
+
const twips2 = universalMeasureToTwips(text2);
|
|
924
927
|
return twips2 === void 0 ? void 0 : halfPoints(Math.sign(twips2) * Math.round(Math.abs(twips2) / 10));
|
|
925
928
|
}
|
|
926
929
|
function parseTextScale(value) {
|
|
927
|
-
const
|
|
928
|
-
if (
|
|
929
|
-
const parsed = parseUnsignedInteger(
|
|
930
|
+
const text2 = value?.trim();
|
|
931
|
+
if (text2?.endsWith("%") && !/^\d+%$/.test(text2)) return void 0;
|
|
932
|
+
const parsed = parseUnsignedInteger(text2?.endsWith("%") ? text2.slice(0, -1) : text2);
|
|
930
933
|
return parsed !== void 0 && parsed <= 600 ? parsed : void 0;
|
|
931
934
|
}
|
|
932
935
|
function parseEighthPoints(value) {
|
|
@@ -1112,16 +1115,16 @@ function parseRunProperties(props) {
|
|
|
1112
1115
|
const color = first2(props, "color");
|
|
1113
1116
|
const hex = parseRgbColor(getW(color, "val"));
|
|
1114
1117
|
if (hex) result.color = hex;
|
|
1115
|
-
const
|
|
1116
|
-
if (
|
|
1117
|
-
result.colorTheme = { token:
|
|
1118
|
+
const themeColor2 = enumValue(isStThemeColor, getW(color, "themeColor"));
|
|
1119
|
+
if (themeColor2) {
|
|
1120
|
+
result.colorTheme = { token: themeColor2 };
|
|
1118
1121
|
const tint = parseTintShade(getW(color, "themeTint"));
|
|
1119
1122
|
const shade = parseTintShade(getW(color, "themeShade"));
|
|
1120
1123
|
if (tint !== void 0) result.colorTheme.tint = tint;
|
|
1121
1124
|
if (shade !== void 0) result.colorTheme.shade = shade;
|
|
1122
1125
|
}
|
|
1123
|
-
const
|
|
1124
|
-
if (
|
|
1126
|
+
const spacing2 = parseSignedTwips(getW(first2(props, "spacing"), "val"));
|
|
1127
|
+
if (spacing2 !== void 0) result.characterSpacingTwips = spacing2;
|
|
1125
1128
|
const scaleElement = first2(props, "w");
|
|
1126
1129
|
const scale = scaleElement ? parseTextScale(getW(scaleElement, "val") ?? "100") : void 0;
|
|
1127
1130
|
if (scale !== void 0) result.textScalePercent = scale;
|
|
@@ -1207,13 +1210,13 @@ function borderSide(element) {
|
|
|
1207
1210
|
const style = enumValue(isStBorder, getW(element, "val"));
|
|
1208
1211
|
const size = parseEighthPoints(getW(element, "sz"));
|
|
1209
1212
|
const color = parseRgbColor(getW(element, "color"));
|
|
1210
|
-
const
|
|
1211
|
-
if (!style && size === void 0 && !color && !
|
|
1213
|
+
const themeColor2 = enumValue(isStThemeColor, getW(element, "themeColor"));
|
|
1214
|
+
if (!style && size === void 0 && !color && !themeColor2) return void 0;
|
|
1212
1215
|
const side = {};
|
|
1213
1216
|
if (style) side.style = style;
|
|
1214
1217
|
if (size !== void 0) side.sizeEighthPoints = size;
|
|
1215
1218
|
if (color) side.color = color;
|
|
1216
|
-
if (
|
|
1219
|
+
if (themeColor2) side.themeColor = themeColor2;
|
|
1217
1220
|
return side;
|
|
1218
1221
|
}
|
|
1219
1222
|
function parseTableBorders(bordersElement) {
|
|
@@ -1328,16 +1331,16 @@ function parseFormatting(pPr) {
|
|
|
1328
1331
|
if (borders) result.borders = borders;
|
|
1329
1332
|
const shading = parseShadingFill(first2(pPr, "shd"));
|
|
1330
1333
|
if (shading) result.shadingFill = shading;
|
|
1331
|
-
const
|
|
1332
|
-
const before = twipValue(getW(
|
|
1333
|
-
const after = twipValue(getW(
|
|
1334
|
-
const
|
|
1334
|
+
const spacing2 = first2(pPr, "spacing");
|
|
1335
|
+
const before = twipValue(getW(spacing2, "before"));
|
|
1336
|
+
const after = twipValue(getW(spacing2, "after"));
|
|
1337
|
+
const line2 = signedTwipValue(getW(spacing2, "line"));
|
|
1335
1338
|
if (before !== void 0) result.spacingBeforeTwips = before;
|
|
1336
1339
|
if (after !== void 0) result.spacingAfterTwips = after;
|
|
1337
|
-
if (
|
|
1338
|
-
const rule = getW(
|
|
1340
|
+
if (line2 !== void 0) result.lineSpacingTwips = line2;
|
|
1341
|
+
const rule = getW(spacing2, "lineRule");
|
|
1339
1342
|
if (rule === "auto" || rule === "exact" || rule === "atLeast") result.lineSpacingRule = rule;
|
|
1340
|
-
else if (
|
|
1343
|
+
else if (line2 !== void 0) result.lineSpacingRule = "auto";
|
|
1341
1344
|
const ind = first2(pPr, "ind");
|
|
1342
1345
|
for (const [xml, key] of [
|
|
1343
1346
|
["left", "indentLeftTwips"],
|
|
@@ -1621,13 +1624,13 @@ function hexToRgbChannels(color) {
|
|
|
1621
1624
|
b: Number.parseInt(normalized.slice(4, 6), 16)
|
|
1622
1625
|
};
|
|
1623
1626
|
}
|
|
1624
|
-
function percentDivisorFor(
|
|
1625
|
-
return
|
|
1627
|
+
function percentDivisorFor(text2) {
|
|
1628
|
+
return text2.endsWith("%") ? 100 : 1e5;
|
|
1626
1629
|
}
|
|
1627
1630
|
function parseOoxmlPercent(value) {
|
|
1628
|
-
const
|
|
1629
|
-
const divisor = percentDivisorFor(
|
|
1630
|
-
const magnitude = Number.parseFloat(divisor === 100 ?
|
|
1631
|
+
const text2 = String(value ?? "").trim();
|
|
1632
|
+
const divisor = percentDivisorFor(text2);
|
|
1633
|
+
const magnitude = Number.parseFloat(divisor === 100 ? text2.slice(0, -1) : text2);
|
|
1631
1634
|
if (!Number.isFinite(magnitude)) {
|
|
1632
1635
|
return void 0;
|
|
1633
1636
|
}
|
|
@@ -1673,7 +1676,7 @@ function rgbToHsl(r, g, b) {
|
|
|
1673
1676
|
return { h, s: clampUnitInterval(s), l: clampUnitInterval(l) };
|
|
1674
1677
|
}
|
|
1675
1678
|
function hslToRgb(h, s, l, roundChannel = Math.round, options) {
|
|
1676
|
-
const sC = clampUnitInterval(s);
|
|
1679
|
+
const sC = options?.clampSaturation === false ? s : clampUnitInterval(s);
|
|
1677
1680
|
const lC = clampUnitInterval(l);
|
|
1678
1681
|
const hN = (h % 360 + 360) % 360;
|
|
1679
1682
|
const c = (1 - Math.abs(2 * lC - 1)) * sC;
|
|
@@ -1734,7 +1737,379 @@ function linearToSrgb255(linear) {
|
|
|
1734
1737
|
return 255 * (c <= 31308e-7 ? c * 12.92 : 1.055 * c ** (1 / 2.4) - 0.055);
|
|
1735
1738
|
}
|
|
1736
1739
|
|
|
1740
|
+
// color/native-gradient-curve.ts
|
|
1741
|
+
var OFFICE_SIGMA_FACTORS = [
|
|
1742
|
+
0,
|
|
1743
|
+
59,
|
|
1744
|
+
120,
|
|
1745
|
+
182,
|
|
1746
|
+
247,
|
|
1747
|
+
314,
|
|
1748
|
+
383,
|
|
1749
|
+
454,
|
|
1750
|
+
527,
|
|
1751
|
+
602,
|
|
1752
|
+
680,
|
|
1753
|
+
759,
|
|
1754
|
+
841,
|
|
1755
|
+
926,
|
|
1756
|
+
1013,
|
|
1757
|
+
1102,
|
|
1758
|
+
1194,
|
|
1759
|
+
1288,
|
|
1760
|
+
1385,
|
|
1761
|
+
1485,
|
|
1762
|
+
1587,
|
|
1763
|
+
1692,
|
|
1764
|
+
1800,
|
|
1765
|
+
1911,
|
|
1766
|
+
2024,
|
|
1767
|
+
2141,
|
|
1768
|
+
2260,
|
|
1769
|
+
2383,
|
|
1770
|
+
2508,
|
|
1771
|
+
2637,
|
|
1772
|
+
2769,
|
|
1773
|
+
2904,
|
|
1774
|
+
3042,
|
|
1775
|
+
3183,
|
|
1776
|
+
3328,
|
|
1777
|
+
3477,
|
|
1778
|
+
3628,
|
|
1779
|
+
3783,
|
|
1780
|
+
3942,
|
|
1781
|
+
4104,
|
|
1782
|
+
4270,
|
|
1783
|
+
4439,
|
|
1784
|
+
4612,
|
|
1785
|
+
4789,
|
|
1786
|
+
4969,
|
|
1787
|
+
5153,
|
|
1788
|
+
5341,
|
|
1789
|
+
5533,
|
|
1790
|
+
5728,
|
|
1791
|
+
5928,
|
|
1792
|
+
6131,
|
|
1793
|
+
6338,
|
|
1794
|
+
6549,
|
|
1795
|
+
6764,
|
|
1796
|
+
6983,
|
|
1797
|
+
7206,
|
|
1798
|
+
7434,
|
|
1799
|
+
7665,
|
|
1800
|
+
7900,
|
|
1801
|
+
8139,
|
|
1802
|
+
8382,
|
|
1803
|
+
8630,
|
|
1804
|
+
8881,
|
|
1805
|
+
9136,
|
|
1806
|
+
9396,
|
|
1807
|
+
9660,
|
|
1808
|
+
9927,
|
|
1809
|
+
10199,
|
|
1810
|
+
10475,
|
|
1811
|
+
10755,
|
|
1812
|
+
11039,
|
|
1813
|
+
11327,
|
|
1814
|
+
11619,
|
|
1815
|
+
11916,
|
|
1816
|
+
12216,
|
|
1817
|
+
12520,
|
|
1818
|
+
12828,
|
|
1819
|
+
13140,
|
|
1820
|
+
13456,
|
|
1821
|
+
13776,
|
|
1822
|
+
14099,
|
|
1823
|
+
14427,
|
|
1824
|
+
14758,
|
|
1825
|
+
15093,
|
|
1826
|
+
15431,
|
|
1827
|
+
15774,
|
|
1828
|
+
16119,
|
|
1829
|
+
16469,
|
|
1830
|
+
16822,
|
|
1831
|
+
17178,
|
|
1832
|
+
17538,
|
|
1833
|
+
17901,
|
|
1834
|
+
18267,
|
|
1835
|
+
18637,
|
|
1836
|
+
19009,
|
|
1837
|
+
19385,
|
|
1838
|
+
19764,
|
|
1839
|
+
20146,
|
|
1840
|
+
20530,
|
|
1841
|
+
20918,
|
|
1842
|
+
21308,
|
|
1843
|
+
21701,
|
|
1844
|
+
22096,
|
|
1845
|
+
22494,
|
|
1846
|
+
22894,
|
|
1847
|
+
23297,
|
|
1848
|
+
23702,
|
|
1849
|
+
24109,
|
|
1850
|
+
24518,
|
|
1851
|
+
24929,
|
|
1852
|
+
25342,
|
|
1853
|
+
25756,
|
|
1854
|
+
26173,
|
|
1855
|
+
26591,
|
|
1856
|
+
27010,
|
|
1857
|
+
27431,
|
|
1858
|
+
27853,
|
|
1859
|
+
28276,
|
|
1860
|
+
28701,
|
|
1861
|
+
29126,
|
|
1862
|
+
29552,
|
|
1863
|
+
29979,
|
|
1864
|
+
30407,
|
|
1865
|
+
30836,
|
|
1866
|
+
31264,
|
|
1867
|
+
31694,
|
|
1868
|
+
32123,
|
|
1869
|
+
32553,
|
|
1870
|
+
32983,
|
|
1871
|
+
33413,
|
|
1872
|
+
33842,
|
|
1873
|
+
34272,
|
|
1874
|
+
34700,
|
|
1875
|
+
35129,
|
|
1876
|
+
35557,
|
|
1877
|
+
35984,
|
|
1878
|
+
36410,
|
|
1879
|
+
36835,
|
|
1880
|
+
37260,
|
|
1881
|
+
37683,
|
|
1882
|
+
38105,
|
|
1883
|
+
38526,
|
|
1884
|
+
38945,
|
|
1885
|
+
39363,
|
|
1886
|
+
39780,
|
|
1887
|
+
40194,
|
|
1888
|
+
40607,
|
|
1889
|
+
41018,
|
|
1890
|
+
41427,
|
|
1891
|
+
41834,
|
|
1892
|
+
42239,
|
|
1893
|
+
42642,
|
|
1894
|
+
43042,
|
|
1895
|
+
43440,
|
|
1896
|
+
43835,
|
|
1897
|
+
44228,
|
|
1898
|
+
44618,
|
|
1899
|
+
45006,
|
|
1900
|
+
45390,
|
|
1901
|
+
45772,
|
|
1902
|
+
46151,
|
|
1903
|
+
46527,
|
|
1904
|
+
46899,
|
|
1905
|
+
47269,
|
|
1906
|
+
47635,
|
|
1907
|
+
47998,
|
|
1908
|
+
48358,
|
|
1909
|
+
48714,
|
|
1910
|
+
49067,
|
|
1911
|
+
49417,
|
|
1912
|
+
49762,
|
|
1913
|
+
50105,
|
|
1914
|
+
50443,
|
|
1915
|
+
50778,
|
|
1916
|
+
51109,
|
|
1917
|
+
51437,
|
|
1918
|
+
51760,
|
|
1919
|
+
52080,
|
|
1920
|
+
52396,
|
|
1921
|
+
52708,
|
|
1922
|
+
53016,
|
|
1923
|
+
53320,
|
|
1924
|
+
53620,
|
|
1925
|
+
53917,
|
|
1926
|
+
54209,
|
|
1927
|
+
54497,
|
|
1928
|
+
54781,
|
|
1929
|
+
55061,
|
|
1930
|
+
55337,
|
|
1931
|
+
55609,
|
|
1932
|
+
55876,
|
|
1933
|
+
56140,
|
|
1934
|
+
56400,
|
|
1935
|
+
56655,
|
|
1936
|
+
56906,
|
|
1937
|
+
57154,
|
|
1938
|
+
57397,
|
|
1939
|
+
57636,
|
|
1940
|
+
57871,
|
|
1941
|
+
58102,
|
|
1942
|
+
58330,
|
|
1943
|
+
58553,
|
|
1944
|
+
58772,
|
|
1945
|
+
58987,
|
|
1946
|
+
59198,
|
|
1947
|
+
59405,
|
|
1948
|
+
59608,
|
|
1949
|
+
59808,
|
|
1950
|
+
60003,
|
|
1951
|
+
60195,
|
|
1952
|
+
60383,
|
|
1953
|
+
60567,
|
|
1954
|
+
60747,
|
|
1955
|
+
60924,
|
|
1956
|
+
61097,
|
|
1957
|
+
61266,
|
|
1958
|
+
61432,
|
|
1959
|
+
61594,
|
|
1960
|
+
61753,
|
|
1961
|
+
61908,
|
|
1962
|
+
62059,
|
|
1963
|
+
62208,
|
|
1964
|
+
62353,
|
|
1965
|
+
62494,
|
|
1966
|
+
62632,
|
|
1967
|
+
62767,
|
|
1968
|
+
62899,
|
|
1969
|
+
63028,
|
|
1970
|
+
63153,
|
|
1971
|
+
63276,
|
|
1972
|
+
63395,
|
|
1973
|
+
63512,
|
|
1974
|
+
63625,
|
|
1975
|
+
63736,
|
|
1976
|
+
63844,
|
|
1977
|
+
63949,
|
|
1978
|
+
64051,
|
|
1979
|
+
64151,
|
|
1980
|
+
64248,
|
|
1981
|
+
64342,
|
|
1982
|
+
64434,
|
|
1983
|
+
64523,
|
|
1984
|
+
64610,
|
|
1985
|
+
64695,
|
|
1986
|
+
64777,
|
|
1987
|
+
64856,
|
|
1988
|
+
64934,
|
|
1989
|
+
65009,
|
|
1990
|
+
65082,
|
|
1991
|
+
65153,
|
|
1992
|
+
65222,
|
|
1993
|
+
65289,
|
|
1994
|
+
65354,
|
|
1995
|
+
65416,
|
|
1996
|
+
65477,
|
|
1997
|
+
65536
|
|
1998
|
+
];
|
|
1999
|
+
|
|
2000
|
+
// color/sigma-gradient-stops.ts
|
|
2001
|
+
function sigmaGradientStops(stops) {
|
|
2002
|
+
if (stops.length !== 2 || stops[0]?.offset !== 0 || stops[1]?.offset !== 1) return void 0;
|
|
2003
|
+
if (stops.some((stop) => (stop.opacity ?? 1) !== 1)) return void 0;
|
|
2004
|
+
const front = hexToRgbChannels(stops[0].color);
|
|
2005
|
+
const back = hexToRgbChannels(stops[1].color);
|
|
2006
|
+
if (!front || !back) return void 0;
|
|
2007
|
+
return OFFICE_SIGMA_FACTORS.map((value, index) => {
|
|
2008
|
+
const factor = value / 65536;
|
|
2009
|
+
const mix = (a, b) => toHex(255 * ((a / 255) ** 2.2 * (1 - factor) + (b / 255) ** 2.2 * factor) ** (1 / 2.2));
|
|
2010
|
+
return {
|
|
2011
|
+
offset: Math.fround(index / 255),
|
|
2012
|
+
color: `#${mix(front.r, back.r)}${mix(front.g, back.g)}${mix(front.b, back.b)}`,
|
|
2013
|
+
opacity: 1
|
|
2014
|
+
};
|
|
2015
|
+
});
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
// color/hex-rgb.ts
|
|
2019
|
+
function parseArgbHex(hex) {
|
|
2020
|
+
const clean2 = hex.replace(/^#/, "");
|
|
2021
|
+
const rgb = clean2.length === 8 ? clean2.slice(2) : clean2;
|
|
2022
|
+
if (!/^[0-9a-fA-F]{6}$/.test(rgb)) return void 0;
|
|
2023
|
+
return [0, 2, 4].map((i) => parseInt(rgb.slice(i, i + 2), 16));
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
// drawingml/ordered-color-transforms.ts
|
|
2027
|
+
function orderedColorTransforms(channels, transforms) {
|
|
2028
|
+
let { r, g, b } = channels;
|
|
2029
|
+
let alpha = 1;
|
|
2030
|
+
const wrap = (value) => (value % 360 + 360) % 360;
|
|
2031
|
+
for (const transform of transforms) {
|
|
2032
|
+
const { name, value } = transform;
|
|
2033
|
+
const fraction = parseDrawingFraction(value);
|
|
2034
|
+
if (name === "alpha" && fraction !== void 0) alpha = clampUnitInterval(fraction);
|
|
2035
|
+
else if (name === "alphaMod" && fraction !== void 0)
|
|
2036
|
+
alpha = clampUnitInterval(alpha * fraction);
|
|
2037
|
+
else if (name === "alphaOff" && fraction !== void 0)
|
|
2038
|
+
alpha = clampUnitInterval(alpha + fraction);
|
|
2039
|
+
else if (name === "inv") [r, g, b] = [255 - r, 255 - g, 255 - b];
|
|
2040
|
+
else if (name === "gray") r = g = b = 0.299 * r + 0.587 * g + 0.114 * b;
|
|
2041
|
+
else if ((name === "shade" || name === "tint") && fraction !== void 0) {
|
|
2042
|
+
const mix = (channel) => linearToSrgb255(
|
|
2043
|
+
name === "shade" ? srgb255ToLinear(channel) * fraction : 1 - (1 - srgb255ToLinear(channel)) * fraction
|
|
2044
|
+
);
|
|
2045
|
+
[r, g, b] = [mix(r), mix(g), mix(b)];
|
|
2046
|
+
} else {
|
|
2047
|
+
const hsl = rgbToHsl(r, g, b);
|
|
2048
|
+
if (name === "comp") hsl.h = wrap(hsl.h + 180);
|
|
2049
|
+
else if (name === "hue") {
|
|
2050
|
+
const hue = parseDrawingHueDegrees(value);
|
|
2051
|
+
if (hue !== void 0) hsl.h = wrap(hue);
|
|
2052
|
+
} else if (name === "hueOff") {
|
|
2053
|
+
const hue = parseDrawingHueDegrees(value);
|
|
2054
|
+
if (hue !== void 0) hsl.h = wrap(hsl.h + hue);
|
|
2055
|
+
} else if (name === "hueMod" && fraction !== void 0) hsl.h = wrap(hsl.h * fraction);
|
|
2056
|
+
else if (name === "sat" && fraction !== void 0) hsl.s = clampUnitInterval(fraction);
|
|
2057
|
+
else if (name === "satMod" && fraction !== void 0) hsl.s *= fraction;
|
|
2058
|
+
else if (name === "satOff" && fraction !== void 0)
|
|
2059
|
+
hsl.s = clampUnitInterval(hsl.s + fraction);
|
|
2060
|
+
else if (name === "lum" && fraction !== void 0) hsl.l = clampUnitInterval(fraction);
|
|
2061
|
+
else if (name === "lumMod" && fraction !== void 0)
|
|
2062
|
+
hsl.l = clampUnitInterval(hsl.l * fraction);
|
|
2063
|
+
else if (name === "lumOff" && fraction !== void 0)
|
|
2064
|
+
hsl.l = clampUnitInterval(hsl.l + fraction);
|
|
2065
|
+
else continue;
|
|
2066
|
+
({ r, g, b } = hslToRgb(hsl.h, hsl.s, hsl.l, (channel) => channel, {
|
|
2067
|
+
clampSaturation: false
|
|
2068
|
+
}));
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
return { r, g, b, alpha };
|
|
2072
|
+
}
|
|
2073
|
+
|
|
1737
2074
|
// drawingml/drawing-color.ts
|
|
2075
|
+
var COLOR_ELEMENTS = {
|
|
2076
|
+
srgbClr: "srgb",
|
|
2077
|
+
schemeClr: "scheme",
|
|
2078
|
+
sysClr: "system",
|
|
2079
|
+
prstClr: "preset",
|
|
2080
|
+
scrgbClr: "scrgb",
|
|
2081
|
+
hslClr: "hsl"
|
|
2082
|
+
};
|
|
2083
|
+
function colorValue(kind, element) {
|
|
2084
|
+
const attribute = (name) => element.getAttribute(name) ?? "";
|
|
2085
|
+
if (kind === "scrgb") return `${attribute("r")},${attribute("g")},${attribute("b")}`;
|
|
2086
|
+
if (kind === "hsl") return `${attribute("hue")},${attribute("sat")},${attribute("lum")}`;
|
|
2087
|
+
return attribute("val");
|
|
2088
|
+
}
|
|
2089
|
+
function parseDrawingColorIn(container) {
|
|
2090
|
+
if (!container) return void 0;
|
|
2091
|
+
for (const element of elements(container)) {
|
|
2092
|
+
const kind = COLOR_ELEMENTS[element.localName];
|
|
2093
|
+
if (!kind || element.namespaceURI && element.namespaceURI !== NS.a) continue;
|
|
2094
|
+
return parseDrawingColor(element);
|
|
2095
|
+
}
|
|
2096
|
+
return void 0;
|
|
2097
|
+
}
|
|
2098
|
+
function parseDrawingColor(element) {
|
|
2099
|
+
const kind = COLOR_ELEMENTS[element.localName];
|
|
2100
|
+
if (!kind) return void 0;
|
|
2101
|
+
const color = {
|
|
2102
|
+
kind,
|
|
2103
|
+
value: colorValue(kind, element),
|
|
2104
|
+
transforms: elements(element).map((child) => ({
|
|
2105
|
+
name: child.localName,
|
|
2106
|
+
value: child.getAttribute("val") ?? ""
|
|
2107
|
+
}))
|
|
2108
|
+
};
|
|
2109
|
+
const fallback = kind === "system" ? element.getAttribute("lastClr") : null;
|
|
2110
|
+
if (fallback) color.fallback = fallback;
|
|
2111
|
+
return color;
|
|
2112
|
+
}
|
|
1738
2113
|
var PRESET_COLORS = {
|
|
1739
2114
|
black: "#000000",
|
|
1740
2115
|
white: "#FFFFFF",
|
|
@@ -1794,6 +2169,17 @@ function resolveDrawingColor(color, theme, options) {
|
|
|
1794
2169
|
const base = baseHex(color, theme);
|
|
1795
2170
|
const rgb = base ? hexToRgbChannels(base) : null;
|
|
1796
2171
|
if (!rgb) return void 0;
|
|
2172
|
+
if (options?.transformOrder === "document") {
|
|
2173
|
+
const value = orderedColorTransforms(rgb, color.transforms);
|
|
2174
|
+
const round = options.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
|
|
2175
|
+
return {
|
|
2176
|
+
hex: `#${toHex(round(value.r))}${toHex(round(value.g))}${toHex(round(value.b))}`,
|
|
2177
|
+
alpha: value.alpha,
|
|
2178
|
+
unapplied: [...new Set(color.transforms.map((transform) => transform.name))].filter(
|
|
2179
|
+
(name) => !APPLIED.has(name)
|
|
2180
|
+
)
|
|
2181
|
+
};
|
|
2182
|
+
}
|
|
1797
2183
|
let { r, g, b } = rgb;
|
|
1798
2184
|
const find = (name) => color.transforms.find((entry) => entry.name === name)?.value;
|
|
1799
2185
|
const has = (name) => color.transforms.some((entry) => entry.name === name);
|
|
@@ -1836,7 +2222,7 @@ function resolveDrawingColor(color, theme, options) {
|
|
|
1836
2222
|
if (lumMod !== void 0) hsl.l = clampUnitInterval(hsl.l * lumMod);
|
|
1837
2223
|
const lumOff = parseDrawingFraction(find("lumOff"));
|
|
1838
2224
|
if (lumOff !== void 0) hsl.l = clampUnitInterval(hsl.l + lumOff);
|
|
1839
|
-
const round = Math.round;
|
|
2225
|
+
const round = options?.hslRounding === "halfDown" ? (value) => Math.ceil(value - 0.5) : Math.round;
|
|
1840
2226
|
({ r, g, b } = hslToRgb(hsl.h, hsl.s, hsl.l, round));
|
|
1841
2227
|
}
|
|
1842
2228
|
let alpha = parseDrawingPercent(find("alpha")) ?? 1;
|
|
@@ -1891,6 +2277,11 @@ function themeColorSlotFor(name, colorMap = {}) {
|
|
|
1891
2277
|
if (name === "dk1" || name === "lt1" || name === "dk2" || name === "lt2") return name;
|
|
1892
2278
|
return colorMap[name] ?? name;
|
|
1893
2279
|
}
|
|
2280
|
+
function themeSlotHex(color) {
|
|
2281
|
+
if (!color) return void 0;
|
|
2282
|
+
const value = color.kind === "srgb" ? color.value : color.kind === "system" ? color.fallback : void 0;
|
|
2283
|
+
return value ? value.toUpperCase() : void 0;
|
|
2284
|
+
}
|
|
1894
2285
|
|
|
1895
2286
|
// docx/theme-color.ts
|
|
1896
2287
|
function isThemeColorToken(value) {
|
|
@@ -1900,6 +2291,11 @@ function fractionToThemeByte(fraction) {
|
|
|
1900
2291
|
return toHex(Math.round(Math.min(1, Math.max(0, fraction)) * 255));
|
|
1901
2292
|
}
|
|
1902
2293
|
|
|
2294
|
+
// opc/signature/xml-utils.ts
|
|
2295
|
+
function escapeXmlAttr(value) {
|
|
2296
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
2297
|
+
}
|
|
2298
|
+
|
|
1903
2299
|
// docx/comment-spans.ts
|
|
1904
2300
|
function rangeKeys(run) {
|
|
1905
2301
|
const keys = (run.commentIds ?? []).map((id) => `comment:${id}`);
|
|
@@ -2190,24 +2586,24 @@ function updateDirection(doc, props, paragraph, base) {
|
|
|
2190
2586
|
}
|
|
2191
2587
|
}
|
|
2192
2588
|
function updateSpacing(doc, props, paragraph, base) {
|
|
2193
|
-
let
|
|
2194
|
-
if (!
|
|
2195
|
-
|
|
2196
|
-
props.appendChild(
|
|
2589
|
+
let spacing2 = first2(props, "spacing");
|
|
2590
|
+
if (!spacing2) {
|
|
2591
|
+
spacing2 = makeW(doc, "spacing");
|
|
2592
|
+
props.appendChild(spacing2);
|
|
2197
2593
|
}
|
|
2198
2594
|
if (!base || paragraph.spacingBeforeTwips !== base.spacingBeforeTwips)
|
|
2199
|
-
setWordValue(
|
|
2595
|
+
setWordValue(spacing2, "before", paragraph.spacingBeforeTwips);
|
|
2200
2596
|
if (!base || paragraph.spacingAfterTwips !== base.spacingAfterTwips)
|
|
2201
|
-
setWordValue(
|
|
2597
|
+
setWordValue(spacing2, "after", paragraph.spacingAfterTwips);
|
|
2202
2598
|
if (!base || paragraph.lineSpacingTwips !== base.lineSpacingTwips || paragraph.lineSpacingRule !== base.lineSpacingRule) {
|
|
2203
|
-
setWordValue(
|
|
2599
|
+
setWordValue(spacing2, "line", paragraph.lineSpacingTwips);
|
|
2204
2600
|
setWordValue(
|
|
2205
|
-
|
|
2601
|
+
spacing2,
|
|
2206
2602
|
"lineRule",
|
|
2207
2603
|
paragraph.lineSpacingRule ?? (paragraph.lineSpacingTwips === void 0 ? void 0 : "auto")
|
|
2208
2604
|
);
|
|
2209
2605
|
}
|
|
2210
|
-
if (!
|
|
2606
|
+
if (!spacing2.attributes.length && !spacing2.childNodes.length) props.removeChild(spacing2);
|
|
2211
2607
|
}
|
|
2212
2608
|
function updateIndent(doc, props, paragraph, base) {
|
|
2213
2609
|
let indent = first2(props, "ind");
|
|
@@ -2530,10 +2926,10 @@ function hasUnexpectedAttributes(element, allowed, allowDateUtc = false) {
|
|
|
2530
2926
|
}
|
|
2531
2927
|
return false;
|
|
2532
2928
|
}
|
|
2533
|
-
function runPropertiesHaveUnknownContent(
|
|
2534
|
-
if (!
|
|
2535
|
-
if (hasUnexpectedAttributes(
|
|
2536
|
-
for (const node of Array.from(
|
|
2929
|
+
function runPropertiesHaveUnknownContent(properties4) {
|
|
2930
|
+
if (!properties4) return false;
|
|
2931
|
+
if (hasUnexpectedAttributes(properties4, [])) return true;
|
|
2932
|
+
for (const node of Array.from(properties4.childNodes)) {
|
|
2537
2933
|
if (node.nodeType !== 1) {
|
|
2538
2934
|
if (node.nodeType === 3 && node.textContent?.trim()) return true;
|
|
2539
2935
|
continue;
|
|
@@ -2637,9 +3033,9 @@ function setExtendedRunProperties(doc, props, run, base) {
|
|
|
2637
3033
|
if (changed("characterSpacingTwips")) {
|
|
2638
3034
|
removeChildren2(props, "spacing");
|
|
2639
3035
|
if (run.characterSpacingTwips !== void 0) {
|
|
2640
|
-
const
|
|
2641
|
-
setAttribute5(
|
|
2642
|
-
props.appendChild(
|
|
3036
|
+
const spacing2 = makeW(doc, "spacing");
|
|
3037
|
+
setAttribute5(spacing2, "val", String(Math.round(run.characterSpacingTwips)));
|
|
3038
|
+
props.appendChild(spacing2);
|
|
2643
3039
|
}
|
|
2644
3040
|
}
|
|
2645
3041
|
if (changed("shadingFill") || changed("shadingThemeFill")) {
|
|
@@ -2737,13 +3133,13 @@ function buildWatermarkRun(doc, spec, uniqueId) {
|
|
|
2737
3133
|
shape.setAttribute("stroked", "f");
|
|
2738
3134
|
const fill = v("fill");
|
|
2739
3135
|
fill.setAttribute("opacity", spec.semitransparent ? ".5" : "1");
|
|
2740
|
-
const
|
|
2741
|
-
|
|
2742
|
-
|
|
3136
|
+
const text2 = v("textpath");
|
|
3137
|
+
text2.setAttribute("style", `font-family:"${spec.fontFamily ?? "Calibri"}";font-size:1pt`);
|
|
3138
|
+
text2.setAttribute("string", spec.text);
|
|
2743
3139
|
const wrap = makeNS(doc, WORD10_NS, "w10:wrap");
|
|
2744
3140
|
wrap.setAttribute("anchorx", "margin");
|
|
2745
3141
|
wrap.setAttribute("anchory", "margin");
|
|
2746
|
-
for (const child of [fill,
|
|
3142
|
+
for (const child of [fill, text2, wrap]) shape.appendChild(child);
|
|
2747
3143
|
pict.appendChild(type);
|
|
2748
3144
|
pict.appendChild(shape);
|
|
2749
3145
|
run.appendChild(pict);
|
|
@@ -2763,15 +3159,15 @@ var add = (parent, ...items) => {
|
|
|
2763
3159
|
var emu = (px) => String(Math.max(1, Math.round(px * EMU_PER_PIXEL)));
|
|
2764
3160
|
var descendants = (root, ns, local) => Array.from(root.getElementsByTagNameNS(ns, local));
|
|
2765
3161
|
function paragraphsFor(doc, lines) {
|
|
2766
|
-
return (lines.length ? lines : [""]).map((
|
|
3162
|
+
return (lines.length ? lines : [""]).map((line2) => {
|
|
2767
3163
|
const paragraph = makeW(doc, "p");
|
|
2768
|
-
if (
|
|
3164
|
+
if (line2) {
|
|
2769
3165
|
const run = makeW(doc, "r");
|
|
2770
|
-
const
|
|
2771
|
-
if (/^\s|\s$/.test(
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
add(run,
|
|
3166
|
+
const text2 = makeW(doc, "t");
|
|
3167
|
+
if (/^\s|\s$/.test(line2))
|
|
3168
|
+
text2.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
|
|
3169
|
+
text2.textContent = line2;
|
|
3170
|
+
add(run, text2);
|
|
2775
3171
|
add(paragraph, run);
|
|
2776
3172
|
}
|
|
2777
3173
|
return paragraph;
|
|
@@ -2815,6 +3211,1962 @@ function patchTextBox(doc, drawing, image, base) {
|
|
|
2815
3211
|
}
|
|
2816
3212
|
}
|
|
2817
3213
|
|
|
3214
|
+
// drawingml/drawing-color-css.ts
|
|
3215
|
+
function drawingColorCss(value) {
|
|
3216
|
+
if (!value || value.alpha === 1) return value?.hex;
|
|
3217
|
+
const channels = [1, 3, 5].map(
|
|
3218
|
+
(offset) => Number.parseInt(value.hex.slice(offset, offset + 2), 16)
|
|
3219
|
+
);
|
|
3220
|
+
return `rgba(${channels.join(",")},${value.alpha})`;
|
|
3221
|
+
}
|
|
3222
|
+
|
|
3223
|
+
// drawingml/drawing-shadow.ts
|
|
3224
|
+
function resolveDrawingShadow(effects, theme) {
|
|
3225
|
+
const node = first(effects, "outerShdw", NS.a);
|
|
3226
|
+
if (!node) return void 0;
|
|
3227
|
+
const value = (key, fallback) => Number(node.getAttribute(key) ?? fallback);
|
|
3228
|
+
if (value("sx", 1e5) !== 1e5 || value("sy", 1e5) !== 1e5 || value("kx", 0) !== 0 || value("ky", 0) !== 0)
|
|
3229
|
+
return void 0;
|
|
3230
|
+
const color = parseDrawingColorIn(node);
|
|
3231
|
+
const resolved = color && resolveDrawingColor(color, theme, { transformOrder: "document" });
|
|
3232
|
+
const blur = value("blurRad", 0) / EMU_PER_PIXEL;
|
|
3233
|
+
const distance = value("dist", 0) / EMU_PER_PIXEL;
|
|
3234
|
+
const angle = value("dir", 0) / 6e4 * Math.PI / 180;
|
|
3235
|
+
if (!resolved || ![blur, distance, angle].every(Number.isFinite) || blur < 0 || distance < 0)
|
|
3236
|
+
return void 0;
|
|
3237
|
+
return {
|
|
3238
|
+
color: resolved.hex,
|
|
3239
|
+
opacity: resolved.alpha,
|
|
3240
|
+
blur,
|
|
3241
|
+
dx: Math.cos(angle) * distance,
|
|
3242
|
+
dy: Math.sin(angle) * distance
|
|
3243
|
+
};
|
|
3244
|
+
}
|
|
3245
|
+
function resolveDrawingShadowXml(xml, theme) {
|
|
3246
|
+
return xml ? resolveDrawingShadow(parseXml(xml).documentElement, theme) : void 0;
|
|
3247
|
+
}
|
|
3248
|
+
function svgDropShadowElement(s, format) {
|
|
3249
|
+
const num = format.number;
|
|
3250
|
+
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"/>`;
|
|
3251
|
+
}
|
|
3252
|
+
function hexToRgb(color) {
|
|
3253
|
+
const parsed = hexToRgbChannels(color);
|
|
3254
|
+
if (parsed) return parsed;
|
|
3255
|
+
const hex = color.replace("#", "");
|
|
3256
|
+
return {
|
|
3257
|
+
r: Number.parseInt(hex.slice(0, 2), 16) || 0,
|
|
3258
|
+
g: Number.parseInt(hex.slice(2, 4), 16) || 0,
|
|
3259
|
+
b: Number.parseInt(hex.slice(4, 6), 16) || 0
|
|
3260
|
+
};
|
|
3261
|
+
}
|
|
3262
|
+
function toHexChannel(value) {
|
|
3263
|
+
return toHex(value).toLowerCase();
|
|
3264
|
+
}
|
|
3265
|
+
function lerpStops(a, b, t) {
|
|
3266
|
+
const ca = hexToRgb(a.color);
|
|
3267
|
+
const cb = hexToRgb(b.color);
|
|
3268
|
+
const oa = a.opacity ?? 1;
|
|
3269
|
+
const ob = b.opacity ?? 1;
|
|
3270
|
+
return {
|
|
3271
|
+
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)}`,
|
|
3272
|
+
opacity: oa + (ob - oa) * t
|
|
3273
|
+
};
|
|
3274
|
+
}
|
|
3275
|
+
function colorAt(stops, position) {
|
|
3276
|
+
const first3 = stops[0];
|
|
3277
|
+
const last = stops[stops.length - 1];
|
|
3278
|
+
if (position <= first3.position) {
|
|
3279
|
+
return { color: first3.color, opacity: first3.opacity ?? 1 };
|
|
3280
|
+
}
|
|
3281
|
+
if (position >= last.position) {
|
|
3282
|
+
return { color: last.color, opacity: last.opacity ?? 1 };
|
|
3283
|
+
}
|
|
3284
|
+
for (let i = 0; i < stops.length - 1; i += 1) {
|
|
3285
|
+
const from = stops[i];
|
|
3286
|
+
const to = stops[i + 1];
|
|
3287
|
+
if (position >= from.position && position <= to.position) {
|
|
3288
|
+
const span = to.position - from.position;
|
|
3289
|
+
const t = span > 0 ? (position - from.position) / span : 0;
|
|
3290
|
+
return lerpStops(from, to, t);
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
return { color: last.color, opacity: last.opacity ?? 1 };
|
|
3294
|
+
}
|
|
3295
|
+
function resolveInnerRect(fillToRect, focalPoint) {
|
|
3296
|
+
let centerX = 50;
|
|
3297
|
+
let centerY = 50;
|
|
3298
|
+
let width = 0;
|
|
3299
|
+
let height = 0;
|
|
3300
|
+
if (fillToRect) {
|
|
3301
|
+
const { l, t, r, b } = fillToRect;
|
|
3302
|
+
centerX = (l + (1 - r)) / 2 * 100;
|
|
3303
|
+
centerY = (t + (1 - b)) / 2 * 100;
|
|
3304
|
+
width = Math.max(0, Math.min(1, 1 - l - r)) * 100;
|
|
3305
|
+
height = Math.max(0, Math.min(1, 1 - t - b)) * 100;
|
|
3306
|
+
}
|
|
3307
|
+
return {
|
|
3308
|
+
left: centerX - width / 2,
|
|
3309
|
+
top: centerY - height / 2,
|
|
3310
|
+
right: centerX + width / 2,
|
|
3311
|
+
bottom: centerY + height / 2
|
|
3312
|
+
};
|
|
3313
|
+
}
|
|
3314
|
+
function lerpEdge(inner, outer, t) {
|
|
3315
|
+
return inner + (outer - inner) * t;
|
|
3316
|
+
}
|
|
3317
|
+
function buildRectPathGradientSvg(stops, focalPoint, fillToRect, options) {
|
|
3318
|
+
if (stops.length === 0) {
|
|
3319
|
+
return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"/>';
|
|
3320
|
+
}
|
|
3321
|
+
const sorted = [...stops].sort((a, b) => a.position - b.position);
|
|
3322
|
+
const inner = resolveInnerRect(fillToRect);
|
|
3323
|
+
const rects = [];
|
|
3324
|
+
const alphaRects = [];
|
|
3325
|
+
const masked = sorted.some((stop) => (stop.opacity ?? 1) < 1);
|
|
3326
|
+
const bands = options?.bands;
|
|
3327
|
+
if (!Number.isInteger(bands) || bands < 1) throw new RangeError("Invalid gradient band count");
|
|
3328
|
+
for (let i = bands; i >= 0; i -= 1) {
|
|
3329
|
+
const t = i / bands;
|
|
3330
|
+
const { color, opacity } = colorAt(sorted, t * 100);
|
|
3331
|
+
const left = lerpEdge(inner.left, 0, t);
|
|
3332
|
+
const top = lerpEdge(inner.top, 0, t);
|
|
3333
|
+
const right = lerpEdge(inner.right, 100, t);
|
|
3334
|
+
const bottom = lerpEdge(inner.bottom, 100, t);
|
|
3335
|
+
const opacityAttr = !masked && opacity < 1 ? ` fill-opacity="${Math.max(0, opacity).toFixed(3)}"` : "";
|
|
3336
|
+
rects.push(
|
|
3337
|
+
`<rect x="${left.toFixed(2)}" y="${top.toFixed(2)}" width="${(right - left).toFixed(2)}" height="${(bottom - top).toFixed(2)}" fill="${color}"${opacityAttr}/>`
|
|
3338
|
+
);
|
|
3339
|
+
if (masked) {
|
|
3340
|
+
const channel = toHexChannel(opacity * 255);
|
|
3341
|
+
alphaRects.push(
|
|
3342
|
+
`<rect x="${left.toFixed(2)}" y="${top.toFixed(2)}" width="${(right - left).toFixed(2)}" height="${(bottom - top).toFixed(2)}" fill="#${channel}${channel}${channel}"/>`
|
|
3343
|
+
);
|
|
3344
|
+
}
|
|
3345
|
+
}
|
|
3346
|
+
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("");
|
|
3347
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none">${paint}</svg>`;
|
|
3348
|
+
}
|
|
3349
|
+
|
|
3350
|
+
// chart/color-palettes.ts
|
|
3351
|
+
var COLORFUL_VARIATIONS = [
|
|
3352
|
+
{},
|
|
3353
|
+
{ lumMod: 6e4 },
|
|
3354
|
+
{ lumMod: 8e4, lumOff: 2e4 },
|
|
3355
|
+
{ lumMod: 8e4 },
|
|
3356
|
+
{ lumMod: 6e4, lumOff: 4e4 },
|
|
3357
|
+
{ lumMod: 5e4 },
|
|
3358
|
+
{ lumMod: 7e4, lumOff: 3e4 },
|
|
3359
|
+
{ lumMod: 7e4 },
|
|
3360
|
+
{ lumMod: 5e4, lumOff: 5e4 }
|
|
3361
|
+
];
|
|
3362
|
+
var GRAY_VARIATIONS = [
|
|
3363
|
+
{ tint: 88500 },
|
|
3364
|
+
{ tint: 55e3 },
|
|
3365
|
+
{ tint: 75e3 },
|
|
3366
|
+
{ tint: 98500 },
|
|
3367
|
+
{ tint: 3e4 },
|
|
3368
|
+
{ tint: 6e4 },
|
|
3369
|
+
{ tint: 8e4 }
|
|
3370
|
+
];
|
|
3371
|
+
var ACCENTS = ["accent1", "accent2", "accent3", "accent4", "accent5", "accent6"];
|
|
3372
|
+
function colorful(id, index, base) {
|
|
3373
|
+
return { id, group: "colorful", index, meth: "cycle", base, variations: COLORFUL_VARIATIONS };
|
|
3374
|
+
}
|
|
3375
|
+
function mono(id, index, accent, meth) {
|
|
3376
|
+
return { id, group: "monochromatic", index, meth, base: [accent], variations: [] };
|
|
3377
|
+
}
|
|
3378
|
+
var CHART_COLOR_PALETTES = [
|
|
3379
|
+
colorful(10, 1, ACCENTS),
|
|
3380
|
+
colorful(11, 2, ["accent1", "accent3", "accent5"]),
|
|
3381
|
+
colorful(12, 3, ["accent2", "accent4", "accent6"]),
|
|
3382
|
+
colorful(13, 4, ["accent6", "accent5", "accent4"]),
|
|
3383
|
+
...ACCENTS.map((accent, i) => mono(14 + i, 1 + i, accent, "withinLinear")),
|
|
3384
|
+
{
|
|
3385
|
+
id: 20,
|
|
3386
|
+
group: "monochromatic",
|
|
3387
|
+
index: 7,
|
|
3388
|
+
meth: "cycle",
|
|
3389
|
+
base: ["dk1"],
|
|
3390
|
+
variations: GRAY_VARIATIONS
|
|
3391
|
+
},
|
|
3392
|
+
...ACCENTS.map((accent, i) => mono(21 + i, 8 + i, accent, "withinLinearReversed"))
|
|
3393
|
+
];
|
|
3394
|
+
function findChartColorPalette(id) {
|
|
3395
|
+
return CHART_COLOR_PALETTES.find((palette) => palette.id === id);
|
|
3396
|
+
}
|
|
3397
|
+
function withinLinearTransform(i, n2) {
|
|
3398
|
+
if (n2 <= 1) {
|
|
3399
|
+
return {};
|
|
3400
|
+
}
|
|
3401
|
+
const step = 140 / (n2 + 1);
|
|
3402
|
+
const centre = (n2 - 1) / 2;
|
|
3403
|
+
const value = 100 - step * Math.abs(i - centre);
|
|
3404
|
+
if (i < centre) {
|
|
3405
|
+
return { shade: Math.floor(value + 1e-9) * 1e3 };
|
|
3406
|
+
}
|
|
3407
|
+
if (i > centre) {
|
|
3408
|
+
return { tint: Math.ceil(value - 1e-9) * 1e3 };
|
|
3409
|
+
}
|
|
3410
|
+
return {};
|
|
3411
|
+
}
|
|
3412
|
+
function chartPaletteSeriesColorChoice(palette, i, n2) {
|
|
3413
|
+
let base;
|
|
3414
|
+
let transform;
|
|
3415
|
+
if (palette.meth === "cycle") {
|
|
3416
|
+
base = palette.base[i % palette.base.length];
|
|
3417
|
+
const round = Math.floor(i / palette.base.length);
|
|
3418
|
+
transform = (palette.variations.length ? palette.variations[round % palette.variations.length] : {}) ?? {};
|
|
3419
|
+
} else {
|
|
3420
|
+
const index = palette.meth === "withinLinearReversed" ? n2 - 1 - i : i;
|
|
3421
|
+
base = palette.base[0];
|
|
3422
|
+
transform = withinLinearTransform(index, n2);
|
|
3423
|
+
}
|
|
3424
|
+
if (!base) throw new RangeError("A chart palette must have a base color");
|
|
3425
|
+
return {
|
|
3426
|
+
kind: "scheme",
|
|
3427
|
+
value: base,
|
|
3428
|
+
transforms: Object.entries(transform).map(([name, value]) => ({ name, value: String(value) }))
|
|
3429
|
+
};
|
|
3430
|
+
}
|
|
3431
|
+
function chartPaletteSeriesColor(palette, i, n2, scheme) {
|
|
3432
|
+
const choice = chartPaletteSeriesColorChoice(palette, i, n2);
|
|
3433
|
+
return (resolveDrawingColor(choice, { scheme: (name) => scheme[name] })?.hex ?? scheme[choice.value]).toUpperCase();
|
|
3434
|
+
}
|
|
3435
|
+
|
|
3436
|
+
// chart/style-definition.ts
|
|
3437
|
+
var CHART_STYLE_PARTS = [
|
|
3438
|
+
"title",
|
|
3439
|
+
"axisTitle",
|
|
3440
|
+
"categoryAxis",
|
|
3441
|
+
"valueAxis",
|
|
3442
|
+
"legend",
|
|
3443
|
+
"dataLabel",
|
|
3444
|
+
"dataPoint",
|
|
3445
|
+
"dataPointLine",
|
|
3446
|
+
"gridlineMajor",
|
|
3447
|
+
"gridlineMinor",
|
|
3448
|
+
"chartArea",
|
|
3449
|
+
"plotArea"
|
|
3450
|
+
];
|
|
3451
|
+
function resolveChartStyleDefinition(style, resolve) {
|
|
3452
|
+
const out = {};
|
|
3453
|
+
const fillColor = (fill) => fill?.kind === "none" ? "none" : fill?.kind === "solid" ? resolve(fill.color) : void 0;
|
|
3454
|
+
for (const name of CHART_STYLE_PARTS) {
|
|
3455
|
+
const source = style.entries[name];
|
|
3456
|
+
if (!source) continue;
|
|
3457
|
+
const entry = {};
|
|
3458
|
+
for (const key of ["fontSize", "bold", "italic", "underline"]) {
|
|
3459
|
+
const value = source[key];
|
|
3460
|
+
if (value !== void 0) Object.assign(entry, { [key]: value });
|
|
3461
|
+
}
|
|
3462
|
+
const line2 = fillColor(source.line?.fill) ?? (source.lineRef?.color && resolve(source.lineRef.color));
|
|
3463
|
+
const fill = fillColor(source.fill) ?? (source.fillRef?.color && resolve(source.fillRef.color));
|
|
3464
|
+
const color = (source.textColor && resolve(source.textColor)) ?? (source.fontRef?.color && resolve(source.fontRef.color));
|
|
3465
|
+
if (color !== void 0) entry.color = color;
|
|
3466
|
+
if (line2 !== void 0) entry.lineColor = line2;
|
|
3467
|
+
if (fill !== void 0) entry.fillColor = fill;
|
|
3468
|
+
if (source.line?.widthEmu !== void 0 && source.line.widthEmu > 0)
|
|
3469
|
+
entry.lineWidth = source.line.widthEmu / 12700;
|
|
3470
|
+
if (Object.keys(entry).length) out[name] = entry;
|
|
3471
|
+
}
|
|
3472
|
+
return Object.keys(out).length ? out : void 0;
|
|
3473
|
+
}
|
|
3474
|
+
function effectiveBuiltInChartStyle(formatting) {
|
|
3475
|
+
return formatting?.builtInStyle ?? (formatting?.sourceXml ? void 0 : 102);
|
|
3476
|
+
}
|
|
3477
|
+
function builtInChartTextStyle(id) {
|
|
3478
|
+
if (id === void 0 || !Number.isInteger(id) || !(id >= 1 && id <= 48 || id >= 101 && id <= 148))
|
|
3479
|
+
return {};
|
|
3480
|
+
const legacy = id > 100 ? id - 100 : id;
|
|
3481
|
+
const common = {
|
|
3482
|
+
sourceXml: "",
|
|
3483
|
+
fontSize: 10,
|
|
3484
|
+
bold: false,
|
|
3485
|
+
italic: false,
|
|
3486
|
+
fontRef: {
|
|
3487
|
+
index: "minor",
|
|
3488
|
+
color: { kind: "scheme", value: legacy >= 41 ? "lt1" : "tx1", transforms: [] }
|
|
3489
|
+
}
|
|
3490
|
+
};
|
|
3491
|
+
return {
|
|
3492
|
+
title: { ...common, fontSize: id > 100 ? 18 : 10, bold: true },
|
|
3493
|
+
categoryAxis: { ...common },
|
|
3494
|
+
valueAxis: { ...common },
|
|
3495
|
+
legend: { ...common }
|
|
3496
|
+
};
|
|
3497
|
+
}
|
|
3498
|
+
|
|
3499
|
+
// chart/manual-layout.ts
|
|
3500
|
+
function hasManualLayoutFields(layout) {
|
|
3501
|
+
return layout != null && (layout.x !== void 0 || layout.y !== void 0 || layout.width !== void 0 || layout.height !== void 0);
|
|
3502
|
+
}
|
|
3503
|
+
function resolveManualLayoutRect(layout, frame, auto) {
|
|
3504
|
+
if (!hasManualLayoutFields(layout)) return void 0;
|
|
3505
|
+
const x = layout.x === void 0 ? auto.x : layout.xMode === "edge" ? layout.x * frame.width : auto.x + layout.x * frame.width;
|
|
3506
|
+
const y = layout.y === void 0 ? auto.y : layout.yMode === "edge" ? layout.y * frame.height : auto.y + layout.y * frame.height;
|
|
3507
|
+
const width = layout.width === void 0 ? auto.width : layout.widthMode === "edge" ? layout.width * frame.width - x : layout.width * frame.width;
|
|
3508
|
+
const height = layout.height === void 0 ? auto.height : layout.heightMode === "edge" ? layout.height * frame.height - y : layout.height * frame.height;
|
|
3509
|
+
return { x, y, width: Math.max(width, 1), height: Math.max(height, 1) };
|
|
3510
|
+
}
|
|
3511
|
+
|
|
3512
|
+
// chart/gradient-stop-edit.ts
|
|
3513
|
+
function sortGradientStops(stops) {
|
|
3514
|
+
return stops.slice().sort((a, b) => a.position - b.position);
|
|
3515
|
+
}
|
|
3516
|
+
|
|
3517
|
+
// chart/gradient-coincident-stops.ts
|
|
3518
|
+
var NATIVE_COINCIDENT_STOP_RAMP = 1 / 256;
|
|
3519
|
+
function spreadCoincidentStops(stops) {
|
|
3520
|
+
const out = [];
|
|
3521
|
+
for (const [index, stop] of stops.entries()) {
|
|
3522
|
+
const source = stops[index - 1];
|
|
3523
|
+
const previous = out.at(-1);
|
|
3524
|
+
const next = stops[index + 1];
|
|
3525
|
+
if (!source || !previous || stop.offset !== source.offset || stop.color === source.color && (stop.opacity ?? 1) === (source.opacity ?? 1)) {
|
|
3526
|
+
out.push(stop);
|
|
3527
|
+
continue;
|
|
3528
|
+
}
|
|
3529
|
+
const limit = Math.min(1, next ? next.offset : 1);
|
|
3530
|
+
out.push({
|
|
3531
|
+
...stop,
|
|
3532
|
+
offset: Math.max(stop.offset, Math.min(previous.offset + NATIVE_COINCIDENT_STOP_RAMP, limit))
|
|
3533
|
+
});
|
|
3534
|
+
}
|
|
3535
|
+
return out;
|
|
3536
|
+
}
|
|
3537
|
+
|
|
3538
|
+
// chart/gradient-definition.ts
|
|
3539
|
+
function resolveChartGradient(fill, resolve) {
|
|
3540
|
+
const focus = fill.fillToRect;
|
|
3541
|
+
const stops = fill.stops.flatMap((stop) => {
|
|
3542
|
+
const color = resolve(stop.color);
|
|
3543
|
+
return color ? [{ position: stop.position, color: color.hex, opacity: color.alpha }] : [];
|
|
3544
|
+
});
|
|
3545
|
+
return {
|
|
3546
|
+
type: fill.path ? "radial" : "linear",
|
|
3547
|
+
stops,
|
|
3548
|
+
...fill.angle === void 0 ? {} : { angle: fill.angle },
|
|
3549
|
+
...fill.scaled === void 0 ? {} : { scaled: fill.scaled },
|
|
3550
|
+
...fill.path === void 0 ? {} : { path: fill.path },
|
|
3551
|
+
...focus === void 0 ? {} : { fillToRect: { ...focus } },
|
|
3552
|
+
// Native opaque endpoint-pair linear, rect, circle and rectangular-shape profiles.
|
|
3553
|
+
...(!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" } : {},
|
|
3554
|
+
...focus ? { focalPoint: { x: (1 + focus.l - focus.r) / 2, y: (1 + focus.t - focus.b) / 2 } } : {}
|
|
3555
|
+
};
|
|
3556
|
+
}
|
|
3557
|
+
function buildChartGradientDef(id, fill, bounds) {
|
|
3558
|
+
const sourceStops = sortGradientStops(fill.stops).map((stop) => ({
|
|
3559
|
+
offset: Math.min(Math.max(stop.position / 100, 0), 1),
|
|
3560
|
+
color: stop.color,
|
|
3561
|
+
...stop.opacity !== void 0 ? { opacity: stop.opacity } : {}
|
|
3562
|
+
}));
|
|
3563
|
+
const stops = fill.interpolation === "sigma-gamma22" ? sigmaGradientStops(sourceStops) ?? sourceStops : sourceStops;
|
|
3564
|
+
if (fill.type === "radial" && (fill.path === "rect" || fill.path === "shape" && bounds?.shape === "rect")) {
|
|
3565
|
+
const markup = buildRectPathGradientSvg(
|
|
3566
|
+
stops.map((stop) => ({
|
|
3567
|
+
position: stop.offset * 100,
|
|
3568
|
+
color: stop.color,
|
|
3569
|
+
...stop.opacity === void 0 ? {} : { opacity: stop.opacity }
|
|
3570
|
+
})),
|
|
3571
|
+
void 0,
|
|
3572
|
+
fill.fillToRect,
|
|
3573
|
+
{ bands: 1024}
|
|
3574
|
+
);
|
|
3575
|
+
return {
|
|
3576
|
+
kind: "rectPath",
|
|
3577
|
+
id,
|
|
3578
|
+
href: `data:image/svg+xml,${encodeURIComponent(markup)}`,
|
|
3579
|
+
stops
|
|
3580
|
+
};
|
|
3581
|
+
}
|
|
3582
|
+
if (fill.type === "radial") {
|
|
3583
|
+
const cx = fill.focalPoint?.x ?? 0.5;
|
|
3584
|
+
const cy = fill.focalPoint?.y ?? 0.5;
|
|
3585
|
+
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;
|
|
3586
|
+
return {
|
|
3587
|
+
kind: "radialGradient",
|
|
3588
|
+
id,
|
|
3589
|
+
cx,
|
|
3590
|
+
cy,
|
|
3591
|
+
r: Math.max(
|
|
3592
|
+
...[0, 1].flatMap((x) => [0, 1].map((y) => Math.hypot(x - cx, (y - cy) * aspect)))
|
|
3593
|
+
),
|
|
3594
|
+
...aspect === 1 ? {} : { gradientTransform: `matrix(1 0 0 ${1 / aspect} 0 ${cy * (1 - 1 / aspect)})` },
|
|
3595
|
+
stops
|
|
3596
|
+
};
|
|
3597
|
+
}
|
|
3598
|
+
const rad = (fill.angle ?? 0) * Math.PI / 180;
|
|
3599
|
+
const span = fill.scaled ? Math.abs(Math.cos(rad)) + Math.abs(Math.sin(rad)) : 1;
|
|
3600
|
+
const dx = Math.cos(rad) * span / 2;
|
|
3601
|
+
const dy = Math.sin(rad) * span / 2;
|
|
3602
|
+
const round = (value) => Math.round(value * 1e4) / 1e4;
|
|
3603
|
+
return {
|
|
3604
|
+
kind: "linearGradient",
|
|
3605
|
+
id,
|
|
3606
|
+
x1: round(0.5 - dx),
|
|
3607
|
+
y1: round(0.5 - dy),
|
|
3608
|
+
x2: round(0.5 + dx),
|
|
3609
|
+
y2: round(0.5 + dy),
|
|
3610
|
+
stops: spreadCoincidentStops(stops)
|
|
3611
|
+
};
|
|
3612
|
+
}
|
|
3613
|
+
|
|
3614
|
+
// chart/gradient-markup.ts
|
|
3615
|
+
function chartGradientMarkup(def) {
|
|
3616
|
+
if (def.kind === "rectPath")
|
|
3617
|
+
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>`;
|
|
3618
|
+
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}"`;
|
|
3619
|
+
const stops = def.stops.map(
|
|
3620
|
+
(stop) => `<stop offset="${stop.offset}" stop-color="${escapeXmlAttr(stop.color)}" stop-opacity="${stop.opacity ?? 1}"/>`
|
|
3621
|
+
).join("");
|
|
3622
|
+
const transform = def.kind === "radialGradient" && def.gradientTransform ? ` gradientTransform="${escapeXmlAttr(def.gradientTransform)}"` : "";
|
|
3623
|
+
return `<${def.kind} id="${escapeXmlAttr(def.id)}" ${geometry}${transform}>${stops}</${def.kind}>`;
|
|
3624
|
+
}
|
|
3625
|
+
|
|
3626
|
+
// chart/bar-cluster-geometry.ts
|
|
3627
|
+
var DEFAULT_BAR_GAP_WIDTH = 150;
|
|
3628
|
+
function clusteredBarGeometry(barGroupWidth, seriesCount, chartData) {
|
|
3629
|
+
const overlap = chartData.barOverlap ?? 0;
|
|
3630
|
+
const overlapSpan = 1 + (seriesCount - 1) * (1 - overlap / 100);
|
|
3631
|
+
const gapWidth = chartData.barGapWidth ?? DEFAULT_BAR_GAP_WIDTH;
|
|
3632
|
+
const singleBarWidth = barGroupWidth / (overlapSpan + Math.max(gapWidth, 0) / 100);
|
|
3633
|
+
const step = singleBarWidth * (1 - overlap / 100);
|
|
3634
|
+
return { singleBarWidth, step, clusterWidth: singleBarWidth + step * (seriesCount - 1) };
|
|
3635
|
+
}
|
|
3636
|
+
|
|
3637
|
+
// chart/data-cache.ts
|
|
3638
|
+
function chartCacheValues(cache) {
|
|
3639
|
+
if (!cache) return [];
|
|
3640
|
+
const numeric = cache.type === "number";
|
|
3641
|
+
const out = [];
|
|
3642
|
+
for (const point of cache.points) {
|
|
3643
|
+
const text2 = point.value;
|
|
3644
|
+
out[point.index ?? out.length] = numeric && text2.trim() !== "" && Number.isFinite(Number(text2)) ? Number(text2) : text2;
|
|
3645
|
+
}
|
|
3646
|
+
const size = Math.max(cache.pointCount ?? 0, out.length);
|
|
3647
|
+
for (let index = 0; index < size; index++) if (out[index] === void 0) out[index] = "";
|
|
3648
|
+
return out;
|
|
3649
|
+
}
|
|
3650
|
+
var chartSourceValues = (source) => chartCacheValues(source?.cache ?? source?.levels?.[0]);
|
|
3651
|
+
|
|
3652
|
+
// chart/render/summary-from-space.ts
|
|
3653
|
+
var solidColor = (fill) => fill?.kind === "solid" ? fill.color : void 0;
|
|
3654
|
+
var isSolidFill = (fill) => fill?.kind === "solid" || fill?.kind === "unsupported" && fill.element === "solidFill";
|
|
3655
|
+
var GROUP_TYPES = {
|
|
3656
|
+
bar: "bar",
|
|
3657
|
+
line: "line",
|
|
3658
|
+
area: "area",
|
|
3659
|
+
pie: "pie",
|
|
3660
|
+
ofPie: "pie",
|
|
3661
|
+
doughnut: "doughnut",
|
|
3662
|
+
scatter: "scatter",
|
|
3663
|
+
radar: "radar",
|
|
3664
|
+
bubble: "bubble",
|
|
3665
|
+
stock: "stock",
|
|
3666
|
+
surface: "surface"
|
|
3667
|
+
};
|
|
3668
|
+
var GROUPINGS = /* @__PURE__ */ new Set(["clustered", "stacked", "percentStacked", "standard"]);
|
|
3669
|
+
function chartSummarySeries(source, chartType) {
|
|
3670
|
+
const categories = source.categories ?? source.xValues;
|
|
3671
|
+
const values = source.values ?? source.yValues;
|
|
3672
|
+
const out = {
|
|
3673
|
+
categories: chartSourceValues(categories),
|
|
3674
|
+
values: chartSourceValues(values).map(
|
|
3675
|
+
(v) => typeof v === "number" ? v : v === "" ? null : Number.isFinite(Number(v)) ? Number(v) : null
|
|
3676
|
+
)
|
|
3677
|
+
};
|
|
3678
|
+
if (source.tx?.text !== void 0) out.name = source.tx.text;
|
|
3679
|
+
const nameRef = source.tx?.reference?.formula;
|
|
3680
|
+
if (nameRef) out.nameRef = nameRef;
|
|
3681
|
+
if (categories?.formula) out.categoriesRef = categories.formula;
|
|
3682
|
+
if (values?.formula) out.valuesRef = values.formula;
|
|
3683
|
+
if (source.spPr?.effectsXml) out.effectsXml = source.spPr.effectsXml;
|
|
3684
|
+
const primary = ["line", "scatter", "radar"].includes(chartType) ? source.spPr?.line?.fill : source.spPr?.fill;
|
|
3685
|
+
const fill = chartType === "scatter" && !isSolidFill(primary) ? source.marker?.spPr?.fill : primary;
|
|
3686
|
+
const drawingColor = solidColor(fill);
|
|
3687
|
+
if (drawingColor) out.drawingColor = drawingColor;
|
|
3688
|
+
if (fill && fill.kind !== "solid" && !(chartType === "scatter" && fill.kind === "none"))
|
|
3689
|
+
out.fill = fill;
|
|
3690
|
+
const points = {};
|
|
3691
|
+
const pointFills = {};
|
|
3692
|
+
for (const point of source.dataPoints) {
|
|
3693
|
+
const properties4 = point.spPr ?? point.marker?.spPr;
|
|
3694
|
+
if (point.index === void 0) continue;
|
|
3695
|
+
const pointColor = solidColor(properties4?.fill);
|
|
3696
|
+
if (pointColor) points[point.index] = pointColor;
|
|
3697
|
+
if (properties4?.fill && properties4.fill.kind !== "solid")
|
|
3698
|
+
pointFills[point.index] = properties4.fill;
|
|
3699
|
+
}
|
|
3700
|
+
if (Object.keys(points).length) out.pointColors = points;
|
|
3701
|
+
if (Object.keys(pointFills).length) out.pointFills = pointFills;
|
|
3702
|
+
return out;
|
|
3703
|
+
}
|
|
3704
|
+
function chartSummaryFromSpace(chartSpace, extras = {}) {
|
|
3705
|
+
const group = chartSpace.plotArea.groups[0];
|
|
3706
|
+
let chartType = group ? GROUP_TYPES[group.kind] : "column";
|
|
3707
|
+
if (chartType === "bar" && group?.barDirection !== "bar") chartType = "column";
|
|
3708
|
+
const series = (group?.series ?? []).map((source) => chartSummarySeries(source, chartType));
|
|
3709
|
+
const summary = {
|
|
3710
|
+
chartType,
|
|
3711
|
+
series,
|
|
3712
|
+
showLegend: chartSpace.legend !== void 0
|
|
3713
|
+
};
|
|
3714
|
+
const grouping = group?.grouping;
|
|
3715
|
+
if (grouping && GROUPINGS.has(grouping))
|
|
3716
|
+
summary.grouping = grouping;
|
|
3717
|
+
if (chartType === "bar" || chartType === "column") {
|
|
3718
|
+
for (const [value, field, fallback, min, max] of [
|
|
3719
|
+
[group?.gapWidth, "barGapWidth", 150, 0, 500],
|
|
3720
|
+
[group?.overlap, "barOverlap", 0, -100, 100]
|
|
3721
|
+
]) {
|
|
3722
|
+
const resolved = value ?? fallback;
|
|
3723
|
+
if (Number.isInteger(resolved) && resolved >= min && resolved <= max)
|
|
3724
|
+
summary[field] = resolved;
|
|
3725
|
+
}
|
|
3726
|
+
}
|
|
3727
|
+
if (chartSpace.title && chartSpace.autoTitleDeleted !== true) {
|
|
3728
|
+
const title = chartSpace.title.text;
|
|
3729
|
+
if (title !== void 0) summary.title = title;
|
|
3730
|
+
else if (series.length === 1 && series[0]?.name) summary.title = series[0].name;
|
|
3731
|
+
}
|
|
3732
|
+
const legendPos = chartSpace.legend?.position;
|
|
3733
|
+
if (legendPos && ["r", "l", "t", "b", "tr"].includes(legendPos))
|
|
3734
|
+
summary.legendPosition = legendPos;
|
|
3735
|
+
if (extras.formatting) summary.formatting = extras.formatting;
|
|
3736
|
+
if (extras.colorPalette !== void 0) summary.colorPalette = extras.colorPalette;
|
|
3737
|
+
if (extras.styleDefinition) summary.styleDefinition = extras.styleDefinition;
|
|
3738
|
+
return summary;
|
|
3739
|
+
}
|
|
3740
|
+
|
|
3741
|
+
// chart/render/chart-scale.ts
|
|
3742
|
+
var clean = (n2) => Number(n2.toPrecision(12));
|
|
3743
|
+
function* units(raw) {
|
|
3744
|
+
let exp = Math.floor(Math.log10(raw)) - 1;
|
|
3745
|
+
for (; ; ) {
|
|
3746
|
+
const base = 10 ** exp;
|
|
3747
|
+
for (const m of [1, 2, 5]) yield clean(m * base);
|
|
3748
|
+
exp++;
|
|
3749
|
+
}
|
|
3750
|
+
}
|
|
3751
|
+
function niceScale(dataMin, dataMax, options = {}) {
|
|
3752
|
+
const maxIntervals = Math.max(1, options.maxIntervals ?? 10);
|
|
3753
|
+
let lo = Number.isFinite(dataMin) ? dataMin : 0;
|
|
3754
|
+
let hi = Number.isFinite(dataMax) ? dataMax : 0;
|
|
3755
|
+
if (lo > hi) [lo, hi] = [hi, lo];
|
|
3756
|
+
if (lo === hi) {
|
|
3757
|
+
if (lo === 0) hi = 1;
|
|
3758
|
+
else if (options.noZero) {
|
|
3759
|
+
const pad = Math.abs(lo) * 0.1 || 1;
|
|
3760
|
+
lo -= pad;
|
|
3761
|
+
hi += pad;
|
|
3762
|
+
} else if (lo > 0) lo = 0;
|
|
3763
|
+
else hi = 0;
|
|
3764
|
+
}
|
|
3765
|
+
let fixedLo = false;
|
|
3766
|
+
let fixedHi = false;
|
|
3767
|
+
if (!options.noZero) {
|
|
3768
|
+
if (lo >= 0 && hi - lo >= hi / 6) {
|
|
3769
|
+
lo = 0;
|
|
3770
|
+
fixedLo = true;
|
|
3771
|
+
} else if (hi <= 0 && hi - lo >= -lo / 6) {
|
|
3772
|
+
hi = 0;
|
|
3773
|
+
fixedHi = true;
|
|
3774
|
+
}
|
|
3775
|
+
}
|
|
3776
|
+
const range = hi - lo;
|
|
3777
|
+
const top = fixedHi ? hi : hi + range * 0.05;
|
|
3778
|
+
const bottom = fixedLo ? lo : lo - range * 0.05;
|
|
3779
|
+
for (const unit of units(range / maxIntervals)) {
|
|
3780
|
+
const min = fixedLo ? lo : Math.floor(clean(bottom / unit)) * unit;
|
|
3781
|
+
const max = fixedHi ? hi : Math.ceil(clean(top / unit)) * unit;
|
|
3782
|
+
const intervals = Math.round((max - min) / unit);
|
|
3783
|
+
if (intervals <= maxIntervals && intervals > 0) {
|
|
3784
|
+
const ticks = [];
|
|
3785
|
+
for (let i = 0; i <= intervals; i++) ticks.push(clean(min + i * unit));
|
|
3786
|
+
return { min: clean(min), max: clean(max), majorUnit: unit, ticks };
|
|
3787
|
+
}
|
|
3788
|
+
}
|
|
3789
|
+
return { min: lo, max: hi, majorUnit: range, ticks: [lo, hi] };
|
|
3790
|
+
}
|
|
3791
|
+
var PERCENT_SCALE = {
|
|
3792
|
+
min: 0,
|
|
3793
|
+
max: 1,
|
|
3794
|
+
majorUnit: 0.1,
|
|
3795
|
+
ticks: [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]
|
|
3796
|
+
};
|
|
3797
|
+
function formatAxisValue(value, percent = false) {
|
|
3798
|
+
if (percent) return `${clean(value * 100)}%`;
|
|
3799
|
+
const v = clean(value);
|
|
3800
|
+
if (Math.abs(v) >= 1e15 || v !== 0 && Math.abs(v) < 1e-6)
|
|
3801
|
+
return v.toExponential(2).replace("e+", "E+").replace("e-", "E-");
|
|
3802
|
+
const [int = "0", frac] = String(Math.abs(v)).split(".");
|
|
3803
|
+
const grouped = int.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
3804
|
+
return `${v < 0 ? "-" : ""}${grouped}${frac ? `.${frac}` : ""}`;
|
|
3805
|
+
}
|
|
3806
|
+
|
|
3807
|
+
// chart/render/chart-svg-util.ts
|
|
3808
|
+
var TEXT_COLOR = "#595959";
|
|
3809
|
+
var GRID_COLOR = "#D9D9D9";
|
|
3810
|
+
var AXIS_COLOR = "#BFBFBF";
|
|
3811
|
+
var FONT_SIZE = 10;
|
|
3812
|
+
function esc(text2) {
|
|
3813
|
+
return text2.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
3814
|
+
}
|
|
3815
|
+
var n = (value) => String(Math.round(value * 100) / 100);
|
|
3816
|
+
var textWidth = (text2, size = FONT_SIZE) => text2.length * size * 0.55;
|
|
3817
|
+
function text(x, y, content, attrs = {}) {
|
|
3818
|
+
const parts = [`x="${n(x)}"`, `y="${n(y)}"`];
|
|
3819
|
+
parts.push(`font-size="${attrs.size ?? FONT_SIZE}"`);
|
|
3820
|
+
parts.push(`fill="${esc(attrs.fill ?? TEXT_COLOR)}"`);
|
|
3821
|
+
if (attrs.anchor && attrs.anchor !== "start") parts.push(`text-anchor="${attrs.anchor}"`);
|
|
3822
|
+
if (attrs.weight) parts.push(`font-weight="${attrs.weight}"`);
|
|
3823
|
+
if (attrs.baseline) parts.push(`dominant-baseline="${attrs.baseline}"`);
|
|
3824
|
+
if (attrs.family) parts.push(`font-family="${esc(attrs.family)}"`);
|
|
3825
|
+
if (attrs.filter) parts.push(`filter="${esc(attrs.filter)}"`);
|
|
3826
|
+
if (attrs.italic !== void 0) parts.push(`font-style="${attrs.italic ? "italic" : "normal"}"`);
|
|
3827
|
+
if (attrs.underline !== void 0)
|
|
3828
|
+
parts.push(`text-decoration="${attrs.underline ? "underline" : "none"}"`);
|
|
3829
|
+
return `<text ${parts.join(" ")}>${esc(content)}</text>`;
|
|
3830
|
+
}
|
|
3831
|
+
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}"/>`;
|
|
3832
|
+
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)}"` : ""}/>`;
|
|
3833
|
+
function fit(content, maxWidth, size = FONT_SIZE) {
|
|
3834
|
+
if (textWidth(content, size) <= maxWidth) return content;
|
|
3835
|
+
const chars = Math.max(1, Math.floor(maxWidth / (size * 0.55)) - 1);
|
|
3836
|
+
return `${content.slice(0, chars)}\u2026`;
|
|
3837
|
+
}
|
|
3838
|
+
|
|
3839
|
+
// chart/render/theme-palette.ts
|
|
3840
|
+
var THEME_SLOTS = [
|
|
3841
|
+
"lt1",
|
|
3842
|
+
"dk1",
|
|
3843
|
+
"lt2",
|
|
3844
|
+
"dk2",
|
|
3845
|
+
"accent1",
|
|
3846
|
+
"accent2",
|
|
3847
|
+
"accent3",
|
|
3848
|
+
"accent4",
|
|
3849
|
+
"accent5",
|
|
3850
|
+
"accent6",
|
|
3851
|
+
"hlink",
|
|
3852
|
+
"folHlink"
|
|
3853
|
+
];
|
|
3854
|
+
var DEFAULT_THEME_COLORS = [
|
|
3855
|
+
"FFFFFF",
|
|
3856
|
+
"000000",
|
|
3857
|
+
"E7E6E6",
|
|
3858
|
+
"44546A",
|
|
3859
|
+
"4472C4",
|
|
3860
|
+
"ED7D31",
|
|
3861
|
+
"A5A5A5",
|
|
3862
|
+
"FFC000",
|
|
3863
|
+
"5B9BD5",
|
|
3864
|
+
"70AD47",
|
|
3865
|
+
"0563C1",
|
|
3866
|
+
"954F72"
|
|
3867
|
+
];
|
|
3868
|
+
function themeColor(theme, index) {
|
|
3869
|
+
const hex = theme.colors[index] ?? DEFAULT_THEME_COLORS[index];
|
|
3870
|
+
return hex && parseArgbHex(hex) ? hex.replace(/^#/, "") : void 0;
|
|
3871
|
+
}
|
|
3872
|
+
|
|
3873
|
+
// chart/render/chart-colors.ts
|
|
3874
|
+
function chartColorScheme(theme) {
|
|
3875
|
+
const slots = Object.fromEntries(
|
|
3876
|
+
THEME_SLOTS.map((slot, index) => [slot, `#${themeColor(theme, index) ?? "000000"}`])
|
|
3877
|
+
);
|
|
3878
|
+
return {
|
|
3879
|
+
...slots,
|
|
3880
|
+
bg1: slots.lt1,
|
|
3881
|
+
tx1: slots.dk1,
|
|
3882
|
+
bg2: slots.lt2,
|
|
3883
|
+
tx2: slots.dk2
|
|
3884
|
+
};
|
|
3885
|
+
}
|
|
3886
|
+
function autoSeriesColor(theme, index) {
|
|
3887
|
+
const i = Math.max(0, Math.floor(index));
|
|
3888
|
+
return chartPaletteSeriesColor(findChartColorPalette(10), i, i + 1, chartColorScheme(theme));
|
|
3889
|
+
}
|
|
3890
|
+
|
|
3891
|
+
// chart/render/chart-value-axis.ts
|
|
3892
|
+
function valueAxis(model) {
|
|
3893
|
+
const stackable = model.type === "bar" || model.type === "column" || model.type === "line" || model.type === "area";
|
|
3894
|
+
if (stackable && model.grouping === "percentStacked")
|
|
3895
|
+
return { ...PERCENT_SCALE, ticks: [...PERCENT_SCALE.ticks], percent: true };
|
|
3896
|
+
let min = Infinity;
|
|
3897
|
+
let max = -Infinity;
|
|
3898
|
+
if (stackable && model.grouping === "stacked") {
|
|
3899
|
+
for (let i = 0; i < model.categories.length; i++) {
|
|
3900
|
+
let pos = 0;
|
|
3901
|
+
let neg = 0;
|
|
3902
|
+
for (const s of model.series) {
|
|
3903
|
+
const v = s.values[i] ?? 0;
|
|
3904
|
+
if (v >= 0) pos += v;
|
|
3905
|
+
else neg += v;
|
|
3906
|
+
}
|
|
3907
|
+
min = Math.min(min, neg);
|
|
3908
|
+
max = Math.max(max, pos);
|
|
3909
|
+
}
|
|
3910
|
+
} else {
|
|
3911
|
+
for (const s of model.series)
|
|
3912
|
+
for (const v of s.values)
|
|
3913
|
+
if (v !== null) {
|
|
3914
|
+
min = Math.min(min, v);
|
|
3915
|
+
max = Math.max(max, v);
|
|
3916
|
+
}
|
|
3917
|
+
}
|
|
3918
|
+
if (min === Infinity) {
|
|
3919
|
+
min = 0;
|
|
3920
|
+
max = 1;
|
|
3921
|
+
}
|
|
3922
|
+
return { ...niceScale(min, max), percent: false };
|
|
3923
|
+
}
|
|
3924
|
+
function categoryTotals(model) {
|
|
3925
|
+
return model.categories.map(
|
|
3926
|
+
(_, i) => model.series.reduce((sum, s) => sum + Math.abs(s.values[i] ?? 0), 0)
|
|
3927
|
+
);
|
|
3928
|
+
}
|
|
3929
|
+
|
|
3930
|
+
// chart/text-inheritance.ts
|
|
3931
|
+
var TEXT_KEYS = [
|
|
3932
|
+
"fontSize",
|
|
3933
|
+
"bold",
|
|
3934
|
+
"italic",
|
|
3935
|
+
"underline",
|
|
3936
|
+
"typeface",
|
|
3937
|
+
"textColor",
|
|
3938
|
+
"fontRef"
|
|
3939
|
+
];
|
|
3940
|
+
var TEXT_PARTS = [
|
|
3941
|
+
"title",
|
|
3942
|
+
"axisTitle",
|
|
3943
|
+
"categoryAxis",
|
|
3944
|
+
"valueAxis",
|
|
3945
|
+
"legend",
|
|
3946
|
+
"dataLabel"
|
|
3947
|
+
];
|
|
3948
|
+
function inheritChartText(part, entry, builtIn, root) {
|
|
3949
|
+
if (!root || !TEXT_PARTS.includes(part)) return entry;
|
|
3950
|
+
const out = { ...entry };
|
|
3951
|
+
for (const key of TEXT_KEYS) {
|
|
3952
|
+
delete out[key];
|
|
3953
|
+
const value = root[key] ?? builtIn?.[key];
|
|
3954
|
+
if (value !== void 0) Object.assign(out, { [key]: value });
|
|
3955
|
+
}
|
|
3956
|
+
if (part === "title" && root.fontSize !== void 0) out.fontSize = root.fontSize * 1.2;
|
|
3957
|
+
if (root.textEffectsXml !== void 0) out.textEffectsXml = root.textEffectsXml;
|
|
3958
|
+
return out;
|
|
3959
|
+
}
|
|
3960
|
+
|
|
3961
|
+
// chart/render/chart-appearance.ts
|
|
3962
|
+
var chartPointsToPixels = (points) => points * EMU_PER_POINT / EMU_PER_PIXEL;
|
|
3963
|
+
function typeface(entry, theme) {
|
|
3964
|
+
const name = entry.typeface;
|
|
3965
|
+
if (name?.startsWith("+mj-")) return theme.majorFont;
|
|
3966
|
+
if (name?.startsWith("+mn-")) return theme.minorFont;
|
|
3967
|
+
return name ?? (entry.fontRef?.index === "major" ? theme.majorFont : entry.fontRef?.index === "minor" ? theme.minorFont : void 0);
|
|
3968
|
+
}
|
|
3969
|
+
function chartAppearance(chart, theme) {
|
|
3970
|
+
const defaults = builtInChartTextStyle(effectiveBuiltInChartStyle(chart.formatting));
|
|
3971
|
+
const entries = {};
|
|
3972
|
+
for (const part of CHART_STYLE_PARTS) {
|
|
3973
|
+
const base = chart.styleDefinition?.entries[part];
|
|
3974
|
+
const direct = chart.formatting?.entries[part];
|
|
3975
|
+
if (!defaults[part] && !base && !direct) continue;
|
|
3976
|
+
const entry = {
|
|
3977
|
+
...inheritChartText(
|
|
3978
|
+
part,
|
|
3979
|
+
{ ...defaults[part], ...base, sourceXml: base?.sourceXml ?? "" },
|
|
3980
|
+
defaults[part],
|
|
3981
|
+
chart.formatting?.textDefaults
|
|
3982
|
+
),
|
|
3983
|
+
...direct,
|
|
3984
|
+
sourceXml: direct?.sourceXml ?? base?.sourceXml ?? ""
|
|
3985
|
+
};
|
|
3986
|
+
if (base?.line || direct?.line) entry.line = { ...base?.line, ...direct?.line };
|
|
3987
|
+
entries[part] = entry;
|
|
3988
|
+
}
|
|
3989
|
+
const scheme = chartColorScheme(theme);
|
|
3990
|
+
const resolve = (color) => resolveDrawingColor(
|
|
3991
|
+
color,
|
|
3992
|
+
{ scheme: (name) => scheme[name] },
|
|
3993
|
+
{ hslRounding: "halfDown", transformOrder: "document" }
|
|
3994
|
+
);
|
|
3995
|
+
const out = resolveChartStyleDefinition(
|
|
3996
|
+
{ entries},
|
|
3997
|
+
(color) => drawingColorCss(resolve(color))
|
|
3998
|
+
) ?? {};
|
|
3999
|
+
for (const part of CHART_STYLE_PARTS) {
|
|
4000
|
+
const entry = entries[part];
|
|
4001
|
+
if (!entry) continue;
|
|
4002
|
+
const family = typeface(entry, theme);
|
|
4003
|
+
const shadow = resolveDrawingShadowXml(entry.textEffectsXml, {
|
|
4004
|
+
scheme: (name) => scheme[name]
|
|
4005
|
+
});
|
|
4006
|
+
if (shadow) (out[part] ??= {}).textShadow = shadow;
|
|
4007
|
+
if (family) (out[part] ??= {}).typeface = family;
|
|
4008
|
+
if (entry.axisVisible !== void 0) (out[part] ??= {}).axisVisible = entry.axisVisible;
|
|
4009
|
+
if (entry.labelsVisible !== void 0) (out[part] ??= {}).labelsVisible = entry.labelsVisible;
|
|
4010
|
+
if (entry.line?.widthEmu === 0) (out[part] ??= {}).lineWidth = 0;
|
|
4011
|
+
if (entry.fill?.kind === "gradient") {
|
|
4012
|
+
(out[part] ??= {}).gradient = resolveChartGradient(entry.fill, resolve);
|
|
4013
|
+
}
|
|
4014
|
+
}
|
|
4015
|
+
return out;
|
|
4016
|
+
}
|
|
4017
|
+
|
|
4018
|
+
// chart/render/chart-title-text.ts
|
|
4019
|
+
function properties(run) {
|
|
4020
|
+
return {
|
|
4021
|
+
...run.sizePt === void 0 ? {} : { fontSize: run.sizePt },
|
|
4022
|
+
...run.bold === void 0 ? {} : { bold: run.bold },
|
|
4023
|
+
...run.italic === void 0 ? {} : { italic: run.italic },
|
|
4024
|
+
...run.underline === void 0 ? {} : { underline: run.underline },
|
|
4025
|
+
...run.typeface === void 0 ? {} : { typeface: run.typeface },
|
|
4026
|
+
...run.color === void 0 ? {} : { textColor: run.color }
|
|
4027
|
+
};
|
|
4028
|
+
}
|
|
4029
|
+
function chartTitleText(chart, theme) {
|
|
4030
|
+
const formatting = chart.formatting;
|
|
4031
|
+
const entry = formatting?.entries.title;
|
|
4032
|
+
const body = entry?.textBody;
|
|
4033
|
+
if (!formatting || !body || body.text !== chart.title) return void 0;
|
|
4034
|
+
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)
|
|
4035
|
+
return void 0;
|
|
4036
|
+
return {
|
|
4037
|
+
paragraphs: body.paragraphs.map((paragraph) => ({
|
|
4038
|
+
...paragraph.align ? { align: paragraph.align } : {},
|
|
4039
|
+
...paragraph.lineSpacing ? { lineSpacing: paragraph.lineSpacing } : {},
|
|
4040
|
+
...paragraph.spaceBefore ? { spaceBefore: paragraph.spaceBefore } : {},
|
|
4041
|
+
...paragraph.spaceAfter ? { spaceAfter: paragraph.spaceAfter } : {},
|
|
4042
|
+
runs: paragraph.runs.map((run) => {
|
|
4043
|
+
const direct = {
|
|
4044
|
+
sourceXml: "",
|
|
4045
|
+
...entry.textBodyStyle,
|
|
4046
|
+
...properties(paragraph.defaultProperties ?? {}),
|
|
4047
|
+
...properties(run)
|
|
4048
|
+
};
|
|
4049
|
+
const appearance = chartAppearance(
|
|
4050
|
+
{
|
|
4051
|
+
...chart,
|
|
4052
|
+
formatting: { ...formatting, entries: { ...formatting.entries, title: direct } }
|
|
4053
|
+
},
|
|
4054
|
+
theme
|
|
4055
|
+
)?.title ?? {};
|
|
4056
|
+
return { text: run.text, appearance };
|
|
4057
|
+
})
|
|
4058
|
+
}))
|
|
4059
|
+
};
|
|
4060
|
+
}
|
|
4061
|
+
|
|
4062
|
+
// chart/render/chart-view.ts
|
|
4063
|
+
var isRefError = (value) => typeof value === "object" && value !== null && "error" in value;
|
|
4064
|
+
var SUPPORTED = /* @__PURE__ */ new Set([
|
|
4065
|
+
"bar",
|
|
4066
|
+
"column",
|
|
4067
|
+
"line",
|
|
4068
|
+
"area",
|
|
4069
|
+
"pie",
|
|
4070
|
+
"doughnut",
|
|
4071
|
+
"scatter",
|
|
4072
|
+
"radar"
|
|
4073
|
+
]);
|
|
4074
|
+
function toText(value) {
|
|
4075
|
+
if (value === null) return "";
|
|
4076
|
+
if (typeof value === "boolean") return value ? "TRUE" : "FALSE";
|
|
4077
|
+
if (isRefError(value)) return value.error;
|
|
4078
|
+
return String(value);
|
|
4079
|
+
}
|
|
4080
|
+
var toNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
4081
|
+
function resolveRef(ref, evaluateRef) {
|
|
4082
|
+
if (!ref) return void 0;
|
|
4083
|
+
try {
|
|
4084
|
+
const values = evaluateRef(ref);
|
|
4085
|
+
return values.length ? values : void 0;
|
|
4086
|
+
} catch {
|
|
4087
|
+
return void 0;
|
|
4088
|
+
}
|
|
4089
|
+
}
|
|
4090
|
+
function seriesName(series, index, evaluateRef) {
|
|
4091
|
+
const fromRef = resolveRef(series.nameRef, evaluateRef)?.map(toText).filter((t) => t !== "").join(" ");
|
|
4092
|
+
return fromRef || series.name || `Series${index + 1}`;
|
|
4093
|
+
}
|
|
4094
|
+
function chartSummaryView(chart, theme, options = {}) {
|
|
4095
|
+
const evaluateRef = options.evaluateRef ?? (() => []);
|
|
4096
|
+
const type = chart.chartType;
|
|
4097
|
+
const radial = type === "pie" || type === "doughnut";
|
|
4098
|
+
const palette = chart.colorPalette === void 0 ? void 0 : findChartColorPalette(chart.colorPalette);
|
|
4099
|
+
const scheme = chartColorScheme(theme);
|
|
4100
|
+
const drawingColor = (color) => color && drawingColorCss(
|
|
4101
|
+
resolveDrawingColor(
|
|
4102
|
+
color,
|
|
4103
|
+
{
|
|
4104
|
+
scheme: (name) => scheme[name]
|
|
4105
|
+
},
|
|
4106
|
+
{ transformOrder: "document" }
|
|
4107
|
+
)
|
|
4108
|
+
);
|
|
4109
|
+
const gradient = (fill) => fill?.kind === "gradient" ? resolveChartGradient(
|
|
4110
|
+
fill,
|
|
4111
|
+
(color) => resolveDrawingColor(
|
|
4112
|
+
color,
|
|
4113
|
+
{
|
|
4114
|
+
scheme: (name) => scheme[name]
|
|
4115
|
+
},
|
|
4116
|
+
{ transformOrder: "document" }
|
|
4117
|
+
)
|
|
4118
|
+
) : void 0;
|
|
4119
|
+
const grouping = chart.grouping ?? (type === "bar" || type === "column" ? "clustered" : "standard");
|
|
4120
|
+
let categories = [];
|
|
4121
|
+
const rawCategories = [];
|
|
4122
|
+
const series = chart.series.map((s, i) => {
|
|
4123
|
+
const values = resolveRef(s.valuesRef, evaluateRef)?.map(toNumber) ?? s.values.map(toNumber);
|
|
4124
|
+
const cats = resolveRef(s.categoriesRef, evaluateRef) ?? s.categories;
|
|
4125
|
+
rawCategories.push(cats);
|
|
4126
|
+
const paletteColor = palette && chartPaletteSeriesColor(palette, i, chart.series.length, scheme);
|
|
4127
|
+
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);
|
|
4128
|
+
const view = { name: seriesName(s, i, evaluateRef), values, color };
|
|
4129
|
+
const shadow = resolveDrawingShadowXml(s.effectsXml, {
|
|
4130
|
+
scheme: (name) => scheme[name]
|
|
4131
|
+
});
|
|
4132
|
+
if (shadow) view.shadow = shadow;
|
|
4133
|
+
const resolvedGradient = gradient(s.fill);
|
|
4134
|
+
if (resolvedGradient) view.gradient = resolvedGradient;
|
|
4135
|
+
const points = Object.fromEntries(
|
|
4136
|
+
Object.entries(s.pointFills ?? {}).flatMap(([key, fill]) => {
|
|
4137
|
+
const value = gradient(fill);
|
|
4138
|
+
return value ? [[key, value]] : [];
|
|
4139
|
+
})
|
|
4140
|
+
);
|
|
4141
|
+
if (Object.keys(points).length) view.pointGradients = points;
|
|
4142
|
+
return view;
|
|
4143
|
+
});
|
|
4144
|
+
const longest = Math.max(0, ...series.map((s) => s.values.length));
|
|
4145
|
+
const firstCats = rawCategories.find((c) => c.length > 0) ?? [];
|
|
4146
|
+
categories = Array.from(
|
|
4147
|
+
{ length: Math.max(longest, firstCats.length) },
|
|
4148
|
+
(_, i) => firstCats[i] !== void 0 ? toText(firstCats[i] ?? null) : String(i + 1)
|
|
4149
|
+
);
|
|
4150
|
+
if (radial) {
|
|
4151
|
+
series.forEach((s, seriesIndex) => {
|
|
4152
|
+
s.pointColors = s.values.map((_, i) => {
|
|
4153
|
+
const explicit = drawingColor(chart.series[seriesIndex]?.pointColors?.[i]);
|
|
4154
|
+
return explicit ?? (palette ? chartPaletteSeriesColor(palette, i, s.values.length, scheme) : autoSeriesColor(theme, i));
|
|
4155
|
+
});
|
|
4156
|
+
});
|
|
4157
|
+
} else
|
|
4158
|
+
series.forEach((s, seriesIndex) => {
|
|
4159
|
+
const points = chart.series[seriesIndex]?.pointColors;
|
|
4160
|
+
if (points) s.pointColors = s.values.map((_, i) => drawingColor(points[i]) ?? s.color);
|
|
4161
|
+
});
|
|
4162
|
+
series.forEach((s, index) => {
|
|
4163
|
+
const source = chart.series[index];
|
|
4164
|
+
if (s.gradient && !radial && s.pointColors) {
|
|
4165
|
+
for (let i = 0; i < s.pointColors.length; i++)
|
|
4166
|
+
if (!source.pointColors?.[i]) delete s.pointColors[i];
|
|
4167
|
+
}
|
|
4168
|
+
for (const [key, fill] of Object.entries(source.pointFills ?? {})) {
|
|
4169
|
+
if (fill.kind === "none") (s.pointColors ??= [])[Number(key)] = "none";
|
|
4170
|
+
else if (fill.kind === "solid") {
|
|
4171
|
+
const paint = drawingColor(fill.color);
|
|
4172
|
+
if (paint) (s.pointColors ??= [])[Number(key)] = paint;
|
|
4173
|
+
}
|
|
4174
|
+
}
|
|
4175
|
+
});
|
|
4176
|
+
const model = {
|
|
4177
|
+
...chart.barGapWidth === void 0 ? {} : { barGapWidth: chart.barGapWidth },
|
|
4178
|
+
...chart.barOverlap === void 0 ? {} : { barOverlap: chart.barOverlap },
|
|
4179
|
+
type,
|
|
4180
|
+
grouping,
|
|
4181
|
+
showLegend: chart.showLegend,
|
|
4182
|
+
legendPosition: chart.legendPosition ?? "r",
|
|
4183
|
+
categories,
|
|
4184
|
+
series,
|
|
4185
|
+
horizontal: type === "bar",
|
|
4186
|
+
supported: SUPPORTED.has(type)
|
|
4187
|
+
};
|
|
4188
|
+
if (chart.title) model.title = chart.title;
|
|
4189
|
+
const titleFormatting = chart.formatting?.entries.title;
|
|
4190
|
+
if (titleFormatting?.layout) model.titleLayout = titleFormatting.layout;
|
|
4191
|
+
if (titleFormatting?.overlay !== void 0) model.titleOverlay = titleFormatting.overlay;
|
|
4192
|
+
const legendFormatting = chart.formatting?.entries.legend;
|
|
4193
|
+
if (legendFormatting?.layout) model.legendLayout = legendFormatting.layout;
|
|
4194
|
+
if (legendFormatting?.overlay !== void 0) model.legendOverlay = legendFormatting.overlay;
|
|
4195
|
+
const titleText = chartTitleText(chart, theme);
|
|
4196
|
+
if (titleText) model.titleText = titleText;
|
|
4197
|
+
const appearance = chartAppearance(chart, theme);
|
|
4198
|
+
if (appearance) model.appearance = appearance;
|
|
4199
|
+
if (type === "scatter") {
|
|
4200
|
+
series.forEach((s, i) => {
|
|
4201
|
+
const cats = rawCategories[i] ?? [];
|
|
4202
|
+
const numeric = cats.length > 0 && cats.every((c) => typeof c === "number");
|
|
4203
|
+
s.xValues = s.values.map((_, k) => numeric ? toNumber(cats[k] ?? null) : k + 1);
|
|
4204
|
+
});
|
|
4205
|
+
const xs = series.flatMap((s) => s.xValues ?? []).filter((x) => x !== null);
|
|
4206
|
+
model.xAxis = xs.length ? niceScale(Math.min(...xs), Math.max(...xs)) : niceScale(0, 1);
|
|
4207
|
+
}
|
|
4208
|
+
if (!radial) model.valueAxis = valueAxis(model);
|
|
4209
|
+
return model;
|
|
4210
|
+
}
|
|
4211
|
+
|
|
4212
|
+
// text/css-font-family.ts
|
|
4213
|
+
var FALLBACKS = {
|
|
4214
|
+
calibri: '"Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
|
|
4215
|
+
"calibri light": '"Calibri Light", "Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
|
|
4216
|
+
cambria: '"Cambria", "Caladea", Georgia, serif',
|
|
4217
|
+
arial: 'Arial, "Liberation Sans", Helvetica, sans-serif',
|
|
4218
|
+
"times new roman": '"Times New Roman", "Liberation Serif", Times, serif',
|
|
4219
|
+
"courier new": '"Courier New", "Liberation Mono", monospace',
|
|
4220
|
+
aptos: '"Aptos", "Calibri", "Carlito", "Segoe UI", sans-serif'
|
|
4221
|
+
};
|
|
4222
|
+
function cssFontFamily(name) {
|
|
4223
|
+
const known = FALLBACKS[name.toLowerCase()];
|
|
4224
|
+
if (known) return known;
|
|
4225
|
+
const quoted = `"${name.replace(/["\\]/g, "")}"`;
|
|
4226
|
+
return `${quoted}, "Calibri", "Carlito", "Segoe UI", sans-serif`;
|
|
4227
|
+
}
|
|
4228
|
+
|
|
4229
|
+
// chart/render/chart-svg-appearance.ts
|
|
4230
|
+
var nextPaintId = 0;
|
|
4231
|
+
function chartGradientPaint(model, width = 1024, height = 768) {
|
|
4232
|
+
const prefix = `xlsx-chart-${++nextPaintId}`;
|
|
4233
|
+
const appearance = { ...model.appearance };
|
|
4234
|
+
const defs = [];
|
|
4235
|
+
const shadowPaint = (shadow, suffix) => {
|
|
4236
|
+
const id = `${prefix}-${suffix}`;
|
|
4237
|
+
const pad = Math.max(4, shadow.blur * 3 + Math.abs(shadow.dx) + Math.abs(shadow.dy));
|
|
4238
|
+
defs.push(
|
|
4239
|
+
`<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>`
|
|
4240
|
+
);
|
|
4241
|
+
return `url(#${id})`;
|
|
4242
|
+
};
|
|
4243
|
+
for (const [part, entry] of Object.entries(appearance)) {
|
|
4244
|
+
if (entry?.textShadow)
|
|
4245
|
+
appearance[part] = {
|
|
4246
|
+
...entry,
|
|
4247
|
+
textShadowFilter: shadowPaint(entry.textShadow, `${part}-text-shadow`)
|
|
4248
|
+
};
|
|
4249
|
+
}
|
|
4250
|
+
const paint = (gradient, suffix, bounds) => {
|
|
4251
|
+
const def = buildChartGradientDef(`${prefix}-${suffix}`, gradient, bounds);
|
|
4252
|
+
defs.push(chartGradientMarkup(def));
|
|
4253
|
+
return `url(#${def.id})`;
|
|
4254
|
+
};
|
|
4255
|
+
for (const part of ["chartArea", "plotArea"]) {
|
|
4256
|
+
const entry = appearance[part];
|
|
4257
|
+
if (!entry?.gradient) continue;
|
|
4258
|
+
if (part === "plotArea" && ["circle", "shape"].includes(entry.gradient.path ?? "")) continue;
|
|
4259
|
+
appearance[part] = {
|
|
4260
|
+
...entry,
|
|
4261
|
+
fillColor: paint(entry.gradient, part, { width, height, shape: "rect" })
|
|
4262
|
+
};
|
|
4263
|
+
}
|
|
4264
|
+
const series = model.series.map((source, index) => {
|
|
4265
|
+
const view = { ...source };
|
|
4266
|
+
if (source.shadow) view.shadowFilter = shadowPaint(source.shadow, `s${index}-shadow`);
|
|
4267
|
+
const bounds = model.type === "bar" || model.type === "column" ? { width: 1, height: 1, shape: "rect" } : void 0;
|
|
4268
|
+
if (source.gradient) view.color = paint(source.gradient, `s${index}`, bounds);
|
|
4269
|
+
if (source.pointGradients) {
|
|
4270
|
+
view.pointColors = [...source.pointColors ?? []];
|
|
4271
|
+
for (const [key, gradient] of Object.entries(source.pointGradients))
|
|
4272
|
+
view.pointColors[Number(key)] = paint(gradient, `s${index}-p${key}`, bounds);
|
|
4273
|
+
}
|
|
4274
|
+
return view;
|
|
4275
|
+
});
|
|
4276
|
+
return defs.length ? { model: { ...model, appearance, series }, defs: `<defs>${defs.join("")}</defs>` } : { model, defs: "" };
|
|
4277
|
+
}
|
|
4278
|
+
function chartTextAttributes(model, part, fallbackSize = FONT_SIZE) {
|
|
4279
|
+
const entry = model.appearance?.[part];
|
|
4280
|
+
return {
|
|
4281
|
+
size: entry?.fontSize === void 0 ? fallbackSize : chartPointsToPixels(entry.fontSize),
|
|
4282
|
+
...entry?.color === void 0 ? {} : { fill: entry.color },
|
|
4283
|
+
...entry?.bold === void 0 ? {} : { weight: entry.bold ? "bold" : "normal" },
|
|
4284
|
+
...entry?.italic === void 0 ? {} : { italic: entry.italic },
|
|
4285
|
+
...entry?.underline === void 0 ? {} : { underline: entry.underline },
|
|
4286
|
+
...entry?.typeface === void 0 ? {} : { family: cssFontFamily(entry.typeface) },
|
|
4287
|
+
...entry?.textShadowFilter === void 0 ? {} : { filter: entry.textShadowFilter }
|
|
4288
|
+
};
|
|
4289
|
+
}
|
|
4290
|
+
function chartStroke(model, part) {
|
|
4291
|
+
const entry = model.appearance?.[part];
|
|
4292
|
+
return {
|
|
4293
|
+
color: entry?.axisVisible === false ? "none" : entry?.lineColor ?? (part === "gridlineMajor" ? GRID_COLOR : AXIS_COLOR),
|
|
4294
|
+
width: entry?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry.lineWidth)
|
|
4295
|
+
};
|
|
4296
|
+
}
|
|
4297
|
+
function chartAreaRect(model, part, area) {
|
|
4298
|
+
if (area.w <= 0 || area.h <= 0) return "";
|
|
4299
|
+
const entry = model.appearance?.[part];
|
|
4300
|
+
let fill = entry?.fillColor ?? (part === "chartArea" ? "#FFFFFF" : "none");
|
|
4301
|
+
let defs = "";
|
|
4302
|
+
if (part !== "chartArea" && entry?.gradient && (part !== "plotArea" || ["circle", "shape"].includes(entry.gradient.path ?? ""))) {
|
|
4303
|
+
const def = buildChartGradientDef(`xlsx-chart-${++nextPaintId}-${part}`, entry.gradient, {
|
|
4304
|
+
width: area.w,
|
|
4305
|
+
height: area.h,
|
|
4306
|
+
shape: "rect"
|
|
4307
|
+
});
|
|
4308
|
+
defs = `<defs>${chartGradientMarkup(def)}</defs>`;
|
|
4309
|
+
fill = `url(#${def.id})`;
|
|
4310
|
+
}
|
|
4311
|
+
const stroke = entry?.lineColor ?? "none";
|
|
4312
|
+
if (fill === "none" && stroke === "none") return "";
|
|
4313
|
+
const width = entry?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry.lineWidth);
|
|
4314
|
+
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}"/>`;
|
|
4315
|
+
}
|
|
4316
|
+
|
|
4317
|
+
// chart/render/chart-spacing.ts
|
|
4318
|
+
function chartBarSpacing(chart) {
|
|
4319
|
+
const stacked = chart.grouping === "stacked" || chart.grouping === "percentStacked";
|
|
4320
|
+
return {
|
|
4321
|
+
barGapWidth: chart.barGapWidth ?? DEFAULT_BAR_GAP_WIDTH,
|
|
4322
|
+
barOverlap: chart.barOverlap ?? (stacked ? 100 : 0)
|
|
4323
|
+
};
|
|
4324
|
+
}
|
|
4325
|
+
|
|
4326
|
+
// chart/render/chart-svg-bars.ts
|
|
4327
|
+
function bars(model, frame, out, values) {
|
|
4328
|
+
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
4329
|
+
const count = Math.max(1, model.series.length);
|
|
4330
|
+
const geometry = clusteredBarGeometry(frame.bandSize, count, chartBarSpacing(model));
|
|
4331
|
+
const barSize = geometry.singleBarWidth;
|
|
4332
|
+
const base = frame.value(0);
|
|
4333
|
+
const pos = new Array(model.categories.length).fill(0);
|
|
4334
|
+
const neg = new Array(model.categories.length).fill(0);
|
|
4335
|
+
model.series.forEach((s, si) => {
|
|
4336
|
+
values[si]?.forEach((v, i) => {
|
|
4337
|
+
if (v === null || i >= model.categories.length) return;
|
|
4338
|
+
let from = 0;
|
|
4339
|
+
let to = v;
|
|
4340
|
+
if (stacked) {
|
|
4341
|
+
const acc = v >= 0 ? pos : neg;
|
|
4342
|
+
from = acc[i] ?? 0;
|
|
4343
|
+
to = from + v;
|
|
4344
|
+
acc[i] = to;
|
|
4345
|
+
}
|
|
4346
|
+
const a = stacked ? frame.value(from) : base;
|
|
4347
|
+
const b = frame.value(to);
|
|
4348
|
+
const offset = model.horizontal ? geometry.clusterWidth / 2 - barSize - si * geometry.step : -geometry.clusterWidth / 2 + si * geometry.step;
|
|
4349
|
+
const center = frame.band(i);
|
|
4350
|
+
const width = model.horizontal ? Math.abs(b - a) : barSize;
|
|
4351
|
+
const height = model.horizontal ? barSize : Math.abs(b - a);
|
|
4352
|
+
let color = s.pointColors?.[i] ?? s.color;
|
|
4353
|
+
const gradient = s.pointGradients?.[i] ?? (s.pointColors?.[i] === void 0 ? s.gradient : void 0);
|
|
4354
|
+
if (gradient && (gradient.path === "circle" || gradient.path === "shape")) {
|
|
4355
|
+
const baseId = color.match(/^url\(#(.+)\)$/)?.[1];
|
|
4356
|
+
if (baseId) {
|
|
4357
|
+
const id = baseId.replace(/(-s\d+(?:-p\d+)?)$/, `-mark${i}$1`);
|
|
4358
|
+
const def = buildChartGradientDef(id, gradient, {
|
|
4359
|
+
width: Number(n(width)),
|
|
4360
|
+
height: Number(n(height)),
|
|
4361
|
+
shape: "rect"
|
|
4362
|
+
});
|
|
4363
|
+
out.push(`<defs>${chartGradientMarkup(def)}</defs>`);
|
|
4364
|
+
color = `url(#${id})`;
|
|
4365
|
+
}
|
|
4366
|
+
}
|
|
4367
|
+
out.push(`<g data-chart-series="${si}" data-chart-point="${i}">`);
|
|
4368
|
+
if (model.horizontal)
|
|
4369
|
+
out.push(
|
|
4370
|
+
rect(Math.min(a, b), center + offset, Math.abs(b - a), barSize, color, s.shadowFilter)
|
|
4371
|
+
);
|
|
4372
|
+
else
|
|
4373
|
+
out.push(
|
|
4374
|
+
rect(center + offset, Math.min(a, b), barSize, Math.abs(b - a), color, s.shadowFilter)
|
|
4375
|
+
);
|
|
4376
|
+
out.push("</g>");
|
|
4377
|
+
});
|
|
4378
|
+
});
|
|
4379
|
+
}
|
|
4380
|
+
|
|
4381
|
+
// chart/render/chart-svg-cartesian.ts
|
|
4382
|
+
function axes(model, area, out) {
|
|
4383
|
+
const scale = model.valueAxis;
|
|
4384
|
+
if (!scale) return void 0;
|
|
4385
|
+
const labels = scale.ticks.map((t) => formatAxisValue(t, scale.percent));
|
|
4386
|
+
const valueAttrs = chartTextAttributes(model, "valueAxis");
|
|
4387
|
+
const categoryAttrs = chartTextAttributes(model, "categoryAxis");
|
|
4388
|
+
const valueSize = valueAttrs.size ?? 10;
|
|
4389
|
+
const categorySize = categoryAttrs.size ?? 10;
|
|
4390
|
+
const grid = chartStroke(model, "gridlineMajor");
|
|
4391
|
+
const axis = chartStroke(model, "categoryAxis");
|
|
4392
|
+
const valueLabels = model.appearance?.valueAxis?.labelsVisible !== false;
|
|
4393
|
+
const categoryLabels = model.appearance?.categoryAxis?.labelsVisible !== false;
|
|
4394
|
+
const labelW = valueLabels ? Math.max(...labels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
|
|
4395
|
+
const horizontal = model.horizontal;
|
|
4396
|
+
const cats = Math.max(1, model.categories.length);
|
|
4397
|
+
const catW = Math.min(
|
|
4398
|
+
area.w * 0.3,
|
|
4399
|
+
Math.max(...model.categories.map((c) => textWidth(c, categorySize)), 8) + 6
|
|
4400
|
+
);
|
|
4401
|
+
const plot = horizontal ? {
|
|
4402
|
+
x: area.x + catW,
|
|
4403
|
+
y: area.y,
|
|
4404
|
+
w: Math.max(1, area.w - catW - 4),
|
|
4405
|
+
h: Math.max(1, area.h - Math.max(16, valueSize * 1.5))
|
|
4406
|
+
} : {
|
|
4407
|
+
x: area.x + labelW,
|
|
4408
|
+
y: area.y + 4,
|
|
4409
|
+
w: Math.max(1, area.w - labelW - 4),
|
|
4410
|
+
h: Math.max(1, area.h - Math.max(20, categorySize * 1.5))
|
|
4411
|
+
};
|
|
4412
|
+
const span = scale.max - scale.min || 1;
|
|
4413
|
+
const value = horizontal ? (v) => plot.x + (v - scale.min) / span * plot.w : (v) => plot.y + plot.h - (v - scale.min) / span * plot.h;
|
|
4414
|
+
const bandSize = (horizontal ? plot.h : plot.w) / cats;
|
|
4415
|
+
const band = horizontal ? (i) => plot.y + plot.h - bandSize * (i + 0.5) : (i) => plot.x + bandSize * (i + 0.5);
|
|
4416
|
+
out.push(chartAreaRect(model, "plotArea", plot));
|
|
4417
|
+
scale.ticks.forEach((t, i) => {
|
|
4418
|
+
const p = value(t);
|
|
4419
|
+
const label = labels[i] ?? "";
|
|
4420
|
+
if (horizontal) {
|
|
4421
|
+
out.push(line(p, plot.y, p, plot.y + plot.h, grid.color, grid.width));
|
|
4422
|
+
if (valueLabels)
|
|
4423
|
+
out.push(
|
|
4424
|
+
text(p, plot.y + plot.h + valueSize + 2, label, { anchor: "middle", ...valueAttrs })
|
|
4425
|
+
);
|
|
4426
|
+
} else {
|
|
4427
|
+
out.push(line(plot.x, p, plot.x + plot.w, p, grid.color, grid.width));
|
|
4428
|
+
if (valueLabels)
|
|
4429
|
+
out.push(text(plot.x - 4, p + valueSize * 0.3, label, { anchor: "end", ...valueAttrs }));
|
|
4430
|
+
}
|
|
4431
|
+
});
|
|
4432
|
+
const zero = value(Math.min(Math.max(0, scale.min), scale.max));
|
|
4433
|
+
if (horizontal) out.push(line(zero, plot.y, zero, plot.y + plot.h, axis.color, axis.width));
|
|
4434
|
+
else out.push(line(plot.x, zero, plot.x + plot.w, zero, axis.color, axis.width));
|
|
4435
|
+
const step = Math.max(
|
|
4436
|
+
1,
|
|
4437
|
+
Math.ceil(cats / Math.max(1, Math.floor((horizontal ? plot.h : plot.w) / 14)))
|
|
4438
|
+
);
|
|
4439
|
+
model.categories.forEach((c, i) => {
|
|
4440
|
+
if (!categoryLabels || i % step !== 0) return;
|
|
4441
|
+
const p = band(i);
|
|
4442
|
+
if (horizontal)
|
|
4443
|
+
out.push(
|
|
4444
|
+
text(plot.x - 4, p + categorySize * 0.3, fit(c, catW - 6, categorySize), {
|
|
4445
|
+
anchor: "end",
|
|
4446
|
+
...categoryAttrs
|
|
4447
|
+
})
|
|
4448
|
+
);
|
|
4449
|
+
else
|
|
4450
|
+
out.push(
|
|
4451
|
+
text(p, plot.y + plot.h + categorySize + 3, fit(c, bandSize * step, categorySize), {
|
|
4452
|
+
anchor: "middle",
|
|
4453
|
+
...categoryAttrs
|
|
4454
|
+
})
|
|
4455
|
+
);
|
|
4456
|
+
});
|
|
4457
|
+
return { plot, value, band, bandSize };
|
|
4458
|
+
}
|
|
4459
|
+
function plotted(model) {
|
|
4460
|
+
if (model.grouping !== "percentStacked") return model.series.map((s) => s.values);
|
|
4461
|
+
const totals = categoryTotals(model);
|
|
4462
|
+
return model.series.map(
|
|
4463
|
+
(s) => s.values.map((v, i) => v === null ? null : v / (totals[i] || 1))
|
|
4464
|
+
);
|
|
4465
|
+
}
|
|
4466
|
+
function linesAndAreas(model, frame, out) {
|
|
4467
|
+
const values = plotted(model);
|
|
4468
|
+
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
4469
|
+
const acc = new Array(model.categories.length).fill(0);
|
|
4470
|
+
const area = model.type === "area";
|
|
4471
|
+
const layers = [];
|
|
4472
|
+
model.series.forEach((s, si) => {
|
|
4473
|
+
const points = [];
|
|
4474
|
+
const lower = [];
|
|
4475
|
+
model.categories.forEach((_, i) => {
|
|
4476
|
+
const v = values[si]?.[i] ?? null;
|
|
4477
|
+
if (v === null && !area) {
|
|
4478
|
+
points.push([NaN, NaN]);
|
|
4479
|
+
return;
|
|
4480
|
+
}
|
|
4481
|
+
const below = stacked ? acc[i] ?? 0 : 0;
|
|
4482
|
+
const top = below + (v ?? 0);
|
|
4483
|
+
if (stacked) acc[i] = top;
|
|
4484
|
+
points.push([frame.band(i), frame.value(top)]);
|
|
4485
|
+
lower.push([frame.band(i), frame.value(below)]);
|
|
4486
|
+
});
|
|
4487
|
+
layers.push({
|
|
4488
|
+
points,
|
|
4489
|
+
lower,
|
|
4490
|
+
color: s.color,
|
|
4491
|
+
filter: s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""
|
|
4492
|
+
});
|
|
4493
|
+
});
|
|
4494
|
+
for (const { points, lower, color, filter } of area ? [...layers].reverse() : layers) {
|
|
4495
|
+
if (area) {
|
|
4496
|
+
const poly = [...points, ...[...lower].reverse()].map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
|
|
4497
|
+
out.push(`<polygon points="${poly}" fill="${color}" fill-opacity="0.85"${filter}/>`);
|
|
4498
|
+
continue;
|
|
4499
|
+
}
|
|
4500
|
+
let segment = [];
|
|
4501
|
+
const flush = () => {
|
|
4502
|
+
if (segment.length > 1)
|
|
4503
|
+
out.push(
|
|
4504
|
+
`<polyline points="${segment.join(" ")}" fill="none" stroke="${color}" stroke-width="2.25" stroke-linejoin="round"${filter}/>`
|
|
4505
|
+
);
|
|
4506
|
+
segment = [];
|
|
4507
|
+
};
|
|
4508
|
+
for (const [x, y] of points) {
|
|
4509
|
+
if (Number.isNaN(x)) flush();
|
|
4510
|
+
else segment.push(`${n(x)},${n(y)}`);
|
|
4511
|
+
}
|
|
4512
|
+
flush();
|
|
4513
|
+
for (const [x, y] of points)
|
|
4514
|
+
if (!Number.isNaN(x))
|
|
4515
|
+
out.push(`<circle cx="${n(x)}" cy="${n(y)}" r="2.5" fill="${color}"${filter}/>`);
|
|
4516
|
+
}
|
|
4517
|
+
}
|
|
4518
|
+
function scatter(model, area, out) {
|
|
4519
|
+
const ys = model.valueAxis;
|
|
4520
|
+
const xs = model.xAxis;
|
|
4521
|
+
if (!ys || !xs) return;
|
|
4522
|
+
const yLabels = ys.ticks.map((t) => formatAxisValue(t));
|
|
4523
|
+
const valueAttrs = chartTextAttributes(model, "valueAxis");
|
|
4524
|
+
const categoryAttrs = chartTextAttributes(model, "categoryAxis");
|
|
4525
|
+
const valueSize = valueAttrs.size ?? 10;
|
|
4526
|
+
const categorySize = categoryAttrs.size ?? 10;
|
|
4527
|
+
const grid = chartStroke(model, "gridlineMajor");
|
|
4528
|
+
const xAxis = chartStroke(model, "categoryAxis");
|
|
4529
|
+
const yAxis = chartStroke(model, "valueAxis");
|
|
4530
|
+
const valueLabels = model.appearance?.valueAxis?.labelsVisible !== false;
|
|
4531
|
+
const categoryLabels = model.appearance?.categoryAxis?.labelsVisible !== false;
|
|
4532
|
+
const labelW = valueLabels ? Math.max(...yLabels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
|
|
4533
|
+
const plot = {
|
|
4534
|
+
x: area.x + labelW,
|
|
4535
|
+
y: area.y + 4,
|
|
4536
|
+
w: Math.max(1, area.w - labelW - 8),
|
|
4537
|
+
h: Math.max(1, area.h - Math.max(20, categorySize * 1.5))
|
|
4538
|
+
};
|
|
4539
|
+
const px = (v, s) => plot.x + (v - s.min) / (s.max - s.min || 1) * plot.w;
|
|
4540
|
+
const py = (v, s) => plot.y + plot.h - (v - s.min) / (s.max - s.min || 1) * plot.h;
|
|
4541
|
+
out.push(chartAreaRect(model, "plotArea", plot));
|
|
4542
|
+
ys.ticks.forEach((t, i) => {
|
|
4543
|
+
out.push(line(plot.x, py(t, ys), plot.x + plot.w, py(t, ys), grid.color, grid.width));
|
|
4544
|
+
if (valueLabels)
|
|
4545
|
+
out.push(
|
|
4546
|
+
text(plot.x - 4, py(t, ys) + valueSize * 0.3, yLabels[i] ?? "", {
|
|
4547
|
+
anchor: "end",
|
|
4548
|
+
...valueAttrs
|
|
4549
|
+
})
|
|
4550
|
+
);
|
|
4551
|
+
});
|
|
4552
|
+
for (const t of xs.ticks) {
|
|
4553
|
+
out.push(
|
|
4554
|
+
line(px(t, xs), plot.y + plot.h, px(t, xs), plot.y + plot.h + 3, xAxis.color, xAxis.width)
|
|
4555
|
+
);
|
|
4556
|
+
if (categoryLabels)
|
|
4557
|
+
out.push(
|
|
4558
|
+
text(px(t, xs), plot.y + plot.h + categorySize + 3, formatAxisValue(t), {
|
|
4559
|
+
anchor: "middle",
|
|
4560
|
+
...categoryAttrs
|
|
4561
|
+
})
|
|
4562
|
+
);
|
|
4563
|
+
}
|
|
4564
|
+
out.push(
|
|
4565
|
+
line(plot.x, plot.y + plot.h, plot.x + plot.w, plot.y + plot.h, xAxis.color, xAxis.width)
|
|
4566
|
+
);
|
|
4567
|
+
out.push(line(plot.x, plot.y, plot.x, plot.y + plot.h, yAxis.color, yAxis.width));
|
|
4568
|
+
for (const s of model.series)
|
|
4569
|
+
s.values.forEach((v, i) => {
|
|
4570
|
+
const x = s.xValues?.[i] ?? null;
|
|
4571
|
+
if (v === null || x === null) return;
|
|
4572
|
+
out.push(
|
|
4573
|
+
`<circle cx="${n(px(x, xs))}" cy="${n(py(v, ys))}" r="3" fill="${s.pointColors?.[i] ?? s.color}"${s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""}/>`
|
|
4574
|
+
);
|
|
4575
|
+
});
|
|
4576
|
+
}
|
|
4577
|
+
function cartesianSvg(model, area) {
|
|
4578
|
+
const out = [];
|
|
4579
|
+
if (model.type === "scatter") {
|
|
4580
|
+
scatter(model, area, out);
|
|
4581
|
+
return out.join("");
|
|
4582
|
+
}
|
|
4583
|
+
const frame = axes(model, area, out);
|
|
4584
|
+
if (!frame) return "";
|
|
4585
|
+
if (model.type === "bar" || model.type === "column") bars(model, frame, out, plotted(model));
|
|
4586
|
+
else linesAndAreas(model, frame, out);
|
|
4587
|
+
return out.join("");
|
|
4588
|
+
}
|
|
4589
|
+
|
|
4590
|
+
// chart/render/chart-svg-radial.ts
|
|
4591
|
+
var polar = (cx, cy, r, angle) => [
|
|
4592
|
+
cx + r * Math.sin(angle),
|
|
4593
|
+
cy - r * Math.cos(angle)
|
|
4594
|
+
];
|
|
4595
|
+
function slicePath(cx, cy, r, inner, a0, a1) {
|
|
4596
|
+
const sweep = a1 - a0;
|
|
4597
|
+
if (sweep >= Math.PI * 2 - 1e-9) {
|
|
4598
|
+
const mid = a0 + Math.PI;
|
|
4599
|
+
return slicePath(cx, cy, r, inner, a0, mid) + slicePath(cx, cy, r, inner, mid, a1);
|
|
4600
|
+
}
|
|
4601
|
+
const large = sweep > Math.PI ? 1 : 0;
|
|
4602
|
+
const [x0, y0] = polar(cx, cy, r, a0);
|
|
4603
|
+
const [x1, y1] = polar(cx, cy, r, a1);
|
|
4604
|
+
if (inner <= 0)
|
|
4605
|
+
return `M${n(cx)},${n(cy)} L${n(x0)},${n(y0)} A${n(r)},${n(r)} 0 ${large} 1 ${n(x1)},${n(y1)} Z`;
|
|
4606
|
+
const [ix1, iy1] = polar(cx, cy, inner, a1);
|
|
4607
|
+
const [ix0, iy0] = polar(cx, cy, inner, a0);
|
|
4608
|
+
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`;
|
|
4609
|
+
}
|
|
4610
|
+
function pieSvg(model, area) {
|
|
4611
|
+
const out = [chartAreaRect(model, "plotArea", area)];
|
|
4612
|
+
const cx = area.x + area.w / 2;
|
|
4613
|
+
const cy = area.y + area.h / 2;
|
|
4614
|
+
const radius = Math.max(1, Math.min(area.w, area.h) / 2 - 4);
|
|
4615
|
+
const rings = model.type === "doughnut" ? model.series : model.series.slice(0, 1);
|
|
4616
|
+
const hole = model.type === "doughnut" ? radius * 0.5 : 0;
|
|
4617
|
+
const ringSize = (radius - hole) / Math.max(1, rings.length);
|
|
4618
|
+
rings.forEach((s, ri) => {
|
|
4619
|
+
const outer = radius - ri * ringSize;
|
|
4620
|
+
const inner = model.type === "doughnut" ? outer - ringSize : 0;
|
|
4621
|
+
const total = s.values.reduce((sum, v) => sum + (v !== null && v > 0 ? v : 0), 0);
|
|
4622
|
+
if (total <= 0) return;
|
|
4623
|
+
let angle = 0;
|
|
4624
|
+
s.values.forEach((v, i) => {
|
|
4625
|
+
if (v === null || v <= 0) return;
|
|
4626
|
+
const sweep = v / total * Math.PI * 2;
|
|
4627
|
+
const color = s.pointColors?.[i] ?? s.color;
|
|
4628
|
+
out.push(
|
|
4629
|
+
`<path d="${slicePath(cx, cy, outer, inner, angle, angle + sweep)}" fill="${color}" stroke="#FFFFFF" stroke-width="1"${s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""}/>`
|
|
4630
|
+
);
|
|
4631
|
+
angle += sweep;
|
|
4632
|
+
});
|
|
4633
|
+
});
|
|
4634
|
+
return out.join("");
|
|
4635
|
+
}
|
|
4636
|
+
function radarSvg(model, area) {
|
|
4637
|
+
const out = [chartAreaRect(model, "plotArea", area)];
|
|
4638
|
+
const scale = model.valueAxis;
|
|
4639
|
+
const count = model.categories.length;
|
|
4640
|
+
if (!scale || count < 1) return "";
|
|
4641
|
+
const valueAttrs = chartTextAttributes(model, "valueAxis", 9);
|
|
4642
|
+
const categoryAttrs = chartTextAttributes(model, "categoryAxis");
|
|
4643
|
+
const valueSize = valueAttrs.size ?? 9;
|
|
4644
|
+
const categorySize = categoryAttrs.size ?? 10;
|
|
4645
|
+
const grid = chartStroke(model, "gridlineMajor");
|
|
4646
|
+
const axis = chartStroke(model, "categoryAxis");
|
|
4647
|
+
const cx = area.x + area.w / 2;
|
|
4648
|
+
const cy = area.y + area.h / 2 + 4;
|
|
4649
|
+
const radius = Math.max(1, Math.min(area.w, area.h) / 2 - Math.max(18, categorySize * 1.8));
|
|
4650
|
+
const angle = (i) => i / count * Math.PI * 2;
|
|
4651
|
+
const r = (v) => (v - scale.min) / (scale.max - scale.min || 1) * radius;
|
|
4652
|
+
const labelEvery = Math.max(
|
|
4653
|
+
1,
|
|
4654
|
+
Math.ceil(12 / Math.max(1, radius / Math.max(1, scale.ticks.length - 1)))
|
|
4655
|
+
);
|
|
4656
|
+
for (const [k, t] of scale.ticks.entries()) {
|
|
4657
|
+
const ring = Array.from({ length: count }, (_, i) => polar(cx, cy, r(t), angle(i))).map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
|
|
4658
|
+
out.push(
|
|
4659
|
+
`<polygon points="${ring}" fill="none" stroke="${grid.color}" stroke-width="${n(grid.width)}"/>`
|
|
4660
|
+
);
|
|
4661
|
+
if (model.appearance?.valueAxis?.labelsVisible !== false && k % labelEvery === 0)
|
|
4662
|
+
out.push(
|
|
4663
|
+
text(cx + 3, cy - r(t) + valueSize * 0.3, formatAxisValue(t, scale.percent), valueAttrs)
|
|
4664
|
+
);
|
|
4665
|
+
}
|
|
4666
|
+
model.categories.forEach((c, i) => {
|
|
4667
|
+
const [x, y] = polar(cx, cy, radius, angle(i));
|
|
4668
|
+
out.push(line(cx, cy, x, y, axis.color, axis.width));
|
|
4669
|
+
const [lx, ly] = polar(cx, cy, radius + 10, angle(i));
|
|
4670
|
+
const anchor = Math.abs(lx - cx) < 2 ? "middle" : lx > cx ? "start" : "end";
|
|
4671
|
+
if (model.appearance?.categoryAxis?.labelsVisible !== false)
|
|
4672
|
+
out.push(
|
|
4673
|
+
text(lx, ly + categorySize * 0.3, fit(c, area.w / 4, categorySize), {
|
|
4674
|
+
anchor,
|
|
4675
|
+
...categoryAttrs
|
|
4676
|
+
})
|
|
4677
|
+
);
|
|
4678
|
+
});
|
|
4679
|
+
for (const s of model.series) {
|
|
4680
|
+
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(" ");
|
|
4681
|
+
out.push(
|
|
4682
|
+
`<polygon points="${points}" fill="none" stroke="${s.color}" stroke-width="2"${s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""}/>`
|
|
4683
|
+
);
|
|
4684
|
+
}
|
|
4685
|
+
return out.join("");
|
|
4686
|
+
}
|
|
4687
|
+
|
|
4688
|
+
// chart/render/chart-svg-text-metrics.ts
|
|
4689
|
+
var CHART_FONT_FAMILY = "Calibri, Carlito, Arial, sans-serif";
|
|
4690
|
+
function cssFont(attrs) {
|
|
4691
|
+
return `${attrs.italic ? "italic" : "normal"} ${attrs.weight ?? "normal"} ${attrs.size ?? 10}px ${attrs.family ?? CHART_FONT_FAMILY}`;
|
|
4692
|
+
}
|
|
4693
|
+
function chartFontMetrics(attrs, options) {
|
|
4694
|
+
const metrics = options.measureFont?.(cssFont(attrs));
|
|
4695
|
+
return metrics && Number.isFinite(metrics.ascent) && Number.isFinite(metrics.descent) && metrics.ascent >= 0 && metrics.descent >= 0 && metrics.ascent + metrics.descent > 0 ? metrics : void 0;
|
|
4696
|
+
}
|
|
4697
|
+
function chartTextWidth(content, attrs, options) {
|
|
4698
|
+
const width = options.measureText?.(content, cssFont(attrs));
|
|
4699
|
+
return width !== void 0 && Number.isFinite(width) && width >= 0 ? width : textWidth(content, attrs.size);
|
|
4700
|
+
}
|
|
4701
|
+
function fitChartText(content, maxWidth, attrs, options) {
|
|
4702
|
+
if (!options.measureText) return fit(content, maxWidth, attrs.size);
|
|
4703
|
+
if (chartTextWidth(content, attrs, options) <= maxWidth) return content;
|
|
4704
|
+
const points = [...content];
|
|
4705
|
+
let low = 0;
|
|
4706
|
+
let high = points.length;
|
|
4707
|
+
while (low < high) {
|
|
4708
|
+
const mid = Math.ceil((low + high) / 2);
|
|
4709
|
+
if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`, attrs, options) <= maxWidth) low = mid;
|
|
4710
|
+
else high = mid - 1;
|
|
4711
|
+
}
|
|
4712
|
+
return `${points.slice(0, low).join("")}\u2026`;
|
|
4713
|
+
}
|
|
4714
|
+
|
|
4715
|
+
// chart/render/chart-svg-legend.ts
|
|
4716
|
+
function chartLegendSvg(model, area, frame, options) {
|
|
4717
|
+
const automatic = [];
|
|
4718
|
+
const bounds = {};
|
|
4719
|
+
const reserved = automaticLegend(model, area, automatic, options, bounds);
|
|
4720
|
+
const plot = model.legendOverlay ? area : reserved;
|
|
4721
|
+
const box = bounds.box;
|
|
4722
|
+
if (!box) return { plot, markup: "", foreground: false };
|
|
4723
|
+
const manual = resolveManualLayoutRect(model.legendLayout, frame, {
|
|
4724
|
+
x: box.x,
|
|
4725
|
+
y: box.y,
|
|
4726
|
+
width: box.w,
|
|
4727
|
+
height: box.h
|
|
4728
|
+
});
|
|
4729
|
+
if (!manual) return { plot, markup: automatic.join(""), foreground: !!model.legendOverlay };
|
|
4730
|
+
const entries = legendEntries(model);
|
|
4731
|
+
const attrs = chartTextAttributes(model, "legend");
|
|
4732
|
+
const size = attrs.size ?? 10;
|
|
4733
|
+
const font = chartFontMetrics(attrs, options);
|
|
4734
|
+
const keySize = size / 2;
|
|
4735
|
+
const keyGap = size / 4;
|
|
4736
|
+
const widths = entries.map(
|
|
4737
|
+
(entry) => chartTextWidth(entry.label, attrs, options) + keySize + keyGap
|
|
4738
|
+
);
|
|
4739
|
+
const horizontal = manual.width > manual.height && widths.reduce((sum, width) => sum + width, 0) + size <= manual.width;
|
|
4740
|
+
const rowWidth = horizontal ? manual.width / entries.length : manual.width;
|
|
4741
|
+
const rowHeight = horizontal ? manual.height : manual.height / entries.length;
|
|
4742
|
+
const horizontalGap = Math.max(
|
|
4743
|
+
0,
|
|
4744
|
+
(manual.width - widths.reduce((sum, width) => sum + width, 0)) / (entries.length + 1)
|
|
4745
|
+
);
|
|
4746
|
+
let horizontalX = manual.x + horizontalGap;
|
|
4747
|
+
const markup = [
|
|
4748
|
+
chartAreaRect(model, "legend", { x: manual.x, y: manual.y, w: manual.width, h: manual.height })
|
|
4749
|
+
];
|
|
4750
|
+
const baselineOffset = font ? (font.ascent - font.descent) / 2 : size * 0.35;
|
|
4751
|
+
entries.forEach((entry, i) => {
|
|
4752
|
+
const available = horizontal ? chartTextWidth(entry.label, attrs, options) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
|
|
4753
|
+
const label = fitChartText(entry.label, available, attrs, options);
|
|
4754
|
+
const contentWidth = Math.min(
|
|
4755
|
+
horizontal ? widths[i] ?? 0 : Math.max(...widths),
|
|
4756
|
+
rowWidth - size / 2
|
|
4757
|
+
);
|
|
4758
|
+
const x = horizontal ? horizontalX : manual.x + Math.max(size / 4, (rowWidth - contentWidth) / 2);
|
|
4759
|
+
const centerY = manual.y + (horizontal ? 0 : i * rowHeight) + rowHeight / 2;
|
|
4760
|
+
markup.push(rect(x, centerY - keySize / 2, keySize, keySize, entry.color));
|
|
4761
|
+
markup.push(text(x + keySize + keyGap, centerY + baselineOffset, label, attrs));
|
|
4762
|
+
if (horizontal) horizontalX += (widths[i] ?? 0) + horizontalGap;
|
|
4763
|
+
});
|
|
4764
|
+
return {
|
|
4765
|
+
plot,
|
|
4766
|
+
markup: `<g data-chart-legend-layout="true">${markup.join("")}</g>`,
|
|
4767
|
+
foreground: true
|
|
4768
|
+
};
|
|
4769
|
+
}
|
|
4770
|
+
function legendEntries(model) {
|
|
4771
|
+
if (model.type === "pie" || model.type === "doughnut") {
|
|
4772
|
+
const first3 = model.series[0];
|
|
4773
|
+
return model.categories.map((label, i) => ({
|
|
4774
|
+
label,
|
|
4775
|
+
color: first3?.pointColors?.[i] ?? first3?.color ?? "#4472C4"
|
|
4776
|
+
}));
|
|
4777
|
+
}
|
|
4778
|
+
return model.series.map((s) => ({ label: s.name, color: s.color }));
|
|
4779
|
+
}
|
|
4780
|
+
function automaticLegend(model, area, out, options, bounds) {
|
|
4781
|
+
const entries = legendEntries(model);
|
|
4782
|
+
if (!model.showLegend || entries.length === 0) return area;
|
|
4783
|
+
const pos = model.legendPosition;
|
|
4784
|
+
const attrs = chartTextAttributes(model, "legend");
|
|
4785
|
+
const size = attrs.size ?? 10;
|
|
4786
|
+
const rowH = Math.max(16, size * 1.4);
|
|
4787
|
+
if (pos === "t" || pos === "b") {
|
|
4788
|
+
const widths = entries.map(
|
|
4789
|
+
(e) => Math.min(chartTextWidth(e.label, attrs, options) + 20, area.w / 2)
|
|
4790
|
+
);
|
|
4791
|
+
const total = widths.reduce((a, b) => a + b, 0);
|
|
4792
|
+
let x2 = area.x + Math.max(0, (area.w - total) / 2);
|
|
4793
|
+
const y = pos === "t" ? area.y + 4 : area.y + area.h - rowH + 4;
|
|
4794
|
+
bounds.box = { x: x2 - 4, y: y - 4, w: Math.min(total, area.w) + 8, h: rowH + 4 };
|
|
4795
|
+
out.push(
|
|
4796
|
+
chartAreaRect(model, "legend", {
|
|
4797
|
+
x: x2 - 4,
|
|
4798
|
+
y: y - 4,
|
|
4799
|
+
w: Math.min(total, area.w) + 8,
|
|
4800
|
+
h: rowH + 4
|
|
4801
|
+
})
|
|
4802
|
+
);
|
|
4803
|
+
entries.forEach((e, i) => {
|
|
4804
|
+
const w = widths[i] ?? 0;
|
|
4805
|
+
out.push(rect(x2, y, 8, 8, e.color));
|
|
4806
|
+
out.push(text(x2 + 12, y + 8, fitChartText(e.label, w - 16, attrs, options), attrs));
|
|
4807
|
+
x2 += w;
|
|
4808
|
+
});
|
|
4809
|
+
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 };
|
|
4810
|
+
}
|
|
4811
|
+
const width = Math.min(
|
|
4812
|
+
area.w * 0.35,
|
|
4813
|
+
Math.max(...entries.map((e) => chartTextWidth(e.label, attrs, options))) + 22
|
|
4814
|
+
);
|
|
4815
|
+
const height = entries.length * rowH;
|
|
4816
|
+
const x = pos === "l" ? area.x + 4 : area.x + area.w - width;
|
|
4817
|
+
const y0 = pos === "tr" ? area.y + 4 : area.y + Math.max(0, (area.h - height) / 2);
|
|
4818
|
+
bounds.box = { x: x - 4, y: y0, w: width + 4, h: Math.min(height, area.y + area.h - y0) };
|
|
4819
|
+
out.push(
|
|
4820
|
+
chartAreaRect(model, "legend", {
|
|
4821
|
+
x: x - 4,
|
|
4822
|
+
y: y0,
|
|
4823
|
+
w: width + 4,
|
|
4824
|
+
h: Math.min(height, area.y + area.h - y0)
|
|
4825
|
+
})
|
|
4826
|
+
);
|
|
4827
|
+
entries.forEach((e, i) => {
|
|
4828
|
+
const y = y0 + i * rowH;
|
|
4829
|
+
if (y + rowH > area.y + area.h + 2) return;
|
|
4830
|
+
out.push(rect(x, y + 3, 8, 8, e.color));
|
|
4831
|
+
out.push(text(x + 12, y + 11, fitChartText(e.label, width - 16, attrs, options), attrs));
|
|
4832
|
+
});
|
|
4833
|
+
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 };
|
|
4834
|
+
}
|
|
4835
|
+
|
|
4836
|
+
// text/wrap-styled-runs.ts
|
|
4837
|
+
var graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
4838
|
+
function wrapStyledRuns(runs, maxWidth, measure, options = {}) {
|
|
4839
|
+
const groups = [];
|
|
4840
|
+
for (const [source, run] of runs.entries()) {
|
|
4841
|
+
for (const token of run.text.split(/(\r\n|[\r\n]|[ \t]+)/u).filter(Boolean)) {
|
|
4842
|
+
const kind = /^[\r\n]+$/u.test(token) ? "break" : /^[ \t]+$/u.test(token) ? "space" : "word";
|
|
4843
|
+
let group = groups.at(-1);
|
|
4844
|
+
if (!group || group.kind !== kind || kind === "break") {
|
|
4845
|
+
group = { kind, pieces: [] };
|
|
4846
|
+
groups.push(group);
|
|
4847
|
+
}
|
|
4848
|
+
if (kind !== "break") group.pieces.push({ run, source, text: token });
|
|
4849
|
+
}
|
|
4850
|
+
}
|
|
4851
|
+
const merged = (left, right) => {
|
|
4852
|
+
const result2 = left.map((piece) => ({ ...piece }));
|
|
4853
|
+
for (const piece of right) {
|
|
4854
|
+
const last = result2.at(-1);
|
|
4855
|
+
if (last?.source === piece.source) last.text += piece.text;
|
|
4856
|
+
else result2.push({ ...piece });
|
|
4857
|
+
}
|
|
4858
|
+
return result2;
|
|
4859
|
+
};
|
|
4860
|
+
const width = (pieces) => pieces.reduce((sum, piece) => {
|
|
4861
|
+
const advance = measure(piece.text, piece.run);
|
|
4862
|
+
return sum + (Number.isFinite(advance) && advance >= 0 ? advance : 0);
|
|
4863
|
+
}, 0);
|
|
4864
|
+
const result = [];
|
|
4865
|
+
let line2 = [];
|
|
4866
|
+
let spaces = [];
|
|
4867
|
+
const flush = () => {
|
|
4868
|
+
result.push(line2.map((piece) => ({ ...piece.run, text: piece.text })));
|
|
4869
|
+
line2 = [];
|
|
4870
|
+
spaces = [];
|
|
4871
|
+
};
|
|
4872
|
+
for (const group of groups) {
|
|
4873
|
+
if (group.kind === "break") {
|
|
4874
|
+
flush();
|
|
4875
|
+
continue;
|
|
4876
|
+
}
|
|
4877
|
+
if (group.kind === "space") {
|
|
4878
|
+
spaces = group.pieces;
|
|
4879
|
+
continue;
|
|
4880
|
+
}
|
|
4881
|
+
const separator = line2.length ? spaces : [];
|
|
4882
|
+
const wordWidth = width(group.pieces);
|
|
4883
|
+
if (line2.length && width(merged(line2, [...separator, ...group.pieces])) > maxWidth) flush();
|
|
4884
|
+
else line2 = merged(line2, separator);
|
|
4885
|
+
spaces = [];
|
|
4886
|
+
if (options.breakWords && wordWidth > maxWidth) {
|
|
4887
|
+
for (const piece of group.pieces) {
|
|
4888
|
+
for (const { segment } of graphemes.segment(piece.text)) {
|
|
4889
|
+
const next = { ...piece, text: segment };
|
|
4890
|
+
if (line2.length && width(merged(line2, [next])) > maxWidth) flush();
|
|
4891
|
+
line2 = merged(line2, [next]);
|
|
4892
|
+
}
|
|
4893
|
+
}
|
|
4894
|
+
} else line2 = merged(line2, group.pieces);
|
|
4895
|
+
}
|
|
4896
|
+
flush();
|
|
4897
|
+
return result;
|
|
4898
|
+
}
|
|
4899
|
+
|
|
4900
|
+
// chart/render/chart-svg-title-text.ts
|
|
4901
|
+
function spacing(value, naturalHeight, fallback) {
|
|
4902
|
+
return value ? value.unit === "points" ? chartPointsToPixels(value.value) : naturalHeight * value.value : fallback;
|
|
4903
|
+
}
|
|
4904
|
+
function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
|
|
4905
|
+
if (!model.title) return void 0;
|
|
4906
|
+
const base = chartTextAttributes(model, "title", 14);
|
|
4907
|
+
const capacity = Math.max(1, width * 0.8 - 8);
|
|
4908
|
+
if (!model.titleText && !hasManualLayoutFields(model.titleLayout) && !model.titleOverlay && !model.title.includes("\n") && chartTextWidth(model.title, base, options) <= capacity)
|
|
4909
|
+
return void 0;
|
|
4910
|
+
const paragraphs = model.titleText?.paragraphs ?? [
|
|
4911
|
+
{
|
|
4912
|
+
runs: [{ text: model.title, appearance: model.appearance?.title ?? {} }]
|
|
4913
|
+
}
|
|
4914
|
+
];
|
|
4915
|
+
const hardLines = [];
|
|
4916
|
+
for (const paragraph of paragraphs) {
|
|
4917
|
+
let line2 = {
|
|
4918
|
+
...paragraph,
|
|
4919
|
+
runs: []
|
|
4920
|
+
};
|
|
4921
|
+
hardLines.push(line2);
|
|
4922
|
+
for (const run of paragraph.runs) {
|
|
4923
|
+
const pieces = run.text.split("\n");
|
|
4924
|
+
for (const [index, piece] of pieces.entries()) {
|
|
4925
|
+
if (index) {
|
|
4926
|
+
line2 = { ...paragraph, runs: [] };
|
|
4927
|
+
hardLines.push(line2);
|
|
4928
|
+
}
|
|
4929
|
+
if (piece) line2.runs.push({ ...run, text: piece });
|
|
4930
|
+
}
|
|
4931
|
+
}
|
|
4932
|
+
}
|
|
4933
|
+
const lines = hardLines.flatMap((line2) => {
|
|
4934
|
+
const wrapped = wrapStyledRuns(
|
|
4935
|
+
line2.runs,
|
|
4936
|
+
capacity,
|
|
4937
|
+
(content, run) => chartTextWidth(
|
|
4938
|
+
content,
|
|
4939
|
+
chartTextAttributes(
|
|
4940
|
+
{ ...model, appearance: { title: run.appearance } },
|
|
4941
|
+
"title",
|
|
4942
|
+
base.size
|
|
4943
|
+
),
|
|
4944
|
+
options
|
|
4945
|
+
),
|
|
4946
|
+
{ breakWords: true }
|
|
4947
|
+
);
|
|
4948
|
+
const { spaceBefore, spaceAfter, ...properties4 } = line2;
|
|
4949
|
+
return wrapped.map((runs, index) => ({
|
|
4950
|
+
...properties4,
|
|
4951
|
+
runs,
|
|
4952
|
+
...index === 0 && spaceBefore ? { spaceBefore } : {},
|
|
4953
|
+
...index === wrapped.length - 1 && spaceAfter ? { spaceAfter } : {}
|
|
4954
|
+
}));
|
|
4955
|
+
});
|
|
4956
|
+
const metrics = lines.map((line2) => {
|
|
4957
|
+
const runs = line2.runs.map((run) => ({
|
|
4958
|
+
...run,
|
|
4959
|
+
attrs: chartTextAttributes(
|
|
4960
|
+
{ ...model, appearance: { title: run.appearance } },
|
|
4961
|
+
"title",
|
|
4962
|
+
base.size
|
|
4963
|
+
)
|
|
4964
|
+
}));
|
|
4965
|
+
return {
|
|
4966
|
+
...line2,
|
|
4967
|
+
runs,
|
|
4968
|
+
width: runs.reduce((sum, run) => sum + chartTextWidth(run.text, run.attrs, options), 0),
|
|
4969
|
+
size: runs.length ? Math.max(...runs.map((run) => run.attrs.size ?? 14)) : base.size ?? 14,
|
|
4970
|
+
fontMetrics: (runs.length ? runs.map((run) => run.attrs) : [base]).map(
|
|
4971
|
+
(attrs) => chartFontMetrics(attrs, options)
|
|
4972
|
+
)
|
|
4973
|
+
};
|
|
4974
|
+
});
|
|
4975
|
+
const measured = metrics.every((line2) => line2.fontMetrics.every((font) => font !== void 0));
|
|
4976
|
+
const vertical = metrics.map((line2) => {
|
|
4977
|
+
const ascent = measured ? Math.max(...line2.fontMetrics.map((font) => font.ascent)) : line2.size;
|
|
4978
|
+
const descent = measured ? Math.max(...line2.fontMetrics.map((font) => font.descent)) : line2.size * 0.4 + 4;
|
|
4979
|
+
const natural = ascent + descent;
|
|
4980
|
+
const height2 = spacing(line2.lineSpacing, natural, natural);
|
|
4981
|
+
const leading = (height2 - natural) / 2;
|
|
4982
|
+
return {
|
|
4983
|
+
ascent: ascent + leading,
|
|
4984
|
+
descent: descent + leading,
|
|
4985
|
+
height: height2,
|
|
4986
|
+
before: spacing(line2.spaceBefore, natural, 0),
|
|
4987
|
+
after: spacing(line2.spaceAfter, natural, 0),
|
|
4988
|
+
leading
|
|
4989
|
+
};
|
|
4990
|
+
});
|
|
4991
|
+
const boxWidth = Math.min(width - 16, Math.max(0, ...metrics.map((line2) => line2.width)) + 8);
|
|
4992
|
+
const height = vertical.reduce(
|
|
4993
|
+
(sum, line2) => sum + line2.height + line2.before + line2.after,
|
|
4994
|
+
measured ? 4 : 0
|
|
4995
|
+
);
|
|
4996
|
+
let baseline = 8 + (metrics[0]?.size ?? base.size ?? 14) + (vertical[0]?.before ?? 0) + (vertical[0]?.leading ?? 0);
|
|
4997
|
+
const spans = [];
|
|
4998
|
+
for (const [index, line2] of metrics.entries()) {
|
|
4999
|
+
if (index)
|
|
5000
|
+
baseline += vertical[index - 1].descent + vertical[index - 1].after + vertical[index].before + vertical[index].ascent;
|
|
5001
|
+
let x = line2.align === "l" ? (width - boxWidth) / 2 + 4 : line2.align === "r" ? (width + boxWidth) / 2 - 4 - line2.width : (width - line2.width) / 2;
|
|
5002
|
+
for (const run of line2.runs) {
|
|
5003
|
+
spans.push(
|
|
5004
|
+
text(x, baseline, run.text, {
|
|
5005
|
+
...run.attrs,
|
|
5006
|
+
anchor: "start"
|
|
5007
|
+
}).replace("<text ", '<tspan data-chart-title-run="true" ').replace("</text>", "</tspan>")
|
|
5008
|
+
);
|
|
5009
|
+
x += chartTextWidth(run.text, run.attrs, options);
|
|
5010
|
+
}
|
|
5011
|
+
}
|
|
5012
|
+
const parent = text(0, 0, "", { ...base, underline: false }).replace(
|
|
5013
|
+
"</text>",
|
|
5014
|
+
`${spans.join("")}</text>`
|
|
5015
|
+
);
|
|
5016
|
+
const markup = chartAreaRect(model, "title", {
|
|
5017
|
+
x: (width - boxWidth) / 2,
|
|
5018
|
+
y: 4,
|
|
5019
|
+
w: Math.max(0, boxWidth),
|
|
5020
|
+
h: height
|
|
5021
|
+
}) + parent;
|
|
5022
|
+
const automatic = { x: (width - boxWidth) / 2, y: 4, width: boxWidth, height };
|
|
5023
|
+
const manual = resolveManualLayoutRect(
|
|
5024
|
+
model.titleLayout,
|
|
5025
|
+
{ width, height: frameHeight },
|
|
5026
|
+
automatic
|
|
5027
|
+
);
|
|
5028
|
+
return {
|
|
5029
|
+
markup: manual ? `<g data-chart-title-layout="true" transform="translate(${n(manual.x - automatic.x)} ${n(manual.y - automatic.y)})">${markup}</g>` : markup,
|
|
5030
|
+
height: Math.max(24, height)
|
|
5031
|
+
};
|
|
5032
|
+
}
|
|
5033
|
+
|
|
5034
|
+
// chart/render/chart-svg.ts
|
|
5035
|
+
function renderChartSvg(model, width, height, options = {}) {
|
|
5036
|
+
const paint = chartGradientPaint(model, Math.max(1, width), Math.max(1, height));
|
|
5037
|
+
model = paint.model;
|
|
5038
|
+
const w = Math.max(1, width);
|
|
5039
|
+
const h = Math.max(1, height);
|
|
5040
|
+
const out = [];
|
|
5041
|
+
let foregroundTitle = "";
|
|
5042
|
+
out.push(
|
|
5043
|
+
`<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">`
|
|
5044
|
+
);
|
|
5045
|
+
if (model.title) out.push(`<title>${esc(model.title)}</title>`);
|
|
5046
|
+
if (paint.defs) out.push(paint.defs);
|
|
5047
|
+
out.push(chartAreaRect(model, "chartArea", { x: 0, y: 0, w, h }));
|
|
5048
|
+
let area = { x: 8, y: 8, w: w - 16, h: h - 16 };
|
|
5049
|
+
const richTitle = chartRichTitleSvg(model, w, options, h);
|
|
5050
|
+
if (richTitle) {
|
|
5051
|
+
if (model.titleLayout || model.titleOverlay) foregroundTitle = richTitle.markup;
|
|
5052
|
+
else out.push(richTitle.markup);
|
|
5053
|
+
if (!model.titleOverlay)
|
|
5054
|
+
area = { ...area, y: area.y + richTitle.height, h: area.h - richTitle.height };
|
|
5055
|
+
} else if (model.title) {
|
|
5056
|
+
const attrs = chartTextAttributes(model, "title", 14);
|
|
5057
|
+
const size = attrs.size ?? 14;
|
|
5058
|
+
const label = fitChartText(model.title, w - 16, attrs, options);
|
|
5059
|
+
const titleWidth = Math.min(w - 16, chartTextWidth(label, attrs, options) + 8);
|
|
5060
|
+
const font = chartFontMetrics(attrs, options);
|
|
5061
|
+
const titleHeight = Math.max(24, font ? font.ascent + font.descent + 4 : size * 1.4 + 4);
|
|
5062
|
+
out.push(
|
|
5063
|
+
chartAreaRect(model, "title", {
|
|
5064
|
+
x: (w - titleWidth) / 2,
|
|
5065
|
+
y: 4,
|
|
5066
|
+
w: Math.max(0, titleWidth),
|
|
5067
|
+
h: font ? font.ascent + font.descent + 4 : size * 1.4 + 4
|
|
5068
|
+
})
|
|
5069
|
+
);
|
|
5070
|
+
out.push(
|
|
5071
|
+
text(w / 2, 8 + size, label, {
|
|
5072
|
+
anchor: "middle",
|
|
5073
|
+
fill: "#404040",
|
|
5074
|
+
...attrs
|
|
5075
|
+
})
|
|
5076
|
+
);
|
|
5077
|
+
if (!model.titleOverlay)
|
|
5078
|
+
area = { x: area.x, y: area.y + titleHeight, w: area.w, h: area.h - titleHeight };
|
|
5079
|
+
}
|
|
5080
|
+
if (!model.supported) {
|
|
5081
|
+
out.push(
|
|
5082
|
+
text(w / 2, area.y + area.h / 2, `${model.type} charts are not drawn`, { anchor: "middle" })
|
|
5083
|
+
);
|
|
5084
|
+
if (foregroundTitle) out.push(foregroundTitle);
|
|
5085
|
+
out.push("</svg>");
|
|
5086
|
+
return out.join("");
|
|
5087
|
+
}
|
|
5088
|
+
const legend = chartLegendSvg(model, area, { width: w, height: h }, options);
|
|
5089
|
+
area = legend.plot;
|
|
5090
|
+
if (!legend.foreground) out.push(legend.markup);
|
|
5091
|
+
if (area.w > 4 && area.h > 4) {
|
|
5092
|
+
if (model.type === "pie" || model.type === "doughnut") out.push(pieSvg(model, area));
|
|
5093
|
+
else if (model.type === "radar") out.push(radarSvg(model, area));
|
|
5094
|
+
else out.push(cartesianSvg(model, area));
|
|
5095
|
+
}
|
|
5096
|
+
if (legend.foreground) out.push(legend.markup);
|
|
5097
|
+
if (foregroundTitle) out.push(foregroundTitle);
|
|
5098
|
+
out.push("</svg>");
|
|
5099
|
+
return out.join("");
|
|
5100
|
+
}
|
|
5101
|
+
|
|
5102
|
+
// chart/render/render-space.ts
|
|
5103
|
+
var DRAWN_CHART_TYPES = /* @__PURE__ */ new Set([
|
|
5104
|
+
"bar",
|
|
5105
|
+
"column",
|
|
5106
|
+
"line",
|
|
5107
|
+
"area",
|
|
5108
|
+
"pie",
|
|
5109
|
+
"doughnut",
|
|
5110
|
+
"scatter",
|
|
5111
|
+
"radar"
|
|
5112
|
+
]);
|
|
5113
|
+
function chartThemePalette(theme, fonts = {}) {
|
|
5114
|
+
return {
|
|
5115
|
+
colors: THEME_SLOTS.map(
|
|
5116
|
+
(slot, index) => themeSlotHex(theme?.colors[slot]) ?? DEFAULT_THEME_COLORS[index] ?? "000000"
|
|
5117
|
+
),
|
|
5118
|
+
majorFont: fonts.major ?? "Calibri Light",
|
|
5119
|
+
minorFont: fonts.minor ?? "Calibri"
|
|
5120
|
+
};
|
|
5121
|
+
}
|
|
5122
|
+
function chartSpaceKind(space) {
|
|
5123
|
+
if (!space.plotArea.groups.length) return { drawn: false };
|
|
5124
|
+
const type = chartSummaryFromSpace(space).chartType;
|
|
5125
|
+
return { type, drawn: DRAWN_CHART_TYPES.has(type) };
|
|
5126
|
+
}
|
|
5127
|
+
function renderChartSpaceSvg(space, options) {
|
|
5128
|
+
const { width, height, theme, fonts, formatting, colorPalette, styleDefinition, ...svg } = options;
|
|
5129
|
+
const summary = chartSummaryFromSpace(space, {
|
|
5130
|
+
...formatting ? { formatting } : {},
|
|
5131
|
+
...colorPalette !== void 0 ? { colorPalette } : {},
|
|
5132
|
+
...styleDefinition ? { styleDefinition } : {}
|
|
5133
|
+
});
|
|
5134
|
+
const view = chartSummaryView(summary, chartThemePalette(theme, fonts));
|
|
5135
|
+
return renderChartSvg(view, width, height, svg);
|
|
5136
|
+
}
|
|
5137
|
+
|
|
5138
|
+
// docx/breaks.ts
|
|
5139
|
+
function isCachedPageBreak(element) {
|
|
5140
|
+
return named2(element, "lastRenderedPageBreak") && !element.childNodes.length && Array.from(element.attributes).every(
|
|
5141
|
+
(attribute) => attribute.namespaceURI === "http://www.w3.org/2000/xmlns/"
|
|
5142
|
+
);
|
|
5143
|
+
}
|
|
5144
|
+
function hasSpecialBreak(element) {
|
|
5145
|
+
for (const attribute of Array.from(element.attributes)) {
|
|
5146
|
+
if (attribute.namespaceURI === "http://www.w3.org/2000/xmlns/") continue;
|
|
5147
|
+
if (attribute.namespaceURI !== WORD_NS) return true;
|
|
5148
|
+
if (attribute.localName === "type") {
|
|
5149
|
+
if (attribute.value !== "textWrapping") return true;
|
|
5150
|
+
} else if (attribute.localName === "clear") {
|
|
5151
|
+
if (attribute.value !== "none") return true;
|
|
5152
|
+
} else return true;
|
|
5153
|
+
}
|
|
5154
|
+
return false;
|
|
5155
|
+
}
|
|
5156
|
+
function classifyBreak(element) {
|
|
5157
|
+
const type = getW(element, "type");
|
|
5158
|
+
return type === "page" || type === "column" ? type : "textWrapping";
|
|
5159
|
+
}
|
|
5160
|
+
function isModeledBreak(element) {
|
|
5161
|
+
const kind = classifyBreak(element);
|
|
5162
|
+
if (kind === "textWrapping") return false;
|
|
5163
|
+
for (const attribute of Array.from(element.attributes)) {
|
|
5164
|
+
if (attribute.namespaceURI === "http://www.w3.org/2000/xmlns/") continue;
|
|
5165
|
+
if (attribute.namespaceURI !== WORD_NS || attribute.localName !== "type") return false;
|
|
5166
|
+
}
|
|
5167
|
+
return true;
|
|
5168
|
+
}
|
|
5169
|
+
|
|
2818
5170
|
// docx/write-drawing.ts
|
|
2819
5171
|
var A_NS2 = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
2820
5172
|
var WP_NS2 = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing";
|
|
@@ -3150,11 +5502,11 @@ function createRun(doc, run, base, old, allocator) {
|
|
|
3150
5502
|
if (piece === "\n") node.appendChild(makeW(doc, "br"));
|
|
3151
5503
|
else if (piece === " ") node.appendChild(makeW(doc, "tab"));
|
|
3152
5504
|
else if (piece) {
|
|
3153
|
-
const
|
|
5505
|
+
const text2 = makeW(doc, "t");
|
|
3154
5506
|
if (/^\s|\s$/.test(piece))
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
node.appendChild(
|
|
5507
|
+
text2.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
|
|
5508
|
+
text2.appendChild(doc.createTextNode(piece));
|
|
5509
|
+
node.appendChild(text2);
|
|
3158
5510
|
}
|
|
3159
5511
|
}
|
|
3160
5512
|
if (!run.text) node.appendChild(makeW(doc, "t"));
|
|
@@ -3221,38 +5573,6 @@ function preserveEquation(run, base, old) {
|
|
|
3221
5573
|
"Equation editing or insertion is unsupported; imported OMML must remain unchanged."
|
|
3222
5574
|
);
|
|
3223
5575
|
}
|
|
3224
|
-
|
|
3225
|
-
// docx/breaks.ts
|
|
3226
|
-
function isCachedPageBreak(element) {
|
|
3227
|
-
return named2(element, "lastRenderedPageBreak") && !element.childNodes.length && Array.from(element.attributes).every(
|
|
3228
|
-
(attribute) => attribute.namespaceURI === "http://www.w3.org/2000/xmlns/"
|
|
3229
|
-
);
|
|
3230
|
-
}
|
|
3231
|
-
function hasSpecialBreak(element) {
|
|
3232
|
-
for (const attribute of Array.from(element.attributes)) {
|
|
3233
|
-
if (attribute.namespaceURI === "http://www.w3.org/2000/xmlns/") continue;
|
|
3234
|
-
if (attribute.namespaceURI !== WORD_NS) return true;
|
|
3235
|
-
if (attribute.localName === "type") {
|
|
3236
|
-
if (attribute.value !== "textWrapping") return true;
|
|
3237
|
-
} else if (attribute.localName === "clear") {
|
|
3238
|
-
if (attribute.value !== "none") return true;
|
|
3239
|
-
} else return true;
|
|
3240
|
-
}
|
|
3241
|
-
return false;
|
|
3242
|
-
}
|
|
3243
|
-
function classifyBreak(element) {
|
|
3244
|
-
const type = getW(element, "type");
|
|
3245
|
-
return type === "page" || type === "column" ? type : "textWrapping";
|
|
3246
|
-
}
|
|
3247
|
-
function isModeledBreak(element) {
|
|
3248
|
-
const kind = classifyBreak(element);
|
|
3249
|
-
if (kind === "textWrapping") return false;
|
|
3250
|
-
for (const attribute of Array.from(element.attributes)) {
|
|
3251
|
-
if (attribute.namespaceURI === "http://www.w3.org/2000/xmlns/") continue;
|
|
3252
|
-
if (attribute.namespaceURI !== WORD_NS || attribute.localName !== "type") return false;
|
|
3253
|
-
}
|
|
3254
|
-
return true;
|
|
3255
|
-
}
|
|
3256
5576
|
function isCommentReferenceRun(run) {
|
|
3257
5577
|
const content = Array.from(run.childNodes).filter(
|
|
3258
5578
|
(child) => isElement(child) && !named2(child, "rPr")
|
|
@@ -3464,18 +5784,18 @@ function parseDirectParagraphProperties(props) {
|
|
|
3464
5784
|
if (shading) paragraph.shadingFill = shading;
|
|
3465
5785
|
const tabStops = parseTabStops(first2(props, "tabs"));
|
|
3466
5786
|
if (tabStops.length) paragraph.tabStops = tabStops;
|
|
3467
|
-
const
|
|
3468
|
-
const before = twipValue2(getW(
|
|
3469
|
-
const after = twipValue2(getW(
|
|
3470
|
-
const
|
|
5787
|
+
const spacing2 = first2(props, "spacing");
|
|
5788
|
+
const before = twipValue2(getW(spacing2, "before"));
|
|
5789
|
+
const after = twipValue2(getW(spacing2, "after"));
|
|
5790
|
+
const line2 = signedTwipValue2(getW(spacing2, "line"));
|
|
3471
5791
|
if (before !== void 0) paragraph.spacingBeforeTwips = before;
|
|
3472
5792
|
if (after !== void 0) paragraph.spacingAfterTwips = after;
|
|
3473
|
-
if (
|
|
3474
|
-
paragraph.lineSpacingTwips =
|
|
5793
|
+
if (line2 !== void 0) {
|
|
5794
|
+
paragraph.lineSpacingTwips = line2;
|
|
3475
5795
|
}
|
|
3476
|
-
const rule = getW(
|
|
5796
|
+
const rule = getW(spacing2, "lineRule");
|
|
3477
5797
|
if (rule === "auto" || rule === "exact" || rule === "atLeast") paragraph.lineSpacingRule = rule;
|
|
3478
|
-
else if (
|
|
5798
|
+
else if (line2 !== void 0) paragraph.lineSpacingRule = "auto";
|
|
3479
5799
|
const indent = first2(props, "ind");
|
|
3480
5800
|
const indentLeft = signedTwipValue2(getW(indent, "left"));
|
|
3481
5801
|
const indentRight = signedTwipValue2(getW(indent, "right"));
|
|
@@ -3607,9 +5927,9 @@ function resolveNumberingLevel(catalog, numId, level) {
|
|
|
3607
5927
|
let base = override?.lvl ?? abstract;
|
|
3608
5928
|
if (!base) return void 0;
|
|
3609
5929
|
if (override?.lvl) {
|
|
3610
|
-
const { lvlRestart: _ignored, ...
|
|
5930
|
+
const { lvlRestart: _ignored, ...properties4 } = base;
|
|
3611
5931
|
base = {
|
|
3612
|
-
...
|
|
5932
|
+
...properties4,
|
|
3613
5933
|
...abstract?.lvlRestart !== void 0 ? { lvlRestart: abstract.lvlRestart } : {}
|
|
3614
5934
|
};
|
|
3615
5935
|
}
|
|
@@ -3635,6 +5955,37 @@ function documentBlockLists(model) {
|
|
|
3635
5955
|
];
|
|
3636
5956
|
}
|
|
3637
5957
|
|
|
5958
|
+
// docx/chart-paint.ts
|
|
5959
|
+
function themeCatalogColorScheme(theme) {
|
|
5960
|
+
const colors = {};
|
|
5961
|
+
for (const [slot, value] of Object.entries(theme?.colors ?? {}))
|
|
5962
|
+
if (value) colors[slot] = { kind: "srgb", value: value.replace(/^#/, ""), transforms: [] };
|
|
5963
|
+
return { colors };
|
|
5964
|
+
}
|
|
5965
|
+
function docxChartPaint(chart, widthPx, heightPx, theme) {
|
|
5966
|
+
const space = chart?.chartSpace;
|
|
5967
|
+
if (!space) return { label: "Chart" };
|
|
5968
|
+
const kind = chartSpaceKind(space);
|
|
5969
|
+
if (!kind.drawn) return { label: kind.type ? `Chart (${kind.type})` : "Chart" };
|
|
5970
|
+
try {
|
|
5971
|
+
const fonts = {
|
|
5972
|
+
...theme?.fonts.major.latin ? { major: theme.fonts.major.latin } : {},
|
|
5973
|
+
...theme?.fonts.minor.latin ? { minor: theme.fonts.minor.latin } : {}
|
|
5974
|
+
};
|
|
5975
|
+
const svg = renderChartSpaceSvg(space, {
|
|
5976
|
+
width: Math.max(1, Math.round(widthPx)),
|
|
5977
|
+
height: Math.max(1, Math.round(heightPx)),
|
|
5978
|
+
theme: themeCatalogColorScheme(theme),
|
|
5979
|
+
fonts,
|
|
5980
|
+
...chart.formatting ? { formatting: chart.formatting } : {},
|
|
5981
|
+
...chart.colorPalette !== void 0 ? { colorPalette: chart.colorPalette } : {}
|
|
5982
|
+
});
|
|
5983
|
+
return { svg, label: chart.title ? `Chart: ${chart.title}` : "Chart" };
|
|
5984
|
+
} catch {
|
|
5985
|
+
return { label: kind.type ? `Chart (${kind.type})` : "Chart" };
|
|
5986
|
+
}
|
|
5987
|
+
}
|
|
5988
|
+
|
|
3638
5989
|
// docx/diagram-theme.ts
|
|
3639
5990
|
function diagramColorTheme(theme) {
|
|
3640
5991
|
return {
|
|
@@ -3702,20 +6053,20 @@ function restoreParagraphFormatting(paragraph) {
|
|
|
3702
6053
|
throw new Error(
|
|
3703
6054
|
"Cannot reject a paragraph formatting revision without its prior properties snapshot."
|
|
3704
6055
|
);
|
|
3705
|
-
const
|
|
6056
|
+
const properties4 = parsePropertiesSnapshot(xml, "pPr");
|
|
3706
6057
|
if (paragraph.sourceParagraphPropertiesXml) {
|
|
3707
6058
|
const current = parsePropertiesSnapshot(paragraph.sourceParagraphPropertiesXml, "pPr");
|
|
3708
6059
|
for (const name of ["rPr", "sectPr"]) {
|
|
3709
6060
|
const element = first2(current, name);
|
|
3710
|
-
if (element && !first2(
|
|
3711
|
-
|
|
6061
|
+
if (element && !first2(properties4, name))
|
|
6062
|
+
properties4.appendChild(properties4.ownerDocument.importNode(element, true));
|
|
3712
6063
|
}
|
|
3713
|
-
orderParagraphProperties(
|
|
6064
|
+
orderParagraphProperties(properties4);
|
|
3714
6065
|
}
|
|
3715
|
-
const previous = parseDirectParagraphProperties(
|
|
6066
|
+
const previous = parseDirectParagraphProperties(properties4);
|
|
3716
6067
|
for (const key of PARAGRAPH_FORMAT_KEYS) delete paragraph[key];
|
|
3717
6068
|
Object.assign(paragraph, previous);
|
|
3718
|
-
paragraph.restoredParagraphPropertiesXml = buildXml(
|
|
6069
|
+
paragraph.restoredParagraphPropertiesXml = buildXml(properties4);
|
|
3719
6070
|
if (paragraph.sourceParagraphPropertiesXml)
|
|
3720
6071
|
paragraph.sourceParagraphPropertiesXml = paragraph.restoredParagraphPropertiesXml;
|
|
3721
6072
|
delete paragraph.formatRevision;
|
|
@@ -4339,7 +6690,8 @@ function runToInlineNodes(run, schema, noteNumber) {
|
|
|
4339
6690
|
textBoxText: run.image.textBoxText ? JSON.stringify(run.image.textBoxText) : null,
|
|
4340
6691
|
textBoxEditable: run.image.textBoxEditable ?? null,
|
|
4341
6692
|
textBoxBorder: run.image.textBoxBorder ?? null,
|
|
4342
|
-
diagram: run.image.diagram ? JSON.stringify(run.image.diagram) : null
|
|
6693
|
+
diagram: run.image.diagram ? JSON.stringify(run.image.diagram) : null,
|
|
6694
|
+
chart: run.image.chart ? JSON.stringify(run.image.chart) : null
|
|
4343
6695
|
},
|
|
4344
6696
|
void 0,
|
|
4345
6697
|
marks2
|
|
@@ -4361,8 +6713,8 @@ function applyInlineFormat(run, child) {
|
|
|
4361
6713
|
Object.assign(run, inlineRunProperties(child));
|
|
4362
6714
|
const marks = { text: "", ...run.revision ? { revision: run.revision } : {} };
|
|
4363
6715
|
applyMarkFormatting(marks, child);
|
|
4364
|
-
const { text: _text, ...
|
|
4365
|
-
Object.assign(run,
|
|
6716
|
+
const { text: _text, ...properties4 } = marks;
|
|
6717
|
+
Object.assign(run, properties4);
|
|
4366
6718
|
const ids = commentIdsFromNode(child);
|
|
4367
6719
|
if (ids.length) run.commentIds = ids;
|
|
4368
6720
|
else delete run.commentIds;
|
|
@@ -4423,6 +6775,7 @@ function appendInlineNode(runs, child) {
|
|
|
4423
6775
|
// Same key order as the parser's run: the writer compares an unchanged placeholder run by JSON.
|
|
4424
6776
|
...child.attrs.unsupported ? { unsupported: child.attrs.unsupported } : {},
|
|
4425
6777
|
...typeof child.attrs.diagram === "string" ? { diagram: JSON.parse(child.attrs.diagram) } : {},
|
|
6778
|
+
...typeof child.attrs.chart === "string" ? { chart: JSON.parse(child.attrs.chart) } : {},
|
|
4426
6779
|
...typeof child.attrs.placement === "string" ? { placement: JSON.parse(child.attrs.placement) } : {},
|
|
4427
6780
|
...typeof child.attrs.textBoxText === "string" ? { textBoxText: JSON.parse(child.attrs.textBoxText) } : {},
|
|
4428
6781
|
...child.attrs.textBoxEditable ? { textBoxEditable: true } : {},
|
|
@@ -4524,9 +6877,9 @@ function fieldClipboardSlice(slice) {
|
|
|
4524
6877
|
});
|
|
4525
6878
|
return node.copy(Fragment.fromArray(children4));
|
|
4526
6879
|
}
|
|
4527
|
-
const
|
|
6880
|
+
const properties4 = !node.isText && node.type.spec.attrs?.format ? inlineRunProperties(node) : void 0;
|
|
4528
6881
|
const field = node.marks.find((mark) => mark.type.name === "field");
|
|
4529
|
-
const cached2 =
|
|
6882
|
+
const cached2 = properties4?.field;
|
|
4530
6883
|
if (!field && !cached2) return node;
|
|
4531
6884
|
if (!(field?.attrs.simple ?? cached2?.simple) && complete.has(pos)) return node;
|
|
4532
6885
|
const marks = node.marks.flatMap((mark) => {
|
|
@@ -4535,8 +6888,8 @@ function fieldClipboardSlice(slice) {
|
|
|
4535
6888
|
const { fieldInstanceId: _identity, fieldFlags: _flags2, ...props } = mark.attrs.props ?? {};
|
|
4536
6889
|
return Object.keys(props).length ? [mark.type.create({ ...mark.attrs, props })] : [];
|
|
4537
6890
|
});
|
|
4538
|
-
if (!
|
|
4539
|
-
const { field: _field, fieldInstanceId: _id, fieldFlags: _flags, ...literal } =
|
|
6891
|
+
if (!properties4 || !cached2) return node.mark(marks);
|
|
6892
|
+
const { field: _field, fieldInstanceId: _id, fieldFlags: _flags, ...literal } = properties4;
|
|
4540
6893
|
return node.type.create(
|
|
4541
6894
|
updatedInlineRunAttributes(
|
|
4542
6895
|
node,
|
|
@@ -4587,7 +6940,7 @@ function fieldResultRanges(doc) {
|
|
|
4587
6940
|
}
|
|
4588
6941
|
|
|
4589
6942
|
// docx/ui/simple-field-input.ts
|
|
4590
|
-
var
|
|
6943
|
+
var graphemes2 = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
4591
6944
|
function targetField(state, from, to) {
|
|
4592
6945
|
return fieldResultRanges(state.doc).find(
|
|
4593
6946
|
(range) => range.mark.attrs.simple && from >= range.from && to <= range.to && (from !== to || from > range.from && from < range.to)
|
|
@@ -4601,14 +6954,14 @@ function resultMarks(node, field) {
|
|
|
4601
6954
|
...typeof id === "string" && { fieldInstanceId: id },
|
|
4602
6955
|
...source?.fieldFlags && { fieldFlags: source.fieldFlags }
|
|
4603
6956
|
};
|
|
4604
|
-
const
|
|
4605
|
-
if (
|
|
4606
|
-
const old =
|
|
6957
|
+
const properties4 = node.type.schema.marks.runProperties;
|
|
6958
|
+
if (properties4) {
|
|
6959
|
+
const old = properties4.isInSet(marks);
|
|
4607
6960
|
const { fieldInstanceId: _identity, fieldFlags: _flags, ...other } = old?.attrs.props ?? {};
|
|
4608
6961
|
const props = { ...other, ...state };
|
|
4609
|
-
marks =
|
|
6962
|
+
marks = properties4.removeFromSet(marks);
|
|
4610
6963
|
if (Object.keys(props).length)
|
|
4611
|
-
marks =
|
|
6964
|
+
marks = properties4.create({ ...old?.attrs ?? {}, props }).addToSet(marks);
|
|
4612
6965
|
}
|
|
4613
6966
|
return marks;
|
|
4614
6967
|
}
|
|
@@ -4634,19 +6987,19 @@ function simpleFieldPasteSlice(slice, state) {
|
|
|
4634
6987
|
slice.content.forEach((node) => children3.push(project(node)));
|
|
4635
6988
|
return new Slice(Fragment.fromArray(children3), slice.openStart, slice.openEnd);
|
|
4636
6989
|
}
|
|
4637
|
-
function replaceSimpleFieldResult(state, from, to,
|
|
6990
|
+
function replaceSimpleFieldResult(state, from, to, text2) {
|
|
4638
6991
|
const field = targetField(state, from, to);
|
|
4639
6992
|
if (!field) return null;
|
|
4640
|
-
if (!
|
|
6993
|
+
if (!text2) {
|
|
4641
6994
|
const tr2 = state.tr;
|
|
4642
6995
|
if (!emptySimpleFieldResult(tr2, from, to)) return null;
|
|
4643
6996
|
return tr2.setSelection(TextSelection.create(tr2.doc, from + 3));
|
|
4644
6997
|
}
|
|
4645
6998
|
const $from = state.doc.resolve(from);
|
|
4646
6999
|
const marks = state.storedMarks ?? (from === to ? $from.marks() : $from.marksAcross(state.doc.resolve(to)));
|
|
4647
|
-
const node = state.schema.text(
|
|
7000
|
+
const node = state.schema.text(text2, marks);
|
|
4648
7001
|
const tr = state.tr.replaceRangeWith(from, to, node.mark(resultMarks(node, field)));
|
|
4649
|
-
if (!tr.selection.empty && tr.selection.to === from +
|
|
7002
|
+
if (!tr.selection.empty && tr.selection.to === from + text2.length)
|
|
4650
7003
|
tr.setSelection(TextSelection.near(tr.selection.$to));
|
|
4651
7004
|
return tr;
|
|
4652
7005
|
}
|
|
@@ -4680,7 +7033,7 @@ function deleteSimpleFieldResult(state, backward) {
|
|
|
4680
7033
|
(range) => range.mark.attrs.simple && (backward ? range.to === from : range.from === from)
|
|
4681
7034
|
);
|
|
4682
7035
|
if (!field) return null;
|
|
4683
|
-
const segments =
|
|
7036
|
+
const segments = graphemes2.segment(field.text)[Symbol.iterator]();
|
|
4684
7037
|
if (segments.next().done || !segments.next().done) return null;
|
|
4685
7038
|
return replaceSimpleFieldResult(state, field.from, field.to, "");
|
|
4686
7039
|
}
|
|
@@ -4718,10 +7071,10 @@ function fieldGuardPlugin() {
|
|
|
4718
7071
|
if (!view.editable || !event.clipboardData) return false;
|
|
4719
7072
|
const tr = deleteFieldSelection(view.state);
|
|
4720
7073
|
if (!tr) return false;
|
|
4721
|
-
const { dom, text } = view.serializeForClipboard(view.state.selection.content());
|
|
7074
|
+
const { dom, text: text2 } = view.serializeForClipboard(view.state.selection.content());
|
|
4722
7075
|
event.clipboardData.clearData();
|
|
4723
7076
|
event.clipboardData.setData("text/html", dom.innerHTML);
|
|
4724
|
-
event.clipboardData.setData("text/plain",
|
|
7077
|
+
event.clipboardData.setData("text/plain", text2);
|
|
4725
7078
|
event.preventDefault();
|
|
4726
7079
|
view.dispatch(tr.scrollIntoView().setMeta("uiEvent", "cut"));
|
|
4727
7080
|
return true;
|
|
@@ -4729,8 +7082,8 @@ function fieldGuardPlugin() {
|
|
|
4729
7082
|
},
|
|
4730
7083
|
transformCopied: fieldClipboardSlice,
|
|
4731
7084
|
transformPasted: (slice, view) => simpleFieldPasteSlice(fieldClipboardSlice(slice), view?.state),
|
|
4732
|
-
handleTextInput: (view, from, to,
|
|
4733
|
-
const transaction = replaceAroundMarkers(view.state, from, to,
|
|
7085
|
+
handleTextInput: (view, from, to, text2) => {
|
|
7086
|
+
const transaction = replaceAroundMarkers(view.state, from, to, text2) ?? replaceSimpleFieldResult(view.state, from, to, text2);
|
|
4734
7087
|
if (transaction) view.dispatch(transaction);
|
|
4735
7088
|
return Boolean(transaction);
|
|
4736
7089
|
},
|
|
@@ -4822,7 +7175,7 @@ function markersIn(doc, from, to) {
|
|
|
4822
7175
|
});
|
|
4823
7176
|
return markers;
|
|
4824
7177
|
}
|
|
4825
|
-
function replaceAroundMarkers(state, from, to,
|
|
7178
|
+
function replaceAroundMarkers(state, from, to, text2) {
|
|
4826
7179
|
if (from === to) return null;
|
|
4827
7180
|
const markers = markersIn(state.doc, from, to);
|
|
4828
7181
|
if (!markers.length) return null;
|
|
@@ -4837,8 +7190,8 @@ function replaceAroundMarkers(state, from, to, text) {
|
|
|
4837
7190
|
end = marker.pos;
|
|
4838
7191
|
}
|
|
4839
7192
|
if (from < end) transaction.delete(from, end);
|
|
4840
|
-
if (
|
|
4841
|
-
return transaction.setSelection(TextSelection.create(transaction.doc, from +
|
|
7193
|
+
if (text2) transaction.insert(from, state.schema.text(text2, marks));
|
|
7194
|
+
return transaction.setSelection(TextSelection.create(transaction.doc, from + text2.length));
|
|
4842
7195
|
}
|
|
4843
7196
|
function deleteAroundMarkers(state, backward) {
|
|
4844
7197
|
const { selection, doc } = state;
|
|
@@ -4910,7 +7263,7 @@ var commentSerial = 0;
|
|
|
4910
7263
|
function nextCommentId(idGenerator) {
|
|
4911
7264
|
return idGenerator ? idGenerator("comment") : `dve-comment-${Date.now().toString(36)}-${++commentSerial}`;
|
|
4912
7265
|
}
|
|
4913
|
-
function addComment(view, author,
|
|
7266
|
+
function addComment(view, author, text2, idGenerator, inlineElements = true) {
|
|
4914
7267
|
if (!view.editable || !view.state.schema.marks.comment) return null;
|
|
4915
7268
|
const { from, to } = commentSelectionRange(
|
|
4916
7269
|
view.state.doc,
|
|
@@ -4939,7 +7292,7 @@ function addComment(view, author, text, idGenerator, inlineElements = true) {
|
|
|
4939
7292
|
tr = tr.addMark(start, end, view.state.schema.marks.comment.create({ ids: [id] }));
|
|
4940
7293
|
});
|
|
4941
7294
|
if (!tr.docChanged) return null;
|
|
4942
|
-
const comment = { id, author, text, resolved: false };
|
|
7295
|
+
const comment = { id, author, text: text2, resolved: false };
|
|
4943
7296
|
const threads = commentThreadsFromDoc(view.state.doc);
|
|
4944
7297
|
if (inlineElements && threads) setCommentThreads(tr, [...threads, comment]);
|
|
4945
7298
|
view.dispatch(closeHistory(tr));
|
|
@@ -4988,9 +7341,9 @@ function deleteComment(comments, id) {
|
|
|
4988
7341
|
function resolveComment(comments, id, resolved) {
|
|
4989
7342
|
return comments.map((comment) => comment.id === id ? { ...comment, resolved } : comment);
|
|
4990
7343
|
}
|
|
4991
|
-
function replyToComment(comments, parentId, author,
|
|
7344
|
+
function replyToComment(comments, parentId, author, text2, idGenerator) {
|
|
4992
7345
|
const id = nextCommentId(idGenerator);
|
|
4993
|
-
return [...comments, { id, author, text, parentId }];
|
|
7346
|
+
return [...comments, { id, author, text: text2, parentId }];
|
|
4994
7347
|
}
|
|
4995
7348
|
function commentIdsAtSelection(view) {
|
|
4996
7349
|
const { from, to, empty } = view.state.selection;
|
|
@@ -5284,7 +7637,7 @@ var WordYjsComments = class {
|
|
|
5284
7637
|
}
|
|
5285
7638
|
return true;
|
|
5286
7639
|
}
|
|
5287
|
-
add(view, author,
|
|
7640
|
+
add(view, author, text2, idGenerator) {
|
|
5288
7641
|
if (!view.editable || view.state.selection.empty || ySyncPluginKey.getState(view.state)?.type !== this.fragment)
|
|
5289
7642
|
return null;
|
|
5290
7643
|
const id = idGenerator("comment");
|
|
@@ -5292,18 +7645,18 @@ var WordYjsComments = class {
|
|
|
5292
7645
|
let added = null;
|
|
5293
7646
|
this.change(() => {
|
|
5294
7647
|
const elements2 = this.inlineEnabled() && this.inlineAnchors.add(view.state, id);
|
|
5295
|
-
added = addComment(view, author,
|
|
5296
|
-
if (!added && elements2) added = { id, author, text, resolved: false };
|
|
7648
|
+
added = addComment(view, author, text2, () => id, false);
|
|
7649
|
+
if (!added && elements2) added = { id, author, text: text2, resolved: false };
|
|
5297
7650
|
if (added) this.records.set(id, added);
|
|
5298
7651
|
});
|
|
5299
7652
|
return added;
|
|
5300
7653
|
}
|
|
5301
|
-
reply(parentId, author,
|
|
7654
|
+
reply(parentId, author, text2, idGenerator) {
|
|
5302
7655
|
const root = this.records.get(parentId);
|
|
5303
7656
|
if (!root || root.parentId || this.deleted.get(parentId)) return false;
|
|
5304
7657
|
const id = idGenerator("comment");
|
|
5305
7658
|
if (!id || this.records.has(id)) return false;
|
|
5306
|
-
return this.change(() => this.records.set(id, { id, parentId, author, text }));
|
|
7659
|
+
return this.change(() => this.records.set(id, { id, parentId, author, text: text2 }));
|
|
5307
7660
|
}
|
|
5308
7661
|
resolve(id, resolved) {
|
|
5309
7662
|
const root = this.records.get(id);
|
|
@@ -5345,12 +7698,12 @@ function independentCommentAnchors(node) {
|
|
|
5345
7698
|
if (!node.isText && node.type.spec.attrs?.format && node.marks.some(
|
|
5346
7699
|
(mark) => mark.type.name === "comment" || mark.type.name === "inlineCommentAnchors"
|
|
5347
7700
|
)) {
|
|
5348
|
-
const
|
|
7701
|
+
const properties4 = inlineRunProperties(node);
|
|
5349
7702
|
const ids = commentIdsFromNode(node);
|
|
5350
|
-
if (ids.length)
|
|
5351
|
-
else delete
|
|
7703
|
+
if (ids.length) properties4.commentIds = ids;
|
|
7704
|
+
else delete properties4.commentIds;
|
|
5352
7705
|
return node.type.create(
|
|
5353
|
-
updatedInlineRunAttributes(node, JSON.stringify(
|
|
7706
|
+
updatedInlineRunAttributes(node, JSON.stringify(properties4)),
|
|
5354
7707
|
void 0,
|
|
5355
7708
|
marks.filter(
|
|
5356
7709
|
(mark) => mark.type.name !== "inlineCommentAnchors" && mark.type.name !== "comment"
|
|
@@ -5697,6 +8050,64 @@ var insertWordHardBreak = (state, dispatch, view) => {
|
|
|
5697
8050
|
return true;
|
|
5698
8051
|
};
|
|
5699
8052
|
|
|
8053
|
+
// docx/ui/chart-spec.ts
|
|
8054
|
+
var SVG_NS2 = "http://www.w3.org/2000/svg";
|
|
8055
|
+
function elementSpec(element, root) {
|
|
8056
|
+
const attrs = {};
|
|
8057
|
+
for (const attr2 of Array.from(element.attributes)) {
|
|
8058
|
+
if (attr2.name === "xmlns" || attr2.name.startsWith("xmlns:") || /^on/i.test(attr2.name)) continue;
|
|
8059
|
+
attrs[attr2.name] = attr2.value;
|
|
8060
|
+
}
|
|
8061
|
+
const children3 = [];
|
|
8062
|
+
for (const child of Array.from(element.childNodes)) {
|
|
8063
|
+
if (isElement(child)) children3.push(elementSpec(child, false));
|
|
8064
|
+
else if (child.nodeType === 3 && child.nodeValue) children3.push(child.nodeValue);
|
|
8065
|
+
}
|
|
8066
|
+
const tag = root ? `${SVG_NS2} ${element.localName}` : element.localName;
|
|
8067
|
+
return [tag, attrs, ...children3];
|
|
8068
|
+
}
|
|
8069
|
+
function svgMarkupSpec(svg) {
|
|
8070
|
+
return elementSpec(parseXml(svg, { label: "Chart SVG" }).documentElement, true);
|
|
8071
|
+
}
|
|
8072
|
+
function nodeChart(node) {
|
|
8073
|
+
const value = node.attrs.chart;
|
|
8074
|
+
if (typeof value !== "string") return void 0;
|
|
8075
|
+
try {
|
|
8076
|
+
return JSON.parse(value);
|
|
8077
|
+
} catch {
|
|
8078
|
+
return void 0;
|
|
8079
|
+
}
|
|
8080
|
+
}
|
|
8081
|
+
function chartNodeSpec(node, theme) {
|
|
8082
|
+
const width = Number(node.attrs.widthPx) || 96;
|
|
8083
|
+
const height = Number(node.attrs.heightPx) || 96;
|
|
8084
|
+
const paint = docxChartPaint(nodeChart(node), width, height, theme);
|
|
8085
|
+
const style = `width:${width}px;height:${height}px`;
|
|
8086
|
+
if (!paint.svg)
|
|
8087
|
+
return [
|
|
8088
|
+
"span",
|
|
8089
|
+
{
|
|
8090
|
+
"data-docx-image-placeholder": "1",
|
|
8091
|
+
"data-docx-chart": "frame",
|
|
8092
|
+
...inlineRunPropertiesDomAttrs(node),
|
|
8093
|
+
class: "dve-image-placeholder",
|
|
8094
|
+
style
|
|
8095
|
+
},
|
|
8096
|
+
paint.label
|
|
8097
|
+
];
|
|
8098
|
+
return [
|
|
8099
|
+
"span",
|
|
8100
|
+
{
|
|
8101
|
+
"data-docx-chart": "1",
|
|
8102
|
+
...inlineRunPropertiesDomAttrs(node),
|
|
8103
|
+
class: "dve-chart",
|
|
8104
|
+
style,
|
|
8105
|
+
title: paint.label
|
|
8106
|
+
},
|
|
8107
|
+
svgMarkupSpec(paint.svg)
|
|
8108
|
+
];
|
|
8109
|
+
}
|
|
8110
|
+
|
|
5700
8111
|
// docx/ui/inline-content-schema.ts
|
|
5701
8112
|
var safeAttrValue = (value) => String(value ?? "").replace(/[;{}"]/g, "");
|
|
5702
8113
|
function placementClass(value) {
|
|
@@ -5717,7 +8128,7 @@ function textBoxLines(value) {
|
|
|
5717
8128
|
if (typeof value !== "string") return [];
|
|
5718
8129
|
try {
|
|
5719
8130
|
const lines = JSON.parse(value);
|
|
5720
|
-
return Array.isArray(lines) ? lines.map((
|
|
8131
|
+
return Array.isArray(lines) ? lines.map((line2) => ["span", { class: "dve-textbox-line" }, String(line2)]) : [];
|
|
5721
8132
|
} catch {
|
|
5722
8133
|
return [];
|
|
5723
8134
|
}
|
|
@@ -5749,7 +8160,9 @@ var imageNodeSpec = {
|
|
|
5749
8160
|
textBoxEditable: { default: null },
|
|
5750
8161
|
textBoxBorder: { default: null },
|
|
5751
8162
|
/** A SmartArt graphic (`DocxDiagram`) as JSON; shown read-only by the SmartArt node view. */
|
|
5752
|
-
diagram: { default: null }
|
|
8163
|
+
diagram: { default: null },
|
|
8164
|
+
/** A chart (`DocxChart`) as JSON; painted read-only from its cached values (`chart-spec.ts`). */
|
|
8165
|
+
chart: { default: null }
|
|
5753
8166
|
},
|
|
5754
8167
|
parseDOM: [
|
|
5755
8168
|
{
|
|
@@ -5768,7 +8181,7 @@ var imageNodeSpec = {
|
|
|
5768
8181
|
})
|
|
5769
8182
|
}
|
|
5770
8183
|
],
|
|
5771
|
-
toDOM: (node) => node.attrs.unsupported ? [
|
|
8184
|
+
toDOM: (node) => node.attrs.chart ? chartNodeSpec(node) : node.attrs.unsupported ? [
|
|
5772
8185
|
"span",
|
|
5773
8186
|
{
|
|
5774
8187
|
"data-docx-image-placeholder": "1",
|
|
@@ -5925,10 +8338,10 @@ var removeWordLink = (state, dispatch, view) => {
|
|
|
5925
8338
|
function patchedRun(node, patch) {
|
|
5926
8339
|
const run = inlineNodeRun(node);
|
|
5927
8340
|
if (!run) return void 0;
|
|
5928
|
-
const
|
|
8341
|
+
const properties4 = run;
|
|
5929
8342
|
for (const [key, value] of Object.entries(patch)) {
|
|
5930
|
-
if (value === void 0) delete
|
|
5931
|
-
else
|
|
8343
|
+
if (value === void 0) delete properties4[key];
|
|
8344
|
+
else properties4[key] = value;
|
|
5932
8345
|
}
|
|
5933
8346
|
return run;
|
|
5934
8347
|
}
|
|
@@ -6340,14 +8753,14 @@ function resolveFormattingRange(tr, from, to, mode) {
|
|
|
6340
8753
|
setInlineRunFormatting(tr, piece.from, run2);
|
|
6341
8754
|
continue;
|
|
6342
8755
|
}
|
|
6343
|
-
const
|
|
8756
|
+
const properties4 = piece.node.marks.find((mark) => mark.type.name === "runProperties");
|
|
6344
8757
|
if (mode === "accept") {
|
|
6345
|
-
const props = { ...
|
|
8758
|
+
const props = { ...properties4.attrs.props };
|
|
6346
8759
|
if (props.formatRevision) delete props.formatRevision;
|
|
6347
8760
|
else delete props.revision;
|
|
6348
|
-
tr.removeMark(piece.from, piece.to,
|
|
8761
|
+
tr.removeMark(piece.from, piece.to, properties4);
|
|
6349
8762
|
if (Object.keys(props).length)
|
|
6350
|
-
tr.addMark(piece.from, piece.to,
|
|
8763
|
+
tr.addMark(piece.from, piece.to, properties4.type.create({ props }));
|
|
6351
8764
|
continue;
|
|
6352
8765
|
}
|
|
6353
8766
|
const run = { text: "", revision: piece.revision };
|
|
@@ -6359,7 +8772,7 @@ function resolveFormattingRange(tr, from, to, mode) {
|
|
|
6359
8772
|
}
|
|
6360
8773
|
|
|
6361
8774
|
// docx/ui/track-run-formatting.ts
|
|
6362
|
-
function
|
|
8775
|
+
function properties2(node) {
|
|
6363
8776
|
const run = inlineNodeRun(node) ?? { text: "" };
|
|
6364
8777
|
run.text = "";
|
|
6365
8778
|
delete run.image;
|
|
@@ -6395,8 +8808,8 @@ function trackRunFormatting(steps, oldState, newState, author, date, nextId) {
|
|
|
6395
8808
|
if (!previous.isInline || previous.type.name === "equation") return;
|
|
6396
8809
|
const start = Math.max(from, previousPos);
|
|
6397
8810
|
const end = Math.min(to, previousPos + previous.nodeSize);
|
|
6398
|
-
const before =
|
|
6399
|
-
const after =
|
|
8811
|
+
const before = properties2(previous);
|
|
8812
|
+
const after = properties2(node);
|
|
6400
8813
|
if (propertiesSignature(before) === propertiesSignature(after)) {
|
|
6401
8814
|
if (hasInlineRunAttributes(node) && node.marks.some((mark2) => RUN_FORMAT_MARKS.has(mark2.type.name)))
|
|
6402
8815
|
setInlineRunFormatting(tr, start, inlineNodeRun(node));
|
|
@@ -6483,7 +8896,7 @@ function paragraphProperties(element) {
|
|
|
6483
8896
|
for (const child of children2(element, name)) element.removeChild(child);
|
|
6484
8897
|
return element;
|
|
6485
8898
|
}
|
|
6486
|
-
function
|
|
8899
|
+
function properties3(node) {
|
|
6487
8900
|
const paragraph = paragraphFromAttrs(node.attrs, String(node.attrs.id), []);
|
|
6488
8901
|
delete paragraph.formatRevision;
|
|
6489
8902
|
delete paragraph.markRevision;
|
|
@@ -6501,8 +8914,8 @@ function trackParagraphFormatting(steps, oldState, newState, author, date, nextI
|
|
|
6501
8914
|
if (node.type.name !== "paragraph" || !node.type.spec.attrs?.formatRevision) return;
|
|
6502
8915
|
const previous = oldState.doc.nodeAt(pos);
|
|
6503
8916
|
if (previous === node) return;
|
|
6504
|
-
const before =
|
|
6505
|
-
const after =
|
|
8917
|
+
const before = properties3(previous);
|
|
8918
|
+
const after = properties3(node);
|
|
6506
8919
|
if (propertiesSignature(before) === propertiesSignature(after)) return;
|
|
6507
8920
|
const pending = paragraphFormattingRevision(previous);
|
|
6508
8921
|
const priorXml = pending?.previousParagraphPropertiesXml ?? buildXml(before);
|
|
@@ -6566,14 +8979,14 @@ function trackSimpleFieldDeletion(transform, from, to, slice, author, date, next
|
|
|
6566
8979
|
function sourceProperties(value) {
|
|
6567
8980
|
if (typeof value !== "string" || !value) return value;
|
|
6568
8981
|
try {
|
|
6569
|
-
const
|
|
6570
|
-
const run = first2(
|
|
8982
|
+
const properties4 = parsePropertiesSnapshot(value, "pPr");
|
|
8983
|
+
const run = first2(properties4, "rPr");
|
|
6571
8984
|
if (run) {
|
|
6572
8985
|
for (const name of ["ins", "del"])
|
|
6573
8986
|
for (const revision of children2(run, name)) run.removeChild(revision);
|
|
6574
|
-
if (!run.childNodes.length && !run.attributes.length)
|
|
8987
|
+
if (!run.childNodes.length && !run.attributes.length) properties4.removeChild(run);
|
|
6575
8988
|
}
|
|
6576
|
-
return propertiesSignature(
|
|
8989
|
+
return propertiesSignature(properties4);
|
|
6577
8990
|
} catch {
|
|
6578
8991
|
return value;
|
|
6579
8992
|
}
|
|
@@ -7916,10 +10329,10 @@ function paragraphBoxCss(borders, shadingFill) {
|
|
|
7916
10329
|
const parsed = typeof borders === "string" ? parseBordersJson(borders) : borders;
|
|
7917
10330
|
const css = [];
|
|
7918
10331
|
for (const side of ["top", "bottom", "left", "right"]) {
|
|
7919
|
-
const
|
|
7920
|
-
if (!
|
|
10332
|
+
const line2 = cssBorderSide(parsed?.[side]);
|
|
10333
|
+
if (!line2) continue;
|
|
7921
10334
|
css.push(
|
|
7922
|
-
`border-${side}:${
|
|
10335
|
+
`border-${side}:${line2}`,
|
|
7923
10336
|
`padding-${side}:${(parsed[side].spacePoints ?? 0) * 4 / 3}px`
|
|
7924
10337
|
);
|
|
7925
10338
|
}
|
|
@@ -8023,7 +10436,7 @@ function applyThemeColors(host, previous, colors) {
|
|
|
8023
10436
|
}
|
|
8024
10437
|
|
|
8025
10438
|
// docx/ui/word-count.ts
|
|
8026
|
-
function countWords(
|
|
10439
|
+
function countWords(text2, locale) {
|
|
8027
10440
|
if (typeof Intl.Segmenter === "function") {
|
|
8028
10441
|
let segmenter;
|
|
8029
10442
|
try {
|
|
@@ -8031,9 +10444,9 @@ function countWords(text, locale) {
|
|
|
8031
10444
|
} catch {
|
|
8032
10445
|
segmenter = new Intl.Segmenter(void 0, { granularity: "word" });
|
|
8033
10446
|
}
|
|
8034
|
-
return [...segmenter.segment(
|
|
10447
|
+
return [...segmenter.segment(text2)].filter((part) => part.isWordLike).length;
|
|
8035
10448
|
}
|
|
8036
|
-
return
|
|
10449
|
+
return text2.match(/[\p{L}\p{N}][\p{L}\p{M}\p{N}'’]*/gu)?.length ?? 0;
|
|
8037
10450
|
}
|
|
8038
10451
|
|
|
8039
10452
|
// docx/ui/zoom-fit.ts
|
|
@@ -8045,4 +10458,4 @@ function fitZoomPercent(mode, viewport, page) {
|
|
|
8045
10458
|
return Math.max(10, Math.min(500, Math.floor(ratio * 100)));
|
|
8046
10459
|
}
|
|
8047
10460
|
|
|
8048
|
-
export { CollaborationAuthority, CollaborationClient, DirtyState, EDITOR_THEME_MODES, FIELD_RESULT_REPAIR_META, HEADER_FOOTER_INPUT, NotePartsStep, PAGE_GAP, PARAGRAPH_KEEP_KEYS, REMOTE_TRANSACTION_META, RIBBON_ACTION_IDS, RIBBON_ACTION_LABELS, SectionPartsStep, THEME_KEYS, WordYjsCollaboration, WordYjsComments, WordYjsMedia, acceptAllChanges, acceptChangeAtCursor, acceptRevisionRange, addComment, appendInlineNode, applyMarkFormatting, applyRunFormattingPatch, applyThemeColors, applyWordLink, authorColor, backstageFocus, clearDirectRunFormatting, collectRevisionRanges, commentAnchors, commentHistoryAttributes, commentIdsAtSelection, commentIdsFromMarks, commentIdsFromNode, commentThreadsFromDoc, countWords, createCollaborationIdGenerator, createToggleFormat, cssBorderSide, darkTheme, deleteAroundMarkers, deleteComment, deleteFieldSelection, dispatchIsolatedCommand, expectDefined, explicitOffFields, extraRunFields, extraRunProperties, fieldGuardPlugin, fieldMarkerNodeSpec, fieldResultRanges, fieldsBalanced, fitZoomPercent, formattingRevision, freezeBatch, goToComment, goToNextChange, goToPreviousChange, hardBreakNodeSpec, hasAnyChange, hasChangeAtCursor, hasNoteRevisions, imageNodeSpec, inlineNodeRun, insertWordHardBreak, isNavigableHref, isRibbonActionId, isWordYjsRemoteTransaction, ligatureCss, ligatureStyle, lightTheme, linkFromMarks, linkMarkSpec, markSpecs, marksForRun, moveName, nodeNumbering, normalizeRibbonActions, normalizeThemeMode, notePartsJson, noteReferenceNodeSpec, pageBreakNodeSpec, paragraphAttrs, paragraphBoxCss, paragraphFormattingRevision, paragraphFromAttrs, parseBatch, parseBordersJson, placementClass, refreshWordYjsPresence, rejectAllChanges, rejectChangeAtCursor, rejectRevisionRange, removeCommentAnchor, removeCommentThread, removeWordLink, repairCollaborativeDocumentIds, repairCollaborativeParagraphIds, replaceAroundMarkers, replyToComment, resolveCellVisuals, resolveComment, resolveNoteRevisions, restoreNoteParts, restoreSectionParts, reviewMarks, ribbonActionIdForLabel, runPropertiesMark, runToInlineNodes, sameJson2 as sameJson, sameRuns, sectionPartsJson, setCommentThreads, setReviewRecordingPreferences, swatchColor, tableCellStyle, tableStyle, themeDrawing, themeToCssVars, toggleTrackChanges, toggleTrackFormatting, toggleTrackMoves, trackChangesPlugin, trackChangesPluginKey, updateCommentThreads, wordHighlightColors, wordLinkRangeAt, wordYjsPluginKey, wordYjsPresencePlugin, wordYjsRedo, wordYjsUndo };
|
|
10461
|
+
export { CollaborationAuthority, CollaborationClient, DirtyState, EDITOR_THEME_MODES, FIELD_RESULT_REPAIR_META, HEADER_FOOTER_INPUT, NotePartsStep, PAGE_GAP, PARAGRAPH_KEEP_KEYS, REMOTE_TRANSACTION_META, RIBBON_ACTION_IDS, RIBBON_ACTION_LABELS, SectionPartsStep, THEME_KEYS, WordYjsCollaboration, WordYjsComments, WordYjsMedia, acceptAllChanges, acceptChangeAtCursor, acceptRevisionRange, addComment, appendInlineNode, applyMarkFormatting, applyRunFormattingPatch, applyThemeColors, applyWordLink, authorColor, backstageFocus, chartNodeSpec, clearDirectRunFormatting, collectRevisionRanges, commentAnchors, commentHistoryAttributes, commentIdsAtSelection, commentIdsFromMarks, commentIdsFromNode, commentThreadsFromDoc, countWords, createCollaborationIdGenerator, createToggleFormat, cssBorderSide, darkTheme, deleteAroundMarkers, deleteComment, deleteFieldSelection, dispatchIsolatedCommand, expectDefined, explicitOffFields, extraRunFields, extraRunProperties, fieldGuardPlugin, fieldMarkerNodeSpec, fieldResultRanges, fieldsBalanced, fitZoomPercent, formattingRevision, freezeBatch, goToComment, goToNextChange, goToPreviousChange, hardBreakNodeSpec, hasAnyChange, hasChangeAtCursor, hasNoteRevisions, imageNodeSpec, inlineNodeRun, insertWordHardBreak, isNavigableHref, isRibbonActionId, isWordYjsRemoteTransaction, ligatureCss, ligatureStyle, lightTheme, linkFromMarks, linkMarkSpec, markSpecs, marksForRun, moveName, nodeChart, nodeNumbering, normalizeRibbonActions, normalizeThemeMode, notePartsJson, noteReferenceNodeSpec, pageBreakNodeSpec, paragraphAttrs, paragraphBoxCss, paragraphFormattingRevision, paragraphFromAttrs, parseBatch, parseBordersJson, placementClass, refreshWordYjsPresence, rejectAllChanges, rejectChangeAtCursor, rejectRevisionRange, removeCommentAnchor, removeCommentThread, removeWordLink, repairCollaborativeDocumentIds, repairCollaborativeParagraphIds, replaceAroundMarkers, replyToComment, resolveCellVisuals, resolveComment, resolveNoteRevisions, restoreNoteParts, restoreSectionParts, reviewMarks, ribbonActionIdForLabel, runPropertiesMark, runToInlineNodes, sameJson2 as sameJson, sameRuns, sectionPartsJson, setCommentThreads, setReviewRecordingPreferences, svgMarkupSpec, swatchColor, tableCellStyle, tableStyle, themeDrawing, themeToCssVars, toggleTrackChanges, toggleTrackFormatting, toggleTrackMoves, trackChangesPlugin, trackChangesPluginKey, updateCommentThreads, wordHighlightColors, wordLinkRangeAt, wordYjsPluginKey, wordYjsPresencePlugin, wordYjsRedo, wordYjsUndo };
|