ooxml-core 1.50.2 → 1.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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 +1147 -251
- package/dist/index.mjs +1147 -251
- 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 +477 -62
- package/dist/text/index.d.ts +5 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.mjs +456 -63
- 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/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.mjs
CHANGED
|
@@ -181,13 +181,13 @@ function updatedInlineRunAttributes(node, format) {
|
|
|
181
181
|
if (Object.hasOwn(desired, key)) metadata[key] = desired[key];
|
|
182
182
|
else delete metadata[key];
|
|
183
183
|
}
|
|
184
|
-
const
|
|
184
|
+
const attrs4 = {
|
|
185
185
|
...node.attrs,
|
|
186
186
|
format: Object.keys(metadata).length ? JSON.stringify(metadata) : null
|
|
187
187
|
};
|
|
188
188
|
for (const key of DIRECT_RUN_PROPERTY_KEYS)
|
|
189
|
-
|
|
190
|
-
return
|
|
189
|
+
attrs4[attributeName(key)] = JSON.stringify(base[key]) === JSON.stringify(desired[key]) ? null : JSON.stringify(desired[key] ?? null);
|
|
190
|
+
return attrs4;
|
|
191
191
|
}
|
|
192
192
|
function wordInlinePropertyCodec(schema) {
|
|
193
193
|
return Object.values(schema.nodes).some((type) => type.spec.attrs?.[attributeName("bold")]) ? schema.marks.inlineCommentAnchors ? "word-yjs-v3" : "word-yjs-v2" : "word-yjs-v1";
|
|
@@ -1166,8 +1166,8 @@ function cellContent(state, cell, text2) {
|
|
|
1166
1166
|
nodes.push(child3);
|
|
1167
1167
|
return;
|
|
1168
1168
|
}
|
|
1169
|
-
const
|
|
1170
|
-
nodes.push(child3.type.create(
|
|
1169
|
+
const attrs4 = child3.attrs.contentControl ? { ...child3.attrs, contentControl: null } : child3.attrs;
|
|
1170
|
+
nodes.push(child3.type.create(attrs4, placed ? null : text2));
|
|
1171
1171
|
placed = true;
|
|
1172
1172
|
});
|
|
1173
1173
|
if (!placed) nodes.push(state.schema.nodes.paragraph.create(null, text2));
|
|
@@ -2500,8 +2500,8 @@ function parseRunProperties(props) {
|
|
|
2500
2500
|
if (scale !== void 0) result.textScalePercent = scale;
|
|
2501
2501
|
const kerning = parseHalfPoints(getW(first2(props, "kern"), "val"));
|
|
2502
2502
|
if (kerning !== void 0) result.kerningHalfPoints = kerning;
|
|
2503
|
-
const
|
|
2504
|
-
if (
|
|
2503
|
+
const position = parseSignedHalfPoints(getW(first2(props, "position"), "val"));
|
|
2504
|
+
if (position !== void 0) result.positionHalfPoints = position;
|
|
2505
2505
|
const shd = first2(props, "shd");
|
|
2506
2506
|
const fill = parseRgbColor(getW(shd, "fill"));
|
|
2507
2507
|
if (fill) result.shadingFill = fill;
|
|
@@ -3386,6 +3386,53 @@ function parseDrawingPictureFill(fill) {
|
|
|
3386
3386
|
};
|
|
3387
3387
|
}
|
|
3388
3388
|
|
|
3389
|
+
// opc/safe-href.ts
|
|
3390
|
+
var OPEN_SCHEMES = /* @__PURE__ */ new Set(["http", "https", "mailto"]);
|
|
3391
|
+
var STORE_SCHEMES = /* @__PURE__ */ new Set([...OPEN_SCHEMES, "ftp", "file"]);
|
|
3392
|
+
var SCRIPT_SCHEMES = /* @__PURE__ */ new Set([
|
|
3393
|
+
"javascript",
|
|
3394
|
+
"vbscript",
|
|
3395
|
+
"livescript",
|
|
3396
|
+
"jscript",
|
|
3397
|
+
"mocha",
|
|
3398
|
+
"data",
|
|
3399
|
+
"mhtml",
|
|
3400
|
+
"ms-its",
|
|
3401
|
+
"mk",
|
|
3402
|
+
"x-javascript",
|
|
3403
|
+
"blob"
|
|
3404
|
+
]);
|
|
3405
|
+
var IGNORABLE = new RegExp(
|
|
3406
|
+
"[\\u0000-\\u0020\\u007f\\u00ad\\u200b-\\u200f\\u202a-\\u202e\\u2060-\\u2064\\ufeff]",
|
|
3407
|
+
"gu"
|
|
3408
|
+
);
|
|
3409
|
+
var CONTROL = new RegExp("[\\u0000-\\u001f\\u007f]", "u");
|
|
3410
|
+
var SCHEME = /^([a-z][a-z0-9+.-]*):/;
|
|
3411
|
+
var STORE_ONLY = { store: true, open: false, reason: "not-openable" };
|
|
3412
|
+
var reject = (reason) => ({
|
|
3413
|
+
store: false,
|
|
3414
|
+
open: false,
|
|
3415
|
+
reason
|
|
3416
|
+
});
|
|
3417
|
+
function hyperlinkPolicy(href, options2 = {}) {
|
|
3418
|
+
if (typeof href !== "string") return reject("empty");
|
|
3419
|
+
const trimmed = href.trim();
|
|
3420
|
+
const normalized = trimmed.replace(IGNORABLE, "").toLowerCase();
|
|
3421
|
+
if (normalized.length === 0) return reject("empty");
|
|
3422
|
+
const scheme2 = SCHEME.exec(normalized)?.[1];
|
|
3423
|
+
if (scheme2 !== void 0 && SCRIPT_SCHEMES.has(scheme2)) return reject("script-scheme");
|
|
3424
|
+
if (scheme2 !== void 0 && !trimmed.toLowerCase().startsWith(`${scheme2}:`))
|
|
3425
|
+
return reject("obfuscated-scheme");
|
|
3426
|
+
if (CONTROL.test(trimmed)) return reject("control-characters");
|
|
3427
|
+
if (scheme2 === void 0) return options2.openRelative ? { store: true, open: true } : STORE_ONLY;
|
|
3428
|
+
if (scheme2.length === 1) return STORE_ONLY;
|
|
3429
|
+
if (OPEN_SCHEMES.has(scheme2)) return { store: true, open: true };
|
|
3430
|
+
if (options2.additionalOpenSchemes?.some((allowed) => allowed.toLowerCase() === scheme2))
|
|
3431
|
+
return { store: true, open: true };
|
|
3432
|
+
if (STORE_SCHEMES.has(scheme2)) return STORE_ONLY;
|
|
3433
|
+
return reject("unsupported-scheme");
|
|
3434
|
+
}
|
|
3435
|
+
|
|
3389
3436
|
// opc/signature/xml-utils.ts
|
|
3390
3437
|
function escapeXmlAttr(value) {
|
|
3391
3438
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
@@ -3582,8 +3629,8 @@ function parseDrawingFill(properties3) {
|
|
|
3582
3629
|
case "gradFill": {
|
|
3583
3630
|
const stops = children(first(fill, "gsLst", NS.a) ?? fill, "gs", NS.a).flatMap((stop) => {
|
|
3584
3631
|
const color = parseDrawingColorIn(stop);
|
|
3585
|
-
const
|
|
3586
|
-
return color && Number.isFinite(
|
|
3632
|
+
const position = Number.parseInt(stop.getAttribute("pos") ?? "", 10);
|
|
3633
|
+
return color && Number.isFinite(position) ? [{ position: position / 1e3, color }] : [];
|
|
3587
3634
|
});
|
|
3588
3635
|
const angle = Number.parseInt(first(fill, "lin", NS.a)?.getAttribute("ang") ?? "", 10);
|
|
3589
3636
|
const scaled = first(fill, "lin", NS.a)?.getAttribute("scaled");
|
|
@@ -4347,21 +4394,21 @@ function lerpStops(a, b, t) {
|
|
|
4347
4394
|
opacity: oa + (ob - oa) * t
|
|
4348
4395
|
};
|
|
4349
4396
|
}
|
|
4350
|
-
function gradientColorAt(stops,
|
|
4397
|
+
function gradientColorAt(stops, position) {
|
|
4351
4398
|
const first3 = stops[0];
|
|
4352
4399
|
const last = stops[stops.length - 1];
|
|
4353
|
-
if (
|
|
4400
|
+
if (position <= first3.position) {
|
|
4354
4401
|
return { color: first3.color, opacity: first3.opacity ?? 1 };
|
|
4355
4402
|
}
|
|
4356
|
-
if (
|
|
4403
|
+
if (position >= last.position) {
|
|
4357
4404
|
return { color: last.color, opacity: last.opacity ?? 1 };
|
|
4358
4405
|
}
|
|
4359
4406
|
for (let i = 0; i < stops.length - 1; i += 1) {
|
|
4360
4407
|
const from = stops[i];
|
|
4361
4408
|
const to = stops[i + 1];
|
|
4362
|
-
if (
|
|
4409
|
+
if (position >= from.position && position <= to.position) {
|
|
4363
4410
|
const span = to.position - from.position;
|
|
4364
|
-
const t = span > 0 ? (
|
|
4411
|
+
const t = span > 0 ? (position - from.position) / span : 0;
|
|
4365
4412
|
return lerpStops(from, to, t);
|
|
4366
4413
|
}
|
|
4367
4414
|
}
|
|
@@ -4623,8 +4670,8 @@ function readAttributes2(element3, out) {
|
|
|
4623
4670
|
function readTabStops(element3) {
|
|
4624
4671
|
return children(element3, "tab", NS.a).map((tab) => {
|
|
4625
4672
|
const stop = {};
|
|
4626
|
-
const
|
|
4627
|
-
if (
|
|
4673
|
+
const position = integerAttribute(tab, "pos");
|
|
4674
|
+
if (position !== void 0) stop.positionEmu = position;
|
|
4628
4675
|
const align = stringAttribute(tab, "algn");
|
|
4629
4676
|
if (align) stop.align = align;
|
|
4630
4677
|
return stop;
|
|
@@ -16299,7 +16346,7 @@ function isSpace(ch) {
|
|
|
16299
16346
|
return ch === " " || ch === " " || ch === "\n" || ch === "\r";
|
|
16300
16347
|
}
|
|
16301
16348
|
function parseAttributes(source) {
|
|
16302
|
-
const
|
|
16349
|
+
const attrs4 = {};
|
|
16303
16350
|
let i = 0;
|
|
16304
16351
|
const n2 = source.length;
|
|
16305
16352
|
while (i < n2) {
|
|
@@ -16334,9 +16381,9 @@ function parseAttributes(source) {
|
|
|
16334
16381
|
if (name2 === "xmlns" || name2.startsWith("xmlns:")) {
|
|
16335
16382
|
continue;
|
|
16336
16383
|
}
|
|
16337
|
-
|
|
16384
|
+
attrs4[localName(name2)] = decodeEntities(value);
|
|
16338
16385
|
}
|
|
16339
|
-
return
|
|
16386
|
+
return attrs4;
|
|
16340
16387
|
}
|
|
16341
16388
|
function tagEnd(xml, from) {
|
|
16342
16389
|
let quote = "";
|
|
@@ -16462,14 +16509,14 @@ function numOrNaN(value) {
|
|
|
16462
16509
|
function relation(value) {
|
|
16463
16510
|
return value === "ch" || value === "des" ? value : "self";
|
|
16464
16511
|
}
|
|
16465
|
-
function parseIterator(
|
|
16512
|
+
function parseIterator(attrs4) {
|
|
16466
16513
|
return {
|
|
16467
|
-
axis: list(
|
|
16468
|
-
ptType: list(
|
|
16469
|
-
hideLastTrans: list(
|
|
16470
|
-
st: numberList(
|
|
16471
|
-
cnt: numberList(
|
|
16472
|
-
step: numberList(
|
|
16514
|
+
axis: list(attrs4.axis),
|
|
16515
|
+
ptType: list(attrs4.ptType),
|
|
16516
|
+
hideLastTrans: list(attrs4.hideLastTrans).map((v) => v === "1" || v === "true"),
|
|
16517
|
+
st: numberList(attrs4.st),
|
|
16518
|
+
cnt: numberList(attrs4.cnt),
|
|
16519
|
+
step: numberList(attrs4.step)
|
|
16473
16520
|
};
|
|
16474
16521
|
}
|
|
16475
16522
|
function parseAlgorithm(element3) {
|
|
@@ -16500,41 +16547,41 @@ function parseShape(element3) {
|
|
|
16500
16547
|
adj
|
|
16501
16548
|
};
|
|
16502
16549
|
}
|
|
16503
|
-
function parseConstraint(
|
|
16504
|
-
const op =
|
|
16550
|
+
function parseConstraint(attrs4) {
|
|
16551
|
+
const op = attrs4.op;
|
|
16505
16552
|
return {
|
|
16506
|
-
type:
|
|
16507
|
-
for: relation(
|
|
16508
|
-
forName:
|
|
16509
|
-
ptType:
|
|
16510
|
-
refType:
|
|
16511
|
-
refFor: relation(
|
|
16512
|
-
refForName:
|
|
16513
|
-
refPtType:
|
|
16553
|
+
type: attrs4.type ?? "none",
|
|
16554
|
+
for: relation(attrs4.for),
|
|
16555
|
+
forName: attrs4.forName || void 0,
|
|
16556
|
+
ptType: attrs4.ptType ?? "all",
|
|
16557
|
+
refType: attrs4.refType ?? "none",
|
|
16558
|
+
refFor: relation(attrs4.refFor),
|
|
16559
|
+
refForName: attrs4.refForName || void 0,
|
|
16560
|
+
refPtType: attrs4.refPtType ?? "all",
|
|
16514
16561
|
op: op === "equ" || op === "gte" || op === "lte" ? op : "none",
|
|
16515
|
-
val: num(
|
|
16516
|
-
hasVal:
|
|
16517
|
-
fact: num(
|
|
16562
|
+
val: num(attrs4.val, 0),
|
|
16563
|
+
hasVal: attrs4.val !== void 0,
|
|
16564
|
+
fact: num(attrs4.fact, 1)
|
|
16518
16565
|
};
|
|
16519
16566
|
}
|
|
16520
|
-
function parseRule(
|
|
16567
|
+
function parseRule(attrs4) {
|
|
16521
16568
|
return {
|
|
16522
|
-
type:
|
|
16523
|
-
for: relation(
|
|
16524
|
-
forName:
|
|
16525
|
-
ptType:
|
|
16526
|
-
val: numOrNaN(
|
|
16527
|
-
fact: numOrNaN(
|
|
16528
|
-
max: numOrNaN(
|
|
16569
|
+
type: attrs4.type ?? "none",
|
|
16570
|
+
for: relation(attrs4.for),
|
|
16571
|
+
forName: attrs4.forName || void 0,
|
|
16572
|
+
ptType: attrs4.ptType ?? "all",
|
|
16573
|
+
val: numOrNaN(attrs4.val),
|
|
16574
|
+
fact: numOrNaN(attrs4.fact),
|
|
16575
|
+
max: numOrNaN(attrs4.max)
|
|
16529
16576
|
};
|
|
16530
16577
|
}
|
|
16531
|
-
function parseCondition(
|
|
16578
|
+
function parseCondition(attrs4) {
|
|
16532
16579
|
return {
|
|
16533
|
-
...parseIterator(
|
|
16534
|
-
func:
|
|
16535
|
-
arg:
|
|
16536
|
-
op:
|
|
16537
|
-
val:
|
|
16580
|
+
...parseIterator(attrs4),
|
|
16581
|
+
func: attrs4.func ?? "cnt",
|
|
16582
|
+
arg: attrs4.arg,
|
|
16583
|
+
op: attrs4.op ?? "equ",
|
|
16584
|
+
val: attrs4.val ?? ""
|
|
16538
16585
|
};
|
|
16539
16586
|
}
|
|
16540
16587
|
function parseBody(element3, state) {
|
|
@@ -19023,8 +19070,8 @@ function endpoints(point) {
|
|
|
19023
19070
|
const content = parent.children.filter((c) => c.type === "node" || c.type === "asst");
|
|
19024
19071
|
const index = parent.children.indexOf(point);
|
|
19025
19072
|
const before = parent.children[index - 1];
|
|
19026
|
-
const
|
|
19027
|
-
return [before, content[(
|
|
19073
|
+
const position = before === void 0 ? -1 : content.indexOf(before);
|
|
19074
|
+
return [before, content[(position + 1) % Math.max(1, content.length)]];
|
|
19028
19075
|
}
|
|
19029
19076
|
function findShape(scope, point, name2, skip) {
|
|
19030
19077
|
if (!point) {
|
|
@@ -24869,18 +24916,18 @@ function esc(text2) {
|
|
|
24869
24916
|
}
|
|
24870
24917
|
var n = (value) => String(Math.round(value * 100) / 100);
|
|
24871
24918
|
var textWidth = (text2, size = FONT_SIZE) => text2.length * size * 0.55;
|
|
24872
|
-
function text(x, y, content,
|
|
24919
|
+
function text(x, y, content, attrs4 = {}) {
|
|
24873
24920
|
const parts = [`x="${n(x)}"`, `y="${n(y)}"`];
|
|
24874
|
-
parts.push(`font-size="${
|
|
24875
|
-
parts.push(`fill="${esc(
|
|
24876
|
-
if (
|
|
24877
|
-
if (
|
|
24878
|
-
if (
|
|
24879
|
-
if (
|
|
24880
|
-
if (
|
|
24881
|
-
if (
|
|
24882
|
-
if (
|
|
24883
|
-
parts.push(`text-decoration="${
|
|
24921
|
+
parts.push(`font-size="${attrs4.size ?? FONT_SIZE}"`);
|
|
24922
|
+
parts.push(`fill="${esc(attrs4.fill ?? TEXT_COLOR)}"`);
|
|
24923
|
+
if (attrs4.anchor && attrs4.anchor !== "start") parts.push(`text-anchor="${attrs4.anchor}"`);
|
|
24924
|
+
if (attrs4.weight) parts.push(`font-weight="${attrs4.weight}"`);
|
|
24925
|
+
if (attrs4.baseline) parts.push(`dominant-baseline="${attrs4.baseline}"`);
|
|
24926
|
+
if (attrs4.family) parts.push(`font-family="${esc(attrs4.family)}"`);
|
|
24927
|
+
if (attrs4.filter) parts.push(`filter="${esc(attrs4.filter)}"`);
|
|
24928
|
+
if (attrs4.italic !== void 0) parts.push(`font-style="${attrs4.italic ? "italic" : "normal"}"`);
|
|
24929
|
+
if (attrs4.underline !== void 0)
|
|
24930
|
+
parts.push(`text-decoration="${attrs4.underline ? "underline" : "none"}"`);
|
|
24884
24931
|
return `<text ${parts.join(" ")}>${esc(content)}</text>`;
|
|
24885
24932
|
}
|
|
24886
24933
|
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}"/>`;
|
|
@@ -25004,8 +25051,8 @@ var GAP = 3;
|
|
|
25004
25051
|
var LINE = 1.2;
|
|
25005
25052
|
var NAMED_COLORS = /^(black|blue|cyan|green|magenta|red|white|yellow)$/iu;
|
|
25006
25053
|
function measure3(model, label) {
|
|
25007
|
-
const
|
|
25008
|
-
const size =
|
|
25054
|
+
const attrs4 = chartTextAttributes(model, "dataLabel", 10);
|
|
25055
|
+
const size = attrs4.size ?? 10;
|
|
25009
25056
|
const lines = label.text.split("\n");
|
|
25010
25057
|
return {
|
|
25011
25058
|
...model.frameSize ? { frame: model.frameSize } : {},
|
|
@@ -25013,7 +25060,7 @@ function measure3(model, label) {
|
|
|
25013
25060
|
size,
|
|
25014
25061
|
w: Math.max(...lines.map((l) => textWidth(l, size))),
|
|
25015
25062
|
h: lines.length * size * LINE,
|
|
25016
|
-
attrs:
|
|
25063
|
+
attrs: attrs4
|
|
25017
25064
|
};
|
|
25018
25065
|
}
|
|
25019
25066
|
function draw(m, label, x, y, anchor, out) {
|
|
@@ -25030,8 +25077,8 @@ function barLabels(model, marks, out) {
|
|
|
25030
25077
|
const label = mark.series.labels?.[mark.index];
|
|
25031
25078
|
if (!label) continue;
|
|
25032
25079
|
const m = measure3(model, label);
|
|
25033
|
-
let
|
|
25034
|
-
if (stacked &&
|
|
25080
|
+
let position = label.position ?? (stacked ? "ctr" : "outEnd");
|
|
25081
|
+
if (stacked && position === "outEnd") position = "ctr";
|
|
25035
25082
|
const cx = mark.x + mark.w / 2;
|
|
25036
25083
|
const cy = mark.y + mark.h / 2;
|
|
25037
25084
|
if (model.horizontal) {
|
|
@@ -25042,14 +25089,14 @@ function barLabels(model, marks, out) {
|
|
|
25042
25089
|
at + (outward ? dir2 : -dir2) * GAP,
|
|
25043
25090
|
(outward ? dir2 : -dir2) > 0 ? "start" : "end"
|
|
25044
25091
|
];
|
|
25045
|
-
const [x, anchor] =
|
|
25092
|
+
const [x, anchor] = position === "ctr" ? [cx, "middle"] : position === "inEnd" ? side(end, false) : position === "inBase" ? side(base, true) : side(end, true);
|
|
25046
25093
|
draw(m, label, x, cy, anchor, out);
|
|
25047
25094
|
continue;
|
|
25048
25095
|
}
|
|
25049
25096
|
const top = mark.negative ? mark.y + mark.h : mark.y;
|
|
25050
25097
|
const bottom = mark.negative ? mark.y : mark.y + mark.h;
|
|
25051
25098
|
const dir = mark.negative ? 1 : -1;
|
|
25052
|
-
const y =
|
|
25099
|
+
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);
|
|
25053
25100
|
draw(m, label, cx, y, "middle", out);
|
|
25054
25101
|
}
|
|
25055
25102
|
}
|
|
@@ -25322,13 +25369,13 @@ function chartDataTableSvg(model, plot) {
|
|
|
25322
25369
|
const bottom = top + height;
|
|
25323
25370
|
const cellW = plot.w / Math.max(1, model.categories.length);
|
|
25324
25371
|
const styled = { ...model, appearance: { ...model.appearance, dataLabel: table.text ?? {} } };
|
|
25325
|
-
const
|
|
25372
|
+
const attrs4 = chartTextAttributes(styled, "dataLabel", fontSize);
|
|
25326
25373
|
const out = ['<g data-chart-part="dataTable">'];
|
|
25327
25374
|
const border = (x1, y1, x2, y2) => out.push(
|
|
25328
25375
|
`<line x1="${n(x1)}" y1="${n(y1)}" x2="${n(x2)}" y2="${n(y2)}" ${strokeAttributes(table.stroke)}/>`
|
|
25329
25376
|
);
|
|
25330
25377
|
const label = (x, y, value, width, anchor = "middle") => out.push(
|
|
25331
|
-
text(x, y + fontSize * 0.35, fit(value, Math.max(1, width), fontSize), { ...
|
|
25378
|
+
text(x, y + fontSize * 0.35, fit(value, Math.max(1, width), fontSize), { ...attrs4, anchor })
|
|
25332
25379
|
);
|
|
25333
25380
|
if (table.fill) out.push(rect2(left, top, right - left, height, table.fill));
|
|
25334
25381
|
if (source.showOutline !== false) {
|
|
@@ -25565,7 +25612,7 @@ function chartDateAxis(model, plot, out) {
|
|
|
25565
25612
|
const min = axis.scaling.min ?? points[0].value;
|
|
25566
25613
|
const max = axis.scaling.max ?? points.at(-1).value;
|
|
25567
25614
|
if (!Number.isFinite(min) || !Number.isFinite(max) || max < min) return void 0;
|
|
25568
|
-
const
|
|
25615
|
+
const position = (value) => {
|
|
25569
25616
|
const ratio = max === min ? 0.5 : (value - min) / (max - min);
|
|
25570
25617
|
const t = axis.scaling.orientation === "maxMin" ? 1 - ratio : ratio;
|
|
25571
25618
|
return model.horizontal ? plot.y + plot.h * (1 - t) : plot.x + plot.w * t;
|
|
@@ -25580,8 +25627,8 @@ function chartDateAxis(model, plot, out) {
|
|
|
25580
25627
|
unit,
|
|
25581
25628
|
Math.max(1, axis.majorUnit ?? 1)
|
|
25582
25629
|
);
|
|
25583
|
-
const
|
|
25584
|
-
const size =
|
|
25630
|
+
const attrs4 = chartTextAttributes(model, "categoryAxis");
|
|
25631
|
+
const size = attrs4.size ?? 10;
|
|
25585
25632
|
const y = axis.position === "t" ? plot.y : plot.y + plot.h;
|
|
25586
25633
|
const paint2 = model.axes?.category?.line;
|
|
25587
25634
|
const stroke = { color: paint2?.color ?? "#BFBFBF", width: paint2?.width ?? 1 };
|
|
@@ -25596,11 +25643,11 @@ function chartDateAxis(model, plot, out) {
|
|
|
25596
25643
|
const a = placement === "cross" ? -length : 0;
|
|
25597
25644
|
const b = placement === "cross" ? length : placement === "in" ? direction * length : -direction * length;
|
|
25598
25645
|
out.push(
|
|
25599
|
-
`<line x1="${x + a}" y1="${
|
|
25646
|
+
`<line x1="${x + a}" y1="${position(serial)}" x2="${x + b}" y2="${position(serial)}" ${strokeAttributes(stroke)} data-chart-part="dateTick"/>`
|
|
25600
25647
|
);
|
|
25601
25648
|
} else
|
|
25602
25649
|
out.push(
|
|
25603
|
-
`<line x1="${
|
|
25650
|
+
`<line x1="${position(serial)}" y1="${y + start}" x2="${position(serial)}" y2="${y + end}" ${strokeAttributes(stroke)} data-chart-part="dateTick"/>`
|
|
25604
25651
|
);
|
|
25605
25652
|
};
|
|
25606
25653
|
ticks.forEach((serial, index) => {
|
|
@@ -25613,13 +25660,13 @@ function chartDateAxis(model, plot, out) {
|
|
|
25613
25660
|
axis.numberFormat?.formatCode
|
|
25614
25661
|
);
|
|
25615
25662
|
if (model.horizontal)
|
|
25616
|
-
out.push(text(plot.x - 4,
|
|
25663
|
+
out.push(text(plot.x - 4, position(serial) + size * 0.3, label, { ...attrs4, anchor: "end" }));
|
|
25617
25664
|
else {
|
|
25618
25665
|
const above = axis.tickLabelPosition === "high" || axis.tickLabelPosition !== "low" && axis.position === "t";
|
|
25619
25666
|
const baseline = axis.tickLabelPosition === "high" ? plot.y : axis.tickLabelPosition === "low" ? plot.y + plot.h : y;
|
|
25620
25667
|
out.push(
|
|
25621
|
-
text(
|
|
25622
|
-
...
|
|
25668
|
+
text(position(serial), baseline + (above ? -4 : size + 3), label, {
|
|
25669
|
+
...attrs4,
|
|
25623
25670
|
anchor: "middle"
|
|
25624
25671
|
})
|
|
25625
25672
|
);
|
|
@@ -25636,7 +25683,7 @@ function chartDateAxis(model, plot, out) {
|
|
|
25636
25683
|
mark(serial, axis.minorTickMark, 2.5);
|
|
25637
25684
|
return {
|
|
25638
25685
|
order: visible.map((p2) => p2.index),
|
|
25639
|
-
band: (index) =>
|
|
25686
|
+
band: (index) => position(values[index] ?? min),
|
|
25640
25687
|
bandSize: (model.horizontal ? plot.h : plot.w) / Math.max(1, max - min + 1)
|
|
25641
25688
|
};
|
|
25642
25689
|
}
|
|
@@ -25675,11 +25722,11 @@ function smoothSegment(points, i) {
|
|
|
25675
25722
|
function chartLineSvg(points, series) {
|
|
25676
25723
|
if (points.length < 2) return "";
|
|
25677
25724
|
const stroke = series.stroke;
|
|
25678
|
-
const
|
|
25725
|
+
const attrs4 = strokeAttributes(
|
|
25679
25726
|
stroke ? { ...stroke, color: stroke.color === "none" ? "none" : series.color } : { color: series.color, width: 2.25 }
|
|
25680
25727
|
);
|
|
25681
25728
|
const filter = series.shadowFilter ? ` filter="${series.shadowFilter}"` : "";
|
|
25682
|
-
return series.smooth ? `<path d="${smoothLinePath(points)}" fill="none" ${
|
|
25729
|
+
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}/>`;
|
|
25683
25730
|
}
|
|
25684
25731
|
|
|
25685
25732
|
// chart/render/chart-svg-plot-layout.ts
|
|
@@ -25771,11 +25818,11 @@ function styledAxisLine(x1, y1, x2, y2, paint2, fallback) {
|
|
|
25771
25818
|
dash ? ` stroke-dasharray="${dash}"/>` : "/>"
|
|
25772
25819
|
);
|
|
25773
25820
|
}
|
|
25774
|
-
function axisGridlines(model, axis, ticks,
|
|
25821
|
+
function axisGridlines(model, axis, ticks, position, plot, vertical) {
|
|
25775
25822
|
const draw2 = (values, paint2, minor2) => {
|
|
25776
25823
|
const fallback = chartStroke(model, minor2 ? "gridlineMinor" : "gridlineMajor");
|
|
25777
25824
|
return values.map((value) => {
|
|
25778
|
-
const p2 =
|
|
25825
|
+
const p2 = position(value);
|
|
25779
25826
|
return vertical ? styledAxisLine(p2, plot.y, p2, plot.y + plot.h, paint2, fallback) : styledAxisLine(plot.x, p2, plot.x + plot.w, p2, paint2, fallback);
|
|
25780
25827
|
}).join("");
|
|
25781
25828
|
};
|
|
@@ -26312,7 +26359,7 @@ function labelsOf(source, view, categories, numberFormat, resolveColor) {
|
|
|
26312
26359
|
view.values.forEach((value, i) => {
|
|
26313
26360
|
const point = points?.[i];
|
|
26314
26361
|
if (value === null || point?.deleted === true) return;
|
|
26315
|
-
const
|
|
26362
|
+
const position = point?.position ?? series?.position ?? chart?.position;
|
|
26316
26363
|
const x = view.xValues?.[i];
|
|
26317
26364
|
const category = x === void 0 || x === null ? categories[i] : formatAxisValue(x);
|
|
26318
26365
|
let built;
|
|
@@ -26349,7 +26396,7 @@ function labelsOf(source, view, categories, numberFormat, resolveColor) {
|
|
|
26349
26396
|
...layout ? { layout } : {},
|
|
26350
26397
|
...showLeaderLines !== void 0 ? { showLeaderLines } : {},
|
|
26351
26398
|
...leaderLine ? { leaderLine } : {},
|
|
26352
|
-
...
|
|
26399
|
+
...position ? { position } : {},
|
|
26353
26400
|
...built.color ? { color: built.color } : {}
|
|
26354
26401
|
};
|
|
26355
26402
|
});
|
|
@@ -27351,11 +27398,11 @@ function resolveRegionCode(label) {
|
|
|
27351
27398
|
|
|
27352
27399
|
// chart/region-map/data.ts
|
|
27353
27400
|
function sourceIndices(indices, length) {
|
|
27354
|
-
return Array.from({ length }, (_,
|
|
27401
|
+
return Array.from({ length }, (_, position) => indices?.[position] ?? position);
|
|
27355
27402
|
}
|
|
27356
27403
|
function valueAtSource(values, indices, sourceIndex) {
|
|
27357
|
-
const
|
|
27358
|
-
return
|
|
27404
|
+
const position = indices.indexOf(sourceIndex);
|
|
27405
|
+
return position >= 0 ? values[position] : void 0;
|
|
27359
27406
|
}
|
|
27360
27407
|
function cachedEntityName(cache, entityId) {
|
|
27361
27408
|
if (!cache || typeof cache !== "object") {
|
|
@@ -27450,18 +27497,18 @@ function resolveValueColorStops(valueColors, valueColorPositions, minVal, maxVal
|
|
|
27450
27497
|
if (!valueColors || valueColors.length < 2) {
|
|
27451
27498
|
return void 0;
|
|
27452
27499
|
}
|
|
27453
|
-
const span = maxVal - minVal || 1, count = valueColors.length, resolvePosition = (
|
|
27454
|
-
if (
|
|
27500
|
+
const span = maxVal - minVal || 1, count = valueColors.length, resolvePosition = (position, index) => {
|
|
27501
|
+
if (position?.kind === "min") {
|
|
27455
27502
|
return 0;
|
|
27456
27503
|
}
|
|
27457
|
-
if (
|
|
27504
|
+
if (position?.kind === "max") {
|
|
27458
27505
|
return 1;
|
|
27459
27506
|
}
|
|
27460
|
-
if (
|
|
27461
|
-
return Math.min(1, Math.max(0, (
|
|
27507
|
+
if (position?.kind === "number" && position.value !== void 0) {
|
|
27508
|
+
return Math.min(1, Math.max(0, (position.value - minVal) / span));
|
|
27462
27509
|
}
|
|
27463
|
-
if (
|
|
27464
|
-
return Math.min(1, Math.max(0,
|
|
27510
|
+
if (position?.kind === "percent" && position.value !== void 0) {
|
|
27511
|
+
return Math.min(1, Math.max(0, position.value / 100));
|
|
27465
27512
|
}
|
|
27466
27513
|
return count === 1 ? 0 : index / (count - 1);
|
|
27467
27514
|
};
|
|
@@ -28007,13 +28054,13 @@ function regionMapSvg(model, area, approximationLabel) {
|
|
|
28007
28054
|
out.push("</svg>");
|
|
28008
28055
|
const y = area.y + height * scale + 5, bar = Math.min(160, area.w * 0.4), left = area.x + (area.w - bar) / 2;
|
|
28009
28056
|
if (model.showLegend) {
|
|
28010
|
-
const
|
|
28011
|
-
out.push(text(left - 8, y + size * 0.4, series.name, { ...
|
|
28057
|
+
const attrs4 = chartTextAttributes(model, "legend", 16), size = attrs4.size ?? 16;
|
|
28058
|
+
out.push(text(left - 8, y + size * 0.4, series.name, { ...attrs4, anchor: "end" }));
|
|
28012
28059
|
for (let i = 0; i < 32; i++)
|
|
28013
28060
|
out.push(rect2(left + i * bar / 32, y, bar / 32 + 0.1, 7, colors((i + 0.5) / 32)));
|
|
28014
28061
|
out.push(
|
|
28015
|
-
text(left, y + 8 + size, String(min),
|
|
28016
|
-
text(left + bar, y + 8 + size, String(max), { ...
|
|
28062
|
+
text(left, y + 8 + size, String(min), attrs4),
|
|
28063
|
+
text(left + bar, y + 8 + size, String(max), { ...attrs4, anchor: "end" })
|
|
28017
28064
|
);
|
|
28018
28065
|
}
|
|
28019
28066
|
let row = y + (model.showLegend ? 32 : 0);
|
|
@@ -28071,10 +28118,10 @@ function computeFunnelGeometry(values, plot, gapWidth = 33) {
|
|
|
28071
28118
|
function funnelSvg(model, area) {
|
|
28072
28119
|
const series = model.series[0];
|
|
28073
28120
|
if (!series || series.hidden) return "";
|
|
28074
|
-
const
|
|
28121
|
+
const attrs4 = chartTextAttributes(model, "categoryAxis", 10);
|
|
28075
28122
|
const width = Math.min(
|
|
28076
28123
|
area.w * 0.3,
|
|
28077
|
-
Math.max(32, ...model.categories.map((s) => s.length * (
|
|
28124
|
+
Math.max(32, ...model.categories.map((s) => s.length * (attrs4.size ?? 10) * 0.55 + 8))
|
|
28078
28125
|
);
|
|
28079
28126
|
const plot = { x: area.x + width, y: area.y, width: Math.max(1, area.w - width), height: area.h };
|
|
28080
28127
|
const out = [
|
|
@@ -28104,9 +28151,9 @@ function funnelSvg(model, area) {
|
|
|
28104
28151
|
out.push(
|
|
28105
28152
|
text(
|
|
28106
28153
|
plot.x - 8,
|
|
28107
|
-
bar.y + bar.height / 2 + (
|
|
28108
|
-
fit(model.categories[bar.index] ?? "", width - 8,
|
|
28109
|
-
{ ...
|
|
28154
|
+
bar.y + bar.height / 2 + (attrs4.size ?? 10) * 0.35,
|
|
28155
|
+
fit(model.categories[bar.index] ?? "", width - 8, attrs4.size ?? 10),
|
|
28156
|
+
{ ...attrs4, anchor: "end" }
|
|
28110
28157
|
)
|
|
28111
28158
|
);
|
|
28112
28159
|
out.push("</g>");
|
|
@@ -28490,14 +28537,14 @@ function sliceLabels(model, marks, out) {
|
|
|
28490
28537
|
mark.cx + radius * ux,
|
|
28491
28538
|
mark.cy + radius * uy
|
|
28492
28539
|
];
|
|
28493
|
-
const
|
|
28540
|
+
const position = label.position ?? (model.type === "doughnut" ? "ctr" : "bestFit");
|
|
28494
28541
|
let x;
|
|
28495
28542
|
let y;
|
|
28496
|
-
if (
|
|
28497
|
-
else if (
|
|
28543
|
+
if (position === "ctr") [x, y] = place2(mark.inner + (mark.outer - mark.inner) / 2);
|
|
28544
|
+
else if (position === "inEnd") {
|
|
28498
28545
|
const extent = Math.abs(ux) * m.w / 2 + Math.abs(uy) * m.h / 2;
|
|
28499
28546
|
[x, y] = place2(Math.max(0, mark.outer - GAP2 - extent));
|
|
28500
|
-
} else if (
|
|
28547
|
+
} else if (position === "outEnd") {
|
|
28501
28548
|
const extent = Math.abs(ux) * m.w / 2 + Math.abs(uy) * m.h / 2;
|
|
28502
28549
|
[x, y] = place2(mark.outer + GAP2 + extent);
|
|
28503
28550
|
} else {
|
|
@@ -28762,26 +28809,26 @@ function sunburstSvg(model, area) {
|
|
|
28762
28809
|
|
|
28763
28810
|
// chart/render/chart-svg-text-metrics.ts
|
|
28764
28811
|
var CHART_FONT_FAMILY = "Calibri, Carlito, Arial, sans-serif";
|
|
28765
|
-
function cssFont(
|
|
28766
|
-
return `${
|
|
28812
|
+
function cssFont(attrs4) {
|
|
28813
|
+
return `${attrs4.italic ? "italic" : "normal"} ${attrs4.weight ?? "normal"} ${attrs4.size ?? 10}px ${attrs4.family ?? CHART_FONT_FAMILY}`;
|
|
28767
28814
|
}
|
|
28768
|
-
function chartFontMetrics(
|
|
28769
|
-
const metrics = options2.measureFont?.(cssFont(
|
|
28815
|
+
function chartFontMetrics(attrs4, options2) {
|
|
28816
|
+
const metrics = options2.measureFont?.(cssFont(attrs4));
|
|
28770
28817
|
return metrics && Number.isFinite(metrics.ascent) && Number.isFinite(metrics.descent) && metrics.ascent >= 0 && metrics.descent >= 0 && metrics.ascent + metrics.descent > 0 ? metrics : void 0;
|
|
28771
28818
|
}
|
|
28772
|
-
function chartTextWidth(content,
|
|
28773
|
-
const width = options2.measureText?.(content, cssFont(
|
|
28774
|
-
return width !== void 0 && Number.isFinite(width) && width >= 0 ? width : textWidth(content,
|
|
28819
|
+
function chartTextWidth(content, attrs4, options2) {
|
|
28820
|
+
const width = options2.measureText?.(content, cssFont(attrs4));
|
|
28821
|
+
return width !== void 0 && Number.isFinite(width) && width >= 0 ? width : textWidth(content, attrs4.size);
|
|
28775
28822
|
}
|
|
28776
|
-
function fitChartText(content, maxWidth,
|
|
28777
|
-
if (!options2.measureText) return fit(content, maxWidth,
|
|
28778
|
-
if (chartTextWidth(content,
|
|
28823
|
+
function fitChartText(content, maxWidth, attrs4, options2) {
|
|
28824
|
+
if (!options2.measureText) return fit(content, maxWidth, attrs4.size);
|
|
28825
|
+
if (chartTextWidth(content, attrs4, options2) <= maxWidth) return content;
|
|
28779
28826
|
const points = [...content];
|
|
28780
28827
|
let low = 0;
|
|
28781
28828
|
let high = points.length;
|
|
28782
28829
|
while (low < high) {
|
|
28783
28830
|
const mid = Math.ceil((low + high) / 2);
|
|
28784
|
-
if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`,
|
|
28831
|
+
if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`, attrs4, options2) <= maxWidth) low = mid;
|
|
28785
28832
|
else high = mid - 1;
|
|
28786
28833
|
}
|
|
28787
28834
|
return `${points.slice(0, low).join("")}\u2026`;
|
|
@@ -28803,13 +28850,13 @@ function chartLegendSvg(model, area, frame2, options2) {
|
|
|
28803
28850
|
});
|
|
28804
28851
|
if (!manual) return { plot, markup: automatic.join(""), foreground: !!model.legendOverlay };
|
|
28805
28852
|
const entries = legendEntries(model);
|
|
28806
|
-
const
|
|
28807
|
-
const size =
|
|
28808
|
-
const font = chartFontMetrics(
|
|
28853
|
+
const attrs4 = chartTextAttributes(model, "legend");
|
|
28854
|
+
const size = attrs4.size ?? 10;
|
|
28855
|
+
const font = chartFontMetrics(attrs4, options2);
|
|
28809
28856
|
const keySize = size / 2;
|
|
28810
28857
|
const keyGap = size / 4;
|
|
28811
28858
|
const widths = entries.map(
|
|
28812
|
-
(entry) => chartTextWidth(entry.label,
|
|
28859
|
+
(entry) => chartTextWidth(entry.label, attrs4, options2) + keySize + keyGap
|
|
28813
28860
|
);
|
|
28814
28861
|
const horizontal = manual.width > manual.height && widths.reduce((sum, width) => sum + width, 0) + size <= manual.width;
|
|
28815
28862
|
const rowWidth = horizontal ? manual.width / entries.length : manual.width;
|
|
@@ -28825,13 +28872,13 @@ function chartLegendSvg(model, area, frame2, options2) {
|
|
|
28825
28872
|
const baselineOffset = font ? (font.ascent - font.descent) / 2 : size * 0.35;
|
|
28826
28873
|
const widest = extentOf(widths).max;
|
|
28827
28874
|
entries.forEach((entry, i) => {
|
|
28828
|
-
const available = horizontal ? chartTextWidth(entry.label,
|
|
28829
|
-
const label = fitChartText(entry.label, available,
|
|
28875
|
+
const available = horizontal ? chartTextWidth(entry.label, attrs4, options2) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
|
|
28876
|
+
const label = fitChartText(entry.label, available, attrs4, options2);
|
|
28830
28877
|
const contentWidth = Math.min(horizontal ? widths[i] ?? 0 : widest, rowWidth - size / 2);
|
|
28831
28878
|
const x = horizontal ? horizontalX : manual.x + Math.max(size / 4, (rowWidth - contentWidth) / 2);
|
|
28832
28879
|
const centerY = manual.y + (horizontal ? 0 : i * rowHeight) + rowHeight / 2;
|
|
28833
28880
|
markup.push(rect2(x, centerY - keySize / 2, keySize, keySize, entry.color));
|
|
28834
|
-
markup.push(text(x + keySize + keyGap, centerY + baselineOffset, label,
|
|
28881
|
+
markup.push(text(x + keySize + keyGap, centerY + baselineOffset, label, attrs4));
|
|
28835
28882
|
if (horizontal) horizontalX += (widths[i] ?? 0) + horizontalGap;
|
|
28836
28883
|
});
|
|
28837
28884
|
return {
|
|
@@ -28870,12 +28917,12 @@ function automaticLegend(model, area, out, options2, bounds) {
|
|
|
28870
28917
|
const entries = legendEntries(model);
|
|
28871
28918
|
if (!model.showLegend || entries.length === 0) return area;
|
|
28872
28919
|
const pos = model.legendPosition;
|
|
28873
|
-
const
|
|
28874
|
-
const size =
|
|
28920
|
+
const attrs4 = chartTextAttributes(model, "legend");
|
|
28921
|
+
const size = attrs4.size ?? 10;
|
|
28875
28922
|
const rowH = Math.max(16, size * 1.4);
|
|
28876
28923
|
if (pos === "t" || pos === "b") {
|
|
28877
28924
|
const widths = entries.map(
|
|
28878
|
-
(e) => Math.min(chartTextWidth(e.label,
|
|
28925
|
+
(e) => Math.min(chartTextWidth(e.label, attrs4, options2) + 20, area.w / 2)
|
|
28879
28926
|
);
|
|
28880
28927
|
const total = widths.reduce((a, b) => a + b, 0);
|
|
28881
28928
|
let x2 = area.x + Math.max(0, (area.w - total) / 2);
|
|
@@ -28892,14 +28939,14 @@ function automaticLegend(model, area, out, options2, bounds) {
|
|
|
28892
28939
|
entries.forEach((e, i) => {
|
|
28893
28940
|
const w = widths[i] ?? 0;
|
|
28894
28941
|
out.push(rect2(x2, y, 8, 8, e.color));
|
|
28895
|
-
out.push(text(x2 + 12, y + 8, fitChartText(e.label, w - 16,
|
|
28942
|
+
out.push(text(x2 + 12, y + 8, fitChartText(e.label, w - 16, attrs4, options2), attrs4));
|
|
28896
28943
|
x2 += w;
|
|
28897
28944
|
});
|
|
28898
28945
|
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 };
|
|
28899
28946
|
}
|
|
28900
28947
|
const width = Math.min(
|
|
28901
28948
|
area.w * 0.35,
|
|
28902
|
-
extentOf(entries.map((e) => chartTextWidth(e.label,
|
|
28949
|
+
extentOf(entries.map((e) => chartTextWidth(e.label, attrs4, options2))).max + 22
|
|
28903
28950
|
);
|
|
28904
28951
|
const height = entries.length * rowH;
|
|
28905
28952
|
const x = pos === "l" ? area.x + 4 : area.x + area.w - width;
|
|
@@ -28917,7 +28964,7 @@ function automaticLegend(model, area, out, options2, bounds) {
|
|
|
28917
28964
|
const y = y0 + i * rowH;
|
|
28918
28965
|
if (y + rowH > area.y + area.h + 2) return;
|
|
28919
28966
|
out.push(rect2(x, y + 3, 8, 8, e.color));
|
|
28920
|
-
out.push(text(x + 12, y + 11, fitChartText(e.label, width - 16,
|
|
28967
|
+
out.push(text(x + 12, y + 11, fitChartText(e.label, width - 16, attrs4, options2), attrs4));
|
|
28921
28968
|
});
|
|
28922
28969
|
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 };
|
|
28923
28970
|
}
|
|
@@ -29057,7 +29104,7 @@ function chartRichTitleSvg(model, width, options2 = {}, frameHeight = 400) {
|
|
|
29057
29104
|
width: runs.reduce((sum, run) => sum + chartTextWidth(run.text, run.attrs, options2), 0),
|
|
29058
29105
|
size: runs.length ? Math.max(...runs.map((run) => run.attrs.size ?? 14)) : base.size ?? 14,
|
|
29059
29106
|
fontMetrics: (runs.length ? runs.map((run) => run.attrs) : [base]).map(
|
|
29060
|
-
(
|
|
29107
|
+
(attrs4) => chartFontMetrics(attrs4, options2)
|
|
29061
29108
|
)
|
|
29062
29109
|
};
|
|
29063
29110
|
});
|
|
@@ -29142,11 +29189,11 @@ function renderChartSvg(model, width, height, options2 = {}) {
|
|
|
29142
29189
|
if (!model.titleOverlay)
|
|
29143
29190
|
area = { ...area, y: area.y + richTitle.height, h: area.h - richTitle.height };
|
|
29144
29191
|
} else if (model.title) {
|
|
29145
|
-
const
|
|
29146
|
-
const size =
|
|
29147
|
-
const label = fitChartText(model.title, w - 16,
|
|
29148
|
-
const titleWidth = Math.min(w - 16, chartTextWidth(label,
|
|
29149
|
-
const font = chartFontMetrics(
|
|
29192
|
+
const attrs4 = chartTextAttributes(model, "title", 14);
|
|
29193
|
+
const size = attrs4.size ?? 14;
|
|
29194
|
+
const label = fitChartText(model.title, w - 16, attrs4, options2);
|
|
29195
|
+
const titleWidth = Math.min(w - 16, chartTextWidth(label, attrs4, options2) + 8);
|
|
29196
|
+
const font = chartFontMetrics(attrs4, options2);
|
|
29150
29197
|
const titleHeight = Math.max(24, font ? font.ascent + font.descent + 4 : size * 1.4 + 4);
|
|
29151
29198
|
out.push(
|
|
29152
29199
|
chartAreaRect(model, "title", {
|
|
@@ -29160,7 +29207,7 @@ function renderChartSvg(model, width, height, options2 = {}) {
|
|
|
29160
29207
|
text(w / 2, 8 + size, label, {
|
|
29161
29208
|
anchor: "middle",
|
|
29162
29209
|
fill: "#404040",
|
|
29163
|
-
...
|
|
29210
|
+
...attrs4
|
|
29164
29211
|
})
|
|
29165
29212
|
);
|
|
29166
29213
|
if (!model.titleOverlay)
|
|
@@ -29277,16 +29324,186 @@ function isModeledBreak(element3) {
|
|
|
29277
29324
|
return true;
|
|
29278
29325
|
}
|
|
29279
29326
|
|
|
29280
|
-
// docx/write-
|
|
29327
|
+
// docx/write-drawing-wrap.ts
|
|
29281
29328
|
var WP_NS2 = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing";
|
|
29282
|
-
var
|
|
29329
|
+
var WRAP_NAMES = ["wrapNone", "wrapSquare", "wrapTight", "wrapThrough", "wrapTopAndBottom"];
|
|
29330
|
+
var BEFORE_WRAP = ["simplePos", "positionH", "positionV", "extent", "effectExtent"];
|
|
29331
|
+
var ANCHOR_ONLY = ["simplePos", "positionH", "positionV", ...WRAP_NAMES];
|
|
29332
|
+
var SIDE_DISTANCE = "114300";
|
|
29333
|
+
var el2 = (doc, name2) => makeNS(doc, WP_NS2, name2);
|
|
29334
|
+
var attrs2 = (element3, values) => {
|
|
29335
|
+
for (const [name2, value] of Object.entries(values)) element3.setAttribute(name2, value);
|
|
29336
|
+
return element3;
|
|
29337
|
+
};
|
|
29338
|
+
var wpChildren = (parent) => Array.from(parent.childNodes).filter(
|
|
29339
|
+
(node) => isElement(node) && node.namespaceURI === WP_NS2
|
|
29340
|
+
);
|
|
29341
|
+
function rectanglePolygon(doc) {
|
|
29342
|
+
const polygon = attrs2(el2(doc, "wp:wrapPolygon"), { edited: "0" });
|
|
29343
|
+
const points = [
|
|
29344
|
+
["start", 0, 0],
|
|
29345
|
+
["lineTo", 0, 21600],
|
|
29346
|
+
["lineTo", 21600, 21600],
|
|
29347
|
+
["lineTo", 21600, 0],
|
|
29348
|
+
["lineTo", 0, 0]
|
|
29349
|
+
];
|
|
29350
|
+
for (const [name2, x, y] of points)
|
|
29351
|
+
polygon.appendChild(attrs2(el2(doc, `wp:${name2}`), { x: String(x), y: String(y) }));
|
|
29352
|
+
return polygon;
|
|
29353
|
+
}
|
|
29354
|
+
function wrapElement(doc, placement, polygon) {
|
|
29355
|
+
const wrapText = placement.wrapText ?? "bothSides";
|
|
29356
|
+
switch (placement.wrap) {
|
|
29357
|
+
case "square":
|
|
29358
|
+
return attrs2(el2(doc, "wp:wrapSquare"), { wrapText });
|
|
29359
|
+
case "tight":
|
|
29360
|
+
case "through": {
|
|
29361
|
+
const wrap = el2(doc, placement.wrap === "tight" ? "wp:wrapTight" : "wp:wrapThrough");
|
|
29362
|
+
wrap.setAttribute("wrapText", wrapText);
|
|
29363
|
+
wrap.appendChild(polygon ?? rectanglePolygon(doc));
|
|
29364
|
+
return wrap;
|
|
29365
|
+
}
|
|
29366
|
+
case "topAndBottom":
|
|
29367
|
+
return el2(doc, "wp:wrapTopAndBottom");
|
|
29368
|
+
default:
|
|
29369
|
+
return el2(doc, "wp:wrapNone");
|
|
29370
|
+
}
|
|
29371
|
+
}
|
|
29372
|
+
function positionElement(doc, axis, relativeFrom, align, offsetPx) {
|
|
29373
|
+
const node = attrs2(el2(doc, `wp:position${axis}`), { relativeFrom });
|
|
29374
|
+
const value = el2(doc, align ? "wp:align" : "wp:posOffset");
|
|
29375
|
+
value.appendChild(
|
|
29376
|
+
doc.createTextNode(align ?? String(Math.round((offsetPx ?? 0) * EMU_PER_PIXEL)))
|
|
29377
|
+
);
|
|
29378
|
+
node.appendChild(value);
|
|
29379
|
+
return node;
|
|
29380
|
+
}
|
|
29381
|
+
function patchAnchorWrap(doc, anchor, placement) {
|
|
29382
|
+
const children3 = wpChildren(anchor);
|
|
29383
|
+
const old = children3.find((child3) => WRAP_NAMES.includes(child3.localName));
|
|
29384
|
+
const oldPolygon = old && wpChildren(old).find((child3) => child3.localName === "wrapPolygon");
|
|
29385
|
+
const next = wrapElement(doc, placement, oldPolygon);
|
|
29386
|
+
if (old) anchor.replaceChild(next, old);
|
|
29387
|
+
else {
|
|
29388
|
+
const after = children3.find((child3) => !BEFORE_WRAP.includes(child3.localName));
|
|
29389
|
+
anchor.insertBefore(next, after ?? null);
|
|
29390
|
+
}
|
|
29391
|
+
anchor.setAttribute("behindDoc", placement.wrap === "none" && placement.behindText ? "1" : "0");
|
|
29392
|
+
}
|
|
29393
|
+
function replaceHolder(from, to, skip) {
|
|
29394
|
+
for (const attribute of Array.from(from.attributes))
|
|
29395
|
+
if (!skip.includes(attribute.name) && !to.hasAttribute(attribute.name))
|
|
29396
|
+
to.setAttributeNS(attribute.namespaceURI, attribute.name, attribute.value);
|
|
29397
|
+
for (const child3 of Array.from(from.childNodes)) to.appendChild(child3);
|
|
29398
|
+
from.parentNode?.replaceChild(to, from);
|
|
29399
|
+
}
|
|
29400
|
+
var ANCHOR_ATTRIBUTES = [
|
|
29401
|
+
"distT",
|
|
29402
|
+
"distB",
|
|
29403
|
+
"distL",
|
|
29404
|
+
"distR",
|
|
29405
|
+
"simplePos",
|
|
29406
|
+
"relativeHeight",
|
|
29407
|
+
"behindDoc",
|
|
29408
|
+
"locked",
|
|
29409
|
+
"layoutInCell",
|
|
29410
|
+
"allowOverlap",
|
|
29411
|
+
"hidden"
|
|
29412
|
+
];
|
|
29413
|
+
function inlineToAnchor(doc, inline, placement, relativeHeight) {
|
|
29414
|
+
const anchor = attrs2(el2(doc, "wp:anchor"), {
|
|
29415
|
+
distT: inline.getAttribute("distT") ?? "0",
|
|
29416
|
+
distB: inline.getAttribute("distB") ?? "0",
|
|
29417
|
+
distL: SIDE_DISTANCE,
|
|
29418
|
+
distR: SIDE_DISTANCE,
|
|
29419
|
+
simplePos: "0",
|
|
29420
|
+
relativeHeight: String(relativeHeight),
|
|
29421
|
+
behindDoc: "0",
|
|
29422
|
+
locked: "0",
|
|
29423
|
+
layoutInCell: "1",
|
|
29424
|
+
allowOverlap: "1"
|
|
29425
|
+
});
|
|
29426
|
+
anchor.appendChild(attrs2(el2(doc, "wp:simplePos"), { x: "0", y: "0" }));
|
|
29427
|
+
anchor.appendChild(
|
|
29428
|
+
positionElement(
|
|
29429
|
+
doc,
|
|
29430
|
+
"H",
|
|
29431
|
+
placement.relativeFrom ?? "column",
|
|
29432
|
+
placement.align,
|
|
29433
|
+
placement.offsetXPx
|
|
29434
|
+
)
|
|
29435
|
+
);
|
|
29436
|
+
anchor.appendChild(
|
|
29437
|
+
positionElement(
|
|
29438
|
+
doc,
|
|
29439
|
+
"V",
|
|
29440
|
+
placement.relativeFromV ?? "paragraph",
|
|
29441
|
+
placement.alignV,
|
|
29442
|
+
placement.offsetYPx
|
|
29443
|
+
)
|
|
29444
|
+
);
|
|
29445
|
+
replaceHolder(inline, anchor, ANCHOR_ATTRIBUTES);
|
|
29446
|
+
patchAnchorWrap(doc, anchor, placement);
|
|
29447
|
+
}
|
|
29448
|
+
function anchorToInline(doc, anchor) {
|
|
29449
|
+
const inline = attrs2(el2(doc, "wp:inline"), { distT: "0", distB: "0", distL: "0", distR: "0" });
|
|
29450
|
+
for (const child3 of wpChildren(anchor))
|
|
29451
|
+
if (ANCHOR_ONLY.includes(child3.localName)) anchor.removeChild(child3);
|
|
29452
|
+
for (const child3 of Array.from(anchor.childNodes))
|
|
29453
|
+
if (isElement(child3) && child3.localName.startsWith("sizeRel")) anchor.removeChild(child3);
|
|
29454
|
+
replaceHolder(anchor, inline, ANCHOR_ATTRIBUTES);
|
|
29455
|
+
}
|
|
29456
|
+
function applyDrawingWrap(drawing, doc, anchored, placement, relativeHeight = 251658240) {
|
|
29457
|
+
const holder = wpChildren(drawing).find(
|
|
29458
|
+
(child3) => child3.localName === "inline" || child3.localName === "anchor"
|
|
29459
|
+
);
|
|
29460
|
+
if (!holder) return false;
|
|
29461
|
+
if (!anchored) {
|
|
29462
|
+
if (holder.localName === "anchor") anchorToInline(doc, holder);
|
|
29463
|
+
return true;
|
|
29464
|
+
}
|
|
29465
|
+
const floating = placement ?? { wrap: "none" };
|
|
29466
|
+
if (holder.localName === "inline") inlineToAnchor(doc, holder, floating, relativeHeight);
|
|
29467
|
+
else patchAnchorWrap(doc, holder, floating);
|
|
29468
|
+
return true;
|
|
29469
|
+
}
|
|
29470
|
+
var wrapKey = (anchored, placement) => anchored ? `${placement?.wrap ?? "none"}|${placement?.behindText ? 1 : 0}|${placement?.wrapText ?? ""}` : "inline";
|
|
29471
|
+
function newRelativeHeight(drawing) {
|
|
29472
|
+
const docPr = drawing.getElementsByTagNameNS(WP_NS2, "docPr")[0];
|
|
29473
|
+
return 251658240 + (Number(docPr?.getAttribute("id")) || 0) % 4096 * 1024;
|
|
29474
|
+
}
|
|
29475
|
+
function patchDrawingWrap(drawing, doc, image, base) {
|
|
29476
|
+
const next = wrapKey(image.anchored, image.placement);
|
|
29477
|
+
if (next === (base ? wrapKey(base.anchored, base.placement) : "inline")) return;
|
|
29478
|
+
applyDrawingWrap(
|
|
29479
|
+
drawing,
|
|
29480
|
+
doc,
|
|
29481
|
+
Boolean(image.anchored),
|
|
29482
|
+
image.placement,
|
|
29483
|
+
newRelativeHeight(drawing)
|
|
29484
|
+
);
|
|
29485
|
+
}
|
|
29486
|
+
var POSITION_KEYS = [
|
|
29487
|
+
"relativeFrom",
|
|
29488
|
+
"align",
|
|
29489
|
+
"offsetXPx",
|
|
29490
|
+
"relativeFromV",
|
|
29491
|
+
"alignV",
|
|
29492
|
+
"offsetYPx"
|
|
29493
|
+
];
|
|
29494
|
+
function placementPositionChanged(next, base) {
|
|
29495
|
+
return !base || POSITION_KEYS.some((key) => next[key] !== base[key]);
|
|
29496
|
+
}
|
|
29497
|
+
|
|
29498
|
+
// docx/write-shape.ts
|
|
29499
|
+
var WP_NS3 = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing";
|
|
29500
|
+
var el3 = (doc, ns, name2) => makeNS(doc, ns, name2);
|
|
29283
29501
|
var add2 = (parent, ...items) => {
|
|
29284
29502
|
for (const item2 of items) parent.appendChild(item2);
|
|
29285
29503
|
return parent;
|
|
29286
29504
|
};
|
|
29287
29505
|
var emu2 = (px) => String(Math.max(1, Math.round(px * EMU_PER_PIXEL)));
|
|
29288
|
-
var
|
|
29289
|
-
var attrs2 = (element3, values) => {
|
|
29506
|
+
var attrs3 = (element3, values) => {
|
|
29290
29507
|
for (const [name2, value] of Object.entries(values)) element3.setAttribute(name2, value);
|
|
29291
29508
|
return element3;
|
|
29292
29509
|
};
|
|
@@ -29339,67 +29556,24 @@ function textParagraphs(doc, lines, color) {
|
|
|
29339
29556
|
}
|
|
29340
29557
|
function shapeStyle(doc) {
|
|
29341
29558
|
const ref = (name2, idx, scheme2, shade2) => {
|
|
29342
|
-
const node =
|
|
29343
|
-
const color =
|
|
29344
|
-
if (shade2) add2(color,
|
|
29559
|
+
const node = attrs3(el3(doc, A_NS2, `a:${name2}`), { idx });
|
|
29560
|
+
const color = attrs3(el3(doc, A_NS2, "a:schemeClr"), { val: scheme2 });
|
|
29561
|
+
if (shade2) add2(color, attrs3(el3(doc, A_NS2, "a:shade"), { val: shade2 }));
|
|
29345
29562
|
return add2(node, color);
|
|
29346
29563
|
};
|
|
29347
29564
|
return add2(
|
|
29348
|
-
|
|
29565
|
+
el3(doc, WPS_NS2, "wps:style"),
|
|
29349
29566
|
ref("lnRef", "2", "accent1", "50000"),
|
|
29350
29567
|
ref("fillRef", "1", "accent1"),
|
|
29351
29568
|
ref("effectRef", "0", "accent1"),
|
|
29352
29569
|
ref("fontRef", "minor", "lt1")
|
|
29353
29570
|
);
|
|
29354
29571
|
}
|
|
29355
|
-
function wrapElement(doc, placement) {
|
|
29356
|
-
switch (placement.wrap) {
|
|
29357
|
-
case "square":
|
|
29358
|
-
return attrs2(el2(doc, WP_NS2, "wp:wrapSquare"), { wrapText: "bothSides" });
|
|
29359
|
-
case "tight":
|
|
29360
|
-
case "through": {
|
|
29361
|
-
const wrap = attrs2(
|
|
29362
|
-
el2(doc, WP_NS2, `wp:wrap${placement.wrap === "tight" ? "Tight" : "Through"}`),
|
|
29363
|
-
{
|
|
29364
|
-
wrapText: "bothSides"
|
|
29365
|
-
}
|
|
29366
|
-
);
|
|
29367
|
-
const polygon = attrs2(el2(doc, WP_NS2, "wp:wrapPolygon"), { edited: "0" });
|
|
29368
|
-
const point = (name2, x, y) => attrs2(el2(doc, WP_NS2, `wp:${name2}`), { x, y });
|
|
29369
|
-
return add2(
|
|
29370
|
-
wrap,
|
|
29371
|
-
add2(
|
|
29372
|
-
polygon,
|
|
29373
|
-
point("start", "0", "0"),
|
|
29374
|
-
point("lineTo", "0", "21600"),
|
|
29375
|
-
point("lineTo", "21600", "21600"),
|
|
29376
|
-
point("lineTo", "21600", "0"),
|
|
29377
|
-
point("lineTo", "0", "0")
|
|
29378
|
-
)
|
|
29379
|
-
);
|
|
29380
|
-
}
|
|
29381
|
-
case "topAndBottom":
|
|
29382
|
-
return el2(doc, WP_NS2, "wp:wrapTopAndBottom");
|
|
29383
|
-
default:
|
|
29384
|
-
return el2(doc, WP_NS2, "wp:wrapNone");
|
|
29385
|
-
}
|
|
29386
|
-
}
|
|
29387
|
-
function position(doc, axis, relativeFrom, align, offsetPx) {
|
|
29388
|
-
const node = attrs2(el2(doc, WP_NS2, `wp:position${axis}`), { relativeFrom });
|
|
29389
|
-
if (align) {
|
|
29390
|
-
const a = el2(doc, WP_NS2, "wp:align");
|
|
29391
|
-
a.textContent = align;
|
|
29392
|
-
return add2(node, a);
|
|
29393
|
-
}
|
|
29394
|
-
const offset = el2(doc, WP_NS2, "wp:posOffset");
|
|
29395
|
-
offset.textContent = emuOffset(offsetPx ?? 0);
|
|
29396
|
-
return add2(node, offset);
|
|
29397
|
-
}
|
|
29398
29572
|
function geometry(doc, spec) {
|
|
29399
|
-
const prst =
|
|
29400
|
-
const avLst =
|
|
29573
|
+
const prst = attrs3(el3(doc, A_NS2, "a:prstGeom"), { prst: spec.preset });
|
|
29574
|
+
const avLst = el3(doc, A_NS2, "a:avLst");
|
|
29401
29575
|
for (const [name2, value] of Object.entries(spec.adjustments ?? {}))
|
|
29402
|
-
add2(avLst,
|
|
29576
|
+
add2(avLst, attrs3(el3(doc, A_NS2, "a:gd"), { name: name2, fmla: `val ${Math.round(value)}` }));
|
|
29403
29577
|
const nodes = spec.customGeometryXml ? importFragment(doc, spec.customGeometryXml) : [add2(prst, avLst)];
|
|
29404
29578
|
if (spec.fill) {
|
|
29405
29579
|
const xml = drawingFillXml(spec.fill);
|
|
@@ -29413,9 +29587,9 @@ function buildShapeDrawing(doc, image, identity, relativeHeight = 251658240) {
|
|
|
29413
29587
|
const drawing = makeW(doc, "drawing");
|
|
29414
29588
|
const placement = image.placement;
|
|
29415
29589
|
const anchored = Boolean(image.anchored);
|
|
29416
|
-
const holder =
|
|
29590
|
+
const holder = el3(doc, WP_NS3, anchored ? "wp:anchor" : "wp:inline");
|
|
29417
29591
|
if (anchored) {
|
|
29418
|
-
|
|
29592
|
+
attrs3(holder, {
|
|
29419
29593
|
distT: "0",
|
|
29420
29594
|
distB: "0",
|
|
29421
29595
|
distL: "114300",
|
|
@@ -29429,15 +29603,15 @@ function buildShapeDrawing(doc, image, identity, relativeHeight = 251658240) {
|
|
|
29429
29603
|
});
|
|
29430
29604
|
add2(
|
|
29431
29605
|
holder,
|
|
29432
|
-
|
|
29433
|
-
|
|
29606
|
+
attrs3(el3(doc, WP_NS3, "wp:simplePos"), { x: "0", y: "0" }),
|
|
29607
|
+
positionElement(
|
|
29434
29608
|
doc,
|
|
29435
29609
|
"H",
|
|
29436
29610
|
placement?.relativeFrom ?? "column",
|
|
29437
29611
|
placement?.align,
|
|
29438
29612
|
placement?.offsetXPx
|
|
29439
29613
|
),
|
|
29440
|
-
|
|
29614
|
+
positionElement(
|
|
29441
29615
|
doc,
|
|
29442
29616
|
"V",
|
|
29443
29617
|
placement?.relativeFromV ?? "paragraph",
|
|
@@ -29448,40 +29622,40 @@ function buildShapeDrawing(doc, image, identity, relativeHeight = 251658240) {
|
|
|
29448
29622
|
} else for (const side of ["distT", "distB", "distL", "distR"]) holder.setAttribute(side, "0");
|
|
29449
29623
|
add2(
|
|
29450
29624
|
holder,
|
|
29451
|
-
|
|
29452
|
-
|
|
29625
|
+
attrs3(el3(doc, WP_NS3, "wp:extent"), { cx: emu2(image.widthPx), cy: emu2(image.heightPx) }),
|
|
29626
|
+
attrs3(el3(doc, WP_NS3, "wp:effectExtent"), { l: "0", t: "0", r: "0", b: "0" })
|
|
29453
29627
|
);
|
|
29454
29628
|
if (anchored) add2(holder, wrapElement(doc, placement ?? { wrap: "none" }));
|
|
29455
|
-
const docPr =
|
|
29629
|
+
const docPr = attrs3(el3(doc, WP_NS3, "wp:docPr"), {
|
|
29456
29630
|
id: identity.id,
|
|
29457
29631
|
name: identity.name ?? `Shape ${identity.id}`
|
|
29458
29632
|
});
|
|
29459
29633
|
if (identity.descr) docPr.setAttribute("descr", identity.descr);
|
|
29460
29634
|
if (identity.title) docPr.setAttribute("title", identity.title);
|
|
29461
|
-
const xfrm =
|
|
29635
|
+
const xfrm = attrs3(el3(doc, A_NS2, "a:xfrm"), {});
|
|
29462
29636
|
if (spec.rotation) xfrm.setAttribute("rot", String(Math.round(spec.rotation * 6e4)));
|
|
29463
29637
|
if (spec.flipH) xfrm.setAttribute("flipH", "1");
|
|
29464
29638
|
if (spec.flipV) xfrm.setAttribute("flipV", "1");
|
|
29465
29639
|
add2(
|
|
29466
29640
|
xfrm,
|
|
29467
|
-
|
|
29468
|
-
|
|
29641
|
+
attrs3(el3(doc, A_NS2, "a:off"), { x: "0", y: "0" }),
|
|
29642
|
+
attrs3(el3(doc, A_NS2, "a:ext"), { cx: emu2(image.widthPx), cy: emu2(image.heightPx) })
|
|
29469
29643
|
);
|
|
29470
|
-
const spPr = add2(
|
|
29644
|
+
const spPr = add2(el3(doc, WPS_NS2, "wps:spPr"), xfrm, ...geometry(doc, spec));
|
|
29471
29645
|
const wsp = add2(
|
|
29472
|
-
|
|
29473
|
-
|
|
29646
|
+
el3(doc, WPS_NS2, "wps:wsp"),
|
|
29647
|
+
el3(doc, WPS_NS2, "wps:cNvSpPr"),
|
|
29474
29648
|
spPr,
|
|
29475
29649
|
shapeStyle(doc)
|
|
29476
29650
|
);
|
|
29477
29651
|
if (spec.text?.length) {
|
|
29478
29652
|
const content = add2(
|
|
29479
|
-
|
|
29653
|
+
el3(doc, W_NS2, "w:txbxContent"),
|
|
29480
29654
|
...textParagraphs(doc, spec.text, explicitTextColor(spec))
|
|
29481
29655
|
);
|
|
29482
|
-
add2(wsp, add2(
|
|
29656
|
+
add2(wsp, add2(el3(doc, WPS_NS2, "wps:txbx"), content));
|
|
29483
29657
|
}
|
|
29484
|
-
const body =
|
|
29658
|
+
const body = attrs3(el3(doc, WPS_NS2, "wps:bodyPr"), {
|
|
29485
29659
|
rot: "0",
|
|
29486
29660
|
vert: "horz",
|
|
29487
29661
|
wrap: "square",
|
|
@@ -29492,26 +29666,26 @@ function buildShapeDrawing(doc, image, identity, relativeHeight = 251658240) {
|
|
|
29492
29666
|
anchor: "ctr",
|
|
29493
29667
|
anchorCtr: "0"
|
|
29494
29668
|
});
|
|
29495
|
-
add2(wsp, add2(body,
|
|
29496
|
-
const graphicData =
|
|
29669
|
+
add2(wsp, add2(body, el3(doc, A_NS2, "a:noAutofit")));
|
|
29670
|
+
const graphicData = attrs3(el3(doc, A_NS2, "a:graphicData"), { uri: WPS_NS2 });
|
|
29497
29671
|
add2(
|
|
29498
29672
|
holder,
|
|
29499
29673
|
docPr,
|
|
29500
|
-
|
|
29501
|
-
add2(
|
|
29674
|
+
el3(doc, WP_NS3, "wp:cNvGraphicFramePr"),
|
|
29675
|
+
add2(el3(doc, A_NS2, "a:graphic"), add2(graphicData, wsp))
|
|
29502
29676
|
);
|
|
29503
29677
|
return add2(drawing, holder);
|
|
29504
29678
|
}
|
|
29505
29679
|
var firstNs = (root, ns, local) => root.getElementsByTagNameNS(ns, local)[0];
|
|
29506
29680
|
function rebuildShapeDrawing(doc, image, old) {
|
|
29507
|
-
const oldDocPr = firstNs(old,
|
|
29681
|
+
const oldDocPr = firstNs(old, WP_NS3, "docPr");
|
|
29508
29682
|
const identity = {
|
|
29509
29683
|
id: oldDocPr?.getAttribute("id") ?? "1",
|
|
29510
29684
|
...oldDocPr?.getAttribute("name") ? { name: oldDocPr.getAttribute("name") } : {},
|
|
29511
29685
|
...oldDocPr?.getAttribute("descr") ? { descr: oldDocPr.getAttribute("descr") } : {},
|
|
29512
29686
|
...oldDocPr?.getAttribute("title") ? { title: oldDocPr.getAttribute("title") } : {}
|
|
29513
29687
|
};
|
|
29514
|
-
const oldAnchor = firstNs(old,
|
|
29688
|
+
const oldAnchor = firstNs(old, WP_NS3, "anchor");
|
|
29515
29689
|
const relativeHeight = Number(oldAnchor?.getAttribute("relativeHeight")) || void 0;
|
|
29516
29690
|
const next = buildShapeDrawing(doc, image, identity, relativeHeight);
|
|
29517
29691
|
const wsp = firstNs(next, WPS_NS2, "wsp");
|
|
@@ -29533,7 +29707,7 @@ function rebuildShapeDrawing(doc, image, old) {
|
|
|
29533
29707
|
|
|
29534
29708
|
// docx/write-drawing-patch.ts
|
|
29535
29709
|
var A_NS3 = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
29536
|
-
var
|
|
29710
|
+
var WP_NS4 = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing";
|
|
29537
29711
|
function walk2(root, visit) {
|
|
29538
29712
|
const stack = [root];
|
|
29539
29713
|
while (stack.length) {
|
|
@@ -29546,7 +29720,7 @@ function updateExtent(drawing, widthPx, heightPx) {
|
|
|
29546
29720
|
const cx = String(Math.max(1, Math.round(widthPx * EMU_PER_PIXEL)));
|
|
29547
29721
|
const cy = String(Math.max(1, Math.round(heightPx * EMU_PER_PIXEL)));
|
|
29548
29722
|
walk2(drawing, (node) => {
|
|
29549
|
-
const isExtent = node.namespaceURI ===
|
|
29723
|
+
const isExtent = node.namespaceURI === WP_NS4 && node.localName === "extent";
|
|
29550
29724
|
const parent = node.parentNode;
|
|
29551
29725
|
const isExt = node.namespaceURI === A_NS3 && node.localName === "ext" && parent?.namespaceURI === A_NS3 && parent.localName === "xfrm";
|
|
29552
29726
|
if (isExtent || isExt) {
|
|
@@ -29557,7 +29731,7 @@ function updateExtent(drawing, widthPx, heightPx) {
|
|
|
29557
29731
|
}
|
|
29558
29732
|
function updateDocPr(drawing, altText, title) {
|
|
29559
29733
|
walk2(drawing, (node) => {
|
|
29560
|
-
if (node.namespaceURI !==
|
|
29734
|
+
if (node.namespaceURI !== WP_NS4 || node.localName !== "docPr") return;
|
|
29561
29735
|
if (altText) node.setAttribute("descr", altText);
|
|
29562
29736
|
else node.removeAttribute("descr");
|
|
29563
29737
|
if (title) node.setAttribute("title", title);
|
|
@@ -29565,21 +29739,21 @@ function updateDocPr(drawing, altText, title) {
|
|
|
29565
29739
|
});
|
|
29566
29740
|
}
|
|
29567
29741
|
function patchPosition(doc, anchor, name2, relativeFrom, align, offsetPx) {
|
|
29568
|
-
const
|
|
29569
|
-
(child3) => isElement(child3) && child3.namespaceURI ===
|
|
29742
|
+
const position = Array.from(anchor.childNodes).find(
|
|
29743
|
+
(child3) => isElement(child3) && child3.namespaceURI === WP_NS4 && child3.localName === name2
|
|
29570
29744
|
);
|
|
29571
|
-
if (!
|
|
29572
|
-
if (relativeFrom)
|
|
29573
|
-
for (const child3 of Array.from(
|
|
29574
|
-
const value = align ? makeNS(doc,
|
|
29745
|
+
if (!position) return;
|
|
29746
|
+
if (relativeFrom) position.setAttribute("relativeFrom", relativeFrom);
|
|
29747
|
+
for (const child3 of Array.from(position.childNodes)) position.removeChild(child3);
|
|
29748
|
+
const value = align ? makeNS(doc, WP_NS4, "wp:align") : makeNS(doc, WP_NS4, "wp:posOffset");
|
|
29575
29749
|
value.appendChild(
|
|
29576
29750
|
doc.createTextNode(align ?? String(Math.round((offsetPx ?? 0) * EMU_PER_PIXEL)))
|
|
29577
29751
|
);
|
|
29578
|
-
|
|
29752
|
+
position.appendChild(value);
|
|
29579
29753
|
}
|
|
29580
29754
|
function updatePlacement(drawing, doc, placement) {
|
|
29581
29755
|
walk2(drawing, (node) => {
|
|
29582
|
-
if (node.namespaceURI !==
|
|
29756
|
+
if (node.namespaceURI !== WP_NS4 || node.localName !== "anchor") return;
|
|
29583
29757
|
patchPosition(
|
|
29584
29758
|
doc,
|
|
29585
29759
|
node,
|
|
@@ -29645,6 +29819,12 @@ function patchFallbackSize(content, image, base) {
|
|
|
29645
29819
|
}
|
|
29646
29820
|
}
|
|
29647
29821
|
|
|
29822
|
+
// docx/hyperlink.ts
|
|
29823
|
+
var WORD_EXTRA_LINK_SCHEMES = ["tel", "ftp"];
|
|
29824
|
+
function isWordNavigableHref(href) {
|
|
29825
|
+
return typeof href === "string" && hyperlinkPolicy(href, { additionalOpenSchemes: WORD_EXTRA_LINK_SCHEMES }).open;
|
|
29826
|
+
}
|
|
29827
|
+
|
|
29648
29828
|
// docx/chart-ex-edit.ts
|
|
29649
29829
|
function isDocxChartExEditable(chart) {
|
|
29650
29830
|
return !!chart?.chartExSpace && chart.issues.every((issue) => issue.code === "CHARTEX_FAMILY_NOT_DRAWN");
|
|
@@ -29654,13 +29834,13 @@ function isDocxChartExEditable(chart) {
|
|
|
29654
29834
|
function isDocxChartEditable(chart) {
|
|
29655
29835
|
return Boolean(chart?.chartSpace) && !chart?.layoutId && !chart?.chartEx && chartIssuesLostOnWrite(chart?.issues ?? []).length === 0;
|
|
29656
29836
|
}
|
|
29657
|
-
var
|
|
29837
|
+
var WP_NS6 = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing";
|
|
29658
29838
|
var EMU_PER_PIXEL2 = 9525;
|
|
29659
29839
|
function isSameDiagram(base, next) {
|
|
29660
29840
|
return Boolean(base?.parts.data?.partName) && base?.parts.data?.partName === next.parts.data?.partName && !next.inserted;
|
|
29661
29841
|
}
|
|
29662
29842
|
function patchDiagramExtent(drawing, widthPx, heightPx) {
|
|
29663
|
-
const extent = drawing.getElementsByTagNameNS(
|
|
29843
|
+
const extent = drawing.getElementsByTagNameNS(WP_NS6, "extent")[0];
|
|
29664
29844
|
if (!extent) return;
|
|
29665
29845
|
extent.setAttribute("cx", String(Math.max(1, Math.round(widthPx * EMU_PER_PIXEL2))));
|
|
29666
29846
|
extent.setAttribute("cy", String(Math.max(1, Math.round(heightPx * EMU_PER_PIXEL2))));
|
|
@@ -29747,6 +29927,9 @@ function createImageRun(doc, image, base, old, allocator) {
|
|
|
29747
29927
|
if (!base && image.shape?.editable && !image.partName) {
|
|
29748
29928
|
throw new Error("Cannot insert a shape without an id allocator.");
|
|
29749
29929
|
}
|
|
29930
|
+
if (image.pictureWatermark) {
|
|
29931
|
+
throw new Error("Cannot insert a picture watermark without a relationship allocator.");
|
|
29932
|
+
}
|
|
29750
29933
|
if (image.watermark) {
|
|
29751
29934
|
clearNonProperties(node);
|
|
29752
29935
|
node.appendChild(
|
|
@@ -29761,7 +29944,7 @@ function createImageRun(doc, image, base, old, allocator) {
|
|
|
29761
29944
|
if (image.pictureFill && JSON.stringify(image.pictureFill) !== JSON.stringify(base.pictureFill)) {
|
|
29762
29945
|
const fill = oldDrawing.getElementsByTagNameNS(PIC_NS, "blipFill")[0];
|
|
29763
29946
|
const blip = fill?.getElementsByTagNameNS(A_NS6, "blip")[0];
|
|
29764
|
-
if (fill && image.pictureFill.crop !== void 0)
|
|
29947
|
+
if (fill && (image.pictureFill.crop !== void 0 || base.pictureFill?.crop))
|
|
29765
29948
|
applyPictureCrop(fill, image.pictureFill.crop);
|
|
29766
29949
|
if (blip && image.pictureFill.effects !== void 0)
|
|
29767
29950
|
applyPictureEffects(blip, image.pictureFill.effects);
|
|
@@ -29772,7 +29955,8 @@ function createImageRun(doc, image, base, old, allocator) {
|
|
|
29772
29955
|
updateExtent(oldDrawing, image.widthPx, image.heightPx);
|
|
29773
29956
|
if (image.altText !== base.altText || image.title !== base.title)
|
|
29774
29957
|
updateDocPr(oldDrawing, image.altText, image.title);
|
|
29775
|
-
|
|
29958
|
+
patchDrawingWrap(oldDrawing, doc, image, base);
|
|
29959
|
+
if (image.anchored && image.placement && placementPositionChanged(image.placement, base.placement))
|
|
29776
29960
|
updatePlacement(oldDrawing, doc, image.placement);
|
|
29777
29961
|
clearNonProperties(node, oldContainer);
|
|
29778
29962
|
return node;
|
|
@@ -29849,8 +30033,11 @@ function revisionWrapper(doc, revision, content) {
|
|
|
29849
30033
|
return wrapper;
|
|
29850
30034
|
}
|
|
29851
30035
|
function convertToDeleteText(doc, run) {
|
|
29852
|
-
for (const t of children2(run, "t")) {
|
|
29853
|
-
const delText = doc.createElementNS(
|
|
30036
|
+
for (const t of [...children2(run, "t"), ...children2(run, "instrText")]) {
|
|
30037
|
+
const delText = doc.createElementNS(
|
|
30038
|
+
WORD_NS,
|
|
30039
|
+
t.localName === "instrText" ? "w:delInstrText" : "w:delText"
|
|
30040
|
+
);
|
|
29854
30041
|
const space = t.getAttributeNS("http://www.w3.org/XML/1998/namespace", "space");
|
|
29855
30042
|
if (space) delText.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", space);
|
|
29856
30043
|
while (t.firstChild) delText.appendChild(t.firstChild);
|
|
@@ -29900,6 +30087,24 @@ var WORD_HIGHLIGHT_TOKENS = [
|
|
|
29900
30087
|
function isWordHighlightToken(value) {
|
|
29901
30088
|
return WORD_HIGHLIGHT_TOKENS.includes(value);
|
|
29902
30089
|
}
|
|
30090
|
+
var wordHighlightColors = {
|
|
30091
|
+
black: "#000000",
|
|
30092
|
+
blue: "#0000ff",
|
|
30093
|
+
cyan: "#00ffff",
|
|
30094
|
+
green: "#00ff00",
|
|
30095
|
+
magenta: "#ff00ff",
|
|
30096
|
+
red: "#ff0000",
|
|
30097
|
+
yellow: "#ffff00",
|
|
30098
|
+
white: "#ffffff",
|
|
30099
|
+
darkBlue: "#000080",
|
|
30100
|
+
darkCyan: "#008080",
|
|
30101
|
+
darkGreen: "#008000",
|
|
30102
|
+
darkMagenta: "#800080",
|
|
30103
|
+
darkRed: "#800000",
|
|
30104
|
+
darkYellow: "#808000",
|
|
30105
|
+
darkGray: "#808080",
|
|
30106
|
+
lightGray: "#c0c0c0"
|
|
30107
|
+
};
|
|
29903
30108
|
|
|
29904
30109
|
// docx/language.ts
|
|
29905
30110
|
function isValidLanguageTag(value) {
|
|
@@ -30391,12 +30596,24 @@ function createRun(doc, run, base, old, allocator) {
|
|
|
30391
30596
|
return node;
|
|
30392
30597
|
}
|
|
30393
30598
|
|
|
30599
|
+
// docx/run-properties-snapshot.ts
|
|
30600
|
+
function runPropertiesElement(source) {
|
|
30601
|
+
const run = { ...source, text: "" };
|
|
30602
|
+
delete run.image;
|
|
30603
|
+
delete run.equation;
|
|
30604
|
+
delete run.revision;
|
|
30605
|
+
delete run.formatRevision;
|
|
30606
|
+
const doc = parseXml2(`<w:r xmlns:w="${WORD_NS}"/>`);
|
|
30607
|
+
return first2(createRun(doc, run), "rPr") ?? makeW(doc, "rPr");
|
|
30608
|
+
}
|
|
30609
|
+
|
|
30394
30610
|
// docx/character-styles.ts
|
|
30395
30611
|
function styleElements(document) {
|
|
30396
30612
|
return Array.from(document.getElementsByTagName("*")).filter(
|
|
30397
30613
|
(element3) => named2(element3, "style") && (getW(element3, "type") === "character" || getW(element3, "type") === "paragraph")
|
|
30398
30614
|
);
|
|
30399
30615
|
}
|
|
30616
|
+
var eastAsiaLanguageOf = (rPr) => getW(first2(rPr, "lang"), "eastAsia");
|
|
30400
30617
|
function parseRunStyleCatalog(xml) {
|
|
30401
30618
|
const document = parseXml2(xml);
|
|
30402
30619
|
const defaults = first2(first2(document.documentElement, "docDefaults"), "rPrDefault");
|
|
@@ -30409,6 +30626,7 @@ function parseRunStyleCatalog(xml) {
|
|
|
30409
30626
|
const linkedStyle = getW(first2(element3, "link"), "val");
|
|
30410
30627
|
const isDefault = parseOnOff(getW(element3, "default"));
|
|
30411
30628
|
const name2 = getW(first2(element3, "name"), "val");
|
|
30629
|
+
const eastAsiaLanguage = eastAsiaLanguageOf(first2(element3, "rPr"));
|
|
30412
30630
|
styles[id] = {
|
|
30413
30631
|
id,
|
|
30414
30632
|
type,
|
|
@@ -30416,7 +30634,8 @@ function parseRunStyleCatalog(xml) {
|
|
|
30416
30634
|
...basedOn ? { basedOn } : {},
|
|
30417
30635
|
...linkedStyle ? { linkedStyle } : {},
|
|
30418
30636
|
...isDefault === void 0 ? {} : { isDefault },
|
|
30419
|
-
formatting: parseRunProperties(first2(element3, "rPr"))
|
|
30637
|
+
formatting: parseRunProperties(first2(element3, "rPr")),
|
|
30638
|
+
...eastAsiaLanguage ? { eastAsiaLanguage } : {}
|
|
30420
30639
|
};
|
|
30421
30640
|
}
|
|
30422
30641
|
const warnings = [];
|
|
@@ -30434,8 +30653,10 @@ function parseRunStyleCatalog(xml) {
|
|
|
30434
30653
|
parent = styles[parent]?.basedOn;
|
|
30435
30654
|
}
|
|
30436
30655
|
}
|
|
30656
|
+
const docDefaultsEastAsiaLanguage = eastAsiaLanguageOf(first2(defaults, "rPr"));
|
|
30437
30657
|
return {
|
|
30438
30658
|
docDefaults: parseRunProperties(first2(defaults, "rPr")),
|
|
30659
|
+
...docDefaultsEastAsiaLanguage ? { docDefaultsEastAsiaLanguage } : {},
|
|
30439
30660
|
styles,
|
|
30440
30661
|
warnings: [...new Set(warnings)]
|
|
30441
30662
|
};
|
|
@@ -30550,6 +30771,12 @@ var PAGINATION_KEYS = [
|
|
|
30550
30771
|
"contextualSpacing",
|
|
30551
30772
|
"suppressLineNumbers"
|
|
30552
30773
|
];
|
|
30774
|
+
var EAST_ASIAN_TYPOGRAPHY_KEYS = [
|
|
30775
|
+
"kinsoku",
|
|
30776
|
+
"autoSpaceDE",
|
|
30777
|
+
"autoSpaceDN",
|
|
30778
|
+
"overflowPunct"
|
|
30779
|
+
];
|
|
30553
30780
|
function parseOutlineLevel(element3) {
|
|
30554
30781
|
const raw = getW(element3, "val");
|
|
30555
30782
|
if (raw === void 0) return void 0;
|
|
@@ -30566,7 +30793,7 @@ function parseFormatting(pPr) {
|
|
|
30566
30793
|
if (bidi !== void 0) result.direction = bidi ? "rtl" : "ltr";
|
|
30567
30794
|
const pageBreakBefore = enabled(first2(pPr, "pageBreakBefore"));
|
|
30568
30795
|
if (pageBreakBefore !== void 0) result.pageBreakBefore = pageBreakBefore;
|
|
30569
|
-
for (const key of PAGINATION_KEYS) {
|
|
30796
|
+
for (const key of [...PAGINATION_KEYS, ...EAST_ASIAN_TYPOGRAPHY_KEYS]) {
|
|
30570
30797
|
const value = enabled(first2(pPr, key));
|
|
30571
30798
|
if (value !== void 0) result[key] = value;
|
|
30572
30799
|
}
|
|
@@ -30673,6 +30900,36 @@ function resolveStyleNumbering(styleId, catalog) {
|
|
|
30673
30900
|
return chain.find((style) => style.numbering)?.numbering;
|
|
30674
30901
|
}
|
|
30675
30902
|
|
|
30903
|
+
// docx/table-margins.ts
|
|
30904
|
+
function parseCellMargins(element3) {
|
|
30905
|
+
if (!element3) return void 0;
|
|
30906
|
+
const parsed = {};
|
|
30907
|
+
for (const [side, logical] of [
|
|
30908
|
+
["top", "top"],
|
|
30909
|
+
["bottom", "bottom"],
|
|
30910
|
+
["left", "start"],
|
|
30911
|
+
["right", "end"]
|
|
30912
|
+
]) {
|
|
30913
|
+
const edge = first2(element3, logical) ?? first2(element3, side);
|
|
30914
|
+
const type = getW(edge, "type") ?? "dxa";
|
|
30915
|
+
const value = type === "nil" ? parseSignedTwips("0") : type === "dxa" ? parseSignedTwips(getW(edge, "w")) : void 0;
|
|
30916
|
+
if (value !== void 0) parsed[side] = value;
|
|
30917
|
+
}
|
|
30918
|
+
return Object.keys(parsed).length ? parsed : void 0;
|
|
30919
|
+
}
|
|
30920
|
+
({
|
|
30921
|
+
top: signedTwips(0),
|
|
30922
|
+
right: signedTwips(108),
|
|
30923
|
+
bottom: signedTwips(0),
|
|
30924
|
+
left: signedTwips(108)
|
|
30925
|
+
});
|
|
30926
|
+
({
|
|
30927
|
+
top: signedTwips(0),
|
|
30928
|
+
right: signedTwips(10),
|
|
30929
|
+
bottom: signedTwips(0),
|
|
30930
|
+
left: signedTwips(10)
|
|
30931
|
+
});
|
|
30932
|
+
|
|
30676
30933
|
// docx/table-styles.ts
|
|
30677
30934
|
var REGIONS = [
|
|
30678
30935
|
"wholeTable",
|
|
@@ -30716,6 +30973,7 @@ function parseTableStyleCatalog(xml) {
|
|
|
30716
30973
|
const tblPr = first2(element3, "tblPr");
|
|
30717
30974
|
const borders = parseTableBorders(first2(tblPr, "tblBorders"));
|
|
30718
30975
|
const shadingFill = parseShadingFill(first2(tblPr, "shd"));
|
|
30976
|
+
const cellMargins = parseCellMargins(first2(tblPr, "tblCellMar"));
|
|
30719
30977
|
const conditional = {};
|
|
30720
30978
|
for (const block of children2(element3, "tblStylePr")) {
|
|
30721
30979
|
const type = getW(block, "type");
|
|
@@ -30729,6 +30987,7 @@ function parseTableStyleCatalog(xml) {
|
|
|
30729
30987
|
...isDefault === void 0 ? {} : { isDefault },
|
|
30730
30988
|
...borders ? { borders } : {},
|
|
30731
30989
|
...shadingFill ? { shadingFill } : {},
|
|
30990
|
+
...cellMargins ? { cellMargins } : {},
|
|
30732
30991
|
conditional
|
|
30733
30992
|
};
|
|
30734
30993
|
}
|
|
@@ -31382,15 +31641,15 @@ function writeCheckbox(doc, sdtPr, control) {
|
|
|
31382
31641
|
const siblings = Array.from(box.childNodes);
|
|
31383
31642
|
box.insertBefore(element3, siblings[order] ?? null);
|
|
31384
31643
|
};
|
|
31385
|
-
replace("checked", (
|
|
31644
|
+
replace("checked", (el6) => w14Attribute(el6, "val", control.checked ? "1" : "0"), 0);
|
|
31386
31645
|
const states = [validGlyph(control.checkedGlyph), validGlyph(control.uncheckedGlyph)];
|
|
31387
31646
|
states.forEach((glyph2, index) => {
|
|
31388
31647
|
if (glyph2)
|
|
31389
31648
|
replace(
|
|
31390
31649
|
index ? "uncheckedState" : "checkedState",
|
|
31391
|
-
(
|
|
31392
|
-
w14Attribute(
|
|
31393
|
-
if (glyph2.font) w14Attribute(
|
|
31650
|
+
(el6) => {
|
|
31651
|
+
w14Attribute(el6, "val", glyph2.code);
|
|
31652
|
+
if (glyph2.font) w14Attribute(el6, "font", glyph2.font);
|
|
31394
31653
|
},
|
|
31395
31654
|
index + 1
|
|
31396
31655
|
);
|
|
@@ -31685,7 +31944,7 @@ function shifted(change, by, from, to, limits) {
|
|
|
31685
31944
|
}
|
|
31686
31945
|
function swallowed(change, markers) {
|
|
31687
31946
|
return markers.filter(
|
|
31688
|
-
({ position
|
|
31947
|
+
({ position, opening }) => opening ? position >= change.fromStart && position < change.fromEnd : position > change.fromStart && position <= change.fromEnd
|
|
31689
31948
|
).length;
|
|
31690
31949
|
}
|
|
31691
31950
|
function placeChange(change, from, to, limits, markers) {
|
|
@@ -31702,7 +31961,7 @@ function placeChange(change, from, to, limits, markers) {
|
|
|
31702
31961
|
placements.push(right);
|
|
31703
31962
|
right = shifted(right, 1, from, to, limits);
|
|
31704
31963
|
}
|
|
31705
|
-
const keepsOut = ({ position
|
|
31964
|
+
const keepsOut = ({ position, opening, exact }) => exact || (opening ? position > 0 : position < from.length);
|
|
31706
31965
|
if (insertion)
|
|
31707
31966
|
return placements.find(
|
|
31708
31967
|
(placement) => markers.some((marker) => marker.position === placement.fromStart && keepsOut(marker))
|
|
@@ -31735,24 +31994,24 @@ function moveMarkers(before, after, markers) {
|
|
|
31735
31994
|
)
|
|
31736
31995
|
);
|
|
31737
31996
|
}
|
|
31738
|
-
const move = ({ position
|
|
31739
|
-
if (!exact && opening &&
|
|
31740
|
-
if (!exact && !opening &&
|
|
31997
|
+
const move = ({ position, opening, exact }) => {
|
|
31998
|
+
if (!exact && opening && position === 0) return 0;
|
|
31999
|
+
if (!exact && !opening && position === from.length) return to.length;
|
|
31741
32000
|
let shift = 0;
|
|
31742
32001
|
for (const [index, change] of changes.entries()) {
|
|
31743
|
-
if (
|
|
31744
|
-
if (
|
|
32002
|
+
if (position < change.fromStart) break;
|
|
32003
|
+
if (position > change.fromEnd) {
|
|
31745
32004
|
shift = change.toEnd - change.fromEnd;
|
|
31746
32005
|
continue;
|
|
31747
32006
|
}
|
|
31748
32007
|
const next = changes[index + 1];
|
|
31749
|
-
const inserted = change.fromStart === change.fromEnd ? change :
|
|
32008
|
+
const inserted = change.fromStart === change.fromEnd ? change : position === change.fromEnd && next?.fromStart === position && next.fromEnd === position ? next : void 0;
|
|
31750
32009
|
if (inserted) return opening ? inserted.toEnd : inserted.toStart;
|
|
31751
|
-
if (
|
|
31752
|
-
if (
|
|
32010
|
+
if (position === change.fromStart) return change.toStart;
|
|
32011
|
+
if (position === change.fromEnd) return change.toEnd;
|
|
31753
32012
|
return opening ? change.toStart : change.toEnd;
|
|
31754
32013
|
}
|
|
31755
|
-
return
|
|
32014
|
+
return position + shift;
|
|
31756
32015
|
};
|
|
31757
32016
|
return markers.map((marker) => ({ ...marker, position: move(marker) }));
|
|
31758
32017
|
}
|
|
@@ -31825,21 +32084,21 @@ function orderRangeEnds(markers) {
|
|
|
31825
32084
|
function placeMarkers(paragraph, markers, runs, placed, containers) {
|
|
31826
32085
|
const positions = runPositions(runs);
|
|
31827
32086
|
const pieces = /* @__PURE__ */ new Map();
|
|
31828
|
-
const insideRun = (index,
|
|
32087
|
+
const insideRun = (index, position, element3) => {
|
|
31829
32088
|
const run = placed[index]?.splittable;
|
|
31830
32089
|
if (!run) return false;
|
|
31831
32090
|
const parts = pieces.get(index) ?? [{ element: run, start: positions[index] }];
|
|
31832
32091
|
pieces.set(index, parts);
|
|
31833
32092
|
let at = parts.length - 1;
|
|
31834
|
-
while (at > 0 && parts[at].start >
|
|
32093
|
+
while (at > 0 && parts[at].start > position) at--;
|
|
31835
32094
|
const part = parts[at];
|
|
31836
|
-
if (part.start ===
|
|
32095
|
+
if (part.start === position) {
|
|
31837
32096
|
part.element.parentNode.insertBefore(element3, part.element);
|
|
31838
32097
|
return true;
|
|
31839
32098
|
}
|
|
31840
|
-
const second = splitRun(part.element,
|
|
32099
|
+
const second = splitRun(part.element, position - part.start);
|
|
31841
32100
|
if (!second) return false;
|
|
31842
|
-
parts.splice(at + 1, 0, { element: second, start:
|
|
32101
|
+
parts.splice(at + 1, 0, { element: second, start: position });
|
|
31843
32102
|
const written = placed[index];
|
|
31844
32103
|
if (written?.last === part.element) written.last = second;
|
|
31845
32104
|
second.parentNode.insertBefore(element3, second);
|
|
@@ -32409,7 +32668,8 @@ function runIsSafe(run) {
|
|
|
32409
32668
|
const [ffData] = data;
|
|
32410
32669
|
return type === "begin" && data.length === 1 && isElement(ffData) && isModeledFormFieldData(ffData);
|
|
32411
32670
|
}
|
|
32412
|
-
if (content.length && content.every((element3) => named2(element3, "instrText")))
|
|
32671
|
+
if (content.length && content.every((element3) => named2(element3, "instrText") || named2(element3, "delInstrText")))
|
|
32672
|
+
return true;
|
|
32413
32673
|
if (runSymbol(content) === null || runPositionalTab(content) === null) return false;
|
|
32414
32674
|
const kinds = /* @__PURE__ */ new Set();
|
|
32415
32675
|
for (const element3 of content) {
|
|
@@ -32506,7 +32766,7 @@ function parseDirectParagraphProperties(props) {
|
|
|
32506
32766
|
if (style) paragraph.style = style;
|
|
32507
32767
|
const pageBreakBefore = onOffElement(first2(props, "pageBreakBefore"));
|
|
32508
32768
|
if (pageBreakBefore !== void 0) paragraph.pageBreakBefore = pageBreakBefore;
|
|
32509
|
-
for (const key of PAGINATION_KEYS) {
|
|
32769
|
+
for (const key of [...PAGINATION_KEYS, ...EAST_ASIAN_TYPOGRAPHY_KEYS]) {
|
|
32510
32770
|
const value = onOffElement(first2(props, key));
|
|
32511
32771
|
if (value !== void 0) paragraph[key] = value;
|
|
32512
32772
|
}
|
|
@@ -32652,12 +32912,12 @@ function writeParagraphImpl(doc, paragraph, node, base, allocator, spans) {
|
|
|
32652
32912
|
runPositions(paragraph.runs).at(-1)
|
|
32653
32913
|
);
|
|
32654
32914
|
const read = markers.filter((marker) => !isBookmark(marker.element) || kept.has(marker.element)).filter((marker) => !permissions?.drop.has(marker.element)).map((marker) => {
|
|
32655
|
-
const
|
|
32915
|
+
const position = sourcePositions[marker.boundary] ?? 0;
|
|
32656
32916
|
const annotation = marker.annotation;
|
|
32657
32917
|
return {
|
|
32658
32918
|
element: marker.element,
|
|
32659
|
-
position
|
|
32660
|
-
source:
|
|
32919
|
+
position,
|
|
32920
|
+
source: position,
|
|
32661
32921
|
opening: annotation ? annotation.edge === "start" : opensRange(marker.element),
|
|
32662
32922
|
...marker.container && { container: marker.container },
|
|
32663
32923
|
...marker.revision && { revision: marker.revision },
|
|
@@ -32890,9 +33150,28 @@ function paragraphsOf(blocks) {
|
|
|
32890
33150
|
function documentParagraphs(model) {
|
|
32891
33151
|
return documentBlockLists(model).flatMap(paragraphsOf);
|
|
32892
33152
|
}
|
|
33153
|
+
function rowEntries(blocks) {
|
|
33154
|
+
const entries = /* @__PURE__ */ new Map();
|
|
33155
|
+
for (const block of blocks)
|
|
33156
|
+
if (block.type === "table")
|
|
33157
|
+
block.rows.forEach((row, index) => {
|
|
33158
|
+
const revision = block.rowProperties?.[index]?.revision;
|
|
33159
|
+
const paragraphId = row[0]?.paragraphs[0]?.id;
|
|
33160
|
+
if (revision && paragraphId)
|
|
33161
|
+
entries.set(paragraphId, {
|
|
33162
|
+
...revision,
|
|
33163
|
+
paragraphId,
|
|
33164
|
+
row: { tableId: block.id, index }
|
|
33165
|
+
});
|
|
33166
|
+
});
|
|
33167
|
+
return entries;
|
|
33168
|
+
}
|
|
32893
33169
|
function listRevisions(model) {
|
|
32894
33170
|
const entries = [];
|
|
33171
|
+
const rows2 = new Map(documentBlockLists(model).flatMap((blocks) => [...rowEntries(blocks)]));
|
|
32895
33172
|
for (const paragraph of documentParagraphs(model)) {
|
|
33173
|
+
const row = rows2.get(paragraph.id);
|
|
33174
|
+
if (row) entries.push(row);
|
|
32896
33175
|
if (paragraph.markRevision)
|
|
32897
33176
|
entries.push({ ...paragraph.markRevision, paragraphId: paragraph.id });
|
|
32898
33177
|
if (paragraph.formatRevision)
|
|
@@ -32908,9 +33187,14 @@ function listRevisions(model) {
|
|
|
32908
33187
|
function findRevision(model, id) {
|
|
32909
33188
|
return listRevisions(model).find((entry) => entry.id === id);
|
|
32910
33189
|
}
|
|
33190
|
+
var isEmptyParagraph = (paragraph) => paragraph.runs.every(
|
|
33191
|
+
(run) => !run.text && !run.image && !run.equation && !run.fieldChar && run.fieldCode === void 0 && !run.break && !run.noteReference && !run.noteMark
|
|
33192
|
+
);
|
|
32911
33193
|
function mergeIntoNext(blocks, paragraphId) {
|
|
32912
33194
|
const index = blocks.findIndex((b) => b.type === "paragraph" && b.id === paragraphId);
|
|
32913
33195
|
const next = blocks[index + 1];
|
|
33196
|
+
if (index >= 0 && next?.type === "table" && isEmptyParagraph(blocks[index]))
|
|
33197
|
+
return [...blocks.slice(0, index), ...blocks.slice(index + 1)];
|
|
32914
33198
|
if (index < 0 || !next || next.type !== "paragraph")
|
|
32915
33199
|
throw new Error(
|
|
32916
33200
|
`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).`
|
|
@@ -32951,8 +33235,12 @@ function resolveParagraphMark(model, id, keepBreak) {
|
|
|
32951
33235
|
(block) => block.type === "table" ? block.rows.flatMap((row) => row.map((cell) => cell.paragraphs)) : []
|
|
32952
33236
|
)
|
|
32953
33237
|
];
|
|
32954
|
-
for (const list2 of lists) {
|
|
33238
|
+
for (const [index, list2] of lists.entries()) {
|
|
32955
33239
|
if (!list2.includes(paragraph)) continue;
|
|
33240
|
+
if (index > 0 && list2.at(-1) === paragraph) {
|
|
33241
|
+
delete paragraph.markRevision;
|
|
33242
|
+
return next;
|
|
33243
|
+
}
|
|
32956
33244
|
const merged = mergeIntoNext(list2, paragraph.id);
|
|
32957
33245
|
list2.splice(0, list2.length, ...merged);
|
|
32958
33246
|
return next;
|
|
@@ -32982,9 +33270,28 @@ function clearRunRevision(paragraph, runIndex) {
|
|
|
32982
33270
|
const run = paragraph.runs[runIndex];
|
|
32983
33271
|
if (run) delete run.revision;
|
|
32984
33272
|
}
|
|
33273
|
+
function resolveRow(model, id, remove2) {
|
|
33274
|
+
const next = structuredClone(model);
|
|
33275
|
+
for (const blocks of documentBlockLists(next))
|
|
33276
|
+
for (const [blockIndex, table] of blocks.entries()) {
|
|
33277
|
+
if (table.type !== "table") continue;
|
|
33278
|
+
const index = table.rowProperties?.findIndex((row) => row.revision?.id === id) ?? -1;
|
|
33279
|
+
if (index < 0) continue;
|
|
33280
|
+
if (!remove2) {
|
|
33281
|
+
delete table.rowProperties[index].revision;
|
|
33282
|
+
return next;
|
|
33283
|
+
}
|
|
33284
|
+
table.rows.splice(index, 1);
|
|
33285
|
+
table.rowProperties.splice(index, 1);
|
|
33286
|
+
if (!table.rows.length) blocks.splice(blockIndex, 1);
|
|
33287
|
+
return next;
|
|
33288
|
+
}
|
|
33289
|
+
throw new Error(`No table row revision with id ${id} was found.`);
|
|
33290
|
+
}
|
|
32985
33291
|
function acceptOne(model, id) {
|
|
32986
33292
|
const entry = findRevision(model, id);
|
|
32987
33293
|
if (!entry) throw new Error(`No revision with id ${id} was found.`);
|
|
33294
|
+
if (entry.row) return resolveRow(model, id, entry.kind === "delete");
|
|
32988
33295
|
if (entry.kind === "formatChange")
|
|
32989
33296
|
return updateRuns(model, id, (paragraph, runIndex) => {
|
|
32990
33297
|
const run = paragraph.runs[runIndex];
|
|
@@ -33009,6 +33316,7 @@ function acceptOne(model, id) {
|
|
|
33009
33316
|
function rejectOne(model, id) {
|
|
33010
33317
|
const entry = findRevision(model, id);
|
|
33011
33318
|
if (!entry) throw new Error(`No revision with id ${id} was found.`);
|
|
33319
|
+
if (entry.row) return resolveRow(model, id, entry.kind === "insert");
|
|
33012
33320
|
if (entry.kind === "formatChange")
|
|
33013
33321
|
return updateRuns(
|
|
33014
33322
|
model,
|
|
@@ -33032,7 +33340,8 @@ function rejectOne(model, id) {
|
|
|
33032
33340
|
}
|
|
33033
33341
|
function applyAll(model, apply) {
|
|
33034
33342
|
let current = model;
|
|
33035
|
-
|
|
33343
|
+
const entries = listRevisions(model).reverse();
|
|
33344
|
+
for (const entry of [...entries.filter((item2) => item2.row), ...entries]) {
|
|
33036
33345
|
if (!findRevision(current, entry.id)) continue;
|
|
33037
33346
|
current = apply(current, entry.id);
|
|
33038
33347
|
}
|
|
@@ -33090,7 +33399,7 @@ function sectionsFromLayout(json, prior, blocks) {
|
|
|
33090
33399
|
return kept.map((section, index) => {
|
|
33091
33400
|
const end = endOf(section, index, kept);
|
|
33092
33401
|
const source = priorSections.find((candidate) => candidate.endsAtBlockId === section.endsAtBlockId) ?? priorSections.find(
|
|
33093
|
-
(candidate,
|
|
33402
|
+
(candidate, position) => endOf(candidate, position, priorSections) >= end
|
|
33094
33403
|
) ?? priorSections.at(-1);
|
|
33095
33404
|
return {
|
|
33096
33405
|
...section,
|
|
@@ -33128,17 +33437,17 @@ function twipsAttr(value) {
|
|
|
33128
33437
|
function signedTwipsAttr(value) {
|
|
33129
33438
|
return typeof value === "number" && Number.isFinite(value) ? roundSignedTwips(value) : void 0;
|
|
33130
33439
|
}
|
|
33131
|
-
function paragraphTwipsFromAttrs(
|
|
33440
|
+
function paragraphTwipsFromAttrs(attrs4) {
|
|
33132
33441
|
const result = {};
|
|
33133
|
-
const spacingBefore = twipsAttr(
|
|
33134
|
-
const spacingAfter = twipsAttr(
|
|
33135
|
-
const lineSpacing = signedTwipsAttr(
|
|
33136
|
-
const left = signedTwipsAttr(
|
|
33137
|
-
const right = signedTwipsAttr(
|
|
33138
|
-
const start = signedTwipsAttr(
|
|
33139
|
-
const end = signedTwipsAttr(
|
|
33140
|
-
const firstLine = twipsAttr(
|
|
33141
|
-
const hanging = twipsAttr(
|
|
33442
|
+
const spacingBefore = twipsAttr(attrs4.spacingBeforeTwips);
|
|
33443
|
+
const spacingAfter = twipsAttr(attrs4.spacingAfterTwips);
|
|
33444
|
+
const lineSpacing = signedTwipsAttr(attrs4.lineSpacingTwips);
|
|
33445
|
+
const left = signedTwipsAttr(attrs4.indentLeftTwips);
|
|
33446
|
+
const right = signedTwipsAttr(attrs4.indentRightTwips);
|
|
33447
|
+
const start = signedTwipsAttr(attrs4.indentStartTwips);
|
|
33448
|
+
const end = signedTwipsAttr(attrs4.indentEndTwips);
|
|
33449
|
+
const firstLine = twipsAttr(attrs4.firstLineTwips);
|
|
33450
|
+
const hanging = twipsAttr(attrs4.hangingTwips);
|
|
33142
33451
|
if (spacingBefore !== void 0) result.spacingBeforeTwips = spacingBefore;
|
|
33143
33452
|
if (spacingAfter !== void 0) result.spacingAfterTwips = spacingAfter;
|
|
33144
33453
|
if (lineSpacing !== void 0) result.lineSpacingTwips = lineSpacing;
|
|
@@ -33233,9 +33542,9 @@ var runPropertiesMark = {
|
|
|
33233
33542
|
parseDOM: [
|
|
33234
33543
|
{
|
|
33235
33544
|
tag: "span[data-run-props]",
|
|
33236
|
-
getAttrs: (
|
|
33545
|
+
getAttrs: (el6) => {
|
|
33237
33546
|
try {
|
|
33238
|
-
return { props: JSON.parse(
|
|
33547
|
+
return { props: JSON.parse(el6.dataset.runProps || "null") };
|
|
33239
33548
|
} catch {
|
|
33240
33549
|
return { props: null };
|
|
33241
33550
|
}
|
|
@@ -33528,7 +33837,9 @@ function runToInlineNodes(run, schema, noteNumber) {
|
|
|
33528
33837
|
textBoxBorder: run.image.textBoxBorder ?? null,
|
|
33529
33838
|
diagram: run.image.diagram ? JSON.stringify(run.image.diagram) : null,
|
|
33530
33839
|
chart: run.image.chart ? JSON.stringify(run.image.chart) : null,
|
|
33531
|
-
shape: run.image.shape ? JSON.stringify(run.image.shape) : null
|
|
33840
|
+
shape: run.image.shape ? JSON.stringify(run.image.shape) : null,
|
|
33841
|
+
watermark: run.image.watermark ? JSON.stringify(run.image.watermark) : null,
|
|
33842
|
+
pictureWatermark: run.image.pictureWatermark ? JSON.stringify(run.image.pictureWatermark) : null
|
|
33532
33843
|
},
|
|
33533
33844
|
void 0,
|
|
33534
33845
|
marks2
|
|
@@ -33615,6 +33926,8 @@ function appendInlineNode(runs, child3) {
|
|
|
33615
33926
|
...typeof child3.attrs.diagram === "string" ? { diagram: JSON.parse(child3.attrs.diagram) } : {},
|
|
33616
33927
|
...typeof child3.attrs.chart === "string" ? { chart: JSON.parse(child3.attrs.chart) } : {},
|
|
33617
33928
|
...typeof child3.attrs.shape === "string" ? { shape: JSON.parse(child3.attrs.shape) } : {},
|
|
33929
|
+
...typeof child3.attrs.watermark === "string" ? { watermark: JSON.parse(child3.attrs.watermark) } : {},
|
|
33930
|
+
...typeof child3.attrs.pictureWatermark === "string" ? { pictureWatermark: JSON.parse(child3.attrs.pictureWatermark) } : {},
|
|
33618
33931
|
...typeof child3.attrs.placement === "string" ? { placement: JSON.parse(child3.attrs.placement) } : {},
|
|
33619
33932
|
...typeof child3.attrs.textBoxText === "string" ? { textBoxText: JSON.parse(child3.attrs.textBoxText) } : {},
|
|
33620
33933
|
...child3.attrs.textBoxEditable ? { textBoxEditable: true } : {},
|
|
@@ -33675,8 +33988,8 @@ var RUN_FORMAT_MARKS = /* @__PURE__ */ new Set([
|
|
|
33675
33988
|
function setInlineRunFormatting(tr, pos, run) {
|
|
33676
33989
|
const node = tr.doc.nodeAt(pos);
|
|
33677
33990
|
const projected = runToInlineNodes(run, tr.doc.type.schema)[0];
|
|
33678
|
-
const
|
|
33679
|
-
for (const [key, value] of Object.entries(
|
|
33991
|
+
const attrs4 = updatedInlineRunAttributes(node, projected.attrs.format);
|
|
33992
|
+
for (const [key, value] of Object.entries(attrs4))
|
|
33680
33993
|
if (node.attrs[key] !== value) tr.setNodeAttribute(pos, key, value);
|
|
33681
33994
|
for (const mark of node.marks)
|
|
33682
33995
|
if (RUN_FORMAT_MARKS.has(mark.type.name)) tr.removeMark(pos, pos + node.nodeSize, mark.type);
|
|
@@ -33731,14 +34044,7 @@ function resolveFormattingRange(tr, from, to, mode) {
|
|
|
33731
34044
|
|
|
33732
34045
|
// docx/ui/track-run-formatting.ts
|
|
33733
34046
|
function properties(node) {
|
|
33734
|
-
|
|
33735
|
-
run.text = "";
|
|
33736
|
-
delete run.image;
|
|
33737
|
-
delete run.equation;
|
|
33738
|
-
delete run.revision;
|
|
33739
|
-
delete run.formatRevision;
|
|
33740
|
-
const doc = parseXml2(`<w:r xmlns:w="${WORD_NS}"/>`);
|
|
33741
|
-
return first2(createRun(doc, run), "rPr") ?? makeW(doc, "rPr");
|
|
34047
|
+
return runPropertiesElement(inlineNodeRun(node) ?? { text: "" });
|
|
33742
34048
|
}
|
|
33743
34049
|
function trackRunFormatting(steps, oldState, newState, author, date, nextId) {
|
|
33744
34050
|
const markType = newState.schema.marks.runProperties;
|
|
@@ -33809,34 +34115,35 @@ var PARAGRAPH_KEEP_KEYS = [
|
|
|
33809
34115
|
"contextualSpacing",
|
|
33810
34116
|
"suppressLineNumbers"
|
|
33811
34117
|
];
|
|
33812
|
-
|
|
34118
|
+
var PARAGRAPH_EAST_ASIAN_KEYS = EAST_ASIAN_TYPOGRAPHY_KEYS;
|
|
34119
|
+
function paragraphFromAttrs(attrs4, id, runs) {
|
|
33813
34120
|
return {
|
|
33814
34121
|
type: "paragraph",
|
|
33815
34122
|
id,
|
|
33816
34123
|
runs,
|
|
33817
|
-
...
|
|
33818
|
-
...
|
|
33819
|
-
...
|
|
33820
|
-
...
|
|
33821
|
-
...
|
|
33822
|
-
...
|
|
33823
|
-
...
|
|
33824
|
-
...
|
|
33825
|
-
...
|
|
33826
|
-
...paragraphTwipsFromAttrs(
|
|
33827
|
-
...
|
|
33828
|
-
...
|
|
33829
|
-
...
|
|
33830
|
-
...
|
|
34124
|
+
...attrs4.restoredParagraphPropertiesXml ? { restoredParagraphPropertiesXml: String(attrs4.restoredParagraphPropertiesXml) } : {},
|
|
34125
|
+
...attrs4.sourceParagraphPropertiesXml ? { sourceParagraphPropertiesXml: String(attrs4.sourceParagraphPropertiesXml) } : {},
|
|
34126
|
+
...attrs4.markRevision ? { markRevision: structuredClone(attrs4.markRevision) } : {},
|
|
34127
|
+
...attrs4.formatRevision ? { formatRevision: structuredClone(attrs4.formatRevision) } : {},
|
|
34128
|
+
...attrs4.align != null ? { align: attrs4.align } : {},
|
|
34129
|
+
...attrs4.justification != null ? { justification: attrs4.justification } : {},
|
|
34130
|
+
...attrs4.outlineLevel != null ? { outlineLevel: Number(attrs4.outlineLevel) } : {},
|
|
34131
|
+
...attrs4.direction != null ? { direction: attrs4.direction } : {},
|
|
34132
|
+
...attrs4.style ? { style: attrs4.style } : {},
|
|
34133
|
+
...paragraphTwipsFromAttrs(attrs4),
|
|
34134
|
+
...attrs4.lineSpacingRule != null ? { lineSpacingRule: attrs4.lineSpacingRule } : {},
|
|
34135
|
+
...attrs4.numId != null ? { numbering: { numId: attrs4.numId, level: attrs4.ilvl ?? 0 } } : {},
|
|
34136
|
+
...attrs4.pageBreakBefore != null ? { pageBreakBefore: Boolean(attrs4.pageBreakBefore) } : {},
|
|
34137
|
+
...attrs4.tabStops?.length ? { tabStops: structuredClone(attrs4.tabStops) } : {},
|
|
33831
34138
|
...Object.fromEntries(
|
|
33832
|
-
PARAGRAPH_KEEP_KEYS.filter((key) =>
|
|
34139
|
+
[...PARAGRAPH_KEEP_KEYS, ...PARAGRAPH_EAST_ASIAN_KEYS].filter((key) => attrs4[key] != null).map((key) => [key, Boolean(attrs4[key])])
|
|
33833
34140
|
),
|
|
33834
|
-
...
|
|
33835
|
-
...
|
|
33836
|
-
...
|
|
33837
|
-
...
|
|
33838
|
-
...
|
|
33839
|
-
...
|
|
34141
|
+
...attrs4.dropCap ? { dropCap: { ...attrs4.dropCap } } : {},
|
|
34142
|
+
...attrs4.borders ? { borders: structuredClone(attrs4.borders) } : {},
|
|
34143
|
+
...attrs4.shadingFill ? { shadingFill: attrs4.shadingFill } : {},
|
|
34144
|
+
...attrs4.bookmarks?.length ? { bookmarks: [...attrs4.bookmarks] } : {},
|
|
34145
|
+
...attrs4.permissions?.length ? { permissions: structuredClone(attrs4.permissions) } : {},
|
|
34146
|
+
...attrs4.contentControl ? { contentControl: structuredClone(attrs4.contentControl) } : {}
|
|
33840
34147
|
};
|
|
33841
34148
|
}
|
|
33842
34149
|
function paragraphAttrs(paragraph) {
|
|
@@ -33870,6 +34177,10 @@ function paragraphAttrs(paragraph) {
|
|
|
33870
34177
|
widowControl: paragraph.widowControl ?? null,
|
|
33871
34178
|
contextualSpacing: paragraph.contextualSpacing ?? null,
|
|
33872
34179
|
suppressLineNumbers: paragraph.suppressLineNumbers ?? null,
|
|
34180
|
+
kinsoku: paragraph.kinsoku ?? null,
|
|
34181
|
+
autoSpaceDE: paragraph.autoSpaceDE ?? null,
|
|
34182
|
+
autoSpaceDN: paragraph.autoSpaceDN ?? null,
|
|
34183
|
+
overflowPunct: paragraph.overflowPunct ?? null,
|
|
33873
34184
|
dropCap: paragraph.dropCap ?? null,
|
|
33874
34185
|
borders: paragraph.borders ?? null,
|
|
33875
34186
|
shadingFill: paragraph.shadingFill ?? null,
|
|
@@ -33889,7 +34200,7 @@ function resolveParagraphFormatting(tr, pos, mode) {
|
|
|
33889
34200
|
if (!node) return;
|
|
33890
34201
|
const revision = paragraphFormattingRevision(node);
|
|
33891
34202
|
if (!revision) return;
|
|
33892
|
-
const
|
|
34203
|
+
const attrs4 = { ...node.attrs, formatRevision: null };
|
|
33893
34204
|
if (mode === "reject") {
|
|
33894
34205
|
const paragraph = {
|
|
33895
34206
|
type: "paragraph",
|
|
@@ -33901,14 +34212,14 @@ function resolveParagraphFormatting(tr, pos, mode) {
|
|
|
33901
34212
|
restoreParagraphFormatting(paragraph);
|
|
33902
34213
|
for (const key of PARAGRAPH_FORMAT_KEYS)
|
|
33903
34214
|
if (Object.hasOwn(node.attrs, key))
|
|
33904
|
-
|
|
33905
|
-
|
|
33906
|
-
|
|
33907
|
-
|
|
34215
|
+
attrs4[key] = paragraph[key] ?? node.type.spec.attrs?.[key]?.default ?? null;
|
|
34216
|
+
attrs4.numId = paragraph.numbering?.numId ?? null;
|
|
34217
|
+
attrs4.ilvl = paragraph.numbering?.level ?? null;
|
|
34218
|
+
attrs4.restoredParagraphPropertiesXml = paragraph.restoredParagraphPropertiesXml;
|
|
33908
34219
|
if (paragraph.sourceParagraphPropertiesXml)
|
|
33909
|
-
|
|
34220
|
+
attrs4.sourceParagraphPropertiesXml = paragraph.sourceParagraphPropertiesXml;
|
|
33910
34221
|
}
|
|
33911
|
-
tr.setNodeMarkup(pos, void 0,
|
|
34222
|
+
tr.setNodeMarkup(pos, void 0, attrs4);
|
|
33912
34223
|
}
|
|
33913
34224
|
|
|
33914
34225
|
// docx/ui/track-paragraph-formatting.ts
|
|
@@ -35059,7 +35370,7 @@ var hardBreakNodeSpec = {
|
|
|
35059
35370
|
parseDOM: [
|
|
35060
35371
|
{
|
|
35061
35372
|
tag: "br",
|
|
35062
|
-
getAttrs: (
|
|
35373
|
+
getAttrs: (el6) => ({ format: el6.dataset.runProperties ?? null })
|
|
35063
35374
|
}
|
|
35064
35375
|
],
|
|
35065
35376
|
toDOM: (node) => ["br", inlineRunPropertiesDomAttrs(node)]
|
|
@@ -35074,9 +35385,9 @@ var pageBreakNodeSpec = {
|
|
|
35074
35385
|
parseDOM: [
|
|
35075
35386
|
{
|
|
35076
35387
|
tag: "span[data-docx-break]",
|
|
35077
|
-
getAttrs: (
|
|
35078
|
-
kind:
|
|
35079
|
-
format:
|
|
35388
|
+
getAttrs: (el6) => ({
|
|
35389
|
+
kind: el6.dataset.docxBreak === "column" ? "column" : "page",
|
|
35390
|
+
format: el6.dataset.runProperties ?? null
|
|
35080
35391
|
})
|
|
35081
35392
|
}
|
|
35082
35393
|
],
|
|
@@ -35112,11 +35423,11 @@ var noteReferenceNodeSpec = {
|
|
|
35112
35423
|
{
|
|
35113
35424
|
tag: "sup[data-docx-note-kind]",
|
|
35114
35425
|
priority: 60,
|
|
35115
|
-
getAttrs: (
|
|
35116
|
-
kind:
|
|
35117
|
-
format:
|
|
35118
|
-
id:
|
|
35119
|
-
number: Number(
|
|
35426
|
+
getAttrs: (el6) => ({
|
|
35427
|
+
kind: el6.dataset.docxNoteKind === "endnote" ? "endnote" : "footnote",
|
|
35428
|
+
format: el6.dataset.runProperties ?? null,
|
|
35429
|
+
id: el6.dataset.docxNoteId || "",
|
|
35430
|
+
number: Number(el6.textContent) || 1
|
|
35120
35431
|
})
|
|
35121
35432
|
}
|
|
35122
35433
|
],
|
|
@@ -35147,10 +35458,10 @@ var fieldMarkerNodeSpec = {
|
|
|
35147
35458
|
parseDOM: [
|
|
35148
35459
|
{
|
|
35149
35460
|
tag: "span[data-field-marker]",
|
|
35150
|
-
getAttrs: (
|
|
35151
|
-
kind:
|
|
35152
|
-
format:
|
|
35153
|
-
code:
|
|
35461
|
+
getAttrs: (el6) => ({
|
|
35462
|
+
kind: el6.dataset.fieldMarker || "begin",
|
|
35463
|
+
format: el6.dataset.runProperties ?? null,
|
|
35464
|
+
code: el6.dataset.fieldCode ?? null
|
|
35154
35465
|
})
|
|
35155
35466
|
}
|
|
35156
35467
|
],
|
|
@@ -35668,8 +35979,8 @@ var WordYjsInlineCommentAnchors = class {
|
|
|
35668
35979
|
capture(doc, from, to, mapping) {
|
|
35669
35980
|
const ranges = [];
|
|
35670
35981
|
const relative = (pos, assoc) => {
|
|
35671
|
-
const
|
|
35672
|
-
const absolute = Y2.createAbsolutePositionFromRelativePosition(
|
|
35982
|
+
const position = absolutePositionToRelativePosition(pos, this.fragment, mapping);
|
|
35983
|
+
const absolute = Y2.createAbsolutePositionFromRelativePosition(position, this.fragment.doc);
|
|
35673
35984
|
if (!absolute) throw new Error("Cannot resolve an inline comment anchor.");
|
|
35674
35985
|
return Array.from(
|
|
35675
35986
|
Y2.encodeRelativePosition(
|
|
@@ -35878,8 +36189,8 @@ function removeSharedAnchor(fragment, id) {
|
|
|
35878
36189
|
let offset = 0;
|
|
35879
36190
|
for (const part of child3.toDelta()) {
|
|
35880
36191
|
const length = typeof part.insert === "string" ? part.insert.length : 1;
|
|
35881
|
-
for (const [key,
|
|
35882
|
-
if (key.startsWith("comment--") && Array.isArray(
|
|
36192
|
+
for (const [key, attrs4] of Object.entries(part.attributes ?? {})) {
|
|
36193
|
+
if (key.startsWith("comment--") && Array.isArray(attrs4.ids) && attrs4.ids.includes(id))
|
|
35883
36194
|
child3.format(offset, length, { [key]: null });
|
|
35884
36195
|
}
|
|
35885
36196
|
offset += length;
|
|
@@ -35936,11 +36247,15 @@ function guardDeletedNodeSelection(doc, view, binding) {
|
|
|
35936
36247
|
doc.on("beforeObserverCalls", guard);
|
|
35937
36248
|
return () => doc.off("beforeObserverCalls", guard);
|
|
35938
36249
|
}
|
|
35939
|
-
|
|
36250
|
+
var LOCAL_DOCUMENT_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
36251
|
+
"commentThreads",
|
|
36252
|
+
"documentInformation"
|
|
36253
|
+
]);
|
|
36254
|
+
function wordYjsDocumentAttributes(attrs4, canWrite) {
|
|
35940
36255
|
const patch = (state) => {
|
|
35941
36256
|
const tr = state.tr;
|
|
35942
|
-
for (const [key, value] of
|
|
35943
|
-
if (key
|
|
36257
|
+
for (const [key, value] of attrs4.entries()) {
|
|
36258
|
+
if (!LOCAL_DOCUMENT_ATTRIBUTES.has(key) && key in (state.doc.type.spec.attrs ?? {}) && JSON.stringify(state.doc.attrs[key]) !== JSON.stringify(value))
|
|
35944
36259
|
tr.setDocAttribute(key, value);
|
|
35945
36260
|
}
|
|
35946
36261
|
return tr.steps.length ? tr.setMeta("dve-remote", true).setMeta("addToHistory", false) : null;
|
|
@@ -35956,18 +36271,18 @@ function wordYjsDocumentAttributes(attrs3, canWrite) {
|
|
|
35956
36271
|
binding?.mux(() => view.dispatch(tr));
|
|
35957
36272
|
}
|
|
35958
36273
|
};
|
|
35959
|
-
|
|
36274
|
+
attrs4.observe(changed);
|
|
35960
36275
|
return {
|
|
35961
36276
|
update: (next, previous) => {
|
|
35962
36277
|
if (previous.doc.attrs === next.state.doc.attrs || !canWrite()) return;
|
|
35963
|
-
|
|
36278
|
+
attrs4.doc.transact((transaction) => {
|
|
35964
36279
|
transaction.meta.set("addToHistory", thisPlugin.getState(next.state));
|
|
35965
36280
|
for (const [key, value] of Object.entries(next.state.doc.attrs))
|
|
35966
|
-
if (key
|
|
35967
|
-
|
|
36281
|
+
if (!LOCAL_DOCUMENT_ATTRIBUTES.has(key) && JSON.stringify(attrs4.get(key)) !== JSON.stringify(value))
|
|
36282
|
+
attrs4.set(key, value);
|
|
35968
36283
|
}, ySyncPluginKey);
|
|
35969
36284
|
},
|
|
35970
|
-
destroy: () =>
|
|
36285
|
+
destroy: () => attrs4.unobserve(changed)
|
|
35971
36286
|
};
|
|
35972
36287
|
}
|
|
35973
36288
|
});
|
|
@@ -36011,7 +36326,7 @@ var WordYjsCollaboration = class {
|
|
|
36011
36326
|
this.comments.resolved.set(comment.id, comment.resolved);
|
|
36012
36327
|
}
|
|
36013
36328
|
for (const [key, value] of Object.entries(initial.attrs))
|
|
36014
|
-
if (key
|
|
36329
|
+
if (!LOCAL_DOCUMENT_ATTRIBUTES.has(key)) this.attributes.set(key, value);
|
|
36015
36330
|
prosemirrorToYXmlFragment(independentCommentAnchors(initial), this.fragment);
|
|
36016
36331
|
seedEmptyParagraphText(this.fragment);
|
|
36017
36332
|
if (format === "word-yjs-v3") {
|
|
@@ -36628,10 +36943,10 @@ var insertWordHardBreak = (state, dispatch, view) => {
|
|
|
36628
36943
|
// docx/ui/chart-spec.ts
|
|
36629
36944
|
var SVG_NS2 = "http://www.w3.org/2000/svg";
|
|
36630
36945
|
function elementSpec(element3, root) {
|
|
36631
|
-
const
|
|
36946
|
+
const attrs4 = {};
|
|
36632
36947
|
for (const attr2 of Array.from(element3.attributes)) {
|
|
36633
36948
|
if (attr2.name === "xmlns" || attr2.name.startsWith("xmlns:") || /^on/i.test(attr2.name)) continue;
|
|
36634
|
-
|
|
36949
|
+
attrs4[attr2.name] = attr2.value;
|
|
36635
36950
|
}
|
|
36636
36951
|
const children3 = [];
|
|
36637
36952
|
for (const child3 of Array.from(element3.childNodes)) {
|
|
@@ -36639,7 +36954,7 @@ function elementSpec(element3, root) {
|
|
|
36639
36954
|
else if (child3.nodeType === 3 && child3.nodeValue) children3.push(child3.nodeValue);
|
|
36640
36955
|
}
|
|
36641
36956
|
const tag = root ? `${SVG_NS2} ${element3.localName}` : element3.localName;
|
|
36642
|
-
return [tag,
|
|
36957
|
+
return [tag, attrs4, ...children3];
|
|
36643
36958
|
}
|
|
36644
36959
|
function svgMarkupSpec(svg) {
|
|
36645
36960
|
return elementSpec(parseXml(svg, { label: "Chart SVG" }).documentElement, true);
|
|
@@ -36740,22 +37055,25 @@ var imageNodeSpec = {
|
|
|
36740
37055
|
/** A chart (`DocxChart`) as JSON; painted read-only from its cached values (`chart-spec.ts`). */
|
|
36741
37056
|
chart: { default: null },
|
|
36742
37057
|
/** A drawing shape (`ShapeSpec`) as JSON; drawn as SVG by the shape node view. */
|
|
36743
|
-
shape: { default: null }
|
|
37058
|
+
shape: { default: null },
|
|
37059
|
+
/** A header watermark (`WatermarkSpec` or `PictureWatermarkSpec`) as JSON, kept through edits. */
|
|
37060
|
+
watermark: { default: null },
|
|
37061
|
+
pictureWatermark: { default: null }
|
|
36744
37062
|
},
|
|
36745
37063
|
parseDOM: [
|
|
36746
37064
|
{
|
|
36747
37065
|
tag: "img[data-docx-image], span[data-docx-image-placeholder]",
|
|
36748
|
-
getAttrs: (
|
|
36749
|
-
format:
|
|
36750
|
-
relId:
|
|
36751
|
-
partName:
|
|
36752
|
-
contentType:
|
|
36753
|
-
widthPx: Number(
|
|
36754
|
-
heightPx: Number(
|
|
36755
|
-
altText:
|
|
36756
|
-
title:
|
|
36757
|
-
anchored:
|
|
36758
|
-
unsupported:
|
|
37066
|
+
getAttrs: (el6) => ({
|
|
37067
|
+
format: el6.dataset.runProperties ?? null,
|
|
37068
|
+
relId: el6.dataset.relId || "",
|
|
37069
|
+
partName: el6.dataset.partName || "",
|
|
37070
|
+
contentType: el6.dataset.contentType || "",
|
|
37071
|
+
widthPx: Number(el6.dataset.widthPx) || 96,
|
|
37072
|
+
heightPx: Number(el6.dataset.heightPx) || 96,
|
|
37073
|
+
altText: el6.getAttribute("alt") || null,
|
|
37074
|
+
title: el6.getAttribute("title") || null,
|
|
37075
|
+
anchored: el6.dataset.anchored === "1",
|
|
37076
|
+
unsupported: el6.dataset.unsupported || null
|
|
36759
37077
|
})
|
|
36760
37078
|
}
|
|
36761
37079
|
],
|
|
@@ -36794,7 +37112,7 @@ var imageNodeSpec = {
|
|
|
36794
37112
|
]
|
|
36795
37113
|
};
|
|
36796
37114
|
function isNavigableHref(href) {
|
|
36797
|
-
return
|
|
37115
|
+
return isWordNavigableHref(href);
|
|
36798
37116
|
}
|
|
36799
37117
|
var linkMarkSpec = {
|
|
36800
37118
|
attrs: {
|
|
@@ -36806,10 +37124,10 @@ var linkMarkSpec = {
|
|
|
36806
37124
|
parseDOM: [
|
|
36807
37125
|
{
|
|
36808
37126
|
tag: "a[data-docx-link]",
|
|
36809
|
-
getAttrs: (
|
|
36810
|
-
href:
|
|
36811
|
-
anchor:
|
|
36812
|
-
tooltip:
|
|
37127
|
+
getAttrs: (el6) => ({
|
|
37128
|
+
href: el6.dataset.href || (el6.dataset.anchor ? null : el6.getAttribute("href")) || null,
|
|
37129
|
+
anchor: el6.dataset.anchor || null,
|
|
37130
|
+
tooltip: el6.getAttribute("title") || null
|
|
36813
37131
|
})
|
|
36814
37132
|
}
|
|
36815
37133
|
],
|
|
@@ -36876,7 +37194,7 @@ function applyWordLink(target, displayText) {
|
|
|
36876
37194
|
if (view?.editable === false || !state.schema.marks.link || !target.href && !target.anchor)
|
|
36877
37195
|
return false;
|
|
36878
37196
|
if (target.href && !isNavigableHref(target.href))
|
|
36879
|
-
throw new Error("Links must start with http://, https
|
|
37197
|
+
throw new Error("Links must start with http://, https://, mailto:, tel: or ftp://.");
|
|
36880
37198
|
if (!dispatch) return true;
|
|
36881
37199
|
const { from, to, empty } = state.selection;
|
|
36882
37200
|
const tr = state.tr;
|
|
@@ -37105,8 +37423,8 @@ var reviewMarks = {
|
|
|
37105
37423
|
parseDOM: [
|
|
37106
37424
|
{
|
|
37107
37425
|
tag: "span[data-inline-comment-ids]",
|
|
37108
|
-
getAttrs: (
|
|
37109
|
-
ids: (
|
|
37426
|
+
getAttrs: (el6) => ({
|
|
37427
|
+
ids: (el6.dataset.inlineCommentIds ?? "").split(",").filter(Boolean)
|
|
37110
37428
|
})
|
|
37111
37429
|
}
|
|
37112
37430
|
],
|
|
@@ -37134,11 +37452,11 @@ var reviewMarks = {
|
|
|
37134
37452
|
parseDOM: [
|
|
37135
37453
|
{
|
|
37136
37454
|
tag: "ins[data-revision-id]",
|
|
37137
|
-
getAttrs: (
|
|
37138
|
-
author:
|
|
37139
|
-
date:
|
|
37140
|
-
dateUtc:
|
|
37141
|
-
id:
|
|
37455
|
+
getAttrs: (el6) => ({
|
|
37456
|
+
author: el6.dataset.author || "",
|
|
37457
|
+
date: el6.dataset.date || null,
|
|
37458
|
+
dateUtc: el6.dataset.dateUtc || null,
|
|
37459
|
+
id: el6.dataset.revisionId || "",
|
|
37142
37460
|
move: null
|
|
37143
37461
|
})
|
|
37144
37462
|
}
|
|
@@ -37169,11 +37487,11 @@ var reviewMarks = {
|
|
|
37169
37487
|
parseDOM: [
|
|
37170
37488
|
{
|
|
37171
37489
|
tag: "del[data-revision-id]",
|
|
37172
|
-
getAttrs: (
|
|
37173
|
-
author:
|
|
37174
|
-
date:
|
|
37175
|
-
dateUtc:
|
|
37176
|
-
id:
|
|
37490
|
+
getAttrs: (el6) => ({
|
|
37491
|
+
author: el6.dataset.author || "",
|
|
37492
|
+
date: el6.dataset.date || null,
|
|
37493
|
+
dateUtc: el6.dataset.dateUtc || null,
|
|
37494
|
+
id: el6.dataset.revisionId || "",
|
|
37177
37495
|
move: null
|
|
37178
37496
|
})
|
|
37179
37497
|
}
|
|
@@ -37199,8 +37517,8 @@ var reviewMarks = {
|
|
|
37199
37517
|
parseDOM: [
|
|
37200
37518
|
{
|
|
37201
37519
|
tag: "span[data-comment-ids]",
|
|
37202
|
-
getAttrs: (
|
|
37203
|
-
ids: (
|
|
37520
|
+
getAttrs: (el6) => ({
|
|
37521
|
+
ids: (el6.dataset.commentIds || "").split(",").filter(Boolean)
|
|
37204
37522
|
})
|
|
37205
37523
|
}
|
|
37206
37524
|
],
|
|
@@ -37804,6 +38122,7 @@ var RIBBON_ACTION_IDS = [
|
|
|
37804
38122
|
"insert-table-of-figures",
|
|
37805
38123
|
"insert-footnote",
|
|
37806
38124
|
"insert-endnote",
|
|
38125
|
+
"convert-notes",
|
|
37807
38126
|
"paragraph-direction",
|
|
37808
38127
|
"text-language",
|
|
37809
38128
|
"custom-text-language-tag",
|
|
@@ -37839,7 +38158,8 @@ var RIBBON_ACTION_IDS = [
|
|
|
37839
38158
|
"merge-cells",
|
|
37840
38159
|
"split-cells",
|
|
37841
38160
|
"delete-table",
|
|
37842
|
-
"table-properties"
|
|
38161
|
+
"table-properties",
|
|
38162
|
+
"crop"
|
|
37843
38163
|
];
|
|
37844
38164
|
var RIBBON_ACTION_LABELS = {
|
|
37845
38165
|
paste: "Paste",
|
|
@@ -38001,6 +38321,7 @@ var RIBBON_ACTION_LABELS = {
|
|
|
38001
38321
|
"insert-table-of-figures": "Insert table of figures",
|
|
38002
38322
|
"insert-footnote": "Insert footnote",
|
|
38003
38323
|
"insert-endnote": "Insert endnote",
|
|
38324
|
+
"convert-notes": "Convert notes",
|
|
38004
38325
|
"paragraph-direction": "Paragraph direction",
|
|
38005
38326
|
"text-language": "Text language",
|
|
38006
38327
|
"custom-text-language-tag": "Custom text language tag",
|
|
@@ -38037,7 +38358,8 @@ var RIBBON_ACTION_LABELS = {
|
|
|
38037
38358
|
"merge-cells": "Merge cells",
|
|
38038
38359
|
"split-cells": "Split cells",
|
|
38039
38360
|
"delete-table": "Delete table",
|
|
38040
|
-
"table-properties": "Table properties"
|
|
38361
|
+
"table-properties": "Table properties",
|
|
38362
|
+
crop: "Crop"
|
|
38041
38363
|
};
|
|
38042
38364
|
var labelToId = new Map(
|
|
38043
38365
|
RIBBON_ACTION_IDS.map((id) => [RIBBON_ACTION_LABELS[id], id])
|
|
@@ -38174,24 +38496,6 @@ function parseFontSize(value) {
|
|
|
38174
38496
|
const size = Number(match[1]) * (match[2]?.toLowerCase() === "px" ? 0.75 : 1);
|
|
38175
38497
|
return Number.isFinite(size) && size > 0 ? size : null;
|
|
38176
38498
|
}
|
|
38177
|
-
var wordHighlightColors = {
|
|
38178
|
-
black: "#000000",
|
|
38179
|
-
blue: "#0000ff",
|
|
38180
|
-
cyan: "#00ffff",
|
|
38181
|
-
green: "#00ff00",
|
|
38182
|
-
magenta: "#ff00ff",
|
|
38183
|
-
red: "#ff0000",
|
|
38184
|
-
yellow: "#ffff00",
|
|
38185
|
-
white: "#ffffff",
|
|
38186
|
-
darkBlue: "#000080",
|
|
38187
|
-
darkCyan: "#008080",
|
|
38188
|
-
darkGreen: "#008000",
|
|
38189
|
-
darkMagenta: "#800080",
|
|
38190
|
-
darkRed: "#800000",
|
|
38191
|
-
darkYellow: "#808000",
|
|
38192
|
-
darkGray: "#808080",
|
|
38193
|
-
lightGray: "#c0c0c0"
|
|
38194
|
-
};
|
|
38195
38499
|
function contentControlDom(data) {
|
|
38196
38500
|
let control = {};
|
|
38197
38501
|
try {
|
|
@@ -38226,8 +38530,8 @@ var markSpecs = {
|
|
|
38226
38530
|
parseDOM: [
|
|
38227
38531
|
{
|
|
38228
38532
|
tag: 'span[style*="background-color"]',
|
|
38229
|
-
getAttrs: (
|
|
38230
|
-
const color =
|
|
38533
|
+
getAttrs: (el6) => {
|
|
38534
|
+
const color = el6.style.backgroundColor.toLowerCase();
|
|
38231
38535
|
if (color === "white" || color === "rgb(255, 255, 255)" || color === "#ffffff")
|
|
38232
38536
|
return false;
|
|
38233
38537
|
const entry = Object.entries(wordHighlightColors).find(([, css]) => {
|
|
@@ -38264,20 +38568,20 @@ var markSpecs = {
|
|
|
38264
38568
|
parseDOM: [
|
|
38265
38569
|
{
|
|
38266
38570
|
tag: "span[lang], span[data-docx-east-asia-language], span[data-docx-bidi-language]",
|
|
38267
|
-
getAttrs: (
|
|
38268
|
-
language:
|
|
38269
|
-
eastAsiaLanguage:
|
|
38270
|
-
bidiLanguage:
|
|
38571
|
+
getAttrs: (el6) => ({
|
|
38572
|
+
language: el6.getAttribute("lang"),
|
|
38573
|
+
eastAsiaLanguage: el6.dataset.docxEastAsiaLanguage || null,
|
|
38574
|
+
bidiLanguage: el6.dataset.docxBidiLanguage || null
|
|
38271
38575
|
})
|
|
38272
38576
|
}
|
|
38273
38577
|
],
|
|
38274
38578
|
toDOM: (mark) => {
|
|
38275
|
-
const
|
|
38276
|
-
if (mark.attrs.language)
|
|
38579
|
+
const attrs4 = {};
|
|
38580
|
+
if (mark.attrs.language) attrs4.lang = mark.attrs.language;
|
|
38277
38581
|
if (mark.attrs.eastAsiaLanguage)
|
|
38278
|
-
|
|
38279
|
-
if (mark.attrs.bidiLanguage)
|
|
38280
|
-
return ["span",
|
|
38582
|
+
attrs4["data-docx-east-asia-language"] = mark.attrs.eastAsiaLanguage;
|
|
38583
|
+
if (mark.attrs.bidiLanguage) attrs4["data-docx-bidi-language"] = mark.attrs.bidiLanguage;
|
|
38584
|
+
return ["span", attrs4, 0];
|
|
38281
38585
|
}
|
|
38282
38586
|
},
|
|
38283
38587
|
runRtl: {
|
|
@@ -38297,14 +38601,14 @@ var markSpecs = {
|
|
|
38297
38601
|
parseDOM: [
|
|
38298
38602
|
{
|
|
38299
38603
|
tag: "span",
|
|
38300
|
-
getAttrs: (
|
|
38301
|
-
const style =
|
|
38302
|
-
const
|
|
38604
|
+
getAttrs: (el6) => {
|
|
38605
|
+
const style = el6.style;
|
|
38606
|
+
const attrs4 = {
|
|
38303
38607
|
family: pastedFontFamily(style.fontFamily),
|
|
38304
38608
|
size: style.fontSize ? parseFontSize(style.fontSize) : null,
|
|
38305
38609
|
color: pastedColor(style.color)
|
|
38306
38610
|
};
|
|
38307
|
-
return
|
|
38611
|
+
return attrs4.family || attrs4.size || attrs4.color ? attrs4 : false;
|
|
38308
38612
|
}
|
|
38309
38613
|
}
|
|
38310
38614
|
],
|
|
@@ -38326,7 +38630,7 @@ var markSpecs = {
|
|
|
38326
38630
|
parseDOM: [
|
|
38327
38631
|
{
|
|
38328
38632
|
tag: "span[data-docx-style]",
|
|
38329
|
-
getAttrs: (
|
|
38633
|
+
getAttrs: (el6) => ({ id: el6.dataset.docxStyle || null })
|
|
38330
38634
|
}
|
|
38331
38635
|
],
|
|
38332
38636
|
toDOM: (mark) => ["span", { "data-docx-style": mark.attrs.id }, 0]
|
|
@@ -38338,8 +38642,8 @@ var markSpecs = {
|
|
|
38338
38642
|
{
|
|
38339
38643
|
tag: "span[data-sdt]",
|
|
38340
38644
|
// Only a control is taken from (pasted) HTML; the span's text stays either way.
|
|
38341
|
-
getAttrs: (
|
|
38342
|
-
const control = controlFromData(
|
|
38645
|
+
getAttrs: (el6) => {
|
|
38646
|
+
const control = controlFromData(el6.dataset.sdt, "inline");
|
|
38343
38647
|
return control ? { data: JSON.stringify(control) } : false;
|
|
38344
38648
|
}
|
|
38345
38649
|
}
|
|
@@ -38353,9 +38657,9 @@ var markSpecs = {
|
|
|
38353
38657
|
parseDOM: [
|
|
38354
38658
|
{
|
|
38355
38659
|
tag: "span[data-field]",
|
|
38356
|
-
getAttrs: (
|
|
38357
|
-
instr:
|
|
38358
|
-
simple:
|
|
38660
|
+
getAttrs: (el6) => ({
|
|
38661
|
+
instr: el6.dataset.field || "",
|
|
38662
|
+
simple: el6.dataset.fieldSimple === "1"
|
|
38359
38663
|
})
|
|
38360
38664
|
}
|
|
38361
38665
|
],
|
|
@@ -38465,15 +38769,15 @@ function parseBordersJson(value) {
|
|
|
38465
38769
|
}
|
|
38466
38770
|
}
|
|
38467
38771
|
var twipsPx = (value) => Number.isSafeInteger(value) ? `${Number(value) / 15}px` : null;
|
|
38468
|
-
function tableStyle(
|
|
38469
|
-
const borders = parseBordersJson(
|
|
38470
|
-
const margins = marginValues(
|
|
38772
|
+
function tableStyle(attrs4) {
|
|
38773
|
+
const borders = parseBordersJson(attrs4.borders);
|
|
38774
|
+
const margins = marginValues(attrs4.cellMargins);
|
|
38471
38775
|
const declarations = [
|
|
38472
38776
|
"border-collapse:collapse",
|
|
38473
|
-
twipsPx(
|
|
38474
|
-
|
|
38475
|
-
|
|
38476
|
-
twipsPx(
|
|
38777
|
+
twipsPx(attrs4.widthTwips) && `width:${twipsPx(attrs4.widthTwips)}`,
|
|
38778
|
+
attrs4.alignment === "center" && "margin-left:auto;margin-right:auto",
|
|
38779
|
+
attrs4.alignment === "right" && "margin-left:auto",
|
|
38780
|
+
twipsPx(attrs4.indentTwips) && attrs4.alignment !== "center" && `margin-left:${twipsPx(attrs4.indentTwips)}`,
|
|
38477
38781
|
// Cells without their own resolved borders (e.g. a table inserted in the editor) draw the
|
|
38478
38782
|
// table's inside line; tables with no border information fall back to dashed gridlines.
|
|
38479
38783
|
borders && `--dve-cell-border:${cssBorderSide(borders.insideH ?? borders.top) ?? "none"}`,
|
|
@@ -38503,14 +38807,14 @@ function cellPadding(value) {
|
|
|
38503
38807
|
(side) => margins[side] === void 0 ? `var(--dve-cell-padding-${side}, ${DEFAULT_CELL_MARGINS[side] / 15}px)` : `${margins[side]}px`
|
|
38504
38808
|
).join(" ")}`;
|
|
38505
38809
|
}
|
|
38506
|
-
function tableCellStyle(
|
|
38507
|
-
const borders = parseBordersJson(
|
|
38508
|
-
const verticalAlign =
|
|
38810
|
+
function tableCellStyle(attrs4) {
|
|
38811
|
+
const borders = parseBordersJson(attrs4.borders);
|
|
38812
|
+
const verticalAlign = attrs4.verticalAlign === "center" ? "middle" : attrs4.verticalAlign === "bottom" ? "bottom" : "top";
|
|
38509
38813
|
const declarations = [
|
|
38510
|
-
cellPadding(
|
|
38814
|
+
cellPadding(attrs4.margins),
|
|
38511
38815
|
`vertical-align:${verticalAlign}`,
|
|
38512
|
-
twipsPx(
|
|
38513
|
-
typeof
|
|
38816
|
+
twipsPx(attrs4.widthTwips) && `width:${twipsPx(attrs4.widthTwips)}`,
|
|
38817
|
+
typeof attrs4.shadingFill === "string" && `background-color:${attrs4.shadingFill}`,
|
|
38514
38818
|
...["top", "bottom", "left", "right"].map(
|
|
38515
38819
|
(side) => borders && (cssBorderSide(borders[side]) ? `border-${side}:${cssBorderSide(borders[side])}` : `border-${side}-style:none`)
|
|
38516
38820
|
)
|
|
@@ -39315,6 +39619,50 @@ function replacementParts(template, match, wildcards = false) {
|
|
|
39315
39619
|
}
|
|
39316
39620
|
return parts;
|
|
39317
39621
|
}
|
|
39622
|
+
|
|
39623
|
+
// docx/find-stories.ts
|
|
39624
|
+
var HEADER_FOOTER_ORDER = [
|
|
39625
|
+
["header", "even"],
|
|
39626
|
+
["header", "default"],
|
|
39627
|
+
["footer", "even"],
|
|
39628
|
+
["footer", "default"],
|
|
39629
|
+
["header", "first"],
|
|
39630
|
+
["footer", "first"]
|
|
39631
|
+
];
|
|
39632
|
+
function findStories(model) {
|
|
39633
|
+
const stories = [{ kind: "main" }];
|
|
39634
|
+
const seen = /* @__PURE__ */ new Set();
|
|
39635
|
+
for (const [kind, slot] of HEADER_FOOTER_ORDER) {
|
|
39636
|
+
(model.sections ?? []).forEach((section, sectionIndex) => {
|
|
39637
|
+
const content = section[kind === "header" ? "headers" : "footers"]?.[slot];
|
|
39638
|
+
if (!content || seen.has(content) || content.partName && seen.has(content.partName)) return;
|
|
39639
|
+
seen.add(content);
|
|
39640
|
+
if (content.partName) seen.add(content.partName);
|
|
39641
|
+
stories.push({ kind, slot, sectionIndex, blocks: content.blocks });
|
|
39642
|
+
});
|
|
39643
|
+
}
|
|
39644
|
+
for (const note of model.footnotes ?? [])
|
|
39645
|
+
stories.push({ kind: "footnote", id: note.id, blocks: note.blocks });
|
|
39646
|
+
for (const note of model.endnotes ?? [])
|
|
39647
|
+
stories.push({ kind: "endnote", id: note.id, blocks: note.blocks });
|
|
39648
|
+
stories.push({ kind: "textBoxes" });
|
|
39649
|
+
return stories;
|
|
39650
|
+
}
|
|
39651
|
+
function findStoryKey(story) {
|
|
39652
|
+
switch (story.kind) {
|
|
39653
|
+
case "main":
|
|
39654
|
+
case "textBoxes":
|
|
39655
|
+
return story.kind;
|
|
39656
|
+
case "footnote":
|
|
39657
|
+
case "endnote":
|
|
39658
|
+
return `${story.kind}:${story.id}`;
|
|
39659
|
+
default:
|
|
39660
|
+
return `${story.kind}:${story.sectionIndex}:${story.slot}`;
|
|
39661
|
+
}
|
|
39662
|
+
}
|
|
39663
|
+
function findStoryGroup(story) {
|
|
39664
|
+
return story.kind === "footnote" || story.kind === "endnote" ? story.kind : findStoryKey(story);
|
|
39665
|
+
}
|
|
39318
39666
|
function editRestrictionOf(protection) {
|
|
39319
39667
|
if (!protection?.enforced) return void 0;
|
|
39320
39668
|
const { edit } = protection;
|
|
@@ -39494,4 +39842,4 @@ function nextEditableRegion(state, user) {
|
|
|
39494
39842
|
return next ? TextSelection.create(state.doc, next.from, next.to) : null;
|
|
39495
39843
|
}
|
|
39496
39844
|
|
|
39497
|
-
export { CONTROL_EDIT_META, CollaborationAuthority, CollaborationClient, DirtyState, EDITOR_THEME_MODES, FIELD_RESULT_REPAIR_META, FIND_LINE_BREAK, FIND_OBJECT, FIND_PAGE_BREAK, FIND_PARAGRAPH_MARK, FORM_FIELD_EDIT_META, FindPatternError, HEADER_FOOTER_INPUT, NotePartsStep, PAGE_GAP, PARAGRAPH_KEEP_KEYS, REMOTE_TRANSACTION_META, RESTRUCTURE_TABLE_META, RIBBON_ACTION_IDS, RIBBON_ACTION_LABELS, SectionPartsStep, THEME_KEYS, WORD_CAPABILITY_ACTIONS, WORD_CAPABILITY_BACKSTAGE_PAGES, WORD_CAPABILITY_FILE_COMMANDS, WORD_CAPABILITY_IDS, WORD_CAPABILITY_MENU_ITEMS, WORD_CAPABILITY_SHORTCUTS, WordYjsCollaboration, WordYjsComments, WordYjsMedia, acceptAllChanges, acceptChangeAtCursor, acceptRevisionRange, addComment, appendInlineNode, applyMarkFormatting, applyRunFormattingPatch, applyThemeColors, applyWordLink, approximateDiagramDrawing, authorColor, backstageFocus, chartNodeSpec, chooseDate, chooseListItem, clearDirectRunFormatting, closeRect, collectRevisionRanges, commentAnchors, commentHistoryAttributes, commentIdsAtSelection, commentIdsFromMarks, commentIdsFromNode, commentThreadsFromDoc, compileFindPattern, contentControlPlugin, continuationsOf, controlAt, controlAtSelection, controlFromData, controlFromValue, controlOfMark, controlSpans, countWords, createCollaborationIdGenerator, createToggleFormat, cssBorderSide, darkTheme, deleteAroundMarkers, deleteColumns, deleteComment, deleteFieldSelection, deleteRow, deleteToPlaceholder, dispatchIsolatedCommand, documentWordCount, editRestrictionKey, editRestrictionOf, editRestrictionPlugin, editableRanges, emptySimpleFieldResult, escapeFindChar, everyControlSpan, exceedsFormTextLength, expectDefined, explicitOffFields, extraRunFields, extraRunProperties, fieldGuardPlugin, fieldMarkerNodeSpec, fieldResultRanges, fieldsBalanced, findCodeSource, findMatches, fitZoomPercent, forcesTrackChanges, formFieldBeside, formFieldGuardPlugin, formFieldLocked, formFieldNodeDisplay, formFieldOfNode, formTextResults, formattingRevision, freezeBatch, goToComment, goToNextChange, goToPreviousChange, hardBreakNodeSpec, hasAnyChange, hasChangeAtCursor, hasContent2 as hasContent, hasNoteRevisions, imageNodeSpec, inlineNodeRun, insertChartImage, insertColumn, insertContentControl, insertRow, insertWordHardBreak, insertedTextMarks, isFormsProtected, isNavigableHref, isRibbonActionId, isWordYjsRemoteTransaction, ligatureCss, ligatureStyle, lightTheme, linkFromMarks, linkMarkSpec, locksStories, markSpecs, marksForRun, mergeCells, mergeOrigin, moveName, newControlId, nextEditableRegion, nodeChart, nodeNumbering, normalizeMerges, normalizeRibbonActions, normalizeThemeMode, notePartsJson, noteReferenceNodeSpec, operatesFormField, pageBreakNodeSpec, paragraphAttrs, paragraphBoxCss, paragraphFormattingRevision, paragraphFromAttrs, parseBatch, parseBordersJson, pasteInCell, permissionRanges, placementClass, positionalTabInputPlugin, previewDocxDiagram, rangeAllows, refreshWordYjsPresence, rejectAllChanges, rejectChangeAtCursor, rejectRevisionRange, removeCommentAnchor, removeCommentThread, removeWordLink, repairCollaborativeDocumentIds, repairCollaborativeParagraphIds, replaceAroundMarkers, replaceControlContent, replaceSelectedChart, replacementParts, replyToComment, resolveCellVisuals, resolveComment, resolveNoteRevisions, restoreNoteParts, restoreSectionParts, reviewMarks, ribbonActionIdForLabel, rowSpanOf, runPropertiesMark, runToInlineNodes, sameJson2 as sameJson, sameRuns, sectionPartsJson, selectFormDropDownAt, selectedChart, setCommentThreads, setEditableRegion, setReviewRecordingPreferences, spanOf, splitCell, staysInFormFields, svgMarkupSpec, swatchColor, symbolFontPlugin, tableCellStyle, tableControlSpans, tableGrid, tableStructureGuardPlugin, tableStyle, themeDrawing, themeToCssVars, toggleCheckboxControl, toggleFormCheckboxAt, toggleTrackChanges, toggleTrackFormatting, toggleTrackMoves, trackChangesPlugin, trackChangesPluginKey, transactionAllowed, typeOverPlaceholder, updateCommentThreads, updateControlProperties, violatesControlLock, wordHighlightColors, wordLinkRangeAt, wordYjsPluginKey, wordYjsPresencePlugin, wordYjsRedo, wordYjsUndo };
|
|
39845
|
+
export { CONTROL_EDIT_META, CollaborationAuthority, CollaborationClient, DirtyState, EDITOR_THEME_MODES, FIELD_RESULT_REPAIR_META, FIND_LINE_BREAK, FIND_OBJECT, FIND_PAGE_BREAK, FIND_PARAGRAPH_MARK, FORM_FIELD_EDIT_META, FindPatternError, HEADER_FOOTER_INPUT, NotePartsStep, PAGE_GAP, PARAGRAPH_EAST_ASIAN_KEYS, PARAGRAPH_KEEP_KEYS, REMOTE_TRANSACTION_META, RESTRUCTURE_TABLE_META, RIBBON_ACTION_IDS, RIBBON_ACTION_LABELS, SectionPartsStep, THEME_KEYS, WORD_CAPABILITY_ACTIONS, WORD_CAPABILITY_BACKSTAGE_PAGES, WORD_CAPABILITY_FILE_COMMANDS, WORD_CAPABILITY_IDS, WORD_CAPABILITY_MENU_ITEMS, WORD_CAPABILITY_SHORTCUTS, WordYjsCollaboration, WordYjsComments, WordYjsMedia, acceptAllChanges, acceptChangeAtCursor, acceptRevisionRange, addComment, appendInlineNode, applyMarkFormatting, applyRunFormattingPatch, applyThemeColors, applyWordLink, approximateDiagramDrawing, authorColor, backstageFocus, chartNodeSpec, chooseDate, chooseListItem, clearDirectRunFormatting, closeRect, collectRevisionRanges, commentAnchors, commentHistoryAttributes, commentIdsAtSelection, commentIdsFromMarks, commentIdsFromNode, commentThreadsFromDoc, compileFindPattern, contentControlPlugin, continuationsOf, controlAt, controlAtSelection, controlFromData, controlFromValue, controlOfMark, controlSpans, countWords, createCollaborationIdGenerator, createToggleFormat, cssBorderSide, darkTheme, deleteAroundMarkers, deleteColumns, deleteComment, deleteFieldSelection, deleteRow, deleteToPlaceholder, dispatchIsolatedCommand, documentWordCount, editRestrictionKey, editRestrictionOf, editRestrictionPlugin, editableRanges, emptySimpleFieldResult, escapeFindChar, everyControlSpan, exceedsFormTextLength, expectDefined, explicitOffFields, extraRunFields, extraRunProperties, fieldGuardPlugin, fieldMarkerNodeSpec, fieldResultRanges, fieldsBalanced, findCodeSource, findMatches, findStories, findStoryGroup, findStoryKey, fitZoomPercent, forcesTrackChanges, formFieldBeside, formFieldGuardPlugin, formFieldLocked, formFieldNodeDisplay, formFieldOfNode, formTextResults, formattingRevision, freezeBatch, goToComment, goToNextChange, goToPreviousChange, hardBreakNodeSpec, hasAnyChange, hasChangeAtCursor, hasContent2 as hasContent, hasNoteRevisions, imageNodeSpec, inlineNodeRun, insertChartImage, insertColumn, insertContentControl, insertRow, insertWordHardBreak, insertedTextMarks, isFormsProtected, isNavigableHref, isRibbonActionId, isWordYjsRemoteTransaction, ligatureCss, ligatureStyle, lightTheme, linkFromMarks, linkMarkSpec, locksStories, markSpecs, marksForRun, mergeCells, mergeOrigin, moveName, newControlId, nextEditableRegion, nodeChart, nodeNumbering, normalizeMerges, normalizeRibbonActions, normalizeThemeMode, notePartsJson, noteReferenceNodeSpec, operatesFormField, pageBreakNodeSpec, paragraphAttrs, paragraphBoxCss, paragraphFormattingRevision, paragraphFromAttrs, parseBatch, parseBordersJson, pasteInCell, permissionRanges, placementClass, positionalTabInputPlugin, previewDocxDiagram, rangeAllows, refreshWordYjsPresence, rejectAllChanges, rejectChangeAtCursor, rejectRevisionRange, removeCommentAnchor, removeCommentThread, removeWordLink, repairCollaborativeDocumentIds, repairCollaborativeParagraphIds, replaceAroundMarkers, replaceControlContent, replaceSelectedChart, replacementParts, replyToComment, resolveCellVisuals, resolveComment, resolveNoteRevisions, restoreNoteParts, restoreSectionParts, reviewMarks, ribbonActionIdForLabel, rowSpanOf, runPropertiesMark, runToInlineNodes, sameJson2 as sameJson, sameRuns, sectionPartsJson, selectFormDropDownAt, selectedChart, setCommentThreads, setEditableRegion, setReviewRecordingPreferences, spanOf, splitCell, staysInFormFields, svgMarkupSpec, swatchColor, symbolFontPlugin, tableCellStyle, tableControlSpans, tableGrid, tableStructureGuardPlugin, tableStyle, themeDrawing, themeToCssVars, toggleCheckboxControl, toggleFormCheckboxAt, toggleTrackChanges, toggleTrackFormatting, toggleTrackMoves, trackChangesPlugin, trackChangesPluginKey, transactionAllowed, typeOverPlaceholder, updateCommentThreads, updateControlProperties, violatesControlLock, wordHighlightColors, wordLinkRangeAt, wordYjsPluginKey, wordYjsPresencePlugin, wordYjsRedo, wordYjsUndo };
|