@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
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared validation context.
|
|
4
|
+
*
|
|
5
|
+
* Checkers share XML parsing work through this context. Relationships,
|
|
6
|
+
* content types, and parsed XML DOMs are parsed at most once and cached.
|
|
7
|
+
* Every checker consumes from the same cache so they all see identical
|
|
8
|
+
* parse results (this matters for "rels malformed" propagation — the
|
|
9
|
+
* malformed entry is reported once, and every downstream checker simply
|
|
10
|
+
* sees the empty parse result).
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.ValidationContext = void 0;
|
|
14
|
+
exports.domRoot = domRoot;
|
|
15
|
+
const xml_utils_1 = require("./xml-utils");
|
|
16
|
+
const textDecoder = new TextDecoder();
|
|
17
|
+
// -----------------------------------------------------------------------------
|
|
18
|
+
// Context
|
|
19
|
+
// -----------------------------------------------------------------------------
|
|
20
|
+
class ValidationContext {
|
|
21
|
+
constructor(entries, reporter) {
|
|
22
|
+
this.textCache = new Map();
|
|
23
|
+
this.domCache = new Map();
|
|
24
|
+
this.relsCache = new Map();
|
|
25
|
+
this.entries = entries;
|
|
26
|
+
this.reporter = reporter;
|
|
27
|
+
}
|
|
28
|
+
/** `true` if `path` points to a file (not a directory) in the package. */
|
|
29
|
+
has(path) {
|
|
30
|
+
const entry = this.entries.get(path);
|
|
31
|
+
return !!entry && entry.type !== "directory";
|
|
32
|
+
}
|
|
33
|
+
/** Iterate every file (skip directories). */
|
|
34
|
+
*files() {
|
|
35
|
+
for (const entry of this.entries) {
|
|
36
|
+
if (entry[1].type !== "directory") {
|
|
37
|
+
yield entry;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** Decode a part as UTF-8 text. Cached. */
|
|
42
|
+
readText(path) {
|
|
43
|
+
const cached = this.textCache.get(path);
|
|
44
|
+
if (cached !== undefined) {
|
|
45
|
+
return cached;
|
|
46
|
+
}
|
|
47
|
+
const entry = this.entries.get(path);
|
|
48
|
+
if (!entry || entry.type === "directory") {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
const text = textDecoder.decode(entry.data);
|
|
52
|
+
this.textCache.set(path, text);
|
|
53
|
+
return text;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Parse a part as XML DOM. Cached. Returns `undefined` if the part is
|
|
57
|
+
* missing or malformed. Callers that need to distinguish those cases
|
|
58
|
+
* should check `has(path)` first.
|
|
59
|
+
*/
|
|
60
|
+
readDom(path, onMalformed) {
|
|
61
|
+
if (this.domCache.has(path)) {
|
|
62
|
+
return this.domCache.get(path);
|
|
63
|
+
}
|
|
64
|
+
const text = this.readText(path);
|
|
65
|
+
if (text === undefined) {
|
|
66
|
+
this.domCache.set(path, undefined);
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
const dom = (0, xml_utils_1.tryParseXml)(text, err => {
|
|
70
|
+
onMalformed?.(err);
|
|
71
|
+
});
|
|
72
|
+
this.domCache.set(path, dom);
|
|
73
|
+
return dom;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Read and cache the content-types table. On first call, parse
|
|
77
|
+
* `[Content_Types].xml`; subsequent calls return the cache.
|
|
78
|
+
* Reports malformed-XML problems via the reporter but never throws.
|
|
79
|
+
*/
|
|
80
|
+
readContentTypes() {
|
|
81
|
+
if (this.contentTypes) {
|
|
82
|
+
return this.contentTypes;
|
|
83
|
+
}
|
|
84
|
+
const path = "[Content_Types].xml";
|
|
85
|
+
const dom = this.readDom(path, err => {
|
|
86
|
+
this.reporter.error("content-types-malformed", `Content types XML parse error: ${err.message}`, path);
|
|
87
|
+
});
|
|
88
|
+
const data = {
|
|
89
|
+
defaults: new Map(),
|
|
90
|
+
overrides: new Map(),
|
|
91
|
+
parseOk: false,
|
|
92
|
+
duplicateOverrides: []
|
|
93
|
+
};
|
|
94
|
+
if (!dom) {
|
|
95
|
+
this.contentTypes = data;
|
|
96
|
+
return data;
|
|
97
|
+
}
|
|
98
|
+
const root = dom.root;
|
|
99
|
+
// Accept namespaced <Types> just in case.
|
|
100
|
+
const looksLikeTypes = root.name === "Types" || root.name.endsWith(":Types");
|
|
101
|
+
if (!looksLikeTypes) {
|
|
102
|
+
this.reporter.error("content-types-malformed", `Content types root element is <${root.name}>, expected <Types>`, path);
|
|
103
|
+
this.contentTypes = data;
|
|
104
|
+
return data;
|
|
105
|
+
}
|
|
106
|
+
for (const el of (0, xml_utils_1.findChildrenLocal)(root, "Default")) {
|
|
107
|
+
const extRaw = (0, xml_utils_1.attrByLocalName)(el, "Extension");
|
|
108
|
+
const ct = (0, xml_utils_1.attrByLocalName)(el, "ContentType");
|
|
109
|
+
if (extRaw && ct) {
|
|
110
|
+
data.defaults.set(extRaw.toLowerCase(), ct);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
for (const el of (0, xml_utils_1.findChildrenLocal)(root, "Override")) {
|
|
114
|
+
const partName = (0, xml_utils_1.attrByLocalName)(el, "PartName");
|
|
115
|
+
const ct = (0, xml_utils_1.attrByLocalName)(el, "ContentType");
|
|
116
|
+
if (!partName || !ct) {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
const key = partName.startsWith("/") ? partName.slice(1) : partName;
|
|
120
|
+
if (data.overrides.has(key)) {
|
|
121
|
+
data.duplicateOverrides.push(partName);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
data.overrides.set(key, ct);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
data.parseOk = true;
|
|
128
|
+
this.contentTypes = data;
|
|
129
|
+
return data;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Read and cache a relationships file. Every .rels in the package is
|
|
133
|
+
* parsed lazily on first request. Malformed files are reported once
|
|
134
|
+
* and return an empty relationships array.
|
|
135
|
+
*/
|
|
136
|
+
readRels(relsPath) {
|
|
137
|
+
const cached = this.relsCache.get(relsPath);
|
|
138
|
+
if (cached) {
|
|
139
|
+
return cached;
|
|
140
|
+
}
|
|
141
|
+
const data = {
|
|
142
|
+
rels: [],
|
|
143
|
+
byId: new Map(),
|
|
144
|
+
parseOk: false,
|
|
145
|
+
malformedEntries: []
|
|
146
|
+
};
|
|
147
|
+
if (!this.has(relsPath)) {
|
|
148
|
+
this.relsCache.set(relsPath, data);
|
|
149
|
+
return data;
|
|
150
|
+
}
|
|
151
|
+
const dom = this.readDom(relsPath, err => {
|
|
152
|
+
this.reporter.error("rels-malformed", `Relationships XML parse error: ${err.message}`, relsPath);
|
|
153
|
+
});
|
|
154
|
+
if (!dom) {
|
|
155
|
+
this.relsCache.set(relsPath, data);
|
|
156
|
+
return data;
|
|
157
|
+
}
|
|
158
|
+
const root = dom.root;
|
|
159
|
+
const looksLikeRelationships = root.name === "Relationships" || root.name.endsWith(":Relationships");
|
|
160
|
+
if (!looksLikeRelationships) {
|
|
161
|
+
this.reporter.error("rels-malformed", `Relationships root element is <${root.name}>, expected <Relationships>`, relsPath);
|
|
162
|
+
this.relsCache.set(relsPath, data);
|
|
163
|
+
return data;
|
|
164
|
+
}
|
|
165
|
+
for (const el of (0, xml_utils_1.findChildrenLocal)(root, "Relationship")) {
|
|
166
|
+
const id = (0, xml_utils_1.attrByLocalName)(el, "Id");
|
|
167
|
+
const type = (0, xml_utils_1.attrByLocalName)(el, "Type");
|
|
168
|
+
const target = (0, xml_utils_1.attrByLocalName)(el, "Target");
|
|
169
|
+
const targetMode = (0, xml_utils_1.attrByLocalName)(el, "TargetMode");
|
|
170
|
+
if (!id || !type || target === undefined) {
|
|
171
|
+
data.malformedEntries.push({
|
|
172
|
+
missingId: !id,
|
|
173
|
+
missingType: !type,
|
|
174
|
+
missingTarget: target === undefined,
|
|
175
|
+
id,
|
|
176
|
+
type
|
|
177
|
+
});
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
const rel = { id, type, target, targetMode };
|
|
181
|
+
data.rels.push(rel);
|
|
182
|
+
// Note: duplicates are checked elsewhere; we keep the FIRST here.
|
|
183
|
+
if (!data.byId.has(id)) {
|
|
184
|
+
data.byId.set(id, rel);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
data.parseOk = true;
|
|
188
|
+
this.relsCache.set(relsPath, data);
|
|
189
|
+
return data;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
exports.ValidationContext = ValidationContext;
|
|
193
|
+
/** Get the root element of a DOM; returns undefined for missing DOM. */
|
|
194
|
+
function domRoot(dom) {
|
|
195
|
+
return dom?.root;
|
|
196
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Public entry point for the OOXML validator.
|
|
4
|
+
*
|
|
5
|
+
* Validates an xlsx package buffer against the OPC spec and Excel's
|
|
6
|
+
* known opening invariants. See `types.ts` for the full catalog of
|
|
7
|
+
* problem kinds.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* const report = await validateXlsxBuffer(await wb.xlsx.writeBuffer());
|
|
11
|
+
* if (!report.ok) {
|
|
12
|
+
* console.error(report.problems);
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* The implementation is composed of independent checkers under
|
|
17
|
+
* `check-*.ts` — each can be unit-tested in isolation. The entry point
|
|
18
|
+
* orchestrates them with a shared `ValidationContext` that caches XML
|
|
19
|
+
* parsing across checks.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.validateXlsxBuffer = validateXlsxBuffer;
|
|
23
|
+
const extract_1 = require("../../../archive/unzip/extract.js");
|
|
24
|
+
const check_chart_1 = require("./check-chart");
|
|
25
|
+
const check_chart_sidecar_1 = require("./check-chart-sidecar");
|
|
26
|
+
const check_chartsheet_1 = require("./check-chartsheet");
|
|
27
|
+
const check_content_types_1 = require("./check-content-types");
|
|
28
|
+
const check_drawing_1 = require("./check-drawing");
|
|
29
|
+
const check_pivot_1 = require("./check-pivot");
|
|
30
|
+
const check_relationships_1 = require("./check-relationships");
|
|
31
|
+
const check_structure_1 = require("./check-structure");
|
|
32
|
+
const check_styles_1 = require("./check-styles");
|
|
33
|
+
const check_table_1 = require("./check-table");
|
|
34
|
+
const check_workbook_1 = require("./check-workbook");
|
|
35
|
+
const check_worksheet_1 = require("./check-worksheet");
|
|
36
|
+
const context_1 = require("./context");
|
|
37
|
+
const path_utils_1 = require("./path-utils");
|
|
38
|
+
const reporter_1 = require("./reporter");
|
|
39
|
+
/**
|
|
40
|
+
* Validate an xlsx package. Returns a report with every detected
|
|
41
|
+
* problem; `ok === true` when no error-severity problems were found.
|
|
42
|
+
*
|
|
43
|
+
* This function never throws — malformed input is surfaced as a
|
|
44
|
+
* `xml-malformed` or similar problem kind. The only exception is if
|
|
45
|
+
* `extractAll` fails to unzip the buffer (not a valid ZIP at all), in
|
|
46
|
+
* which case the underlying archive error propagates.
|
|
47
|
+
*/
|
|
48
|
+
async function validateXlsxBuffer(xlsxBuffer, options = {}) {
|
|
49
|
+
const { checkXmlWellFormed: optCheckXmlWellFormed = true, checkRelationshipTargets = true, checkContentTypesOverrides = true, checkWorksheetControlWiring = true, checkChartStructure = true, checkStylesIntegrity = true, maxProblems, includeWarnings = false } = options;
|
|
50
|
+
const entries = await (0, extract_1.extractAll)(xlsxBuffer);
|
|
51
|
+
const reporter = new reporter_1.Reporter({ maxProblems, includeWarnings });
|
|
52
|
+
const ctx = new context_1.ValidationContext(entries, reporter);
|
|
53
|
+
// Order matters: later checks rely on earlier ones NOT firing false
|
|
54
|
+
// positives when structural invariants are broken. Structure first.
|
|
55
|
+
(0, check_structure_1.checkStructure)(ctx);
|
|
56
|
+
if (optCheckXmlWellFormed) {
|
|
57
|
+
(0, check_structure_1.checkXmlWellFormed)(ctx);
|
|
58
|
+
}
|
|
59
|
+
if (checkContentTypesOverrides) {
|
|
60
|
+
(0, check_content_types_1.checkContentTypes)(ctx);
|
|
61
|
+
}
|
|
62
|
+
(0, check_relationships_1.checkRootRelationships)(ctx);
|
|
63
|
+
if (checkRelationshipTargets) {
|
|
64
|
+
(0, check_relationships_1.checkRelationships)(ctx);
|
|
65
|
+
}
|
|
66
|
+
(0, check_workbook_1.checkWorkbook)(ctx);
|
|
67
|
+
if (checkWorksheetControlWiring) {
|
|
68
|
+
(0, check_worksheet_1.checkWorksheets)(ctx);
|
|
69
|
+
}
|
|
70
|
+
if (checkChartStructure) {
|
|
71
|
+
(0, check_chart_1.checkChart)(ctx);
|
|
72
|
+
(0, check_drawing_1.checkDrawing)(ctx);
|
|
73
|
+
(0, check_chartsheet_1.checkChartsheet)(ctx);
|
|
74
|
+
(0, check_pivot_1.checkPivot)(ctx);
|
|
75
|
+
(0, check_table_1.checkTables)(ctx);
|
|
76
|
+
(0, check_chart_sidecar_1.checkChartSidecars)(ctx);
|
|
77
|
+
}
|
|
78
|
+
if (checkStylesIntegrity) {
|
|
79
|
+
(0, check_styles_1.checkStyles)(ctx);
|
|
80
|
+
}
|
|
81
|
+
const stats = computeStats(entries);
|
|
82
|
+
return {
|
|
83
|
+
ok: !reporter.hasErrors,
|
|
84
|
+
problems: reporter.problems,
|
|
85
|
+
stats
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function computeStats(entries) {
|
|
89
|
+
let entryCount = 0;
|
|
90
|
+
let xmlLikeCount = 0;
|
|
91
|
+
let relsCount = 0;
|
|
92
|
+
for (const [, entry] of entries) {
|
|
93
|
+
if (entry.type === "directory") {
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
entryCount++;
|
|
97
|
+
if ((0, path_utils_1.isXmlLike)(entry.path)) {
|
|
98
|
+
xmlLikeCount++;
|
|
99
|
+
}
|
|
100
|
+
if (entry.path.endsWith(".rels")) {
|
|
101
|
+
relsCount++;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return { entryCount, xmlLikeCount, relsCount };
|
|
105
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Path helpers shared across all validator checkers.
|
|
4
|
+
*
|
|
5
|
+
* All paths are handled as **forward-slash POSIX strings** because that is
|
|
6
|
+
* how OPC part names are defined. We never touch the host's path separator.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.stripLeadingSlash = stripLeadingSlash;
|
|
10
|
+
exports.isXmlLike = isXmlLike;
|
|
11
|
+
exports.getRelsSourceDir = getRelsSourceDir;
|
|
12
|
+
exports.posixBasename = posixBasename;
|
|
13
|
+
exports.getExtension = getExtension;
|
|
14
|
+
exports.resolveRelTarget = resolveRelTarget;
|
|
15
|
+
exports.isSafeResolvedPath = isSafeResolvedPath;
|
|
16
|
+
exports.relsPathForPart = relsPathForPart;
|
|
17
|
+
exports.sourcePartForRels = sourcePartForRels;
|
|
18
|
+
exports.isLegalPartName = isLegalPartName;
|
|
19
|
+
/**
|
|
20
|
+
* Strip a single leading `/` if present. OPC `PartName` values start with
|
|
21
|
+
* `/` by spec, but zip entries do not.
|
|
22
|
+
*/
|
|
23
|
+
function stripLeadingSlash(p) {
|
|
24
|
+
return p.startsWith("/") ? p.slice(1) : p;
|
|
25
|
+
}
|
|
26
|
+
/** `.xml`, `.rels`, or `.vml` — the payloads we parse as XML. */
|
|
27
|
+
function isXmlLike(pathName) {
|
|
28
|
+
return pathName.endsWith(".xml") || pathName.endsWith(".rels") || pathName.endsWith(".vml");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Directory in which a relationships part's **source** part lives. OPC
|
|
32
|
+
* resolves rel Targets relative to the source part's directory, NOT the
|
|
33
|
+
* `.rels` file's directory. Examples:
|
|
34
|
+
*
|
|
35
|
+
* | .rels path | source dir |
|
|
36
|
+
* |-----------------------------------------|---------------------|
|
|
37
|
+
* | `_rels/.rels` | `` |
|
|
38
|
+
* | `xl/_rels/workbook.xml.rels` | `xl` |
|
|
39
|
+
* | `xl/worksheets/_rels/sheet1.xml.rels` | `xl/worksheets` |
|
|
40
|
+
*/
|
|
41
|
+
function getRelsSourceDir(relsPath) {
|
|
42
|
+
if (relsPath === "_rels/.rels") {
|
|
43
|
+
return "";
|
|
44
|
+
}
|
|
45
|
+
const marker = "/_rels/";
|
|
46
|
+
const idx = relsPath.indexOf(marker);
|
|
47
|
+
if (idx === -1) {
|
|
48
|
+
return relsPath.includes("/") ? relsPath.slice(0, relsPath.lastIndexOf("/")) : "";
|
|
49
|
+
}
|
|
50
|
+
return relsPath.slice(0, idx);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Basename without directory, e.g. `xl/foo/bar.xml` → `bar.xml`.
|
|
54
|
+
*/
|
|
55
|
+
function posixBasename(p) {
|
|
56
|
+
const idx = p.lastIndexOf("/");
|
|
57
|
+
return idx === -1 ? p : p.slice(idx + 1);
|
|
58
|
+
}
|
|
59
|
+
/** Extension without the leading dot, lowercase. `""` when missing. */
|
|
60
|
+
function getExtension(p) {
|
|
61
|
+
const base = posixBasename(p);
|
|
62
|
+
const idx = base.lastIndexOf(".");
|
|
63
|
+
return idx === -1 ? "" : base.slice(idx + 1).toLowerCase();
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Resolve a relationship Target against a .rels path. Handles absolute
|
|
67
|
+
* targets starting with `/` (relative to package root), `../` traversal,
|
|
68
|
+
* `./`, and plain relative segments. Never returns a leading slash.
|
|
69
|
+
*
|
|
70
|
+
* We do NOT use `node:path` so this module is usable in browsers.
|
|
71
|
+
*/
|
|
72
|
+
function resolveRelTarget(relsPath, target) {
|
|
73
|
+
// Absolute-in-package targets start with "/".
|
|
74
|
+
if (target.startsWith("/")) {
|
|
75
|
+
return normalizeSegments(target.split("/"));
|
|
76
|
+
}
|
|
77
|
+
const baseDir = getRelsSourceDir(relsPath);
|
|
78
|
+
const segments = [];
|
|
79
|
+
if (baseDir) {
|
|
80
|
+
segments.push(...baseDir.split("/"));
|
|
81
|
+
}
|
|
82
|
+
segments.push(...target.split("/"));
|
|
83
|
+
return normalizeSegments(segments);
|
|
84
|
+
}
|
|
85
|
+
function normalizeSegments(segments) {
|
|
86
|
+
const out = [];
|
|
87
|
+
let escaped = false;
|
|
88
|
+
for (const seg of segments) {
|
|
89
|
+
if (seg === "" || seg === ".") {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (seg === "..") {
|
|
93
|
+
if (out.length === 0) {
|
|
94
|
+
// Record traversal past the package root — caller's job to flag it.
|
|
95
|
+
escaped = true;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
out.pop();
|
|
99
|
+
}
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
out.push(seg);
|
|
103
|
+
}
|
|
104
|
+
const joined = out.join("/");
|
|
105
|
+
return escaped ? `../${joined}` : joined;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* `false` when a resolved rel target escapes the package root. Targets
|
|
109
|
+
* that escape are malicious or accidentally produced by broken
|
|
110
|
+
* serialisers and always indicate a corrupt package.
|
|
111
|
+
*/
|
|
112
|
+
function isSafeResolvedPath(resolved) {
|
|
113
|
+
return !(resolved === ".." || resolved.startsWith("../") || resolved.includes("/../"));
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Derive the .rels path for a given source part. Symmetric with
|
|
117
|
+
* `getRelsSourceDir`. Examples:
|
|
118
|
+
*
|
|
119
|
+
* | source part | rels path |
|
|
120
|
+
* |--------------------------------|----------------------------------------|
|
|
121
|
+
* | `xl/workbook.xml` | `xl/_rels/workbook.xml.rels` |
|
|
122
|
+
* | `xl/worksheets/sheet1.xml` | `xl/worksheets/_rels/sheet1.xml.rels` |
|
|
123
|
+
*/
|
|
124
|
+
function relsPathForPart(partPath) {
|
|
125
|
+
const base = posixBasename(partPath);
|
|
126
|
+
const dir = partPath.length > base.length ? partPath.slice(0, partPath.length - base.length - 1) : "";
|
|
127
|
+
return dir ? `${dir}/_rels/${base}.rels` : `_rels/${base}.rels`;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Inverse of {@link relsPathForPart}: source part for a given rels file.
|
|
131
|
+
* Returns undefined for the root rels (which has no conventional source).
|
|
132
|
+
*/
|
|
133
|
+
function sourcePartForRels(relsPath) {
|
|
134
|
+
if (relsPath === "_rels/.rels") {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
const base = posixBasename(relsPath);
|
|
138
|
+
if (!base.endsWith(".rels")) {
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
141
|
+
const srcDir = getRelsSourceDir(relsPath);
|
|
142
|
+
const sourceName = base.slice(0, -".rels".length);
|
|
143
|
+
return srcDir ? `${srcDir}/${sourceName}` : sourceName;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Part name satisfies OPC PartName grammar — not empty, uses only safe
|
|
147
|
+
* characters, does not end with `/` and does not contain `.` or `..`
|
|
148
|
+
* segments. We do not validate the full grammar but cover the cases that
|
|
149
|
+
* break Excel in practice.
|
|
150
|
+
*/
|
|
151
|
+
function isLegalPartName(partName) {
|
|
152
|
+
if (!partName) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
if (partName.endsWith("/")) {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
if (/[\\:*?"<>|]/.test(partName)) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
const segments = partName.split("/");
|
|
162
|
+
for (const seg of segments) {
|
|
163
|
+
if (seg === "" || seg === "." || seg === "..") {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Problem reporter shared by all checkers.
|
|
4
|
+
*
|
|
5
|
+
* Two responsibilities:
|
|
6
|
+
* 1. Filter warnings when `includeWarnings` is `false`.
|
|
7
|
+
* 2. Short-circuit after `maxProblems` is reached.
|
|
8
|
+
*
|
|
9
|
+
* The reporter does not sort or dedupe — checkers are expected to emit at
|
|
10
|
+
* most one problem per logical issue. Callers get problems in encounter
|
|
11
|
+
* order, which is stable across runs for the same input.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.Reporter = void 0;
|
|
15
|
+
exports.reportWithSeverity = reportWithSeverity;
|
|
16
|
+
class Reporter {
|
|
17
|
+
constructor(options = {}) {
|
|
18
|
+
this.problems = [];
|
|
19
|
+
this.errorCount = 0;
|
|
20
|
+
this.maxProblems = options.maxProblems;
|
|
21
|
+
this.includeWarnings = options.includeWarnings ?? false;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* `true` once the configured `maxProblems` cap is reached. Checkers
|
|
25
|
+
* should consult this at the top of their per-part loops to avoid
|
|
26
|
+
* doing unnecessary work.
|
|
27
|
+
*/
|
|
28
|
+
get capped() {
|
|
29
|
+
return this.maxProblems !== undefined && this.problems.length >= this.maxProblems;
|
|
30
|
+
}
|
|
31
|
+
get hasErrors() {
|
|
32
|
+
return this.errorCount > 0;
|
|
33
|
+
}
|
|
34
|
+
/** Report an error-severity problem. */
|
|
35
|
+
error(kind, message, file) {
|
|
36
|
+
this.push({ kind, severity: "error", message, file });
|
|
37
|
+
this.errorCount += this.capped ? 0 : 1;
|
|
38
|
+
}
|
|
39
|
+
/** Report a warning-severity problem. Only recorded if includeWarnings. */
|
|
40
|
+
warning(kind, message, file) {
|
|
41
|
+
if (!this.includeWarnings) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
this.push({ kind, severity: "warning", message, file });
|
|
45
|
+
}
|
|
46
|
+
push(problem) {
|
|
47
|
+
if (this.maxProblems !== undefined && this.problems.length >= this.maxProblems) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
this.problems.push(problem);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.Reporter = Reporter;
|
|
54
|
+
/**
|
|
55
|
+
* Convenience alias for the legacy `severity` argument used in the old
|
|
56
|
+
* flat API. Kept for internal checker code that wants to produce a
|
|
57
|
+
* problem with a runtime-chosen severity.
|
|
58
|
+
*/
|
|
59
|
+
function reportWithSeverity(reporter, severity, kind, message, file) {
|
|
60
|
+
if (severity === "error") {
|
|
61
|
+
reporter.error(kind, message, file);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
reporter.warning(kind, message, file);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Public types for the OOXML validator.
|
|
4
|
+
*
|
|
5
|
+
* The validator's job is to detect xlsx packages that Excel will refuse to
|
|
6
|
+
* open (or silently repair). Each check emits zero or more `Problem` entries
|
|
7
|
+
* tagged by `kind`; callers can branch on `kind` for structured handling.
|
|
8
|
+
*
|
|
9
|
+
* Problem kinds are grouped by subsystem to make ad-hoc extension easy.
|
|
10
|
+
* New kinds MUST be added to the union below so consumers can enumerate them
|
|
11
|
+
* at the type level. Removing or renaming kinds is a breaking change.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* XML helpers that tolerate namespace prefixes.
|
|
4
|
+
*
|
|
5
|
+
* OOXML serialisers are allowed to write `<drawing>` or `<x:drawing>` —
|
|
6
|
+
* both are legal in the same schema. All validator checks must therefore
|
|
7
|
+
* match on the **local name**, not the prefixed name. These helpers also
|
|
8
|
+
* tolerate namespaced attributes like `r:id` vs `ns0:id`.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.findChildren = void 0;
|
|
12
|
+
exports.localName = localName;
|
|
13
|
+
exports.matchesLocal = matchesLocal;
|
|
14
|
+
exports.findChildLocal = findChildLocal;
|
|
15
|
+
exports.findChildrenLocal = findChildrenLocal;
|
|
16
|
+
exports.hasDescendantLocal = hasDescendantLocal;
|
|
17
|
+
exports.collectDescendantsLocal = collectDescendantsLocal;
|
|
18
|
+
exports.attrByLocalName = attrByLocalName;
|
|
19
|
+
exports.tryParseXml = tryParseXml;
|
|
20
|
+
const dom_1 = require("../../../xml/dom.js");
|
|
21
|
+
Object.defineProperty(exports, "findChildren", { enumerable: true, get: function () { return dom_1.findChildren; } });
|
|
22
|
+
/**
|
|
23
|
+
* Extract the local name from a tag name, i.e. the part after the last `:`.
|
|
24
|
+
* For `drawing` returns `drawing`; for `x:drawing` returns `drawing`.
|
|
25
|
+
*/
|
|
26
|
+
function localName(name) {
|
|
27
|
+
const idx = name.lastIndexOf(":");
|
|
28
|
+
return idx === -1 ? name : name.slice(idx + 1);
|
|
29
|
+
}
|
|
30
|
+
/** Namespace-insensitive element-name equality. */
|
|
31
|
+
function matchesLocal(name, target) {
|
|
32
|
+
return localName(name) === target;
|
|
33
|
+
}
|
|
34
|
+
/** Find first child element with matching **local** name. */
|
|
35
|
+
function findChildLocal(el, local) {
|
|
36
|
+
for (const child of el.children) {
|
|
37
|
+
if (child.type === "element" && matchesLocal(child.name, local)) {
|
|
38
|
+
return child;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
/** Find all child elements with matching **local** name. */
|
|
44
|
+
function findChildrenLocal(el, local) {
|
|
45
|
+
const out = [];
|
|
46
|
+
for (const child of el.children) {
|
|
47
|
+
if (child.type === "element" && matchesLocal(child.name, local)) {
|
|
48
|
+
out.push(child);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
/** `true` when any descendant (or self) has matching local name. */
|
|
54
|
+
function hasDescendantLocal(root, local) {
|
|
55
|
+
if (matchesLocal(root.name, local)) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
let found = false;
|
|
59
|
+
(0, dom_1.walk)(root, child => {
|
|
60
|
+
if (!found && matchesLocal(child.name, local)) {
|
|
61
|
+
found = true;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return found;
|
|
65
|
+
}
|
|
66
|
+
/** Collect all descendants (including self) matching local name. */
|
|
67
|
+
function collectDescendantsLocal(root, local) {
|
|
68
|
+
const out = [];
|
|
69
|
+
if (matchesLocal(root.name, local)) {
|
|
70
|
+
out.push(root);
|
|
71
|
+
}
|
|
72
|
+
(0, dom_1.walk)(root, child => {
|
|
73
|
+
if (child !== root && matchesLocal(child.name, local)) {
|
|
74
|
+
out.push(child);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
return out;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Read an attribute by local name. The OOXML convention is to use
|
|
81
|
+
* namespaced attributes like `r:id` but some serialisers strip or
|
|
82
|
+
* renumber the prefix. We match by suffix `:<local>` or exact `local`.
|
|
83
|
+
*/
|
|
84
|
+
function attrByLocalName(el, local) {
|
|
85
|
+
const direct = el.attributes[local];
|
|
86
|
+
if (direct !== undefined) {
|
|
87
|
+
return direct;
|
|
88
|
+
}
|
|
89
|
+
for (const key in el.attributes) {
|
|
90
|
+
const idx = key.lastIndexOf(":");
|
|
91
|
+
if (idx !== -1 && key.slice(idx + 1) === local) {
|
|
92
|
+
return el.attributes[key];
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Parse an XML string into a DOM tree. Returns `undefined` and records the
|
|
99
|
+
* failure as a malformed XML problem via `onMalformed`. We don't throw
|
|
100
|
+
* because validators must continue after a parse failure.
|
|
101
|
+
*/
|
|
102
|
+
function tryParseXml(xml, onMalformed) {
|
|
103
|
+
try {
|
|
104
|
+
return (0, dom_1.parseXml)(xml);
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
onMalformed(err instanceof Error ? err : new Error(String(err)));
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
}
|