@zeke-02/docx-editor 0.0.34 → 0.5.1
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/README.md +34 -29
- package/dist/{ClipboardManager-C1l58nzE.d.ts → ClipboardManager-CVKX0v9q.d.ts} +1 -1
- package/dist/{ClipboardManager-Cjb_v74d.d.mts → ClipboardManager-V3aaMnWE.d.mts} +1 -1
- package/dist/{DocumentAgent-E8OX_8j0.d.mts → DocumentAgent-BWflKHpH.d.mts} +1 -1
- package/dist/{DocumentAgent-iedmc_8s.d.ts → DocumentAgent-DsdXtetF.d.ts} +1 -1
- package/dist/{FindReplaceDialog-YW3R4FHM.mjs → FindReplaceDialog-L3YF5HIS.mjs} +1 -1
- package/dist/FindReplaceDialog-SEBWC5P7.js +1 -0
- package/dist/{FootnotePropertiesDialog-LNFJXQUG.mjs → FootnotePropertiesDialog-TNVJJCY6.mjs} +1 -1
- package/dist/{FootnotePropertiesDialog-7QX54WQT.js → FootnotePropertiesDialog-XQ7NIFIU.js} +1 -1
- package/dist/{HyperlinkDialog-HNYTXDCB.mjs → HyperlinkDialog-FR4IZZ7E.mjs} +1 -1
- package/dist/HyperlinkDialog-WEK6JSAC.js +1 -0
- package/dist/{ImagePositionDialog-M65BYQQE.js → ImagePositionDialog-2YXRAGZS.js} +1 -1
- package/dist/{ImagePositionDialog-B4RLP2W5.mjs → ImagePositionDialog-JSZSIKF5.mjs} +1 -1
- package/dist/ImagePropertiesDialog-527MFLQO.mjs +1 -0
- package/dist/{ImagePropertiesDialog-O4WQSF5M.js → ImagePropertiesDialog-HG4K3IE7.js} +1 -1
- package/dist/PageSetupDialog-GALVJMUB.js +1 -0
- package/dist/PageSetupDialog-TGQIAMI7.mjs +1 -0
- package/dist/SplitCellDialog-JIAC3RYV.js +1 -0
- package/dist/SplitCellDialog-NP3JJYHD.mjs +1 -0
- package/dist/{TablePropertiesDialog-WOZ4ES3H.js → TablePropertiesDialog-T7D4HSVP.js} +1 -1
- package/dist/TablePropertiesDialog-TIK4AA5M.mjs +1 -0
- package/dist/{clipboard-BWhM0CRj.d.mts → TableToolbar-DUgmob2I.d.ts} +227 -135
- package/dist/{clipboard-BvkuNZub.d.ts → TableToolbar-YL74HNS1.d.mts} +227 -135
- package/dist/{agentApi-mv532p8I.d.mts → agentApi-DLt94vXk.d.mts} +83 -5
- package/dist/{agentApi-mv532p8I.d.ts → agentApi-DLt94vXk.d.ts} +83 -5
- package/dist/chunk-23SXXIZS.js +111 -0
- package/dist/chunk-3F52AP2Q.js +1 -0
- package/dist/chunk-42O5GXM5.mjs +82 -0
- package/dist/chunk-54ULJEHM.mjs +1 -0
- package/dist/chunk-5XK326FI.mjs +1 -0
- package/dist/chunk-76IYR7C7.mjs +1 -0
- package/dist/chunk-7BG7QY7I.js +182 -0
- package/dist/chunk-AGRIVA4G.js +1 -0
- package/dist/chunk-BTCQ2QI3.mjs +3 -0
- package/dist/chunk-BXRC4U3X.mjs +2 -0
- package/dist/chunk-CPAYKE6X.mjs +1 -0
- package/dist/chunk-DACWLFKI.mjs +1 -0
- package/dist/{chunk-377ZVTSE.js → chunk-EHFEG3TX.js} +1 -1
- package/dist/chunk-EPBFWE36.js +2 -0
- package/dist/chunk-FXES3YDB.js +82 -0
- package/dist/chunk-HI66BSGS.mjs +9 -0
- package/dist/chunk-INTPVEO6.mjs +9 -0
- package/dist/chunk-IOAGVW6Q.mjs +2 -0
- package/dist/chunk-JCEWC5QL.mjs +4 -0
- package/dist/chunk-JTIUFACT.js +1 -0
- package/dist/chunk-KUTCCI4X.mjs +182 -0
- package/dist/{chunk-KCOGY3V2.js → chunk-LUF7PWIC.js} +4 -4
- package/dist/chunk-LVGJKS7Y.mjs +24 -0
- package/dist/chunk-MGEN6GOE.mjs +2 -0
- package/dist/chunk-MOE2ZGUE.js +18 -0
- package/dist/chunk-MWLHJWB6.js +9 -0
- package/dist/chunk-OFYVDN3U.mjs +2 -0
- package/dist/chunk-P4VSHBGZ.js +2 -0
- package/dist/chunk-P5FQHIES.mjs +1 -0
- package/dist/chunk-PBC7XAYZ.js +3 -0
- package/dist/chunk-PEMB6SZT.js +2 -0
- package/dist/chunk-PKEOQIQO.mjs +2 -0
- package/dist/chunk-PQMSZTBB.js +9 -0
- package/dist/chunk-Q7UDQXAF.js +1 -0
- package/dist/chunk-QGTAIC5E.js +1 -0
- package/dist/chunk-R3QMYPL5.mjs +59 -0
- package/dist/chunk-RBUTXXQJ.mjs +18 -0
- package/dist/chunk-RRWYZ2TS.mjs +111 -0
- package/dist/{chunk-AU5NVRHP.js → chunk-SFUM35DH.js} +2 -2
- package/dist/chunk-SNLC6EK2.js +1 -0
- package/dist/chunk-TMTLIGLZ.js +59 -0
- package/dist/{chunk-RTFUE3KK.mjs → chunk-TSE2PWFX.mjs} +3 -3
- package/dist/chunk-UWYD42WV.js +4 -0
- package/dist/chunk-UXVACQCY.mjs +1 -0
- package/dist/{chunk-Z26WOH6R.mjs → chunk-W4EIKDM6.mjs} +2 -2
- package/dist/chunk-WNS2RBQD.js +2 -0
- package/dist/chunk-YC5KZSYD.js +24 -0
- package/dist/chunk-Z3KMSHUP.js +1 -0
- package/dist/core-plugins-reexport.d.mts +4 -4
- package/dist/core-plugins-reexport.d.ts +4 -4
- package/dist/core-plugins-reexport.js +1 -1
- package/dist/core-plugins-reexport.mjs +1 -1
- package/dist/core-reexport.d.mts +47 -16
- package/dist/core-reexport.d.ts +47 -16
- package/dist/core-reexport.js +1 -1
- package/dist/core-reexport.mjs +1 -1
- package/dist/{colorResolver-C5fQ4fxP.d.mts → documentSerializer-DtS_-oGA.d.mts} +378 -376
- package/dist/{colorResolver-Bp9flT3l.d.ts → documentSerializer-Wj1p2ASa.d.ts} +378 -376
- package/dist/executor-C3VXF7QA.mjs +1 -0
- package/dist/executor-GDBV3AGV.js +1 -0
- package/dist/headless-reexport.d.mts +14 -12
- package/dist/headless-reexport.d.ts +14 -12
- package/dist/headless-reexport.js +1 -4
- package/dist/headless-reexport.mjs +1 -4
- package/dist/index.css +1 -1
- package/dist/index.d.mts +284 -172
- package/dist/index.d.ts +284 -172
- package/dist/index.js +17 -9
- package/dist/index.mjs +17 -9
- package/dist/{fontLoader-0G00frKD.d.mts → insertOperations-BTH1Asas.d.mts} +86 -86
- package/dist/{fontLoader-DPdt4JvW.d.ts → insertOperations-CbUnXAXH.d.ts} +86 -86
- package/dist/layout-bridge-EA4DJ227.js +1 -0
- package/dist/layout-bridge-XDPSO6GO.mjs +1 -0
- package/dist/mcp-reexport.d.mts +2 -2
- package/dist/mcp-reexport.d.ts +2 -2
- package/dist/mcp-reexport.js +8 -8
- package/dist/mcp-reexport.mjs +7 -7
- package/dist/processTemplate-MJ2PCSO5.js +1 -0
- package/dist/{processTemplate-LRHXOWMZ.mjs → processTemplate-W2C5PXZB.mjs} +1 -1
- package/dist/{react-8budV7xv.d.mts → react-B0W16SV6.d.ts} +401 -166
- package/dist/{react-D6tMLo0R.d.ts → react-D0Pn1nww.d.mts} +401 -166
- package/dist/react.css +1 -1
- package/dist/react.d.mts +5 -5
- package/dist/react.d.ts +5 -5
- package/dist/react.js +1 -1
- package/dist/react.mjs +1 -1
- package/dist/{registry-BWGKcKc1.d.ts → registry-CH9V-IX0.d.ts} +1 -1
- package/dist/{registry-8XOdjHGC.d.mts → registry-CWBKYlNW.d.mts} +1 -1
- package/dist/styles.css +1 -1
- package/dist/{types-DIBvJ7AJ.d.mts → types-UDsUq8D3.d.mts} +1 -1
- package/dist/{types-CfAiObQo.d.ts → types-jbivc9Lj.d.ts} +1 -1
- package/dist/ui.d.mts +33 -83
- package/dist/ui.d.ts +33 -83
- package/dist/ui.js +1 -1
- package/dist/ui.mjs +1 -1
- package/dist/{variableDetector-DNO18eZ1.d.mts → variableDetector-CdQ7ZTzA.d.mts} +1 -1
- package/dist/{variableDetector-BIJFVpkl.d.ts → variableDetector-DsRV3A9z.d.ts} +1 -1
- package/i18n/de.json +49 -2
- package/i18n/en.json +55 -8
- package/i18n/he.json +792 -0
- package/i18n/pl.json +49 -2
- package/i18n/pt-BR.json +792 -0
- package/i18n/tr.json +792 -0
- package/i18n/zh-CN.json +792 -0
- package/package.json +17 -5
- package/dist/FindReplaceDialog-KNJETYJX.js +0 -1
- package/dist/HyperlinkDialog-GBAYMTUE.js +0 -1
- package/dist/ImagePropertiesDialog-JOGW3WDU.mjs +0 -1
- package/dist/PageSetupDialog-2GIBTKMJ.js +0 -1
- package/dist/PageSetupDialog-Q7SHEZIJ.mjs +0 -1
- package/dist/TablePropertiesDialog-LMXWX3FI.mjs +0 -1
- package/dist/chunk-2HDYCD2Q.mjs +0 -1
- package/dist/chunk-37SLIJPH.mjs +0 -58
- package/dist/chunk-3OKYQQQ5.js +0 -111
- package/dist/chunk-4VUZBV2S.js +0 -1
- package/dist/chunk-7MGFEP2R.mjs +0 -26
- package/dist/chunk-7QTNB64A.mjs +0 -9
- package/dist/chunk-AARNCPWR.js +0 -1
- package/dist/chunk-DC65PJYE.js +0 -4
- package/dist/chunk-DLNS7XC2.js +0 -261
- package/dist/chunk-DLVLK5FT.mjs +0 -24
- package/dist/chunk-EV3CM6TU.js +0 -1
- package/dist/chunk-FVUGBRDD.js +0 -1
- package/dist/chunk-FW5LYOOZ.mjs +0 -111
- package/dist/chunk-GZOCOWWB.mjs +0 -2
- package/dist/chunk-KUL2SDYC.js +0 -26
- package/dist/chunk-LYBG4YI7.mjs +0 -1
- package/dist/chunk-M5F4SK3W.mjs +0 -1
- package/dist/chunk-P7WEP4JU.js +0 -9
- package/dist/chunk-PB7VMDDP.js +0 -24
- package/dist/chunk-QAZ4233N.mjs +0 -1
- package/dist/chunk-QSUPYUOP.js +0 -2
- package/dist/chunk-QTSXJRP6.mjs +0 -1
- package/dist/chunk-SE5EN2QL.js +0 -1
- package/dist/chunk-X5A54T6S.mjs +0 -4
- package/dist/chunk-YKBSKEBS.mjs +0 -2
- package/dist/chunk-Z7ZLARCQ.mjs +0 -261
- package/dist/chunk-ZJNGMDRE.js +0 -58
- package/dist/executor-L2MVKMXO.js +0 -1
- package/dist/executor-XKBCCVNY.mjs +0 -1
- package/dist/processTemplate-5ZST2Q5L.js +0 -1
- package/dist/selectionRects-DEX5THEG.js +0 -1
- package/dist/selectionRects-SQTAHMCH.mjs +0 -1
|
@@ -1,89 +1,4 @@
|
|
|
1
|
-
import { D as Document, B as BreakContent, a as Paragraph, b as Run, c as RunContent } from './agentApi-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Insert Operations Utility
|
|
5
|
-
*
|
|
6
|
-
* Utility functions for inserting content into the document.
|
|
7
|
-
* Provides functions for inserting page breaks, horizontal rules, and other elements.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Insert position in the document
|
|
12
|
-
*/
|
|
13
|
-
interface InsertPosition {
|
|
14
|
-
/** Paragraph index in the document body */
|
|
15
|
-
paragraphIndex: number;
|
|
16
|
-
/** Run index within the paragraph (optional) */
|
|
17
|
-
runIndex?: number;
|
|
18
|
-
/** Character offset within the run (optional) */
|
|
19
|
-
offset?: number;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Create a page break content element
|
|
23
|
-
*/
|
|
24
|
-
declare function createPageBreak(): BreakContent;
|
|
25
|
-
/**
|
|
26
|
-
* Create a column break content element
|
|
27
|
-
*/
|
|
28
|
-
declare function createColumnBreak(): BreakContent;
|
|
29
|
-
/**
|
|
30
|
-
* Create a text wrapping break (line break)
|
|
31
|
-
*/
|
|
32
|
-
declare function createLineBreak(clear?: 'none' | 'left' | 'right' | 'all'): BreakContent;
|
|
33
|
-
/**
|
|
34
|
-
* Create a run containing a page break
|
|
35
|
-
*/
|
|
36
|
-
declare function createPageBreakRun(): Run;
|
|
37
|
-
/**
|
|
38
|
-
* Create an empty paragraph with a page break before it
|
|
39
|
-
*/
|
|
40
|
-
declare function createPageBreakParagraph(): Paragraph;
|
|
41
|
-
/**
|
|
42
|
-
* Insert a page break at a position in the document
|
|
43
|
-
* This inserts a new paragraph with pageBreakBefore: true
|
|
44
|
-
*/
|
|
45
|
-
declare function insertPageBreak(doc: Document, position: InsertPosition): Document;
|
|
46
|
-
/**
|
|
47
|
-
* Create a horizontal rule paragraph
|
|
48
|
-
* Uses a paragraph with bottom border to simulate horizontal rule
|
|
49
|
-
*/
|
|
50
|
-
declare function createHorizontalRule(): Paragraph;
|
|
51
|
-
/**
|
|
52
|
-
* Insert a horizontal rule at a position in the document
|
|
53
|
-
*/
|
|
54
|
-
declare function insertHorizontalRule(doc: Document, position: InsertPosition): Document;
|
|
55
|
-
/**
|
|
56
|
-
* Check if content is a page break
|
|
57
|
-
*/
|
|
58
|
-
declare function isPageBreak(content: RunContent): boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Check if content is a column break
|
|
61
|
-
*/
|
|
62
|
-
declare function isColumnBreak(content: RunContent): boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Check if content is a line break
|
|
65
|
-
*/
|
|
66
|
-
declare function isLineBreak(content: RunContent): boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Check if content is any type of break
|
|
69
|
-
*/
|
|
70
|
-
declare function isBreakContent(content: RunContent): content is BreakContent;
|
|
71
|
-
/**
|
|
72
|
-
* Check if a paragraph has pageBreakBefore
|
|
73
|
-
*/
|
|
74
|
-
declare function hasPageBreakBefore(paragraph: Paragraph): boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Count page breaks in a document
|
|
77
|
-
*/
|
|
78
|
-
declare function countPageBreaks(doc: Document): number;
|
|
79
|
-
/**
|
|
80
|
-
* Find all page break positions in a document
|
|
81
|
-
*/
|
|
82
|
-
declare function findPageBreaks(doc: Document): InsertPosition[];
|
|
83
|
-
/**
|
|
84
|
-
* Remove a page break at a specific position
|
|
85
|
-
*/
|
|
86
|
-
declare function removePageBreak(doc: Document, position: InsertPosition): Document;
|
|
1
|
+
import { D as Document, B as BreakContent, a as Paragraph, b as Run, c as RunContent } from './agentApi-DLt94vXk.mjs';
|
|
87
2
|
|
|
88
3
|
/**
|
|
89
4
|
* Google Fonts Loader
|
|
@@ -173,4 +88,89 @@ declare function loadFontFromBuffer(fontFamily: string, buffer: ArrayBuffer, opt
|
|
|
173
88
|
*/
|
|
174
89
|
declare function preloadCommonFonts(): Promise<void>;
|
|
175
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Insert Operations Utility
|
|
93
|
+
*
|
|
94
|
+
* Utility functions for inserting content into the document.
|
|
95
|
+
* Provides functions for inserting page breaks, horizontal rules, and other elements.
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Insert position in the document
|
|
100
|
+
*/
|
|
101
|
+
interface InsertPosition {
|
|
102
|
+
/** Paragraph index in the document body */
|
|
103
|
+
paragraphIndex: number;
|
|
104
|
+
/** Run index within the paragraph (optional) */
|
|
105
|
+
runIndex?: number;
|
|
106
|
+
/** Character offset within the run (optional) */
|
|
107
|
+
offset?: number;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Create a page break content element
|
|
111
|
+
*/
|
|
112
|
+
declare function createPageBreak(): BreakContent;
|
|
113
|
+
/**
|
|
114
|
+
* Create a column break content element
|
|
115
|
+
*/
|
|
116
|
+
declare function createColumnBreak(): BreakContent;
|
|
117
|
+
/**
|
|
118
|
+
* Create a text wrapping break (line break)
|
|
119
|
+
*/
|
|
120
|
+
declare function createLineBreak(clear?: 'none' | 'left' | 'right' | 'all'): BreakContent;
|
|
121
|
+
/**
|
|
122
|
+
* Create a run containing a page break
|
|
123
|
+
*/
|
|
124
|
+
declare function createPageBreakRun(): Run;
|
|
125
|
+
/**
|
|
126
|
+
* Create an empty paragraph with a page break before it
|
|
127
|
+
*/
|
|
128
|
+
declare function createPageBreakParagraph(): Paragraph;
|
|
129
|
+
/**
|
|
130
|
+
* Insert a page break at a position in the document
|
|
131
|
+
* This inserts a new paragraph with pageBreakBefore: true
|
|
132
|
+
*/
|
|
133
|
+
declare function insertPageBreak(doc: Document, position: InsertPosition): Document;
|
|
134
|
+
/**
|
|
135
|
+
* Create a horizontal rule paragraph
|
|
136
|
+
* Uses a paragraph with bottom border to simulate horizontal rule
|
|
137
|
+
*/
|
|
138
|
+
declare function createHorizontalRule(): Paragraph;
|
|
139
|
+
/**
|
|
140
|
+
* Insert a horizontal rule at a position in the document
|
|
141
|
+
*/
|
|
142
|
+
declare function insertHorizontalRule(doc: Document, position: InsertPosition): Document;
|
|
143
|
+
/**
|
|
144
|
+
* Check if content is a page break
|
|
145
|
+
*/
|
|
146
|
+
declare function isPageBreak(content: RunContent): boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Check if content is a column break
|
|
149
|
+
*/
|
|
150
|
+
declare function isColumnBreak(content: RunContent): boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Check if content is a line break
|
|
153
|
+
*/
|
|
154
|
+
declare function isLineBreak(content: RunContent): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Check if content is any type of break
|
|
157
|
+
*/
|
|
158
|
+
declare function isBreakContent(content: RunContent): content is BreakContent;
|
|
159
|
+
/**
|
|
160
|
+
* Check if a paragraph has pageBreakBefore
|
|
161
|
+
*/
|
|
162
|
+
declare function hasPageBreakBefore(paragraph: Paragraph): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Count page breaks in a document
|
|
165
|
+
*/
|
|
166
|
+
declare function countPageBreaks(doc: Document): number;
|
|
167
|
+
/**
|
|
168
|
+
* Find all page break positions in a document
|
|
169
|
+
*/
|
|
170
|
+
declare function findPageBreaks(doc: Document): InsertPosition[];
|
|
171
|
+
/**
|
|
172
|
+
* Remove a page break at a specific position
|
|
173
|
+
*/
|
|
174
|
+
declare function removePageBreak(doc: Document, position: InsertPosition): Document;
|
|
175
|
+
|
|
176
176
|
export { type InsertPosition as I, countPageBreaks as a, createColumnBreak as b, canRenderFont as c, createHorizontalRule as d, createLineBreak as e, createPageBreak as f, createPageBreakParagraph as g, createPageBreakRun as h, findPageBreaks as i, getLoadedFonts as j, hasPageBreakBefore as k, insertHorizontalRule as l, insertPageBreak as m, isBreakContent as n, isColumnBreak as o, isFontLoaded as p, isLoading as q, isLineBreak as r, isPageBreak as s, loadFont as t, loadFontFromBuffer as u, loadFonts as v, onFontsLoaded as w, preloadCommonFonts as x, removePageBreak as y };
|
|
@@ -1,89 +1,4 @@
|
|
|
1
|
-
import { D as Document, B as BreakContent, a as Paragraph, b as Run, c as RunContent } from './agentApi-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Insert Operations Utility
|
|
5
|
-
*
|
|
6
|
-
* Utility functions for inserting content into the document.
|
|
7
|
-
* Provides functions for inserting page breaks, horizontal rules, and other elements.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Insert position in the document
|
|
12
|
-
*/
|
|
13
|
-
interface InsertPosition {
|
|
14
|
-
/** Paragraph index in the document body */
|
|
15
|
-
paragraphIndex: number;
|
|
16
|
-
/** Run index within the paragraph (optional) */
|
|
17
|
-
runIndex?: number;
|
|
18
|
-
/** Character offset within the run (optional) */
|
|
19
|
-
offset?: number;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Create a page break content element
|
|
23
|
-
*/
|
|
24
|
-
declare function createPageBreak(): BreakContent;
|
|
25
|
-
/**
|
|
26
|
-
* Create a column break content element
|
|
27
|
-
*/
|
|
28
|
-
declare function createColumnBreak(): BreakContent;
|
|
29
|
-
/**
|
|
30
|
-
* Create a text wrapping break (line break)
|
|
31
|
-
*/
|
|
32
|
-
declare function createLineBreak(clear?: 'none' | 'left' | 'right' | 'all'): BreakContent;
|
|
33
|
-
/**
|
|
34
|
-
* Create a run containing a page break
|
|
35
|
-
*/
|
|
36
|
-
declare function createPageBreakRun(): Run;
|
|
37
|
-
/**
|
|
38
|
-
* Create an empty paragraph with a page break before it
|
|
39
|
-
*/
|
|
40
|
-
declare function createPageBreakParagraph(): Paragraph;
|
|
41
|
-
/**
|
|
42
|
-
* Insert a page break at a position in the document
|
|
43
|
-
* This inserts a new paragraph with pageBreakBefore: true
|
|
44
|
-
*/
|
|
45
|
-
declare function insertPageBreak(doc: Document, position: InsertPosition): Document;
|
|
46
|
-
/**
|
|
47
|
-
* Create a horizontal rule paragraph
|
|
48
|
-
* Uses a paragraph with bottom border to simulate horizontal rule
|
|
49
|
-
*/
|
|
50
|
-
declare function createHorizontalRule(): Paragraph;
|
|
51
|
-
/**
|
|
52
|
-
* Insert a horizontal rule at a position in the document
|
|
53
|
-
*/
|
|
54
|
-
declare function insertHorizontalRule(doc: Document, position: InsertPosition): Document;
|
|
55
|
-
/**
|
|
56
|
-
* Check if content is a page break
|
|
57
|
-
*/
|
|
58
|
-
declare function isPageBreak(content: RunContent): boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Check if content is a column break
|
|
61
|
-
*/
|
|
62
|
-
declare function isColumnBreak(content: RunContent): boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Check if content is a line break
|
|
65
|
-
*/
|
|
66
|
-
declare function isLineBreak(content: RunContent): boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Check if content is any type of break
|
|
69
|
-
*/
|
|
70
|
-
declare function isBreakContent(content: RunContent): content is BreakContent;
|
|
71
|
-
/**
|
|
72
|
-
* Check if a paragraph has pageBreakBefore
|
|
73
|
-
*/
|
|
74
|
-
declare function hasPageBreakBefore(paragraph: Paragraph): boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Count page breaks in a document
|
|
77
|
-
*/
|
|
78
|
-
declare function countPageBreaks(doc: Document): number;
|
|
79
|
-
/**
|
|
80
|
-
* Find all page break positions in a document
|
|
81
|
-
*/
|
|
82
|
-
declare function findPageBreaks(doc: Document): InsertPosition[];
|
|
83
|
-
/**
|
|
84
|
-
* Remove a page break at a specific position
|
|
85
|
-
*/
|
|
86
|
-
declare function removePageBreak(doc: Document, position: InsertPosition): Document;
|
|
1
|
+
import { D as Document, B as BreakContent, a as Paragraph, b as Run, c as RunContent } from './agentApi-DLt94vXk.js';
|
|
87
2
|
|
|
88
3
|
/**
|
|
89
4
|
* Google Fonts Loader
|
|
@@ -173,4 +88,89 @@ declare function loadFontFromBuffer(fontFamily: string, buffer: ArrayBuffer, opt
|
|
|
173
88
|
*/
|
|
174
89
|
declare function preloadCommonFonts(): Promise<void>;
|
|
175
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Insert Operations Utility
|
|
93
|
+
*
|
|
94
|
+
* Utility functions for inserting content into the document.
|
|
95
|
+
* Provides functions for inserting page breaks, horizontal rules, and other elements.
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Insert position in the document
|
|
100
|
+
*/
|
|
101
|
+
interface InsertPosition {
|
|
102
|
+
/** Paragraph index in the document body */
|
|
103
|
+
paragraphIndex: number;
|
|
104
|
+
/** Run index within the paragraph (optional) */
|
|
105
|
+
runIndex?: number;
|
|
106
|
+
/** Character offset within the run (optional) */
|
|
107
|
+
offset?: number;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Create a page break content element
|
|
111
|
+
*/
|
|
112
|
+
declare function createPageBreak(): BreakContent;
|
|
113
|
+
/**
|
|
114
|
+
* Create a column break content element
|
|
115
|
+
*/
|
|
116
|
+
declare function createColumnBreak(): BreakContent;
|
|
117
|
+
/**
|
|
118
|
+
* Create a text wrapping break (line break)
|
|
119
|
+
*/
|
|
120
|
+
declare function createLineBreak(clear?: 'none' | 'left' | 'right' | 'all'): BreakContent;
|
|
121
|
+
/**
|
|
122
|
+
* Create a run containing a page break
|
|
123
|
+
*/
|
|
124
|
+
declare function createPageBreakRun(): Run;
|
|
125
|
+
/**
|
|
126
|
+
* Create an empty paragraph with a page break before it
|
|
127
|
+
*/
|
|
128
|
+
declare function createPageBreakParagraph(): Paragraph;
|
|
129
|
+
/**
|
|
130
|
+
* Insert a page break at a position in the document
|
|
131
|
+
* This inserts a new paragraph with pageBreakBefore: true
|
|
132
|
+
*/
|
|
133
|
+
declare function insertPageBreak(doc: Document, position: InsertPosition): Document;
|
|
134
|
+
/**
|
|
135
|
+
* Create a horizontal rule paragraph
|
|
136
|
+
* Uses a paragraph with bottom border to simulate horizontal rule
|
|
137
|
+
*/
|
|
138
|
+
declare function createHorizontalRule(): Paragraph;
|
|
139
|
+
/**
|
|
140
|
+
* Insert a horizontal rule at a position in the document
|
|
141
|
+
*/
|
|
142
|
+
declare function insertHorizontalRule(doc: Document, position: InsertPosition): Document;
|
|
143
|
+
/**
|
|
144
|
+
* Check if content is a page break
|
|
145
|
+
*/
|
|
146
|
+
declare function isPageBreak(content: RunContent): boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Check if content is a column break
|
|
149
|
+
*/
|
|
150
|
+
declare function isColumnBreak(content: RunContent): boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Check if content is a line break
|
|
153
|
+
*/
|
|
154
|
+
declare function isLineBreak(content: RunContent): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Check if content is any type of break
|
|
157
|
+
*/
|
|
158
|
+
declare function isBreakContent(content: RunContent): content is BreakContent;
|
|
159
|
+
/**
|
|
160
|
+
* Check if a paragraph has pageBreakBefore
|
|
161
|
+
*/
|
|
162
|
+
declare function hasPageBreakBefore(paragraph: Paragraph): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Count page breaks in a document
|
|
165
|
+
*/
|
|
166
|
+
declare function countPageBreaks(doc: Document): number;
|
|
167
|
+
/**
|
|
168
|
+
* Find all page break positions in a document
|
|
169
|
+
*/
|
|
170
|
+
declare function findPageBreaks(doc: Document): InsertPosition[];
|
|
171
|
+
/**
|
|
172
|
+
* Remove a page break at a specific position
|
|
173
|
+
*/
|
|
174
|
+
declare function removePageBreak(doc: Document, position: InsertPosition): Document;
|
|
175
|
+
|
|
176
176
|
export { type InsertPosition as I, countPageBreaks as a, createColumnBreak as b, canRenderFont as c, createHorizontalRule as d, createLineBreak as e, createPageBreak as f, createPageBreakParagraph as g, createPageBreakRun as h, findPageBreaks as i, getLoadedFonts as j, hasPageBreakBefore as k, insertHorizontalRule as l, insertPageBreak as m, isBreakContent as n, isColumnBreak as o, isFontLoaded as p, isLoading as q, isLineBreak as r, isPageBreak as s, loadFont as t, loadFontFromBuffer as u, loadFonts as v, onFontsLoaded as w, preloadCommonFonts as x, removePageBreak as y };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkPEMB6SZT_js=require('./chunk-PEMB6SZT.js');require('./chunk-PBC7XAYZ.js'),require('./chunk-SNLC6EK2.js'),require('./chunk-Z3KMSHUP.js'),require('./chunk-MOE2ZGUE.js'),require('./chunk-Q7UDQXAF.js'),require('./chunk-H5NTJZO4.js');Object.defineProperty(exports,"TABLE_INSERT_EDGE_PROXIMITY",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Xa}});Object.defineProperty(exports,"TABLE_INSERT_HIDE_DELAY_MS",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Ya}});Object.defineProperty(exports,"applyFootnotePresentation",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Pa}});Object.defineProperty(exports,"buildFontString",{enumerable:true,get:function(){return chunkPEMB6SZT_js.v}});Object.defineProperty(exports,"buildFootnoteContentMap",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Ra}});Object.defineProperty(exports,"calculateFootnoteReservedHeights",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Sa}});Object.defineProperty(exports,"calculateHeaderFooterVisualBounds",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Va}});Object.defineProperty(exports,"clearAllCaches",{enumerable:true,get:function(){return chunkPEMB6SZT_js.$}});Object.defineProperty(exports,"clearFontMetricsCache",{enumerable:true,get:function(){return chunkPEMB6SZT_js.S}});Object.defineProperty(exports,"clearParagraphMeasureCache",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Y}});Object.defineProperty(exports,"clearTextWidthCache",{enumerable:true,get:function(){return chunkPEMB6SZT_js.N}});Object.defineProperty(exports,"clickToPosition",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Da}});Object.defineProperty(exports,"clickToPositionDom",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Ga}});Object.defineProperty(exports,"clickToPositionInParagraph",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Ba}});Object.defineProperty(exports,"clickToPositionInTableCell",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Ca}});Object.defineProperty(exports,"collectFootnoteRefs",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Na}});Object.defineProperty(exports,"convertBorderSpecToLayout",{enumerable:true,get:function(){return chunkPEMB6SZT_js.ja}});Object.defineProperty(exports,"convertFootnoteToContent",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Qa}});Object.defineProperty(exports,"convertHeaderFooterToContent",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Wa}});Object.defineProperty(exports,"countTableColumns",{enumerable:true,get:function(){return chunkPEMB6SZT_js.ma}});Object.defineProperty(exports,"detectTableInsertHover",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Za}});Object.defineProperty(exports,"findBodyEmptyRuns",{enumerable:true,get:function(){return chunkPEMB6SZT_js.$a}});Object.defineProperty(exports,"findBodyPmAnchor",{enumerable:true,get:function(){return chunkPEMB6SZT_js.bb}});Object.defineProperty(exports,"findBodyPmAnchors",{enumerable:true,get:function(){return chunkPEMB6SZT_js.ab}});Object.defineProperty(exports,"findBodyPmSpans",{enumerable:true,get:function(){return chunkPEMB6SZT_js._a}});Object.defineProperty(exports,"findCharacterAtX",{enumerable:true,get:function(){return chunkPEMB6SZT_js.A}});Object.defineProperty(exports,"getCachedFontMetrics",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Q}});Object.defineProperty(exports,"getCachedParagraphMeasure",{enumerable:true,get:function(){return chunkPEMB6SZT_js.W}});Object.defineProperty(exports,"getCachedTextWidth",{enumerable:true,get:function(){return chunkPEMB6SZT_js.L}});Object.defineProperty(exports,"getCanvasContext",{enumerable:true,get:function(){return chunkPEMB6SZT_js.t}});Object.defineProperty(exports,"getCaretPosition",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Ka}});Object.defineProperty(exports,"getCaretPositionFromDom",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Ia}});Object.defineProperty(exports,"getFontCacheSize",{enumerable:true,get:function(){return chunkPEMB6SZT_js.U}});Object.defineProperty(exports,"getFontMetrics",{enumerable:true,get:function(){return chunkPEMB6SZT_js.w}});Object.defineProperty(exports,"getPageBounds",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Aa}});Object.defineProperty(exports,"getPageIndexAtY",{enumerable:true,get:function(){return chunkPEMB6SZT_js.ta}});Object.defineProperty(exports,"getPageTop",{enumerable:true,get:function(){return chunkPEMB6SZT_js.sa}});Object.defineProperty(exports,"getParagraphCacheSize",{enumerable:true,get:function(){return chunkPEMB6SZT_js._}});Object.defineProperty(exports,"getPositionRect",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Fa}});Object.defineProperty(exports,"getRunCharWidths",{enumerable:true,get:function(){return chunkPEMB6SZT_js.K}});Object.defineProperty(exports,"getScrollYForPage",{enumerable:true,get:function(){return chunkPEMB6SZT_js.za}});Object.defineProperty(exports,"getSelectionRectsFromDom",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Ha}});Object.defineProperty(exports,"getTextCacheSize",{enumerable:true,get:function(){return chunkPEMB6SZT_js.P}});Object.defineProperty(exports,"getTotalCacheSize",{enumerable:true,get:function(){return chunkPEMB6SZT_js.aa}});Object.defineProperty(exports,"getTotalDocumentHeight",{enumerable:true,get:function(){return chunkPEMB6SZT_js.ya}});Object.defineProperty(exports,"getXForCharacter",{enumerable:true,get:function(){return chunkPEMB6SZT_js.B}});Object.defineProperty(exports,"groupRectsByPage",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Ma}});Object.defineProperty(exports,"halfPtToPx",{enumerable:true,get:function(){return chunkPEMB6SZT_js.G}});Object.defineProperty(exports,"hashParagraphBlock",{enumerable:true,get:function(){return chunkPEMB6SZT_js.V}});Object.defineProperty(exports,"hitTest",{enumerable:true,get:function(){return chunkPEMB6SZT_js.xa}});Object.defineProperty(exports,"hitTestFragment",{enumerable:true,get:function(){return chunkPEMB6SZT_js.ua}});Object.defineProperty(exports,"hitTestImageFragment",{enumerable:true,get:function(){return chunkPEMB6SZT_js.va}});Object.defineProperty(exports,"hitTestPage",{enumerable:true,get:function(){return chunkPEMB6SZT_js.ra}});Object.defineProperty(exports,"hitTestTableCell",{enumerable:true,get:function(){return chunkPEMB6SZT_js.wa}});Object.defineProperty(exports,"isMultiPageSelection",{enumerable:true,get:function(){return chunkPEMB6SZT_js.La}});Object.defineProperty(exports,"mapFootnotesToPages",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Oa}});Object.defineProperty(exports,"measureParagraph",{enumerable:true,get:function(){return chunkPEMB6SZT_js.I}});Object.defineProperty(exports,"measureParagraphs",{enumerable:true,get:function(){return chunkPEMB6SZT_js.J}});Object.defineProperty(exports,"measureRun",{enumerable:true,get:function(){return chunkPEMB6SZT_js.z}});Object.defineProperty(exports,"measureText",{enumerable:true,get:function(){return chunkPEMB6SZT_js.y}});Object.defineProperty(exports,"measureTextWidth",{enumerable:true,get:function(){return chunkPEMB6SZT_js.x}});Object.defineProperty(exports,"mouseToPosition",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Ga}});Object.defineProperty(exports,"normalizeHeaderFooterMeasureBlocks",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Ta}});Object.defineProperty(exports,"normalizeTableColumnWidths",{enumerable:true,get:function(){return chunkPEMB6SZT_js.na}});Object.defineProperty(exports,"positionToX",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Ea}});Object.defineProperty(exports,"ptToPx",{enumerable:true,get:function(){return chunkPEMB6SZT_js.E}});Object.defineProperty(exports,"pxToHalfPt",{enumerable:true,get:function(){return chunkPEMB6SZT_js.H}});Object.defineProperty(exports,"pxToPt",{enumerable:true,get:function(){return chunkPEMB6SZT_js.F}});Object.defineProperty(exports,"pxToTwips",{enumerable:true,get:function(){return chunkPEMB6SZT_js.D}});Object.defineProperty(exports,"resetBlockIdCounter",{enumerable:true,get:function(){return chunkPEMB6SZT_js.ia}});Object.defineProperty(exports,"resetCanvasContext",{enumerable:true,get:function(){return chunkPEMB6SZT_js.u}});Object.defineProperty(exports,"resolveHeaderFooterVisualTop",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Ua}});Object.defineProperty(exports,"resolveListTemplate",{enumerable:true,get:function(){return chunkPEMB6SZT_js.ha}});Object.defineProperty(exports,"resolveTableWidthPx",{enumerable:true,get:function(){return chunkPEMB6SZT_js.la}});Object.defineProperty(exports,"selectionToRects",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Ja}});Object.defineProperty(exports,"setCachedFontMetrics",{enumerable:true,get:function(){return chunkPEMB6SZT_js.R}});Object.defineProperty(exports,"setCachedParagraphMeasure",{enumerable:true,get:function(){return chunkPEMB6SZT_js.X}});Object.defineProperty(exports,"setCachedTextWidth",{enumerable:true,get:function(){return chunkPEMB6SZT_js.M}});Object.defineProperty(exports,"setFontCacheSize",{enumerable:true,get:function(){return chunkPEMB6SZT_js.T}});Object.defineProperty(exports,"setParagraphCacheSize",{enumerable:true,get:function(){return chunkPEMB6SZT_js.Z}});Object.defineProperty(exports,"setTextCacheSize",{enumerable:true,get:function(){return chunkPEMB6SZT_js.O}});Object.defineProperty(exports,"toFlowBlocks",{enumerable:true,get:function(){return chunkPEMB6SZT_js.ka}});Object.defineProperty(exports,"twipsToPx",{enumerable:true,get:function(){return chunkPEMB6SZT_js.C}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{Xa as TABLE_INSERT_EDGE_PROXIMITY,Ya as TABLE_INSERT_HIDE_DELAY_MS,Pa as applyFootnotePresentation,v as buildFontString,Ra as buildFootnoteContentMap,Sa as calculateFootnoteReservedHeights,Va as calculateHeaderFooterVisualBounds,$ as clearAllCaches,S as clearFontMetricsCache,Y as clearParagraphMeasureCache,N as clearTextWidthCache,Da as clickToPosition,Ga as clickToPositionDom,Ba as clickToPositionInParagraph,Ca as clickToPositionInTableCell,Na as collectFootnoteRefs,ja as convertBorderSpecToLayout,Qa as convertFootnoteToContent,Wa as convertHeaderFooterToContent,ma as countTableColumns,Za as detectTableInsertHover,$a as findBodyEmptyRuns,bb as findBodyPmAnchor,ab as findBodyPmAnchors,_a as findBodyPmSpans,A as findCharacterAtX,Q as getCachedFontMetrics,W as getCachedParagraphMeasure,L as getCachedTextWidth,t as getCanvasContext,Ka as getCaretPosition,Ia as getCaretPositionFromDom,U as getFontCacheSize,w as getFontMetrics,Aa as getPageBounds,ta as getPageIndexAtY,sa as getPageTop,_ as getParagraphCacheSize,Fa as getPositionRect,K as getRunCharWidths,za as getScrollYForPage,Ha as getSelectionRectsFromDom,P as getTextCacheSize,aa as getTotalCacheSize,ya as getTotalDocumentHeight,B as getXForCharacter,Ma as groupRectsByPage,G as halfPtToPx,V as hashParagraphBlock,xa as hitTest,ua as hitTestFragment,va as hitTestImageFragment,ra as hitTestPage,wa as hitTestTableCell,La as isMultiPageSelection,Oa as mapFootnotesToPages,I as measureParagraph,J as measureParagraphs,z as measureRun,y as measureText,x as measureTextWidth,Ga as mouseToPosition,Ta as normalizeHeaderFooterMeasureBlocks,na as normalizeTableColumnWidths,Ea as positionToX,E as ptToPx,H as pxToHalfPt,F as pxToPt,D as pxToTwips,ia as resetBlockIdCounter,u as resetCanvasContext,Ua as resolveHeaderFooterVisualTop,ha as resolveListTemplate,la as resolveTableWidthPx,Ja as selectionToRects,R as setCachedFontMetrics,X as setCachedParagraphMeasure,M as setCachedTextWidth,T as setFontCacheSize,Z as setParagraphCacheSize,O as setTextCacheSize,ka as toFlowBlocks,C as twipsToPx}from'./chunk-BXRC4U3X.mjs';import'./chunk-BTCQ2QI3.mjs';import'./chunk-CPAYKE6X.mjs';import'./chunk-76IYR7C7.mjs';import'./chunk-RBUTXXQJ.mjs';import'./chunk-54ULJEHM.mjs';import'./chunk-TAUMSKRE.mjs';
|
package/dist/mcp-reexport.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as McpToolDefinition, e as McpSession, J as JsonSchema } from './types-
|
|
2
|
-
import './agentApi-
|
|
1
|
+
import { M as McpToolDefinition, e as McpSession, J as JsonSchema } from './types-UDsUq8D3.mjs';
|
|
2
|
+
import './agentApi-DLt94vXk.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Core MCP Tools
|
package/dist/mcp-reexport.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as McpToolDefinition, e as McpSession, J as JsonSchema } from './types-
|
|
2
|
-
import './agentApi-
|
|
1
|
+
import { M as McpToolDefinition, e as McpSession, J as JsonSchema } from './types-jbivc9Lj.js';
|
|
2
|
+
import './agentApi-DLt94vXk.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Core MCP Tools
|
package/dist/mcp-reexport.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkTMTLIGLZ_js=require('./chunk-TMTLIGLZ.js'),chunkQGTAIC5E_js=require('./chunk-QGTAIC5E.js');require('./chunk-Z3KMSHUP.js');var chunkP4VSHBGZ_js=require('./chunk-P4VSHBGZ.js');require('./chunk-IFPN3NT3.js');var chunkBUEMG4NW_js=require('./chunk-BUEMG4NW.js');require('./chunk-MOE2ZGUE.js'),require('./chunk-MWLHJWB6.js'),require('./chunk-Q7UDQXAF.js'),require('./chunk-H5NTJZO4.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 chunkP4VSHBGZ_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 chunkTMTLIGLZ_js.i(c.document):t=await chunkTMTLIGLZ_js.r(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.
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
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=
|
|
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=chunkQGTAIC5E_js.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=chunkQGTAIC5E_js.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=chunkQGTAIC5E_js.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=chunkQGTAIC5E_js.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=chunkQGTAIC5E_js.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=chunkBUEMG4NW_js.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:{}}}exports.applyStyleTool=O;exports.closeDocumentTool=R;exports.coreMcpTools=T;exports.createMcpServer=q;exports.deleteTextTool=j;exports.formatTextTool=E;exports.getDocumentInfoTool=k;exports.getDocumentTextTool=$;exports.handleJsonRpcRequest=F;exports.insertTextTool=J;exports.loadDocumentTool=D;exports.replaceTextTool=v;exports.saveDocumentTool=C;exports.startStdioServer=H;
|
package/dist/mcp-reexport.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {i,r}from'./chunk-
|
|
1
|
+
import {i,r}from'./chunk-R3QMYPL5.mjs';import {a as a$1}from'./chunk-5XK326FI.mjs';import'./chunk-76IYR7C7.mjs';import {a}from'./chunk-IOAGVW6Q.mjs';import'./chunk-WOHFANC5.mjs';import {b}from'./chunk-W53SI3XW.mjs';import'./chunk-RBUTXXQJ.mjs';import'./chunk-INTPVEO6.mjs';import'./chunk-54ULJEHM.mjs';import'./chunk-TAUMSKRE.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
|
|
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$1,s)=>{let{documentId:e}=r$1,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 i(c.document):t=await r(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.
|
|
@@ -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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkYC5KZSYD_js=require('./chunk-YC5KZSYD.js');require('./chunk-H5NTJZO4.js');Object.defineProperty(exports,"createTemplateProcessor",{enumerable:true,get:function(){return chunkYC5KZSYD_js.j}});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return chunkYC5KZSYD_js.k}});Object.defineProperty(exports,"getMissingVariables",{enumerable:true,get:function(){return chunkYC5KZSYD_js.g}});Object.defineProperty(exports,"getTemplateTags",{enumerable:true,get:function(){return chunkYC5KZSYD_js.e}});Object.defineProperty(exports,"previewTemplate",{enumerable:true,get:function(){return chunkYC5KZSYD_js.h}});Object.defineProperty(exports,"processTemplate",{enumerable:true,get:function(){return chunkYC5KZSYD_js.a}});Object.defineProperty(exports,"processTemplateAdvanced",{enumerable:true,get:function(){return chunkYC5KZSYD_js.i}});Object.defineProperty(exports,"processTemplateAndDownload",{enumerable:true,get:function(){return chunkYC5KZSYD_js.d}});Object.defineProperty(exports,"processTemplateAsBlob",{enumerable:true,get:function(){return chunkYC5KZSYD_js.c}});Object.defineProperty(exports,"processTemplateDetailed",{enumerable:true,get:function(){return chunkYC5KZSYD_js.b}});Object.defineProperty(exports,"validateTemplate",{enumerable:true,get:function(){return chunkYC5KZSYD_js.f}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{j as createTemplateProcessor,k as default,g as getMissingVariables,e as getTemplateTags,h as previewTemplate,a as processTemplate,i as processTemplateAdvanced,d as processTemplateAndDownload,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-
|
|
1
|
+
export{j as createTemplateProcessor,k as default,g as getMissingVariables,e as getTemplateTags,h as previewTemplate,a as processTemplate,i as processTemplateAdvanced,d as processTemplateAndDownload,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-LVGJKS7Y.mjs';import'./chunk-TAUMSKRE.mjs';
|