postext 1.69.0 → 1.70.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/__tests__/exports.test.js +3 -0
- package/dist/__tests__/exports.test.js.map +1 -1
- package/dist/__tests__/paint/canvasBulletBaseline.test.d.ts +2 -0
- package/dist/__tests__/paint/canvasBulletBaseline.test.d.ts.map +1 -0
- package/dist/__tests__/paint/canvasBulletBaseline.test.js +56 -0
- package/dist/__tests__/paint/canvasBulletBaseline.test.js.map +1 -0
- package/dist/__tests__/pipeline/contents/tocNumberBaseline.test.js +5 -1
- package/dist/__tests__/pipeline/contents/tocNumberBaseline.test.js.map +1 -1
- package/dist/canvas-backend/blockRender/block.d.ts.map +1 -1
- package/dist/canvas-backend/blockRender/block.js +17 -9
- package/dist/canvas-backend/blockRender/block.js.map +1 -1
- package/dist/composed/sourceMap/text.d.ts.map +1 -1
- package/dist/composed/sourceMap/text.js +1 -15
- package/dist/composed/sourceMap/text.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/paint/displayList/blocks.d.ts +29 -0
- package/dist/paint/displayList/blocks.d.ts.map +1 -0
- package/dist/paint/displayList/blocks.js +257 -0
- package/dist/paint/displayList/blocks.js.map +1 -0
- package/dist/paint/displayList/comic.d.ts +8 -0
- package/dist/paint/displayList/comic.d.ts.map +1 -0
- package/dist/paint/displayList/comic.js +142 -0
- package/dist/paint/displayList/comic.js.map +1 -0
- package/dist/paint/displayList/design.d.ts +27 -0
- package/dist/paint/displayList/design.d.ts.map +1 -0
- package/dist/paint/displayList/design.js +190 -0
- package/dist/paint/displayList/design.js.map +1 -0
- package/dist/paint/displayList/displayList.test.d.ts +2 -0
- package/dist/paint/displayList/displayList.test.d.ts.map +1 -0
- package/dist/paint/displayList/displayList.test.js +256 -0
- package/dist/paint/displayList/displayList.test.js.map +1 -0
- package/dist/paint/displayList/eastAsian.test.d.ts +2 -0
- package/dist/paint/displayList/eastAsian.test.d.ts.map +1 -0
- package/dist/paint/displayList/eastAsian.test.js +112 -0
- package/dist/paint/displayList/eastAsian.test.js.map +1 -0
- package/dist/paint/displayList/frame.d.ts +49 -0
- package/dist/paint/displayList/frame.d.ts.map +1 -0
- package/dist/paint/displayList/frame.js +230 -0
- package/dist/paint/displayList/frame.js.map +1 -0
- package/dist/paint/displayList/frames.test.d.ts +2 -0
- package/dist/paint/displayList/frames.test.d.ts.map +1 -0
- package/dist/paint/displayList/frames.test.js +129 -0
- package/dist/paint/displayList/frames.test.js.map +1 -0
- package/dist/paint/displayList/index.d.ts +4 -0
- package/dist/paint/displayList/index.d.ts.map +1 -0
- package/dist/paint/displayList/index.js +5 -0
- package/dist/paint/displayList/index.js.map +1 -0
- package/dist/paint/displayList/inline.d.ts +19 -0
- package/dist/paint/displayList/inline.d.ts.map +1 -0
- package/dist/paint/displayList/inline.js +84 -0
- package/dist/paint/displayList/inline.js.map +1 -0
- package/dist/paint/displayList/lines.d.ts +60 -0
- package/dist/paint/displayList/lines.d.ts.map +1 -0
- package/dist/paint/displayList/lines.js +267 -0
- package/dist/paint/displayList/lines.js.map +1 -0
- package/dist/paint/displayList/overlays.d.ts +23 -0
- package/dist/paint/displayList/overlays.d.ts.map +1 -0
- package/dist/paint/displayList/overlays.js +99 -0
- package/dist/paint/displayList/overlays.js.map +1 -0
- package/dist/paint/displayList/overlays.test.d.ts +2 -0
- package/dist/paint/displayList/overlays.test.d.ts.map +1 -0
- package/dist/paint/displayList/overlays.test.js +241 -0
- package/dist/paint/displayList/overlays.test.js.map +1 -0
- package/dist/paint/displayList/page.d.ts +8 -0
- package/dist/paint/displayList/page.d.ts.map +1 -0
- package/dist/paint/displayList/page.js +157 -0
- package/dist/paint/displayList/page.js.map +1 -0
- package/dist/paint/displayList/resource.d.ts +6 -0
- package/dist/paint/displayList/resource.d.ts.map +1 -0
- package/dist/paint/displayList/resource.js +195 -0
- package/dist/paint/displayList/resource.js.map +1 -0
- package/dist/paint/displayList/review.test.d.ts +2 -0
- package/dist/paint/displayList/review.test.d.ts.map +1 -0
- package/dist/paint/displayList/review.test.js +185 -0
- package/dist/paint/displayList/review.test.js.map +1 -0
- package/dist/paint/displayList/source.d.ts +57 -0
- package/dist/paint/displayList/source.d.ts.map +1 -0
- package/dist/paint/displayList/source.js +263 -0
- package/dist/paint/displayList/source.js.map +1 -0
- package/dist/paint/displayList/source.test.d.ts +2 -0
- package/dist/paint/displayList/source.test.d.ts.map +1 -0
- package/dist/paint/displayList/source.test.js +37 -0
- package/dist/paint/displayList/source.test.js.map +1 -0
- package/dist/paint/displayList/types.d.ts +309 -0
- package/dist/paint/displayList/types.d.ts.map +1 -0
- package/dist/paint/displayList/types.js +7 -0
- package/dist/paint/displayList/types.js.map +1 -0
- package/dist/paint/segmentPlainLength.d.ts +9 -0
- package/dist/paint/segmentPlainLength.d.ts.map +1 -0
- package/dist/paint/segmentPlainLength.js +19 -0
- package/dist/paint/segmentPlainLength.js.map +1 -0
- package/dist/parse/sourceMapping.d.ts.map +1 -1
- package/dist/parse/sourceMapping.js +10 -4
- package/dist/parse/sourceMapping.js.map +1 -1
- package/dist/vdt/blocks.d.ts +5 -3
- package/dist/vdt/blocks.d.ts.map +1 -1
- package/dist/word/anchors/anchors.test.d.ts +2 -0
- package/dist/word/anchors/anchors.test.d.ts.map +1 -0
- package/dist/word/anchors/anchors.test.js +88 -0
- package/dist/word/anchors/anchors.test.js.map +1 -0
- package/dist/word/anchors/base64.d.ts +3 -0
- package/dist/word/anchors/base64.d.ts.map +1 -0
- package/dist/word/anchors/base64.js +47 -0
- package/dist/word/anchors/base64.js.map +1 -0
- package/dist/word/anchors/bookmarks.d.ts +11 -0
- package/dist/word/anchors/bookmarks.d.ts.map +1 -0
- package/dist/word/anchors/bookmarks.js +34 -0
- package/dist/word/anchors/bookmarks.js.map +1 -0
- package/dist/word/anchors/exportMap.d.ts +25 -0
- package/dist/word/anchors/exportMap.d.ts.map +1 -0
- package/dist/word/anchors/exportMap.js +131 -0
- package/dist/word/anchors/exportMap.js.map +1 -0
- package/dist/word/anchors/hash.d.ts +7 -0
- package/dist/word/anchors/hash.d.ts.map +1 -0
- package/dist/word/anchors/hash.js +39 -0
- package/dist/word/anchors/hash.js.map +1 -0
- package/dist/word/anchors/index.d.ts +7 -0
- package/dist/word/anchors/index.d.ts.map +1 -0
- package/dist/word/anchors/index.js +9 -0
- package/dist/word/anchors/index.js.map +1 -0
- package/dist/word/anchors/ommlHash.d.ts +8 -0
- package/dist/word/anchors/ommlHash.d.ts.map +1 -0
- package/dist/word/anchors/ommlHash.js +71 -0
- package/dist/word/anchors/ommlHash.js.map +1 -0
- package/dist/word/anchors/types.d.ts +87 -0
- package/dist/word/anchors/types.d.ts.map +1 -0
- package/dist/word/anchors/types.js +8 -0
- package/dist/word/anchors/types.js.map +1 -0
- package/dist/word/fonts/cmap.d.ts +13 -0
- package/dist/word/fonts/cmap.d.ts.map +1 -0
- package/dist/word/fonts/cmap.js +235 -0
- package/dist/word/fonts/cmap.js.map +1 -0
- package/dist/word/fonts/fonts.test.d.ts +2 -0
- package/dist/word/fonts/fonts.test.d.ts.map +1 -0
- package/dist/word/fonts/fonts.test.js +459 -0
- package/dist/word/fonts/fonts.test.js.map +1 -0
- package/dist/word/fonts/glyf.d.ts +21 -0
- package/dist/word/fonts/glyf.d.ts.map +1 -0
- package/dist/word/fonts/glyf.js +139 -0
- package/dist/word/fonts/glyf.js.map +1 -0
- package/dist/word/fonts/gsub.d.ts +8 -0
- package/dist/word/fonts/gsub.d.ts.map +1 -0
- package/dist/word/fonts/gsub.js +145 -0
- package/dist/word/fonts/gsub.js.map +1 -0
- package/dist/word/fonts/gsub.test.d.ts +2 -0
- package/dist/word/fonts/gsub.test.d.ts.map +1 -0
- package/dist/word/fonts/gsub.test.js +98 -0
- package/dist/word/fonts/gsub.test.js.map +1 -0
- package/dist/word/fonts/index.d.ts +6 -0
- package/dist/word/fonts/index.d.ts.map +1 -0
- package/dist/word/fonts/index.js +5 -0
- package/dist/word/fonts/index.js.map +1 -0
- package/dist/word/fonts/merge.d.ts +7 -0
- package/dist/word/fonts/merge.d.ts.map +1 -0
- package/dist/word/fonts/merge.js +222 -0
- package/dist/word/fonts/merge.js.map +1 -0
- package/dist/word/fonts/meta.d.ts +33 -0
- package/dist/word/fonts/meta.d.ts.map +1 -0
- package/dist/word/fonts/meta.js +206 -0
- package/dist/word/fonts/meta.js.map +1 -0
- package/dist/word/fonts/plan.d.ts +31 -0
- package/dist/word/fonts/plan.d.ts.map +1 -0
- package/dist/word/fonts/plan.js +275 -0
- package/dist/word/fonts/plan.js.map +1 -0
- package/dist/word/fonts/sfnt.d.ts +47 -0
- package/dist/word/fonts/sfnt.d.ts.map +1 -0
- package/dist/word/fonts/sfnt.js +202 -0
- package/dist/word/fonts/sfnt.js.map +1 -0
- package/dist/word/fonts/types.d.ts +54 -0
- package/dist/word/fonts/types.d.ts.map +1 -0
- package/dist/word/fonts/types.js +5 -0
- package/dist/word/fonts/types.js.map +1 -0
- package/dist/word/formatted/displayRoundTrip.test.d.ts +2 -0
- package/dist/word/formatted/displayRoundTrip.test.d.ts.map +1 -0
- package/dist/word/formatted/displayRoundTrip.test.js +99 -0
- package/dist/word/formatted/displayRoundTrip.test.js.map +1 -0
- package/dist/word/formatted/drawing.d.ts +61 -0
- package/dist/word/formatted/drawing.d.ts.map +1 -0
- package/dist/word/formatted/drawing.js +85 -0
- package/dist/word/formatted/drawing.js.map +1 -0
- package/dist/word/formatted/dump.test.d.ts +2 -0
- package/dist/word/formatted/dump.test.d.ts.map +1 -0
- package/dist/word/formatted/dump.test.js +31 -0
- package/dist/word/formatted/dump.test.js.map +1 -0
- package/dist/word/formatted/eastAsian.d.ts +68 -0
- package/dist/word/formatted/eastAsian.d.ts.map +1 -0
- package/dist/word/formatted/eastAsian.js +144 -0
- package/dist/word/formatted/eastAsian.js.map +1 -0
- package/dist/word/formatted/formatted.test-helper.d.ts +34 -0
- package/dist/word/formatted/formatted.test-helper.d.ts.map +1 -0
- package/dist/word/formatted/formatted.test-helper.js +138 -0
- package/dist/word/formatted/formatted.test-helper.js.map +1 -0
- package/dist/word/formatted/formatted.test.d.ts +2 -0
- package/dist/word/formatted/formatted.test.d.ts.map +1 -0
- package/dist/word/formatted/formatted.test.js +285 -0
- package/dist/word/formatted/formatted.test.js.map +1 -0
- package/dist/word/formatted/fragments.d.ts +30 -0
- package/dist/word/formatted/fragments.d.ts.map +1 -0
- package/dist/word/formatted/fragments.js +98 -0
- package/dist/word/formatted/fragments.js.map +1 -0
- package/dist/word/formatted/graphics.test.d.ts +2 -0
- package/dist/word/formatted/graphics.test.d.ts.map +1 -0
- package/dist/word/formatted/graphics.test.js +204 -0
- package/dist/word/formatted/graphics.test.js.map +1 -0
- package/dist/word/formatted/index.d.ts +8 -0
- package/dist/word/formatted/index.d.ts.map +1 -0
- package/dist/word/formatted/index.js +103 -0
- package/dist/word/formatted/index.js.map +1 -0
- package/dist/word/formatted/inline.test.d.ts +2 -0
- package/dist/word/formatted/inline.test.d.ts.map +1 -0
- package/dist/word/formatted/inline.test.js +154 -0
- package/dist/word/formatted/inline.test.js.map +1 -0
- package/dist/word/formatted/inlineShapes.d.ts +13 -0
- package/dist/word/formatted/inlineShapes.d.ts.map +1 -0
- package/dist/word/formatted/inlineShapes.js +79 -0
- package/dist/word/formatted/inlineShapes.js.map +1 -0
- package/dist/word/formatted/metrics.d.ts +54 -0
- package/dist/word/formatted/metrics.d.ts.map +1 -0
- package/dist/word/formatted/metrics.js +165 -0
- package/dist/word/formatted/metrics.js.map +1 -0
- package/dist/word/formatted/page.d.ts +16 -0
- package/dist/word/formatted/page.d.ts.map +1 -0
- package/dist/word/formatted/page.js +82 -0
- package/dist/word/formatted/page.js.map +1 -0
- package/dist/word/formatted/paragraphs.d.ts +98 -0
- package/dist/word/formatted/paragraphs.d.ts.map +1 -0
- package/dist/word/formatted/paragraphs.js +364 -0
- package/dist/word/formatted/paragraphs.js.map +1 -0
- package/dist/word/formatted/pictures.d.ts +27 -0
- package/dist/word/formatted/pictures.d.ts.map +1 -0
- package/dist/word/formatted/pictures.js +239 -0
- package/dist/word/formatted/pictures.js.map +1 -0
- package/dist/word/formatted/review.test.d.ts +2 -0
- package/dist/word/formatted/review.test.d.ts.map +1 -0
- package/dist/word/formatted/review.test.js +141 -0
- package/dist/word/formatted/review.test.js.map +1 -0
- package/dist/word/formatted/runs.d.ts +135 -0
- package/dist/word/formatted/runs.d.ts.map +1 -0
- package/dist/word/formatted/runs.js +433 -0
- package/dist/word/formatted/runs.js.map +1 -0
- package/dist/word/formatted/scripts.test.d.ts +2 -0
- package/dist/word/formatted/scripts.test.d.ts.map +1 -0
- package/dist/word/formatted/scripts.test.js +201 -0
- package/dist/word/formatted/scripts.test.js.map +1 -0
- package/dist/word/formatted/shapes.d.ts +29 -0
- package/dist/word/formatted/shapes.d.ts.map +1 -0
- package/dist/word/formatted/shapes.js +101 -0
- package/dist/word/formatted/shapes.js.map +1 -0
- package/dist/word/formatted/styles.d.ts +17 -0
- package/dist/word/formatted/styles.d.ts.map +1 -0
- package/dist/word/formatted/styles.js +91 -0
- package/dist/word/formatted/styles.js.map +1 -0
- package/dist/word/formatted/tables.d.ts +13 -0
- package/dist/word/formatted/tables.d.ts.map +1 -0
- package/dist/word/formatted/tables.js +159 -0
- package/dist/word/formatted/tables.js.map +1 -0
- package/dist/word/formatted/text.d.ts +32 -0
- package/dist/word/formatted/text.d.ts.map +1 -0
- package/dist/word/formatted/text.js +115 -0
- package/dist/word/formatted/text.js.map +1 -0
- package/dist/word/formatted/types.d.ts +68 -0
- package/dist/word/formatted/types.d.ts.map +1 -0
- package/dist/word/formatted/types.js +4 -0
- package/dist/word/formatted/types.js.map +1 -0
- package/dist/word/formatted/units.d.ts +23 -0
- package/dist/word/formatted/units.d.ts.map +1 -0
- package/dist/word/formatted/units.js +51 -0
- package/dist/word/formatted/units.js.map +1 -0
- package/dist/word/formatted/widths.test.d.ts +2 -0
- package/dist/word/formatted/widths.test.d.ts.map +1 -0
- package/dist/word/formatted/widths.test.js +327 -0
- package/dist/word/formatted/widths.test.js.map +1 -0
- package/dist/word/index.d.ts +13 -2
- package/dist/word/index.d.ts.map +1 -1
- package/dist/word/index.js +14 -5
- package/dist/word/index.js.map +1 -1
- package/dist/word/integration/corpus.known.test.d.ts +2 -0
- package/dist/word/integration/corpus.known.test.d.ts.map +1 -0
- package/dist/word/integration/corpus.known.test.js +42 -0
- package/dist/word/integration/corpus.known.test.js.map +1 -0
- package/dist/word/integration/corpus.test.d.ts +2 -0
- package/dist/word/integration/corpus.test.d.ts.map +1 -0
- package/dist/word/integration/corpus.test.js +352 -0
- package/dist/word/integration/corpus.test.js.map +1 -0
- package/dist/word/integration/formatted.test.d.ts +2 -0
- package/dist/word/integration/formatted.test.d.ts.map +1 -0
- package/dist/word/integration/formatted.test.js +125 -0
- package/dist/word/integration/formatted.test.js.map +1 -0
- package/dist/word/integration/integration.test-helper.d.ts +16 -0
- package/dist/word/integration/integration.test-helper.d.ts.map +1 -0
- package/dist/word/integration/integration.test-helper.js +48 -0
- package/dist/word/integration/integration.test-helper.js.map +1 -0
- package/dist/word/integration/sample.test-helper.d.ts +5 -0
- package/dist/word/integration/sample.test-helper.d.ts.map +1 -0
- package/dist/word/integration/sample.test-helper.js +48 -0
- package/dist/word/integration/sample.test-helper.js.map +1 -0
- package/dist/word/integration/semantic.test.d.ts +2 -0
- package/dist/word/integration/semantic.test.d.ts.map +1 -0
- package/dist/word/integration/semantic.test.js +111 -0
- package/dist/word/integration/semantic.test.js.map +1 -0
- package/dist/word/integration/wordEdit.test-helper.d.ts +14 -0
- package/dist/word/integration/wordEdit.test-helper.d.ts.map +1 -0
- package/dist/word/integration/wordEdit.test-helper.js +150 -0
- package/dist/word/integration/wordEdit.test-helper.js.map +1 -0
- package/dist/word/omml.d.ts.map +1 -1
- package/dist/word/omml.js +17 -5
- package/dist/word/omml.js.map +1 -1
- package/dist/word/omml.test.d.ts +2 -0
- package/dist/word/omml.test.d.ts.map +1 -0
- package/dist/word/omml.test.js +46 -0
- package/dist/word/omml.test.js.map +1 -0
- package/dist/word/ommlWrite/convert.d.ts +20 -0
- package/dist/word/ommlWrite/convert.d.ts.map +1 -0
- package/dist/word/ommlWrite/convert.js +311 -0
- package/dist/word/ommlWrite/convert.js.map +1 -0
- package/dist/word/ommlWrite/index.d.ts +25 -0
- package/dist/word/ommlWrite/index.d.ts.map +1 -0
- package/dist/word/ommlWrite/index.js +80 -0
- package/dist/word/ommlWrite/index.js.map +1 -0
- package/dist/word/ommlWrite/mml.d.ts +49 -0
- package/dist/word/ommlWrite/mml.d.ts.map +1 -0
- package/dist/word/ommlWrite/mml.js +73 -0
- package/dist/word/ommlWrite/mml.js.map +1 -0
- package/dist/word/ommlWrite/ommlWrite.test.d.ts +2 -0
- package/dist/word/ommlWrite/ommlWrite.test.d.ts.map +1 -0
- package/dist/word/ommlWrite/ommlWrite.test.js +230 -0
- package/dist/word/ommlWrite/ommlWrite.test.js.map +1 -0
- package/dist/word/ommlWrite/rows.d.ts +6 -0
- package/dist/word/ommlWrite/rows.d.ts.map +1 -0
- package/dist/word/ommlWrite/rows.js +216 -0
- package/dist/word/ommlWrite/rows.js.map +1 -0
- package/dist/word/ommlWrite/runs.d.ts +30 -0
- package/dist/word/ommlWrite/runs.d.ts.map +1 -0
- package/dist/word/ommlWrite/runs.js +122 -0
- package/dist/word/ommlWrite/runs.js.map +1 -0
- package/dist/word/ommlWrite/tables.d.ts +4 -0
- package/dist/word/ommlWrite/tables.d.ts.map +1 -0
- package/dist/word/ommlWrite/tables.js +50 -0
- package/dist/word/ommlWrite/tables.js.map +1 -0
- package/dist/word/ooxml/constants.d.ts +54 -0
- package/dist/word/ooxml/constants.d.ts.map +1 -0
- package/dist/word/ooxml/constants.js +85 -0
- package/dist/word/ooxml/constants.js.map +1 -0
- package/dist/word/ooxml/fonts.d.ts +16 -0
- package/dist/word/ooxml/fonts.d.ts.map +1 -0
- package/dist/word/ooxml/fonts.js +71 -0
- package/dist/word/ooxml/fonts.js.map +1 -0
- package/dist/word/ooxml/index.d.ts +7 -0
- package/dist/word/ooxml/index.d.ts.map +1 -0
- package/dist/word/ooxml/index.js +7 -0
- package/dist/word/ooxml/index.js.map +1 -0
- package/dist/word/ooxml/package.d.ts +21 -0
- package/dist/word/ooxml/package.d.ts.map +1 -0
- package/dist/word/ooxml/package.js +202 -0
- package/dist/word/ooxml/package.js.map +1 -0
- package/dist/word/ooxml/package.test.d.ts +2 -0
- package/dist/word/ooxml/package.test.d.ts.map +1 -0
- package/dist/word/ooxml/package.test.js +176 -0
- package/dist/word/ooxml/package.test.js.map +1 -0
- package/dist/word/ooxml/parts.d.ts +28 -0
- package/dist/word/ooxml/parts.d.ts.map +1 -0
- package/dist/word/ooxml/parts.js +172 -0
- package/dist/word/ooxml/parts.js.map +1 -0
- package/dist/word/ooxml/review.test.d.ts +2 -0
- package/dist/word/ooxml/review.test.d.ts.map +1 -0
- package/dist/word/ooxml/review.test.js +104 -0
- package/dist/word/ooxml/review.test.js.map +1 -0
- package/dist/word/ooxml/types.d.ts +85 -0
- package/dist/word/ooxml/types.d.ts.map +1 -0
- package/dist/word/ooxml/types.js +6 -0
- package/dist/word/ooxml/types.js.map +1 -0
- package/dist/word/ooxml/validate.d.ts +3 -0
- package/dist/word/ooxml/validate.d.ts.map +1 -0
- package/dist/word/ooxml/validate.js +122 -0
- package/dist/word/ooxml/validate.js.map +1 -0
- package/dist/word/ooxml/wellFormed.d.ts +3 -0
- package/dist/word/ooxml/wellFormed.d.ts.map +1 -0
- package/dist/word/ooxml/wellFormed.js +79 -0
- package/dist/word/ooxml/wellFormed.js.map +1 -0
- package/dist/word/roundtrip/added.d.ts +31 -0
- package/dist/word/roundtrip/added.d.ts.map +1 -0
- package/dist/word/roundtrip/added.js +199 -0
- package/dist/word/roundtrip/added.js.map +1 -0
- package/dist/word/roundtrip/added.test.d.ts +2 -0
- package/dist/word/roundtrip/added.test.d.ts.map +1 -0
- package/dist/word/roundtrip/added.test.js +59 -0
- package/dist/word/roundtrip/added.test.js.map +1 -0
- package/dist/word/roundtrip/apply.d.ts +11 -0
- package/dist/word/roundtrip/apply.d.ts.map +1 -0
- package/dist/word/roundtrip/apply.js +260 -0
- package/dist/word/roundtrip/apply.js.map +1 -0
- package/dist/word/roundtrip/blocks.d.ts +56 -0
- package/dist/word/roundtrip/blocks.d.ts.map +1 -0
- package/dist/word/roundtrip/blocks.js +145 -0
- package/dist/word/roundtrip/blocks.js.map +1 -0
- package/dist/word/roundtrip/corpus.test.d.ts +2 -0
- package/dist/word/roundtrip/corpus.test.d.ts.map +1 -0
- package/dist/word/roundtrip/corpus.test.js +54 -0
- package/dist/word/roundtrip/corpus.test.js.map +1 -0
- package/dist/word/roundtrip/diff.d.ts +15 -0
- package/dist/word/roundtrip/diff.d.ts.map +1 -0
- package/dist/word/roundtrip/diff.js +160 -0
- package/dist/word/roundtrip/diff.js.map +1 -0
- package/dist/word/roundtrip/diff.test.d.ts +2 -0
- package/dist/word/roundtrip/diff.test.d.ts.map +1 -0
- package/dist/word/roundtrip/diff.test.js +79 -0
- package/dist/word/roundtrip/diff.test.js.map +1 -0
- package/dist/word/roundtrip/edits.d.ts +34 -0
- package/dist/word/roundtrip/edits.d.ts.map +1 -0
- package/dist/word/roundtrip/edits.js +467 -0
- package/dist/word/roundtrip/edits.js.map +1 -0
- package/dist/word/roundtrip/fixture.test-helper.d.ts +62 -0
- package/dist/word/roundtrip/fixture.test-helper.d.ts.map +1 -0
- package/dist/word/roundtrip/fixture.test-helper.js +258 -0
- package/dist/word/roundtrip/fixture.test-helper.js.map +1 -0
- package/dist/word/roundtrip/formats.d.ts +6 -0
- package/dist/word/roundtrip/formats.d.ts.map +1 -0
- package/dist/word/roundtrip/formats.js +102 -0
- package/dist/word/roundtrip/formats.js.map +1 -0
- package/dist/word/roundtrip/formatted.test.d.ts +2 -0
- package/dist/word/roundtrip/formatted.test.d.ts.map +1 -0
- package/dist/word/roundtrip/formatted.test.js +93 -0
- package/dist/word/roundtrip/formatted.test.js.map +1 -0
- package/dist/word/roundtrip/holders.test.d.ts +2 -0
- package/dist/word/roundtrip/holders.test.d.ts.map +1 -0
- package/dist/word/roundtrip/holders.test.js +109 -0
- package/dist/word/roundtrip/holders.test.js.map +1 -0
- package/dist/word/roundtrip/index.d.ts +6 -0
- package/dist/word/roundtrip/index.d.ts.map +1 -0
- package/dist/word/roundtrip/index.js +9 -0
- package/dist/word/roundtrip/index.js.map +1 -0
- package/dist/word/roundtrip/markup.d.ts +35 -0
- package/dist/word/roundtrip/markup.d.ts.map +1 -0
- package/dist/word/roundtrip/markup.js +168 -0
- package/dist/word/roundtrip/markup.js.map +1 -0
- package/dist/word/roundtrip/math.d.ts +12 -0
- package/dist/word/roundtrip/math.d.ts.map +1 -0
- package/dist/word/roundtrip/math.js +47 -0
- package/dist/word/roundtrip/math.js.map +1 -0
- package/dist/word/roundtrip/math.test.d.ts +2 -0
- package/dist/word/roundtrip/math.test.d.ts.map +1 -0
- package/dist/word/roundtrip/math.test.js +63 -0
- package/dist/word/roundtrip/math.test.js.map +1 -0
- package/dist/word/roundtrip/merge.d.ts +21 -0
- package/dist/word/roundtrip/merge.d.ts.map +1 -0
- package/dist/word/roundtrip/merge.js +81 -0
- package/dist/word/roundtrip/merge.js.map +1 -0
- package/dist/word/roundtrip/paragraphs.test.d.ts +2 -0
- package/dist/word/roundtrip/paragraphs.test.d.ts.map +1 -0
- package/dist/word/roundtrip/paragraphs.test.js +44 -0
- package/dist/word/roundtrip/paragraphs.test.js.map +1 -0
- package/dist/word/roundtrip/read.d.ts +60 -0
- package/dist/word/roundtrip/read.d.ts.map +1 -0
- package/dist/word/roundtrip/read.js +247 -0
- package/dist/word/roundtrip/read.js.map +1 -0
- package/dist/word/roundtrip/review.test.d.ts +2 -0
- package/dist/word/roundtrip/review.test.d.ts.map +1 -0
- package/dist/word/roundtrip/review.test.js +76 -0
- package/dist/word/roundtrip/review.test.js.map +1 -0
- package/dist/word/roundtrip/semantic.test.d.ts +2 -0
- package/dist/word/roundtrip/semantic.test.d.ts.map +1 -0
- package/dist/word/roundtrip/semantic.test.js +121 -0
- package/dist/word/roundtrip/semantic.test.js.map +1 -0
- package/dist/word/roundtrip/targets.d.ts +26 -0
- package/dist/word/roundtrip/targets.d.ts.map +1 -0
- package/dist/word/roundtrip/targets.js +58 -0
- package/dist/word/roundtrip/targets.js.map +1 -0
- package/dist/word/roundtrip/types.d.ts +46 -0
- package/dist/word/roundtrip/types.d.ts.map +1 -0
- package/dist/word/roundtrip/types.js +4 -0
- package/dist/word/roundtrip/types.js.map +1 -0
- package/dist/word/roundtrip/walk.d.ts +66 -0
- package/dist/word/roundtrip/walk.d.ts.map +1 -0
- package/dist/word/roundtrip/walk.js +328 -0
- package/dist/word/roundtrip/walk.js.map +1 -0
- package/dist/word/roundtrip/writers.test.d.ts +2 -0
- package/dist/word/roundtrip/writers.test.d.ts.map +1 -0
- package/dist/word/roundtrip/writers.test.js +51 -0
- package/dist/word/roundtrip/writers.test.js.map +1 -0
- package/dist/word/semantic/atoms.d.ts +14 -0
- package/dist/word/semantic/atoms.d.ts.map +1 -0
- package/dist/word/semantic/atoms.js +85 -0
- package/dist/word/semantic/atoms.js.map +1 -0
- package/dist/word/semantic/blocks.d.ts +39 -0
- package/dist/word/semantic/blocks.d.ts.map +1 -0
- package/dist/word/semantic/blocks.js +260 -0
- package/dist/word/semantic/blocks.js.map +1 -0
- package/dist/word/semantic/chapter.d.ts +17 -0
- package/dist/word/semantic/chapter.d.ts.map +1 -0
- package/dist/word/semantic/chapter.js +56 -0
- package/dist/word/semantic/chapter.js.map +1 -0
- package/dist/word/semantic/constructs.test.d.ts +2 -0
- package/dist/word/semantic/constructs.test.d.ts.map +1 -0
- package/dist/word/semantic/constructs.test.js +267 -0
- package/dist/word/semantic/constructs.test.js.map +1 -0
- package/dist/word/semantic/containers.d.ts +8 -0
- package/dist/word/semantic/containers.d.ts.map +1 -0
- package/dist/word/semantic/containers.js +141 -0
- package/dist/word/semantic/containers.js.map +1 -0
- package/dist/word/semantic/context.d.ts +83 -0
- package/dist/word/semantic/context.d.ts.map +1 -0
- package/dist/word/semantic/context.js +9 -0
- package/dist/word/semantic/context.js.map +1 -0
- package/dist/word/semantic/corpus.test.d.ts +2 -0
- package/dist/word/semantic/corpus.test.d.ts.map +1 -0
- package/dist/word/semantic/corpus.test.js +80 -0
- package/dist/word/semantic/corpus.test.js.map +1 -0
- package/dist/word/semantic/engineNumbers.d.ts +31 -0
- package/dist/word/semantic/engineNumbers.d.ts.map +1 -0
- package/dist/word/semantic/engineNumbers.js +66 -0
- package/dist/word/semantic/engineNumbers.js.map +1 -0
- package/dist/word/semantic/figures.d.ts +8 -0
- package/dist/word/semantic/figures.d.ts.map +1 -0
- package/dist/word/semantic/figures.js +175 -0
- package/dist/word/semantic/figures.js.map +1 -0
- package/dist/word/semantic/fixtures/harness.d.ts +20 -0
- package/dist/word/semantic/fixtures/harness.d.ts.map +1 -0
- package/dist/word/semantic/fixtures/harness.js +89 -0
- package/dist/word/semantic/fixtures/harness.js.map +1 -0
- package/dist/word/semantic/fragments.d.ts +48 -0
- package/dist/word/semantic/fragments.d.ts.map +1 -0
- package/dist/word/semantic/fragments.js +109 -0
- package/dist/word/semantic/fragments.js.map +1 -0
- package/dist/word/semantic/index.d.ts +25 -0
- package/dist/word/semantic/index.d.ts.map +1 -0
- package/dist/word/semantic/index.js +141 -0
- package/dist/word/semantic/index.js.map +1 -0
- package/dist/word/semantic/inline.d.ts +34 -0
- package/dist/word/semantic/inline.d.ts.map +1 -0
- package/dist/word/semantic/inline.js +210 -0
- package/dist/word/semantic/inline.js.map +1 -0
- package/dist/word/semantic/inspect.d.ts +6 -0
- package/dist/word/semantic/inspect.d.ts.map +1 -0
- package/dist/word/semantic/inspect.js +102 -0
- package/dist/word/semantic/inspect.js.map +1 -0
- package/dist/word/semantic/marks.d.ts +30 -0
- package/dist/word/semantic/marks.d.ts.map +1 -0
- package/dist/word/semantic/marks.js +87 -0
- package/dist/word/semantic/marks.js.map +1 -0
- package/dist/word/semantic/numbering.d.ts +18 -0
- package/dist/word/semantic/numbering.d.ts.map +1 -0
- package/dist/word/semantic/numbering.js +93 -0
- package/dist/word/semantic/numbering.js.map +1 -0
- package/dist/word/semantic/numbers.test.d.ts +2 -0
- package/dist/word/semantic/numbers.test.d.ts.map +1 -0
- package/dist/word/semantic/numbers.test.js +53 -0
- package/dist/word/semantic/numbers.test.js.map +1 -0
- package/dist/word/semantic/raw.d.ts +8 -0
- package/dist/word/semantic/raw.d.ts.map +1 -0
- package/dist/word/semantic/raw.js +42 -0
- package/dist/word/semantic/raw.js.map +1 -0
- package/dist/word/semantic/review.test.d.ts +2 -0
- package/dist/word/semantic/review.test.d.ts.map +1 -0
- package/dist/word/semantic/review.test.js +88 -0
- package/dist/word/semantic/review.test.js.map +1 -0
- package/dist/word/semantic/sections.d.ts +25 -0
- package/dist/word/semantic/sections.d.ts.map +1 -0
- package/dist/word/semantic/sections.js +83 -0
- package/dist/word/semantic/sections.js.map +1 -0
- package/dist/word/semantic/snippet.d.ts +10 -0
- package/dist/word/semantic/snippet.d.ts.map +1 -0
- package/dist/word/semantic/snippet.js +34 -0
- package/dist/word/semantic/snippet.js.map +1 -0
- package/dist/word/semantic/styles.d.ts +66 -0
- package/dist/word/semantic/styles.d.ts.map +1 -0
- package/dist/word/semantic/styles.js +354 -0
- package/dist/word/semantic/styles.js.map +1 -0
- package/dist/word/semantic/tables.d.ts +4 -0
- package/dist/word/semantic/tables.d.ts.map +1 -0
- package/dist/word/semantic/tables.js +114 -0
- package/dist/word/semantic/tables.js.map +1 -0
- package/dist/word/semantic/types.d.ts +9 -0
- package/dist/word/semantic/types.d.ts.map +1 -0
- package/dist/word/semantic/types.js +3 -0
- package/dist/word/semantic/types.js.map +1 -0
- package/dist/word/semantic/wml.d.ts +104 -0
- package/dist/word/semantic/wml.d.ts.map +1 -0
- package/dist/word/semantic/wml.js +192 -0
- package/dist/word/semantic/wml.js.map +1 -0
- package/dist/word/word.test.js +31 -53
- package/dist/word/word.test.js.map +1 -1
- package/dist/word/xml.d.ts +16 -0
- package/dist/word/xml.d.ts.map +1 -1
- package/dist/word/xml.js +61 -15
- package/dist/word/xml.js.map +1 -1
- package/dist/word/xml.test.d.ts +2 -0
- package/dist/word/xml.test.d.ts.map +1 -0
- package/dist/word/xml.test.js +46 -0
- package/dist/word/xml.test.js.map +1 -0
- package/package.json +1 -1
- package/dist/word/toDocx/parse.d.ts +0 -46
- package/dist/word/toDocx/parse.d.ts.map +0 -1
- package/dist/word/toDocx/parse.js +0 -313
- package/dist/word/toDocx/parse.js.map +0 -1
- package/dist/word/toDocx/styles.d.ts +0 -63
- package/dist/word/toDocx/styles.d.ts.map +0 -1
- package/dist/word/toDocx/styles.js +0 -239
- package/dist/word/toDocx/styles.js.map +0 -1
- package/dist/word/toDocx/wordml.d.ts +0 -24
- package/dist/word/toDocx/wordml.d.ts.map +0 -1
- package/dist/word/toDocx/wordml.js +0 -114
- package/dist/word/toDocx/wordml.js.map +0 -1
- package/dist/word/toDocx.d.ts +0 -6
- package/dist/word/toDocx.d.ts.map +0 -1
- package/dist/word/toDocx.js +0 -157
- package/dist/word/toDocx.js.map +0 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// The export map's custom XML part (#1389): JSON → deflate → base64 inside
|
|
2
|
+
// `<postextExportMap xmlns="https://postext.dev/ns/docx-map/1">`. Fragment
|
|
3
|
+
// `map` arrays are stored as runs of consecutive offsets (`m`), which the
|
|
4
|
+
// deflate pass then shrinks further; decoding restores them exactly.
|
|
5
|
+
import { deflateSync, inflateSync, strFromU8, strToU8 } from 'fflate';
|
|
6
|
+
import { attr, children, escapeAttr, localName, parseXml, textOf } from '../xml.js';
|
|
7
|
+
import { base64Decode, base64Encode } from './base64.js';
|
|
8
|
+
import { EXPORT_MAP_NS, EXPORT_MAP_ROOT } from './types.js';
|
|
9
|
+
/** Custom document properties (docProps/custom.xml) the package writes. */
|
|
10
|
+
export const PROP_EXPORT_ID = 'postext.exportId';
|
|
11
|
+
export const PROP_VARIANT = 'postext.variant';
|
|
12
|
+
export const PROP_VERSION = 'postext.version';
|
|
13
|
+
/** Runs of a source-offset map as flat `[start, length]` pairs: a run of
|
|
14
|
+
* `start, start+1, …`, or of repeated -1 (synthetic characters). */
|
|
15
|
+
export function encodeOffsetRuns(map) {
|
|
16
|
+
const out = [];
|
|
17
|
+
let i = 0;
|
|
18
|
+
while (i < map.length) {
|
|
19
|
+
const start = map[i];
|
|
20
|
+
let len = 1;
|
|
21
|
+
if (start === -1)
|
|
22
|
+
while (i + len < map.length && map[i + len] === -1)
|
|
23
|
+
len++;
|
|
24
|
+
else
|
|
25
|
+
while (i + len < map.length && map[i + len] === start + len)
|
|
26
|
+
len++;
|
|
27
|
+
out.push(start, len);
|
|
28
|
+
i += len;
|
|
29
|
+
}
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
export function decodeOffsetRuns(runs) {
|
|
33
|
+
const out = [];
|
|
34
|
+
for (let i = 0; i + 1 < runs.length; i += 2) {
|
|
35
|
+
const start = runs[i];
|
|
36
|
+
const len = runs[i + 1];
|
|
37
|
+
for (let k = 0; k < len; k++)
|
|
38
|
+
out.push(start === -1 ? -1 : start + k);
|
|
39
|
+
}
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
42
|
+
function packFragment(f) {
|
|
43
|
+
const { map, ...rest } = f;
|
|
44
|
+
return { ...rest, m: encodeOffsetRuns(map) };
|
|
45
|
+
}
|
|
46
|
+
function unpackFragment(f) {
|
|
47
|
+
const { m, ...rest } = f;
|
|
48
|
+
return { ...rest, map: decodeOffsetRuns(m) };
|
|
49
|
+
}
|
|
50
|
+
/** The whole custom XML part for a map. */
|
|
51
|
+
export function encodeExportMap(map) {
|
|
52
|
+
const stored = { ...map, fragments: map.fragments.map(packFragment) };
|
|
53
|
+
const payload = base64Encode(deflateSync(strToU8(JSON.stringify(stored)), { level: 9 }));
|
|
54
|
+
return ('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' +
|
|
55
|
+
`<${EXPORT_MAP_ROOT} xmlns="${EXPORT_MAP_NS}" v="${map.version}" exportId="${escapeAttr(map.exportId)}" variant="${map.variant}" engine="${escapeAttr(map.engine)}">` +
|
|
56
|
+
payload +
|
|
57
|
+
`</${EXPORT_MAP_ROOT}>`);
|
|
58
|
+
}
|
|
59
|
+
/** Whether a parsed root element is an export map part (by name and namespace). */
|
|
60
|
+
function isMapRoot(root) {
|
|
61
|
+
if (localName(root.name) !== EXPORT_MAP_ROOT)
|
|
62
|
+
return false;
|
|
63
|
+
const prefix = root.name.includes(':') ? root.name.slice(0, root.name.indexOf(':')) : '';
|
|
64
|
+
return (prefix ? root.attrs[`xmlns:${prefix}`] : root.attrs.xmlns) === EXPORT_MAP_NS;
|
|
65
|
+
}
|
|
66
|
+
/** Decode a map part written by {@link encodeExportMap}. Throws on a part
|
|
67
|
+
* that is not a version 1 export map. */
|
|
68
|
+
export function decodeExportMap(xml) {
|
|
69
|
+
const root = parseXml(xml);
|
|
70
|
+
if (!isMapRoot(root))
|
|
71
|
+
throw new Error('decodeExportMap: not a postext export map part');
|
|
72
|
+
const json = strFromU8(inflateSync(base64Decode(textOf(root))));
|
|
73
|
+
const stored = JSON.parse(json);
|
|
74
|
+
if (stored.version !== 1)
|
|
75
|
+
throw new Error(`decodeExportMap: unsupported version ${String(stored.version)}`);
|
|
76
|
+
return { ...stored, fragments: stored.fragments.map(unpackFragment) };
|
|
77
|
+
}
|
|
78
|
+
/** A custom document property's string value. */
|
|
79
|
+
export function readCustomProp(files, name) {
|
|
80
|
+
const bytes = files['docProps/custom.xml'];
|
|
81
|
+
if (!bytes)
|
|
82
|
+
return undefined;
|
|
83
|
+
try {
|
|
84
|
+
for (const p of children(parseXml(xmlPartText(bytes)), 'property')) {
|
|
85
|
+
if (attr(p, 'name') === name)
|
|
86
|
+
return textOf(p).trim();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
/** Text of an XML part: UTF-8, or UTF-16 when it starts with a byte order
|
|
95
|
+
* mark (Word may re-save custom XML items with either BOM). */
|
|
96
|
+
export function xmlPartText(bytes) {
|
|
97
|
+
if (bytes.length >= 2 && ((bytes[0] === 0xff && bytes[1] === 0xfe) || (bytes[0] === 0xfe && bytes[1] === 0xff))) {
|
|
98
|
+
const le = bytes[0] === 0xff;
|
|
99
|
+
let out = '';
|
|
100
|
+
for (let i = 2; i + 1 < bytes.length; i += 2)
|
|
101
|
+
out += String.fromCharCode(le ? bytes[i] | (bytes[i + 1] << 8) : (bytes[i] << 8) | bytes[i + 1]);
|
|
102
|
+
return out;
|
|
103
|
+
}
|
|
104
|
+
const text = strFromU8(bytes);
|
|
105
|
+
return text.charCodeAt(0) === 0xfeff ? text.slice(1) : text;
|
|
106
|
+
}
|
|
107
|
+
/** Find the export map in an unzipped package. The part is located by its
|
|
108
|
+
* root and namespace among `customXml/item*.xml`; when docProps/custom.xml
|
|
109
|
+
* names an export id it must match the map's (a map pasted from another
|
|
110
|
+
* export is ignored). Undefined when there is no valid map. */
|
|
111
|
+
export function readExportMap(files) {
|
|
112
|
+
const expected = readCustomProp(files, PROP_EXPORT_ID);
|
|
113
|
+
for (const path of Object.keys(files).sort()) {
|
|
114
|
+
if (!/^customXml\/item\d+\.xml$/.test(path))
|
|
115
|
+
continue;
|
|
116
|
+
const text = xmlPartText(files[path]);
|
|
117
|
+
if (!text.includes(EXPORT_MAP_ROOT))
|
|
118
|
+
continue;
|
|
119
|
+
try {
|
|
120
|
+
const map = decodeExportMap(text);
|
|
121
|
+
if (expected !== undefined && expected !== map.exportId)
|
|
122
|
+
continue;
|
|
123
|
+
return map;
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=exportMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exportMap.js","sourceRoot":"","sources":["../../../src/word/anchors/exportMap.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,2EAA2E;AAC3E,0EAA0E;AAC1E,qEAAqE;AAErE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAoC,MAAM,YAAY,CAAC;AAE9F,2EAA2E;AAC3E,MAAM,CAAC,MAAM,cAAc,GAAG,kBAAkB,CAAC;AACjD,MAAM,CAAC,MAAM,YAAY,GAAG,iBAAiB,CAAC;AAC9C,MAAM,CAAC,MAAM,YAAY,GAAG,iBAAiB,CAAC;AAE9C;qEACqE;AACrE,MAAM,UAAU,gBAAgB,CAAC,GAAsB;IACrD,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;QACtB,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,CAAE,CAAC;QACtB,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,IAAI,KAAK,KAAK,CAAC,CAAC;YAAE,OAAO,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;gBAAE,GAAG,EAAE,CAAC;;YACvE,OAAO,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,MAAM,I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C;YAAE,SAAS;QAC9C,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;YAClC,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,GAAG,CAAC,QAAQ;gBAAE,SAAS;YAClE,OAAO,GAAG,CAAC;QACb,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** FNV-1a 64 of raw bytes as 16 lowercase hex digits. */
|
|
2
|
+
export declare function hashBytes(bytes: Uint8Array, seed?: string): string;
|
|
3
|
+
/** FNV-1a 64 of a string's UTF-8 bytes as 16 lowercase hex digits. */
|
|
4
|
+
export declare function hashText(s: string): string;
|
|
5
|
+
/** A deterministic `{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}` from any text. */
|
|
6
|
+
export declare function guidFrom(text: string): string;
|
|
7
|
+
//# sourceMappingURL=hash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../../src/word/anchors/hash.ts"],"names":[],"mappings":"AAOA,yDAAyD;AACzD,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAqBlE;AAED,sEAAsE;AACtE,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE1C;AAED,8EAA8E;AAC9E,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG7C"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// FNV-1a 64-bit over UTF-8 bytes: a fast, stable hash for chapter text,
|
|
2
|
+
// media deduplication and deterministic GUIDs. Not cryptographic; no
|
|
3
|
+
// `crypto` dependency. Computed on four 16-bit limbs so plain numbers
|
|
4
|
+
// never lose precision.
|
|
5
|
+
import { strToU8 } from 'fflate';
|
|
6
|
+
/** FNV-1a 64 of raw bytes as 16 lowercase hex digits. */
|
|
7
|
+
export function hashBytes(bytes, seed) {
|
|
8
|
+
// Offset basis 0xcbf29ce484222325, little-endian limbs.
|
|
9
|
+
let h0 = 0x2325, h1 = 0x8422, h2 = 0x9ce4, h3 = 0xcbf2;
|
|
10
|
+
const feed = (data) => {
|
|
11
|
+
for (let i = 0; i < data.length; i++) {
|
|
12
|
+
h0 ^= data[i];
|
|
13
|
+
// × 0x100000001b3 = × (2^40 + 0x1b3).
|
|
14
|
+
const t0 = h0 * 0x1b3;
|
|
15
|
+
const t1 = h1 * 0x1b3 + (t0 >>> 16);
|
|
16
|
+
const t2 = h2 * 0x1b3 + h0 * 0x100 + (t1 >>> 16);
|
|
17
|
+
const t3 = h3 * 0x1b3 + h1 * 0x100 + (t2 >>> 16);
|
|
18
|
+
h0 = t0 & 0xffff;
|
|
19
|
+
h1 = t1 & 0xffff;
|
|
20
|
+
h2 = t2 & 0xffff;
|
|
21
|
+
h3 = t3 & 0xffff;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
if (seed)
|
|
25
|
+
feed(strToU8(seed));
|
|
26
|
+
feed(bytes);
|
|
27
|
+
const hex = (n) => n.toString(16).padStart(4, '0');
|
|
28
|
+
return hex(h3) + hex(h2) + hex(h1) + hex(h0);
|
|
29
|
+
}
|
|
30
|
+
/** FNV-1a 64 of a string's UTF-8 bytes as 16 lowercase hex digits. */
|
|
31
|
+
export function hashText(s) {
|
|
32
|
+
return hashBytes(strToU8(s));
|
|
33
|
+
}
|
|
34
|
+
/** A deterministic `{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}` from any text. */
|
|
35
|
+
export function guidFrom(text) {
|
|
36
|
+
const hex = (hashText(text) + hashText(`${text}\u0000guid`)).toUpperCase();
|
|
37
|
+
return `{${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}}`;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=hash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../../src/word/anchors/hash.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,qEAAqE;AACrE,sEAAsE;AACtE,wBAAwB;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,yDAAyD;AACzD,MAAM,UAAU,SAAS,CAAC,KAAiB,EAAE,IAAa;IACxD,wDAAwD;IACxD,IAAI,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC;IACvD,MAAM,IAAI,GAAG,CAAC,IAAgB,EAAQ,EAAE;QACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACrC,EAAE,IAAI,IAAI,CAAC,CAAC,CAAE,CAAC;YACf,sCAAsC;YACtC,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;YACtB,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;YACpC,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;YACjD,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;YACjD,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;YACjB,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;YACjB,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;YACjB,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;QACnB,CAAC;IACH,CAAC,CAAC;IACF,IAAI,IAAI;QAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9B,IAAI,CAAC,KAAK,CAAC,CAAC;IACZ,MAAM,GAAG,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACnE,OAAO,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,QAAQ,CAAC,CAAS;IAChC,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC3E,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC;AACnH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export { encodeExportMap, decodeExportMap, readExportMap, readCustomProp, xmlPartText, encodeOffsetRuns, decodeOffsetRuns, PROP_EXPORT_ID, PROP_VARIANT, PROP_VERSION } from './exportMap.js';
|
|
3
|
+
export { bookmarkName, newFragmentId, fragmentIdOf, bookmarkStartXml, bookmarkEndXml, MAX_BOOKMARK_NAME } from './bookmarks.js';
|
|
4
|
+
export { hashText, hashBytes, guidFrom } from './hash.js';
|
|
5
|
+
export { ommlHash, canonicalOmml } from './ommlHash.js';
|
|
6
|
+
export { base64Encode, base64Decode } from './base64.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/word/anchors/index.ts"],"names":[],"mappings":"AAGA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9L,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAChI,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Source anchors and the embedded export map shared by both Word variants
|
|
2
|
+
// (#1389).
|
|
3
|
+
export * from './types.js';
|
|
4
|
+
export { encodeExportMap, decodeExportMap, readExportMap, readCustomProp, xmlPartText, encodeOffsetRuns, decodeOffsetRuns, PROP_EXPORT_ID, PROP_VARIANT, PROP_VERSION } from './exportMap.js';
|
|
5
|
+
export { bookmarkName, newFragmentId, fragmentIdOf, bookmarkStartXml, bookmarkEndXml, MAX_BOOKMARK_NAME } from './bookmarks.js';
|
|
6
|
+
export { hashText, hashBytes, guidFrom } from './hash.js';
|
|
7
|
+
export { ommlHash, canonicalOmml } from './ommlHash.js';
|
|
8
|
+
export { base64Encode, base64Decode } from './base64.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/word/anchors/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,WAAW;AAEX,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9L,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAChI,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type XmlElement } from '../xml.js';
|
|
2
|
+
/** The canonical spelling of an `m:oMath` element. */
|
|
3
|
+
export declare function canonicalOmml(el: XmlElement): string;
|
|
4
|
+
/** Hash of the canonical OMML of the first equation in `omml` (an element,
|
|
5
|
+
* or the XML the writer emits, which may hold `m:oMathPara` and runs
|
|
6
|
+
* without namespace declarations). Undefined when there is none. */
|
|
7
|
+
export declare function ommlHash(omml: XmlElement | string): string | undefined;
|
|
8
|
+
//# sourceMappingURL=ommlHash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ommlHash.d.ts","sourceRoot":"","sources":["../../../src/word/anchors/ommlHash.ts"],"names":[],"mappings":"AASA,OAAO,EAAY,KAAK,UAAU,EAAgB,MAAM,WAAW,CAAC;AAsCpE,sDAAsD;AACtD,wBAAgB,aAAa,CAAC,EAAE,EAAE,UAAU,GAAG,MAAM,CAEpD;AAED;;qEAEqE;AACrE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAWtE"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// A stable fingerprint of an equation's OMML (#1395). Word rewrites the
|
|
2
|
+
// equations it opens: it adds rsid attributes, Cambria Math run properties
|
|
3
|
+
// (`w:rPr` inside `m:r`, `m:ctrlPr`), namespace declarations and
|
|
4
|
+
// whitespace. The canonical form keeps only the Office Math structure
|
|
5
|
+
// (elements and attributes in the `m:` namespace, the text of `m:t`), so
|
|
6
|
+
// an equation the user did not touch hashes the same as when it was
|
|
7
|
+
// written, and the importer keeps its TeX byte-identical.
|
|
8
|
+
import { hashText } from './hash.js';
|
|
9
|
+
import { parseXml } from '../xml.js';
|
|
10
|
+
const prefixOf = (name) => (name.includes(':') ? name.slice(0, name.indexOf(':')) : '');
|
|
11
|
+
const localOf = (name) => name.slice(name.indexOf(':') + 1);
|
|
12
|
+
function canonicalNode(el) {
|
|
13
|
+
// Word's control properties only carry run formatting for the editor.
|
|
14
|
+
if (localOf(el.name) === 'ctrlPr')
|
|
15
|
+
return '';
|
|
16
|
+
let inner = '';
|
|
17
|
+
for (const c of el.children)
|
|
18
|
+
inner += typeof c === 'string' ? (localOf(el.name) === 't' ? c : c.trim()) : canonicalChild(c);
|
|
19
|
+
const attrs = Object.keys(el.attrs)
|
|
20
|
+
.filter((k) => prefixOf(k) === 'm')
|
|
21
|
+
.sort()
|
|
22
|
+
.map((k) => ` ${localOf(k)}="${el.attrs[k]}"`)
|
|
23
|
+
.join('');
|
|
24
|
+
const local = localOf(el.name);
|
|
25
|
+
// A property element left empty (Word adds `m:sSupPr` around a
|
|
26
|
+
// `m:ctrlPr`) says nothing.
|
|
27
|
+
if (!inner && !attrs && local.endsWith('Pr'))
|
|
28
|
+
return '';
|
|
29
|
+
return `<${local}${attrs}>${inner}</${local}>`;
|
|
30
|
+
}
|
|
31
|
+
function canonicalChild(node) {
|
|
32
|
+
if (typeof node === 'string')
|
|
33
|
+
return node.trim();
|
|
34
|
+
return prefixOf(node.name) === 'm' ? canonicalNode(node) : '';
|
|
35
|
+
}
|
|
36
|
+
/** The first `m:oMath` at or below `el`. */
|
|
37
|
+
function firstOMath(el) {
|
|
38
|
+
if (localOf(el.name) === 'oMath')
|
|
39
|
+
return el;
|
|
40
|
+
for (const c of el.children) {
|
|
41
|
+
if (typeof c === 'string')
|
|
42
|
+
continue;
|
|
43
|
+
const got = firstOMath(c);
|
|
44
|
+
if (got)
|
|
45
|
+
return got;
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
/** The canonical spelling of an `m:oMath` element. */
|
|
50
|
+
export function canonicalOmml(el) {
|
|
51
|
+
return canonicalNode(el);
|
|
52
|
+
}
|
|
53
|
+
/** Hash of the canonical OMML of the first equation in `omml` (an element,
|
|
54
|
+
* or the XML the writer emits, which may hold `m:oMathPara` and runs
|
|
55
|
+
* without namespace declarations). Undefined when there is none. */
|
|
56
|
+
export function ommlHash(omml) {
|
|
57
|
+
let root;
|
|
58
|
+
if (typeof omml === 'string') {
|
|
59
|
+
try {
|
|
60
|
+
root = parseXml(`<root>${omml}</root>`);
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else
|
|
67
|
+
root = omml;
|
|
68
|
+
const eq = firstOMath(root);
|
|
69
|
+
return eq ? hashText(canonicalOmml(eq)) : undefined;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=ommlHash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ommlHash.js","sourceRoot":"","sources":["../../../src/word/anchors/ommlHash.ts"],"names":[],"mappings":"AAAA,w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ChD,IAAI,IAAgB,CAAC;IACrB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,IAAI,CAAC;YACH,IAAI,GAAG,QAAQ,CAAC,SAAS,IAAI,SAAS,CAAC,CAAC;QAC1C,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;;QAAM,IAAI,GAAG,IAAI,CAAC;IACnB,MAAM,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAC5B,OAAO,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export declare const EXPORT_MAP_NS = "https://postext.dev/ns/docx-map/1";
|
|
2
|
+
export declare const EXPORT_MAP_ROOT = "postextExportMap";
|
|
3
|
+
export declare const BOOKMARK_PREFIX = "_ptx_";
|
|
4
|
+
export type ExportVariant = 'semantic' | 'formatted';
|
|
5
|
+
export interface MapChapter {
|
|
6
|
+
/** Book chapter id (Sandbox) or file name (CLI). */
|
|
7
|
+
id: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
/** Hash of the chapter Markdown at export time. */
|
|
10
|
+
hash: string;
|
|
11
|
+
}
|
|
12
|
+
export type FragmentTarget = {
|
|
13
|
+
kind: 'markdown';
|
|
14
|
+
chapter: number;
|
|
15
|
+
} | {
|
|
16
|
+
kind: 'resource';
|
|
17
|
+
resourceId: string;
|
|
18
|
+
field: 'caption' | 'note' | 'alt' | 'cell' | 'label';
|
|
19
|
+
row?: number;
|
|
20
|
+
col?: number;
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'generated';
|
|
23
|
+
};
|
|
24
|
+
/** Inline formatting of a span of the exported text, to detect changes. */
|
|
25
|
+
export interface MapFormat {
|
|
26
|
+
start: number;
|
|
27
|
+
end: number;
|
|
28
|
+
/** b = bold, i = italic, c = small caps, p = sup, s = sub, k = code. */
|
|
29
|
+
flags: string;
|
|
30
|
+
href?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface MapFragment {
|
|
33
|
+
/** Bookmark suffix (base36, unique in the file). */
|
|
34
|
+
id: string;
|
|
35
|
+
/** Logical block; fragments split by columns/pages share it. */
|
|
36
|
+
block: string;
|
|
37
|
+
/** Order of this fragment within its block. */
|
|
38
|
+
part: number;
|
|
39
|
+
target: FragmentTarget;
|
|
40
|
+
/** Plain text as exported (engine line breaks as '\n', added hyphens included). */
|
|
41
|
+
text: string;
|
|
42
|
+
/** Source offset per UTF-16 code unit of `text` (`map.length ===
|
|
43
|
+
* text.length`); -1 = synthetic (line break,
|
|
44
|
+
* added/repeated hyphen, generated number). Resource targets index the
|
|
45
|
+
* resource field's text. */
|
|
46
|
+
map: number[];
|
|
47
|
+
/** `hash` (maths only): hashText of the canonical OMML the writer
|
|
48
|
+
* emitted (anchors/ommlHash.ts), so an equation Word left alone keeps
|
|
49
|
+
* its TeX byte-identical. */
|
|
50
|
+
atoms?: {
|
|
51
|
+
at: number;
|
|
52
|
+
start: number;
|
|
53
|
+
end: number;
|
|
54
|
+
kind: string;
|
|
55
|
+
hash?: string;
|
|
56
|
+
}[];
|
|
57
|
+
formats?: MapFormat[];
|
|
58
|
+
/** Source range the fragment covers [start, end). */
|
|
59
|
+
range: [number, number];
|
|
60
|
+
/** Paragraph role/style, used to style paragraphs the user adds. */
|
|
61
|
+
role?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface ExportSnapshot {
|
|
64
|
+
chapters: {
|
|
65
|
+
id: string;
|
|
66
|
+
markdown: string;
|
|
67
|
+
}[];
|
|
68
|
+
/** Resources as JSON (only the ones the export references). */
|
|
69
|
+
resources?: Record<string, unknown>;
|
|
70
|
+
configHash?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface ExportMap {
|
|
73
|
+
version: 1;
|
|
74
|
+
exportId: string;
|
|
75
|
+
variant: ExportVariant;
|
|
76
|
+
/** postext version that wrote the file. */
|
|
77
|
+
engine: string;
|
|
78
|
+
createdAt: string;
|
|
79
|
+
chapters: MapChapter[];
|
|
80
|
+
/** In document reading order. */
|
|
81
|
+
fragments: MapFragment[];
|
|
82
|
+
snapshot?: ExportSnapshot;
|
|
83
|
+
/** Atom holders are runs marked w:noProof (formatted, since #1406): the
|
|
84
|
+
* importer tells them from typed no-break spaces. */
|
|
85
|
+
holders?: true;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/word/anchors/types.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa,sCAAsC,CAAC;AACjE,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAClD,eAAO,MAAM,eAAe,UAAU,CAAC;AAEvC,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,WAAW,CAAC;AAErD,MAAM,WAAW,UAAU;IACzB,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1H;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC;AAE1B,2EAA2E;AAC3E,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,wEAAwE;IACxE,KAAK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,EAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B;0DACsD;IACtD,OAAO,CAAC,EAAE,IAAI,CAAC;CAChB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// The export map (#1389): what both Word variants embed so edits made in
|
|
2
|
+
// Word re-import into the exact Markdown and resource positions (#1395).
|
|
3
|
+
// Stored deflated + base64 JSON in a custom XML part; every fragment is
|
|
4
|
+
// wrapped in a hidden bookmark `_ptx_<id>` in the document.
|
|
5
|
+
export const EXPORT_MAP_NS = 'https://postext.dev/ns/docx-map/1';
|
|
6
|
+
export const EXPORT_MAP_ROOT = 'postextExportMap';
|
|
7
|
+
export const BOOKMARK_PREFIX = '_ptx_';
|
|
8
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/word/anchors/types.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,yEAAyE;AACzE,wEAAwE;AACxE,4DAA4D;AAE5D,MAAM,CAAC,MAAM,aAAa,GAAG,mCAAmC,CAAC;AACjE,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAClD,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Whether the face's map is a Windows symbol one (3,0): Word wants
|
|
2
|
+
* charset 02 for it. */
|
|
3
|
+
export declare function isSymbolCmap(t: Uint8Array | undefined): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* The face's Unicode map: the full-repertoire subtable when there is one
|
|
6
|
+
* (3,10 / 0,4 / 0,6), else the BMP one (3,1 / 0,3 / 0,x), else a symbol
|
|
7
|
+
* map (3,0). Formats 4, 6 and 12 are read; others are skipped.
|
|
8
|
+
*/
|
|
9
|
+
export declare function readCmap(t: Uint8Array | undefined): Map<number, number>;
|
|
10
|
+
/** A `cmap` table with a (3,1) format 4 and a (3,10) format 12 subtable,
|
|
11
|
+
* or a (3,0) symbol one alone for a symbol face. */
|
|
12
|
+
export declare function writeCmap(map: Map<number, number>, symbol?: boolean): Uint8Array;
|
|
13
|
+
//# sourceMappingURL=cmap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cmap.d.ts","sourceRoot":"","sources":["../../../src/word/fonts/cmap.ts"],"names":[],"mappings":"AAuDA;yBACyB;AACzB,wBAAgB,YAAY,CAAC,CAAC,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAY/D;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,UAAU,GAAG,SAAS,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CA+BvE;AAoFD;qDACqD;AACrD,wBAAgB,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,UAAQ,GAAG,UAAU,CAc9E"}
|