@zeke-02/docx-editor-core 0.1.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/LICENSE +201 -0
- package/README.md +89 -0
- package/dist/ImageExtension-BN327PNe.d.mts +38 -0
- package/dist/ImageExtension-BlI5afZD.d.ts +38 -0
- package/dist/Subscribable-DOz6Ohoo.d.mts +33 -0
- package/dist/Subscribable-DOz6Ohoo.d.ts +33 -0
- package/dist/agent/index.d.mts +168 -0
- package/dist/agent/index.d.ts +168 -0
- package/dist/agent/index.js +1 -0
- package/dist/agent/index.mjs +1 -0
- package/dist/borders-BH_GoYU3.d.mts +58 -0
- package/dist/borders-Z9hPno2u.d.ts +58 -0
- package/dist/chunk-2HFQ4QTU.js +1 -0
- package/dist/chunk-2KHWHVTA.js +1 -0
- package/dist/chunk-2MSZXH6Q.mjs +2 -0
- package/dist/chunk-3COGZG7O.mjs +1 -0
- package/dist/chunk-3NRMSZX2.mjs +1 -0
- package/dist/chunk-3SXJPJSV.mjs +1 -0
- package/dist/chunk-44FHVKSI.js +1 -0
- package/dist/chunk-4BFNWPKW.js +1 -0
- package/dist/chunk-4G6AJ4ZM.js +1 -0
- package/dist/chunk-4GER4JLW.js +1 -0
- package/dist/chunk-4Q2IP5FW.js +1 -0
- package/dist/chunk-56D223FM.mjs +1 -0
- package/dist/chunk-5VBNOHRE.mjs +1 -0
- package/dist/chunk-67LVRQIR.mjs +1 -0
- package/dist/chunk-6LVPRTB6.js +1 -0
- package/dist/chunk-6NQSIC27.mjs +1 -0
- package/dist/chunk-6Y6LON6Y.mjs +1 -0
- package/dist/chunk-6ZXL3EIP.mjs +2 -0
- package/dist/chunk-7AMYZMCX.js +1 -0
- package/dist/chunk-7E5VBRDL.mjs +1 -0
- package/dist/chunk-7HANRHHL.js +1 -0
- package/dist/chunk-7LRR7RKE.mjs +15 -0
- package/dist/chunk-7RDCZLTU.js +1 -0
- package/dist/chunk-7U4I6BKJ.js +1 -0
- package/dist/chunk-7Z2AGPNQ.mjs +10 -0
- package/dist/chunk-AAPBAMD7.js +1 -0
- package/dist/chunk-AGVFAXVQ.mjs +9 -0
- package/dist/chunk-AMENZY5F.mjs +1 -0
- package/dist/chunk-ARHPXIBJ.mjs +1 -0
- package/dist/chunk-BGY3CB37.mjs +1 -0
- package/dist/chunk-BHBOAP6Z.js +3 -0
- package/dist/chunk-BOOHU5EW.mjs +1 -0
- package/dist/chunk-C2BAPYGJ.js +1 -0
- package/dist/chunk-CGJ6S3AH.mjs +1 -0
- package/dist/chunk-CKKO4JWE.mjs +1 -0
- package/dist/chunk-CTHHUJAB.mjs +2 -0
- package/dist/chunk-CUY2THAO.mjs +1 -0
- package/dist/chunk-CXQDYR2Y.js +1 -0
- package/dist/chunk-D4RPOJC7.js +1 -0
- package/dist/chunk-D6GO7UGD.mjs +1 -0
- package/dist/chunk-DC7S76ZX.js +1 -0
- package/dist/chunk-DROCYKAR.js +1 -0
- package/dist/chunk-DV6GWBUJ.js +2 -0
- package/dist/chunk-DZYYLV2O.js +1 -0
- package/dist/chunk-E4JMCA5X.js +2 -0
- package/dist/chunk-ERNVFCGN.js +59 -0
- package/dist/chunk-ESI4BSBF.js +1 -0
- package/dist/chunk-F44ZLDZS.js +4 -0
- package/dist/chunk-FCJWLEKT.mjs +1 -0
- package/dist/chunk-FDEDN2RC.mjs +0 -0
- package/dist/chunk-FRYMBAHP.js +3 -0
- package/dist/chunk-FWTP7BN7.mjs +4 -0
- package/dist/chunk-G3YJ5RKC.mjs +1 -0
- package/dist/chunk-GGPKPXON.js +1 -0
- package/dist/chunk-HKVAW3RE.js +1 -0
- package/dist/chunk-HQPWFUP5.js +2 -0
- package/dist/chunk-I6PMX4BO.js +1 -0
- package/dist/chunk-ILJUDEZ5.mjs +1 -0
- package/dist/chunk-IMKU4O3P.js +1 -0
- package/dist/chunk-IP2VXNWG.js +1 -0
- package/dist/chunk-J4J2Y6EU.js +10 -0
- package/dist/chunk-J7NADDC4.mjs +1 -0
- package/dist/chunk-JFZIXFRC.js +1 -0
- package/dist/chunk-JHZ3HLSR.mjs +1 -0
- package/dist/chunk-JY5EFI4D.js +1 -0
- package/dist/chunk-JZESIPVC.mjs +3 -0
- package/dist/chunk-K7GVLZS6.mjs +1 -0
- package/dist/chunk-KESNGXGO.js +1 -0
- package/dist/chunk-KQTB5Y7P.mjs +1 -0
- package/dist/chunk-L2U3TTAD.js +9 -0
- package/dist/chunk-LBKMYD3M.mjs +1 -0
- package/dist/chunk-LCICADWM.js +2 -0
- package/dist/chunk-LE67NTCN.mjs +1 -0
- package/dist/chunk-LTHT4A4S.js +1 -0
- package/dist/chunk-MCFHOMA2.js +2 -0
- package/dist/chunk-MCX4GVRX.mjs +1 -0
- package/dist/chunk-MJ5FQX7Q.js +1 -0
- package/dist/chunk-MJ6XZFVD.mjs +1 -0
- package/dist/chunk-MNOHUTKE.js +15 -0
- package/dist/chunk-MOKKS75W.mjs +3 -0
- package/dist/chunk-MP4QSEO2.mjs +1 -0
- package/dist/chunk-MVZOTKNL.mjs +1 -0
- package/dist/chunk-MZ7LW5CH.js +1 -0
- package/dist/chunk-MZOVDLYL.js +1 -0
- package/dist/chunk-N3Y5BUKV.js +1 -0
- package/dist/chunk-NBLJPT54.mjs +1 -0
- package/dist/chunk-NDDJ67FQ.mjs +1 -0
- package/dist/chunk-NMUHXIF5.js +1 -0
- package/dist/chunk-NXLJVVVE.js +1 -0
- package/dist/chunk-OBMN4VSM.mjs +1 -0
- package/dist/chunk-OCAX2KJQ.js +4 -0
- package/dist/chunk-OEXVWIHW.mjs +2 -0
- package/dist/chunk-OZMNIX6U.mjs +1 -0
- package/dist/chunk-PRRM64JO.mjs +1 -0
- package/dist/chunk-PXE2OWEA.mjs +1 -0
- package/dist/chunk-Q4CKLXWA.js +1 -0
- package/dist/chunk-Q5QOBZWT.mjs +1 -0
- package/dist/chunk-QJJQ53V6.mjs +1 -0
- package/dist/chunk-QLPQVR5W.mjs +1 -0
- package/dist/chunk-QLX4HX3I.mjs +59 -0
- package/dist/chunk-QPFJJPIC.mjs +1 -0
- package/dist/chunk-QYUPLKLP.mjs +1 -0
- package/dist/chunk-RFC2SXZ6.mjs +4 -0
- package/dist/chunk-RNOXNNSD.mjs +0 -0
- package/dist/chunk-RPIQG46O.mjs +1 -0
- package/dist/chunk-RQN4C636.js +1 -0
- package/dist/chunk-SHJBS42Y.js +1 -0
- package/dist/chunk-SORYYVJ7.js +1 -0
- package/dist/chunk-SWC6T7YQ.js +1 -0
- package/dist/chunk-TE2AF7FM.js +1 -0
- package/dist/chunk-TE2VQJZG.js +1 -0
- package/dist/chunk-TUIEV7Q7.js +1 -0
- package/dist/chunk-U4UCHBZ7.js +1 -0
- package/dist/chunk-U74VPTIU.js +1 -0
- package/dist/chunk-UCJGOQ4J.mjs +1 -0
- package/dist/chunk-UQ6WNWXX.js +1 -0
- package/dist/chunk-VHUVPHPI.mjs +1 -0
- package/dist/chunk-VQWZHPWI.mjs +1 -0
- package/dist/chunk-VW22RZ6C.mjs +1 -0
- package/dist/chunk-WLHNIXWC.mjs +2 -0
- package/dist/chunk-WLKRUBY4.js +1 -0
- package/dist/chunk-WTFLNYAT.mjs +1 -0
- package/dist/chunk-XNDGWWDT.js +1 -0
- package/dist/chunk-XXU7YQVV.js +1 -0
- package/dist/chunk-Y74ANBPV.js +1 -0
- package/dist/chunk-YMZ3F2FZ.mjs +1 -0
- package/dist/chunk-YTDWMXNS.js +1 -0
- package/dist/chunk-YUZQTRI2.js +1 -0
- package/dist/chunk-ZX26QZJ5.mjs +1 -0
- package/dist/chunk-ZY7EMTZ3.mjs +1 -0
- package/dist/colorResolver-BZ_yScf4.d.ts +390 -0
- package/dist/colorResolver-C6DtsoFI.d.mts +390 -0
- package/dist/colors-C3vA7HUU.d.mts +70 -0
- package/dist/colors-C3vA7HUU.d.ts +70 -0
- package/dist/content-5Mrz6w_b.d.mts +1360 -0
- package/dist/content-CmqAwdFL.d.ts +1360 -0
- package/dist/core-plugins.d.mts +63 -0
- package/dist/core-plugins.d.ts +63 -0
- package/dist/core-plugins.js +1 -0
- package/dist/core-plugins.mjs +1 -0
- package/dist/core.d.mts +398 -0
- package/dist/core.d.ts +398 -0
- package/dist/core.js +1 -0
- package/dist/core.mjs +1 -0
- package/dist/documentSerializer-BRaaXIHm.d.ts +36 -0
- package/dist/documentSerializer-DgO3A9av.d.mts +36 -0
- package/dist/docx/index.d.mts +1123 -0
- package/dist/docx/index.d.ts +1123 -0
- package/dist/docx/index.js +1 -0
- package/dist/docx/index.mjs +1 -0
- package/dist/docx/parser.d.mts +108 -0
- package/dist/docx/parser.d.ts +108 -0
- package/dist/docx/parser.js +1 -0
- package/dist/docx/parser.mjs +1 -0
- package/dist/docx/rezip.d.mts +312 -0
- package/dist/docx/rezip.d.ts +312 -0
- package/dist/docx/rezip.js +1 -0
- package/dist/docx/rezip.mjs +1 -0
- package/dist/docx/serializer/index.d.mts +125 -0
- package/dist/docx/serializer/index.d.ts +125 -0
- package/dist/docx/serializer/index.js +1 -0
- package/dist/docx/serializer/index.mjs +1 -0
- package/dist/docx/wrapTypes.d.mts +19 -0
- package/dist/docx/wrapTypes.d.ts +19 -0
- package/dist/docx/wrapTypes.js +1 -0
- package/dist/docx/wrapTypes.mjs +1 -0
- package/dist/docxInput-DTbCa48g.d.mts +21 -0
- package/dist/docxInput-DTbCa48g.d.ts +21 -0
- package/dist/executor-DZAMMQ35.js +1 -0
- package/dist/executor-ZCJRLT3Z.mjs +1 -0
- package/dist/findParagraphByParaId-Maw_8M5D.d.mts +28 -0
- package/dist/findParagraphByParaId-Maw_8M5D.d.ts +28 -0
- package/dist/fontLoader-8b4X-AIh.d.mts +283 -0
- package/dist/fontLoader-CK2QLq68.d.ts +283 -0
- package/dist/footnotes-lCH_P3N3.d.mts +78 -0
- package/dist/footnotes-skVvEHvZ.d.ts +78 -0
- package/dist/formatting-BH4hcZiq.d.mts +410 -0
- package/dist/formatting-_OXU8gLB.d.ts +410 -0
- package/dist/headerFooterLayout-72Vz7yp3.d.mts +292 -0
- package/dist/headerFooterLayout-Ca4ESDHF.d.ts +292 -0
- package/dist/headless.d.mts +109 -0
- package/dist/headless.d.ts +109 -0
- package/dist/headless.js +1 -0
- package/dist/headless.mjs +1 -0
- package/dist/layout-bridge/clickToPositionDom.d.mts +56 -0
- package/dist/layout-bridge/clickToPositionDom.d.ts +56 -0
- package/dist/layout-bridge/clickToPositionDom.js +1 -0
- package/dist/layout-bridge/clickToPositionDom.mjs +1 -0
- package/dist/layout-bridge/index.d.mts +462 -0
- package/dist/layout-bridge/index.d.ts +462 -0
- package/dist/layout-bridge/index.js +1 -0
- package/dist/layout-bridge/index.mjs +1 -0
- package/dist/layout-bridge/measuring/index.d.mts +377 -0
- package/dist/layout-bridge/measuring/index.d.ts +377 -0
- package/dist/layout-bridge/measuring/index.js +1 -0
- package/dist/layout-bridge/measuring/index.mjs +1 -0
- package/dist/layout-bridge/tableInsertHover.d.mts +45 -0
- package/dist/layout-bridge/tableInsertHover.d.ts +45 -0
- package/dist/layout-bridge/tableInsertHover.js +1 -0
- package/dist/layout-bridge/tableInsertHover.mjs +1 -0
- package/dist/layout-bridge/toFlowBlocks.d.mts +130 -0
- package/dist/layout-bridge/toFlowBlocks.d.ts +130 -0
- package/dist/layout-bridge/toFlowBlocks.js +1 -0
- package/dist/layout-bridge/toFlowBlocks.mjs +1 -0
- package/dist/layout-engine/index.d.mts +352 -0
- package/dist/layout-engine/index.d.ts +352 -0
- package/dist/layout-engine/index.js +1 -0
- package/dist/layout-engine/index.mjs +1 -0
- package/dist/layout-engine/types.d.mts +943 -0
- package/dist/layout-engine/types.d.ts +943 -0
- package/dist/layout-engine/types.js +1 -0
- package/dist/layout-engine/types.mjs +1 -0
- package/dist/layout-painter/index.d.mts +22 -0
- package/dist/layout-painter/index.d.ts +22 -0
- package/dist/layout-painter/index.js +1 -0
- package/dist/layout-painter/index.mjs +1 -0
- package/dist/layout-painter/renderPage.d.mts +680 -0
- package/dist/layout-painter/renderPage.d.ts +680 -0
- package/dist/layout-painter/renderPage.js +1 -0
- package/dist/layout-painter/renderPage.mjs +1 -0
- package/dist/managers/AutoSaveManager.d.mts +95 -0
- package/dist/managers/AutoSaveManager.d.ts +95 -0
- package/dist/managers/AutoSaveManager.js +1 -0
- package/dist/managers/AutoSaveManager.mjs +1 -0
- package/dist/managers/TableSelectionManager.d.mts +94 -0
- package/dist/managers/TableSelectionManager.d.ts +94 -0
- package/dist/managers/TableSelectionManager.js +1 -0
- package/dist/managers/TableSelectionManager.mjs +1 -0
- package/dist/managers/types.d.mts +121 -0
- package/dist/managers/types.d.ts +121 -0
- package/dist/managers/types.js +1 -0
- package/dist/managers/types.mjs +0 -0
- package/dist/marks-BY573yZn.d.mts +56 -0
- package/dist/marks-CjC9tF5k.d.ts +56 -0
- package/dist/mcp-cli.mjs +138 -0
- package/dist/mcp.d.mts +183 -0
- package/dist/mcp.d.ts +183 -0
- package/dist/mcp.js +16 -0
- package/dist/mcp.mjs +16 -0
- package/dist/nodes-7753Bgi_.d.mts +320 -0
- package/dist/nodes-CC_nwkT_.d.ts +320 -0
- package/dist/plugin-api/RenderedDomContext.d.mts +74 -0
- package/dist/plugin-api/RenderedDomContext.d.ts +74 -0
- package/dist/plugin-api/RenderedDomContext.js +1 -0
- package/dist/plugin-api/RenderedDomContext.mjs +1 -0
- package/dist/plugin-api/index.d.mts +15 -0
- package/dist/plugin-api/index.d.ts +15 -0
- package/dist/plugin-api/index.js +1 -0
- package/dist/plugin-api/index.mjs +0 -0
- package/dist/plugin-api/resolveItemPositions.d.mts +54 -0
- package/dist/plugin-api/resolveItemPositions.d.ts +54 -0
- package/dist/plugin-api/resolveItemPositions.js +1 -0
- package/dist/plugin-api/resolveItemPositions.mjs +1 -0
- package/dist/plugin-api/types.d.mts +190 -0
- package/dist/plugin-api/types.d.ts +190 -0
- package/dist/plugin-api/types.js +1 -0
- package/dist/plugin-api/types.mjs +0 -0
- package/dist/processTemplate-GPFDLQMX.mjs +1 -0
- package/dist/processTemplate-HH2E3HBO.js +1 -0
- package/dist/prosemirror/commands/formatting.d.mts +100 -0
- package/dist/prosemirror/commands/formatting.d.ts +100 -0
- package/dist/prosemirror/commands/formatting.js +1 -0
- package/dist/prosemirror/commands/formatting.mjs +1 -0
- package/dist/prosemirror/commands/index.d.mts +188 -0
- package/dist/prosemirror/commands/index.d.ts +188 -0
- package/dist/prosemirror/commands/index.js +1 -0
- package/dist/prosemirror/commands/index.mjs +1 -0
- package/dist/prosemirror/commands/pageBreak.d.mts +20 -0
- package/dist/prosemirror/commands/pageBreak.d.ts +20 -0
- package/dist/prosemirror/commands/pageBreak.js +1 -0
- package/dist/prosemirror/commands/pageBreak.mjs +1 -0
- package/dist/prosemirror/commands/paragraph.d.mts +70 -0
- package/dist/prosemirror/commands/paragraph.d.ts +70 -0
- package/dist/prosemirror/commands/paragraph.js +1 -0
- package/dist/prosemirror/commands/paragraph.mjs +1 -0
- package/dist/prosemirror/conversion/fromProseDoc.d.mts +65 -0
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +65 -0
- package/dist/prosemirror/conversion/fromProseDoc.js +1 -0
- package/dist/prosemirror/conversion/fromProseDoc.mjs +1 -0
- package/dist/prosemirror/conversion/index.d.mts +85 -0
- package/dist/prosemirror/conversion/index.d.ts +85 -0
- package/dist/prosemirror/conversion/index.js +1 -0
- package/dist/prosemirror/conversion/index.mjs +1 -0
- package/dist/prosemirror/editor.css +823 -0
- package/dist/prosemirror/extensions/index.d.mts +79 -0
- package/dist/prosemirror/extensions/index.d.ts +79 -0
- package/dist/prosemirror/extensions/index.js +1 -0
- package/dist/prosemirror/extensions/index.mjs +1 -0
- package/dist/prosemirror/extensions/nodes/TableExtension.d.mts +30 -0
- package/dist/prosemirror/extensions/nodes/TableExtension.d.ts +30 -0
- package/dist/prosemirror/extensions/nodes/TableExtension.js +1 -0
- package/dist/prosemirror/extensions/nodes/TableExtension.mjs +1 -0
- package/dist/prosemirror/index.d.mts +70 -0
- package/dist/prosemirror/index.d.ts +70 -0
- package/dist/prosemirror/index.js +1 -0
- package/dist/prosemirror/index.mjs +1 -0
- package/dist/prosemirror/plugins/index.d.mts +154 -0
- package/dist/prosemirror/plugins/index.d.ts +154 -0
- package/dist/prosemirror/plugins/index.js +1 -0
- package/dist/prosemirror/plugins/index.mjs +1 -0
- package/dist/prosemirror/plugins/selectionTracker.d.mts +78 -0
- package/dist/prosemirror/plugins/selectionTracker.d.ts +78 -0
- package/dist/prosemirror/plugins/selectionTracker.js +1 -0
- package/dist/prosemirror/plugins/selectionTracker.mjs +1 -0
- package/dist/prosemirror/schema/index.d.mts +29 -0
- package/dist/prosemirror/schema/index.d.ts +29 -0
- package/dist/prosemirror/schema/index.js +1 -0
- package/dist/prosemirror/schema/index.mjs +1 -0
- package/dist/prosemirror/styles/index.d.mts +124 -0
- package/dist/prosemirror/styles/index.d.ts +124 -0
- package/dist/prosemirror/styles/index.js +1 -0
- package/dist/prosemirror/styles/index.mjs +1 -0
- package/dist/prosemirror/template/prosemirror-plugin.d.mts +66 -0
- package/dist/prosemirror/template/prosemirror-plugin.d.ts +66 -0
- package/dist/prosemirror/template/prosemirror-plugin.js +15 -0
- package/dist/prosemirror/template/prosemirror-plugin.mjs +15 -0
- package/dist/prosemirror/utils/ClickPositionResolver.d.mts +109 -0
- package/dist/prosemirror/utils/ClickPositionResolver.d.ts +109 -0
- package/dist/prosemirror/utils/ClickPositionResolver.js +1 -0
- package/dist/prosemirror/utils/ClickPositionResolver.mjs +1 -0
- package/dist/prosemirror/utils/LayoutSelectionGate.d.mts +81 -0
- package/dist/prosemirror/utils/LayoutSelectionGate.d.ts +81 -0
- package/dist/prosemirror/utils/LayoutSelectionGate.js +1 -0
- package/dist/prosemirror/utils/LayoutSelectionGate.mjs +1 -0
- package/dist/prosemirror/utils/PointerEventHandler.d.mts +94 -0
- package/dist/prosemirror/utils/PointerEventHandler.d.ts +94 -0
- package/dist/prosemirror/utils/PointerEventHandler.js +1 -0
- package/dist/prosemirror/utils/PointerEventHandler.mjs +1 -0
- package/dist/prosemirror/utils/extractTrackedChanges.d.mts +85 -0
- package/dist/prosemirror/utils/extractTrackedChanges.d.ts +85 -0
- package/dist/prosemirror/utils/extractTrackedChanges.js +1 -0
- package/dist/prosemirror/utils/extractTrackedChanges.mjs +1 -0
- package/dist/prosemirror/utils/visualLineNavigation.d.mts +45 -0
- package/dist/prosemirror/utils/visualLineNavigation.d.ts +45 -0
- package/dist/prosemirror/utils/visualLineNavigation.js +1 -0
- package/dist/prosemirror/utils/visualLineNavigation.mjs +1 -0
- package/dist/registry-Cpyybgij.d.mts +165 -0
- package/dist/registry-E5pahPKL.d.ts +165 -0
- package/dist/selectionContext-BPAqgNgk.d.ts +570 -0
- package/dist/selectionContext-CoZat7QZ.d.mts +570 -0
- package/dist/selectiveSave-CWaPEv0B.d.ts +31 -0
- package/dist/selectiveSave-jinP_4xa.d.mts +31 -0
- package/dist/selectiveXmlPatch-ypkxlTD_.d.mts +23 -0
- package/dist/selectiveXmlPatch-ypkxlTD_.d.ts +23 -0
- package/dist/styles-BBv7doYK.d.ts +233 -0
- package/dist/styles-EI2lxeEN.d.mts +233 -0
- package/dist/table-P8esKWAc.d.ts +82 -0
- package/dist/table-_t_W8oQf.d.mts +82 -0
- package/dist/types/agentApi.d.mts +467 -0
- package/dist/types/agentApi.d.ts +467 -0
- package/dist/types/agentApi.js +1 -0
- package/dist/types/agentApi.mjs +1 -0
- package/dist/types/content.d.mts +18 -0
- package/dist/types/content.d.ts +18 -0
- package/dist/types/content.js +1 -0
- package/dist/types/content.mjs +0 -0
- package/dist/types/document.d.mts +123 -0
- package/dist/types/document.d.ts +123 -0
- package/dist/types/document.js +1 -0
- package/dist/types/document.mjs +0 -0
- package/dist/types-DXG7vqe9.d.ts +311 -0
- package/dist/types-RchZmPFN.d.mts +137 -0
- package/dist/types-RchZmPFN.d.ts +137 -0
- package/dist/types-dYdjUZMo.d.mts +311 -0
- package/dist/utils/cardStyles.d.mts +31 -0
- package/dist/utils/cardStyles.d.ts +31 -0
- package/dist/utils/cardStyles.js +1 -0
- package/dist/utils/cardStyles.mjs +1 -0
- package/dist/utils/comments.d.mts +121 -0
- package/dist/utils/comments.d.ts +121 -0
- package/dist/utils/comments.js +1 -0
- package/dist/utils/comments.mjs +1 -0
- package/dist/utils/findReplace.d.mts +114 -0
- package/dist/utils/findReplace.d.ts +114 -0
- package/dist/utils/findReplace.js +2 -0
- package/dist/utils/findReplace.mjs +2 -0
- package/dist/utils/findVerticalScrollParent.d.mts +25 -0
- package/dist/utils/findVerticalScrollParent.d.ts +25 -0
- package/dist/utils/findVerticalScrollParent.js +1 -0
- package/dist/utils/findVerticalScrollParent.mjs +1 -0
- package/dist/utils/fontOptions.d.mts +21 -0
- package/dist/utils/fontOptions.d.ts +21 -0
- package/dist/utils/fontOptions.js +1 -0
- package/dist/utils/fontOptions.mjs +1 -0
- package/dist/utils/headingCollector.d.mts +32 -0
- package/dist/utils/headingCollector.d.ts +32 -0
- package/dist/utils/headingCollector.js +1 -0
- package/dist/utils/headingCollector.mjs +1 -0
- package/dist/utils/highlightColors.d.mts +14 -0
- package/dist/utils/highlightColors.d.ts +14 -0
- package/dist/utils/highlightColors.js +1 -0
- package/dist/utils/highlightColors.mjs +1 -0
- package/dist/utils/index.d.mts +710 -0
- package/dist/utils/index.d.ts +710 -0
- package/dist/utils/index.js +82 -0
- package/dist/utils/index.mjs +82 -0
- package/dist/utils/listState.d.mts +27 -0
- package/dist/utils/listState.d.ts +27 -0
- package/dist/utils/listState.js +1 -0
- package/dist/utils/listState.mjs +1 -0
- package/dist/utils/reportIssue.d.mts +23 -0
- package/dist/utils/reportIssue.d.ts +23 -0
- package/dist/utils/reportIssue.js +2 -0
- package/dist/utils/reportIssue.mjs +2 -0
- package/dist/utils/sidebarConstants.d.mts +10 -0
- package/dist/utils/sidebarConstants.d.ts +10 -0
- package/dist/utils/sidebarConstants.js +1 -0
- package/dist/utils/sidebarConstants.mjs +1 -0
- package/dist/utils/textSelection.d.mts +92 -0
- package/dist/utils/textSelection.d.ts +92 -0
- package/dist/utils/textSelection.js +1 -0
- package/dist/utils/textSelection.mjs +1 -0
- package/dist/utils/units.d.mts +91 -0
- package/dist/utils/units.d.ts +91 -0
- package/dist/utils/units.js +1 -0
- package/dist/utils/units.mjs +1 -0
- package/dist/variableDetector-DF3-nxUC.d.mts +115 -0
- package/dist/variableDetector-sBkgVh3f.d.ts +115 -0
- package/package.json +565 -0
|
@@ -0,0 +1,1123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOCX I/O
|
|
3
|
+
*
|
|
4
|
+
* Parsing DOCX archives into the `Document` model and re-zipping a
|
|
5
|
+
* model back into a DOCX file. Use `./docx/serializer` for the lower-level
|
|
6
|
+
* Document → XML transforms.
|
|
7
|
+
*
|
|
8
|
+
* The named exports below are the public API contract. Adding a parser
|
|
9
|
+
* helper to a source module does not automatically make it public — it
|
|
10
|
+
* must be added to this barrel to be reachable from
|
|
11
|
+
* `@zeke-02/docx-editor-core/docx`.
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export { parseDocx } from './parser.js';
|
|
16
|
+
export { createDocx, default as repackDocx, updateMultipleFiles } from './rezip.js';
|
|
17
|
+
export { a as attemptSelectiveSave } from '../selectiveSave-CWaPEv0B.js';
|
|
18
|
+
export { b as buildPatchedDocumentXml, v as validatePatchSafety } from '../selectiveXmlPatch-ypkxlTD_.js';
|
|
19
|
+
import { I as Image, N as NumberingDefinitions, L as ListLevel, A as AbstractNumbering, ah as NumberingInstance, o as NumberFormat, E as Endnote, F as Footnote, K as EndnoteProperties, X as FootnoteProperties, R as Run, U as FieldType, O as Field, av as SimpleField, H as Hyperlink, ap as Shape, T as Table, h as TableCell, P as Paragraph, aA as TextBox, a1 as ImageSize, a0 as ImagePosition, a3 as ImageWrap, B as BlockContent, C as Comment } from '../content-CmqAwdFL.js';
|
|
20
|
+
import { b as RelationshipMap, M as MediaFile, S as Style, T as Theme } from '../styles-BBv7doYK.js';
|
|
21
|
+
import { Element } from 'xml-js';
|
|
22
|
+
import { i as TabStopAlignment, h as TabLeader, e as TabStop, C as CellMargins, F as FloatingTableProperties, j as TableBorders, f as TableLook, k as TableMeasurement, a as TableFormatting } from '../formatting-_OXU8gLB.js';
|
|
23
|
+
export { emuToPixels, pixelsToEmu } from '../utils/units.js';
|
|
24
|
+
import { B as BorderSpec, S as ShadingProperties } from '../colors-C3vA7HUU.js';
|
|
25
|
+
import '../types/document.js';
|
|
26
|
+
import './wrapTypes.js';
|
|
27
|
+
import '../docxInput-DTbCa48g.js';
|
|
28
|
+
import 'jszip';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Image Parser - Parse embedded images from w:drawing elements
|
|
32
|
+
*
|
|
33
|
+
* DOCX images are contained in <w:drawing> elements with either:
|
|
34
|
+
* - wp:inline - Inline images that flow with text
|
|
35
|
+
* - wp:anchor - Floating/anchored images with text wrapping
|
|
36
|
+
*
|
|
37
|
+
* OOXML Structure:
|
|
38
|
+
* w:drawing
|
|
39
|
+
* ├── wp:inline or wp:anchor
|
|
40
|
+
* │ ├── wp:extent (size: cx, cy in EMUs)
|
|
41
|
+
* │ ├── wp:effectExtent (effect margins)
|
|
42
|
+
* │ ├── wp:docPr (document properties: id, name, descr, title)
|
|
43
|
+
* │ ├── wp:positionH / wp:positionV (for anchor only)
|
|
44
|
+
* │ ├── wp:wrap* (wrapping mode for anchor: wrapNone, wrapSquare, etc.)
|
|
45
|
+
* │ └── a:graphic
|
|
46
|
+
* │ └── a:graphicData
|
|
47
|
+
* │ └── pic:pic
|
|
48
|
+
* │ ├── pic:nvPicPr (non-visual properties)
|
|
49
|
+
* │ ├── pic:blipFill
|
|
50
|
+
* │ │ └── a:blip (r:embed = rId)
|
|
51
|
+
* │ └── pic:spPr
|
|
52
|
+
* │ └── a:xfrm (transform: rotation, flip)
|
|
53
|
+
*
|
|
54
|
+
* EMU (English Metric Units): 914400 EMU = 1 inch
|
|
55
|
+
* Conversion: pixels = (emu * 96) / 914400
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Parse a w:drawing element
|
|
60
|
+
*
|
|
61
|
+
* The drawing element contains either wp:inline or wp:anchor.
|
|
62
|
+
*
|
|
63
|
+
* @param drawingEl - The w:drawing element
|
|
64
|
+
* @param rels - Relationship map for resolving rId
|
|
65
|
+
* @param media - Media files map
|
|
66
|
+
* @returns Parsed Image object or null if not an image
|
|
67
|
+
*/
|
|
68
|
+
declare function parseDrawing(drawingEl: Element, rels: RelationshipMap | undefined, media: Map<string, MediaFile> | undefined): Image | null;
|
|
69
|
+
/**
|
|
70
|
+
* Parse an image from a w:drawing element
|
|
71
|
+
*
|
|
72
|
+
* This is the main entry point for image parsing.
|
|
73
|
+
*
|
|
74
|
+
* @param node - The w:drawing XML element
|
|
75
|
+
* @param rels - Relationship map for resolving rId
|
|
76
|
+
* @param media - Media files map
|
|
77
|
+
* @returns Parsed Image object or null if parsing fails
|
|
78
|
+
*/
|
|
79
|
+
declare function parseImage(node: Element, rels: RelationshipMap | undefined, media: Map<string, MediaFile> | undefined): Image | null;
|
|
80
|
+
/**
|
|
81
|
+
* Check if an image is inline (not floating)
|
|
82
|
+
*/
|
|
83
|
+
declare function isInlineImage(image: Image): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Check if an image is floating (anchored)
|
|
86
|
+
*/
|
|
87
|
+
declare function isFloatingImage(image: Image): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Check if an image is behind text
|
|
90
|
+
*/
|
|
91
|
+
declare function isBehindText(image: Image): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Check if an image is in front of text
|
|
94
|
+
*/
|
|
95
|
+
declare function isInFrontOfText(image: Image): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Get image width in pixels
|
|
98
|
+
*/
|
|
99
|
+
declare function getImageWidthPx(image: Image): number;
|
|
100
|
+
/**
|
|
101
|
+
* Get image height in pixels
|
|
102
|
+
*/
|
|
103
|
+
declare function getImageHeightPx(image: Image): number;
|
|
104
|
+
/**
|
|
105
|
+
* Check if image is decorative (should be ignored by screen readers)
|
|
106
|
+
*/
|
|
107
|
+
declare function isDecorativeImage(image: Image): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Get wrap distances in pixels
|
|
110
|
+
*/
|
|
111
|
+
declare function getWrapDistancesPx(image: Image): {
|
|
112
|
+
top: number;
|
|
113
|
+
bottom: number;
|
|
114
|
+
left: number;
|
|
115
|
+
right: number;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Style Parser - Parse styles.xml with full inheritance resolution
|
|
120
|
+
*
|
|
121
|
+
* Parses all style types (paragraph, character, table, list) with
|
|
122
|
+
* complete basedOn inheritance chain resolution.
|
|
123
|
+
*
|
|
124
|
+
* OOXML Reference:
|
|
125
|
+
* - Style file is at: word/styles.xml
|
|
126
|
+
* - Uses WordprocessingML namespace (w:)
|
|
127
|
+
*
|
|
128
|
+
* Style Cascade (lowest to highest priority):
|
|
129
|
+
* 1. Document defaults (w:docDefaults)
|
|
130
|
+
* 2. Parent style properties (w:basedOn chain)
|
|
131
|
+
* 3. Current style properties
|
|
132
|
+
* 4. Direct formatting in document
|
|
133
|
+
*
|
|
134
|
+
* This file owns the style element itself, docDefaults, inheritance
|
|
135
|
+
* resolution, and the top-level entry points (parseStyles,
|
|
136
|
+
* parseStyleDefinitions, getResolved*). Property-level parsers live under
|
|
137
|
+
* ./styleParser/{runProperties,paragraphProperties,tableProperties}.ts.
|
|
138
|
+
*/
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Style map keyed by styleId
|
|
142
|
+
*/
|
|
143
|
+
type StyleMap = Map<string, Style>;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Numbering/List Parser for DOCX
|
|
147
|
+
*
|
|
148
|
+
* Parses numbering.xml to extract:
|
|
149
|
+
* - Abstract numbering definitions (templates with levels)
|
|
150
|
+
* - Numbering instances (concrete references with optional overrides)
|
|
151
|
+
*
|
|
152
|
+
* OOXML Structure:
|
|
153
|
+
* - w:abstractNum - Template definitions with 9 levels (0-8)
|
|
154
|
+
* - w:num - Instances that reference abstractNum and can override levels
|
|
155
|
+
* - w:lvl - Level definition with start, format, text pattern, etc.
|
|
156
|
+
*/
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Map of rId to numbering definitions
|
|
160
|
+
*/
|
|
161
|
+
type NumberingMap = {
|
|
162
|
+
definitions: NumberingDefinitions;
|
|
163
|
+
/** Get level info for a numId and ilvl */
|
|
164
|
+
getLevel: (numId: number, ilvl: number) => ListLevel | null;
|
|
165
|
+
/** Get abstract numbering by ID */
|
|
166
|
+
getAbstract: (abstractNumId: number) => AbstractNumbering | null;
|
|
167
|
+
/** Get the numbering instance (numId → abstractNumId + lvlOverrides) */
|
|
168
|
+
getInstance: (numId: number) => NumberingInstance | null;
|
|
169
|
+
/** Check if numId exists */
|
|
170
|
+
hasNumbering: (numId: number) => boolean;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Parse numbering.xml into NumberingDefinitions
|
|
174
|
+
*
|
|
175
|
+
* @param numberingXml - Raw XML string from word/numbering.xml (or null if not present)
|
|
176
|
+
* @returns NumberingMap with definitions and helper functions
|
|
177
|
+
*/
|
|
178
|
+
declare function parseNumbering(numberingXml: string | null): NumberingMap;
|
|
179
|
+
/**
|
|
180
|
+
* Format a number according to the specified format
|
|
181
|
+
*
|
|
182
|
+
* @param num - The number to format
|
|
183
|
+
* @param format - The number format
|
|
184
|
+
* @returns Formatted string
|
|
185
|
+
*/
|
|
186
|
+
declare function formatNumber(num: number, format: NumberFormat): string;
|
|
187
|
+
/**
|
|
188
|
+
* Render list marker text by replacing placeholders with formatted numbers
|
|
189
|
+
*
|
|
190
|
+
* @param lvlText - The level text pattern (e.g., "%1.", "%1.%2")
|
|
191
|
+
* @param counters - Array of counter values for each level (index 0 = level 0, etc.)
|
|
192
|
+
* @param formats - Array of number formats for each level
|
|
193
|
+
* @returns Rendered marker text
|
|
194
|
+
*/
|
|
195
|
+
declare function renderListMarker(lvlText: string, counters: number[], formats: NumberFormat[]): string;
|
|
196
|
+
/**
|
|
197
|
+
* Get the bullet character for a bullet list level
|
|
198
|
+
*
|
|
199
|
+
* @param level - The list level definition
|
|
200
|
+
* @returns The bullet character to display
|
|
201
|
+
*/
|
|
202
|
+
declare function getBulletCharacter(level: ListLevel): string;
|
|
203
|
+
/**
|
|
204
|
+
* Check if a list level is a bullet (not numbered)
|
|
205
|
+
*/
|
|
206
|
+
declare function isBulletLevel(level: ListLevel): boolean;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Footnote/Endnote Parser - Parse footnotes.xml and endnotes.xml
|
|
210
|
+
*
|
|
211
|
+
* Footnotes and endnotes are stored in separate XML files within the DOCX package:
|
|
212
|
+
* - word/footnotes.xml - Contains all footnote definitions
|
|
213
|
+
* - word/endnotes.xml - Contains all endnote definitions
|
|
214
|
+
*
|
|
215
|
+
* Each note contains:
|
|
216
|
+
* - An ID that matches references in document.xml (w:footnoteReference, w:endnoteReference)
|
|
217
|
+
* - A type (normal, separator, continuationSeparator, continuationNotice)
|
|
218
|
+
* - Content (paragraphs)
|
|
219
|
+
*
|
|
220
|
+
* The references in the document body are parsed by runParser as NoteReferenceContent.
|
|
221
|
+
*
|
|
222
|
+
* OOXML Reference:
|
|
223
|
+
* - Footnote: w:footnote[@w:id][@w:type]
|
|
224
|
+
* - Endnote: w:endnote[@w:id][@w:type]
|
|
225
|
+
* - Content: w:p (paragraphs)
|
|
226
|
+
*/
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Footnote map returned by parseFootnotes
|
|
230
|
+
*/
|
|
231
|
+
interface FootnoteMap {
|
|
232
|
+
/** All footnotes indexed by ID */
|
|
233
|
+
byId: Map<number, Footnote>;
|
|
234
|
+
/** Array of all footnotes in document order */
|
|
235
|
+
footnotes: Footnote[];
|
|
236
|
+
/** Get footnote by ID */
|
|
237
|
+
getFootnote(id: number): Footnote | undefined;
|
|
238
|
+
/** Check if footnote exists */
|
|
239
|
+
hasFootnote(id: number): boolean;
|
|
240
|
+
/** Get all normal (non-separator) footnotes */
|
|
241
|
+
getNormalFootnotes(): Footnote[];
|
|
242
|
+
/** Get separator footnote if exists */
|
|
243
|
+
getSeparator(): Footnote | undefined;
|
|
244
|
+
/** Get continuation separator if exists */
|
|
245
|
+
getContinuationSeparator(): Footnote | undefined;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Endnote map returned by parseEndnotes
|
|
249
|
+
*/
|
|
250
|
+
interface EndnoteMap {
|
|
251
|
+
/** All endnotes indexed by ID */
|
|
252
|
+
byId: Map<number, Endnote>;
|
|
253
|
+
/** Array of all endnotes in document order */
|
|
254
|
+
endnotes: Endnote[];
|
|
255
|
+
/** Get endnote by ID */
|
|
256
|
+
getEndnote(id: number): Endnote | undefined;
|
|
257
|
+
/** Check if endnote exists */
|
|
258
|
+
hasEndnote(id: number): boolean;
|
|
259
|
+
/** Get all normal (non-separator) endnotes */
|
|
260
|
+
getNormalEndnotes(): Endnote[];
|
|
261
|
+
/** Get separator endnote if exists */
|
|
262
|
+
getSeparator(): Endnote | undefined;
|
|
263
|
+
/** Get continuation separator if exists */
|
|
264
|
+
getContinuationSeparator(): Endnote | undefined;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Parse footnotes.xml
|
|
268
|
+
*
|
|
269
|
+
* @param footnotesXml - The raw XML content of word/footnotes.xml
|
|
270
|
+
* @param styles - Parsed style map for applying styles
|
|
271
|
+
* @param theme - Parsed theme for color resolution
|
|
272
|
+
* @param numbering - Parsed numbering definitions for lists
|
|
273
|
+
* @param rels - Relationships for resolving hyperlinks
|
|
274
|
+
* @param media - Media files for images
|
|
275
|
+
* @returns FootnoteMap with all footnotes
|
|
276
|
+
*/
|
|
277
|
+
declare function parseFootnotes(footnotesXml: string | null, styles?: StyleMap | null, theme?: Theme | null, numbering?: NumberingMap | null, rels?: RelationshipMap | null, media?: Map<string, MediaFile> | null): FootnoteMap;
|
|
278
|
+
/**
|
|
279
|
+
* Parse endnotes.xml
|
|
280
|
+
*
|
|
281
|
+
* @param endnotesXml - The raw XML content of word/endnotes.xml
|
|
282
|
+
* @param styles - Parsed style map for applying styles
|
|
283
|
+
* @param theme - Parsed theme for color resolution
|
|
284
|
+
* @param numbering - Parsed numbering definitions for lists
|
|
285
|
+
* @param rels - Relationships for resolving hyperlinks
|
|
286
|
+
* @param media - Media files for images
|
|
287
|
+
* @returns EndnoteMap with all endnotes
|
|
288
|
+
*/
|
|
289
|
+
declare function parseEndnotes(endnotesXml: string | null, styles?: StyleMap | null, theme?: Theme | null, numbering?: NumberingMap | null, rels?: RelationshipMap | null, media?: Map<string, MediaFile> | null): EndnoteMap;
|
|
290
|
+
/**
|
|
291
|
+
* Parse footnote properties from w:footnotePr element
|
|
292
|
+
* (Can appear in w:sectPr or w:settings)
|
|
293
|
+
*/
|
|
294
|
+
declare function parseFootnoteProperties(element: Element | null): FootnoteProperties;
|
|
295
|
+
/**
|
|
296
|
+
* Parse endnote properties from w:endnotePr element
|
|
297
|
+
* (Can appear in w:sectPr or w:settings)
|
|
298
|
+
*/
|
|
299
|
+
declare function parseEndnoteProperties(element: Element | null): EndnoteProperties;
|
|
300
|
+
/**
|
|
301
|
+
* Get plain text content of a footnote
|
|
302
|
+
*/
|
|
303
|
+
declare function getFootnoteText(footnote: Footnote): string;
|
|
304
|
+
/**
|
|
305
|
+
* Get plain text content of an endnote
|
|
306
|
+
*/
|
|
307
|
+
declare function getEndnoteText(endnote: Endnote): string;
|
|
308
|
+
/**
|
|
309
|
+
* Check if a footnote is a separator (not regular content)
|
|
310
|
+
*/
|
|
311
|
+
declare function isSeparatorFootnote(footnote: Footnote): boolean;
|
|
312
|
+
/**
|
|
313
|
+
* Check if an endnote is a separator (not regular content)
|
|
314
|
+
*/
|
|
315
|
+
declare function isSeparatorEndnote(endnote: Endnote): boolean;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Field Parser - Parse field codes in DOCX documents
|
|
319
|
+
*
|
|
320
|
+
* OOXML supports two types of fields:
|
|
321
|
+
* 1. Simple fields (w:fldSimple) - Single element with instruction attribute
|
|
322
|
+
* 2. Complex fields (w:fldChar + w:instrText) - Multi-element spanning runs
|
|
323
|
+
*
|
|
324
|
+
* Fields provide dynamic content like:
|
|
325
|
+
* - Page numbers (PAGE, NUMPAGES)
|
|
326
|
+
* - Dates and times (DATE, TIME, CREATEDATE)
|
|
327
|
+
* - Document properties (AUTHOR, TITLE, FILENAME)
|
|
328
|
+
* - Cross-references (REF, PAGEREF, NOTEREF)
|
|
329
|
+
* - Tables of contents (TOC, INDEX)
|
|
330
|
+
* - Mail merge fields (MERGEFIELD)
|
|
331
|
+
*
|
|
332
|
+
* OOXML Reference:
|
|
333
|
+
* - Simple field: <w:fldSimple w:instr="FIELD INSTRUCTION">content</w:fldSimple>
|
|
334
|
+
* - Complex field:
|
|
335
|
+
* <w:r><w:fldChar w:fldCharType="begin"/></w:r>
|
|
336
|
+
* <w:r><w:instrText>FIELD INSTRUCTION</w:instrText></w:r>
|
|
337
|
+
* <w:r><w:fldChar w:fldCharType="separate"/></w:r>
|
|
338
|
+
* <w:r><w:t>display result</w:t></w:r>
|
|
339
|
+
* <w:r><w:fldChar w:fldCharType="end"/></w:r>
|
|
340
|
+
*/
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* All known field types from OOXML specification
|
|
344
|
+
*/
|
|
345
|
+
declare const KNOWN_FIELD_TYPES: FieldType[];
|
|
346
|
+
/**
|
|
347
|
+
* Parse field type from instruction string
|
|
348
|
+
*
|
|
349
|
+
* Field instructions follow the format: FIELDNAME [arguments] [switches]
|
|
350
|
+
* Examples:
|
|
351
|
+
* - "PAGE \\* MERGEFORMAT"
|
|
352
|
+
* - "DATE \\@ \"MMMM d, yyyy\""
|
|
353
|
+
* - "MERGEFIELD client_name \\* Upper"
|
|
354
|
+
* - "REF _Ref123456 \\h"
|
|
355
|
+
*
|
|
356
|
+
* @param instruction - The field instruction string
|
|
357
|
+
* @returns The detected field type
|
|
358
|
+
*/
|
|
359
|
+
declare function parseFieldType(instruction: string): FieldType;
|
|
360
|
+
/**
|
|
361
|
+
* Check if a field type is a known type
|
|
362
|
+
*
|
|
363
|
+
* @param type - Field type string to check
|
|
364
|
+
* @returns true if it's a known field type
|
|
365
|
+
*/
|
|
366
|
+
declare function isKnownFieldType(type: string): type is FieldType;
|
|
367
|
+
/**
|
|
368
|
+
* Parsed field instruction with arguments and switches
|
|
369
|
+
*/
|
|
370
|
+
interface ParsedFieldInstruction {
|
|
371
|
+
/** Field type */
|
|
372
|
+
type: FieldType;
|
|
373
|
+
/** Raw instruction string */
|
|
374
|
+
raw: string;
|
|
375
|
+
/** Field argument (e.g., property name for DOCPROPERTY, bookmark name for REF) */
|
|
376
|
+
argument?: string;
|
|
377
|
+
/** Field switches (e.g., \* MERGEFORMAT, \@ "date format") */
|
|
378
|
+
switches: FieldSwitch[];
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Field switch parsed from instruction
|
|
382
|
+
*/
|
|
383
|
+
interface FieldSwitch {
|
|
384
|
+
/** Switch character (e.g., '*', '@', '#', 'h', 'p') */
|
|
385
|
+
switch: string;
|
|
386
|
+
/** Switch value if any */
|
|
387
|
+
value?: string;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Parse a complete field instruction into structured data
|
|
391
|
+
*
|
|
392
|
+
* @param instruction - Raw instruction string
|
|
393
|
+
* @returns Parsed instruction object
|
|
394
|
+
*/
|
|
395
|
+
declare function parseFieldInstruction(instruction: string): ParsedFieldInstruction;
|
|
396
|
+
/**
|
|
397
|
+
* Get the format switch value (\* or \@)
|
|
398
|
+
*
|
|
399
|
+
* @param instruction - Parsed instruction
|
|
400
|
+
* @returns Format string or undefined
|
|
401
|
+
*/
|
|
402
|
+
declare function getFormatSwitch(instruction: ParsedFieldInstruction): string | undefined;
|
|
403
|
+
/**
|
|
404
|
+
* Check if field has MERGEFORMAT switch (preserve formatting)
|
|
405
|
+
*
|
|
406
|
+
* @param instruction - Parsed instruction
|
|
407
|
+
* @returns true if MERGEFORMAT is present
|
|
408
|
+
*/
|
|
409
|
+
declare function hasMergeFormat(instruction: ParsedFieldInstruction): boolean;
|
|
410
|
+
/**
|
|
411
|
+
* Parse a simple field element (w:fldSimple)
|
|
412
|
+
*
|
|
413
|
+
* @param node - The w:fldSimple XML element
|
|
414
|
+
* @param styles - Style definitions for parsing content runs
|
|
415
|
+
* @param theme - Theme for color/font resolution
|
|
416
|
+
* @returns Parsed SimpleField object
|
|
417
|
+
*/
|
|
418
|
+
declare function parseSimpleField(node: Element, styles: StyleMap | null, theme: Theme | null): SimpleField;
|
|
419
|
+
/**
|
|
420
|
+
* State machine for tracking complex field parsing
|
|
421
|
+
*/
|
|
422
|
+
type ComplexFieldState = 'outside' | 'code' | 'result';
|
|
423
|
+
/**
|
|
424
|
+
* Complex field parsing context
|
|
425
|
+
*/
|
|
426
|
+
interface ComplexFieldContext {
|
|
427
|
+
/** Current state */
|
|
428
|
+
state: ComplexFieldState;
|
|
429
|
+
/** Accumulated instruction text */
|
|
430
|
+
instruction: string;
|
|
431
|
+
/** Runs in the field code section */
|
|
432
|
+
codeRuns: Run[];
|
|
433
|
+
/** Runs in the result section */
|
|
434
|
+
resultRuns: Run[];
|
|
435
|
+
/** Whether field is locked */
|
|
436
|
+
fldLock: boolean;
|
|
437
|
+
/** Whether field needs update */
|
|
438
|
+
dirty: boolean;
|
|
439
|
+
/** Nesting level (for nested fields) */
|
|
440
|
+
nestingLevel: number;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Create a new complex field context
|
|
444
|
+
*/
|
|
445
|
+
declare function createComplexFieldContext(): ComplexFieldContext;
|
|
446
|
+
/**
|
|
447
|
+
* Get the current display value of a field
|
|
448
|
+
*
|
|
449
|
+
* @param field - The field (simple or complex)
|
|
450
|
+
* @returns The display text
|
|
451
|
+
*/
|
|
452
|
+
declare function getFieldDisplayValue(field: Field): string;
|
|
453
|
+
/**
|
|
454
|
+
* Check if field represents a page number
|
|
455
|
+
*
|
|
456
|
+
* @param field - The field to check
|
|
457
|
+
* @returns true if this is a page number field
|
|
458
|
+
*/
|
|
459
|
+
declare function isPageNumberField(field: Field): boolean;
|
|
460
|
+
/**
|
|
461
|
+
* Check if field represents total page count
|
|
462
|
+
*
|
|
463
|
+
* @param field - The field to check
|
|
464
|
+
* @returns true if this is a total pages field
|
|
465
|
+
*/
|
|
466
|
+
declare function isTotalPagesField(field: Field): boolean;
|
|
467
|
+
/**
|
|
468
|
+
* Check if field is a date/time field
|
|
469
|
+
*
|
|
470
|
+
* @param field - The field to check
|
|
471
|
+
* @returns true if this is a date/time field
|
|
472
|
+
*/
|
|
473
|
+
declare function isDateTimeField(field: Field): boolean;
|
|
474
|
+
/**
|
|
475
|
+
* Check if field is a document property field
|
|
476
|
+
*
|
|
477
|
+
* @param field - The field to check
|
|
478
|
+
* @returns true if this is a document property field
|
|
479
|
+
*/
|
|
480
|
+
declare function isDocPropertyField(field: Field): boolean;
|
|
481
|
+
/**
|
|
482
|
+
* Check if field is a cross-reference field
|
|
483
|
+
*
|
|
484
|
+
* @param field - The field to check
|
|
485
|
+
* @returns true if this is a cross-reference field
|
|
486
|
+
*/
|
|
487
|
+
declare function isReferenceField(field: Field): boolean;
|
|
488
|
+
/**
|
|
489
|
+
* Check if field is a mail merge field
|
|
490
|
+
*
|
|
491
|
+
* @param field - The field to check
|
|
492
|
+
* @returns true if this is a mail merge field
|
|
493
|
+
*/
|
|
494
|
+
declare function isMergeField(field: Field): boolean;
|
|
495
|
+
/**
|
|
496
|
+
* Check if field is a TOC/Index field
|
|
497
|
+
*
|
|
498
|
+
* @param field - The field to check
|
|
499
|
+
* @returns true if this is a TOC or index field
|
|
500
|
+
*/
|
|
501
|
+
declare function isTocField(field: Field): boolean;
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Hyperlink Parser - Parse hyperlinks (w:hyperlink) with URL resolution
|
|
505
|
+
*
|
|
506
|
+
* OOXML Reference:
|
|
507
|
+
* - Hyperlink element: w:hyperlink
|
|
508
|
+
* - Attributes:
|
|
509
|
+
* - r:id - Relationship ID for external link (resolves via .rels)
|
|
510
|
+
* - w:anchor - Internal bookmark name
|
|
511
|
+
* - w:tooltip - Tooltip/title text
|
|
512
|
+
* - w:tgtFrame - Target frame (_blank, _self, etc.)
|
|
513
|
+
* - w:history - Whether to add to history
|
|
514
|
+
* - w:docLocation - Location within a document
|
|
515
|
+
*
|
|
516
|
+
* External links use r:id to reference a relationship in document.xml.rels
|
|
517
|
+
* Internal links use w:anchor to reference a bookmark in the same document
|
|
518
|
+
*/
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Parse a hyperlink element (w:hyperlink)
|
|
522
|
+
*
|
|
523
|
+
* Handles both external links (via r:id relationship) and internal
|
|
524
|
+
* links (via w:anchor bookmark reference).
|
|
525
|
+
*
|
|
526
|
+
* @param node - The w:hyperlink XML element
|
|
527
|
+
* @param rels - Relationship map to resolve r:id references
|
|
528
|
+
* @param styles - Style map for resolving run styles
|
|
529
|
+
* @param theme - Theme for resolving colors/fonts
|
|
530
|
+
* @param media - Media files map for image data
|
|
531
|
+
* @returns Parsed Hyperlink object
|
|
532
|
+
*/
|
|
533
|
+
declare function parseHyperlink(node: Element, rels: RelationshipMap | null, styles?: StyleMap | null, theme?: Theme | null, media?: Map<string, MediaFile> | null): Hyperlink;
|
|
534
|
+
/**
|
|
535
|
+
* Get the display text of a hyperlink
|
|
536
|
+
*
|
|
537
|
+
* Concatenates text from all child runs.
|
|
538
|
+
*
|
|
539
|
+
* @param hyperlink - Parsed Hyperlink object
|
|
540
|
+
* @returns Display text string
|
|
541
|
+
*/
|
|
542
|
+
declare function getHyperlinkText(hyperlink: Hyperlink): string;
|
|
543
|
+
/**
|
|
544
|
+
* Check if a hyperlink is an external link
|
|
545
|
+
*
|
|
546
|
+
* @param hyperlink - Parsed Hyperlink object
|
|
547
|
+
* @returns true if this links to an external URL
|
|
548
|
+
*/
|
|
549
|
+
declare function isExternalLink(hyperlink: Hyperlink): boolean;
|
|
550
|
+
/**
|
|
551
|
+
* Check if a hyperlink is an internal bookmark link
|
|
552
|
+
*
|
|
553
|
+
* @param hyperlink - Parsed Hyperlink object
|
|
554
|
+
* @returns true if this links to an internal bookmark
|
|
555
|
+
*/
|
|
556
|
+
declare function isInternalLink(hyperlink: Hyperlink): boolean;
|
|
557
|
+
/**
|
|
558
|
+
* Get the resolved URL of a hyperlink
|
|
559
|
+
*
|
|
560
|
+
* For external links, returns the full URL.
|
|
561
|
+
* For internal links, returns the anchor prefixed with #.
|
|
562
|
+
* Returns undefined if the link couldn't be resolved.
|
|
563
|
+
*
|
|
564
|
+
* @param hyperlink - Parsed Hyperlink object
|
|
565
|
+
* @returns Resolved URL or undefined
|
|
566
|
+
*/
|
|
567
|
+
declare function getHyperlinkUrl(hyperlink: Hyperlink): string | undefined;
|
|
568
|
+
/**
|
|
569
|
+
* Check if a hyperlink has any content (runs)
|
|
570
|
+
*
|
|
571
|
+
* @param hyperlink - Parsed Hyperlink object
|
|
572
|
+
* @returns true if hyperlink has child runs
|
|
573
|
+
*/
|
|
574
|
+
declare function hasContent(hyperlink: Hyperlink): boolean;
|
|
575
|
+
/**
|
|
576
|
+
* Get all runs from a hyperlink
|
|
577
|
+
*
|
|
578
|
+
* @param hyperlink - Parsed Hyperlink object
|
|
579
|
+
* @returns Array of Run objects
|
|
580
|
+
*/
|
|
581
|
+
declare function getHyperlinkRuns(hyperlink: Hyperlink): Run[];
|
|
582
|
+
/**
|
|
583
|
+
* Resolve a hyperlink's rId to a URL using a relationship map
|
|
584
|
+
*
|
|
585
|
+
* This is useful when you have a hyperlink that was parsed without
|
|
586
|
+
* relationship context and need to resolve it later.
|
|
587
|
+
*
|
|
588
|
+
* @param hyperlink - Parsed Hyperlink object (will be modified)
|
|
589
|
+
* @param rels - Relationship map to resolve against
|
|
590
|
+
* @returns The resolved URL or undefined
|
|
591
|
+
*/
|
|
592
|
+
declare function resolveHyperlinkUrl(hyperlink: Hyperlink, rels: RelationshipMap): string | undefined;
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Shape Parser - Parse shapes and drawings from wps:wsp elements
|
|
596
|
+
*
|
|
597
|
+
* DOCX shapes are contained in drawings with wps:wsp (Word Processing Shape) elements.
|
|
598
|
+
* Shapes can be standalone or inside groups (wpg:wgp).
|
|
599
|
+
*
|
|
600
|
+
* OOXML Structure:
|
|
601
|
+
* w:drawing
|
|
602
|
+
* └── wp:inline or wp:anchor
|
|
603
|
+
* └── a:graphic
|
|
604
|
+
* └── a:graphicData
|
|
605
|
+
* └── wps:wsp (shape)
|
|
606
|
+
* ├── wps:cNvSpPr (non-visual properties)
|
|
607
|
+
* ├── wps:spPr (shape properties)
|
|
608
|
+
* │ ├── a:xfrm (transform: position, size, rotation)
|
|
609
|
+
* │ ├── a:prstGeom (preset geometry/shape type)
|
|
610
|
+
* │ ├── a:solidFill / a:noFill / a:gradFill (fill)
|
|
611
|
+
* │ └── a:ln (line/outline properties)
|
|
612
|
+
* ├── wps:style (style reference)
|
|
613
|
+
* ├── wps:txbx (text box container)
|
|
614
|
+
* │ └── w:txbxContent (text content)
|
|
615
|
+
* └── wps:bodyPr (body/text properties)
|
|
616
|
+
*
|
|
617
|
+
* EMU (English Metric Units): 914400 EMU = 1 inch
|
|
618
|
+
*/
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Parse a wps:wsp (Word Processing Shape) element
|
|
622
|
+
*
|
|
623
|
+
* @param node - The wps:wsp XML element
|
|
624
|
+
* @returns Parsed Shape object
|
|
625
|
+
*/
|
|
626
|
+
declare function parseShape(node: Element): Shape;
|
|
627
|
+
/**
|
|
628
|
+
* Parse shape from a w:drawing element that contains a shape (not an image)
|
|
629
|
+
*
|
|
630
|
+
* @param drawingEl - The w:drawing element
|
|
631
|
+
* @returns Parsed Shape object or null if not a shape
|
|
632
|
+
*/
|
|
633
|
+
declare function parseShapeFromDrawing(drawingEl: Element): Shape | null;
|
|
634
|
+
/**
|
|
635
|
+
* Check if a drawing element contains a shape (not an image)
|
|
636
|
+
*/
|
|
637
|
+
declare function isShapeDrawing(drawingEl: Element): boolean;
|
|
638
|
+
/**
|
|
639
|
+
* Check if a shape is a line (connector)
|
|
640
|
+
*/
|
|
641
|
+
declare function isLineShape(shape: Shape): boolean;
|
|
642
|
+
/**
|
|
643
|
+
* Check if a shape is a text box
|
|
644
|
+
*/
|
|
645
|
+
declare function isTextBoxShape(shape: Shape): boolean;
|
|
646
|
+
/**
|
|
647
|
+
* Check if a shape has text content
|
|
648
|
+
*/
|
|
649
|
+
declare function hasTextContent(shape: Shape): boolean;
|
|
650
|
+
/**
|
|
651
|
+
* Get shape width in pixels
|
|
652
|
+
*/
|
|
653
|
+
declare function getShapeWidthPx(shape: Shape): number;
|
|
654
|
+
/**
|
|
655
|
+
* Get shape height in pixels
|
|
656
|
+
*/
|
|
657
|
+
declare function getShapeHeightPx(shape: Shape): number;
|
|
658
|
+
/**
|
|
659
|
+
* Get shape dimensions in pixels
|
|
660
|
+
*/
|
|
661
|
+
declare function getShapeDimensionsPx(shape: Shape): {
|
|
662
|
+
width: number;
|
|
663
|
+
height: number;
|
|
664
|
+
};
|
|
665
|
+
/**
|
|
666
|
+
* Check if shape is floating (anchored)
|
|
667
|
+
*/
|
|
668
|
+
declare function isFloatingShape(shape: Shape): boolean;
|
|
669
|
+
/**
|
|
670
|
+
* Check if shape has fill
|
|
671
|
+
*/
|
|
672
|
+
declare function hasFill(shape: Shape): boolean;
|
|
673
|
+
/**
|
|
674
|
+
* Check if shape has outline
|
|
675
|
+
*/
|
|
676
|
+
declare function hasOutline(shape: Shape): boolean;
|
|
677
|
+
/**
|
|
678
|
+
* Get outline width in pixels
|
|
679
|
+
*/
|
|
680
|
+
declare function getOutlineWidthPx(shape: Shape): number;
|
|
681
|
+
/**
|
|
682
|
+
* Resolve fill color to CSS color string
|
|
683
|
+
*/
|
|
684
|
+
declare function resolveFillColor(shape: Shape): string | undefined;
|
|
685
|
+
/**
|
|
686
|
+
* Resolve outline color to CSS color string
|
|
687
|
+
*/
|
|
688
|
+
declare function resolveOutlineColor(shape: Shape): string | undefined;
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Tab Parser - Parse and handle tab stops in DOCX documents
|
|
692
|
+
*
|
|
693
|
+
* Tab stops define positions where the cursor jumps when the user presses Tab.
|
|
694
|
+
* They can have different alignments (left, center, right, decimal) and
|
|
695
|
+
* leader characters (dots, dashes, underscores).
|
|
696
|
+
*
|
|
697
|
+
* OOXML Reference:
|
|
698
|
+
* - Tab stops container: w:tabs
|
|
699
|
+
* - Individual tab stop: w:tab
|
|
700
|
+
* - Tab character in runs: w:tab (different from tab stop definition)
|
|
701
|
+
*
|
|
702
|
+
* Attributes of w:tab in w:tabs:
|
|
703
|
+
* - w:val - alignment type (left, center, right, decimal, bar, clear, num)
|
|
704
|
+
* - w:pos - position in twips from left margin
|
|
705
|
+
* - w:leader - leader character (none, dot, hyphen, underscore, heavy, middleDot)
|
|
706
|
+
*/
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* Default tab stop interval in twips (0.5 inches = 720 twips at 1440 twips/inch)
|
|
710
|
+
* Word uses this when no explicit tab stops are defined
|
|
711
|
+
*/
|
|
712
|
+
declare const DEFAULT_TAB_INTERVAL_TWIPS = 720;
|
|
713
|
+
/**
|
|
714
|
+
* Default tab alignment
|
|
715
|
+
*/
|
|
716
|
+
declare const DEFAULT_TAB_ALIGNMENT: TabStopAlignment;
|
|
717
|
+
/**
|
|
718
|
+
* Default tab leader
|
|
719
|
+
*/
|
|
720
|
+
declare const DEFAULT_TAB_LEADER: TabLeader;
|
|
721
|
+
/**
|
|
722
|
+
* Parse a single tab stop element (w:tab within w:tabs)
|
|
723
|
+
*
|
|
724
|
+
* @param tab - The w:tab XML element
|
|
725
|
+
* @returns Parsed TabStop or null if invalid
|
|
726
|
+
*/
|
|
727
|
+
declare function parseTabStop(tab: Element): TabStop | null;
|
|
728
|
+
/**
|
|
729
|
+
* Parse tab stops container (w:tabs)
|
|
730
|
+
*
|
|
731
|
+
* @param tabs - The w:tabs XML element
|
|
732
|
+
* @returns Array of TabStop objects, sorted by position
|
|
733
|
+
*/
|
|
734
|
+
declare function parseTabStops(tabs: Element | null): TabStop[];
|
|
735
|
+
/**
|
|
736
|
+
* Parse tab stops from paragraph properties element
|
|
737
|
+
*
|
|
738
|
+
* @param pPr - The w:pPr XML element
|
|
739
|
+
* @returns Array of TabStop objects or undefined if none
|
|
740
|
+
*/
|
|
741
|
+
declare function parseTabStopsFromParagraphProperties(pPr: Element | null): TabStop[] | undefined;
|
|
742
|
+
/**
|
|
743
|
+
* Merge tab stops from different sources (style, direct formatting)
|
|
744
|
+
*
|
|
745
|
+
* Direct formatting tab stops override style tab stops at the same position.
|
|
746
|
+
* "clear" alignment removes a tab stop from the style.
|
|
747
|
+
*
|
|
748
|
+
* @param styleTabs - Tab stops from style
|
|
749
|
+
* @param directTabs - Tab stops from direct formatting (w:pPr in paragraph)
|
|
750
|
+
* @returns Merged and filtered tab stops
|
|
751
|
+
*/
|
|
752
|
+
declare function mergeTabStops(styleTabs: TabStop[] | undefined, directTabs: TabStop[] | undefined): TabStop[];
|
|
753
|
+
/**
|
|
754
|
+
* Get the next tab stop position for a given current position
|
|
755
|
+
*
|
|
756
|
+
* @param currentPosition - Current position in twips from left margin
|
|
757
|
+
* @param tabStops - Defined tab stops
|
|
758
|
+
* @param pageWidth - Page content width in twips (for boundary)
|
|
759
|
+
* @returns The next tab stop or a default position
|
|
760
|
+
*/
|
|
761
|
+
declare function getNextTabStop(currentPosition: number, tabStops: TabStop[], pageWidth: number): TabStop;
|
|
762
|
+
/**
|
|
763
|
+
* Calculate the width needed for a tab at a given position
|
|
764
|
+
*
|
|
765
|
+
* @param currentPosition - Current position in twips
|
|
766
|
+
* @param tabStops - Defined tab stops
|
|
767
|
+
* @param pageWidth - Page content width in twips
|
|
768
|
+
* @returns Width in twips that the tab should span
|
|
769
|
+
*/
|
|
770
|
+
declare function calculateTabWidth(currentPosition: number, tabStops: TabStop[], pageWidth: number): number;
|
|
771
|
+
/**
|
|
772
|
+
* Calculate tab width considering alignment
|
|
773
|
+
*
|
|
774
|
+
* For non-left alignments (center, right, decimal), the width depends on
|
|
775
|
+
* the content that follows the tab.
|
|
776
|
+
*
|
|
777
|
+
* @param currentPosition - Current position in twips
|
|
778
|
+
* @param tabStops - Defined tab stops
|
|
779
|
+
* @param pageWidth - Page content width in twips
|
|
780
|
+
* @param followingContentWidth - Width of content after the tab (for alignment)
|
|
781
|
+
* @returns Width in twips
|
|
782
|
+
*/
|
|
783
|
+
declare function calculateTabWidthWithAlignment(currentPosition: number, tabStops: TabStop[], pageWidth: number, followingContentWidth?: number): {
|
|
784
|
+
width: number;
|
|
785
|
+
alignment: TabStopAlignment;
|
|
786
|
+
};
|
|
787
|
+
/**
|
|
788
|
+
* Get the character used for a tab leader
|
|
789
|
+
*
|
|
790
|
+
* @param leader - Tab leader type
|
|
791
|
+
* @returns The character to use for filling
|
|
792
|
+
*/
|
|
793
|
+
declare function getLeaderCharacter(leader: TabLeader | undefined): string;
|
|
794
|
+
/**
|
|
795
|
+
* Check if a leader type requires visible filling
|
|
796
|
+
*
|
|
797
|
+
* @param leader - Tab leader type
|
|
798
|
+
* @returns true if the leader needs visible characters
|
|
799
|
+
*/
|
|
800
|
+
declare function hasVisibleLeader(leader: TabLeader | undefined): boolean;
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Table Atom-level Property Parsers
|
|
804
|
+
*
|
|
805
|
+
* Parsers for the small, leaf-style table property elements:
|
|
806
|
+
* - measurements (w:tblW, w:tcW, w:trHeight twip values + width type)
|
|
807
|
+
* - borders (w:tblBorders, w:tcBorders, individual side specs)
|
|
808
|
+
* - cell margins (w:tblCellMar, w:tcMar)
|
|
809
|
+
* - shading (w:shd background + theme tint/shade)
|
|
810
|
+
* - table look flags (w:tblLook firstRow/lastRow/etc.)
|
|
811
|
+
* - floating table positioning (w:tblpPr anchors + offsets)
|
|
812
|
+
*
|
|
813
|
+
* These are leaf parsers — they don't recurse into rows/cells. The composite
|
|
814
|
+
* row/cell/table parsers (in `../tableParser.ts`) compose these.
|
|
815
|
+
*/
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* Parse a table measurement (width, height, etc.)
|
|
819
|
+
*
|
|
820
|
+
* @param element - Element with w:w and w:type attributes
|
|
821
|
+
* @returns Parsed measurement or undefined
|
|
822
|
+
*/
|
|
823
|
+
declare function parseTableMeasurement(element: Element | null): TableMeasurement | undefined;
|
|
824
|
+
/**
|
|
825
|
+
* Parse a single border specification
|
|
826
|
+
*
|
|
827
|
+
* @param element - Border element (w:top, w:bottom, etc.)
|
|
828
|
+
* @returns Parsed border or undefined
|
|
829
|
+
*/
|
|
830
|
+
declare function parseBorderSpec(element: Element | null): BorderSpec | undefined;
|
|
831
|
+
/**
|
|
832
|
+
* Parse table borders (w:tblBorders or w:tcBorders)
|
|
833
|
+
*
|
|
834
|
+
* @param bordersElement - The borders container element
|
|
835
|
+
* @returns Parsed borders or undefined
|
|
836
|
+
*/
|
|
837
|
+
declare function parseTableBorders(bordersElement: Element | null): TableBorders | undefined;
|
|
838
|
+
/**
|
|
839
|
+
* Parse cell margins (w:tblCellMar or w:tcMar)
|
|
840
|
+
*
|
|
841
|
+
* @param marginsElement - The margins container element
|
|
842
|
+
* @returns Parsed margins or undefined
|
|
843
|
+
*/
|
|
844
|
+
declare function parseCellMargins(marginsElement: Element | null): CellMargins | undefined;
|
|
845
|
+
/**
|
|
846
|
+
* Parse shading properties (w:shd)
|
|
847
|
+
*
|
|
848
|
+
* @param shdElement - The w:shd element
|
|
849
|
+
* @returns Parsed shading or undefined
|
|
850
|
+
*/
|
|
851
|
+
declare function parseShading(shdElement: Element | null): ShadingProperties | undefined;
|
|
852
|
+
/**
|
|
853
|
+
* Parse table look flags (w:tblLook)
|
|
854
|
+
*
|
|
855
|
+
* @param lookElement - The w:tblLook element
|
|
856
|
+
* @returns Parsed table look or undefined
|
|
857
|
+
*/
|
|
858
|
+
declare function parseTableLook(lookElement: Element | null): TableLook | undefined;
|
|
859
|
+
/**
|
|
860
|
+
* Parse floating table properties (w:tblpPr)
|
|
861
|
+
*
|
|
862
|
+
* @param tblpPrElement - The w:tblpPr element
|
|
863
|
+
* @returns Parsed floating properties or undefined
|
|
864
|
+
*/
|
|
865
|
+
declare function parseFloatingTableProperties(tblpPrElement: Element | null): FloatingTableProperties | undefined;
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* Table Query Helpers
|
|
869
|
+
*
|
|
870
|
+
* Read-only utilities for inspecting a parsed Table model — column/row
|
|
871
|
+
* counts, cell merge state, plain-text extraction, header detection,
|
|
872
|
+
* floating-table detection. No XML access; these operate on the parsed
|
|
873
|
+
* `Table` shape.
|
|
874
|
+
*/
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* Get the number of columns in a table
|
|
878
|
+
*
|
|
879
|
+
* Uses the table grid if available, otherwise counts cells in first row.
|
|
880
|
+
*
|
|
881
|
+
* @param table - The table to measure
|
|
882
|
+
* @returns Number of columns
|
|
883
|
+
*/
|
|
884
|
+
declare function getTableColumnCount(table: Table): number;
|
|
885
|
+
/**
|
|
886
|
+
* Get the number of rows in a table
|
|
887
|
+
*
|
|
888
|
+
* @param table - The table to measure
|
|
889
|
+
* @returns Number of rows
|
|
890
|
+
*/
|
|
891
|
+
declare function getTableRowCount(table: Table): number;
|
|
892
|
+
/**
|
|
893
|
+
* Check if a cell is part of a vertical merge
|
|
894
|
+
*
|
|
895
|
+
* @param cell - The cell to check
|
|
896
|
+
* @returns true if cell continues a vertical merge
|
|
897
|
+
*/
|
|
898
|
+
declare function isCellMergeContinuation(cell: TableCell): boolean;
|
|
899
|
+
/**
|
|
900
|
+
* Check if a cell starts a vertical merge
|
|
901
|
+
*
|
|
902
|
+
* @param cell - The cell to check
|
|
903
|
+
* @returns true if cell starts a vertical merge
|
|
904
|
+
*/
|
|
905
|
+
declare function isCellMergeStart(cell: TableCell): boolean;
|
|
906
|
+
/**
|
|
907
|
+
* Check if table has header row
|
|
908
|
+
*
|
|
909
|
+
* @param table - The table to check
|
|
910
|
+
* @returns true if first row is marked as header
|
|
911
|
+
*/
|
|
912
|
+
declare function hasHeaderRow(table: Table): boolean;
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* Table Parser - Parse tables with full OOXML structure
|
|
916
|
+
*
|
|
917
|
+
* OOXML tables consist of:
|
|
918
|
+
* - w:tbl - Table element
|
|
919
|
+
* - w:tblPr - Table properties (width, borders, style)
|
|
920
|
+
* - w:tblGrid - Column width definitions
|
|
921
|
+
* - w:tr - Table rows
|
|
922
|
+
* - w:trPr - Row properties (height, header)
|
|
923
|
+
* - w:tc - Table cells
|
|
924
|
+
* - w:tcPr - Cell properties (width, borders, merge)
|
|
925
|
+
*
|
|
926
|
+
* Cell merging:
|
|
927
|
+
* - Horizontal: w:gridSpan (how many grid columns this cell spans)
|
|
928
|
+
* - Vertical: w:vMerge (restart = start of merge, continue = continuation)
|
|
929
|
+
*
|
|
930
|
+
* OOXML Reference:
|
|
931
|
+
* - w:tbl contains w:tblPr, w:tblGrid, and w:tr elements
|
|
932
|
+
* - w:tr contains w:trPr and w:tc elements
|
|
933
|
+
* - w:tc contains w:tcPr and content (paragraphs, tables)
|
|
934
|
+
*
|
|
935
|
+
* Composite parsers (parseTable, parseTableRow, parseTableCell, plus the
|
|
936
|
+
* three property parsers and their tracked-change variants) live here.
|
|
937
|
+
* Leaf property parsers (measurements, borders, margins, shading, look,
|
|
938
|
+
* floating) are in ./tableParser/properties.ts. Query helpers (counts, merge
|
|
939
|
+
* checks, text extraction) are in ./tableParser/queries.ts.
|
|
940
|
+
*/
|
|
941
|
+
|
|
942
|
+
/**
|
|
943
|
+
* Parse table properties (w:tblPr)
|
|
944
|
+
*
|
|
945
|
+
* @param tblPrElement - The w:tblPr element
|
|
946
|
+
* @returns Parsed table formatting
|
|
947
|
+
*/
|
|
948
|
+
declare function parseTableProperties(tblPrElement: Element | null): TableFormatting | undefined;
|
|
949
|
+
|
|
950
|
+
/**
|
|
951
|
+
* Text Box Parser - Parse floating text box containers
|
|
952
|
+
*
|
|
953
|
+
* Text boxes in DOCX are implemented as shapes (wps:wsp) with text body content (wps:txbx).
|
|
954
|
+
* The text body contains w:txbxContent which holds paragraphs and tables like the main document.
|
|
955
|
+
*
|
|
956
|
+
* OOXML Structure:
|
|
957
|
+
* w:drawing
|
|
958
|
+
* └── wp:inline or wp:anchor
|
|
959
|
+
* └── a:graphic
|
|
960
|
+
* └── a:graphicData
|
|
961
|
+
* └── wps:wsp (shape)
|
|
962
|
+
* ├── wps:cNvSpPr (non-visual properties)
|
|
963
|
+
* ├── wps:spPr (shape properties)
|
|
964
|
+
* │ ├── a:xfrm (transform: position, size)
|
|
965
|
+
* │ ├── a:prstGeom (preset geometry - typically "rect" for text boxes)
|
|
966
|
+
* │ ├── a:solidFill / a:noFill (fill)
|
|
967
|
+
* │ └── a:ln (outline)
|
|
968
|
+
* ├── wps:txbx (text box container)
|
|
969
|
+
* │ └── w:txbxContent (text content)
|
|
970
|
+
* │ ├── w:p (paragraphs)
|
|
971
|
+
* │ └── w:tbl (tables)
|
|
972
|
+
* └── wps:bodyPr (body properties - margins, text direction, etc.)
|
|
973
|
+
*
|
|
974
|
+
* EMU (English Metric Units): 914400 EMU = 1 inch
|
|
975
|
+
*/
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* Extract raw paragraph elements from w:txbxContent
|
|
979
|
+
* Actual parsing happens via document parser to avoid circular dependencies
|
|
980
|
+
*/
|
|
981
|
+
declare function extractTextBoxContentElements(txbxContent: Element | null): {
|
|
982
|
+
paragraphElements: Element[];
|
|
983
|
+
tableElements: Element[];
|
|
984
|
+
};
|
|
985
|
+
/**
|
|
986
|
+
* Type for the paragraph parser function to avoid circular imports
|
|
987
|
+
*/
|
|
988
|
+
type ParagraphParserFn = (node: Element, styles: StyleMap | null, theme: Theme | null, numbering: NumberingMap | null, rels?: RelationshipMap | null) => Paragraph;
|
|
989
|
+
/**
|
|
990
|
+
* Type for the table parser function to avoid circular imports
|
|
991
|
+
*/
|
|
992
|
+
type TableParserFn = (node: Element, styles: StyleMap | null, theme: Theme | null, numbering: NumberingMap | null, rels?: RelationshipMap | null, media?: Map<string, MediaFile>) => Table;
|
|
993
|
+
/**
|
|
994
|
+
* Parse text box content with provided parser functions
|
|
995
|
+
* This avoids circular dependencies by accepting parser functions as parameters
|
|
996
|
+
*/
|
|
997
|
+
declare function parseTextBoxContent(txbxContent: Element | null, parseParagraph: ParagraphParserFn, parseTable: TableParserFn | null, styles: StyleMap | null, theme: Theme | null, numbering: NumberingMap | null, rels?: RelationshipMap | null, _media?: Map<string, MediaFile>): Paragraph[];
|
|
998
|
+
/**
|
|
999
|
+
* Check if a drawing element contains a text box
|
|
1000
|
+
* Text boxes are shapes with wps:txbx content
|
|
1001
|
+
*/
|
|
1002
|
+
declare function isTextBoxDrawing(drawingEl: Element): boolean;
|
|
1003
|
+
/**
|
|
1004
|
+
* Check if a wps:wsp element is a text box
|
|
1005
|
+
*/
|
|
1006
|
+
declare function isShapeTextBox(wsp: Element): boolean;
|
|
1007
|
+
/**
|
|
1008
|
+
* Parse a text box from a w:drawing element
|
|
1009
|
+
*
|
|
1010
|
+
* This creates a TextBox object with placeholder content.
|
|
1011
|
+
* The actual content parsing requires paragraph/table parsers which
|
|
1012
|
+
* creates a circular dependency. The document parser should call
|
|
1013
|
+
* parseTextBoxContent() separately with the required parsers.
|
|
1014
|
+
*
|
|
1015
|
+
* @param drawingEl - The w:drawing XML element
|
|
1016
|
+
* @returns TextBox object with placeholder content, or null if not a text box
|
|
1017
|
+
*/
|
|
1018
|
+
declare function parseTextBox(drawingEl: Element): TextBox | null;
|
|
1019
|
+
/**
|
|
1020
|
+
* Parse text box content XML element
|
|
1021
|
+
* @param wsp - The wps:wsp element containing the text box
|
|
1022
|
+
* @returns The w:txbxContent element or null
|
|
1023
|
+
*/
|
|
1024
|
+
declare function getTextBoxContentElement(wsp: Element): Element | null;
|
|
1025
|
+
/**
|
|
1026
|
+
* Parse text box from a wps:wsp element directly
|
|
1027
|
+
* Useful when you already have the shape element
|
|
1028
|
+
*/
|
|
1029
|
+
declare function parseTextBoxFromShape(wsp: Element, size: ImageSize, position?: ImagePosition, wrap?: ImageWrap): TextBox | null;
|
|
1030
|
+
/**
|
|
1031
|
+
* Get text box width in pixels
|
|
1032
|
+
*/
|
|
1033
|
+
declare function getTextBoxWidthPx(textBox: TextBox): number;
|
|
1034
|
+
/**
|
|
1035
|
+
* Get text box height in pixels
|
|
1036
|
+
*/
|
|
1037
|
+
declare function getTextBoxHeightPx(textBox: TextBox): number;
|
|
1038
|
+
/**
|
|
1039
|
+
* Get text box dimensions in pixels
|
|
1040
|
+
*/
|
|
1041
|
+
declare function getTextBoxDimensionsPx(textBox: TextBox): {
|
|
1042
|
+
width: number;
|
|
1043
|
+
height: number;
|
|
1044
|
+
};
|
|
1045
|
+
/**
|
|
1046
|
+
* Get text box margins in pixels
|
|
1047
|
+
*/
|
|
1048
|
+
declare function getTextBoxMarginsPx(textBox: TextBox): {
|
|
1049
|
+
top: number;
|
|
1050
|
+
bottom: number;
|
|
1051
|
+
left: number;
|
|
1052
|
+
right: number;
|
|
1053
|
+
};
|
|
1054
|
+
/**
|
|
1055
|
+
* Check if text box is floating (anchored)
|
|
1056
|
+
*/
|
|
1057
|
+
declare function isFloatingTextBox(textBox: TextBox): boolean;
|
|
1058
|
+
/**
|
|
1059
|
+
* Check if text box has fill
|
|
1060
|
+
*/
|
|
1061
|
+
declare function hasTextBoxFill(textBox: TextBox): boolean;
|
|
1062
|
+
/**
|
|
1063
|
+
* Check if text box has outline
|
|
1064
|
+
*/
|
|
1065
|
+
declare function hasTextBoxOutline(textBox: TextBox): boolean;
|
|
1066
|
+
/**
|
|
1067
|
+
* Check if text box has content
|
|
1068
|
+
*/
|
|
1069
|
+
declare function hasTextBoxContent(textBox: TextBox): boolean;
|
|
1070
|
+
/**
|
|
1071
|
+
* Get plain text from text box (helper for search/indexing)
|
|
1072
|
+
*/
|
|
1073
|
+
declare function getTextBoxText(textBox: TextBox): string;
|
|
1074
|
+
/**
|
|
1075
|
+
* Resolve fill color to CSS color string
|
|
1076
|
+
*/
|
|
1077
|
+
declare function resolveTextBoxFillColor(textBox: TextBox): string | undefined;
|
|
1078
|
+
/**
|
|
1079
|
+
* Resolve outline color to CSS color string
|
|
1080
|
+
*/
|
|
1081
|
+
declare function resolveTextBoxOutlineColor(textBox: TextBox): string | undefined;
|
|
1082
|
+
/**
|
|
1083
|
+
* Get outline width in pixels
|
|
1084
|
+
*/
|
|
1085
|
+
declare function getTextBoxOutlineWidthPx(textBox: TextBox): number;
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
* Reply-range marker injection for serialization.
|
|
1089
|
+
*
|
|
1090
|
+
* Word / Pages / LibreOffice expect every comment in `comments.xml`
|
|
1091
|
+
* (including REPLY threads) to have matching `commentRangeStart` /
|
|
1092
|
+
* `commentRangeEnd` / `commentReference` markers in `document.xml`.
|
|
1093
|
+
* The PM document only stamps marks for the parent comment because
|
|
1094
|
+
* replies don't have their own visible range — they share the parent
|
|
1095
|
+
* thread's text. So before serialization we walk the body content and
|
|
1096
|
+
* synthesize parallel range markers for every reply.
|
|
1097
|
+
*
|
|
1098
|
+
* Two helpers, one per parent shape:
|
|
1099
|
+
* - `injectReplyRangeMarkers` — replies whose parent is another
|
|
1100
|
+
* comment (regular threaded discussion). Finds the parent's
|
|
1101
|
+
* `commentRangeStart`/`End` and adds parallel markers next to them.
|
|
1102
|
+
* - `injectTCReplyRangeMarkers` — replies whose parent is a tracked
|
|
1103
|
+
* change (insertion/deletion). Wraps the TC content with
|
|
1104
|
+
* commentRange markers.
|
|
1105
|
+
*
|
|
1106
|
+
* Pre-#... this code lived inside React's DocxEditor.tsx; Vue had no
|
|
1107
|
+
* equivalent and so silently lost reply markers when saving collab
|
|
1108
|
+
* documents. Living in core means both adapters get it for free.
|
|
1109
|
+
*/
|
|
1110
|
+
|
|
1111
|
+
/**
|
|
1112
|
+
* Inject `commentRangeStart`/`commentRangeEnd` for reply comments
|
|
1113
|
+
* that share their parent comment's text range.
|
|
1114
|
+
*/
|
|
1115
|
+
declare function injectReplyRangeMarkers(content: BlockContent[], comments: Comment[]): void;
|
|
1116
|
+
/**
|
|
1117
|
+
* Inject `commentRangeStart`/`commentRangeEnd` for comments whose
|
|
1118
|
+
* parent is a tracked-change revision (insertion/deletion). The TC
|
|
1119
|
+
* content nodes don't carry the comment's range, so we wrap them.
|
|
1120
|
+
*/
|
|
1121
|
+
declare function injectTCReplyRangeMarkers(content: BlockContent[], comments: Comment[]): void;
|
|
1122
|
+
|
|
1123
|
+
export { type ComplexFieldContext, type ComplexFieldState, DEFAULT_TAB_ALIGNMENT, DEFAULT_TAB_INTERVAL_TWIPS, DEFAULT_TAB_LEADER, type EndnoteMap, type FieldSwitch, type FootnoteMap, KNOWN_FIELD_TYPES, type NumberingMap, type ParagraphParserFn, type ParsedFieldInstruction, type TableParserFn, calculateTabWidth, calculateTabWidthWithAlignment, createComplexFieldContext, extractTextBoxContentElements, formatNumber, getBulletCharacter, getEndnoteText, getFieldDisplayValue, getFootnoteText, getFormatSwitch, getHyperlinkRuns, getHyperlinkText, getHyperlinkUrl, getImageHeightPx, getImageWidthPx, getLeaderCharacter, getNextTabStop, getOutlineWidthPx, getShapeDimensionsPx, getShapeHeightPx, getShapeWidthPx, getTableColumnCount, getTableRowCount, getTextBoxContentElement, getTextBoxDimensionsPx, getTextBoxHeightPx, getTextBoxMarginsPx, getTextBoxOutlineWidthPx, getTextBoxText, getTextBoxWidthPx, getWrapDistancesPx, hasContent, hasFill, hasHeaderRow, hasMergeFormat, hasOutline, hasTextBoxContent, hasTextBoxFill, hasTextBoxOutline, hasTextContent, hasVisibleLeader, injectReplyRangeMarkers, injectTCReplyRangeMarkers, isBehindText, isBulletLevel, isCellMergeContinuation, isCellMergeStart, isDateTimeField, isDecorativeImage, isDocPropertyField, isExternalLink, isFloatingImage, isFloatingShape, isFloatingTextBox, isInFrontOfText, isInlineImage, isInternalLink, isKnownFieldType, isLineShape, isMergeField, isPageNumberField, isReferenceField, isSeparatorEndnote, isSeparatorFootnote, isShapeDrawing, isShapeTextBox, isTextBoxDrawing, isTextBoxShape, isTocField, isTotalPagesField, mergeTabStops, parseBorderSpec, parseCellMargins, parseDrawing, parseEndnoteProperties, parseEndnotes, parseFieldInstruction, parseFieldType, parseFloatingTableProperties, parseFootnoteProperties, parseFootnotes, parseHyperlink, parseImage, parseNumbering, parseShading, parseShape, parseShapeFromDrawing, parseSimpleField, parseTabStop, parseTabStops, parseTabStopsFromParagraphProperties, parseTableBorders, parseTableLook, parseTableMeasurement, parseTableProperties, parseTextBox, parseTextBoxContent, parseTextBoxFromShape, renderListMarker, resolveFillColor, resolveHyperlinkUrl, resolveOutlineColor, resolveTextBoxFillColor, resolveTextBoxOutlineColor };
|