@cj-tech-master/excelts 9.5.4 → 9.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/modules/archive/compression/streaming-compress.browser.js +29 -0
- package/dist/browser/modules/archive/compression/streaming-compress.js +9 -0
- package/dist/browser/modules/archive/compression/worker-pool/pool.browser.js +26 -1
- package/dist/browser/modules/archive/fs/archive-file.d.ts +8 -5
- package/dist/browser/modules/archive/fs/archive-file.js +78 -16
- package/dist/browser/modules/archive/unzip/stream.browser.js +43 -2
- package/dist/browser/modules/excel/chart/chart-ex-builder.js +7 -2
- package/dist/browser/modules/excel/chart/chart-ex-renderer.js +4 -9
- package/dist/browser/modules/excel/chart/chart-ex-types.d.ts +0 -12
- package/dist/browser/modules/excel/chart/chart.d.ts +1 -5
- package/dist/browser/modules/excel/chart/chart.js +1 -7
- package/dist/browser/modules/excel/chart/types.d.ts +0 -6
- package/dist/browser/modules/excel/stream/workbook-reader.browser.js +25 -1
- package/dist/browser/modules/excel/stream/workbook-reader.js +9 -0
- package/dist/browser/modules/excel/stream/workbook-writer.browser.d.ts +40 -0
- package/dist/browser/modules/excel/stream/workbook-writer.browser.js +228 -13
- package/dist/browser/modules/excel/utils/string-buf.d.ts +5 -26
- package/dist/browser/modules/excel/utils/string-buf.js +4 -81
- package/dist/browser/modules/excel/workbook.browser.js +135 -25
- package/dist/browser/modules/excel/xlsx/xform/chart/chart-space-xform.js +6 -20
- package/dist/browser/modules/excel/xlsx/xlsx.browser.d.ts +19 -9
- package/dist/browser/modules/excel/xlsx/xlsx.browser.js +32 -8
- package/dist/browser/modules/excel/xlsx/xlsx.d.ts +10 -2
- package/dist/browser/modules/excel/xlsx/xlsx.js +9 -1
- package/dist/browser/modules/pdf/excel-bridge.d.ts +30 -1
- package/dist/browser/modules/pdf/excel-bridge.js +32 -0
- package/dist/browser/modules/pdf/font/metrics.d.ts +3 -52
- package/dist/browser/modules/pdf/font/metrics.js +3 -237
- package/dist/browser/modules/pdf/index.d.ts +1 -1
- package/dist/browser/modules/pdf/index.js +1 -1
- package/dist/browser/modules/pdf/render-layout-to-pdf.d.ts +66 -0
- package/dist/browser/modules/pdf/render-layout-to-pdf.js +647 -0
- package/dist/browser/modules/pdf/word-bridge.d.ts +80 -12
- package/dist/browser/modules/pdf/word-bridge.js +122 -274
- package/dist/browser/modules/stream/index.base.d.ts +2 -0
- package/dist/browser/modules/stream/index.base.js +2 -1
- package/dist/browser/modules/stream/internal/sink-adapter.d.ts +65 -0
- package/dist/browser/modules/stream/internal/sink-adapter.js +198 -0
- package/dist/browser/modules/stream/pull-stream.d.ts +19 -2
- package/dist/browser/modules/stream/pull-stream.js +51 -5
- package/dist/browser/modules/stream/types.d.ts +13 -1
- package/dist/browser/modules/word/advanced/diff.d.ts +61 -0
- package/dist/browser/modules/word/advanced/diff.js +167 -0
- package/dist/browser/modules/word/advanced/drawing-shapes.d.ts +269 -0
- package/dist/browser/modules/word/advanced/drawing-shapes.js +268 -0
- package/dist/browser/modules/word/advanced/field-engine.d.ts +43 -0
- package/dist/browser/modules/word/advanced/field-engine.js +1225 -0
- package/dist/browser/modules/word/advanced/glossary.d.ts +86 -0
- package/dist/browser/modules/word/advanced/glossary.js +79 -0
- package/dist/browser/modules/word/advanced/math-convert.d.ts +30 -0
- package/dist/browser/modules/word/advanced/math-convert.js +595 -0
- package/dist/browser/modules/word/advanced/ole-objects.d.ts +115 -0
- package/dist/browser/modules/word/advanced/ole-objects.js +271 -0
- package/dist/browser/modules/word/advanced/style-map.d.ts +105 -0
- package/dist/browser/modules/word/advanced/style-map.js +322 -0
- package/dist/browser/modules/word/advanced/validation.d.ts +56 -0
- package/dist/browser/modules/word/advanced/validation.js +1065 -0
- package/dist/browser/modules/word/advanced/vba-project.d.ts +91 -0
- package/dist/browser/modules/word/advanced/vba-project.js +265 -0
- package/dist/browser/modules/word/bridge/excel-bridge.d.ts +127 -0
- package/dist/browser/modules/word/bridge/excel-bridge.js +980 -0
- package/dist/browser/modules/word/builder/document-handle.d.ts +151 -0
- package/dist/browser/modules/word/builder/document-handle.js +664 -0
- package/dist/browser/modules/word/builder/paragraph-builders.d.ts +61 -0
- package/dist/browser/modules/word/builder/paragraph-builders.js +90 -0
- package/dist/browser/modules/word/builder/run-builders.d.ts +374 -0
- package/dist/browser/modules/word/builder/run-builders.js +600 -0
- package/dist/browser/modules/word/builder/table-builders.d.ts +23 -0
- package/dist/browser/modules/word/builder/table-builders.js +45 -0
- package/dist/browser/modules/word/constants.d.ts +39 -1
- package/dist/browser/modules/word/constants.js +109 -1
- package/dist/browser/modules/word/convert/conversion-ir.d.ts +210 -0
- package/dist/browser/modules/word/convert/conversion-ir.js +31 -0
- package/dist/browser/modules/word/convert/docx-to-semantic.d.ts +39 -0
- package/dist/browser/modules/word/convert/docx-to-semantic.js +499 -0
- package/dist/browser/modules/word/convert/flat-opc.d.ts +44 -0
- package/dist/browser/modules/word/convert/flat-opc.js +385 -0
- package/dist/browser/modules/word/convert/html/html-import.d.ts +50 -0
- package/dist/browser/modules/word/convert/html/html-import.js +1907 -0
- package/dist/{types/modules/word → browser/modules/word/convert/html}/html-renderer.d.ts +14 -1
- package/dist/{esm/modules/word → browser/modules/word/convert/html}/html-renderer.js +420 -69
- package/dist/browser/modules/word/convert/html/html.d.ts +15 -0
- package/dist/browser/modules/word/convert/html/html.js +15 -0
- package/dist/browser/modules/word/convert/markdown/markdown-import.d.ts +68 -0
- package/dist/browser/modules/word/convert/markdown/markdown-import.js +1325 -0
- package/dist/browser/modules/word/convert/markdown/markdown-renderer.d.ts +25 -0
- package/dist/browser/modules/word/convert/markdown/markdown-renderer.js +634 -0
- package/dist/browser/modules/word/convert/markdown/markdown.d.ts +15 -0
- package/dist/browser/modules/word/convert/markdown/markdown.js +15 -0
- package/dist/browser/modules/word/convert/odt/odt.d.ts +41 -0
- package/dist/browser/modules/word/convert/odt/odt.js +1932 -0
- package/dist/browser/modules/word/{color-utils.d.ts → core/color-utils.d.ts} +8 -1
- package/dist/browser/modules/word/core/color-utils.js +43 -0
- package/dist/browser/modules/word/core/internal-utils.d.ts +90 -0
- package/dist/browser/modules/word/core/internal-utils.js +209 -0
- package/dist/browser/modules/word/core/mapper.d.ts +44 -0
- package/dist/browser/modules/word/core/mapper.js +427 -0
- package/dist/browser/modules/word/core/opc-paths.d.ts +33 -0
- package/dist/browser/modules/word/core/opc-paths.js +48 -0
- package/dist/browser/modules/word/core/text-utils.d.ts +38 -0
- package/dist/browser/modules/word/core/text-utils.js +202 -0
- package/dist/browser/modules/word/core/walker.d.ts +119 -0
- package/dist/browser/modules/word/core/walker.js +570 -0
- package/dist/browser/modules/word/crypto.d.ts +14 -9
- package/dist/browser/modules/word/crypto.js +13 -7
- package/dist/browser/modules/word/document-io.d.ts +59 -27
- package/dist/browser/modules/word/document-io.js +80 -197
- package/dist/browser/modules/word/errors.d.ts +44 -1
- package/dist/browser/modules/word/errors.js +54 -2
- package/dist/browser/modules/word/excel.d.ts +14 -0
- package/dist/browser/modules/word/excel.js +13 -0
- package/dist/browser/modules/word/font/font-embed.d.ts +112 -0
- package/dist/browser/modules/word/font/font-embed.js +646 -0
- package/dist/{esm/modules/word → browser/modules/word/font}/font-obfuscation.js +4 -9
- package/dist/browser/modules/word/font/hyphenation.d.ts +65 -0
- package/dist/browser/modules/word/font/hyphenation.js +4210 -0
- package/dist/browser/modules/word/font/text-shaping.d.ts +58 -0
- package/dist/browser/modules/word/font/text-shaping.js +635 -0
- package/dist/browser/modules/word/html.d.ts +7 -6
- package/dist/browser/modules/word/html.js +6 -5
- package/dist/browser/modules/word/incremental-edit.d.ts +123 -0
- package/dist/browser/modules/word/incremental-edit.js +361 -0
- package/dist/browser/modules/word/index.base.d.ts +194 -10
- package/dist/browser/modules/word/index.base.js +138 -29
- package/dist/browser/modules/word/layout/layout-constants.d.ts +17 -0
- package/dist/browser/modules/word/layout/layout-constants.js +17 -0
- package/dist/browser/modules/word/layout/layout-full.d.ts +53 -0
- package/dist/browser/modules/word/layout/layout-full.js +1696 -0
- package/dist/browser/modules/word/layout/layout-model.d.ts +344 -0
- package/dist/browser/modules/word/layout/layout-model.js +16 -0
- package/dist/browser/modules/word/layout/layout.d.ts +63 -0
- package/dist/browser/modules/word/layout/layout.js +1167 -0
- package/dist/browser/modules/word/layout/render-page.d.ts +57 -0
- package/dist/browser/modules/word/layout/render-page.js +1238 -0
- package/dist/browser/modules/word/markdown.d.ts +14 -0
- package/dist/browser/modules/word/markdown.js +13 -0
- package/dist/browser/modules/word/patcher.d.ts +62 -0
- package/dist/browser/modules/word/patcher.js +537 -0
- package/dist/browser/modules/word/query/compat.d.ts +25 -0
- package/dist/browser/modules/word/query/compat.js +58 -0
- package/dist/browser/modules/word/query/data-binding.d.ts +22 -0
- package/dist/browser/modules/word/query/data-binding.js +392 -0
- package/dist/browser/modules/word/query/form-fields.d.ts +41 -0
- package/dist/browser/modules/word/query/form-fields.js +268 -0
- package/dist/browser/modules/word/query/format-search.d.ts +99 -0
- package/dist/browser/modules/word/query/format-search.js +329 -0
- package/dist/browser/modules/word/query/mail-merge.d.ts +25 -0
- package/dist/browser/modules/word/query/mail-merge.js +111 -0
- package/dist/browser/modules/word/query/merge.d.ts +50 -0
- package/dist/browser/modules/word/query/merge.js +617 -0
- package/dist/browser/modules/word/query/replace.d.ts +47 -0
- package/dist/browser/modules/word/query/replace.js +301 -0
- package/dist/browser/modules/word/query/revisions.d.ts +67 -0
- package/dist/browser/modules/word/query/revisions.js +879 -0
- package/dist/browser/modules/word/query/search.d.ts +129 -0
- package/dist/browser/modules/word/query/search.js +346 -0
- package/dist/browser/modules/word/query/split.d.ts +44 -0
- package/dist/browser/modules/word/query/split.js +135 -0
- package/dist/browser/modules/word/query/style-resolve.d.ts +104 -0
- package/dist/browser/modules/word/query/style-resolve.js +368 -0
- package/dist/browser/modules/word/reader/chart-parser.d.ts +20 -0
- package/dist/browser/modules/word/reader/chart-parser.js +810 -0
- package/dist/browser/modules/word/reader/comments-parser.d.ts +26 -0
- package/dist/browser/modules/word/reader/comments-parser.js +92 -0
- package/dist/browser/modules/word/reader/doc-props-parsers.d.ts +15 -0
- package/dist/browser/modules/word/reader/doc-props-parsers.js +190 -0
- package/dist/browser/modules/word/reader/docx-reader.d.ts +27 -0
- package/dist/browser/modules/word/reader/docx-reader.js +2557 -0
- package/dist/browser/modules/word/reader/drawing-helpers.d.ts +27 -0
- package/dist/browser/modules/word/reader/drawing-helpers.js +84 -0
- package/dist/browser/modules/word/reader/form-field-parser.d.ts +21 -0
- package/dist/browser/modules/word/reader/form-field-parser.js +82 -0
- package/dist/browser/modules/word/reader/image-parsers.d.ts +11 -0
- package/dist/browser/modules/word/reader/image-parsers.js +291 -0
- package/dist/browser/modules/word/reader/math-parser.d.ts +12 -0
- package/dist/browser/modules/word/reader/math-parser.js +422 -0
- package/dist/browser/modules/word/reader/metadata-parsers.d.ts +17 -0
- package/dist/browser/modules/word/reader/metadata-parsers.js +87 -0
- package/dist/browser/modules/word/reader/numbering-parser.d.ts +13 -0
- package/dist/browser/modules/word/reader/numbering-parser.js +166 -0
- package/dist/browser/modules/word/reader/paragraph-section-parsers.d.ts +12 -0
- package/dist/browser/modules/word/reader/paragraph-section-parsers.js +503 -0
- package/dist/browser/modules/word/reader/parse-utils.d.ts +91 -0
- package/dist/browser/modules/word/reader/parse-utils.js +249 -0
- package/dist/browser/modules/word/reader/properties-parsers.d.ts +21 -0
- package/dist/browser/modules/word/reader/properties-parsers.js +332 -0
- package/dist/browser/modules/word/reader/reader-context.d.ts +69 -0
- package/dist/browser/modules/word/reader/reader-context.js +61 -0
- package/dist/browser/modules/word/reader/sdt-helpers.d.ts +29 -0
- package/dist/browser/modules/word/reader/sdt-helpers.js +111 -0
- package/dist/browser/modules/word/reader/settings-parser.d.ts +8 -0
- package/dist/browser/modules/word/reader/settings-parser.js +263 -0
- package/dist/browser/modules/word/reader/styles-parser.d.ts +12 -0
- package/dist/browser/modules/word/reader/styles-parser.js +147 -0
- package/dist/browser/modules/word/reader/table-properties-parsers.d.ts +12 -0
- package/dist/browser/modules/word/reader/table-properties-parsers.js +234 -0
- package/dist/browser/modules/word/reader/theme-parser.d.ts +8 -0
- package/dist/browser/modules/word/reader/theme-parser.js +167 -0
- package/dist/browser/modules/word/reader/watermark-parser.d.ts +15 -0
- package/dist/browser/modules/word/reader/watermark-parser.js +110 -0
- package/dist/browser/modules/word/security/cfb-reader.d.ts +37 -0
- package/dist/browser/modules/word/security/cfb-reader.js +410 -0
- package/dist/browser/modules/word/{digital-signatures.d.ts → security/digital-signatures.d.ts} +19 -11
- package/dist/browser/modules/word/{digital-signatures.js → security/digital-signatures.js} +34 -34
- package/dist/browser/modules/word/security/document-protection.d.ts +93 -0
- package/dist/browser/modules/word/security/document-protection.js +201 -0
- package/dist/{types/modules/word → browser/modules/word/security}/encryption.d.ts +51 -4
- package/dist/browser/modules/word/security/encryption.js +602 -0
- package/dist/browser/modules/word/security/policy.d.ts +80 -0
- package/dist/browser/modules/word/security/policy.js +102 -0
- package/dist/browser/modules/word/template/template-chart.d.ts +56 -0
- package/dist/browser/modules/word/template/template-chart.js +167 -0
- package/dist/browser/modules/word/template/template-datasource.d.ts +154 -0
- package/dist/browser/modules/word/template/template-datasource.js +541 -0
- package/dist/browser/modules/word/template/template-engine.d.ts +121 -0
- package/dist/browser/modules/word/template/template-engine.js +1435 -0
- package/dist/browser/modules/word/types.d.ts +224 -25
- package/dist/browser/modules/word/units.d.ts +26 -0
- package/dist/browser/modules/word/units.js +43 -14
- package/dist/browser/modules/word/{writers → writer}/chart-writer.js +164 -23
- package/dist/browser/modules/word/writer/checkbox-writer.d.ts +17 -0
- package/dist/browser/modules/word/writer/checkbox-writer.js +79 -0
- package/dist/{types/modules/word/writers → browser/modules/word/writer}/comment-writer.d.ts +2 -1
- package/dist/browser/modules/word/{writers → writer}/comment-writer.js +8 -6
- package/dist/browser/modules/word/writer/common-parts.d.ts +57 -0
- package/dist/browser/modules/word/writer/common-parts.js +101 -0
- package/dist/{types/modules/word → browser/modules/word/writer}/content-types.d.ts +2 -2
- package/dist/{esm/modules/word → browser/modules/word/writer}/content-types.js +14 -6
- package/dist/browser/modules/word/writer/document-writer.d.ts +24 -0
- package/dist/browser/modules/word/writer/document-writer.js +473 -0
- package/dist/browser/modules/word/writer/docx-packager.d.ts +35 -0
- package/dist/browser/modules/word/writer/docx-packager.js +1515 -0
- package/dist/{types/modules/word/writers → browser/modules/word/writer}/footnote-writer.d.ts +3 -2
- package/dist/{esm/modules/word/writers → browser/modules/word/writer}/footnote-writer.js +13 -10
- package/dist/{types/modules/word/writers → browser/modules/word/writer}/header-footer-writer.d.ts +3 -2
- package/dist/{esm/modules/word/writers → browser/modules/word/writer}/header-footer-writer.js +39 -21
- package/dist/{types/modules/word/writers → browser/modules/word/writer}/image-writer.d.ts +1 -1
- package/dist/browser/modules/word/{writers → writer}/image-writer.js +11 -7
- package/dist/browser/modules/word/writer/math-writer.d.ts +20 -0
- package/dist/{esm/modules/word/writers → browser/modules/word/writer}/math-writer.js +21 -1
- package/dist/browser/modules/word/{writers → writer}/numbering-writer.d.ts +1 -1
- package/dist/{esm/modules/word/writers → browser/modules/word/writer}/numbering-writer.js +11 -4
- package/dist/browser/modules/word/{writers → writer}/paragraph-writer.d.ts +2 -1
- package/dist/browser/modules/word/{writers → writer}/paragraph-writer.js +73 -38
- package/dist/browser/modules/word/{writers → writer}/parts-writer.d.ts +3 -3
- package/dist/{esm/modules/word/writers → browser/modules/word/writer}/parts-writer.js +91 -12
- package/dist/browser/modules/word/writer/reference-scanners.d.ts +42 -0
- package/dist/browser/modules/word/writer/reference-scanners.js +111 -0
- package/dist/browser/modules/word/writer/relationships.d.ts +52 -0
- package/dist/browser/modules/word/writer/relationships.js +117 -0
- package/dist/browser/modules/word/writer/render-context.d.ts +124 -0
- package/dist/browser/modules/word/writer/render-context.js +46 -0
- package/dist/browser/modules/word/{writers → writer}/run-writer.d.ts +10 -1
- package/dist/{esm/modules/word/writers → browser/modules/word/writer}/run-writer.js +126 -24
- package/dist/browser/modules/word/writer/sdt-writer.d.ts +25 -0
- package/dist/browser/modules/word/writer/sdt-writer.js +189 -0
- package/dist/browser/modules/word/writer/stream-buf.d.ts +37 -0
- package/dist/browser/modules/word/writer/stream-buf.js +73 -0
- package/dist/browser/modules/word/writer/streaming-writer.d.ts +344 -0
- package/dist/browser/modules/word/writer/streaming-writer.js +1382 -0
- package/dist/browser/modules/word/writer/string-buf.d.ts +8 -0
- package/dist/browser/modules/word/writer/string-buf.js +7 -0
- package/dist/browser/modules/word/{writers → writer}/styles-writer.js +32 -1
- package/dist/browser/modules/word/{writers → writer}/table-writer.d.ts +2 -1
- package/dist/browser/modules/word/{writers → writer}/table-writer.js +94 -11
- package/dist/browser/modules/xml/types.d.ts +22 -0
- package/dist/browser/utils/crypto.browser.d.ts +3 -1
- package/dist/browser/utils/crypto.browser.js +3 -1
- package/dist/browser/utils/crypto.d.ts +4 -1
- package/dist/browser/utils/crypto.js +4 -1
- package/dist/browser/utils/font-metrics.d.ts +63 -0
- package/dist/browser/utils/font-metrics.js +293 -0
- package/dist/browser/utils/string-buf.d.ts +42 -0
- package/dist/browser/utils/string-buf.js +89 -0
- package/dist/browser/utils/theme-colors.d.ts +55 -0
- package/dist/browser/utils/theme-colors.js +120 -0
- package/dist/cjs/modules/archive/compression/streaming-compress.browser.js +29 -0
- package/dist/cjs/modules/archive/compression/streaming-compress.js +9 -0
- package/dist/cjs/modules/archive/compression/worker-pool/pool.browser.js +26 -1
- package/dist/cjs/modules/archive/fs/archive-file.js +78 -16
- package/dist/cjs/modules/archive/unzip/stream.browser.js +43 -2
- package/dist/cjs/modules/excel/chart/chart-ex-builder.js +7 -2
- package/dist/cjs/modules/excel/chart/chart-ex-renderer.js +4 -9
- package/dist/cjs/modules/excel/chart/chart.js +1 -7
- package/dist/cjs/modules/excel/stream/workbook-reader.browser.js +25 -1
- package/dist/cjs/modules/excel/stream/workbook-reader.js +9 -0
- package/dist/cjs/modules/excel/stream/workbook-writer.browser.js +228 -13
- package/dist/cjs/modules/excel/utils/string-buf.js +5 -81
- package/dist/cjs/modules/excel/workbook.browser.js +135 -25
- package/dist/cjs/modules/excel/xlsx/xform/chart/chart-space-xform.js +6 -20
- package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +32 -8
- package/dist/cjs/modules/excel/xlsx/xlsx.js +9 -1
- package/dist/cjs/modules/pdf/excel-bridge.js +33 -0
- package/dist/cjs/modules/pdf/font/metrics.js +11 -244
- package/dist/cjs/modules/pdf/index.js +2 -1
- package/dist/cjs/modules/pdf/render-layout-to-pdf.js +651 -0
- package/dist/cjs/modules/pdf/word-bridge.js +155 -274
- package/dist/cjs/modules/stream/index.base.js +4 -2
- package/dist/cjs/modules/stream/internal/sink-adapter.js +202 -0
- package/dist/cjs/modules/stream/pull-stream.js +51 -5
- package/dist/cjs/modules/word/advanced/diff.js +170 -0
- package/dist/cjs/modules/word/advanced/drawing-shapes.js +279 -0
- package/dist/cjs/modules/word/advanced/field-engine.js +1229 -0
- package/dist/cjs/modules/word/advanced/glossary.js +87 -0
- package/dist/cjs/modules/word/advanced/math-convert.js +599 -0
- package/dist/cjs/modules/word/advanced/ole-objects.js +277 -0
- package/dist/cjs/modules/word/advanced/style-map.js +329 -0
- package/dist/cjs/modules/word/advanced/validation.js +1068 -0
- package/dist/cjs/modules/word/advanced/vba-project.js +274 -0
- package/dist/cjs/modules/word/bridge/excel-bridge.js +1020 -0
- package/dist/cjs/modules/word/builder/document-handle.js +667 -0
- package/dist/cjs/modules/word/builder/paragraph-builders.js +109 -0
- package/dist/cjs/modules/word/builder/run-builders.js +676 -0
- package/dist/cjs/modules/word/builder/table-builders.js +53 -0
- package/dist/cjs/modules/word/constants.js +111 -2
- package/dist/cjs/modules/word/convert/conversion-ir.js +34 -0
- package/dist/cjs/modules/word/convert/docx-to-semantic.js +502 -0
- package/dist/cjs/modules/word/convert/flat-opc.js +390 -0
- package/dist/cjs/modules/word/convert/html/html-import.js +1910 -0
- package/dist/cjs/modules/word/{html-renderer.js → convert/html/html-renderer.js} +420 -69
- package/dist/cjs/modules/word/convert/html/html.js +20 -0
- package/dist/cjs/modules/word/convert/markdown/markdown-import.js +1329 -0
- package/dist/cjs/modules/word/convert/markdown/markdown-renderer.js +637 -0
- package/dist/cjs/modules/word/convert/markdown/markdown.js +21 -0
- package/dist/cjs/modules/word/convert/odt/odt.js +1936 -0
- package/dist/cjs/modules/word/core/color-utils.js +47 -0
- package/dist/cjs/modules/word/core/internal-utils.js +219 -0
- package/dist/cjs/modules/word/core/mapper.js +430 -0
- package/dist/cjs/modules/word/core/opc-paths.js +53 -0
- package/dist/cjs/modules/word/core/text-utils.js +210 -0
- package/dist/cjs/modules/word/core/walker.js +577 -0
- package/dist/cjs/modules/word/crypto.js +19 -8
- package/dist/cjs/modules/word/document-io.js +117 -197
- package/dist/cjs/modules/word/errors.js +59 -13
- package/dist/cjs/modules/word/excel.js +22 -0
- package/dist/cjs/modules/word/font/font-embed.js +652 -0
- package/dist/cjs/modules/word/{font-obfuscation.js → font/font-obfuscation.js} +4 -9
- package/dist/cjs/modules/word/font/hyphenation.js +4216 -0
- package/dist/cjs/modules/word/font/text-shaping.js +640 -0
- package/dist/cjs/modules/word/html.js +9 -7
- package/dist/cjs/modules/word/incremental-edit.js +366 -0
- package/dist/cjs/modules/word/index.base.js +370 -137
- package/dist/cjs/modules/word/layout/layout-constants.js +20 -0
- package/dist/cjs/modules/word/layout/layout-full.js +1699 -0
- package/dist/cjs/modules/word/layout/layout-model.js +17 -0
- package/dist/cjs/modules/word/layout/layout.js +1170 -0
- package/dist/cjs/modules/word/layout/render-page.js +1243 -0
- package/dist/cjs/modules/word/markdown.js +19 -0
- package/dist/cjs/modules/word/patcher.js +539 -0
- package/dist/cjs/modules/word/query/compat.js +61 -0
- package/dist/cjs/modules/word/query/data-binding.js +395 -0
- package/dist/cjs/modules/word/query/form-fields.js +272 -0
- package/dist/cjs/modules/word/query/format-search.js +334 -0
- package/dist/cjs/modules/word/query/mail-merge.js +114 -0
- package/dist/cjs/modules/word/query/merge.js +620 -0
- package/dist/cjs/modules/word/query/replace.js +304 -0
- package/dist/cjs/modules/word/query/revisions.js +885 -0
- package/dist/cjs/modules/word/query/search.js +361 -0
- package/dist/cjs/modules/word/query/split.js +138 -0
- package/dist/cjs/modules/word/query/style-resolve.js +374 -0
- package/dist/cjs/modules/word/reader/chart-parser.js +814 -0
- package/dist/cjs/modules/word/reader/comments-parser.js +96 -0
- package/dist/cjs/modules/word/reader/doc-props-parsers.js +194 -0
- package/dist/cjs/modules/word/reader/docx-reader.js +2560 -0
- package/dist/cjs/modules/word/reader/drawing-helpers.js +90 -0
- package/dist/cjs/modules/word/reader/form-field-parser.js +85 -0
- package/dist/cjs/modules/word/reader/image-parsers.js +293 -0
- package/dist/cjs/modules/word/reader/math-parser.js +424 -0
- package/dist/cjs/modules/word/reader/metadata-parsers.js +93 -0
- package/dist/cjs/modules/word/reader/numbering-parser.js +168 -0
- package/dist/cjs/modules/word/reader/paragraph-section-parsers.js +505 -0
- package/dist/cjs/modules/word/reader/parse-utils.js +271 -0
- package/dist/cjs/modules/word/reader/properties-parsers.js +338 -0
- package/dist/cjs/modules/word/reader/reader-context.js +66 -0
- package/dist/cjs/modules/word/reader/sdt-helpers.js +114 -0
- package/dist/cjs/modules/word/reader/settings-parser.js +265 -0
- package/dist/cjs/modules/word/reader/styles-parser.js +149 -0
- package/dist/cjs/modules/word/reader/table-properties-parsers.js +237 -0
- package/dist/cjs/modules/word/reader/theme-parser.js +169 -0
- package/dist/cjs/modules/word/reader/watermark-parser.js +113 -0
- package/dist/cjs/modules/word/security/cfb-reader.js +414 -0
- package/dist/cjs/modules/word/{digital-signatures.js → security/digital-signatures.js} +34 -34
- package/dist/cjs/modules/word/security/document-protection.js +208 -0
- package/dist/cjs/modules/word/security/encryption.js +612 -0
- package/dist/cjs/modules/word/security/policy.js +106 -0
- package/dist/cjs/modules/word/template/template-chart.js +170 -0
- package/dist/cjs/modules/word/template/template-datasource.js +549 -0
- package/dist/cjs/modules/word/template/template-engine.js +1430 -0
- package/dist/cjs/modules/word/units.js +44 -14
- package/dist/cjs/modules/word/{writers → writer}/chart-writer.js +163 -22
- package/dist/cjs/modules/word/writer/checkbox-writer.js +82 -0
- package/dist/cjs/modules/word/{writers → writer}/comment-writer.js +8 -6
- package/dist/cjs/modules/word/writer/common-parts.js +104 -0
- package/dist/cjs/modules/word/{content-types.js → writer/content-types.js} +14 -6
- package/dist/cjs/modules/word/writer/document-writer.js +478 -0
- package/dist/cjs/modules/word/writer/docx-packager.js +1551 -0
- package/dist/cjs/modules/word/{writers → writer}/footnote-writer.js +13 -10
- package/dist/cjs/modules/word/{writers → writer}/header-footer-writer.js +38 -20
- package/dist/cjs/modules/word/{writers → writer}/image-writer.js +11 -7
- package/dist/cjs/modules/word/{writers → writer}/math-writer.js +21 -1
- package/dist/cjs/modules/word/{writers → writer}/numbering-writer.js +11 -4
- package/dist/cjs/modules/word/{writers → writer}/paragraph-writer.js +72 -37
- package/dist/cjs/modules/word/{writers → writer}/parts-writer.js +91 -12
- package/dist/cjs/modules/word/writer/reference-scanners.js +120 -0
- package/dist/cjs/modules/word/writer/relationships.js +124 -0
- package/dist/cjs/modules/word/writer/render-context.js +51 -0
- package/dist/cjs/modules/word/{writers → writer}/run-writer.js +127 -24
- package/dist/cjs/modules/word/writer/sdt-writer.js +192 -0
- package/dist/cjs/modules/word/writer/stream-buf.js +76 -0
- package/dist/cjs/modules/word/writer/streaming-writer.js +1387 -0
- package/dist/cjs/modules/word/writer/string-buf.js +11 -0
- package/dist/cjs/modules/word/{writers → writer}/styles-writer.js +32 -1
- package/dist/cjs/modules/word/{writers → writer}/table-writer.js +94 -11
- package/dist/cjs/utils/crypto.browser.js +3 -1
- package/dist/cjs/utils/crypto.js +4 -1
- package/dist/cjs/utils/font-metrics.js +303 -0
- package/dist/cjs/utils/string-buf.js +92 -0
- package/dist/cjs/utils/theme-colors.js +126 -0
- package/dist/esm/modules/archive/compression/streaming-compress.browser.js +29 -0
- package/dist/esm/modules/archive/compression/streaming-compress.js +9 -0
- package/dist/esm/modules/archive/compression/worker-pool/pool.browser.js +26 -1
- package/dist/esm/modules/archive/fs/archive-file.js +78 -16
- package/dist/esm/modules/archive/unzip/stream.browser.js +43 -2
- package/dist/esm/modules/excel/chart/chart-ex-builder.js +7 -2
- package/dist/esm/modules/excel/chart/chart-ex-renderer.js +4 -9
- package/dist/esm/modules/excel/chart/chart.js +1 -7
- package/dist/esm/modules/excel/stream/workbook-reader.browser.js +25 -1
- package/dist/esm/modules/excel/stream/workbook-reader.js +9 -0
- package/dist/esm/modules/excel/stream/workbook-writer.browser.js +228 -13
- package/dist/esm/modules/excel/utils/string-buf.js +4 -81
- package/dist/esm/modules/excel/workbook.browser.js +135 -25
- package/dist/esm/modules/excel/xlsx/xform/chart/chart-space-xform.js +6 -20
- package/dist/esm/modules/excel/xlsx/xlsx.browser.js +32 -8
- package/dist/esm/modules/excel/xlsx/xlsx.js +9 -1
- package/dist/esm/modules/pdf/excel-bridge.js +32 -0
- package/dist/esm/modules/pdf/font/metrics.js +3 -237
- package/dist/esm/modules/pdf/index.js +1 -1
- package/dist/esm/modules/pdf/render-layout-to-pdf.js +647 -0
- package/dist/esm/modules/pdf/word-bridge.js +122 -274
- package/dist/esm/modules/stream/index.base.js +2 -1
- package/dist/esm/modules/stream/internal/sink-adapter.js +198 -0
- package/dist/esm/modules/stream/pull-stream.js +51 -5
- package/dist/esm/modules/word/advanced/diff.js +167 -0
- package/dist/esm/modules/word/advanced/drawing-shapes.js +268 -0
- package/dist/esm/modules/word/advanced/field-engine.js +1225 -0
- package/dist/esm/modules/word/advanced/glossary.js +79 -0
- package/dist/esm/modules/word/advanced/math-convert.js +595 -0
- package/dist/esm/modules/word/advanced/ole-objects.js +271 -0
- package/dist/esm/modules/word/advanced/style-map.js +322 -0
- package/dist/esm/modules/word/advanced/validation.js +1065 -0
- package/dist/esm/modules/word/advanced/vba-project.js +265 -0
- package/dist/esm/modules/word/bridge/excel-bridge.js +980 -0
- package/dist/esm/modules/word/builder/document-handle.js +664 -0
- package/dist/esm/modules/word/builder/paragraph-builders.js +90 -0
- package/dist/esm/modules/word/builder/run-builders.js +600 -0
- package/dist/esm/modules/word/builder/table-builders.js +45 -0
- package/dist/esm/modules/word/constants.js +109 -1
- package/dist/esm/modules/word/convert/conversion-ir.js +31 -0
- package/dist/esm/modules/word/convert/docx-to-semantic.js +499 -0
- package/dist/esm/modules/word/convert/flat-opc.js +385 -0
- package/dist/esm/modules/word/convert/html/html-import.js +1907 -0
- package/dist/{browser/modules/word → esm/modules/word/convert/html}/html-renderer.js +420 -69
- package/dist/esm/modules/word/convert/html/html.js +15 -0
- package/dist/esm/modules/word/convert/markdown/markdown-import.js +1325 -0
- package/dist/esm/modules/word/convert/markdown/markdown-renderer.js +634 -0
- package/dist/esm/modules/word/convert/markdown/markdown.js +15 -0
- package/dist/esm/modules/word/convert/odt/odt.js +1932 -0
- package/dist/esm/modules/word/core/color-utils.js +43 -0
- package/dist/esm/modules/word/core/internal-utils.js +209 -0
- package/dist/esm/modules/word/core/mapper.js +427 -0
- package/dist/esm/modules/word/core/opc-paths.js +48 -0
- package/dist/esm/modules/word/core/text-utils.js +202 -0
- package/dist/esm/modules/word/core/walker.js +570 -0
- package/dist/esm/modules/word/crypto.js +13 -7
- package/dist/esm/modules/word/document-io.js +80 -197
- package/dist/esm/modules/word/errors.js +54 -2
- package/dist/esm/modules/word/excel.js +13 -0
- package/dist/esm/modules/word/font/font-embed.js +646 -0
- package/dist/{browser/modules/word → esm/modules/word/font}/font-obfuscation.js +4 -9
- package/dist/esm/modules/word/font/hyphenation.js +4210 -0
- package/dist/esm/modules/word/font/text-shaping.js +635 -0
- package/dist/esm/modules/word/html.js +6 -5
- package/dist/esm/modules/word/incremental-edit.js +361 -0
- package/dist/esm/modules/word/index.base.js +138 -29
- package/dist/esm/modules/word/layout/layout-constants.js +17 -0
- package/dist/esm/modules/word/layout/layout-full.js +1696 -0
- package/dist/esm/modules/word/layout/layout-model.js +16 -0
- package/dist/esm/modules/word/layout/layout.js +1167 -0
- package/dist/esm/modules/word/layout/render-page.js +1238 -0
- package/dist/esm/modules/word/markdown.js +13 -0
- package/dist/esm/modules/word/patcher.js +537 -0
- package/dist/esm/modules/word/query/compat.js +58 -0
- package/dist/esm/modules/word/query/data-binding.js +392 -0
- package/dist/esm/modules/word/query/form-fields.js +268 -0
- package/dist/esm/modules/word/query/format-search.js +329 -0
- package/dist/esm/modules/word/query/mail-merge.js +111 -0
- package/dist/esm/modules/word/query/merge.js +617 -0
- package/dist/esm/modules/word/query/replace.js +301 -0
- package/dist/esm/modules/word/query/revisions.js +879 -0
- package/dist/esm/modules/word/query/search.js +346 -0
- package/dist/esm/modules/word/query/split.js +135 -0
- package/dist/esm/modules/word/query/style-resolve.js +368 -0
- package/dist/esm/modules/word/reader/chart-parser.js +810 -0
- package/dist/esm/modules/word/reader/comments-parser.js +92 -0
- package/dist/esm/modules/word/reader/doc-props-parsers.js +190 -0
- package/dist/esm/modules/word/reader/docx-reader.js +2557 -0
- package/dist/esm/modules/word/reader/drawing-helpers.js +84 -0
- package/dist/esm/modules/word/reader/form-field-parser.js +82 -0
- package/dist/esm/modules/word/reader/image-parsers.js +291 -0
- package/dist/esm/modules/word/reader/math-parser.js +422 -0
- package/dist/esm/modules/word/reader/metadata-parsers.js +87 -0
- package/dist/esm/modules/word/reader/numbering-parser.js +166 -0
- package/dist/esm/modules/word/reader/paragraph-section-parsers.js +503 -0
- package/dist/esm/modules/word/reader/parse-utils.js +249 -0
- package/dist/esm/modules/word/reader/properties-parsers.js +332 -0
- package/dist/esm/modules/word/reader/reader-context.js +61 -0
- package/dist/esm/modules/word/reader/sdt-helpers.js +111 -0
- package/dist/esm/modules/word/reader/settings-parser.js +263 -0
- package/dist/esm/modules/word/reader/styles-parser.js +147 -0
- package/dist/esm/modules/word/reader/table-properties-parsers.js +234 -0
- package/dist/esm/modules/word/reader/theme-parser.js +167 -0
- package/dist/esm/modules/word/reader/watermark-parser.js +110 -0
- package/dist/esm/modules/word/security/cfb-reader.js +410 -0
- package/dist/esm/modules/word/{digital-signatures.js → security/digital-signatures.js} +34 -34
- package/dist/esm/modules/word/security/document-protection.js +201 -0
- package/dist/esm/modules/word/security/encryption.js +602 -0
- package/dist/esm/modules/word/security/policy.js +102 -0
- package/dist/esm/modules/word/template/template-chart.js +167 -0
- package/dist/esm/modules/word/template/template-datasource.js +541 -0
- package/dist/esm/modules/word/template/template-engine.js +1435 -0
- package/dist/esm/modules/word/units.js +43 -14
- package/dist/esm/modules/word/{writers → writer}/chart-writer.js +164 -23
- package/dist/esm/modules/word/writer/checkbox-writer.js +79 -0
- package/dist/esm/modules/word/{writers → writer}/comment-writer.js +8 -6
- package/dist/esm/modules/word/writer/common-parts.js +101 -0
- package/dist/{browser/modules/word → esm/modules/word/writer}/content-types.js +14 -6
- package/dist/esm/modules/word/writer/document-writer.js +473 -0
- package/dist/esm/modules/word/writer/docx-packager.js +1515 -0
- package/dist/{browser/modules/word/writers → esm/modules/word/writer}/footnote-writer.js +13 -10
- package/dist/{browser/modules/word/writers → esm/modules/word/writer}/header-footer-writer.js +39 -21
- package/dist/esm/modules/word/{writers → writer}/image-writer.js +11 -7
- package/dist/{browser/modules/word/writers → esm/modules/word/writer}/math-writer.js +21 -1
- package/dist/{browser/modules/word/writers → esm/modules/word/writer}/numbering-writer.js +11 -4
- package/dist/esm/modules/word/{writers → writer}/paragraph-writer.js +73 -38
- package/dist/{browser/modules/word/writers → esm/modules/word/writer}/parts-writer.js +91 -12
- package/dist/esm/modules/word/writer/reference-scanners.js +111 -0
- package/dist/esm/modules/word/writer/relationships.js +117 -0
- package/dist/esm/modules/word/writer/render-context.js +46 -0
- package/dist/{browser/modules/word/writers → esm/modules/word/writer}/run-writer.js +126 -24
- package/dist/esm/modules/word/writer/sdt-writer.js +189 -0
- package/dist/esm/modules/word/writer/stream-buf.js +73 -0
- package/dist/esm/modules/word/writer/streaming-writer.js +1382 -0
- package/dist/esm/modules/word/writer/string-buf.js +7 -0
- package/dist/esm/modules/word/{writers → writer}/styles-writer.js +32 -1
- package/dist/esm/modules/word/{writers → writer}/table-writer.js +94 -11
- package/dist/esm/utils/crypto.browser.js +3 -1
- package/dist/esm/utils/crypto.js +4 -1
- package/dist/esm/utils/font-metrics.js +293 -0
- package/dist/esm/utils/string-buf.js +89 -0
- package/dist/esm/utils/theme-colors.js +120 -0
- package/dist/iife/excelts.iife.js +70692 -70337
- package/dist/iife/excelts.iife.js.map +1 -1
- package/dist/iife/excelts.iife.min.js +57 -57
- package/dist/types/modules/archive/fs/archive-file.d.ts +8 -5
- package/dist/types/modules/excel/chart/chart-ex-types.d.ts +0 -12
- package/dist/types/modules/excel/chart/chart.d.ts +1 -5
- package/dist/types/modules/excel/chart/types.d.ts +0 -6
- package/dist/types/modules/excel/stream/workbook-writer.browser.d.ts +40 -0
- package/dist/types/modules/excel/utils/string-buf.d.ts +5 -26
- package/dist/types/modules/excel/xlsx/xlsx.browser.d.ts +19 -9
- package/dist/types/modules/excel/xlsx/xlsx.d.ts +10 -2
- package/dist/types/modules/pdf/excel-bridge.d.ts +30 -1
- package/dist/types/modules/pdf/font/metrics.d.ts +3 -52
- package/dist/types/modules/pdf/index.d.ts +1 -1
- package/dist/types/modules/pdf/render-layout-to-pdf.d.ts +66 -0
- package/dist/types/modules/pdf/word-bridge.d.ts +80 -12
- package/dist/types/modules/stream/index.base.d.ts +2 -0
- package/dist/types/modules/stream/internal/sink-adapter.d.ts +65 -0
- package/dist/types/modules/stream/pull-stream.d.ts +19 -2
- package/dist/types/modules/stream/types.d.ts +13 -1
- package/dist/types/modules/word/advanced/diff.d.ts +61 -0
- package/dist/types/modules/word/advanced/drawing-shapes.d.ts +269 -0
- package/dist/types/modules/word/advanced/field-engine.d.ts +43 -0
- package/dist/types/modules/word/advanced/glossary.d.ts +86 -0
- package/dist/types/modules/word/advanced/math-convert.d.ts +30 -0
- package/dist/types/modules/word/advanced/ole-objects.d.ts +115 -0
- package/dist/types/modules/word/advanced/style-map.d.ts +105 -0
- package/dist/types/modules/word/advanced/validation.d.ts +56 -0
- package/dist/types/modules/word/advanced/vba-project.d.ts +91 -0
- package/dist/types/modules/word/bridge/excel-bridge.d.ts +127 -0
- package/dist/types/modules/word/builder/document-handle.d.ts +151 -0
- package/dist/types/modules/word/builder/paragraph-builders.d.ts +61 -0
- package/dist/types/modules/word/builder/run-builders.d.ts +374 -0
- package/dist/types/modules/word/builder/table-builders.d.ts +23 -0
- package/dist/types/modules/word/constants.d.ts +39 -1
- package/dist/types/modules/word/convert/conversion-ir.d.ts +210 -0
- package/dist/types/modules/word/convert/docx-to-semantic.d.ts +39 -0
- package/dist/types/modules/word/convert/flat-opc.d.ts +44 -0
- package/dist/types/modules/word/convert/html/html-import.d.ts +50 -0
- package/dist/{browser/modules/word → types/modules/word/convert/html}/html-renderer.d.ts +14 -1
- package/dist/types/modules/word/convert/html/html.d.ts +15 -0
- package/dist/types/modules/word/convert/markdown/markdown-import.d.ts +68 -0
- package/dist/types/modules/word/convert/markdown/markdown-renderer.d.ts +25 -0
- package/dist/types/modules/word/convert/markdown/markdown.d.ts +15 -0
- package/dist/types/modules/word/convert/odt/odt.d.ts +41 -0
- package/dist/types/modules/word/{color-utils.d.ts → core/color-utils.d.ts} +8 -1
- package/dist/types/modules/word/core/internal-utils.d.ts +90 -0
- package/dist/types/modules/word/core/mapper.d.ts +44 -0
- package/dist/types/modules/word/core/opc-paths.d.ts +33 -0
- package/dist/types/modules/word/core/text-utils.d.ts +38 -0
- package/dist/types/modules/word/core/walker.d.ts +119 -0
- package/dist/types/modules/word/crypto.d.ts +14 -9
- package/dist/types/modules/word/document-io.d.ts +59 -27
- package/dist/types/modules/word/errors.d.ts +44 -1
- package/dist/types/modules/word/excel.d.ts +14 -0
- package/dist/types/modules/word/font/font-embed.d.ts +112 -0
- package/dist/types/modules/word/font/hyphenation.d.ts +65 -0
- package/dist/types/modules/word/font/text-shaping.d.ts +58 -0
- package/dist/types/modules/word/html.d.ts +7 -6
- package/dist/types/modules/word/incremental-edit.d.ts +123 -0
- package/dist/types/modules/word/index.base.d.ts +194 -10
- package/dist/types/modules/word/layout/layout-constants.d.ts +17 -0
- package/dist/types/modules/word/layout/layout-full.d.ts +53 -0
- package/dist/types/modules/word/layout/layout-model.d.ts +344 -0
- package/dist/types/modules/word/layout/layout.d.ts +63 -0
- package/dist/types/modules/word/layout/render-page.d.ts +57 -0
- package/dist/types/modules/word/markdown.d.ts +14 -0
- package/dist/types/modules/word/patcher.d.ts +62 -0
- package/dist/types/modules/word/query/compat.d.ts +25 -0
- package/dist/types/modules/word/query/data-binding.d.ts +22 -0
- package/dist/types/modules/word/query/form-fields.d.ts +41 -0
- package/dist/types/modules/word/query/format-search.d.ts +99 -0
- package/dist/types/modules/word/query/mail-merge.d.ts +25 -0
- package/dist/types/modules/word/query/merge.d.ts +50 -0
- package/dist/types/modules/word/query/replace.d.ts +47 -0
- package/dist/types/modules/word/query/revisions.d.ts +67 -0
- package/dist/types/modules/word/query/search.d.ts +129 -0
- package/dist/types/modules/word/query/split.d.ts +44 -0
- package/dist/types/modules/word/query/style-resolve.d.ts +104 -0
- package/dist/types/modules/word/reader/chart-parser.d.ts +20 -0
- package/dist/types/modules/word/reader/comments-parser.d.ts +26 -0
- package/dist/types/modules/word/reader/doc-props-parsers.d.ts +15 -0
- package/dist/types/modules/word/reader/docx-reader.d.ts +27 -0
- package/dist/types/modules/word/reader/drawing-helpers.d.ts +27 -0
- package/dist/types/modules/word/reader/form-field-parser.d.ts +21 -0
- package/dist/types/modules/word/reader/image-parsers.d.ts +11 -0
- package/dist/types/modules/word/reader/math-parser.d.ts +12 -0
- package/dist/types/modules/word/reader/metadata-parsers.d.ts +17 -0
- package/dist/types/modules/word/reader/numbering-parser.d.ts +13 -0
- package/dist/types/modules/word/reader/paragraph-section-parsers.d.ts +12 -0
- package/dist/types/modules/word/reader/parse-utils.d.ts +91 -0
- package/dist/types/modules/word/reader/properties-parsers.d.ts +21 -0
- package/dist/types/modules/word/reader/reader-context.d.ts +69 -0
- package/dist/types/modules/word/reader/sdt-helpers.d.ts +29 -0
- package/dist/types/modules/word/reader/settings-parser.d.ts +8 -0
- package/dist/types/modules/word/reader/styles-parser.d.ts +12 -0
- package/dist/types/modules/word/reader/table-properties-parsers.d.ts +12 -0
- package/dist/types/modules/word/reader/theme-parser.d.ts +8 -0
- package/dist/types/modules/word/reader/watermark-parser.d.ts +15 -0
- package/dist/types/modules/word/security/cfb-reader.d.ts +37 -0
- package/dist/types/modules/word/{digital-signatures.d.ts → security/digital-signatures.d.ts} +19 -11
- package/dist/types/modules/word/security/document-protection.d.ts +93 -0
- package/dist/{browser/modules/word → types/modules/word/security}/encryption.d.ts +51 -4
- package/dist/types/modules/word/security/policy.d.ts +80 -0
- package/dist/types/modules/word/template/template-chart.d.ts +56 -0
- package/dist/types/modules/word/template/template-datasource.d.ts +154 -0
- package/dist/types/modules/word/template/template-engine.d.ts +121 -0
- package/dist/types/modules/word/types.d.ts +224 -25
- package/dist/types/modules/word/units.d.ts +26 -0
- package/dist/types/modules/word/writer/checkbox-writer.d.ts +17 -0
- package/dist/{browser/modules/word/writers → types/modules/word/writer}/comment-writer.d.ts +2 -1
- package/dist/types/modules/word/writer/common-parts.d.ts +57 -0
- package/dist/{browser/modules/word → types/modules/word/writer}/content-types.d.ts +2 -2
- package/dist/types/modules/word/writer/document-writer.d.ts +24 -0
- package/dist/types/modules/word/writer/docx-packager.d.ts +35 -0
- package/dist/{browser/modules/word/writers → types/modules/word/writer}/footnote-writer.d.ts +3 -2
- package/dist/{browser/modules/word/writers → types/modules/word/writer}/header-footer-writer.d.ts +3 -2
- package/dist/{browser/modules/word/writers → types/modules/word/writer}/image-writer.d.ts +1 -1
- package/dist/types/modules/word/writer/math-writer.d.ts +20 -0
- package/dist/types/modules/word/{writers → writer}/numbering-writer.d.ts +1 -1
- package/dist/types/modules/word/{writers → writer}/paragraph-writer.d.ts +2 -1
- package/dist/types/modules/word/{writers → writer}/parts-writer.d.ts +3 -3
- package/dist/types/modules/word/writer/reference-scanners.d.ts +42 -0
- package/dist/types/modules/word/writer/relationships.d.ts +52 -0
- package/dist/types/modules/word/writer/render-context.d.ts +124 -0
- package/dist/types/modules/word/{writers → writer}/run-writer.d.ts +10 -1
- package/dist/types/modules/word/writer/sdt-writer.d.ts +25 -0
- package/dist/types/modules/word/writer/stream-buf.d.ts +37 -0
- package/dist/types/modules/word/writer/streaming-writer.d.ts +344 -0
- package/dist/types/modules/word/writer/string-buf.d.ts +8 -0
- package/dist/types/modules/word/{writers → writer}/table-writer.d.ts +2 -1
- package/dist/types/modules/xml/types.d.ts +22 -0
- package/dist/types/utils/crypto.browser.d.ts +3 -1
- package/dist/types/utils/crypto.d.ts +4 -1
- package/dist/types/utils/font-metrics.d.ts +63 -0
- package/dist/types/utils/string-buf.d.ts +42 -0
- package/dist/types/utils/theme-colors.d.ts +55 -0
- package/package.json +121 -39
- package/dist/browser/modules/word/color-utils.js +0 -94
- package/dist/browser/modules/word/document.d.ts +0 -657
- package/dist/browser/modules/word/document.js +0 -1533
- package/dist/browser/modules/word/docx-packager.d.ts +0 -14
- package/dist/browser/modules/word/docx-packager.js +0 -822
- package/dist/browser/modules/word/docx-reader.d.ts +0 -11
- package/dist/browser/modules/word/docx-reader.js +0 -4929
- package/dist/browser/modules/word/encryption.js +0 -274
- package/dist/browser/modules/word/internal-utils.d.ts +0 -23
- package/dist/browser/modules/word/internal-utils.js +0 -54
- package/dist/browser/modules/word/namespaces.d.ts +0 -159
- package/dist/browser/modules/word/namespaces.js +0 -189
- package/dist/browser/modules/word/relationships.d.ts +0 -30
- package/dist/browser/modules/word/relationships.js +0 -48
- package/dist/browser/modules/word/writers/checkbox-writer.d.ts +0 -9
- package/dist/browser/modules/word/writers/checkbox-writer.js +0 -42
- package/dist/browser/modules/word/writers/document-writer.d.ts +0 -16
- package/dist/browser/modules/word/writers/document-writer.js +0 -461
- package/dist/browser/modules/word/writers/math-writer.d.ts +0 -9
- package/dist/cjs/modules/word/color-utils.js +0 -97
- package/dist/cjs/modules/word/document.js +0 -1645
- package/dist/cjs/modules/word/docx-packager.js +0 -825
- package/dist/cjs/modules/word/docx-reader.js +0 -4932
- package/dist/cjs/modules/word/encryption.js +0 -282
- package/dist/cjs/modules/word/internal-utils.js +0 -59
- package/dist/cjs/modules/word/namespaces.js +0 -192
- package/dist/cjs/modules/word/relationships.js +0 -55
- package/dist/cjs/modules/word/writers/checkbox-writer.js +0 -45
- package/dist/cjs/modules/word/writers/document-writer.js +0 -465
- package/dist/esm/modules/word/color-utils.js +0 -94
- package/dist/esm/modules/word/document.js +0 -1533
- package/dist/esm/modules/word/docx-packager.js +0 -822
- package/dist/esm/modules/word/docx-reader.js +0 -4929
- package/dist/esm/modules/word/encryption.js +0 -274
- package/dist/esm/modules/word/internal-utils.js +0 -54
- package/dist/esm/modules/word/namespaces.js +0 -189
- package/dist/esm/modules/word/relationships.js +0 -48
- package/dist/esm/modules/word/writers/checkbox-writer.js +0 -42
- package/dist/esm/modules/word/writers/document-writer.js +0 -461
- package/dist/types/modules/word/document.d.ts +0 -657
- package/dist/types/modules/word/docx-packager.d.ts +0 -14
- package/dist/types/modules/word/docx-reader.d.ts +0 -11
- package/dist/types/modules/word/internal-utils.d.ts +0 -23
- package/dist/types/modules/word/namespaces.d.ts +0 -159
- package/dist/types/modules/word/relationships.d.ts +0 -30
- package/dist/types/modules/word/writers/checkbox-writer.d.ts +0 -9
- package/dist/types/modules/word/writers/document-writer.d.ts +0 -16
- package/dist/types/modules/word/writers/math-writer.d.ts +0 -9
- /package/dist/browser/modules/word/{font-obfuscation.d.ts → font/font-obfuscation.d.ts} +0 -0
- /package/dist/browser/modules/word/{writers → writer}/chart-writer.d.ts +0 -0
- /package/dist/browser/modules/word/{writers → writer}/section-writer.d.ts +0 -0
- /package/dist/browser/modules/word/{writers → writer}/section-writer.js +0 -0
- /package/dist/browser/modules/word/{writers → writer}/styles-writer.d.ts +0 -0
- /package/dist/browser/modules/word/{writers → writer}/textbox-writer.d.ts +0 -0
- /package/dist/browser/modules/word/{writers → writer}/textbox-writer.js +0 -0
- /package/dist/browser/modules/word/{writers → writer}/toc-writer.d.ts +0 -0
- /package/dist/browser/modules/word/{writers → writer}/toc-writer.js +0 -0
- /package/dist/cjs/modules/word/{writers → writer}/section-writer.js +0 -0
- /package/dist/cjs/modules/word/{writers → writer}/textbox-writer.js +0 -0
- /package/dist/cjs/modules/word/{writers → writer}/toc-writer.js +0 -0
- /package/dist/esm/modules/word/{writers → writer}/section-writer.js +0 -0
- /package/dist/esm/modules/word/{writers → writer}/textbox-writer.js +0 -0
- /package/dist/esm/modules/word/{writers → writer}/toc-writer.js +0 -0
- /package/dist/types/modules/word/{font-obfuscation.d.ts → font/font-obfuscation.d.ts} +0 -0
- /package/dist/types/modules/word/{writers → writer}/chart-writer.d.ts +0 -0
- /package/dist/types/modules/word/{writers → writer}/section-writer.d.ts +0 -0
- /package/dist/types/modules/word/{writers → writer}/styles-writer.d.ts +0 -0
- /package/dist/types/modules/word/{writers → writer}/textbox-writer.d.ts +0 -0
- /package/dist/types/modules/word/{writers → writer}/toc-writer.d.ts +0 -0
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOCX Module - Streaming Writer
|
|
3
|
+
*
|
|
4
|
+
* A DOCX generator that serializes body content incrementally and pushes it
|
|
5
|
+
* through a streaming compression pipeline. Uses the same streaming ZIP
|
|
6
|
+
* infrastructure as the Excel module:
|
|
7
|
+
*
|
|
8
|
+
* - `Zip` (StreamingZip) — streams ZIP entries to output
|
|
9
|
+
* - `ZipDeflate` — per-entry deflate compression
|
|
10
|
+
* - `StreamBuf` — event-driven pipe from XML to ZIP
|
|
11
|
+
* - `StringBuf` — efficient XML string builder with buffer reuse
|
|
12
|
+
*
|
|
13
|
+
* Data flow with sink (true end-to-end streaming):
|
|
14
|
+
* ```
|
|
15
|
+
* add(paragraph) → XML → StreamBuf → ZipDeflate → Zip
|
|
16
|
+
* ↓ (per-chunk callback)
|
|
17
|
+
* await SinkAdapter.write(chunk)
|
|
18
|
+
* ↓
|
|
19
|
+
* user-supplied WritableStream /
|
|
20
|
+
* Node Writable / duck-typed sink
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* Memory profile:
|
|
24
|
+
* - Body model is never retained: each element is serialised and
|
|
25
|
+
* compressed as it arrives, so peak per-element memory is
|
|
26
|
+
* O(largest_single_element).
|
|
27
|
+
* - When `options.sink` is provided, compressed bytes are pushed
|
|
28
|
+
* into the sink as soon as they are produced (with backpressure
|
|
29
|
+
* awaited via {@link SinkAdapter}). Total writer-side memory then
|
|
30
|
+
* stays O(largest_part) regardless of final DOCX size.
|
|
31
|
+
* - When `options.sink` is omitted, compressed bytes accumulate in
|
|
32
|
+
* `_outputChunks` and `finalize()` returns the assembled
|
|
33
|
+
* `Uint8Array`. Total memory is O(compressed_docx_size).
|
|
34
|
+
*/
|
|
35
|
+
import { type AnySink } from "../../stream/internal/sink-adapter.js";
|
|
36
|
+
import type { WordSecurityPolicy } from "../security/policy.js";
|
|
37
|
+
import type { AbstractNumbering, AppProperties, BodyContent, CommentDef, CoreProperties, CustomProperty, CustomXmlPart, DocDefaults, DocumentBackground, DocumentSettings, DocumentTheme, EmbeddedFont, EndnoteDef, FontDef, FooterDef, FootnoteDef, HeaderDef, ImageDef, NumberingInstance, OpaquePart, Paragraph, SectionProperties, StyleDef, Watermark } from "../types.js";
|
|
38
|
+
/** Options for the streaming DOCX writer. */
|
|
39
|
+
export interface StreamingDocxOptions {
|
|
40
|
+
/** Compression level (0-9). Default: 6. */
|
|
41
|
+
readonly compressionLevel?: number;
|
|
42
|
+
/** Progress callback interval: report after every N elements. Default: 1000. */
|
|
43
|
+
readonly chunkSize?: number;
|
|
44
|
+
/** Section properties for the final section. */
|
|
45
|
+
readonly sectionProperties?: SectionProperties;
|
|
46
|
+
/** Document styles. */
|
|
47
|
+
readonly styles?: readonly StyleDef[];
|
|
48
|
+
/** Document defaults. */
|
|
49
|
+
readonly docDefaults?: DocDefaults;
|
|
50
|
+
/** Abstract numbering definitions. */
|
|
51
|
+
readonly abstractNumberings?: readonly AbstractNumbering[];
|
|
52
|
+
/** Numbering instances. */
|
|
53
|
+
readonly numberingInstances?: readonly NumberingInstance[];
|
|
54
|
+
/** Headers. */
|
|
55
|
+
readonly headers?: ReadonlyMap<string, HeaderDef>;
|
|
56
|
+
/** Footers. */
|
|
57
|
+
readonly footers?: ReadonlyMap<string, FooterDef>;
|
|
58
|
+
/** Footnotes. */
|
|
59
|
+
readonly footnotes?: readonly FootnoteDef[];
|
|
60
|
+
/** Endnotes. */
|
|
61
|
+
readonly endnotes?: readonly EndnoteDef[];
|
|
62
|
+
/** Images. */
|
|
63
|
+
readonly images?: readonly ImageDef[];
|
|
64
|
+
/** Fonts. */
|
|
65
|
+
readonly fonts?: readonly FontDef[];
|
|
66
|
+
/** Document settings. */
|
|
67
|
+
readonly settings?: DocumentSettings;
|
|
68
|
+
/** Core properties. */
|
|
69
|
+
readonly coreProperties?: CoreProperties;
|
|
70
|
+
/** App properties. */
|
|
71
|
+
readonly appProperties?: AppProperties;
|
|
72
|
+
/** Comments. */
|
|
73
|
+
readonly comments?: readonly CommentDef[];
|
|
74
|
+
/** Background. */
|
|
75
|
+
readonly background?: DocumentBackground;
|
|
76
|
+
/** Custom properties. */
|
|
77
|
+
readonly customProperties?: readonly CustomProperty[];
|
|
78
|
+
/** Watermark. */
|
|
79
|
+
readonly watermark?: Watermark;
|
|
80
|
+
/** Theme. */
|
|
81
|
+
readonly theme?: DocumentTheme;
|
|
82
|
+
/** Custom XML parts (for SDT data binding). */
|
|
83
|
+
readonly customXmlParts?: readonly CustomXmlPart[];
|
|
84
|
+
/** Embedded font binaries (stored in word/fonts/). */
|
|
85
|
+
readonly embeddedFonts?: readonly EmbeddedFont[];
|
|
86
|
+
/** Opaque (unrecognized) parts preserved for round-trip fidelity. */
|
|
87
|
+
readonly opaqueParts?: readonly OpaquePart[];
|
|
88
|
+
/**
|
|
89
|
+
* How to handle image references whose binary is not in `images`.
|
|
90
|
+
*
|
|
91
|
+
* - `"throw"` (default): throw `DocxWriteError` from `add*` so the caller
|
|
92
|
+
* notices the broken reference immediately.
|
|
93
|
+
* - `"warn"`: emit a `console.warn` and skip the rId. The output will be
|
|
94
|
+
* missing this image's relationship — useful only for tooling that
|
|
95
|
+
* knows it's intentionally producing a partial document.
|
|
96
|
+
*
|
|
97
|
+
* The previous behaviour (silent skip) is gone because it generated
|
|
98
|
+
* invalid DOCX files.
|
|
99
|
+
*/
|
|
100
|
+
readonly missingImagePolicy?: "throw" | "warn";
|
|
101
|
+
/**
|
|
102
|
+
* Security policy. Currently used to surface `rawXmlPolicy` to the renderers
|
|
103
|
+
* (preserve / strip / reject) so opaque rawXml fields behave consistently
|
|
104
|
+
* with the buffered `packageDocx` writer.
|
|
105
|
+
*/
|
|
106
|
+
readonly securityPolicy?: WordSecurityPolicy;
|
|
107
|
+
/**
|
|
108
|
+
* Output sink. When provided, compressed bytes flow through it as soon
|
|
109
|
+
* as the underlying ZIP pipeline produces them, with backpressure
|
|
110
|
+
* awaited via {@link SinkAdapter}. Total writer-side memory then
|
|
111
|
+
* stays O(largest_part) regardless of final DOCX size.
|
|
112
|
+
*
|
|
113
|
+
* Accepts:
|
|
114
|
+
* - Web `WritableStream<Uint8Array>` (browser, Deno, modern Node)
|
|
115
|
+
* - Node `Writable` (`fs.createWriteStream`, http response, …)
|
|
116
|
+
* - Any duck-typed object exposing `write(chunk)` + `end()` plus
|
|
117
|
+
* `once("drain"|"error"|"close"|"finish", …)` listeners
|
|
118
|
+
*
|
|
119
|
+
* When the sink is provided, {@link StreamingDocxWriter.finalize}
|
|
120
|
+
* resolves to a zero-length `Uint8Array` (the bytes have already
|
|
121
|
+
* been delivered to the sink — the empty return is a sentinel that
|
|
122
|
+
* keeps `finalize`'s return type stable across both modes). Use
|
|
123
|
+
* {@link StreamingDocxWriter.addAsync} (instead of
|
|
124
|
+
* {@link StreamingDocxWriter.add}) when you want each `add` call to
|
|
125
|
+
* await actual sink drain — that gives true end-to-end backpressure
|
|
126
|
+
* for tight production loops.
|
|
127
|
+
*
|
|
128
|
+
* When omitted, behaviour is unchanged: compressed bytes accumulate
|
|
129
|
+
* internally and `finalize()` returns the assembled `Uint8Array`.
|
|
130
|
+
*/
|
|
131
|
+
readonly sink?: AnySink;
|
|
132
|
+
}
|
|
133
|
+
/** Progress callback for streaming writer. */
|
|
134
|
+
export type StreamingProgressCallback = (info: {
|
|
135
|
+
/** Number of body elements written so far. */
|
|
136
|
+
elementsWritten: number;
|
|
137
|
+
/** Current phase: "body" | "finalizing". */
|
|
138
|
+
phase: string;
|
|
139
|
+
}) => void;
|
|
140
|
+
/**
|
|
141
|
+
* Streaming DOCX writer. Body elements are serialized to XML and compressed
|
|
142
|
+
* into the ZIP pipeline as they arrive, so the body **model** is not retained
|
|
143
|
+
* after each `add()`.
|
|
144
|
+
*
|
|
145
|
+
* When constructed with `options.sink`, compressed bytes are pushed into
|
|
146
|
+
* the sink as soon as the ZIP layer produces them, with backpressure
|
|
147
|
+
* awaited via {@link SinkAdapter}; in this mode peak memory is
|
|
148
|
+
* O(largest_part) and `finalize()` resolves to a zero-length
|
|
149
|
+
* `Uint8Array` (the bytes are already in the sink). Without a sink,
|
|
150
|
+
* compressed bytes accumulate in `_outputChunks` and `finalize()`
|
|
151
|
+
* returns the assembled `Uint8Array` (peak memory
|
|
152
|
+
* O(compressed_docx_size)).
|
|
153
|
+
*
|
|
154
|
+
* Use {@link addAsync} (instead of {@link add}) when driving the sink
|
|
155
|
+
* variant to obtain true end-to-end backpressure: each call awaits all
|
|
156
|
+
* pending sink writes before resolving.
|
|
157
|
+
*/
|
|
158
|
+
export declare class StreamingDocxWriter {
|
|
159
|
+
private readonly _options;
|
|
160
|
+
private _elementCount;
|
|
161
|
+
private _finalized;
|
|
162
|
+
private _onProgress?;
|
|
163
|
+
private readonly _xmlBuffer;
|
|
164
|
+
private _zip;
|
|
165
|
+
/** Compressed-byte accumulator used when no `sink` is supplied. */
|
|
166
|
+
private _outputChunks;
|
|
167
|
+
/** Sink-mode adapter (set when `options.sink` is provided). */
|
|
168
|
+
private _sinkAdapter?;
|
|
169
|
+
/**
|
|
170
|
+
* Promise chain serialising every sink write. The `Zip` callback fires
|
|
171
|
+
* synchronously, so we queue chunks via `.then(...)` and let
|
|
172
|
+
* `addAsync` / `finalize` await the chain.
|
|
173
|
+
*/
|
|
174
|
+
private _pendingDrain;
|
|
175
|
+
private _documentStream;
|
|
176
|
+
private _documentZipFile;
|
|
177
|
+
private _headerWritten;
|
|
178
|
+
/**
|
|
179
|
+
* Whether the previously-written body element was a `<w:tbl>`. Tracked
|
|
180
|
+
* so we can insert a separator `<w:p>` between adjacent tables — Word
|
|
181
|
+
* rejects (and silently merges) two `<w:tbl>` blocks that share no
|
|
182
|
+
* paragraph between them per ECMA-376 §17.13.5.34.
|
|
183
|
+
*/
|
|
184
|
+
private _prevWasTable;
|
|
185
|
+
/**
|
|
186
|
+
* First error reported by the underlying ZIP stream (compression failure,
|
|
187
|
+
* write-after-end, etc.). Stored synchronously by the `Zip` callback and
|
|
188
|
+
* surfaced from `finalize()` so callers receive a rejection instead of an
|
|
189
|
+
* indefinitely-pending promise.
|
|
190
|
+
*/
|
|
191
|
+
private _streamError;
|
|
192
|
+
private _documentRels;
|
|
193
|
+
private _renderCtx;
|
|
194
|
+
/** Charts encountered in body content; rendered to `word/charts/chartN.xml` at finalize time. */
|
|
195
|
+
private readonly _bodyCharts;
|
|
196
|
+
/** ChartEx items encountered in body content. */
|
|
197
|
+
private readonly _bodyChartEx;
|
|
198
|
+
/**
|
|
199
|
+
* Per-chart sequence numbers fixed at registration time. Both classes
|
|
200
|
+
* use independent monotonic counters; the writer emits
|
|
201
|
+
* `word/charts/chart{n}.xml` for the regular chart family and
|
|
202
|
+
* `word/charts/chartEx{n}.xml` for the chartEx family.
|
|
203
|
+
*
|
|
204
|
+
* The previous scheme used `chartCount + chartExCount + 1` as the
|
|
205
|
+
* sequence number for both classes, which made the rId path encoded in
|
|
206
|
+
* documentRels disagree with the path used at finalize when the writer
|
|
207
|
+
* iterated the two arrays separately. The result was relationships
|
|
208
|
+
* pointing at non-existent chart parts.
|
|
209
|
+
*/
|
|
210
|
+
private readonly _chartNum;
|
|
211
|
+
private _nextChartSeq;
|
|
212
|
+
private _nextChartExSeq;
|
|
213
|
+
/** Hyperlink object identities already registered (to keep one rId per object). */
|
|
214
|
+
private readonly _registeredHyperlinks;
|
|
215
|
+
/** Image rIds already registered to documentRels (avoid duplicates). */
|
|
216
|
+
private readonly _registeredImageRIds;
|
|
217
|
+
/** header map key → newly allocated rId. Populated by `_allocateHeaderFooterRIds`. */
|
|
218
|
+
private readonly _headerKeyToRid;
|
|
219
|
+
/** footer map key → newly allocated rId. */
|
|
220
|
+
private readonly _footerKeyToRid;
|
|
221
|
+
/** rId allocated for the auto-generated watermark header (if any). */
|
|
222
|
+
private _watermarkHeaderRid;
|
|
223
|
+
constructor(options?: StreamingDocxOptions);
|
|
224
|
+
/** Set a progress callback. */
|
|
225
|
+
onProgress(cb: StreamingProgressCallback): this;
|
|
226
|
+
/**
|
|
227
|
+
* Add a single body element. The element is immediately serialized to XML
|
|
228
|
+
* and pushed into the ZIP compression pipeline. After this call, the element
|
|
229
|
+
* can be garbage collected — it is not retained.
|
|
230
|
+
*/
|
|
231
|
+
add(element: BodyContent): this;
|
|
232
|
+
/** Add multiple body elements at once. */
|
|
233
|
+
addMany(elements: readonly BodyContent[]): this;
|
|
234
|
+
/**
|
|
235
|
+
* Async variant of {@link add}. After serialising the element, awaits
|
|
236
|
+
* any pending writes to the configured `sink` so callers driving large
|
|
237
|
+
* input get true end-to-end backpressure rather than letting the
|
|
238
|
+
* sink-write queue grow unbounded inside the writer.
|
|
239
|
+
*
|
|
240
|
+
* Without `options.sink` this is equivalent to `add` (resolving
|
|
241
|
+
* synchronously after element serialisation).
|
|
242
|
+
*
|
|
243
|
+
* Throws if the sink reports an error: previous queued writes whose
|
|
244
|
+
* rejection was captured into `_streamError` surface here.
|
|
245
|
+
*/
|
|
246
|
+
addAsync(element: BodyContent): Promise<this>;
|
|
247
|
+
/**
|
|
248
|
+
* Async variant of {@link addMany}. Awaits `addAsync` for each element
|
|
249
|
+
* so backpressure is honoured between every body element.
|
|
250
|
+
*/
|
|
251
|
+
addManyAsync(elements: readonly BodyContent[]): Promise<this>;
|
|
252
|
+
/** Add a paragraph with simple text content. */
|
|
253
|
+
addText(content: string, properties?: Paragraph["properties"]): this;
|
|
254
|
+
/** Get the count of body elements written so far. */
|
|
255
|
+
get elementCount(): number;
|
|
256
|
+
/**
|
|
257
|
+
* Finalize the document.
|
|
258
|
+
*
|
|
259
|
+
* - Without `options.sink`: returns the assembled `Uint8Array`
|
|
260
|
+
* containing the full DOCX file.
|
|
261
|
+
* - With `options.sink`: drains any pending sink writes, calls
|
|
262
|
+
* `sink.end()`, and resolves to a zero-length `Uint8Array`. The
|
|
263
|
+
* DOCX bytes have already been delivered to the sink — the empty
|
|
264
|
+
* return is a sentinel signalling "writer is done; consumer keeps
|
|
265
|
+
* the data".
|
|
266
|
+
*/
|
|
267
|
+
finalize(): Promise<Uint8Array>;
|
|
268
|
+
/** Reset the writer for reuse. */
|
|
269
|
+
/**
|
|
270
|
+
* Reset the writer for reuse.
|
|
271
|
+
*
|
|
272
|
+
* Throws when the writer was constructed with an `options.sink`: a
|
|
273
|
+
* sink can only be `end()`ed once, so reusing the same writer would
|
|
274
|
+
* produce an undefined byte stream. Construct a new writer (with a
|
|
275
|
+
* new sink) for each document instead.
|
|
276
|
+
*/
|
|
277
|
+
reset(): this;
|
|
278
|
+
private _initZip;
|
|
279
|
+
private _write;
|
|
280
|
+
private _writeDocumentHeader;
|
|
281
|
+
private _writeBodyElement;
|
|
282
|
+
/**
|
|
283
|
+
* Emit an empty `<w:p/>` to separate two adjacent tables. Required by
|
|
284
|
+
* ECMA-376 §17.13.5.34 — Word rejects packages where two `<w:tbl>`
|
|
285
|
+
* elements appear without a paragraph between them.
|
|
286
|
+
*/
|
|
287
|
+
private _writeSeparatorParagraph;
|
|
288
|
+
/**
|
|
289
|
+
* Scan a single body element and register any chart / hyperlink / image
|
|
290
|
+
* references it introduces against the writer's accumulated state. This
|
|
291
|
+
* must run before the element is serialized so the render context already
|
|
292
|
+
* carries the relationships the renderer will look up.
|
|
293
|
+
*/
|
|
294
|
+
private _registerElementReferences;
|
|
295
|
+
private _registerParagraphReferences;
|
|
296
|
+
private _registerChart;
|
|
297
|
+
private _registerChartEx;
|
|
298
|
+
private _registerHyperlink;
|
|
299
|
+
private _registerImageRId;
|
|
300
|
+
private _lookupImage;
|
|
301
|
+
private _writeDocumentFooter;
|
|
302
|
+
/**
|
|
303
|
+
* Allocate header/footer relationship IDs deterministically (in the same
|
|
304
|
+
* order auxiliary parts will be emitted). Called once during finalize so
|
|
305
|
+
* `_writeDocumentFooter` and `_addAuxiliaryParts` agree on which rId
|
|
306
|
+
* points at which header/footer XML part.
|
|
307
|
+
*/
|
|
308
|
+
private _allocateHeaderFooterRIds;
|
|
309
|
+
private _rewireSectionRefs;
|
|
310
|
+
/**
|
|
311
|
+
* Synthesise section-property header references for every header part
|
|
312
|
+
* the caller registered. Recognised type keys (`default`/`first`/`even`)
|
|
313
|
+
* keep their semantics; any other key (round-tripped rId names from
|
|
314
|
+
* readDocx, custom strings) falls back to `"default"` so the header is
|
|
315
|
+
* actually referenced — without this fallback header parts can sit in
|
|
316
|
+
* the package as dangling content.
|
|
317
|
+
*
|
|
318
|
+
* If multiple keys map to the same logical type, only the first one is
|
|
319
|
+
* kept so we don't emit two `<w:headerReference w:type="default">`
|
|
320
|
+
* children (Word's behaviour with duplicates is implementation-defined).
|
|
321
|
+
*/
|
|
322
|
+
private _synthesizeHeaderRefs;
|
|
323
|
+
private _synthesizeFooterRefs;
|
|
324
|
+
private _addAuxiliaryParts;
|
|
325
|
+
private _endStream;
|
|
326
|
+
private _assembleOutput;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Create a new streaming DOCX writer.
|
|
330
|
+
*
|
|
331
|
+
* @example
|
|
332
|
+
* ```ts
|
|
333
|
+
* const writer = createDocxStream({
|
|
334
|
+
* styles: [{ type: "paragraph", styleId: "Normal", name: "Normal" }]
|
|
335
|
+
* });
|
|
336
|
+
*
|
|
337
|
+
* for (let i = 0; i < 100000; i++) {
|
|
338
|
+
* writer.addText(`Paragraph ${i}`);
|
|
339
|
+
* }
|
|
340
|
+
*
|
|
341
|
+
* const buffer = await writer.finalize();
|
|
342
|
+
* ```
|
|
343
|
+
*/
|
|
344
|
+
export declare function createDocxStream(options?: StreamingDocxOptions): StreamingDocxWriter;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-export of the shared {@link StringBuf} from `@utils/string-buf`.
|
|
3
|
+
*
|
|
4
|
+
* Kept as a thin alias so existing relative imports (`./string-buf`) within
|
|
5
|
+
* the word writer continue to work without churn.
|
|
6
|
+
*/
|
|
7
|
+
export { StringBuf } from "../../../utils/string-buf.js";
|
|
8
|
+
export type { StringBufOptions } from "../../../utils/string-buf.js";
|
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { XmlSink } from "../../xml/types.js";
|
|
8
8
|
import type { Table } from "../types.js";
|
|
9
|
+
import type { RenderHelpers } from "./render-context.js";
|
|
9
10
|
/** Render a w:tbl element. */
|
|
10
|
-
export declare function renderTable(xml: XmlSink, table: Table): void;
|
|
11
|
+
export declare function renderTable(xml: XmlSink, table: Table, helpers?: RenderHelpers): void;
|
|
@@ -214,6 +214,28 @@ export interface SaxOptions {
|
|
|
214
214
|
* Accepts strings or Uint8Array chunks.
|
|
215
215
|
* Compatible with Node.js Writable, browser WritableStream wrappers,
|
|
216
216
|
* and the project's own StreamBuf.
|
|
217
|
+
*
|
|
218
|
+
* **Backpressure caveat**: `write()` returns `void`. The XmlStreamWriter
|
|
219
|
+
* cannot signal or wait for backpressure on the target — it pushes
|
|
220
|
+
* chunks synchronously as the caller invokes `openNode`/`writeText`/etc.
|
|
221
|
+
*
|
|
222
|
+
* If the target is a slow sink (HTTP response, fs stream, etc), the
|
|
223
|
+
* caller is responsible for ensuring chunks are consumed at a rate
|
|
224
|
+
* matching production. Two safe patterns:
|
|
225
|
+
*
|
|
226
|
+
* 1. Wrap the target so `write()` buffers into a bounded queue and
|
|
227
|
+
* pause your XML production loop when the queue is full.
|
|
228
|
+
* 2. Use a small in-memory buffer as the `WritableTarget`, then ship
|
|
229
|
+
* the assembled bytes to the slow sink with proper backpressure
|
|
230
|
+
* (e.g. via `pipeline()`).
|
|
231
|
+
*
|
|
232
|
+
* `XmlStreamWriter` is used internally by excelts's xlsx writer. The xlsx
|
|
233
|
+
* writer wraps it in a backpressure-aware zip pipeline that awaits drain
|
|
234
|
+
* BETWEEN zip entries — so memory grows at most by one entry's worth of
|
|
235
|
+
* uncompressed XML before the producer is parked. Within a single very
|
|
236
|
+
* large worksheet entry the synchronous push pattern still applies; that
|
|
237
|
+
* is the practical bound on how much a slow user sink can buffer behind
|
|
238
|
+
* the xlsx writer.
|
|
217
239
|
*/
|
|
218
240
|
export interface WritableTarget {
|
|
219
241
|
write(chunk: string | Uint8Array): void;
|
|
@@ -19,7 +19,9 @@ export declare function sha256(input: Uint8Array): Uint8Array;
|
|
|
19
19
|
export declare function md5(input: Uint8Array): Uint8Array;
|
|
20
20
|
/**
|
|
21
21
|
* RC4 stream cipher.
|
|
22
|
-
*
|
|
22
|
+
*
|
|
23
|
+
* Required by ISO 32000 for reading PDFs encrypted with the RC4 algorithm
|
|
24
|
+
* (PDF 1.4 standard handler V=1/V=2).
|
|
23
25
|
*/
|
|
24
26
|
export declare function rc4(key: Uint8Array, data: Uint8Array): Uint8Array;
|
|
25
27
|
/**
|
|
@@ -67,7 +67,10 @@ export declare function aesCbcEncryptRaw(plaintext: Uint8Array, key: Uint8Array,
|
|
|
67
67
|
export declare function aesEcbEncrypt(block: Uint8Array, key: Uint8Array): Uint8Array;
|
|
68
68
|
/**
|
|
69
69
|
* RC4 stream cipher.
|
|
70
|
-
*
|
|
70
|
+
*
|
|
71
|
+
* Required by ISO 32000 for reading PDFs encrypted with the RC4 algorithm
|
|
72
|
+
* (PDF 1.4 standard handler V=1/V=2). Modern Node `crypto` no longer
|
|
73
|
+
* exposes RC4, so this is a pure-JS implementation.
|
|
71
74
|
*/
|
|
72
75
|
export declare function rc4(key: Uint8Array, data: Uint8Array): Uint8Array;
|
|
73
76
|
/**
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard Font Metrics — shared between Word layout and PDF rendering.
|
|
3
|
+
*
|
|
4
|
+
* Provides width data for the 14 standard PDF fonts (Helvetica, Times, Courier families).
|
|
5
|
+
* Used for text measurement without requiring actual font files.
|
|
6
|
+
*
|
|
7
|
+
* Character widths are specified in 1/1000 of a text unit. To get the actual width
|
|
8
|
+
* of a character at a given font size:
|
|
9
|
+
* width_in_points = (charWidth / 1000) * fontSize
|
|
10
|
+
*
|
|
11
|
+
* @see PDF Reference 1.7, Appendix D - Standard Type 1 Fonts
|
|
12
|
+
* @see Adobe Font Metrics files (AFM) for canonical widths
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Get the width of a character in a given font.
|
|
16
|
+
* @param charCode - Unicode code point (or char code)
|
|
17
|
+
* @param fontName - PDF standard font name
|
|
18
|
+
* @returns Width in thousandths of a unit
|
|
19
|
+
*/
|
|
20
|
+
export declare function getCharWidth(charCode: number, fontName: string): number;
|
|
21
|
+
/**
|
|
22
|
+
* Measure the width of a text string in the given font and size.
|
|
23
|
+
* @param text - The string to measure
|
|
24
|
+
* @param fontName - PDF standard font name
|
|
25
|
+
* @param fontSize - Font size in points
|
|
26
|
+
* @returns Width in points
|
|
27
|
+
*/
|
|
28
|
+
export declare function measureTextWidth(text: string, fontName: string, fontSize: number): number;
|
|
29
|
+
/**
|
|
30
|
+
* Get the font ascent for a given font and size.
|
|
31
|
+
* @param fontName - PDF standard font name
|
|
32
|
+
* @param fontSize - Font size in points
|
|
33
|
+
* @returns Ascent in points (positive, distance above baseline)
|
|
34
|
+
*/
|
|
35
|
+
export declare function getFontAscent(fontName: string, fontSize: number): number;
|
|
36
|
+
/**
|
|
37
|
+
* Get the font descent for a given font and size.
|
|
38
|
+
* @param fontName - PDF standard font name
|
|
39
|
+
* @param fontSize - Font size in points
|
|
40
|
+
* @returns Descent in points (positive value representing distance below baseline)
|
|
41
|
+
*/
|
|
42
|
+
export declare function getFontDescent(fontName: string, fontSize: number): number;
|
|
43
|
+
/**
|
|
44
|
+
* Get the total line height (ascent - descent) for a font.
|
|
45
|
+
* @param fontName - PDF standard font name
|
|
46
|
+
* @param fontSize - Font size in points
|
|
47
|
+
* @returns Line height in points
|
|
48
|
+
*/
|
|
49
|
+
export declare function getLineHeight(fontName: string, fontSize: number): number;
|
|
50
|
+
/**
|
|
51
|
+
* Check if a font name is a known standard PDF font.
|
|
52
|
+
*/
|
|
53
|
+
export declare function isStandardFont(fontName: string): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Get all supported standard font names.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getStandardFontNames(): string[];
|
|
58
|
+
/**
|
|
59
|
+
* Map common font names (like "Arial", "Calibri") to closest standard font.
|
|
60
|
+
* Returns the input unchanged if it's already a standard font name.
|
|
61
|
+
* Falls back to "Helvetica" for unknown fonts.
|
|
62
|
+
*/
|
|
63
|
+
export declare function mapToStandardFont(fontName: string): string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StringBuf - Cross-Platform String Buffer
|
|
3
|
+
*
|
|
4
|
+
* Efficient string builder that accumulates UTF-8 encoded bytes into a single
|
|
5
|
+
* `Uint8Array`. Designed for hot paths that build large XML / text payloads
|
|
6
|
+
* (XLSX worksheet writers, streaming DOCX writer) where naïve `string +=`
|
|
7
|
+
* concatenation triggers O(n²) re-allocations.
|
|
8
|
+
*
|
|
9
|
+
* Works identically in Node.js and Browser environments — uses only
|
|
10
|
+
* `TextEncoder` and `Uint8Array`.
|
|
11
|
+
*/
|
|
12
|
+
interface StringBufOptions {
|
|
13
|
+
/** Initial capacity in bytes (default: 16384). */
|
|
14
|
+
size?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Encoding label, accepted for API symmetry. Only UTF-8 is supported by
|
|
17
|
+
* `TextEncoder`, so this option is ignored.
|
|
18
|
+
*/
|
|
19
|
+
encoding?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Efficient string builder backed by a growable `Uint8Array`.
|
|
23
|
+
*/
|
|
24
|
+
declare class StringBuf {
|
|
25
|
+
private _buf;
|
|
26
|
+
private _inPos;
|
|
27
|
+
private _buffer;
|
|
28
|
+
constructor(options?: StringBufOptions);
|
|
29
|
+
get length(): number;
|
|
30
|
+
get capacity(): number;
|
|
31
|
+
get buffer(): Uint8Array;
|
|
32
|
+
/** Return a snapshot of the bytes written so far. Cached until next mutation. */
|
|
33
|
+
toBuffer(): Uint8Array;
|
|
34
|
+
reset(position?: number): void;
|
|
35
|
+
private _grow;
|
|
36
|
+
/** Append a string, encoded as UTF-8. */
|
|
37
|
+
addText(text: string): void;
|
|
38
|
+
/** Append the contents of another StringBuf without re-encoding. */
|
|
39
|
+
addStringBuf(inBuf: StringBuf): void;
|
|
40
|
+
}
|
|
41
|
+
export { StringBuf };
|
|
42
|
+
export type { StringBufOptions };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OOXML Theme Color Resolution — shared between Excel and Word modules.
|
|
3
|
+
*
|
|
4
|
+
* Provides utilities for resolving theme color references with tint/shade
|
|
5
|
+
* transformations per the ECMA-376 color model.
|
|
6
|
+
*/
|
|
7
|
+
/** Standard OOXML theme color names (scheme keys in theme1.xml). */
|
|
8
|
+
export type OoxmlThemeColorName = "dk1" | "lt1" | "dk2" | "lt2" | "accent1" | "accent2" | "accent3" | "accent4" | "accent5" | "accent6" | "hlink" | "folHlink";
|
|
9
|
+
/**
|
|
10
|
+
* Map from OOXML property attribute values to theme scheme keys.
|
|
11
|
+
*
|
|
12
|
+
* Word/Excel run/paragraph/cell properties use long-form names ("dark1",
|
|
13
|
+
* "light1", "hyperlink") while the theme XML stores short-form keys
|
|
14
|
+
* ("dk1", "lt1", "hlink"). This map normalises both forms.
|
|
15
|
+
*/
|
|
16
|
+
export declare const THEME_COLOR_ATTRIBUTE_MAP: Record<string, OoxmlThemeColorName>;
|
|
17
|
+
/**
|
|
18
|
+
* Apply a tint (lighten toward white) to a hex color.
|
|
19
|
+
*
|
|
20
|
+
* OOXML tint formula: `newComponent = component + (255 - component) * tint`
|
|
21
|
+
* where tint ∈ [0, 1]. tint=0 → original, tint=1 → white.
|
|
22
|
+
*
|
|
23
|
+
* @param hex - 6-character hex color string (no "#" prefix).
|
|
24
|
+
* @param tint - Tint value in range [0, 1].
|
|
25
|
+
* @returns Tinted 6-character hex color string.
|
|
26
|
+
*/
|
|
27
|
+
export declare function applyTint(hex: string, tint: number): string;
|
|
28
|
+
/**
|
|
29
|
+
* Apply a shade (darken toward black) to a hex color.
|
|
30
|
+
*
|
|
31
|
+
* OOXML shade formula: `newComponent = component * shade`
|
|
32
|
+
* where shade ∈ [0, 1]. shade=1 → original, shade=0 → black.
|
|
33
|
+
*
|
|
34
|
+
* @param hex - 6-character hex color string (no "#" prefix).
|
|
35
|
+
* @param shade - Shade value in range [0, 1].
|
|
36
|
+
* @returns Shaded 6-character hex color string.
|
|
37
|
+
*/
|
|
38
|
+
export declare function applyShade(hex: string, shade: number): string;
|
|
39
|
+
/**
|
|
40
|
+
* Resolve a theme color reference to a hex color string.
|
|
41
|
+
*
|
|
42
|
+
* Looks up the theme color by attribute name (normalising long-form names
|
|
43
|
+
* like "dark1" to scheme keys like "dk1"), then applies optional tint or
|
|
44
|
+
* shade transformation.
|
|
45
|
+
*
|
|
46
|
+
* @param themeColorName - The theme color attribute value (e.g. "accent1", "dark1", "dk1").
|
|
47
|
+
* @param colors - The theme color scheme (scheme key → 6-char hex mapping).
|
|
48
|
+
* @param tint - Optional tint value in [0, 1]. Values > 1 are treated as
|
|
49
|
+
* raw bytes (0-255) and normalised by dividing by 255.
|
|
50
|
+
* @param shade - Optional shade value in [0, 1]. Values > 1 are treated as
|
|
51
|
+
* raw bytes (0-255) and normalised by dividing by 255.
|
|
52
|
+
* @returns Resolved 6-character hex color string, or undefined if the theme
|
|
53
|
+
* color name cannot be found in the provided scheme.
|
|
54
|
+
*/
|
|
55
|
+
export declare function resolveOoxmlThemeColor(themeColorName: string, colors: Readonly<Record<string, string>>, tint?: number, shade?: number): string | undefined;
|