@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,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pointer Event Handler
|
|
3
|
+
*
|
|
4
|
+
* Centralized input handling for all pointer events.
|
|
5
|
+
* Provides single source of truth for click, drag, and focus management.
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
import { ClickPositionResolver } from './ClickPositionResolver.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Pointer Event Handler
|
|
13
|
+
*
|
|
14
|
+
* Centralized input handling for all pointer events.
|
|
15
|
+
* Provides single source of truth for click, drag, and focus management.
|
|
16
|
+
* @packageDocumentation
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Interface for the editor that the handler controls.
|
|
22
|
+
*/
|
|
23
|
+
interface EditorInterface {
|
|
24
|
+
/** Set selection to a position (collapsed) */
|
|
25
|
+
setSelection(pos: number): void;
|
|
26
|
+
/** Set selection range */
|
|
27
|
+
setSelectionRange(from: number, to: number): void;
|
|
28
|
+
/** Get current selection */
|
|
29
|
+
getSelection(): {
|
|
30
|
+
from: number;
|
|
31
|
+
to: number;
|
|
32
|
+
} | null;
|
|
33
|
+
/** Focus the editor */
|
|
34
|
+
focus(): void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Callback for input events.
|
|
38
|
+
*/
|
|
39
|
+
type InputEventCallback = (event: {
|
|
40
|
+
type: 'click' | 'doubleClick' | 'tripleClick' | 'dragStart' | 'drag' | 'dragEnd';
|
|
41
|
+
position?: number;
|
|
42
|
+
from?: number;
|
|
43
|
+
to?: number;
|
|
44
|
+
}) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Options for PointerEventHandler.
|
|
47
|
+
*/
|
|
48
|
+
interface PointerEventHandlerOptions {
|
|
49
|
+
/** The editor to control */
|
|
50
|
+
editor: EditorInterface;
|
|
51
|
+
/** Position resolver for click mapping */
|
|
52
|
+
positionResolver: ClickPositionResolver;
|
|
53
|
+
/** Callback for input events */
|
|
54
|
+
onInput?: InputEventCallback;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* PointerEventHandler handles all pointer input for the paged editor.
|
|
58
|
+
* It provides:
|
|
59
|
+
* - Single/double/triple click detection
|
|
60
|
+
* - Drag selection with anchor tracking
|
|
61
|
+
* - Coordinate normalization for zoom
|
|
62
|
+
* - Focus management
|
|
63
|
+
*/
|
|
64
|
+
declare class PointerEventHandler {
|
|
65
|
+
#private;
|
|
66
|
+
static readonly MULTI_CLICK_DELAY = 500;
|
|
67
|
+
constructor(options: PointerEventHandlerOptions);
|
|
68
|
+
/**
|
|
69
|
+
* Attach event listeners to a container element.
|
|
70
|
+
*/
|
|
71
|
+
attach(container: HTMLElement): void;
|
|
72
|
+
/**
|
|
73
|
+
* Detach event listeners from the container.
|
|
74
|
+
*/
|
|
75
|
+
detach(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Update the position resolver reference.
|
|
78
|
+
*/
|
|
79
|
+
setPositionResolver(positionResolver: ClickPositionResolver): void;
|
|
80
|
+
/**
|
|
81
|
+
* Get current drag state.
|
|
82
|
+
*/
|
|
83
|
+
isDragging(): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Get drag anchor position.
|
|
86
|
+
*/
|
|
87
|
+
getDragAnchor(): number | null;
|
|
88
|
+
/**
|
|
89
|
+
* Cancel any ongoing drag.
|
|
90
|
+
*/
|
|
91
|
+
cancelDrag(): void;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export { type EditorInterface, type InputEventCallback, PointerEventHandler, type PointerEventHandlerOptions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkWLKRUBY4_js=require('../../chunk-WLKRUBY4.js'),chunkDC7S76ZX_js=require('../../chunk-DC7S76ZX.js');var s,p,a,C,u,d,S,L,v,b,E,g,P,n,I,N,w,T,U,Y,_,f,k=class k{constructor(e){chunkDC7S76ZX_js.c(this,n);chunkDC7S76ZX_js.c(this,s);chunkDC7S76ZX_js.c(this,p);chunkDC7S76ZX_js.c(this,a,null);chunkDC7S76ZX_js.c(this,C);chunkDC7S76ZX_js.c(this,u,false);chunkDC7S76ZX_js.c(this,d,null);chunkDC7S76ZX_js.c(this,S,0);chunkDC7S76ZX_js.c(this,L,null);chunkDC7S76ZX_js.c(this,v,0);chunkDC7S76ZX_js.c(this,b);chunkDC7S76ZX_js.c(this,E);chunkDC7S76ZX_js.c(this,g);chunkDC7S76ZX_js.c(this,P);chunkDC7S76ZX_js.d(this,s,e.editor),chunkDC7S76ZX_js.d(this,p,e.positionResolver),chunkDC7S76ZX_js.d(this,C,e.onInput),chunkDC7S76ZX_js.d(this,b,chunkDC7S76ZX_js.e(this,n,N).bind(this)),chunkDC7S76ZX_js.d(this,E,chunkDC7S76ZX_js.e(this,n,w).bind(this)),chunkDC7S76ZX_js.d(this,g,chunkDC7S76ZX_js.e(this,n,T).bind(this)),chunkDC7S76ZX_js.d(this,P,chunkDC7S76ZX_js.e(this,n,U).bind(this));}attach(e){chunkDC7S76ZX_js.d(this,a,e),e.addEventListener("pointerdown",chunkDC7S76ZX_js.b(this,b)),e.addEventListener("pointermove",chunkDC7S76ZX_js.b(this,E)),e.addEventListener("pointerup",chunkDC7S76ZX_js.b(this,g)),e.addEventListener("pointerleave",chunkDC7S76ZX_js.b(this,P));}detach(){chunkDC7S76ZX_js.b(this,a)&&(chunkDC7S76ZX_js.b(this,a).removeEventListener("pointerdown",chunkDC7S76ZX_js.b(this,b)),chunkDC7S76ZX_js.b(this,a).removeEventListener("pointermove",chunkDC7S76ZX_js.b(this,E)),chunkDC7S76ZX_js.b(this,a).removeEventListener("pointerup",chunkDC7S76ZX_js.b(this,g)),chunkDC7S76ZX_js.b(this,a).removeEventListener("pointerleave",chunkDC7S76ZX_js.b(this,P)),chunkDC7S76ZX_js.d(this,a,null));}setPositionResolver(e){chunkDC7S76ZX_js.d(this,p,e);}isDragging(){return chunkDC7S76ZX_js.b(this,u)}getDragAnchor(){return chunkDC7S76ZX_js.b(this,d)}cancelDrag(){chunkDC7S76ZX_js.d(this,u,false),chunkDC7S76ZX_js.d(this,d,null);}};s=new WeakMap,p=new WeakMap,a=new WeakMap,C=new WeakMap,u=new WeakMap,d=new WeakMap,S=new WeakMap,L=new WeakMap,v=new WeakMap,b=new WeakMap,E=new WeakMap,g=new WeakMap,P=new WeakMap,n=new WeakSet,I=function(e,i){return chunkDC7S76ZX_js.b(this,p).getPositionAtPoint(e,i)?.pmPosition??null},N=function(e){if(e.button!==0)return;chunkDC7S76ZX_js.b(this,s).focus();let i=chunkDC7S76ZX_js.e(this,n,I).call(this,e.clientX,e.clientY);if(i===null)return;let h=Date.now();if(h-chunkDC7S76ZX_js.b(this,S)<k.MULTI_CLICK_DELAY&&chunkDC7S76ZX_js.b(this,L)===i?chunkDC7S76ZX_js.f(this,v)._++:chunkDC7S76ZX_js.d(this,v,1),chunkDC7S76ZX_js.d(this,S,h),chunkDC7S76ZX_js.d(this,L,i),chunkDC7S76ZX_js.b(this,v)===1){if(e.shiftKey){let m=chunkDC7S76ZX_js.b(this,s).getSelection();m?chunkDC7S76ZX_js.b(this,s).setSelectionRange(m.from,i):chunkDC7S76ZX_js.b(this,s).setSelection(i);}else chunkDC7S76ZX_js.b(this,s).setSelection(i);chunkDC7S76ZX_js.d(this,u,true),chunkDC7S76ZX_js.d(this,d,i),chunkDC7S76ZX_js.e(this,n,f).call(this,{type:"click",position:i}),chunkDC7S76ZX_js.e(this,n,f).call(this,{type:"dragStart",position:i});}else chunkDC7S76ZX_js.b(this,v)===2?(chunkDC7S76ZX_js.e(this,n,Y).call(this,i),chunkDC7S76ZX_js.e(this,n,f).call(this,{type:"doubleClick",position:i})):chunkDC7S76ZX_js.b(this,v)>=3&&(chunkDC7S76ZX_js.e(this,n,_).call(this,i),chunkDC7S76ZX_js.e(this,n,f).call(this,{type:"tripleClick",position:i}),chunkDC7S76ZX_js.d(this,v,0));},w=function(e){if(!chunkDC7S76ZX_js.b(this,u)||chunkDC7S76ZX_js.b(this,d)===null)return;let i=chunkDC7S76ZX_js.e(this,n,I).call(this,e.clientX,e.clientY);if(i===null)return;let h=Math.min(chunkDC7S76ZX_js.b(this,d),i),c=Math.max(chunkDC7S76ZX_js.b(this,d),i);chunkDC7S76ZX_js.b(this,s).setSelectionRange(h,c),chunkDC7S76ZX_js.e(this,n,f).call(this,{type:"drag",from:h,to:c});},T=function(e){if(chunkDC7S76ZX_js.b(this,u)){let i=chunkDC7S76ZX_js.b(this,s).getSelection();chunkDC7S76ZX_js.e(this,n,f).call(this,{type:"dragEnd",from:i?.from,to:i?.to});}chunkDC7S76ZX_js.d(this,u,false);},U=function(e){},Y=function(e){let i=chunkDC7S76ZX_js.b(this,p).getElementAtPosition(e);if(!i){chunkDC7S76ZX_js.b(this,s).setSelection(e);return}let h=i.textContent||"",c=Number(i.dataset.pmStart)||0,m=e-c,[H,K]=chunkWLKRUBY4_js.c(h,m),R=c+H,y=c+K;R<y?chunkDC7S76ZX_js.b(this,s).setSelectionRange(R,y):chunkDC7S76ZX_js.b(this,s).setSelection(e);},_=function(e){let i=chunkDC7S76ZX_js.b(this,p).getElementAtPosition(e);if(!i){chunkDC7S76ZX_js.b(this,s).setSelection(e);return}let h=i.closest(".layout-paragraph");if(!h){chunkDC7S76ZX_js.b(this,s).setSelection(e);return}let c=Number(h.dataset.pmStart),m=Number(h.dataset.pmEnd);!isNaN(c)&&!isNaN(m)&&c<m?chunkDC7S76ZX_js.b(this,s).setSelectionRange(c,m):chunkDC7S76ZX_js.b(this,s).setSelection(e);},f=function(e){var i;(i=chunkDC7S76ZX_js.b(this,C))==null||i.call(this,e);},chunkDC7S76ZX_js.a(k,"MULTI_CLICK_DELAY",500);var A=k;exports.PointerEventHandler=A;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {c as c$1}from'../../chunk-OBMN4VSM.mjs';import {a as a$1,c,d as d$1,e,b as b$1,f as f$1}from'../../chunk-QYUPLKLP.mjs';var s,p,a,C,u,d,S,L,v,b,E,g,P,n,I,N,w,T,U,Y,_,f,k=class k{constructor(e$1){c(this,n);c(this,s);c(this,p);c(this,a,null);c(this,C);c(this,u,false);c(this,d,null);c(this,S,0);c(this,L,null);c(this,v,0);c(this,b);c(this,E);c(this,g);c(this,P);d$1(this,s,e$1.editor),d$1(this,p,e$1.positionResolver),d$1(this,C,e$1.onInput),d$1(this,b,e(this,n,N).bind(this)),d$1(this,E,e(this,n,w).bind(this)),d$1(this,g,e(this,n,T).bind(this)),d$1(this,P,e(this,n,U).bind(this));}attach(e){d$1(this,a,e),e.addEventListener("pointerdown",b$1(this,b)),e.addEventListener("pointermove",b$1(this,E)),e.addEventListener("pointerup",b$1(this,g)),e.addEventListener("pointerleave",b$1(this,P));}detach(){b$1(this,a)&&(b$1(this,a).removeEventListener("pointerdown",b$1(this,b)),b$1(this,a).removeEventListener("pointermove",b$1(this,E)),b$1(this,a).removeEventListener("pointerup",b$1(this,g)),b$1(this,a).removeEventListener("pointerleave",b$1(this,P)),d$1(this,a,null));}setPositionResolver(e){d$1(this,p,e);}isDragging(){return b$1(this,u)}getDragAnchor(){return b$1(this,d)}cancelDrag(){d$1(this,u,false),d$1(this,d,null);}};s=new WeakMap,p=new WeakMap,a=new WeakMap,C=new WeakMap,u=new WeakMap,d=new WeakMap,S=new WeakMap,L=new WeakMap,v=new WeakMap,b=new WeakMap,E=new WeakMap,g=new WeakMap,P=new WeakMap,n=new WeakSet,I=function(e,i){return b$1(this,p).getPositionAtPoint(e,i)?.pmPosition??null},N=function(e$1){if(e$1.button!==0)return;b$1(this,s).focus();let i=e(this,n,I).call(this,e$1.clientX,e$1.clientY);if(i===null)return;let h=Date.now();if(h-b$1(this,S)<k.MULTI_CLICK_DELAY&&b$1(this,L)===i?f$1(this,v)._++:d$1(this,v,1),d$1(this,S,h),d$1(this,L,i),b$1(this,v)===1){if(e$1.shiftKey){let m=b$1(this,s).getSelection();m?b$1(this,s).setSelectionRange(m.from,i):b$1(this,s).setSelection(i);}else b$1(this,s).setSelection(i);d$1(this,u,true),d$1(this,d,i),e(this,n,f).call(this,{type:"click",position:i}),e(this,n,f).call(this,{type:"dragStart",position:i});}else b$1(this,v)===2?(e(this,n,Y).call(this,i),e(this,n,f).call(this,{type:"doubleClick",position:i})):b$1(this,v)>=3&&(e(this,n,_).call(this,i),e(this,n,f).call(this,{type:"tripleClick",position:i}),d$1(this,v,0));},w=function(e$1){if(!b$1(this,u)||b$1(this,d)===null)return;let i=e(this,n,I).call(this,e$1.clientX,e$1.clientY);if(i===null)return;let h=Math.min(b$1(this,d),i),c=Math.max(b$1(this,d),i);b$1(this,s).setSelectionRange(h,c),e(this,n,f).call(this,{type:"drag",from:h,to:c});},T=function(e$1){if(b$1(this,u)){let i=b$1(this,s).getSelection();e(this,n,f).call(this,{type:"dragEnd",from:i?.from,to:i?.to});}d$1(this,u,false);},U=function(e){},Y=function(e){let i=b$1(this,p).getElementAtPosition(e);if(!i){b$1(this,s).setSelection(e);return}let h=i.textContent||"",c=Number(i.dataset.pmStart)||0,m=e-c,[H,K]=c$1(h,m),R=c+H,y=c+K;R<y?b$1(this,s).setSelectionRange(R,y):b$1(this,s).setSelection(e);},_=function(e){let i=b$1(this,p).getElementAtPosition(e);if(!i){b$1(this,s).setSelection(e);return}let h=i.closest(".layout-paragraph");if(!h){b$1(this,s).setSelection(e);return}let c=Number(h.dataset.pmStart),m=Number(h.dataset.pmEnd);!isNaN(c)&&!isNaN(m)&&c<m?b$1(this,s).setSelectionRange(c,m):b$1(this,s).setSelection(e);},f=function(e){var i;(i=b$1(this,C))==null||i.call(this,e);},a$1(k,"MULTI_CLICK_DELAY",500);var A=k;export{A as PointerEventHandler};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Walk the PM doc once and derive (a) the tracked-change list and (b) a
|
|
3
|
+
* comment→revision overlap map for threading. Adjacent entries from the
|
|
4
|
+
* same revision are merged; deletion+insertion pairs from the same
|
|
5
|
+
* author/date become a single `replacement` entry (matches Word's UX
|
|
6
|
+
* for replace ops).
|
|
7
|
+
*
|
|
8
|
+
* Pure function — no React, no Vue, no side effects. Single O(N) walk
|
|
9
|
+
* over text nodes. Consumers building custom sidebars should prefer the
|
|
10
|
+
* adapter-specific wrappers (`useTrackedChanges` in
|
|
11
|
+
* `@zeke-02/docx-editor-react/hooks` and
|
|
12
|
+
* `@eigenpal/docx-editor-vue/composables`), which add the memoization
|
|
13
|
+
* and reactivity layer. Reach for the core function directly for
|
|
14
|
+
* server-side analysis or test fixtures.
|
|
15
|
+
*
|
|
16
|
+
* @packageDocumentation
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
import { EditorState } from 'prosemirror-state';
|
|
20
|
+
import { TrackedChangeEntry } from '../../utils/comments.mjs';
|
|
21
|
+
import '../../content-5Mrz6w_b.mjs';
|
|
22
|
+
import '../../formatting-BH4hcZiq.mjs';
|
|
23
|
+
import '../../colors-C3vA7HUU.mjs';
|
|
24
|
+
import '../../docx/wrapTypes.mjs';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Walk the PM doc once and derive (a) the tracked-change list and (b) a
|
|
28
|
+
* comment→revision overlap map for threading. Adjacent entries from the
|
|
29
|
+
* same revision are merged; deletion+insertion pairs from the same
|
|
30
|
+
* author/date become a single `replacement` entry (matches Word's UX
|
|
31
|
+
* for replace ops).
|
|
32
|
+
*
|
|
33
|
+
* Pure function — no React, no Vue, no side effects. Single O(N) walk
|
|
34
|
+
* over text nodes. Consumers building custom sidebars should prefer the
|
|
35
|
+
* adapter-specific wrappers (`useTrackedChanges` in
|
|
36
|
+
* `@zeke-02/docx-editor-react/hooks` and
|
|
37
|
+
* `@eigenpal/docx-editor-vue/composables`), which add the memoization
|
|
38
|
+
* and reactivity layer. Reach for the core function directly for
|
|
39
|
+
* server-side analysis or test fixtures.
|
|
40
|
+
*
|
|
41
|
+
* @packageDocumentation
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Output of {@link extractTrackedChanges}.
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
interface TrackedChangesResult {
|
|
51
|
+
/** Tracked-change entries, sorted by document position, with adjacent same-revision entries merged. */
|
|
52
|
+
entries: TrackedChangeEntry[];
|
|
53
|
+
/**
|
|
54
|
+
* Map of `commentId -> revisionId` for comments whose range overlaps a tracked-change mark.
|
|
55
|
+
* Consumers (DocxEditor's threading effect) use this to thread comments under their tracked change.
|
|
56
|
+
*/
|
|
57
|
+
commentToRevision: Map<number, number>;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Walk the PM doc and extract every tracked change as a flat list of
|
|
61
|
+
* `TrackedChangeEntry` plus a comment→revision overlap map. Adjacent
|
|
62
|
+
* inline marks coalesce by `(type, revisionId, author, date)`; a
|
|
63
|
+
* deletion immediately followed by an insertion (same author + same
|
|
64
|
+
* date) collapses into a single `replacement` entry; paragraph-mark
|
|
65
|
+
* cards (`paragraphMarkInsertion` / `paragraphMarkDeletion`) are
|
|
66
|
+
* hidden when an inline entry already covers their revision triple
|
|
67
|
+
* (one Accept clears every site of one conceptual change).
|
|
68
|
+
*
|
|
69
|
+
* Pure and deterministic. Returns `EMPTY_RESULT` on null state.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* import { extractTrackedChanges } from '@zeke-02/docx-editor-core/prosemirror/utils/extractTrackedChanges';
|
|
74
|
+
*
|
|
75
|
+
* const { entries, commentToRevision } = extractTrackedChanges(view.state);
|
|
76
|
+
* for (const e of entries) {
|
|
77
|
+
* console.log(e.type, e.author, e.text);
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
83
|
+
declare function extractTrackedChanges(state: EditorState | null): TrackedChangesResult;
|
|
84
|
+
|
|
85
|
+
export { type TrackedChangesResult, extractTrackedChanges };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Walk the PM doc once and derive (a) the tracked-change list and (b) a
|
|
3
|
+
* comment→revision overlap map for threading. Adjacent entries from the
|
|
4
|
+
* same revision are merged; deletion+insertion pairs from the same
|
|
5
|
+
* author/date become a single `replacement` entry (matches Word's UX
|
|
6
|
+
* for replace ops).
|
|
7
|
+
*
|
|
8
|
+
* Pure function — no React, no Vue, no side effects. Single O(N) walk
|
|
9
|
+
* over text nodes. Consumers building custom sidebars should prefer the
|
|
10
|
+
* adapter-specific wrappers (`useTrackedChanges` in
|
|
11
|
+
* `@zeke-02/docx-editor-react/hooks` and
|
|
12
|
+
* `@eigenpal/docx-editor-vue/composables`), which add the memoization
|
|
13
|
+
* and reactivity layer. Reach for the core function directly for
|
|
14
|
+
* server-side analysis or test fixtures.
|
|
15
|
+
*
|
|
16
|
+
* @packageDocumentation
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
import { EditorState } from 'prosemirror-state';
|
|
20
|
+
import { TrackedChangeEntry } from '../../utils/comments.js';
|
|
21
|
+
import '../../content-CmqAwdFL.js';
|
|
22
|
+
import '../../formatting-_OXU8gLB.js';
|
|
23
|
+
import '../../colors-C3vA7HUU.js';
|
|
24
|
+
import '../../docx/wrapTypes.js';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Walk the PM doc once and derive (a) the tracked-change list and (b) a
|
|
28
|
+
* comment→revision overlap map for threading. Adjacent entries from the
|
|
29
|
+
* same revision are merged; deletion+insertion pairs from the same
|
|
30
|
+
* author/date become a single `replacement` entry (matches Word's UX
|
|
31
|
+
* for replace ops).
|
|
32
|
+
*
|
|
33
|
+
* Pure function — no React, no Vue, no side effects. Single O(N) walk
|
|
34
|
+
* over text nodes. Consumers building custom sidebars should prefer the
|
|
35
|
+
* adapter-specific wrappers (`useTrackedChanges` in
|
|
36
|
+
* `@zeke-02/docx-editor-react/hooks` and
|
|
37
|
+
* `@eigenpal/docx-editor-vue/composables`), which add the memoization
|
|
38
|
+
* and reactivity layer. Reach for the core function directly for
|
|
39
|
+
* server-side analysis or test fixtures.
|
|
40
|
+
*
|
|
41
|
+
* @packageDocumentation
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Output of {@link extractTrackedChanges}.
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
interface TrackedChangesResult {
|
|
51
|
+
/** Tracked-change entries, sorted by document position, with adjacent same-revision entries merged. */
|
|
52
|
+
entries: TrackedChangeEntry[];
|
|
53
|
+
/**
|
|
54
|
+
* Map of `commentId -> revisionId` for comments whose range overlaps a tracked-change mark.
|
|
55
|
+
* Consumers (DocxEditor's threading effect) use this to thread comments under their tracked change.
|
|
56
|
+
*/
|
|
57
|
+
commentToRevision: Map<number, number>;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Walk the PM doc and extract every tracked change as a flat list of
|
|
61
|
+
* `TrackedChangeEntry` plus a comment→revision overlap map. Adjacent
|
|
62
|
+
* inline marks coalesce by `(type, revisionId, author, date)`; a
|
|
63
|
+
* deletion immediately followed by an insertion (same author + same
|
|
64
|
+
* date) collapses into a single `replacement` entry; paragraph-mark
|
|
65
|
+
* cards (`paragraphMarkInsertion` / `paragraphMarkDeletion`) are
|
|
66
|
+
* hidden when an inline entry already covers their revision triple
|
|
67
|
+
* (one Accept clears every site of one conceptual change).
|
|
68
|
+
*
|
|
69
|
+
* Pure and deterministic. Returns `EMPTY_RESULT` on null state.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* import { extractTrackedChanges } from '@zeke-02/docx-editor-core/prosemirror/utils/extractTrackedChanges';
|
|
74
|
+
*
|
|
75
|
+
* const { entries, commentToRevision } = extractTrackedChanges(view.state);
|
|
76
|
+
* for (const e of entries) {
|
|
77
|
+
* console.log(e.type, e.author, e.text);
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
83
|
+
declare function extractTrackedChanges(state: EditorState | null): TrackedChangesResult;
|
|
84
|
+
|
|
85
|
+
export { type TrackedChangesResult, extractTrackedChanges };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';require('../../chunk-DC7S76ZX.js');var z={entries:[],commentToRevision:new Map};function U(M){if(!M)return z;let{doc:A,schema:I}=M,v=I.marks.insertion,m=I.marks.deletion,P=I.marks.comment;if(!v&&!m)return z;let a=[],b=new Map;A.descendants((e,t)=>{if(e.type.name==="paragraph"){let n=e.attrs.pPrIns,i=e.attrs.pPrDel;n&&a.push({type:"paragraphMarkInsertion",text:e.textContent||"",author:n.author||"",date:n.date??void 0,from:t,to:t+e.nodeSize,revisionId:n.revisionId}),i&&a.push({type:"paragraphMarkDeletion",text:e.textContent||"",author:i.author||"",date:i.date??void 0,from:t,to:t+e.nodeSize,revisionId:i.revisionId});let s=e.attrs.pPrChange;if(Array.isArray(s))for(let o of s)a.push({type:"paragraphPropertiesChanged",text:e.textContent||"",author:o.info.author||"",date:o.info.date??void 0,from:t,to:t+e.nodeSize,revisionId:o.info.id});}if(e.type.name==="tableRow"){let n=e.attrs.trIns,i=e.attrs.trDel;n&&a.push({type:"rowInserted",text:e.textContent||"",author:n.author||"",date:n.date??void 0,from:t,to:t+e.nodeSize,revisionId:n.revisionId}),i&&a.push({type:"rowDeleted",text:e.textContent||"",author:i.author||"",date:i.date??void 0,from:t,to:t+e.nodeSize,revisionId:i.revisionId});let s=e.attrs.trPrChange;if(Array.isArray(s))for(let o of s)!o?.info||typeof o.info.id!="number"||a.push({type:"rowPropertiesChanged",text:e.textContent||"",author:o.info.author||"",date:o.info.date??void 0,from:t,to:t+e.nodeSize,revisionId:o.info.id});}if(e.type.name==="tableCell"||e.type.name==="tableHeader"){let n=e.attrs.cellMarker;if(n?.info&&typeof n.info.revisionId=="number"){let o={ins:"cellInserted",del:"cellDeleted",merge:"cellMerged"}[n.kind];o&&a.push({type:o,text:e.textContent||"",author:n.info.author||"",date:n.info.date??void 0,from:t,to:t+e.nodeSize,revisionId:n.info.revisionId});}let i=e.attrs.tcPrChange;if(Array.isArray(i))for(let s of i)!s?.info||typeof s.info.id!="number"||a.push({type:"cellPropertiesChanged",text:e.textContent||"",author:s.info.author||"",date:s.info.date??void 0,from:t,to:t+e.nodeSize,revisionId:s.info.id});}if(e.type.name==="table"){let n=e.attrs.tblPrChange;if(Array.isArray(n))for(let d of n)!d?.info||typeof d.info.id!="number"||a.push({type:"tablePropertiesChanged",text:"",author:d.info.author||"",date:d.info.date??void 0,from:t,to:t+e.nodeSize,revisionId:d.info.id});let i=e.firstChild,s=i?.attrs.trIns,o=i?.attrs.trDel,C=s?"trIns":o?"trDel":null;if(C){let d=s??o,T=true,x=[];if(e.forEach(f=>{if(f.type.name!=="tableRow"){T=false;return}let l=f.attrs[C];if(!l||(l.author??"")!==(d.author??"")||(l.date??null)!==(d.date??null)){T=false;return}x.push(l.revisionId);}),T){let f="";m?e.descendants(h=>{h.isText&&!h.marks.some(R=>R.type===m)&&(f+=h.text||"");}):f=e.textContent||"";let l=d.revisionId,$=x.filter((h,R)=>h!==l&&x.indexOf(h)===R);a.push({type:C==="trIns"?"tableInserted":"tableDeleted",text:f,author:d.author||"",date:d.date??void 0,from:t,to:t+e.nodeSize,revisionId:l,...$.length>0?{coalescedRevisionIds:$}:{}});}}}if(!e.isText)return;let r=null;for(let n of e.marks)(n.type===v||n.type===m)&&(a.push({type:n.type===v?"insertion":"deletion",text:e.text||"",author:n.attrs.author||"",date:n.attrs.date,from:t,to:t+e.nodeSize,revisionId:n.attrs.revisionId}),r=n);if(P&&r){let n=e.marks.find(i=>i.type===P);if(n){let i=n.attrs.commentId,s=r.attrs.revisionId;b.has(i)||b.set(i,s);}}});let k={tableInserted:6,tableDeleted:6,tablePropertiesChanged:5,rowInserted:4,rowDeleted:4,rowPropertiesChanged:4,cellInserted:3,cellDeleted:3,cellMerged:3,cellPropertiesChanged:3,paragraphMarkInsertion:2,paragraphMarkDeletion:2,paragraphPropertiesChanged:2},B=e=>e in k,S=new Map,c=[],w=(e,t)=>{let r=new Set(e.coalescedRevisionIds??[]);for(let n of t.coalescedRevisionIds??[])r.add(n);return r.add(t.revisionId),r.delete(e.revisionId),[...r]};for(let e of a){if(!B(e.type)){c.push(e);continue}let t=`${e.author}|${e.date??""}`,r=S.get(t);if(r===void 0){S.set(t,c.push(e)-1);continue}let n=c[r],i=k[e.type]??0,s=k[n.type]??0;i>s?c[r]={...e,coalescedRevisionIds:w(e,n)}:c[r]={...n,coalescedRevisionIds:w(n,e)};}let D=new Map,p=[];for(let e of c){if(!(e.type==="insertion"||e.type==="deletion")){p.push({...e});continue}let r=`${e.type}|${e.author}|${e.date??""}`,n=D.get(r);if(n){let i=n.to===e.from?"":" ";if(n.text+=i+e.text,n.to=e.to,e.revisionId!==n.revisionId){let s=new Set(n.coalescedRevisionIds??[]);for(let o of e.coalescedRevisionIds??[])s.add(o);s.add(e.revisionId),s.delete(n.revisionId),n.coalescedRevisionIds=s.size>0?[...s]:void 0;}}else {let i={...e};D.set(r,i),p.push(i);}}let u=[];for(let e=0;e<p.length;e++){let t=p[e],r=p[e+1];t.type==="deletion"&&r&&r.type==="insertion"&&t.author===r.author&&t.date===r.date&&t.to===r.from?(u.push({type:"replacement",text:r.text,deletedText:t.text,author:t.author,date:t.date,from:t.from,to:r.to,revisionId:t.revisionId,insertionRevisionId:r.revisionId}),e++):u.push(t);}let g=new Map;for(let e of u)if(e.type==="insertion"||e.type==="deletion"||e.type==="replacement"){let t=`${e.author}|${e.date??""}`;g.has(t)||g.set(t,e);}for(let e of u){if(e.type!=="paragraphMarkInsertion"&&e.type!=="paragraphMarkDeletion")continue;let t=g.get(`${e.author}|${e.date??""}`);if(!t)continue;let r=new Set(t.coalescedRevisionIds??[]);for(let n of e.coalescedRevisionIds??[])r.add(n);r.add(e.revisionId),r.delete(t.revisionId),t.type==="replacement"&&t.insertionRevisionId!=null&&r.delete(t.insertionRevisionId),t.coalescedRevisionIds=r.size>0?[...r]:void 0;}let E=new Set,y=new Map;for(let e of u){if(e.type!=="tableInserted"&&e.type!=="tableDeleted")continue;let t=`${e.author}|${e.date??""}`;e.text.trim().length>0||(E.add(e),y.has(t)||y.set(t,e));}for(let e of u){if(e.type!=="paragraphMarkInsertion"&&e.type!=="paragraphMarkDeletion")continue;let t=y.get(`${e.author}|${e.date??""}`);if(!t)continue;let r=new Set(t.coalescedRevisionIds??[]);for(let n of e.coalescedRevisionIds??[])r.add(n);r.add(e.revisionId),r.delete(t.revisionId),t.coalescedRevisionIds=r.size>0?[...r]:void 0;}return {entries:u.filter(e=>{let t=`${e.author}|${e.date??""}`;return e.type==="tableInserted"||e.type==="tableDeleted"?E.has(e):e.type==="paragraphMarkInsertion"||e.type==="paragraphMarkDeletion"?!g.has(t)&&!y.has(t):e.type==="insertion"||e.type==="deletion"||e.type==="replacement"?!y.has(t):true}),commentToRevision:b}}exports.extractTrackedChanges=U;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import'../../chunk-QYUPLKLP.mjs';var z={entries:[],commentToRevision:new Map};function U(M){if(!M)return z;let{doc:A,schema:I}=M,v=I.marks.insertion,m=I.marks.deletion,P=I.marks.comment;if(!v&&!m)return z;let a=[],b=new Map;A.descendants((e,t)=>{if(e.type.name==="paragraph"){let n=e.attrs.pPrIns,i=e.attrs.pPrDel;n&&a.push({type:"paragraphMarkInsertion",text:e.textContent||"",author:n.author||"",date:n.date??void 0,from:t,to:t+e.nodeSize,revisionId:n.revisionId}),i&&a.push({type:"paragraphMarkDeletion",text:e.textContent||"",author:i.author||"",date:i.date??void 0,from:t,to:t+e.nodeSize,revisionId:i.revisionId});let s=e.attrs.pPrChange;if(Array.isArray(s))for(let o of s)a.push({type:"paragraphPropertiesChanged",text:e.textContent||"",author:o.info.author||"",date:o.info.date??void 0,from:t,to:t+e.nodeSize,revisionId:o.info.id});}if(e.type.name==="tableRow"){let n=e.attrs.trIns,i=e.attrs.trDel;n&&a.push({type:"rowInserted",text:e.textContent||"",author:n.author||"",date:n.date??void 0,from:t,to:t+e.nodeSize,revisionId:n.revisionId}),i&&a.push({type:"rowDeleted",text:e.textContent||"",author:i.author||"",date:i.date??void 0,from:t,to:t+e.nodeSize,revisionId:i.revisionId});let s=e.attrs.trPrChange;if(Array.isArray(s))for(let o of s)!o?.info||typeof o.info.id!="number"||a.push({type:"rowPropertiesChanged",text:e.textContent||"",author:o.info.author||"",date:o.info.date??void 0,from:t,to:t+e.nodeSize,revisionId:o.info.id});}if(e.type.name==="tableCell"||e.type.name==="tableHeader"){let n=e.attrs.cellMarker;if(n?.info&&typeof n.info.revisionId=="number"){let o={ins:"cellInserted",del:"cellDeleted",merge:"cellMerged"}[n.kind];o&&a.push({type:o,text:e.textContent||"",author:n.info.author||"",date:n.info.date??void 0,from:t,to:t+e.nodeSize,revisionId:n.info.revisionId});}let i=e.attrs.tcPrChange;if(Array.isArray(i))for(let s of i)!s?.info||typeof s.info.id!="number"||a.push({type:"cellPropertiesChanged",text:e.textContent||"",author:s.info.author||"",date:s.info.date??void 0,from:t,to:t+e.nodeSize,revisionId:s.info.id});}if(e.type.name==="table"){let n=e.attrs.tblPrChange;if(Array.isArray(n))for(let d of n)!d?.info||typeof d.info.id!="number"||a.push({type:"tablePropertiesChanged",text:"",author:d.info.author||"",date:d.info.date??void 0,from:t,to:t+e.nodeSize,revisionId:d.info.id});let i=e.firstChild,s=i?.attrs.trIns,o=i?.attrs.trDel,C=s?"trIns":o?"trDel":null;if(C){let d=s??o,T=true,x=[];if(e.forEach(f=>{if(f.type.name!=="tableRow"){T=false;return}let l=f.attrs[C];if(!l||(l.author??"")!==(d.author??"")||(l.date??null)!==(d.date??null)){T=false;return}x.push(l.revisionId);}),T){let f="";m?e.descendants(h=>{h.isText&&!h.marks.some(R=>R.type===m)&&(f+=h.text||"");}):f=e.textContent||"";let l=d.revisionId,$=x.filter((h,R)=>h!==l&&x.indexOf(h)===R);a.push({type:C==="trIns"?"tableInserted":"tableDeleted",text:f,author:d.author||"",date:d.date??void 0,from:t,to:t+e.nodeSize,revisionId:l,...$.length>0?{coalescedRevisionIds:$}:{}});}}}if(!e.isText)return;let r=null;for(let n of e.marks)(n.type===v||n.type===m)&&(a.push({type:n.type===v?"insertion":"deletion",text:e.text||"",author:n.attrs.author||"",date:n.attrs.date,from:t,to:t+e.nodeSize,revisionId:n.attrs.revisionId}),r=n);if(P&&r){let n=e.marks.find(i=>i.type===P);if(n){let i=n.attrs.commentId,s=r.attrs.revisionId;b.has(i)||b.set(i,s);}}});let k={tableInserted:6,tableDeleted:6,tablePropertiesChanged:5,rowInserted:4,rowDeleted:4,rowPropertiesChanged:4,cellInserted:3,cellDeleted:3,cellMerged:3,cellPropertiesChanged:3,paragraphMarkInsertion:2,paragraphMarkDeletion:2,paragraphPropertiesChanged:2},B=e=>e in k,S=new Map,c=[],w=(e,t)=>{let r=new Set(e.coalescedRevisionIds??[]);for(let n of t.coalescedRevisionIds??[])r.add(n);return r.add(t.revisionId),r.delete(e.revisionId),[...r]};for(let e of a){if(!B(e.type)){c.push(e);continue}let t=`${e.author}|${e.date??""}`,r=S.get(t);if(r===void 0){S.set(t,c.push(e)-1);continue}let n=c[r],i=k[e.type]??0,s=k[n.type]??0;i>s?c[r]={...e,coalescedRevisionIds:w(e,n)}:c[r]={...n,coalescedRevisionIds:w(n,e)};}let D=new Map,p=[];for(let e of c){if(!(e.type==="insertion"||e.type==="deletion")){p.push({...e});continue}let r=`${e.type}|${e.author}|${e.date??""}`,n=D.get(r);if(n){let i=n.to===e.from?"":" ";if(n.text+=i+e.text,n.to=e.to,e.revisionId!==n.revisionId){let s=new Set(n.coalescedRevisionIds??[]);for(let o of e.coalescedRevisionIds??[])s.add(o);s.add(e.revisionId),s.delete(n.revisionId),n.coalescedRevisionIds=s.size>0?[...s]:void 0;}}else {let i={...e};D.set(r,i),p.push(i);}}let u=[];for(let e=0;e<p.length;e++){let t=p[e],r=p[e+1];t.type==="deletion"&&r&&r.type==="insertion"&&t.author===r.author&&t.date===r.date&&t.to===r.from?(u.push({type:"replacement",text:r.text,deletedText:t.text,author:t.author,date:t.date,from:t.from,to:r.to,revisionId:t.revisionId,insertionRevisionId:r.revisionId}),e++):u.push(t);}let g=new Map;for(let e of u)if(e.type==="insertion"||e.type==="deletion"||e.type==="replacement"){let t=`${e.author}|${e.date??""}`;g.has(t)||g.set(t,e);}for(let e of u){if(e.type!=="paragraphMarkInsertion"&&e.type!=="paragraphMarkDeletion")continue;let t=g.get(`${e.author}|${e.date??""}`);if(!t)continue;let r=new Set(t.coalescedRevisionIds??[]);for(let n of e.coalescedRevisionIds??[])r.add(n);r.add(e.revisionId),r.delete(t.revisionId),t.type==="replacement"&&t.insertionRevisionId!=null&&r.delete(t.insertionRevisionId),t.coalescedRevisionIds=r.size>0?[...r]:void 0;}let E=new Set,y=new Map;for(let e of u){if(e.type!=="tableInserted"&&e.type!=="tableDeleted")continue;let t=`${e.author}|${e.date??""}`;e.text.trim().length>0||(E.add(e),y.has(t)||y.set(t,e));}for(let e of u){if(e.type!=="paragraphMarkInsertion"&&e.type!=="paragraphMarkDeletion")continue;let t=y.get(`${e.author}|${e.date??""}`);if(!t)continue;let r=new Set(t.coalescedRevisionIds??[]);for(let n of e.coalescedRevisionIds??[])r.add(n);r.add(e.revisionId),r.delete(t.revisionId),t.coalescedRevisionIds=r.size>0?[...r]:void 0;}return {entries:u.filter(e=>{let t=`${e.author}|${e.date??""}`;return e.type==="tableInserted"||e.type==="tableDeleted"?E.has(e):e.type==="paragraphMarkInsertion"||e.type==="paragraphMarkDeletion"?!g.has(t)&&!y.has(t):e.type==="insertion"||e.type==="deletion"||e.type==="replacement"?!y.has(t):true}),commentToRevision:b}}export{U as extractTrackedChanges};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visual line navigation helpers — implements Word/Google-Docs-style
|
|
3
|
+
* ArrowUp / ArrowDown with sticky X across visual lines (not just
|
|
4
|
+
* paragraphs). Lifted from packages/react/src/paged-editor/
|
|
5
|
+
* useVisualLineNavigation.ts so both adapters share the algorithm.
|
|
6
|
+
*
|
|
7
|
+
* Frontend-agnostic: takes a `getContainer: () => HTMLElement | null`
|
|
8
|
+
* callback and a mutable sticky-state object, returns the same
|
|
9
|
+
* function quartet React's hook returns.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* Tagged `@internal` post-1.0 cut. Both adapters re-export this through
|
|
13
|
+
* their own composables (`useVisualLineNavigation`); consumers should
|
|
14
|
+
* prefer those. The subpath stays in `package.json` `exports` for
|
|
15
|
+
* back-compat; expect it to move behind a public surface in a future
|
|
16
|
+
* major.
|
|
17
|
+
*
|
|
18
|
+
* @packageDocumentation
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
import { EditorView } from 'prosemirror-view';
|
|
22
|
+
|
|
23
|
+
/** @internal */
|
|
24
|
+
interface VisualLineState {
|
|
25
|
+
stickyX: number | null;
|
|
26
|
+
lastVisualLineIndex: number;
|
|
27
|
+
}
|
|
28
|
+
/** @internal */
|
|
29
|
+
declare function createVisualLineState(): VisualLineState;
|
|
30
|
+
/** @internal */
|
|
31
|
+
declare function getCaretClientX(container: HTMLElement, pmPos: number): number | null;
|
|
32
|
+
/** @internal */
|
|
33
|
+
declare function findLineElementAtPosition(container: HTMLElement, pmPos: number): HTMLElement | null;
|
|
34
|
+
/** @internal */
|
|
35
|
+
declare function findPositionOnLineAtClientX(lineEl: HTMLElement, clientX: number): number | null;
|
|
36
|
+
/**
|
|
37
|
+
* Handle PM ArrowUp / ArrowDown with visual-line awareness + sticky
|
|
38
|
+
* X. Returns true if the event was handled and PM should not run
|
|
39
|
+
* its default behaviour. Mutates `state` so consecutive presses
|
|
40
|
+
* keep the same sticky X.
|
|
41
|
+
*/
|
|
42
|
+
/** @internal */
|
|
43
|
+
declare function handleVisualLineKeyDown(state: VisualLineState, view: EditorView, event: KeyboardEvent, container: HTMLElement | null): boolean;
|
|
44
|
+
|
|
45
|
+
export { type VisualLineState, createVisualLineState, findLineElementAtPosition, findPositionOnLineAtClientX, getCaretClientX, handleVisualLineKeyDown };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visual line navigation helpers — implements Word/Google-Docs-style
|
|
3
|
+
* ArrowUp / ArrowDown with sticky X across visual lines (not just
|
|
4
|
+
* paragraphs). Lifted from packages/react/src/paged-editor/
|
|
5
|
+
* useVisualLineNavigation.ts so both adapters share the algorithm.
|
|
6
|
+
*
|
|
7
|
+
* Frontend-agnostic: takes a `getContainer: () => HTMLElement | null`
|
|
8
|
+
* callback and a mutable sticky-state object, returns the same
|
|
9
|
+
* function quartet React's hook returns.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* Tagged `@internal` post-1.0 cut. Both adapters re-export this through
|
|
13
|
+
* their own composables (`useVisualLineNavigation`); consumers should
|
|
14
|
+
* prefer those. The subpath stays in `package.json` `exports` for
|
|
15
|
+
* back-compat; expect it to move behind a public surface in a future
|
|
16
|
+
* major.
|
|
17
|
+
*
|
|
18
|
+
* @packageDocumentation
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
import { EditorView } from 'prosemirror-view';
|
|
22
|
+
|
|
23
|
+
/** @internal */
|
|
24
|
+
interface VisualLineState {
|
|
25
|
+
stickyX: number | null;
|
|
26
|
+
lastVisualLineIndex: number;
|
|
27
|
+
}
|
|
28
|
+
/** @internal */
|
|
29
|
+
declare function createVisualLineState(): VisualLineState;
|
|
30
|
+
/** @internal */
|
|
31
|
+
declare function getCaretClientX(container: HTMLElement, pmPos: number): number | null;
|
|
32
|
+
/** @internal */
|
|
33
|
+
declare function findLineElementAtPosition(container: HTMLElement, pmPos: number): HTMLElement | null;
|
|
34
|
+
/** @internal */
|
|
35
|
+
declare function findPositionOnLineAtClientX(lineEl: HTMLElement, clientX: number): number | null;
|
|
36
|
+
/**
|
|
37
|
+
* Handle PM ArrowUp / ArrowDown with visual-line awareness + sticky
|
|
38
|
+
* X. Returns true if the event was handled and PM should not run
|
|
39
|
+
* its default behaviour. Mutates `state` so consecutive presses
|
|
40
|
+
* keep the same sticky X.
|
|
41
|
+
*/
|
|
42
|
+
/** @internal */
|
|
43
|
+
declare function handleVisualLineKeyDown(state: VisualLineState, view: EditorView, event: KeyboardEvent, container: HTMLElement | null): boolean;
|
|
44
|
+
|
|
45
|
+
export { type VisualLineState, createVisualLineState, findLineElementAtPosition, findPositionOnLineAtClientX, getCaretClientX, handleVisualLineKeyDown };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkJY5EFI4D_js=require('../../chunk-JY5EFI4D.js');require('../../chunk-DC7S76ZX.js');var prosemirrorState=require('prosemirror-state');var S=".layout-page-content .layout-line";function C(){return {stickyX:null,lastVisualLineIndex:-1}}function T(o){let t=chunkJY5EFI4D_js.a(o);if(!t)return;let n=o.getBoundingClientRect(),l=t.getBoundingClientRect(),e=40;n.bottom>l.bottom-e?t.scrollTop+=n.bottom-l.bottom+e:n.top<l.top+e&&(t.scrollTop-=l.top-n.top+e);}function x(o,t){let n=o.querySelectorAll("span[data-pm-start][data-pm-end]");for(let e of Array.from(n)){let i=e,c=Number(i.dataset.pmStart),r=Number(i.dataset.pmEnd);if(i.classList.contains("layout-run-tab")){if(t>=c&&t<r)return i.getBoundingClientRect().left;continue}if(t>=c&&t<=r&&e.firstChild?.nodeType===Node.TEXT_NODE){let a=e.firstChild,u=Math.min(t-c,a.length),p=i.ownerDocument;if(!p)continue;let f=p.createRange();return f.setStart(a,u),f.setEnd(a,u),f.getBoundingClientRect().left}}let l=o.querySelectorAll(".layout-empty-run");for(let e of Array.from(l)){let i=e.closest(".layout-paragraph");if(!i)continue;let c=Number(i.dataset.pmStart),r=Number(i.dataset.pmEnd);if(t>=c&&t<=r)return e.getBoundingClientRect().left}return null}function M(o,t){let n=o.querySelectorAll(S);for(let l of Array.from(n)){let e=l,i=e.querySelectorAll("span[data-pm-start][data-pm-end]");for(let c of Array.from(i)){let r=c,a=Number(r.dataset.pmStart),u=Number(r.dataset.pmEnd);if(t>=a&&t<=u)return e}}for(let l of Array.from(n)){let e=l,i=e.closest(".layout-paragraph");if(!i)continue;let c=Number(i.dataset.pmStart),r=Number(i.dataset.pmEnd);if(t>=c&&t<=r&&i.querySelector(".layout-line")===e)return e}return null}function N(o,t){let n=o.querySelectorAll("span[data-pm-start][data-pm-end]");if(n.length===0){let c=o.closest(".layout-paragraph");return c?.dataset.pmStart?Number(c.dataset.pmStart)+1:null}for(let c of Array.from(n)){let r=c,a=r.getBoundingClientRect(),u=Number(r.dataset.pmStart),p=Number(r.dataset.pmEnd);if(r.classList.contains("layout-run-tab")){if(t>=a.left&&t<=a.right){let f=(a.left+a.right)/2;return t<f?u:p}continue}if(t>=a.left&&t<=a.right){let f=r.firstChild;if(!f||f.nodeType!==Node.TEXT_NODE)return u;let m=f,g=r.ownerDocument;if(!g)return u;let s=0,y=m.length;for(;s<y;){let d=Math.floor((s+y)/2),E=g.createRange();E.setStart(m,d),E.setEnd(m,d),t<E.getBoundingClientRect().left?y=d:s=d+1;}if(s>0&&s<=m.length){let d=g.createRange();d.setStart(m,s-1),d.setEnd(m,s-1);let E=d.getBoundingClientRect().left;d.setStart(m,Math.min(s,m.length)),d.setEnd(m,Math.min(s,m.length));let b=d.getBoundingClientRect().left;if(Math.abs(t-E)<Math.abs(t-b))return u+(s-1)}return u+Math.min(s,p-u)}}let l=null,e=1/0;for(let c of Array.from(n)){let r=c,a=r.getBoundingClientRect(),u=t<a.left?a.left-t:t-a.right;u<e&&(e=u,l=r);}if(!l)return null;let i=l.getBoundingClientRect();return t<i.left?Number(l.dataset.pmStart):Number(l.dataset.pmEnd)}function w(o,t,n,l){if(n.key!=="ArrowUp"&&n.key!=="ArrowDown")return (["ArrowLeft","ArrowRight","Home","End"].includes(n.key)||n.key.length===1&&!n.ctrlKey&&!n.metaKey)&&(o.stickyX=null,o.lastVisualLineIndex=-1),false;if(n.ctrlKey||n.metaKey)return o.stickyX=null,o.lastVisualLineIndex=-1,false;if(!l)return false;let e=Array.from(l.querySelectorAll(S));if(e.length===0)return false;let{from:i,anchor:c}=t.state.selection;if(o.stickyX===null){let s=x(l,i);if(s===null)return false;o.stickyX=s;}let r;if(o.lastVisualLineIndex>=0&&o.lastVisualLineIndex<e.length)r=o.lastVisualLineIndex;else {let s=M(l,i);if(!s||(r=e.indexOf(s),r===-1))return false}let a=n.key==="ArrowUp"?r-1:r+1;if(a<0||a>=e.length)return o.lastVisualLineIndex=-1,false;let u=e[a],p=N(u,o.stickyX);if(p===null)return false;o.lastVisualLineIndex=a;let{state:f,dispatch:m}=t,g=Math.max(0,Math.min(p,f.doc.content.size));try{let s=n.shiftKey?prosemirrorState.TextSelection.create(f.doc,c,g):prosemirrorState.TextSelection.create(f.doc,g);m(f.tr.setSelection(s));}catch{let s=f.doc.resolve(g),y=n.shiftKey?prosemirrorState.TextSelection.between(f.doc.resolve(c),s):prosemirrorState.TextSelection.near(s);m(f.tr.setSelection(y));}return T(u),true}exports.createVisualLineState=C;exports.findLineElementAtPosition=M;exports.findPositionOnLineAtClientX=N;exports.getCaretClientX=x;exports.handleVisualLineKeyDown=w;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'../../chunk-RPIQG46O.mjs';import'../../chunk-QYUPLKLP.mjs';import {TextSelection}from'prosemirror-state';var S=".layout-page-content .layout-line";function C(){return {stickyX:null,lastVisualLineIndex:-1}}function T(o){let t=a(o);if(!t)return;let n=o.getBoundingClientRect(),l=t.getBoundingClientRect(),e=40;n.bottom>l.bottom-e?t.scrollTop+=n.bottom-l.bottom+e:n.top<l.top+e&&(t.scrollTop-=l.top-n.top+e);}function x(o,t){let n=o.querySelectorAll("span[data-pm-start][data-pm-end]");for(let e of Array.from(n)){let i=e,c=Number(i.dataset.pmStart),r=Number(i.dataset.pmEnd);if(i.classList.contains("layout-run-tab")){if(t>=c&&t<r)return i.getBoundingClientRect().left;continue}if(t>=c&&t<=r&&e.firstChild?.nodeType===Node.TEXT_NODE){let a=e.firstChild,u=Math.min(t-c,a.length),p=i.ownerDocument;if(!p)continue;let f=p.createRange();return f.setStart(a,u),f.setEnd(a,u),f.getBoundingClientRect().left}}let l=o.querySelectorAll(".layout-empty-run");for(let e of Array.from(l)){let i=e.closest(".layout-paragraph");if(!i)continue;let c=Number(i.dataset.pmStart),r=Number(i.dataset.pmEnd);if(t>=c&&t<=r)return e.getBoundingClientRect().left}return null}function M(o,t){let n=o.querySelectorAll(S);for(let l of Array.from(n)){let e=l,i=e.querySelectorAll("span[data-pm-start][data-pm-end]");for(let c of Array.from(i)){let r=c,a=Number(r.dataset.pmStart),u=Number(r.dataset.pmEnd);if(t>=a&&t<=u)return e}}for(let l of Array.from(n)){let e=l,i=e.closest(".layout-paragraph");if(!i)continue;let c=Number(i.dataset.pmStart),r=Number(i.dataset.pmEnd);if(t>=c&&t<=r&&i.querySelector(".layout-line")===e)return e}return null}function N(o,t){let n=o.querySelectorAll("span[data-pm-start][data-pm-end]");if(n.length===0){let c=o.closest(".layout-paragraph");return c?.dataset.pmStart?Number(c.dataset.pmStart)+1:null}for(let c of Array.from(n)){let r=c,a=r.getBoundingClientRect(),u=Number(r.dataset.pmStart),p=Number(r.dataset.pmEnd);if(r.classList.contains("layout-run-tab")){if(t>=a.left&&t<=a.right){let f=(a.left+a.right)/2;return t<f?u:p}continue}if(t>=a.left&&t<=a.right){let f=r.firstChild;if(!f||f.nodeType!==Node.TEXT_NODE)return u;let m=f,g=r.ownerDocument;if(!g)return u;let s=0,y=m.length;for(;s<y;){let d=Math.floor((s+y)/2),E=g.createRange();E.setStart(m,d),E.setEnd(m,d),t<E.getBoundingClientRect().left?y=d:s=d+1;}if(s>0&&s<=m.length){let d=g.createRange();d.setStart(m,s-1),d.setEnd(m,s-1);let E=d.getBoundingClientRect().left;d.setStart(m,Math.min(s,m.length)),d.setEnd(m,Math.min(s,m.length));let b=d.getBoundingClientRect().left;if(Math.abs(t-E)<Math.abs(t-b))return u+(s-1)}return u+Math.min(s,p-u)}}let l=null,e=1/0;for(let c of Array.from(n)){let r=c,a=r.getBoundingClientRect(),u=t<a.left?a.left-t:t-a.right;u<e&&(e=u,l=r);}if(!l)return null;let i=l.getBoundingClientRect();return t<i.left?Number(l.dataset.pmStart):Number(l.dataset.pmEnd)}function w(o,t,n,l){if(n.key!=="ArrowUp"&&n.key!=="ArrowDown")return (["ArrowLeft","ArrowRight","Home","End"].includes(n.key)||n.key.length===1&&!n.ctrlKey&&!n.metaKey)&&(o.stickyX=null,o.lastVisualLineIndex=-1),false;if(n.ctrlKey||n.metaKey)return o.stickyX=null,o.lastVisualLineIndex=-1,false;if(!l)return false;let e=Array.from(l.querySelectorAll(S));if(e.length===0)return false;let{from:i,anchor:c}=t.state.selection;if(o.stickyX===null){let s=x(l,i);if(s===null)return false;o.stickyX=s;}let r;if(o.lastVisualLineIndex>=0&&o.lastVisualLineIndex<e.length)r=o.lastVisualLineIndex;else {let s=M(l,i);if(!s||(r=e.indexOf(s),r===-1))return false}let a=n.key==="ArrowUp"?r-1:r+1;if(a<0||a>=e.length)return o.lastVisualLineIndex=-1,false;let u=e[a],p=N(u,o.stickyX);if(p===null)return false;o.lastVisualLineIndex=a;let{state:f,dispatch:m}=t,g=Math.max(0,Math.min(p,f.doc.content.size));try{let s=n.shiftKey?TextSelection.create(f.doc,c,g):TextSelection.create(f.doc,g);m(f.tr.setSelection(s));}catch{let s=f.doc.resolve(g),y=n.shiftKey?TextSelection.between(f.doc.resolve(c),s):TextSelection.near(s);m(f.tr.setSelection(y));}return T(u),true}export{C as createVisualLineState,M as findLineElementAtPosition,N as findPositionOnLineAtClientX,x as getCaretClientX,w as handleVisualLineKeyDown};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { b as CorePlugin, k as PluginOptions, l as PluginRegistrationResult, C as CommandHandler, f as McpToolDefinition, j as PluginEventListener } from './types-dYdjUZMo.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Plugin Registry
|
|
5
|
+
*
|
|
6
|
+
* Central registry for core plugins. Manages plugin lifecycle,
|
|
7
|
+
* collects command handlers from all plugins, and aggregates
|
|
8
|
+
* MCP tool definitions for the MCP server.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Plugin Registry - manages core plugins
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { pluginRegistry, docxtemplaterPlugin } from '@eigenpal/docx-editor/core-plugins';
|
|
17
|
+
*
|
|
18
|
+
* // Register plugins
|
|
19
|
+
* pluginRegistry.register(docxtemplaterPlugin);
|
|
20
|
+
*
|
|
21
|
+
* // Get all MCP tools for MCP server
|
|
22
|
+
* const tools = pluginRegistry.getMcpTools();
|
|
23
|
+
*
|
|
24
|
+
* // Get command handler for executor
|
|
25
|
+
* const handler = pluginRegistry.getCommandHandler('insertTemplateVariable');
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
declare class PluginRegistry {
|
|
29
|
+
private plugins;
|
|
30
|
+
private commandHandlers;
|
|
31
|
+
private eventListeners;
|
|
32
|
+
private initialized;
|
|
33
|
+
/**
|
|
34
|
+
* Register a plugin
|
|
35
|
+
*
|
|
36
|
+
* @param plugin - The plugin to register
|
|
37
|
+
* @param options - Optional configuration
|
|
38
|
+
* @returns Registration result
|
|
39
|
+
*/
|
|
40
|
+
register(plugin: CorePlugin, options?: PluginOptions): PluginRegistrationResult;
|
|
41
|
+
/**
|
|
42
|
+
* Unregister a plugin
|
|
43
|
+
*
|
|
44
|
+
* @param pluginId - ID of the plugin to unregister
|
|
45
|
+
* @returns Whether unregistration succeeded
|
|
46
|
+
*/
|
|
47
|
+
unregister(pluginId: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Get a registered plugin by ID
|
|
50
|
+
*
|
|
51
|
+
* @param id - Plugin ID
|
|
52
|
+
* @returns The plugin or undefined
|
|
53
|
+
*/
|
|
54
|
+
get(id: string): CorePlugin | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Get all registered plugins
|
|
57
|
+
*
|
|
58
|
+
* @returns Array of all plugins
|
|
59
|
+
*/
|
|
60
|
+
getAll(): CorePlugin[];
|
|
61
|
+
/**
|
|
62
|
+
* Check if a plugin is registered
|
|
63
|
+
*
|
|
64
|
+
* @param id - Plugin ID
|
|
65
|
+
* @returns Whether the plugin is registered
|
|
66
|
+
*/
|
|
67
|
+
has(id: string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Get number of registered plugins
|
|
70
|
+
*/
|
|
71
|
+
get size(): number;
|
|
72
|
+
/**
|
|
73
|
+
* Get a command handler for a command type
|
|
74
|
+
*
|
|
75
|
+
* @param commandType - The command type
|
|
76
|
+
* @returns The handler or undefined
|
|
77
|
+
*/
|
|
78
|
+
getCommandHandler(commandType: string): CommandHandler | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Get all registered command types
|
|
81
|
+
*
|
|
82
|
+
* @returns Array of command type strings
|
|
83
|
+
*/
|
|
84
|
+
getCommandTypes(): string[];
|
|
85
|
+
/**
|
|
86
|
+
* Check if a command type has a handler
|
|
87
|
+
*
|
|
88
|
+
* @param commandType - The command type
|
|
89
|
+
* @returns Whether a handler exists
|
|
90
|
+
*/
|
|
91
|
+
hasCommandHandler(commandType: string): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Get all MCP tools from all registered plugins
|
|
94
|
+
*
|
|
95
|
+
* @returns Array of MCP tool definitions
|
|
96
|
+
*/
|
|
97
|
+
getMcpTools(): McpToolDefinition[];
|
|
98
|
+
/**
|
|
99
|
+
* Get MCP tools from a specific plugin
|
|
100
|
+
*
|
|
101
|
+
* @param pluginId - Plugin ID
|
|
102
|
+
* @returns Array of MCP tool definitions
|
|
103
|
+
*/
|
|
104
|
+
getMcpToolsForPlugin(pluginId: string): McpToolDefinition[];
|
|
105
|
+
/**
|
|
106
|
+
* Get an MCP tool by name
|
|
107
|
+
*
|
|
108
|
+
* @param toolName - Tool name
|
|
109
|
+
* @returns The tool definition or undefined
|
|
110
|
+
*/
|
|
111
|
+
getMcpTool(toolName: string): McpToolDefinition | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Add an event listener
|
|
114
|
+
*
|
|
115
|
+
* @param listener - Event listener function
|
|
116
|
+
*/
|
|
117
|
+
addEventListener(listener: PluginEventListener): void;
|
|
118
|
+
/**
|
|
119
|
+
* Remove an event listener
|
|
120
|
+
*
|
|
121
|
+
* @param listener - Event listener function
|
|
122
|
+
*/
|
|
123
|
+
removeEventListener(listener: PluginEventListener): void;
|
|
124
|
+
/**
|
|
125
|
+
* Emit an event to all listeners
|
|
126
|
+
*/
|
|
127
|
+
private emit;
|
|
128
|
+
/**
|
|
129
|
+
* Clear all registered plugins
|
|
130
|
+
*
|
|
131
|
+
* Useful for testing or resetting state.
|
|
132
|
+
*/
|
|
133
|
+
clear(): void;
|
|
134
|
+
/**
|
|
135
|
+
* Get registry state for debugging
|
|
136
|
+
*/
|
|
137
|
+
getDebugInfo(): {
|
|
138
|
+
plugins: string[];
|
|
139
|
+
commandTypes: string[];
|
|
140
|
+
mcpTools: string[];
|
|
141
|
+
initialized: string[];
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Global plugin registry instance
|
|
146
|
+
*
|
|
147
|
+
* Use this for registering plugins and accessing their capabilities.
|
|
148
|
+
*/
|
|
149
|
+
declare const pluginRegistry: PluginRegistry;
|
|
150
|
+
/**
|
|
151
|
+
* Register multiple plugins at once
|
|
152
|
+
*
|
|
153
|
+
* @param plugins - Array of plugins to register
|
|
154
|
+
* @returns Array of registration results
|
|
155
|
+
*/
|
|
156
|
+
declare function registerPlugins(plugins: CorePlugin[], options?: PluginOptions): PluginRegistrationResult[];
|
|
157
|
+
/**
|
|
158
|
+
* Create a plugin registration helper with options pre-configured
|
|
159
|
+
*
|
|
160
|
+
* @param options - Default options for plugin registration
|
|
161
|
+
* @returns Registration function
|
|
162
|
+
*/
|
|
163
|
+
declare function createPluginRegistrar(options: PluginOptions): (plugin: CorePlugin) => PluginRegistrationResult;
|
|
164
|
+
|
|
165
|
+
export { PluginRegistry as P, createPluginRegistrar as c, pluginRegistry as p, registerPlugins as r };
|