@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,292 @@
|
|
|
1
|
+
import { Node } from 'prosemirror-model';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import { FlowBlock, Measure, LayoutOptions, FootnoteContent, Layout, Page, PageMargins, ImageRun } from './layout-engine/types.mjs';
|
|
4
|
+
import { F as Footnote, u as HeaderFooter } from './content-5Mrz6w_b.mjs';
|
|
5
|
+
import { a as StyleDefinitions, T as Theme } from './styles-EI2lxeEN.mjs';
|
|
6
|
+
import { F as FootnoteRenderItem, H as HeaderFooterContent } from './footnotes-lCH_P3N3.mjs';
|
|
7
|
+
import { Document } from './types/document.mjs';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Footnote Layout Utilities
|
|
11
|
+
*
|
|
12
|
+
* Footnote/endnote rendering pipeline plus page-mapping helpers:
|
|
13
|
+
* - scanning FlowBlocks for footnote references and their PM positions
|
|
14
|
+
* - mapping references to the page that ends up containing them
|
|
15
|
+
* - converting a Footnote → FootnoteContent via the body pipeline
|
|
16
|
+
* (footnoteToProseDoc → toFlowBlocks → caller-supplied measureBlocks)
|
|
17
|
+
* - reserving per-page footnote area heights for layout
|
|
18
|
+
*
|
|
19
|
+
* Everything that's pure OOXML / FlowBlock semantics lives here so the
|
|
20
|
+
* React, Vue, and any future adapters can share the conversion logic
|
|
21
|
+
* and just supply their own measurement function (which depends on
|
|
22
|
+
* platform-specific Canvas/font metrics).
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/** Separator line height + vertical padding in pixels. */
|
|
26
|
+
declare const FOOTNOTE_SEPARATOR_HEIGHT = 12;
|
|
27
|
+
/**
|
|
28
|
+
* Hard cap on the multi-pass footnote layout loop. Reserving footnote
|
|
29
|
+
* space can move a reference to another page, so adapters keep remapping
|
|
30
|
+
* until the page→height contract is stable. Dense layouts converge in
|
|
31
|
+
* 2–3 passes in practice; 6 is a safe ceiling.
|
|
32
|
+
*/
|
|
33
|
+
declare const MAX_FOOTNOTE_LAYOUT_PASSES = 6;
|
|
34
|
+
/**
|
|
35
|
+
* Compare two per-page footnote reservation maps. Used by the React +
|
|
36
|
+
* Vue adapters to detect when the multi-pass loop has converged.
|
|
37
|
+
*/
|
|
38
|
+
declare function footnoteReservedHeightsEqual(a: Map<number, number>, b: Map<number, number>): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Scan FlowBlocks for runs with footnoteRefId set.
|
|
41
|
+
* Returns a list of { footnoteId, pmPos } in document order.
|
|
42
|
+
*
|
|
43
|
+
* Recurses into container blocks (table cells, text boxes) so footnote
|
|
44
|
+
* references authored anywhere in the body reach the page-reservation
|
|
45
|
+
* pass. Without this, a `footnoteRefId` nested inside a table cell never
|
|
46
|
+
* gets mapped to a page and the per-page `.layout-footnote-area` silently
|
|
47
|
+
* drops that entry even though the body still renders the in-line ref
|
|
48
|
+
* marker.
|
|
49
|
+
*/
|
|
50
|
+
declare function collectFootnoteRefs(blocks: FlowBlock[]): Array<{
|
|
51
|
+
footnoteId: number;
|
|
52
|
+
pmPos: number;
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* After layout, determine which footnotes appear on which pages.
|
|
56
|
+
* Checks each page's fragments to see if any footnoteRef PM positions fall within.
|
|
57
|
+
*
|
|
58
|
+
* Returns Map<pageNumber, footnoteId[]> in document order.
|
|
59
|
+
*/
|
|
60
|
+
declare function mapFootnotesToPages(pages: Page[], footnoteRefs: Array<{
|
|
61
|
+
footnoteId: number;
|
|
62
|
+
pmPos: number;
|
|
63
|
+
}>): Map<number, number[]>;
|
|
64
|
+
/**
|
|
65
|
+
* Footnote-specific block normalization. Mirrors the spirit of
|
|
66
|
+
* `normalizeHeaderFooterMeasureBlocks`: post-process the body-pipeline
|
|
67
|
+
* output for a single footnote so it carries the correct visual prefix
|
|
68
|
+
* (its display number, rendered as a superscript) and a default 8pt font
|
|
69
|
+
* for any run that didn't specify a size.
|
|
70
|
+
*
|
|
71
|
+
* The displayNumber is prepended onto the FIRST paragraph as a fresh
|
|
72
|
+
* superscript text run — visually matches Word's footnote numbering
|
|
73
|
+
* without disturbing the authored runs.
|
|
74
|
+
*
|
|
75
|
+
* Exported for callers that want to compose their own conversion
|
|
76
|
+
* pipeline; `convertFootnoteToContent` calls it as part of its flow.
|
|
77
|
+
*/
|
|
78
|
+
declare function applyFootnotePresentation(blocks: FlowBlock[], displayNumber: number): FlowBlock[];
|
|
79
|
+
/**
|
|
80
|
+
* Adapter-supplied block measurement function. The caller (React /
|
|
81
|
+
* Vue / etc.) supplies its platform's measure routine — at minimum
|
|
82
|
+
* paragraph + table + image + textBox — so this core helper stays
|
|
83
|
+
* Canvas-free.
|
|
84
|
+
*/
|
|
85
|
+
type MeasureBlocksFn = (blocks: FlowBlock[], contentWidth: number) => Measure[];
|
|
86
|
+
/**
|
|
87
|
+
* Options for {@link convertFootnoteToContent}.
|
|
88
|
+
*/
|
|
89
|
+
type ConvertFootnoteOptions = {
|
|
90
|
+
/** The document's parsed style definitions, threaded into the body pipeline. */
|
|
91
|
+
styles?: StyleDefinitions | null;
|
|
92
|
+
/** Theme for resolving themed fills / fonts inside the footnote. */
|
|
93
|
+
theme?: Theme | null;
|
|
94
|
+
/** Measure callback supplied by the rendering adapter. */
|
|
95
|
+
measureBlocks: MeasureBlocksFn;
|
|
96
|
+
/**
|
|
97
|
+
* Doc-level `w:defaultTabStop` (twips) from the body so list markers
|
|
98
|
+
* inside footnotes honor the same tab grid.
|
|
99
|
+
*/
|
|
100
|
+
defaultTabStopTwips?: number | null;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Convert a Footnote to renderable FootnoteContent via the body pipeline:
|
|
104
|
+
* `footnoteToProseDoc → toFlowBlocks → applyFootnotePresentation →
|
|
105
|
+
* measureBlocks`. Pre-PR (#378) this lived in a hand-rolled shadow stack
|
|
106
|
+
* that silently dropped non-paragraph content; routing through the body
|
|
107
|
+
* pipeline gives footnotes full block-kind support — paragraph + table
|
|
108
|
+
* + image + textBox + fields.
|
|
109
|
+
*/
|
|
110
|
+
declare function convertFootnoteToContent(footnote: Footnote, displayNumber: number, contentWidth: number, options: ConvertFootnoteOptions): FootnoteContent;
|
|
111
|
+
/**
|
|
112
|
+
* Build footnote content for all footnotes referenced in the document.
|
|
113
|
+
* Display numbers are assigned by first-appearance order (the same way
|
|
114
|
+
* Word renders them).
|
|
115
|
+
*/
|
|
116
|
+
declare function buildFootnoteContentMap(footnotes: Footnote[], footnoteRefs: Array<{
|
|
117
|
+
footnoteId: number;
|
|
118
|
+
}>, contentWidth: number, options: ConvertFootnoteOptions): Map<number, FootnoteContent>;
|
|
119
|
+
/**
|
|
120
|
+
* Calculate per-page footnote reserved heights.
|
|
121
|
+
* Returns Map<pageNumber, reservedHeight>.
|
|
122
|
+
*/
|
|
123
|
+
declare function calculateFootnoteReservedHeights(pageFootnoteMap: Map<number, number[]>, footnoteContentMap: Map<number, {
|
|
124
|
+
height: number;
|
|
125
|
+
}>): Map<number, number>;
|
|
126
|
+
interface StabilizeFootnoteLayoutArgs {
|
|
127
|
+
blocks: FlowBlock[];
|
|
128
|
+
measures: Measure[];
|
|
129
|
+
layoutOpts: LayoutOptions;
|
|
130
|
+
footnoteRefs: Array<{
|
|
131
|
+
footnoteId: number;
|
|
132
|
+
pmPos: number;
|
|
133
|
+
}>;
|
|
134
|
+
footnoteContentMap: Map<number, FootnoteContent>;
|
|
135
|
+
/** First-pass layout already computed by the caller without reserved heights. */
|
|
136
|
+
initialLayout: Layout;
|
|
137
|
+
}
|
|
138
|
+
interface StabilizeFootnoteLayoutResult {
|
|
139
|
+
layout: Layout;
|
|
140
|
+
pageFootnoteMap: Map<number, number[]>;
|
|
141
|
+
/** True if the loop converged before hitting MAX_FOOTNOTE_LAYOUT_PASSES. */
|
|
142
|
+
converged: boolean;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Run the multi-pass footnote layout loop. Reserving footnote space on a
|
|
146
|
+
* page can move a reference to another page, which changes the reservation,
|
|
147
|
+
* which can move references again. Iterate until the page→height contract
|
|
148
|
+
* is the same one used by the latest layout, or `MAX_FOOTNOTE_LAYOUT_PASSES`
|
|
149
|
+
* passes have run.
|
|
150
|
+
*
|
|
151
|
+
* Lives in core so the React + Vue adapters call the same loop and stay in
|
|
152
|
+
* lockstep on convergence behaviour. Writes `page.footnoteIds` onto each
|
|
153
|
+
* page in the returned layout so renderers can paint footnote areas.
|
|
154
|
+
*/
|
|
155
|
+
declare function stabilizeFootnoteLayout(args: StabilizeFootnoteLayoutArgs): StabilizeFootnoteLayoutResult;
|
|
156
|
+
/**
|
|
157
|
+
* Turn the page→footnote-id map into the per-page render payload that
|
|
158
|
+
* `renderPages` consumes via `footnotesByPage`. Skips non-`normal` notes
|
|
159
|
+
* (separators, continuation notices), reads the display number out of the
|
|
160
|
+
* content map, and pulls plain text via `getFootnoteText`.
|
|
161
|
+
*
|
|
162
|
+
* Lives in core (not in either adapter) so React + Vue both call the
|
|
163
|
+
* same helper — same rule as the rest of this module.
|
|
164
|
+
*/
|
|
165
|
+
declare function buildFootnoteRenderItems(pageFootnoteMap: Map<number, number[]>, footnoteContentMap: Map<number, FootnoteContent>, doc: Document | null): Map<number, FootnoteRenderItem[]>;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Header / Footer Layout Utilities
|
|
169
|
+
*
|
|
170
|
+
* The header/footer rendering pipeline lives here so any rendering adapter
|
|
171
|
+
* (React, Vue, etc.) can share the conversion logic and just supply its
|
|
172
|
+
* platform-specific {@link MeasureBlocksFn}. Mirrors the footnote pipeline
|
|
173
|
+
* in `footnoteLayout.ts`.
|
|
174
|
+
*
|
|
175
|
+
* Pipeline:
|
|
176
|
+
* HF.content → headerFooterToProseDoc → toFlowBlocks
|
|
177
|
+
* → measureBlocks (caller-supplied, Canvas-aware)
|
|
178
|
+
* → HeaderFooterContent (blocks, measures, height, visualTop/Bottom)
|
|
179
|
+
*
|
|
180
|
+
* The render side uses the normalized block list so paint and measurement stay
|
|
181
|
+
* in lockstep. Visual-bounds calculation still inspects the original block
|
|
182
|
+
* list because floating images can paint above/below the nominal flow box even
|
|
183
|
+
* when they do not contribute to flow height.
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
type HeaderFooterMetrics = {
|
|
187
|
+
section: 'header' | 'footer';
|
|
188
|
+
pageSize: {
|
|
189
|
+
w: number;
|
|
190
|
+
h: number;
|
|
191
|
+
};
|
|
192
|
+
margins: PageMargins;
|
|
193
|
+
};
|
|
194
|
+
declare function normalizeHeaderFooterMeasureBlocks(blocks: FlowBlock[]): FlowBlock[];
|
|
195
|
+
declare function resolveHeaderFooterVisualTop(run: ImageRun, paragraphY: number, flowHeight: number, metrics: HeaderFooterMetrics): number;
|
|
196
|
+
declare function calculateHeaderFooterVisualBounds(blocks: FlowBlock[], measures: Measure[], flowHeight: number, metrics: HeaderFooterMetrics): {
|
|
197
|
+
visualTop: number;
|
|
198
|
+
visualBottom: number;
|
|
199
|
+
};
|
|
200
|
+
type ConvertHeaderFooterOptions = {
|
|
201
|
+
styles?: StyleDefinitions | null;
|
|
202
|
+
theme?: Theme | null;
|
|
203
|
+
measureBlocks: MeasureBlocksFn;
|
|
204
|
+
/**
|
|
205
|
+
* `w:defaultTabStop` (twips) read from `state.doc.attrs.defaultTabStopTwips`
|
|
206
|
+
* on the body doc — HF content doesn't carry its own doc-level setting,
|
|
207
|
+
* so pass it through so list markers inside headers/footers honor the
|
|
208
|
+
* same tab grid as the body.
|
|
209
|
+
*/
|
|
210
|
+
defaultTabStopTwips?: number | null;
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* Convert HeaderFooter (document type) to HeaderFooterContent (render type).
|
|
214
|
+
*
|
|
215
|
+
* Routes through the same pipeline as the body: HF.content →
|
|
216
|
+
* headerFooterToProseDoc → toFlowBlocks → measureBlocks. The inline editor
|
|
217
|
+
* uses the same conversion chain, so block support (paragraph, table, image,
|
|
218
|
+
* textBox, fields) and the inline editor's content stay in lockstep.
|
|
219
|
+
*/
|
|
220
|
+
declare function convertHeaderFooterToContent(headerFooter: HeaderFooter | null | undefined, contentWidth: number, metrics: HeaderFooterMetrics, options: ConvertHeaderFooterOptions): HeaderFooterContent | undefined;
|
|
221
|
+
/**
|
|
222
|
+
* Same pipeline as {@link convertHeaderFooterToContent}, but starts from an
|
|
223
|
+
* already-built ProseMirror document instead of `HeaderFooter.content`.
|
|
224
|
+
*
|
|
225
|
+
* The unified HF editing model (see `openspec/changes/unify-hf-editing/`)
|
|
226
|
+
* maintains one persistent hidden PM EditorView per HF `rId`. The painter
|
|
227
|
+
* reads from that EditorView's current `state.doc` rather than re-parsing
|
|
228
|
+
* the Document-model `HeaderFooter` every layout pass — this is what
|
|
229
|
+
* actually makes the painter and the editor stay in lockstep.
|
|
230
|
+
*
|
|
231
|
+
* `headerFooterToProseDoc` is still the right entry point when there is no
|
|
232
|
+
* mounted PM for the slot (cold load, or rId not yet projected).
|
|
233
|
+
*
|
|
234
|
+
* @public
|
|
235
|
+
*/
|
|
236
|
+
declare function convertHeaderFooterPmDocToContent(pmDoc: Node, contentWidth: number, metrics: HeaderFooterMetrics, options: ConvertHeaderFooterOptions): HeaderFooterContent | undefined;
|
|
237
|
+
/**
|
|
238
|
+
* Drop the cached HF host + span lists. Hosts/painters call this after
|
|
239
|
+
* a repaint (or HF mode toggle) so the next caret / selection compute
|
|
240
|
+
* re-walks the DOM. Public so adapters can call it from their painter
|
|
241
|
+
* commit signal.
|
|
242
|
+
*
|
|
243
|
+
* @public
|
|
244
|
+
*/
|
|
245
|
+
declare function invalidateHfDomCache(): void;
|
|
246
|
+
/**
|
|
247
|
+
* TODO(unify-hf-editing follow-up): this function duplicates the
|
|
248
|
+
* span-walking + Range/TreeWalker logic in
|
|
249
|
+
* `packages/react/src/components/DocxEditor/internals/domSelection.ts:getCaretFromDom`
|
|
250
|
+
* (body). The body's helper is scoped to `.layout-page-content` via
|
|
251
|
+
* `findBodyPmSpans`; we walk the same shape scoped to `.layout-page-header /
|
|
252
|
+
* .layout-page-footer` here. Unification path:
|
|
253
|
+
* 1. Add `findHfPmSpans` / `findHfEmptyRuns` mirrors next to the body
|
|
254
|
+
* ones in `packages/core/src/layout-bridge/findBodyPmSpans.ts`.
|
|
255
|
+
* 2. Add `scope: 'body' | 'hf'` param to `getCaretFromDom` +
|
|
256
|
+
* `computeSelectionRectsFromDom`; switch the helper internally.
|
|
257
|
+
* 3. Move the (now scope-aware) helpers into core so React + Vue both
|
|
258
|
+
* call them.
|
|
259
|
+
* 4. Delete this function and `computeHfSelectionRectsFromView` —
|
|
260
|
+
* `DocxEditorPagedArea` calls `getCaretFromDom(scope: 'hf', ...)`.
|
|
261
|
+
* Reviewer estimate: ~30 LOC net deletion + body↔HF parity for free
|
|
262
|
+
* (lineHeight from `.layout-line` ancestor, empty-paragraph fallback
|
|
263
|
+
* via `findBodyEmptyRuns`, etc.). Deferred because it's a multi-file
|
|
264
|
+
* shape change that doesn't affect observable behavior.
|
|
265
|
+
*
|
|
266
|
+
* @public
|
|
267
|
+
*/
|
|
268
|
+
declare function computeHfCaretRectFromView(view: EditorView, doc?: globalThis.Document): {
|
|
269
|
+
top: number;
|
|
270
|
+
left: number;
|
|
271
|
+
height: number;
|
|
272
|
+
} | null;
|
|
273
|
+
/**
|
|
274
|
+
* Selection-rect set for a non-empty HF selection, projected against the
|
|
275
|
+
* painted HF spans. Mirror of `computeSelectionRectsFromDom` but scoped to
|
|
276
|
+
* `.layout-page-header` / `.layout-page-footer` instead of the body. Used
|
|
277
|
+
* so the painter draws a visible highlight when the user drag-selects
|
|
278
|
+
* inside a header/footer in edit mode.
|
|
279
|
+
*
|
|
280
|
+
* Returns viewport-relative `{top, left, width, height}` rects. Empty
|
|
281
|
+
* array when selection is collapsed or no painted spans overlap the range.
|
|
282
|
+
*
|
|
283
|
+
* @public
|
|
284
|
+
*/
|
|
285
|
+
declare function computeHfSelectionRectsFromView(view: EditorView, doc?: globalThis.Document): Array<{
|
|
286
|
+
top: number;
|
|
287
|
+
left: number;
|
|
288
|
+
width: number;
|
|
289
|
+
height: number;
|
|
290
|
+
}>;
|
|
291
|
+
|
|
292
|
+
export { type ConvertFootnoteOptions as C, FOOTNOTE_SEPARATOR_HEIGHT as F, type HeaderFooterMetrics as H, MAX_FOOTNOTE_LAYOUT_PASSES as M, type StabilizeFootnoteLayoutArgs as S, type ConvertHeaderFooterOptions as a, type MeasureBlocksFn as b, type StabilizeFootnoteLayoutResult as c, buildFootnoteContentMap as d, buildFootnoteRenderItems as e, calculateFootnoteReservedHeights as f, collectFootnoteRefs as g, convertHeaderFooterToContent as h, footnoteReservedHeightsEqual as i, applyFootnotePresentation as j, calculateHeaderFooterVisualBounds as k, computeHfCaretRectFromView as l, mapFootnotesToPages as m, computeHfSelectionRectsFromView as n, convertFootnoteToContent as o, convertHeaderFooterPmDocToContent as p, invalidateHfDomCache as q, normalizeHeaderFooterMeasureBlocks as r, stabilizeFootnoteLayout as s, resolveHeaderFooterVisualTop as t };
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { Node } from 'prosemirror-model';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import { FlowBlock, Measure, LayoutOptions, FootnoteContent, Layout, Page, PageMargins, ImageRun } from './layout-engine/types.js';
|
|
4
|
+
import { F as Footnote, u as HeaderFooter } from './content-CmqAwdFL.js';
|
|
5
|
+
import { a as StyleDefinitions, T as Theme } from './styles-BBv7doYK.js';
|
|
6
|
+
import { F as FootnoteRenderItem, H as HeaderFooterContent } from './footnotes-skVvEHvZ.js';
|
|
7
|
+
import { Document } from './types/document.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Footnote Layout Utilities
|
|
11
|
+
*
|
|
12
|
+
* Footnote/endnote rendering pipeline plus page-mapping helpers:
|
|
13
|
+
* - scanning FlowBlocks for footnote references and their PM positions
|
|
14
|
+
* - mapping references to the page that ends up containing them
|
|
15
|
+
* - converting a Footnote → FootnoteContent via the body pipeline
|
|
16
|
+
* (footnoteToProseDoc → toFlowBlocks → caller-supplied measureBlocks)
|
|
17
|
+
* - reserving per-page footnote area heights for layout
|
|
18
|
+
*
|
|
19
|
+
* Everything that's pure OOXML / FlowBlock semantics lives here so the
|
|
20
|
+
* React, Vue, and any future adapters can share the conversion logic
|
|
21
|
+
* and just supply their own measurement function (which depends on
|
|
22
|
+
* platform-specific Canvas/font metrics).
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/** Separator line height + vertical padding in pixels. */
|
|
26
|
+
declare const FOOTNOTE_SEPARATOR_HEIGHT = 12;
|
|
27
|
+
/**
|
|
28
|
+
* Hard cap on the multi-pass footnote layout loop. Reserving footnote
|
|
29
|
+
* space can move a reference to another page, so adapters keep remapping
|
|
30
|
+
* until the page→height contract is stable. Dense layouts converge in
|
|
31
|
+
* 2–3 passes in practice; 6 is a safe ceiling.
|
|
32
|
+
*/
|
|
33
|
+
declare const MAX_FOOTNOTE_LAYOUT_PASSES = 6;
|
|
34
|
+
/**
|
|
35
|
+
* Compare two per-page footnote reservation maps. Used by the React +
|
|
36
|
+
* Vue adapters to detect when the multi-pass loop has converged.
|
|
37
|
+
*/
|
|
38
|
+
declare function footnoteReservedHeightsEqual(a: Map<number, number>, b: Map<number, number>): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Scan FlowBlocks for runs with footnoteRefId set.
|
|
41
|
+
* Returns a list of { footnoteId, pmPos } in document order.
|
|
42
|
+
*
|
|
43
|
+
* Recurses into container blocks (table cells, text boxes) so footnote
|
|
44
|
+
* references authored anywhere in the body reach the page-reservation
|
|
45
|
+
* pass. Without this, a `footnoteRefId` nested inside a table cell never
|
|
46
|
+
* gets mapped to a page and the per-page `.layout-footnote-area` silently
|
|
47
|
+
* drops that entry even though the body still renders the in-line ref
|
|
48
|
+
* marker.
|
|
49
|
+
*/
|
|
50
|
+
declare function collectFootnoteRefs(blocks: FlowBlock[]): Array<{
|
|
51
|
+
footnoteId: number;
|
|
52
|
+
pmPos: number;
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* After layout, determine which footnotes appear on which pages.
|
|
56
|
+
* Checks each page's fragments to see if any footnoteRef PM positions fall within.
|
|
57
|
+
*
|
|
58
|
+
* Returns Map<pageNumber, footnoteId[]> in document order.
|
|
59
|
+
*/
|
|
60
|
+
declare function mapFootnotesToPages(pages: Page[], footnoteRefs: Array<{
|
|
61
|
+
footnoteId: number;
|
|
62
|
+
pmPos: number;
|
|
63
|
+
}>): Map<number, number[]>;
|
|
64
|
+
/**
|
|
65
|
+
* Footnote-specific block normalization. Mirrors the spirit of
|
|
66
|
+
* `normalizeHeaderFooterMeasureBlocks`: post-process the body-pipeline
|
|
67
|
+
* output for a single footnote so it carries the correct visual prefix
|
|
68
|
+
* (its display number, rendered as a superscript) and a default 8pt font
|
|
69
|
+
* for any run that didn't specify a size.
|
|
70
|
+
*
|
|
71
|
+
* The displayNumber is prepended onto the FIRST paragraph as a fresh
|
|
72
|
+
* superscript text run — visually matches Word's footnote numbering
|
|
73
|
+
* without disturbing the authored runs.
|
|
74
|
+
*
|
|
75
|
+
* Exported for callers that want to compose their own conversion
|
|
76
|
+
* pipeline; `convertFootnoteToContent` calls it as part of its flow.
|
|
77
|
+
*/
|
|
78
|
+
declare function applyFootnotePresentation(blocks: FlowBlock[], displayNumber: number): FlowBlock[];
|
|
79
|
+
/**
|
|
80
|
+
* Adapter-supplied block measurement function. The caller (React /
|
|
81
|
+
* Vue / etc.) supplies its platform's measure routine — at minimum
|
|
82
|
+
* paragraph + table + image + textBox — so this core helper stays
|
|
83
|
+
* Canvas-free.
|
|
84
|
+
*/
|
|
85
|
+
type MeasureBlocksFn = (blocks: FlowBlock[], contentWidth: number) => Measure[];
|
|
86
|
+
/**
|
|
87
|
+
* Options for {@link convertFootnoteToContent}.
|
|
88
|
+
*/
|
|
89
|
+
type ConvertFootnoteOptions = {
|
|
90
|
+
/** The document's parsed style definitions, threaded into the body pipeline. */
|
|
91
|
+
styles?: StyleDefinitions | null;
|
|
92
|
+
/** Theme for resolving themed fills / fonts inside the footnote. */
|
|
93
|
+
theme?: Theme | null;
|
|
94
|
+
/** Measure callback supplied by the rendering adapter. */
|
|
95
|
+
measureBlocks: MeasureBlocksFn;
|
|
96
|
+
/**
|
|
97
|
+
* Doc-level `w:defaultTabStop` (twips) from the body so list markers
|
|
98
|
+
* inside footnotes honor the same tab grid.
|
|
99
|
+
*/
|
|
100
|
+
defaultTabStopTwips?: number | null;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Convert a Footnote to renderable FootnoteContent via the body pipeline:
|
|
104
|
+
* `footnoteToProseDoc → toFlowBlocks → applyFootnotePresentation →
|
|
105
|
+
* measureBlocks`. Pre-PR (#378) this lived in a hand-rolled shadow stack
|
|
106
|
+
* that silently dropped non-paragraph content; routing through the body
|
|
107
|
+
* pipeline gives footnotes full block-kind support — paragraph + table
|
|
108
|
+
* + image + textBox + fields.
|
|
109
|
+
*/
|
|
110
|
+
declare function convertFootnoteToContent(footnote: Footnote, displayNumber: number, contentWidth: number, options: ConvertFootnoteOptions): FootnoteContent;
|
|
111
|
+
/**
|
|
112
|
+
* Build footnote content for all footnotes referenced in the document.
|
|
113
|
+
* Display numbers are assigned by first-appearance order (the same way
|
|
114
|
+
* Word renders them).
|
|
115
|
+
*/
|
|
116
|
+
declare function buildFootnoteContentMap(footnotes: Footnote[], footnoteRefs: Array<{
|
|
117
|
+
footnoteId: number;
|
|
118
|
+
}>, contentWidth: number, options: ConvertFootnoteOptions): Map<number, FootnoteContent>;
|
|
119
|
+
/**
|
|
120
|
+
* Calculate per-page footnote reserved heights.
|
|
121
|
+
* Returns Map<pageNumber, reservedHeight>.
|
|
122
|
+
*/
|
|
123
|
+
declare function calculateFootnoteReservedHeights(pageFootnoteMap: Map<number, number[]>, footnoteContentMap: Map<number, {
|
|
124
|
+
height: number;
|
|
125
|
+
}>): Map<number, number>;
|
|
126
|
+
interface StabilizeFootnoteLayoutArgs {
|
|
127
|
+
blocks: FlowBlock[];
|
|
128
|
+
measures: Measure[];
|
|
129
|
+
layoutOpts: LayoutOptions;
|
|
130
|
+
footnoteRefs: Array<{
|
|
131
|
+
footnoteId: number;
|
|
132
|
+
pmPos: number;
|
|
133
|
+
}>;
|
|
134
|
+
footnoteContentMap: Map<number, FootnoteContent>;
|
|
135
|
+
/** First-pass layout already computed by the caller without reserved heights. */
|
|
136
|
+
initialLayout: Layout;
|
|
137
|
+
}
|
|
138
|
+
interface StabilizeFootnoteLayoutResult {
|
|
139
|
+
layout: Layout;
|
|
140
|
+
pageFootnoteMap: Map<number, number[]>;
|
|
141
|
+
/** True if the loop converged before hitting MAX_FOOTNOTE_LAYOUT_PASSES. */
|
|
142
|
+
converged: boolean;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Run the multi-pass footnote layout loop. Reserving footnote space on a
|
|
146
|
+
* page can move a reference to another page, which changes the reservation,
|
|
147
|
+
* which can move references again. Iterate until the page→height contract
|
|
148
|
+
* is the same one used by the latest layout, or `MAX_FOOTNOTE_LAYOUT_PASSES`
|
|
149
|
+
* passes have run.
|
|
150
|
+
*
|
|
151
|
+
* Lives in core so the React + Vue adapters call the same loop and stay in
|
|
152
|
+
* lockstep on convergence behaviour. Writes `page.footnoteIds` onto each
|
|
153
|
+
* page in the returned layout so renderers can paint footnote areas.
|
|
154
|
+
*/
|
|
155
|
+
declare function stabilizeFootnoteLayout(args: StabilizeFootnoteLayoutArgs): StabilizeFootnoteLayoutResult;
|
|
156
|
+
/**
|
|
157
|
+
* Turn the page→footnote-id map into the per-page render payload that
|
|
158
|
+
* `renderPages` consumes via `footnotesByPage`. Skips non-`normal` notes
|
|
159
|
+
* (separators, continuation notices), reads the display number out of the
|
|
160
|
+
* content map, and pulls plain text via `getFootnoteText`.
|
|
161
|
+
*
|
|
162
|
+
* Lives in core (not in either adapter) so React + Vue both call the
|
|
163
|
+
* same helper — same rule as the rest of this module.
|
|
164
|
+
*/
|
|
165
|
+
declare function buildFootnoteRenderItems(pageFootnoteMap: Map<number, number[]>, footnoteContentMap: Map<number, FootnoteContent>, doc: Document | null): Map<number, FootnoteRenderItem[]>;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Header / Footer Layout Utilities
|
|
169
|
+
*
|
|
170
|
+
* The header/footer rendering pipeline lives here so any rendering adapter
|
|
171
|
+
* (React, Vue, etc.) can share the conversion logic and just supply its
|
|
172
|
+
* platform-specific {@link MeasureBlocksFn}. Mirrors the footnote pipeline
|
|
173
|
+
* in `footnoteLayout.ts`.
|
|
174
|
+
*
|
|
175
|
+
* Pipeline:
|
|
176
|
+
* HF.content → headerFooterToProseDoc → toFlowBlocks
|
|
177
|
+
* → measureBlocks (caller-supplied, Canvas-aware)
|
|
178
|
+
* → HeaderFooterContent (blocks, measures, height, visualTop/Bottom)
|
|
179
|
+
*
|
|
180
|
+
* The render side uses the normalized block list so paint and measurement stay
|
|
181
|
+
* in lockstep. Visual-bounds calculation still inspects the original block
|
|
182
|
+
* list because floating images can paint above/below the nominal flow box even
|
|
183
|
+
* when they do not contribute to flow height.
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
type HeaderFooterMetrics = {
|
|
187
|
+
section: 'header' | 'footer';
|
|
188
|
+
pageSize: {
|
|
189
|
+
w: number;
|
|
190
|
+
h: number;
|
|
191
|
+
};
|
|
192
|
+
margins: PageMargins;
|
|
193
|
+
};
|
|
194
|
+
declare function normalizeHeaderFooterMeasureBlocks(blocks: FlowBlock[]): FlowBlock[];
|
|
195
|
+
declare function resolveHeaderFooterVisualTop(run: ImageRun, paragraphY: number, flowHeight: number, metrics: HeaderFooterMetrics): number;
|
|
196
|
+
declare function calculateHeaderFooterVisualBounds(blocks: FlowBlock[], measures: Measure[], flowHeight: number, metrics: HeaderFooterMetrics): {
|
|
197
|
+
visualTop: number;
|
|
198
|
+
visualBottom: number;
|
|
199
|
+
};
|
|
200
|
+
type ConvertHeaderFooterOptions = {
|
|
201
|
+
styles?: StyleDefinitions | null;
|
|
202
|
+
theme?: Theme | null;
|
|
203
|
+
measureBlocks: MeasureBlocksFn;
|
|
204
|
+
/**
|
|
205
|
+
* `w:defaultTabStop` (twips) read from `state.doc.attrs.defaultTabStopTwips`
|
|
206
|
+
* on the body doc — HF content doesn't carry its own doc-level setting,
|
|
207
|
+
* so pass it through so list markers inside headers/footers honor the
|
|
208
|
+
* same tab grid as the body.
|
|
209
|
+
*/
|
|
210
|
+
defaultTabStopTwips?: number | null;
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* Convert HeaderFooter (document type) to HeaderFooterContent (render type).
|
|
214
|
+
*
|
|
215
|
+
* Routes through the same pipeline as the body: HF.content →
|
|
216
|
+
* headerFooterToProseDoc → toFlowBlocks → measureBlocks. The inline editor
|
|
217
|
+
* uses the same conversion chain, so block support (paragraph, table, image,
|
|
218
|
+
* textBox, fields) and the inline editor's content stay in lockstep.
|
|
219
|
+
*/
|
|
220
|
+
declare function convertHeaderFooterToContent(headerFooter: HeaderFooter | null | undefined, contentWidth: number, metrics: HeaderFooterMetrics, options: ConvertHeaderFooterOptions): HeaderFooterContent | undefined;
|
|
221
|
+
/**
|
|
222
|
+
* Same pipeline as {@link convertHeaderFooterToContent}, but starts from an
|
|
223
|
+
* already-built ProseMirror document instead of `HeaderFooter.content`.
|
|
224
|
+
*
|
|
225
|
+
* The unified HF editing model (see `openspec/changes/unify-hf-editing/`)
|
|
226
|
+
* maintains one persistent hidden PM EditorView per HF `rId`. The painter
|
|
227
|
+
* reads from that EditorView's current `state.doc` rather than re-parsing
|
|
228
|
+
* the Document-model `HeaderFooter` every layout pass — this is what
|
|
229
|
+
* actually makes the painter and the editor stay in lockstep.
|
|
230
|
+
*
|
|
231
|
+
* `headerFooterToProseDoc` is still the right entry point when there is no
|
|
232
|
+
* mounted PM for the slot (cold load, or rId not yet projected).
|
|
233
|
+
*
|
|
234
|
+
* @public
|
|
235
|
+
*/
|
|
236
|
+
declare function convertHeaderFooterPmDocToContent(pmDoc: Node, contentWidth: number, metrics: HeaderFooterMetrics, options: ConvertHeaderFooterOptions): HeaderFooterContent | undefined;
|
|
237
|
+
/**
|
|
238
|
+
* Drop the cached HF host + span lists. Hosts/painters call this after
|
|
239
|
+
* a repaint (or HF mode toggle) so the next caret / selection compute
|
|
240
|
+
* re-walks the DOM. Public so adapters can call it from their painter
|
|
241
|
+
* commit signal.
|
|
242
|
+
*
|
|
243
|
+
* @public
|
|
244
|
+
*/
|
|
245
|
+
declare function invalidateHfDomCache(): void;
|
|
246
|
+
/**
|
|
247
|
+
* TODO(unify-hf-editing follow-up): this function duplicates the
|
|
248
|
+
* span-walking + Range/TreeWalker logic in
|
|
249
|
+
* `packages/react/src/components/DocxEditor/internals/domSelection.ts:getCaretFromDom`
|
|
250
|
+
* (body). The body's helper is scoped to `.layout-page-content` via
|
|
251
|
+
* `findBodyPmSpans`; we walk the same shape scoped to `.layout-page-header /
|
|
252
|
+
* .layout-page-footer` here. Unification path:
|
|
253
|
+
* 1. Add `findHfPmSpans` / `findHfEmptyRuns` mirrors next to the body
|
|
254
|
+
* ones in `packages/core/src/layout-bridge/findBodyPmSpans.ts`.
|
|
255
|
+
* 2. Add `scope: 'body' | 'hf'` param to `getCaretFromDom` +
|
|
256
|
+
* `computeSelectionRectsFromDom`; switch the helper internally.
|
|
257
|
+
* 3. Move the (now scope-aware) helpers into core so React + Vue both
|
|
258
|
+
* call them.
|
|
259
|
+
* 4. Delete this function and `computeHfSelectionRectsFromView` —
|
|
260
|
+
* `DocxEditorPagedArea` calls `getCaretFromDom(scope: 'hf', ...)`.
|
|
261
|
+
* Reviewer estimate: ~30 LOC net deletion + body↔HF parity for free
|
|
262
|
+
* (lineHeight from `.layout-line` ancestor, empty-paragraph fallback
|
|
263
|
+
* via `findBodyEmptyRuns`, etc.). Deferred because it's a multi-file
|
|
264
|
+
* shape change that doesn't affect observable behavior.
|
|
265
|
+
*
|
|
266
|
+
* @public
|
|
267
|
+
*/
|
|
268
|
+
declare function computeHfCaretRectFromView(view: EditorView, doc?: globalThis.Document): {
|
|
269
|
+
top: number;
|
|
270
|
+
left: number;
|
|
271
|
+
height: number;
|
|
272
|
+
} | null;
|
|
273
|
+
/**
|
|
274
|
+
* Selection-rect set for a non-empty HF selection, projected against the
|
|
275
|
+
* painted HF spans. Mirror of `computeSelectionRectsFromDom` but scoped to
|
|
276
|
+
* `.layout-page-header` / `.layout-page-footer` instead of the body. Used
|
|
277
|
+
* so the painter draws a visible highlight when the user drag-selects
|
|
278
|
+
* inside a header/footer in edit mode.
|
|
279
|
+
*
|
|
280
|
+
* Returns viewport-relative `{top, left, width, height}` rects. Empty
|
|
281
|
+
* array when selection is collapsed or no painted spans overlap the range.
|
|
282
|
+
*
|
|
283
|
+
* @public
|
|
284
|
+
*/
|
|
285
|
+
declare function computeHfSelectionRectsFromView(view: EditorView, doc?: globalThis.Document): Array<{
|
|
286
|
+
top: number;
|
|
287
|
+
left: number;
|
|
288
|
+
width: number;
|
|
289
|
+
height: number;
|
|
290
|
+
}>;
|
|
291
|
+
|
|
292
|
+
export { type ConvertFootnoteOptions as C, FOOTNOTE_SEPARATOR_HEIGHT as F, type HeaderFooterMetrics as H, MAX_FOOTNOTE_LAYOUT_PASSES as M, type StabilizeFootnoteLayoutArgs as S, type ConvertHeaderFooterOptions as a, type MeasureBlocksFn as b, type StabilizeFootnoteLayoutResult as c, buildFootnoteContentMap as d, buildFootnoteRenderItems as e, calculateFootnoteReservedHeights as f, collectFootnoteRefs as g, convertHeaderFooterToContent as h, footnoteReservedHeightsEqual as i, applyFootnotePresentation as j, calculateHeaderFooterVisualBounds as k, computeHfCaretRectFromView as l, mapFootnotesToPages as m, computeHfSelectionRectsFromView as n, convertFootnoteToContent as o, convertHeaderFooterPmDocToContent as p, invalidateHfDomCache as q, normalizeHeaderFooterMeasureBlocks as r, stabilizeFootnoteLayout as s, resolveHeaderFooterVisualTop as t };
|