ooxml-core 1.50.2 → 1.51.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/{PptxHandler-PVQW47CY.mjs → PptxHandler-6GRVJRHP.mjs} +2 -2
- package/dist/PptxHandler-E6QYPF7X.mjs +8 -0
- package/dist/PptxHandler-UNQVCIGM.cjs +17 -0
- package/dist/PresentationBuilder-DVDJSV5R.mjs +8 -0
- package/dist/PresentationBuilder-F5UWRF6H.cjs +25 -0
- package/dist/{PresentationBuilder-ZOOVSBPR.mjs → PresentationBuilder-T6YKWPF7.mjs} +2 -2
- package/dist/automation/index.cjs +5806 -4494
- package/dist/automation/index.mjs +5806 -4494
- package/dist/chunk-25IJEN7R.cjs +36 -0
- package/dist/chunk-25JN3ZQM.mjs +58 -0
- package/dist/{chunk-7XYVFUB3.cjs → chunk-2IO523MM.cjs} +1 -0
- package/dist/{chunk-53KMIHYN.mjs → chunk-4LUZHBTT.mjs} +83 -31
- package/dist/chunk-554UZLPS.mjs +237 -0
- package/dist/{chunk-VLKUMQGT.mjs → chunk-63RAF3TS.mjs} +1 -1
- package/dist/{chunk-7UM5IFPR.mjs → chunk-6IUYKP77.mjs} +1 -1
- package/dist/{chunk-VK2G4BGX.mjs → chunk-BIMV5FVL.mjs} +481 -193
- package/dist/{chunk-CODMW5KF.cjs → chunk-CVUMILG3.cjs} +1 -0
- package/dist/{chunk-NBMXEVHL.mjs → chunk-FX6WL42B.mjs} +1 -0
- package/dist/chunk-GI4Y6BBX.mjs +21 -0
- package/dist/{chunk-MX2GFMZS.mjs → chunk-GZL4ERW3.mjs} +1 -1
- package/dist/chunk-HWL2AGLD.cjs +98 -0
- package/dist/chunk-HZAB3YDO.cjs +234 -0
- package/dist/chunk-IDATIFCG.mjs +226 -0
- package/dist/chunk-LO55N7VL.cjs +247 -0
- package/dist/{chunk-FFLU4LUQ.cjs → chunk-LUBPW5NP.cjs} +1629 -1609
- package/dist/chunk-MUNEIE2J.cjs +62 -0
- package/dist/{chunk-ZCKEKP7N.mjs → chunk-RYUADJV6.mjs} +4 -4
- package/dist/chunk-TOBK5FC4.mjs +88 -0
- package/dist/chunk-UV4LMGVZ.mjs +31 -0
- package/dist/{chunk-O3YGBYGZ.mjs → chunk-VRVHM6TJ.mjs} +1 -0
- package/dist/chunk-W7LVJC32.cjs +25 -0
- package/dist/chunk-WAZ7T2BL.cjs +169 -0
- package/dist/{chunk-3OKY56UM.mjs → chunk-YX33WEKS.mjs} +411 -391
- package/dist/docx/auto-number-fields.d.ts +22 -0
- package/dist/docx/auto-number-fields.d.ts.map +1 -0
- package/dist/docx/block-parser.d.ts.map +1 -1
- package/dist/docx/character-styles.d.ts.map +1 -1
- package/dist/docx/clipboard/css.d.ts +21 -0
- package/dist/docx/clipboard/css.d.ts.map +1 -0
- package/dist/docx/clipboard/html-tokens.d.ts +38 -0
- package/dist/docx/clipboard/html-tokens.d.ts.map +1 -0
- package/dist/docx/clipboard/index.d.ts +6 -0
- package/dist/docx/clipboard/index.d.ts.map +1 -0
- package/dist/docx/clipboard/word-fields.d.ts +13 -0
- package/dist/docx/clipboard/word-fields.d.ts.map +1 -0
- package/dist/docx/clipboard/word-fragment.d.ts +14 -0
- package/dist/docx/clipboard/word-fragment.d.ts.map +1 -0
- package/dist/docx/clipboard/word-html.d.ts +22 -0
- package/dist/docx/clipboard/word-html.d.ts.map +1 -0
- package/dist/docx/clipboard/word-list-scan.d.ts +25 -0
- package/dist/docx/clipboard/word-list-scan.d.ts.map +1 -0
- package/dist/docx/clipboard/word-lists.d.ts +13 -0
- package/dist/docx/clipboard/word-lists.d.ts.map +1 -0
- package/dist/docx/clipboard/word-runs.d.ts +18 -0
- package/dist/docx/clipboard/word-runs.d.ts.map +1 -0
- package/dist/docx/clipboard/word-styles.d.ts +35 -0
- package/dist/docx/clipboard/word-styles.d.ts.map +1 -0
- package/dist/docx/compare/build.d.ts +48 -0
- package/dist/docx/compare/build.d.ts.map +1 -0
- package/dist/docx/compare/compare.d.ts +18 -0
- package/dist/docx/compare/compare.d.ts.map +1 -0
- package/dist/docx/compare/context.d.ts +42 -0
- package/dist/docx/compare/context.d.ts.map +1 -0
- package/dist/docx/compare/diff.d.ts +20 -0
- package/dist/docx/compare/diff.d.ts.map +1 -0
- package/dist/docx/compare/index.d.ts +4 -0
- package/dist/docx/compare/index.d.ts.map +1 -0
- package/dist/docx/compare/slide.d.ts +9 -0
- package/dist/docx/compare/slide.d.ts.map +1 -0
- package/dist/docx/compare/spans.d.ts +13 -0
- package/dist/docx/compare/spans.d.ts.map +1 -0
- package/dist/docx/compare/story.d.ts +7 -0
- package/dist/docx/compare/story.d.ts.map +1 -0
- package/dist/docx/compare/table.d.ts +23 -0
- package/dist/docx/compare/table.d.ts.map +1 -0
- package/dist/docx/compare/tokens.d.ts +50 -0
- package/dist/docx/compare/tokens.d.ts.map +1 -0
- package/dist/docx/compare/types.d.ts +51 -0
- package/dist/docx/compare/types.d.ts.map +1 -0
- package/dist/docx/compatibility.d.ts +46 -0
- package/dist/docx/compatibility.d.ts.map +1 -0
- package/dist/docx/computed-fields.d.ts +39 -0
- package/dist/docx/computed-fields.d.ts.map +1 -0
- package/dist/docx/doc-property-field.d.ts +17 -0
- package/dist/docx/doc-property-field.d.ts.map +1 -0
- package/dist/docx/document-parts.d.ts +2 -0
- package/dist/docx/document-parts.d.ts.map +1 -1
- package/dist/docx/drawing-wrap.d.ts +21 -0
- package/dist/docx/drawing-wrap.d.ts.map +1 -0
- package/dist/docx/drawing.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +3965 -2313
- package/dist/docx/embedded.mjs +3965 -2313
- package/dist/docx/field-format.d.ts +45 -0
- package/dist/docx/field-format.d.ts.map +1 -0
- package/dist/docx/field-result-spans.d.ts +62 -0
- package/dist/docx/field-result-spans.d.ts.map +1 -0
- package/dist/docx/field-runs.d.ts.map +1 -1
- package/dist/docx/field-stories.d.ts +9 -0
- package/dist/docx/field-stories.d.ts.map +1 -0
- package/dist/docx/find-stories.d.ts +27 -0
- package/dist/docx/find-stories.d.ts.map +1 -0
- package/dist/docx/highlight.d.ts +19 -0
- package/dist/docx/highlight.d.ts.map +1 -1
- package/dist/docx/hyperlink.d.ts +7 -0
- package/dist/docx/hyperlink.d.ts.map +1 -1
- package/dist/docx/index.cjs +7359 -3476
- package/dist/docx/index.d.ts +13 -1
- package/dist/docx/index.d.ts.map +1 -1
- package/dist/docx/index.mjs +7327 -3476
- package/dist/docx/inline-model.d.ts +21 -0
- package/dist/docx/inline-model.d.ts.map +1 -1
- package/dist/docx/inline-slots.d.ts.map +1 -1
- package/dist/docx/inspect-document.d.ts +21 -0
- package/dist/docx/inspect-document.d.ts.map +1 -0
- package/dist/docx/kinsoku-settings.d.ts +9 -0
- package/dist/docx/kinsoku-settings.d.ts.map +1 -0
- package/dist/docx/layout/adapt-table-floating.d.ts +11 -0
- package/dist/docx/layout/adapt-table-floating.d.ts.map +1 -0
- package/dist/docx/layout/adapt-table.d.ts.map +1 -1
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/computed-field-runs.d.ts +8 -0
- package/dist/docx/layout/computed-field-runs.d.ts.map +1 -0
- package/dist/docx/layout/floats.d.ts +3 -1
- package/dist/docx/layout/floats.d.ts.map +1 -1
- package/dist/docx/layout/flow-floating-table.d.ts +13 -0
- package/dist/docx/layout/flow-floating-table.d.ts.map +1 -0
- package/dist/docx/layout/flow-table.d.ts +1 -1
- package/dist/docx/layout/flow-table.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +2280 -941
- package/dist/docx/layout/index.mjs +2276 -942
- package/dist/docx/layout/input.d.ts +50 -0
- package/dist/docx/layout/input.d.ts.map +1 -1
- package/dist/docx/layout/layout.d.ts.map +1 -1
- package/dist/docx/layout/page-cursor.d.ts.map +1 -1
- package/dist/docx/layout/page-flow.d.ts.map +1 -1
- package/dist/docx/layout/paragraph-layout.d.ts.map +1 -1
- package/dist/docx/layout/paragraph-tokens.d.ts +6 -0
- package/dist/docx/layout/paragraph-tokens.d.ts.map +1 -1
- package/dist/docx/layout/result.d.ts +12 -0
- package/dist/docx/layout/result.d.ts.map +1 -1
- package/dist/docx/layout/section-flow.d.ts.map +1 -1
- package/dist/docx/layout/table-autofit-distribute.d.ts +18 -0
- package/dist/docx/layout/table-autofit-distribute.d.ts.map +1 -0
- package/dist/docx/layout/table-autofit-measure.d.ts +15 -0
- package/dist/docx/layout/table-autofit-measure.d.ts.map +1 -0
- package/dist/docx/layout/table-autofit.d.ts +10 -0
- package/dist/docx/layout/table-autofit.d.ts.map +1 -0
- package/dist/docx/layout/table-cell-layout.d.ts.map +1 -1
- package/dist/docx/layout/text-breaks.d.ts +38 -13
- package/dist/docx/layout/text-breaks.d.ts.map +1 -1
- package/dist/docx/layout/wrap.d.ts +1 -1
- package/dist/docx/layout/wrap.d.ts.map +1 -1
- package/dist/docx/list-number-fields.d.ts +25 -0
- package/dist/docx/list-number-fields.d.ts.map +1 -0
- package/dist/docx/load/index.cjs +4355 -2703
- package/dist/docx/load/index.mjs +4355 -2703
- package/dist/docx/model-paragraph.d.ts +12 -1
- package/dist/docx/model-paragraph.d.ts.map +1 -1
- package/dist/docx/model.d.ts +26 -1
- package/dist/docx/model.d.ts.map +1 -1
- package/dist/docx/note-convert.d.ts +45 -0
- package/dist/docx/note-convert.d.ts.map +1 -0
- package/dist/docx/numbering-counters.d.ts +17 -0
- package/dist/docx/numbering-counters.d.ts.map +1 -0
- package/dist/docx/numbering-format.d.ts +11 -2
- package/dist/docx/numbering-format.d.ts.map +1 -1
- package/dist/docx/outline-numbering.d.ts +6 -0
- package/dist/docx/outline-numbering.d.ts.map +1 -0
- package/dist/docx/package-information-save.d.ts +9 -0
- package/dist/docx/package-information-save.d.ts.map +1 -0
- package/dist/docx/package-information.d.ts +43 -0
- package/dist/docx/package-information.d.ts.map +1 -0
- package/dist/docx/package-properties.d.ts +5 -0
- package/dist/docx/package-properties.d.ts.map +1 -0
- package/dist/docx/paragraph-styles.d.ts +2 -0
- package/dist/docx/paragraph-styles.d.ts.map +1 -1
- package/dist/docx/parse-revisions.d.ts +2 -0
- package/dist/docx/parse-revisions.d.ts.map +1 -1
- package/dist/docx/parse-table-floating.d.ts +5 -0
- package/dist/docx/parse-table-floating.d.ts.map +1 -0
- package/dist/docx/parse-table.d.ts.map +1 -1
- package/dist/docx/parse.d.ts.map +1 -1
- package/dist/docx/part-relationships.d.ts.map +1 -1
- package/dist/docx/personal-information.d.ts +18 -0
- package/dist/docx/personal-information.d.ts.map +1 -0
- package/dist/docx/picture-crop-edit.d.ts +18 -0
- package/dist/docx/picture-crop-edit.d.ts.map +1 -0
- package/dist/docx/picture-watermark.d.ts +29 -0
- package/dist/docx/picture-watermark.d.ts.map +1 -0
- package/dist/docx/relationship-allocator.d.ts.map +1 -1
- package/dist/docx/remove-document-information.d.ts +8 -0
- package/dist/docx/remove-document-information.d.ts.map +1 -0
- package/dist/docx/revision-commands.d.ts +6 -1
- package/dist/docx/revision-commands.d.ts.map +1 -1
- package/dist/docx/revision-ids.d.ts.map +1 -1
- package/dist/docx/run-language.d.ts +9 -0
- package/dist/docx/run-language.d.ts.map +1 -0
- package/dist/docx/run-properties-snapshot.d.ts +9 -0
- package/dist/docx/run-properties-snapshot.d.ts.map +1 -0
- package/dist/docx/run-style-model.d.ts +4 -0
- package/dist/docx/run-style-model.d.ts.map +1 -1
- package/dist/docx/save-modified.d.ts +2 -1
- package/dist/docx/save-modified.d.ts.map +1 -1
- package/dist/docx/save.d.ts.map +1 -1
- package/dist/docx/style-ref-fields.d.ts +1 -8
- package/dist/docx/style-ref-fields.d.ts.map +1 -1
- package/dist/docx/symbol-field.d.ts +21 -0
- package/dist/docx/symbol-field.d.ts.map +1 -0
- package/dist/docx/table-cell-write.d.ts.map +1 -1
- package/dist/docx/table-defaults.d.ts +2 -0
- package/dist/docx/table-defaults.d.ts.map +1 -1
- package/dist/docx/table-margins.d.ts +18 -0
- package/dist/docx/table-margins.d.ts.map +1 -0
- package/dist/docx/table-model.d.ts +23 -0
- package/dist/docx/table-model.d.ts.map +1 -1
- package/dist/docx/table-structure-check.d.ts.map +1 -1
- package/dist/docx/table-styles.d.ts.map +1 -1
- package/dist/docx/ui/index.cjs +787 -435
- 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 +784 -436
- package/dist/docx/ui/inline-content-schema.d.ts.map +1 -1
- package/dist/docx/ui/paragraph-attributes.d.ts +6 -0
- package/dist/docx/ui/paragraph-attributes.d.ts.map +1 -1
- package/dist/docx/ui/ribbon-action-ids.d.ts +1 -1
- package/dist/docx/ui/ribbon-action-ids.d.ts.map +1 -1
- package/dist/docx/ui/ribbon-legacy-labels.d.ts +1 -1
- package/dist/docx/ui/ribbon-legacy-labels.d.ts.map +1 -1
- package/dist/docx/ui/run-adapter.d.ts.map +1 -1
- package/dist/docx/ui/schema-marks.d.ts +2 -19
- package/dist/docx/ui/schema-marks.d.ts.map +1 -1
- package/dist/docx/ui/track-run-formatting.d.ts.map +1 -1
- package/dist/docx/ui/yjs-document-attributes.d.ts +5 -0
- package/dist/docx/ui/yjs-document-attributes.d.ts.map +1 -1
- package/dist/docx/write-drawing-wrap.d.ts +22 -0
- package/dist/docx/write-drawing-wrap.d.ts.map +1 -0
- package/dist/docx/write-drawing.d.ts.map +1 -1
- package/dist/docx/write-revisions.d.ts +3 -1
- package/dist/docx/write-revisions.d.ts.map +1 -1
- package/dist/docx/write-shape.d.ts.map +1 -1
- package/dist/docx/write-table-properties.d.ts.map +1 -1
- package/dist/docx/write.d.ts.map +1 -1
- package/dist/drawingml/html-text-paste.d.ts +28 -0
- package/dist/drawingml/html-text-paste.d.ts.map +1 -0
- package/dist/drawingml/html-text-style.d.ts +18 -0
- package/dist/drawingml/html-text-style.d.ts.map +1 -0
- package/dist/drawingml/index.cjs +762 -0
- package/dist/drawingml/index.d.ts +1 -0
- package/dist/drawingml/index.d.ts.map +1 -1
- package/dist/drawingml/index.mjs +760 -1
- package/dist/index.cjs +1237 -285
- package/dist/index.mjs +1237 -285
- package/dist/pptx/automation/index.cjs +561 -180
- package/dist/pptx/automation/index.d.ts +4 -4
- package/dist/pptx/automation/index.mjs +6 -5
- package/dist/pptx/chunks/{index-BCy58n13.d.ts → index-8ZfPndYR.d.ts} +2 -2
- package/dist/pptx/chunks/{index-BCy58n13.d.ts.map → index-8ZfPndYR.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-OwiX5IVw.d.ts → index-DVhD9Kd5.d.ts} +4 -4
- package/dist/pptx/chunks/{index-OwiX5IVw.d.ts.map → index-DVhD9Kd5.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-oQHWAO7M.d.ts → index-DsUnUj-V.d.ts} +5 -5
- package/dist/pptx/chunks/{index-oQHWAO7M.d.ts.map → index-DsUnUj-V.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-AZN38e6S.d.ts → index-xB7MDLI7.d.ts} +4 -4
- package/dist/pptx/chunks/{index-AZN38e6S.d.ts.map → index-xB7MDLI7.d.ts.map} +1 -1
- package/dist/pptx/chunks/{presentation-DOaYIW-l.d.ts → presentation-BvnVkFPJ.d.ts} +26 -2
- package/dist/pptx/chunks/{presentation-DOaYIW-l.d.ts.map → presentation-BvnVkFPJ.d.ts.map} +1 -1
- package/dist/pptx/chunks/{text-operations-CYSXno9L.d.ts → text-operations-D7TCPhlv.d.ts} +2 -2
- package/dist/pptx/chunks/{text-operations-CYSXno9L.d.ts.map → text-operations-D7TCPhlv.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +504 -124
- 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/editor/render/custom-show-operations.cjs +2 -2
- package/dist/pptx/editor/render/custom-show-operations.mjs +1 -1
- package/dist/pptx/editor/render/find-replace.cjs +16 -15
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +3 -2
- package/dist/pptx/editor/render/font-family-update.d.ts +2 -2
- package/dist/pptx/editor/render/paragraph-geometry-overrides.d.ts +2 -2
- package/dist/pptx/editor/render/segments-text-edit.cjs +159 -0
- package/dist/pptx/editor/render/segments-text-edit.d.ts +26 -0
- package/dist/pptx/editor/render/segments-text-edit.d.ts.map +1 -0
- package/dist/pptx/editor/render/segments-text-edit.mjs +156 -0
- package/dist/pptx/editor/render/slide-operations.cjs +12 -9
- package/dist/pptx/editor/render/slide-operations.mjs +6 -3
- package/dist/pptx/editor/render/table-cell-edit.cjs +5 -5
- 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-cell-rich-text.cjs +41 -0
- package/dist/pptx/editor/render/table-cell-rich-text.d.ts +50 -0
- package/dist/pptx/editor/render/table-cell-rich-text.d.ts.map +1 -0
- package/dist/pptx/editor/render/table-cell-rich-text.mjs +8 -0
- package/dist/pptx/editor/render/table-cell-source.cjs +23 -0
- package/dist/pptx/editor/render/table-cell-source.d.ts +31 -0
- package/dist/pptx/editor/render/table-cell-source.d.ts.map +1 -0
- package/dist/pptx/editor/render/table-cell-source.mjs +6 -0
- package/dist/pptx/editor/render/table-cells-text-style.cjs +116 -0
- package/dist/pptx/editor/render/table-cells-text-style.d.ts +37 -0
- package/dist/pptx/editor/render/table-cells-text-style.d.ts.map +1 -0
- package/dist/pptx/editor/render/table-cells-text-style.mjs +113 -0
- package/dist/pptx/editor/render/table-data-grid-ops.cjs +40 -94
- package/dist/pptx/editor/render/table-data-grid-ops.mjs +3 -88
- package/dist/pptx/editor/render/table-grid-fill.cjs +30 -0
- package/dist/pptx/editor/render/table-grid-fill.d.ts +34 -0
- package/dist/pptx/editor/render/table-grid-fill.d.ts.map +1 -0
- package/dist/pptx/editor/render/table-grid-fill.mjs +28 -0
- package/dist/pptx/editor/render/table-layout.cjs +6 -6
- package/dist/pptx/editor/render/table-layout.d.ts +2 -2
- 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/editor/render/text-content-style.d.ts +2 -2
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +2 -2
- package/dist/pptx/editor/render/text-style-scope.d.ts +2 -2
- package/dist/pptx/editor/render/update-text-segment-style.d.ts +2 -2
- package/dist/pptx/index.cjs +519 -201
- package/dist/pptx/index.d.ts +7 -7
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.d.ts +1 -1
- package/dist/pptx/smartart-layouts/index.d.ts +2 -2
- package/dist/teams/index.cjs +35 -25
- package/dist/teams/index.mjs +35 -25
- package/dist/text/complex-breaks.d.ts +24 -0
- package/dist/text/complex-breaks.d.ts.map +1 -0
- package/dist/text/east-asian.d.ts +32 -0
- package/dist/text/east-asian.d.ts.map +1 -0
- package/dist/text/html-tokens.d.ts +45 -0
- package/dist/text/html-tokens.d.ts.map +1 -0
- package/dist/text/index.cjs +567 -96
- package/dist/text/index.d.ts +6 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.mjs +544 -97
- package/dist/text/kinsoku.d.ts +55 -0
- package/dist/text/kinsoku.d.ts.map +1 -0
- package/dist/text/truetype/embedding.d.ts +42 -0
- package/dist/text/truetype/embedding.d.ts.map +1 -0
- package/dist/text/truetype/glyphless.d.ts +5 -0
- package/dist/text/truetype/glyphless.d.ts.map +1 -0
- package/dist/text/truetype/sfnt-write.d.ts +10 -0
- package/dist/text/truetype/sfnt-write.d.ts.map +1 -0
- package/dist/text/truetype/subset.d.ts.map +1 -1
- package/dist/text/windows-1252.d.ts +10 -0
- package/dist/text/windows-1252.d.ts.map +1 -0
- package/dist/xlsx/collab/index.cjs +10 -6
- package/dist/xlsx/collab/index.mjs +10 -6
- package/dist/xlsx/edit/clipboard-html-parse.d.ts +1 -0
- package/dist/xlsx/edit/clipboard-html-parse.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/text-convert.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +96 -51
- package/dist/xlsx/index.mjs +96 -51
- package/dist/xlsx/load/index.cjs +10 -6
- package/dist/xlsx/load/index.mjs +10 -6
- package/dist/xlsx/ui/index.cjs +97 -52
- package/dist/xlsx/ui/index.mjs +97 -52
- package/package.json +1 -1
- package/dist/PptxHandler-72NTA5ZY.cjs +0 -14
- package/dist/PptxHandler-O4IJ3TKZ.mjs +0 -5
- package/dist/PresentationBuilder-ORM22QGC.mjs +0 -5
- package/dist/PresentationBuilder-T2ETYT3L.cjs +0 -22
- package/dist/chunk-X4RL5AZ7.cjs +0 -120
- package/dist/{chunk-PRGXRAAU.mjs → chunk-4Y76EAKK.mjs} +131 -131
- package/dist/{chunk-EN3KSEW5.cjs → chunk-MMULWQOM.cjs} +131 -131
package/dist/docx/ui/index.cjs
CHANGED
|
@@ -203,13 +203,13 @@ function updatedInlineRunAttributes(node, format) {
|
|
|
203
203
|
if (Object.hasOwn(desired, key)) metadata[key] = desired[key];
|
|
204
204
|
else delete metadata[key];
|
|
205
205
|
}
|
|
206
|
-
const
|
|
206
|
+
const attrs4 = {
|
|
207
207
|
...node.attrs,
|
|
208
208
|
format: Object.keys(metadata).length ? JSON.stringify(metadata) : null
|
|
209
209
|
};
|
|
210
210
|
for (const key of DIRECT_RUN_PROPERTY_KEYS)
|
|
211
|
-
|
|
212
|
-
return
|
|
211
|
+
attrs4[attributeName(key)] = JSON.stringify(base[key]) === JSON.stringify(desired[key]) ? null : JSON.stringify(desired[key] ?? null);
|
|
212
|
+
return attrs4;
|
|
213
213
|
}
|
|
214
214
|
function wordInlinePropertyCodec(schema) {
|
|
215
215
|
return Object.values(schema.nodes).some((type) => type.spec.attrs?.[attributeName("bold")]) ? schema.marks.inlineCommentAnchors ? "word-yjs-v3" : "word-yjs-v2" : "word-yjs-v1";
|
|
@@ -1188,8 +1188,8 @@ function cellContent(state, cell, text2) {
|
|
|
1188
1188
|
nodes.push(child3);
|
|
1189
1189
|
return;
|
|
1190
1190
|
}
|
|
1191
|
-
const
|
|
1192
|
-
nodes.push(child3.type.create(
|
|
1191
|
+
const attrs4 = child3.attrs.contentControl ? { ...child3.attrs, contentControl: null } : child3.attrs;
|
|
1192
|
+
nodes.push(child3.type.create(attrs4, placed ? null : text2));
|
|
1193
1193
|
placed = true;
|
|
1194
1194
|
});
|
|
1195
1195
|
if (!placed) nodes.push(state.schema.nodes.paragraph.create(null, text2));
|
|
@@ -2522,8 +2522,8 @@ function parseRunProperties(props) {
|
|
|
2522
2522
|
if (scale !== void 0) result.textScalePercent = scale;
|
|
2523
2523
|
const kerning = parseHalfPoints(getW(first2(props, "kern"), "val"));
|
|
2524
2524
|
if (kerning !== void 0) result.kerningHalfPoints = kerning;
|
|
2525
|
-
const
|
|
2526
|
-
if (
|
|
2525
|
+
const position = parseSignedHalfPoints(getW(first2(props, "position"), "val"));
|
|
2526
|
+
if (position !== void 0) result.positionHalfPoints = position;
|
|
2527
2527
|
const shd = first2(props, "shd");
|
|
2528
2528
|
const fill = parseRgbColor(getW(shd, "fill"));
|
|
2529
2529
|
if (fill) result.shadingFill = fill;
|
|
@@ -3408,6 +3408,53 @@ function parseDrawingPictureFill(fill) {
|
|
|
3408
3408
|
};
|
|
3409
3409
|
}
|
|
3410
3410
|
|
|
3411
|
+
// opc/safe-href.ts
|
|
3412
|
+
var OPEN_SCHEMES = /* @__PURE__ */ new Set(["http", "https", "mailto"]);
|
|
3413
|
+
var STORE_SCHEMES = /* @__PURE__ */ new Set([...OPEN_SCHEMES, "ftp", "file"]);
|
|
3414
|
+
var SCRIPT_SCHEMES = /* @__PURE__ */ new Set([
|
|
3415
|
+
"javascript",
|
|
3416
|
+
"vbscript",
|
|
3417
|
+
"livescript",
|
|
3418
|
+
"jscript",
|
|
3419
|
+
"mocha",
|
|
3420
|
+
"data",
|
|
3421
|
+
"mhtml",
|
|
3422
|
+
"ms-its",
|
|
3423
|
+
"mk",
|
|
3424
|
+
"x-javascript",
|
|
3425
|
+
"blob"
|
|
3426
|
+
]);
|
|
3427
|
+
var IGNORABLE = new RegExp(
|
|
3428
|
+
"[\\u0000-\\u0020\\u007f\\u00ad\\u200b-\\u200f\\u202a-\\u202e\\u2060-\\u2064\\ufeff]",
|
|
3429
|
+
"gu"
|
|
3430
|
+
);
|
|
3431
|
+
var CONTROL = new RegExp("[\\u0000-\\u001f\\u007f]", "u");
|
|
3432
|
+
var SCHEME = /^([a-z][a-z0-9+.-]*):/;
|
|
3433
|
+
var STORE_ONLY = { store: true, open: false, reason: "not-openable" };
|
|
3434
|
+
var reject = (reason) => ({
|
|
3435
|
+
store: false,
|
|
3436
|
+
open: false,
|
|
3437
|
+
reason
|
|
3438
|
+
});
|
|
3439
|
+
function hyperlinkPolicy(href, options2 = {}) {
|
|
3440
|
+
if (typeof href !== "string") return reject("empty");
|
|
3441
|
+
const trimmed = href.trim();
|
|
3442
|
+
const normalized = trimmed.replace(IGNORABLE, "").toLowerCase();
|
|
3443
|
+
if (normalized.length === 0) return reject("empty");
|
|
3444
|
+
const scheme2 = SCHEME.exec(normalized)?.[1];
|
|
3445
|
+
if (scheme2 !== void 0 && SCRIPT_SCHEMES.has(scheme2)) return reject("script-scheme");
|
|
3446
|
+
if (scheme2 !== void 0 && !trimmed.toLowerCase().startsWith(`${scheme2}:`))
|
|
3447
|
+
return reject("obfuscated-scheme");
|
|
3448
|
+
if (CONTROL.test(trimmed)) return reject("control-characters");
|
|
3449
|
+
if (scheme2 === void 0) return options2.openRelative ? { store: true, open: true } : STORE_ONLY;
|
|
3450
|
+
if (scheme2.length === 1) return STORE_ONLY;
|
|
3451
|
+
if (OPEN_SCHEMES.has(scheme2)) return { store: true, open: true };
|
|
3452
|
+
if (options2.additionalOpenSchemes?.some((allowed) => allowed.toLowerCase() === scheme2))
|
|
3453
|
+
return { store: true, open: true };
|
|
3454
|
+
if (STORE_SCHEMES.has(scheme2)) return STORE_ONLY;
|
|
3455
|
+
return reject("unsupported-scheme");
|
|
3456
|
+
}
|
|
3457
|
+
|
|
3411
3458
|
// opc/signature/xml-utils.ts
|
|
3412
3459
|
function escapeXmlAttr(value) {
|
|
3413
3460
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -3604,8 +3651,8 @@ function parseDrawingFill(properties3) {
|
|
|
3604
3651
|
case "gradFill": {
|
|
3605
3652
|
const stops = children(first(fill, "gsLst", NS.a) ?? fill, "gs", NS.a).flatMap((stop) => {
|
|
3606
3653
|
const color = parseDrawingColorIn(stop);
|
|
3607
|
-
const
|
|
3608
|
-
return color && Number.isFinite(
|
|
3654
|
+
const position = Number.parseInt(stop.getAttribute("pos") ?? "", 10);
|
|
3655
|
+
return color && Number.isFinite(position) ? [{ position: position / 1e3, color }] : [];
|
|
3609
3656
|
});
|
|
3610
3657
|
const angle = Number.parseInt(first(fill, "lin", NS.a)?.getAttribute("ang") ?? "", 10);
|
|
3611
3658
|
const scaled = first(fill, "lin", NS.a)?.getAttribute("scaled");
|
|
@@ -4369,21 +4416,21 @@ function lerpStops(a, b, t) {
|
|
|
4369
4416
|
opacity: oa + (ob - oa) * t
|
|
4370
4417
|
};
|
|
4371
4418
|
}
|
|
4372
|
-
function gradientColorAt(stops,
|
|
4419
|
+
function gradientColorAt(stops, position) {
|
|
4373
4420
|
const first3 = stops[0];
|
|
4374
4421
|
const last = stops[stops.length - 1];
|
|
4375
|
-
if (
|
|
4422
|
+
if (position <= first3.position) {
|
|
4376
4423
|
return { color: first3.color, opacity: first3.opacity ?? 1 };
|
|
4377
4424
|
}
|
|
4378
|
-
if (
|
|
4425
|
+
if (position >= last.position) {
|
|
4379
4426
|
return { color: last.color, opacity: last.opacity ?? 1 };
|
|
4380
4427
|
}
|
|
4381
4428
|
for (let i = 0; i < stops.length - 1; i += 1) {
|
|
4382
4429
|
const from = stops[i];
|
|
4383
4430
|
const to = stops[i + 1];
|
|
4384
|
-
if (
|
|
4431
|
+
if (position >= from.position && position <= to.position) {
|
|
4385
4432
|
const span = to.position - from.position;
|
|
4386
|
-
const t = span > 0 ? (
|
|
4433
|
+
const t = span > 0 ? (position - from.position) / span : 0;
|
|
4387
4434
|
return lerpStops(from, to, t);
|
|
4388
4435
|
}
|
|
4389
4436
|
}
|
|
@@ -4645,8 +4692,8 @@ function readAttributes2(element3, out) {
|
|
|
4645
4692
|
function readTabStops(element3) {
|
|
4646
4693
|
return children(element3, "tab", NS.a).map((tab) => {
|
|
4647
4694
|
const stop = {};
|
|
4648
|
-
const
|
|
4649
|
-
if (
|
|
4695
|
+
const position = integerAttribute(tab, "pos");
|
|
4696
|
+
if (position !== void 0) stop.positionEmu = position;
|
|
4650
4697
|
const align = stringAttribute(tab, "algn");
|
|
4651
4698
|
if (align) stop.align = align;
|
|
4652
4699
|
return stop;
|
|
@@ -16321,7 +16368,7 @@ function isSpace(ch) {
|
|
|
16321
16368
|
return ch === " " || ch === " " || ch === "\n" || ch === "\r";
|
|
16322
16369
|
}
|
|
16323
16370
|
function parseAttributes(source) {
|
|
16324
|
-
const
|
|
16371
|
+
const attrs4 = {};
|
|
16325
16372
|
let i = 0;
|
|
16326
16373
|
const n2 = source.length;
|
|
16327
16374
|
while (i < n2) {
|
|
@@ -16356,9 +16403,9 @@ function parseAttributes(source) {
|
|
|
16356
16403
|
if (name2 === "xmlns" || name2.startsWith("xmlns:")) {
|
|
16357
16404
|
continue;
|
|
16358
16405
|
}
|
|
16359
|
-
|
|
16406
|
+
attrs4[localName(name2)] = decodeEntities(value);
|
|
16360
16407
|
}
|
|
16361
|
-
return
|
|
16408
|
+
return attrs4;
|
|
16362
16409
|
}
|
|
16363
16410
|
function tagEnd(xml, from) {
|
|
16364
16411
|
let quote = "";
|
|
@@ -16484,14 +16531,14 @@ function numOrNaN(value) {
|
|
|
16484
16531
|
function relation(value) {
|
|
16485
16532
|
return value === "ch" || value === "des" ? value : "self";
|
|
16486
16533
|
}
|
|
16487
|
-
function parseIterator(
|
|
16534
|
+
function parseIterator(attrs4) {
|
|
16488
16535
|
return {
|
|
16489
|
-
axis: list(
|
|
16490
|
-
ptType: list(
|
|
16491
|
-
hideLastTrans: list(
|
|
16492
|
-
st: numberList(
|
|
16493
|
-
cnt: numberList(
|
|
16494
|
-
step: numberList(
|
|
16536
|
+
axis: list(attrs4.axis),
|
|
16537
|
+
ptType: list(attrs4.ptType),
|
|
16538
|
+
hideLastTrans: list(attrs4.hideLastTrans).map((v) => v === "1" || v === "true"),
|
|
16539
|
+
st: numberList(attrs4.st),
|
|
16540
|
+
cnt: numberList(attrs4.cnt),
|
|
16541
|
+
step: numberList(attrs4.step)
|
|
16495
16542
|
};
|
|
16496
16543
|
}
|
|
16497
16544
|
function parseAlgorithm(element3) {
|
|
@@ -16522,41 +16569,41 @@ function parseShape(element3) {
|
|
|
16522
16569
|
adj
|
|
16523
16570
|
};
|
|
16524
16571
|
}
|
|
16525
|
-
function parseConstraint(
|
|
16526
|
-
const op =
|
|
16572
|
+
function parseConstraint(attrs4) {
|
|
16573
|
+
const op = attrs4.op;
|
|
16527
16574
|
return {
|
|
16528
|
-
type:
|
|
16529
|
-
for: relation(
|
|
16530
|
-
forName:
|
|
16531
|
-
ptType:
|
|
16532
|
-
refType:
|
|
16533
|
-
refFor: relation(
|
|
16534
|
-
refForName:
|
|
16535
|
-
refPtType:
|
|
16575
|
+
type: attrs4.type ?? "none",
|
|
16576
|
+
for: relation(attrs4.for),
|
|
16577
|
+
forName: attrs4.forName || void 0,
|
|
16578
|
+
ptType: attrs4.ptType ?? "all",
|
|
16579
|
+
refType: attrs4.refType ?? "none",
|
|
16580
|
+
refFor: relation(attrs4.refFor),
|
|
16581
|
+
refForName: attrs4.refForName || void 0,
|
|
16582
|
+
refPtType: attrs4.refPtType ?? "all",
|
|
16536
16583
|
op: op === "equ" || op === "gte" || op === "lte" ? op : "none",
|
|
16537
|
-
val: num(
|
|
16538
|
-
hasVal:
|
|
16539
|
-
fact: num(
|
|
16584
|
+
val: num(attrs4.val, 0),
|
|
16585
|
+
hasVal: attrs4.val !== void 0,
|
|
16586
|
+
fact: num(attrs4.fact, 1)
|
|
16540
16587
|
};
|
|
16541
16588
|
}
|
|
16542
|
-
function parseRule(
|
|
16589
|
+
function parseRule(attrs4) {
|
|
16543
16590
|
return {
|
|
16544
|
-
type:
|
|
16545
|
-
for: relation(
|
|
16546
|
-
forName:
|
|
16547
|
-
ptType:
|
|
16548
|
-
val: numOrNaN(
|
|
16549
|
-
fact: numOrNaN(
|
|
16550
|
-
max: numOrNaN(
|
|
16591
|
+
type: attrs4.type ?? "none",
|
|
16592
|
+
for: relation(attrs4.for),
|
|
16593
|
+
forName: attrs4.forName || void 0,
|
|
16594
|
+
ptType: attrs4.ptType ?? "all",
|
|
16595
|
+
val: numOrNaN(attrs4.val),
|
|
16596
|
+
fact: numOrNaN(attrs4.fact),
|
|
16597
|
+
max: numOrNaN(attrs4.max)
|
|
16551
16598
|
};
|
|
16552
16599
|
}
|
|
16553
|
-
function parseCondition(
|
|
16600
|
+
function parseCondition(attrs4) {
|
|
16554
16601
|
return {
|
|
16555
|
-
...parseIterator(
|
|
16556
|
-
func:
|
|
16557
|
-
arg:
|
|
16558
|
-
op:
|
|
16559
|
-
val:
|
|
16602
|
+
...parseIterator(attrs4),
|
|
16603
|
+
func: attrs4.func ?? "cnt",
|
|
16604
|
+
arg: attrs4.arg,
|
|
16605
|
+
op: attrs4.op ?? "equ",
|
|
16606
|
+
val: attrs4.val ?? ""
|
|
16560
16607
|
};
|
|
16561
16608
|
}
|
|
16562
16609
|
function parseBody(element3, state) {
|
|
@@ -19045,8 +19092,8 @@ function endpoints(point) {
|
|
|
19045
19092
|
const content = parent.children.filter((c) => c.type === "node" || c.type === "asst");
|
|
19046
19093
|
const index = parent.children.indexOf(point);
|
|
19047
19094
|
const before = parent.children[index - 1];
|
|
19048
|
-
const
|
|
19049
|
-
return [before, content[(
|
|
19095
|
+
const position = before === void 0 ? -1 : content.indexOf(before);
|
|
19096
|
+
return [before, content[(position + 1) % Math.max(1, content.length)]];
|
|
19050
19097
|
}
|
|
19051
19098
|
function findShape(scope, point, name2, skip) {
|
|
19052
19099
|
if (!point) {
|
|
@@ -24891,18 +24938,18 @@ function esc(text2) {
|
|
|
24891
24938
|
}
|
|
24892
24939
|
var n = (value) => String(Math.round(value * 100) / 100);
|
|
24893
24940
|
var textWidth = (text2, size = FONT_SIZE) => text2.length * size * 0.55;
|
|
24894
|
-
function text(x, y, content,
|
|
24941
|
+
function text(x, y, content, attrs4 = {}) {
|
|
24895
24942
|
const parts = [`x="${n(x)}"`, `y="${n(y)}"`];
|
|
24896
|
-
parts.push(`font-size="${
|
|
24897
|
-
parts.push(`fill="${esc(
|
|
24898
|
-
if (
|
|
24899
|
-
if (
|
|
24900
|
-
if (
|
|
24901
|
-
if (
|
|
24902
|
-
if (
|
|
24903
|
-
if (
|
|
24904
|
-
if (
|
|
24905
|
-
parts.push(`text-decoration="${
|
|
24943
|
+
parts.push(`font-size="${attrs4.size ?? FONT_SIZE}"`);
|
|
24944
|
+
parts.push(`fill="${esc(attrs4.fill ?? TEXT_COLOR)}"`);
|
|
24945
|
+
if (attrs4.anchor && attrs4.anchor !== "start") parts.push(`text-anchor="${attrs4.anchor}"`);
|
|
24946
|
+
if (attrs4.weight) parts.push(`font-weight="${attrs4.weight}"`);
|
|
24947
|
+
if (attrs4.baseline) parts.push(`dominant-baseline="${attrs4.baseline}"`);
|
|
24948
|
+
if (attrs4.family) parts.push(`font-family="${esc(attrs4.family)}"`);
|
|
24949
|
+
if (attrs4.filter) parts.push(`filter="${esc(attrs4.filter)}"`);
|
|
24950
|
+
if (attrs4.italic !== void 0) parts.push(`font-style="${attrs4.italic ? "italic" : "normal"}"`);
|
|
24951
|
+
if (attrs4.underline !== void 0)
|
|
24952
|
+
parts.push(`text-decoration="${attrs4.underline ? "underline" : "none"}"`);
|
|
24906
24953
|
return `<text ${parts.join(" ")}>${esc(content)}</text>`;
|
|
24907
24954
|
}
|
|
24908
24955
|
var line2 = (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}"/>`;
|
|
@@ -25026,8 +25073,8 @@ var GAP = 3;
|
|
|
25026
25073
|
var LINE = 1.2;
|
|
25027
25074
|
var NAMED_COLORS = /^(black|blue|cyan|green|magenta|red|white|yellow)$/iu;
|
|
25028
25075
|
function measure3(model, label) {
|
|
25029
|
-
const
|
|
25030
|
-
const size =
|
|
25076
|
+
const attrs4 = chartTextAttributes(model, "dataLabel", 10);
|
|
25077
|
+
const size = attrs4.size ?? 10;
|
|
25031
25078
|
const lines = label.text.split("\n");
|
|
25032
25079
|
return {
|
|
25033
25080
|
...model.frameSize ? { frame: model.frameSize } : {},
|
|
@@ -25035,7 +25082,7 @@ function measure3(model, label) {
|
|
|
25035
25082
|
size,
|
|
25036
25083
|
w: Math.max(...lines.map((l) => textWidth(l, size))),
|
|
25037
25084
|
h: lines.length * size * LINE,
|
|
25038
|
-
attrs:
|
|
25085
|
+
attrs: attrs4
|
|
25039
25086
|
};
|
|
25040
25087
|
}
|
|
25041
25088
|
function draw(m, label, x, y, anchor, out) {
|
|
@@ -25052,8 +25099,8 @@ function barLabels(model, marks, out) {
|
|
|
25052
25099
|
const label = mark.series.labels?.[mark.index];
|
|
25053
25100
|
if (!label) continue;
|
|
25054
25101
|
const m = measure3(model, label);
|
|
25055
|
-
let
|
|
25056
|
-
if (stacked &&
|
|
25102
|
+
let position = label.position ?? (stacked ? "ctr" : "outEnd");
|
|
25103
|
+
if (stacked && position === "outEnd") position = "ctr";
|
|
25057
25104
|
const cx = mark.x + mark.w / 2;
|
|
25058
25105
|
const cy = mark.y + mark.h / 2;
|
|
25059
25106
|
if (model.horizontal) {
|
|
@@ -25064,14 +25111,14 @@ function barLabels(model, marks, out) {
|
|
|
25064
25111
|
at + (outward ? dir2 : -dir2) * GAP,
|
|
25065
25112
|
(outward ? dir2 : -dir2) > 0 ? "start" : "end"
|
|
25066
25113
|
];
|
|
25067
|
-
const [x, anchor] =
|
|
25114
|
+
const [x, anchor] = position === "ctr" ? [cx, "middle"] : position === "inEnd" ? side(end, false) : position === "inBase" ? side(base, true) : side(end, true);
|
|
25068
25115
|
draw(m, label, x, cy, anchor, out);
|
|
25069
25116
|
continue;
|
|
25070
25117
|
}
|
|
25071
25118
|
const top = mark.negative ? mark.y + mark.h : mark.y;
|
|
25072
25119
|
const bottom = mark.negative ? mark.y : mark.y + mark.h;
|
|
25073
25120
|
const dir = mark.negative ? 1 : -1;
|
|
25074
|
-
const y =
|
|
25121
|
+
const y = position === "ctr" ? cy : position === "inEnd" ? top - dir * (GAP + m.h / 2) : position === "inBase" ? bottom + dir * (GAP + m.h / 2) : top + dir * (GAP + m.h / 2);
|
|
25075
25122
|
draw(m, label, cx, y, "middle", out);
|
|
25076
25123
|
}
|
|
25077
25124
|
}
|
|
@@ -25344,13 +25391,13 @@ function chartDataTableSvg(model, plot) {
|
|
|
25344
25391
|
const bottom = top + height;
|
|
25345
25392
|
const cellW = plot.w / Math.max(1, model.categories.length);
|
|
25346
25393
|
const styled = { ...model, appearance: { ...model.appearance, dataLabel: table.text ?? {} } };
|
|
25347
|
-
const
|
|
25394
|
+
const attrs4 = chartTextAttributes(styled, "dataLabel", fontSize);
|
|
25348
25395
|
const out = ['<g data-chart-part="dataTable">'];
|
|
25349
25396
|
const border = (x1, y1, x2, y2) => out.push(
|
|
25350
25397
|
`<line x1="${n(x1)}" y1="${n(y1)}" x2="${n(x2)}" y2="${n(y2)}" ${strokeAttributes(table.stroke)}/>`
|
|
25351
25398
|
);
|
|
25352
25399
|
const label = (x, y, value, width, anchor = "middle") => out.push(
|
|
25353
|
-
text(x, y + fontSize * 0.35, fit(value, Math.max(1, width), fontSize), { ...
|
|
25400
|
+
text(x, y + fontSize * 0.35, fit(value, Math.max(1, width), fontSize), { ...attrs4, anchor })
|
|
25354
25401
|
);
|
|
25355
25402
|
if (table.fill) out.push(rect2(left, top, right - left, height, table.fill));
|
|
25356
25403
|
if (source.showOutline !== false) {
|
|
@@ -25587,7 +25634,7 @@ function chartDateAxis(model, plot, out) {
|
|
|
25587
25634
|
const min = axis.scaling.min ?? points[0].value;
|
|
25588
25635
|
const max = axis.scaling.max ?? points.at(-1).value;
|
|
25589
25636
|
if (!Number.isFinite(min) || !Number.isFinite(max) || max < min) return void 0;
|
|
25590
|
-
const
|
|
25637
|
+
const position = (value) => {
|
|
25591
25638
|
const ratio = max === min ? 0.5 : (value - min) / (max - min);
|
|
25592
25639
|
const t = axis.scaling.orientation === "maxMin" ? 1 - ratio : ratio;
|
|
25593
25640
|
return model.horizontal ? plot.y + plot.h * (1 - t) : plot.x + plot.w * t;
|
|
@@ -25602,8 +25649,8 @@ function chartDateAxis(model, plot, out) {
|
|
|
25602
25649
|
unit,
|
|
25603
25650
|
Math.max(1, axis.majorUnit ?? 1)
|
|
25604
25651
|
);
|
|
25605
|
-
const
|
|
25606
|
-
const size =
|
|
25652
|
+
const attrs4 = chartTextAttributes(model, "categoryAxis");
|
|
25653
|
+
const size = attrs4.size ?? 10;
|
|
25607
25654
|
const y = axis.position === "t" ? plot.y : plot.y + plot.h;
|
|
25608
25655
|
const paint2 = model.axes?.category?.line;
|
|
25609
25656
|
const stroke = { color: paint2?.color ?? "#BFBFBF", width: paint2?.width ?? 1 };
|
|
@@ -25618,11 +25665,11 @@ function chartDateAxis(model, plot, out) {
|
|
|
25618
25665
|
const a = placement === "cross" ? -length : 0;
|
|
25619
25666
|
const b = placement === "cross" ? length : placement === "in" ? direction * length : -direction * length;
|
|
25620
25667
|
out.push(
|
|
25621
|
-
`<line x1="${x + a}" y1="${
|
|
25668
|
+
`<line x1="${x + a}" y1="${position(serial)}" x2="${x + b}" y2="${position(serial)}" ${strokeAttributes(stroke)} data-chart-part="dateTick"/>`
|
|
25622
25669
|
);
|
|
25623
25670
|
} else
|
|
25624
25671
|
out.push(
|
|
25625
|
-
`<line x1="${
|
|
25672
|
+
`<line x1="${position(serial)}" y1="${y + start}" x2="${position(serial)}" y2="${y + end}" ${strokeAttributes(stroke)} data-chart-part="dateTick"/>`
|
|
25626
25673
|
);
|
|
25627
25674
|
};
|
|
25628
25675
|
ticks.forEach((serial, index) => {
|
|
@@ -25635,13 +25682,13 @@ function chartDateAxis(model, plot, out) {
|
|
|
25635
25682
|
axis.numberFormat?.formatCode
|
|
25636
25683
|
);
|
|
25637
25684
|
if (model.horizontal)
|
|
25638
|
-
out.push(text(plot.x - 4,
|
|
25685
|
+
out.push(text(plot.x - 4, position(serial) + size * 0.3, label, { ...attrs4, anchor: "end" }));
|
|
25639
25686
|
else {
|
|
25640
25687
|
const above = axis.tickLabelPosition === "high" || axis.tickLabelPosition !== "low" && axis.position === "t";
|
|
25641
25688
|
const baseline = axis.tickLabelPosition === "high" ? plot.y : axis.tickLabelPosition === "low" ? plot.y + plot.h : y;
|
|
25642
25689
|
out.push(
|
|
25643
|
-
text(
|
|
25644
|
-
...
|
|
25690
|
+
text(position(serial), baseline + (above ? -4 : size + 3), label, {
|
|
25691
|
+
...attrs4,
|
|
25645
25692
|
anchor: "middle"
|
|
25646
25693
|
})
|
|
25647
25694
|
);
|
|
@@ -25658,7 +25705,7 @@ function chartDateAxis(model, plot, out) {
|
|
|
25658
25705
|
mark(serial, axis.minorTickMark, 2.5);
|
|
25659
25706
|
return {
|
|
25660
25707
|
order: visible.map((p2) => p2.index),
|
|
25661
|
-
band: (index) =>
|
|
25708
|
+
band: (index) => position(values[index] ?? min),
|
|
25662
25709
|
bandSize: (model.horizontal ? plot.h : plot.w) / Math.max(1, max - min + 1)
|
|
25663
25710
|
};
|
|
25664
25711
|
}
|
|
@@ -25697,11 +25744,11 @@ function smoothSegment(points, i) {
|
|
|
25697
25744
|
function chartLineSvg(points, series) {
|
|
25698
25745
|
if (points.length < 2) return "";
|
|
25699
25746
|
const stroke = series.stroke;
|
|
25700
|
-
const
|
|
25747
|
+
const attrs4 = strokeAttributes(
|
|
25701
25748
|
stroke ? { ...stroke, color: stroke.color === "none" ? "none" : series.color } : { color: series.color, width: 2.25 }
|
|
25702
25749
|
);
|
|
25703
25750
|
const filter = series.shadowFilter ? ` filter="${series.shadowFilter}"` : "";
|
|
25704
|
-
return series.smooth ? `<path d="${smoothLinePath(points)}" fill="none" ${
|
|
25751
|
+
return series.smooth ? `<path d="${smoothLinePath(points)}" fill="none" ${attrs4} stroke-linejoin="round"${filter}/>` : `<polyline points="${points.map((p2) => `${n(p2.x)},${n(p2.y)}`).join(" ")}" fill="none" ${attrs4} stroke-linejoin="round"${filter}/>`;
|
|
25705
25752
|
}
|
|
25706
25753
|
|
|
25707
25754
|
// chart/render/chart-svg-plot-layout.ts
|
|
@@ -25793,11 +25840,11 @@ function styledAxisLine(x1, y1, x2, y2, paint2, fallback) {
|
|
|
25793
25840
|
dash ? ` stroke-dasharray="${dash}"/>` : "/>"
|
|
25794
25841
|
);
|
|
25795
25842
|
}
|
|
25796
|
-
function axisGridlines(model, axis, ticks,
|
|
25843
|
+
function axisGridlines(model, axis, ticks, position, plot, vertical) {
|
|
25797
25844
|
const draw2 = (values, paint2, minor2) => {
|
|
25798
25845
|
const fallback = chartStroke(model, minor2 ? "gridlineMinor" : "gridlineMajor");
|
|
25799
25846
|
return values.map((value) => {
|
|
25800
|
-
const p2 =
|
|
25847
|
+
const p2 = position(value);
|
|
25801
25848
|
return vertical ? styledAxisLine(p2, plot.y, p2, plot.y + plot.h, paint2, fallback) : styledAxisLine(plot.x, p2, plot.x + plot.w, p2, paint2, fallback);
|
|
25802
25849
|
}).join("");
|
|
25803
25850
|
};
|
|
@@ -26334,7 +26381,7 @@ function labelsOf(source, view, categories, numberFormat, resolveColor) {
|
|
|
26334
26381
|
view.values.forEach((value, i) => {
|
|
26335
26382
|
const point = points?.[i];
|
|
26336
26383
|
if (value === null || point?.deleted === true) return;
|
|
26337
|
-
const
|
|
26384
|
+
const position = point?.position ?? series?.position ?? chart?.position;
|
|
26338
26385
|
const x = view.xValues?.[i];
|
|
26339
26386
|
const category = x === void 0 || x === null ? categories[i] : formatAxisValue(x);
|
|
26340
26387
|
let built;
|
|
@@ -26371,7 +26418,7 @@ function labelsOf(source, view, categories, numberFormat, resolveColor) {
|
|
|
26371
26418
|
...layout ? { layout } : {},
|
|
26372
26419
|
...showLeaderLines !== void 0 ? { showLeaderLines } : {},
|
|
26373
26420
|
...leaderLine ? { leaderLine } : {},
|
|
26374
|
-
...
|
|
26421
|
+
...position ? { position } : {},
|
|
26375
26422
|
...built.color ? { color: built.color } : {}
|
|
26376
26423
|
};
|
|
26377
26424
|
});
|
|
@@ -27373,11 +27420,11 @@ function resolveRegionCode(label) {
|
|
|
27373
27420
|
|
|
27374
27421
|
// chart/region-map/data.ts
|
|
27375
27422
|
function sourceIndices(indices, length) {
|
|
27376
|
-
return Array.from({ length }, (_,
|
|
27423
|
+
return Array.from({ length }, (_, position) => indices?.[position] ?? position);
|
|
27377
27424
|
}
|
|
27378
27425
|
function valueAtSource(values, indices, sourceIndex) {
|
|
27379
|
-
const
|
|
27380
|
-
return
|
|
27426
|
+
const position = indices.indexOf(sourceIndex);
|
|
27427
|
+
return position >= 0 ? values[position] : void 0;
|
|
27381
27428
|
}
|
|
27382
27429
|
function cachedEntityName(cache, entityId) {
|
|
27383
27430
|
if (!cache || typeof cache !== "object") {
|
|
@@ -27472,18 +27519,18 @@ function resolveValueColorStops(valueColors, valueColorPositions, minVal, maxVal
|
|
|
27472
27519
|
if (!valueColors || valueColors.length < 2) {
|
|
27473
27520
|
return void 0;
|
|
27474
27521
|
}
|
|
27475
|
-
const span = maxVal - minVal || 1, count = valueColors.length, resolvePosition = (
|
|
27476
|
-
if (
|
|
27522
|
+
const span = maxVal - minVal || 1, count = valueColors.length, resolvePosition = (position, index) => {
|
|
27523
|
+
if (position?.kind === "min") {
|
|
27477
27524
|
return 0;
|
|
27478
27525
|
}
|
|
27479
|
-
if (
|
|
27526
|
+
if (position?.kind === "max") {
|
|
27480
27527
|
return 1;
|
|
27481
27528
|
}
|
|
27482
|
-
if (
|
|
27483
|
-
return Math.min(1, Math.max(0, (
|
|
27529
|
+
if (position?.kind === "number" && position.value !== void 0) {
|
|
27530
|
+
return Math.min(1, Math.max(0, (position.value - minVal) / span));
|
|
27484
27531
|
}
|
|
27485
|
-
if (
|
|
27486
|
-
return Math.min(1, Math.max(0,
|
|
27532
|
+
if (position?.kind === "percent" && position.value !== void 0) {
|
|
27533
|
+
return Math.min(1, Math.max(0, position.value / 100));
|
|
27487
27534
|
}
|
|
27488
27535
|
return count === 1 ? 0 : index / (count - 1);
|
|
27489
27536
|
};
|
|
@@ -28029,13 +28076,13 @@ function regionMapSvg(model, area, approximationLabel) {
|
|
|
28029
28076
|
out.push("</svg>");
|
|
28030
28077
|
const y = area.y + height * scale + 5, bar = Math.min(160, area.w * 0.4), left = area.x + (area.w - bar) / 2;
|
|
28031
28078
|
if (model.showLegend) {
|
|
28032
|
-
const
|
|
28033
|
-
out.push(text(left - 8, y + size * 0.4, series.name, { ...
|
|
28079
|
+
const attrs4 = chartTextAttributes(model, "legend", 16), size = attrs4.size ?? 16;
|
|
28080
|
+
out.push(text(left - 8, y + size * 0.4, series.name, { ...attrs4, anchor: "end" }));
|
|
28034
28081
|
for (let i = 0; i < 32; i++)
|
|
28035
28082
|
out.push(rect2(left + i * bar / 32, y, bar / 32 + 0.1, 7, colors((i + 0.5) / 32)));
|
|
28036
28083
|
out.push(
|
|
28037
|
-
text(left, y + 8 + size, String(min),
|
|
28038
|
-
text(left + bar, y + 8 + size, String(max), { ...
|
|
28084
|
+
text(left, y + 8 + size, String(min), attrs4),
|
|
28085
|
+
text(left + bar, y + 8 + size, String(max), { ...attrs4, anchor: "end" })
|
|
28039
28086
|
);
|
|
28040
28087
|
}
|
|
28041
28088
|
let row = y + (model.showLegend ? 32 : 0);
|
|
@@ -28093,10 +28140,10 @@ function computeFunnelGeometry(values, plot, gapWidth = 33) {
|
|
|
28093
28140
|
function funnelSvg(model, area) {
|
|
28094
28141
|
const series = model.series[0];
|
|
28095
28142
|
if (!series || series.hidden) return "";
|
|
28096
|
-
const
|
|
28143
|
+
const attrs4 = chartTextAttributes(model, "categoryAxis", 10);
|
|
28097
28144
|
const width = Math.min(
|
|
28098
28145
|
area.w * 0.3,
|
|
28099
|
-
Math.max(32, ...model.categories.map((s) => s.length * (
|
|
28146
|
+
Math.max(32, ...model.categories.map((s) => s.length * (attrs4.size ?? 10) * 0.55 + 8))
|
|
28100
28147
|
);
|
|
28101
28148
|
const plot = { x: area.x + width, y: area.y, width: Math.max(1, area.w - width), height: area.h };
|
|
28102
28149
|
const out = [
|
|
@@ -28126,9 +28173,9 @@ function funnelSvg(model, area) {
|
|
|
28126
28173
|
out.push(
|
|
28127
28174
|
text(
|
|
28128
28175
|
plot.x - 8,
|
|
28129
|
-
bar.y + bar.height / 2 + (
|
|
28130
|
-
fit(model.categories[bar.index] ?? "", width - 8,
|
|
28131
|
-
{ ...
|
|
28176
|
+
bar.y + bar.height / 2 + (attrs4.size ?? 10) * 0.35,
|
|
28177
|
+
fit(model.categories[bar.index] ?? "", width - 8, attrs4.size ?? 10),
|
|
28178
|
+
{ ...attrs4, anchor: "end" }
|
|
28132
28179
|
)
|
|
28133
28180
|
);
|
|
28134
28181
|
out.push("</g>");
|
|
@@ -28512,14 +28559,14 @@ function sliceLabels(model, marks, out) {
|
|
|
28512
28559
|
mark.cx + radius * ux,
|
|
28513
28560
|
mark.cy + radius * uy
|
|
28514
28561
|
];
|
|
28515
|
-
const
|
|
28562
|
+
const position = label.position ?? (model.type === "doughnut" ? "ctr" : "bestFit");
|
|
28516
28563
|
let x;
|
|
28517
28564
|
let y;
|
|
28518
|
-
if (
|
|
28519
|
-
else if (
|
|
28565
|
+
if (position === "ctr") [x, y] = place2(mark.inner + (mark.outer - mark.inner) / 2);
|
|
28566
|
+
else if (position === "inEnd") {
|
|
28520
28567
|
const extent = Math.abs(ux) * m.w / 2 + Math.abs(uy) * m.h / 2;
|
|
28521
28568
|
[x, y] = place2(Math.max(0, mark.outer - GAP2 - extent));
|
|
28522
|
-
} else if (
|
|
28569
|
+
} else if (position === "outEnd") {
|
|
28523
28570
|
const extent = Math.abs(ux) * m.w / 2 + Math.abs(uy) * m.h / 2;
|
|
28524
28571
|
[x, y] = place2(mark.outer + GAP2 + extent);
|
|
28525
28572
|
} else {
|
|
@@ -28784,26 +28831,26 @@ function sunburstSvg(model, area) {
|
|
|
28784
28831
|
|
|
28785
28832
|
// chart/render/chart-svg-text-metrics.ts
|
|
28786
28833
|
var CHART_FONT_FAMILY = "Calibri, Carlito, Arial, sans-serif";
|
|
28787
|
-
function cssFont(
|
|
28788
|
-
return `${
|
|
28834
|
+
function cssFont(attrs4) {
|
|
28835
|
+
return `${attrs4.italic ? "italic" : "normal"} ${attrs4.weight ?? "normal"} ${attrs4.size ?? 10}px ${attrs4.family ?? CHART_FONT_FAMILY}`;
|
|
28789
28836
|
}
|
|
28790
|
-
function chartFontMetrics(
|
|
28791
|
-
const metrics = options2.measureFont?.(cssFont(
|
|
28837
|
+
function chartFontMetrics(attrs4, options2) {
|
|
28838
|
+
const metrics = options2.measureFont?.(cssFont(attrs4));
|
|
28792
28839
|
return metrics && Number.isFinite(metrics.ascent) && Number.isFinite(metrics.descent) && metrics.ascent >= 0 && metrics.descent >= 0 && metrics.ascent + metrics.descent > 0 ? metrics : void 0;
|
|
28793
28840
|
}
|
|
28794
|
-
function chartTextWidth(content,
|
|
28795
|
-
const width = options2.measureText?.(content, cssFont(
|
|
28796
|
-
return width !== void 0 && Number.isFinite(width) && width >= 0 ? width : textWidth(content,
|
|
28841
|
+
function chartTextWidth(content, attrs4, options2) {
|
|
28842
|
+
const width = options2.measureText?.(content, cssFont(attrs4));
|
|
28843
|
+
return width !== void 0 && Number.isFinite(width) && width >= 0 ? width : textWidth(content, attrs4.size);
|
|
28797
28844
|
}
|
|
28798
|
-
function fitChartText(content, maxWidth,
|
|
28799
|
-
if (!options2.measureText) return fit(content, maxWidth,
|
|
28800
|
-
if (chartTextWidth(content,
|
|
28845
|
+
function fitChartText(content, maxWidth, attrs4, options2) {
|
|
28846
|
+
if (!options2.measureText) return fit(content, maxWidth, attrs4.size);
|
|
28847
|
+
if (chartTextWidth(content, attrs4, options2) <= maxWidth) return content;
|
|
28801
28848
|
const points = [...content];
|
|
28802
28849
|
let low = 0;
|
|
28803
28850
|
let high = points.length;
|
|
28804
28851
|
while (low < high) {
|
|
28805
28852
|
const mid = Math.ceil((low + high) / 2);
|
|
28806
|
-
if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`,
|
|
28853
|
+
if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`, attrs4, options2) <= maxWidth) low = mid;
|
|
28807
28854
|
else high = mid - 1;
|
|
28808
28855
|
}
|
|
28809
28856
|
return `${points.slice(0, low).join("")}\u2026`;
|
|
@@ -28825,13 +28872,13 @@ function chartLegendSvg(model, area, frame2, options2) {
|
|
|
28825
28872
|
});
|
|
28826
28873
|
if (!manual) return { plot, markup: automatic.join(""), foreground: !!model.legendOverlay };
|
|
28827
28874
|
const entries = legendEntries(model);
|
|
28828
|
-
const
|
|
28829
|
-
const size =
|
|
28830
|
-
const font = chartFontMetrics(
|
|
28875
|
+
const attrs4 = chartTextAttributes(model, "legend");
|
|
28876
|
+
const size = attrs4.size ?? 10;
|
|
28877
|
+
const font = chartFontMetrics(attrs4, options2);
|
|
28831
28878
|
const keySize = size / 2;
|
|
28832
28879
|
const keyGap = size / 4;
|
|
28833
28880
|
const widths = entries.map(
|
|
28834
|
-
(entry) => chartTextWidth(entry.label,
|
|
28881
|
+
(entry) => chartTextWidth(entry.label, attrs4, options2) + keySize + keyGap
|
|
28835
28882
|
);
|
|
28836
28883
|
const horizontal = manual.width > manual.height && widths.reduce((sum, width) => sum + width, 0) + size <= manual.width;
|
|
28837
28884
|
const rowWidth = horizontal ? manual.width / entries.length : manual.width;
|
|
@@ -28847,13 +28894,13 @@ function chartLegendSvg(model, area, frame2, options2) {
|
|
|
28847
28894
|
const baselineOffset = font ? (font.ascent - font.descent) / 2 : size * 0.35;
|
|
28848
28895
|
const widest = extentOf(widths).max;
|
|
28849
28896
|
entries.forEach((entry, i) => {
|
|
28850
|
-
const available = horizontal ? chartTextWidth(entry.label,
|
|
28851
|
-
const label = fitChartText(entry.label, available,
|
|
28897
|
+
const available = horizontal ? chartTextWidth(entry.label, attrs4, options2) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
|
|
28898
|
+
const label = fitChartText(entry.label, available, attrs4, options2);
|
|
28852
28899
|
const contentWidth = Math.min(horizontal ? widths[i] ?? 0 : widest, rowWidth - size / 2);
|
|
28853
28900
|
const x = horizontal ? horizontalX : manual.x + Math.max(size / 4, (rowWidth - contentWidth) / 2);
|
|
28854
28901
|
const centerY = manual.y + (horizontal ? 0 : i * rowHeight) + rowHeight / 2;
|
|
28855
28902
|
markup.push(rect2(x, centerY - keySize / 2, keySize, keySize, entry.color));
|
|
28856
|
-
markup.push(text(x + keySize + keyGap, centerY + baselineOffset, label,
|
|
28903
|
+
markup.push(text(x + keySize + keyGap, centerY + baselineOffset, label, attrs4));
|
|
28857
28904
|
if (horizontal) horizontalX += (widths[i] ?? 0) + horizontalGap;
|
|
28858
28905
|
});
|
|
28859
28906
|
return {
|
|
@@ -28892,12 +28939,12 @@ function automaticLegend(model, area, out, options2, bounds) {
|
|
|
28892
28939
|
const entries = legendEntries(model);
|
|
28893
28940
|
if (!model.showLegend || entries.length === 0) return area;
|
|
28894
28941
|
const pos = model.legendPosition;
|
|
28895
|
-
const
|
|
28896
|
-
const size =
|
|
28942
|
+
const attrs4 = chartTextAttributes(model, "legend");
|
|
28943
|
+
const size = attrs4.size ?? 10;
|
|
28897
28944
|
const rowH = Math.max(16, size * 1.4);
|
|
28898
28945
|
if (pos === "t" || pos === "b") {
|
|
28899
28946
|
const widths = entries.map(
|
|
28900
|
-
(e) => Math.min(chartTextWidth(e.label,
|
|
28947
|
+
(e) => Math.min(chartTextWidth(e.label, attrs4, options2) + 20, area.w / 2)
|
|
28901
28948
|
);
|
|
28902
28949
|
const total = widths.reduce((a, b) => a + b, 0);
|
|
28903
28950
|
let x2 = area.x + Math.max(0, (area.w - total) / 2);
|
|
@@ -28914,14 +28961,14 @@ function automaticLegend(model, area, out, options2, bounds) {
|
|
|
28914
28961
|
entries.forEach((e, i) => {
|
|
28915
28962
|
const w = widths[i] ?? 0;
|
|
28916
28963
|
out.push(rect2(x2, y, 8, 8, e.color));
|
|
28917
|
-
out.push(text(x2 + 12, y + 8, fitChartText(e.label, w - 16,
|
|
28964
|
+
out.push(text(x2 + 12, y + 8, fitChartText(e.label, w - 16, attrs4, options2), attrs4));
|
|
28918
28965
|
x2 += w;
|
|
28919
28966
|
});
|
|
28920
28967
|
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 };
|
|
28921
28968
|
}
|
|
28922
28969
|
const width = Math.min(
|
|
28923
28970
|
area.w * 0.35,
|
|
28924
|
-
extentOf(entries.map((e) => chartTextWidth(e.label,
|
|
28971
|
+
extentOf(entries.map((e) => chartTextWidth(e.label, attrs4, options2))).max + 22
|
|
28925
28972
|
);
|
|
28926
28973
|
const height = entries.length * rowH;
|
|
28927
28974
|
const x = pos === "l" ? area.x + 4 : area.x + area.w - width;
|
|
@@ -28939,7 +28986,7 @@ function automaticLegend(model, area, out, options2, bounds) {
|
|
|
28939
28986
|
const y = y0 + i * rowH;
|
|
28940
28987
|
if (y + rowH > area.y + area.h + 2) return;
|
|
28941
28988
|
out.push(rect2(x, y + 3, 8, 8, e.color));
|
|
28942
|
-
out.push(text(x + 12, y + 11, fitChartText(e.label, width - 16,
|
|
28989
|
+
out.push(text(x + 12, y + 11, fitChartText(e.label, width - 16, attrs4, options2), attrs4));
|
|
28943
28990
|
});
|
|
28944
28991
|
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 };
|
|
28945
28992
|
}
|
|
@@ -29079,7 +29126,7 @@ function chartRichTitleSvg(model, width, options2 = {}, frameHeight = 400) {
|
|
|
29079
29126
|
width: runs.reduce((sum, run) => sum + chartTextWidth(run.text, run.attrs, options2), 0),
|
|
29080
29127
|
size: runs.length ? Math.max(...runs.map((run) => run.attrs.size ?? 14)) : base.size ?? 14,
|
|
29081
29128
|
fontMetrics: (runs.length ? runs.map((run) => run.attrs) : [base]).map(
|
|
29082
|
-
(
|
|
29129
|
+
(attrs4) => chartFontMetrics(attrs4, options2)
|
|
29083
29130
|
)
|
|
29084
29131
|
};
|
|
29085
29132
|
});
|
|
@@ -29164,11 +29211,11 @@ function renderChartSvg(model, width, height, options2 = {}) {
|
|
|
29164
29211
|
if (!model.titleOverlay)
|
|
29165
29212
|
area = { ...area, y: area.y + richTitle.height, h: area.h - richTitle.height };
|
|
29166
29213
|
} else if (model.title) {
|
|
29167
|
-
const
|
|
29168
|
-
const size =
|
|
29169
|
-
const label = fitChartText(model.title, w - 16,
|
|
29170
|
-
const titleWidth = Math.min(w - 16, chartTextWidth(label,
|
|
29171
|
-
const font = chartFontMetrics(
|
|
29214
|
+
const attrs4 = chartTextAttributes(model, "title", 14);
|
|
29215
|
+
const size = attrs4.size ?? 14;
|
|
29216
|
+
const label = fitChartText(model.title, w - 16, attrs4, options2);
|
|
29217
|
+
const titleWidth = Math.min(w - 16, chartTextWidth(label, attrs4, options2) + 8);
|
|
29218
|
+
const font = chartFontMetrics(attrs4, options2);
|
|
29172
29219
|
const titleHeight = Math.max(24, font ? font.ascent + font.descent + 4 : size * 1.4 + 4);
|
|
29173
29220
|
out.push(
|
|
29174
29221
|
chartAreaRect(model, "title", {
|
|
@@ -29182,7 +29229,7 @@ function renderChartSvg(model, width, height, options2 = {}) {
|
|
|
29182
29229
|
text(w / 2, 8 + size, label, {
|
|
29183
29230
|
anchor: "middle",
|
|
29184
29231
|
fill: "#404040",
|
|
29185
|
-
...
|
|
29232
|
+
...attrs4
|
|
29186
29233
|
})
|
|
29187
29234
|
);
|
|
29188
29235
|
if (!model.titleOverlay)
|
|
@@ -29299,16 +29346,186 @@ function isModeledBreak(element3) {
|
|
|
29299
29346
|
return true;
|
|
29300
29347
|
}
|
|
29301
29348
|
|
|
29302
|
-
// docx/write-
|
|
29349
|
+
// docx/write-drawing-wrap.ts
|
|
29303
29350
|
var WP_NS2 = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing";
|
|
29304
|
-
var
|
|
29351
|
+
var WRAP_NAMES = ["wrapNone", "wrapSquare", "wrapTight", "wrapThrough", "wrapTopAndBottom"];
|
|
29352
|
+
var BEFORE_WRAP = ["simplePos", "positionH", "positionV", "extent", "effectExtent"];
|
|
29353
|
+
var ANCHOR_ONLY = ["simplePos", "positionH", "positionV", ...WRAP_NAMES];
|
|
29354
|
+
var SIDE_DISTANCE = "114300";
|
|
29355
|
+
var el2 = (doc, name2) => makeNS(doc, WP_NS2, name2);
|
|
29356
|
+
var attrs2 = (element3, values) => {
|
|
29357
|
+
for (const [name2, value] of Object.entries(values)) element3.setAttribute(name2, value);
|
|
29358
|
+
return element3;
|
|
29359
|
+
};
|
|
29360
|
+
var wpChildren = (parent) => Array.from(parent.childNodes).filter(
|
|
29361
|
+
(node) => isElement(node) && node.namespaceURI === WP_NS2
|
|
29362
|
+
);
|
|
29363
|
+
function rectanglePolygon(doc) {
|
|
29364
|
+
const polygon = attrs2(el2(doc, "wp:wrapPolygon"), { edited: "0" });
|
|
29365
|
+
const points = [
|
|
29366
|
+
["start", 0, 0],
|
|
29367
|
+
["lineTo", 0, 21600],
|
|
29368
|
+
["lineTo", 21600, 21600],
|
|
29369
|
+
["lineTo", 21600, 0],
|
|
29370
|
+
["lineTo", 0, 0]
|
|
29371
|
+
];
|
|
29372
|
+
for (const [name2, x, y] of points)
|
|
29373
|
+
polygon.appendChild(attrs2(el2(doc, `wp:${name2}`), { x: String(x), y: String(y) }));
|
|
29374
|
+
return polygon;
|
|
29375
|
+
}
|
|
29376
|
+
function wrapElement(doc, placement, polygon) {
|
|
29377
|
+
const wrapText = placement.wrapText ?? "bothSides";
|
|
29378
|
+
switch (placement.wrap) {
|
|
29379
|
+
case "square":
|
|
29380
|
+
return attrs2(el2(doc, "wp:wrapSquare"), { wrapText });
|
|
29381
|
+
case "tight":
|
|
29382
|
+
case "through": {
|
|
29383
|
+
const wrap = el2(doc, placement.wrap === "tight" ? "wp:wrapTight" : "wp:wrapThrough");
|
|
29384
|
+
wrap.setAttribute("wrapText", wrapText);
|
|
29385
|
+
wrap.appendChild(polygon ?? rectanglePolygon(doc));
|
|
29386
|
+
return wrap;
|
|
29387
|
+
}
|
|
29388
|
+
case "topAndBottom":
|
|
29389
|
+
return el2(doc, "wp:wrapTopAndBottom");
|
|
29390
|
+
default:
|
|
29391
|
+
return el2(doc, "wp:wrapNone");
|
|
29392
|
+
}
|
|
29393
|
+
}
|
|
29394
|
+
function positionElement(doc, axis, relativeFrom, align, offsetPx) {
|
|
29395
|
+
const node = attrs2(el2(doc, `wp:position${axis}`), { relativeFrom });
|
|
29396
|
+
const value = el2(doc, align ? "wp:align" : "wp:posOffset");
|
|
29397
|
+
value.appendChild(
|
|
29398
|
+
doc.createTextNode(align ?? String(Math.round((offsetPx ?? 0) * EMU_PER_PIXEL)))
|
|
29399
|
+
);
|
|
29400
|
+
node.appendChild(value);
|
|
29401
|
+
return node;
|
|
29402
|
+
}
|
|
29403
|
+
function patchAnchorWrap(doc, anchor, placement) {
|
|
29404
|
+
const children3 = wpChildren(anchor);
|
|
29405
|
+
const old = children3.find((child3) => WRAP_NAMES.includes(child3.localName));
|
|
29406
|
+
const oldPolygon = old && wpChildren(old).find((child3) => child3.localName === "wrapPolygon");
|
|
29407
|
+
const next = wrapElement(doc, placement, oldPolygon);
|
|
29408
|
+
if (old) anchor.replaceChild(next, old);
|
|
29409
|
+
else {
|
|
29410
|
+
const after = children3.find((child3) => !BEFORE_WRAP.includes(child3.localName));
|
|
29411
|
+
anchor.insertBefore(next, after ?? null);
|
|
29412
|
+
}
|
|
29413
|
+
anchor.setAttribute("behindDoc", placement.wrap === "none" && placement.behindText ? "1" : "0");
|
|
29414
|
+
}
|
|
29415
|
+
function replaceHolder(from, to, skip) {
|
|
29416
|
+
for (const attribute of Array.from(from.attributes))
|
|
29417
|
+
if (!skip.includes(attribute.name) && !to.hasAttribute(attribute.name))
|
|
29418
|
+
to.setAttributeNS(attribute.namespaceURI, attribute.name, attribute.value);
|
|
29419
|
+
for (const child3 of Array.from(from.childNodes)) to.appendChild(child3);
|
|
29420
|
+
from.parentNode?.replaceChild(to, from);
|
|
29421
|
+
}
|
|
29422
|
+
var ANCHOR_ATTRIBUTES = [
|
|
29423
|
+
"distT",
|
|
29424
|
+
"distB",
|
|
29425
|
+
"distL",
|
|
29426
|
+
"distR",
|
|
29427
|
+
"simplePos",
|
|
29428
|
+
"relativeHeight",
|
|
29429
|
+
"behindDoc",
|
|
29430
|
+
"locked",
|
|
29431
|
+
"layoutInCell",
|
|
29432
|
+
"allowOverlap",
|
|
29433
|
+
"hidden"
|
|
29434
|
+
];
|
|
29435
|
+
function inlineToAnchor(doc, inline, placement, relativeHeight) {
|
|
29436
|
+
const anchor = attrs2(el2(doc, "wp:anchor"), {
|
|
29437
|
+
distT: inline.getAttribute("distT") ?? "0",
|
|
29438
|
+
distB: inline.getAttribute("distB") ?? "0",
|
|
29439
|
+
distL: SIDE_DISTANCE,
|
|
29440
|
+
distR: SIDE_DISTANCE,
|
|
29441
|
+
simplePos: "0",
|
|
29442
|
+
relativeHeight: String(relativeHeight),
|
|
29443
|
+
behindDoc: "0",
|
|
29444
|
+
locked: "0",
|
|
29445
|
+
layoutInCell: "1",
|
|
29446
|
+
allowOverlap: "1"
|
|
29447
|
+
});
|
|
29448
|
+
anchor.appendChild(attrs2(el2(doc, "wp:simplePos"), { x: "0", y: "0" }));
|
|
29449
|
+
anchor.appendChild(
|
|
29450
|
+
positionElement(
|
|
29451
|
+
doc,
|
|
29452
|
+
"H",
|
|
29453
|
+
placement.relativeFrom ?? "column",
|
|
29454
|
+
placement.align,
|
|
29455
|
+
placement.offsetXPx
|
|
29456
|
+
)
|
|
29457
|
+
);
|
|
29458
|
+
anchor.appendChild(
|
|
29459
|
+
positionElement(
|
|
29460
|
+
doc,
|
|
29461
|
+
"V",
|
|
29462
|
+
placement.relativeFromV ?? "paragraph",
|
|
29463
|
+
placement.alignV,
|
|
29464
|
+
placement.offsetYPx
|
|
29465
|
+
)
|
|
29466
|
+
);
|
|
29467
|
+
replaceHolder(inline, anchor, ANCHOR_ATTRIBUTES);
|
|
29468
|
+
patchAnchorWrap(doc, anchor, placement);
|
|
29469
|
+
}
|
|
29470
|
+
function anchorToInline(doc, anchor) {
|
|
29471
|
+
const inline = attrs2(el2(doc, "wp:inline"), { distT: "0", distB: "0", distL: "0", distR: "0" });
|
|
29472
|
+
for (const child3 of wpChildren(anchor))
|
|
29473
|
+
if (ANCHOR_ONLY.includes(child3.localName)) anchor.removeChild(child3);
|
|
29474
|
+
for (const child3 of Array.from(anchor.childNodes))
|
|
29475
|
+
if (isElement(child3) && child3.localName.startsWith("sizeRel")) anchor.removeChild(child3);
|
|
29476
|
+
replaceHolder(anchor, inline, ANCHOR_ATTRIBUTES);
|
|
29477
|
+
}
|
|
29478
|
+
function applyDrawingWrap(drawing, doc, anchored, placement, relativeHeight = 251658240) {
|
|
29479
|
+
const holder = wpChildren(drawing).find(
|
|
29480
|
+
(child3) => child3.localName === "inline" || child3.localName === "anchor"
|
|
29481
|
+
);
|
|
29482
|
+
if (!holder) return false;
|
|
29483
|
+
if (!anchored) {
|
|
29484
|
+
if (holder.localName === "anchor") anchorToInline(doc, holder);
|
|
29485
|
+
return true;
|
|
29486
|
+
}
|
|
29487
|
+
const floating = placement ?? { wrap: "none" };
|
|
29488
|
+
if (holder.localName === "inline") inlineToAnchor(doc, holder, floating, relativeHeight);
|
|
29489
|
+
else patchAnchorWrap(doc, holder, floating);
|
|
29490
|
+
return true;
|
|
29491
|
+
}
|
|
29492
|
+
var wrapKey = (anchored, placement) => anchored ? `${placement?.wrap ?? "none"}|${placement?.behindText ? 1 : 0}|${placement?.wrapText ?? ""}` : "inline";
|
|
29493
|
+
function newRelativeHeight(drawing) {
|
|
29494
|
+
const docPr = drawing.getElementsByTagNameNS(WP_NS2, "docPr")[0];
|
|
29495
|
+
return 251658240 + (Number(docPr?.getAttribute("id")) || 0) % 4096 * 1024;
|
|
29496
|
+
}
|
|
29497
|
+
function patchDrawingWrap(drawing, doc, image, base) {
|
|
29498
|
+
const next = wrapKey(image.anchored, image.placement);
|
|
29499
|
+
if (next === (base ? wrapKey(base.anchored, base.placement) : "inline")) return;
|
|
29500
|
+
applyDrawingWrap(
|
|
29501
|
+
drawing,
|
|
29502
|
+
doc,
|
|
29503
|
+
Boolean(image.anchored),
|
|
29504
|
+
image.placement,
|
|
29505
|
+
newRelativeHeight(drawing)
|
|
29506
|
+
);
|
|
29507
|
+
}
|
|
29508
|
+
var POSITION_KEYS = [
|
|
29509
|
+
"relativeFrom",
|
|
29510
|
+
"align",
|
|
29511
|
+
"offsetXPx",
|
|
29512
|
+
"relativeFromV",
|
|
29513
|
+
"alignV",
|
|
29514
|
+
"offsetYPx"
|
|
29515
|
+
];
|
|
29516
|
+
function placementPositionChanged(next, base) {
|
|
29517
|
+
return !base || POSITION_KEYS.some((key) => next[key] !== base[key]);
|
|
29518
|
+
}
|
|
29519
|
+
|
|
29520
|
+
// docx/write-shape.ts
|
|
29521
|
+
var WP_NS3 = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing";
|
|
29522
|
+
var el3 = (doc, ns, name2) => makeNS(doc, ns, name2);
|
|
29305
29523
|
var add2 = (parent, ...items) => {
|
|
29306
29524
|
for (const item2 of items) parent.appendChild(item2);
|
|
29307
29525
|
return parent;
|
|
29308
29526
|
};
|
|
29309
29527
|
var emu2 = (px) => String(Math.max(1, Math.round(px * EMU_PER_PIXEL)));
|
|
29310
|
-
var
|
|
29311
|
-
var attrs2 = (element3, values) => {
|
|
29528
|
+
var attrs3 = (element3, values) => {
|
|
29312
29529
|
for (const [name2, value] of Object.entries(values)) element3.setAttribute(name2, value);
|
|
29313
29530
|
return element3;
|
|
29314
29531
|
};
|
|
@@ -29361,67 +29578,24 @@ function textParagraphs(doc, lines, color) {
|
|
|
29361
29578
|
}
|
|
29362
29579
|
function shapeStyle(doc) {
|
|
29363
29580
|
const ref = (name2, idx, scheme2, shade2) => {
|
|
29364
|
-
const node =
|
|
29365
|
-
const color =
|
|
29366
|
-
if (shade2) add2(color,
|
|
29581
|
+
const node = attrs3(el3(doc, A_NS2, `a:${name2}`), { idx });
|
|
29582
|
+
const color = attrs3(el3(doc, A_NS2, "a:schemeClr"), { val: scheme2 });
|
|
29583
|
+
if (shade2) add2(color, attrs3(el3(doc, A_NS2, "a:shade"), { val: shade2 }));
|
|
29367
29584
|
return add2(node, color);
|
|
29368
29585
|
};
|
|
29369
29586
|
return add2(
|
|
29370
|
-
|
|
29587
|
+
el3(doc, WPS_NS2, "wps:style"),
|
|
29371
29588
|
ref("lnRef", "2", "accent1", "50000"),
|
|
29372
29589
|
ref("fillRef", "1", "accent1"),
|
|
29373
29590
|
ref("effectRef", "0", "accent1"),
|
|
29374
29591
|
ref("fontRef", "minor", "lt1")
|
|
29375
29592
|
);
|
|
29376
29593
|
}
|
|
29377
|
-
function wrapElement(doc, placement) {
|
|
29378
|
-
switch (placement.wrap) {
|
|
29379
|
-
case "square":
|
|
29380
|
-
return attrs2(el2(doc, WP_NS2, "wp:wrapSquare"), { wrapText: "bothSides" });
|
|
29381
|
-
case "tight":
|
|
29382
|
-
case "through": {
|
|
29383
|
-
const wrap = attrs2(
|
|
29384
|
-
el2(doc, WP_NS2, `wp:wrap${placement.wrap === "tight" ? "Tight" : "Through"}`),
|
|
29385
|
-
{
|
|
29386
|
-
wrapText: "bothSides"
|
|
29387
|
-
}
|
|
29388
|
-
);
|
|
29389
|
-
const polygon = attrs2(el2(doc, WP_NS2, "wp:wrapPolygon"), { edited: "0" });
|
|
29390
|
-
const point = (name2, x, y) => attrs2(el2(doc, WP_NS2, `wp:${name2}`), { x, y });
|
|
29391
|
-
return add2(
|
|
29392
|
-
wrap,
|
|
29393
|
-
add2(
|
|
29394
|
-
polygon,
|
|
29395
|
-
point("start", "0", "0"),
|
|
29396
|
-
point("lineTo", "0", "21600"),
|
|
29397
|
-
point("lineTo", "21600", "21600"),
|
|
29398
|
-
point("lineTo", "21600", "0"),
|
|
29399
|
-
point("lineTo", "0", "0")
|
|
29400
|
-
)
|
|
29401
|
-
);
|
|
29402
|
-
}
|
|
29403
|
-
case "topAndBottom":
|
|
29404
|
-
return el2(doc, WP_NS2, "wp:wrapTopAndBottom");
|
|
29405
|
-
default:
|
|
29406
|
-
return el2(doc, WP_NS2, "wp:wrapNone");
|
|
29407
|
-
}
|
|
29408
|
-
}
|
|
29409
|
-
function position(doc, axis, relativeFrom, align, offsetPx) {
|
|
29410
|
-
const node = attrs2(el2(doc, WP_NS2, `wp:position${axis}`), { relativeFrom });
|
|
29411
|
-
if (align) {
|
|
29412
|
-
const a = el2(doc, WP_NS2, "wp:align");
|
|
29413
|
-
a.textContent = align;
|
|
29414
|
-
return add2(node, a);
|
|
29415
|
-
}
|
|
29416
|
-
const offset = el2(doc, WP_NS2, "wp:posOffset");
|
|
29417
|
-
offset.textContent = emuOffset(offsetPx ?? 0);
|
|
29418
|
-
return add2(node, offset);
|
|
29419
|
-
}
|
|
29420
29594
|
function geometry(doc, spec) {
|
|
29421
|
-
const prst =
|
|
29422
|
-
const avLst =
|
|
29595
|
+
const prst = attrs3(el3(doc, A_NS2, "a:prstGeom"), { prst: spec.preset });
|
|
29596
|
+
const avLst = el3(doc, A_NS2, "a:avLst");
|
|
29423
29597
|
for (const [name2, value] of Object.entries(spec.adjustments ?? {}))
|
|
29424
|
-
add2(avLst,
|
|
29598
|
+
add2(avLst, attrs3(el3(doc, A_NS2, "a:gd"), { name: name2, fmla: `val ${Math.round(value)}` }));
|
|
29425
29599
|
const nodes = spec.customGeometryXml ? importFragment(doc, spec.customGeometryXml) : [add2(prst, avLst)];
|
|
29426
29600
|
if (spec.fill) {
|
|
29427
29601
|
const xml = drawingFillXml(spec.fill);
|
|
@@ -29435,9 +29609,9 @@ function buildShapeDrawing(doc, image, identity, relativeHeight = 251658240) {
|
|
|
29435
29609
|
const drawing = makeW(doc, "drawing");
|
|
29436
29610
|
const placement = image.placement;
|
|
29437
29611
|
const anchored = Boolean(image.anchored);
|
|
29438
|
-
const holder =
|
|
29612
|
+
const holder = el3(doc, WP_NS3, anchored ? "wp:anchor" : "wp:inline");
|
|
29439
29613
|
if (anchored) {
|
|
29440
|
-
|
|
29614
|
+
attrs3(holder, {
|
|
29441
29615
|
distT: "0",
|
|
29442
29616
|
distB: "0",
|
|
29443
29617
|
distL: "114300",
|
|
@@ -29451,15 +29625,15 @@ function buildShapeDrawing(doc, image, identity, relativeHeight = 251658240) {
|
|
|
29451
29625
|
});
|
|
29452
29626
|
add2(
|
|
29453
29627
|
holder,
|
|
29454
|
-
|
|
29455
|
-
|
|
29628
|
+
attrs3(el3(doc, WP_NS3, "wp:simplePos"), { x: "0", y: "0" }),
|
|
29629
|
+
positionElement(
|
|
29456
29630
|
doc,
|
|
29457
29631
|
"H",
|
|
29458
29632
|
placement?.relativeFrom ?? "column",
|
|
29459
29633
|
placement?.align,
|
|
29460
29634
|
placement?.offsetXPx
|
|
29461
29635
|
),
|
|
29462
|
-
|
|
29636
|
+
positionElement(
|
|
29463
29637
|
doc,
|
|
29464
29638
|
"V",
|
|
29465
29639
|
placement?.relativeFromV ?? "paragraph",
|
|
@@ -29470,40 +29644,40 @@ function buildShapeDrawing(doc, image, identity, relativeHeight = 251658240) {
|
|
|
29470
29644
|
} else for (const side of ["distT", "distB", "distL", "distR"]) holder.setAttribute(side, "0");
|
|
29471
29645
|
add2(
|
|
29472
29646
|
holder,
|
|
29473
|
-
|
|
29474
|
-
|
|
29647
|
+
attrs3(el3(doc, WP_NS3, "wp:extent"), { cx: emu2(image.widthPx), cy: emu2(image.heightPx) }),
|
|
29648
|
+
attrs3(el3(doc, WP_NS3, "wp:effectExtent"), { l: "0", t: "0", r: "0", b: "0" })
|
|
29475
29649
|
);
|
|
29476
29650
|
if (anchored) add2(holder, wrapElement(doc, placement ?? { wrap: "none" }));
|
|
29477
|
-
const docPr =
|
|
29651
|
+
const docPr = attrs3(el3(doc, WP_NS3, "wp:docPr"), {
|
|
29478
29652
|
id: identity.id,
|
|
29479
29653
|
name: identity.name ?? `Shape ${identity.id}`
|
|
29480
29654
|
});
|
|
29481
29655
|
if (identity.descr) docPr.setAttribute("descr", identity.descr);
|
|
29482
29656
|
if (identity.title) docPr.setAttribute("title", identity.title);
|
|
29483
|
-
const xfrm =
|
|
29657
|
+
const xfrm = attrs3(el3(doc, A_NS2, "a:xfrm"), {});
|
|
29484
29658
|
if (spec.rotation) xfrm.setAttribute("rot", String(Math.round(spec.rotation * 6e4)));
|
|
29485
29659
|
if (spec.flipH) xfrm.setAttribute("flipH", "1");
|
|
29486
29660
|
if (spec.flipV) xfrm.setAttribute("flipV", "1");
|
|
29487
29661
|
add2(
|
|
29488
29662
|
xfrm,
|
|
29489
|
-
|
|
29490
|
-
|
|
29663
|
+
attrs3(el3(doc, A_NS2, "a:off"), { x: "0", y: "0" }),
|
|
29664
|
+
attrs3(el3(doc, A_NS2, "a:ext"), { cx: emu2(image.widthPx), cy: emu2(image.heightPx) })
|
|
29491
29665
|
);
|
|
29492
|
-
const spPr = add2(
|
|
29666
|
+
const spPr = add2(el3(doc, WPS_NS2, "wps:spPr"), xfrm, ...geometry(doc, spec));
|
|
29493
29667
|
const wsp = add2(
|
|
29494
|
-
|
|
29495
|
-
|
|
29668
|
+
el3(doc, WPS_NS2, "wps:wsp"),
|
|
29669
|
+
el3(doc, WPS_NS2, "wps:cNvSpPr"),
|
|
29496
29670
|
spPr,
|
|
29497
29671
|
shapeStyle(doc)
|
|
29498
29672
|
);
|
|
29499
29673
|
if (spec.text?.length) {
|
|
29500
29674
|
const content = add2(
|
|
29501
|
-
|
|
29675
|
+
el3(doc, W_NS2, "w:txbxContent"),
|
|
29502
29676
|
...textParagraphs(doc, spec.text, explicitTextColor(spec))
|
|
29503
29677
|
);
|
|
29504
|
-
add2(wsp, add2(
|
|
29678
|
+
add2(wsp, add2(el3(doc, WPS_NS2, "wps:txbx"), content));
|
|
29505
29679
|
}
|
|
29506
|
-
const body =
|
|
29680
|
+
const body = attrs3(el3(doc, WPS_NS2, "wps:bodyPr"), {
|
|
29507
29681
|
rot: "0",
|
|
29508
29682
|
vert: "horz",
|
|
29509
29683
|
wrap: "square",
|
|
@@ -29514,26 +29688,26 @@ function buildShapeDrawing(doc, image, identity, relativeHeight = 251658240) {
|
|
|
29514
29688
|
anchor: "ctr",
|
|
29515
29689
|
anchorCtr: "0"
|
|
29516
29690
|
});
|
|
29517
|
-
add2(wsp, add2(body,
|
|
29518
|
-
const graphicData =
|
|
29691
|
+
add2(wsp, add2(body, el3(doc, A_NS2, "a:noAutofit")));
|
|
29692
|
+
const graphicData = attrs3(el3(doc, A_NS2, "a:graphicData"), { uri: WPS_NS2 });
|
|
29519
29693
|
add2(
|
|
29520
29694
|
holder,
|
|
29521
29695
|
docPr,
|
|
29522
|
-
|
|
29523
|
-
add2(
|
|
29696
|
+
el3(doc, WP_NS3, "wp:cNvGraphicFramePr"),
|
|
29697
|
+
add2(el3(doc, A_NS2, "a:graphic"), add2(graphicData, wsp))
|
|
29524
29698
|
);
|
|
29525
29699
|
return add2(drawing, holder);
|
|
29526
29700
|
}
|
|
29527
29701
|
var firstNs = (root, ns, local) => root.getElementsByTagNameNS(ns, local)[0];
|
|
29528
29702
|
function rebuildShapeDrawing(doc, image, old) {
|
|
29529
|
-
const oldDocPr = firstNs(old,
|
|
29703
|
+
const oldDocPr = firstNs(old, WP_NS3, "docPr");
|
|
29530
29704
|
const identity = {
|
|
29531
29705
|
id: oldDocPr?.getAttribute("id") ?? "1",
|
|
29532
29706
|
...oldDocPr?.getAttribute("name") ? { name: oldDocPr.getAttribute("name") } : {},
|
|
29533
29707
|
...oldDocPr?.getAttribute("descr") ? { descr: oldDocPr.getAttribute("descr") } : {},
|
|
29534
29708
|
...oldDocPr?.getAttribute("title") ? { title: oldDocPr.getAttribute("title") } : {}
|
|
29535
29709
|
};
|
|
29536
|
-
const oldAnchor = firstNs(old,
|
|
29710
|
+
const oldAnchor = firstNs(old, WP_NS3, "anchor");
|
|
29537
29711
|
const relativeHeight = Number(oldAnchor?.getAttribute("relativeHeight")) || void 0;
|
|
29538
29712
|
const next = buildShapeDrawing(doc, image, identity, relativeHeight);
|
|
29539
29713
|
const wsp = firstNs(next, WPS_NS2, "wsp");
|
|
@@ -29555,7 +29729,7 @@ function rebuildShapeDrawing(doc, image, old) {
|
|
|
29555
29729
|
|
|
29556
29730
|
// docx/write-drawing-patch.ts
|
|
29557
29731
|
var A_NS3 = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
29558
|
-
var
|
|
29732
|
+
var WP_NS4 = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing";
|
|
29559
29733
|
function walk2(root, visit) {
|
|
29560
29734
|
const stack = [root];
|
|
29561
29735
|
while (stack.length) {
|
|
@@ -29568,7 +29742,7 @@ function updateExtent(drawing, widthPx, heightPx) {
|
|
|
29568
29742
|
const cx = String(Math.max(1, Math.round(widthPx * EMU_PER_PIXEL)));
|
|
29569
29743
|
const cy = String(Math.max(1, Math.round(heightPx * EMU_PER_PIXEL)));
|
|
29570
29744
|
walk2(drawing, (node) => {
|
|
29571
|
-
const isExtent = node.namespaceURI ===
|
|
29745
|
+
const isExtent = node.namespaceURI === WP_NS4 && node.localName === "extent";
|
|
29572
29746
|
const parent = node.parentNode;
|
|
29573
29747
|
const isExt = node.namespaceURI === A_NS3 && node.localName === "ext" && parent?.namespaceURI === A_NS3 && parent.localName === "xfrm";
|
|
29574
29748
|
if (isExtent || isExt) {
|
|
@@ -29579,7 +29753,7 @@ function updateExtent(drawing, widthPx, heightPx) {
|
|
|
29579
29753
|
}
|
|
29580
29754
|
function updateDocPr(drawing, altText, title) {
|
|
29581
29755
|
walk2(drawing, (node) => {
|
|
29582
|
-
if (node.namespaceURI !==
|
|
29756
|
+
if (node.namespaceURI !== WP_NS4 || node.localName !== "docPr") return;
|
|
29583
29757
|
if (altText) node.setAttribute("descr", altText);
|
|
29584
29758
|
else node.removeAttribute("descr");
|
|
29585
29759
|
if (title) node.setAttribute("title", title);
|
|
@@ -29587,21 +29761,21 @@ function updateDocPr(drawing, altText, title) {
|
|
|
29587
29761
|
});
|
|
29588
29762
|
}
|
|
29589
29763
|
function patchPosition(doc, anchor, name2, relativeFrom, align, offsetPx) {
|
|
29590
|
-
const
|
|
29591
|
-
(child3) => isElement(child3) && child3.namespaceURI ===
|
|
29764
|
+
const position = Array.from(anchor.childNodes).find(
|
|
29765
|
+
(child3) => isElement(child3) && child3.namespaceURI === WP_NS4 && child3.localName === name2
|
|
29592
29766
|
);
|
|
29593
|
-
if (!
|
|
29594
|
-
if (relativeFrom)
|
|
29595
|
-
for (const child3 of Array.from(
|
|
29596
|
-
const value = align ? makeNS(doc,
|
|
29767
|
+
if (!position) return;
|
|
29768
|
+
if (relativeFrom) position.setAttribute("relativeFrom", relativeFrom);
|
|
29769
|
+
for (const child3 of Array.from(position.childNodes)) position.removeChild(child3);
|
|
29770
|
+
const value = align ? makeNS(doc, WP_NS4, "wp:align") : makeNS(doc, WP_NS4, "wp:posOffset");
|
|
29597
29771
|
value.appendChild(
|
|
29598
29772
|
doc.createTextNode(align ?? String(Math.round((offsetPx ?? 0) * EMU_PER_PIXEL)))
|
|
29599
29773
|
);
|
|
29600
|
-
|
|
29774
|
+
position.appendChild(value);
|
|
29601
29775
|
}
|
|
29602
29776
|
function updatePlacement(drawing, doc, placement) {
|
|
29603
29777
|
walk2(drawing, (node) => {
|
|
29604
|
-
if (node.namespaceURI !==
|
|
29778
|
+
if (node.namespaceURI !== WP_NS4 || node.localName !== "anchor") return;
|
|
29605
29779
|
patchPosition(
|
|
29606
29780
|
doc,
|
|
29607
29781
|
node,
|
|
@@ -29667,6 +29841,12 @@ function patchFallbackSize(content, image, base) {
|
|
|
29667
29841
|
}
|
|
29668
29842
|
}
|
|
29669
29843
|
|
|
29844
|
+
// docx/hyperlink.ts
|
|
29845
|
+
var WORD_EXTRA_LINK_SCHEMES = ["tel", "ftp"];
|
|
29846
|
+
function isWordNavigableHref(href) {
|
|
29847
|
+
return typeof href === "string" && hyperlinkPolicy(href, { additionalOpenSchemes: WORD_EXTRA_LINK_SCHEMES }).open;
|
|
29848
|
+
}
|
|
29849
|
+
|
|
29670
29850
|
// docx/chart-ex-edit.ts
|
|
29671
29851
|
function isDocxChartExEditable(chart) {
|
|
29672
29852
|
return !!chart?.chartExSpace && chart.issues.every((issue) => issue.code === "CHARTEX_FAMILY_NOT_DRAWN");
|
|
@@ -29676,13 +29856,13 @@ function isDocxChartExEditable(chart) {
|
|
|
29676
29856
|
function isDocxChartEditable(chart) {
|
|
29677
29857
|
return Boolean(chart?.chartSpace) && !chart?.layoutId && !chart?.chartEx && chartIssuesLostOnWrite(chart?.issues ?? []).length === 0;
|
|
29678
29858
|
}
|
|
29679
|
-
var
|
|
29859
|
+
var WP_NS6 = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing";
|
|
29680
29860
|
var EMU_PER_PIXEL2 = 9525;
|
|
29681
29861
|
function isSameDiagram(base, next) {
|
|
29682
29862
|
return Boolean(base?.parts.data?.partName) && base?.parts.data?.partName === next.parts.data?.partName && !next.inserted;
|
|
29683
29863
|
}
|
|
29684
29864
|
function patchDiagramExtent(drawing, widthPx, heightPx) {
|
|
29685
|
-
const extent = drawing.getElementsByTagNameNS(
|
|
29865
|
+
const extent = drawing.getElementsByTagNameNS(WP_NS6, "extent")[0];
|
|
29686
29866
|
if (!extent) return;
|
|
29687
29867
|
extent.setAttribute("cx", String(Math.max(1, Math.round(widthPx * EMU_PER_PIXEL2))));
|
|
29688
29868
|
extent.setAttribute("cy", String(Math.max(1, Math.round(heightPx * EMU_PER_PIXEL2))));
|
|
@@ -29769,6 +29949,9 @@ function createImageRun(doc, image, base, old, allocator) {
|
|
|
29769
29949
|
if (!base && image.shape?.editable && !image.partName) {
|
|
29770
29950
|
throw new Error("Cannot insert a shape without an id allocator.");
|
|
29771
29951
|
}
|
|
29952
|
+
if (image.pictureWatermark) {
|
|
29953
|
+
throw new Error("Cannot insert a picture watermark without a relationship allocator.");
|
|
29954
|
+
}
|
|
29772
29955
|
if (image.watermark) {
|
|
29773
29956
|
clearNonProperties(node);
|
|
29774
29957
|
node.appendChild(
|
|
@@ -29783,7 +29966,7 @@ function createImageRun(doc, image, base, old, allocator) {
|
|
|
29783
29966
|
if (image.pictureFill && JSON.stringify(image.pictureFill) !== JSON.stringify(base.pictureFill)) {
|
|
29784
29967
|
const fill = oldDrawing.getElementsByTagNameNS(PIC_NS, "blipFill")[0];
|
|
29785
29968
|
const blip = fill?.getElementsByTagNameNS(A_NS6, "blip")[0];
|
|
29786
|
-
if (fill && image.pictureFill.crop !== void 0)
|
|
29969
|
+
if (fill && (image.pictureFill.crop !== void 0 || base.pictureFill?.crop))
|
|
29787
29970
|
applyPictureCrop(fill, image.pictureFill.crop);
|
|
29788
29971
|
if (blip && image.pictureFill.effects !== void 0)
|
|
29789
29972
|
applyPictureEffects(blip, image.pictureFill.effects);
|
|
@@ -29794,7 +29977,8 @@ function createImageRun(doc, image, base, old, allocator) {
|
|
|
29794
29977
|
updateExtent(oldDrawing, image.widthPx, image.heightPx);
|
|
29795
29978
|
if (image.altText !== base.altText || image.title !== base.title)
|
|
29796
29979
|
updateDocPr(oldDrawing, image.altText, image.title);
|
|
29797
|
-
|
|
29980
|
+
patchDrawingWrap(oldDrawing, doc, image, base);
|
|
29981
|
+
if (image.anchored && image.placement && placementPositionChanged(image.placement, base.placement))
|
|
29798
29982
|
updatePlacement(oldDrawing, doc, image.placement);
|
|
29799
29983
|
clearNonProperties(node, oldContainer);
|
|
29800
29984
|
return node;
|
|
@@ -29871,8 +30055,11 @@ function revisionWrapper(doc, revision, content) {
|
|
|
29871
30055
|
return wrapper;
|
|
29872
30056
|
}
|
|
29873
30057
|
function convertToDeleteText(doc, run) {
|
|
29874
|
-
for (const t of children2(run, "t")) {
|
|
29875
|
-
const delText = doc.createElementNS(
|
|
30058
|
+
for (const t of [...children2(run, "t"), ...children2(run, "instrText")]) {
|
|
30059
|
+
const delText = doc.createElementNS(
|
|
30060
|
+
WORD_NS,
|
|
30061
|
+
t.localName === "instrText" ? "w:delInstrText" : "w:delText"
|
|
30062
|
+
);
|
|
29876
30063
|
const space = t.getAttributeNS("http://www.w3.org/XML/1998/namespace", "space");
|
|
29877
30064
|
if (space) delText.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", space);
|
|
29878
30065
|
while (t.firstChild) delText.appendChild(t.firstChild);
|
|
@@ -29922,6 +30109,24 @@ var WORD_HIGHLIGHT_TOKENS = [
|
|
|
29922
30109
|
function isWordHighlightToken(value) {
|
|
29923
30110
|
return WORD_HIGHLIGHT_TOKENS.includes(value);
|
|
29924
30111
|
}
|
|
30112
|
+
var wordHighlightColors = {
|
|
30113
|
+
black: "#000000",
|
|
30114
|
+
blue: "#0000ff",
|
|
30115
|
+
cyan: "#00ffff",
|
|
30116
|
+
green: "#00ff00",
|
|
30117
|
+
magenta: "#ff00ff",
|
|
30118
|
+
red: "#ff0000",
|
|
30119
|
+
yellow: "#ffff00",
|
|
30120
|
+
white: "#ffffff",
|
|
30121
|
+
darkBlue: "#000080",
|
|
30122
|
+
darkCyan: "#008080",
|
|
30123
|
+
darkGreen: "#008000",
|
|
30124
|
+
darkMagenta: "#800080",
|
|
30125
|
+
darkRed: "#800000",
|
|
30126
|
+
darkYellow: "#808000",
|
|
30127
|
+
darkGray: "#808080",
|
|
30128
|
+
lightGray: "#c0c0c0"
|
|
30129
|
+
};
|
|
29925
30130
|
|
|
29926
30131
|
// docx/language.ts
|
|
29927
30132
|
function isValidLanguageTag(value) {
|
|
@@ -30413,12 +30618,24 @@ function createRun(doc, run, base, old, allocator) {
|
|
|
30413
30618
|
return node;
|
|
30414
30619
|
}
|
|
30415
30620
|
|
|
30621
|
+
// docx/run-properties-snapshot.ts
|
|
30622
|
+
function runPropertiesElement(source) {
|
|
30623
|
+
const run = { ...source, text: "" };
|
|
30624
|
+
delete run.image;
|
|
30625
|
+
delete run.equation;
|
|
30626
|
+
delete run.revision;
|
|
30627
|
+
delete run.formatRevision;
|
|
30628
|
+
const doc = parseXml2(`<w:r xmlns:w="${WORD_NS}"/>`);
|
|
30629
|
+
return first2(createRun(doc, run), "rPr") ?? makeW(doc, "rPr");
|
|
30630
|
+
}
|
|
30631
|
+
|
|
30416
30632
|
// docx/character-styles.ts
|
|
30417
30633
|
function styleElements(document) {
|
|
30418
30634
|
return Array.from(document.getElementsByTagName("*")).filter(
|
|
30419
30635
|
(element3) => named2(element3, "style") && (getW(element3, "type") === "character" || getW(element3, "type") === "paragraph")
|
|
30420
30636
|
);
|
|
30421
30637
|
}
|
|
30638
|
+
var eastAsiaLanguageOf = (rPr) => getW(first2(rPr, "lang"), "eastAsia");
|
|
30422
30639
|
function parseRunStyleCatalog(xml) {
|
|
30423
30640
|
const document = parseXml2(xml);
|
|
30424
30641
|
const defaults = first2(first2(document.documentElement, "docDefaults"), "rPrDefault");
|
|
@@ -30431,6 +30648,7 @@ function parseRunStyleCatalog(xml) {
|
|
|
30431
30648
|
const linkedStyle = getW(first2(element3, "link"), "val");
|
|
30432
30649
|
const isDefault = parseOnOff(getW(element3, "default"));
|
|
30433
30650
|
const name2 = getW(first2(element3, "name"), "val");
|
|
30651
|
+
const eastAsiaLanguage = eastAsiaLanguageOf(first2(element3, "rPr"));
|
|
30434
30652
|
styles[id] = {
|
|
30435
30653
|
id,
|
|
30436
30654
|
type,
|
|
@@ -30438,7 +30656,8 @@ function parseRunStyleCatalog(xml) {
|
|
|
30438
30656
|
...basedOn ? { basedOn } : {},
|
|
30439
30657
|
...linkedStyle ? { linkedStyle } : {},
|
|
30440
30658
|
...isDefault === void 0 ? {} : { isDefault },
|
|
30441
|
-
formatting: parseRunProperties(first2(element3, "rPr"))
|
|
30659
|
+
formatting: parseRunProperties(first2(element3, "rPr")),
|
|
30660
|
+
...eastAsiaLanguage ? { eastAsiaLanguage } : {}
|
|
30442
30661
|
};
|
|
30443
30662
|
}
|
|
30444
30663
|
const warnings = [];
|
|
@@ -30456,8 +30675,10 @@ function parseRunStyleCatalog(xml) {
|
|
|
30456
30675
|
parent = styles[parent]?.basedOn;
|
|
30457
30676
|
}
|
|
30458
30677
|
}
|
|
30678
|
+
const docDefaultsEastAsiaLanguage = eastAsiaLanguageOf(first2(defaults, "rPr"));
|
|
30459
30679
|
return {
|
|
30460
30680
|
docDefaults: parseRunProperties(first2(defaults, "rPr")),
|
|
30681
|
+
...docDefaultsEastAsiaLanguage ? { docDefaultsEastAsiaLanguage } : {},
|
|
30461
30682
|
styles,
|
|
30462
30683
|
warnings: [...new Set(warnings)]
|
|
30463
30684
|
};
|
|
@@ -30572,6 +30793,12 @@ var PAGINATION_KEYS = [
|
|
|
30572
30793
|
"contextualSpacing",
|
|
30573
30794
|
"suppressLineNumbers"
|
|
30574
30795
|
];
|
|
30796
|
+
var EAST_ASIAN_TYPOGRAPHY_KEYS = [
|
|
30797
|
+
"kinsoku",
|
|
30798
|
+
"autoSpaceDE",
|
|
30799
|
+
"autoSpaceDN",
|
|
30800
|
+
"overflowPunct"
|
|
30801
|
+
];
|
|
30575
30802
|
function parseOutlineLevel(element3) {
|
|
30576
30803
|
const raw = getW(element3, "val");
|
|
30577
30804
|
if (raw === void 0) return void 0;
|
|
@@ -30588,7 +30815,7 @@ function parseFormatting(pPr) {
|
|
|
30588
30815
|
if (bidi !== void 0) result.direction = bidi ? "rtl" : "ltr";
|
|
30589
30816
|
const pageBreakBefore = enabled(first2(pPr, "pageBreakBefore"));
|
|
30590
30817
|
if (pageBreakBefore !== void 0) result.pageBreakBefore = pageBreakBefore;
|
|
30591
|
-
for (const key of PAGINATION_KEYS) {
|
|
30818
|
+
for (const key of [...PAGINATION_KEYS, ...EAST_ASIAN_TYPOGRAPHY_KEYS]) {
|
|
30592
30819
|
const value = enabled(first2(pPr, key));
|
|
30593
30820
|
if (value !== void 0) result[key] = value;
|
|
30594
30821
|
}
|
|
@@ -30695,6 +30922,36 @@ function resolveStyleNumbering(styleId, catalog) {
|
|
|
30695
30922
|
return chain.find((style) => style.numbering)?.numbering;
|
|
30696
30923
|
}
|
|
30697
30924
|
|
|
30925
|
+
// docx/table-margins.ts
|
|
30926
|
+
function parseCellMargins(element3) {
|
|
30927
|
+
if (!element3) return void 0;
|
|
30928
|
+
const parsed = {};
|
|
30929
|
+
for (const [side, logical] of [
|
|
30930
|
+
["top", "top"],
|
|
30931
|
+
["bottom", "bottom"],
|
|
30932
|
+
["left", "start"],
|
|
30933
|
+
["right", "end"]
|
|
30934
|
+
]) {
|
|
30935
|
+
const edge = first2(element3, logical) ?? first2(element3, side);
|
|
30936
|
+
const type = getW(edge, "type") ?? "dxa";
|
|
30937
|
+
const value = type === "nil" ? parseSignedTwips("0") : type === "dxa" ? parseSignedTwips(getW(edge, "w")) : void 0;
|
|
30938
|
+
if (value !== void 0) parsed[side] = value;
|
|
30939
|
+
}
|
|
30940
|
+
return Object.keys(parsed).length ? parsed : void 0;
|
|
30941
|
+
}
|
|
30942
|
+
({
|
|
30943
|
+
top: signedTwips(0),
|
|
30944
|
+
right: signedTwips(108),
|
|
30945
|
+
bottom: signedTwips(0),
|
|
30946
|
+
left: signedTwips(108)
|
|
30947
|
+
});
|
|
30948
|
+
({
|
|
30949
|
+
top: signedTwips(0),
|
|
30950
|
+
right: signedTwips(10),
|
|
30951
|
+
bottom: signedTwips(0),
|
|
30952
|
+
left: signedTwips(10)
|
|
30953
|
+
});
|
|
30954
|
+
|
|
30698
30955
|
// docx/table-styles.ts
|
|
30699
30956
|
var REGIONS = [
|
|
30700
30957
|
"wholeTable",
|
|
@@ -30738,6 +30995,7 @@ function parseTableStyleCatalog(xml) {
|
|
|
30738
30995
|
const tblPr = first2(element3, "tblPr");
|
|
30739
30996
|
const borders = parseTableBorders(first2(tblPr, "tblBorders"));
|
|
30740
30997
|
const shadingFill = parseShadingFill(first2(tblPr, "shd"));
|
|
30998
|
+
const cellMargins = parseCellMargins(first2(tblPr, "tblCellMar"));
|
|
30741
30999
|
const conditional = {};
|
|
30742
31000
|
for (const block of children2(element3, "tblStylePr")) {
|
|
30743
31001
|
const type = getW(block, "type");
|
|
@@ -30751,6 +31009,7 @@ function parseTableStyleCatalog(xml) {
|
|
|
30751
31009
|
...isDefault === void 0 ? {} : { isDefault },
|
|
30752
31010
|
...borders ? { borders } : {},
|
|
30753
31011
|
...shadingFill ? { shadingFill } : {},
|
|
31012
|
+
...cellMargins ? { cellMargins } : {},
|
|
30754
31013
|
conditional
|
|
30755
31014
|
};
|
|
30756
31015
|
}
|
|
@@ -31404,15 +31663,15 @@ function writeCheckbox(doc, sdtPr, control) {
|
|
|
31404
31663
|
const siblings = Array.from(box.childNodes);
|
|
31405
31664
|
box.insertBefore(element3, siblings[order] ?? null);
|
|
31406
31665
|
};
|
|
31407
|
-
replace("checked", (
|
|
31666
|
+
replace("checked", (el6) => w14Attribute(el6, "val", control.checked ? "1" : "0"), 0);
|
|
31408
31667
|
const states = [validGlyph(control.checkedGlyph), validGlyph(control.uncheckedGlyph)];
|
|
31409
31668
|
states.forEach((glyph2, index) => {
|
|
31410
31669
|
if (glyph2)
|
|
31411
31670
|
replace(
|
|
31412
31671
|
index ? "uncheckedState" : "checkedState",
|
|
31413
|
-
(
|
|
31414
|
-
w14Attribute(
|
|
31415
|
-
if (glyph2.font) w14Attribute(
|
|
31672
|
+
(el6) => {
|
|
31673
|
+
w14Attribute(el6, "val", glyph2.code);
|
|
31674
|
+
if (glyph2.font) w14Attribute(el6, "font", glyph2.font);
|
|
31416
31675
|
},
|
|
31417
31676
|
index + 1
|
|
31418
31677
|
);
|
|
@@ -31707,7 +31966,7 @@ function shifted(change, by, from, to, limits) {
|
|
|
31707
31966
|
}
|
|
31708
31967
|
function swallowed(change, markers) {
|
|
31709
31968
|
return markers.filter(
|
|
31710
|
-
({ position
|
|
31969
|
+
({ position, opening }) => opening ? position >= change.fromStart && position < change.fromEnd : position > change.fromStart && position <= change.fromEnd
|
|
31711
31970
|
).length;
|
|
31712
31971
|
}
|
|
31713
31972
|
function placeChange(change, from, to, limits, markers) {
|
|
@@ -31724,7 +31983,7 @@ function placeChange(change, from, to, limits, markers) {
|
|
|
31724
31983
|
placements.push(right);
|
|
31725
31984
|
right = shifted(right, 1, from, to, limits);
|
|
31726
31985
|
}
|
|
31727
|
-
const keepsOut = ({ position
|
|
31986
|
+
const keepsOut = ({ position, opening, exact }) => exact || (opening ? position > 0 : position < from.length);
|
|
31728
31987
|
if (insertion)
|
|
31729
31988
|
return placements.find(
|
|
31730
31989
|
(placement) => markers.some((marker) => marker.position === placement.fromStart && keepsOut(marker))
|
|
@@ -31757,24 +32016,24 @@ function moveMarkers(before, after, markers) {
|
|
|
31757
32016
|
)
|
|
31758
32017
|
);
|
|
31759
32018
|
}
|
|
31760
|
-
const move = ({ position
|
|
31761
|
-
if (!exact && opening &&
|
|
31762
|
-
if (!exact && !opening &&
|
|
32019
|
+
const move = ({ position, opening, exact }) => {
|
|
32020
|
+
if (!exact && opening && position === 0) return 0;
|
|
32021
|
+
if (!exact && !opening && position === from.length) return to.length;
|
|
31763
32022
|
let shift = 0;
|
|
31764
32023
|
for (const [index, change] of changes.entries()) {
|
|
31765
|
-
if (
|
|
31766
|
-
if (
|
|
32024
|
+
if (position < change.fromStart) break;
|
|
32025
|
+
if (position > change.fromEnd) {
|
|
31767
32026
|
shift = change.toEnd - change.fromEnd;
|
|
31768
32027
|
continue;
|
|
31769
32028
|
}
|
|
31770
32029
|
const next = changes[index + 1];
|
|
31771
|
-
const inserted = change.fromStart === change.fromEnd ? change :
|
|
32030
|
+
const inserted = change.fromStart === change.fromEnd ? change : position === change.fromEnd && next?.fromStart === position && next.fromEnd === position ? next : void 0;
|
|
31772
32031
|
if (inserted) return opening ? inserted.toEnd : inserted.toStart;
|
|
31773
|
-
if (
|
|
31774
|
-
if (
|
|
32032
|
+
if (position === change.fromStart) return change.toStart;
|
|
32033
|
+
if (position === change.fromEnd) return change.toEnd;
|
|
31775
32034
|
return opening ? change.toStart : change.toEnd;
|
|
31776
32035
|
}
|
|
31777
|
-
return
|
|
32036
|
+
return position + shift;
|
|
31778
32037
|
};
|
|
31779
32038
|
return markers.map((marker) => ({ ...marker, position: move(marker) }));
|
|
31780
32039
|
}
|
|
@@ -31847,21 +32106,21 @@ function orderRangeEnds(markers) {
|
|
|
31847
32106
|
function placeMarkers(paragraph, markers, runs, placed, containers) {
|
|
31848
32107
|
const positions = runPositions(runs);
|
|
31849
32108
|
const pieces = /* @__PURE__ */ new Map();
|
|
31850
|
-
const insideRun = (index,
|
|
32109
|
+
const insideRun = (index, position, element3) => {
|
|
31851
32110
|
const run = placed[index]?.splittable;
|
|
31852
32111
|
if (!run) return false;
|
|
31853
32112
|
const parts = pieces.get(index) ?? [{ element: run, start: positions[index] }];
|
|
31854
32113
|
pieces.set(index, parts);
|
|
31855
32114
|
let at = parts.length - 1;
|
|
31856
|
-
while (at > 0 && parts[at].start >
|
|
32115
|
+
while (at > 0 && parts[at].start > position) at--;
|
|
31857
32116
|
const part = parts[at];
|
|
31858
|
-
if (part.start ===
|
|
32117
|
+
if (part.start === position) {
|
|
31859
32118
|
part.element.parentNode.insertBefore(element3, part.element);
|
|
31860
32119
|
return true;
|
|
31861
32120
|
}
|
|
31862
|
-
const second = splitRun(part.element,
|
|
32121
|
+
const second = splitRun(part.element, position - part.start);
|
|
31863
32122
|
if (!second) return false;
|
|
31864
|
-
parts.splice(at + 1, 0, { element: second, start:
|
|
32123
|
+
parts.splice(at + 1, 0, { element: second, start: position });
|
|
31865
32124
|
const written = placed[index];
|
|
31866
32125
|
if (written?.last === part.element) written.last = second;
|
|
31867
32126
|
second.parentNode.insertBefore(element3, second);
|
|
@@ -32431,7 +32690,8 @@ function runIsSafe(run) {
|
|
|
32431
32690
|
const [ffData] = data;
|
|
32432
32691
|
return type === "begin" && data.length === 1 && isElement(ffData) && isModeledFormFieldData(ffData);
|
|
32433
32692
|
}
|
|
32434
|
-
if (content.length && content.every((element3) => named2(element3, "instrText")))
|
|
32693
|
+
if (content.length && content.every((element3) => named2(element3, "instrText") || named2(element3, "delInstrText")))
|
|
32694
|
+
return true;
|
|
32435
32695
|
if (runSymbol(content) === null || runPositionalTab(content) === null) return false;
|
|
32436
32696
|
const kinds = /* @__PURE__ */ new Set();
|
|
32437
32697
|
for (const element3 of content) {
|
|
@@ -32528,7 +32788,7 @@ function parseDirectParagraphProperties(props) {
|
|
|
32528
32788
|
if (style) paragraph.style = style;
|
|
32529
32789
|
const pageBreakBefore = onOffElement(first2(props, "pageBreakBefore"));
|
|
32530
32790
|
if (pageBreakBefore !== void 0) paragraph.pageBreakBefore = pageBreakBefore;
|
|
32531
|
-
for (const key of PAGINATION_KEYS) {
|
|
32791
|
+
for (const key of [...PAGINATION_KEYS, ...EAST_ASIAN_TYPOGRAPHY_KEYS]) {
|
|
32532
32792
|
const value = onOffElement(first2(props, key));
|
|
32533
32793
|
if (value !== void 0) paragraph[key] = value;
|
|
32534
32794
|
}
|
|
@@ -32674,12 +32934,12 @@ function writeParagraphImpl(doc, paragraph, node, base, allocator, spans) {
|
|
|
32674
32934
|
runPositions(paragraph.runs).at(-1)
|
|
32675
32935
|
);
|
|
32676
32936
|
const read = markers.filter((marker) => !isBookmark(marker.element) || kept.has(marker.element)).filter((marker) => !permissions?.drop.has(marker.element)).map((marker) => {
|
|
32677
|
-
const
|
|
32937
|
+
const position = sourcePositions[marker.boundary] ?? 0;
|
|
32678
32938
|
const annotation = marker.annotation;
|
|
32679
32939
|
return {
|
|
32680
32940
|
element: marker.element,
|
|
32681
|
-
position
|
|
32682
|
-
source:
|
|
32941
|
+
position,
|
|
32942
|
+
source: position,
|
|
32683
32943
|
opening: annotation ? annotation.edge === "start" : opensRange(marker.element),
|
|
32684
32944
|
...marker.container && { container: marker.container },
|
|
32685
32945
|
...marker.revision && { revision: marker.revision },
|
|
@@ -32912,9 +33172,28 @@ function paragraphsOf(blocks) {
|
|
|
32912
33172
|
function documentParagraphs(model) {
|
|
32913
33173
|
return documentBlockLists(model).flatMap(paragraphsOf);
|
|
32914
33174
|
}
|
|
33175
|
+
function rowEntries(blocks) {
|
|
33176
|
+
const entries = /* @__PURE__ */ new Map();
|
|
33177
|
+
for (const block of blocks)
|
|
33178
|
+
if (block.type === "table")
|
|
33179
|
+
block.rows.forEach((row, index) => {
|
|
33180
|
+
const revision = block.rowProperties?.[index]?.revision;
|
|
33181
|
+
const paragraphId = row[0]?.paragraphs[0]?.id;
|
|
33182
|
+
if (revision && paragraphId)
|
|
33183
|
+
entries.set(paragraphId, {
|
|
33184
|
+
...revision,
|
|
33185
|
+
paragraphId,
|
|
33186
|
+
row: { tableId: block.id, index }
|
|
33187
|
+
});
|
|
33188
|
+
});
|
|
33189
|
+
return entries;
|
|
33190
|
+
}
|
|
32915
33191
|
function listRevisions(model) {
|
|
32916
33192
|
const entries = [];
|
|
33193
|
+
const rows2 = new Map(documentBlockLists(model).flatMap((blocks) => [...rowEntries(blocks)]));
|
|
32917
33194
|
for (const paragraph of documentParagraphs(model)) {
|
|
33195
|
+
const row = rows2.get(paragraph.id);
|
|
33196
|
+
if (row) entries.push(row);
|
|
32918
33197
|
if (paragraph.markRevision)
|
|
32919
33198
|
entries.push({ ...paragraph.markRevision, paragraphId: paragraph.id });
|
|
32920
33199
|
if (paragraph.formatRevision)
|
|
@@ -32930,9 +33209,14 @@ function listRevisions(model) {
|
|
|
32930
33209
|
function findRevision(model, id) {
|
|
32931
33210
|
return listRevisions(model).find((entry) => entry.id === id);
|
|
32932
33211
|
}
|
|
33212
|
+
var isEmptyParagraph = (paragraph) => paragraph.runs.every(
|
|
33213
|
+
(run) => !run.text && !run.image && !run.equation && !run.fieldChar && run.fieldCode === void 0 && !run.break && !run.noteReference && !run.noteMark
|
|
33214
|
+
);
|
|
32933
33215
|
function mergeIntoNext(blocks, paragraphId) {
|
|
32934
33216
|
const index = blocks.findIndex((b) => b.type === "paragraph" && b.id === paragraphId);
|
|
32935
33217
|
const next = blocks[index + 1];
|
|
33218
|
+
if (index >= 0 && next?.type === "table" && isEmptyParagraph(blocks[index]))
|
|
33219
|
+
return [...blocks.slice(0, index), ...blocks.slice(index + 1)];
|
|
32936
33220
|
if (index < 0 || !next || next.type !== "paragraph")
|
|
32937
33221
|
throw new Error(
|
|
32938
33222
|
`Cannot resolve the paragraph mark revision on paragraph ${paragraphId}: there is no following paragraph to merge with (merging across a table boundary is not supported).`
|
|
@@ -32973,8 +33257,12 @@ function resolveParagraphMark(model, id, keepBreak) {
|
|
|
32973
33257
|
(block) => block.type === "table" ? block.rows.flatMap((row) => row.map((cell) => cell.paragraphs)) : []
|
|
32974
33258
|
)
|
|
32975
33259
|
];
|
|
32976
|
-
for (const list2 of lists) {
|
|
33260
|
+
for (const [index, list2] of lists.entries()) {
|
|
32977
33261
|
if (!list2.includes(paragraph)) continue;
|
|
33262
|
+
if (index > 0 && list2.at(-1) === paragraph) {
|
|
33263
|
+
delete paragraph.markRevision;
|
|
33264
|
+
return next;
|
|
33265
|
+
}
|
|
32978
33266
|
const merged = mergeIntoNext(list2, paragraph.id);
|
|
32979
33267
|
list2.splice(0, list2.length, ...merged);
|
|
32980
33268
|
return next;
|
|
@@ -33004,9 +33292,28 @@ function clearRunRevision(paragraph, runIndex) {
|
|
|
33004
33292
|
const run = paragraph.runs[runIndex];
|
|
33005
33293
|
if (run) delete run.revision;
|
|
33006
33294
|
}
|
|
33295
|
+
function resolveRow(model, id, remove2) {
|
|
33296
|
+
const next = structuredClone(model);
|
|
33297
|
+
for (const blocks of documentBlockLists(next))
|
|
33298
|
+
for (const [blockIndex, table] of blocks.entries()) {
|
|
33299
|
+
if (table.type !== "table") continue;
|
|
33300
|
+
const index = table.rowProperties?.findIndex((row) => row.revision?.id === id) ?? -1;
|
|
33301
|
+
if (index < 0) continue;
|
|
33302
|
+
if (!remove2) {
|
|
33303
|
+
delete table.rowProperties[index].revision;
|
|
33304
|
+
return next;
|
|
33305
|
+
}
|
|
33306
|
+
table.rows.splice(index, 1);
|
|
33307
|
+
table.rowProperties.splice(index, 1);
|
|
33308
|
+
if (!table.rows.length) blocks.splice(blockIndex, 1);
|
|
33309
|
+
return next;
|
|
33310
|
+
}
|
|
33311
|
+
throw new Error(`No table row revision with id ${id} was found.`);
|
|
33312
|
+
}
|
|
33007
33313
|
function acceptOne(model, id) {
|
|
33008
33314
|
const entry = findRevision(model, id);
|
|
33009
33315
|
if (!entry) throw new Error(`No revision with id ${id} was found.`);
|
|
33316
|
+
if (entry.row) return resolveRow(model, id, entry.kind === "delete");
|
|
33010
33317
|
if (entry.kind === "formatChange")
|
|
33011
33318
|
return updateRuns(model, id, (paragraph, runIndex) => {
|
|
33012
33319
|
const run = paragraph.runs[runIndex];
|
|
@@ -33031,6 +33338,7 @@ function acceptOne(model, id) {
|
|
|
33031
33338
|
function rejectOne(model, id) {
|
|
33032
33339
|
const entry = findRevision(model, id);
|
|
33033
33340
|
if (!entry) throw new Error(`No revision with id ${id} was found.`);
|
|
33341
|
+
if (entry.row) return resolveRow(model, id, entry.kind === "insert");
|
|
33034
33342
|
if (entry.kind === "formatChange")
|
|
33035
33343
|
return updateRuns(
|
|
33036
33344
|
model,
|
|
@@ -33054,7 +33362,8 @@ function rejectOne(model, id) {
|
|
|
33054
33362
|
}
|
|
33055
33363
|
function applyAll(model, apply) {
|
|
33056
33364
|
let current = model;
|
|
33057
|
-
|
|
33365
|
+
const entries = listRevisions(model).reverse();
|
|
33366
|
+
for (const entry of [...entries.filter((item2) => item2.row), ...entries]) {
|
|
33058
33367
|
if (!findRevision(current, entry.id)) continue;
|
|
33059
33368
|
current = apply(current, entry.id);
|
|
33060
33369
|
}
|
|
@@ -33112,7 +33421,7 @@ function sectionsFromLayout(json, prior, blocks) {
|
|
|
33112
33421
|
return kept.map((section, index) => {
|
|
33113
33422
|
const end = endOf(section, index, kept);
|
|
33114
33423
|
const source = priorSections.find((candidate) => candidate.endsAtBlockId === section.endsAtBlockId) ?? priorSections.find(
|
|
33115
|
-
(candidate,
|
|
33424
|
+
(candidate, position) => endOf(candidate, position, priorSections) >= end
|
|
33116
33425
|
) ?? priorSections.at(-1);
|
|
33117
33426
|
return {
|
|
33118
33427
|
...section,
|
|
@@ -33150,17 +33459,17 @@ function twipsAttr(value) {
|
|
|
33150
33459
|
function signedTwipsAttr(value) {
|
|
33151
33460
|
return typeof value === "number" && Number.isFinite(value) ? roundSignedTwips(value) : void 0;
|
|
33152
33461
|
}
|
|
33153
|
-
function paragraphTwipsFromAttrs(
|
|
33462
|
+
function paragraphTwipsFromAttrs(attrs4) {
|
|
33154
33463
|
const result = {};
|
|
33155
|
-
const spacingBefore = twipsAttr(
|
|
33156
|
-
const spacingAfter = twipsAttr(
|
|
33157
|
-
const lineSpacing = signedTwipsAttr(
|
|
33158
|
-
const left = signedTwipsAttr(
|
|
33159
|
-
const right = signedTwipsAttr(
|
|
33160
|
-
const start = signedTwipsAttr(
|
|
33161
|
-
const end = signedTwipsAttr(
|
|
33162
|
-
const firstLine = twipsAttr(
|
|
33163
|
-
const hanging = twipsAttr(
|
|
33464
|
+
const spacingBefore = twipsAttr(attrs4.spacingBeforeTwips);
|
|
33465
|
+
const spacingAfter = twipsAttr(attrs4.spacingAfterTwips);
|
|
33466
|
+
const lineSpacing = signedTwipsAttr(attrs4.lineSpacingTwips);
|
|
33467
|
+
const left = signedTwipsAttr(attrs4.indentLeftTwips);
|
|
33468
|
+
const right = signedTwipsAttr(attrs4.indentRightTwips);
|
|
33469
|
+
const start = signedTwipsAttr(attrs4.indentStartTwips);
|
|
33470
|
+
const end = signedTwipsAttr(attrs4.indentEndTwips);
|
|
33471
|
+
const firstLine = twipsAttr(attrs4.firstLineTwips);
|
|
33472
|
+
const hanging = twipsAttr(attrs4.hangingTwips);
|
|
33164
33473
|
if (spacingBefore !== void 0) result.spacingBeforeTwips = spacingBefore;
|
|
33165
33474
|
if (spacingAfter !== void 0) result.spacingAfterTwips = spacingAfter;
|
|
33166
33475
|
if (lineSpacing !== void 0) result.lineSpacingTwips = lineSpacing;
|
|
@@ -33255,9 +33564,9 @@ var runPropertiesMark = {
|
|
|
33255
33564
|
parseDOM: [
|
|
33256
33565
|
{
|
|
33257
33566
|
tag: "span[data-run-props]",
|
|
33258
|
-
getAttrs: (
|
|
33567
|
+
getAttrs: (el6) => {
|
|
33259
33568
|
try {
|
|
33260
|
-
return { props: JSON.parse(
|
|
33569
|
+
return { props: JSON.parse(el6.dataset.runProps || "null") };
|
|
33261
33570
|
} catch {
|
|
33262
33571
|
return { props: null };
|
|
33263
33572
|
}
|
|
@@ -33550,7 +33859,9 @@ function runToInlineNodes(run, schema, noteNumber) {
|
|
|
33550
33859
|
textBoxBorder: run.image.textBoxBorder ?? null,
|
|
33551
33860
|
diagram: run.image.diagram ? JSON.stringify(run.image.diagram) : null,
|
|
33552
33861
|
chart: run.image.chart ? JSON.stringify(run.image.chart) : null,
|
|
33553
|
-
shape: run.image.shape ? JSON.stringify(run.image.shape) : null
|
|
33862
|
+
shape: run.image.shape ? JSON.stringify(run.image.shape) : null,
|
|
33863
|
+
watermark: run.image.watermark ? JSON.stringify(run.image.watermark) : null,
|
|
33864
|
+
pictureWatermark: run.image.pictureWatermark ? JSON.stringify(run.image.pictureWatermark) : null
|
|
33554
33865
|
},
|
|
33555
33866
|
void 0,
|
|
33556
33867
|
marks2
|
|
@@ -33637,6 +33948,8 @@ function appendInlineNode(runs, child3) {
|
|
|
33637
33948
|
...typeof child3.attrs.diagram === "string" ? { diagram: JSON.parse(child3.attrs.diagram) } : {},
|
|
33638
33949
|
...typeof child3.attrs.chart === "string" ? { chart: JSON.parse(child3.attrs.chart) } : {},
|
|
33639
33950
|
...typeof child3.attrs.shape === "string" ? { shape: JSON.parse(child3.attrs.shape) } : {},
|
|
33951
|
+
...typeof child3.attrs.watermark === "string" ? { watermark: JSON.parse(child3.attrs.watermark) } : {},
|
|
33952
|
+
...typeof child3.attrs.pictureWatermark === "string" ? { pictureWatermark: JSON.parse(child3.attrs.pictureWatermark) } : {},
|
|
33640
33953
|
...typeof child3.attrs.placement === "string" ? { placement: JSON.parse(child3.attrs.placement) } : {},
|
|
33641
33954
|
...typeof child3.attrs.textBoxText === "string" ? { textBoxText: JSON.parse(child3.attrs.textBoxText) } : {},
|
|
33642
33955
|
...child3.attrs.textBoxEditable ? { textBoxEditable: true } : {},
|
|
@@ -33697,8 +34010,8 @@ var RUN_FORMAT_MARKS = /* @__PURE__ */ new Set([
|
|
|
33697
34010
|
function setInlineRunFormatting(tr, pos, run) {
|
|
33698
34011
|
const node = tr.doc.nodeAt(pos);
|
|
33699
34012
|
const projected = runToInlineNodes(run, tr.doc.type.schema)[0];
|
|
33700
|
-
const
|
|
33701
|
-
for (const [key, value] of Object.entries(
|
|
34013
|
+
const attrs4 = updatedInlineRunAttributes(node, projected.attrs.format);
|
|
34014
|
+
for (const [key, value] of Object.entries(attrs4))
|
|
33702
34015
|
if (node.attrs[key] !== value) tr.setNodeAttribute(pos, key, value);
|
|
33703
34016
|
for (const mark of node.marks)
|
|
33704
34017
|
if (RUN_FORMAT_MARKS.has(mark.type.name)) tr.removeMark(pos, pos + node.nodeSize, mark.type);
|
|
@@ -33753,14 +34066,7 @@ function resolveFormattingRange(tr, from, to, mode) {
|
|
|
33753
34066
|
|
|
33754
34067
|
// docx/ui/track-run-formatting.ts
|
|
33755
34068
|
function properties(node) {
|
|
33756
|
-
|
|
33757
|
-
run.text = "";
|
|
33758
|
-
delete run.image;
|
|
33759
|
-
delete run.equation;
|
|
33760
|
-
delete run.revision;
|
|
33761
|
-
delete run.formatRevision;
|
|
33762
|
-
const doc = parseXml2(`<w:r xmlns:w="${WORD_NS}"/>`);
|
|
33763
|
-
return first2(createRun(doc, run), "rPr") ?? makeW(doc, "rPr");
|
|
34069
|
+
return runPropertiesElement(inlineNodeRun(node) ?? { text: "" });
|
|
33764
34070
|
}
|
|
33765
34071
|
function trackRunFormatting(steps, oldState, newState, author, date, nextId) {
|
|
33766
34072
|
const markType = newState.schema.marks.runProperties;
|
|
@@ -33831,34 +34137,35 @@ var PARAGRAPH_KEEP_KEYS = [
|
|
|
33831
34137
|
"contextualSpacing",
|
|
33832
34138
|
"suppressLineNumbers"
|
|
33833
34139
|
];
|
|
33834
|
-
|
|
34140
|
+
var PARAGRAPH_EAST_ASIAN_KEYS = EAST_ASIAN_TYPOGRAPHY_KEYS;
|
|
34141
|
+
function paragraphFromAttrs(attrs4, id, runs) {
|
|
33835
34142
|
return {
|
|
33836
34143
|
type: "paragraph",
|
|
33837
34144
|
id,
|
|
33838
34145
|
runs,
|
|
33839
|
-
...
|
|
33840
|
-
...
|
|
33841
|
-
...
|
|
33842
|
-
...
|
|
33843
|
-
...
|
|
33844
|
-
...
|
|
33845
|
-
...
|
|
33846
|
-
...
|
|
33847
|
-
...
|
|
33848
|
-
...paragraphTwipsFromAttrs(
|
|
33849
|
-
...
|
|
33850
|
-
...
|
|
33851
|
-
...
|
|
33852
|
-
...
|
|
34146
|
+
...attrs4.restoredParagraphPropertiesXml ? { restoredParagraphPropertiesXml: String(attrs4.restoredParagraphPropertiesXml) } : {},
|
|
34147
|
+
...attrs4.sourceParagraphPropertiesXml ? { sourceParagraphPropertiesXml: String(attrs4.sourceParagraphPropertiesXml) } : {},
|
|
34148
|
+
...attrs4.markRevision ? { markRevision: structuredClone(attrs4.markRevision) } : {},
|
|
34149
|
+
...attrs4.formatRevision ? { formatRevision: structuredClone(attrs4.formatRevision) } : {},
|
|
34150
|
+
...attrs4.align != null ? { align: attrs4.align } : {},
|
|
34151
|
+
...attrs4.justification != null ? { justification: attrs4.justification } : {},
|
|
34152
|
+
...attrs4.outlineLevel != null ? { outlineLevel: Number(attrs4.outlineLevel) } : {},
|
|
34153
|
+
...attrs4.direction != null ? { direction: attrs4.direction } : {},
|
|
34154
|
+
...attrs4.style ? { style: attrs4.style } : {},
|
|
34155
|
+
...paragraphTwipsFromAttrs(attrs4),
|
|
34156
|
+
...attrs4.lineSpacingRule != null ? { lineSpacingRule: attrs4.lineSpacingRule } : {},
|
|
34157
|
+
...attrs4.numId != null ? { numbering: { numId: attrs4.numId, level: attrs4.ilvl ?? 0 } } : {},
|
|
34158
|
+
...attrs4.pageBreakBefore != null ? { pageBreakBefore: Boolean(attrs4.pageBreakBefore) } : {},
|
|
34159
|
+
...attrs4.tabStops?.length ? { tabStops: structuredClone(attrs4.tabStops) } : {},
|
|
33853
34160
|
...Object.fromEntries(
|
|
33854
|
-
PARAGRAPH_KEEP_KEYS.filter((key) =>
|
|
34161
|
+
[...PARAGRAPH_KEEP_KEYS, ...PARAGRAPH_EAST_ASIAN_KEYS].filter((key) => attrs4[key] != null).map((key) => [key, Boolean(attrs4[key])])
|
|
33855
34162
|
),
|
|
33856
|
-
...
|
|
33857
|
-
...
|
|
33858
|
-
...
|
|
33859
|
-
...
|
|
33860
|
-
...
|
|
33861
|
-
...
|
|
34163
|
+
...attrs4.dropCap ? { dropCap: { ...attrs4.dropCap } } : {},
|
|
34164
|
+
...attrs4.borders ? { borders: structuredClone(attrs4.borders) } : {},
|
|
34165
|
+
...attrs4.shadingFill ? { shadingFill: attrs4.shadingFill } : {},
|
|
34166
|
+
...attrs4.bookmarks?.length ? { bookmarks: [...attrs4.bookmarks] } : {},
|
|
34167
|
+
...attrs4.permissions?.length ? { permissions: structuredClone(attrs4.permissions) } : {},
|
|
34168
|
+
...attrs4.contentControl ? { contentControl: structuredClone(attrs4.contentControl) } : {}
|
|
33862
34169
|
};
|
|
33863
34170
|
}
|
|
33864
34171
|
function paragraphAttrs(paragraph) {
|
|
@@ -33892,6 +34199,10 @@ function paragraphAttrs(paragraph) {
|
|
|
33892
34199
|
widowControl: paragraph.widowControl ?? null,
|
|
33893
34200
|
contextualSpacing: paragraph.contextualSpacing ?? null,
|
|
33894
34201
|
suppressLineNumbers: paragraph.suppressLineNumbers ?? null,
|
|
34202
|
+
kinsoku: paragraph.kinsoku ?? null,
|
|
34203
|
+
autoSpaceDE: paragraph.autoSpaceDE ?? null,
|
|
34204
|
+
autoSpaceDN: paragraph.autoSpaceDN ?? null,
|
|
34205
|
+
overflowPunct: paragraph.overflowPunct ?? null,
|
|
33895
34206
|
dropCap: paragraph.dropCap ?? null,
|
|
33896
34207
|
borders: paragraph.borders ?? null,
|
|
33897
34208
|
shadingFill: paragraph.shadingFill ?? null,
|
|
@@ -33911,7 +34222,7 @@ function resolveParagraphFormatting(tr, pos, mode) {
|
|
|
33911
34222
|
if (!node) return;
|
|
33912
34223
|
const revision = paragraphFormattingRevision(node);
|
|
33913
34224
|
if (!revision) return;
|
|
33914
|
-
const
|
|
34225
|
+
const attrs4 = { ...node.attrs, formatRevision: null };
|
|
33915
34226
|
if (mode === "reject") {
|
|
33916
34227
|
const paragraph = {
|
|
33917
34228
|
type: "paragraph",
|
|
@@ -33923,14 +34234,14 @@ function resolveParagraphFormatting(tr, pos, mode) {
|
|
|
33923
34234
|
restoreParagraphFormatting(paragraph);
|
|
33924
34235
|
for (const key of PARAGRAPH_FORMAT_KEYS)
|
|
33925
34236
|
if (Object.hasOwn(node.attrs, key))
|
|
33926
|
-
|
|
33927
|
-
|
|
33928
|
-
|
|
33929
|
-
|
|
34237
|
+
attrs4[key] = paragraph[key] ?? node.type.spec.attrs?.[key]?.default ?? null;
|
|
34238
|
+
attrs4.numId = paragraph.numbering?.numId ?? null;
|
|
34239
|
+
attrs4.ilvl = paragraph.numbering?.level ?? null;
|
|
34240
|
+
attrs4.restoredParagraphPropertiesXml = paragraph.restoredParagraphPropertiesXml;
|
|
33930
34241
|
if (paragraph.sourceParagraphPropertiesXml)
|
|
33931
|
-
|
|
34242
|
+
attrs4.sourceParagraphPropertiesXml = paragraph.sourceParagraphPropertiesXml;
|
|
33932
34243
|
}
|
|
33933
|
-
tr.setNodeMarkup(pos, void 0,
|
|
34244
|
+
tr.setNodeMarkup(pos, void 0, attrs4);
|
|
33934
34245
|
}
|
|
33935
34246
|
|
|
33936
34247
|
// docx/ui/track-paragraph-formatting.ts
|
|
@@ -35081,7 +35392,7 @@ var hardBreakNodeSpec = {
|
|
|
35081
35392
|
parseDOM: [
|
|
35082
35393
|
{
|
|
35083
35394
|
tag: "br",
|
|
35084
|
-
getAttrs: (
|
|
35395
|
+
getAttrs: (el6) => ({ format: el6.dataset.runProperties ?? null })
|
|
35085
35396
|
}
|
|
35086
35397
|
],
|
|
35087
35398
|
toDOM: (node) => ["br", inlineRunPropertiesDomAttrs(node)]
|
|
@@ -35096,9 +35407,9 @@ var pageBreakNodeSpec = {
|
|
|
35096
35407
|
parseDOM: [
|
|
35097
35408
|
{
|
|
35098
35409
|
tag: "span[data-docx-break]",
|
|
35099
|
-
getAttrs: (
|
|
35100
|
-
kind:
|
|
35101
|
-
format:
|
|
35410
|
+
getAttrs: (el6) => ({
|
|
35411
|
+
kind: el6.dataset.docxBreak === "column" ? "column" : "page",
|
|
35412
|
+
format: el6.dataset.runProperties ?? null
|
|
35102
35413
|
})
|
|
35103
35414
|
}
|
|
35104
35415
|
],
|
|
@@ -35134,11 +35445,11 @@ var noteReferenceNodeSpec = {
|
|
|
35134
35445
|
{
|
|
35135
35446
|
tag: "sup[data-docx-note-kind]",
|
|
35136
35447
|
priority: 60,
|
|
35137
|
-
getAttrs: (
|
|
35138
|
-
kind:
|
|
35139
|
-
format:
|
|
35140
|
-
id:
|
|
35141
|
-
number: Number(
|
|
35448
|
+
getAttrs: (el6) => ({
|
|
35449
|
+
kind: el6.dataset.docxNoteKind === "endnote" ? "endnote" : "footnote",
|
|
35450
|
+
format: el6.dataset.runProperties ?? null,
|
|
35451
|
+
id: el6.dataset.docxNoteId || "",
|
|
35452
|
+
number: Number(el6.textContent) || 1
|
|
35142
35453
|
})
|
|
35143
35454
|
}
|
|
35144
35455
|
],
|
|
@@ -35169,10 +35480,10 @@ var fieldMarkerNodeSpec = {
|
|
|
35169
35480
|
parseDOM: [
|
|
35170
35481
|
{
|
|
35171
35482
|
tag: "span[data-field-marker]",
|
|
35172
|
-
getAttrs: (
|
|
35173
|
-
kind:
|
|
35174
|
-
format:
|
|
35175
|
-
code:
|
|
35483
|
+
getAttrs: (el6) => ({
|
|
35484
|
+
kind: el6.dataset.fieldMarker || "begin",
|
|
35485
|
+
format: el6.dataset.runProperties ?? null,
|
|
35486
|
+
code: el6.dataset.fieldCode ?? null
|
|
35176
35487
|
})
|
|
35177
35488
|
}
|
|
35178
35489
|
],
|
|
@@ -35690,8 +36001,8 @@ var WordYjsInlineCommentAnchors = class {
|
|
|
35690
36001
|
capture(doc, from, to, mapping) {
|
|
35691
36002
|
const ranges = [];
|
|
35692
36003
|
const relative = (pos, assoc) => {
|
|
35693
|
-
const
|
|
35694
|
-
const absolute = Y2__namespace.createAbsolutePositionFromRelativePosition(
|
|
36004
|
+
const position = yProsemirror.absolutePositionToRelativePosition(pos, this.fragment, mapping);
|
|
36005
|
+
const absolute = Y2__namespace.createAbsolutePositionFromRelativePosition(position, this.fragment.doc);
|
|
35695
36006
|
if (!absolute) throw new Error("Cannot resolve an inline comment anchor.");
|
|
35696
36007
|
return Array.from(
|
|
35697
36008
|
Y2__namespace.encodeRelativePosition(
|
|
@@ -35900,8 +36211,8 @@ function removeSharedAnchor(fragment, id) {
|
|
|
35900
36211
|
let offset = 0;
|
|
35901
36212
|
for (const part of child3.toDelta()) {
|
|
35902
36213
|
const length = typeof part.insert === "string" ? part.insert.length : 1;
|
|
35903
|
-
for (const [key,
|
|
35904
|
-
if (key.startsWith("comment--") && Array.isArray(
|
|
36214
|
+
for (const [key, attrs4] of Object.entries(part.attributes ?? {})) {
|
|
36215
|
+
if (key.startsWith("comment--") && Array.isArray(attrs4.ids) && attrs4.ids.includes(id))
|
|
35905
36216
|
child3.format(offset, length, { [key]: null });
|
|
35906
36217
|
}
|
|
35907
36218
|
offset += length;
|
|
@@ -35958,11 +36269,15 @@ function guardDeletedNodeSelection(doc, view, binding) {
|
|
|
35958
36269
|
doc.on("beforeObserverCalls", guard);
|
|
35959
36270
|
return () => doc.off("beforeObserverCalls", guard);
|
|
35960
36271
|
}
|
|
35961
|
-
|
|
36272
|
+
var LOCAL_DOCUMENT_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
36273
|
+
"commentThreads",
|
|
36274
|
+
"documentInformation"
|
|
36275
|
+
]);
|
|
36276
|
+
function wordYjsDocumentAttributes(attrs4, canWrite) {
|
|
35962
36277
|
const patch = (state) => {
|
|
35963
36278
|
const tr = state.tr;
|
|
35964
|
-
for (const [key, value] of
|
|
35965
|
-
if (key
|
|
36279
|
+
for (const [key, value] of attrs4.entries()) {
|
|
36280
|
+
if (!LOCAL_DOCUMENT_ATTRIBUTES.has(key) && key in (state.doc.type.spec.attrs ?? {}) && JSON.stringify(state.doc.attrs[key]) !== JSON.stringify(value))
|
|
35966
36281
|
tr.setDocAttribute(key, value);
|
|
35967
36282
|
}
|
|
35968
36283
|
return tr.steps.length ? tr.setMeta("dve-remote", true).setMeta("addToHistory", false) : null;
|
|
@@ -35978,18 +36293,18 @@ function wordYjsDocumentAttributes(attrs3, canWrite) {
|
|
|
35978
36293
|
binding?.mux(() => view.dispatch(tr));
|
|
35979
36294
|
}
|
|
35980
36295
|
};
|
|
35981
|
-
|
|
36296
|
+
attrs4.observe(changed);
|
|
35982
36297
|
return {
|
|
35983
36298
|
update: (next, previous) => {
|
|
35984
36299
|
if (previous.doc.attrs === next.state.doc.attrs || !canWrite()) return;
|
|
35985
|
-
|
|
36300
|
+
attrs4.doc.transact((transaction) => {
|
|
35986
36301
|
transaction.meta.set("addToHistory", thisPlugin.getState(next.state));
|
|
35987
36302
|
for (const [key, value] of Object.entries(next.state.doc.attrs))
|
|
35988
|
-
if (key
|
|
35989
|
-
|
|
36303
|
+
if (!LOCAL_DOCUMENT_ATTRIBUTES.has(key) && JSON.stringify(attrs4.get(key)) !== JSON.stringify(value))
|
|
36304
|
+
attrs4.set(key, value);
|
|
35990
36305
|
}, yProsemirror.ySyncPluginKey);
|
|
35991
36306
|
},
|
|
35992
|
-
destroy: () =>
|
|
36307
|
+
destroy: () => attrs4.unobserve(changed)
|
|
35993
36308
|
};
|
|
35994
36309
|
}
|
|
35995
36310
|
});
|
|
@@ -36033,7 +36348,7 @@ var WordYjsCollaboration = class {
|
|
|
36033
36348
|
this.comments.resolved.set(comment.id, comment.resolved);
|
|
36034
36349
|
}
|
|
36035
36350
|
for (const [key, value] of Object.entries(initial.attrs))
|
|
36036
|
-
if (key
|
|
36351
|
+
if (!LOCAL_DOCUMENT_ATTRIBUTES.has(key)) this.attributes.set(key, value);
|
|
36037
36352
|
yProsemirror.prosemirrorToYXmlFragment(independentCommentAnchors(initial), this.fragment);
|
|
36038
36353
|
seedEmptyParagraphText(this.fragment);
|
|
36039
36354
|
if (format === "word-yjs-v3") {
|
|
@@ -36650,10 +36965,10 @@ var insertWordHardBreak = (state, dispatch, view) => {
|
|
|
36650
36965
|
// docx/ui/chart-spec.ts
|
|
36651
36966
|
var SVG_NS2 = "http://www.w3.org/2000/svg";
|
|
36652
36967
|
function elementSpec(element3, root) {
|
|
36653
|
-
const
|
|
36968
|
+
const attrs4 = {};
|
|
36654
36969
|
for (const attr2 of Array.from(element3.attributes)) {
|
|
36655
36970
|
if (attr2.name === "xmlns" || attr2.name.startsWith("xmlns:") || /^on/i.test(attr2.name)) continue;
|
|
36656
|
-
|
|
36971
|
+
attrs4[attr2.name] = attr2.value;
|
|
36657
36972
|
}
|
|
36658
36973
|
const children3 = [];
|
|
36659
36974
|
for (const child3 of Array.from(element3.childNodes)) {
|
|
@@ -36661,7 +36976,7 @@ function elementSpec(element3, root) {
|
|
|
36661
36976
|
else if (child3.nodeType === 3 && child3.nodeValue) children3.push(child3.nodeValue);
|
|
36662
36977
|
}
|
|
36663
36978
|
const tag = root ? `${SVG_NS2} ${element3.localName}` : element3.localName;
|
|
36664
|
-
return [tag,
|
|
36979
|
+
return [tag, attrs4, ...children3];
|
|
36665
36980
|
}
|
|
36666
36981
|
function svgMarkupSpec(svg) {
|
|
36667
36982
|
return elementSpec(parseXml(svg, { label: "Chart SVG" }).documentElement, true);
|
|
@@ -36762,22 +37077,25 @@ var imageNodeSpec = {
|
|
|
36762
37077
|
/** A chart (`DocxChart`) as JSON; painted read-only from its cached values (`chart-spec.ts`). */
|
|
36763
37078
|
chart: { default: null },
|
|
36764
37079
|
/** A drawing shape (`ShapeSpec`) as JSON; drawn as SVG by the shape node view. */
|
|
36765
|
-
shape: { default: null }
|
|
37080
|
+
shape: { default: null },
|
|
37081
|
+
/** A header watermark (`WatermarkSpec` or `PictureWatermarkSpec`) as JSON, kept through edits. */
|
|
37082
|
+
watermark: { default: null },
|
|
37083
|
+
pictureWatermark: { default: null }
|
|
36766
37084
|
},
|
|
36767
37085
|
parseDOM: [
|
|
36768
37086
|
{
|
|
36769
37087
|
tag: "img[data-docx-image], span[data-docx-image-placeholder]",
|
|
36770
|
-
getAttrs: (
|
|
36771
|
-
format:
|
|
36772
|
-
relId:
|
|
36773
|
-
partName:
|
|
36774
|
-
contentType:
|
|
36775
|
-
widthPx: Number(
|
|
36776
|
-
heightPx: Number(
|
|
36777
|
-
altText:
|
|
36778
|
-
title:
|
|
36779
|
-
anchored:
|
|
36780
|
-
unsupported:
|
|
37088
|
+
getAttrs: (el6) => ({
|
|
37089
|
+
format: el6.dataset.runProperties ?? null,
|
|
37090
|
+
relId: el6.dataset.relId || "",
|
|
37091
|
+
partName: el6.dataset.partName || "",
|
|
37092
|
+
contentType: el6.dataset.contentType || "",
|
|
37093
|
+
widthPx: Number(el6.dataset.widthPx) || 96,
|
|
37094
|
+
heightPx: Number(el6.dataset.heightPx) || 96,
|
|
37095
|
+
altText: el6.getAttribute("alt") || null,
|
|
37096
|
+
title: el6.getAttribute("title") || null,
|
|
37097
|
+
anchored: el6.dataset.anchored === "1",
|
|
37098
|
+
unsupported: el6.dataset.unsupported || null
|
|
36781
37099
|
})
|
|
36782
37100
|
}
|
|
36783
37101
|
],
|
|
@@ -36816,7 +37134,7 @@ var imageNodeSpec = {
|
|
|
36816
37134
|
]
|
|
36817
37135
|
};
|
|
36818
37136
|
function isNavigableHref(href) {
|
|
36819
|
-
return
|
|
37137
|
+
return isWordNavigableHref(href);
|
|
36820
37138
|
}
|
|
36821
37139
|
var linkMarkSpec = {
|
|
36822
37140
|
attrs: {
|
|
@@ -36828,10 +37146,10 @@ var linkMarkSpec = {
|
|
|
36828
37146
|
parseDOM: [
|
|
36829
37147
|
{
|
|
36830
37148
|
tag: "a[data-docx-link]",
|
|
36831
|
-
getAttrs: (
|
|
36832
|
-
href:
|
|
36833
|
-
anchor:
|
|
36834
|
-
tooltip:
|
|
37149
|
+
getAttrs: (el6) => ({
|
|
37150
|
+
href: el6.dataset.href || (el6.dataset.anchor ? null : el6.getAttribute("href")) || null,
|
|
37151
|
+
anchor: el6.dataset.anchor || null,
|
|
37152
|
+
tooltip: el6.getAttribute("title") || null
|
|
36835
37153
|
})
|
|
36836
37154
|
}
|
|
36837
37155
|
],
|
|
@@ -36898,7 +37216,7 @@ function applyWordLink(target, displayText) {
|
|
|
36898
37216
|
if (view?.editable === false || !state.schema.marks.link || !target.href && !target.anchor)
|
|
36899
37217
|
return false;
|
|
36900
37218
|
if (target.href && !isNavigableHref(target.href))
|
|
36901
|
-
throw new Error("Links must start with http://, https
|
|
37219
|
+
throw new Error("Links must start with http://, https://, mailto:, tel: or ftp://.");
|
|
36902
37220
|
if (!dispatch) return true;
|
|
36903
37221
|
const { from, to, empty } = state.selection;
|
|
36904
37222
|
const tr = state.tr;
|
|
@@ -37127,8 +37445,8 @@ var reviewMarks = {
|
|
|
37127
37445
|
parseDOM: [
|
|
37128
37446
|
{
|
|
37129
37447
|
tag: "span[data-inline-comment-ids]",
|
|
37130
|
-
getAttrs: (
|
|
37131
|
-
ids: (
|
|
37448
|
+
getAttrs: (el6) => ({
|
|
37449
|
+
ids: (el6.dataset.inlineCommentIds ?? "").split(",").filter(Boolean)
|
|
37132
37450
|
})
|
|
37133
37451
|
}
|
|
37134
37452
|
],
|
|
@@ -37156,11 +37474,11 @@ var reviewMarks = {
|
|
|
37156
37474
|
parseDOM: [
|
|
37157
37475
|
{
|
|
37158
37476
|
tag: "ins[data-revision-id]",
|
|
37159
|
-
getAttrs: (
|
|
37160
|
-
author:
|
|
37161
|
-
date:
|
|
37162
|
-
dateUtc:
|
|
37163
|
-
id:
|
|
37477
|
+
getAttrs: (el6) => ({
|
|
37478
|
+
author: el6.dataset.author || "",
|
|
37479
|
+
date: el6.dataset.date || null,
|
|
37480
|
+
dateUtc: el6.dataset.dateUtc || null,
|
|
37481
|
+
id: el6.dataset.revisionId || "",
|
|
37164
37482
|
move: null
|
|
37165
37483
|
})
|
|
37166
37484
|
}
|
|
@@ -37191,11 +37509,11 @@ var reviewMarks = {
|
|
|
37191
37509
|
parseDOM: [
|
|
37192
37510
|
{
|
|
37193
37511
|
tag: "del[data-revision-id]",
|
|
37194
|
-
getAttrs: (
|
|
37195
|
-
author:
|
|
37196
|
-
date:
|
|
37197
|
-
dateUtc:
|
|
37198
|
-
id:
|
|
37512
|
+
getAttrs: (el6) => ({
|
|
37513
|
+
author: el6.dataset.author || "",
|
|
37514
|
+
date: el6.dataset.date || null,
|
|
37515
|
+
dateUtc: el6.dataset.dateUtc || null,
|
|
37516
|
+
id: el6.dataset.revisionId || "",
|
|
37199
37517
|
move: null
|
|
37200
37518
|
})
|
|
37201
37519
|
}
|
|
@@ -37221,8 +37539,8 @@ var reviewMarks = {
|
|
|
37221
37539
|
parseDOM: [
|
|
37222
37540
|
{
|
|
37223
37541
|
tag: "span[data-comment-ids]",
|
|
37224
|
-
getAttrs: (
|
|
37225
|
-
ids: (
|
|
37542
|
+
getAttrs: (el6) => ({
|
|
37543
|
+
ids: (el6.dataset.commentIds || "").split(",").filter(Boolean)
|
|
37226
37544
|
})
|
|
37227
37545
|
}
|
|
37228
37546
|
],
|
|
@@ -37826,6 +38144,7 @@ var RIBBON_ACTION_IDS = [
|
|
|
37826
38144
|
"insert-table-of-figures",
|
|
37827
38145
|
"insert-footnote",
|
|
37828
38146
|
"insert-endnote",
|
|
38147
|
+
"convert-notes",
|
|
37829
38148
|
"paragraph-direction",
|
|
37830
38149
|
"text-language",
|
|
37831
38150
|
"custom-text-language-tag",
|
|
@@ -37861,7 +38180,8 @@ var RIBBON_ACTION_IDS = [
|
|
|
37861
38180
|
"merge-cells",
|
|
37862
38181
|
"split-cells",
|
|
37863
38182
|
"delete-table",
|
|
37864
|
-
"table-properties"
|
|
38183
|
+
"table-properties",
|
|
38184
|
+
"crop"
|
|
37865
38185
|
];
|
|
37866
38186
|
var RIBBON_ACTION_LABELS = {
|
|
37867
38187
|
paste: "Paste",
|
|
@@ -38023,6 +38343,7 @@ var RIBBON_ACTION_LABELS = {
|
|
|
38023
38343
|
"insert-table-of-figures": "Insert table of figures",
|
|
38024
38344
|
"insert-footnote": "Insert footnote",
|
|
38025
38345
|
"insert-endnote": "Insert endnote",
|
|
38346
|
+
"convert-notes": "Convert notes",
|
|
38026
38347
|
"paragraph-direction": "Paragraph direction",
|
|
38027
38348
|
"text-language": "Text language",
|
|
38028
38349
|
"custom-text-language-tag": "Custom text language tag",
|
|
@@ -38059,7 +38380,8 @@ var RIBBON_ACTION_LABELS = {
|
|
|
38059
38380
|
"merge-cells": "Merge cells",
|
|
38060
38381
|
"split-cells": "Split cells",
|
|
38061
38382
|
"delete-table": "Delete table",
|
|
38062
|
-
"table-properties": "Table properties"
|
|
38383
|
+
"table-properties": "Table properties",
|
|
38384
|
+
crop: "Crop"
|
|
38063
38385
|
};
|
|
38064
38386
|
var labelToId = new Map(
|
|
38065
38387
|
RIBBON_ACTION_IDS.map((id) => [RIBBON_ACTION_LABELS[id], id])
|
|
@@ -38196,24 +38518,6 @@ function parseFontSize(value) {
|
|
|
38196
38518
|
const size = Number(match[1]) * (match[2]?.toLowerCase() === "px" ? 0.75 : 1);
|
|
38197
38519
|
return Number.isFinite(size) && size > 0 ? size : null;
|
|
38198
38520
|
}
|
|
38199
|
-
var wordHighlightColors = {
|
|
38200
|
-
black: "#000000",
|
|
38201
|
-
blue: "#0000ff",
|
|
38202
|
-
cyan: "#00ffff",
|
|
38203
|
-
green: "#00ff00",
|
|
38204
|
-
magenta: "#ff00ff",
|
|
38205
|
-
red: "#ff0000",
|
|
38206
|
-
yellow: "#ffff00",
|
|
38207
|
-
white: "#ffffff",
|
|
38208
|
-
darkBlue: "#000080",
|
|
38209
|
-
darkCyan: "#008080",
|
|
38210
|
-
darkGreen: "#008000",
|
|
38211
|
-
darkMagenta: "#800080",
|
|
38212
|
-
darkRed: "#800000",
|
|
38213
|
-
darkYellow: "#808000",
|
|
38214
|
-
darkGray: "#808080",
|
|
38215
|
-
lightGray: "#c0c0c0"
|
|
38216
|
-
};
|
|
38217
38521
|
function contentControlDom(data) {
|
|
38218
38522
|
let control = {};
|
|
38219
38523
|
try {
|
|
@@ -38248,8 +38552,8 @@ var markSpecs = {
|
|
|
38248
38552
|
parseDOM: [
|
|
38249
38553
|
{
|
|
38250
38554
|
tag: 'span[style*="background-color"]',
|
|
38251
|
-
getAttrs: (
|
|
38252
|
-
const color =
|
|
38555
|
+
getAttrs: (el6) => {
|
|
38556
|
+
const color = el6.style.backgroundColor.toLowerCase();
|
|
38253
38557
|
if (color === "white" || color === "rgb(255, 255, 255)" || color === "#ffffff")
|
|
38254
38558
|
return false;
|
|
38255
38559
|
const entry = Object.entries(wordHighlightColors).find(([, css]) => {
|
|
@@ -38286,20 +38590,20 @@ var markSpecs = {
|
|
|
38286
38590
|
parseDOM: [
|
|
38287
38591
|
{
|
|
38288
38592
|
tag: "span[lang], span[data-docx-east-asia-language], span[data-docx-bidi-language]",
|
|
38289
|
-
getAttrs: (
|
|
38290
|
-
language:
|
|
38291
|
-
eastAsiaLanguage:
|
|
38292
|
-
bidiLanguage:
|
|
38593
|
+
getAttrs: (el6) => ({
|
|
38594
|
+
language: el6.getAttribute("lang"),
|
|
38595
|
+
eastAsiaLanguage: el6.dataset.docxEastAsiaLanguage || null,
|
|
38596
|
+
bidiLanguage: el6.dataset.docxBidiLanguage || null
|
|
38293
38597
|
})
|
|
38294
38598
|
}
|
|
38295
38599
|
],
|
|
38296
38600
|
toDOM: (mark) => {
|
|
38297
|
-
const
|
|
38298
|
-
if (mark.attrs.language)
|
|
38601
|
+
const attrs4 = {};
|
|
38602
|
+
if (mark.attrs.language) attrs4.lang = mark.attrs.language;
|
|
38299
38603
|
if (mark.attrs.eastAsiaLanguage)
|
|
38300
|
-
|
|
38301
|
-
if (mark.attrs.bidiLanguage)
|
|
38302
|
-
return ["span",
|
|
38604
|
+
attrs4["data-docx-east-asia-language"] = mark.attrs.eastAsiaLanguage;
|
|
38605
|
+
if (mark.attrs.bidiLanguage) attrs4["data-docx-bidi-language"] = mark.attrs.bidiLanguage;
|
|
38606
|
+
return ["span", attrs4, 0];
|
|
38303
38607
|
}
|
|
38304
38608
|
},
|
|
38305
38609
|
runRtl: {
|
|
@@ -38319,14 +38623,14 @@ var markSpecs = {
|
|
|
38319
38623
|
parseDOM: [
|
|
38320
38624
|
{
|
|
38321
38625
|
tag: "span",
|
|
38322
|
-
getAttrs: (
|
|
38323
|
-
const style =
|
|
38324
|
-
const
|
|
38626
|
+
getAttrs: (el6) => {
|
|
38627
|
+
const style = el6.style;
|
|
38628
|
+
const attrs4 = {
|
|
38325
38629
|
family: pastedFontFamily(style.fontFamily),
|
|
38326
38630
|
size: style.fontSize ? parseFontSize(style.fontSize) : null,
|
|
38327
38631
|
color: pastedColor(style.color)
|
|
38328
38632
|
};
|
|
38329
|
-
return
|
|
38633
|
+
return attrs4.family || attrs4.size || attrs4.color ? attrs4 : false;
|
|
38330
38634
|
}
|
|
38331
38635
|
}
|
|
38332
38636
|
],
|
|
@@ -38348,7 +38652,7 @@ var markSpecs = {
|
|
|
38348
38652
|
parseDOM: [
|
|
38349
38653
|
{
|
|
38350
38654
|
tag: "span[data-docx-style]",
|
|
38351
|
-
getAttrs: (
|
|
38655
|
+
getAttrs: (el6) => ({ id: el6.dataset.docxStyle || null })
|
|
38352
38656
|
}
|
|
38353
38657
|
],
|
|
38354
38658
|
toDOM: (mark) => ["span", { "data-docx-style": mark.attrs.id }, 0]
|
|
@@ -38360,8 +38664,8 @@ var markSpecs = {
|
|
|
38360
38664
|
{
|
|
38361
38665
|
tag: "span[data-sdt]",
|
|
38362
38666
|
// Only a control is taken from (pasted) HTML; the span's text stays either way.
|
|
38363
|
-
getAttrs: (
|
|
38364
|
-
const control = controlFromData(
|
|
38667
|
+
getAttrs: (el6) => {
|
|
38668
|
+
const control = controlFromData(el6.dataset.sdt, "inline");
|
|
38365
38669
|
return control ? { data: JSON.stringify(control) } : false;
|
|
38366
38670
|
}
|
|
38367
38671
|
}
|
|
@@ -38375,9 +38679,9 @@ var markSpecs = {
|
|
|
38375
38679
|
parseDOM: [
|
|
38376
38680
|
{
|
|
38377
38681
|
tag: "span[data-field]",
|
|
38378
|
-
getAttrs: (
|
|
38379
|
-
instr:
|
|
38380
|
-
simple:
|
|
38682
|
+
getAttrs: (el6) => ({
|
|
38683
|
+
instr: el6.dataset.field || "",
|
|
38684
|
+
simple: el6.dataset.fieldSimple === "1"
|
|
38381
38685
|
})
|
|
38382
38686
|
}
|
|
38383
38687
|
],
|
|
@@ -38487,15 +38791,15 @@ function parseBordersJson(value) {
|
|
|
38487
38791
|
}
|
|
38488
38792
|
}
|
|
38489
38793
|
var twipsPx = (value) => Number.isSafeInteger(value) ? `${Number(value) / 15}px` : null;
|
|
38490
|
-
function tableStyle(
|
|
38491
|
-
const borders = parseBordersJson(
|
|
38492
|
-
const margins = marginValues(
|
|
38794
|
+
function tableStyle(attrs4) {
|
|
38795
|
+
const borders = parseBordersJson(attrs4.borders);
|
|
38796
|
+
const margins = marginValues(attrs4.cellMargins);
|
|
38493
38797
|
const declarations = [
|
|
38494
38798
|
"border-collapse:collapse",
|
|
38495
|
-
twipsPx(
|
|
38496
|
-
|
|
38497
|
-
|
|
38498
|
-
twipsPx(
|
|
38799
|
+
twipsPx(attrs4.widthTwips) && `width:${twipsPx(attrs4.widthTwips)}`,
|
|
38800
|
+
attrs4.alignment === "center" && "margin-left:auto;margin-right:auto",
|
|
38801
|
+
attrs4.alignment === "right" && "margin-left:auto",
|
|
38802
|
+
twipsPx(attrs4.indentTwips) && attrs4.alignment !== "center" && `margin-left:${twipsPx(attrs4.indentTwips)}`,
|
|
38499
38803
|
// Cells without their own resolved borders (e.g. a table inserted in the editor) draw the
|
|
38500
38804
|
// table's inside line; tables with no border information fall back to dashed gridlines.
|
|
38501
38805
|
borders && `--dve-cell-border:${cssBorderSide(borders.insideH ?? borders.top) ?? "none"}`,
|
|
@@ -38525,14 +38829,14 @@ function cellPadding(value) {
|
|
|
38525
38829
|
(side) => margins[side] === void 0 ? `var(--dve-cell-padding-${side}, ${DEFAULT_CELL_MARGINS[side] / 15}px)` : `${margins[side]}px`
|
|
38526
38830
|
).join(" ")}`;
|
|
38527
38831
|
}
|
|
38528
|
-
function tableCellStyle(
|
|
38529
|
-
const borders = parseBordersJson(
|
|
38530
|
-
const verticalAlign =
|
|
38832
|
+
function tableCellStyle(attrs4) {
|
|
38833
|
+
const borders = parseBordersJson(attrs4.borders);
|
|
38834
|
+
const verticalAlign = attrs4.verticalAlign === "center" ? "middle" : attrs4.verticalAlign === "bottom" ? "bottom" : "top";
|
|
38531
38835
|
const declarations = [
|
|
38532
|
-
cellPadding(
|
|
38836
|
+
cellPadding(attrs4.margins),
|
|
38533
38837
|
`vertical-align:${verticalAlign}`,
|
|
38534
|
-
twipsPx(
|
|
38535
|
-
typeof
|
|
38838
|
+
twipsPx(attrs4.widthTwips) && `width:${twipsPx(attrs4.widthTwips)}`,
|
|
38839
|
+
typeof attrs4.shadingFill === "string" && `background-color:${attrs4.shadingFill}`,
|
|
38536
38840
|
...["top", "bottom", "left", "right"].map(
|
|
38537
38841
|
(side) => borders && (cssBorderSide(borders[side]) ? `border-${side}:${cssBorderSide(borders[side])}` : `border-${side}-style:none`)
|
|
38538
38842
|
)
|
|
@@ -39337,6 +39641,50 @@ function replacementParts(template, match, wildcards = false) {
|
|
|
39337
39641
|
}
|
|
39338
39642
|
return parts;
|
|
39339
39643
|
}
|
|
39644
|
+
|
|
39645
|
+
// docx/find-stories.ts
|
|
39646
|
+
var HEADER_FOOTER_ORDER = [
|
|
39647
|
+
["header", "even"],
|
|
39648
|
+
["header", "default"],
|
|
39649
|
+
["footer", "even"],
|
|
39650
|
+
["footer", "default"],
|
|
39651
|
+
["header", "first"],
|
|
39652
|
+
["footer", "first"]
|
|
39653
|
+
];
|
|
39654
|
+
function findStories(model) {
|
|
39655
|
+
const stories = [{ kind: "main" }];
|
|
39656
|
+
const seen = /* @__PURE__ */ new Set();
|
|
39657
|
+
for (const [kind, slot] of HEADER_FOOTER_ORDER) {
|
|
39658
|
+
(model.sections ?? []).forEach((section, sectionIndex) => {
|
|
39659
|
+
const content = section[kind === "header" ? "headers" : "footers"]?.[slot];
|
|
39660
|
+
if (!content || seen.has(content) || content.partName && seen.has(content.partName)) return;
|
|
39661
|
+
seen.add(content);
|
|
39662
|
+
if (content.partName) seen.add(content.partName);
|
|
39663
|
+
stories.push({ kind, slot, sectionIndex, blocks: content.blocks });
|
|
39664
|
+
});
|
|
39665
|
+
}
|
|
39666
|
+
for (const note of model.footnotes ?? [])
|
|
39667
|
+
stories.push({ kind: "footnote", id: note.id, blocks: note.blocks });
|
|
39668
|
+
for (const note of model.endnotes ?? [])
|
|
39669
|
+
stories.push({ kind: "endnote", id: note.id, blocks: note.blocks });
|
|
39670
|
+
stories.push({ kind: "textBoxes" });
|
|
39671
|
+
return stories;
|
|
39672
|
+
}
|
|
39673
|
+
function findStoryKey(story) {
|
|
39674
|
+
switch (story.kind) {
|
|
39675
|
+
case "main":
|
|
39676
|
+
case "textBoxes":
|
|
39677
|
+
return story.kind;
|
|
39678
|
+
case "footnote":
|
|
39679
|
+
case "endnote":
|
|
39680
|
+
return `${story.kind}:${story.id}`;
|
|
39681
|
+
default:
|
|
39682
|
+
return `${story.kind}:${story.sectionIndex}:${story.slot}`;
|
|
39683
|
+
}
|
|
39684
|
+
}
|
|
39685
|
+
function findStoryGroup(story) {
|
|
39686
|
+
return story.kind === "footnote" || story.kind === "endnote" ? story.kind : findStoryKey(story);
|
|
39687
|
+
}
|
|
39340
39688
|
function editRestrictionOf(protection) {
|
|
39341
39689
|
if (!protection?.enforced) return void 0;
|
|
39342
39690
|
const { edit } = protection;
|
|
@@ -39531,6 +39879,7 @@ exports.FindPatternError = FindPatternError;
|
|
|
39531
39879
|
exports.HEADER_FOOTER_INPUT = HEADER_FOOTER_INPUT;
|
|
39532
39880
|
exports.NotePartsStep = NotePartsStep;
|
|
39533
39881
|
exports.PAGE_GAP = PAGE_GAP;
|
|
39882
|
+
exports.PARAGRAPH_EAST_ASIAN_KEYS = PARAGRAPH_EAST_ASIAN_KEYS;
|
|
39534
39883
|
exports.PARAGRAPH_KEEP_KEYS = PARAGRAPH_KEEP_KEYS;
|
|
39535
39884
|
exports.REMOTE_TRANSACTION_META = REMOTE_TRANSACTION_META;
|
|
39536
39885
|
exports.RESTRUCTURE_TABLE_META = RESTRUCTURE_TABLE_META;
|
|
@@ -39611,6 +39960,9 @@ exports.fieldResultRanges = fieldResultRanges;
|
|
|
39611
39960
|
exports.fieldsBalanced = fieldsBalanced;
|
|
39612
39961
|
exports.findCodeSource = findCodeSource;
|
|
39613
39962
|
exports.findMatches = findMatches;
|
|
39963
|
+
exports.findStories = findStories;
|
|
39964
|
+
exports.findStoryGroup = findStoryGroup;
|
|
39965
|
+
exports.findStoryKey = findStoryKey;
|
|
39614
39966
|
exports.fitZoomPercent = fitZoomPercent;
|
|
39615
39967
|
exports.forcesTrackChanges = forcesTrackChanges;
|
|
39616
39968
|
exports.formFieldBeside = formFieldBeside;
|