ooxml-core 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -18
- package/dist/{PptxHandler-75LOVF7I.mjs → PptxHandler-SJTINPU4.mjs} +3 -3
- package/dist/automation/index.cjs +6550 -4115
- package/dist/automation/index.mjs +6550 -4115
- package/dist/chart/color-palettes.d.ts +2 -2
- package/dist/chart/color-palettes.d.ts.map +1 -1
- package/dist/chart/data-cache.d.ts +6 -0
- package/dist/chart/data-cache.d.ts.map +1 -0
- package/dist/chart/gradient-coincident-stops.d.ts +17 -0
- package/dist/chart/gradient-coincident-stops.d.ts.map +1 -0
- package/dist/chart/gradient-definition.d.ts +3 -3
- package/dist/chart/gradient-definition.d.ts.map +1 -1
- package/dist/chart/index.cjs +3065 -139
- package/dist/chart/index.d.ts +7 -0
- package/dist/chart/index.d.ts.map +1 -1
- package/dist/chart/index.mjs +3045 -140
- package/dist/chart/model-chrome.d.ts +39 -0
- package/dist/chart/model-chrome.d.ts.map +1 -0
- package/dist/chart/model-series.d.ts +189 -0
- package/dist/chart/model-series.d.ts.map +1 -0
- package/dist/chart/model.d.ts +202 -0
- package/dist/chart/model.d.ts.map +1 -0
- package/dist/chart/parse-chrome.d.ts +16 -0
- package/dist/chart/parse-chrome.d.ts.map +1 -0
- package/dist/chart/parse-plot.d.ts +11 -0
- package/dist/chart/parse-plot.d.ts.map +1 -0
- package/dist/chart/parse-series.d.ts +8 -0
- package/dist/chart/parse-series.d.ts.map +1 -0
- package/dist/chart/parse-space.d.ts +8 -0
- package/dist/chart/parse-space.d.ts.map +1 -0
- package/dist/chart/parse-text.d.ts +12 -0
- package/dist/chart/parse-text.d.ts.map +1 -0
- package/dist/chart/parse-util.d.ts +42 -0
- package/dist/chart/parse-util.d.ts.map +1 -0
- package/dist/{xlsx/layout → chart/render}/chart-appearance.d.ts +4 -4
- package/dist/chart/render/chart-appearance.d.ts.map +1 -0
- package/dist/chart/render/chart-colors.d.ts +9 -0
- package/dist/chart/render/chart-colors.d.ts.map +1 -0
- package/dist/chart/render/chart-scale.d.ts.map +1 -0
- package/dist/chart/render/chart-spacing.d.ts +6 -0
- package/dist/chart/render/chart-spacing.d.ts.map +1 -0
- package/dist/{xlsx/layout → chart/render}/chart-svg-appearance.d.ts +1 -1
- package/dist/chart/render/chart-svg-appearance.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-bars.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-cartesian.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-legend.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-radial.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-text-metrics.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-title-text.d.ts.map +1 -0
- package/dist/chart/render/chart-svg-util.d.ts.map +1 -0
- package/dist/chart/render/chart-svg.d.ts.map +1 -0
- package/dist/chart/render/chart-title-text.d.ts +14 -0
- package/dist/chart/render/chart-title-text.d.ts.map +1 -0
- package/dist/chart/render/chart-value-axis.d.ts +6 -0
- package/dist/chart/render/chart-value-axis.d.ts.map +1 -0
- package/dist/chart/render/chart-view.d.ts +71 -0
- package/dist/chart/render/chart-view.d.ts.map +1 -0
- package/dist/chart/render/index.d.ts +9 -0
- package/dist/chart/render/index.d.ts.map +1 -0
- package/dist/chart/render/render-space.d.ts +34 -0
- package/dist/chart/render/render-space.d.ts.map +1 -0
- package/dist/chart/render/summary-from-space.d.ts +15 -0
- package/dist/chart/render/summary-from-space.d.ts.map +1 -0
- package/dist/chart/render/summary.d.ts +51 -0
- package/dist/chart/render/summary.d.ts.map +1 -0
- package/dist/chart/render/theme-palette.d.ts +8 -0
- package/dist/chart/render/theme-palette.d.ts.map +1 -0
- package/dist/chart/style-definition.d.ts +7 -7
- package/dist/chart/style-definition.d.ts.map +1 -1
- package/dist/chart/write-axes.d.ts +5 -0
- package/dist/chart/write-axes.d.ts.map +1 -0
- package/dist/chart/write-chrome.d.ts +9 -0
- package/dist/chart/write-chrome.d.ts.map +1 -0
- package/dist/chart/write-plot.d.ts +7 -0
- package/dist/chart/write-plot.d.ts.map +1 -0
- package/dist/chart/write-series.d.ts +7 -0
- package/dist/chart/write-series.d.ts.map +1 -0
- package/dist/chart/write-shape.d.ts +21 -0
- package/dist/chart/write-shape.d.ts.map +1 -0
- package/dist/chart/write-space.d.ts +15 -0
- package/dist/chart/write-space.d.ts.map +1 -0
- package/dist/chart/write-text-body.d.ts +6 -0
- package/dist/chart/write-text-body.d.ts.map +1 -0
- package/dist/chart/write-text.d.ts +15 -0
- package/dist/chart/write-text.d.ts.map +1 -0
- package/dist/chart/write-util.d.ts +24 -0
- package/dist/chart/write-util.d.ts.map +1 -0
- package/dist/chart/xml-fragment.d.ts +13 -0
- package/dist/chart/xml-fragment.d.ts.map +1 -0
- package/dist/{chunk-HUBK4EOT.mjs → chunk-3IT6ZD7K.mjs} +2 -0
- package/dist/{chunk-TS3E27NK.mjs → chunk-3UMDVJRN.mjs} +12 -1
- package/dist/{chunk-P22OKTRK.mjs → chunk-54S5A5PZ.mjs} +208 -159
- package/dist/{chunk-75LA7H3F.mjs → chunk-CQQAPUAG.mjs} +27440 -27402
- package/dist/{chunk-Q27H4HFS.mjs → chunk-FI4RSJ24.mjs} +1 -1
- package/dist/{chunk-OJI3N5AY.cjs → chunk-FRUB573B.cjs} +2 -0
- package/dist/{chunk-OMGH6IKY.mjs → chunk-TEOAOAIF.mjs} +42 -5
- package/dist/{chunk-RFX7AJDZ.mjs → chunk-VYTA2OUN.mjs} +2 -2
- package/dist/{chunk-LA7D6ZYQ.mjs → chunk-XCZ7U3GZ.mjs} +3569 -2075
- package/dist/{chunk-2C72N64G.cjs → chunk-XROY25LN.cjs} +12 -0
- package/dist/collab/index.cjs +1 -0
- package/dist/collab/index.mjs +1 -0
- package/dist/collab/transport-provider.d.ts.map +1 -1
- package/dist/color/hex-rgb.d.ts +5 -0
- package/dist/color/hex-rgb.d.ts.map +1 -0
- package/dist/color/index.cjs +12 -0
- package/dist/color/index.d.ts +1 -0
- package/dist/color/index.d.ts.map +1 -1
- package/dist/color/index.mjs +11 -1
- package/dist/diagram/engine/alg-composite.d.ts +18 -0
- package/dist/diagram/engine/alg-composite.d.ts.map +1 -0
- package/dist/diagram/engine/alg-connector.d.ts +17 -0
- package/dist/diagram/engine/alg-connector.d.ts.map +1 -0
- package/dist/diagram/engine/alg-cycle.d.ts +28 -0
- package/dist/diagram/engine/alg-cycle.d.ts.map +1 -0
- package/dist/diagram/engine/alg-hier.d.ts +33 -0
- package/dist/diagram/engine/alg-hier.d.ts.map +1 -0
- package/dist/diagram/engine/alg-linear.d.ts +24 -0
- package/dist/diagram/engine/alg-linear.d.ts.map +1 -0
- package/dist/diagram/engine/alg-pyra.d.ts +117 -0
- package/dist/diagram/engine/alg-pyra.d.ts.map +1 -0
- package/dist/diagram/engine/alg-snake.d.ts +21 -0
- package/dist/diagram/engine/alg-snake.d.ts.map +1 -0
- package/dist/diagram/engine/axis.d.ts +24 -0
- package/dist/diagram/engine/axis.d.ts.map +1 -0
- package/dist/diagram/engine/conditions.d.ts +12 -0
- package/dist/diagram/engine/conditions.d.ts.map +1 -0
- package/dist/diagram/engine/connector-shape.d.ts +25 -0
- package/dist/diagram/engine/connector-shape.d.ts.map +1 -0
- package/dist/diagram/engine/connector-size.d.ts +30 -0
- package/dist/diagram/engine/connector-size.d.ts.map +1 -0
- package/dist/diagram/engine/constraint-eval.d.ts +37 -0
- package/dist/diagram/engine/constraint-eval.d.ts.map +1 -0
- package/dist/diagram/engine/constraint-fill-idiom.d.ts +61 -0
- package/dist/diagram/engine/constraint-fill-idiom.d.ts.map +1 -0
- package/dist/diagram/engine/constraint-units.d.ts +35 -0
- package/dist/diagram/engine/constraint-units.d.ts.map +1 -0
- package/dist/diagram/engine/data-points.d.ts +48 -0
- package/dist/diagram/engine/data-points.d.ts.map +1 -0
- package/dist/diagram/engine/engine-context.d.ts +21 -0
- package/dist/diagram/engine/engine-context.d.ts.map +1 -0
- package/dist/diagram/engine/engine-first-allowlist.d.ts +31 -0
- package/dist/diagram/engine/engine-first-allowlist.d.ts.map +1 -0
- package/dist/diagram/engine/engine-fonts.d.ts +26 -0
- package/dist/diagram/engine/engine-fonts.d.ts.map +1 -0
- package/dist/diagram/engine/engine-node.d.ts +72 -0
- package/dist/diagram/engine/engine-node.d.ts.map +1 -0
- package/dist/diagram/engine/engine-to-result.d.ts +43 -0
- package/dist/diagram/engine/engine-to-result.d.ts.map +1 -0
- package/dist/diagram/engine/engine.d.ts +18 -0
- package/dist/diagram/engine/engine.d.ts.map +1 -0
- package/dist/diagram/engine/font-groups.d.ts +33 -0
- package/dist/diagram/engine/font-groups.d.ts.map +1 -0
- package/dist/diagram/engine/font-length.d.ts +26 -0
- package/dist/diagram/engine/font-length.d.ts.map +1 -0
- package/dist/diagram/engine/font-search.d.ts +38 -0
- package/dist/diagram/engine/font-search.d.ts.map +1 -0
- package/dist/diagram/engine/hier-assistants.d.ts +47 -0
- package/dist/diagram/engine/hier-assistants.d.ts.map +1 -0
- package/dist/diagram/engine/hier-hang.d.ts +28 -0
- package/dist/diagram/engine/hier-hang.d.ts.map +1 -0
- package/dist/diagram/engine/hier-measure.d.ts +33 -0
- package/dist/diagram/engine/hier-measure.d.ts.map +1 -0
- package/dist/diagram/engine/hier-node-size.d.ts +23 -0
- package/dist/diagram/engine/hier-node-size.d.ts.map +1 -0
- package/dist/diagram/engine/hier-shape.d.ts +31 -0
- package/dist/diagram/engine/hier-shape.d.ts.map +1 -0
- package/dist/diagram/engine/index.d.ts +6 -0
- package/dist/diagram/engine/index.d.ts.map +1 -0
- package/dist/diagram/engine/layout-def-parse.d.ts +13 -0
- package/dist/diagram/engine/layout-def-parse.d.ts.map +1 -0
- package/dist/diagram/engine/layout-def-types.d.ts +118 -0
- package/dist/diagram/engine/layout-def-types.d.ts.map +1 -0
- package/dist/diagram/engine/layout-driver.d.ts +41 -0
- package/dist/diagram/engine/layout-driver.d.ts.map +1 -0
- package/dist/diagram/engine/layout-font.d.ts +27 -0
- package/dist/diagram/engine/layout-font.d.ts.map +1 -0
- package/dist/diagram/engine/move-with-merge.d.ts +49 -0
- package/dist/diagram/engine/move-with-merge.d.ts.map +1 -0
- package/dist/diagram/engine/node-text.d.ts +20 -0
- package/dist/diagram/engine/node-text.d.ts.map +1 -0
- package/dist/diagram/engine/ordered-xml.d.ts +30 -0
- package/dist/diagram/engine/ordered-xml.d.ts.map +1 -0
- package/dist/diagram/engine/preferred-size.d.ts +28 -0
- package/dist/diagram/engine/preferred-size.d.ts.map +1 -0
- package/dist/diagram/engine/pres-tree.d.ts +58 -0
- package/dist/diagram/engine/pres-tree.d.ts.map +1 -0
- package/dist/diagram/engine/registry.d.ts +7 -0
- package/dist/diagram/engine/registry.d.ts.map +1 -0
- package/dist/diagram/engine/render-filter.d.ts +43 -0
- package/dist/diagram/engine/render-filter.d.ts.map +1 -0
- package/dist/diagram/engine/shape-adjust.d.ts +16 -0
- package/dist/diagram/engine/shape-adjust.d.ts.map +1 -0
- package/dist/diagram/engine/shape-transform.d.ts +14 -0
- package/dist/diagram/engine/shape-transform.d.ts.map +1 -0
- package/dist/diagram/engine/snake-rule-fit.d.ts +34 -0
- package/dist/diagram/engine/snake-rule-fit.d.ts.map +1 -0
- package/dist/diagram/engine/style-label.d.ts +24 -0
- package/dist/diagram/engine/style-label.d.ts.map +1 -0
- package/dist/diagram/engine/text-fit.d.ts +61 -0
- package/dist/diagram/engine/text-fit.d.ts.map +1 -0
- package/dist/diagram/engine/text-grow.d.ts +33 -0
- package/dist/diagram/engine/text-grow.d.ts.map +1 -0
- package/dist/diagram/engine/text-measure.d.ts +77 -0
- package/dist/diagram/engine/text-measure.d.ts.map +1 -0
- package/dist/diagram/hierarchy/index.d.ts +5 -0
- package/dist/diagram/hierarchy/index.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-axis-pitch.d.ts +65 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-axis-pitch.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-axis-swap-orientation.d.ts +68 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-axis-swap-orientation.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-branch-mode.d.ts +54 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-branch-mode.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-cascade.d.ts +58 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-cascade.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-centered-fan-axis.d.ts +63 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-centered-fan-axis.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-child-order.d.ts +41 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-child-order.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-composite-child.d.ts +129 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-composite-child.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-constraint-lookup.d.ts +76 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-constraint-lookup.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-corner-plan.d.ts +49 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-corner-plan.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-dispatch-lindir.d.ts +58 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-dispatch-lindir.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fan-aware-width.d.ts +48 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fan-aware-width.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fan.d.ts +97 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fan.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fanned-hang-geometry.d.ts +42 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fanned-hang-geometry.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fanned-hang.d.ts +74 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fanned-hang.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fit-item-box.d.ts +111 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fit-item-box.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fold-depth.d.ts +44 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-fold-depth.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-generation-gap.d.ts +60 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-generation-gap.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-generation-templates.d.ts +106 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-generation-templates.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hang-depth.d.ts +133 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hang-depth.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hang-dispatch.d.ts +28 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hang-dispatch.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hanging-arrange.d.ts +28 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hanging-arrange.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hanging-box.d.ts +86 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hanging-box.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hanging-fold.d.ts +36 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hanging-fold.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hanging.d.ts +118 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-hanging.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-item-template.d.ts +64 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-item-template.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-orgchart-tree.d.ts +53 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-orgchart-tree.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-orientation-resolve.d.ts +36 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-orientation-resolve.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-orientation-types.d.ts +81 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-orientation-types.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-orientation.d.ts +78 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-orientation.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-pitch.d.ts +140 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-pitch.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-shared.d.ts +131 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-shared.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-standard-options.d.ts +91 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-standard-options.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-standard-rows.d.ts +21 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-standard-rows.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-standard.d.ts +36 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-standard.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-tailed-placer.d.ts +20 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-tailed-placer.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-tailed-transpose.d.ts +50 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-tailed-transpose.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-transpose.d.ts +23 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-transpose.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-transposed-orientation.d.ts +22 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-transposed-orientation.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-wrapped-groups.d.ts +93 -0
- package/dist/diagram/hierarchy/smartart-hierarchy-wrapped-groups.d.ts.map +1 -0
- package/dist/diagram/hierarchy/smartart-layout-interpreter-hierarchy.d.ts +49 -0
- package/dist/diagram/hierarchy/smartart-layout-interpreter-hierarchy.d.ts.map +1 -0
- package/dist/diagram/index.cjs +22537 -80
- package/dist/diagram/index.d.ts +4 -0
- package/dist/diagram/index.d.ts.map +1 -1
- package/dist/diagram/index.mjs +22453 -81
- package/dist/diagram/layout/index.d.ts +38 -0
- package/dist/diagram/layout/index.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-choose-xml.d.ts +32 -0
- package/dist/diagram/layout/smartart-choose-xml.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-constraint-branch-index.d.ts +49 -0
- package/dist/diagram/layout/smartart-constraint-branch-index.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-constraint-declared-by.d.ts +64 -0
- package/dist/diagram/layout/smartart-constraint-declared-by.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-constraint-ratio-fallback.d.ts +18 -0
- package/dist/diagram/layout/smartart-constraint-ratio-fallback.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-constraint-resolve.d.ts +24 -0
- package/dist/diagram/layout/smartart-constraint-resolve.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-constraint-rules.d.ts +26 -0
- package/dist/diagram/layout/smartart-constraint-rules.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-constraint-sibling-roles.d.ts +100 -0
- package/dist/diagram/layout/smartart-constraint-sibling-roles.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-constraint-solver.d.ts +133 -0
- package/dist/diagram/layout/smartart-constraint-solver.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-constraint-values.d.ts +5 -0
- package/dist/diagram/layout/smartart-constraint-values.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-font-table.d.ts +14 -0
- package/dist/diagram/layout/smartart-font-table.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-interpreter-fold-text.d.ts +75 -0
- package/dist/diagram/layout/smartart-interpreter-fold-text.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-control-flow.d.ts +25 -0
- package/dist/diagram/layout/smartart-layout-control-flow.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-arranged-selection.d.ts +56 -0
- package/dist/diagram/layout/smartart-layout-interpreter-arranged-selection.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-arrangement-kind.d.ts +37 -0
- package/dist/diagram/layout/smartart-layout-interpreter-arrangement-kind.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-aux.d.ts +66 -0
- package/dist/diagram/layout/smartart-layout-interpreter-aux.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-axis-count.d.ts +128 -0
- package/dist/diagram/layout/smartart-layout-interpreter-axis-count.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-axis-depth.d.ts +73 -0
- package/dist/diagram/layout/smartart-layout-interpreter-axis-depth.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-axis-hop.d.ts +48 -0
- package/dist/diagram/layout/smartart-layout-interpreter-axis-hop.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-axis-range.d.ts +19 -0
- package/dist/diagram/layout/smartart-layout-interpreter-axis-range.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-choose-algorithm.d.ts +60 -0
- package/dist/diagram/layout/smartart-layout-interpreter-choose-algorithm.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-choose-branch.d.ts +36 -0
- package/dist/diagram/layout/smartart-layout-interpreter-choose-branch.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-choose-composite.d.ts +42 -0
- package/dist/diagram/layout/smartart-layout-interpreter-choose-composite.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-choose-depth.d.ts +102 -0
- package/dist/diagram/layout/smartart-layout-interpreter-choose-depth.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-choose-resolve.d.ts +32 -0
- package/dist/diagram/layout/smartart-layout-interpreter-choose-resolve.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-alternative.d.ts +33 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-alternative.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-anchor.d.ts +95 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-anchor.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-aspect.d.ts +84 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-aspect.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-candidates.d.ts +60 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-candidates.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-children.d.ts +86 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-children.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-choose-groups.d.ts +44 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-choose-groups.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-choose.d.ts +109 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-choose.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-detect.d.ts +182 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-detect.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-fontfit.d.ts +60 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-fontfit.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-foreach.d.ts +36 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-foreach.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-group-slots.d.ts +92 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-group-slots.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-iteration.d.ts +45 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-iteration.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-nested-cycle.d.ts +57 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-nested-cycle.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-order-fallback.d.ts +24 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-order-fallback.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-order.d.ts +41 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-order.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-pairs.d.ts +34 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-pairs.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-render.d.ts +29 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-render.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-ring.d.ts +40 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-ring.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-slot-dim.d.ts +22 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-slot-dim.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-slots.d.ts +69 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite-slots.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite.d.ts +56 -0
- package/dist/diagram/layout/smartart-layout-interpreter-composite.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-conn-path.d.ts +42 -0
- package/dist/diagram/layout/smartart-layout-interpreter-conn-path.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-connector-order.d.ts +23 -0
- package/dist/diagram/layout/smartart-layout-interpreter-connector-order.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-constraints.d.ts +28 -0
- package/dist/diagram/layout/smartart-layout-interpreter-constraints.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-custom.d.ts +31 -0
- package/dist/diagram/layout/smartart-layout-interpreter-custom.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-boxes.d.ts +36 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-boxes.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-connectors.d.ts +21 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-connectors.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-constraints.d.ts +116 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-constraints.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-extension.d.ts +110 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-extension.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-fontfit.d.ts +50 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-fontfit.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-hub-detect.d.ts +66 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-hub-detect.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-hub-ratio-usersize.d.ts +81 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-hub-ratio-usersize.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-hub-ratio.d.ts +109 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-hub-ratio.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-item-aspect.d.ts +121 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-item-aspect.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-item-node.d.ts +57 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-item-node.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-ring-bulge.d.ts +34 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-ring-bulge.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-ring-item.d.ts +39 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-ring-item.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-ring-nested-hub.d.ts +22 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-ring-nested-hub.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-ring-offset.d.ts +43 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-ring-offset.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-ring.d.ts +76 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-ring.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-sibtrans.d.ts +40 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle-sibtrans.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle.d.ts +69 -0
- package/dist/diagram/layout/smartart-layout-interpreter-cycle.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-dispatch.d.ts +18 -0
- package/dist/diagram/layout/smartart-layout-interpreter-dispatch.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-flow-direction.d.ts +29 -0
- package/dist/diagram/layout/smartart-layout-interpreter-flow-direction.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-flow.d.ts +49 -0
- package/dist/diagram/layout/smartart-layout-interpreter-flow.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-hierarchy-descendant.d.ts +60 -0
- package/dist/diagram/layout/smartart-layout-interpreter-hierarchy-descendant.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-hierarchy-fontfit.d.ts +45 -0
- package/dist/diagram/layout/smartart-layout-interpreter-hierarchy-fontfit.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-hub-detect.d.ts +26 -0
- package/dist/diagram/layout/smartart-layout-interpreter-hub-detect.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-hub.d.ts +62 -0
- package/dist/diagram/layout/smartart-layout-interpreter-hub.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-compound.d.ts +36 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-compound.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-orientation.d.ts +80 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-orientation.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-shared.d.ts +102 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-shared.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-stack-columns.d.ts +23 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-stack-columns.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-stack-fields.d.ts +77 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-stack-fields.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-stack-rect.d.ts +20 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-stack-rect.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-stack.d.ts +53 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-stack.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-transition.d.ts +50 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-role-transition.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-roles-recursive.d.ts +87 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-roles-recursive.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-roles-unwrap.d.ts +57 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-roles-unwrap.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-roles.d.ts +109 -0
- package/dist/diagram/layout/smartart-layout-interpreter-item-roles.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear-content-size.d.ts +42 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear-content-size.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear-item-aspect.d.ts +94 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear-item-aspect.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear-main-axis.d.ts +17 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear-main-axis.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear-shared.d.ts +21 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear-shared.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear-table.d.ts +76 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear-table.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear.d.ts +20 -0
- package/dist/diagram/layout/smartart-layout-interpreter-linear.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-model.d.ts +77 -0
- package/dist/diagram/layout/smartart-layout-interpreter-model.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-named-rules.d.ts +93 -0
- package/dist/diagram/layout/smartart-layout-interpreter-named-rules.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-position-family.d.ts +58 -0
- package/dist/diagram/layout/smartart-layout-interpreter-position-family.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-preset-node.d.ts +61 -0
- package/dist/diagram/layout/smartart-layout-interpreter-preset-node.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-presof-choose.d.ts +29 -0
- package/dist/diagram/layout/smartart-layout-interpreter-presof-choose.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-pyramid-bands.d.ts +41 -0
- package/dist/diagram/layout/smartart-layout-interpreter-pyramid-bands.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-pyramid.d.ts +100 -0
- package/dist/diagram/layout/smartart-layout-interpreter-pyramid.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-render.d.ts +86 -0
- package/dist/diagram/layout/smartart-layout-interpreter-render.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-snake.d.ts +18 -0
- package/dist/diagram/layout/smartart-layout-interpreter-snake.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-tree-location.d.ts +28 -0
- package/dist/diagram/layout/smartart-layout-interpreter-tree-location.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-when-numeric.d.ts +15 -0
- package/dist/diagram/layout/smartart-layout-interpreter-when-numeric.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-when-var.d.ts +12 -0
- package/dist/diagram/layout/smartart-layout-interpreter-when-var.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter-when.d.ts +69 -0
- package/dist/diagram/layout/smartart-layout-interpreter-when.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-interpreter.d.ts +80 -0
- package/dist/diagram/layout/smartart-layout-interpreter.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-item-font-role.d.ts +80 -0
- package/dist/diagram/layout/smartart-layout-item-font-role.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-item-font-size.d.ts +129 -0
- package/dist/diagram/layout/smartart-layout-item-font-size.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-item-font-tier-fit.d.ts +70 -0
- package/dist/diagram/layout/smartart-layout-item-font-tier-fit.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-item-font-tier.d.ts +139 -0
- package/dist/diagram/layout/smartart-layout-item-font-tier.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-item-tx-anchor.d.ts +105 -0
- package/dist/diagram/layout/smartart-layout-item-tx-anchor.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-shape-polygon.d.ts +17 -0
- package/dist/diagram/layout/smartart-layout-shape-polygon.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-shape-preset.d.ts +127 -0
- package/dist/diagram/layout/smartart-layout-shape-preset.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-snake-grid.d.ts +43 -0
- package/dist/diagram/layout/smartart-layout-snake-grid.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-style-helpers.d.ts +84 -0
- package/dist/diagram/layout/smartart-layout-style-helpers.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-layout-types.d.ts +253 -0
- package/dist/diagram/layout/smartart-layout-types.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-line-pitch.d.ts +29 -0
- package/dist/diagram/layout/smartart-line-pitch.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-node-role-colors.d.ts +30 -0
- package/dist/diagram/layout/smartart-node-role-colors.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-node-tree-axis.d.ts +91 -0
- package/dist/diagram/layout/smartart-node-tree-axis.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-text-wrap-fit.d.ts +84 -0
- package/dist/diagram/layout/smartart-text-wrap-fit.d.ts.map +1 -0
- package/dist/diagram/layout/smartart-tree.d.ts +33 -0
- package/dist/diagram/layout/smartart-tree.d.ts.map +1 -0
- package/dist/diagram/model/constraint-rules.d.ts +31 -0
- package/dist/diagram/model/constraint-rules.d.ts.map +1 -0
- package/dist/diagram/model/data.d.ts +109 -0
- package/dist/diagram/model/data.d.ts.map +1 -0
- package/dist/diagram/model/index.d.ts +7 -0
- package/dist/diagram/model/index.d.ts.map +1 -0
- package/dist/diagram/model/layout-definition.d.ts +276 -0
- package/dist/diagram/model/layout-definition.d.ts.map +1 -0
- package/dist/diagram/model/layout-primitives.d.ts +82 -0
- package/dist/diagram/model/layout-primitives.d.ts.map +1 -0
- package/dist/diagram/model/node.d.ts +194 -0
- package/dist/diagram/model/node.d.ts.map +1 -0
- package/dist/diagram/model/style-definition.d.ts +131 -0
- package/dist/diagram/model/style-definition.d.ts.map +1 -0
- package/dist/docx/chart-paint.d.ts +14 -0
- package/dist/docx/chart-paint.d.ts.map +1 -0
- package/dist/docx/chart.d.ts +43 -0
- package/dist/docx/chart.d.ts.map +1 -0
- package/dist/docx/drawing.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +1393 -326
- package/dist/docx/embedded.mjs +1393 -326
- package/dist/docx/index.cjs +4042 -683
- package/dist/docx/index.d.ts +2 -0
- package/dist/docx/index.d.ts.map +1 -1
- package/dist/docx/index.mjs +4038 -684
- package/dist/docx/inline-model.d.ts +3 -0
- package/dist/docx/inline-model.d.ts.map +1 -1
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +2672 -88
- package/dist/docx/layout/index.mjs +2673 -89
- package/dist/docx/layout/input.d.ts +5 -0
- package/dist/docx/layout/input.d.ts.map +1 -1
- package/dist/docx/load/index.cjs +1616 -549
- package/dist/docx/load/index.mjs +1616 -549
- package/dist/docx/parse.d.ts.map +1 -1
- package/dist/docx/ui/chart-spec.d.ts +10 -0
- package/dist/docx/ui/chart-spec.d.ts.map +1 -0
- package/dist/docx/ui/index.cjs +2600 -186
- package/dist/docx/ui/index.d.ts +1 -0
- package/dist/docx/ui/index.d.ts.map +1 -1
- package/dist/docx/ui/index.mjs +2599 -188
- package/dist/docx/ui/inline-content-schema.d.ts.map +1 -1
- package/dist/docx/ui/run-adapter.d.ts.map +1 -1
- package/dist/drawingml/write-line.d.ts +7 -0
- package/dist/drawingml/write-line.d.ts.map +1 -0
- package/dist/geometry/ooxml-arc.d.ts +31 -0
- package/dist/geometry/ooxml-arc.d.ts.map +1 -0
- package/dist/geometry/preset-shape-evaluator.d.ts +73 -0
- package/dist/geometry/preset-shape-evaluator.d.ts.map +1 -0
- package/dist/index.cjs +34835 -18367
- package/dist/index.mjs +34831 -18367
- package/dist/opc/embedded-packages.d.ts +11 -0
- package/dist/opc/embedded-packages.d.ts.map +1 -0
- package/dist/opc/index.cjs +365 -70
- package/dist/opc/index.d.ts +1 -0
- package/dist/opc/index.d.ts.map +1 -1
- package/dist/opc/index.mjs +353 -71
- package/dist/opc/properties/app.d.ts +9 -3
- package/dist/opc/properties/app.d.ts.map +1 -1
- package/dist/opc/properties/core.d.ts +5 -1
- package/dist/opc/properties/core.d.ts.map +1 -1
- package/dist/opc/properties/custom.d.ts +19 -0
- package/dist/opc/properties/custom.d.ts.map +1 -1
- package/dist/opc/properties/index.d.ts +6 -3
- package/dist/opc/properties/index.d.ts.map +1 -1
- package/dist/opc/properties/patch.d.ts +38 -0
- package/dist/opc/properties/patch.d.ts.map +1 -0
- package/dist/opc/properties/title-groups.d.ts +30 -0
- package/dist/opc/properties/title-groups.d.ts.map +1 -0
- package/dist/opc/properties/types.d.ts +15 -0
- package/dist/opc/properties/types.d.ts.map +1 -1
- package/dist/pptx/automation/index.cjs +9023 -7151
- package/dist/pptx/automation/index.d.ts +4 -4
- package/dist/pptx/automation/index.mjs +6 -6
- package/dist/pptx/chunks/{index-BYkdcS8J.d.ts → index-EZJZ7USt.d.ts} +907 -962
- package/dist/pptx/chunks/index-EZJZ7USt.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-BHqL5KXH.d.ts → index-JNv7AJx5.d.ts} +163 -210
- package/dist/pptx/chunks/index-JNv7AJx5.d.ts.map +1 -0
- package/dist/pptx/chunks/{smart-art-CO2jmJFf.d.ts → smart-art-Q2kZQtHh.d.ts} +436 -374
- package/dist/pptx/chunks/smart-art-Q2kZQtHh.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-DEJ7alZR.d.ts → text-operations-DtCxXrMh.d.ts} +55 -4
- package/dist/pptx/chunks/text-operations-DtCxXrMh.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +8702 -6830
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +5 -5
- package/dist/pptx/converter/index.cjs +7124 -7136
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +3 -3
- package/dist/pptx/editor/render/table-cell-edit.cjs +7 -3
- package/dist/pptx/editor/render/table-cell-edit.d.ts +16 -1
- package/dist/pptx/editor/render/table-cell-edit.d.ts.map +1 -1
- package/dist/pptx/editor/render/table-cell-edit.mjs +1 -1
- package/dist/pptx/editor/render/table-cell-merge.cjs +3 -3
- package/dist/pptx/editor/render/table-cell-merge.mjs +1 -1
- package/dist/pptx/editor/render/table-data-grid-ops.cjs +7 -7
- package/dist/pptx/editor/render/table-data-grid-ops.mjs +2 -2
- package/dist/pptx/editor/render/table-layout.cjs +6 -6
- package/dist/pptx/editor/render/table-layout.d.ts.map +1 -1
- package/dist/pptx/editor/render/table-layout.mjs +1 -1
- package/dist/pptx/editor/render/table-merge.cjs +5 -5
- package/dist/pptx/editor/render/table-merge.mjs +1 -1
- package/dist/pptx/index.cjs +9345 -7304
- package/dist/pptx/index.d.ts +5 -5
- package/dist/pptx/index.mjs +6 -6
- package/dist/pptx/smartart-layouts/index.cjs +135 -106
- package/dist/pptx/smartart-layouts/index.d.ts +1 -1
- package/dist/pptx/smartart-layouts/index.mjs +1 -1
- package/dist/teams/content.d.ts.map +1 -1
- package/dist/teams/index.cjs +3778 -1999
- package/dist/teams/index.d.ts +1 -0
- package/dist/teams/index.d.ts.map +1 -1
- package/dist/teams/index.mjs +3777 -1999
- package/dist/teams/server-file-storage.d.ts +11 -0
- package/dist/teams/server-file-storage.d.ts.map +1 -0
- package/dist/teams/store.d.ts +2 -0
- package/dist/teams/store.d.ts.map +1 -1
- package/dist/teams/stored-file.d.ts.map +1 -1
- package/dist/{xlsx/layout/font-family.d.ts → text/css-font-family.d.ts} +1 -1
- package/dist/text/css-font-family.d.ts.map +1 -0
- package/dist/text/font-metrics/font-advance-widths-aptos-display.generated.d.ts +10 -0
- package/dist/text/font-metrics/font-advance-widths-aptos-display.generated.d.ts.map +1 -0
- package/dist/text/font-metrics/font-advance-widths-aptos.generated.d.ts +10 -0
- package/dist/text/font-metrics/font-advance-widths-aptos.generated.d.ts.map +1 -0
- package/dist/text/font-metrics/font-advance-widths-arial.generated.d.ts +10 -0
- package/dist/text/font-metrics/font-advance-widths-arial.generated.d.ts.map +1 -0
- package/dist/text/font-metrics/font-advance-widths-calibri-light.generated.d.ts +10 -0
- package/dist/text/font-metrics/font-advance-widths-calibri-light.generated.d.ts.map +1 -0
- package/dist/text/font-metrics/font-advance-widths-calibri.generated.d.ts +10 -0
- package/dist/text/font-metrics/font-advance-widths-calibri.generated.d.ts.map +1 -0
- package/dist/text/font-metrics/font-advance-widths-segoe-ui.generated.d.ts +10 -0
- package/dist/text/font-metrics/font-advance-widths-segoe-ui.generated.d.ts.map +1 -0
- package/dist/text/font-metrics/font-advance-widths-times-new-roman.generated.d.ts +10 -0
- package/dist/text/font-metrics/font-advance-widths-times-new-roman.generated.d.ts.map +1 -0
- package/dist/text/font-metrics/font-advance-widths.generated.d.ts +48 -0
- package/dist/text/font-metrics/font-advance-widths.generated.d.ts.map +1 -0
- package/dist/text/font-metrics/font-kerning.d.ts +19 -0
- package/dist/text/font-metrics/font-kerning.d.ts.map +1 -0
- package/dist/visio/index.cjs +645 -119
- package/dist/visio/index.mjs +645 -119
- package/dist/visio/theme-color.d.ts +13 -3
- package/dist/visio/theme-color.d.ts.map +1 -1
- package/dist/visio/theme-resolve.d.ts +2 -1
- package/dist/visio/theme-resolve.d.ts.map +1 -1
- package/dist/visio/theme.d.ts +5 -2
- package/dist/visio/theme.d.ts.map +1 -1
- package/dist/xlsx/collab/adapter.d.ts +18 -0
- package/dist/xlsx/collab/adapter.d.ts.map +1 -0
- package/dist/xlsx/collab/apply.d.ts +8 -0
- package/dist/xlsx/collab/apply.d.ts.map +1 -0
- package/dist/xlsx/collab/bind.d.ts +34 -0
- package/dist/xlsx/collab/bind.d.ts.map +1 -0
- package/dist/xlsx/collab/codec.d.ts +35 -0
- package/dist/xlsx/collab/codec.d.ts.map +1 -0
- package/dist/xlsx/collab/dirty.d.ts +23 -0
- package/dist/xlsx/collab/dirty.d.ts.map +1 -0
- package/dist/xlsx/collab/index.cjs +1245 -0
- package/dist/xlsx/collab/index.d.ts +10 -0
- package/dist/xlsx/collab/index.d.ts.map +1 -0
- package/dist/xlsx/collab/index.mjs +1207 -0
- package/dist/xlsx/collab/lines.d.ts +22 -0
- package/dist/xlsx/collab/lines.d.ts.map +1 -0
- package/dist/xlsx/collab/names.d.ts +16 -0
- package/dist/xlsx/collab/names.d.ts.map +1 -0
- package/dist/xlsx/collab/presence.d.ts +31 -0
- package/dist/xlsx/collab/presence.d.ts.map +1 -0
- package/dist/xlsx/collab/schema.d.ts +30 -0
- package/dist/xlsx/collab/schema.d.ts.map +1 -0
- package/dist/xlsx/collab/sheets.d.ts +34 -0
- package/dist/xlsx/collab/sheets.d.ts.map +1 -0
- package/dist/xlsx/collab/styles.d.ts +26 -0
- package/dist/xlsx/collab/styles.d.ts.map +1 -0
- package/dist/xlsx/collab/write.d.ts +14 -0
- package/dist/xlsx/collab/write.d.ts.map +1 -0
- package/dist/xlsx/edit/chart-colors.d.ts +2 -2
- package/dist/xlsx/edit/chart-colors.d.ts.map +1 -1
- package/dist/xlsx/edit/chart-element-fill.d.ts +3 -3
- package/dist/xlsx/edit/chart-element-fill.d.ts.map +1 -1
- package/dist/xlsx/edit/chart-series-fill.d.ts +2 -2
- package/dist/xlsx/edit/chart-series-fill.d.ts.map +1 -1
- package/dist/xlsx/edit/chart-series-gradient.d.ts +3 -3
- package/dist/xlsx/edit/chart-series-gradient.d.ts.map +1 -1
- package/dist/xlsx/edit/chart-series-target.d.ts +15 -0
- package/dist/xlsx/edit/chart-series-target.d.ts.map +1 -0
- package/dist/xlsx/edit/chart-series-transparency.d.ts +2 -2
- package/dist/xlsx/edit/chart-series-transparency.d.ts.map +1 -1
- package/dist/xlsx/edit/external.d.ts +28 -0
- package/dist/xlsx/edit/external.d.ts.map +1 -0
- package/dist/xlsx/edit/index.d.ts +1 -0
- package/dist/xlsx/edit/index.d.ts.map +1 -1
- package/dist/xlsx/edit/session-calc.d.ts +7 -0
- package/dist/xlsx/edit/session-calc.d.ts.map +1 -1
- package/dist/xlsx/edit/session.d.ts.map +1 -1
- package/dist/xlsx/edit/types.d.ts +14 -1
- package/dist/xlsx/edit/types.d.ts.map +1 -1
- package/dist/xlsx/formula/engine.d.ts.map +1 -1
- package/dist/xlsx/formula/lexemes.d.ts +6 -0
- package/dist/xlsx/formula/lexemes.d.ts.map +1 -1
- package/dist/xlsx/formula/tokenizer.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +4599 -2399
- package/dist/xlsx/index.mjs +4589 -2400
- package/dist/xlsx/layout/cell-view.d.ts.map +1 -1
- package/dist/xlsx/layout/chart-view.d.ts +3 -54
- package/dist/xlsx/layout/chart-view.d.ts.map +1 -1
- package/dist/xlsx/layout/colors.d.ts +1 -4
- package/dist/xlsx/layout/colors.d.ts.map +1 -1
- package/dist/xlsx/layout/index.d.ts +7 -4
- package/dist/xlsx/layout/index.d.ts.map +1 -1
- package/dist/xlsx/layout/remote-selections.d.ts +40 -0
- package/dist/xlsx/layout/remote-selections.d.ts.map +1 -0
- package/dist/xlsx/layout/sparkline-data.d.ts +19 -0
- package/dist/xlsx/layout/sparkline-data.d.ts.map +1 -0
- package/dist/xlsx/layout/sparkline-view.d.ts +52 -0
- package/dist/xlsx/layout/sparkline-view.d.ts.map +1 -0
- package/dist/xlsx/layout/tint.d.ts +3 -12
- package/dist/xlsx/layout/tint.d.ts.map +1 -1
- package/dist/xlsx/layout/types.d.ts +3 -0
- package/dist/xlsx/layout/types.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +3036 -1286
- package/dist/xlsx/load/index.mjs +3036 -1286
- package/dist/xlsx/model-sparklines.d.ts +52 -0
- package/dist/xlsx/model-sparklines.d.ts.map +1 -0
- package/dist/xlsx/model.d.ts +10 -47
- package/dist/xlsx/model.d.ts.map +1 -1
- package/dist/xlsx/read/chart.d.ts +1 -4
- package/dist/xlsx/read/chart.d.ts.map +1 -1
- package/dist/xlsx/read/index.d.ts +1 -0
- package/dist/xlsx/read/index.d.ts.map +1 -1
- package/dist/xlsx/read/sheet-data-source.d.ts +10 -0
- package/dist/xlsx/read/sheet-data-source.d.ts.map +1 -0
- package/dist/xlsx/read/sparklines.d.ts +12 -0
- package/dist/xlsx/read/sparklines.d.ts.map +1 -0
- package/dist/xlsx/read/worksheet.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
- package/dist/xlsx/ui/context.d.ts +15 -1
- package/dist/xlsx/ui/context.d.ts.map +1 -1
- package/dist/xlsx/ui/grid/cell-items.d.ts.map +1 -1
- package/dist/xlsx/ui/grid/cell-paint.d.ts +1 -1
- package/dist/xlsx/ui/grid/cell-paint.d.ts.map +1 -1
- package/dist/xlsx/ui/grid/view-cache.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +1127 -559
- package/dist/xlsx/ui/index.mjs +1127 -560
- package/dist/xlsx/ui/locales/de/collab.d.ts +2 -0
- package/dist/xlsx/ui/locales/de/collab.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/de/index.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/en/collab.d.ts +2 -0
- package/dist/xlsx/ui/locales/en/collab.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/en/index.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/es/collab.d.ts +2 -0
- package/dist/xlsx/ui/locales/es/collab.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/es/index.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/fr/collab.d.ts +2 -0
- package/dist/xlsx/ui/locales/fr/collab.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/fr/index.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/zh-CN/collab.d.ts +2 -0
- package/dist/xlsx/ui/locales/zh-CN/collab.d.ts.map +1 -0
- package/dist/xlsx/ui/locales/zh-CN/index.d.ts.map +1 -1
- package/dist/xlsx/ui/ribbon/icon-paths.d.ts.map +1 -1
- package/dist/xlsx/write/chart-colors.d.ts +3 -0
- package/dist/xlsx/write/chart-colors.d.ts.map +1 -1
- package/dist/xlsx/write/chart-space.d.ts +5 -0
- package/dist/xlsx/write/chart-space.d.ts.map +1 -0
- package/dist/xlsx/write/chart-title.d.ts +4 -1
- package/dist/xlsx/write/chart-title.d.ts.map +1 -1
- package/dist/xlsx/write/chart.d.ts +4 -1
- package/dist/xlsx/write/chart.d.ts.map +1 -1
- package/dist/xml/index.cjs +162 -0
- package/dist/xml/index.d.ts +1 -0
- package/dist/xml/index.d.ts.map +1 -1
- package/dist/xml/index.mjs +161 -1
- package/dist/xml/lite.d.ts +30 -0
- package/dist/xml/lite.d.ts.map +1 -0
- package/package.json +6 -1
- package/dist/pptx/chunks/index-BHqL5KXH.d.ts.map +0 -1
- package/dist/pptx/chunks/index-BYkdcS8J.d.ts.map +0 -1
- package/dist/pptx/chunks/smart-art-CO2jmJFf.d.ts.map +0 -1
- package/dist/pptx/chunks/text-operations-DEJ7alZR.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-appearance.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-colors.d.ts +0 -9
- package/dist/xlsx/layout/chart-colors.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-scale.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-spacing.d.ts +0 -6
- package/dist/xlsx/layout/chart-spacing.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-appearance.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-bars.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-cartesian.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-legend.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-radial.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-text-metrics.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-title-text.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg-util.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-svg.d.ts.map +0 -1
- package/dist/xlsx/layout/chart-title-text.d.ts +0 -14
- package/dist/xlsx/layout/chart-title-text.d.ts.map +0 -1
- package/dist/xlsx/layout/font-family.d.ts.map +0 -1
- /package/dist/{xlsx/layout → chart/render}/chart-scale.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-bars.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-cartesian.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-legend.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-radial.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-text-metrics.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-title-text.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg-util.d.ts +0 -0
- /package/dist/{xlsx/layout → chart/render}/chart-svg.d.ts +0 -0
package/dist/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,1960 @@ 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
|
+
function clusteredBarGeometry(barGroupWidth, seriesCount, chartData) {
|
|
3628
|
+
const overlap = chartData.barOverlap ?? 0;
|
|
3629
|
+
const overlapSpan = 1 + (seriesCount - 1) * (1 - overlap / 100);
|
|
3630
|
+
const singleBarWidth = chartData.barGapWidth !== void 0 ? barGroupWidth / (overlapSpan + Math.max(chartData.barGapWidth, 0) / 100) : barGroupWidth * 0.7 / seriesCount;
|
|
3631
|
+
const step = singleBarWidth * (1 - overlap / 100);
|
|
3632
|
+
return { singleBarWidth, step, clusterWidth: singleBarWidth + step * (seriesCount - 1) };
|
|
3633
|
+
}
|
|
3634
|
+
|
|
3635
|
+
// chart/data-cache.ts
|
|
3636
|
+
function chartCacheValues(cache) {
|
|
3637
|
+
if (!cache) return [];
|
|
3638
|
+
const numeric = cache.type === "number";
|
|
3639
|
+
const out = [];
|
|
3640
|
+
for (const point of cache.points) {
|
|
3641
|
+
const text2 = point.value;
|
|
3642
|
+
out[point.index ?? out.length] = numeric && text2.trim() !== "" && Number.isFinite(Number(text2)) ? Number(text2) : text2;
|
|
3643
|
+
}
|
|
3644
|
+
const size = Math.max(cache.pointCount ?? 0, out.length);
|
|
3645
|
+
for (let index = 0; index < size; index++) if (out[index] === void 0) out[index] = "";
|
|
3646
|
+
return out;
|
|
3647
|
+
}
|
|
3648
|
+
var chartSourceValues = (source) => chartCacheValues(source?.cache ?? source?.levels?.[0]);
|
|
3649
|
+
|
|
3650
|
+
// chart/render/summary-from-space.ts
|
|
3651
|
+
var solidColor = (fill) => fill?.kind === "solid" ? fill.color : void 0;
|
|
3652
|
+
var isSolidFill = (fill) => fill?.kind === "solid" || fill?.kind === "unsupported" && fill.element === "solidFill";
|
|
3653
|
+
var GROUP_TYPES = {
|
|
3654
|
+
bar: "bar",
|
|
3655
|
+
line: "line",
|
|
3656
|
+
area: "area",
|
|
3657
|
+
pie: "pie",
|
|
3658
|
+
ofPie: "pie",
|
|
3659
|
+
doughnut: "doughnut",
|
|
3660
|
+
scatter: "scatter",
|
|
3661
|
+
radar: "radar",
|
|
3662
|
+
bubble: "bubble",
|
|
3663
|
+
stock: "stock",
|
|
3664
|
+
surface: "surface"
|
|
3665
|
+
};
|
|
3666
|
+
var GROUPINGS = /* @__PURE__ */ new Set(["clustered", "stacked", "percentStacked", "standard"]);
|
|
3667
|
+
function chartSummarySeries(source, chartType) {
|
|
3668
|
+
const categories = source.categories ?? source.xValues;
|
|
3669
|
+
const values = source.values ?? source.yValues;
|
|
3670
|
+
const out = {
|
|
3671
|
+
categories: chartSourceValues(categories),
|
|
3672
|
+
values: chartSourceValues(values).map(
|
|
3673
|
+
(v) => typeof v === "number" ? v : v === "" ? null : Number.isFinite(Number(v)) ? Number(v) : null
|
|
3674
|
+
)
|
|
3675
|
+
};
|
|
3676
|
+
if (source.tx?.text !== void 0) out.name = source.tx.text;
|
|
3677
|
+
const nameRef = source.tx?.reference?.formula;
|
|
3678
|
+
if (nameRef) out.nameRef = nameRef;
|
|
3679
|
+
if (categories?.formula) out.categoriesRef = categories.formula;
|
|
3680
|
+
if (values?.formula) out.valuesRef = values.formula;
|
|
3681
|
+
if (source.spPr?.effectsXml) out.effectsXml = source.spPr.effectsXml;
|
|
3682
|
+
const primary = ["line", "scatter", "radar"].includes(chartType) ? source.spPr?.line?.fill : source.spPr?.fill;
|
|
3683
|
+
const fill = chartType === "scatter" && !isSolidFill(primary) ? source.marker?.spPr?.fill : primary;
|
|
3684
|
+
const drawingColor = solidColor(fill);
|
|
3685
|
+
if (drawingColor) out.drawingColor = drawingColor;
|
|
3686
|
+
if (fill && fill.kind !== "solid" && !(chartType === "scatter" && fill.kind === "none"))
|
|
3687
|
+
out.fill = fill;
|
|
3688
|
+
const points = {};
|
|
3689
|
+
const pointFills = {};
|
|
3690
|
+
for (const point of source.dataPoints) {
|
|
3691
|
+
const properties4 = point.spPr ?? point.marker?.spPr;
|
|
3692
|
+
if (point.index === void 0) continue;
|
|
3693
|
+
const pointColor = solidColor(properties4?.fill);
|
|
3694
|
+
if (pointColor) points[point.index] = pointColor;
|
|
3695
|
+
if (properties4?.fill && properties4.fill.kind !== "solid")
|
|
3696
|
+
pointFills[point.index] = properties4.fill;
|
|
3697
|
+
}
|
|
3698
|
+
if (Object.keys(points).length) out.pointColors = points;
|
|
3699
|
+
if (Object.keys(pointFills).length) out.pointFills = pointFills;
|
|
3700
|
+
return out;
|
|
3701
|
+
}
|
|
3702
|
+
function chartSummaryFromSpace(chartSpace, extras = {}) {
|
|
3703
|
+
const group = chartSpace.plotArea.groups[0];
|
|
3704
|
+
let chartType = group ? GROUP_TYPES[group.kind] : "column";
|
|
3705
|
+
if (chartType === "bar" && group?.barDirection !== "bar") chartType = "column";
|
|
3706
|
+
const series = (group?.series ?? []).map((source) => chartSummarySeries(source, chartType));
|
|
3707
|
+
const summary = {
|
|
3708
|
+
chartType,
|
|
3709
|
+
series,
|
|
3710
|
+
showLegend: chartSpace.legend !== void 0
|
|
3711
|
+
};
|
|
3712
|
+
const grouping = group?.grouping;
|
|
3713
|
+
if (grouping && GROUPINGS.has(grouping))
|
|
3714
|
+
summary.grouping = grouping;
|
|
3715
|
+
if (chartType === "bar" || chartType === "column") {
|
|
3716
|
+
for (const [value, field, fallback, min, max] of [
|
|
3717
|
+
[group?.gapWidth, "barGapWidth", 150, 0, 500],
|
|
3718
|
+
[group?.overlap, "barOverlap", 0, -100, 100]
|
|
3719
|
+
]) {
|
|
3720
|
+
const resolved = value ?? fallback;
|
|
3721
|
+
if (Number.isInteger(resolved) && resolved >= min && resolved <= max)
|
|
3722
|
+
summary[field] = resolved;
|
|
3723
|
+
}
|
|
3724
|
+
}
|
|
3725
|
+
if (chartSpace.title && chartSpace.autoTitleDeleted !== true) {
|
|
3726
|
+
const title = chartSpace.title.text;
|
|
3727
|
+
if (title !== void 0) summary.title = title;
|
|
3728
|
+
else if (series.length === 1 && series[0]?.name) summary.title = series[0].name;
|
|
3729
|
+
}
|
|
3730
|
+
const legendPos = chartSpace.legend?.position;
|
|
3731
|
+
if (legendPos && ["r", "l", "t", "b", "tr"].includes(legendPos))
|
|
3732
|
+
summary.legendPosition = legendPos;
|
|
3733
|
+
if (extras.formatting) summary.formatting = extras.formatting;
|
|
3734
|
+
if (extras.colorPalette !== void 0) summary.colorPalette = extras.colorPalette;
|
|
3735
|
+
if (extras.styleDefinition) summary.styleDefinition = extras.styleDefinition;
|
|
3736
|
+
return summary;
|
|
3737
|
+
}
|
|
3738
|
+
|
|
3739
|
+
// chart/render/chart-scale.ts
|
|
3740
|
+
var clean = (n2) => Number(n2.toPrecision(12));
|
|
3741
|
+
function* units(raw) {
|
|
3742
|
+
let exp = Math.floor(Math.log10(raw)) - 1;
|
|
3743
|
+
for (; ; ) {
|
|
3744
|
+
const base = 10 ** exp;
|
|
3745
|
+
for (const m of [1, 2, 5]) yield clean(m * base);
|
|
3746
|
+
exp++;
|
|
3747
|
+
}
|
|
3748
|
+
}
|
|
3749
|
+
function niceScale(dataMin, dataMax, options = {}) {
|
|
3750
|
+
const maxIntervals = Math.max(1, options.maxIntervals ?? 10);
|
|
3751
|
+
let lo = Number.isFinite(dataMin) ? dataMin : 0;
|
|
3752
|
+
let hi = Number.isFinite(dataMax) ? dataMax : 0;
|
|
3753
|
+
if (lo > hi) [lo, hi] = [hi, lo];
|
|
3754
|
+
if (lo === hi) {
|
|
3755
|
+
if (lo === 0) hi = 1;
|
|
3756
|
+
else if (options.noZero) {
|
|
3757
|
+
const pad = Math.abs(lo) * 0.1 || 1;
|
|
3758
|
+
lo -= pad;
|
|
3759
|
+
hi += pad;
|
|
3760
|
+
} else if (lo > 0) lo = 0;
|
|
3761
|
+
else hi = 0;
|
|
3762
|
+
}
|
|
3763
|
+
let fixedLo = false;
|
|
3764
|
+
let fixedHi = false;
|
|
3765
|
+
if (!options.noZero) {
|
|
3766
|
+
if (lo >= 0 && hi - lo >= hi / 6) {
|
|
3767
|
+
lo = 0;
|
|
3768
|
+
fixedLo = true;
|
|
3769
|
+
} else if (hi <= 0 && hi - lo >= -lo / 6) {
|
|
3770
|
+
hi = 0;
|
|
3771
|
+
fixedHi = true;
|
|
3772
|
+
}
|
|
3773
|
+
}
|
|
3774
|
+
const range = hi - lo;
|
|
3775
|
+
const top = fixedHi ? hi : hi + range * 0.05;
|
|
3776
|
+
const bottom = fixedLo ? lo : lo - range * 0.05;
|
|
3777
|
+
for (const unit of units(range / maxIntervals)) {
|
|
3778
|
+
const min = fixedLo ? lo : Math.floor(clean(bottom / unit)) * unit;
|
|
3779
|
+
const max = fixedHi ? hi : Math.ceil(clean(top / unit)) * unit;
|
|
3780
|
+
const intervals = Math.round((max - min) / unit);
|
|
3781
|
+
if (intervals <= maxIntervals && intervals > 0) {
|
|
3782
|
+
const ticks = [];
|
|
3783
|
+
for (let i = 0; i <= intervals; i++) ticks.push(clean(min + i * unit));
|
|
3784
|
+
return { min: clean(min), max: clean(max), majorUnit: unit, ticks };
|
|
3785
|
+
}
|
|
3786
|
+
}
|
|
3787
|
+
return { min: lo, max: hi, majorUnit: range, ticks: [lo, hi] };
|
|
3788
|
+
}
|
|
3789
|
+
var PERCENT_SCALE = {
|
|
3790
|
+
min: 0,
|
|
3791
|
+
max: 1,
|
|
3792
|
+
majorUnit: 0.1,
|
|
3793
|
+
ticks: [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]
|
|
3794
|
+
};
|
|
3795
|
+
function formatAxisValue(value, percent = false) {
|
|
3796
|
+
if (percent) return `${clean(value * 100)}%`;
|
|
3797
|
+
const v = clean(value);
|
|
3798
|
+
if (Math.abs(v) >= 1e15 || v !== 0 && Math.abs(v) < 1e-6)
|
|
3799
|
+
return v.toExponential(2).replace("e+", "E+").replace("e-", "E-");
|
|
3800
|
+
const [int = "0", frac] = String(Math.abs(v)).split(".");
|
|
3801
|
+
const grouped = int.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
3802
|
+
return `${v < 0 ? "-" : ""}${grouped}${frac ? `.${frac}` : ""}`;
|
|
3803
|
+
}
|
|
3804
|
+
|
|
3805
|
+
// chart/render/chart-svg-util.ts
|
|
3806
|
+
var TEXT_COLOR = "#595959";
|
|
3807
|
+
var GRID_COLOR = "#D9D9D9";
|
|
3808
|
+
var AXIS_COLOR = "#BFBFBF";
|
|
3809
|
+
var FONT_SIZE = 10;
|
|
3810
|
+
function esc(text2) {
|
|
3811
|
+
return text2.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
3812
|
+
}
|
|
3813
|
+
var n = (value) => String(Math.round(value * 100) / 100);
|
|
3814
|
+
var textWidth = (text2, size = FONT_SIZE) => text2.length * size * 0.55;
|
|
3815
|
+
function text(x, y, content, attrs = {}) {
|
|
3816
|
+
const parts = [`x="${n(x)}"`, `y="${n(y)}"`];
|
|
3817
|
+
parts.push(`font-size="${attrs.size ?? FONT_SIZE}"`);
|
|
3818
|
+
parts.push(`fill="${esc(attrs.fill ?? TEXT_COLOR)}"`);
|
|
3819
|
+
if (attrs.anchor && attrs.anchor !== "start") parts.push(`text-anchor="${attrs.anchor}"`);
|
|
3820
|
+
if (attrs.weight) parts.push(`font-weight="${attrs.weight}"`);
|
|
3821
|
+
if (attrs.baseline) parts.push(`dominant-baseline="${attrs.baseline}"`);
|
|
3822
|
+
if (attrs.family) parts.push(`font-family="${esc(attrs.family)}"`);
|
|
3823
|
+
if (attrs.filter) parts.push(`filter="${esc(attrs.filter)}"`);
|
|
3824
|
+
if (attrs.italic !== void 0) parts.push(`font-style="${attrs.italic ? "italic" : "normal"}"`);
|
|
3825
|
+
if (attrs.underline !== void 0)
|
|
3826
|
+
parts.push(`text-decoration="${attrs.underline ? "underline" : "none"}"`);
|
|
3827
|
+
return `<text ${parts.join(" ")}>${esc(content)}</text>`;
|
|
3828
|
+
}
|
|
3829
|
+
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}"/>`;
|
|
3830
|
+
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)}"` : ""}/>`;
|
|
3831
|
+
function fit(content, maxWidth, size = FONT_SIZE) {
|
|
3832
|
+
if (textWidth(content, size) <= maxWidth) return content;
|
|
3833
|
+
const chars = Math.max(1, Math.floor(maxWidth / (size * 0.55)) - 1);
|
|
3834
|
+
return `${content.slice(0, chars)}\u2026`;
|
|
3835
|
+
}
|
|
3836
|
+
|
|
3837
|
+
// chart/render/theme-palette.ts
|
|
3838
|
+
var THEME_SLOTS = [
|
|
3839
|
+
"lt1",
|
|
3840
|
+
"dk1",
|
|
3841
|
+
"lt2",
|
|
3842
|
+
"dk2",
|
|
3843
|
+
"accent1",
|
|
3844
|
+
"accent2",
|
|
3845
|
+
"accent3",
|
|
3846
|
+
"accent4",
|
|
3847
|
+
"accent5",
|
|
3848
|
+
"accent6",
|
|
3849
|
+
"hlink",
|
|
3850
|
+
"folHlink"
|
|
3851
|
+
];
|
|
3852
|
+
var DEFAULT_THEME_COLORS = [
|
|
3853
|
+
"FFFFFF",
|
|
3854
|
+
"000000",
|
|
3855
|
+
"E7E6E6",
|
|
3856
|
+
"44546A",
|
|
3857
|
+
"4472C4",
|
|
3858
|
+
"ED7D31",
|
|
3859
|
+
"A5A5A5",
|
|
3860
|
+
"FFC000",
|
|
3861
|
+
"5B9BD5",
|
|
3862
|
+
"70AD47",
|
|
3863
|
+
"0563C1",
|
|
3864
|
+
"954F72"
|
|
3865
|
+
];
|
|
3866
|
+
function themeColor(theme, index) {
|
|
3867
|
+
const hex = theme.colors[index] ?? DEFAULT_THEME_COLORS[index];
|
|
3868
|
+
return hex && parseArgbHex(hex) ? hex.replace(/^#/, "") : void 0;
|
|
3869
|
+
}
|
|
3870
|
+
|
|
3871
|
+
// chart/render/chart-colors.ts
|
|
3872
|
+
function chartColorScheme(theme) {
|
|
3873
|
+
const slots = Object.fromEntries(
|
|
3874
|
+
THEME_SLOTS.map((slot, index) => [slot, `#${themeColor(theme, index) ?? "000000"}`])
|
|
3875
|
+
);
|
|
3876
|
+
return {
|
|
3877
|
+
...slots,
|
|
3878
|
+
bg1: slots.lt1,
|
|
3879
|
+
tx1: slots.dk1,
|
|
3880
|
+
bg2: slots.lt2,
|
|
3881
|
+
tx2: slots.dk2
|
|
3882
|
+
};
|
|
3883
|
+
}
|
|
3884
|
+
function autoSeriesColor(theme, index) {
|
|
3885
|
+
const i = Math.max(0, Math.floor(index));
|
|
3886
|
+
return chartPaletteSeriesColor(findChartColorPalette(10), i, i + 1, chartColorScheme(theme));
|
|
3887
|
+
}
|
|
3888
|
+
|
|
3889
|
+
// chart/render/chart-value-axis.ts
|
|
3890
|
+
function valueAxis(model) {
|
|
3891
|
+
const stackable = model.type === "bar" || model.type === "column" || model.type === "line" || model.type === "area";
|
|
3892
|
+
if (stackable && model.grouping === "percentStacked")
|
|
3893
|
+
return { ...PERCENT_SCALE, ticks: [...PERCENT_SCALE.ticks], percent: true };
|
|
3894
|
+
let min = Infinity;
|
|
3895
|
+
let max = -Infinity;
|
|
3896
|
+
if (stackable && model.grouping === "stacked") {
|
|
3897
|
+
for (let i = 0; i < model.categories.length; i++) {
|
|
3898
|
+
let pos = 0;
|
|
3899
|
+
let neg = 0;
|
|
3900
|
+
for (const s of model.series) {
|
|
3901
|
+
const v = s.values[i] ?? 0;
|
|
3902
|
+
if (v >= 0) pos += v;
|
|
3903
|
+
else neg += v;
|
|
3904
|
+
}
|
|
3905
|
+
min = Math.min(min, neg);
|
|
3906
|
+
max = Math.max(max, pos);
|
|
3907
|
+
}
|
|
3908
|
+
} else {
|
|
3909
|
+
for (const s of model.series)
|
|
3910
|
+
for (const v of s.values)
|
|
3911
|
+
if (v !== null) {
|
|
3912
|
+
min = Math.min(min, v);
|
|
3913
|
+
max = Math.max(max, v);
|
|
3914
|
+
}
|
|
3915
|
+
}
|
|
3916
|
+
if (min === Infinity) {
|
|
3917
|
+
min = 0;
|
|
3918
|
+
max = 1;
|
|
3919
|
+
}
|
|
3920
|
+
return { ...niceScale(min, max), percent: false };
|
|
3921
|
+
}
|
|
3922
|
+
function categoryTotals(model) {
|
|
3923
|
+
return model.categories.map(
|
|
3924
|
+
(_, i) => model.series.reduce((sum, s) => sum + Math.abs(s.values[i] ?? 0), 0)
|
|
3925
|
+
);
|
|
3926
|
+
}
|
|
3927
|
+
|
|
3928
|
+
// chart/text-inheritance.ts
|
|
3929
|
+
var TEXT_KEYS = [
|
|
3930
|
+
"fontSize",
|
|
3931
|
+
"bold",
|
|
3932
|
+
"italic",
|
|
3933
|
+
"underline",
|
|
3934
|
+
"typeface",
|
|
3935
|
+
"textColor",
|
|
3936
|
+
"fontRef"
|
|
3937
|
+
];
|
|
3938
|
+
var TEXT_PARTS = [
|
|
3939
|
+
"title",
|
|
3940
|
+
"axisTitle",
|
|
3941
|
+
"categoryAxis",
|
|
3942
|
+
"valueAxis",
|
|
3943
|
+
"legend",
|
|
3944
|
+
"dataLabel"
|
|
3945
|
+
];
|
|
3946
|
+
function inheritChartText(part, entry, builtIn, root) {
|
|
3947
|
+
if (!root || !TEXT_PARTS.includes(part)) return entry;
|
|
3948
|
+
const out = { ...entry };
|
|
3949
|
+
for (const key of TEXT_KEYS) {
|
|
3950
|
+
delete out[key];
|
|
3951
|
+
const value = root[key] ?? builtIn?.[key];
|
|
3952
|
+
if (value !== void 0) Object.assign(out, { [key]: value });
|
|
3953
|
+
}
|
|
3954
|
+
if (part === "title" && root.fontSize !== void 0) out.fontSize = root.fontSize * 1.2;
|
|
3955
|
+
if (root.textEffectsXml !== void 0) out.textEffectsXml = root.textEffectsXml;
|
|
3956
|
+
return out;
|
|
3957
|
+
}
|
|
3958
|
+
|
|
3959
|
+
// chart/render/chart-appearance.ts
|
|
3960
|
+
var chartPointsToPixels = (points) => points * EMU_PER_POINT / EMU_PER_PIXEL;
|
|
3961
|
+
function typeface(entry, theme) {
|
|
3962
|
+
const name = entry.typeface;
|
|
3963
|
+
if (name?.startsWith("+mj-")) return theme.majorFont;
|
|
3964
|
+
if (name?.startsWith("+mn-")) return theme.minorFont;
|
|
3965
|
+
return name ?? (entry.fontRef?.index === "major" ? theme.majorFont : entry.fontRef?.index === "minor" ? theme.minorFont : void 0);
|
|
3966
|
+
}
|
|
3967
|
+
function chartAppearance(chart, theme) {
|
|
3968
|
+
const defaults = builtInChartTextStyle(effectiveBuiltInChartStyle(chart.formatting));
|
|
3969
|
+
const entries = {};
|
|
3970
|
+
for (const part of CHART_STYLE_PARTS) {
|
|
3971
|
+
const base = chart.styleDefinition?.entries[part];
|
|
3972
|
+
const direct = chart.formatting?.entries[part];
|
|
3973
|
+
if (!defaults[part] && !base && !direct) continue;
|
|
3974
|
+
const entry = {
|
|
3975
|
+
...inheritChartText(
|
|
3976
|
+
part,
|
|
3977
|
+
{ ...defaults[part], ...base, sourceXml: base?.sourceXml ?? "" },
|
|
3978
|
+
defaults[part],
|
|
3979
|
+
chart.formatting?.textDefaults
|
|
3980
|
+
),
|
|
3981
|
+
...direct,
|
|
3982
|
+
sourceXml: direct?.sourceXml ?? base?.sourceXml ?? ""
|
|
3983
|
+
};
|
|
3984
|
+
if (base?.line || direct?.line) entry.line = { ...base?.line, ...direct?.line };
|
|
3985
|
+
entries[part] = entry;
|
|
3986
|
+
}
|
|
3987
|
+
const scheme = chartColorScheme(theme);
|
|
3988
|
+
const resolve = (color) => resolveDrawingColor(
|
|
3989
|
+
color,
|
|
3990
|
+
{ scheme: (name) => scheme[name] },
|
|
3991
|
+
{ hslRounding: "halfDown", transformOrder: "document" }
|
|
3992
|
+
);
|
|
3993
|
+
const out = resolveChartStyleDefinition(
|
|
3994
|
+
{ entries},
|
|
3995
|
+
(color) => drawingColorCss(resolve(color))
|
|
3996
|
+
) ?? {};
|
|
3997
|
+
for (const part of CHART_STYLE_PARTS) {
|
|
3998
|
+
const entry = entries[part];
|
|
3999
|
+
if (!entry) continue;
|
|
4000
|
+
const family = typeface(entry, theme);
|
|
4001
|
+
const shadow = resolveDrawingShadowXml(entry.textEffectsXml, {
|
|
4002
|
+
scheme: (name) => scheme[name]
|
|
4003
|
+
});
|
|
4004
|
+
if (shadow) (out[part] ??= {}).textShadow = shadow;
|
|
4005
|
+
if (family) (out[part] ??= {}).typeface = family;
|
|
4006
|
+
if (entry.axisVisible !== void 0) (out[part] ??= {}).axisVisible = entry.axisVisible;
|
|
4007
|
+
if (entry.labelsVisible !== void 0) (out[part] ??= {}).labelsVisible = entry.labelsVisible;
|
|
4008
|
+
if (entry.line?.widthEmu === 0) (out[part] ??= {}).lineWidth = 0;
|
|
4009
|
+
if (entry.fill?.kind === "gradient") {
|
|
4010
|
+
(out[part] ??= {}).gradient = resolveChartGradient(entry.fill, resolve);
|
|
4011
|
+
}
|
|
4012
|
+
}
|
|
4013
|
+
return out;
|
|
4014
|
+
}
|
|
4015
|
+
|
|
4016
|
+
// chart/render/chart-title-text.ts
|
|
4017
|
+
function properties(run) {
|
|
4018
|
+
return {
|
|
4019
|
+
...run.sizePt === void 0 ? {} : { fontSize: run.sizePt },
|
|
4020
|
+
...run.bold === void 0 ? {} : { bold: run.bold },
|
|
4021
|
+
...run.italic === void 0 ? {} : { italic: run.italic },
|
|
4022
|
+
...run.underline === void 0 ? {} : { underline: run.underline },
|
|
4023
|
+
...run.typeface === void 0 ? {} : { typeface: run.typeface },
|
|
4024
|
+
...run.color === void 0 ? {} : { textColor: run.color }
|
|
4025
|
+
};
|
|
4026
|
+
}
|
|
4027
|
+
function chartTitleText(chart, theme) {
|
|
4028
|
+
const formatting = chart.formatting;
|
|
4029
|
+
const entry = formatting?.entries.title;
|
|
4030
|
+
const body = entry?.textBody;
|
|
4031
|
+
if (!formatting || !body || body.text !== chart.title) return void 0;
|
|
4032
|
+
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)
|
|
4033
|
+
return void 0;
|
|
4034
|
+
return {
|
|
4035
|
+
paragraphs: body.paragraphs.map((paragraph) => ({
|
|
4036
|
+
...paragraph.align ? { align: paragraph.align } : {},
|
|
4037
|
+
...paragraph.lineSpacing ? { lineSpacing: paragraph.lineSpacing } : {},
|
|
4038
|
+
...paragraph.spaceBefore ? { spaceBefore: paragraph.spaceBefore } : {},
|
|
4039
|
+
...paragraph.spaceAfter ? { spaceAfter: paragraph.spaceAfter } : {},
|
|
4040
|
+
runs: paragraph.runs.map((run) => {
|
|
4041
|
+
const direct = {
|
|
4042
|
+
sourceXml: "",
|
|
4043
|
+
...entry.textBodyStyle,
|
|
4044
|
+
...properties(paragraph.defaultProperties ?? {}),
|
|
4045
|
+
...properties(run)
|
|
4046
|
+
};
|
|
4047
|
+
const appearance = chartAppearance(
|
|
4048
|
+
{
|
|
4049
|
+
...chart,
|
|
4050
|
+
formatting: { ...formatting, entries: { ...formatting.entries, title: direct } }
|
|
4051
|
+
},
|
|
4052
|
+
theme
|
|
4053
|
+
)?.title ?? {};
|
|
4054
|
+
return { text: run.text, appearance };
|
|
4055
|
+
})
|
|
4056
|
+
}))
|
|
4057
|
+
};
|
|
4058
|
+
}
|
|
4059
|
+
|
|
4060
|
+
// chart/render/chart-view.ts
|
|
4061
|
+
var isRefError = (value) => typeof value === "object" && value !== null && "error" in value;
|
|
4062
|
+
var SUPPORTED = /* @__PURE__ */ new Set([
|
|
4063
|
+
"bar",
|
|
4064
|
+
"column",
|
|
4065
|
+
"line",
|
|
4066
|
+
"area",
|
|
4067
|
+
"pie",
|
|
4068
|
+
"doughnut",
|
|
4069
|
+
"scatter",
|
|
4070
|
+
"radar"
|
|
4071
|
+
]);
|
|
4072
|
+
function toText(value) {
|
|
4073
|
+
if (value === null) return "";
|
|
4074
|
+
if (typeof value === "boolean") return value ? "TRUE" : "FALSE";
|
|
4075
|
+
if (isRefError(value)) return value.error;
|
|
4076
|
+
return String(value);
|
|
4077
|
+
}
|
|
4078
|
+
var toNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
4079
|
+
function resolveRef(ref, evaluateRef) {
|
|
4080
|
+
if (!ref) return void 0;
|
|
4081
|
+
try {
|
|
4082
|
+
const values = evaluateRef(ref);
|
|
4083
|
+
return values.length ? values : void 0;
|
|
4084
|
+
} catch {
|
|
4085
|
+
return void 0;
|
|
4086
|
+
}
|
|
4087
|
+
}
|
|
4088
|
+
function seriesName(series, index, evaluateRef) {
|
|
4089
|
+
const fromRef = resolveRef(series.nameRef, evaluateRef)?.map(toText).filter((t) => t !== "").join(" ");
|
|
4090
|
+
return fromRef || series.name || `Series${index + 1}`;
|
|
4091
|
+
}
|
|
4092
|
+
function chartSummaryView(chart, theme, options = {}) {
|
|
4093
|
+
const evaluateRef = options.evaluateRef ?? (() => []);
|
|
4094
|
+
const type = chart.chartType;
|
|
4095
|
+
const radial = type === "pie" || type === "doughnut";
|
|
4096
|
+
const palette = chart.colorPalette === void 0 ? void 0 : findChartColorPalette(chart.colorPalette);
|
|
4097
|
+
const scheme = chartColorScheme(theme);
|
|
4098
|
+
const drawingColor = (color) => color && drawingColorCss(
|
|
4099
|
+
resolveDrawingColor(
|
|
4100
|
+
color,
|
|
4101
|
+
{
|
|
4102
|
+
scheme: (name) => scheme[name]
|
|
4103
|
+
},
|
|
4104
|
+
{ transformOrder: "document" }
|
|
4105
|
+
)
|
|
4106
|
+
);
|
|
4107
|
+
const gradient = (fill) => fill?.kind === "gradient" ? resolveChartGradient(
|
|
4108
|
+
fill,
|
|
4109
|
+
(color) => resolveDrawingColor(
|
|
4110
|
+
color,
|
|
4111
|
+
{
|
|
4112
|
+
scheme: (name) => scheme[name]
|
|
4113
|
+
},
|
|
4114
|
+
{ transformOrder: "document" }
|
|
4115
|
+
)
|
|
4116
|
+
) : void 0;
|
|
4117
|
+
const grouping = chart.grouping ?? (type === "bar" || type === "column" ? "clustered" : "standard");
|
|
4118
|
+
let categories = [];
|
|
4119
|
+
const rawCategories = [];
|
|
4120
|
+
const series = chart.series.map((s, i) => {
|
|
4121
|
+
const values = resolveRef(s.valuesRef, evaluateRef)?.map(toNumber) ?? s.values.map(toNumber);
|
|
4122
|
+
const cats = resolveRef(s.categoriesRef, evaluateRef) ?? s.categories;
|
|
4123
|
+
rawCategories.push(cats);
|
|
4124
|
+
const paletteColor = palette && chartPaletteSeriesColor(palette, i, chart.series.length, scheme);
|
|
4125
|
+
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);
|
|
4126
|
+
const view = { name: seriesName(s, i, evaluateRef), values, color };
|
|
4127
|
+
const shadow = resolveDrawingShadowXml(s.effectsXml, {
|
|
4128
|
+
scheme: (name) => scheme[name]
|
|
4129
|
+
});
|
|
4130
|
+
if (shadow) view.shadow = shadow;
|
|
4131
|
+
const resolvedGradient = gradient(s.fill);
|
|
4132
|
+
if (resolvedGradient) view.gradient = resolvedGradient;
|
|
4133
|
+
const points = Object.fromEntries(
|
|
4134
|
+
Object.entries(s.pointFills ?? {}).flatMap(([key, fill]) => {
|
|
4135
|
+
const value = gradient(fill);
|
|
4136
|
+
return value ? [[key, value]] : [];
|
|
4137
|
+
})
|
|
4138
|
+
);
|
|
4139
|
+
if (Object.keys(points).length) view.pointGradients = points;
|
|
4140
|
+
return view;
|
|
4141
|
+
});
|
|
4142
|
+
const longest = Math.max(0, ...series.map((s) => s.values.length));
|
|
4143
|
+
const firstCats = rawCategories.find((c) => c.length > 0) ?? [];
|
|
4144
|
+
categories = Array.from(
|
|
4145
|
+
{ length: Math.max(longest, firstCats.length) },
|
|
4146
|
+
(_, i) => firstCats[i] !== void 0 ? toText(firstCats[i] ?? null) : String(i + 1)
|
|
4147
|
+
);
|
|
4148
|
+
if (radial) {
|
|
4149
|
+
series.forEach((s, seriesIndex) => {
|
|
4150
|
+
s.pointColors = s.values.map((_, i) => {
|
|
4151
|
+
const explicit = drawingColor(chart.series[seriesIndex]?.pointColors?.[i]);
|
|
4152
|
+
return explicit ?? (palette ? chartPaletteSeriesColor(palette, i, s.values.length, scheme) : autoSeriesColor(theme, i));
|
|
4153
|
+
});
|
|
4154
|
+
});
|
|
4155
|
+
} else
|
|
4156
|
+
series.forEach((s, seriesIndex) => {
|
|
4157
|
+
const points = chart.series[seriesIndex]?.pointColors;
|
|
4158
|
+
if (points) s.pointColors = s.values.map((_, i) => drawingColor(points[i]) ?? s.color);
|
|
4159
|
+
});
|
|
4160
|
+
series.forEach((s, index) => {
|
|
4161
|
+
const source = chart.series[index];
|
|
4162
|
+
if (s.gradient && !radial && s.pointColors) {
|
|
4163
|
+
for (let i = 0; i < s.pointColors.length; i++)
|
|
4164
|
+
if (!source.pointColors?.[i]) delete s.pointColors[i];
|
|
4165
|
+
}
|
|
4166
|
+
for (const [key, fill] of Object.entries(source.pointFills ?? {})) {
|
|
4167
|
+
if (fill.kind === "none") (s.pointColors ??= [])[Number(key)] = "none";
|
|
4168
|
+
else if (fill.kind === "solid") {
|
|
4169
|
+
const paint = drawingColor(fill.color);
|
|
4170
|
+
if (paint) (s.pointColors ??= [])[Number(key)] = paint;
|
|
4171
|
+
}
|
|
4172
|
+
}
|
|
4173
|
+
});
|
|
4174
|
+
const model = {
|
|
4175
|
+
...chart.barGapWidth === void 0 ? {} : { barGapWidth: chart.barGapWidth },
|
|
4176
|
+
...chart.barOverlap === void 0 ? {} : { barOverlap: chart.barOverlap },
|
|
4177
|
+
type,
|
|
4178
|
+
grouping,
|
|
4179
|
+
showLegend: chart.showLegend,
|
|
4180
|
+
legendPosition: chart.legendPosition ?? "r",
|
|
4181
|
+
categories,
|
|
4182
|
+
series,
|
|
4183
|
+
horizontal: type === "bar",
|
|
4184
|
+
supported: SUPPORTED.has(type)
|
|
4185
|
+
};
|
|
4186
|
+
if (chart.title) model.title = chart.title;
|
|
4187
|
+
const titleFormatting = chart.formatting?.entries.title;
|
|
4188
|
+
if (titleFormatting?.layout) model.titleLayout = titleFormatting.layout;
|
|
4189
|
+
if (titleFormatting?.overlay !== void 0) model.titleOverlay = titleFormatting.overlay;
|
|
4190
|
+
const legendFormatting = chart.formatting?.entries.legend;
|
|
4191
|
+
if (legendFormatting?.layout) model.legendLayout = legendFormatting.layout;
|
|
4192
|
+
if (legendFormatting?.overlay !== void 0) model.legendOverlay = legendFormatting.overlay;
|
|
4193
|
+
const titleText = chartTitleText(chart, theme);
|
|
4194
|
+
if (titleText) model.titleText = titleText;
|
|
4195
|
+
const appearance = chartAppearance(chart, theme);
|
|
4196
|
+
if (appearance) model.appearance = appearance;
|
|
4197
|
+
if (type === "scatter") {
|
|
4198
|
+
series.forEach((s, i) => {
|
|
4199
|
+
const cats = rawCategories[i] ?? [];
|
|
4200
|
+
const numeric = cats.length > 0 && cats.every((c) => typeof c === "number");
|
|
4201
|
+
s.xValues = s.values.map((_, k) => numeric ? toNumber(cats[k] ?? null) : k + 1);
|
|
4202
|
+
});
|
|
4203
|
+
const xs = series.flatMap((s) => s.xValues ?? []).filter((x) => x !== null);
|
|
4204
|
+
model.xAxis = xs.length ? niceScale(Math.min(...xs), Math.max(...xs)) : niceScale(0, 1);
|
|
4205
|
+
}
|
|
4206
|
+
if (!radial) model.valueAxis = valueAxis(model);
|
|
4207
|
+
return model;
|
|
4208
|
+
}
|
|
4209
|
+
|
|
4210
|
+
// text/css-font-family.ts
|
|
4211
|
+
var FALLBACKS = {
|
|
4212
|
+
calibri: '"Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
|
|
4213
|
+
"calibri light": '"Calibri Light", "Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
|
|
4214
|
+
cambria: '"Cambria", "Caladea", Georgia, serif',
|
|
4215
|
+
arial: 'Arial, "Liberation Sans", Helvetica, sans-serif',
|
|
4216
|
+
"times new roman": '"Times New Roman", "Liberation Serif", Times, serif',
|
|
4217
|
+
"courier new": '"Courier New", "Liberation Mono", monospace',
|
|
4218
|
+
aptos: '"Aptos", "Calibri", "Carlito", "Segoe UI", sans-serif'
|
|
4219
|
+
};
|
|
4220
|
+
function cssFontFamily(name) {
|
|
4221
|
+
const known = FALLBACKS[name.toLowerCase()];
|
|
4222
|
+
if (known) return known;
|
|
4223
|
+
const quoted = `"${name.replace(/["\\]/g, "")}"`;
|
|
4224
|
+
return `${quoted}, "Calibri", "Carlito", "Segoe UI", sans-serif`;
|
|
4225
|
+
}
|
|
4226
|
+
|
|
4227
|
+
// chart/render/chart-svg-appearance.ts
|
|
4228
|
+
var nextPaintId = 0;
|
|
4229
|
+
function chartGradientPaint(model, width = 1024, height = 768) {
|
|
4230
|
+
const prefix = `xlsx-chart-${++nextPaintId}`;
|
|
4231
|
+
const appearance = { ...model.appearance };
|
|
4232
|
+
const defs = [];
|
|
4233
|
+
const shadowPaint = (shadow, suffix) => {
|
|
4234
|
+
const id = `${prefix}-${suffix}`;
|
|
4235
|
+
const pad = Math.max(4, shadow.blur * 3 + Math.abs(shadow.dx) + Math.abs(shadow.dy));
|
|
4236
|
+
defs.push(
|
|
4237
|
+
`<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>`
|
|
4238
|
+
);
|
|
4239
|
+
return `url(#${id})`;
|
|
4240
|
+
};
|
|
4241
|
+
for (const [part, entry] of Object.entries(appearance)) {
|
|
4242
|
+
if (entry?.textShadow)
|
|
4243
|
+
appearance[part] = {
|
|
4244
|
+
...entry,
|
|
4245
|
+
textShadowFilter: shadowPaint(entry.textShadow, `${part}-text-shadow`)
|
|
4246
|
+
};
|
|
4247
|
+
}
|
|
4248
|
+
const paint = (gradient, suffix, bounds) => {
|
|
4249
|
+
const def = buildChartGradientDef(`${prefix}-${suffix}`, gradient, bounds);
|
|
4250
|
+
defs.push(chartGradientMarkup(def));
|
|
4251
|
+
return `url(#${def.id})`;
|
|
4252
|
+
};
|
|
4253
|
+
for (const part of ["chartArea", "plotArea"]) {
|
|
4254
|
+
const entry = appearance[part];
|
|
4255
|
+
if (!entry?.gradient) continue;
|
|
4256
|
+
if (part === "plotArea" && ["circle", "shape"].includes(entry.gradient.path ?? "")) continue;
|
|
4257
|
+
appearance[part] = {
|
|
4258
|
+
...entry,
|
|
4259
|
+
fillColor: paint(entry.gradient, part, { width, height, shape: "rect" })
|
|
4260
|
+
};
|
|
4261
|
+
}
|
|
4262
|
+
const series = model.series.map((source, index) => {
|
|
4263
|
+
const view = { ...source };
|
|
4264
|
+
if (source.shadow) view.shadowFilter = shadowPaint(source.shadow, `s${index}-shadow`);
|
|
4265
|
+
const bounds = model.type === "bar" || model.type === "column" ? { width: 1, height: 1, shape: "rect" } : void 0;
|
|
4266
|
+
if (source.gradient) view.color = paint(source.gradient, `s${index}`, bounds);
|
|
4267
|
+
if (source.pointGradients) {
|
|
4268
|
+
view.pointColors = [...source.pointColors ?? []];
|
|
4269
|
+
for (const [key, gradient] of Object.entries(source.pointGradients))
|
|
4270
|
+
view.pointColors[Number(key)] = paint(gradient, `s${index}-p${key}`, bounds);
|
|
4271
|
+
}
|
|
4272
|
+
return view;
|
|
4273
|
+
});
|
|
4274
|
+
return defs.length ? { model: { ...model, appearance, series }, defs: `<defs>${defs.join("")}</defs>` } : { model, defs: "" };
|
|
4275
|
+
}
|
|
4276
|
+
function chartTextAttributes(model, part, fallbackSize = FONT_SIZE) {
|
|
4277
|
+
const entry = model.appearance?.[part];
|
|
4278
|
+
return {
|
|
4279
|
+
size: entry?.fontSize === void 0 ? fallbackSize : chartPointsToPixels(entry.fontSize),
|
|
4280
|
+
...entry?.color === void 0 ? {} : { fill: entry.color },
|
|
4281
|
+
...entry?.bold === void 0 ? {} : { weight: entry.bold ? "bold" : "normal" },
|
|
4282
|
+
...entry?.italic === void 0 ? {} : { italic: entry.italic },
|
|
4283
|
+
...entry?.underline === void 0 ? {} : { underline: entry.underline },
|
|
4284
|
+
...entry?.typeface === void 0 ? {} : { family: cssFontFamily(entry.typeface) },
|
|
4285
|
+
...entry?.textShadowFilter === void 0 ? {} : { filter: entry.textShadowFilter }
|
|
4286
|
+
};
|
|
4287
|
+
}
|
|
4288
|
+
function chartStroke(model, part) {
|
|
4289
|
+
const entry = model.appearance?.[part];
|
|
4290
|
+
return {
|
|
4291
|
+
color: entry?.axisVisible === false ? "none" : entry?.lineColor ?? (part === "gridlineMajor" ? GRID_COLOR : AXIS_COLOR),
|
|
4292
|
+
width: entry?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry.lineWidth)
|
|
4293
|
+
};
|
|
4294
|
+
}
|
|
4295
|
+
function chartAreaRect(model, part, area) {
|
|
4296
|
+
if (area.w <= 0 || area.h <= 0) return "";
|
|
4297
|
+
const entry = model.appearance?.[part];
|
|
4298
|
+
let fill = entry?.fillColor ?? (part === "chartArea" ? "#FFFFFF" : "none");
|
|
4299
|
+
let defs = "";
|
|
4300
|
+
if (part !== "chartArea" && entry?.gradient && (part !== "plotArea" || ["circle", "shape"].includes(entry.gradient.path ?? ""))) {
|
|
4301
|
+
const def = buildChartGradientDef(`xlsx-chart-${++nextPaintId}-${part}`, entry.gradient, {
|
|
4302
|
+
width: area.w,
|
|
4303
|
+
height: area.h,
|
|
4304
|
+
shape: "rect"
|
|
4305
|
+
});
|
|
4306
|
+
defs = `<defs>${chartGradientMarkup(def)}</defs>`;
|
|
4307
|
+
fill = `url(#${def.id})`;
|
|
4308
|
+
}
|
|
4309
|
+
const stroke = entry?.lineColor ?? "none";
|
|
4310
|
+
if (fill === "none" && stroke === "none") return "";
|
|
4311
|
+
const width = entry?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry.lineWidth);
|
|
4312
|
+
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}"/>`;
|
|
4313
|
+
}
|
|
4314
|
+
|
|
4315
|
+
// chart/render/chart-spacing.ts
|
|
4316
|
+
function chartBarSpacing(chart) {
|
|
4317
|
+
const stacked = chart.grouping === "stacked" || chart.grouping === "percentStacked";
|
|
4318
|
+
return {
|
|
4319
|
+
barGapWidth: chart.barGapWidth ?? 150,
|
|
4320
|
+
barOverlap: chart.barOverlap ?? (stacked ? 100 : 0)
|
|
4321
|
+
};
|
|
4322
|
+
}
|
|
4323
|
+
|
|
4324
|
+
// chart/render/chart-svg-bars.ts
|
|
4325
|
+
function bars(model, frame, out, values) {
|
|
4326
|
+
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
4327
|
+
const count = Math.max(1, model.series.length);
|
|
4328
|
+
const geometry = clusteredBarGeometry(frame.bandSize, count, chartBarSpacing(model));
|
|
4329
|
+
const barSize = geometry.singleBarWidth;
|
|
4330
|
+
const base = frame.value(0);
|
|
4331
|
+
const pos = new Array(model.categories.length).fill(0);
|
|
4332
|
+
const neg = new Array(model.categories.length).fill(0);
|
|
4333
|
+
model.series.forEach((s, si) => {
|
|
4334
|
+
values[si]?.forEach((v, i) => {
|
|
4335
|
+
if (v === null || i >= model.categories.length) return;
|
|
4336
|
+
let from = 0;
|
|
4337
|
+
let to = v;
|
|
4338
|
+
if (stacked) {
|
|
4339
|
+
const acc = v >= 0 ? pos : neg;
|
|
4340
|
+
from = acc[i] ?? 0;
|
|
4341
|
+
to = from + v;
|
|
4342
|
+
acc[i] = to;
|
|
4343
|
+
}
|
|
4344
|
+
const a = stacked ? frame.value(from) : base;
|
|
4345
|
+
const b = frame.value(to);
|
|
4346
|
+
const offset = model.horizontal ? geometry.clusterWidth / 2 - barSize - si * geometry.step : -geometry.clusterWidth / 2 + si * geometry.step;
|
|
4347
|
+
const center = frame.band(i);
|
|
4348
|
+
const width = model.horizontal ? Math.abs(b - a) : barSize;
|
|
4349
|
+
const height = model.horizontal ? barSize : Math.abs(b - a);
|
|
4350
|
+
let color = s.pointColors?.[i] ?? s.color;
|
|
4351
|
+
const gradient = s.pointGradients?.[i] ?? (s.pointColors?.[i] === void 0 ? s.gradient : void 0);
|
|
4352
|
+
if (gradient && (gradient.path === "circle" || gradient.path === "shape")) {
|
|
4353
|
+
const baseId = color.match(/^url\(#(.+)\)$/)?.[1];
|
|
4354
|
+
if (baseId) {
|
|
4355
|
+
const id = baseId.replace(/(-s\d+(?:-p\d+)?)$/, `-mark${i}$1`);
|
|
4356
|
+
const def = buildChartGradientDef(id, gradient, {
|
|
4357
|
+
width: Number(n(width)),
|
|
4358
|
+
height: Number(n(height)),
|
|
4359
|
+
shape: "rect"
|
|
4360
|
+
});
|
|
4361
|
+
out.push(`<defs>${chartGradientMarkup(def)}</defs>`);
|
|
4362
|
+
color = `url(#${id})`;
|
|
4363
|
+
}
|
|
4364
|
+
}
|
|
4365
|
+
out.push(`<g data-chart-series="${si}" data-chart-point="${i}">`);
|
|
4366
|
+
if (model.horizontal)
|
|
4367
|
+
out.push(
|
|
4368
|
+
rect(Math.min(a, b), center + offset, Math.abs(b - a), barSize, color, s.shadowFilter)
|
|
4369
|
+
);
|
|
4370
|
+
else
|
|
4371
|
+
out.push(
|
|
4372
|
+
rect(center + offset, Math.min(a, b), barSize, Math.abs(b - a), color, s.shadowFilter)
|
|
4373
|
+
);
|
|
4374
|
+
out.push("</g>");
|
|
4375
|
+
});
|
|
4376
|
+
});
|
|
4377
|
+
}
|
|
4378
|
+
|
|
4379
|
+
// chart/render/chart-svg-cartesian.ts
|
|
4380
|
+
function axes(model, area, out) {
|
|
4381
|
+
const scale = model.valueAxis;
|
|
4382
|
+
if (!scale) return void 0;
|
|
4383
|
+
const labels = scale.ticks.map((t) => formatAxisValue(t, scale.percent));
|
|
4384
|
+
const valueAttrs = chartTextAttributes(model, "valueAxis");
|
|
4385
|
+
const categoryAttrs = chartTextAttributes(model, "categoryAxis");
|
|
4386
|
+
const valueSize = valueAttrs.size ?? 10;
|
|
4387
|
+
const categorySize = categoryAttrs.size ?? 10;
|
|
4388
|
+
const grid = chartStroke(model, "gridlineMajor");
|
|
4389
|
+
const axis = chartStroke(model, "categoryAxis");
|
|
4390
|
+
const valueLabels = model.appearance?.valueAxis?.labelsVisible !== false;
|
|
4391
|
+
const categoryLabels = model.appearance?.categoryAxis?.labelsVisible !== false;
|
|
4392
|
+
const labelW = valueLabels ? Math.max(...labels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
|
|
4393
|
+
const horizontal = model.horizontal;
|
|
4394
|
+
const cats = Math.max(1, model.categories.length);
|
|
4395
|
+
const catW = Math.min(
|
|
4396
|
+
area.w * 0.3,
|
|
4397
|
+
Math.max(...model.categories.map((c) => textWidth(c, categorySize)), 8) + 6
|
|
4398
|
+
);
|
|
4399
|
+
const plot = horizontal ? {
|
|
4400
|
+
x: area.x + catW,
|
|
4401
|
+
y: area.y,
|
|
4402
|
+
w: Math.max(1, area.w - catW - 4),
|
|
4403
|
+
h: Math.max(1, area.h - Math.max(16, valueSize * 1.5))
|
|
4404
|
+
} : {
|
|
4405
|
+
x: area.x + labelW,
|
|
4406
|
+
y: area.y + 4,
|
|
4407
|
+
w: Math.max(1, area.w - labelW - 4),
|
|
4408
|
+
h: Math.max(1, area.h - Math.max(20, categorySize * 1.5))
|
|
4409
|
+
};
|
|
4410
|
+
const span = scale.max - scale.min || 1;
|
|
4411
|
+
const value = horizontal ? (v) => plot.x + (v - scale.min) / span * plot.w : (v) => plot.y + plot.h - (v - scale.min) / span * plot.h;
|
|
4412
|
+
const bandSize = (horizontal ? plot.h : plot.w) / cats;
|
|
4413
|
+
const band = horizontal ? (i) => plot.y + plot.h - bandSize * (i + 0.5) : (i) => plot.x + bandSize * (i + 0.5);
|
|
4414
|
+
out.push(chartAreaRect(model, "plotArea", plot));
|
|
4415
|
+
scale.ticks.forEach((t, i) => {
|
|
4416
|
+
const p = value(t);
|
|
4417
|
+
const label = labels[i] ?? "";
|
|
4418
|
+
if (horizontal) {
|
|
4419
|
+
out.push(line(p, plot.y, p, plot.y + plot.h, grid.color, grid.width));
|
|
4420
|
+
if (valueLabels)
|
|
4421
|
+
out.push(
|
|
4422
|
+
text(p, plot.y + plot.h + valueSize + 2, label, { anchor: "middle", ...valueAttrs })
|
|
4423
|
+
);
|
|
4424
|
+
} else {
|
|
4425
|
+
out.push(line(plot.x, p, plot.x + plot.w, p, grid.color, grid.width));
|
|
4426
|
+
if (valueLabels)
|
|
4427
|
+
out.push(text(plot.x - 4, p + valueSize * 0.3, label, { anchor: "end", ...valueAttrs }));
|
|
4428
|
+
}
|
|
4429
|
+
});
|
|
4430
|
+
const zero = value(Math.min(Math.max(0, scale.min), scale.max));
|
|
4431
|
+
if (horizontal) out.push(line(zero, plot.y, zero, plot.y + plot.h, axis.color, axis.width));
|
|
4432
|
+
else out.push(line(plot.x, zero, plot.x + plot.w, zero, axis.color, axis.width));
|
|
4433
|
+
const step = Math.max(
|
|
4434
|
+
1,
|
|
4435
|
+
Math.ceil(cats / Math.max(1, Math.floor((horizontal ? plot.h : plot.w) / 14)))
|
|
4436
|
+
);
|
|
4437
|
+
model.categories.forEach((c, i) => {
|
|
4438
|
+
if (!categoryLabels || i % step !== 0) return;
|
|
4439
|
+
const p = band(i);
|
|
4440
|
+
if (horizontal)
|
|
4441
|
+
out.push(
|
|
4442
|
+
text(plot.x - 4, p + categorySize * 0.3, fit(c, catW - 6, categorySize), {
|
|
4443
|
+
anchor: "end",
|
|
4444
|
+
...categoryAttrs
|
|
4445
|
+
})
|
|
4446
|
+
);
|
|
4447
|
+
else
|
|
4448
|
+
out.push(
|
|
4449
|
+
text(p, plot.y + plot.h + categorySize + 3, fit(c, bandSize * step, categorySize), {
|
|
4450
|
+
anchor: "middle",
|
|
4451
|
+
...categoryAttrs
|
|
4452
|
+
})
|
|
4453
|
+
);
|
|
4454
|
+
});
|
|
4455
|
+
return { plot, value, band, bandSize };
|
|
4456
|
+
}
|
|
4457
|
+
function plotted(model) {
|
|
4458
|
+
if (model.grouping !== "percentStacked") return model.series.map((s) => s.values);
|
|
4459
|
+
const totals = categoryTotals(model);
|
|
4460
|
+
return model.series.map(
|
|
4461
|
+
(s) => s.values.map((v, i) => v === null ? null : v / (totals[i] || 1))
|
|
4462
|
+
);
|
|
4463
|
+
}
|
|
4464
|
+
function linesAndAreas(model, frame, out) {
|
|
4465
|
+
const values = plotted(model);
|
|
4466
|
+
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
4467
|
+
const acc = new Array(model.categories.length).fill(0);
|
|
4468
|
+
const area = model.type === "area";
|
|
4469
|
+
const layers = [];
|
|
4470
|
+
model.series.forEach((s, si) => {
|
|
4471
|
+
const points = [];
|
|
4472
|
+
const lower = [];
|
|
4473
|
+
model.categories.forEach((_, i) => {
|
|
4474
|
+
const v = values[si]?.[i] ?? null;
|
|
4475
|
+
if (v === null && !area) {
|
|
4476
|
+
points.push([NaN, NaN]);
|
|
4477
|
+
return;
|
|
4478
|
+
}
|
|
4479
|
+
const below = stacked ? acc[i] ?? 0 : 0;
|
|
4480
|
+
const top = below + (v ?? 0);
|
|
4481
|
+
if (stacked) acc[i] = top;
|
|
4482
|
+
points.push([frame.band(i), frame.value(top)]);
|
|
4483
|
+
lower.push([frame.band(i), frame.value(below)]);
|
|
4484
|
+
});
|
|
4485
|
+
layers.push({
|
|
4486
|
+
points,
|
|
4487
|
+
lower,
|
|
4488
|
+
color: s.color,
|
|
4489
|
+
filter: s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""
|
|
4490
|
+
});
|
|
4491
|
+
});
|
|
4492
|
+
for (const { points, lower, color, filter } of area ? [...layers].reverse() : layers) {
|
|
4493
|
+
if (area) {
|
|
4494
|
+
const poly = [...points, ...[...lower].reverse()].map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
|
|
4495
|
+
out.push(`<polygon points="${poly}" fill="${color}" fill-opacity="0.85"${filter}/>`);
|
|
4496
|
+
continue;
|
|
4497
|
+
}
|
|
4498
|
+
let segment = [];
|
|
4499
|
+
const flush = () => {
|
|
4500
|
+
if (segment.length > 1)
|
|
4501
|
+
out.push(
|
|
4502
|
+
`<polyline points="${segment.join(" ")}" fill="none" stroke="${color}" stroke-width="2.25" stroke-linejoin="round"${filter}/>`
|
|
4503
|
+
);
|
|
4504
|
+
segment = [];
|
|
4505
|
+
};
|
|
4506
|
+
for (const [x, y] of points) {
|
|
4507
|
+
if (Number.isNaN(x)) flush();
|
|
4508
|
+
else segment.push(`${n(x)},${n(y)}`);
|
|
4509
|
+
}
|
|
4510
|
+
flush();
|
|
4511
|
+
for (const [x, y] of points)
|
|
4512
|
+
if (!Number.isNaN(x))
|
|
4513
|
+
out.push(`<circle cx="${n(x)}" cy="${n(y)}" r="2.5" fill="${color}"${filter}/>`);
|
|
4514
|
+
}
|
|
4515
|
+
}
|
|
4516
|
+
function scatter(model, area, out) {
|
|
4517
|
+
const ys = model.valueAxis;
|
|
4518
|
+
const xs = model.xAxis;
|
|
4519
|
+
if (!ys || !xs) return;
|
|
4520
|
+
const yLabels = ys.ticks.map((t) => formatAxisValue(t));
|
|
4521
|
+
const valueAttrs = chartTextAttributes(model, "valueAxis");
|
|
4522
|
+
const categoryAttrs = chartTextAttributes(model, "categoryAxis");
|
|
4523
|
+
const valueSize = valueAttrs.size ?? 10;
|
|
4524
|
+
const categorySize = categoryAttrs.size ?? 10;
|
|
4525
|
+
const grid = chartStroke(model, "gridlineMajor");
|
|
4526
|
+
const xAxis = chartStroke(model, "categoryAxis");
|
|
4527
|
+
const yAxis = chartStroke(model, "valueAxis");
|
|
4528
|
+
const valueLabels = model.appearance?.valueAxis?.labelsVisible !== false;
|
|
4529
|
+
const categoryLabels = model.appearance?.categoryAxis?.labelsVisible !== false;
|
|
4530
|
+
const labelW = valueLabels ? Math.max(...yLabels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
|
|
4531
|
+
const plot = {
|
|
4532
|
+
x: area.x + labelW,
|
|
4533
|
+
y: area.y + 4,
|
|
4534
|
+
w: Math.max(1, area.w - labelW - 8),
|
|
4535
|
+
h: Math.max(1, area.h - Math.max(20, categorySize * 1.5))
|
|
4536
|
+
};
|
|
4537
|
+
const px = (v, s) => plot.x + (v - s.min) / (s.max - s.min || 1) * plot.w;
|
|
4538
|
+
const py = (v, s) => plot.y + plot.h - (v - s.min) / (s.max - s.min || 1) * plot.h;
|
|
4539
|
+
out.push(chartAreaRect(model, "plotArea", plot));
|
|
4540
|
+
ys.ticks.forEach((t, i) => {
|
|
4541
|
+
out.push(line(plot.x, py(t, ys), plot.x + plot.w, py(t, ys), grid.color, grid.width));
|
|
4542
|
+
if (valueLabels)
|
|
4543
|
+
out.push(
|
|
4544
|
+
text(plot.x - 4, py(t, ys) + valueSize * 0.3, yLabels[i] ?? "", {
|
|
4545
|
+
anchor: "end",
|
|
4546
|
+
...valueAttrs
|
|
4547
|
+
})
|
|
4548
|
+
);
|
|
4549
|
+
});
|
|
4550
|
+
for (const t of xs.ticks) {
|
|
4551
|
+
out.push(
|
|
4552
|
+
line(px(t, xs), plot.y + plot.h, px(t, xs), plot.y + plot.h + 3, xAxis.color, xAxis.width)
|
|
4553
|
+
);
|
|
4554
|
+
if (categoryLabels)
|
|
4555
|
+
out.push(
|
|
4556
|
+
text(px(t, xs), plot.y + plot.h + categorySize + 3, formatAxisValue(t), {
|
|
4557
|
+
anchor: "middle",
|
|
4558
|
+
...categoryAttrs
|
|
4559
|
+
})
|
|
4560
|
+
);
|
|
4561
|
+
}
|
|
4562
|
+
out.push(
|
|
4563
|
+
line(plot.x, plot.y + plot.h, plot.x + plot.w, plot.y + plot.h, xAxis.color, xAxis.width)
|
|
4564
|
+
);
|
|
4565
|
+
out.push(line(plot.x, plot.y, plot.x, plot.y + plot.h, yAxis.color, yAxis.width));
|
|
4566
|
+
for (const s of model.series)
|
|
4567
|
+
s.values.forEach((v, i) => {
|
|
4568
|
+
const x = s.xValues?.[i] ?? null;
|
|
4569
|
+
if (v === null || x === null) return;
|
|
4570
|
+
out.push(
|
|
4571
|
+
`<circle cx="${n(px(x, xs))}" cy="${n(py(v, ys))}" r="3" fill="${s.pointColors?.[i] ?? s.color}"${s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""}/>`
|
|
4572
|
+
);
|
|
4573
|
+
});
|
|
4574
|
+
}
|
|
4575
|
+
function cartesianSvg(model, area) {
|
|
4576
|
+
const out = [];
|
|
4577
|
+
if (model.type === "scatter") {
|
|
4578
|
+
scatter(model, area, out);
|
|
4579
|
+
return out.join("");
|
|
4580
|
+
}
|
|
4581
|
+
const frame = axes(model, area, out);
|
|
4582
|
+
if (!frame) return "";
|
|
4583
|
+
if (model.type === "bar" || model.type === "column") bars(model, frame, out, plotted(model));
|
|
4584
|
+
else linesAndAreas(model, frame, out);
|
|
4585
|
+
return out.join("");
|
|
4586
|
+
}
|
|
4587
|
+
|
|
4588
|
+
// chart/render/chart-svg-radial.ts
|
|
4589
|
+
var polar = (cx, cy, r, angle) => [
|
|
4590
|
+
cx + r * Math.sin(angle),
|
|
4591
|
+
cy - r * Math.cos(angle)
|
|
4592
|
+
];
|
|
4593
|
+
function slicePath(cx, cy, r, inner, a0, a1) {
|
|
4594
|
+
const sweep = a1 - a0;
|
|
4595
|
+
if (sweep >= Math.PI * 2 - 1e-9) {
|
|
4596
|
+
const mid = a0 + Math.PI;
|
|
4597
|
+
return slicePath(cx, cy, r, inner, a0, mid) + slicePath(cx, cy, r, inner, mid, a1);
|
|
4598
|
+
}
|
|
4599
|
+
const large = sweep > Math.PI ? 1 : 0;
|
|
4600
|
+
const [x0, y0] = polar(cx, cy, r, a0);
|
|
4601
|
+
const [x1, y1] = polar(cx, cy, r, a1);
|
|
4602
|
+
if (inner <= 0)
|
|
4603
|
+
return `M${n(cx)},${n(cy)} L${n(x0)},${n(y0)} A${n(r)},${n(r)} 0 ${large} 1 ${n(x1)},${n(y1)} Z`;
|
|
4604
|
+
const [ix1, iy1] = polar(cx, cy, inner, a1);
|
|
4605
|
+
const [ix0, iy0] = polar(cx, cy, inner, a0);
|
|
4606
|
+
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`;
|
|
4607
|
+
}
|
|
4608
|
+
function pieSvg(model, area) {
|
|
4609
|
+
const out = [chartAreaRect(model, "plotArea", area)];
|
|
4610
|
+
const cx = area.x + area.w / 2;
|
|
4611
|
+
const cy = area.y + area.h / 2;
|
|
4612
|
+
const radius = Math.max(1, Math.min(area.w, area.h) / 2 - 4);
|
|
4613
|
+
const rings = model.type === "doughnut" ? model.series : model.series.slice(0, 1);
|
|
4614
|
+
const hole = model.type === "doughnut" ? radius * 0.5 : 0;
|
|
4615
|
+
const ringSize = (radius - hole) / Math.max(1, rings.length);
|
|
4616
|
+
rings.forEach((s, ri) => {
|
|
4617
|
+
const outer = radius - ri * ringSize;
|
|
4618
|
+
const inner = model.type === "doughnut" ? outer - ringSize : 0;
|
|
4619
|
+
const total = s.values.reduce((sum, v) => sum + (v !== null && v > 0 ? v : 0), 0);
|
|
4620
|
+
if (total <= 0) return;
|
|
4621
|
+
let angle = 0;
|
|
4622
|
+
s.values.forEach((v, i) => {
|
|
4623
|
+
if (v === null || v <= 0) return;
|
|
4624
|
+
const sweep = v / total * Math.PI * 2;
|
|
4625
|
+
const color = s.pointColors?.[i] ?? s.color;
|
|
4626
|
+
out.push(
|
|
4627
|
+
`<path d="${slicePath(cx, cy, outer, inner, angle, angle + sweep)}" fill="${color}" stroke="#FFFFFF" stroke-width="1"${s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""}/>`
|
|
4628
|
+
);
|
|
4629
|
+
angle += sweep;
|
|
4630
|
+
});
|
|
4631
|
+
});
|
|
4632
|
+
return out.join("");
|
|
4633
|
+
}
|
|
4634
|
+
function radarSvg(model, area) {
|
|
4635
|
+
const out = [chartAreaRect(model, "plotArea", area)];
|
|
4636
|
+
const scale = model.valueAxis;
|
|
4637
|
+
const count = model.categories.length;
|
|
4638
|
+
if (!scale || count < 1) return "";
|
|
4639
|
+
const valueAttrs = chartTextAttributes(model, "valueAxis", 9);
|
|
4640
|
+
const categoryAttrs = chartTextAttributes(model, "categoryAxis");
|
|
4641
|
+
const valueSize = valueAttrs.size ?? 9;
|
|
4642
|
+
const categorySize = categoryAttrs.size ?? 10;
|
|
4643
|
+
const grid = chartStroke(model, "gridlineMajor");
|
|
4644
|
+
const axis = chartStroke(model, "categoryAxis");
|
|
4645
|
+
const cx = area.x + area.w / 2;
|
|
4646
|
+
const cy = area.y + area.h / 2 + 4;
|
|
4647
|
+
const radius = Math.max(1, Math.min(area.w, area.h) / 2 - Math.max(18, categorySize * 1.8));
|
|
4648
|
+
const angle = (i) => i / count * Math.PI * 2;
|
|
4649
|
+
const r = (v) => (v - scale.min) / (scale.max - scale.min || 1) * radius;
|
|
4650
|
+
const labelEvery = Math.max(
|
|
4651
|
+
1,
|
|
4652
|
+
Math.ceil(12 / Math.max(1, radius / Math.max(1, scale.ticks.length - 1)))
|
|
4653
|
+
);
|
|
4654
|
+
for (const [k, t] of scale.ticks.entries()) {
|
|
4655
|
+
const ring = Array.from({ length: count }, (_, i) => polar(cx, cy, r(t), angle(i))).map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
|
|
4656
|
+
out.push(
|
|
4657
|
+
`<polygon points="${ring}" fill="none" stroke="${grid.color}" stroke-width="${n(grid.width)}"/>`
|
|
4658
|
+
);
|
|
4659
|
+
if (model.appearance?.valueAxis?.labelsVisible !== false && k % labelEvery === 0)
|
|
4660
|
+
out.push(
|
|
4661
|
+
text(cx + 3, cy - r(t) + valueSize * 0.3, formatAxisValue(t, scale.percent), valueAttrs)
|
|
4662
|
+
);
|
|
4663
|
+
}
|
|
4664
|
+
model.categories.forEach((c, i) => {
|
|
4665
|
+
const [x, y] = polar(cx, cy, radius, angle(i));
|
|
4666
|
+
out.push(line(cx, cy, x, y, axis.color, axis.width));
|
|
4667
|
+
const [lx, ly] = polar(cx, cy, radius + 10, angle(i));
|
|
4668
|
+
const anchor = Math.abs(lx - cx) < 2 ? "middle" : lx > cx ? "start" : "end";
|
|
4669
|
+
if (model.appearance?.categoryAxis?.labelsVisible !== false)
|
|
4670
|
+
out.push(
|
|
4671
|
+
text(lx, ly + categorySize * 0.3, fit(c, area.w / 4, categorySize), {
|
|
4672
|
+
anchor,
|
|
4673
|
+
...categoryAttrs
|
|
4674
|
+
})
|
|
4675
|
+
);
|
|
4676
|
+
});
|
|
4677
|
+
for (const s of model.series) {
|
|
4678
|
+
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(" ");
|
|
4679
|
+
out.push(
|
|
4680
|
+
`<polygon points="${points}" fill="none" stroke="${s.color}" stroke-width="2"${s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""}/>`
|
|
4681
|
+
);
|
|
4682
|
+
}
|
|
4683
|
+
return out.join("");
|
|
4684
|
+
}
|
|
4685
|
+
|
|
4686
|
+
// chart/render/chart-svg-text-metrics.ts
|
|
4687
|
+
var CHART_FONT_FAMILY = "Calibri, Carlito, Arial, sans-serif";
|
|
4688
|
+
function cssFont(attrs) {
|
|
4689
|
+
return `${attrs.italic ? "italic" : "normal"} ${attrs.weight ?? "normal"} ${attrs.size ?? 10}px ${attrs.family ?? CHART_FONT_FAMILY}`;
|
|
4690
|
+
}
|
|
4691
|
+
function chartFontMetrics(attrs, options) {
|
|
4692
|
+
const metrics = options.measureFont?.(cssFont(attrs));
|
|
4693
|
+
return metrics && Number.isFinite(metrics.ascent) && Number.isFinite(metrics.descent) && metrics.ascent >= 0 && metrics.descent >= 0 && metrics.ascent + metrics.descent > 0 ? metrics : void 0;
|
|
4694
|
+
}
|
|
4695
|
+
function chartTextWidth(content, attrs, options) {
|
|
4696
|
+
const width = options.measureText?.(content, cssFont(attrs));
|
|
4697
|
+
return width !== void 0 && Number.isFinite(width) && width >= 0 ? width : textWidth(content, attrs.size);
|
|
4698
|
+
}
|
|
4699
|
+
function fitChartText(content, maxWidth, attrs, options) {
|
|
4700
|
+
if (!options.measureText) return fit(content, maxWidth, attrs.size);
|
|
4701
|
+
if (chartTextWidth(content, attrs, options) <= maxWidth) return content;
|
|
4702
|
+
const points = [...content];
|
|
4703
|
+
let low = 0;
|
|
4704
|
+
let high = points.length;
|
|
4705
|
+
while (low < high) {
|
|
4706
|
+
const mid = Math.ceil((low + high) / 2);
|
|
4707
|
+
if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`, attrs, options) <= maxWidth) low = mid;
|
|
4708
|
+
else high = mid - 1;
|
|
4709
|
+
}
|
|
4710
|
+
return `${points.slice(0, low).join("")}\u2026`;
|
|
4711
|
+
}
|
|
4712
|
+
|
|
4713
|
+
// chart/render/chart-svg-legend.ts
|
|
4714
|
+
function chartLegendSvg(model, area, frame, options) {
|
|
4715
|
+
const automatic = [];
|
|
4716
|
+
const bounds = {};
|
|
4717
|
+
const reserved = automaticLegend(model, area, automatic, options, bounds);
|
|
4718
|
+
const plot = model.legendOverlay ? area : reserved;
|
|
4719
|
+
const box = bounds.box;
|
|
4720
|
+
if (!box) return { plot, markup: "", foreground: false };
|
|
4721
|
+
const manual = resolveManualLayoutRect(model.legendLayout, frame, {
|
|
4722
|
+
x: box.x,
|
|
4723
|
+
y: box.y,
|
|
4724
|
+
width: box.w,
|
|
4725
|
+
height: box.h
|
|
4726
|
+
});
|
|
4727
|
+
if (!manual) return { plot, markup: automatic.join(""), foreground: !!model.legendOverlay };
|
|
4728
|
+
const entries = legendEntries(model);
|
|
4729
|
+
const attrs = chartTextAttributes(model, "legend");
|
|
4730
|
+
const size = attrs.size ?? 10;
|
|
4731
|
+
const font = chartFontMetrics(attrs, options);
|
|
4732
|
+
const keySize = size / 2;
|
|
4733
|
+
const keyGap = size / 4;
|
|
4734
|
+
const widths = entries.map(
|
|
4735
|
+
(entry) => chartTextWidth(entry.label, attrs, options) + keySize + keyGap
|
|
4736
|
+
);
|
|
4737
|
+
const horizontal = manual.width > manual.height && widths.reduce((sum, width) => sum + width, 0) + size <= manual.width;
|
|
4738
|
+
const rowWidth = horizontal ? manual.width / entries.length : manual.width;
|
|
4739
|
+
const rowHeight = horizontal ? manual.height : manual.height / entries.length;
|
|
4740
|
+
const horizontalGap = Math.max(
|
|
4741
|
+
0,
|
|
4742
|
+
(manual.width - widths.reduce((sum, width) => sum + width, 0)) / (entries.length + 1)
|
|
4743
|
+
);
|
|
4744
|
+
let horizontalX = manual.x + horizontalGap;
|
|
4745
|
+
const markup = [
|
|
4746
|
+
chartAreaRect(model, "legend", { x: manual.x, y: manual.y, w: manual.width, h: manual.height })
|
|
4747
|
+
];
|
|
4748
|
+
const baselineOffset = font ? (font.ascent - font.descent) / 2 : size * 0.35;
|
|
4749
|
+
entries.forEach((entry, i) => {
|
|
4750
|
+
const available = horizontal ? chartTextWidth(entry.label, attrs, options) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
|
|
4751
|
+
const label = fitChartText(entry.label, available, attrs, options);
|
|
4752
|
+
const contentWidth = Math.min(
|
|
4753
|
+
horizontal ? widths[i] ?? 0 : Math.max(...widths),
|
|
4754
|
+
rowWidth - size / 2
|
|
4755
|
+
);
|
|
4756
|
+
const x = horizontal ? horizontalX : manual.x + Math.max(size / 4, (rowWidth - contentWidth) / 2);
|
|
4757
|
+
const centerY = manual.y + (horizontal ? 0 : i * rowHeight) + rowHeight / 2;
|
|
4758
|
+
markup.push(rect(x, centerY - keySize / 2, keySize, keySize, entry.color));
|
|
4759
|
+
markup.push(text(x + keySize + keyGap, centerY + baselineOffset, label, attrs));
|
|
4760
|
+
if (horizontal) horizontalX += (widths[i] ?? 0) + horizontalGap;
|
|
4761
|
+
});
|
|
4762
|
+
return {
|
|
4763
|
+
plot,
|
|
4764
|
+
markup: `<g data-chart-legend-layout="true">${markup.join("")}</g>`,
|
|
4765
|
+
foreground: true
|
|
4766
|
+
};
|
|
4767
|
+
}
|
|
4768
|
+
function legendEntries(model) {
|
|
4769
|
+
if (model.type === "pie" || model.type === "doughnut") {
|
|
4770
|
+
const first3 = model.series[0];
|
|
4771
|
+
return model.categories.map((label, i) => ({
|
|
4772
|
+
label,
|
|
4773
|
+
color: first3?.pointColors?.[i] ?? first3?.color ?? "#4472C4"
|
|
4774
|
+
}));
|
|
4775
|
+
}
|
|
4776
|
+
return model.series.map((s) => ({ label: s.name, color: s.color }));
|
|
4777
|
+
}
|
|
4778
|
+
function automaticLegend(model, area, out, options, bounds) {
|
|
4779
|
+
const entries = legendEntries(model);
|
|
4780
|
+
if (!model.showLegend || entries.length === 0) return area;
|
|
4781
|
+
const pos = model.legendPosition;
|
|
4782
|
+
const attrs = chartTextAttributes(model, "legend");
|
|
4783
|
+
const size = attrs.size ?? 10;
|
|
4784
|
+
const rowH = Math.max(16, size * 1.4);
|
|
4785
|
+
if (pos === "t" || pos === "b") {
|
|
4786
|
+
const widths = entries.map(
|
|
4787
|
+
(e) => Math.min(chartTextWidth(e.label, attrs, options) + 20, area.w / 2)
|
|
4788
|
+
);
|
|
4789
|
+
const total = widths.reduce((a, b) => a + b, 0);
|
|
4790
|
+
let x2 = area.x + Math.max(0, (area.w - total) / 2);
|
|
4791
|
+
const y = pos === "t" ? area.y + 4 : area.y + area.h - rowH + 4;
|
|
4792
|
+
bounds.box = { x: x2 - 4, y: y - 4, w: Math.min(total, area.w) + 8, h: rowH + 4 };
|
|
4793
|
+
out.push(
|
|
4794
|
+
chartAreaRect(model, "legend", {
|
|
4795
|
+
x: x2 - 4,
|
|
4796
|
+
y: y - 4,
|
|
4797
|
+
w: Math.min(total, area.w) + 8,
|
|
4798
|
+
h: rowH + 4
|
|
4799
|
+
})
|
|
4800
|
+
);
|
|
4801
|
+
entries.forEach((e, i) => {
|
|
4802
|
+
const w = widths[i] ?? 0;
|
|
4803
|
+
out.push(rect(x2, y, 8, 8, e.color));
|
|
4804
|
+
out.push(text(x2 + 12, y + 8, fitChartText(e.label, w - 16, attrs, options), attrs));
|
|
4805
|
+
x2 += w;
|
|
4806
|
+
});
|
|
4807
|
+
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 };
|
|
4808
|
+
}
|
|
4809
|
+
const width = Math.min(
|
|
4810
|
+
area.w * 0.35,
|
|
4811
|
+
Math.max(...entries.map((e) => chartTextWidth(e.label, attrs, options))) + 22
|
|
4812
|
+
);
|
|
4813
|
+
const height = entries.length * rowH;
|
|
4814
|
+
const x = pos === "l" ? area.x + 4 : area.x + area.w - width;
|
|
4815
|
+
const y0 = pos === "tr" ? area.y + 4 : area.y + Math.max(0, (area.h - height) / 2);
|
|
4816
|
+
bounds.box = { x: x - 4, y: y0, w: width + 4, h: Math.min(height, area.y + area.h - y0) };
|
|
4817
|
+
out.push(
|
|
4818
|
+
chartAreaRect(model, "legend", {
|
|
4819
|
+
x: x - 4,
|
|
4820
|
+
y: y0,
|
|
4821
|
+
w: width + 4,
|
|
4822
|
+
h: Math.min(height, area.y + area.h - y0)
|
|
4823
|
+
})
|
|
4824
|
+
);
|
|
4825
|
+
entries.forEach((e, i) => {
|
|
4826
|
+
const y = y0 + i * rowH;
|
|
4827
|
+
if (y + rowH > area.y + area.h + 2) return;
|
|
4828
|
+
out.push(rect(x, y + 3, 8, 8, e.color));
|
|
4829
|
+
out.push(text(x + 12, y + 11, fitChartText(e.label, width - 16, attrs, options), attrs));
|
|
4830
|
+
});
|
|
4831
|
+
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 };
|
|
4832
|
+
}
|
|
4833
|
+
|
|
4834
|
+
// text/wrap-styled-runs.ts
|
|
4835
|
+
var graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
4836
|
+
function wrapStyledRuns(runs, maxWidth, measure, options = {}) {
|
|
4837
|
+
const groups = [];
|
|
4838
|
+
for (const [source, run] of runs.entries()) {
|
|
4839
|
+
for (const token of run.text.split(/(\r\n|[\r\n]|[ \t]+)/u).filter(Boolean)) {
|
|
4840
|
+
const kind = /^[\r\n]+$/u.test(token) ? "break" : /^[ \t]+$/u.test(token) ? "space" : "word";
|
|
4841
|
+
let group = groups.at(-1);
|
|
4842
|
+
if (!group || group.kind !== kind || kind === "break") {
|
|
4843
|
+
group = { kind, pieces: [] };
|
|
4844
|
+
groups.push(group);
|
|
4845
|
+
}
|
|
4846
|
+
if (kind !== "break") group.pieces.push({ run, source, text: token });
|
|
4847
|
+
}
|
|
4848
|
+
}
|
|
4849
|
+
const merged = (left, right) => {
|
|
4850
|
+
const result2 = left.map((piece) => ({ ...piece }));
|
|
4851
|
+
for (const piece of right) {
|
|
4852
|
+
const last = result2.at(-1);
|
|
4853
|
+
if (last?.source === piece.source) last.text += piece.text;
|
|
4854
|
+
else result2.push({ ...piece });
|
|
4855
|
+
}
|
|
4856
|
+
return result2;
|
|
4857
|
+
};
|
|
4858
|
+
const width = (pieces) => pieces.reduce((sum, piece) => {
|
|
4859
|
+
const advance = measure(piece.text, piece.run);
|
|
4860
|
+
return sum + (Number.isFinite(advance) && advance >= 0 ? advance : 0);
|
|
4861
|
+
}, 0);
|
|
4862
|
+
const result = [];
|
|
4863
|
+
let line2 = [];
|
|
4864
|
+
let spaces = [];
|
|
4865
|
+
const flush = () => {
|
|
4866
|
+
result.push(line2.map((piece) => ({ ...piece.run, text: piece.text })));
|
|
4867
|
+
line2 = [];
|
|
4868
|
+
spaces = [];
|
|
4869
|
+
};
|
|
4870
|
+
for (const group of groups) {
|
|
4871
|
+
if (group.kind === "break") {
|
|
4872
|
+
flush();
|
|
4873
|
+
continue;
|
|
4874
|
+
}
|
|
4875
|
+
if (group.kind === "space") {
|
|
4876
|
+
spaces = group.pieces;
|
|
4877
|
+
continue;
|
|
4878
|
+
}
|
|
4879
|
+
const separator = line2.length ? spaces : [];
|
|
4880
|
+
const wordWidth = width(group.pieces);
|
|
4881
|
+
if (line2.length && width(merged(line2, [...separator, ...group.pieces])) > maxWidth) flush();
|
|
4882
|
+
else line2 = merged(line2, separator);
|
|
4883
|
+
spaces = [];
|
|
4884
|
+
if (options.breakWords && wordWidth > maxWidth) {
|
|
4885
|
+
for (const piece of group.pieces) {
|
|
4886
|
+
for (const { segment } of graphemes.segment(piece.text)) {
|
|
4887
|
+
const next = { ...piece, text: segment };
|
|
4888
|
+
if (line2.length && width(merged(line2, [next])) > maxWidth) flush();
|
|
4889
|
+
line2 = merged(line2, [next]);
|
|
4890
|
+
}
|
|
4891
|
+
}
|
|
4892
|
+
} else line2 = merged(line2, group.pieces);
|
|
4893
|
+
}
|
|
4894
|
+
flush();
|
|
4895
|
+
return result;
|
|
4896
|
+
}
|
|
4897
|
+
|
|
4898
|
+
// chart/render/chart-svg-title-text.ts
|
|
4899
|
+
function spacing(value, naturalHeight, fallback) {
|
|
4900
|
+
return value ? value.unit === "points" ? chartPointsToPixels(value.value) : naturalHeight * value.value : fallback;
|
|
4901
|
+
}
|
|
4902
|
+
function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
|
|
4903
|
+
if (!model.title) return void 0;
|
|
4904
|
+
const base = chartTextAttributes(model, "title", 14);
|
|
4905
|
+
const capacity = Math.max(1, width * 0.8 - 8);
|
|
4906
|
+
if (!model.titleText && !hasManualLayoutFields(model.titleLayout) && !model.titleOverlay && !model.title.includes("\n") && chartTextWidth(model.title, base, options) <= capacity)
|
|
4907
|
+
return void 0;
|
|
4908
|
+
const paragraphs = model.titleText?.paragraphs ?? [
|
|
4909
|
+
{
|
|
4910
|
+
runs: [{ text: model.title, appearance: model.appearance?.title ?? {} }]
|
|
4911
|
+
}
|
|
4912
|
+
];
|
|
4913
|
+
const hardLines = [];
|
|
4914
|
+
for (const paragraph of paragraphs) {
|
|
4915
|
+
let line2 = {
|
|
4916
|
+
...paragraph,
|
|
4917
|
+
runs: []
|
|
4918
|
+
};
|
|
4919
|
+
hardLines.push(line2);
|
|
4920
|
+
for (const run of paragraph.runs) {
|
|
4921
|
+
const pieces = run.text.split("\n");
|
|
4922
|
+
for (const [index, piece] of pieces.entries()) {
|
|
4923
|
+
if (index) {
|
|
4924
|
+
line2 = { ...paragraph, runs: [] };
|
|
4925
|
+
hardLines.push(line2);
|
|
4926
|
+
}
|
|
4927
|
+
if (piece) line2.runs.push({ ...run, text: piece });
|
|
4928
|
+
}
|
|
4929
|
+
}
|
|
4930
|
+
}
|
|
4931
|
+
const lines = hardLines.flatMap((line2) => {
|
|
4932
|
+
const wrapped = wrapStyledRuns(
|
|
4933
|
+
line2.runs,
|
|
4934
|
+
capacity,
|
|
4935
|
+
(content, run) => chartTextWidth(
|
|
4936
|
+
content,
|
|
4937
|
+
chartTextAttributes(
|
|
4938
|
+
{ ...model, appearance: { title: run.appearance } },
|
|
4939
|
+
"title",
|
|
4940
|
+
base.size
|
|
4941
|
+
),
|
|
4942
|
+
options
|
|
4943
|
+
),
|
|
4944
|
+
{ breakWords: true }
|
|
4945
|
+
);
|
|
4946
|
+
const { spaceBefore, spaceAfter, ...properties4 } = line2;
|
|
4947
|
+
return wrapped.map((runs, index) => ({
|
|
4948
|
+
...properties4,
|
|
4949
|
+
runs,
|
|
4950
|
+
...index === 0 && spaceBefore ? { spaceBefore } : {},
|
|
4951
|
+
...index === wrapped.length - 1 && spaceAfter ? { spaceAfter } : {}
|
|
4952
|
+
}));
|
|
4953
|
+
});
|
|
4954
|
+
const metrics = lines.map((line2) => {
|
|
4955
|
+
const runs = line2.runs.map((run) => ({
|
|
4956
|
+
...run,
|
|
4957
|
+
attrs: chartTextAttributes(
|
|
4958
|
+
{ ...model, appearance: { title: run.appearance } },
|
|
4959
|
+
"title",
|
|
4960
|
+
base.size
|
|
4961
|
+
)
|
|
4962
|
+
}));
|
|
4963
|
+
return {
|
|
4964
|
+
...line2,
|
|
4965
|
+
runs,
|
|
4966
|
+
width: runs.reduce((sum, run) => sum + chartTextWidth(run.text, run.attrs, options), 0),
|
|
4967
|
+
size: runs.length ? Math.max(...runs.map((run) => run.attrs.size ?? 14)) : base.size ?? 14,
|
|
4968
|
+
fontMetrics: (runs.length ? runs.map((run) => run.attrs) : [base]).map(
|
|
4969
|
+
(attrs) => chartFontMetrics(attrs, options)
|
|
4970
|
+
)
|
|
4971
|
+
};
|
|
4972
|
+
});
|
|
4973
|
+
const measured = metrics.every((line2) => line2.fontMetrics.every((font) => font !== void 0));
|
|
4974
|
+
const vertical = metrics.map((line2) => {
|
|
4975
|
+
const ascent = measured ? Math.max(...line2.fontMetrics.map((font) => font.ascent)) : line2.size;
|
|
4976
|
+
const descent = measured ? Math.max(...line2.fontMetrics.map((font) => font.descent)) : line2.size * 0.4 + 4;
|
|
4977
|
+
const natural = ascent + descent;
|
|
4978
|
+
const height2 = spacing(line2.lineSpacing, natural, natural);
|
|
4979
|
+
const leading = (height2 - natural) / 2;
|
|
4980
|
+
return {
|
|
4981
|
+
ascent: ascent + leading,
|
|
4982
|
+
descent: descent + leading,
|
|
4983
|
+
height: height2,
|
|
4984
|
+
before: spacing(line2.spaceBefore, natural, 0),
|
|
4985
|
+
after: spacing(line2.spaceAfter, natural, 0),
|
|
4986
|
+
leading
|
|
4987
|
+
};
|
|
4988
|
+
});
|
|
4989
|
+
const boxWidth = Math.min(width - 16, Math.max(0, ...metrics.map((line2) => line2.width)) + 8);
|
|
4990
|
+
const height = vertical.reduce(
|
|
4991
|
+
(sum, line2) => sum + line2.height + line2.before + line2.after,
|
|
4992
|
+
measured ? 4 : 0
|
|
4993
|
+
);
|
|
4994
|
+
let baseline = 8 + (metrics[0]?.size ?? base.size ?? 14) + (vertical[0]?.before ?? 0) + (vertical[0]?.leading ?? 0);
|
|
4995
|
+
const spans = [];
|
|
4996
|
+
for (const [index, line2] of metrics.entries()) {
|
|
4997
|
+
if (index)
|
|
4998
|
+
baseline += vertical[index - 1].descent + vertical[index - 1].after + vertical[index].before + vertical[index].ascent;
|
|
4999
|
+
let x = line2.align === "l" ? (width - boxWidth) / 2 + 4 : line2.align === "r" ? (width + boxWidth) / 2 - 4 - line2.width : (width - line2.width) / 2;
|
|
5000
|
+
for (const run of line2.runs) {
|
|
5001
|
+
spans.push(
|
|
5002
|
+
text(x, baseline, run.text, {
|
|
5003
|
+
...run.attrs,
|
|
5004
|
+
anchor: "start"
|
|
5005
|
+
}).replace("<text ", '<tspan data-chart-title-run="true" ').replace("</text>", "</tspan>")
|
|
5006
|
+
);
|
|
5007
|
+
x += chartTextWidth(run.text, run.attrs, options);
|
|
5008
|
+
}
|
|
5009
|
+
}
|
|
5010
|
+
const parent = text(0, 0, "", { ...base, underline: false }).replace(
|
|
5011
|
+
"</text>",
|
|
5012
|
+
`${spans.join("")}</text>`
|
|
5013
|
+
);
|
|
5014
|
+
const markup = chartAreaRect(model, "title", {
|
|
5015
|
+
x: (width - boxWidth) / 2,
|
|
5016
|
+
y: 4,
|
|
5017
|
+
w: Math.max(0, boxWidth),
|
|
5018
|
+
h: height
|
|
5019
|
+
}) + parent;
|
|
5020
|
+
const automatic = { x: (width - boxWidth) / 2, y: 4, width: boxWidth, height };
|
|
5021
|
+
const manual = resolveManualLayoutRect(
|
|
5022
|
+
model.titleLayout,
|
|
5023
|
+
{ width, height: frameHeight },
|
|
5024
|
+
automatic
|
|
5025
|
+
);
|
|
5026
|
+
return {
|
|
5027
|
+
markup: manual ? `<g data-chart-title-layout="true" transform="translate(${n(manual.x - automatic.x)} ${n(manual.y - automatic.y)})">${markup}</g>` : markup,
|
|
5028
|
+
height: Math.max(24, height)
|
|
5029
|
+
};
|
|
5030
|
+
}
|
|
5031
|
+
|
|
5032
|
+
// chart/render/chart-svg.ts
|
|
5033
|
+
function renderChartSvg(model, width, height, options = {}) {
|
|
5034
|
+
const paint = chartGradientPaint(model, Math.max(1, width), Math.max(1, height));
|
|
5035
|
+
model = paint.model;
|
|
5036
|
+
const w = Math.max(1, width);
|
|
5037
|
+
const h = Math.max(1, height);
|
|
5038
|
+
const out = [];
|
|
5039
|
+
let foregroundTitle = "";
|
|
5040
|
+
out.push(
|
|
5041
|
+
`<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">`
|
|
5042
|
+
);
|
|
5043
|
+
if (model.title) out.push(`<title>${esc(model.title)}</title>`);
|
|
5044
|
+
if (paint.defs) out.push(paint.defs);
|
|
5045
|
+
out.push(chartAreaRect(model, "chartArea", { x: 0, y: 0, w, h }));
|
|
5046
|
+
let area = { x: 8, y: 8, w: w - 16, h: h - 16 };
|
|
5047
|
+
const richTitle = chartRichTitleSvg(model, w, options, h);
|
|
5048
|
+
if (richTitle) {
|
|
5049
|
+
if (model.titleLayout || model.titleOverlay) foregroundTitle = richTitle.markup;
|
|
5050
|
+
else out.push(richTitle.markup);
|
|
5051
|
+
if (!model.titleOverlay)
|
|
5052
|
+
area = { ...area, y: area.y + richTitle.height, h: area.h - richTitle.height };
|
|
5053
|
+
} else if (model.title) {
|
|
5054
|
+
const attrs = chartTextAttributes(model, "title", 14);
|
|
5055
|
+
const size = attrs.size ?? 14;
|
|
5056
|
+
const label = fitChartText(model.title, w - 16, attrs, options);
|
|
5057
|
+
const titleWidth = Math.min(w - 16, chartTextWidth(label, attrs, options) + 8);
|
|
5058
|
+
const font = chartFontMetrics(attrs, options);
|
|
5059
|
+
const titleHeight = Math.max(24, font ? font.ascent + font.descent + 4 : size * 1.4 + 4);
|
|
5060
|
+
out.push(
|
|
5061
|
+
chartAreaRect(model, "title", {
|
|
5062
|
+
x: (w - titleWidth) / 2,
|
|
5063
|
+
y: 4,
|
|
5064
|
+
w: Math.max(0, titleWidth),
|
|
5065
|
+
h: font ? font.ascent + font.descent + 4 : size * 1.4 + 4
|
|
5066
|
+
})
|
|
5067
|
+
);
|
|
5068
|
+
out.push(
|
|
5069
|
+
text(w / 2, 8 + size, label, {
|
|
5070
|
+
anchor: "middle",
|
|
5071
|
+
fill: "#404040",
|
|
5072
|
+
...attrs
|
|
5073
|
+
})
|
|
5074
|
+
);
|
|
5075
|
+
if (!model.titleOverlay)
|
|
5076
|
+
area = { x: area.x, y: area.y + titleHeight, w: area.w, h: area.h - titleHeight };
|
|
5077
|
+
}
|
|
5078
|
+
if (!model.supported) {
|
|
5079
|
+
out.push(
|
|
5080
|
+
text(w / 2, area.y + area.h / 2, `${model.type} charts are not drawn`, { anchor: "middle" })
|
|
5081
|
+
);
|
|
5082
|
+
if (foregroundTitle) out.push(foregroundTitle);
|
|
5083
|
+
out.push("</svg>");
|
|
5084
|
+
return out.join("");
|
|
5085
|
+
}
|
|
5086
|
+
const legend = chartLegendSvg(model, area, { width: w, height: h }, options);
|
|
5087
|
+
area = legend.plot;
|
|
5088
|
+
if (!legend.foreground) out.push(legend.markup);
|
|
5089
|
+
if (area.w > 4 && area.h > 4) {
|
|
5090
|
+
if (model.type === "pie" || model.type === "doughnut") out.push(pieSvg(model, area));
|
|
5091
|
+
else if (model.type === "radar") out.push(radarSvg(model, area));
|
|
5092
|
+
else out.push(cartesianSvg(model, area));
|
|
5093
|
+
}
|
|
5094
|
+
if (legend.foreground) out.push(legend.markup);
|
|
5095
|
+
if (foregroundTitle) out.push(foregroundTitle);
|
|
5096
|
+
out.push("</svg>");
|
|
5097
|
+
return out.join("");
|
|
5098
|
+
}
|
|
5099
|
+
|
|
5100
|
+
// chart/render/render-space.ts
|
|
5101
|
+
var DRAWN_CHART_TYPES = /* @__PURE__ */ new Set([
|
|
5102
|
+
"bar",
|
|
5103
|
+
"column",
|
|
5104
|
+
"line",
|
|
5105
|
+
"area",
|
|
5106
|
+
"pie",
|
|
5107
|
+
"doughnut",
|
|
5108
|
+
"scatter",
|
|
5109
|
+
"radar"
|
|
5110
|
+
]);
|
|
5111
|
+
function chartThemePalette(theme, fonts = {}) {
|
|
5112
|
+
return {
|
|
5113
|
+
colors: THEME_SLOTS.map(
|
|
5114
|
+
(slot, index) => themeSlotHex(theme?.colors[slot]) ?? DEFAULT_THEME_COLORS[index] ?? "000000"
|
|
5115
|
+
),
|
|
5116
|
+
majorFont: fonts.major ?? "Calibri Light",
|
|
5117
|
+
minorFont: fonts.minor ?? "Calibri"
|
|
5118
|
+
};
|
|
5119
|
+
}
|
|
5120
|
+
function chartSpaceKind(space) {
|
|
5121
|
+
if (!space.plotArea.groups.length) return { drawn: false };
|
|
5122
|
+
const type = chartSummaryFromSpace(space).chartType;
|
|
5123
|
+
return { type, drawn: DRAWN_CHART_TYPES.has(type) };
|
|
5124
|
+
}
|
|
5125
|
+
function renderChartSpaceSvg(space, options) {
|
|
5126
|
+
const { width, height, theme, fonts, formatting, colorPalette, styleDefinition, ...svg } = options;
|
|
5127
|
+
const summary = chartSummaryFromSpace(space, {
|
|
5128
|
+
...formatting ? { formatting } : {},
|
|
5129
|
+
...colorPalette !== void 0 ? { colorPalette } : {},
|
|
5130
|
+
...styleDefinition ? { styleDefinition } : {}
|
|
5131
|
+
});
|
|
5132
|
+
const view = chartSummaryView(summary, chartThemePalette(theme, fonts));
|
|
5133
|
+
return renderChartSvg(view, width, height, svg);
|
|
5134
|
+
}
|
|
5135
|
+
|
|
5136
|
+
// docx/breaks.ts
|
|
5137
|
+
function isCachedPageBreak(element) {
|
|
5138
|
+
return named2(element, "lastRenderedPageBreak") && !element.childNodes.length && Array.from(element.attributes).every(
|
|
5139
|
+
(attribute) => attribute.namespaceURI === "http://www.w3.org/2000/xmlns/"
|
|
5140
|
+
);
|
|
5141
|
+
}
|
|
5142
|
+
function hasSpecialBreak(element) {
|
|
5143
|
+
for (const attribute of Array.from(element.attributes)) {
|
|
5144
|
+
if (attribute.namespaceURI === "http://www.w3.org/2000/xmlns/") continue;
|
|
5145
|
+
if (attribute.namespaceURI !== WORD_NS) return true;
|
|
5146
|
+
if (attribute.localName === "type") {
|
|
5147
|
+
if (attribute.value !== "textWrapping") return true;
|
|
5148
|
+
} else if (attribute.localName === "clear") {
|
|
5149
|
+
if (attribute.value !== "none") return true;
|
|
5150
|
+
} else return true;
|
|
5151
|
+
}
|
|
5152
|
+
return false;
|
|
5153
|
+
}
|
|
5154
|
+
function classifyBreak(element) {
|
|
5155
|
+
const type = getW(element, "type");
|
|
5156
|
+
return type === "page" || type === "column" ? type : "textWrapping";
|
|
5157
|
+
}
|
|
5158
|
+
function isModeledBreak(element) {
|
|
5159
|
+
const kind = classifyBreak(element);
|
|
5160
|
+
if (kind === "textWrapping") return false;
|
|
5161
|
+
for (const attribute of Array.from(element.attributes)) {
|
|
5162
|
+
if (attribute.namespaceURI === "http://www.w3.org/2000/xmlns/") continue;
|
|
5163
|
+
if (attribute.namespaceURI !== WORD_NS || attribute.localName !== "type") return false;
|
|
5164
|
+
}
|
|
5165
|
+
return true;
|
|
5166
|
+
}
|
|
5167
|
+
|
|
2818
5168
|
// docx/write-drawing.ts
|
|
2819
5169
|
var A_NS2 = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
2820
5170
|
var WP_NS2 = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing";
|
|
@@ -3150,11 +5500,11 @@ function createRun(doc, run, base, old, allocator) {
|
|
|
3150
5500
|
if (piece === "\n") node.appendChild(makeW(doc, "br"));
|
|
3151
5501
|
else if (piece === " ") node.appendChild(makeW(doc, "tab"));
|
|
3152
5502
|
else if (piece) {
|
|
3153
|
-
const
|
|
5503
|
+
const text2 = makeW(doc, "t");
|
|
3154
5504
|
if (/^\s|\s$/.test(piece))
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
node.appendChild(
|
|
5505
|
+
text2.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
|
|
5506
|
+
text2.appendChild(doc.createTextNode(piece));
|
|
5507
|
+
node.appendChild(text2);
|
|
3158
5508
|
}
|
|
3159
5509
|
}
|
|
3160
5510
|
if (!run.text) node.appendChild(makeW(doc, "t"));
|
|
@@ -3221,38 +5571,6 @@ function preserveEquation(run, base, old) {
|
|
|
3221
5571
|
"Equation editing or insertion is unsupported; imported OMML must remain unchanged."
|
|
3222
5572
|
);
|
|
3223
5573
|
}
|
|
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
5574
|
function isCommentReferenceRun(run) {
|
|
3257
5575
|
const content = Array.from(run.childNodes).filter(
|
|
3258
5576
|
(child) => isElement(child) && !named2(child, "rPr")
|
|
@@ -3464,18 +5782,18 @@ function parseDirectParagraphProperties(props) {
|
|
|
3464
5782
|
if (shading) paragraph.shadingFill = shading;
|
|
3465
5783
|
const tabStops = parseTabStops(first2(props, "tabs"));
|
|
3466
5784
|
if (tabStops.length) paragraph.tabStops = tabStops;
|
|
3467
|
-
const
|
|
3468
|
-
const before = twipValue2(getW(
|
|
3469
|
-
const after = twipValue2(getW(
|
|
3470
|
-
const
|
|
5785
|
+
const spacing2 = first2(props, "spacing");
|
|
5786
|
+
const before = twipValue2(getW(spacing2, "before"));
|
|
5787
|
+
const after = twipValue2(getW(spacing2, "after"));
|
|
5788
|
+
const line2 = signedTwipValue2(getW(spacing2, "line"));
|
|
3471
5789
|
if (before !== void 0) paragraph.spacingBeforeTwips = before;
|
|
3472
5790
|
if (after !== void 0) paragraph.spacingAfterTwips = after;
|
|
3473
|
-
if (
|
|
3474
|
-
paragraph.lineSpacingTwips =
|
|
5791
|
+
if (line2 !== void 0) {
|
|
5792
|
+
paragraph.lineSpacingTwips = line2;
|
|
3475
5793
|
}
|
|
3476
|
-
const rule = getW(
|
|
5794
|
+
const rule = getW(spacing2, "lineRule");
|
|
3477
5795
|
if (rule === "auto" || rule === "exact" || rule === "atLeast") paragraph.lineSpacingRule = rule;
|
|
3478
|
-
else if (
|
|
5796
|
+
else if (line2 !== void 0) paragraph.lineSpacingRule = "auto";
|
|
3479
5797
|
const indent = first2(props, "ind");
|
|
3480
5798
|
const indentLeft = signedTwipValue2(getW(indent, "left"));
|
|
3481
5799
|
const indentRight = signedTwipValue2(getW(indent, "right"));
|
|
@@ -3607,9 +5925,9 @@ function resolveNumberingLevel(catalog, numId, level) {
|
|
|
3607
5925
|
let base = override?.lvl ?? abstract;
|
|
3608
5926
|
if (!base) return void 0;
|
|
3609
5927
|
if (override?.lvl) {
|
|
3610
|
-
const { lvlRestart: _ignored, ...
|
|
5928
|
+
const { lvlRestart: _ignored, ...properties4 } = base;
|
|
3611
5929
|
base = {
|
|
3612
|
-
...
|
|
5930
|
+
...properties4,
|
|
3613
5931
|
...abstract?.lvlRestart !== void 0 ? { lvlRestart: abstract.lvlRestart } : {}
|
|
3614
5932
|
};
|
|
3615
5933
|
}
|
|
@@ -3635,6 +5953,37 @@ function documentBlockLists(model) {
|
|
|
3635
5953
|
];
|
|
3636
5954
|
}
|
|
3637
5955
|
|
|
5956
|
+
// docx/chart-paint.ts
|
|
5957
|
+
function themeCatalogColorScheme(theme) {
|
|
5958
|
+
const colors = {};
|
|
5959
|
+
for (const [slot, value] of Object.entries(theme?.colors ?? {}))
|
|
5960
|
+
if (value) colors[slot] = { kind: "srgb", value: value.replace(/^#/, ""), transforms: [] };
|
|
5961
|
+
return { colors };
|
|
5962
|
+
}
|
|
5963
|
+
function docxChartPaint(chart, widthPx, heightPx, theme) {
|
|
5964
|
+
const space = chart?.chartSpace;
|
|
5965
|
+
if (!space) return { label: "Chart" };
|
|
5966
|
+
const kind = chartSpaceKind(space);
|
|
5967
|
+
if (!kind.drawn) return { label: kind.type ? `Chart (${kind.type})` : "Chart" };
|
|
5968
|
+
try {
|
|
5969
|
+
const fonts = {
|
|
5970
|
+
...theme?.fonts.major.latin ? { major: theme.fonts.major.latin } : {},
|
|
5971
|
+
...theme?.fonts.minor.latin ? { minor: theme.fonts.minor.latin } : {}
|
|
5972
|
+
};
|
|
5973
|
+
const svg = renderChartSpaceSvg(space, {
|
|
5974
|
+
width: Math.max(1, Math.round(widthPx)),
|
|
5975
|
+
height: Math.max(1, Math.round(heightPx)),
|
|
5976
|
+
theme: themeCatalogColorScheme(theme),
|
|
5977
|
+
fonts,
|
|
5978
|
+
...chart.formatting ? { formatting: chart.formatting } : {},
|
|
5979
|
+
...chart.colorPalette !== void 0 ? { colorPalette: chart.colorPalette } : {}
|
|
5980
|
+
});
|
|
5981
|
+
return { svg, label: chart.title ? `Chart: ${chart.title}` : "Chart" };
|
|
5982
|
+
} catch {
|
|
5983
|
+
return { label: kind.type ? `Chart (${kind.type})` : "Chart" };
|
|
5984
|
+
}
|
|
5985
|
+
}
|
|
5986
|
+
|
|
3638
5987
|
// docx/diagram-theme.ts
|
|
3639
5988
|
function diagramColorTheme(theme) {
|
|
3640
5989
|
return {
|
|
@@ -3702,20 +6051,20 @@ function restoreParagraphFormatting(paragraph) {
|
|
|
3702
6051
|
throw new Error(
|
|
3703
6052
|
"Cannot reject a paragraph formatting revision without its prior properties snapshot."
|
|
3704
6053
|
);
|
|
3705
|
-
const
|
|
6054
|
+
const properties4 = parsePropertiesSnapshot(xml, "pPr");
|
|
3706
6055
|
if (paragraph.sourceParagraphPropertiesXml) {
|
|
3707
6056
|
const current = parsePropertiesSnapshot(paragraph.sourceParagraphPropertiesXml, "pPr");
|
|
3708
6057
|
for (const name of ["rPr", "sectPr"]) {
|
|
3709
6058
|
const element = first2(current, name);
|
|
3710
|
-
if (element && !first2(
|
|
3711
|
-
|
|
6059
|
+
if (element && !first2(properties4, name))
|
|
6060
|
+
properties4.appendChild(properties4.ownerDocument.importNode(element, true));
|
|
3712
6061
|
}
|
|
3713
|
-
orderParagraphProperties(
|
|
6062
|
+
orderParagraphProperties(properties4);
|
|
3714
6063
|
}
|
|
3715
|
-
const previous = parseDirectParagraphProperties(
|
|
6064
|
+
const previous = parseDirectParagraphProperties(properties4);
|
|
3716
6065
|
for (const key of PARAGRAPH_FORMAT_KEYS) delete paragraph[key];
|
|
3717
6066
|
Object.assign(paragraph, previous);
|
|
3718
|
-
paragraph.restoredParagraphPropertiesXml = buildXml(
|
|
6067
|
+
paragraph.restoredParagraphPropertiesXml = buildXml(properties4);
|
|
3719
6068
|
if (paragraph.sourceParagraphPropertiesXml)
|
|
3720
6069
|
paragraph.sourceParagraphPropertiesXml = paragraph.restoredParagraphPropertiesXml;
|
|
3721
6070
|
delete paragraph.formatRevision;
|
|
@@ -4339,7 +6688,8 @@ function runToInlineNodes(run, schema, noteNumber) {
|
|
|
4339
6688
|
textBoxText: run.image.textBoxText ? JSON.stringify(run.image.textBoxText) : null,
|
|
4340
6689
|
textBoxEditable: run.image.textBoxEditable ?? null,
|
|
4341
6690
|
textBoxBorder: run.image.textBoxBorder ?? null,
|
|
4342
|
-
diagram: run.image.diagram ? JSON.stringify(run.image.diagram) : null
|
|
6691
|
+
diagram: run.image.diagram ? JSON.stringify(run.image.diagram) : null,
|
|
6692
|
+
chart: run.image.chart ? JSON.stringify(run.image.chart) : null
|
|
4343
6693
|
},
|
|
4344
6694
|
void 0,
|
|
4345
6695
|
marks2
|
|
@@ -4361,8 +6711,8 @@ function applyInlineFormat(run, child) {
|
|
|
4361
6711
|
Object.assign(run, inlineRunProperties(child));
|
|
4362
6712
|
const marks = { text: "", ...run.revision ? { revision: run.revision } : {} };
|
|
4363
6713
|
applyMarkFormatting(marks, child);
|
|
4364
|
-
const { text: _text, ...
|
|
4365
|
-
Object.assign(run,
|
|
6714
|
+
const { text: _text, ...properties4 } = marks;
|
|
6715
|
+
Object.assign(run, properties4);
|
|
4366
6716
|
const ids = commentIdsFromNode(child);
|
|
4367
6717
|
if (ids.length) run.commentIds = ids;
|
|
4368
6718
|
else delete run.commentIds;
|
|
@@ -4423,6 +6773,7 @@ function appendInlineNode(runs, child) {
|
|
|
4423
6773
|
// Same key order as the parser's run: the writer compares an unchanged placeholder run by JSON.
|
|
4424
6774
|
...child.attrs.unsupported ? { unsupported: child.attrs.unsupported } : {},
|
|
4425
6775
|
...typeof child.attrs.diagram === "string" ? { diagram: JSON.parse(child.attrs.diagram) } : {},
|
|
6776
|
+
...typeof child.attrs.chart === "string" ? { chart: JSON.parse(child.attrs.chart) } : {},
|
|
4426
6777
|
...typeof child.attrs.placement === "string" ? { placement: JSON.parse(child.attrs.placement) } : {},
|
|
4427
6778
|
...typeof child.attrs.textBoxText === "string" ? { textBoxText: JSON.parse(child.attrs.textBoxText) } : {},
|
|
4428
6779
|
...child.attrs.textBoxEditable ? { textBoxEditable: true } : {},
|
|
@@ -4524,9 +6875,9 @@ function fieldClipboardSlice(slice) {
|
|
|
4524
6875
|
});
|
|
4525
6876
|
return node.copy(Fragment.fromArray(children4));
|
|
4526
6877
|
}
|
|
4527
|
-
const
|
|
6878
|
+
const properties4 = !node.isText && node.type.spec.attrs?.format ? inlineRunProperties(node) : void 0;
|
|
4528
6879
|
const field = node.marks.find((mark) => mark.type.name === "field");
|
|
4529
|
-
const cached2 =
|
|
6880
|
+
const cached2 = properties4?.field;
|
|
4530
6881
|
if (!field && !cached2) return node;
|
|
4531
6882
|
if (!(field?.attrs.simple ?? cached2?.simple) && complete.has(pos)) return node;
|
|
4532
6883
|
const marks = node.marks.flatMap((mark) => {
|
|
@@ -4535,8 +6886,8 @@ function fieldClipboardSlice(slice) {
|
|
|
4535
6886
|
const { fieldInstanceId: _identity, fieldFlags: _flags2, ...props } = mark.attrs.props ?? {};
|
|
4536
6887
|
return Object.keys(props).length ? [mark.type.create({ ...mark.attrs, props })] : [];
|
|
4537
6888
|
});
|
|
4538
|
-
if (!
|
|
4539
|
-
const { field: _field, fieldInstanceId: _id, fieldFlags: _flags, ...literal } =
|
|
6889
|
+
if (!properties4 || !cached2) return node.mark(marks);
|
|
6890
|
+
const { field: _field, fieldInstanceId: _id, fieldFlags: _flags, ...literal } = properties4;
|
|
4540
6891
|
return node.type.create(
|
|
4541
6892
|
updatedInlineRunAttributes(
|
|
4542
6893
|
node,
|
|
@@ -4587,7 +6938,7 @@ function fieldResultRanges(doc) {
|
|
|
4587
6938
|
}
|
|
4588
6939
|
|
|
4589
6940
|
// docx/ui/simple-field-input.ts
|
|
4590
|
-
var
|
|
6941
|
+
var graphemes2 = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
4591
6942
|
function targetField(state, from, to) {
|
|
4592
6943
|
return fieldResultRanges(state.doc).find(
|
|
4593
6944
|
(range) => range.mark.attrs.simple && from >= range.from && to <= range.to && (from !== to || from > range.from && from < range.to)
|
|
@@ -4601,14 +6952,14 @@ function resultMarks(node, field) {
|
|
|
4601
6952
|
...typeof id === "string" && { fieldInstanceId: id },
|
|
4602
6953
|
...source?.fieldFlags && { fieldFlags: source.fieldFlags }
|
|
4603
6954
|
};
|
|
4604
|
-
const
|
|
4605
|
-
if (
|
|
4606
|
-
const old =
|
|
6955
|
+
const properties4 = node.type.schema.marks.runProperties;
|
|
6956
|
+
if (properties4) {
|
|
6957
|
+
const old = properties4.isInSet(marks);
|
|
4607
6958
|
const { fieldInstanceId: _identity, fieldFlags: _flags, ...other } = old?.attrs.props ?? {};
|
|
4608
6959
|
const props = { ...other, ...state };
|
|
4609
|
-
marks =
|
|
6960
|
+
marks = properties4.removeFromSet(marks);
|
|
4610
6961
|
if (Object.keys(props).length)
|
|
4611
|
-
marks =
|
|
6962
|
+
marks = properties4.create({ ...old?.attrs ?? {}, props }).addToSet(marks);
|
|
4612
6963
|
}
|
|
4613
6964
|
return marks;
|
|
4614
6965
|
}
|
|
@@ -4634,19 +6985,19 @@ function simpleFieldPasteSlice(slice, state) {
|
|
|
4634
6985
|
slice.content.forEach((node) => children3.push(project(node)));
|
|
4635
6986
|
return new Slice(Fragment.fromArray(children3), slice.openStart, slice.openEnd);
|
|
4636
6987
|
}
|
|
4637
|
-
function replaceSimpleFieldResult(state, from, to,
|
|
6988
|
+
function replaceSimpleFieldResult(state, from, to, text2) {
|
|
4638
6989
|
const field = targetField(state, from, to);
|
|
4639
6990
|
if (!field) return null;
|
|
4640
|
-
if (!
|
|
6991
|
+
if (!text2) {
|
|
4641
6992
|
const tr2 = state.tr;
|
|
4642
6993
|
if (!emptySimpleFieldResult(tr2, from, to)) return null;
|
|
4643
6994
|
return tr2.setSelection(TextSelection.create(tr2.doc, from + 3));
|
|
4644
6995
|
}
|
|
4645
6996
|
const $from = state.doc.resolve(from);
|
|
4646
6997
|
const marks = state.storedMarks ?? (from === to ? $from.marks() : $from.marksAcross(state.doc.resolve(to)));
|
|
4647
|
-
const node = state.schema.text(
|
|
6998
|
+
const node = state.schema.text(text2, marks);
|
|
4648
6999
|
const tr = state.tr.replaceRangeWith(from, to, node.mark(resultMarks(node, field)));
|
|
4649
|
-
if (!tr.selection.empty && tr.selection.to === from +
|
|
7000
|
+
if (!tr.selection.empty && tr.selection.to === from + text2.length)
|
|
4650
7001
|
tr.setSelection(TextSelection.near(tr.selection.$to));
|
|
4651
7002
|
return tr;
|
|
4652
7003
|
}
|
|
@@ -4680,7 +7031,7 @@ function deleteSimpleFieldResult(state, backward) {
|
|
|
4680
7031
|
(range) => range.mark.attrs.simple && (backward ? range.to === from : range.from === from)
|
|
4681
7032
|
);
|
|
4682
7033
|
if (!field) return null;
|
|
4683
|
-
const segments =
|
|
7034
|
+
const segments = graphemes2.segment(field.text)[Symbol.iterator]();
|
|
4684
7035
|
if (segments.next().done || !segments.next().done) return null;
|
|
4685
7036
|
return replaceSimpleFieldResult(state, field.from, field.to, "");
|
|
4686
7037
|
}
|
|
@@ -4718,10 +7069,10 @@ function fieldGuardPlugin() {
|
|
|
4718
7069
|
if (!view.editable || !event.clipboardData) return false;
|
|
4719
7070
|
const tr = deleteFieldSelection(view.state);
|
|
4720
7071
|
if (!tr) return false;
|
|
4721
|
-
const { dom, text } = view.serializeForClipboard(view.state.selection.content());
|
|
7072
|
+
const { dom, text: text2 } = view.serializeForClipboard(view.state.selection.content());
|
|
4722
7073
|
event.clipboardData.clearData();
|
|
4723
7074
|
event.clipboardData.setData("text/html", dom.innerHTML);
|
|
4724
|
-
event.clipboardData.setData("text/plain",
|
|
7075
|
+
event.clipboardData.setData("text/plain", text2);
|
|
4725
7076
|
event.preventDefault();
|
|
4726
7077
|
view.dispatch(tr.scrollIntoView().setMeta("uiEvent", "cut"));
|
|
4727
7078
|
return true;
|
|
@@ -4729,8 +7080,8 @@ function fieldGuardPlugin() {
|
|
|
4729
7080
|
},
|
|
4730
7081
|
transformCopied: fieldClipboardSlice,
|
|
4731
7082
|
transformPasted: (slice, view) => simpleFieldPasteSlice(fieldClipboardSlice(slice), view?.state),
|
|
4732
|
-
handleTextInput: (view, from, to,
|
|
4733
|
-
const transaction = replaceAroundMarkers(view.state, from, to,
|
|
7083
|
+
handleTextInput: (view, from, to, text2) => {
|
|
7084
|
+
const transaction = replaceAroundMarkers(view.state, from, to, text2) ?? replaceSimpleFieldResult(view.state, from, to, text2);
|
|
4734
7085
|
if (transaction) view.dispatch(transaction);
|
|
4735
7086
|
return Boolean(transaction);
|
|
4736
7087
|
},
|
|
@@ -4822,7 +7173,7 @@ function markersIn(doc, from, to) {
|
|
|
4822
7173
|
});
|
|
4823
7174
|
return markers;
|
|
4824
7175
|
}
|
|
4825
|
-
function replaceAroundMarkers(state, from, to,
|
|
7176
|
+
function replaceAroundMarkers(state, from, to, text2) {
|
|
4826
7177
|
if (from === to) return null;
|
|
4827
7178
|
const markers = markersIn(state.doc, from, to);
|
|
4828
7179
|
if (!markers.length) return null;
|
|
@@ -4837,8 +7188,8 @@ function replaceAroundMarkers(state, from, to, text) {
|
|
|
4837
7188
|
end = marker.pos;
|
|
4838
7189
|
}
|
|
4839
7190
|
if (from < end) transaction.delete(from, end);
|
|
4840
|
-
if (
|
|
4841
|
-
return transaction.setSelection(TextSelection.create(transaction.doc, from +
|
|
7191
|
+
if (text2) transaction.insert(from, state.schema.text(text2, marks));
|
|
7192
|
+
return transaction.setSelection(TextSelection.create(transaction.doc, from + text2.length));
|
|
4842
7193
|
}
|
|
4843
7194
|
function deleteAroundMarkers(state, backward) {
|
|
4844
7195
|
const { selection, doc } = state;
|
|
@@ -4910,7 +7261,7 @@ var commentSerial = 0;
|
|
|
4910
7261
|
function nextCommentId(idGenerator) {
|
|
4911
7262
|
return idGenerator ? idGenerator("comment") : `dve-comment-${Date.now().toString(36)}-${++commentSerial}`;
|
|
4912
7263
|
}
|
|
4913
|
-
function addComment(view, author,
|
|
7264
|
+
function addComment(view, author, text2, idGenerator, inlineElements = true) {
|
|
4914
7265
|
if (!view.editable || !view.state.schema.marks.comment) return null;
|
|
4915
7266
|
const { from, to } = commentSelectionRange(
|
|
4916
7267
|
view.state.doc,
|
|
@@ -4939,7 +7290,7 @@ function addComment(view, author, text, idGenerator, inlineElements = true) {
|
|
|
4939
7290
|
tr = tr.addMark(start, end, view.state.schema.marks.comment.create({ ids: [id] }));
|
|
4940
7291
|
});
|
|
4941
7292
|
if (!tr.docChanged) return null;
|
|
4942
|
-
const comment = { id, author, text, resolved: false };
|
|
7293
|
+
const comment = { id, author, text: text2, resolved: false };
|
|
4943
7294
|
const threads = commentThreadsFromDoc(view.state.doc);
|
|
4944
7295
|
if (inlineElements && threads) setCommentThreads(tr, [...threads, comment]);
|
|
4945
7296
|
view.dispatch(closeHistory(tr));
|
|
@@ -4988,9 +7339,9 @@ function deleteComment(comments, id) {
|
|
|
4988
7339
|
function resolveComment(comments, id, resolved) {
|
|
4989
7340
|
return comments.map((comment) => comment.id === id ? { ...comment, resolved } : comment);
|
|
4990
7341
|
}
|
|
4991
|
-
function replyToComment(comments, parentId, author,
|
|
7342
|
+
function replyToComment(comments, parentId, author, text2, idGenerator) {
|
|
4992
7343
|
const id = nextCommentId(idGenerator);
|
|
4993
|
-
return [...comments, { id, author, text, parentId }];
|
|
7344
|
+
return [...comments, { id, author, text: text2, parentId }];
|
|
4994
7345
|
}
|
|
4995
7346
|
function commentIdsAtSelection(view) {
|
|
4996
7347
|
const { from, to, empty } = view.state.selection;
|
|
@@ -5284,7 +7635,7 @@ var WordYjsComments = class {
|
|
|
5284
7635
|
}
|
|
5285
7636
|
return true;
|
|
5286
7637
|
}
|
|
5287
|
-
add(view, author,
|
|
7638
|
+
add(view, author, text2, idGenerator) {
|
|
5288
7639
|
if (!view.editable || view.state.selection.empty || ySyncPluginKey.getState(view.state)?.type !== this.fragment)
|
|
5289
7640
|
return null;
|
|
5290
7641
|
const id = idGenerator("comment");
|
|
@@ -5292,18 +7643,18 @@ var WordYjsComments = class {
|
|
|
5292
7643
|
let added = null;
|
|
5293
7644
|
this.change(() => {
|
|
5294
7645
|
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 };
|
|
7646
|
+
added = addComment(view, author, text2, () => id, false);
|
|
7647
|
+
if (!added && elements2) added = { id, author, text: text2, resolved: false };
|
|
5297
7648
|
if (added) this.records.set(id, added);
|
|
5298
7649
|
});
|
|
5299
7650
|
return added;
|
|
5300
7651
|
}
|
|
5301
|
-
reply(parentId, author,
|
|
7652
|
+
reply(parentId, author, text2, idGenerator) {
|
|
5302
7653
|
const root = this.records.get(parentId);
|
|
5303
7654
|
if (!root || root.parentId || this.deleted.get(parentId)) return false;
|
|
5304
7655
|
const id = idGenerator("comment");
|
|
5305
7656
|
if (!id || this.records.has(id)) return false;
|
|
5306
|
-
return this.change(() => this.records.set(id, { id, parentId, author, text }));
|
|
7657
|
+
return this.change(() => this.records.set(id, { id, parentId, author, text: text2 }));
|
|
5307
7658
|
}
|
|
5308
7659
|
resolve(id, resolved) {
|
|
5309
7660
|
const root = this.records.get(id);
|
|
@@ -5345,12 +7696,12 @@ function independentCommentAnchors(node) {
|
|
|
5345
7696
|
if (!node.isText && node.type.spec.attrs?.format && node.marks.some(
|
|
5346
7697
|
(mark) => mark.type.name === "comment" || mark.type.name === "inlineCommentAnchors"
|
|
5347
7698
|
)) {
|
|
5348
|
-
const
|
|
7699
|
+
const properties4 = inlineRunProperties(node);
|
|
5349
7700
|
const ids = commentIdsFromNode(node);
|
|
5350
|
-
if (ids.length)
|
|
5351
|
-
else delete
|
|
7701
|
+
if (ids.length) properties4.commentIds = ids;
|
|
7702
|
+
else delete properties4.commentIds;
|
|
5352
7703
|
return node.type.create(
|
|
5353
|
-
updatedInlineRunAttributes(node, JSON.stringify(
|
|
7704
|
+
updatedInlineRunAttributes(node, JSON.stringify(properties4)),
|
|
5354
7705
|
void 0,
|
|
5355
7706
|
marks.filter(
|
|
5356
7707
|
(mark) => mark.type.name !== "inlineCommentAnchors" && mark.type.name !== "comment"
|
|
@@ -5697,6 +8048,64 @@ var insertWordHardBreak = (state, dispatch, view) => {
|
|
|
5697
8048
|
return true;
|
|
5698
8049
|
};
|
|
5699
8050
|
|
|
8051
|
+
// docx/ui/chart-spec.ts
|
|
8052
|
+
var SVG_NS2 = "http://www.w3.org/2000/svg";
|
|
8053
|
+
function elementSpec(element, root) {
|
|
8054
|
+
const attrs = {};
|
|
8055
|
+
for (const attr2 of Array.from(element.attributes)) {
|
|
8056
|
+
if (attr2.name === "xmlns" || attr2.name.startsWith("xmlns:") || /^on/i.test(attr2.name)) continue;
|
|
8057
|
+
attrs[attr2.name] = attr2.value;
|
|
8058
|
+
}
|
|
8059
|
+
const children3 = [];
|
|
8060
|
+
for (const child of Array.from(element.childNodes)) {
|
|
8061
|
+
if (isElement(child)) children3.push(elementSpec(child, false));
|
|
8062
|
+
else if (child.nodeType === 3 && child.nodeValue) children3.push(child.nodeValue);
|
|
8063
|
+
}
|
|
8064
|
+
const tag = root ? `${SVG_NS2} ${element.localName}` : element.localName;
|
|
8065
|
+
return [tag, attrs, ...children3];
|
|
8066
|
+
}
|
|
8067
|
+
function svgMarkupSpec(svg) {
|
|
8068
|
+
return elementSpec(parseXml(svg, { label: "Chart SVG" }).documentElement, true);
|
|
8069
|
+
}
|
|
8070
|
+
function nodeChart(node) {
|
|
8071
|
+
const value = node.attrs.chart;
|
|
8072
|
+
if (typeof value !== "string") return void 0;
|
|
8073
|
+
try {
|
|
8074
|
+
return JSON.parse(value);
|
|
8075
|
+
} catch {
|
|
8076
|
+
return void 0;
|
|
8077
|
+
}
|
|
8078
|
+
}
|
|
8079
|
+
function chartNodeSpec(node, theme) {
|
|
8080
|
+
const width = Number(node.attrs.widthPx) || 96;
|
|
8081
|
+
const height = Number(node.attrs.heightPx) || 96;
|
|
8082
|
+
const paint = docxChartPaint(nodeChart(node), width, height, theme);
|
|
8083
|
+
const style = `width:${width}px;height:${height}px`;
|
|
8084
|
+
if (!paint.svg)
|
|
8085
|
+
return [
|
|
8086
|
+
"span",
|
|
8087
|
+
{
|
|
8088
|
+
"data-docx-image-placeholder": "1",
|
|
8089
|
+
"data-docx-chart": "frame",
|
|
8090
|
+
...inlineRunPropertiesDomAttrs(node),
|
|
8091
|
+
class: "dve-image-placeholder",
|
|
8092
|
+
style
|
|
8093
|
+
},
|
|
8094
|
+
paint.label
|
|
8095
|
+
];
|
|
8096
|
+
return [
|
|
8097
|
+
"span",
|
|
8098
|
+
{
|
|
8099
|
+
"data-docx-chart": "1",
|
|
8100
|
+
...inlineRunPropertiesDomAttrs(node),
|
|
8101
|
+
class: "dve-chart",
|
|
8102
|
+
style,
|
|
8103
|
+
title: paint.label
|
|
8104
|
+
},
|
|
8105
|
+
svgMarkupSpec(paint.svg)
|
|
8106
|
+
];
|
|
8107
|
+
}
|
|
8108
|
+
|
|
5700
8109
|
// docx/ui/inline-content-schema.ts
|
|
5701
8110
|
var safeAttrValue = (value) => String(value ?? "").replace(/[;{}"]/g, "");
|
|
5702
8111
|
function placementClass(value) {
|
|
@@ -5717,7 +8126,7 @@ function textBoxLines(value) {
|
|
|
5717
8126
|
if (typeof value !== "string") return [];
|
|
5718
8127
|
try {
|
|
5719
8128
|
const lines = JSON.parse(value);
|
|
5720
|
-
return Array.isArray(lines) ? lines.map((
|
|
8129
|
+
return Array.isArray(lines) ? lines.map((line2) => ["span", { class: "dve-textbox-line" }, String(line2)]) : [];
|
|
5721
8130
|
} catch {
|
|
5722
8131
|
return [];
|
|
5723
8132
|
}
|
|
@@ -5749,7 +8158,9 @@ var imageNodeSpec = {
|
|
|
5749
8158
|
textBoxEditable: { default: null },
|
|
5750
8159
|
textBoxBorder: { default: null },
|
|
5751
8160
|
/** A SmartArt graphic (`DocxDiagram`) as JSON; shown read-only by the SmartArt node view. */
|
|
5752
|
-
diagram: { default: null }
|
|
8161
|
+
diagram: { default: null },
|
|
8162
|
+
/** A chart (`DocxChart`) as JSON; painted read-only from its cached values (`chart-spec.ts`). */
|
|
8163
|
+
chart: { default: null }
|
|
5753
8164
|
},
|
|
5754
8165
|
parseDOM: [
|
|
5755
8166
|
{
|
|
@@ -5768,7 +8179,7 @@ var imageNodeSpec = {
|
|
|
5768
8179
|
})
|
|
5769
8180
|
}
|
|
5770
8181
|
],
|
|
5771
|
-
toDOM: (node) => node.attrs.unsupported ? [
|
|
8182
|
+
toDOM: (node) => node.attrs.chart ? chartNodeSpec(node) : node.attrs.unsupported ? [
|
|
5772
8183
|
"span",
|
|
5773
8184
|
{
|
|
5774
8185
|
"data-docx-image-placeholder": "1",
|
|
@@ -5925,10 +8336,10 @@ var removeWordLink = (state, dispatch, view) => {
|
|
|
5925
8336
|
function patchedRun(node, patch) {
|
|
5926
8337
|
const run = inlineNodeRun(node);
|
|
5927
8338
|
if (!run) return void 0;
|
|
5928
|
-
const
|
|
8339
|
+
const properties4 = run;
|
|
5929
8340
|
for (const [key, value] of Object.entries(patch)) {
|
|
5930
|
-
if (value === void 0) delete
|
|
5931
|
-
else
|
|
8341
|
+
if (value === void 0) delete properties4[key];
|
|
8342
|
+
else properties4[key] = value;
|
|
5932
8343
|
}
|
|
5933
8344
|
return run;
|
|
5934
8345
|
}
|
|
@@ -6340,14 +8751,14 @@ function resolveFormattingRange(tr, from, to, mode) {
|
|
|
6340
8751
|
setInlineRunFormatting(tr, piece.from, run2);
|
|
6341
8752
|
continue;
|
|
6342
8753
|
}
|
|
6343
|
-
const
|
|
8754
|
+
const properties4 = piece.node.marks.find((mark) => mark.type.name === "runProperties");
|
|
6344
8755
|
if (mode === "accept") {
|
|
6345
|
-
const props = { ...
|
|
8756
|
+
const props = { ...properties4.attrs.props };
|
|
6346
8757
|
if (props.formatRevision) delete props.formatRevision;
|
|
6347
8758
|
else delete props.revision;
|
|
6348
|
-
tr.removeMark(piece.from, piece.to,
|
|
8759
|
+
tr.removeMark(piece.from, piece.to, properties4);
|
|
6349
8760
|
if (Object.keys(props).length)
|
|
6350
|
-
tr.addMark(piece.from, piece.to,
|
|
8761
|
+
tr.addMark(piece.from, piece.to, properties4.type.create({ props }));
|
|
6351
8762
|
continue;
|
|
6352
8763
|
}
|
|
6353
8764
|
const run = { text: "", revision: piece.revision };
|
|
@@ -6359,7 +8770,7 @@ function resolveFormattingRange(tr, from, to, mode) {
|
|
|
6359
8770
|
}
|
|
6360
8771
|
|
|
6361
8772
|
// docx/ui/track-run-formatting.ts
|
|
6362
|
-
function
|
|
8773
|
+
function properties2(node) {
|
|
6363
8774
|
const run = inlineNodeRun(node) ?? { text: "" };
|
|
6364
8775
|
run.text = "";
|
|
6365
8776
|
delete run.image;
|
|
@@ -6395,8 +8806,8 @@ function trackRunFormatting(steps, oldState, newState, author, date, nextId) {
|
|
|
6395
8806
|
if (!previous.isInline || previous.type.name === "equation") return;
|
|
6396
8807
|
const start = Math.max(from, previousPos);
|
|
6397
8808
|
const end = Math.min(to, previousPos + previous.nodeSize);
|
|
6398
|
-
const before =
|
|
6399
|
-
const after =
|
|
8809
|
+
const before = properties2(previous);
|
|
8810
|
+
const after = properties2(node);
|
|
6400
8811
|
if (propertiesSignature(before) === propertiesSignature(after)) {
|
|
6401
8812
|
if (hasInlineRunAttributes(node) && node.marks.some((mark2) => RUN_FORMAT_MARKS.has(mark2.type.name)))
|
|
6402
8813
|
setInlineRunFormatting(tr, start, inlineNodeRun(node));
|
|
@@ -6483,7 +8894,7 @@ function paragraphProperties(element) {
|
|
|
6483
8894
|
for (const child of children2(element, name)) element.removeChild(child);
|
|
6484
8895
|
return element;
|
|
6485
8896
|
}
|
|
6486
|
-
function
|
|
8897
|
+
function properties3(node) {
|
|
6487
8898
|
const paragraph = paragraphFromAttrs(node.attrs, String(node.attrs.id), []);
|
|
6488
8899
|
delete paragraph.formatRevision;
|
|
6489
8900
|
delete paragraph.markRevision;
|
|
@@ -6501,8 +8912,8 @@ function trackParagraphFormatting(steps, oldState, newState, author, date, nextI
|
|
|
6501
8912
|
if (node.type.name !== "paragraph" || !node.type.spec.attrs?.formatRevision) return;
|
|
6502
8913
|
const previous = oldState.doc.nodeAt(pos);
|
|
6503
8914
|
if (previous === node) return;
|
|
6504
|
-
const before =
|
|
6505
|
-
const after =
|
|
8915
|
+
const before = properties3(previous);
|
|
8916
|
+
const after = properties3(node);
|
|
6506
8917
|
if (propertiesSignature(before) === propertiesSignature(after)) return;
|
|
6507
8918
|
const pending = paragraphFormattingRevision(previous);
|
|
6508
8919
|
const priorXml = pending?.previousParagraphPropertiesXml ?? buildXml(before);
|
|
@@ -6566,14 +8977,14 @@ function trackSimpleFieldDeletion(transform, from, to, slice, author, date, next
|
|
|
6566
8977
|
function sourceProperties(value) {
|
|
6567
8978
|
if (typeof value !== "string" || !value) return value;
|
|
6568
8979
|
try {
|
|
6569
|
-
const
|
|
6570
|
-
const run = first2(
|
|
8980
|
+
const properties4 = parsePropertiesSnapshot(value, "pPr");
|
|
8981
|
+
const run = first2(properties4, "rPr");
|
|
6571
8982
|
if (run) {
|
|
6572
8983
|
for (const name of ["ins", "del"])
|
|
6573
8984
|
for (const revision of children2(run, name)) run.removeChild(revision);
|
|
6574
|
-
if (!run.childNodes.length && !run.attributes.length)
|
|
8985
|
+
if (!run.childNodes.length && !run.attributes.length) properties4.removeChild(run);
|
|
6575
8986
|
}
|
|
6576
|
-
return propertiesSignature(
|
|
8987
|
+
return propertiesSignature(properties4);
|
|
6577
8988
|
} catch {
|
|
6578
8989
|
return value;
|
|
6579
8990
|
}
|
|
@@ -7916,10 +10327,10 @@ function paragraphBoxCss(borders, shadingFill) {
|
|
|
7916
10327
|
const parsed = typeof borders === "string" ? parseBordersJson(borders) : borders;
|
|
7917
10328
|
const css = [];
|
|
7918
10329
|
for (const side of ["top", "bottom", "left", "right"]) {
|
|
7919
|
-
const
|
|
7920
|
-
if (!
|
|
10330
|
+
const line2 = cssBorderSide(parsed?.[side]);
|
|
10331
|
+
if (!line2) continue;
|
|
7921
10332
|
css.push(
|
|
7922
|
-
`border-${side}:${
|
|
10333
|
+
`border-${side}:${line2}`,
|
|
7923
10334
|
`padding-${side}:${(parsed[side].spacePoints ?? 0) * 4 / 3}px`
|
|
7924
10335
|
);
|
|
7925
10336
|
}
|
|
@@ -8023,7 +10434,7 @@ function applyThemeColors(host, previous, colors) {
|
|
|
8023
10434
|
}
|
|
8024
10435
|
|
|
8025
10436
|
// docx/ui/word-count.ts
|
|
8026
|
-
function countWords(
|
|
10437
|
+
function countWords(text2, locale) {
|
|
8027
10438
|
if (typeof Intl.Segmenter === "function") {
|
|
8028
10439
|
let segmenter;
|
|
8029
10440
|
try {
|
|
@@ -8031,9 +10442,9 @@ function countWords(text, locale) {
|
|
|
8031
10442
|
} catch {
|
|
8032
10443
|
segmenter = new Intl.Segmenter(void 0, { granularity: "word" });
|
|
8033
10444
|
}
|
|
8034
|
-
return [...segmenter.segment(
|
|
10445
|
+
return [...segmenter.segment(text2)].filter((part) => part.isWordLike).length;
|
|
8035
10446
|
}
|
|
8036
|
-
return
|
|
10447
|
+
return text2.match(/[\p{L}\p{N}][\p{L}\p{M}\p{N}'’]*/gu)?.length ?? 0;
|
|
8037
10448
|
}
|
|
8038
10449
|
|
|
8039
10450
|
// docx/ui/zoom-fit.ts
|
|
@@ -8045,4 +10456,4 @@ function fitZoomPercent(mode, viewport, page) {
|
|
|
8045
10456
|
return Math.max(10, Math.min(500, Math.floor(ratio * 100)));
|
|
8046
10457
|
}
|
|
8047
10458
|
|
|
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 };
|
|
10459
|
+
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 };
|