ooxml-core 1.5.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PptxHandler-ZPJNHEZZ.mjs → PptxHandler-BTXB54UC.mjs} +2 -2
- package/dist/automation/index.cjs +15757 -8955
- package/dist/automation/index.mjs +15757 -8955
- package/dist/chart/gradient-definition.d.ts +2 -0
- package/dist/chart/gradient-definition.d.ts.map +1 -1
- package/dist/chart/index.cjs +1 -1
- package/dist/chart/index.mjs +1 -1
- package/dist/{chunk-BB55ASTX.mjs → chunk-4L4UB3RQ.mjs} +3 -3
- package/dist/{chunk-QPQDLSJQ.mjs → chunk-5CJRDY7Q.mjs} +1 -1
- package/dist/{chunk-XGLKW3JJ.mjs → chunk-CS7HRNHL.mjs} +26 -3
- package/dist/{chunk-H4TPDZV4.mjs → chunk-Q5LESLDA.mjs} +1 -1
- package/dist/{chunk-IVDC75E5.mjs → chunk-RIFVZP2S.mjs} +1 -1
- package/dist/diagram/engine/text-measure.d.ts +1 -1
- package/dist/diagram/layout/smartart-font-table.d.ts +1 -1
- package/dist/diagram/layout/smartart-layout-interpreter-linear-content-size.d.ts +1 -1
- package/dist/diagram/layout/smartart-layout-item-font-size.d.ts +1 -1
- package/dist/diagram/layout/smartart-layout-item-font-tier-fit.d.ts +1 -1
- package/dist/diagram/layout/smartart-line-pitch.d.ts +1 -1
- package/dist/diagram/layout/smartart-text-wrap-fit.d.ts +1 -1
- package/dist/docx/index.cjs +1 -1
- package/dist/docx/index.mjs +1 -1
- package/dist/docx/layout/index.cjs +1 -1
- package/dist/docx/layout/index.mjs +1 -1
- package/dist/docx/ui/index.cjs +1 -1
- package/dist/docx/ui/index.mjs +1 -1
- package/dist/drawingml/index.cjs +102 -24
- package/dist/drawingml/index.d.ts +1 -0
- package/dist/drawingml/index.d.ts.map +1 -1
- package/dist/drawingml/index.mjs +102 -25
- package/dist/drawingml/write-theme.d.ts +17 -0
- package/dist/drawingml/write-theme.d.ts.map +1 -0
- package/dist/geometry/auto-align.d.ts +32 -0
- package/dist/geometry/auto-align.d.ts.map +1 -0
- package/dist/geometry/graph-layout.d.ts +37 -0
- package/dist/geometry/graph-layout.d.ts.map +1 -0
- package/dist/geometry/index.cjs +361 -7
- package/dist/geometry/index.d.ts +2 -0
- package/dist/geometry/index.d.ts.map +1 -1
- package/dist/geometry/index.mjs +359 -8
- package/dist/index.cjs +625 -123
- package/dist/index.mjs +625 -123
- package/dist/pptx/automation/index.cjs +26 -2
- package/dist/pptx/automation/index.d.ts +3 -3
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-JNv7AJx5.d.ts → index-CKIUurnd.d.ts} +2 -2
- package/dist/pptx/chunks/{index-JNv7AJx5.d.ts.map → index-CKIUurnd.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-EZJZ7USt.d.ts → index-DkHgeV1p.d.ts} +3 -3
- package/dist/pptx/chunks/{index-EZJZ7USt.d.ts.map → index-DkHgeV1p.d.ts.map} +1 -1
- package/dist/pptx/chunks/{text-operations-DtCxXrMh.d.ts → text-operations-BHfAm5K9.d.ts} +8 -1
- package/dist/pptx/chunks/text-operations-BHfAm5K9.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +26 -2
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/index.cjs +26 -2
- package/dist/pptx/index.d.ts +3 -3
- package/dist/pptx/index.mjs +5 -5
- package/dist/text/change-case.d.ts +20 -0
- package/dist/text/change-case.d.ts.map +1 -0
- package/dist/text/font-metrics/font-advance-widths-aptos-display.generated.d.ts +1 -1
- package/dist/text/font-metrics/font-advance-widths-aptos.generated.d.ts +1 -1
- package/dist/text/font-metrics/font-advance-widths-arial.generated.d.ts +1 -1
- package/dist/text/font-metrics/font-advance-widths-calibri-light.generated.d.ts +1 -1
- package/dist/text/font-metrics/font-advance-widths-calibri.generated.d.ts +1 -1
- package/dist/text/font-metrics/font-advance-widths-segoe-ui.generated.d.ts +1 -1
- package/dist/text/font-metrics/font-advance-widths-times-new-roman.generated.d.ts +1 -1
- package/dist/text/index.cjs +70 -0
- package/dist/text/index.d.ts +1 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.mjs +68 -1
- package/dist/visio/arrow-shapes.d.ts +16 -0
- package/dist/visio/arrow-shapes.d.ts.map +1 -0
- package/dist/visio/basic-shapes.d.ts +2 -0
- package/dist/visio/basic-shapes.d.ts.map +1 -1
- package/dist/visio/comments.d.ts +39 -0
- package/dist/visio/comments.d.ts.map +1 -0
- package/dist/visio/connector-route.d.ts +31 -0
- package/dist/visio/connector-route.d.ts.map +1 -0
- package/dist/visio/data-recordsets.d.ts +66 -0
- package/dist/visio/data-recordsets.d.ts.map +1 -0
- package/dist/visio/edit-change-shape-commands.d.ts +17 -0
- package/dist/visio/edit-change-shape-commands.d.ts.map +1 -0
- package/dist/visio/edit-change-shape.d.ts +4 -0
- package/dist/visio/edit-change-shape.d.ts.map +1 -0
- package/dist/visio/edit-commands.d.ts +41 -6
- package/dist/visio/edit-commands.d.ts.map +1 -1
- package/dist/visio/edit-comment-commands.d.ts +32 -0
- package/dist/visio/edit-comment-commands.d.ts.map +1 -0
- package/dist/visio/edit-comments.d.ts +7 -0
- package/dist/visio/edit-comments.d.ts.map +1 -0
- package/dist/visio/edit-connection-points.d.ts +19 -0
- package/dist/visio/edit-connection-points.d.ts.map +1 -0
- package/dist/visio/edit-connector-commands.d.ts +57 -0
- package/dist/visio/edit-connector-commands.d.ts.map +1 -0
- package/dist/visio/edit-connector-glue.d.ts +43 -0
- package/dist/visio/edit-connector-glue.d.ts.map +1 -0
- package/dist/visio/edit-connector-layout.d.ts +37 -0
- package/dist/visio/edit-connector-layout.d.ts.map +1 -0
- package/dist/visio/edit-connector-reroute.d.ts +30 -0
- package/dist/visio/edit-connector-reroute.d.ts.map +1 -0
- package/dist/visio/edit-connector.d.ts +42 -0
- package/dist/visio/edit-connector.d.ts.map +1 -0
- package/dist/visio/edit-data-commands.d.ts +49 -0
- package/dist/visio/edit-data-commands.d.ts.map +1 -0
- package/dist/visio/edit-data-parts.d.ts +34 -0
- package/dist/visio/edit-data-parts.d.ts.map +1 -0
- package/dist/visio/edit-data.d.ts +8 -0
- package/dist/visio/edit-data.d.ts.map +1 -0
- package/dist/visio/edit-delete.d.ts.map +1 -1
- package/dist/visio/edit-diagram-parts-commands.d.ts +55 -0
- package/dist/visio/edit-diagram-parts-commands.d.ts.map +1 -0
- package/dist/visio/edit-diagram-parts.d.ts +16 -0
- package/dist/visio/edit-diagram-parts.d.ts.map +1 -0
- package/dist/visio/edit-ellipse-geometry.d.ts +2 -0
- package/dist/visio/edit-ellipse-geometry.d.ts.map +1 -1
- package/dist/visio/edit-foreign-bitmap.d.ts +7 -0
- package/dist/visio/edit-foreign-bitmap.d.ts.map +1 -0
- package/dist/visio/edit-formatting-cell-admission.d.ts +2 -0
- package/dist/visio/edit-formatting-cell-admission.d.ts.map +1 -1
- package/dist/visio/edit-formatting-commands.d.ts +14 -1
- package/dist/visio/edit-formatting-commands.d.ts.map +1 -1
- package/dist/visio/edit-formatting-effects.d.ts +50 -0
- package/dist/visio/edit-formatting-effects.d.ts.map +1 -0
- package/dist/visio/edit-formatting-glow.d.ts +43 -0
- package/dist/visio/edit-formatting-glow.d.ts.map +1 -0
- package/dist/visio/edit-formatting-paint-scope.d.ts.map +1 -1
- package/dist/visio/edit-formatting-paint.d.ts +6 -0
- package/dist/visio/edit-formatting-paint.d.ts.map +1 -1
- package/dist/visio/edit-formatting-scope.d.ts.map +1 -1
- package/dist/visio/edit-formatting-text-commands.d.ts +56 -0
- package/dist/visio/edit-formatting-text-commands.d.ts.map +1 -0
- package/dist/visio/edit-formatting-text-extra.d.ts +11 -0
- package/dist/visio/edit-formatting-text-extra.d.ts.map +1 -0
- package/dist/visio/edit-formatting-text.d.ts.map +1 -1
- package/dist/visio/edit-formatting-theme-context.d.ts +14 -0
- package/dist/visio/edit-formatting-theme-context.d.ts.map +1 -0
- package/dist/visio/edit-formatting.d.ts +2 -0
- package/dist/visio/edit-formatting.d.ts.map +1 -1
- package/dist/visio/edit-geometry-admission.d.ts +1 -1
- package/dist/visio/edit-geometry-admission.d.ts.map +1 -1
- package/dist/visio/edit-geometry.d.ts.map +1 -1
- package/dist/visio/edit-group-commands.d.ts +22 -0
- package/dist/visio/edit-group-commands.d.ts.map +1 -0
- package/dist/visio/edit-group-rotation.d.ts +7 -1
- package/dist/visio/edit-group-rotation.d.ts.map +1 -1
- package/dist/visio/edit-group.d.ts +17 -0
- package/dist/visio/edit-group.d.ts.map +1 -0
- package/dist/visio/edit-guide-commands.d.ts +26 -0
- package/dist/visio/edit-guide-commands.d.ts.map +1 -0
- package/dist/visio/edit-guides.d.ts +4 -0
- package/dist/visio/edit-guides.d.ts.map +1 -0
- package/dist/visio/edit-layer-commands.d.ts +20 -0
- package/dist/visio/edit-layer-commands.d.ts.map +1 -0
- package/dist/visio/edit-layers.d.ts +7 -0
- package/dist/visio/edit-layers.d.ts.map +1 -0
- package/dist/visio/edit-metadata-commands.d.ts +46 -0
- package/dist/visio/edit-metadata-commands.d.ts.map +1 -0
- package/dist/visio/edit-metadata.d.ts +4 -0
- package/dist/visio/edit-metadata.d.ts.map +1 -0
- package/dist/visio/edit-page-auto-size.d.ts +19 -0
- package/dist/visio/edit-page-auto-size.d.ts.map +1 -0
- package/dist/visio/edit-page-create.d.ts +24 -0
- package/dist/visio/edit-page-create.d.ts.map +1 -0
- package/dist/visio/edit-page-decoration.d.ts +14 -0
- package/dist/visio/edit-page-decoration.d.ts.map +1 -0
- package/dist/visio/edit-page-setup-commands.d.ts +57 -0
- package/dist/visio/edit-page-setup-commands.d.ts.map +1 -0
- package/dist/visio/edit-page-setup.d.ts +13 -0
- package/dist/visio/edit-page-setup.d.ts.map +1 -0
- package/dist/visio/edit-page-size.d.ts +4 -0
- package/dist/visio/edit-page-size.d.ts.map +1 -1
- package/dist/visio/edit-page-theme-commands.d.ts +15 -0
- package/dist/visio/edit-page-theme-commands.d.ts.map +1 -0
- package/dist/visio/edit-page-theme-recolor.d.ts +3 -0
- package/dist/visio/edit-page-theme-recolor.d.ts.map +1 -0
- package/dist/visio/edit-page-theme.d.ts +10 -0
- package/dist/visio/edit-page-theme.d.ts.map +1 -0
- package/dist/visio/edit-pages.d.ts.map +1 -1
- package/dist/visio/edit-path-commands.d.ts +19 -0
- package/dist/visio/edit-path-commands.d.ts.map +1 -0
- package/dist/visio/edit-path-create.d.ts +23 -0
- package/dist/visio/edit-path-create.d.ts.map +1 -0
- package/dist/visio/edit-picture.d.ts +7 -0
- package/dist/visio/edit-picture.d.ts.map +1 -0
- package/dist/visio/edit-recalculate-index.d.ts +2 -0
- package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
- package/dist/visio/edit-resize-anchor.d.ts +1 -1
- package/dist/visio/edit-resize-anchor.d.ts.map +1 -1
- package/dist/visio/edit-scope.d.ts.map +1 -1
- package/dist/visio/edit-shape-create.d.ts +8 -0
- package/dist/visio/edit-shape-create.d.ts.map +1 -1
- package/dist/visio/edit-shape-data-commands.d.ts +34 -0
- package/dist/visio/edit-shape-data-commands.d.ts.map +1 -0
- package/dist/visio/edit-shape-data.d.ts +22 -0
- package/dist/visio/edit-shape-data.d.ts.map +1 -0
- package/dist/visio/edit-shape-order.d.ts.map +1 -1
- package/dist/visio/edit-subprocess-commands.d.ts +27 -0
- package/dist/visio/edit-subprocess-commands.d.ts.map +1 -0
- package/dist/visio/edit-subprocess.d.ts +9 -0
- package/dist/visio/edit-subprocess.d.ts.map +1 -0
- package/dist/visio/edit-text-field-commands.d.ts +21 -0
- package/dist/visio/edit-text-field-commands.d.ts.map +1 -0
- package/dist/visio/edit-text-field.d.ts +5 -0
- package/dist/visio/edit-text-field.d.ts.map +1 -0
- package/dist/visio/edit-text-range-plan.d.ts.map +1 -1
- package/dist/visio/edit-text-ranges.d.ts.map +1 -1
- package/dist/visio/edit-text.d.ts.map +1 -1
- package/dist/visio/edit.d.ts +2 -1
- package/dist/visio/edit.d.ts.map +1 -1
- package/dist/visio/effects.d.ts +13 -0
- package/dist/visio/effects.d.ts.map +1 -0
- package/dist/visio/formula-evaluate.d.ts.map +1 -1
- package/dist/visio/index.cjs +26474 -19318
- package/dist/visio/index.d.ts +25 -1
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +26406 -19319
- package/dist/visio/model.d.ts +125 -0
- package/dist/visio/model.d.ts.map +1 -1
- package/dist/visio/page-decoration.d.ts +66 -0
- package/dist/visio/page-decoration.d.ts.map +1 -0
- package/dist/visio/page-scale.d.ts.map +1 -1
- package/dist/visio/page-setup.d.ts +8 -0
- package/dist/visio/page-setup.d.ts.map +1 -0
- package/dist/visio/page-theme.d.ts +9 -0
- package/dist/visio/page-theme.d.ts.map +1 -0
- package/dist/visio/paper-sizes.d.ts +24 -0
- package/dist/visio/paper-sizes.d.ts.map +1 -0
- package/dist/visio/parser.d.ts.map +1 -1
- package/dist/visio/path-fit.d.ts +69 -0
- package/dist/visio/path-fit.d.ts.map +1 -0
- package/dist/visio/shadow.d.ts +9 -0
- package/dist/visio/shadow.d.ts.map +1 -0
- package/dist/visio/shape-connections.d.ts +5 -0
- package/dist/visio/shape-connections.d.ts.map +1 -0
- package/dist/visio/shape-metadata.d.ts +3 -0
- package/dist/visio/shape-metadata.d.ts.map +1 -1
- package/dist/visio/shape-structure.d.ts +10 -0
- package/dist/visio/shape-structure.d.ts.map +1 -0
- package/dist/visio/shapes.d.ts.map +1 -1
- package/dist/visio/stencil-shapes.d.ts +20 -0
- package/dist/visio/stencil-shapes.d.ts.map +1 -0
- package/dist/visio/stencils.d.ts +30 -0
- package/dist/visio/stencils.d.ts.map +1 -0
- package/dist/visio/style.d.ts +3 -0
- package/dist/visio/style.d.ts.map +1 -1
- package/dist/visio/text-character.d.ts +5 -0
- package/dist/visio/text-character.d.ts.map +1 -0
- package/dist/visio/text-field-context.d.ts +6 -0
- package/dist/visio/text-field-context.d.ts.map +1 -0
- package/dist/visio/text-field-display.d.ts +12 -0
- package/dist/visio/text-field-display.d.ts.map +1 -0
- package/dist/visio/text-fields.d.ts +65 -0
- package/dist/visio/text-fields.d.ts.map +1 -0
- package/dist/visio/theme-builtins.d.ts +32 -0
- package/dist/visio/theme-builtins.d.ts.map +1 -0
- package/dist/visio/theme-write.d.ts +4 -0
- package/dist/visio/theme-write.d.ts.map +1 -0
- package/dist/visio/theme.d.ts +2 -0
- package/dist/visio/theme.d.ts.map +1 -1
- package/dist/visio/ui/auto-layout.d.ts +38 -0
- package/dist/visio/ui/auto-layout.d.ts.map +1 -0
- package/dist/visio/ui/change-case.d.ts +12 -0
- package/dist/visio/ui/change-case.d.ts.map +1 -0
- package/dist/visio/ui/connection-points.d.ts +45 -0
- package/dist/visio/ui/connection-points.d.ts.map +1 -0
- package/dist/visio/ui/connector-preview.d.ts +24 -0
- package/dist/visio/ui/connector-preview.d.ts.map +1 -0
- package/dist/visio/ui/data-graphic-rules.d.ts +45 -0
- package/dist/visio/ui/data-graphic-rules.d.ts.map +1 -0
- package/dist/visio/ui/data-graphics.d.ts +15 -0
- package/dist/visio/ui/data-graphics.d.ts.map +1 -0
- package/dist/visio/ui/data-table.d.ts +33 -0
- package/dist/visio/ui/data-table.d.ts.map +1 -0
- package/dist/visio/ui/diagram-check.d.ts +32 -0
- package/dist/visio/ui/diagram-check.d.ts.map +1 -0
- package/dist/visio/ui/diagram-parts.d.ts +20 -0
- package/dist/visio/ui/diagram-parts.d.ts.map +1 -0
- package/dist/visio/ui/draw-path-plan.d.ts +21 -0
- package/dist/visio/ui/draw-path-plan.d.ts.map +1 -0
- package/dist/visio/ui/draw-plan.d.ts +11 -3
- package/dist/visio/ui/draw-plan.d.ts.map +1 -1
- package/dist/visio/ui/edit-commands.d.ts.map +1 -1
- package/dist/visio/ui/format-painter.d.ts +25 -0
- package/dist/visio/ui/format-painter.d.ts.map +1 -0
- package/dist/visio/ui/guides.d.ts +34 -0
- package/dist/visio/ui/guides.d.ts.map +1 -0
- package/dist/visio/ui/index.cjs +8006 -2705
- package/dist/visio/ui/index.d.ts +25 -0
- package/dist/visio/ui/index.d.ts.map +1 -1
- package/dist/visio/ui/index.mjs +7894 -2706
- package/dist/visio/ui/insert.d.ts +26 -0
- package/dist/visio/ui/insert.d.ts.map +1 -0
- package/dist/visio/ui/layer-assign.d.ts +31 -0
- package/dist/visio/ui/layer-assign.d.ts.map +1 -0
- package/dist/visio/ui/page-edit.d.ts.map +1 -1
- package/dist/visio/ui/page-setup.d.ts +50 -0
- package/dist/visio/ui/page-setup.d.ts.map +1 -0
- package/dist/visio/ui/page-size.d.ts +2 -11
- package/dist/visio/ui/page-size.d.ts.map +1 -1
- package/dist/visio/ui/paste-text.d.ts +13 -0
- package/dist/visio/ui/paste-text.d.ts.map +1 -0
- package/dist/visio/ui/scene-data.d.ts +4 -0
- package/dist/visio/ui/scene-data.d.ts.map +1 -0
- package/dist/visio/ui/scene-details.d.ts.map +1 -1
- package/dist/visio/ui/scene-validation-text.d.ts +8 -0
- package/dist/visio/ui/scene-validation-text.d.ts.map +1 -0
- package/dist/visio/ui/scene-validation.d.ts.map +1 -1
- package/dist/visio/ui/select-by-type.d.ts +35 -0
- package/dist/visio/ui/select-by-type.d.ts.map +1 -0
- package/dist/visio/ui/shape-arrange.d.ts.map +1 -1
- package/dist/visio/ui/shape-change.d.ts +11 -0
- package/dist/visio/ui/shape-change.d.ts.map +1 -0
- package/dist/visio/ui/shape-effects.d.ts +14 -0
- package/dist/visio/ui/shape-effects.d.ts.map +1 -0
- package/dist/visio/ui/shape-formatting.d.ts +5 -0
- package/dist/visio/ui/shape-formatting.d.ts.map +1 -1
- package/dist/visio/ui/shape-group.d.ts +9 -0
- package/dist/visio/ui/shape-group.d.ts.map +1 -0
- package/dist/visio/ui/shape-move.d.ts +5 -2
- package/dist/visio/ui/shape-move.d.ts.map +1 -1
- package/dist/visio/ui/shape-report.d.ts +37 -0
- package/dist/visio/ui/shape-report.d.ts.map +1 -0
- package/dist/visio/ui/shape-resize.d.ts.map +1 -1
- package/dist/visio/ui/shape-rotation.d.ts.map +1 -1
- package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
- package/dist/visio/ui/subprocess.d.ts +13 -0
- package/dist/visio/ui/subprocess.d.ts.map +1 -0
- package/dist/visio/ui/text-block.d.ts +42 -0
- package/dist/visio/ui/text-block.d.ts.map +1 -0
- package/dist/visio/ui/text-dialog.d.ts +54 -0
- package/dist/visio/ui/text-dialog.d.ts.map +1 -0
- package/dist/visio/ui/text-draft.d.ts +25 -0
- package/dist/visio/ui/text-draft.d.ts.map +1 -0
- package/dist/visio/ui/text-field-catalog.d.ts +17 -0
- package/dist/visio/ui/text-field-catalog.d.ts.map +1 -0
- package/dist/xlsx/formula/test-helpers.d.ts +9 -9
- package/dist/xlsx/index.cjs +1 -1
- package/dist/xlsx/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/pptx/chunks/text-operations-DtCxXrMh.d.ts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -2452,7 +2452,7 @@ function drawingFillXml(fill) {
|
|
|
2452
2452
|
const root = doc.documentElement;
|
|
2453
2453
|
if (root.namespaceURI !== NS.a || root.localName !== "gradFill")
|
|
2454
2454
|
throw new Error("Invalid gradient source XML");
|
|
2455
|
-
const
|
|
2455
|
+
const fragment2 = (xml) => doc.importNode(elements(parseXml(`<w xmlns:a="${NS.a}">${xml}</w>`).documentElement)[0], true);
|
|
2456
2456
|
let list2 = first(root, "gsLst", NS.a);
|
|
2457
2457
|
if (!list2) {
|
|
2458
2458
|
list2 = doc.createElementNS(NS.a, "a:gsLst");
|
|
@@ -2467,7 +2467,7 @@ function drawingFillXml(fill) {
|
|
|
2467
2467
|
node.setAttribute("pos", String(Math.round(stop.position * 1e3)));
|
|
2468
2468
|
for (const old of elements(node))
|
|
2469
2469
|
if (old.namespaceURI === NS.a && old.localName.endsWith("Clr")) node.removeChild(old);
|
|
2470
|
-
node.insertBefore(
|
|
2470
|
+
node.insertBefore(fragment2(drawingColorXml(stop.color)), node.firstChild);
|
|
2471
2471
|
});
|
|
2472
2472
|
for (const stop of stops.slice(fill.stops.length)) list2.removeChild(stop);
|
|
2473
2473
|
for (const node of elements(root))
|
|
@@ -2770,14 +2770,14 @@ function resolveChartGradient(fill, resolve) {
|
|
|
2770
2770
|
...focus ? { focalPoint: { x: (1 + focus.l - focus.r) / 2, y: (1 + focus.t - focus.b) / 2 } } : {}
|
|
2771
2771
|
};
|
|
2772
2772
|
}
|
|
2773
|
-
function buildChartGradientDef(id, fill,
|
|
2773
|
+
function buildChartGradientDef(id, fill, bounds2) {
|
|
2774
2774
|
const sourceStops = sortGradientStops(fill.stops).map((stop) => ({
|
|
2775
2775
|
offset: Math.min(Math.max(stop.position / 100, 0), 1),
|
|
2776
2776
|
color: stop.color,
|
|
2777
2777
|
...stop.opacity !== void 0 ? { opacity: stop.opacity } : {}
|
|
2778
2778
|
}));
|
|
2779
2779
|
const stops = fill.interpolation === "sigma-gamma22" ? sigmaGradientStops(sourceStops) ?? sourceStops : sourceStops;
|
|
2780
|
-
if (fill.type === "radial" && (fill.path === "rect" || fill.path === "shape" &&
|
|
2780
|
+
if (fill.type === "radial" && (fill.path === "rect" || fill.path === "shape" && bounds2?.shape === "rect")) {
|
|
2781
2781
|
const markup = buildRectPathGradientSvg(
|
|
2782
2782
|
stops.map((stop) => ({
|
|
2783
2783
|
position: stop.offset * 100,
|
|
@@ -2798,7 +2798,7 @@ function buildChartGradientDef(id, fill, bounds) {
|
|
|
2798
2798
|
if (fill.type === "radial") {
|
|
2799
2799
|
const cx = fill.focalPoint?.x ?? 0.5;
|
|
2800
2800
|
const cy = fill.focalPoint?.y ?? 0.5;
|
|
2801
|
-
const aspect = fill.path === "circle" &&
|
|
2801
|
+
const aspect = fill.path === "circle" && bounds2 && Number.isFinite(bounds2.width) && Number.isFinite(bounds2.height) && bounds2.width > 0 && bounds2.height > 0 ? bounds2.height / bounds2.width : 1;
|
|
2802
2802
|
return {
|
|
2803
2803
|
kind: "radialGradient",
|
|
2804
2804
|
id,
|
|
@@ -2874,7 +2874,7 @@ function extractAllTagText(xml, localName2) {
|
|
|
2874
2874
|
function chartGradientMarkup(def) {
|
|
2875
2875
|
if (def.kind === "rectPath")
|
|
2876
2876
|
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>`;
|
|
2877
|
-
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}"`;
|
|
2877
|
+
const geometry = def.kind === "linearGradient" ? `${def.gradientUnits ? `gradientUnits="${def.gradientUnits}" ` : ""}x1="${def.x1}" y1="${def.y1}" x2="${def.x2}" y2="${def.y2}"` : `cx="${def.cx}" cy="${def.cy}" r="${def.r}"`;
|
|
2878
2878
|
const stops = def.stops.map(
|
|
2879
2879
|
(stop) => `<stop offset="${stop.offset}" stop-color="${escapeXmlAttr(stop.color)}" stop-opacity="${stop.opacity ?? 1}"/>`
|
|
2880
2880
|
).join("");
|
|
@@ -3653,17 +3653,17 @@ function parseView3D(context, element) {
|
|
|
3653
3653
|
}
|
|
3654
3654
|
);
|
|
3655
3655
|
}
|
|
3656
|
-
function chartStyle(context,
|
|
3657
|
-
const direct = cNumber(context,
|
|
3656
|
+
function chartStyle(context, space3) {
|
|
3657
|
+
const direct = cNumber(context, space3, "style");
|
|
3658
3658
|
if (direct !== void 0) return direct;
|
|
3659
|
-
for (const alternate of children(
|
|
3659
|
+
for (const alternate of children(space3, "AlternateContent", NS.mc)) {
|
|
3660
3660
|
const style = cNumber(context, first(alternate, "Fallback", NS.mc), "style");
|
|
3661
3661
|
if (style !== void 0) return style;
|
|
3662
3662
|
}
|
|
3663
3663
|
return void 0;
|
|
3664
3664
|
}
|
|
3665
|
-
function c14Style(
|
|
3666
|
-
for (const alternate of children(
|
|
3665
|
+
function c14Style(space3) {
|
|
3666
|
+
for (const alternate of children(space3, "AlternateContent", NS.mc)) {
|
|
3667
3667
|
const raw2 = attribute(first(first(alternate, "Choice", NS.mc), "style", NS.c14, false), "val");
|
|
3668
3668
|
const value = raw2?.trim() ? Number(raw2) : Number.NaN;
|
|
3669
3669
|
if (Number.isFinite(value)) return value;
|
|
@@ -4172,10 +4172,10 @@ function legendXml(context, legend) {
|
|
|
4172
4172
|
valXml("legendPos", legend.position) + entries + layoutXml(context, legend.layout) + valXml("overlay", legend.overlay) + shapePropertiesXml(context, legend.spPr) + textBodyXml(context, legend.txPr) + raw(context, legend.extLst)
|
|
4173
4173
|
);
|
|
4174
4174
|
}
|
|
4175
|
-
function styleXml(context,
|
|
4176
|
-
const style = valXml("style",
|
|
4177
|
-
if (
|
|
4178
|
-
const choice = `<mc:Choice Requires="c14" xmlns:c14="${NS.c14}"><c14:style val="${
|
|
4175
|
+
function styleXml(context, space3) {
|
|
4176
|
+
const style = valXml("style", space3.style);
|
|
4177
|
+
if (space3.c14Style === void 0) return style;
|
|
4178
|
+
const choice = `<mc:Choice Requires="c14" xmlns:c14="${NS.c14}"><c14:style val="${space3.c14Style}"/></mc:Choice>`;
|
|
4179
4179
|
const fallback = style ? `<mc:Fallback>${style}</mc:Fallback>` : "<mc:Fallback/>";
|
|
4180
4180
|
return raw(
|
|
4181
4181
|
context,
|
|
@@ -4183,21 +4183,21 @@ function styleXml(context, space) {
|
|
|
4183
4183
|
);
|
|
4184
4184
|
}
|
|
4185
4185
|
var relationship = (local, id, content2 = "") => id === void 0 ? "" : elementXml(local, content2, ` r:id="${escapeAttribute(id)}"`);
|
|
4186
|
-
function writeChartSpace(
|
|
4186
|
+
function writeChartSpace(space3, options = {}) {
|
|
4187
4187
|
const bindings = new Map(CHART_ROOT_BINDINGS);
|
|
4188
|
-
for (const { prefix, uri } of
|
|
4188
|
+
for (const { prefix, uri } of space3.namespaceDeclarations ?? [])
|
|
4189
4189
|
if (!bindings.has(prefix) && /^[A-Za-z_][\w.-]*$/.test(prefix)) bindings.set(prefix, uri);
|
|
4190
4190
|
const context = { bindings };
|
|
4191
4191
|
const declarations = [...bindings].map(([prefix, uri]) => ` xmlns:${prefix}="${escapeAttribute(uri)}"`).join("");
|
|
4192
4192
|
const chart = elementXml(
|
|
4193
4193
|
"chart",
|
|
4194
|
-
titleXml(context,
|
|
4194
|
+
titleXml(context, space3.title) + valXml("autoTitleDeleted", space3.autoTitleDeleted) + view3DXml(space3.view3D) + surfaceXml(context, "floor", space3.floor) + surfaceXml(context, "sideWall", space3.sideWall) + surfaceXml(context, "backWall", space3.backWall) + plotAreaXml(context, space3.plotArea) + legendXml(context, space3.legend) + valXml("plotVisOnly", space3.plotVisibleOnly) + valXml("dispBlanksAs", space3.displayBlanksAs) + valXml("showDLblsOverMax", space3.showDataLabelsOverMax) + raw(context, space3.chartExtLst)
|
|
4195
4195
|
);
|
|
4196
|
-
const body = valXml("date1904",
|
|
4196
|
+
const body = valXml("date1904", space3.date1904) + valXml("lang", space3.language) + valXml("roundedCorners", space3.roundedCorners) + styleXml(context, space3) + chart + shapePropertiesXml(context, space3.spPr) + textBodyXml(context, space3.txPr) + relationship(
|
|
4197
4197
|
"externalData",
|
|
4198
|
-
|
|
4199
|
-
valXml("autoUpdate",
|
|
4200
|
-
) + raw(context,
|
|
4198
|
+
space3.externalDataRelId,
|
|
4199
|
+
valXml("autoUpdate", space3.externalDataAutoUpdate)
|
|
4200
|
+
) + raw(context, space3.printSettings) + relationship("userShapes", space3.userShapesRelId) + raw(context, space3.extLst);
|
|
4201
4201
|
const breakAfter = options.declarationBreak ?? "\r\n";
|
|
4202
4202
|
return `${DECLARATION2}${breakAfter}<c:chartSpace${declarations}>${body}</c:chartSpace>`;
|
|
4203
4203
|
}
|
|
@@ -4993,8 +4993,8 @@ function chartGradientPaint(model, width = 1024, height = 768) {
|
|
|
4993
4993
|
textShadowFilter: shadowPaint(entry3.textShadow, `${part}-text-shadow`)
|
|
4994
4994
|
};
|
|
4995
4995
|
}
|
|
4996
|
-
const paint = (gradient, suffix,
|
|
4997
|
-
const def = buildChartGradientDef(`${prefix}-${suffix}`, gradient,
|
|
4996
|
+
const paint = (gradient, suffix, bounds2) => {
|
|
4997
|
+
const def = buildChartGradientDef(`${prefix}-${suffix}`, gradient, bounds2);
|
|
4998
4998
|
defs.push(chartGradientMarkup(def));
|
|
4999
4999
|
return `url(#${def.id})`;
|
|
5000
5000
|
};
|
|
@@ -5010,12 +5010,12 @@ function chartGradientPaint(model, width = 1024, height = 768) {
|
|
|
5010
5010
|
const series = model.series.map((source, index) => {
|
|
5011
5011
|
const view = { ...source };
|
|
5012
5012
|
if (source.shadow) view.shadowFilter = shadowPaint(source.shadow, `s${index}-shadow`);
|
|
5013
|
-
const
|
|
5014
|
-
if (source.gradient) view.color = paint(source.gradient, `s${index}`,
|
|
5013
|
+
const bounds2 = model.type === "bar" || model.type === "column" ? { width: 1, height: 1, shape: "rect" } : void 0;
|
|
5014
|
+
if (source.gradient) view.color = paint(source.gradient, `s${index}`, bounds2);
|
|
5015
5015
|
if (source.pointGradients) {
|
|
5016
5016
|
view.pointColors = [...source.pointColors ?? []];
|
|
5017
5017
|
for (const [key, gradient] of Object.entries(source.pointGradients))
|
|
5018
|
-
view.pointColors[Number(key)] = paint(gradient, `s${index}-p${key}`,
|
|
5018
|
+
view.pointColors[Number(key)] = paint(gradient, `s${index}-p${key}`, bounds2);
|
|
5019
5019
|
}
|
|
5020
5020
|
return view;
|
|
5021
5021
|
});
|
|
@@ -5214,7 +5214,7 @@ function linesAndAreas(model, frame2, out) {
|
|
|
5214
5214
|
const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
|
|
5215
5215
|
const acc = new Array(model.categories.length).fill(0);
|
|
5216
5216
|
const area = model.type === "area";
|
|
5217
|
-
const
|
|
5217
|
+
const layers2 = [];
|
|
5218
5218
|
model.series.forEach((s, si) => {
|
|
5219
5219
|
const points = [];
|
|
5220
5220
|
const lower = [];
|
|
@@ -5230,14 +5230,14 @@ function linesAndAreas(model, frame2, out) {
|
|
|
5230
5230
|
points.push([frame2.band(i2), frame2.value(top)]);
|
|
5231
5231
|
lower.push([frame2.band(i2), frame2.value(below)]);
|
|
5232
5232
|
});
|
|
5233
|
-
|
|
5233
|
+
layers2.push({
|
|
5234
5234
|
points,
|
|
5235
5235
|
lower,
|
|
5236
5236
|
color: s.color,
|
|
5237
5237
|
filter: s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""
|
|
5238
5238
|
});
|
|
5239
5239
|
});
|
|
5240
|
-
for (const { points, lower, color, filter } of area ? [...
|
|
5240
|
+
for (const { points, lower, color, filter } of area ? [...layers2].reverse() : layers2) {
|
|
5241
5241
|
if (area) {
|
|
5242
5242
|
const poly = [...points, ...[...lower].reverse()].map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
|
|
5243
5243
|
out.push(`<polygon points="${poly}" fill="${color}" fill-opacity="0.85"${filter}/>`);
|
|
@@ -5461,10 +5461,10 @@ function fitChartText(content2, maxWidth, attrs, options) {
|
|
|
5461
5461
|
// chart/render/chart-svg-legend.ts
|
|
5462
5462
|
function chartLegendSvg(model, area, frame2, options) {
|
|
5463
5463
|
const automatic = [];
|
|
5464
|
-
const
|
|
5465
|
-
const reserved = automaticLegend(model, area, automatic, options,
|
|
5464
|
+
const bounds2 = {};
|
|
5465
|
+
const reserved = automaticLegend(model, area, automatic, options, bounds2);
|
|
5466
5466
|
const plot = model.legendOverlay ? area : reserved;
|
|
5467
|
-
const box =
|
|
5467
|
+
const box = bounds2.box;
|
|
5468
5468
|
if (!box) return { plot, markup: "", foreground: false };
|
|
5469
5469
|
const manual = resolveManualLayoutRect(model.legendLayout, frame2, {
|
|
5470
5470
|
x: box.x,
|
|
@@ -5523,7 +5523,7 @@ function legendEntries(model) {
|
|
|
5523
5523
|
}
|
|
5524
5524
|
return model.series.map((s) => ({ label: s.name, color: s.color }));
|
|
5525
5525
|
}
|
|
5526
|
-
function automaticLegend(model, area, out, options,
|
|
5526
|
+
function automaticLegend(model, area, out, options, bounds2) {
|
|
5527
5527
|
const entries = legendEntries(model);
|
|
5528
5528
|
if (!model.showLegend || entries.length === 0) return area;
|
|
5529
5529
|
const pos = model.legendPosition;
|
|
@@ -5537,7 +5537,7 @@ function automaticLegend(model, area, out, options, bounds) {
|
|
|
5537
5537
|
const total = widths.reduce((a2, b) => a2 + b, 0);
|
|
5538
5538
|
let x2 = area.x + Math.max(0, (area.w - total) / 2);
|
|
5539
5539
|
const y = pos === "t" ? area.y + 4 : area.y + area.h - rowH + 4;
|
|
5540
|
-
|
|
5540
|
+
bounds2.box = { x: x2 - 4, y: y - 4, w: Math.min(total, area.w) + 8, h: rowH + 4 };
|
|
5541
5541
|
out.push(
|
|
5542
5542
|
chartAreaRect(model, "legend", {
|
|
5543
5543
|
x: x2 - 4,
|
|
@@ -5561,7 +5561,7 @@ function automaticLegend(model, area, out, options, bounds) {
|
|
|
5561
5561
|
const height = entries.length * rowH;
|
|
5562
5562
|
const x = pos === "l" ? area.x + 4 : area.x + area.w - width;
|
|
5563
5563
|
const y0 = pos === "tr" ? area.y + 4 : area.y + Math.max(0, (area.h - height) / 2);
|
|
5564
|
-
|
|
5564
|
+
bounds2.box = { x: x - 4, y: y0, w: width + 4, h: Math.min(height, area.y + area.h - y0) };
|
|
5565
5565
|
out.push(
|
|
5566
5566
|
chartAreaRect(model, "legend", {
|
|
5567
5567
|
x: x - 4,
|
|
@@ -5865,14 +5865,14 @@ function chartThemePalette(theme, fonts = {}) {
|
|
|
5865
5865
|
minorFont: fonts.minor ?? "Calibri"
|
|
5866
5866
|
};
|
|
5867
5867
|
}
|
|
5868
|
-
function chartSpaceKind(
|
|
5869
|
-
if (!
|
|
5870
|
-
const type = chartSummaryFromSpace(
|
|
5868
|
+
function chartSpaceKind(space3) {
|
|
5869
|
+
if (!space3.plotArea.groups.length) return { drawn: false };
|
|
5870
|
+
const type = chartSummaryFromSpace(space3).chartType;
|
|
5871
5871
|
return { type, drawn: DRAWN_CHART_TYPES.has(type) };
|
|
5872
5872
|
}
|
|
5873
|
-
function renderChartSpaceSvg(
|
|
5873
|
+
function renderChartSpaceSvg(space3, options) {
|
|
5874
5874
|
const { width, height, theme, fonts, formatting, colorPalette, styleDefinition, ...svg } = options;
|
|
5875
|
-
const summary = chartSummaryFromSpace(
|
|
5875
|
+
const summary = chartSummaryFromSpace(space3, {
|
|
5876
5876
|
...formatting ? { formatting } : {},
|
|
5877
5877
|
...colorPalette !== void 0 ? { colorPalette } : {},
|
|
5878
5878
|
...styleDefinition ? { styleDefinition } : {}
|
|
@@ -5884,7 +5884,10 @@ function renderChartSpaceSvg(space, options) {
|
|
|
5884
5884
|
// text/index.ts
|
|
5885
5885
|
var text_exports = {};
|
|
5886
5886
|
__export(text_exports, {
|
|
5887
|
+
TEXT_CASE_MODES: () => TEXT_CASE_MODES,
|
|
5887
5888
|
buildLeaderString: () => buildLeaderString,
|
|
5889
|
+
changeTextCase: () => changeTextCase,
|
|
5890
|
+
changeTextCaseRanges: () => changeTextCaseRanges,
|
|
5888
5891
|
decimalAnchorIndex: () => decimalAnchorIndex,
|
|
5889
5892
|
decimalSeparatorForLanguage: () => decimalSeparatorForLanguage,
|
|
5890
5893
|
detectFontScript: () => detectFontScript,
|
|
@@ -6079,6 +6082,73 @@ function decimalAnchorIndex(text3, separator) {
|
|
|
6079
6082
|
return sep >= 0 ? first2 + sep : end;
|
|
6080
6083
|
}
|
|
6081
6084
|
|
|
6085
|
+
// text/change-case.ts
|
|
6086
|
+
var TEXT_CASE_MODES = Object.freeze([
|
|
6087
|
+
"sentence",
|
|
6088
|
+
"lower",
|
|
6089
|
+
"upper",
|
|
6090
|
+
"capitalize",
|
|
6091
|
+
"toggle"
|
|
6092
|
+
]);
|
|
6093
|
+
var letter = /\p{L}/u;
|
|
6094
|
+
var wordCharacter = /[\p{L}\p{N}\p{M}'’]/u;
|
|
6095
|
+
var sentenceEnd = /[.!?。!?]/u;
|
|
6096
|
+
var space = /\s/u;
|
|
6097
|
+
function convert(text3, mode) {
|
|
6098
|
+
if (!TEXT_CASE_MODES.includes(mode)) throw new TypeError(`Unknown text case mode: ${mode}`);
|
|
6099
|
+
const points = [];
|
|
6100
|
+
let offset = 0, sentenceStart = true, pendingEnd = false, previous = "";
|
|
6101
|
+
for (const point of text3) {
|
|
6102
|
+
let out = point;
|
|
6103
|
+
if (letter.test(point)) {
|
|
6104
|
+
const lower = point.toLowerCase(), upper = point.toUpperCase();
|
|
6105
|
+
if (mode === "upper") out = upper;
|
|
6106
|
+
else if (mode === "lower") out = lower;
|
|
6107
|
+
else if (mode === "toggle") out = point === upper && point !== lower ? lower : upper;
|
|
6108
|
+
else if (mode === "sentence") out = sentenceStart ? upper : lower;
|
|
6109
|
+
else out = previous && wordCharacter.test(previous) ? lower : upper;
|
|
6110
|
+
sentenceStart = false;
|
|
6111
|
+
pendingEnd = false;
|
|
6112
|
+
} else if (point === "\n") {
|
|
6113
|
+
sentenceStart = true;
|
|
6114
|
+
pendingEnd = false;
|
|
6115
|
+
} else if (sentenceEnd.test(point)) pendingEnd = true;
|
|
6116
|
+
else if (space.test(point)) {
|
|
6117
|
+
if (pendingEnd) sentenceStart = true;
|
|
6118
|
+
pendingEnd = false;
|
|
6119
|
+
} else if (/\p{N}/u.test(point)) {
|
|
6120
|
+
sentenceStart = false;
|
|
6121
|
+
pendingEnd = false;
|
|
6122
|
+
}
|
|
6123
|
+
points.push({ start: offset, end: offset + point.length, text: point, out });
|
|
6124
|
+
offset += point.length;
|
|
6125
|
+
previous = point;
|
|
6126
|
+
}
|
|
6127
|
+
return points;
|
|
6128
|
+
}
|
|
6129
|
+
function changeTextCase(text3, mode) {
|
|
6130
|
+
return convert(text3, mode).map((point) => point.out).join("");
|
|
6131
|
+
}
|
|
6132
|
+
function changeTextCaseRanges(text3, mode, boundaries = []) {
|
|
6133
|
+
const breaks = new Set(boundaries);
|
|
6134
|
+
const ranges = [];
|
|
6135
|
+
let current;
|
|
6136
|
+
for (const point of convert(text3, mode)) {
|
|
6137
|
+
if (point.out === point.text) {
|
|
6138
|
+
current = void 0;
|
|
6139
|
+
continue;
|
|
6140
|
+
}
|
|
6141
|
+
if (current && current.end === point.start && !breaks.has(point.start)) {
|
|
6142
|
+
current.end = point.end;
|
|
6143
|
+
current.text += point.out;
|
|
6144
|
+
} else {
|
|
6145
|
+
current = { start: point.start, end: point.end, text: point.out };
|
|
6146
|
+
ranges.push(current);
|
|
6147
|
+
}
|
|
6148
|
+
}
|
|
6149
|
+
return ranges;
|
|
6150
|
+
}
|
|
6151
|
+
|
|
6082
6152
|
// i18n/index.ts
|
|
6083
6153
|
var i18n_exports = {};
|
|
6084
6154
|
__export(i18n_exports, {
|
|
@@ -6166,6 +6236,7 @@ __export(drawingml_exports, {
|
|
|
6166
6236
|
drawingColorCss: () => drawingColorCss,
|
|
6167
6237
|
drawingColorXml: () => drawingColorXml,
|
|
6168
6238
|
drawingFillXml: () => drawingFillXml,
|
|
6239
|
+
drawingThemeXml: () => drawingThemeXml,
|
|
6169
6240
|
fillElementOf: () => fillElementOf,
|
|
6170
6241
|
integerAttribute: () => integerAttribute,
|
|
6171
6242
|
isThemeColorSlot: () => isThemeColorSlot,
|
|
@@ -6337,6 +6408,83 @@ function parseDrawingGeometry(spPr) {
|
|
|
6337
6408
|
return { geometry, ...Object.keys(adjustments).length > 0 ? { adjustments } : {} };
|
|
6338
6409
|
}
|
|
6339
6410
|
|
|
6411
|
+
// drawingml/write-theme.ts
|
|
6412
|
+
function fragment(host, xml, namespaces) {
|
|
6413
|
+
const declarations = Object.entries({ a: NS.a, ...namespaces }).map(([prefix, uri]) => ` xmlns:${prefix}="${uri}"`).join("");
|
|
6414
|
+
const wrapper = parseXml(`<w${declarations}>${xml}</w>`, { label: "DrawingML theme fragment" });
|
|
6415
|
+
return elements(wrapper.documentElement).map(
|
|
6416
|
+
(node) => host.ownerDocument.importNode(node, true)
|
|
6417
|
+
);
|
|
6418
|
+
}
|
|
6419
|
+
function extensionList2(parent, extensions, namespaces) {
|
|
6420
|
+
const entries = Object.entries(extensions ?? {});
|
|
6421
|
+
if (!entries.length) return;
|
|
6422
|
+
const doc = parent.ownerDocument;
|
|
6423
|
+
const list2 = doc.createElementNS(NS.a, "a:extLst");
|
|
6424
|
+
for (const [uri, xml] of entries) {
|
|
6425
|
+
const ext = doc.createElementNS(NS.a, "a:ext");
|
|
6426
|
+
ext.setAttribute("uri", uri);
|
|
6427
|
+
for (const node of fragment(ext, xml, namespaces)) ext.appendChild(node);
|
|
6428
|
+
list2.appendChild(ext);
|
|
6429
|
+
}
|
|
6430
|
+
parent.appendChild(list2);
|
|
6431
|
+
}
|
|
6432
|
+
function fontCollection(parent, name, fonts) {
|
|
6433
|
+
const doc = parent.ownerDocument;
|
|
6434
|
+
const node = doc.createElementNS(NS.a, `a:${name}`);
|
|
6435
|
+
for (const [local, face] of [
|
|
6436
|
+
["latin", fonts.latin],
|
|
6437
|
+
["ea", fonts.eastAsia],
|
|
6438
|
+
["cs", fonts.complexScript]
|
|
6439
|
+
]) {
|
|
6440
|
+
const font = doc.createElementNS(NS.a, `a:${local}`);
|
|
6441
|
+
font.setAttribute("typeface", face ?? "");
|
|
6442
|
+
node.appendChild(font);
|
|
6443
|
+
}
|
|
6444
|
+
for (const [script, face] of Object.entries(fonts.scripts)) {
|
|
6445
|
+
const font = doc.createElementNS(NS.a, "a:font");
|
|
6446
|
+
font.setAttribute("script", script);
|
|
6447
|
+
font.setAttribute("typeface", face);
|
|
6448
|
+
node.appendChild(font);
|
|
6449
|
+
}
|
|
6450
|
+
parent.appendChild(node);
|
|
6451
|
+
}
|
|
6452
|
+
function drawingThemeXml(theme, parts) {
|
|
6453
|
+
const namespaces = parts.namespaces ?? {};
|
|
6454
|
+
const doc = parseXml(
|
|
6455
|
+
`<a:theme xmlns:a="${NS.a}"${Object.entries(namespaces).map(([prefix, uri]) => ` xmlns:${prefix}="${uri}"`).join("")}/>`
|
|
6456
|
+
);
|
|
6457
|
+
const root = doc.documentElement;
|
|
6458
|
+
if (theme.name !== void 0) root.setAttribute("name", theme.name);
|
|
6459
|
+
const elementsNode = doc.createElementNS(NS.a, "a:themeElements");
|
|
6460
|
+
root.appendChild(elementsNode);
|
|
6461
|
+
const scheme = doc.createElementNS(NS.a, "a:clrScheme");
|
|
6462
|
+
scheme.setAttribute("name", theme.colorScheme.name ?? theme.name ?? "Custom");
|
|
6463
|
+
for (const slot2 of THEME_COLOR_SLOTS) {
|
|
6464
|
+
const color = theme.colorScheme.colors[slot2];
|
|
6465
|
+
if (!color) throw new Error(`The theme colour scheme has no ${slot2} colour.`);
|
|
6466
|
+
const node = doc.createElementNS(NS.a, `a:${slot2}`);
|
|
6467
|
+
for (const child3 of fragment(node, drawingColorXml(color), namespaces)) node.appendChild(child3);
|
|
6468
|
+
scheme.appendChild(node);
|
|
6469
|
+
}
|
|
6470
|
+
extensionList2(scheme, parts.colorSchemeExtensions, namespaces);
|
|
6471
|
+
elementsNode.appendChild(scheme);
|
|
6472
|
+
const fonts = doc.createElementNS(NS.a, "a:fontScheme");
|
|
6473
|
+
fonts.setAttribute("name", theme.fontScheme.name ?? theme.name ?? "Custom");
|
|
6474
|
+
fontCollection(fonts, "majorFont", theme.fontScheme.major);
|
|
6475
|
+
fontCollection(fonts, "minorFont", theme.fontScheme.minor);
|
|
6476
|
+
elementsNode.appendChild(fonts);
|
|
6477
|
+
const format = fragment(elementsNode, parts.formatScheme, namespaces);
|
|
6478
|
+
if (format.length !== 1 || format[0].localName !== "fmtScheme" || format[0].namespaceURI !== NS.a)
|
|
6479
|
+
throw new Error("The theme format scheme must be one a:fmtScheme element.");
|
|
6480
|
+
elementsNode.appendChild(format[0]);
|
|
6481
|
+
extensionList2(elementsNode, parts.themeElementsExtensions, namespaces);
|
|
6482
|
+
root.appendChild(doc.createElementNS(NS.a, "a:objectDefaults"));
|
|
6483
|
+
root.appendChild(doc.createElementNS(NS.a, "a:extraClrSchemeLst"));
|
|
6484
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
6485
|
+
${buildXml(doc)}`;
|
|
6486
|
+
}
|
|
6487
|
+
|
|
6340
6488
|
// drawingml/gradient-preset-data.ts
|
|
6341
6489
|
var OFFICE_GRADIENT_PRESET_DATA = [
|
|
6342
6490
|
[
|
|
@@ -18401,13 +18549,13 @@ function textFitsAt(node, text3, sizePt, metrics, refSize) {
|
|
|
18401
18549
|
}
|
|
18402
18550
|
return paragraphsFit(text3, sizePt, availW, availH, metrics);
|
|
18403
18551
|
}
|
|
18404
|
-
function fitNodeFontPt(node, text3,
|
|
18405
|
-
for (let size =
|
|
18552
|
+
function fitNodeFontPt(node, text3, bounds2, metrics, refSize) {
|
|
18553
|
+
for (let size = bounds2.start; size > bounds2.floor; size--) {
|
|
18406
18554
|
if (textFitsAt(node, text3, size, metrics, refSize)) {
|
|
18407
18555
|
return size;
|
|
18408
18556
|
}
|
|
18409
18557
|
}
|
|
18410
|
-
return
|
|
18558
|
+
return bounds2.floor;
|
|
18411
18559
|
}
|
|
18412
18560
|
|
|
18413
18561
|
// diagram/engine/text-grow.ts
|
|
@@ -19440,9 +19588,9 @@ function placeTwoColumns(shapes, centre, top, gap, sp) {
|
|
|
19440
19588
|
const left = side === 0 ? centre - gap / 2 - width : centre + gap / 2;
|
|
19441
19589
|
let y = top;
|
|
19442
19590
|
for (const shape of column) {
|
|
19443
|
-
const
|
|
19444
|
-
rects.push(...shiftShape(shape, left -
|
|
19445
|
-
y +=
|
|
19591
|
+
const bounds2 = boundsOf(shape.rects);
|
|
19592
|
+
rects.push(...shiftShape(shape, left - bounds2.x, y - bounds2.y).rects);
|
|
19593
|
+
y += bounds2.h + sp;
|
|
19446
19594
|
bottom = Math.max(bottom, y - sp);
|
|
19447
19595
|
}
|
|
19448
19596
|
}
|
|
@@ -19509,9 +19657,9 @@ function pack(shapes, vertical, gap, end) {
|
|
|
19509
19657
|
const across = (s) => vertical ? boundsOf(s.rects).w : boundsOf(s.rects).h;
|
|
19510
19658
|
const thickness = Math.max(0, ...shapes.map(across));
|
|
19511
19659
|
for (const shape of shapes) {
|
|
19512
|
-
const
|
|
19660
|
+
const bounds2 = boundsOf(shape.rects);
|
|
19513
19661
|
const crossShift = end ? thickness - across(shape) : 0;
|
|
19514
|
-
let placed = vertical ? shiftShape(shape, crossShift -
|
|
19662
|
+
let placed = vertical ? shiftShape(shape, crossShift - bounds2.x, 0) : shiftShape(shape, 0, crossShift - bounds2.y);
|
|
19515
19663
|
if (rects.length > 0 && vertical) {
|
|
19516
19664
|
const above = boundsOf(rects);
|
|
19517
19665
|
placed = shiftShape(placed, 0, above.y + above.h + gap - boundsOf(placed.rects).y);
|
|
@@ -19648,21 +19796,21 @@ function fitContainers(node) {
|
|
|
19648
19796
|
if (boxes.length === 0) {
|
|
19649
19797
|
return void 0;
|
|
19650
19798
|
}
|
|
19651
|
-
const
|
|
19799
|
+
const bounds2 = boundsOf(boxes);
|
|
19652
19800
|
if (HIER_ALGS.has(node.alg.type) && hasHierAncestor(node)) {
|
|
19653
|
-
node.box =
|
|
19801
|
+
node.box = bounds2;
|
|
19654
19802
|
}
|
|
19655
|
-
return
|
|
19803
|
+
return bounds2;
|
|
19656
19804
|
}
|
|
19657
19805
|
function placeScaled(node, shape) {
|
|
19658
19806
|
const box = node.box;
|
|
19659
|
-
const
|
|
19660
|
-
if (!box || !(
|
|
19807
|
+
const bounds2 = boundsOf(shape.rects);
|
|
19808
|
+
if (!box || !(bounds2.w > 0) || !(bounds2.h > 0)) {
|
|
19661
19809
|
return;
|
|
19662
19810
|
}
|
|
19663
|
-
const scale = Math.min(box.w /
|
|
19664
|
-
const ox = box.x + (box.w -
|
|
19665
|
-
const oy = box.y + (box.h -
|
|
19811
|
+
const scale = Math.min(box.w / bounds2.w, box.h / bounds2.h);
|
|
19812
|
+
const ox = box.x + (box.w - bounds2.w * scale) / 2 - bounds2.x * scale;
|
|
19813
|
+
const oy = box.y + (box.h - bounds2.h * scale) / 2 - bounds2.y * scale;
|
|
19666
19814
|
for (const r of shape.rects) {
|
|
19667
19815
|
r.node.box = { x: ox + r.x * scale, y: oy + r.y * scale, w: r.w * scale, h: r.h * scale };
|
|
19668
19816
|
}
|
|
@@ -20459,20 +20607,20 @@ var UnionFind = class {
|
|
|
20459
20607
|
}
|
|
20460
20608
|
};
|
|
20461
20609
|
function allNodes(entries) {
|
|
20462
|
-
const
|
|
20610
|
+
const roots2 = /* @__PURE__ */ new Set();
|
|
20463
20611
|
for (const { node } of entries) {
|
|
20464
20612
|
let top = node;
|
|
20465
20613
|
while (top.parent) {
|
|
20466
20614
|
top = top.parent;
|
|
20467
20615
|
}
|
|
20468
|
-
|
|
20616
|
+
roots2.add(top);
|
|
20469
20617
|
}
|
|
20470
20618
|
const out = [];
|
|
20471
20619
|
const visit = (n2) => {
|
|
20472
20620
|
out.push(n2);
|
|
20473
20621
|
n2.children.forEach(visit);
|
|
20474
20622
|
};
|
|
20475
|
-
|
|
20623
|
+
roots2.forEach(visit);
|
|
20476
20624
|
return out;
|
|
20477
20625
|
}
|
|
20478
20626
|
function buildLinks(entries) {
|
|
@@ -20551,8 +20699,8 @@ function resolveEngineFonts(entries, metrics) {
|
|
|
20551
20699
|
const refSize = (ref) => previous.get(ref) ?? starts.get(ref);
|
|
20552
20700
|
const sizes = /* @__PURE__ */ new Map();
|
|
20553
20701
|
for (const entry3 of entries) {
|
|
20554
|
-
const
|
|
20555
|
-
sizes.set(entry3.node, fitNodeFontPt(entry3.node, entry3.text,
|
|
20702
|
+
const bounds2 = nodeFontBounds(entry3.node);
|
|
20703
|
+
sizes.set(entry3.node, fitNodeFontPt(entry3.node, entry3.text, bounds2, metrics, refSize));
|
|
20556
20704
|
}
|
|
20557
20705
|
equalise(sizes, starts, groups, caps);
|
|
20558
20706
|
resolved = sizes;
|
|
@@ -21335,11 +21483,11 @@ function ancestorsOf(node, parentOf) {
|
|
|
21335
21483
|
}
|
|
21336
21484
|
return out;
|
|
21337
21485
|
}
|
|
21338
|
-
function siblingGroupOf(node, parentOf, childrenOf,
|
|
21486
|
+
function siblingGroupOf(node, parentOf, childrenOf, roots2) {
|
|
21339
21487
|
const parent = parentOf.get(node.id);
|
|
21340
|
-
return parent ? childrenOf.get(parent.id) ?? [] :
|
|
21488
|
+
return parent ? childrenOf.get(parent.id) ?? [] : roots2;
|
|
21341
21489
|
}
|
|
21342
|
-
function navigateAxisHop(current, axis, nodes, childrenOf, parentOf,
|
|
21490
|
+
function navigateAxisHop(current, axis, nodes, childrenOf, parentOf, roots2) {
|
|
21343
21491
|
const out = [];
|
|
21344
21492
|
const seen = /* @__PURE__ */ new Set();
|
|
21345
21493
|
const add = (node) => {
|
|
@@ -21384,7 +21532,7 @@ function navigateAxisHop(current, axis, nodes, childrenOf, parentOf, roots) {
|
|
|
21384
21532
|
break;
|
|
21385
21533
|
case "followSib":
|
|
21386
21534
|
case "precedSib": {
|
|
21387
|
-
const siblings = siblingGroupOf(node, parentOf, childrenOf,
|
|
21535
|
+
const siblings = siblingGroupOf(node, parentOf, childrenOf, roots2);
|
|
21388
21536
|
const index = siblings.findIndex((sibling) => sibling.id === node.id);
|
|
21389
21537
|
addAll(axis === "followSib" ? siblings.slice(index + 1) : siblings.slice(0, index));
|
|
21390
21538
|
break;
|
|
@@ -21462,30 +21610,30 @@ function resolveAxisNodes(nodes, axis, pointTypes, start, count, context) {
|
|
|
21462
21610
|
}
|
|
21463
21611
|
}
|
|
21464
21612
|
}
|
|
21465
|
-
const
|
|
21613
|
+
const roots2 = nodes.filter((n2) => !n2.parentId || !byId.has(n2.parentId));
|
|
21466
21614
|
let current;
|
|
21467
21615
|
let nextHop;
|
|
21468
21616
|
if (axis[0] === "root" && axis.length > 1) {
|
|
21469
|
-
current = applyPointTypeAndRange(
|
|
21617
|
+
current = applyPointTypeAndRange(roots2, pointTypes?.[1], start?.[1], count?.[1]);
|
|
21470
21618
|
nextHop = 2;
|
|
21471
21619
|
} else if (axis[0] === "root") {
|
|
21472
|
-
current = applyPointTypeAndRange(
|
|
21620
|
+
current = applyPointTypeAndRange(roots2, pointTypes?.[0], start?.[0], count?.[0]);
|
|
21473
21621
|
nextHop = 1;
|
|
21474
21622
|
} else if (context !== void 0) {
|
|
21475
21623
|
current = applyPointTypeAndRange(
|
|
21476
|
-
navigateAxisHop(context, axis[0], nodes, childrenOf, parentOf,
|
|
21624
|
+
navigateAxisHop(context, axis[0], nodes, childrenOf, parentOf, roots2),
|
|
21477
21625
|
pointTypes?.[0],
|
|
21478
21626
|
start?.[0],
|
|
21479
21627
|
count?.[0]
|
|
21480
21628
|
);
|
|
21481
21629
|
nextHop = 1;
|
|
21482
21630
|
} else {
|
|
21483
|
-
current = applyPointTypeAndRange(
|
|
21631
|
+
current = applyPointTypeAndRange(roots2, pointTypes?.[0], start?.[0], count?.[0]);
|
|
21484
21632
|
nextHop = 1;
|
|
21485
21633
|
}
|
|
21486
21634
|
for (let hop = nextHop; hop < axis.length; hop += 1) {
|
|
21487
21635
|
current = applyPointTypeAndRange(
|
|
21488
|
-
navigateAxisHop(current, axis[hop], nodes, childrenOf, parentOf,
|
|
21636
|
+
navigateAxisHop(current, axis[hop], nodes, childrenOf, parentOf, roots2),
|
|
21489
21637
|
pointTypes?.[hop],
|
|
21490
21638
|
start?.[hop],
|
|
21491
21639
|
count?.[hop]
|
|
@@ -22665,12 +22813,12 @@ function collectFollowSibNodeCounts(node) {
|
|
|
22665
22813
|
function isChildOnlyAxis(iter) {
|
|
22666
22814
|
return iter.axis?.length === 1 && iter.axis[0] === "ch";
|
|
22667
22815
|
}
|
|
22668
|
-
function selectArrangedNodes(node, flat,
|
|
22816
|
+
function selectArrangedNodes(node, flat, roots2) {
|
|
22669
22817
|
const iterators = qualifyingIterators(node);
|
|
22670
22818
|
if (iterators.length === 0) {
|
|
22671
|
-
return
|
|
22819
|
+
return roots2 && roots2.length > 1 ? roots2 : flat;
|
|
22672
22820
|
}
|
|
22673
|
-
const base =
|
|
22821
|
+
const base = roots2 && roots2.length > 0 && iterators.every(isChildOnlyAxis) ? roots2 : flat;
|
|
22674
22822
|
const indices = /* @__PURE__ */ new Set();
|
|
22675
22823
|
for (const iter of iterators) {
|
|
22676
22824
|
for (const i2 of resolveIteratorIndices(iter, base.length)) {
|
|
@@ -22703,16 +22851,16 @@ function buildForest(nodes) {
|
|
|
22703
22851
|
for (const n2 of nodes) {
|
|
22704
22852
|
map.set(n2.id, { node: n2, children: [] });
|
|
22705
22853
|
}
|
|
22706
|
-
const
|
|
22854
|
+
const roots2 = [];
|
|
22707
22855
|
for (const n2 of nodes) {
|
|
22708
22856
|
const tn = map.get(n2.id);
|
|
22709
22857
|
if (n2.parentId && map.has(n2.parentId)) {
|
|
22710
22858
|
map.get(n2.parentId).children.push(tn);
|
|
22711
22859
|
} else {
|
|
22712
|
-
|
|
22860
|
+
roots2.push(tn);
|
|
22713
22861
|
}
|
|
22714
22862
|
}
|
|
22715
|
-
return
|
|
22863
|
+
return roots2;
|
|
22716
22864
|
}
|
|
22717
22865
|
function buildTree(nodes) {
|
|
22718
22866
|
const hasNestedChildren = nodes.some((n2) => n2.children !== void 0 && n2.children.length > 0);
|
|
@@ -22724,8 +22872,8 @@ function buildTree(nodes) {
|
|
|
22724
22872
|
children: (n2.children ?? []).map(toTreeNode)
|
|
22725
22873
|
});
|
|
22726
22874
|
const allIds = new Set(nodes.map((n2) => n2.id));
|
|
22727
|
-
const
|
|
22728
|
-
return
|
|
22875
|
+
const roots2 = nodes.filter((n2) => !n2.parentId || !allIds.has(n2.parentId));
|
|
22876
|
+
return roots2.map(toTreeNode);
|
|
22729
22877
|
}
|
|
22730
22878
|
var MAX_TREE_DEPTH = 256;
|
|
22731
22879
|
function treeWidth(t, depth = 0) {
|
|
@@ -22872,8 +23020,8 @@ function resolveRoleFontSize(roleNode, index, items, fontName) {
|
|
|
22872
23020
|
void 0
|
|
22873
23021
|
);
|
|
22874
23022
|
}
|
|
22875
|
-
function fitSharedFontSize(
|
|
22876
|
-
const { ceilingPx, floorPx, role } =
|
|
23023
|
+
function fitSharedFontSize(bounds2, index, items, fontName, naturalAspect) {
|
|
23024
|
+
const { ceilingPx, floorPx, role } = bounds2;
|
|
22877
23025
|
if (items.length === 0) {
|
|
22878
23026
|
return snapToWholePoint(ceilingPx);
|
|
22879
23027
|
}
|
|
@@ -24370,9 +24518,9 @@ function smartArtChildrenOf(nodes, connections) {
|
|
|
24370
24518
|
|
|
24371
24519
|
// diagram/layout/smartart-layout-interpreter-arranged-selection.ts
|
|
24372
24520
|
function selectArrangedPoints(view, plan, nodes, flat, connections) {
|
|
24373
|
-
const
|
|
24521
|
+
const roots2 = topLevelSmartArtNodes(nodes);
|
|
24374
24522
|
const childrenOf = smartArtChildrenOf(nodes, connections);
|
|
24375
|
-
const preArranged = plan.kind === "composite" ?
|
|
24523
|
+
const preArranged = plan.kind === "composite" ? roots2.length > 0 ? roots2 : flat : selectArrangedNodes(plan.node, flat, roots2);
|
|
24376
24524
|
const hub = plan.kind === "composite" ? void 0 : detectHubExpansion(view, plan.node, preArranged, childrenOf);
|
|
24377
24525
|
const arranged = hub ? applyChildOrder(hub.satellites, buildChildOrder(connections)) : preArranged;
|
|
24378
24526
|
return { childrenOf, hub, arranged };
|
|
@@ -25007,10 +25155,10 @@ function arrangeRecursiveTable(view, plan, nodes, box, palette, style, elementId
|
|
|
25007
25155
|
childIds.add(c2.id);
|
|
25008
25156
|
}
|
|
25009
25157
|
}
|
|
25010
|
-
const
|
|
25158
|
+
const roots2 = nodes.filter((n2) => !childIds.has(n2.id));
|
|
25011
25159
|
const depthOf2 = /* @__PURE__ */ new Map();
|
|
25012
25160
|
let maxDepth2 = 0;
|
|
25013
|
-
const depthStack =
|
|
25161
|
+
const depthStack = roots2.map((r) => ({
|
|
25014
25162
|
node: r,
|
|
25015
25163
|
depth: 0
|
|
25016
25164
|
}));
|
|
@@ -25052,7 +25200,7 @@ function arrangeRecursiveTable(view, plan, nodes, box, palette, style, elementId
|
|
|
25052
25200
|
place(child3, childX, childWidth);
|
|
25053
25201
|
}
|
|
25054
25202
|
};
|
|
25055
|
-
for (const [root, rootX, rootWidth] of splitAcross(
|
|
25203
|
+
for (const [root, rootX, rootWidth] of splitAcross(roots2, 0, w)) {
|
|
25056
25204
|
place(root, rootX, rootWidth);
|
|
25057
25205
|
}
|
|
25058
25206
|
const itemShape = findCompositeItemShape(plan.node);
|
|
@@ -27184,13 +27332,13 @@ function allChildrenHangForRoot(root, orgChart, perRow) {
|
|
|
27184
27332
|
return r.deepestFanLevel === childLevel;
|
|
27185
27333
|
});
|
|
27186
27334
|
}
|
|
27187
|
-
function computeHangShape(
|
|
27335
|
+
function computeHangShape(roots2, orgChart, perRow) {
|
|
27188
27336
|
let fannedGenerations = 1;
|
|
27189
27337
|
let maxHangDepth = 0;
|
|
27190
27338
|
let maxHangRows = 0;
|
|
27191
27339
|
let allChildrenHang = false;
|
|
27192
27340
|
let hangingColumns = 0;
|
|
27193
|
-
for (const root of
|
|
27341
|
+
for (const root of roots2) {
|
|
27194
27342
|
const r = walk2(root, 0, perRow, orgChart, void 0);
|
|
27195
27343
|
fannedGenerations = Math.max(fannedGenerations, r.deepestFanLevel + 1);
|
|
27196
27344
|
maxHangDepth = Math.max(maxHangDepth, r.maxHangDepth);
|
|
@@ -27223,9 +27371,9 @@ function widthWalk(t, level2, perRow, orgChart, siblingCount, map) {
|
|
|
27223
27371
|
map.set(t, width);
|
|
27224
27372
|
return width;
|
|
27225
27373
|
}
|
|
27226
|
-
function buildFanAwareWidthMap(
|
|
27374
|
+
function buildFanAwareWidthMap(roots2, orgChart, perRow) {
|
|
27227
27375
|
const map = /* @__PURE__ */ new Map();
|
|
27228
|
-
for (const root of
|
|
27376
|
+
for (const root of roots2) {
|
|
27229
27377
|
widthWalk(root, 0, perRow, orgChart, void 0, map);
|
|
27230
27378
|
}
|
|
27231
27379
|
return map;
|
|
@@ -27337,7 +27485,7 @@ function placeDescendantColumn(hc, node, edgeX, side, y, descW, descH, stackGapP
|
|
|
27337
27485
|
}
|
|
27338
27486
|
return nextY;
|
|
27339
27487
|
}
|
|
27340
|
-
function arrangeFannedHangingForest(view, nodes, box, palette, style, elementId,
|
|
27488
|
+
function arrangeFannedHangingForest(view, nodes, box, palette, style, elementId, roots2, itemShape, connectorLabels, algorithmNode, index, fontName, presLayoutVars, orgChart) {
|
|
27341
27489
|
if (orgChart) {
|
|
27342
27490
|
return void 0;
|
|
27343
27491
|
}
|
|
@@ -27347,7 +27495,7 @@ function arrangeFannedHangingForest(view, nodes, box, palette, style, elementId,
|
|
|
27347
27495
|
index,
|
|
27348
27496
|
nodes.length,
|
|
27349
27497
|
presLayoutVars,
|
|
27350
|
-
|
|
27498
|
+
roots2.length,
|
|
27351
27499
|
box
|
|
27352
27500
|
);
|
|
27353
27501
|
if (!geometry) {
|
|
@@ -27366,8 +27514,8 @@ function arrangeFannedHangingForest(view, nodes, box, palette, style, elementId,
|
|
|
27366
27514
|
resolveHierarchyItemFontSizePx(nodes, algorithmNode, index, descW, descH, fontName)
|
|
27367
27515
|
);
|
|
27368
27516
|
const rootChildGap = ROOT_CHILD_GAP_RATIO * descH;
|
|
27369
|
-
const branchCount =
|
|
27370
|
-
|
|
27517
|
+
const branchCount = roots2.length;
|
|
27518
|
+
roots2.forEach((root, i2) => {
|
|
27371
27519
|
const columnIndex = reversed ? branchCount - 1 - i2 : i2;
|
|
27372
27520
|
const branchX = columnIndex * (rootW + gap);
|
|
27373
27521
|
pushNode(hc, root.node, branchX, 0, rootW, rootH);
|
|
@@ -27440,9 +27588,9 @@ function placeHangingTree(hc, t, x, options, cursor, size, level2 = 0) {
|
|
|
27440
27588
|
placeHangingTree(hc, child3, childX, options, cursor, void 0, level2 + 1);
|
|
27441
27589
|
}
|
|
27442
27590
|
}
|
|
27443
|
-
function placeHangingForest(hc,
|
|
27591
|
+
function placeHangingForest(hc, roots2, startX, startY, options, rootSize) {
|
|
27444
27592
|
const cursor = { y: startY };
|
|
27445
|
-
for (const root of
|
|
27593
|
+
for (const root of roots2) {
|
|
27446
27594
|
placeHangingTree(hc, root, startX, options, cursor, rootSize);
|
|
27447
27595
|
}
|
|
27448
27596
|
}
|
|
@@ -27524,16 +27672,16 @@ function countRows(t, level2, orgChart, fold) {
|
|
|
27524
27672
|
}
|
|
27525
27673
|
return count;
|
|
27526
27674
|
}
|
|
27527
|
-
function countHangingRows(
|
|
27528
|
-
return
|
|
27675
|
+
function countHangingRows(roots2, orgChart, fold) {
|
|
27676
|
+
return roots2.reduce((sum, root) => sum + countRows(root, 0, orgChart, fold), 0);
|
|
27529
27677
|
}
|
|
27530
27678
|
|
|
27531
27679
|
// diagram/hierarchy/smartart-hierarchy-hanging-arrange.ts
|
|
27532
27680
|
var HANGING_MODE_INSET = 6;
|
|
27533
|
-
function arrangeFullyHangingTree(view, nodes, box, palette, style, elementId,
|
|
27681
|
+
function arrangeFullyHangingTree(view, nodes, box, palette, style, elementId, roots2, itemShape, connectorLabels, algorithmNode, index, fontName, linDir, orgChart, presLayoutVars, cornerSide) {
|
|
27534
27682
|
const { width: w, height: h2 } = box;
|
|
27535
27683
|
const foldDeeperGenerations = algorithmNode ? hierarchyLeafFoldsDescendants(algorithmNode) : false;
|
|
27536
|
-
const rows = countHangingRows(
|
|
27684
|
+
const rows = countHangingRows(roots2, orgChart, foldDeeperGenerations);
|
|
27537
27685
|
const fit2 = fitHangingBox(view, algorithmNode, index, w, h2, rows, nodes.length, presLayoutVars);
|
|
27538
27686
|
const { boxW, boxH, vGap } = fit2;
|
|
27539
27687
|
const indent = boxW * 0.35;
|
|
@@ -27556,7 +27704,7 @@ function arrangeFullyHangingTree(view, nodes, box, palette, style, elementId, ro
|
|
|
27556
27704
|
} : void 0;
|
|
27557
27705
|
placeHangingForest(
|
|
27558
27706
|
hc,
|
|
27559
|
-
|
|
27707
|
+
roots2,
|
|
27560
27708
|
HANGING_MODE_INSET + indent,
|
|
27561
27709
|
columnAlign ? 0 : HANGING_MODE_INSET,
|
|
27562
27710
|
{
|
|
@@ -27579,8 +27727,8 @@ function arrangeFullyHangingTree(view, nodes, box, palette, style, elementId, ro
|
|
|
27579
27727
|
}
|
|
27580
27728
|
|
|
27581
27729
|
// diagram/hierarchy/smartart-hierarchy-hang-dispatch.ts
|
|
27582
|
-
function dispatchHangingMode(view, nodes, box, palette, style, elementId,
|
|
27583
|
-
if (
|
|
27730
|
+
function dispatchHangingMode(view, nodes, box, palette, style, elementId, roots2, itemShape, connectorLabels, algorithmNode, index, fontName, presLayoutVars, orgChart, cornerPlan) {
|
|
27731
|
+
if (roots2.length > 1) {
|
|
27584
27732
|
const fanned = arrangeFannedHangingForest(
|
|
27585
27733
|
view,
|
|
27586
27734
|
nodes,
|
|
@@ -27588,7 +27736,7 @@ function dispatchHangingMode(view, nodes, box, palette, style, elementId, roots,
|
|
|
27588
27736
|
palette,
|
|
27589
27737
|
style,
|
|
27590
27738
|
elementId,
|
|
27591
|
-
|
|
27739
|
+
roots2,
|
|
27592
27740
|
itemShape,
|
|
27593
27741
|
connectorLabels,
|
|
27594
27742
|
algorithmNode,
|
|
@@ -27608,7 +27756,7 @@ function dispatchHangingMode(view, nodes, box, palette, style, elementId, roots,
|
|
|
27608
27756
|
palette,
|
|
27609
27757
|
style,
|
|
27610
27758
|
elementId,
|
|
27611
|
-
|
|
27759
|
+
roots2,
|
|
27612
27760
|
itemShape,
|
|
27613
27761
|
connectorLabels,
|
|
27614
27762
|
algorithmNode,
|
|
@@ -28387,7 +28535,7 @@ function arrangeHierarchy(view, nodes, box, palette, style, elementId, presLayou
|
|
|
28387
28535
|
const { width: w, height: h2 } = box;
|
|
28388
28536
|
const orgChart = presLayoutVars?.orgChart === true;
|
|
28389
28537
|
const orderedNodes = applyChildOrder(nodes, childOrder);
|
|
28390
|
-
const
|
|
28538
|
+
const roots2 = buildTree(flattenOrgChartGroupWrappers(orderedNodes, orgChart));
|
|
28391
28539
|
const cornerPlan = resolveCornerHangPlan(
|
|
28392
28540
|
view,
|
|
28393
28541
|
algorithmNode,
|
|
@@ -28405,7 +28553,7 @@ function arrangeHierarchy(view, nodes, box, palette, style, elementId, presLayou
|
|
|
28405
28553
|
palette,
|
|
28406
28554
|
style,
|
|
28407
28555
|
elementId,
|
|
28408
|
-
|
|
28556
|
+
roots2,
|
|
28409
28557
|
itemShape,
|
|
28410
28558
|
connectorLabels,
|
|
28411
28559
|
algorithmNode,
|
|
@@ -28425,14 +28573,14 @@ function arrangeHierarchy(view, nodes, box, palette, style, elementId, presLayou
|
|
|
28425
28573
|
presLayoutVars,
|
|
28426
28574
|
box
|
|
28427
28575
|
);
|
|
28428
|
-
const rawDepth =
|
|
28576
|
+
const rawDepth = roots2.length > 0 ? Math.max(...roots2.map((r) => treeDepth(r))) : 1;
|
|
28429
28577
|
const rowSize = resolveRowSize(presLayoutVars);
|
|
28430
28578
|
const noHang = { maxHangDepth: 0, maxHangRows: 0, allChildrenHang: false, hangingColumns: 0 };
|
|
28431
|
-
const hangShape = mode === "tailed" ? computeHangShape(
|
|
28579
|
+
const hangShape = mode === "tailed" ? computeHangShape(roots2, orgChart, rowSize) : { fannedGenerations: rawDepth, ...noHang };
|
|
28432
28580
|
const depth = hangShape.fannedGenerations;
|
|
28433
|
-
const fanAwareWidthMap = mode === "tailed" ? buildFanAwareWidthMap(
|
|
28581
|
+
const fanAwareWidthMap = mode === "tailed" ? buildFanAwareWidthMap(roots2, orgChart, rowSize) : void 0;
|
|
28434
28582
|
const spanOfRoot = (r) => resolveSpanWidth(fanAwareWidthMap, r, orgChart);
|
|
28435
|
-
const totalLeaves =
|
|
28583
|
+
const totalLeaves = roots2.reduce((sum, r) => sum + spanOfRoot(r), 0);
|
|
28436
28584
|
const { boxW, boxH } = fitItemBox(
|
|
28437
28585
|
effectiveBox,
|
|
28438
28586
|
totalLeaves,
|
|
@@ -28499,7 +28647,7 @@ function arrangeHierarchy(view, nodes, box, palette, style, elementId, presLayou
|
|
|
28499
28647
|
orgChart
|
|
28500
28648
|
);
|
|
28501
28649
|
let offset = 0;
|
|
28502
|
-
for (const root of
|
|
28650
|
+
for (const root of roots2) {
|
|
28503
28651
|
placeStandardTree(hc, root, offset, 0, cellW, cellH, standardOptions);
|
|
28504
28652
|
offset += spanOfRoot(root);
|
|
28505
28653
|
}
|
|
@@ -32894,6 +33042,7 @@ __export(geometry_exports, {
|
|
|
32894
33042
|
FLOWCHART_PRESET_DEFINITIONS: () => FLOWCHART_PRESET_DEFINITIONS,
|
|
32895
33043
|
FLOWCHART_TEXT_RECTS: () => FLOWCHART_TEXT_RECTS,
|
|
32896
33044
|
GEAR9_CONNECTION_SITES: () => GEAR9_CONNECTION_SITES,
|
|
33045
|
+
GRAPH_LAYOUT_STYLES: () => GRAPH_LAYOUT_STYLES,
|
|
32897
33046
|
IDENTITY_AFFINE: () => IDENTITY_AFFINE,
|
|
32898
33047
|
LEFT_CIRCULAR_ARROW_CONNECTION_SITES: () => LEFT_CIRCULAR_ARROW_CONNECTION_SITES,
|
|
32899
33048
|
LEFT_RIGHT_CIRCULAR_ARROW_CONNECTION_SITES: () => LEFT_RIGHT_CIRCULAR_ARROW_CONNECTION_SITES,
|
|
@@ -32930,6 +33079,7 @@ __export(geometry_exports, {
|
|
|
32930
33079
|
alignElements: () => alignElements,
|
|
32931
33080
|
angleToRadians: () => angleToRadians,
|
|
32932
33081
|
at: () => at,
|
|
33082
|
+
autoAlignBoxes: () => autoAlignBoxes,
|
|
32933
33083
|
buildCalloutLeaderLineSvgPath: () => buildCalloutLeaderLineSvgPath,
|
|
32934
33084
|
clipPolygons: () => clipPolygons,
|
|
32935
33085
|
combineShapes: () => combineShapes,
|
|
@@ -32979,6 +33129,7 @@ __export(geometry_exports, {
|
|
|
32979
33129
|
isConvex: () => isConvex,
|
|
32980
33130
|
isHorizontalPrimaryAxis: () => isHorizontalPrimaryAxis,
|
|
32981
33131
|
isStShapeType: () => isStShapeType,
|
|
33132
|
+
layoutGraph: () => layoutGraph,
|
|
32982
33133
|
lineIntersection: () => lineIntersection,
|
|
32983
33134
|
lookupPresetConnectionSites: () => lookupPresetConnectionSites,
|
|
32984
33135
|
lookupPresetTextRectOverride: () => lookupPresetTextRectOverride,
|
|
@@ -39221,11 +39372,11 @@ function createRotationDrag(center, startPointer, startRotation, options = {}) {
|
|
|
39221
39372
|
|
|
39222
39373
|
// geometry/rotate-handle-placement.ts
|
|
39223
39374
|
function resolveRotateHandlePlacement(input) {
|
|
39224
|
-
const { preferred, selection, bounds, hitWidth, hitHeight, obstacles } = input;
|
|
39375
|
+
const { preferred, selection, bounds: bounds2, hitWidth, hitHeight, obstacles } = input;
|
|
39225
39376
|
if (![
|
|
39226
39377
|
...Object.values(preferred),
|
|
39227
39378
|
...Object.values(selection),
|
|
39228
|
-
...Object.values(
|
|
39379
|
+
...Object.values(bounds2),
|
|
39229
39380
|
hitWidth,
|
|
39230
39381
|
hitHeight
|
|
39231
39382
|
].every(Number.isFinite) || hitWidth <= 0 || hitHeight <= 0) {
|
|
@@ -39239,7 +39390,7 @@ function resolveRotateHandlePlacement(input) {
|
|
|
39239
39390
|
};
|
|
39240
39391
|
const fits3 = ({ x, y }) => {
|
|
39241
39392
|
const rect3 = { left: x - halfX, right: x + halfX, top: y - halfY, bottom: y + halfY };
|
|
39242
|
-
return rect3.left >=
|
|
39393
|
+
return rect3.left >= bounds2.left + 1 && rect3.right <= bounds2.right - 1 && rect3.top >= bounds2.top + 1 && rect3.bottom <= bounds2.bottom - 1 && // A target over the rotation center has no usable initial bearing.
|
|
39243
39394
|
!(center.x >= rect3.left && center.x <= rect3.right && center.y >= rect3.top && center.y <= rect3.bottom) && !obstacles.some(
|
|
39244
39395
|
(other) => rect3.left < other.right + 2 && rect3.right > other.left - 2 && rect3.top < other.bottom + 2 && rect3.bottom > other.top - 2
|
|
39245
39396
|
);
|
|
@@ -39267,10 +39418,10 @@ function resolveRotateHandlePlacement(input) {
|
|
|
39267
39418
|
{ x: center.x, y: selection.bottom + padY },
|
|
39268
39419
|
{ x: selection.left - padX, y: center.y }
|
|
39269
39420
|
];
|
|
39270
|
-
const left = Math.max(selection.left,
|
|
39271
|
-
const right = Math.min(selection.right,
|
|
39272
|
-
const top = Math.max(selection.top,
|
|
39273
|
-
const bottom = Math.min(selection.bottom,
|
|
39421
|
+
const left = Math.max(selection.left, bounds2.left) + halfX + 3;
|
|
39422
|
+
const right = Math.min(selection.right, bounds2.right) - halfX - 3;
|
|
39423
|
+
const top = Math.max(selection.top, bounds2.top) + halfY + 3;
|
|
39424
|
+
const bottom = Math.min(selection.bottom, bounds2.bottom) - halfY - 3;
|
|
39274
39425
|
if (left <= right && top <= bottom) {
|
|
39275
39426
|
for (const fraction of [0.25, 0.75]) {
|
|
39276
39427
|
const x = left + (right - left) * fraction;
|
|
@@ -39284,6 +39435,357 @@ function resolveRotateHandlePlacement(input) {
|
|
|
39284
39435
|
})[0] ?? null;
|
|
39285
39436
|
}
|
|
39286
39437
|
|
|
39438
|
+
// geometry/graph-layout.ts
|
|
39439
|
+
var GRAPH_LAYOUT_STYLES = [
|
|
39440
|
+
"flowchart-tb",
|
|
39441
|
+
"flowchart-lr",
|
|
39442
|
+
"hierarchy",
|
|
39443
|
+
"compact-tree",
|
|
39444
|
+
"circular"
|
|
39445
|
+
];
|
|
39446
|
+
function components(graph) {
|
|
39447
|
+
const seen = /* @__PURE__ */ new Set();
|
|
39448
|
+
const connected = [];
|
|
39449
|
+
const isolated = [];
|
|
39450
|
+
for (const node of graph.nodes) {
|
|
39451
|
+
if (seen.has(node.id)) continue;
|
|
39452
|
+
const ids = [];
|
|
39453
|
+
const stack = [node.id];
|
|
39454
|
+
seen.add(node.id);
|
|
39455
|
+
while (stack.length) {
|
|
39456
|
+
const id = stack.pop();
|
|
39457
|
+
ids.push(id);
|
|
39458
|
+
for (const next of [...graph.out.get(id), ...graph.into.get(id)])
|
|
39459
|
+
if (!seen.has(next)) {
|
|
39460
|
+
seen.add(next);
|
|
39461
|
+
stack.push(next);
|
|
39462
|
+
}
|
|
39463
|
+
}
|
|
39464
|
+
if (ids.length === 1) isolated.push(node.id);
|
|
39465
|
+
else {
|
|
39466
|
+
const order = new Map(graph.nodes.map((entry3, index) => [entry3.id, index]));
|
|
39467
|
+
connected.push(ids.sort((a2, b) => order.get(a2) - order.get(b)));
|
|
39468
|
+
}
|
|
39469
|
+
}
|
|
39470
|
+
return { connected, isolated };
|
|
39471
|
+
}
|
|
39472
|
+
function roots(ids, graph) {
|
|
39473
|
+
const found = ids.filter((id) => !graph.into.get(id).some((from) => ids.includes(from)));
|
|
39474
|
+
return found.length ? found : [ids[0]];
|
|
39475
|
+
}
|
|
39476
|
+
function forwardEdges(ids, graph) {
|
|
39477
|
+
const state = /* @__PURE__ */ new Map();
|
|
39478
|
+
const forward = new Map(ids.map((id) => [id, []]));
|
|
39479
|
+
const visit = (start) => {
|
|
39480
|
+
const stack = [{ id: start, next: 0 }];
|
|
39481
|
+
state.set(start, 1);
|
|
39482
|
+
while (stack.length) {
|
|
39483
|
+
const top = stack.at(-1);
|
|
39484
|
+
const targets = graph.out.get(top.id);
|
|
39485
|
+
if (top.next >= targets.length) {
|
|
39486
|
+
state.set(top.id, 2);
|
|
39487
|
+
stack.pop();
|
|
39488
|
+
continue;
|
|
39489
|
+
}
|
|
39490
|
+
const target = targets[top.next++];
|
|
39491
|
+
const mark = state.get(target);
|
|
39492
|
+
if (mark === 1) continue;
|
|
39493
|
+
forward.get(top.id).push(target);
|
|
39494
|
+
if (mark === void 0) {
|
|
39495
|
+
state.set(target, 1);
|
|
39496
|
+
stack.push({ id: target, next: 0 });
|
|
39497
|
+
}
|
|
39498
|
+
}
|
|
39499
|
+
};
|
|
39500
|
+
for (const root of roots(ids, graph)) if (!state.has(root)) visit(root);
|
|
39501
|
+
for (const id of ids) if (!state.has(id)) visit(id);
|
|
39502
|
+
return forward;
|
|
39503
|
+
}
|
|
39504
|
+
function layers(ids, forward, shortest) {
|
|
39505
|
+
const rank = /* @__PURE__ */ new Map();
|
|
39506
|
+
const incoming = new Map(ids.map((id) => [id, 0]));
|
|
39507
|
+
for (const targets of forward.values())
|
|
39508
|
+
for (const target of targets) incoming.set(target, incoming.get(target) + 1);
|
|
39509
|
+
const queue = ids.filter((id) => incoming.get(id) === 0);
|
|
39510
|
+
for (const id of queue) rank.set(id, 0);
|
|
39511
|
+
for (let index = 0; index < queue.length; index++) {
|
|
39512
|
+
const id = queue[index];
|
|
39513
|
+
for (const target of forward.get(id)) {
|
|
39514
|
+
const candidate = rank.get(id) + 1;
|
|
39515
|
+
if (shortest) {
|
|
39516
|
+
if (!rank.has(target)) rank.set(target, candidate);
|
|
39517
|
+
} else rank.set(target, Math.max(rank.get(target) ?? 0, candidate));
|
|
39518
|
+
incoming.set(target, incoming.get(target) - 1);
|
|
39519
|
+
if (incoming.get(target) === 0) queue.push(target);
|
|
39520
|
+
}
|
|
39521
|
+
}
|
|
39522
|
+
const result = [];
|
|
39523
|
+
for (const id of ids) {
|
|
39524
|
+
const level2 = rank.get(id) ?? 0;
|
|
39525
|
+
(result[level2] ??= []).push(id);
|
|
39526
|
+
}
|
|
39527
|
+
return result.filter((layer) => layer.length);
|
|
39528
|
+
}
|
|
39529
|
+
function orderLayers(layered, graph) {
|
|
39530
|
+
const result = layered.map((layer) => [...layer]);
|
|
39531
|
+
const position = /* @__PURE__ */ new Map();
|
|
39532
|
+
const index = () => result.forEach((layer) => layer.forEach((id, at2) => position.set(id, at2)));
|
|
39533
|
+
index();
|
|
39534
|
+
for (let sweep = 0; sweep < 4; sweep++) {
|
|
39535
|
+
const down = sweep % 2 === 0;
|
|
39536
|
+
const range = down ? result.map((_, at2) => at2).slice(1) : result.map((_, at2) => at2).slice(0, -1).reverse();
|
|
39537
|
+
for (const at2 of range) {
|
|
39538
|
+
const neighbour = new Set(result[down ? at2 - 1 : at2 + 1]);
|
|
39539
|
+
const weight = (id) => {
|
|
39540
|
+
const linked = [...graph.out.get(id), ...graph.into.get(id)].filter(
|
|
39541
|
+
(other) => neighbour.has(other)
|
|
39542
|
+
);
|
|
39543
|
+
return linked.length ? linked.reduce((sum, other) => sum + position.get(other), 0) / linked.length : position.get(id);
|
|
39544
|
+
};
|
|
39545
|
+
const weights = new Map(result[at2].map((id) => [id, weight(id)]));
|
|
39546
|
+
result[at2].sort(
|
|
39547
|
+
(a2, b) => weights.get(a2) - weights.get(b) || position.get(a2) - position.get(b)
|
|
39548
|
+
);
|
|
39549
|
+
index();
|
|
39550
|
+
}
|
|
39551
|
+
}
|
|
39552
|
+
return result;
|
|
39553
|
+
}
|
|
39554
|
+
function placeLayers(ordered2, size, horizontal, spacing3, layerSpacing) {
|
|
39555
|
+
const placed = [];
|
|
39556
|
+
const along = (node) => horizontal ? node.width : node.height;
|
|
39557
|
+
const across = (node) => horizontal ? node.height : node.width;
|
|
39558
|
+
let cursor = 0;
|
|
39559
|
+
for (const layer of ordered2) {
|
|
39560
|
+
const nodes = layer.map((id) => size.get(id));
|
|
39561
|
+
const depth = Math.max(...nodes.map(along));
|
|
39562
|
+
const span = nodes.reduce((sum, node) => sum + across(node), 0) + spacing3 * (nodes.length - 1);
|
|
39563
|
+
let offset = -span / 2;
|
|
39564
|
+
for (const node of nodes) {
|
|
39565
|
+
const centre = offset + across(node) / 2;
|
|
39566
|
+
const primary = cursor + depth / 2;
|
|
39567
|
+
placed.push({
|
|
39568
|
+
id: node.id,
|
|
39569
|
+
x: horizontal ? primary : centre,
|
|
39570
|
+
y: horizontal ? centre : primary,
|
|
39571
|
+
width: node.width,
|
|
39572
|
+
height: node.height
|
|
39573
|
+
});
|
|
39574
|
+
offset += across(node) + spacing3;
|
|
39575
|
+
}
|
|
39576
|
+
cursor += depth + layerSpacing;
|
|
39577
|
+
}
|
|
39578
|
+
return placed;
|
|
39579
|
+
}
|
|
39580
|
+
function placeCompactTree(ids, forward, graph, size, spacing3, layerSpacing) {
|
|
39581
|
+
const placed = [];
|
|
39582
|
+
const seen = /* @__PURE__ */ new Set();
|
|
39583
|
+
const indent = Math.max(...ids.map((id) => size.get(id).width)) / 2 + layerSpacing / 2;
|
|
39584
|
+
let y = 0;
|
|
39585
|
+
const visit = (start) => {
|
|
39586
|
+
const stack = [{ id: start, depth: 0 }];
|
|
39587
|
+
while (stack.length) {
|
|
39588
|
+
const { id, depth } = stack.pop();
|
|
39589
|
+
if (seen.has(id)) continue;
|
|
39590
|
+
seen.add(id);
|
|
39591
|
+
const node = size.get(id);
|
|
39592
|
+
placed.push({
|
|
39593
|
+
id,
|
|
39594
|
+
x: depth * indent + node.width / 2,
|
|
39595
|
+
y: y + node.height / 2,
|
|
39596
|
+
width: node.width,
|
|
39597
|
+
height: node.height
|
|
39598
|
+
});
|
|
39599
|
+
y += node.height + spacing3;
|
|
39600
|
+
const children2 = forward.get(id).filter((child3) => !seen.has(child3));
|
|
39601
|
+
for (const child3 of children2.reverse()) stack.push({ id: child3, depth: depth + 1 });
|
|
39602
|
+
}
|
|
39603
|
+
};
|
|
39604
|
+
for (const root of roots(ids, graph)) visit(root);
|
|
39605
|
+
for (const id of ids) visit(id);
|
|
39606
|
+
return placed;
|
|
39607
|
+
}
|
|
39608
|
+
function placeCircle(ids, forward, size, spacing3) {
|
|
39609
|
+
const order = [];
|
|
39610
|
+
const seen = /* @__PURE__ */ new Set();
|
|
39611
|
+
for (const start of ids) {
|
|
39612
|
+
const stack = [start];
|
|
39613
|
+
while (stack.length) {
|
|
39614
|
+
const id = stack.pop();
|
|
39615
|
+
if (seen.has(id)) continue;
|
|
39616
|
+
seen.add(id);
|
|
39617
|
+
order.push(id);
|
|
39618
|
+
stack.push(...[...forward.get(id)].reverse());
|
|
39619
|
+
}
|
|
39620
|
+
}
|
|
39621
|
+
const extent = (id) => Math.hypot(size.get(id).width, size.get(id).height);
|
|
39622
|
+
const circumference = order.reduce((sum, id) => sum + extent(id) + spacing3, 0);
|
|
39623
|
+
const radius = Math.max(circumference / (2 * Math.PI), Math.max(...order.map(extent)));
|
|
39624
|
+
return order.map((id, index) => {
|
|
39625
|
+
const angle = -Math.PI / 2 + 2 * Math.PI * index / order.length;
|
|
39626
|
+
const node = size.get(id);
|
|
39627
|
+
return {
|
|
39628
|
+
id,
|
|
39629
|
+
x: radius * Math.cos(angle),
|
|
39630
|
+
y: radius * Math.sin(angle),
|
|
39631
|
+
width: node.width,
|
|
39632
|
+
height: node.height
|
|
39633
|
+
};
|
|
39634
|
+
});
|
|
39635
|
+
}
|
|
39636
|
+
function bounds(placed) {
|
|
39637
|
+
const left = Math.min(...placed.map((box) => box.x - box.width / 2));
|
|
39638
|
+
const top = Math.min(...placed.map((box) => box.y - box.height / 2));
|
|
39639
|
+
const right = Math.max(...placed.map((box) => box.x + box.width / 2));
|
|
39640
|
+
const bottom = Math.max(...placed.map((box) => box.y + box.height / 2));
|
|
39641
|
+
return { left, top, width: right - left, height: bottom - top };
|
|
39642
|
+
}
|
|
39643
|
+
function placeGrid(ids, size, spacing3) {
|
|
39644
|
+
const columns = Math.ceil(Math.sqrt(ids.length));
|
|
39645
|
+
const cellWidth = Math.max(...ids.map((id) => size.get(id).width));
|
|
39646
|
+
const cellHeight = Math.max(...ids.map((id) => size.get(id).height));
|
|
39647
|
+
return ids.map((id, index) => ({
|
|
39648
|
+
id,
|
|
39649
|
+
x: index % columns * (cellWidth + spacing3) + cellWidth / 2,
|
|
39650
|
+
y: Math.floor(index / columns) * (cellHeight + spacing3) + cellHeight / 2,
|
|
39651
|
+
width: size.get(id).width,
|
|
39652
|
+
height: size.get(id).height
|
|
39653
|
+
}));
|
|
39654
|
+
}
|
|
39655
|
+
function layoutGraph(nodes, edges, style, options = {}) {
|
|
39656
|
+
if (!GRAPH_LAYOUT_STYLES.includes(style)) throw new Error("Unknown graph layout style.");
|
|
39657
|
+
const spacing3 = options.spacing ?? 0.5;
|
|
39658
|
+
const layerSpacing = options.layerSpacing ?? spacing3;
|
|
39659
|
+
if (![spacing3, layerSpacing].every((value) => Number.isFinite(value) && value >= 0))
|
|
39660
|
+
throw new Error("Layout spacing must be finite and not negative.");
|
|
39661
|
+
const size = /* @__PURE__ */ new Map();
|
|
39662
|
+
for (const node of nodes) {
|
|
39663
|
+
if (size.has(node.id)) throw new Error("Layout node IDs must be unique.");
|
|
39664
|
+
if (![node.width, node.height].every((value) => Number.isFinite(value) && value >= 0))
|
|
39665
|
+
throw new Error("Layout node sizes must be finite and not negative.");
|
|
39666
|
+
size.set(node.id, node);
|
|
39667
|
+
}
|
|
39668
|
+
const graph = {
|
|
39669
|
+
nodes,
|
|
39670
|
+
out: new Map(nodes.map((node) => [node.id, []])),
|
|
39671
|
+
into: new Map(nodes.map((node) => [node.id, []]))
|
|
39672
|
+
};
|
|
39673
|
+
for (const edge of edges) {
|
|
39674
|
+
if (!size.has(edge.from) || !size.has(edge.to) || edge.from === edge.to) continue;
|
|
39675
|
+
if (graph.out.get(edge.from).includes(edge.to)) continue;
|
|
39676
|
+
graph.out.get(edge.from).push(edge.to);
|
|
39677
|
+
graph.into.get(edge.to).push(edge.from);
|
|
39678
|
+
}
|
|
39679
|
+
const { connected, isolated } = components(graph);
|
|
39680
|
+
const horizontal = style === "flowchart-lr";
|
|
39681
|
+
const blocks = connected.map((ids) => {
|
|
39682
|
+
const forward = forwardEdges(ids, graph);
|
|
39683
|
+
if (style === "circular") return placeCircle(ids, forward, size, spacing3);
|
|
39684
|
+
if (style === "compact-tree")
|
|
39685
|
+
return placeCompactTree(ids, forward, graph, size, spacing3, layerSpacing);
|
|
39686
|
+
const ordered2 = orderLayers(layers(ids, forward, style === "hierarchy"), graph);
|
|
39687
|
+
return placeLayers(ordered2, size, horizontal, spacing3, layerSpacing);
|
|
39688
|
+
});
|
|
39689
|
+
const result = /* @__PURE__ */ new Map();
|
|
39690
|
+
let cursor = 0;
|
|
39691
|
+
let extent = 0;
|
|
39692
|
+
for (const block of blocks) {
|
|
39693
|
+
const box = bounds(block);
|
|
39694
|
+
for (const item of block)
|
|
39695
|
+
result.set(item.id, {
|
|
39696
|
+
x: item.x - box.left + (horizontal ? 0 : cursor),
|
|
39697
|
+
y: item.y - box.top + (horizontal ? cursor : 0)
|
|
39698
|
+
});
|
|
39699
|
+
cursor += (horizontal ? box.height : box.width) + spacing3 * 2;
|
|
39700
|
+
extent = Math.max(extent, horizontal ? box.width : box.height);
|
|
39701
|
+
}
|
|
39702
|
+
if (isolated.length) {
|
|
39703
|
+
const grid = placeGrid(isolated, size, spacing3);
|
|
39704
|
+
const offset = blocks.length ? extent + layerSpacing * 2 : 0;
|
|
39705
|
+
for (const item of grid)
|
|
39706
|
+
result.set(item.id, {
|
|
39707
|
+
x: item.x + (horizontal ? offset : 0),
|
|
39708
|
+
y: item.y + (horizontal ? 0 : offset)
|
|
39709
|
+
});
|
|
39710
|
+
}
|
|
39711
|
+
return result;
|
|
39712
|
+
}
|
|
39713
|
+
|
|
39714
|
+
// geometry/auto-align.ts
|
|
39715
|
+
var median = (values) => {
|
|
39716
|
+
const sorted = [...values].sort((a2, b) => a2 - b);
|
|
39717
|
+
const middle = Math.floor(sorted.length / 2);
|
|
39718
|
+
return sorted.length % 2 ? sorted[middle] : (sorted[middle - 1] + sorted[middle]) / 2;
|
|
39719
|
+
};
|
|
39720
|
+
function clusters(boxes, centre, tolerance) {
|
|
39721
|
+
const sorted = [...boxes].sort((a2, b) => centre(a2) - centre(b));
|
|
39722
|
+
const result = [];
|
|
39723
|
+
let mean = 0;
|
|
39724
|
+
for (const box of sorted) {
|
|
39725
|
+
const current = result.at(-1);
|
|
39726
|
+
if (current && Math.abs(centre(box) - mean) <= tolerance) {
|
|
39727
|
+
current.push(box);
|
|
39728
|
+
mean += (centre(box) - mean) / current.length;
|
|
39729
|
+
} else {
|
|
39730
|
+
result.push([box]);
|
|
39731
|
+
mean = centre(box);
|
|
39732
|
+
}
|
|
39733
|
+
}
|
|
39734
|
+
return result;
|
|
39735
|
+
}
|
|
39736
|
+
function space2(groups, start, size, minimumGap) {
|
|
39737
|
+
const extents = groups.map((group) => {
|
|
39738
|
+
const centre = group.reduce((sum, box) => sum + start(box) + size(box) / 2, 0) / group.length;
|
|
39739
|
+
const half = Math.max(...group.map((box) => size(box) / 2));
|
|
39740
|
+
return { centre, half };
|
|
39741
|
+
});
|
|
39742
|
+
const gaps = extents.slice(1).map(
|
|
39743
|
+
(extent, index) => extent.centre - extent.half - extents[index].centre - extents[index].half
|
|
39744
|
+
);
|
|
39745
|
+
const gap = Math.max(
|
|
39746
|
+
minimumGap,
|
|
39747
|
+
gaps.length ? gaps.reduce((sum, value) => sum + value, 0) / gaps.length : 0
|
|
39748
|
+
);
|
|
39749
|
+
const result = /* @__PURE__ */ new Map();
|
|
39750
|
+
let cursor = extents[0] ? extents[0].centre - extents[0].half : 0;
|
|
39751
|
+
groups.forEach((group, index) => {
|
|
39752
|
+
const { half } = extents[index];
|
|
39753
|
+
for (const box of group) result.set(box.id, cursor + half);
|
|
39754
|
+
cursor += half * 2 + gap;
|
|
39755
|
+
});
|
|
39756
|
+
return result;
|
|
39757
|
+
}
|
|
39758
|
+
function autoAlignBoxes(boxes, options = {}) {
|
|
39759
|
+
if (new Set(boxes.map((box) => box.id)).size !== boxes.length)
|
|
39760
|
+
throw new Error("Auto align box IDs must be unique.");
|
|
39761
|
+
if (!boxes.every(
|
|
39762
|
+
(box) => [box.x, box.y, box.width, box.height].every((value) => Number.isFinite(value))
|
|
39763
|
+
))
|
|
39764
|
+
throw new Error("Auto align boxes must be finite.");
|
|
39765
|
+
const result = /* @__PURE__ */ new Map();
|
|
39766
|
+
if (!boxes.length) return result;
|
|
39767
|
+
const toleranceX = options.tolerance?.x ?? median(boxes.map((box) => box.width)) / 2;
|
|
39768
|
+
const toleranceY = options.tolerance?.y ?? median(boxes.map((box) => box.height)) / 2;
|
|
39769
|
+
const minimumGap = options.minimumGap ?? 0;
|
|
39770
|
+
const rows = clusters(boxes, (box) => box.y + box.height / 2, toleranceY);
|
|
39771
|
+
const columns = clusters(boxes, (box) => box.x + box.width / 2, toleranceX);
|
|
39772
|
+
const ys = space2(
|
|
39773
|
+
rows,
|
|
39774
|
+
(box) => box.y,
|
|
39775
|
+
(box) => box.height,
|
|
39776
|
+
minimumGap
|
|
39777
|
+
);
|
|
39778
|
+
const xs = space2(
|
|
39779
|
+
columns,
|
|
39780
|
+
(box) => box.x,
|
|
39781
|
+
(box) => box.width,
|
|
39782
|
+
minimumGap
|
|
39783
|
+
);
|
|
39784
|
+
for (const box of boxes)
|
|
39785
|
+
result.set(box.id, { x: xs.get(box.id) - box.width / 2, y: ys.get(box.id) - box.height / 2 });
|
|
39786
|
+
return result;
|
|
39787
|
+
}
|
|
39788
|
+
|
|
39287
39789
|
// units/index.ts
|
|
39288
39790
|
var units_exports = {};
|
|
39289
39791
|
__export(units_exports, {
|
|
@@ -40628,9 +41130,9 @@ function convertOmmlToLatex(omml) {
|
|
|
40628
41130
|
return "";
|
|
40629
41131
|
}
|
|
40630
41132
|
const para = omml["m:oMathPara"];
|
|
40631
|
-
const
|
|
40632
|
-
if (
|
|
40633
|
-
return
|
|
41133
|
+
const roots2 = para ? ensureArr(para).flatMap((p) => ensureArr(p["m:oMath"])) : [];
|
|
41134
|
+
if (roots2.length > 0) {
|
|
41135
|
+
return roots2.map((root) => childrenToLatex(root)).join(" ");
|
|
40634
41136
|
}
|
|
40635
41137
|
if (omml["m:oMath"]) {
|
|
40636
41138
|
return ensureArr(omml["m:oMath"]).map((root) => childrenToLatex(root)).join(" ");
|