@cj-tech-master/excelts 9.4.2 → 9.5.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/dist/browser/index.browser.d.ts +8 -5
- package/dist/browser/index.browser.js +19 -1
- package/dist/browser/index.d.ts +4 -2
- package/dist/browser/index.js +9 -1
- package/dist/browser/modules/excel/chart/cache-populator.d.ts +49 -0
- package/dist/browser/modules/excel/chart/cache-populator.js +1171 -0
- package/dist/browser/modules/excel/chart/chart-api.d.ts +92 -0
- package/dist/browser/modules/excel/chart/chart-api.js +364 -0
- package/dist/browser/modules/excel/chart/chart-builder.d.ts +48 -0
- package/dist/browser/modules/excel/chart/chart-builder.js +2432 -0
- package/dist/browser/modules/excel/chart/chart-ex-builder.d.ts +36 -0
- package/dist/browser/modules/excel/chart/chart-ex-builder.js +903 -0
- package/dist/browser/modules/excel/chart/chart-ex-parser.d.ts +8 -0
- package/dist/browser/modules/excel/chart/chart-ex-parser.js +1205 -0
- package/dist/browser/modules/excel/chart/chart-ex-renderer.d.ts +187 -0
- package/dist/browser/modules/excel/chart/chart-ex-renderer.js +5352 -0
- package/dist/browser/modules/excel/chart/chart-ex-types.d.ts +531 -0
- package/dist/browser/modules/excel/chart/chart-ex-types.js +11 -0
- package/dist/browser/modules/excel/chart/chart-images.d.ts +78 -0
- package/dist/browser/modules/excel/chart/chart-images.js +363 -0
- package/dist/browser/modules/excel/chart/chart-presets.d.ts +392 -0
- package/dist/browser/modules/excel/chart/chart-presets.js +179 -0
- package/dist/browser/modules/excel/chart/chart-renderer.d.ts +550 -0
- package/dist/browser/modules/excel/chart/chart-renderer.js +6440 -0
- package/dist/browser/modules/excel/chart/chart-sidecar.d.ts +21 -0
- package/dist/browser/modules/excel/chart/chart-sidecar.js +427 -0
- package/dist/browser/modules/excel/chart/chart-utils.d.ts +306 -0
- package/dist/browser/modules/excel/chart/chart-utils.js +821 -0
- package/dist/browser/modules/excel/chart/chart.d.ts +504 -0
- package/dist/browser/modules/excel/chart/chart.js +1320 -0
- package/dist/browser/modules/excel/chart/glyph-rasterizer.d.ts +62 -0
- package/dist/browser/modules/excel/chart/glyph-rasterizer.js +658 -0
- package/dist/browser/modules/excel/chart/index.d.ts +54 -0
- package/dist/browser/modules/excel/chart/index.js +46 -0
- package/dist/browser/modules/excel/chart/install.d.ts +44 -0
- package/dist/browser/modules/excel/chart/install.js +91 -0
- package/dist/browser/modules/excel/chart/shape-properties.d.ts +156 -0
- package/dist/browser/modules/excel/chart/shape-properties.js +1557 -0
- package/dist/browser/modules/excel/chart/stroke-font.d.ts +36 -0
- package/dist/browser/modules/excel/chart/stroke-font.js +1556 -0
- package/dist/browser/modules/excel/chart/topojson.d.ts +98 -0
- package/dist/browser/modules/excel/chart/topojson.js +236 -0
- package/dist/browser/modules/excel/chart/types.d.ts +2559 -0
- package/dist/browser/modules/excel/chart/types.js +8 -0
- package/dist/browser/modules/excel/chart-host-registry.d.ts +157 -0
- package/dist/browser/modules/excel/chart-host-registry.js +90 -0
- package/dist/browser/modules/excel/chartsheet.d.ts +102 -0
- package/dist/browser/modules/excel/chartsheet.js +196 -0
- package/dist/browser/modules/excel/defined-names.d.ts +35 -0
- package/dist/browser/modules/excel/defined-names.js +44 -4
- package/dist/browser/modules/excel/errors.d.ts +6 -0
- package/dist/browser/modules/excel/errors.js +9 -0
- package/dist/browser/modules/excel/form-control.d.ts +6 -0
- package/dist/browser/modules/excel/form-control.js +17 -0
- package/dist/browser/modules/excel/image.js +12 -2
- package/dist/browser/modules/excel/pivot-chart.d.ts +7 -0
- package/dist/browser/modules/excel/pivot-chart.js +53 -0
- package/dist/browser/modules/excel/pivot-table.d.ts +55 -0
- package/dist/browser/modules/excel/pivot-table.js +35 -0
- package/dist/browser/modules/excel/range.js +5 -1
- package/dist/browser/modules/excel/sparkline/index.d.ts +7 -0
- package/dist/browser/modules/excel/sparkline/index.js +7 -0
- package/dist/browser/modules/excel/sparkline/sparkline.d.ts +206 -0
- package/dist/browser/modules/excel/sparkline/sparkline.js +750 -0
- package/dist/browser/modules/excel/stream/worksheet-writer.js +3 -2
- package/dist/browser/modules/excel/table.js +42 -6
- package/dist/browser/modules/excel/types.d.ts +72 -0
- package/dist/browser/modules/excel/utils/address.d.ts +18 -0
- package/dist/browser/modules/excel/utils/address.js +28 -0
- package/dist/browser/modules/excel/utils/drawing-utils.js +11 -6
- package/dist/browser/modules/excel/utils/guid.d.ts +15 -0
- package/dist/browser/modules/excel/utils/guid.js +35 -0
- package/dist/browser/modules/excel/utils/ooxml-paths.d.ts +74 -0
- package/dist/browser/modules/excel/utils/ooxml-paths.js +206 -9
- package/dist/browser/modules/excel/utils/ooxml-validator/check-chart-sidecar.d.ts +35 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-chart-sidecar.js +101 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-chart.d.ts +32 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-chart.js +2125 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-chartsheet.d.ts +9 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-chartsheet.js +26 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-content-types.d.ts +16 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-content-types.js +181 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-drawing.d.ts +34 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-drawing.js +267 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-pivot.d.ts +14 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-pivot.js +104 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-relationships.d.ts +18 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-relationships.js +184 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-structure.d.ts +21 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-structure.js +56 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-styles.d.ts +15 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-styles.js +89 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-table.d.ts +31 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-table.js +177 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-workbook.d.ts +19 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-workbook.js +163 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-worksheet.d.ts +25 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/check-worksheet.js +569 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/context.d.ts +85 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/context.js +191 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/index.d.ts +31 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/index.js +102 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/path-utils.d.ts +67 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/path-utils.js +156 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/reporter.d.ts +41 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/reporter.js +61 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/types.d.ts +109 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/types.js +12 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/xml-utils.d.ts +38 -0
- package/dist/browser/modules/excel/utils/ooxml-validator/xml-utils.js +100 -0
- package/dist/browser/modules/excel/workbook.browser.d.ts +248 -30
- package/dist/browser/modules/excel/workbook.browser.js +966 -31
- package/dist/browser/modules/excel/workbook.d.ts +43 -0
- package/dist/browser/modules/excel/workbook.js +48 -0
- package/dist/browser/modules/excel/worksheet.d.ts +157 -3
- package/dist/browser/modules/excel/worksheet.js +394 -35
- package/dist/browser/modules/excel/xlsx/rel-type.d.ts +40 -0
- package/dist/browser/modules/excel/xlsx/rel-type.js +41 -1
- package/dist/browser/modules/excel/xlsx/xform/book/defined-name-xform.d.ts +1 -0
- package/dist/browser/modules/excel/xlsx/xform/book/defined-name-xform.js +11 -2
- package/dist/browser/modules/excel/xlsx/xform/book/external-link-xform.js +12 -10
- package/dist/browser/modules/excel/xlsx/xform/book/workbook-xform.js +96 -22
- package/dist/browser/modules/excel/xlsx/xform/chart/chart-space-xform.d.ts +353 -0
- package/dist/browser/modules/excel/xlsx/xform/chart/chart-space-xform.js +6000 -0
- package/dist/browser/modules/excel/xlsx/xform/comment/threaded-comments-xform.d.ts +60 -0
- package/dist/browser/modules/excel/xlsx/xform/comment/threaded-comments-xform.js +213 -0
- package/dist/browser/modules/excel/xlsx/xform/core/content-types-xform.js +150 -11
- package/dist/browser/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +20 -1
- package/dist/browser/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
- package/dist/browser/modules/excel/xlsx/xform/drawing/drawing-xform.d.ts +30 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/drawing-xform.js +109 -5
- package/dist/browser/modules/excel/xlsx/xform/drawing/graphic-frame-xform.d.ts +54 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/graphic-frame-xform.js +225 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.d.ts +3 -1
- package/dist/browser/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +18 -3
- package/dist/browser/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.d.ts +46 -0
- package/dist/browser/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +294 -12
- package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.d.ts +13 -2
- package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +32 -6
- package/dist/browser/modules/excel/xlsx/xform/sheet/chartsheet-xform.d.ts +185 -0
- package/dist/browser/modules/excel/xlsx/xform/sheet/chartsheet-xform.js +441 -0
- package/dist/browser/modules/excel/xlsx/xform/sheet/ext-lst-xform.d.ts +1 -0
- package/dist/browser/modules/excel/xlsx/xform/sheet/ext-lst-xform.js +51 -2
- package/dist/browser/modules/excel/xlsx/xform/sheet/worksheet-xform.js +196 -20
- package/dist/browser/modules/excel/xlsx/xform/table/auto-filter-xform.js +16 -1
- package/dist/browser/modules/excel/xlsx/xform/table/table-column-xform.js +17 -2
- package/dist/browser/modules/excel/xlsx/xform/xsd-values.d.ts +63 -0
- package/dist/browser/modules/excel/xlsx/xform/xsd-values.js +101 -0
- package/dist/browser/modules/excel/xlsx/xlsx.browser.d.ts +115 -21
- package/dist/browser/modules/excel/xlsx/xlsx.browser.js +4422 -78
- package/dist/browser/modules/pdf/builder/document-builder.d.ts +74 -0
- package/dist/browser/modules/pdf/builder/document-builder.js +507 -2
- package/dist/browser/modules/pdf/builder/pdf-editor.js +48 -3
- package/dist/browser/modules/pdf/excel-bridge.d.ts +69 -0
- package/dist/browser/modules/pdf/excel-bridge.js +683 -12
- package/dist/browser/modules/pdf/font/font-manager.d.ts +25 -0
- package/dist/browser/modules/pdf/font/font-manager.js +39 -0
- package/dist/browser/modules/pdf/index.d.ts +5 -2
- package/dist/browser/modules/pdf/index.js +3 -1
- package/dist/browser/modules/pdf/render/chart-surface.d.ts +33 -0
- package/dist/browser/modules/pdf/render/chart-surface.js +200 -0
- package/dist/browser/modules/pdf/render/layout-engine.d.ts +22 -1
- package/dist/browser/modules/pdf/render/layout-engine.js +436 -56
- package/dist/browser/modules/pdf/render/page-renderer.js +169 -28
- package/dist/browser/modules/pdf/render/pdf-exporter.js +117 -7
- package/dist/browser/modules/pdf/types.d.ts +227 -23
- package/dist/browser/modules/pdf/types.js +4 -0
- package/dist/browser/modules/pdf/word-bridge.d.ts +47 -0
- package/dist/browser/modules/pdf/word-bridge.js +304 -0
- package/dist/browser/modules/word/constants.d.ts +179 -0
- package/dist/browser/modules/word/constants.js +231 -0
- package/dist/browser/modules/word/content-types.d.ts +27 -0
- package/dist/browser/modules/word/content-types.js +53 -0
- package/dist/browser/modules/word/digital-signatures.d.ts +87 -0
- package/dist/browser/modules/word/digital-signatures.js +134 -0
- package/dist/browser/modules/word/document.d.ts +728 -0
- package/dist/browser/modules/word/document.js +1795 -0
- package/dist/browser/modules/word/docx-packager.d.ts +14 -0
- package/dist/browser/modules/word/docx-packager.js +822 -0
- package/dist/browser/modules/word/docx-reader.d.ts +11 -0
- package/dist/browser/modules/word/docx-reader.js +4929 -0
- package/dist/browser/modules/word/encryption.d.ts +102 -0
- package/dist/browser/modules/word/encryption.js +274 -0
- package/dist/browser/modules/word/errors.d.ts +49 -0
- package/dist/browser/modules/word/errors.js +68 -0
- package/dist/browser/modules/word/font-obfuscation.d.ts +31 -0
- package/dist/browser/modules/word/font-obfuscation.js +83 -0
- package/dist/browser/modules/word/html-renderer.d.ts +38 -0
- package/dist/browser/modules/word/html-renderer.js +782 -0
- package/dist/browser/modules/word/index.base.d.ts +19 -0
- package/dist/browser/modules/word/index.base.js +51 -0
- package/dist/browser/modules/word/index.browser.d.ts +4 -0
- package/dist/browser/modules/word/index.browser.js +4 -0
- package/dist/browser/modules/word/index.d.ts +4 -0
- package/dist/browser/modules/word/index.js +4 -0
- package/dist/browser/modules/word/internal-utils.d.ts +23 -0
- package/dist/browser/modules/word/internal-utils.js +54 -0
- package/dist/browser/modules/word/relationships.d.ts +31 -0
- package/dist/browser/modules/word/relationships.js +56 -0
- package/dist/browser/modules/word/types.d.ts +2325 -0
- package/dist/browser/modules/word/types.js +10 -0
- package/dist/browser/modules/word/units.d.ts +49 -0
- package/dist/browser/modules/word/units.js +111 -0
- package/dist/browser/modules/word/writers/chart-writer.d.ts +10 -0
- package/dist/browser/modules/word/writers/chart-writer.js +385 -0
- package/dist/browser/modules/word/writers/checkbox-writer.d.ts +9 -0
- package/dist/browser/modules/word/writers/checkbox-writer.js +42 -0
- package/dist/browser/modules/word/writers/comment-writer.d.ts +15 -0
- package/dist/browser/modules/word/writers/comment-writer.js +70 -0
- package/dist/browser/modules/word/writers/document-writer.d.ts +16 -0
- package/dist/browser/modules/word/writers/document-writer.js +461 -0
- package/dist/browser/modules/word/writers/footnote-writer.d.ts +11 -0
- package/dist/browser/modules/word/writers/footnote-writer.js +72 -0
- package/dist/browser/modules/word/writers/header-footer-writer.d.ts +13 -0
- package/dist/browser/modules/word/writers/header-footer-writer.js +129 -0
- package/dist/browser/modules/word/writers/image-writer.d.ts +10 -0
- package/dist/browser/modules/word/writers/image-writer.js +185 -0
- package/dist/browser/modules/word/writers/math-writer.d.ts +9 -0
- package/dist/browser/modules/word/writers/math-writer.js +428 -0
- package/dist/browser/modules/word/writers/numbering-writer.d.ts +10 -0
- package/dist/browser/modules/word/writers/numbering-writer.js +125 -0
- package/dist/browser/modules/word/writers/paragraph-writer.d.ts +13 -0
- package/dist/browser/modules/word/writers/paragraph-writer.js +516 -0
- package/dist/browser/modules/word/writers/parts-writer.d.ts +26 -0
- package/dist/browser/modules/word/writers/parts-writer.js +660 -0
- package/dist/browser/modules/word/writers/run-writer.d.ts +15 -0
- package/dist/browser/modules/word/writers/run-writer.js +649 -0
- package/dist/browser/modules/word/writers/section-writer.d.ts +10 -0
- package/dist/browser/modules/word/writers/section-writer.js +238 -0
- package/dist/browser/modules/word/writers/styles-writer.d.ts +10 -0
- package/dist/browser/modules/word/writers/styles-writer.js +242 -0
- package/dist/browser/modules/word/writers/table-writer.d.ts +10 -0
- package/dist/browser/modules/word/writers/table-writer.js +503 -0
- package/dist/browser/modules/word/writers/textbox-writer.d.ts +9 -0
- package/dist/browser/modules/word/writers/textbox-writer.js +53 -0
- package/dist/browser/modules/word/writers/toc-writer.d.ts +9 -0
- package/dist/browser/modules/word/writers/toc-writer.js +79 -0
- package/dist/browser/modules/xml/encode.d.ts +56 -7
- package/dist/browser/modules/xml/encode.js +157 -11
- package/dist/cjs/index.js +13 -2
- package/dist/cjs/modules/excel/chart/cache-populator.js +1178 -0
- package/dist/cjs/modules/excel/chart/chart-api.js +371 -0
- package/dist/cjs/modules/excel/chart/chart-builder.js +2440 -0
- package/dist/cjs/modules/excel/chart/chart-ex-builder.js +907 -0
- package/dist/cjs/modules/excel/chart/chart-ex-parser.js +1208 -0
- package/dist/cjs/modules/excel/chart/chart-ex-renderer.js +5364 -0
- package/dist/cjs/modules/excel/chart/chart-ex-types.js +12 -0
- package/dist/cjs/modules/excel/chart/chart-images.js +366 -0
- package/dist/cjs/modules/excel/chart/chart-presets.js +184 -0
- package/dist/cjs/modules/excel/chart/chart-renderer.js +6450 -0
- package/dist/cjs/modules/excel/chart/chart-sidecar.js +433 -0
- package/dist/cjs/modules/excel/chart/chart-utils.js +845 -0
- package/dist/cjs/modules/excel/chart/chart.js +1324 -0
- package/dist/cjs/modules/excel/chart/glyph-rasterizer.js +664 -0
- package/dist/cjs/modules/excel/chart/index.js +101 -0
- package/dist/cjs/modules/excel/chart/install.js +95 -0
- package/dist/cjs/modules/excel/chart/shape-properties.js +1577 -0
- package/dist/cjs/modules/excel/chart/stroke-font.js +1559 -0
- package/dist/cjs/modules/excel/chart/topojson.js +239 -0
- package/dist/cjs/modules/excel/chart/types.js +9 -0
- package/dist/cjs/modules/excel/chart-host-registry.js +96 -0
- package/dist/cjs/modules/excel/chartsheet.js +199 -0
- package/dist/cjs/modules/excel/defined-names.js +44 -4
- package/dist/cjs/modules/excel/errors.js +11 -1
- package/dist/cjs/modules/excel/form-control.js +17 -0
- package/dist/cjs/modules/excel/image.js +12 -2
- package/dist/cjs/modules/excel/pivot-chart.js +56 -0
- package/dist/cjs/modules/excel/pivot-table.js +35 -0
- package/dist/cjs/modules/excel/range.js +5 -1
- package/dist/cjs/modules/excel/sparkline/index.js +23 -0
- package/dist/cjs/modules/excel/sparkline/sparkline.js +756 -0
- package/dist/cjs/modules/excel/stream/worksheet-writer.js +3 -2
- package/dist/cjs/modules/excel/table.js +42 -6
- package/dist/cjs/modules/excel/utils/address.js +29 -0
- package/dist/cjs/modules/excel/utils/drawing-utils.js +11 -6
- package/dist/cjs/modules/excel/utils/guid.js +38 -0
- package/dist/cjs/modules/excel/utils/ooxml-paths.js +246 -9
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-chart-sidecar.js +103 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-chart.js +2128 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-chartsheet.js +29 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-content-types.js +184 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-drawing.js +270 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-pivot.js +107 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-relationships.js +188 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-structure.js +60 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-styles.js +92 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-table.js +180 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-workbook.js +166 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/check-worksheet.js +572 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/context.js +196 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/index.js +105 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/path-utils.js +168 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/reporter.js +66 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/types.js +13 -0
- package/dist/cjs/modules/excel/utils/ooxml-validator/xml-utils.js +110 -0
- package/dist/cjs/modules/excel/workbook.browser.js +973 -38
- package/dist/cjs/modules/excel/workbook.js +48 -0
- package/dist/cjs/modules/excel/worksheet.js +393 -34
- package/dist/cjs/modules/excel/xlsx/rel-type.js +41 -1
- package/dist/cjs/modules/excel/xlsx/xform/book/defined-name-xform.js +11 -2
- package/dist/cjs/modules/excel/xlsx/xform/book/external-link-xform.js +12 -10
- package/dist/cjs/modules/excel/xlsx/xform/book/workbook-xform.js +96 -22
- package/dist/cjs/modules/excel/xlsx/xform/chart/chart-space-xform.js +6003 -0
- package/dist/cjs/modules/excel/xlsx/xform/comment/threaded-comments-xform.js +219 -0
- package/dist/cjs/modules/excel/xlsx/xform/core/content-types-xform.js +149 -10
- package/dist/cjs/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +20 -1
- package/dist/cjs/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
- package/dist/cjs/modules/excel/xlsx/xform/drawing/drawing-xform.js +109 -5
- package/dist/cjs/modules/excel/xlsx/xform/drawing/graphic-frame-xform.js +228 -0
- package/dist/cjs/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +18 -3
- package/dist/cjs/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +294 -12
- package/dist/cjs/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +32 -6
- package/dist/cjs/modules/excel/xlsx/xform/sheet/chartsheet-xform.js +444 -0
- package/dist/cjs/modules/excel/xlsx/xform/sheet/ext-lst-xform.js +51 -2
- package/dist/cjs/modules/excel/xlsx/xform/sheet/worksheet-xform.js +195 -19
- package/dist/cjs/modules/excel/xlsx/xform/table/auto-filter-xform.js +16 -1
- package/dist/cjs/modules/excel/xlsx/xform/table/table-column-xform.js +17 -2
- package/dist/cjs/modules/excel/xlsx/xform/xsd-values.js +106 -0
- package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +4420 -76
- package/dist/cjs/modules/pdf/builder/document-builder.js +506 -1
- package/dist/cjs/modules/pdf/builder/pdf-editor.js +48 -3
- package/dist/cjs/modules/pdf/excel-bridge.js +684 -12
- package/dist/cjs/modules/pdf/font/font-manager.js +39 -0
- package/dist/cjs/modules/pdf/index.js +5 -1
- package/dist/cjs/modules/pdf/render/chart-surface.js +203 -0
- package/dist/cjs/modules/pdf/render/layout-engine.js +437 -56
- package/dist/cjs/modules/pdf/render/page-renderer.js +169 -28
- package/dist/cjs/modules/pdf/render/pdf-exporter.js +115 -5
- package/dist/cjs/modules/pdf/types.js +5 -0
- package/dist/cjs/modules/pdf/word-bridge.js +307 -0
- package/dist/cjs/modules/word/constants.js +234 -0
- package/dist/cjs/modules/word/content-types.js +57 -0
- package/dist/cjs/modules/word/digital-signatures.js +140 -0
- package/dist/cjs/modules/word/document.js +1909 -0
- package/dist/cjs/modules/word/docx-packager.js +825 -0
- package/dist/cjs/modules/word/docx-reader.js +4932 -0
- package/dist/cjs/modules/word/encryption.js +282 -0
- package/dist/cjs/modules/word/errors.js +88 -0
- package/dist/cjs/modules/word/font-obfuscation.js +88 -0
- package/dist/cjs/modules/word/html-renderer.js +785 -0
- package/dist/cjs/modules/word/index.base.js +199 -0
- package/dist/cjs/modules/word/index.browser.js +20 -0
- package/dist/cjs/modules/word/index.js +20 -0
- package/dist/cjs/modules/word/internal-utils.js +59 -0
- package/dist/cjs/modules/word/relationships.js +60 -0
- package/dist/cjs/modules/word/types.js +11 -0
- package/dist/cjs/modules/word/units.js +135 -0
- package/dist/cjs/modules/word/writers/chart-writer.js +388 -0
- package/dist/cjs/modules/word/writers/checkbox-writer.js +45 -0
- package/dist/cjs/modules/word/writers/comment-writer.js +74 -0
- package/dist/cjs/modules/word/writers/document-writer.js +465 -0
- package/dist/cjs/modules/word/writers/footnote-writer.js +76 -0
- package/dist/cjs/modules/word/writers/header-footer-writer.js +134 -0
- package/dist/cjs/modules/word/writers/image-writer.js +188 -0
- package/dist/cjs/modules/word/writers/math-writer.js +431 -0
- package/dist/cjs/modules/word/writers/numbering-writer.js +128 -0
- package/dist/cjs/modules/word/writers/paragraph-writer.js +521 -0
- package/dist/cjs/modules/word/writers/parts-writer.js +671 -0
- package/dist/cjs/modules/word/writers/run-writer.js +655 -0
- package/dist/cjs/modules/word/writers/section-writer.js +241 -0
- package/dist/cjs/modules/word/writers/styles-writer.js +245 -0
- package/dist/cjs/modules/word/writers/table-writer.js +506 -0
- package/dist/cjs/modules/word/writers/textbox-writer.js +56 -0
- package/dist/cjs/modules/word/writers/toc-writer.js +82 -0
- package/dist/cjs/modules/xml/encode.js +158 -11
- package/dist/esm/index.browser.js +20 -2
- package/dist/esm/index.js +9 -1
- package/dist/esm/modules/excel/chart/cache-populator.js +1171 -0
- package/dist/esm/modules/excel/chart/chart-api.js +364 -0
- package/dist/esm/modules/excel/chart/chart-builder.js +2432 -0
- package/dist/esm/modules/excel/chart/chart-ex-builder.js +903 -0
- package/dist/esm/modules/excel/chart/chart-ex-parser.js +1205 -0
- package/dist/esm/modules/excel/chart/chart-ex-renderer.js +5352 -0
- package/dist/esm/modules/excel/chart/chart-ex-types.js +11 -0
- package/dist/esm/modules/excel/chart/chart-images.js +363 -0
- package/dist/esm/modules/excel/chart/chart-presets.js +179 -0
- package/dist/esm/modules/excel/chart/chart-renderer.js +6440 -0
- package/dist/esm/modules/excel/chart/chart-sidecar.js +427 -0
- package/dist/esm/modules/excel/chart/chart-utils.js +821 -0
- package/dist/esm/modules/excel/chart/chart.js +1320 -0
- package/dist/esm/modules/excel/chart/glyph-rasterizer.js +658 -0
- package/dist/esm/modules/excel/chart/index.js +46 -0
- package/dist/esm/modules/excel/chart/install.js +91 -0
- package/dist/esm/modules/excel/chart/shape-properties.js +1557 -0
- package/dist/esm/modules/excel/chart/stroke-font.js +1556 -0
- package/dist/esm/modules/excel/chart/topojson.js +236 -0
- package/dist/esm/modules/excel/chart/types.js +8 -0
- package/dist/esm/modules/excel/chart-host-registry.js +90 -0
- package/dist/esm/modules/excel/chartsheet.js +196 -0
- package/dist/esm/modules/excel/defined-names.js +44 -4
- package/dist/esm/modules/excel/errors.js +9 -0
- package/dist/esm/modules/excel/form-control.js +17 -0
- package/dist/esm/modules/excel/image.js +12 -2
- package/dist/esm/modules/excel/pivot-chart.js +53 -0
- package/dist/esm/modules/excel/pivot-table.js +35 -0
- package/dist/esm/modules/excel/range.js +5 -1
- package/dist/esm/modules/excel/sparkline/index.js +7 -0
- package/dist/esm/modules/excel/sparkline/sparkline.js +750 -0
- package/dist/esm/modules/excel/stream/worksheet-writer.js +3 -2
- package/dist/esm/modules/excel/table.js +42 -6
- package/dist/esm/modules/excel/utils/address.js +28 -0
- package/dist/esm/modules/excel/utils/drawing-utils.js +11 -6
- package/dist/esm/modules/excel/utils/guid.js +35 -0
- package/dist/esm/modules/excel/utils/ooxml-paths.js +206 -9
- package/dist/esm/modules/excel/utils/ooxml-validator/check-chart-sidecar.js +101 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-chart.js +2125 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-chartsheet.js +26 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-content-types.js +181 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-drawing.js +267 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-pivot.js +104 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-relationships.js +184 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-structure.js +56 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-styles.js +89 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-table.js +177 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-workbook.js +163 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/check-worksheet.js +569 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/context.js +191 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/index.js +102 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/path-utils.js +156 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/reporter.js +61 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/types.js +12 -0
- package/dist/esm/modules/excel/utils/ooxml-validator/xml-utils.js +100 -0
- package/dist/esm/modules/excel/workbook.browser.js +969 -34
- package/dist/esm/modules/excel/workbook.js +48 -0
- package/dist/esm/modules/excel/worksheet.js +394 -35
- package/dist/esm/modules/excel/xlsx/rel-type.js +41 -1
- package/dist/esm/modules/excel/xlsx/xform/book/defined-name-xform.js +11 -2
- package/dist/esm/modules/excel/xlsx/xform/book/external-link-xform.js +12 -10
- package/dist/esm/modules/excel/xlsx/xform/book/workbook-xform.js +96 -22
- package/dist/esm/modules/excel/xlsx/xform/chart/chart-space-xform.js +6000 -0
- package/dist/esm/modules/excel/xlsx/xform/comment/threaded-comments-xform.js +213 -0
- package/dist/esm/modules/excel/xlsx/xform/core/content-types-xform.js +150 -11
- package/dist/esm/modules/excel/xlsx/xform/drawing/absolute-anchor-xform.js +20 -1
- package/dist/esm/modules/excel/xlsx/xform/drawing/base-cell-anchor-xform.js +1 -1
- package/dist/esm/modules/excel/xlsx/xform/drawing/drawing-xform.js +109 -5
- package/dist/esm/modules/excel/xlsx/xform/drawing/graphic-frame-xform.js +225 -0
- package/dist/esm/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.js +18 -3
- package/dist/esm/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +294 -12
- package/dist/esm/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +32 -6
- package/dist/esm/modules/excel/xlsx/xform/sheet/chartsheet-xform.js +441 -0
- package/dist/esm/modules/excel/xlsx/xform/sheet/ext-lst-xform.js +51 -2
- package/dist/esm/modules/excel/xlsx/xform/sheet/worksheet-xform.js +196 -20
- package/dist/esm/modules/excel/xlsx/xform/table/auto-filter-xform.js +16 -1
- package/dist/esm/modules/excel/xlsx/xform/table/table-column-xform.js +17 -2
- package/dist/esm/modules/excel/xlsx/xform/xsd-values.js +101 -0
- package/dist/esm/modules/excel/xlsx/xlsx.browser.js +4422 -78
- package/dist/esm/modules/pdf/builder/document-builder.js +507 -2
- package/dist/esm/modules/pdf/builder/pdf-editor.js +48 -3
- package/dist/esm/modules/pdf/excel-bridge.js +683 -12
- package/dist/esm/modules/pdf/font/font-manager.js +39 -0
- package/dist/esm/modules/pdf/index.js +3 -1
- package/dist/esm/modules/pdf/render/chart-surface.js +200 -0
- package/dist/esm/modules/pdf/render/layout-engine.js +436 -56
- package/dist/esm/modules/pdf/render/page-renderer.js +169 -28
- package/dist/esm/modules/pdf/render/pdf-exporter.js +117 -7
- package/dist/esm/modules/pdf/types.js +4 -0
- package/dist/esm/modules/pdf/word-bridge.js +304 -0
- package/dist/esm/modules/word/constants.js +231 -0
- package/dist/esm/modules/word/content-types.js +53 -0
- package/dist/esm/modules/word/digital-signatures.js +134 -0
- package/dist/esm/modules/word/document.js +1795 -0
- package/dist/esm/modules/word/docx-packager.js +822 -0
- package/dist/esm/modules/word/docx-reader.js +4929 -0
- package/dist/esm/modules/word/encryption.js +274 -0
- package/dist/esm/modules/word/errors.js +68 -0
- package/dist/esm/modules/word/font-obfuscation.js +83 -0
- package/dist/esm/modules/word/html-renderer.js +782 -0
- package/dist/esm/modules/word/index.base.js +51 -0
- package/dist/esm/modules/word/index.browser.js +4 -0
- package/dist/esm/modules/word/index.js +4 -0
- package/dist/esm/modules/word/internal-utils.js +54 -0
- package/dist/esm/modules/word/relationships.js +56 -0
- package/dist/esm/modules/word/types.js +10 -0
- package/dist/esm/modules/word/units.js +111 -0
- package/dist/esm/modules/word/writers/chart-writer.js +385 -0
- package/dist/esm/modules/word/writers/checkbox-writer.js +42 -0
- package/dist/esm/modules/word/writers/comment-writer.js +70 -0
- package/dist/esm/modules/word/writers/document-writer.js +461 -0
- package/dist/esm/modules/word/writers/footnote-writer.js +72 -0
- package/dist/esm/modules/word/writers/header-footer-writer.js +129 -0
- package/dist/esm/modules/word/writers/image-writer.js +185 -0
- package/dist/esm/modules/word/writers/math-writer.js +428 -0
- package/dist/esm/modules/word/writers/numbering-writer.js +125 -0
- package/dist/esm/modules/word/writers/paragraph-writer.js +516 -0
- package/dist/esm/modules/word/writers/parts-writer.js +660 -0
- package/dist/esm/modules/word/writers/run-writer.js +649 -0
- package/dist/esm/modules/word/writers/section-writer.js +238 -0
- package/dist/esm/modules/word/writers/styles-writer.js +242 -0
- package/dist/esm/modules/word/writers/table-writer.js +503 -0
- package/dist/esm/modules/word/writers/textbox-writer.js +53 -0
- package/dist/esm/modules/word/writers/toc-writer.js +79 -0
- package/dist/esm/modules/xml/encode.js +157 -11
- package/dist/iife/excelts.iife.js +11789 -687
- package/dist/iife/excelts.iife.js.map +1 -1
- package/dist/iife/excelts.iife.min.js +52 -44
- package/dist/types/index.browser.d.ts +8 -5
- package/dist/types/index.d.ts +4 -2
- package/dist/types/modules/excel/chart/cache-populator.d.ts +49 -0
- package/dist/types/modules/excel/chart/chart-api.d.ts +92 -0
- package/dist/types/modules/excel/chart/chart-builder.d.ts +48 -0
- package/dist/types/modules/excel/chart/chart-ex-builder.d.ts +36 -0
- package/dist/types/modules/excel/chart/chart-ex-parser.d.ts +8 -0
- package/dist/types/modules/excel/chart/chart-ex-renderer.d.ts +187 -0
- package/dist/types/modules/excel/chart/chart-ex-types.d.ts +531 -0
- package/dist/types/modules/excel/chart/chart-images.d.ts +78 -0
- package/dist/types/modules/excel/chart/chart-presets.d.ts +392 -0
- package/dist/types/modules/excel/chart/chart-renderer.d.ts +550 -0
- package/dist/types/modules/excel/chart/chart-sidecar.d.ts +21 -0
- package/dist/types/modules/excel/chart/chart-utils.d.ts +306 -0
- package/dist/types/modules/excel/chart/chart.d.ts +504 -0
- package/dist/types/modules/excel/chart/glyph-rasterizer.d.ts +62 -0
- package/dist/types/modules/excel/chart/index.d.ts +54 -0
- package/dist/types/modules/excel/chart/install.d.ts +44 -0
- package/dist/types/modules/excel/chart/shape-properties.d.ts +156 -0
- package/dist/types/modules/excel/chart/stroke-font.d.ts +36 -0
- package/dist/types/modules/excel/chart/topojson.d.ts +98 -0
- package/dist/types/modules/excel/chart/types.d.ts +2559 -0
- package/dist/types/modules/excel/chart-host-registry.d.ts +157 -0
- package/dist/types/modules/excel/chartsheet.d.ts +102 -0
- package/dist/types/modules/excel/defined-names.d.ts +35 -0
- package/dist/types/modules/excel/errors.d.ts +6 -0
- package/dist/types/modules/excel/form-control.d.ts +6 -0
- package/dist/types/modules/excel/pivot-chart.d.ts +7 -0
- package/dist/types/modules/excel/pivot-table.d.ts +55 -0
- package/dist/types/modules/excel/sparkline/index.d.ts +7 -0
- package/dist/types/modules/excel/sparkline/sparkline.d.ts +206 -0
- package/dist/types/modules/excel/types.d.ts +72 -0
- package/dist/types/modules/excel/utils/address.d.ts +18 -0
- package/dist/types/modules/excel/utils/guid.d.ts +15 -0
- package/dist/types/modules/excel/utils/ooxml-paths.d.ts +74 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-chart-sidecar.d.ts +35 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-chart.d.ts +32 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-chartsheet.d.ts +9 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-content-types.d.ts +16 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-drawing.d.ts +34 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-pivot.d.ts +14 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-relationships.d.ts +18 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-structure.d.ts +21 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-styles.d.ts +15 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-table.d.ts +31 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-workbook.d.ts +19 -0
- package/dist/types/modules/excel/utils/ooxml-validator/check-worksheet.d.ts +25 -0
- package/dist/types/modules/excel/utils/ooxml-validator/context.d.ts +85 -0
- package/dist/types/modules/excel/utils/ooxml-validator/index.d.ts +31 -0
- package/dist/types/modules/excel/utils/ooxml-validator/path-utils.d.ts +67 -0
- package/dist/types/modules/excel/utils/ooxml-validator/reporter.d.ts +41 -0
- package/dist/types/modules/excel/utils/ooxml-validator/types.d.ts +109 -0
- package/dist/types/modules/excel/utils/ooxml-validator/xml-utils.d.ts +38 -0
- package/dist/types/modules/excel/workbook.browser.d.ts +248 -30
- package/dist/types/modules/excel/workbook.d.ts +43 -0
- package/dist/types/modules/excel/worksheet.d.ts +157 -3
- package/dist/types/modules/excel/xlsx/rel-type.d.ts +40 -0
- package/dist/types/modules/excel/xlsx/xform/book/defined-name-xform.d.ts +1 -0
- package/dist/types/modules/excel/xlsx/xform/chart/chart-space-xform.d.ts +353 -0
- package/dist/types/modules/excel/xlsx/xform/comment/threaded-comments-xform.d.ts +60 -0
- package/dist/types/modules/excel/xlsx/xform/drawing/drawing-xform.d.ts +30 -0
- package/dist/types/modules/excel/xlsx/xform/drawing/graphic-frame-xform.d.ts +54 -0
- package/dist/types/modules/excel/xlsx/xform/drawing/one-cell-anchor-xform.d.ts +3 -1
- package/dist/types/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.d.ts +46 -0
- package/dist/types/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.d.ts +13 -2
- package/dist/types/modules/excel/xlsx/xform/sheet/chartsheet-xform.d.ts +185 -0
- package/dist/types/modules/excel/xlsx/xform/sheet/ext-lst-xform.d.ts +1 -0
- package/dist/types/modules/excel/xlsx/xform/xsd-values.d.ts +63 -0
- package/dist/types/modules/excel/xlsx/xlsx.browser.d.ts +115 -21
- package/dist/types/modules/pdf/builder/document-builder.d.ts +74 -0
- package/dist/types/modules/pdf/excel-bridge.d.ts +69 -0
- package/dist/types/modules/pdf/font/font-manager.d.ts +25 -0
- package/dist/types/modules/pdf/index.d.ts +5 -2
- package/dist/types/modules/pdf/render/chart-surface.d.ts +33 -0
- package/dist/types/modules/pdf/render/layout-engine.d.ts +22 -1
- package/dist/types/modules/pdf/types.d.ts +227 -23
- package/dist/types/modules/pdf/word-bridge.d.ts +47 -0
- package/dist/types/modules/word/constants.d.ts +179 -0
- package/dist/types/modules/word/content-types.d.ts +27 -0
- package/dist/types/modules/word/digital-signatures.d.ts +87 -0
- package/dist/types/modules/word/document.d.ts +728 -0
- package/dist/types/modules/word/docx-packager.d.ts +14 -0
- package/dist/types/modules/word/docx-reader.d.ts +11 -0
- package/dist/types/modules/word/encryption.d.ts +102 -0
- package/dist/types/modules/word/errors.d.ts +49 -0
- package/dist/types/modules/word/font-obfuscation.d.ts +31 -0
- package/dist/types/modules/word/html-renderer.d.ts +38 -0
- package/dist/types/modules/word/index.base.d.ts +19 -0
- package/dist/types/modules/word/index.browser.d.ts +4 -0
- package/dist/types/modules/word/index.d.ts +4 -0
- package/dist/types/modules/word/internal-utils.d.ts +23 -0
- package/dist/types/modules/word/relationships.d.ts +31 -0
- package/dist/types/modules/word/types.d.ts +2325 -0
- package/dist/types/modules/word/units.d.ts +49 -0
- package/dist/types/modules/word/writers/chart-writer.d.ts +10 -0
- package/dist/types/modules/word/writers/checkbox-writer.d.ts +9 -0
- package/dist/types/modules/word/writers/comment-writer.d.ts +15 -0
- package/dist/types/modules/word/writers/document-writer.d.ts +16 -0
- package/dist/types/modules/word/writers/footnote-writer.d.ts +11 -0
- package/dist/types/modules/word/writers/header-footer-writer.d.ts +13 -0
- package/dist/types/modules/word/writers/image-writer.d.ts +10 -0
- package/dist/types/modules/word/writers/math-writer.d.ts +9 -0
- package/dist/types/modules/word/writers/numbering-writer.d.ts +10 -0
- package/dist/types/modules/word/writers/paragraph-writer.d.ts +13 -0
- package/dist/types/modules/word/writers/parts-writer.d.ts +26 -0
- package/dist/types/modules/word/writers/run-writer.d.ts +15 -0
- package/dist/types/modules/word/writers/section-writer.d.ts +10 -0
- package/dist/types/modules/word/writers/styles-writer.d.ts +10 -0
- package/dist/types/modules/word/writers/table-writer.d.ts +10 -0
- package/dist/types/modules/word/writers/textbox-writer.d.ts +9 -0
- package/dist/types/modules/word/writers/toc-writer.d.ts +9 -0
- package/dist/types/modules/xml/encode.d.ts +56 -7
- package/package.json +29 -11
- package/dist/browser/modules/excel/utils/ooxml-validator.d.ts +0 -48
- package/dist/browser/modules/excel/utils/ooxml-validator.js +0 -493
- package/dist/browser/modules/excel/utils/passthrough-manager.d.ts +0 -77
- package/dist/browser/modules/excel/utils/passthrough-manager.js +0 -129
- package/dist/cjs/modules/excel/utils/ooxml-validator.js +0 -499
- package/dist/cjs/modules/excel/utils/passthrough-manager.js +0 -133
- package/dist/esm/modules/excel/utils/ooxml-validator.js +0 -493
- package/dist/esm/modules/excel/utils/passthrough-manager.js +0 -129
- package/dist/types/modules/excel/utils/ooxml-validator.d.ts +0 -48
- package/dist/types/modules/excel/utils/passthrough-manager.d.ts +0 -77
|
@@ -61,6 +61,7 @@ const pdf_stream_1 = require("../core/pdf-stream");
|
|
|
61
61
|
const pdf_writer_1 = require("../core/pdf-writer");
|
|
62
62
|
const pdfa_1 = require("../core/pdfa");
|
|
63
63
|
const font_manager_1 = require("../font/font-manager");
|
|
64
|
+
const system_fonts_1 = require("../font/system-fonts");
|
|
64
65
|
const ttf_parser_1 = require("../font/ttf-parser");
|
|
65
66
|
const page_renderer_1 = require("../render/page-renderer");
|
|
66
67
|
const image_utils_1 = require("./image-utils");
|
|
@@ -94,6 +95,15 @@ class PdfPageBuilder {
|
|
|
94
95
|
this._builderAnnotations = [];
|
|
95
96
|
/** @internal */
|
|
96
97
|
this._formFields = [];
|
|
98
|
+
/**
|
|
99
|
+
* Alpha values < 1 encountered during painting; each is materialised as
|
|
100
|
+
* one `/ExtGState` object in the page resource dictionary and applied
|
|
101
|
+
* via `setGraphicsState` before the corresponding colour draw. Empty
|
|
102
|
+
* set = no ExtGState entry needed in Resources (keeps the common
|
|
103
|
+
* opacity-1 case byte-identical with the pre-alpha implementation).
|
|
104
|
+
* @internal
|
|
105
|
+
*/
|
|
106
|
+
this._alphaValues = new Set();
|
|
97
107
|
this._width = width;
|
|
98
108
|
this._height = height;
|
|
99
109
|
this._fontManager = fontManager;
|
|
@@ -126,12 +136,24 @@ class PdfPageBuilder {
|
|
|
126
136
|
const resourceName = this._fontManager.resolveFont(fontFamily, bold, italic);
|
|
127
137
|
this._fontManager.trackText(text);
|
|
128
138
|
const useType3 = this._fontManager.hasType3Fonts() && !this._fontManager.hasEmbeddedFont();
|
|
139
|
+
// Resolve anchor into an adjusted x before any matrix math. We use the
|
|
140
|
+
// same font/size combination the stream will render with, so the
|
|
141
|
+
// alignment is correct for the actual glyphs (not a fallback
|
|
142
|
+
// estimate). Single-line drawing only — wrapped text ignores anchor
|
|
143
|
+
// because the wrapper re-splits by the caller's supplied x.
|
|
144
|
+
const anchor = options.anchor ?? "start";
|
|
145
|
+
const resolvedX = anchor === "start" || options.maxWidth
|
|
146
|
+
? options.x
|
|
147
|
+
: options.x -
|
|
148
|
+
this._fontManager.measureText(text, resourceName, fontSize) *
|
|
149
|
+
(anchor === "middle" ? 0.5 : 1);
|
|
129
150
|
if (options.maxWidth) {
|
|
130
151
|
// Word-wrap (reuses the shared wrapTextLines from page-renderer)
|
|
131
152
|
const measure = (s) => this._fontManager.measureText(s, resourceName, fontSize);
|
|
132
153
|
const lines = (0, page_renderer_1.wrapTextLines)(text, measure, options.maxWidth);
|
|
133
154
|
const leading = fontSize * lineHeightFactor;
|
|
134
155
|
this._stream.save();
|
|
156
|
+
this._applyAlpha(color.a);
|
|
135
157
|
this._stream.setFillColor(color);
|
|
136
158
|
for (let i = 0; i < lines.length; i++) {
|
|
137
159
|
const lineY = options.y - i * leading;
|
|
@@ -142,8 +164,22 @@ class PdfPageBuilder {
|
|
|
142
164
|
else {
|
|
143
165
|
// Single line
|
|
144
166
|
this._stream.save();
|
|
167
|
+
this._applyAlpha(color.a);
|
|
145
168
|
this._stream.setFillColor(color);
|
|
146
|
-
|
|
169
|
+
const rotation = options.rotation ?? 0;
|
|
170
|
+
if (rotation === 0) {
|
|
171
|
+
(0, page_renderer_1.emitTextWithMatrix)(this._stream, text, 1, 0, 0, 1, resolvedX, options.y, resourceName, fontSize, this._fontManager, useType3);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
// Build the rotation matrix around (x, y). `emitTextWithMatrix`
|
|
175
|
+
// accepts the full 2×3 text matrix, so we pre-multiply the
|
|
176
|
+
// rotation with the translation so one call positions and
|
|
177
|
+
// rotates the glyph sequence in a single Tm op.
|
|
178
|
+
const theta = (rotation * Math.PI) / 180;
|
|
179
|
+
const cos = Math.cos(theta);
|
|
180
|
+
const sin = Math.sin(theta);
|
|
181
|
+
(0, page_renderer_1.emitTextWithMatrix)(this._stream, text, cos, sin, -sin, cos, resolvedX, options.y, resourceName, fontSize, this._fontManager, useType3);
|
|
182
|
+
}
|
|
147
183
|
this._stream.restore();
|
|
148
184
|
}
|
|
149
185
|
return this;
|
|
@@ -204,6 +240,7 @@ class PdfPageBuilder {
|
|
|
204
240
|
const color = options.color ?? BLACK;
|
|
205
241
|
const lineWidth = options.lineWidth ?? 1;
|
|
206
242
|
this._stream.save();
|
|
243
|
+
this._applyAlpha(color.a);
|
|
207
244
|
this._stream.setStrokeColor(color);
|
|
208
245
|
this._stream.setLineWidth(lineWidth);
|
|
209
246
|
if (options.dashPattern && options.dashPattern.length > 0) {
|
|
@@ -378,6 +415,93 @@ class PdfPageBuilder {
|
|
|
378
415
|
const ops = parseSvgPath(d);
|
|
379
416
|
return this.drawPath(ops, options);
|
|
380
417
|
}
|
|
418
|
+
/**
|
|
419
|
+
* Draw a simple SVG document onto this page.
|
|
420
|
+
*
|
|
421
|
+
* Supports the SVG primitives emitted by ExcelTS chart rendering:
|
|
422
|
+
* `rect`, `line`, `circle`, `polyline`, `polygon`, `path`, and `text`.
|
|
423
|
+
*/
|
|
424
|
+
drawSvg(options) {
|
|
425
|
+
const parsed = parseSimpleSvg(options.svg);
|
|
426
|
+
const scaleX = (options.width ?? parsed.width) / parsed.width;
|
|
427
|
+
const scaleY = (options.height ?? parsed.height) / parsed.height;
|
|
428
|
+
const mapX = (x) => options.x + x * scaleX;
|
|
429
|
+
const mapY = (y) => options.y + (options.height ?? parsed.height) - y * scaleY;
|
|
430
|
+
// `opacity` applies to both fill and stroke per SVG spec; multiply it
|
|
431
|
+
// in alongside the channel-specific `fill-opacity` / `stroke-opacity`
|
|
432
|
+
// so every SVG form authors emit (inline rgba, channel opacity, or
|
|
433
|
+
// element-wide opacity) ends up driving `/ExtGState` consistently.
|
|
434
|
+
const fillColor = (attrs) => {
|
|
435
|
+
const base = attrs.fill ? svgColorToPdf(attrs.fill) : undefined;
|
|
436
|
+
return withSvgOpacity(withSvgOpacity(base, attrs["fill-opacity"]), attrs.opacity);
|
|
437
|
+
};
|
|
438
|
+
const strokeColor = (attrs) => {
|
|
439
|
+
const base = attrs.stroke ? svgColorToPdf(attrs.stroke) : undefined;
|
|
440
|
+
return withSvgOpacity(withSvgOpacity(base, attrs["stroke-opacity"]), attrs.opacity);
|
|
441
|
+
};
|
|
442
|
+
for (const element of parsed.elements) {
|
|
443
|
+
if (element.name === "rect") {
|
|
444
|
+
const rectWidth = lengthAttr(element, "width", parsed.width, 0);
|
|
445
|
+
const rectHeight = lengthAttr(element, "height", parsed.height, 0);
|
|
446
|
+
this.drawRect({
|
|
447
|
+
x: mapX(lengthAttr(element, "x", parsed.width, 0)),
|
|
448
|
+
y: mapY(lengthAttr(element, "y", parsed.height, 0) + rectHeight),
|
|
449
|
+
width: rectWidth * scaleX,
|
|
450
|
+
height: rectHeight * scaleY,
|
|
451
|
+
fill: fillColor(element.attrs),
|
|
452
|
+
stroke: strokeColor(element.attrs)
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
else if (element.name === "line") {
|
|
456
|
+
this.drawLine({
|
|
457
|
+
x1: mapX(numAttr(element, "x1", 0)),
|
|
458
|
+
y1: mapY(numAttr(element, "y1", 0)),
|
|
459
|
+
x2: mapX(numAttr(element, "x2", 0)),
|
|
460
|
+
y2: mapY(numAttr(element, "y2", 0)),
|
|
461
|
+
color: strokeColor(element.attrs)
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
else if (element.name === "circle") {
|
|
465
|
+
this.drawCircle({
|
|
466
|
+
cx: mapX(numAttr(element, "cx", 0)),
|
|
467
|
+
cy: mapY(numAttr(element, "cy", 0)),
|
|
468
|
+
r: numAttr(element, "r", 0) * Math.max(scaleX, scaleY),
|
|
469
|
+
fill: fillColor(element.attrs),
|
|
470
|
+
stroke: strokeColor(element.attrs)
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
else if (element.name === "polyline" || element.name === "polygon") {
|
|
474
|
+
const ops = svgPointsToPath(element.attrs.points ?? "", element.name === "polygon").map(op => transformPathOp(op, mapX, mapY));
|
|
475
|
+
const stroke = strokeColor(element.attrs) ?? (element.name === "polyline" ? BLACK : undefined);
|
|
476
|
+
this.drawPath(ops, {
|
|
477
|
+
fill: element.name === "polygon" ? fillColor(element.attrs) : undefined,
|
|
478
|
+
stroke,
|
|
479
|
+
closePath: element.name === "polygon"
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
else if (element.name === "path" && element.attrs.d) {
|
|
483
|
+
const ops = parseSvgPath(element.attrs.d).map(op => transformPathOp(op, mapX, mapY));
|
|
484
|
+
const fill = fillColor(element.attrs);
|
|
485
|
+
const stroke = strokeColor(element.attrs);
|
|
486
|
+
if (!fill && !stroke) {
|
|
487
|
+
continue;
|
|
488
|
+
}
|
|
489
|
+
this.drawPath(ops, {
|
|
490
|
+
fill,
|
|
491
|
+
stroke
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
else if (element.name === "text") {
|
|
495
|
+
this.drawText(xmlDecodeBasic(element.text), {
|
|
496
|
+
x: mapX(numAttr(element, "x", 0)),
|
|
497
|
+
y: mapY(numAttr(element, "y", 0)),
|
|
498
|
+
fontSize: numAttr(element, "font-size", 12) * Math.max(scaleX, scaleY),
|
|
499
|
+
color: fillColor(element.attrs)
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
return this;
|
|
504
|
+
}
|
|
381
505
|
// ===========================================================================
|
|
382
506
|
// Raw content stream access
|
|
383
507
|
// ===========================================================================
|
|
@@ -395,6 +519,18 @@ class PdfPageBuilder {
|
|
|
395
519
|
_paintPath(fill, stroke, lineWidth) {
|
|
396
520
|
const hasFill = fill !== undefined;
|
|
397
521
|
const hasStroke = stroke !== undefined;
|
|
522
|
+
// Apply alpha ExtGState before setting colours. `_paintPath` callers
|
|
523
|
+
// all wrap this in save()/restore(), so the graphics state mutation is
|
|
524
|
+
// local to this path. When fill and stroke carry different alphas,
|
|
525
|
+
// the second `setGraphicsState` overrides the first — this matches
|
|
526
|
+
// pdf-exporter's behaviour and real-world use (alpha parity across
|
|
527
|
+
// fill/stroke for the same object is overwhelmingly common).
|
|
528
|
+
if (hasFill) {
|
|
529
|
+
this._applyAlpha(fill.a);
|
|
530
|
+
}
|
|
531
|
+
if (hasStroke) {
|
|
532
|
+
this._applyAlpha(stroke.a);
|
|
533
|
+
}
|
|
398
534
|
if (hasFill) {
|
|
399
535
|
this._stream.setFillColor(fill);
|
|
400
536
|
}
|
|
@@ -418,6 +554,27 @@ class PdfPageBuilder {
|
|
|
418
554
|
this._stream.stroke();
|
|
419
555
|
}
|
|
420
556
|
}
|
|
557
|
+
/**
|
|
558
|
+
* Register a colour alpha on this page so `build()` can emit the
|
|
559
|
+
* matching `<< /Type /ExtGState /ca n /CA n >>` resource, and issue
|
|
560
|
+
* the content-stream `gs` operator pointing at that resource. `alpha
|
|
561
|
+
* === undefined` or `alpha >= 1` is a no-op, so opaque draws produce
|
|
562
|
+
* byte-identical output to the pre-alpha implementation.
|
|
563
|
+
*
|
|
564
|
+
* Callers must already have issued `save()` so `restore()` scopes the
|
|
565
|
+
* ExtGState change to the current draw — mirroring the pattern used by
|
|
566
|
+
* `page-renderer.drawCellFill` (see `render/page-renderer.ts:178-194`).
|
|
567
|
+
*
|
|
568
|
+
* @internal
|
|
569
|
+
*/
|
|
570
|
+
_applyAlpha(alpha) {
|
|
571
|
+
if (alpha === undefined || alpha >= 1) {
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
const clamped = Math.max(0, Math.min(1, alpha));
|
|
575
|
+
this._alphaValues.add(clamped);
|
|
576
|
+
this._stream.setGraphicsState((0, page_renderer_1.alphaGsName)(clamped));
|
|
577
|
+
}
|
|
421
578
|
}
|
|
422
579
|
exports.PdfPageBuilder = PdfPageBuilder;
|
|
423
580
|
// =============================================================================
|
|
@@ -438,6 +595,14 @@ class PdfDocumentBuilder {
|
|
|
438
595
|
this._embeddedFont = null;
|
|
439
596
|
this._pdfA = false;
|
|
440
597
|
this._signatureOptions = null;
|
|
598
|
+
/**
|
|
599
|
+
* Set via {@link disableFontAutoDiscovery} — opts out of the system-font
|
|
600
|
+
* auto-embed path in `build()`. Authors who need byte-stable output
|
|
601
|
+
* across machines (golden tests, reproducible build pipelines) should
|
|
602
|
+
* enable this so a host-only CJK font doesn't sneak into one run but
|
|
603
|
+
* not another.
|
|
604
|
+
*/
|
|
605
|
+
this._disableFontAutoDiscovery = false;
|
|
441
606
|
}
|
|
442
607
|
/**
|
|
443
608
|
* Add a new blank page to the document.
|
|
@@ -475,6 +640,35 @@ class PdfDocumentBuilder {
|
|
|
475
640
|
this._embeddedFont = fontBytes;
|
|
476
641
|
return this;
|
|
477
642
|
}
|
|
643
|
+
/**
|
|
644
|
+
* Register a callback invoked once per non-fatal diagnostic during
|
|
645
|
+
* `build()`. Currently raised for:
|
|
646
|
+
*
|
|
647
|
+
* - auto-embedded system fonts (`'Auto-embedded system font ...'`)
|
|
648
|
+
* - non-WinAnsi characters with no covering font (`'...non-WinAnsi character(s) present...'`)
|
|
649
|
+
*
|
|
650
|
+
* The callback is synchronous and runs inside `build()`; throwing
|
|
651
|
+
* from it will abort the build. Return value is ignored.
|
|
652
|
+
*/
|
|
653
|
+
onWarning(handler) {
|
|
654
|
+
this._onWarning = handler;
|
|
655
|
+
return this;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Opt out of the best-effort system-font auto-discovery that `build()`
|
|
659
|
+
* performs when the document contains non-WinAnsi characters and no
|
|
660
|
+
* font was explicitly embedded. Use this to keep output byte-stable
|
|
661
|
+
* across hosts: one machine may have SimSun installed while another
|
|
662
|
+
* does not.
|
|
663
|
+
*/
|
|
664
|
+
disableFontAutoDiscovery() {
|
|
665
|
+
this._disableFontAutoDiscovery = true;
|
|
666
|
+
return this;
|
|
667
|
+
}
|
|
668
|
+
/** @internal */
|
|
669
|
+
_warn(message) {
|
|
670
|
+
this._onWarning?.(message);
|
|
671
|
+
}
|
|
478
672
|
/**
|
|
479
673
|
* Enable PDF/A compliance output.
|
|
480
674
|
*
|
|
@@ -669,6 +863,65 @@ class PdfDocumentBuilder {
|
|
|
669
863
|
const ttfFont = (0, ttf_parser_1.parseTtf)(this._embeddedFont);
|
|
670
864
|
this._fontManager.registerEmbeddedFont(ttfFont);
|
|
671
865
|
}
|
|
866
|
+
else {
|
|
867
|
+
// Auto-discover a system font when the document contains non-WinAnsi
|
|
868
|
+
// characters (CJK, accented code points beyond WinAnsi, etc.) and
|
|
869
|
+
// the caller did not supply one via `embedFont`. Mirrors the
|
|
870
|
+
// `pdf-exporter` pipeline so `drawChartPdf`-style overlays, ad-hoc
|
|
871
|
+
// `drawText` usage, and the spreadsheet exporter all reach for the
|
|
872
|
+
// same system fonts before falling back to Type3 NOTDEF glyphs.
|
|
873
|
+
// Failures are non-fatal: discovery is best-effort and users who
|
|
874
|
+
// need guaranteed rendering should still call `embedFont` with a
|
|
875
|
+
// font they control.
|
|
876
|
+
const nonWinAnsi = this._fontManager.getType3CodePoints();
|
|
877
|
+
if (nonWinAnsi.size > 0) {
|
|
878
|
+
// Try auto-discovery unless the caller opted out.
|
|
879
|
+
if (!this._disableFontAutoDiscovery) {
|
|
880
|
+
for (const candidate of (0, system_fonts_1.discoverSystemFontCandidates)()) {
|
|
881
|
+
try {
|
|
882
|
+
const testTtf = (0, ttf_parser_1.parseTtf)(candidate);
|
|
883
|
+
const allCovered = [...nonWinAnsi].every(cp => testTtf.cmap.has(cp));
|
|
884
|
+
if (allCovered) {
|
|
885
|
+
this._fontManager.registerEmbeddedFont(testTtf);
|
|
886
|
+
this._warn(`Auto-embedded system font '${testTtf.familyName}' to render ${nonWinAnsi.size} non-WinAnsi character(s). ` +
|
|
887
|
+
`Call embedFont(bytes) explicitly for deterministic output.`);
|
|
888
|
+
break;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
catch {
|
|
892
|
+
// Parse failed — try next candidate
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
if (!this._fontManager.hasEmbeddedFont()) {
|
|
897
|
+
// Either discovery was disabled, every candidate failed to
|
|
898
|
+
// parse, or no candidate covered these code points. Type3
|
|
899
|
+
// NOTDEF glyphs (tofu boxes) will appear for any cp
|
|
900
|
+
// `type3-glyphs.ts` does not map. Surface a warning so the
|
|
901
|
+
// author knows rendering will degrade, and list up to 5
|
|
902
|
+
// sample code points to help them debug.
|
|
903
|
+
const sample = [...nonWinAnsi]
|
|
904
|
+
.slice(0, 5)
|
|
905
|
+
.map(cp => `U+${cp.toString(16).toUpperCase().padStart(4, "0")}`)
|
|
906
|
+
.join(", ");
|
|
907
|
+
this._warn(`${nonWinAnsi.size} non-WinAnsi character(s) present but no TrueType font is embedded and no system font candidate covered them ` +
|
|
908
|
+
`(e.g. ${sample}). Call embedFont(bytes) with a font that covers these code points; otherwise Type3 NOTDEF boxes will render.`);
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
// Surface any unknown font families the FontManager saw during
|
|
913
|
+
// resolveFont (one diagnostic per distinct family, independent of
|
|
914
|
+
// how many text runs used it). An embedded font shadows everything
|
|
915
|
+
// anyway, so skip the warning in that case to avoid noise.
|
|
916
|
+
if (!this._fontManager.hasEmbeddedFont()) {
|
|
917
|
+
const unknown = this._fontManager.getUnknownFontFamilies();
|
|
918
|
+
if (unknown.size > 0) {
|
|
919
|
+
const list = [...unknown].slice(0, 5).join(", ");
|
|
920
|
+
const more = unknown.size > 5 ? ` (and ${unknown.size - 5} more)` : "";
|
|
921
|
+
this._warn(`Font family ${unknown.size > 1 ? "names" : "name"} '${list}'${more} not recognised; ` +
|
|
922
|
+
`falling back to Helvetica metrics. Add the typeface to the font-family map or call embedFont(bytes).`);
|
|
923
|
+
}
|
|
924
|
+
}
|
|
672
925
|
// Write font resources
|
|
673
926
|
const fontObjectMap = this._fontManager.writeFontResources(writer);
|
|
674
927
|
const fontDictStr = this._fontManager.buildFontDictString(fontObjectMap);
|
|
@@ -716,6 +969,25 @@ class PdfDocumentBuilder {
|
|
|
716
969
|
if (xobjDictStr) {
|
|
717
970
|
resourcesStr += `/XObject ${xobjDictStr} `;
|
|
718
971
|
}
|
|
972
|
+
// Emit an /ExtGState entry for every distinct page-level alpha. Mirrors
|
|
973
|
+
// the scheme used by `pdf-exporter.ts:377-390` so viewers see the
|
|
974
|
+
// same construct regardless of which rendering path produced the
|
|
975
|
+
// PDF. Empty set → no entry (and byte-identical with the old
|
|
976
|
+
// implementation for fully-opaque documents).
|
|
977
|
+
if (page._alphaValues.size > 0) {
|
|
978
|
+
const gsParts = ["<<"];
|
|
979
|
+
for (const alpha of page._alphaValues) {
|
|
980
|
+
const gsObjNum = writer.allocObject();
|
|
981
|
+
const gsDict = new pdf_object_1.PdfDict()
|
|
982
|
+
.set("Type", "/ExtGState")
|
|
983
|
+
.set("ca", (0, pdf_object_1.pdfNumber)(alpha))
|
|
984
|
+
.set("CA", (0, pdf_object_1.pdfNumber)(alpha));
|
|
985
|
+
writer.addObject(gsObjNum, gsDict);
|
|
986
|
+
gsParts.push(`/${(0, page_renderer_1.alphaGsName)(alpha)} ${(0, pdf_object_1.pdfRef)(gsObjNum)}`);
|
|
987
|
+
}
|
|
988
|
+
gsParts.push(">>");
|
|
989
|
+
resourcesStr += `/ExtGState ${gsParts.join("\n")} `;
|
|
990
|
+
}
|
|
719
991
|
resourcesStr += ">>";
|
|
720
992
|
writer.addObject(resourcesObjNum, resourcesStr);
|
|
721
993
|
pageResourceRefs.push(resourcesObjNum);
|
|
@@ -1427,6 +1699,239 @@ function parseSvgPath(d) {
|
|
|
1427
1699
|
}
|
|
1428
1700
|
return ops;
|
|
1429
1701
|
}
|
|
1702
|
+
function parseSimpleSvg(svg) {
|
|
1703
|
+
const svgTag = /<svg\b([^>]*)>/i.exec(svg);
|
|
1704
|
+
const svgAttrs = parseSvgAttrs(svgTag?.[1] ?? "");
|
|
1705
|
+
const viewBox = svgAttrs.viewBox?.split(/[\s,]+/).map(Number) ?? [];
|
|
1706
|
+
const width = svgRootLength(svgAttrs.width, viewBox[2], 300);
|
|
1707
|
+
const height = svgRootLength(svgAttrs.height, viewBox[3], 150);
|
|
1708
|
+
const elements = [];
|
|
1709
|
+
const elementRe = /<(rect|line|circle|polyline|polygon|path)\b([^>]*)\/?>|<text\b([^>]*)>([\s\S]*?)<\/text>/gi;
|
|
1710
|
+
let match;
|
|
1711
|
+
while ((match = elementRe.exec(svg)) !== null) {
|
|
1712
|
+
if (match[1]) {
|
|
1713
|
+
elements.push({ name: match[1], attrs: parseSvgAttrs(match[2] ?? ""), text: "" });
|
|
1714
|
+
}
|
|
1715
|
+
else {
|
|
1716
|
+
elements.push({ name: "text", attrs: parseSvgAttrs(match[3] ?? ""), text: match[4] ?? "" });
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
return { width, height, elements };
|
|
1720
|
+
}
|
|
1721
|
+
function parseSvgAttrs(raw) {
|
|
1722
|
+
const attrs = {};
|
|
1723
|
+
// Manual parser avoids regex backtracking on uncontrolled input.
|
|
1724
|
+
let i = 0;
|
|
1725
|
+
const len = raw.length;
|
|
1726
|
+
while (i < len) {
|
|
1727
|
+
// Skip non-name characters
|
|
1728
|
+
while (i < len && !isSvgNameChar(raw.charCodeAt(i))) {
|
|
1729
|
+
i++;
|
|
1730
|
+
}
|
|
1731
|
+
if (i >= len) {
|
|
1732
|
+
break;
|
|
1733
|
+
}
|
|
1734
|
+
// Read attribute name
|
|
1735
|
+
const nameStart = i;
|
|
1736
|
+
while (i < len && isSvgNameChar(raw.charCodeAt(i))) {
|
|
1737
|
+
i++;
|
|
1738
|
+
}
|
|
1739
|
+
const name = raw.slice(nameStart, i);
|
|
1740
|
+
// Expect `="`
|
|
1741
|
+
if (i >= len || raw.charCodeAt(i) !== 61 /* = */) {
|
|
1742
|
+
continue;
|
|
1743
|
+
}
|
|
1744
|
+
i++;
|
|
1745
|
+
if (i >= len || raw.charCodeAt(i) !== 34 /* " */) {
|
|
1746
|
+
continue;
|
|
1747
|
+
}
|
|
1748
|
+
i++;
|
|
1749
|
+
// Read attribute value until closing quote
|
|
1750
|
+
const valStart = i;
|
|
1751
|
+
while (i < len && raw.charCodeAt(i) !== 34) {
|
|
1752
|
+
i++;
|
|
1753
|
+
}
|
|
1754
|
+
attrs[name] = raw.slice(valStart, i);
|
|
1755
|
+
if (i < len) {
|
|
1756
|
+
i++; // skip closing quote
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
return attrs;
|
|
1760
|
+
}
|
|
1761
|
+
/** Check if a char code is valid in an SVG/XML attribute name (word chars, colon, hyphen). */
|
|
1762
|
+
function isSvgNameChar(c) {
|
|
1763
|
+
return ((c >= 65 && c <= 90) || // A-Z
|
|
1764
|
+
(c >= 97 && c <= 122) || // a-z
|
|
1765
|
+
(c >= 48 && c <= 57) || // 0-9
|
|
1766
|
+
c === 95 || // _
|
|
1767
|
+
c === 58 || // :
|
|
1768
|
+
c === 45 // -
|
|
1769
|
+
);
|
|
1770
|
+
}
|
|
1771
|
+
function numAttr(element, name, fallback) {
|
|
1772
|
+
const value = parseFloat(element.attrs[name] ?? "");
|
|
1773
|
+
return Number.isFinite(value) ? value : fallback;
|
|
1774
|
+
}
|
|
1775
|
+
function lengthAttr(element, name, axisLength, fallback) {
|
|
1776
|
+
const raw = element.attrs[name];
|
|
1777
|
+
if (!raw) {
|
|
1778
|
+
return fallback;
|
|
1779
|
+
}
|
|
1780
|
+
if (raw.trim().endsWith("%")) {
|
|
1781
|
+
const pct = parseFloat(raw);
|
|
1782
|
+
return Number.isFinite(pct) ? (axisLength * pct) / 100 : fallback;
|
|
1783
|
+
}
|
|
1784
|
+
const value = parseFloat(raw);
|
|
1785
|
+
return Number.isFinite(value) ? value : fallback;
|
|
1786
|
+
}
|
|
1787
|
+
function svgRootLength(raw, viewBoxLength, fallback) {
|
|
1788
|
+
if (!raw || raw.trim().endsWith("%")) {
|
|
1789
|
+
return viewBoxLength || fallback;
|
|
1790
|
+
}
|
|
1791
|
+
const value = parseFloat(raw);
|
|
1792
|
+
return Number.isFinite(value) && value > 0 ? value : viewBoxLength || fallback;
|
|
1793
|
+
}
|
|
1794
|
+
/**
|
|
1795
|
+
* Parse an SVG color token (`#rgb` / `#rrggbb` / `rgb(...)` / `rgba(...)`)
|
|
1796
|
+
* into a {@link PdfColor}. Named colours and functional forms beyond
|
|
1797
|
+
* `rgb`/`rgba` are deliberately out of scope — chart SVG output sticks
|
|
1798
|
+
* to these forms, and the `drawSvg` consumer should pass-through
|
|
1799
|
+
* `undefined` (i.e. "no fill") rather than silently guess.
|
|
1800
|
+
*
|
|
1801
|
+
* `rgba(r, g, b, a)` populates `.a` so the caller can thread the alpha
|
|
1802
|
+
* through `PdfPageBuilder._applyAlpha` → `/ExtGState`. Percentage values
|
|
1803
|
+
* are accepted (e.g. `rgb(100%, 0%, 0%)` ≡ red).
|
|
1804
|
+
*/
|
|
1805
|
+
function svgColorToPdf(value) {
|
|
1806
|
+
if (!value || value === "none") {
|
|
1807
|
+
return undefined;
|
|
1808
|
+
}
|
|
1809
|
+
const trimmed = value.trim();
|
|
1810
|
+
// rgb(r,g,b) / rgba(r,g,b,a) — whitespace tolerant, supports 0..255 and 0..100%
|
|
1811
|
+
const fnMatch = /^rgba?\(([^)]+)\)$/i.exec(trimmed);
|
|
1812
|
+
if (fnMatch) {
|
|
1813
|
+
const parts = fnMatch[1]
|
|
1814
|
+
.split(/[\s,]+/)
|
|
1815
|
+
.filter(Boolean)
|
|
1816
|
+
.map(part => {
|
|
1817
|
+
if (part.endsWith("%")) {
|
|
1818
|
+
const pct = Number.parseFloat(part);
|
|
1819
|
+
return Number.isFinite(pct) ? pct / 100 : undefined;
|
|
1820
|
+
}
|
|
1821
|
+
const num = Number.parseFloat(part);
|
|
1822
|
+
return Number.isFinite(num) ? num : undefined;
|
|
1823
|
+
});
|
|
1824
|
+
if (parts.length < 3 || parts.slice(0, 3).some(p => p === undefined)) {
|
|
1825
|
+
return undefined;
|
|
1826
|
+
}
|
|
1827
|
+
// The first three values are RGB in 0..255 when integer, already-0..1
|
|
1828
|
+
// when expressed as percentages above. Detect by the original token
|
|
1829
|
+
// to avoid mis-normalising `rgb(0.5, 0.5, 0.5)` as 0..255.
|
|
1830
|
+
const rawTokens = fnMatch[1].split(/[\s,]+/).filter(Boolean);
|
|
1831
|
+
const normaliseChannel = (v, idx) => {
|
|
1832
|
+
if (rawTokens[idx]?.endsWith("%")) {
|
|
1833
|
+
return Math.max(0, Math.min(1, v));
|
|
1834
|
+
}
|
|
1835
|
+
return Math.max(0, Math.min(1, v / 255));
|
|
1836
|
+
};
|
|
1837
|
+
const color = {
|
|
1838
|
+
r: normaliseChannel(parts[0], 0),
|
|
1839
|
+
g: normaliseChannel(parts[1], 1),
|
|
1840
|
+
b: normaliseChannel(parts[2], 2)
|
|
1841
|
+
};
|
|
1842
|
+
if (parts.length >= 4 && parts[3] !== undefined) {
|
|
1843
|
+
// rgba's alpha is 0..1 by spec regardless of whether RGB used %.
|
|
1844
|
+
color.a = Math.max(0, Math.min(1, parts[3]));
|
|
1845
|
+
}
|
|
1846
|
+
return color;
|
|
1847
|
+
}
|
|
1848
|
+
const hex = trimmed.startsWith("#") ? trimmed.slice(1) : trimmed;
|
|
1849
|
+
if (/^[0-9a-fA-F]{3}$/.test(hex)) {
|
|
1850
|
+
return {
|
|
1851
|
+
r: parseInt(hex[0] + hex[0], 16) / 255,
|
|
1852
|
+
g: parseInt(hex[1] + hex[1], 16) / 255,
|
|
1853
|
+
b: parseInt(hex[2] + hex[2], 16) / 255
|
|
1854
|
+
};
|
|
1855
|
+
}
|
|
1856
|
+
if (!/^[0-9a-fA-F]{6}$/.test(hex)) {
|
|
1857
|
+
return undefined;
|
|
1858
|
+
}
|
|
1859
|
+
return {
|
|
1860
|
+
r: parseInt(hex.slice(0, 2), 16) / 255,
|
|
1861
|
+
g: parseInt(hex.slice(2, 4), 16) / 255,
|
|
1862
|
+
b: parseInt(hex.slice(4, 6), 16) / 255
|
|
1863
|
+
};
|
|
1864
|
+
}
|
|
1865
|
+
/**
|
|
1866
|
+
* Apply an `*-opacity` attribute to an already-parsed {@link PdfColor}.
|
|
1867
|
+
*
|
|
1868
|
+
* SVG lets authors specify opacity either inline on the colour (`rgba`)
|
|
1869
|
+
* or as a separate `fill-opacity`/`stroke-opacity` attribute. When both
|
|
1870
|
+
* are present the W3C spec multiplies them — `rgba(…,0.5)` with
|
|
1871
|
+
* `fill-opacity="0.4"` yields effective alpha 0.2. We preserve that
|
|
1872
|
+
* here so chart SVG output whose authors use either form surfaces the
|
|
1873
|
+
* same alpha through to `/ExtGState`.
|
|
1874
|
+
*/
|
|
1875
|
+
function withSvgOpacity(color, opacityAttr) {
|
|
1876
|
+
if (!color) {
|
|
1877
|
+
return color;
|
|
1878
|
+
}
|
|
1879
|
+
if (!opacityAttr) {
|
|
1880
|
+
return color;
|
|
1881
|
+
}
|
|
1882
|
+
const parsed = Number.parseFloat(opacityAttr);
|
|
1883
|
+
if (!Number.isFinite(parsed)) {
|
|
1884
|
+
return color;
|
|
1885
|
+
}
|
|
1886
|
+
const clamped = Math.max(0, Math.min(1, parsed));
|
|
1887
|
+
const combined = (color.a ?? 1) * clamped;
|
|
1888
|
+
if (combined >= 1) {
|
|
1889
|
+
return color;
|
|
1890
|
+
}
|
|
1891
|
+
return { ...color, a: combined };
|
|
1892
|
+
}
|
|
1893
|
+
function svgPointsToPath(points, close) {
|
|
1894
|
+
const nums = points
|
|
1895
|
+
.trim()
|
|
1896
|
+
.split(/[\s,]+/)
|
|
1897
|
+
.map(Number)
|
|
1898
|
+
.filter(Number.isFinite);
|
|
1899
|
+
const ops = [];
|
|
1900
|
+
for (let i = 0; i + 1 < nums.length; i += 2) {
|
|
1901
|
+
ops.push(i === 0
|
|
1902
|
+
? { op: "move", x: nums[i], y: nums[i + 1] }
|
|
1903
|
+
: { op: "line", x: nums[i], y: nums[i + 1] });
|
|
1904
|
+
}
|
|
1905
|
+
if (close && ops.length > 0) {
|
|
1906
|
+
ops.push({ op: "close" });
|
|
1907
|
+
}
|
|
1908
|
+
return ops;
|
|
1909
|
+
}
|
|
1910
|
+
function transformPathOp(op, mapX, mapY) {
|
|
1911
|
+
if (op.op === "move" || op.op === "line") {
|
|
1912
|
+
return { ...op, x: mapX(op.x), y: mapY(op.y) };
|
|
1913
|
+
}
|
|
1914
|
+
if (op.op === "curve") {
|
|
1915
|
+
return {
|
|
1916
|
+
op: "curve",
|
|
1917
|
+
x1: mapX(op.x1),
|
|
1918
|
+
y1: mapY(op.y1),
|
|
1919
|
+
x2: mapX(op.x2),
|
|
1920
|
+
y2: mapY(op.y2),
|
|
1921
|
+
x3: mapX(op.x3),
|
|
1922
|
+
y3: mapY(op.y3)
|
|
1923
|
+
};
|
|
1924
|
+
}
|
|
1925
|
+
return op;
|
|
1926
|
+
}
|
|
1927
|
+
function xmlDecodeBasic(value) {
|
|
1928
|
+
return value
|
|
1929
|
+
.replace(/</g, "<")
|
|
1930
|
+
.replace(/>/g, ">")
|
|
1931
|
+
.replace(/"/g, '"')
|
|
1932
|
+
.replace(/'/g, "'")
|
|
1933
|
+
.replace(/&/g, "&");
|
|
1934
|
+
}
|
|
1430
1935
|
/**
|
|
1431
1936
|
* Convert an SVG elliptical arc to cubic Bézier curves.
|
|
1432
1937
|
* Follows the SVG spec's endpoint-to-center arc parameterization.
|