@eigenpal/docx-editor-core 1.3.3 → 1.5.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/dist/agent/index.d.mts +7 -6
- package/dist/agent/index.d.ts +7 -6
- package/dist/agent/index.js +1 -1
- package/dist/agent/index.mjs +1 -1
- package/dist/chunk-2LVK7EF5.mjs +2 -0
- package/dist/chunk-3HENAL6V.mjs +2 -0
- package/dist/{chunk-BUEMXRXH.js → chunk-3SJQRYO7.js} +1 -1
- package/dist/chunk-4JPHW7ZI.js +2 -0
- package/dist/chunk-4RQAAKQI.mjs +1 -0
- package/dist/{chunk-OF373DBR.mjs → chunk-5HA66FH4.mjs} +1 -1
- package/dist/chunk-5WINQXA3.js +1 -0
- package/dist/{chunk-3QPKTG2Y.js → chunk-6KM4VW4L.js} +2 -2
- package/dist/chunk-AA6D2C6R.js +4 -0
- package/dist/{chunk-7CZEZ3UL.mjs → chunk-AMJNIGO2.mjs} +1 -1
- package/dist/chunk-BTSL4AYY.js +1 -0
- package/dist/{chunk-GE2GV2AX.mjs → chunk-CBKJOPOW.mjs} +1 -1
- package/dist/chunk-CDBKFBC2.mjs +15 -0
- package/dist/chunk-COV4LHQ7.js +1 -0
- package/dist/chunk-DZ3FN3JI.js +2 -0
- package/dist/chunk-ENIWJBS7.mjs +2 -0
- package/dist/{chunk-55XWETY4.mjs → chunk-EZNVVB63.mjs} +1 -1
- package/dist/{chunk-CHN26LLL.mjs → chunk-F24WZXN4.mjs} +1 -1
- package/dist/{chunk-LIW3H4WB.js → chunk-GB7RICH6.js} +1 -1
- package/dist/{chunk-CZSAC65M.js → chunk-GFM6PERG.js} +1 -1
- package/dist/chunk-GKAXYZCE.mjs +1 -0
- package/dist/chunk-H57LNDBH.js +1 -0
- package/dist/chunk-IGYHDSM7.mjs +1 -0
- package/dist/{chunk-BH3ACQ3M.js → chunk-JQUIUKRO.js} +3 -3
- package/dist/chunk-L6ZRNW7Y.mjs +1 -0
- package/dist/{chunk-Q4IEATDJ.js → chunk-LJ2TB6CY.js} +1 -1
- package/dist/{chunk-DFUWJHKF.mjs → chunk-M3UL6EUU.mjs} +3 -3
- package/dist/chunk-M7KTKPGO.mjs +1 -0
- package/dist/chunk-MA3HLGFO.js +1 -0
- package/dist/chunk-ND33YQGU.js +1 -0
- package/dist/{chunk-KXVCCT2A.js → chunk-NPFFCPZ6.js} +1 -1
- package/dist/chunk-NTBZRITU.mjs +1 -0
- package/dist/{chunk-SCK6ZM5V.js → chunk-O2643IUW.js} +1 -1
- package/dist/chunk-P7HWOJC5.js +2 -0
- package/dist/{chunk-YNUPP7UG.mjs → chunk-PYDX4MOT.mjs} +2 -2
- package/dist/{chunk-CHTIWTHQ.mjs → chunk-QUM4DFRE.mjs} +1 -1
- package/dist/chunk-QVRMX2AC.js +15 -0
- package/dist/chunk-QXSDGNJ4.js +1 -0
- package/dist/{chunk-FYRJTDC4.mjs → chunk-QZPVZY6S.mjs} +1 -1
- package/dist/chunk-RT52EYG3.mjs +4 -0
- package/dist/chunk-SHYNWAW6.mjs +1 -0
- package/dist/chunk-SKBHY5MK.mjs +1 -0
- package/dist/chunk-SNTAAXXA.mjs +1 -0
- package/dist/chunk-T4O4PFJD.mjs +1 -0
- package/dist/chunk-TAQTZAVZ.js +1 -0
- package/dist/{chunk-2SGJZYQF.js → chunk-TDYWEVAE.js} +1 -1
- package/dist/{chunk-OPSOGVSU.js → chunk-TV6JLFY5.js} +1 -1
- package/dist/chunk-UKMKGIME.js +1 -0
- package/dist/chunk-UXPY65AC.js +1 -0
- package/dist/chunk-VDKSZ5BQ.mjs +1 -0
- package/dist/chunk-VJFIAFZ5.mjs +1 -0
- package/dist/chunk-WQRWRWSK.js +1 -0
- package/dist/chunk-WWVIVYX6.mjs +1 -0
- package/dist/chunk-WXSGCEBZ.js +1 -0
- package/dist/{chunk-C52D36FA.mjs → chunk-WYFK4QOF.mjs} +1 -1
- package/dist/chunk-X6AICTHN.js +1 -0
- package/dist/chunk-YHXVNJK5.mjs +1 -0
- package/dist/{chunk-J3YFJDZD.js → chunk-ZETEPB7I.js} +1 -1
- package/dist/{colorResolver-8A-qj-LP.d.ts → colorResolver-C696sd9x.d.ts} +1 -1
- package/dist/{colorResolver-BCvxTlLF.d.mts → colorResolver-DCBfI4ld.d.mts} +1 -1
- package/dist/{content-3xF4WDE8.d.mts → content-BlWiORm-.d.mts} +3 -147
- package/dist/{content-C8fc_tL6.d.ts → content-eG_Rtl0l.d.ts} +3 -147
- package/dist/{contentControlValues-DGDKD589.d.ts → contentControlValues-CO7pUqOf.d.ts} +1 -1
- package/dist/{contentControlValues-DjWvoJQ-.d.mts → contentControlValues-DfYN9BZ8.d.mts} +1 -1
- package/dist/core-plugins.d.mts +4 -3
- package/dist/core-plugins.d.ts +4 -3
- package/dist/core-plugins.js +1 -1
- package/dist/core-plugins.mjs +1 -1
- package/dist/core.d.mts +11 -10
- package/dist/core.d.ts +11 -10
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/{documentStyles-qR0VR2s0.d.mts → documentStyles-1G0xTl1v.d.mts} +1 -1
- package/dist/{documentStyles-C7k_8Sye.d.ts → documentStyles-Bw98BwEy.d.ts} +1 -1
- package/dist/docx/index.d.mts +7 -67
- package/dist/docx/index.d.ts +7 -67
- package/dist/docx/index.js +1 -1
- package/dist/docx/index.mjs +1 -1
- package/dist/docx/parser.d.mts +4 -3
- package/dist/docx/parser.d.ts +4 -3
- package/dist/docx/parser.js +1 -1
- package/dist/docx/parser.mjs +1 -1
- package/dist/docx/rezip.d.mts +4 -3
- package/dist/docx/rezip.d.ts +4 -3
- package/dist/docx/rezip.js +1 -1
- package/dist/docx/rezip.mjs +1 -1
- package/dist/docx/serializer/index.d.mts +5 -4
- package/dist/docx/serializer/index.d.ts +5 -4
- package/dist/docx/serializer/index.js +1 -1
- package/dist/docx/serializer/index.mjs +1 -1
- package/dist/editor/index.d.mts +4 -3
- package/dist/editor/index.d.ts +4 -3
- package/dist/editor/index.js +1 -1
- package/dist/editor/index.mjs +1 -1
- package/dist/{fontLoader-CUS1BPv7.d.mts → fontLoader-3MFD_Hj2.d.mts} +48 -5
- package/dist/{fontLoader-Dl9SEKex.d.ts → fontLoader-C6VvBUVB.d.ts} +48 -5
- package/dist/{formatting-BH4hcZiq.d.mts → formatting-DFtuRFQY.d.mts} +13 -0
- package/dist/{formatting-_OXU8gLB.d.ts → formatting-JhqWT_XM.d.ts} +13 -0
- package/dist/{headerFooterLayout-CU6hvszp.d.mts → headerFooterLayout-DJb-dV7X.d.mts} +2 -2
- package/dist/{headerFooterLayout-AtAOhM8E.d.ts → headerFooterLayout-bdHWlU6g.d.ts} +2 -2
- package/dist/headless.d.mts +9 -8
- package/dist/headless.d.ts +9 -8
- package/dist/headless.js +1 -1
- package/dist/headless.mjs +1 -1
- package/dist/layout-bridge/clickToPositionDom.js +1 -1
- package/dist/layout-bridge/clickToPositionDom.mjs +1 -1
- package/dist/layout-bridge/index.d.mts +5 -4
- package/dist/layout-bridge/index.d.ts +5 -4
- package/dist/layout-bridge/index.js +1 -1
- package/dist/layout-bridge/index.mjs +1 -1
- package/dist/layout-bridge/measuring/index.d.mts +3 -2
- package/dist/layout-bridge/measuring/index.d.ts +3 -2
- package/dist/layout-bridge/measuring/index.js +1 -1
- package/dist/layout-bridge/measuring/index.mjs +1 -1
- package/dist/layout-bridge/tableInsertHover.js +1 -1
- package/dist/layout-bridge/tableInsertHover.mjs +1 -1
- package/dist/layout-bridge/toFlowBlocks.d.mts +4 -3
- package/dist/layout-bridge/toFlowBlocks.d.ts +4 -3
- package/dist/layout-bridge/toFlowBlocks.js +1 -1
- package/dist/layout-bridge/toFlowBlocks.mjs +1 -1
- package/dist/layout-engine/index.d.mts +4 -3
- package/dist/layout-engine/index.d.ts +4 -3
- package/dist/layout-engine/index.js +1 -1
- package/dist/layout-engine/index.mjs +1 -1
- package/dist/layout-engine/types.d.mts +21 -9
- package/dist/layout-engine/types.d.ts +21 -9
- package/dist/layout-painter/index.d.mts +5 -4
- package/dist/layout-painter/index.d.ts +5 -4
- package/dist/layout-painter/index.js +1 -1
- package/dist/layout-painter/index.mjs +1 -1
- package/dist/layout-painter/renderPage.d.mts +5 -4
- package/dist/layout-painter/renderPage.d.ts +5 -4
- package/dist/layout-painter/renderPage.js +1 -1
- package/dist/layout-painter/renderPage.mjs +1 -1
- package/dist/lists-Bn29SzeS.d.ts +148 -0
- package/dist/lists-CyGxd5Y2.d.mts +148 -0
- package/dist/managers/AutoSaveManager.d.mts +4 -3
- package/dist/managers/AutoSaveManager.d.ts +4 -3
- package/dist/managers/TableSelectionManager.d.mts +4 -3
- package/dist/managers/TableSelectionManager.d.ts +4 -3
- package/dist/managers/types.d.mts +4 -3
- package/dist/managers/types.d.ts +4 -3
- package/dist/{marks-BY573yZn.d.mts → marks-CzrbFi4o.d.mts} +1 -1
- package/dist/{marks-CjC9tF5k.d.ts → marks-Dq1QsxKA.d.ts} +1 -1
- package/dist/mcp-cli.mjs +23 -23
- package/dist/mcp.d.mts +4 -3
- package/dist/mcp.d.ts +4 -3
- package/dist/mcp.js +3 -3
- package/dist/mcp.mjs +7 -7
- package/dist/{nodes-75Q9GBxV.d.ts → nodes-BJef4KFW.d.ts} +17 -2
- package/dist/{nodes-cEI7hVY2.d.mts → nodes-RfTS-NSv.d.mts} +17 -2
- package/dist/numberingParser-ZSQ3SDCV.d.ts +81 -0
- package/dist/numberingParser-nSPZlzKr.d.mts +81 -0
- package/dist/prosemirror/applyFormatting.d.mts +5 -2
- package/dist/prosemirror/applyFormatting.d.ts +5 -2
- package/dist/prosemirror/applyFormatting.js +1 -1
- package/dist/prosemirror/applyFormatting.mjs +1 -1
- package/dist/prosemirror/cellDragSelection.d.mts +46 -0
- package/dist/prosemirror/cellDragSelection.d.ts +46 -0
- package/dist/prosemirror/cellDragSelection.js +1 -0
- package/dist/prosemirror/cellDragSelection.mjs +1 -0
- package/dist/prosemirror/commands/formatting.d.mts +2 -2
- package/dist/prosemirror/commands/formatting.d.ts +2 -2
- package/dist/prosemirror/commands/formatting.js +1 -1
- package/dist/prosemirror/commands/formatting.mjs +1 -1
- package/dist/prosemirror/commands/index.d.mts +32 -3
- package/dist/prosemirror/commands/index.d.ts +32 -3
- package/dist/prosemirror/commands/index.js +1 -1
- package/dist/prosemirror/commands/index.mjs +1 -1
- package/dist/prosemirror/commands/paragraph.d.mts +11 -1
- package/dist/prosemirror/commands/paragraph.d.ts +11 -1
- package/dist/prosemirror/commands/paragraph.js +1 -1
- package/dist/prosemirror/commands/paragraph.mjs +1 -1
- package/dist/prosemirror/commentIdAllocator.d.mts +3 -2
- package/dist/prosemirror/commentIdAllocator.d.ts +3 -2
- package/dist/prosemirror/commentOps.d.mts +3 -2
- package/dist/prosemirror/commentOps.d.ts +3 -2
- package/dist/prosemirror/conversion/fromProseDoc.d.mts +4 -3
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +4 -3
- package/dist/prosemirror/conversion/fromProseDoc.js +1 -1
- package/dist/prosemirror/conversion/fromProseDoc.mjs +1 -1
- package/dist/prosemirror/conversion/index.d.mts +4 -3
- package/dist/prosemirror/conversion/index.d.ts +4 -3
- package/dist/prosemirror/conversion/index.js +1 -1
- package/dist/prosemirror/conversion/index.mjs +1 -1
- package/dist/prosemirror/editor.css +13 -0
- package/dist/prosemirror/extensions/index.d.mts +1 -1
- package/dist/prosemirror/extensions/index.d.ts +1 -1
- package/dist/prosemirror/extensions/index.js +1 -1
- package/dist/prosemirror/extensions/index.mjs +1 -1
- package/dist/prosemirror/extensions/nodes/TableExtension.js +1 -1
- package/dist/prosemirror/extensions/nodes/TableExtension.mjs +1 -1
- package/dist/prosemirror/imageCommit.d.mts +18 -1
- package/dist/prosemirror/imageCommit.d.ts +18 -1
- package/dist/prosemirror/imageCommit.js +1 -1
- package/dist/prosemirror/imageCommit.mjs +1 -1
- package/dist/prosemirror/index.d.mts +20 -10
- package/dist/prosemirror/index.d.ts +20 -10
- package/dist/prosemirror/index.js +3 -3
- package/dist/prosemirror/index.mjs +3 -3
- package/dist/prosemirror/plugins/index.d.mts +5 -4
- package/dist/prosemirror/plugins/index.d.ts +5 -4
- package/dist/prosemirror/plugins/index.js +1 -1
- package/dist/prosemirror/plugins/index.mjs +1 -1
- package/dist/prosemirror/plugins/selectionTracker.d.mts +1 -1
- package/dist/prosemirror/plugins/selectionTracker.d.ts +1 -1
- package/dist/prosemirror/queries.d.mts +45 -3
- package/dist/prosemirror/queries.d.ts +45 -3
- package/dist/prosemirror/queries.js +2 -2
- package/dist/prosemirror/queries.mjs +2 -2
- package/dist/prosemirror/schema/index.d.mts +5 -4
- package/dist/prosemirror/schema/index.d.ts +5 -4
- package/dist/prosemirror/schema/index.js +1 -1
- package/dist/prosemirror/schema/index.mjs +1 -1
- package/dist/prosemirror/styles/index.d.mts +2 -2
- package/dist/prosemirror/styles/index.d.ts +2 -2
- package/dist/prosemirror/tableResize.js +1 -1
- package/dist/prosemirror/tableResize.mjs +1 -1
- package/dist/prosemirror/utils/extractTrackedChanges.d.mts +3 -2
- package/dist/prosemirror/utils/extractTrackedChanges.d.ts +3 -2
- package/dist/prosemirror/utils/extractTrackedChanges.js +1 -1
- package/dist/prosemirror/utils/extractTrackedChanges.mjs +1 -1
- package/dist/{sectionPropertiesSerializer-D86QlzlT.d.mts → sectionPropertiesSerializer-C8XCmzE4.d.mts} +1 -1
- package/dist/{sectionPropertiesSerializer-uXyGONxu.d.ts → sectionPropertiesSerializer-S8J1V9mb.d.ts} +1 -1
- package/dist/{selectionContext-BPAqgNgk.d.ts → selectionContext-BJZZW1JA.d.ts} +1 -1
- package/dist/{selectionContext-CoZat7QZ.d.mts → selectionContext-BjMyVQZO.d.mts} +1 -1
- package/dist/{styles-BOJ93SAm.d.mts → styles-Dqec8Aw6.d.mts} +1 -1
- package/dist/{styles-BWqX2AS-.d.ts → styles-gEujs7j6.d.ts} +1 -1
- package/dist/types/agentApi.d.mts +1 -1
- package/dist/types/agentApi.d.ts +1 -1
- package/dist/types/content.d.mts +3 -2
- package/dist/types/content.d.ts +3 -2
- package/dist/types/document.d.mts +7 -5
- package/dist/types/document.d.ts +7 -5
- package/dist/utils/comments.d.mts +3 -2
- package/dist/utils/comments.d.ts +3 -2
- package/dist/utils/index.d.mts +6 -5
- package/dist/utils/index.d.ts +6 -5
- package/dist/utils/index.js +3 -3
- package/dist/utils/index.mjs +3 -3
- package/dist/{variableDetector-CaY-sDau.d.mts → variableDetector-CN9_pUR_.d.mts} +1 -1
- package/dist/{variableDetector-1mxzPfs2.d.ts → variableDetector-o4Rb2Csy.d.ts} +1 -1
- package/package.json +9 -1
- package/dist/chunk-2WGTGBBS.js +0 -2
- package/dist/chunk-3G44SFHX.mjs +0 -4
- package/dist/chunk-4MYKVWNF.js +0 -1
- package/dist/chunk-7KMTWDPE.mjs +0 -1
- package/dist/chunk-7LRR7RKE.mjs +0 -15
- package/dist/chunk-CRMZH7U7.mjs +0 -2
- package/dist/chunk-D3PRIF3Y.mjs +0 -1
- package/dist/chunk-ESCPS4AO.mjs +0 -1
- package/dist/chunk-EUZLYQRB.mjs +0 -1
- package/dist/chunk-EV4LVK4X.js +0 -1
- package/dist/chunk-FW23IMBF.mjs +0 -1
- package/dist/chunk-HKN2NKOG.mjs +0 -1
- package/dist/chunk-INDYZOOS.js +0 -1
- package/dist/chunk-IUJCUITW.mjs +0 -1
- package/dist/chunk-IYKBX24M.js +0 -1
- package/dist/chunk-JHTURDPX.mjs +0 -1
- package/dist/chunk-L5NPEM7C.js +0 -1
- package/dist/chunk-LERLET2D.js +0 -4
- package/dist/chunk-LX35TFGF.mjs +0 -1
- package/dist/chunk-MNOHUTKE.js +0 -15
- package/dist/chunk-NAFMAKLK.js +0 -2
- package/dist/chunk-OTHV7YV2.js +0 -2
- package/dist/chunk-QAJSNLJR.mjs +0 -1
- package/dist/chunk-RSU4HTC6.js +0 -1
- package/dist/chunk-TUIEV7Q7.js +0 -1
- package/dist/chunk-U67MWOPZ.mjs +0 -1
- package/dist/chunk-UE2ZKRYB.mjs +0 -2
- package/dist/chunk-WVERBZZU.js +0 -1
- package/dist/chunk-WWNOXNEX.mjs +0 -2
- package/dist/chunk-XLB6AC5Q.js +0 -1
- package/dist/chunk-YPQACU4A.js +0 -1
- package/dist/chunk-YWM2QH36.js +0 -1
- package/dist/chunk-ZX26QZJ5.mjs +0 -1
package/dist/mcp.d.mts
CHANGED
|
@@ -22,11 +22,12 @@
|
|
|
22
22
|
import { M as McpToolDefinition, e as McpSession, J as JsonSchema } from './types-DTF0N7UE.mjs';
|
|
23
23
|
import './types/document.mjs';
|
|
24
24
|
import './colors-C3vA7HUU.mjs';
|
|
25
|
-
import './formatting-
|
|
26
|
-
import './
|
|
25
|
+
import './formatting-DFtuRFQY.mjs';
|
|
26
|
+
import './lists-CyGxd5Y2.mjs';
|
|
27
|
+
import './content-BlWiORm-.mjs';
|
|
27
28
|
import './docx/wrapTypes.mjs';
|
|
28
29
|
import './watermark-DAcnAs_J.mjs';
|
|
29
|
-
import './styles-
|
|
30
|
+
import './styles-Dqec8Aw6.mjs';
|
|
30
31
|
import './types/agentApi.mjs';
|
|
31
32
|
|
|
32
33
|
/**
|
package/dist/mcp.d.ts
CHANGED
|
@@ -22,11 +22,12 @@
|
|
|
22
22
|
import { M as McpToolDefinition, e as McpSession, J as JsonSchema } from './types-DDQWU7-j.js';
|
|
23
23
|
import './types/document.js';
|
|
24
24
|
import './colors-C3vA7HUU.js';
|
|
25
|
-
import './formatting-
|
|
26
|
-
import './
|
|
25
|
+
import './formatting-JhqWT_XM.js';
|
|
26
|
+
import './lists-Bn29SzeS.js';
|
|
27
|
+
import './content-eG_Rtl0l.js';
|
|
27
28
|
import './docx/wrapTypes.js';
|
|
28
29
|
import './watermark-DAcnAs_J.js';
|
|
29
|
-
import './styles-
|
|
30
|
+
import './styles-gEujs7j6.js';
|
|
30
31
|
import './types/agentApi.js';
|
|
31
32
|
|
|
32
33
|
/**
|
package/dist/mcp.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
'use strict';var chunkTE2AF7FM_js=require('./chunk-TE2AF7FM.js'),
|
|
1
|
+
'use strict';var chunkTE2AF7FM_js=require('./chunk-TE2AF7FM.js'),chunkJQUIUKRO_js=require('./chunk-JQUIUKRO.js');require('./chunk-4JPHW7ZI.js');var chunk4BFNWPKW_js=require('./chunk-4BFNWPKW.js'),chunkP7HWOJC5_js=require('./chunk-P7HWOJC5.js');require('./chunk-AA6D2C6R.js'),require('./chunk-FIGLFSNR.js'),require('./chunk-QVRMX2AC.js'),require('./chunk-O2643IUW.js'),require('./chunk-Z3LGMBJC.js'),require('./chunk-C2BAPYGJ.js'),require('./chunk-4Q2IP5FW.js'),require('./chunk-GSKMHXHG.js'),require('./chunk-H57LNDBH.js'),require('./chunk-3R7QHNI5.js'),require('./chunk-DC7S76ZX.js');var u={type:"string",description:"Document ID returned from docx_load"},x={type:"object",properties:{paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)",minimum:0},offset:{type:"number",description:"Character offset within the paragraph",minimum:0}},required:["paragraphIndex","offset"]},h={type:"object",properties:{start:x,end:x},required:["start","end"]},D={name:"docx_load",description:`Load a DOCX document from base64-encoded content.
|
|
2
2
|
Returns a document ID that can be used with other tools.
|
|
3
|
-
The document remains in session memory until closed.`,inputSchema:{type:"object",properties:{content:{type:"string",description:"Base64-encoded DOCX file content"},source:{type:"string",description:"Optional source filename or identifier for reference"}},required:["content"]},handler:async(r,s)=>{let{content:e,source:c}=r;try{let t=atob(e),n=new Uint8Array(t.length);for(let l=0;l<t.length;l++)n[l]=t.charCodeAt(l);let o=n.buffer,a=await
|
|
4
|
-
Returns the document as a base64 string that can be saved to a file.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(r,s)=>{let{documentId:e}=r,c=s.session.documents.get(e);if(!c)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let t;c.buffer?t=await
|
|
3
|
+
The document remains in session memory until closed.`,inputSchema:{type:"object",properties:{content:{type:"string",description:"Base64-encoded DOCX file content"},source:{type:"string",description:"Optional source filename or identifier for reference"}},required:["content"]},handler:async(r,s)=>{let{content:e,source:c}=r;try{let t=atob(e),n=new Uint8Array(t.length);for(let l=0;l<t.length;l++)n[l]=t.charCodeAt(l);let o=n.buffer,a=await chunkP7HWOJC5_js.a(o),d=`doc_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;s.session.documents.set(d,{id:d,document:a,buffer:o,source:c,lastModified:Date.now()});let p=a.package.document.content.filter(l=>l.type==="paragraph").length;return {content:[{type:"text",text:JSON.stringify({documentId:d,source:c,paragraphCount:p,message:"Document loaded successfully"})}]}}catch(t){return {isError:true,content:[{type:"text",text:`Failed to load document: ${t.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},C={name:"docx_save",description:`Export the document to base64-encoded DOCX format.
|
|
4
|
+
Returns the document as a base64 string that can be saved to a file.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(r,s)=>{let{documentId:e}=r,c=s.session.documents.get(e);if(!c)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let t;c.buffer?t=await chunkJQUIUKRO_js.i(c.document):t=await chunkJQUIUKRO_js.t(c.document);let n=new Uint8Array(t),o="";for(let d=0;d<n.length;d++)o+=String.fromCharCode(n[d]);let a=btoa(o);return {content:[{type:"text",text:JSON.stringify({documentId:e,base64:a,size:t.byteLength,message:"Document exported successfully"})}]}}catch(t){return {isError:true,content:[{type:"text",text:`Failed to save document: ${t.message}`}]}}},annotations:{category:"core",readOnly:true,complexity:"low"}},R={name:"docx_close",description:`Close a document and free its memory.
|
|
5
5
|
Use this when done working with a document.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(r,s)=>{let{documentId:e}=r;return s.session.documents.has(e)?(s.session.documents.delete(e),{content:[{type:"text",text:JSON.stringify({documentId:e,message:"Document closed"})}]}):{isError:true,content:[{type:"text",text:`Document not found: ${e}`}]}},annotations:{category:"core",readOnly:false,complexity:"low"}},k={name:"docx_get_info",description:`Get metadata and statistics about a document.
|
|
6
6
|
Returns paragraph count, word count, table count, and other useful info.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(r,s)=>{let{documentId:e}=r,c=s.session.documents.get(e);if(!c)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};let t=c.document,n=t.package.document,o=n.content.filter(p=>p.type==="paragraph"),a=n.content.filter(p=>p.type==="table"),d=0;for(let p of o)if(p.type==="paragraph"){let l=P(p);d+=l.split(/\s+/).filter(y=>y.length>0).length;}return {content:[{type:"text",text:JSON.stringify({documentId:e,paragraphCount:o.length,tableCount:a.length,wordCount:d,hasStyles:!!t.package.styles,hasTheme:!!t.package.theme,source:c.source,lastModified:c.lastModified})}]}},annotations:{category:"core",readOnly:true,complexity:"low"}},$={name:"docx_get_text",description:`Get the plain text content of the document.
|
|
7
7
|
Returns all text concatenated with paragraph breaks.
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {a}from'./chunk-CUY2THAO.mjs';import {i,t}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-CUY2THAO.mjs';import {i,t}from'./chunk-F24WZXN4.mjs';import'./chunk-2LVK7EF5.mjs';import {b}from'./chunk-3NRMSZX2.mjs';import {a}from'./chunk-3HENAL6V.mjs';import'./chunk-RT52EYG3.mjs';import'./chunk-MOCGHQ4A.mjs';import'./chunk-CDBKFBC2.mjs';import'./chunk-AMJNIGO2.mjs';import'./chunk-W77JXDEV.mjs';import'./chunk-LE67NTCN.mjs';import'./chunk-VW22RZ6C.mjs';import'./chunk-DI6CRWSW.mjs';import'./chunk-VJFIAFZ5.mjs';import'./chunk-3ANZ3252.mjs';import'./chunk-QYUPLKLP.mjs';var u={type:"string",description:"Document ID returned from docx_load"},x={type:"object",properties:{paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)",minimum:0},offset:{type:"number",description:"Character offset within the paragraph",minimum:0}},required:["paragraphIndex","offset"]},h={type:"object",properties:{start:x,end:x},required:["start","end"]},D={name:"docx_load",description:`Load a DOCX document from base64-encoded content.
|
|
2
2
|
Returns a document ID that can be used with other tools.
|
|
3
|
-
The document remains in session memory until closed.`,inputSchema:{type:"object",properties:{content:{type:"string",description:"Base64-encoded DOCX file content"},source:{type:"string",description:"Optional source filename or identifier for reference"}},required:["content"]},handler:async(r,s)=>{let{content:e,source:c}=r;try{let t=atob(e),n=new Uint8Array(t.length);for(let l=0;l<t.length;l++)n[l]=t.charCodeAt(l);let o=n.buffer,a=await
|
|
3
|
+
The document remains in session memory until closed.`,inputSchema:{type:"object",properties:{content:{type:"string",description:"Base64-encoded DOCX file content"},source:{type:"string",description:"Optional source filename or identifier for reference"}},required:["content"]},handler:async(r,s)=>{let{content:e,source:c}=r;try{let t=atob(e),n=new Uint8Array(t.length);for(let l=0;l<t.length;l++)n[l]=t.charCodeAt(l);let o=n.buffer,a$1=await a(o),d=`doc_${Date.now()}_${Math.random().toString(36).substr(2,9)}`;s.session.documents.set(d,{id:d,document:a$1,buffer:o,source:c,lastModified:Date.now()});let p=a$1.package.document.content.filter(l=>l.type==="paragraph").length;return {content:[{type:"text",text:JSON.stringify({documentId:d,source:c,paragraphCount:p,message:"Document loaded successfully"})}]}}catch(t){return {isError:true,content:[{type:"text",text:`Failed to load document: ${t.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},C={name:"docx_save",description:`Export the document to base64-encoded DOCX format.
|
|
4
4
|
Returns the document as a base64 string that can be saved to a file.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(r,s)=>{let{documentId:e}=r,c=s.session.documents.get(e);if(!c)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let t$1;c.buffer?t$1=await i(c.document):t$1=await t(c.document);let n=new Uint8Array(t$1),o="";for(let d=0;d<n.length;d++)o+=String.fromCharCode(n[d]);let a=btoa(o);return {content:[{type:"text",text:JSON.stringify({documentId:e,base64:a,size:t$1.byteLength,message:"Document exported successfully"})}]}}catch(t){return {isError:true,content:[{type:"text",text:`Failed to save document: ${t.message}`}]}}},annotations:{category:"core",readOnly:true,complexity:"low"}},R={name:"docx_close",description:`Close a document and free its memory.
|
|
5
5
|
Use this when done working with a document.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(r,s)=>{let{documentId:e}=r;return s.session.documents.has(e)?(s.session.documents.delete(e),{content:[{type:"text",text:JSON.stringify({documentId:e,message:"Document closed"})}]}):{isError:true,content:[{type:"text",text:`Document not found: ${e}`}]}},annotations:{category:"core",readOnly:false,complexity:"low"}},k={name:"docx_get_info",description:`Get metadata and statistics about a document.
|
|
6
6
|
Returns paragraph count, word count, table count, and other useful info.`,inputSchema:{type:"object",properties:{documentId:u},required:["documentId"]},handler:async(r,s)=>{let{documentId:e}=r,c=s.session.documents.get(e);if(!c)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};let t=c.document,n=t.package.document,o=n.content.filter(p=>p.type==="paragraph"),a=n.content.filter(p=>p.type==="table"),d=0;for(let p of o)if(p.type==="paragraph"){let l=P(p);d+=l.split(/\s+/).filter(y=>y.length>0).length;}return {content:[{type:"text",text:JSON.stringify({documentId:e,paragraphCount:o.length,tableCount:a.length,wordCount:d,hasStyles:!!t.package.styles,hasTheme:!!t.package.theme,source:c.source,lastModified:c.lastModified})}]}},annotations:{category:"core",readOnly:true,complexity:"low"}},$={name:"docx_get_text",description:`Get the plain text content of the document.
|
|
@@ -8,9 +8,9 @@ Returns all text concatenated with paragraph breaks.
|
|
|
8
8
|
Useful for understanding document content before making edits.`,inputSchema:{type:"object",properties:{documentId:u,maxLength:{type:"number",description:"Maximum characters to return (default: 10000)",default:1e4}},required:["documentId"]},handler:async(r,s)=>{let{documentId:e,maxLength:c=1e4}=r,t=s.session.documents.get(e);if(!t)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};let n=t.document.package.document,o=[];for(let p of n.content)p.type==="paragraph"?o.push(P(p)):p.type==="table"&&o.push("[TABLE]");let a=o.join(`
|
|
9
9
|
`),d=a.length>c;return d&&(a=a.slice(0,c)+"..."),{content:[{type:"text",text:JSON.stringify({documentId:e,text:a,truncated:d,totalLength:d?o.join(`
|
|
10
10
|
`).length:a.length})}]}},annotations:{category:"core",readOnly:true,complexity:"low"}},J={name:"docx_insert_text",description:`Insert text at a specific position in the document.
|
|
11
|
-
Position is specified by paragraph index (0-indexed) and character offset.`,inputSchema:{type:"object",properties:{documentId:u,position:x,text:{type:"string",description:"Text to insert"}},required:["documentId","position","text"]},handler:async(r,s)=>{let{documentId:e,position:c,text:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=a(n.document,{type:"insertText",position:c,text:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,insertedLength:t.length,position:c})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to insert text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},v={name:"docx_replace_text",description:`Replace text in a range with new text.
|
|
12
|
-
Specify start and end positions to define the range to replace.`,inputSchema:{type:"object",properties:{documentId:u,range:h,text:{type:"string",description:"Replacement text"}},required:["documentId","range","text"]},handler:async(r,s)=>{let{documentId:e,range:c,text:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=a(n.document,{type:"replaceText",range:c,text:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,replacedRange:c,newTextLength:t.length})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to replace text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},j={name:"docx_delete_text",description:`Delete text in a range.
|
|
13
|
-
Specify start and end positions to define the range to delete.`,inputSchema:{type:"object",properties:{documentId:u,range:h},required:["documentId","range"]},handler:async(r,s)=>{let{documentId:e,range:c}=r,t=s.session.documents.get(e);if(!t)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let n=a(t.document,{type:"deleteText",range:c});return t.document=n,t.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,deletedRange:c})}]}}catch(n){return {isError:true,content:[{type:"text",text:`Failed to delete text: ${n.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},E={name:"docx_format_text",description:`Apply formatting to text in a range.
|
|
14
|
-
Supports bold, italic, underline, font size, font family, color, and highlight.`,inputSchema:{type:"object",properties:{documentId:u,range:h,formatting:{type:"object",description:"Formatting options to apply",properties:{bold:{type:"boolean"},italic:{type:"boolean"},underline:{type:"boolean"},strikethrough:{type:"boolean"},fontSize:{type:"number",description:"Font size in points"},fontFamily:{type:"string"},color:{type:"string",description:'Hex color (e.g., "#FF0000")'},highlight:{type:"string",description:"Highlight color name"}}}},required:["documentId","range","formatting"]},handler:async(r,s)=>{let{documentId:e,range:c,formatting:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=a(n.document,{type:"formatText",range:c,formatting:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,range:c,appliedFormatting:t})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to format text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"medium"}},O={name:"docx_apply_style",description:`Apply a named style to a paragraph.
|
|
15
|
-
Use document styles like "Heading1", "Heading2", "Normal", etc.`,inputSchema:{type:"object",properties:{documentId:u,paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)",minimum:0},styleId:{type:"string",description:'Style ID (e.g., "Heading1", "Normal")'}},required:["documentId","paragraphIndex","styleId"]},handler:async(r,s)=>{let{documentId:e,paragraphIndex:c,styleId:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=a(n.document,{type:"applyStyle",paragraphIndex:c,styleId:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,paragraphIndex:c,styleId:t})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to apply style: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}};function P(r){let s=[];for(let e of r.content)e.type==="run"?s.push(_(e)):e.type==="hyperlink"&&s.push(A(e));return s.join("")}function _(r){return r.content.filter(s=>s.type==="text").map(s=>s.text).join("")}function A(r){let s=[];for(let e of r.children)e.type==="run"&&s.push(_(e));return s.join("")}var T=[D,C,R,k,$,J,v,j,E,O];function q(r={}){let{name:s="docx-editor",version:e="0.1.0",includeCoreTools:c=true,debug:t=false,additionalTools:n=[]}=r,o=new Map,a={id:`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,documents:new Map,data:new Map};if(c)for(let i of T)o.set(i.name,i),t&&console.log(`[MCP] Registered core tool: ${i.name}`);let d=b.getMcpTools();for(let i of d)o.has(i.name)&&console.warn(`[MCP] Tool '${i.name}' from plugin overrides existing tool`),o.set(i.name,i),t&&console.log(`[MCP] Registered plugin tool: ${i.name}`);for(let i of n)o.set(i.name,i),t&&console.log(`[MCP] Registered additional tool: ${i.name}`);let p=t?(i,f)=>{console.log(`[MCP] ${i}`,f??"");}:()=>{};async function l(i,f){let M=o.get(i);if(!M)throw new Error(`Unknown tool: ${i}`);p(`Calling tool: ${i}`,f);let N={session:a,log:p};try{let g=await M.handler(f,N);return p(`Tool ${i} completed`,g),g}catch(g){throw p(`Tool ${i} failed`,g),g}}function y(){return Array.from(o.values()).map(i=>({name:i.name,description:i.description,inputSchema:z(i.inputSchema),category:i.annotations?.category}))}function L(){return {name:s,version:e,toolCount:o.size}}return {tools:o,session:a,handleToolCall:l,listTools:y,getInfo:L}}async function F(r,s){let{id:e,method:c,params:t}=s;try{switch(c){case "initialize":return {jsonrpc:"2.0",id:e,result:{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:r.getInfo()}};case "tools/list":{let n=r.listTools();return {jsonrpc:"2.0",id:e,result:{tools:n.map(o=>({name:o.name,description:o.description,inputSchema:o.inputSchema}))}}}case "tools/call":{let{name:n,arguments:o}=t,a=await r.handleToolCall(n,o);return {jsonrpc:"2.0",id:e,result:a}}default:return {jsonrpc:"2.0",id:e,error:{code:-32601,message:`Method not found: ${c}`}}}}catch(n){return {jsonrpc:"2.0",id:e,error:{code:-32e3,message:n.message}}}}async function H(r={}){let s=q(r);r.debug&&(console.error(`[MCP] Server started: ${s.getInfo().name} v${s.getInfo().version}`),console.error(`[MCP] Tools registered: ${s.tools.size}`));let c=(await import('readline')).createInterface({input:process.stdin,output:process.stdout,terminal:false}),t="";c.on("line",async n=>{t+=n;try{let o=JSON.parse(t);t="";let a=await F(s,o);process.stdout.write(JSON.stringify(a)+`
|
|
11
|
+
Position is specified by paragraph index (0-indexed) and character offset.`,inputSchema:{type:"object",properties:{documentId:u,position:x,text:{type:"string",description:"Text to insert"}},required:["documentId","position","text"]},handler:async(r,s)=>{let{documentId:e,position:c,text:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=a$1(n.document,{type:"insertText",position:c,text:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,insertedLength:t.length,position:c})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to insert text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},v={name:"docx_replace_text",description:`Replace text in a range with new text.
|
|
12
|
+
Specify start and end positions to define the range to replace.`,inputSchema:{type:"object",properties:{documentId:u,range:h,text:{type:"string",description:"Replacement text"}},required:["documentId","range","text"]},handler:async(r,s)=>{let{documentId:e,range:c,text:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=a$1(n.document,{type:"replaceText",range:c,text:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,replacedRange:c,newTextLength:t.length})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to replace text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},j={name:"docx_delete_text",description:`Delete text in a range.
|
|
13
|
+
Specify start and end positions to define the range to delete.`,inputSchema:{type:"object",properties:{documentId:u,range:h},required:["documentId","range"]},handler:async(r,s)=>{let{documentId:e,range:c}=r,t=s.session.documents.get(e);if(!t)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let n=a$1(t.document,{type:"deleteText",range:c});return t.document=n,t.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,deletedRange:c})}]}}catch(n){return {isError:true,content:[{type:"text",text:`Failed to delete text: ${n.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}},E={name:"docx_format_text",description:`Apply formatting to text in a range.
|
|
14
|
+
Supports bold, italic, underline, font size, font family, color, and highlight.`,inputSchema:{type:"object",properties:{documentId:u,range:h,formatting:{type:"object",description:"Formatting options to apply",properties:{bold:{type:"boolean"},italic:{type:"boolean"},underline:{type:"boolean"},strikethrough:{type:"boolean"},fontSize:{type:"number",description:"Font size in points"},fontFamily:{type:"string"},color:{type:"string",description:'Hex color (e.g., "#FF0000")'},highlight:{type:"string",description:"Highlight color name"}}}},required:["documentId","range","formatting"]},handler:async(r,s)=>{let{documentId:e,range:c,formatting:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=a$1(n.document,{type:"formatText",range:c,formatting:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,range:c,appliedFormatting:t})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to format text: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"medium"}},O={name:"docx_apply_style",description:`Apply a named style to a paragraph.
|
|
15
|
+
Use document styles like "Heading1", "Heading2", "Normal", etc.`,inputSchema:{type:"object",properties:{documentId:u,paragraphIndex:{type:"number",description:"Index of the paragraph (0-indexed)",minimum:0},styleId:{type:"string",description:'Style ID (e.g., "Heading1", "Normal")'}},required:["documentId","paragraphIndex","styleId"]},handler:async(r,s)=>{let{documentId:e,paragraphIndex:c,styleId:t}=r,n=s.session.documents.get(e);if(!n)return {isError:true,content:[{type:"text",text:`Document not found: ${e}`}]};try{let o=a$1(n.document,{type:"applyStyle",paragraphIndex:c,styleId:t});return n.document=o,n.lastModified=Date.now(),{content:[{type:"text",text:JSON.stringify({success:!0,paragraphIndex:c,styleId:t})}]}}catch(o){return {isError:true,content:[{type:"text",text:`Failed to apply style: ${o.message}`}]}}},annotations:{category:"core",readOnly:false,complexity:"low"}};function P(r){let s=[];for(let e of r.content)e.type==="run"?s.push(_(e)):e.type==="hyperlink"&&s.push(A(e));return s.join("")}function _(r){return r.content.filter(s=>s.type==="text").map(s=>s.text).join("")}function A(r){let s=[];for(let e of r.children)e.type==="run"&&s.push(_(e));return s.join("")}var T=[D,C,R,k,$,J,v,j,E,O];function q(r={}){let{name:s="docx-editor",version:e="0.1.0",includeCoreTools:c=true,debug:t=false,additionalTools:n=[]}=r,o=new Map,a={id:`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,documents:new Map,data:new Map};if(c)for(let i of T)o.set(i.name,i),t&&console.log(`[MCP] Registered core tool: ${i.name}`);let d=b.getMcpTools();for(let i of d)o.has(i.name)&&console.warn(`[MCP] Tool '${i.name}' from plugin overrides existing tool`),o.set(i.name,i),t&&console.log(`[MCP] Registered plugin tool: ${i.name}`);for(let i of n)o.set(i.name,i),t&&console.log(`[MCP] Registered additional tool: ${i.name}`);let p=t?(i,f)=>{console.log(`[MCP] ${i}`,f??"");}:()=>{};async function l(i,f){let M=o.get(i);if(!M)throw new Error(`Unknown tool: ${i}`);p(`Calling tool: ${i}`,f);let N={session:a,log:p};try{let g=await M.handler(f,N);return p(`Tool ${i} completed`,g),g}catch(g){throw p(`Tool ${i} failed`,g),g}}function y(){return Array.from(o.values()).map(i=>({name:i.name,description:i.description,inputSchema:z(i.inputSchema),category:i.annotations?.category}))}function L(){return {name:s,version:e,toolCount:o.size}}return {tools:o,session:a,handleToolCall:l,listTools:y,getInfo:L}}async function F(r,s){let{id:e,method:c,params:t}=s;try{switch(c){case "initialize":return {jsonrpc:"2.0",id:e,result:{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:r.getInfo()}};case "tools/list":{let n=r.listTools();return {jsonrpc:"2.0",id:e,result:{tools:n.map(o=>({name:o.name,description:o.description,inputSchema:o.inputSchema}))}}}case "tools/call":{let{name:n,arguments:o}=t,a=await r.handleToolCall(n,o);return {jsonrpc:"2.0",id:e,result:a}}default:return {jsonrpc:"2.0",id:e,error:{code:-32601,message:`Method not found: ${c}`}}}}catch(n){return {jsonrpc:"2.0",id:e,error:{code:-32e3,message:n.message}}}}async function H(r={}){let s=q(r);r.debug&&(console.error(`[MCP] Server started: ${s.getInfo().name} v${s.getInfo().version}`),console.error(`[MCP] Tools registered: ${s.tools.size}`));let c=(await import('readline')).createInterface({input:process.stdin,output:process.stdout,terminal:false}),t="";c.on("line",async n=>{t+=n;try{let o=JSON.parse(t);t="";let a=await F(s,o);process.stdout.write(JSON.stringify(a)+`
|
|
16
16
|
`);}catch{}}),c.on("close",()=>{r.debug&&console.error("[MCP] Server closed"),process.exit(0);});}function z(r){return typeof r=="object"&&r!==null&&("type"in r||"properties"in r)?r:{type:"object",properties:{}}}export{O as applyStyleTool,R as closeDocumentTool,T as coreMcpTools,q as createMcpServer,j as deleteTextTool,E as formatTextTool,k as getDocumentInfoTool,$ as getDocumentTextTool,F as handleJsonRpcRequest,J as insertTextTool,D as loadDocumentTool,v as replaceTextTool,C as saveDocumentTool,H as startStdioServer};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { B as BorderSpec, S as ShadingProperties } from './colors-C3vA7HUU.js';
|
|
2
|
-
import { d as ParagraphAlignment, L as LineSpacingRule, S as SpacingExplicit, e as TabStop, T as TextFormatting, P as ParagraphFormatting, F as FloatingTableProperties, f as TableLook, a as TableFormatting, c as TableCellFormatting, b as TableRowFormatting } from './formatting-
|
|
3
|
-
import { N as NumberFormat
|
|
2
|
+
import { d as ParagraphAlignment, L as LineSpacingRule, S as SpacingExplicit, e as TabStop, T as TextFormatting, P as ParagraphFormatting, F as FloatingTableProperties, f as TableLook, a as TableFormatting, c as TableCellFormatting, b as TableRowFormatting } from './formatting-JhqWT_XM.js';
|
|
3
|
+
import { N as NumberFormat } from './lists-Bn29SzeS.js';
|
|
4
4
|
import { WrapType } from './docx/wrapTypes.js';
|
|
5
|
+
import { S as SectionProperties, R as RevisionInfo, a as ParagraphPropertyChange, b as TablePropertyChange, c as TableCellPropertyChange, d as TableRowPropertyChange } from './content-eG_Rtl0l.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Paragraph node attributes - maps to ParagraphFormatting
|
|
@@ -24,6 +25,18 @@ interface ParagraphAttrs {
|
|
|
24
25
|
numId?: number;
|
|
25
26
|
ilvl?: number;
|
|
26
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* The style-sourced numPr value when `numPr` came from the paragraph
|
|
30
|
+
* style rather than direct formatting. While `numPr` still equals this,
|
|
31
|
+
* fromProseDoc omits it from serialized formatting (writing it as direct
|
|
32
|
+
* `<w:numPr>` would flip Word's level-indent precedence on reload). List
|
|
33
|
+
* commands that change `numPr` make the values diverge, which re-enables
|
|
34
|
+
* direct serialization — no explicit clearing needed.
|
|
35
|
+
*/
|
|
36
|
+
numPrFromStyle?: {
|
|
37
|
+
numId?: number;
|
|
38
|
+
ilvl?: number;
|
|
39
|
+
};
|
|
27
40
|
/** List number format (decimal, lowerRoman, upperRoman, etc.) for CSS counter styling */
|
|
28
41
|
listNumFmt?: NumberFormat;
|
|
29
42
|
/** Whether this is a bullet list */
|
|
@@ -205,6 +218,8 @@ interface TableAttrs {
|
|
|
205
218
|
justification?: 'left' | 'center' | 'right';
|
|
206
219
|
/** Column widths (in twips) from w:tblGrid */
|
|
207
220
|
columnWidths?: number[];
|
|
221
|
+
/** Table layout (`w:tblLayout` type). `fixed` makes Word honor explicit widths. */
|
|
222
|
+
tableLayout?: 'fixed' | 'autofit' | null;
|
|
208
223
|
/** Floating table properties (w:tblpPr) */
|
|
209
224
|
floating?: FloatingTableProperties;
|
|
210
225
|
/** Default cell margins for the table (w:tblCellMar), in twips */
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { B as BorderSpec, S as ShadingProperties } from './colors-C3vA7HUU.mjs';
|
|
2
|
-
import { d as ParagraphAlignment, L as LineSpacingRule, S as SpacingExplicit, e as TabStop, T as TextFormatting, P as ParagraphFormatting, F as FloatingTableProperties, f as TableLook, a as TableFormatting, c as TableCellFormatting, b as TableRowFormatting } from './formatting-
|
|
3
|
-
import { N as NumberFormat
|
|
2
|
+
import { d as ParagraphAlignment, L as LineSpacingRule, S as SpacingExplicit, e as TabStop, T as TextFormatting, P as ParagraphFormatting, F as FloatingTableProperties, f as TableLook, a as TableFormatting, c as TableCellFormatting, b as TableRowFormatting } from './formatting-DFtuRFQY.mjs';
|
|
3
|
+
import { N as NumberFormat } from './lists-CyGxd5Y2.mjs';
|
|
4
4
|
import { WrapType } from './docx/wrapTypes.mjs';
|
|
5
|
+
import { S as SectionProperties, R as RevisionInfo, a as ParagraphPropertyChange, b as TablePropertyChange, c as TableCellPropertyChange, d as TableRowPropertyChange } from './content-BlWiORm-.mjs';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Paragraph node attributes - maps to ParagraphFormatting
|
|
@@ -24,6 +25,18 @@ interface ParagraphAttrs {
|
|
|
24
25
|
numId?: number;
|
|
25
26
|
ilvl?: number;
|
|
26
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* The style-sourced numPr value when `numPr` came from the paragraph
|
|
30
|
+
* style rather than direct formatting. While `numPr` still equals this,
|
|
31
|
+
* fromProseDoc omits it from serialized formatting (writing it as direct
|
|
32
|
+
* `<w:numPr>` would flip Word's level-indent precedence on reload). List
|
|
33
|
+
* commands that change `numPr` make the values diverge, which re-enables
|
|
34
|
+
* direct serialization — no explicit clearing needed.
|
|
35
|
+
*/
|
|
36
|
+
numPrFromStyle?: {
|
|
37
|
+
numId?: number;
|
|
38
|
+
ilvl?: number;
|
|
39
|
+
};
|
|
27
40
|
/** List number format (decimal, lowerRoman, upperRoman, etc.) for CSS counter styling */
|
|
28
41
|
listNumFmt?: NumberFormat;
|
|
29
42
|
/** Whether this is a bullet list */
|
|
@@ -205,6 +218,8 @@ interface TableAttrs {
|
|
|
205
218
|
justification?: 'left' | 'center' | 'right';
|
|
206
219
|
/** Column widths (in twips) from w:tblGrid */
|
|
207
220
|
columnWidths?: number[];
|
|
221
|
+
/** Table layout (`w:tblLayout` type). `fixed` makes Word honor explicit widths. */
|
|
222
|
+
tableLayout?: 'fixed' | 'autofit' | null;
|
|
208
223
|
/** Floating table properties (w:tblpPr) */
|
|
209
224
|
floating?: FloatingTableProperties;
|
|
210
225
|
/** Default cell margins for the table (w:tblCellMar), in twips */
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { a as NumberingDefinitions, L as ListLevel, A as AbstractNumbering, b as NumberingInstance, c as ListRendering, N as NumberFormat } from './lists-Bn29SzeS.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Numbering/List Parser for DOCX
|
|
5
|
+
*
|
|
6
|
+
* Parses numbering.xml to extract:
|
|
7
|
+
* - Abstract numbering definitions (templates with levels)
|
|
8
|
+
* - Numbering instances (concrete references with optional overrides)
|
|
9
|
+
*
|
|
10
|
+
* OOXML Structure:
|
|
11
|
+
* - w:abstractNum - Template definitions with 9 levels (0-8)
|
|
12
|
+
* - w:num - Instances that reference abstractNum and can override levels
|
|
13
|
+
* - w:lvl - Level definition with start, format, text pattern, etc.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Map of rId to numbering definitions
|
|
18
|
+
*/
|
|
19
|
+
type NumberingMap = {
|
|
20
|
+
definitions: NumberingDefinitions;
|
|
21
|
+
/** Get level info for a numId and ilvl */
|
|
22
|
+
getLevel: (numId: number, ilvl: number) => ListLevel | null;
|
|
23
|
+
/** Get abstract numbering by ID */
|
|
24
|
+
getAbstract: (abstractNumId: number) => AbstractNumbering | null;
|
|
25
|
+
/** Get the numbering instance (numId → abstractNumId + lvlOverrides) */
|
|
26
|
+
getInstance: (numId: number) => NumberingInstance | null;
|
|
27
|
+
/** Check if numId exists */
|
|
28
|
+
hasNumbering: (numId: number) => boolean;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Parse numbering.xml into NumberingDefinitions
|
|
32
|
+
*
|
|
33
|
+
* @param numberingXml - Raw XML string from word/numbering.xml (or null if not present)
|
|
34
|
+
* @returns NumberingMap with definitions and helper functions
|
|
35
|
+
*/
|
|
36
|
+
declare function parseNumbering(numberingXml: string | null): NumberingMap;
|
|
37
|
+
declare function getCachedNumberingMap(definitions: NumberingDefinitions): NumberingMap;
|
|
38
|
+
declare function createNumberingMap(definitions: NumberingDefinitions): NumberingMap;
|
|
39
|
+
/**
|
|
40
|
+
* Resolve a paragraph's `numPr` against the numbering definitions into the
|
|
41
|
+
* `ListRendering` the layout pipeline needs (marker template, per-level
|
|
42
|
+
* numFmts, counter key, start override). Returns null when the numPr doesn't
|
|
43
|
+
* name a real level — including `numId === 0`, "no numbering" per ECMA-376.
|
|
44
|
+
*
|
|
45
|
+
* Shared by the parser (document load) and `applyStyle` (style picker), so a
|
|
46
|
+
* style-attached list renders identically in both paths.
|
|
47
|
+
*/
|
|
48
|
+
declare function computeListRendering(numPr: {
|
|
49
|
+
numId?: number;
|
|
50
|
+
ilvl?: number;
|
|
51
|
+
}, numbering: NumberingMap): ListRendering | null;
|
|
52
|
+
/**
|
|
53
|
+
* Format a number according to the specified format
|
|
54
|
+
*
|
|
55
|
+
* @param num - The number to format
|
|
56
|
+
* @param format - The number format
|
|
57
|
+
* @returns Formatted string
|
|
58
|
+
*/
|
|
59
|
+
declare function formatNumber(num: number, format: NumberFormat): string;
|
|
60
|
+
/**
|
|
61
|
+
* Render list marker text by replacing placeholders with formatted numbers
|
|
62
|
+
*
|
|
63
|
+
* @param lvlText - The level text pattern (e.g., "%1.", "%1.%2")
|
|
64
|
+
* @param counters - Array of counter values for each level (index 0 = level 0, etc.)
|
|
65
|
+
* @param formats - Array of number formats for each level
|
|
66
|
+
* @returns Rendered marker text
|
|
67
|
+
*/
|
|
68
|
+
declare function renderListMarker(lvlText: string, counters: number[], formats: NumberFormat[]): string;
|
|
69
|
+
/**
|
|
70
|
+
* Get the bullet character for a bullet list level
|
|
71
|
+
*
|
|
72
|
+
* @param level - The list level definition
|
|
73
|
+
* @returns The bullet character to display
|
|
74
|
+
*/
|
|
75
|
+
declare function getBulletCharacter(level: ListLevel): string;
|
|
76
|
+
/**
|
|
77
|
+
* Check if a list level is a bullet (not numbered)
|
|
78
|
+
*/
|
|
79
|
+
declare function isBulletLevel(level: ListLevel): boolean;
|
|
80
|
+
|
|
81
|
+
export { type NumberingMap as N, createNumberingMap as a, getCachedNumberingMap as b, computeListRendering as c, formatNumber as f, getBulletCharacter as g, isBulletLevel as i, parseNumbering as p, renderListMarker as r };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { a as NumberingDefinitions, L as ListLevel, A as AbstractNumbering, b as NumberingInstance, c as ListRendering, N as NumberFormat } from './lists-CyGxd5Y2.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Numbering/List Parser for DOCX
|
|
5
|
+
*
|
|
6
|
+
* Parses numbering.xml to extract:
|
|
7
|
+
* - Abstract numbering definitions (templates with levels)
|
|
8
|
+
* - Numbering instances (concrete references with optional overrides)
|
|
9
|
+
*
|
|
10
|
+
* OOXML Structure:
|
|
11
|
+
* - w:abstractNum - Template definitions with 9 levels (0-8)
|
|
12
|
+
* - w:num - Instances that reference abstractNum and can override levels
|
|
13
|
+
* - w:lvl - Level definition with start, format, text pattern, etc.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Map of rId to numbering definitions
|
|
18
|
+
*/
|
|
19
|
+
type NumberingMap = {
|
|
20
|
+
definitions: NumberingDefinitions;
|
|
21
|
+
/** Get level info for a numId and ilvl */
|
|
22
|
+
getLevel: (numId: number, ilvl: number) => ListLevel | null;
|
|
23
|
+
/** Get abstract numbering by ID */
|
|
24
|
+
getAbstract: (abstractNumId: number) => AbstractNumbering | null;
|
|
25
|
+
/** Get the numbering instance (numId → abstractNumId + lvlOverrides) */
|
|
26
|
+
getInstance: (numId: number) => NumberingInstance | null;
|
|
27
|
+
/** Check if numId exists */
|
|
28
|
+
hasNumbering: (numId: number) => boolean;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Parse numbering.xml into NumberingDefinitions
|
|
32
|
+
*
|
|
33
|
+
* @param numberingXml - Raw XML string from word/numbering.xml (or null if not present)
|
|
34
|
+
* @returns NumberingMap with definitions and helper functions
|
|
35
|
+
*/
|
|
36
|
+
declare function parseNumbering(numberingXml: string | null): NumberingMap;
|
|
37
|
+
declare function getCachedNumberingMap(definitions: NumberingDefinitions): NumberingMap;
|
|
38
|
+
declare function createNumberingMap(definitions: NumberingDefinitions): NumberingMap;
|
|
39
|
+
/**
|
|
40
|
+
* Resolve a paragraph's `numPr` against the numbering definitions into the
|
|
41
|
+
* `ListRendering` the layout pipeline needs (marker template, per-level
|
|
42
|
+
* numFmts, counter key, start override). Returns null when the numPr doesn't
|
|
43
|
+
* name a real level — including `numId === 0`, "no numbering" per ECMA-376.
|
|
44
|
+
*
|
|
45
|
+
* Shared by the parser (document load) and `applyStyle` (style picker), so a
|
|
46
|
+
* style-attached list renders identically in both paths.
|
|
47
|
+
*/
|
|
48
|
+
declare function computeListRendering(numPr: {
|
|
49
|
+
numId?: number;
|
|
50
|
+
ilvl?: number;
|
|
51
|
+
}, numbering: NumberingMap): ListRendering | null;
|
|
52
|
+
/**
|
|
53
|
+
* Format a number according to the specified format
|
|
54
|
+
*
|
|
55
|
+
* @param num - The number to format
|
|
56
|
+
* @param format - The number format
|
|
57
|
+
* @returns Formatted string
|
|
58
|
+
*/
|
|
59
|
+
declare function formatNumber(num: number, format: NumberFormat): string;
|
|
60
|
+
/**
|
|
61
|
+
* Render list marker text by replacing placeholders with formatted numbers
|
|
62
|
+
*
|
|
63
|
+
* @param lvlText - The level text pattern (e.g., "%1.", "%1.%2")
|
|
64
|
+
* @param counters - Array of counter values for each level (index 0 = level 0, etc.)
|
|
65
|
+
* @param formats - Array of number formats for each level
|
|
66
|
+
* @returns Rendered marker text
|
|
67
|
+
*/
|
|
68
|
+
declare function renderListMarker(lvlText: string, counters: number[], formats: NumberFormat[]): string;
|
|
69
|
+
/**
|
|
70
|
+
* Get the bullet character for a bullet list level
|
|
71
|
+
*
|
|
72
|
+
* @param level - The list level definition
|
|
73
|
+
* @returns The bullet character to display
|
|
74
|
+
*/
|
|
75
|
+
declare function getBulletCharacter(level: ListLevel): string;
|
|
76
|
+
/**
|
|
77
|
+
* Check if a list level is a bullet (not numbered)
|
|
78
|
+
*/
|
|
79
|
+
declare function isBulletLevel(level: ListLevel): boolean;
|
|
80
|
+
|
|
81
|
+
export { type NumberingMap as N, createNumberingMap as a, getCachedNumberingMap as b, computeListRendering as c, formatNumber as f, getBulletCharacter as g, isBulletLevel as i, parseNumbering as p, renderListMarker as r };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { EditorView } from 'prosemirror-view';
|
|
2
2
|
import { StyleResolver } from './styles/index.mjs';
|
|
3
|
-
import '../
|
|
3
|
+
import { N as NumberingMap } from '../numberingParser-nSPZlzKr.mjs';
|
|
4
|
+
import '../formatting-DFtuRFQY.mjs';
|
|
4
5
|
import '../colors-C3vA7HUU.mjs';
|
|
5
|
-
import '../styles-
|
|
6
|
+
import '../styles-Dqec8Aw6.mjs';
|
|
7
|
+
import '../lists-CyGxd5Y2.mjs';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Agent-facing formatting operations shared by the React and Vue adapters.
|
|
@@ -62,6 +64,7 @@ declare function setParagraphStyle(view: EditorView, options: {
|
|
|
62
64
|
styleId: string;
|
|
63
65
|
}, deps: {
|
|
64
66
|
styleResolver: StyleResolver | null;
|
|
67
|
+
numbering?: NumberingMap | null;
|
|
65
68
|
}): boolean;
|
|
66
69
|
|
|
67
70
|
export { type ApplyFormattingOptions, applyFormatting, setParagraphStyle };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { EditorView } from 'prosemirror-view';
|
|
2
2
|
import { StyleResolver } from './styles/index.js';
|
|
3
|
-
import '../
|
|
3
|
+
import { N as NumberingMap } from '../numberingParser-ZSQ3SDCV.js';
|
|
4
|
+
import '../formatting-JhqWT_XM.js';
|
|
4
5
|
import '../colors-C3vA7HUU.js';
|
|
5
|
-
import '../styles-
|
|
6
|
+
import '../styles-gEujs7j6.js';
|
|
7
|
+
import '../lists-Bn29SzeS.js';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Agent-facing formatting operations shared by the React and Vue adapters.
|
|
@@ -62,6 +64,7 @@ declare function setParagraphStyle(view: EditorView, options: {
|
|
|
62
64
|
styleId: string;
|
|
63
65
|
}, deps: {
|
|
64
66
|
styleResolver: StyleResolver | null;
|
|
67
|
+
numbering?: NumberingMap | null;
|
|
65
68
|
}): boolean;
|
|
66
69
|
|
|
67
70
|
export { type ApplyFormattingOptions, applyFormatting, setParagraphStyle };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var chunkNRWQ65NX_js=require('../chunk-NRWQ65NX.js'),chunkQEACB5VG_js=require('../chunk-QEACB5VG.js'),
|
|
1
|
+
'use strict';var chunkNRWQ65NX_js=require('../chunk-NRWQ65NX.js'),chunkQEACB5VG_js=require('../chunk-QEACB5VG.js'),chunkNPFFCPZ6_js=require('../chunk-NPFFCPZ6.js');require('../chunk-ND33YQGU.js'),require('../chunk-DZ3FN3JI.js'),require('../chunk-BHBOAP6Z.js'),require('../chunk-MZ7LW5CH.js'),require('../chunk-N3Y5BUKV.js'),require('../chunk-5WINQXA3.js'),require('../chunk-6LVPRTB6.js'),require('../chunk-LWH66Q7Q.js'),require('../chunk-X6AICTHN.js'),require('../chunk-7HANRHHL.js'),require('../chunk-MJ5FQX7Q.js'),require('../chunk-C2BAPYGJ.js');var chunk4Q2IP5FW_js=require('../chunk-4Q2IP5FW.js');require('../chunk-GSKMHXHG.js'),require('../chunk-H57LNDBH.js'),require('../chunk-3R7QHNI5.js'),require('../chunk-DC7S76ZX.js');var prosemirrorState=require('prosemirror-state');function I(o,n){let s=chunkNRWQ65NX_js.a(o.state.doc,n.paraId);if(!s)return false;let i=s.from+1,a=s.to-1;if(n.search){let l=chunkNRWQ65NX_js.d(o.state.doc,s.from,s.to,n.search);if(!l)return false;i=l.from,a=l.to;}if(i>=a)return true;let{schema:t}=o.state,e=n.marks,r=o.state.tr;if(e.bold!==void 0&&t.marks.bold&&(r=e.bold?r.addMark(i,a,t.marks.bold.create()):r.removeMark(i,a,t.marks.bold)),e.italic!==void 0&&t.marks.italic&&(r=e.italic?r.addMark(i,a,t.marks.italic.create()):r.removeMark(i,a,t.marks.italic)),e.underline!==void 0&&t.marks.underline)if(e.underline){let l=typeof e.underline=="object"?e.underline.style:void 0;r=r.addMark(i,a,t.marks.underline.create({style:l??"single"}));}else r=r.removeMark(i,a,t.marks.underline);if(e.strike!==void 0&&t.marks.strike&&(r=e.strike?r.addMark(i,a,t.marks.strike.create()):r.removeMark(i,a,t.marks.strike)),e.color!==void 0&&t.marks.textColor&&(e.color&&(e.color.rgb||e.color.themeColor)?r=r.addMark(i,a,t.marks.textColor.create({rgb:e.color.rgb??null,themeColor:e.color.themeColor??null})):r=r.removeMark(i,a,t.marks.textColor)),e.highlight!==void 0&&t.marks.highlight)if(e.highlight){let l=chunkQEACB5VG_js.b(e.highlight);r=r.addMark(i,a,t.marks.highlight.create({color:l||e.highlight}));}else r=r.removeMark(i,a,t.marks.highlight);return e.fontSize!==void 0&&t.marks.fontSize&&(e.fontSize>0?r=r.addMark(i,a,t.marks.fontSize.create({size:chunk4Q2IP5FW_js.l(e.fontSize)})):r=r.removeMark(i,a,t.marks.fontSize)),e.fontFamily!==void 0&&t.marks.fontFamily&&(e.fontFamily&&(e.fontFamily.ascii||e.fontFamily.hAnsi)?r=r.addMark(i,a,t.marks.fontFamily.create({ascii:e.fontFamily.ascii??null,hAnsi:e.fontFamily.hAnsi??e.fontFamily.ascii??null})):r=r.removeMark(i,a,t.marks.fontFamily)),o.dispatch(r),true}function z(o,n,s){let i=chunkNRWQ65NX_js.a(o.state.doc,n.paraId);if(!i)return false;let{styleResolver:a,numbering:t}=s;if(a&&!a.hasParagraphStyle(n.styleId))return false;let e=o.state.doc.resolve(i.from+1),r=o.state.doc.resolve(i.to-1),l=prosemirrorState.TextSelection.between(e,r),p=o.state.apply(o.state.tr.setSelection(l)),u=a?(()=>{let m=a.resolveParagraphStyle(n.styleId);return chunkNPFFCPZ6_js.v(n.styleId,{paragraphFormatting:m.paragraphFormatting,runFormatting:m.runFormatting,numbering:t})})():chunkNPFFCPZ6_js.v(n.styleId),c=false;return u(p,m=>{c=true,m.setSelection(o.state.selection.map(m.doc,m.mapping)),o.dispatch(m);}),c}exports.applyFormatting=I;exports.setParagraphStyle=z;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a,d}from'../chunk-HPJBZL37.mjs';import {b}from'../chunk-XPV6VILW.mjs';import {v}from'../chunk-
|
|
1
|
+
import {a,d}from'../chunk-HPJBZL37.mjs';import {b}from'../chunk-XPV6VILW.mjs';import {v}from'../chunk-QUM4DFRE.mjs';import'../chunk-SNTAAXXA.mjs';import'../chunk-ENIWJBS7.mjs';import'../chunk-MOKKS75W.mjs';import'../chunk-OZMNIX6U.mjs';import'../chunk-AMENZY5F.mjs';import'../chunk-M7KTKPGO.mjs';import'../chunk-BGY3CB37.mjs';import'../chunk-2XP6GLA4.mjs';import'../chunk-NTBZRITU.mjs';import'../chunk-MJ6XZFVD.mjs';import'../chunk-67LVRQIR.mjs';import'../chunk-LE67NTCN.mjs';import {l}from'../chunk-VW22RZ6C.mjs';import'../chunk-DI6CRWSW.mjs';import'../chunk-VJFIAFZ5.mjs';import'../chunk-3ANZ3252.mjs';import'../chunk-QYUPLKLP.mjs';import {TextSelection}from'prosemirror-state';function I(o,n){let s=a(o.state.doc,n.paraId);if(!s)return false;let i=s.from+1,a$1=s.to-1;if(n.search){let l=d(o.state.doc,s.from,s.to,n.search);if(!l)return false;i=l.from,a$1=l.to;}if(i>=a$1)return true;let{schema:t}=o.state,e=n.marks,r=o.state.tr;if(e.bold!==void 0&&t.marks.bold&&(r=e.bold?r.addMark(i,a$1,t.marks.bold.create()):r.removeMark(i,a$1,t.marks.bold)),e.italic!==void 0&&t.marks.italic&&(r=e.italic?r.addMark(i,a$1,t.marks.italic.create()):r.removeMark(i,a$1,t.marks.italic)),e.underline!==void 0&&t.marks.underline)if(e.underline){let l=typeof e.underline=="object"?e.underline.style:void 0;r=r.addMark(i,a$1,t.marks.underline.create({style:l??"single"}));}else r=r.removeMark(i,a$1,t.marks.underline);if(e.strike!==void 0&&t.marks.strike&&(r=e.strike?r.addMark(i,a$1,t.marks.strike.create()):r.removeMark(i,a$1,t.marks.strike)),e.color!==void 0&&t.marks.textColor&&(e.color&&(e.color.rgb||e.color.themeColor)?r=r.addMark(i,a$1,t.marks.textColor.create({rgb:e.color.rgb??null,themeColor:e.color.themeColor??null})):r=r.removeMark(i,a$1,t.marks.textColor)),e.highlight!==void 0&&t.marks.highlight)if(e.highlight){let l=b(e.highlight);r=r.addMark(i,a$1,t.marks.highlight.create({color:l||e.highlight}));}else r=r.removeMark(i,a$1,t.marks.highlight);return e.fontSize!==void 0&&t.marks.fontSize&&(e.fontSize>0?r=r.addMark(i,a$1,t.marks.fontSize.create({size:l(e.fontSize)})):r=r.removeMark(i,a$1,t.marks.fontSize)),e.fontFamily!==void 0&&t.marks.fontFamily&&(e.fontFamily&&(e.fontFamily.ascii||e.fontFamily.hAnsi)?r=r.addMark(i,a$1,t.marks.fontFamily.create({ascii:e.fontFamily.ascii??null,hAnsi:e.fontFamily.hAnsi??e.fontFamily.ascii??null})):r=r.removeMark(i,a$1,t.marks.fontFamily)),o.dispatch(r),true}function z(o,n,s){let i=a(o.state.doc,n.paraId);if(!i)return false;let{styleResolver:a$1,numbering:t}=s;if(a$1&&!a$1.hasParagraphStyle(n.styleId))return false;let e=o.state.doc.resolve(i.from+1),r=o.state.doc.resolve(i.to-1),l=TextSelection.between(e,r),p=o.state.apply(o.state.tr.setSelection(l)),u=a$1?(()=>{let m=a$1.resolveParagraphStyle(n.styleId);return v(n.styleId,{paragraphFormatting:m.paragraphFormatting,runFormatting:m.runFormatting,numbering:t})})():v(n.styleId),c=false;return u(p,m=>{c=true,m.setSelection(o.state.selection.map(m.doc,m.mapping)),o.dispatch(m);}),c}export{I as applyFormatting,z as setParagraphStyle};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { EditorView } from 'prosemirror-view';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Drag-to-select table cells, shared by the React and Vue pages-pointer
|
|
5
|
+
* handlers. A pointer drag that starts inside a table cell and crosses into
|
|
6
|
+
* another cell is promoted from a text selection to a prosemirror-tables
|
|
7
|
+
* `CellSelection` (so multi-cell ops — delete row/column, fill, merge — become
|
|
8
|
+
* reachable by dragging). Pure `(view, pmPos, clientX) → boolean` logic; the
|
|
9
|
+
* adapters own the DOM event wiring and the active-view resolution (body vs
|
|
10
|
+
* header/footer).
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Once a text selection has maxed out inside a single cell, the cursor stops
|
|
15
|
+
* moving while the mouse keeps going. Promote to a full-cell selection after
|
|
16
|
+
* the pointer overshoots the last caret position by this many pixels.
|
|
17
|
+
*/
|
|
18
|
+
declare const CELL_SELECT_OVERFLOW_PX = 5;
|
|
19
|
+
/**
|
|
20
|
+
* Walk up from a PM position to the enclosing `tableCell`/`tableHeader` and
|
|
21
|
+
* return its `before(d)` position (what `CellSelection` resolves against), or
|
|
22
|
+
* null when the position isn't inside a table cell.
|
|
23
|
+
*/
|
|
24
|
+
declare function findCellPosFromPmPos(view: EditorView, pmPos: number): number | null;
|
|
25
|
+
/** Dispatch a `CellSelection` spanning the two cell positions. */
|
|
26
|
+
declare function applyCellSelection(view: EditorView, anchorCellPos: number, headCellPos: number): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Per-gesture state machine for cell-drag selection. Create one per pointer
|
|
29
|
+
* handler; drive it from mousedown/mousemove/mouseup.
|
|
30
|
+
*/
|
|
31
|
+
interface CellDragTracker {
|
|
32
|
+
/** mousedown: record the cell under the press (or null when outside a table). */
|
|
33
|
+
begin(cellPos: number | null): void;
|
|
34
|
+
/**
|
|
35
|
+
* mousemove: returns true when it applied a `CellSelection` and the caller
|
|
36
|
+
* should NOT also run its text-drag selection for this move.
|
|
37
|
+
*/
|
|
38
|
+
update(view: EditorView, pmPos: number, clientX: number): boolean;
|
|
39
|
+
/** mouseup / gesture end: clear the transient drag flags. */
|
|
40
|
+
end(): void;
|
|
41
|
+
/** True while a cell drag is actively producing CellSelections. */
|
|
42
|
+
readonly isCellDragging: boolean;
|
|
43
|
+
}
|
|
44
|
+
declare function createCellDragTracker(): CellDragTracker;
|
|
45
|
+
|
|
46
|
+
export { CELL_SELECT_OVERFLOW_PX, type CellDragTracker, applyCellSelection, createCellDragTracker, findCellPosFromPmPos };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { EditorView } from 'prosemirror-view';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Drag-to-select table cells, shared by the React and Vue pages-pointer
|
|
5
|
+
* handlers. A pointer drag that starts inside a table cell and crosses into
|
|
6
|
+
* another cell is promoted from a text selection to a prosemirror-tables
|
|
7
|
+
* `CellSelection` (so multi-cell ops — delete row/column, fill, merge — become
|
|
8
|
+
* reachable by dragging). Pure `(view, pmPos, clientX) → boolean` logic; the
|
|
9
|
+
* adapters own the DOM event wiring and the active-view resolution (body vs
|
|
10
|
+
* header/footer).
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Once a text selection has maxed out inside a single cell, the cursor stops
|
|
15
|
+
* moving while the mouse keeps going. Promote to a full-cell selection after
|
|
16
|
+
* the pointer overshoots the last caret position by this many pixels.
|
|
17
|
+
*/
|
|
18
|
+
declare const CELL_SELECT_OVERFLOW_PX = 5;
|
|
19
|
+
/**
|
|
20
|
+
* Walk up from a PM position to the enclosing `tableCell`/`tableHeader` and
|
|
21
|
+
* return its `before(d)` position (what `CellSelection` resolves against), or
|
|
22
|
+
* null when the position isn't inside a table cell.
|
|
23
|
+
*/
|
|
24
|
+
declare function findCellPosFromPmPos(view: EditorView, pmPos: number): number | null;
|
|
25
|
+
/** Dispatch a `CellSelection` spanning the two cell positions. */
|
|
26
|
+
declare function applyCellSelection(view: EditorView, anchorCellPos: number, headCellPos: number): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Per-gesture state machine for cell-drag selection. Create one per pointer
|
|
29
|
+
* handler; drive it from mousedown/mousemove/mouseup.
|
|
30
|
+
*/
|
|
31
|
+
interface CellDragTracker {
|
|
32
|
+
/** mousedown: record the cell under the press (or null when outside a table). */
|
|
33
|
+
begin(cellPos: number | null): void;
|
|
34
|
+
/**
|
|
35
|
+
* mousemove: returns true when it applied a `CellSelection` and the caller
|
|
36
|
+
* should NOT also run its text-drag selection for this move.
|
|
37
|
+
*/
|
|
38
|
+
update(view: EditorView, pmPos: number, clientX: number): boolean;
|
|
39
|
+
/** mouseup / gesture end: clear the transient drag flags. */
|
|
40
|
+
end(): void;
|
|
41
|
+
/** True while a cell drag is actively producing CellSelections. */
|
|
42
|
+
readonly isCellDragging: boolean;
|
|
43
|
+
}
|
|
44
|
+
declare function createCellDragTracker(): CellDragTracker;
|
|
45
|
+
|
|
46
|
+
export { CELL_SELECT_OVERFLOW_PX, type CellDragTracker, applyCellSelection, createCellDragTracker, findCellPosFromPmPos };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';require('../chunk-DC7S76ZX.js');var prosemirrorTables=require('prosemirror-tables');var d=5;function c(l,t){try{let n=l.state.doc.resolve(t);for(let e=n.depth;e>0;e--){let r=n.node(e);if(r.type.name==="tableCell"||r.type.name==="tableHeader")return n.before(e)}}catch{}return null}function a(l,t,n){try{let e=l.state.doc.resolve(t),r=l.state.doc.resolve(n);return l.dispatch(l.state.tr.setSelection(new prosemirrorTables.CellSelection(e,r))),!0}catch{return false}}function m(){let l=null,t=false,n=null,e=null;return {begin(r){l=r,t=false,n=null,e=null;},update(r,o,s){if(l===null)return false;if(t){let i=c(r,o);if(i!==null)return a(r,l,i),true}let u=c(r,o);if(u!==null&&u!==l)return t=true,a(r,l,u),e=null,true;if(n!==null&&o===n){if(e===null)e=s;else if(Math.abs(s-e)>=d)return t=true,a(r,l,l),e=null,true}else e=null,n=o;return false},end(){t=false,n=null,e=null;},get isCellDragging(){return t}}}exports.CELL_SELECT_OVERFLOW_PX=d;exports.applyCellSelection=a;exports.createCellDragTracker=m;exports.findCellPosFromPmPos=c;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import'../chunk-QYUPLKLP.mjs';import {CellSelection}from'prosemirror-tables';var d=5;function c(l,t){try{let n=l.state.doc.resolve(t);for(let e=n.depth;e>0;e--){let r=n.node(e);if(r.type.name==="tableCell"||r.type.name==="tableHeader")return n.before(e)}}catch{}return null}function a(l,t,n){try{let e=l.state.doc.resolve(t),r=l.state.doc.resolve(n);return l.dispatch(l.state.tr.setSelection(new CellSelection(e,r))),!0}catch{return false}}function m(){let l=null,t=false,n=null,e=null;return {begin(r){l=r,t=false,n=null,e=null;},update(r,o,s){if(l===null)return false;if(t){let i=c(r,o);if(i!==null)return a(r,l,i),true}let u=c(r,o);if(u!==null&&u!==l)return t=true,a(r,l,u),e=null,true;if(n!==null&&o===n){if(e===null)e=s;else if(Math.abs(s-e)>=d)return t=true,a(r,l,l),e=null,true}else e=null,n=o;return false},end(){t=false,n=null,e=null;},get isCellDragging(){return t}}}export{d as CELL_SELECT_OVERFLOW_PX,a as applyCellSelection,m as createCellDragTracker,c as findCellPosFromPmPos};
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { Command, EditorState } from 'prosemirror-state';
|
|
11
11
|
import { MarkType, Mark } from 'prosemirror-model';
|
|
12
|
-
import { T as TextFormatting } from '../../formatting-
|
|
13
|
-
import { T as TextColorAttrs } from '../../marks-
|
|
12
|
+
import { T as TextFormatting } from '../../formatting-DFtuRFQY.mjs';
|
|
13
|
+
import { T as TextColorAttrs } from '../../marks-CzrbFi4o.mjs';
|
|
14
14
|
import '../../colors-C3vA7HUU.mjs';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { Command, EditorState } from 'prosemirror-state';
|
|
11
11
|
import { MarkType, Mark } from 'prosemirror-model';
|
|
12
|
-
import { T as TextFormatting } from '../../formatting-
|
|
13
|
-
import { T as TextColorAttrs } from '../../marks-
|
|
12
|
+
import { T as TextFormatting } from '../../formatting-JhqWT_XM.js';
|
|
13
|
+
import { T as TextColorAttrs } from '../../marks-Dq1QsxKA.js';
|
|
14
14
|
import '../../colors-C3vA7HUU.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk3SJQRYO7_js=require('../../chunk-3SJQRYO7.js');require('../../chunk-ND33YQGU.js');var chunkDZ3FN3JI_js=require('../../chunk-DZ3FN3JI.js');require('../../chunk-BHBOAP6Z.js'),require('../../chunk-MZ7LW5CH.js'),require('../../chunk-N3Y5BUKV.js');var chunk5WINQXA3_js=require('../../chunk-5WINQXA3.js');require('../../chunk-6LVPRTB6.js'),require('../../chunk-LWH66Q7Q.js'),require('../../chunk-X6AICTHN.js'),require('../../chunk-7HANRHHL.js'),require('../../chunk-MJ5FQX7Q.js'),require('../../chunk-C2BAPYGJ.js'),require('../../chunk-4Q2IP5FW.js'),require('../../chunk-GSKMHXHG.js'),require('../../chunk-H57LNDBH.js'),require('../../chunk-3R7QHNI5.js'),require('../../chunk-DC7S76ZX.js');Object.defineProperty(exports,"clearFontFamily",{enumerable:true,get:function(){return chunk3SJQRYO7_js.o}});Object.defineProperty(exports,"clearFontSize",{enumerable:true,get:function(){return chunk3SJQRYO7_js.m}});Object.defineProperty(exports,"clearHighlight",{enumerable:true,get:function(){return chunk3SJQRYO7_js.k}});Object.defineProperty(exports,"clearTextColor",{enumerable:true,get:function(){return chunk3SJQRYO7_js.i}});Object.defineProperty(exports,"insertHyperlink",{enumerable:true,get:function(){return chunk3SJQRYO7_js.s}});Object.defineProperty(exports,"removeHyperlink",{enumerable:true,get:function(){return chunk3SJQRYO7_js.r}});Object.defineProperty(exports,"setFontFamily",{enumerable:true,get:function(){return chunk3SJQRYO7_js.n}});Object.defineProperty(exports,"setFontSize",{enumerable:true,get:function(){return chunk3SJQRYO7_js.l}});Object.defineProperty(exports,"setHighlight",{enumerable:true,get:function(){return chunk3SJQRYO7_js.j}});Object.defineProperty(exports,"setHyperlink",{enumerable:true,get:function(){return chunk3SJQRYO7_js.q}});Object.defineProperty(exports,"setTextColor",{enumerable:true,get:function(){return chunk3SJQRYO7_js.h}});Object.defineProperty(exports,"setUnderlineStyle",{enumerable:true,get:function(){return chunk3SJQRYO7_js.p}});Object.defineProperty(exports,"textFormattingToMarks",{enumerable:true,get:function(){return chunk3SJQRYO7_js.a}});Object.defineProperty(exports,"toggleBold",{enumerable:true,get:function(){return chunk3SJQRYO7_js.b}});Object.defineProperty(exports,"toggleItalic",{enumerable:true,get:function(){return chunk3SJQRYO7_js.c}});Object.defineProperty(exports,"toggleStrike",{enumerable:true,get:function(){return chunk3SJQRYO7_js.e}});Object.defineProperty(exports,"toggleSubscript",{enumerable:true,get:function(){return chunk3SJQRYO7_js.g}});Object.defineProperty(exports,"toggleSuperscript",{enumerable:true,get:function(){return chunk3SJQRYO7_js.f}});Object.defineProperty(exports,"toggleUnderline",{enumerable:true,get:function(){return chunk3SJQRYO7_js.d}});Object.defineProperty(exports,"findHyperlinkRangeAt",{enumerable:true,get:function(){return chunkDZ3FN3JI_js.h}});Object.defineProperty(exports,"getHyperlinkAttrs",{enumerable:true,get:function(){return chunkDZ3FN3JI_js.f}});Object.defineProperty(exports,"getSelectedText",{enumerable:true,get:function(){return chunkDZ3FN3JI_js.g}});Object.defineProperty(exports,"isHyperlinkActive",{enumerable:true,get:function(){return chunkDZ3FN3JI_js.e}});Object.defineProperty(exports,"clearFormatting",{enumerable:true,get:function(){return chunk5WINQXA3_js.h}});Object.defineProperty(exports,"createRemoveMarkCommand",{enumerable:true,get:function(){return chunk5WINQXA3_js.j}});Object.defineProperty(exports,"createSetMarkCommand",{enumerable:true,get:function(){return chunk5WINQXA3_js.i}});Object.defineProperty(exports,"getMarkAttr",{enumerable:true,get:function(){return chunk5WINQXA3_js.f}});Object.defineProperty(exports,"isMarkActive",{enumerable:true,get:function(){return chunk5WINQXA3_js.e}});
|