@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,570 @@
|
|
|
1
|
+
import { Document } from './types/document.mjs';
|
|
2
|
+
import { StyleInfo, AgentContext, Position, Range, AgentCommand, SelectionContext } from './types/agentApi.mjs';
|
|
3
|
+
import { S as SelectiveSaveOptions } from './selectiveSave-jinP_4xa.mjs';
|
|
4
|
+
import { D as DocxInput } from './docxInput-DTbCa48g.mjs';
|
|
5
|
+
import { T as TextFormatting, P as ParagraphFormatting } from './formatting-BH4hcZiq.mjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* DocumentAgent - High-level fluent API for programmatic document manipulation
|
|
9
|
+
*
|
|
10
|
+
* Provides a convenient interface for:
|
|
11
|
+
* - Reading document content and metadata
|
|
12
|
+
* - Editing text with formatting
|
|
13
|
+
* - Inserting tables, images, and hyperlinks
|
|
14
|
+
* - Managing template variables
|
|
15
|
+
* - Exporting to DOCX buffer
|
|
16
|
+
*
|
|
17
|
+
* All operations are immutable - they return a new DocumentAgent instance
|
|
18
|
+
* or don't modify the underlying document.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Options for inserting text
|
|
23
|
+
*/
|
|
24
|
+
interface InsertTextOptions {
|
|
25
|
+
/** Text formatting */
|
|
26
|
+
formatting?: TextFormatting;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Options for inserting table
|
|
30
|
+
*/
|
|
31
|
+
interface InsertTableOptions {
|
|
32
|
+
/** Table data (2D array of strings) */
|
|
33
|
+
data?: string[][];
|
|
34
|
+
/** Whether first row is a header */
|
|
35
|
+
hasHeader?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Options for inserting image
|
|
39
|
+
*/
|
|
40
|
+
interface InsertImageOptions {
|
|
41
|
+
/** Image width in pixels */
|
|
42
|
+
width?: number;
|
|
43
|
+
/** Image height in pixels */
|
|
44
|
+
height?: number;
|
|
45
|
+
/** Alt text for accessibility */
|
|
46
|
+
alt?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Options for inserting hyperlink
|
|
50
|
+
*/
|
|
51
|
+
interface InsertHyperlinkOptions {
|
|
52
|
+
/** Display text (overrides selected text) */
|
|
53
|
+
displayText?: string;
|
|
54
|
+
/** Tooltip on hover */
|
|
55
|
+
tooltip?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Formatted text segment
|
|
59
|
+
*/
|
|
60
|
+
interface FormattedTextSegment {
|
|
61
|
+
/** Text content */
|
|
62
|
+
text: string;
|
|
63
|
+
/** Applied formatting */
|
|
64
|
+
formatting?: TextFormatting;
|
|
65
|
+
/** Is part of a hyperlink */
|
|
66
|
+
isHyperlink?: boolean;
|
|
67
|
+
/** Hyperlink URL if applicable */
|
|
68
|
+
hyperlinkUrl?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* DocumentAgent provides a fluent API for document manipulation
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* const agent = new DocumentAgent(buffer);
|
|
76
|
+
*
|
|
77
|
+
* // Read operations
|
|
78
|
+
* const text = agent.getText();
|
|
79
|
+
* const wordCount = agent.getWordCount();
|
|
80
|
+
* const variables = agent.getVariables();
|
|
81
|
+
*
|
|
82
|
+
* // Write operations (returns new agent)
|
|
83
|
+
* const newAgent = agent
|
|
84
|
+
* .insertText({ paragraphIndex: 0, offset: 0 }, 'Hello ', { formatting: { bold: true } })
|
|
85
|
+
* .applyStyle({ paragraphIndex: 0, offset: 0 }, { paragraphIndex: 0, offset: 5 }, 'Heading1');
|
|
86
|
+
*
|
|
87
|
+
* // Export
|
|
88
|
+
* const newBuffer = await newAgent.toBuffer();
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
declare class DocumentAgent {
|
|
92
|
+
private _document;
|
|
93
|
+
private _pendingVariables;
|
|
94
|
+
/**
|
|
95
|
+
* Create a new DocumentAgent
|
|
96
|
+
*
|
|
97
|
+
* @param source - Document object or ArrayBuffer to parse
|
|
98
|
+
*/
|
|
99
|
+
constructor(source: Document | ArrayBuffer);
|
|
100
|
+
/**
|
|
101
|
+
* Create a DocumentAgent from a DOCX buffer (async)
|
|
102
|
+
*
|
|
103
|
+
* @param buffer - DOCX file as ArrayBuffer, Uint8Array, Blob, or File
|
|
104
|
+
* @returns Promise resolving to DocumentAgent
|
|
105
|
+
*/
|
|
106
|
+
static fromBuffer(buffer: DocxInput): Promise<DocumentAgent>;
|
|
107
|
+
/**
|
|
108
|
+
* Create a DocumentAgent from a Document object
|
|
109
|
+
*
|
|
110
|
+
* @param document - Parsed Document
|
|
111
|
+
* @returns DocumentAgent
|
|
112
|
+
*/
|
|
113
|
+
static fromDocument(document: Document): DocumentAgent;
|
|
114
|
+
/**
|
|
115
|
+
* Get the underlying document
|
|
116
|
+
*/
|
|
117
|
+
getDocument(): Document;
|
|
118
|
+
/**
|
|
119
|
+
* Get plain text content of the document
|
|
120
|
+
*
|
|
121
|
+
* @returns All document text concatenated
|
|
122
|
+
*/
|
|
123
|
+
getText(): string;
|
|
124
|
+
/**
|
|
125
|
+
* Get formatted text segments
|
|
126
|
+
*
|
|
127
|
+
* @returns Array of text segments with formatting info
|
|
128
|
+
*/
|
|
129
|
+
getFormattedText(): FormattedTextSegment[];
|
|
130
|
+
/**
|
|
131
|
+
* Get detected template variables
|
|
132
|
+
*
|
|
133
|
+
* @returns Array of variable names (without braces)
|
|
134
|
+
*/
|
|
135
|
+
getVariables(): string[];
|
|
136
|
+
/**
|
|
137
|
+
* Get available styles from the document
|
|
138
|
+
*
|
|
139
|
+
* @returns Array of style info
|
|
140
|
+
*/
|
|
141
|
+
getStyles(): StyleInfo[];
|
|
142
|
+
/**
|
|
143
|
+
* Get approximate page count
|
|
144
|
+
*
|
|
145
|
+
* Note: This is an estimate based on content length.
|
|
146
|
+
* Actual page count requires full layout computation.
|
|
147
|
+
*
|
|
148
|
+
* @returns Estimated page count
|
|
149
|
+
*/
|
|
150
|
+
getPageCount(): number;
|
|
151
|
+
/**
|
|
152
|
+
* Get word count
|
|
153
|
+
*
|
|
154
|
+
* @returns Number of words in the document
|
|
155
|
+
*/
|
|
156
|
+
getWordCount(): number;
|
|
157
|
+
/**
|
|
158
|
+
* Get character count
|
|
159
|
+
*
|
|
160
|
+
* @param includeSpaces - Whether to include whitespace
|
|
161
|
+
* @returns Number of characters
|
|
162
|
+
*/
|
|
163
|
+
getCharacterCount(includeSpaces?: boolean): number;
|
|
164
|
+
/**
|
|
165
|
+
* Get paragraph count
|
|
166
|
+
*
|
|
167
|
+
* @returns Number of paragraphs
|
|
168
|
+
*/
|
|
169
|
+
getParagraphCount(): number;
|
|
170
|
+
/**
|
|
171
|
+
* Get table count
|
|
172
|
+
*
|
|
173
|
+
* @returns Number of tables
|
|
174
|
+
*/
|
|
175
|
+
getTableCount(): number;
|
|
176
|
+
/**
|
|
177
|
+
* Get document context for AI agents
|
|
178
|
+
*
|
|
179
|
+
* @param outlineMaxChars - Max characters per paragraph in outline
|
|
180
|
+
* @returns Agent context
|
|
181
|
+
*/
|
|
182
|
+
getAgentContext(outlineMaxChars?: number): AgentContext;
|
|
183
|
+
/**
|
|
184
|
+
* Insert text at a position
|
|
185
|
+
*
|
|
186
|
+
* @param position - Where to insert
|
|
187
|
+
* @param text - Text to insert
|
|
188
|
+
* @param options - Insert options
|
|
189
|
+
* @returns New DocumentAgent with text inserted
|
|
190
|
+
*/
|
|
191
|
+
insertText(position: Position, text: string, options?: InsertTextOptions): DocumentAgent;
|
|
192
|
+
/**
|
|
193
|
+
* Replace text in a range
|
|
194
|
+
*
|
|
195
|
+
* @param range - Range to replace
|
|
196
|
+
* @param text - Replacement text
|
|
197
|
+
* @param options - Replace options
|
|
198
|
+
* @returns New DocumentAgent with text replaced
|
|
199
|
+
*/
|
|
200
|
+
replaceRange(range: Range, text: string, options?: InsertTextOptions): DocumentAgent;
|
|
201
|
+
/**
|
|
202
|
+
* Delete text in a range
|
|
203
|
+
*
|
|
204
|
+
* @param range - Range to delete
|
|
205
|
+
* @returns New DocumentAgent with text deleted
|
|
206
|
+
*/
|
|
207
|
+
deleteRange(range: Range): DocumentAgent;
|
|
208
|
+
/**
|
|
209
|
+
* Apply text formatting to a range
|
|
210
|
+
*
|
|
211
|
+
* @param range - Range to format
|
|
212
|
+
* @param formatting - Formatting to apply
|
|
213
|
+
* @returns New DocumentAgent with formatting applied
|
|
214
|
+
*/
|
|
215
|
+
applyFormatting(range: Range, formatting: Partial<TextFormatting>): DocumentAgent;
|
|
216
|
+
/**
|
|
217
|
+
* Apply a named style to a paragraph
|
|
218
|
+
*
|
|
219
|
+
* @param paragraphIndex - Index of the paragraph
|
|
220
|
+
* @param styleId - Style ID to apply
|
|
221
|
+
* @returns New DocumentAgent with style applied
|
|
222
|
+
*/
|
|
223
|
+
applyStyle(paragraphIndex: number, styleId: string): DocumentAgent;
|
|
224
|
+
/**
|
|
225
|
+
* Apply paragraph formatting
|
|
226
|
+
*
|
|
227
|
+
* @param paragraphIndex - Index of the paragraph
|
|
228
|
+
* @param formatting - Formatting to apply
|
|
229
|
+
* @returns New DocumentAgent with formatting applied
|
|
230
|
+
*/
|
|
231
|
+
applyParagraphFormatting(paragraphIndex: number, formatting: Partial<ParagraphFormatting>): DocumentAgent;
|
|
232
|
+
/**
|
|
233
|
+
* Insert a table at a position
|
|
234
|
+
*
|
|
235
|
+
* @param position - Where to insert the table
|
|
236
|
+
* @param rows - Number of rows
|
|
237
|
+
* @param cols - Number of columns
|
|
238
|
+
* @param options - Table options
|
|
239
|
+
* @returns New DocumentAgent with table inserted
|
|
240
|
+
*/
|
|
241
|
+
insertTable(position: Position, rows: number, cols: number, options?: InsertTableOptions): DocumentAgent;
|
|
242
|
+
/**
|
|
243
|
+
* Insert an image at a position
|
|
244
|
+
*
|
|
245
|
+
* @param position - Where to insert the image
|
|
246
|
+
* @param src - Image source (base64 data URL or URL)
|
|
247
|
+
* @param options - Image options
|
|
248
|
+
* @returns New DocumentAgent with image inserted
|
|
249
|
+
*/
|
|
250
|
+
insertImage(position: Position, src: string, options?: InsertImageOptions): DocumentAgent;
|
|
251
|
+
/**
|
|
252
|
+
* Insert a hyperlink
|
|
253
|
+
*
|
|
254
|
+
* @param range - Range to make into a hyperlink
|
|
255
|
+
* @param url - URL of the hyperlink
|
|
256
|
+
* @param options - Hyperlink options
|
|
257
|
+
* @returns New DocumentAgent with hyperlink inserted
|
|
258
|
+
*/
|
|
259
|
+
insertHyperlink(range: Range, url: string, options?: InsertHyperlinkOptions): DocumentAgent;
|
|
260
|
+
/**
|
|
261
|
+
* Remove a hyperlink but keep the text
|
|
262
|
+
*
|
|
263
|
+
* @param range - Range containing the hyperlink
|
|
264
|
+
* @returns New DocumentAgent with hyperlink removed
|
|
265
|
+
*/
|
|
266
|
+
removeHyperlink(range: Range): DocumentAgent;
|
|
267
|
+
/**
|
|
268
|
+
* Insert a paragraph break
|
|
269
|
+
*
|
|
270
|
+
* @param position - Where to break the paragraph
|
|
271
|
+
* @returns New DocumentAgent with paragraph broken
|
|
272
|
+
*/
|
|
273
|
+
insertParagraphBreak(position: Position): DocumentAgent;
|
|
274
|
+
/**
|
|
275
|
+
* Merge consecutive paragraphs
|
|
276
|
+
*
|
|
277
|
+
* @param startParagraphIndex - First paragraph index
|
|
278
|
+
* @param count - Number of paragraphs to merge with the first
|
|
279
|
+
* @returns New DocumentAgent with paragraphs merged
|
|
280
|
+
*/
|
|
281
|
+
mergeParagraphs(startParagraphIndex: number, count: number): DocumentAgent;
|
|
282
|
+
/**
|
|
283
|
+
* Set a template variable value
|
|
284
|
+
*
|
|
285
|
+
* Note: Variables are not applied until `applyVariables()` is called
|
|
286
|
+
*
|
|
287
|
+
* @param name - Variable name (without braces)
|
|
288
|
+
* @param value - Variable value
|
|
289
|
+
* @returns This DocumentAgent (for chaining)
|
|
290
|
+
*/
|
|
291
|
+
setVariable(name: string, value: string): DocumentAgent;
|
|
292
|
+
/**
|
|
293
|
+
* Set multiple template variables
|
|
294
|
+
*
|
|
295
|
+
* @param variables - Map of variable names to values
|
|
296
|
+
* @returns This DocumentAgent (for chaining)
|
|
297
|
+
*/
|
|
298
|
+
setVariables(variables: Record<string, string>): DocumentAgent;
|
|
299
|
+
/**
|
|
300
|
+
* Get pending variable values
|
|
301
|
+
*
|
|
302
|
+
* @returns Map of pending variable values
|
|
303
|
+
*/
|
|
304
|
+
getPendingVariables(): Record<string, string>;
|
|
305
|
+
/**
|
|
306
|
+
* Clear pending variables
|
|
307
|
+
*
|
|
308
|
+
* @returns This DocumentAgent (for chaining)
|
|
309
|
+
*/
|
|
310
|
+
clearPendingVariables(): DocumentAgent;
|
|
311
|
+
/**
|
|
312
|
+
* Apply all pending template variables
|
|
313
|
+
*
|
|
314
|
+
* Uses docxtemplater to substitute variables while preserving formatting.
|
|
315
|
+
*
|
|
316
|
+
* @param variables - Optional additional variables (merged with pending)
|
|
317
|
+
* @returns New DocumentAgent with variables applied
|
|
318
|
+
*/
|
|
319
|
+
applyVariables(variables?: Record<string, string>): Promise<DocumentAgent>;
|
|
320
|
+
/**
|
|
321
|
+
* Export document to DOCX ArrayBuffer
|
|
322
|
+
*
|
|
323
|
+
* @returns Promise resolving to DOCX file as ArrayBuffer
|
|
324
|
+
*/
|
|
325
|
+
toBuffer(options?: {
|
|
326
|
+
selective?: SelectiveSaveOptions;
|
|
327
|
+
}): Promise<ArrayBuffer>;
|
|
328
|
+
/**
|
|
329
|
+
* Export document to Blob
|
|
330
|
+
*
|
|
331
|
+
* @param mimeType - MIME type for the blob
|
|
332
|
+
* @returns Promise resolving to DOCX file as Blob
|
|
333
|
+
*/
|
|
334
|
+
toBlob(mimeType?: string): Promise<Blob>;
|
|
335
|
+
/**
|
|
336
|
+
* Execute multiple commands in sequence
|
|
337
|
+
*
|
|
338
|
+
* @param commands - Commands to execute
|
|
339
|
+
* @returns New DocumentAgent with all commands applied
|
|
340
|
+
*/
|
|
341
|
+
executeCommands(commands: AgentCommand[]): DocumentAgent;
|
|
342
|
+
/**
|
|
343
|
+
* Execute a single command and return new agent
|
|
344
|
+
*/
|
|
345
|
+
private _executeCommand;
|
|
346
|
+
/**
|
|
347
|
+
* Get plain text from document body
|
|
348
|
+
*/
|
|
349
|
+
private _getBodyText;
|
|
350
|
+
/**
|
|
351
|
+
* Get plain text from a paragraph
|
|
352
|
+
*/
|
|
353
|
+
private _getParagraphText;
|
|
354
|
+
/**
|
|
355
|
+
* Get plain text from a run
|
|
356
|
+
*/
|
|
357
|
+
private _getRunText;
|
|
358
|
+
/**
|
|
359
|
+
* Get plain text from a hyperlink
|
|
360
|
+
*/
|
|
361
|
+
private _getHyperlinkText;
|
|
362
|
+
/**
|
|
363
|
+
* Get plain text from a table
|
|
364
|
+
*/
|
|
365
|
+
private _getTableText;
|
|
366
|
+
/**
|
|
367
|
+
* Extract formatted text segments from a paragraph
|
|
368
|
+
*/
|
|
369
|
+
private _extractParagraphSegments;
|
|
370
|
+
/**
|
|
371
|
+
* Parse heading level from style ID
|
|
372
|
+
*/
|
|
373
|
+
private _parseHeadingLevel;
|
|
374
|
+
/**
|
|
375
|
+
* Check if document has images
|
|
376
|
+
*/
|
|
377
|
+
private _hasImages;
|
|
378
|
+
/**
|
|
379
|
+
* Check if document has hyperlinks
|
|
380
|
+
*/
|
|
381
|
+
private _hasHyperlinks;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Create a DocumentAgent from a DOCX buffer
|
|
385
|
+
*
|
|
386
|
+
* @param buffer - DOCX file as ArrayBuffer
|
|
387
|
+
* @returns Promise resolving to DocumentAgent
|
|
388
|
+
*/
|
|
389
|
+
declare function createAgent(buffer: ArrayBuffer): Promise<DocumentAgent>;
|
|
390
|
+
/**
|
|
391
|
+
* Create a DocumentAgent from a parsed Document
|
|
392
|
+
*
|
|
393
|
+
* @param document - Parsed Document
|
|
394
|
+
* @returns DocumentAgent
|
|
395
|
+
*/
|
|
396
|
+
declare function createAgentFromDocument(document: Document): DocumentAgent;
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Command Executor
|
|
400
|
+
*
|
|
401
|
+
* Executes agent commands on a document immutably:
|
|
402
|
+
* - Handles all command types from AgentCommand
|
|
403
|
+
* - Preserves surrounding formatting
|
|
404
|
+
* - Returns new document (immutable updates)
|
|
405
|
+
*
|
|
406
|
+
* Per-command handlers live under `executor/` by domain (text edits,
|
|
407
|
+
* paragraph splits/merges, structural inserts, template variables).
|
|
408
|
+
* Shared helpers (clone, lookup, text-range edits) live in
|
|
409
|
+
* `executor/helpers.ts`.
|
|
410
|
+
*/
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Execute an agent command on a document
|
|
414
|
+
* Returns a new document with the command applied (immutable)
|
|
415
|
+
*
|
|
416
|
+
* Dispatch order:
|
|
417
|
+
* 1. Try plugin handlers first (allows plugins to override built-in commands)
|
|
418
|
+
* 2. Fall back to built-in handlers
|
|
419
|
+
*
|
|
420
|
+
* @param doc - The document to modify
|
|
421
|
+
* @param command - The command to execute
|
|
422
|
+
* @returns New document with command applied
|
|
423
|
+
*/
|
|
424
|
+
declare function executeCommand(doc: Document, command: AgentCommand): Document;
|
|
425
|
+
/**
|
|
426
|
+
* Execute multiple commands in sequence
|
|
427
|
+
*
|
|
428
|
+
* @param doc - The document to modify
|
|
429
|
+
* @param commands - Commands to execute in order
|
|
430
|
+
* @returns New document with all commands applied
|
|
431
|
+
*/
|
|
432
|
+
declare function executeCommands(doc: Document, commands: AgentCommand[]): Document;
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Agent Context Builder
|
|
436
|
+
*
|
|
437
|
+
* Generates context objects for AI/LLM consumption from DOCX documents.
|
|
438
|
+
* The context provides a structured summary of the document that can be
|
|
439
|
+
* used by AI agents to understand the document structure and content.
|
|
440
|
+
*
|
|
441
|
+
* All outputs are JSON serializable for easy transmission to AI backends.
|
|
442
|
+
*/
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Options for building agent context
|
|
446
|
+
*/
|
|
447
|
+
interface AgentContextOptions {
|
|
448
|
+
/** Maximum characters per paragraph in outline (default: 100) */
|
|
449
|
+
outlineMaxChars?: number;
|
|
450
|
+
/** Maximum paragraphs to include in outline (default: 50) */
|
|
451
|
+
maxOutlineParagraphs?: number;
|
|
452
|
+
/** Include table content in context (default: false) */
|
|
453
|
+
includeTableContent?: boolean;
|
|
454
|
+
/** Include detailed formatting info (default: false) */
|
|
455
|
+
includeFormatting?: boolean;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Options for building selection context
|
|
459
|
+
*/
|
|
460
|
+
interface SelectionContextOptions$1 {
|
|
461
|
+
/** Characters of context before/after selection (default: 200) */
|
|
462
|
+
contextChars?: number;
|
|
463
|
+
/** Include suggested actions (default: true) */
|
|
464
|
+
includeSuggestions?: boolean;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Build agent context from a document
|
|
468
|
+
*
|
|
469
|
+
* @param doc - The parsed document
|
|
470
|
+
* @param options - Context building options
|
|
471
|
+
* @returns AgentContext object (JSON serializable)
|
|
472
|
+
*/
|
|
473
|
+
declare function getAgentContext(doc: Document, options?: AgentContextOptions): AgentContext;
|
|
474
|
+
/**
|
|
475
|
+
* Build selection context for AI operations
|
|
476
|
+
*
|
|
477
|
+
* @param doc - The parsed document
|
|
478
|
+
* @param range - The selected range
|
|
479
|
+
* @param options - Selection context options
|
|
480
|
+
* @returns SelectionContext object (JSON serializable)
|
|
481
|
+
*/
|
|
482
|
+
declare function buildSelectionContext$1(doc: Document, range: Range, options?: SelectionContextOptions$1): SelectionContext;
|
|
483
|
+
/**
|
|
484
|
+
* Get a simple document summary for quick context
|
|
485
|
+
*
|
|
486
|
+
* @param doc - The parsed document
|
|
487
|
+
* @returns Summary string
|
|
488
|
+
*/
|
|
489
|
+
declare function getDocumentSummary(doc: Document): string;
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Selection Context Builder
|
|
493
|
+
*
|
|
494
|
+
* Builds rich context objects from document selections for AI operations.
|
|
495
|
+
* Includes selected text, formatting, surrounding context, and suggested actions.
|
|
496
|
+
*/
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Options for building selection context
|
|
500
|
+
*/
|
|
501
|
+
interface SelectionContextOptions {
|
|
502
|
+
/** Characters of context before selection (default: 200) */
|
|
503
|
+
contextCharsBefore?: number;
|
|
504
|
+
/** Characters of context after selection (default: 200) */
|
|
505
|
+
contextCharsAfter?: number;
|
|
506
|
+
/** Include suggested actions (default: true) */
|
|
507
|
+
includeSuggestions?: boolean;
|
|
508
|
+
/** Include document summary (default: true) */
|
|
509
|
+
includeDocumentSummary?: boolean;
|
|
510
|
+
/** Maximum suggested actions (default: 8) */
|
|
511
|
+
maxSuggestions?: number;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Extended selection context with additional details
|
|
515
|
+
*/
|
|
516
|
+
interface ExtendedSelectionContext extends SelectionContext {
|
|
517
|
+
/** Document summary for additional context */
|
|
518
|
+
documentSummary?: string;
|
|
519
|
+
/** Selection word count */
|
|
520
|
+
wordCount?: number;
|
|
521
|
+
/** Selection character count */
|
|
522
|
+
characterCount?: number;
|
|
523
|
+
/** Is selection multi-paragraph */
|
|
524
|
+
isMultiParagraph?: boolean;
|
|
525
|
+
/** Selected paragraph indices */
|
|
526
|
+
paragraphIndices?: number[];
|
|
527
|
+
/** Language detection hint */
|
|
528
|
+
detectedLanguage?: string;
|
|
529
|
+
/** Content type hints */
|
|
530
|
+
contentType?: 'prose' | 'list' | 'heading' | 'table' | 'mixed';
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Selection formatting summary
|
|
534
|
+
*/
|
|
535
|
+
interface FormattingSummary {
|
|
536
|
+
/** Predominant formatting */
|
|
537
|
+
predominant: Partial<TextFormatting>;
|
|
538
|
+
/** Is formatting consistent across selection */
|
|
539
|
+
isConsistent: boolean;
|
|
540
|
+
/** All formatting found */
|
|
541
|
+
allFormatting: Partial<TextFormatting>[];
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Build selection context for AI operations
|
|
545
|
+
*
|
|
546
|
+
* @param doc - The parsed document
|
|
547
|
+
* @param range - The selected range
|
|
548
|
+
* @param options - Selection context options
|
|
549
|
+
* @returns SelectionContext object
|
|
550
|
+
*/
|
|
551
|
+
declare function buildSelectionContext(doc: Document, range: Range, options?: SelectionContextOptions): SelectionContext;
|
|
552
|
+
/**
|
|
553
|
+
* Build extended selection context with additional details
|
|
554
|
+
*
|
|
555
|
+
* @param doc - The parsed document
|
|
556
|
+
* @param range - The selected range
|
|
557
|
+
* @param options - Selection context options
|
|
558
|
+
* @returns ExtendedSelectionContext object
|
|
559
|
+
*/
|
|
560
|
+
declare function buildExtendedSelectionContext(doc: Document, range: Range, options?: SelectionContextOptions): ExtendedSelectionContext;
|
|
561
|
+
/**
|
|
562
|
+
* Get formatting summary for a selection
|
|
563
|
+
*
|
|
564
|
+
* @param doc - The parsed document
|
|
565
|
+
* @param range - The selected range
|
|
566
|
+
* @returns FormattingSummary object
|
|
567
|
+
*/
|
|
568
|
+
declare function getSelectionFormattingSummary(doc: Document, range: Range): FormattingSummary;
|
|
569
|
+
|
|
570
|
+
export { type AgentContextOptions as A, DocumentAgent as D, type ExtendedSelectionContext as E, type FormattedTextSegment as F, type InsertHyperlinkOptions as I, type SelectionContextOptions$1 as S, type FormattingSummary as a, type InsertImageOptions as b, type InsertTableOptions as c, type InsertTextOptions as d, type SelectionContextOptions as e, buildExtendedSelectionContext as f, buildSelectionContext as g, buildSelectionContext$1 as h, createAgent as i, createAgentFromDocument as j, executeCommand as k, executeCommands as l, getAgentContext as m, getDocumentSummary as n, getSelectionFormattingSummary as o };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Document } from './types/document.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Selective Save Module
|
|
5
|
+
*
|
|
6
|
+
* Orchestrates selective XML patching for the save flow.
|
|
7
|
+
* Serializes full document.xml, validates patch safety, builds patched XML,
|
|
8
|
+
* and calls applyUpdatesToZip() to produce the final DOCX.
|
|
9
|
+
*
|
|
10
|
+
* Returns null on any failure, signaling the caller to fall back to full repack.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface SelectiveSaveOptions {
|
|
14
|
+
/** Changed paragraph IDs to selectively patch */
|
|
15
|
+
changedParaIds: Set<string>;
|
|
16
|
+
/** Whether structural changes occurred (paragraph add/delete) */
|
|
17
|
+
structuralChange: boolean;
|
|
18
|
+
/** Whether any changes affected paragraphs without paraId */
|
|
19
|
+
hasUntrackedChanges: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Attempt a selective save — patch only changed paragraphs in document.xml.
|
|
23
|
+
* Also updates comments, headers/footers, and core properties so that
|
|
24
|
+
* all document parts stay in sync even when only paragraphs are patched.
|
|
25
|
+
*
|
|
26
|
+
* Returns the saved ArrayBuffer, or null if selective save is not possible
|
|
27
|
+
* (caller should fall back to full repack).
|
|
28
|
+
*/
|
|
29
|
+
declare function attemptSelectiveSave(doc: Document, originalBuffer: ArrayBuffer, options: SelectiveSaveOptions): Promise<ArrayBuffer | null>;
|
|
30
|
+
|
|
31
|
+
export { type SelectiveSaveOptions as S, attemptSelectiveSave as a };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Document } from './types/document.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Selective Save Module
|
|
5
|
+
*
|
|
6
|
+
* Orchestrates selective XML patching for the save flow.
|
|
7
|
+
* Serializes full document.xml, validates patch safety, builds patched XML,
|
|
8
|
+
* and calls applyUpdatesToZip() to produce the final DOCX.
|
|
9
|
+
*
|
|
10
|
+
* Returns null on any failure, signaling the caller to fall back to full repack.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface SelectiveSaveOptions {
|
|
14
|
+
/** Changed paragraph IDs to selectively patch */
|
|
15
|
+
changedParaIds: Set<string>;
|
|
16
|
+
/** Whether structural changes occurred (paragraph add/delete) */
|
|
17
|
+
structuralChange: boolean;
|
|
18
|
+
/** Whether any changes affected paragraphs without paraId */
|
|
19
|
+
hasUntrackedChanges: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Attempt a selective save — patch only changed paragraphs in document.xml.
|
|
23
|
+
* Also updates comments, headers/footers, and core properties so that
|
|
24
|
+
* all document parts stay in sync even when only paragraphs are patched.
|
|
25
|
+
*
|
|
26
|
+
* Returns the saved ArrayBuffer, or null if selective save is not possible
|
|
27
|
+
* (caller should fall back to full repack).
|
|
28
|
+
*/
|
|
29
|
+
declare function attemptSelectiveSave(doc: Document, originalBuffer: ArrayBuffer, options: SelectiveSaveOptions): Promise<ArrayBuffer | null>;
|
|
30
|
+
|
|
31
|
+
export { type SelectiveSaveOptions as S, attemptSelectiveSave as a };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
interface PatchValidationResult {
|
|
2
|
+
safe: boolean;
|
|
3
|
+
reason?: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Validate that a selective patch can be safely applied.
|
|
7
|
+
*
|
|
8
|
+
* Checks:
|
|
9
|
+
* - All changed paraIds exist in original XML (exactly once)
|
|
10
|
+
* - All changed paraIds exist in serialized XML (exactly once)
|
|
11
|
+
* - Paragraph count matches between original and serialized
|
|
12
|
+
*/
|
|
13
|
+
declare function validatePatchSafety(originalXml: string, serializedXml: string, changedIds: Set<string>): PatchValidationResult;
|
|
14
|
+
/**
|
|
15
|
+
* Build a patched document.xml by splicing new paragraph XML into
|
|
16
|
+
* the original at the correct offsets. Only changed paragraphs
|
|
17
|
+
* are replaced; everything else is preserved byte-for-byte.
|
|
18
|
+
*
|
|
19
|
+
* Returns null if any step fails.
|
|
20
|
+
*/
|
|
21
|
+
declare function buildPatchedDocumentXml(originalXml: string, serializedXml: string, changedIds: Set<string>): string | null;
|
|
22
|
+
|
|
23
|
+
export { buildPatchedDocumentXml as b, validatePatchSafety as v };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
interface PatchValidationResult {
|
|
2
|
+
safe: boolean;
|
|
3
|
+
reason?: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Validate that a selective patch can be safely applied.
|
|
7
|
+
*
|
|
8
|
+
* Checks:
|
|
9
|
+
* - All changed paraIds exist in original XML (exactly once)
|
|
10
|
+
* - All changed paraIds exist in serialized XML (exactly once)
|
|
11
|
+
* - Paragraph count matches between original and serialized
|
|
12
|
+
*/
|
|
13
|
+
declare function validatePatchSafety(originalXml: string, serializedXml: string, changedIds: Set<string>): PatchValidationResult;
|
|
14
|
+
/**
|
|
15
|
+
* Build a patched document.xml by splicing new paragraph XML into
|
|
16
|
+
* the original at the correct offsets. Only changed paragraphs
|
|
17
|
+
* are replaced; everything else is preserved byte-for-byte.
|
|
18
|
+
*
|
|
19
|
+
* Returns null if any step fails.
|
|
20
|
+
*/
|
|
21
|
+
declare function buildPatchedDocumentXml(originalXml: string, serializedXml: string, changedIds: Set<string>): string | null;
|
|
22
|
+
|
|
23
|
+
export { buildPatchedDocumentXml as b, validatePatchSafety as v };
|