@zeke-02/docx-editor 0.5.2 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +204 -0
- package/dist/FindReplaceDialog-7SQOVQWH.js +1 -0
- package/dist/FindReplaceDialog-RK3A7MSK.mjs +1 -0
- package/dist/{FootnotePropertiesDialog-XQ7NIFIU.js → FootnotePropertiesDialog-2Q2SHVMR.js} +1 -1
- package/dist/{FootnotePropertiesDialog-TNVJJCY6.mjs → FootnotePropertiesDialog-ZKQXW3YO.mjs} +1 -1
- package/dist/{HyperlinkDialog-FR4IZZ7E.mjs → HyperlinkDialog-QV3CVFQU.mjs} +1 -1
- package/dist/HyperlinkDialog-XVAF7FVN.js +1 -0
- package/dist/{ImagePositionDialog-JSZSIKF5.mjs → ImagePositionDialog-EGRH3HPP.mjs} +1 -1
- package/dist/{ImagePositionDialog-2YXRAGZS.js → ImagePositionDialog-HIVHUTBT.js} +1 -1
- package/dist/ImagePropertiesDialog-67WLFIIZ.mjs +1 -0
- package/dist/ImagePropertiesDialog-HSM3JJ22.js +1 -0
- package/dist/KeyboardShortcutsDialog-B0UFuR4w.d.ts +395 -0
- package/dist/KeyboardShortcutsDialog-t6JKL4Aj.d.mts +395 -0
- package/dist/PageSetupDialog-642IAVG2.js +1 -0
- package/dist/PageSetupDialog-ERUQDHAY.mjs +1 -0
- package/dist/PluginHost-HS31VIuo.d.mts +16 -0
- package/dist/PluginHost-zILZO7zX.d.ts +16 -0
- package/dist/{SplitCellDialog-NP3JJYHD.mjs → SplitCellDialog-GFWCFCTD.mjs} +1 -1
- package/dist/{SplitCellDialog-JIAC3RYV.js → SplitCellDialog-M7WF7ANE.js} +1 -1
- package/dist/{TablePropertiesDialog-TIK4AA5M.mjs → TablePropertiesDialog-TZ7VCL6V.mjs} +1 -1
- package/dist/{TablePropertiesDialog-T7D4HSVP.js → TablePropertiesDialog-ZKU2FTUX.js} +1 -1
- package/dist/agentApi-B2Y7kexW.d.ts +486 -0
- package/dist/agentApi-BzUJ_kao.d.mts +486 -0
- package/dist/chunk-2XXILKEQ.js +1 -0
- package/dist/chunk-35DG3R42.js +2 -0
- package/dist/chunk-5UX5CD4C.js +1 -0
- package/dist/chunk-7QQSDIWK.mjs +2 -0
- package/dist/chunk-AW5TISUL.js +3 -0
- package/dist/chunk-B45ECEGY.js +18 -0
- package/dist/chunk-B7CCL7SL.mjs +2 -0
- package/dist/chunk-BRMTZRLJ.js +2 -0
- package/dist/chunk-D47GTKGU.js +2 -0
- package/dist/chunk-F5SERL7X.mjs +2 -0
- package/dist/chunk-FWPVBFKQ.mjs +1 -0
- package/dist/chunk-GGQK26JO.js +2 -0
- package/dist/chunk-GM2S2WMT.mjs +1 -0
- package/dist/chunk-HXDMASAR.js +1 -0
- package/dist/chunk-ILYKDR3C.js +1 -0
- package/dist/chunk-JFRDFK7V.mjs +260 -0
- package/dist/chunk-JPF5R2ZM.mjs +1 -0
- package/dist/chunk-KOXCF3CL.mjs +1 -0
- package/dist/chunk-KRLNX56Y.mjs +2 -0
- package/dist/chunk-LWOHVYKW.mjs +1 -0
- package/dist/chunk-MDTA25AN.mjs +60 -0
- package/dist/chunk-MKNSJOCN.js +70 -0
- package/dist/chunk-NIBCC7WQ.js +1 -0
- package/dist/chunk-NLFXR2VH.js +2 -0
- package/dist/chunk-NOLMVQNN.mjs +40 -0
- package/dist/chunk-ONIYA2FU.mjs +2 -0
- package/dist/chunk-RCIZ7OM3.mjs +70 -0
- package/dist/chunk-SGTUE33R.js +260 -0
- package/dist/{chunk-EHFEG3TX.js → chunk-SNZ57XBI.js} +1 -1
- package/dist/chunk-SOTWG3KJ.mjs +1 -0
- package/dist/chunk-TYPGB4KF.js +1 -0
- package/dist/chunk-U7ZW2DOO.mjs +2 -0
- package/dist/chunk-WO3FIV4B.js +40 -0
- package/dist/{chunk-PKEOQIQO.mjs → chunk-WPI3YRFO.mjs} +1 -1
- package/dist/chunk-XGJ2EORY.mjs +1 -0
- package/dist/chunk-XQZTWWRF.mjs +18 -0
- package/dist/chunk-Y3SEHWZ2.js +1 -0
- package/dist/chunk-YBEVHQCT.js +60 -0
- package/dist/chunk-ZVAFVHWR.mjs +3 -0
- package/dist/chunk-ZXPCJWVY.js +2 -0
- package/dist/{agentApi-DLt94vXk.d.mts → content-REFGFfEH.d.mts} +8 -755
- package/dist/{agentApi-DLt94vXk.d.ts → content-REFGFfEH.d.ts} +8 -755
- package/dist/dialogs.d.mts +25 -0
- package/dist/dialogs.d.ts +25 -0
- package/dist/dialogs.js +1 -0
- package/dist/dialogs.mjs +1 -0
- package/dist/document-Cu2vq_wS.d.mts +294 -0
- package/dist/document-CxOagoLQ.d.ts +294 -0
- package/dist/executor-WBHID2RK.mjs +1 -0
- package/dist/executor-Y5VUOAHY.js +1 -0
- package/dist/findReplace-Bue0JaXh.d.ts +138 -0
- package/dist/findReplace-shXbOjFQ.d.mts +138 -0
- package/dist/fork.d.mts +535 -0
- package/dist/fork.d.ts +535 -0
- package/dist/fork.js +1 -0
- package/dist/fork.mjs +1 -0
- package/dist/hooks.d.mts +598 -0
- package/dist/hooks.d.ts +598 -0
- package/dist/hooks.js +1 -0
- package/dist/hooks.mjs +1 -0
- package/dist/index-B5A-J9GC.d.ts +1119 -0
- package/dist/index-bw-PaozF.d.mts +1119 -0
- package/dist/index.d.mts +12 -591
- package/dist/index.d.ts +12 -591
- package/dist/index.js +1 -120
- package/dist/index.mjs +1 -120
- package/dist/layout-bridge-5GYGYKM5.mjs +1 -0
- package/dist/layout-bridge-QQDA7ELH.js +1 -0
- package/dist/plugin-api.d.mts +165 -0
- package/dist/plugin-api.d.ts +165 -0
- package/dist/plugin-api.js +1 -0
- package/dist/plugin-api.mjs +1 -0
- package/dist/processTemplate-BTBTR7AM.js +1 -0
- package/dist/{processTemplate-W2C5PXZB.mjs → processTemplate-MBX2KDLE.mjs} +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.d.mts +18 -0
- package/dist/styles.d.ts +18 -0
- package/dist/styles.js +1 -0
- package/dist/styles.mjs +1 -0
- package/dist/types-BF48VxkC.d.mts +18 -0
- package/dist/types-BF48VxkC.d.ts +18 -0
- package/dist/types-BnIs4sE7.d.mts +281 -0
- package/dist/types-BnIs4sE7.d.ts +281 -0
- package/dist/types-CW6HFAX6.d.ts +39 -0
- package/dist/types-DIsDCwTG.d.mts +39 -0
- package/dist/ui.d.mts +111 -552
- package/dist/ui.d.ts +111 -552
- package/dist/ui.js +111 -1
- package/dist/ui.mjs +111 -1
- package/dist/useFindReplace-DKy-s3gS.d.ts +261 -0
- package/dist/useFindReplace-vuoKpDKE.d.mts +261 -0
- package/package.json +47 -49
- package/dist/ClipboardManager-CVKX0v9q.d.ts +0 -464
- package/dist/ClipboardManager-V3aaMnWE.d.mts +0 -464
- package/dist/DocumentAgent-BWflKHpH.d.mts +0 -442
- package/dist/DocumentAgent-DsdXtetF.d.ts +0 -442
- package/dist/FindReplaceDialog-L3YF5HIS.mjs +0 -1
- package/dist/FindReplaceDialog-SEBWC5P7.js +0 -1
- package/dist/HyperlinkDialog-WEK6JSAC.js +0 -1
- package/dist/ImagePropertiesDialog-527MFLQO.mjs +0 -1
- package/dist/ImagePropertiesDialog-HG4K3IE7.js +0 -1
- package/dist/PageSetupDialog-GALVJMUB.js +0 -1
- package/dist/PageSetupDialog-TGQIAMI7.mjs +0 -1
- package/dist/TableToolbar-DUgmob2I.d.ts +0 -1273
- package/dist/TableToolbar-YL74HNS1.d.mts +0 -1273
- package/dist/chunk-23SXXIZS.js +0 -111
- package/dist/chunk-3F52AP2Q.js +0 -1
- package/dist/chunk-42O5GXM5.mjs +0 -82
- package/dist/chunk-54ULJEHM.mjs +0 -1
- package/dist/chunk-5XK326FI.mjs +0 -1
- package/dist/chunk-6WPRCJ5A.mjs +0 -1
- package/dist/chunk-76IYR7C7.mjs +0 -1
- package/dist/chunk-AGRIVA4G.js +0 -1
- package/dist/chunk-BTCQ2QI3.mjs +0 -3
- package/dist/chunk-BUEMG4NW.js +0 -1
- package/dist/chunk-BXRC4U3X.mjs +0 -2
- package/dist/chunk-CPAYKE6X.mjs +0 -1
- package/dist/chunk-DACWLFKI.mjs +0 -1
- package/dist/chunk-EPBFWE36.js +0 -2
- package/dist/chunk-FXES3YDB.js +0 -82
- package/dist/chunk-HI66BSGS.mjs +0 -9
- package/dist/chunk-INTPVEO6.mjs +0 -9
- package/dist/chunk-IOAGVW6Q.mjs +0 -2
- package/dist/chunk-JCEWC5QL.mjs +0 -4
- package/dist/chunk-JTIUFACT.js +0 -1
- package/dist/chunk-LUF7PWIC.js +0 -10
- package/dist/chunk-MGEN6GOE.mjs +0 -2
- package/dist/chunk-MOE2ZGUE.js +0 -18
- package/dist/chunk-MWLHJWB6.js +0 -9
- package/dist/chunk-OFYVDN3U.mjs +0 -2
- package/dist/chunk-P4VSHBGZ.js +0 -2
- package/dist/chunk-P5FQHIES.mjs +0 -1
- package/dist/chunk-PBC7XAYZ.js +0 -3
- package/dist/chunk-PEMB6SZT.js +0 -2
- package/dist/chunk-PQMSZTBB.js +0 -9
- package/dist/chunk-Q7UDQXAF.js +0 -1
- package/dist/chunk-QGTAIC5E.js +0 -1
- package/dist/chunk-QVPR2W5S.js +0 -1
- package/dist/chunk-R3QMYPL5.mjs +0 -59
- package/dist/chunk-RBUTXXQJ.mjs +0 -18
- package/dist/chunk-RRWYZ2TS.mjs +0 -111
- package/dist/chunk-S3STEPVO.js +0 -182
- package/dist/chunk-SFUM35DH.js +0 -2
- package/dist/chunk-SNLC6EK2.js +0 -1
- package/dist/chunk-TMTLIGLZ.js +0 -59
- package/dist/chunk-TSE2PWFX.mjs +0 -10
- package/dist/chunk-UKESXQS5.mjs +0 -182
- package/dist/chunk-UWYD42WV.js +0 -4
- package/dist/chunk-UXVACQCY.mjs +0 -1
- package/dist/chunk-W4EIKDM6.mjs +0 -2
- package/dist/chunk-W53SI3XW.mjs +0 -1
- package/dist/chunk-WNS2RBQD.js +0 -2
- package/dist/chunk-Z3KMSHUP.js +0 -1
- package/dist/core-plugins-reexport.d.mts +0 -31
- package/dist/core-plugins-reexport.d.ts +0 -31
- package/dist/core-plugins-reexport.js +0 -1
- package/dist/core-plugins-reexport.mjs +0 -1
- package/dist/core-reexport.d.mts +0 -340
- package/dist/core-reexport.d.ts +0 -340
- package/dist/core-reexport.js +0 -1
- package/dist/core-reexport.mjs +0 -1
- package/dist/documentSerializer-DtS_-oGA.d.mts +0 -664
- package/dist/documentSerializer-Wj1p2ASa.d.ts +0 -664
- package/dist/executor-C3VXF7QA.mjs +0 -1
- package/dist/executor-GDBV3AGV.js +0 -1
- package/dist/headless-reexport.d.mts +0 -197
- package/dist/headless-reexport.d.ts +0 -197
- package/dist/headless-reexport.js +0 -1
- package/dist/headless-reexport.mjs +0 -1
- package/dist/insertOperations-BTH1Asas.d.mts +0 -176
- package/dist/insertOperations-CbUnXAXH.d.ts +0 -176
- package/dist/layout-bridge-EA4DJ227.js +0 -1
- package/dist/layout-bridge-XDPSO6GO.mjs +0 -1
- package/dist/mcp-reexport.d.mts +0 -156
- package/dist/mcp-reexport.d.ts +0 -156
- package/dist/mcp-reexport.js +0 -16
- package/dist/mcp-reexport.mjs +0 -16
- package/dist/processTemplate-MJ2PCSO5.js +0 -1
- package/dist/react-B0W16SV6.d.ts +0 -1330
- package/dist/react-D0Pn1nww.d.mts +0 -1330
- package/dist/react.d.mts +0 -10
- package/dist/react.d.ts +0 -10
- package/dist/react.js +0 -1
- package/dist/react.mjs +0 -1
- package/dist/registry-CH9V-IX0.d.ts +0 -165
- package/dist/registry-CWBKYlNW.d.mts +0 -165
- package/dist/types-UDsUq8D3.d.mts +0 -310
- package/dist/types-jbivc9Lj.d.ts +0 -310
- package/dist/variableDetector-CdQ7ZTzA.d.mts +0 -204
- package/dist/variableDetector-DsRV3A9z.d.ts +0 -204
- package/i18n/de.json +0 -792
- package/i18n/en.json +0 -792
- package/i18n/he.json +0 -792
- package/i18n/pl.json +0 -792
- package/i18n/pt-BR.json +0 -792
- package/i18n/tr.json +0 -792
- package/i18n/zh-CN.json +0 -792
- /package/dist/{chunk-YC5KZSYD.js → chunk-ESZ6JRTW.js} +0 -0
- /package/dist/{chunk-LVGJKS7Y.mjs → chunk-TZMMD6RR.mjs} +0 -0
- /package/dist/{react.css → fork.css} +0 -0
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { D as Document, B as BreakContent, a as Paragraph, b as Run, c as RunContent } from './agentApi-DLt94vXk.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Google Fonts Loader
|
|
5
|
-
*
|
|
6
|
-
* Dynamically loads fonts from Google Fonts API with:
|
|
7
|
-
* - Loading state tracking
|
|
8
|
-
* - Duplicate prevention
|
|
9
|
-
* - Callback notifications
|
|
10
|
-
* - Font availability detection
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Load a font from Google Fonts
|
|
14
|
-
*
|
|
15
|
-
* @param fontFamily - The font family name to load
|
|
16
|
-
* @param options - Optional configuration
|
|
17
|
-
* @returns Promise resolving to true if font loaded successfully, false otherwise
|
|
18
|
-
*/
|
|
19
|
-
declare function loadFont(fontFamily: string, options?: {
|
|
20
|
-
weights?: number[];
|
|
21
|
-
styles?: ('normal' | 'italic')[];
|
|
22
|
-
}): Promise<boolean>;
|
|
23
|
-
/**
|
|
24
|
-
* Load multiple fonts from Google Fonts
|
|
25
|
-
*
|
|
26
|
-
* @param families - Array of font family names to load
|
|
27
|
-
* @param options - Optional configuration
|
|
28
|
-
* @returns Promise resolving when all fonts are loaded (or failed)
|
|
29
|
-
*/
|
|
30
|
-
declare function loadFonts(families: string[], options?: {
|
|
31
|
-
weights?: number[];
|
|
32
|
-
styles?: ('normal' | 'italic')[];
|
|
33
|
-
}): Promise<void>;
|
|
34
|
-
/**
|
|
35
|
-
* Check if a font is loaded
|
|
36
|
-
*
|
|
37
|
-
* @param fontFamily - The font family name to check
|
|
38
|
-
* @returns true if the font is loaded, false otherwise
|
|
39
|
-
*/
|
|
40
|
-
declare function isFontLoaded(fontFamily: string): boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Check if any fonts are currently loading
|
|
43
|
-
*
|
|
44
|
-
* @returns true if any fonts are loading, false otherwise
|
|
45
|
-
*/
|
|
46
|
-
declare function isLoading(): boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Get list of all loaded fonts
|
|
49
|
-
*
|
|
50
|
-
* @returns Array of loaded font family names
|
|
51
|
-
*/
|
|
52
|
-
declare function getLoadedFonts(): string[];
|
|
53
|
-
/**
|
|
54
|
-
* Register a callback to be notified when fonts are loaded
|
|
55
|
-
*
|
|
56
|
-
* @param callback - Function to call when fonts are loaded
|
|
57
|
-
* @returns Cleanup function to remove the callback
|
|
58
|
-
*/
|
|
59
|
-
declare function onFontsLoaded(callback: (fonts: string[]) => void): () => void;
|
|
60
|
-
/**
|
|
61
|
-
* Check if a font is available on the system using canvas measurement
|
|
62
|
-
*
|
|
63
|
-
* This uses the technique of comparing text width with the target font
|
|
64
|
-
* vs a known fallback font. If they differ, the font is available.
|
|
65
|
-
*
|
|
66
|
-
* @param fontFamily - The font family name to check
|
|
67
|
-
* @param fallbackFont - Fallback font to compare against
|
|
68
|
-
* @returns true if font is available, false otherwise
|
|
69
|
-
*/
|
|
70
|
-
declare function canRenderFont(fontFamily: string, fallbackFont?: string): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Load a font from a raw buffer (e.g., embedded in DOCX)
|
|
73
|
-
*
|
|
74
|
-
* @param fontFamily - The font family name
|
|
75
|
-
* @param buffer - Font file buffer (TTF, OTF, WOFF, WOFF2)
|
|
76
|
-
* @param options - Font options
|
|
77
|
-
* @returns Promise resolving when font is loaded
|
|
78
|
-
*/
|
|
79
|
-
declare function loadFontFromBuffer(fontFamily: string, buffer: ArrayBuffer, options?: {
|
|
80
|
-
weight?: number | string;
|
|
81
|
-
style?: 'normal' | 'italic';
|
|
82
|
-
}): Promise<boolean>;
|
|
83
|
-
/**
|
|
84
|
-
* Preload a list of common document fonts
|
|
85
|
-
*
|
|
86
|
-
* This preloads fonts commonly used in DOCX documents that have
|
|
87
|
-
* Google Fonts equivalents.
|
|
88
|
-
*/
|
|
89
|
-
declare function preloadCommonFonts(): Promise<void>;
|
|
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
|
-
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 +0,0 @@
|
|
|
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}});
|
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { M as McpToolDefinition, e as McpSession, J as JsonSchema } from './types-UDsUq8D3.mjs';
|
|
2
|
-
import './agentApi-DLt94vXk.mjs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Core MCP Tools
|
|
6
|
-
*
|
|
7
|
-
* Built-in MCP tools for document operations that are always available.
|
|
8
|
-
* These provide basic document manipulation without requiring plugins.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Load a DOCX document from base64
|
|
13
|
-
*/
|
|
14
|
-
declare const loadDocumentTool: McpToolDefinition;
|
|
15
|
-
/**
|
|
16
|
-
* Save a document to base64
|
|
17
|
-
*/
|
|
18
|
-
declare const saveDocumentTool: McpToolDefinition;
|
|
19
|
-
/**
|
|
20
|
-
* Close a document
|
|
21
|
-
*/
|
|
22
|
-
declare const closeDocumentTool: McpToolDefinition;
|
|
23
|
-
/**
|
|
24
|
-
* Get document information
|
|
25
|
-
*/
|
|
26
|
-
declare const getDocumentInfoTool: McpToolDefinition;
|
|
27
|
-
/**
|
|
28
|
-
* Get document plain text
|
|
29
|
-
*/
|
|
30
|
-
declare const getDocumentTextTool: McpToolDefinition;
|
|
31
|
-
/**
|
|
32
|
-
* Insert text at a position
|
|
33
|
-
*/
|
|
34
|
-
declare const insertTextTool: McpToolDefinition;
|
|
35
|
-
/**
|
|
36
|
-
* Replace text in a range
|
|
37
|
-
*/
|
|
38
|
-
declare const replaceTextTool: McpToolDefinition;
|
|
39
|
-
/**
|
|
40
|
-
* Delete text in a range
|
|
41
|
-
*/
|
|
42
|
-
declare const deleteTextTool: McpToolDefinition;
|
|
43
|
-
/**
|
|
44
|
-
* Apply text formatting
|
|
45
|
-
*/
|
|
46
|
-
declare const formatTextTool: McpToolDefinition;
|
|
47
|
-
/**
|
|
48
|
-
* Apply paragraph style
|
|
49
|
-
*/
|
|
50
|
-
declare const applyStyleTool: McpToolDefinition;
|
|
51
|
-
declare const coreMcpTools: McpToolDefinition[];
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* MCP Server
|
|
55
|
-
*
|
|
56
|
-
* Model Context Protocol server that exposes document editing tools to AI clients.
|
|
57
|
-
* Discovers and registers tools from the plugin system plus core built-in tools.
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```ts
|
|
61
|
-
* import { createMcpServer, startStdioServer } from '@eigenpal/docx-editor/mcp';
|
|
62
|
-
* import { pluginRegistry, docxtemplaterPlugin } from '@eigenpal/docx-editor/core-plugins';
|
|
63
|
-
*
|
|
64
|
-
* // Register plugins
|
|
65
|
-
* pluginRegistry.register(docxtemplaterPlugin);
|
|
66
|
-
*
|
|
67
|
-
* // Start MCP server
|
|
68
|
-
* startStdioServer();
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* MCP Server configuration
|
|
74
|
-
*/
|
|
75
|
-
interface McpServerConfig {
|
|
76
|
-
/** Server name */
|
|
77
|
-
name?: string;
|
|
78
|
-
/** Server version */
|
|
79
|
-
version?: string;
|
|
80
|
-
/** Include core tools (default: true) */
|
|
81
|
-
includeCoreTools?: boolean;
|
|
82
|
-
/** Enable debug logging */
|
|
83
|
-
debug?: boolean;
|
|
84
|
-
/** Custom tools to add */
|
|
85
|
-
additionalTools?: McpToolDefinition[];
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* MCP Server instance
|
|
89
|
-
*/
|
|
90
|
-
interface McpServer {
|
|
91
|
-
/** All registered tools */
|
|
92
|
-
tools: Map<string, McpToolDefinition>;
|
|
93
|
-
/** Active session */
|
|
94
|
-
session: McpSession;
|
|
95
|
-
/** Handle a tool call */
|
|
96
|
-
handleToolCall(toolName: string, input: unknown): Promise<unknown>;
|
|
97
|
-
/** List available tools */
|
|
98
|
-
listTools(): McpToolInfo[];
|
|
99
|
-
/** Get server info */
|
|
100
|
-
getInfo(): {
|
|
101
|
-
name: string;
|
|
102
|
-
version: string;
|
|
103
|
-
toolCount: number;
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Tool info for listing
|
|
108
|
-
*/
|
|
109
|
-
interface McpToolInfo {
|
|
110
|
-
name: string;
|
|
111
|
-
description: string;
|
|
112
|
-
inputSchema: JsonSchema;
|
|
113
|
-
category?: string;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Create an MCP server instance
|
|
117
|
-
*
|
|
118
|
-
* @param config - Server configuration
|
|
119
|
-
* @returns MCP server instance
|
|
120
|
-
*/
|
|
121
|
-
declare function createMcpServer(config?: McpServerConfig): McpServer;
|
|
122
|
-
/**
|
|
123
|
-
* JSON-RPC request
|
|
124
|
-
*/
|
|
125
|
-
interface JsonRpcRequest {
|
|
126
|
-
jsonrpc: '2.0';
|
|
127
|
-
id: string | number;
|
|
128
|
-
method: string;
|
|
129
|
-
params?: unknown;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* JSON-RPC response
|
|
133
|
-
*/
|
|
134
|
-
interface JsonRpcResponse {
|
|
135
|
-
jsonrpc: '2.0';
|
|
136
|
-
id: string | number;
|
|
137
|
-
result?: unknown;
|
|
138
|
-
error?: {
|
|
139
|
-
code: number;
|
|
140
|
-
message: string;
|
|
141
|
-
data?: unknown;
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Handle a JSON-RPC request
|
|
146
|
-
*/
|
|
147
|
-
declare function handleJsonRpcRequest(server: McpServer, request: JsonRpcRequest): Promise<JsonRpcResponse>;
|
|
148
|
-
/**
|
|
149
|
-
* Start the MCP server with stdio transport
|
|
150
|
-
*
|
|
151
|
-
* Reads JSON-RPC requests from stdin, writes responses to stdout.
|
|
152
|
-
* This is the standard way to run an MCP server for Claude Desktop.
|
|
153
|
-
*/
|
|
154
|
-
declare function startStdioServer(config?: McpServerConfig): Promise<void>;
|
|
155
|
-
|
|
156
|
-
export { type McpServer, type McpServerConfig, type McpToolInfo, applyStyleTool, closeDocumentTool, coreMcpTools, createMcpServer, deleteTextTool, formatTextTool, getDocumentInfoTool, getDocumentTextTool, handleJsonRpcRequest, insertTextTool, loadDocumentTool, replaceTextTool, saveDocumentTool, startStdioServer };
|
package/dist/mcp-reexport.d.ts
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { M as McpToolDefinition, e as McpSession, J as JsonSchema } from './types-jbivc9Lj.js';
|
|
2
|
-
import './agentApi-DLt94vXk.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Core MCP Tools
|
|
6
|
-
*
|
|
7
|
-
* Built-in MCP tools for document operations that are always available.
|
|
8
|
-
* These provide basic document manipulation without requiring plugins.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Load a DOCX document from base64
|
|
13
|
-
*/
|
|
14
|
-
declare const loadDocumentTool: McpToolDefinition;
|
|
15
|
-
/**
|
|
16
|
-
* Save a document to base64
|
|
17
|
-
*/
|
|
18
|
-
declare const saveDocumentTool: McpToolDefinition;
|
|
19
|
-
/**
|
|
20
|
-
* Close a document
|
|
21
|
-
*/
|
|
22
|
-
declare const closeDocumentTool: McpToolDefinition;
|
|
23
|
-
/**
|
|
24
|
-
* Get document information
|
|
25
|
-
*/
|
|
26
|
-
declare const getDocumentInfoTool: McpToolDefinition;
|
|
27
|
-
/**
|
|
28
|
-
* Get document plain text
|
|
29
|
-
*/
|
|
30
|
-
declare const getDocumentTextTool: McpToolDefinition;
|
|
31
|
-
/**
|
|
32
|
-
* Insert text at a position
|
|
33
|
-
*/
|
|
34
|
-
declare const insertTextTool: McpToolDefinition;
|
|
35
|
-
/**
|
|
36
|
-
* Replace text in a range
|
|
37
|
-
*/
|
|
38
|
-
declare const replaceTextTool: McpToolDefinition;
|
|
39
|
-
/**
|
|
40
|
-
* Delete text in a range
|
|
41
|
-
*/
|
|
42
|
-
declare const deleteTextTool: McpToolDefinition;
|
|
43
|
-
/**
|
|
44
|
-
* Apply text formatting
|
|
45
|
-
*/
|
|
46
|
-
declare const formatTextTool: McpToolDefinition;
|
|
47
|
-
/**
|
|
48
|
-
* Apply paragraph style
|
|
49
|
-
*/
|
|
50
|
-
declare const applyStyleTool: McpToolDefinition;
|
|
51
|
-
declare const coreMcpTools: McpToolDefinition[];
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* MCP Server
|
|
55
|
-
*
|
|
56
|
-
* Model Context Protocol server that exposes document editing tools to AI clients.
|
|
57
|
-
* Discovers and registers tools from the plugin system plus core built-in tools.
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```ts
|
|
61
|
-
* import { createMcpServer, startStdioServer } from '@eigenpal/docx-editor/mcp';
|
|
62
|
-
* import { pluginRegistry, docxtemplaterPlugin } from '@eigenpal/docx-editor/core-plugins';
|
|
63
|
-
*
|
|
64
|
-
* // Register plugins
|
|
65
|
-
* pluginRegistry.register(docxtemplaterPlugin);
|
|
66
|
-
*
|
|
67
|
-
* // Start MCP server
|
|
68
|
-
* startStdioServer();
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* MCP Server configuration
|
|
74
|
-
*/
|
|
75
|
-
interface McpServerConfig {
|
|
76
|
-
/** Server name */
|
|
77
|
-
name?: string;
|
|
78
|
-
/** Server version */
|
|
79
|
-
version?: string;
|
|
80
|
-
/** Include core tools (default: true) */
|
|
81
|
-
includeCoreTools?: boolean;
|
|
82
|
-
/** Enable debug logging */
|
|
83
|
-
debug?: boolean;
|
|
84
|
-
/** Custom tools to add */
|
|
85
|
-
additionalTools?: McpToolDefinition[];
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* MCP Server instance
|
|
89
|
-
*/
|
|
90
|
-
interface McpServer {
|
|
91
|
-
/** All registered tools */
|
|
92
|
-
tools: Map<string, McpToolDefinition>;
|
|
93
|
-
/** Active session */
|
|
94
|
-
session: McpSession;
|
|
95
|
-
/** Handle a tool call */
|
|
96
|
-
handleToolCall(toolName: string, input: unknown): Promise<unknown>;
|
|
97
|
-
/** List available tools */
|
|
98
|
-
listTools(): McpToolInfo[];
|
|
99
|
-
/** Get server info */
|
|
100
|
-
getInfo(): {
|
|
101
|
-
name: string;
|
|
102
|
-
version: string;
|
|
103
|
-
toolCount: number;
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Tool info for listing
|
|
108
|
-
*/
|
|
109
|
-
interface McpToolInfo {
|
|
110
|
-
name: string;
|
|
111
|
-
description: string;
|
|
112
|
-
inputSchema: JsonSchema;
|
|
113
|
-
category?: string;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Create an MCP server instance
|
|
117
|
-
*
|
|
118
|
-
* @param config - Server configuration
|
|
119
|
-
* @returns MCP server instance
|
|
120
|
-
*/
|
|
121
|
-
declare function createMcpServer(config?: McpServerConfig): McpServer;
|
|
122
|
-
/**
|
|
123
|
-
* JSON-RPC request
|
|
124
|
-
*/
|
|
125
|
-
interface JsonRpcRequest {
|
|
126
|
-
jsonrpc: '2.0';
|
|
127
|
-
id: string | number;
|
|
128
|
-
method: string;
|
|
129
|
-
params?: unknown;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* JSON-RPC response
|
|
133
|
-
*/
|
|
134
|
-
interface JsonRpcResponse {
|
|
135
|
-
jsonrpc: '2.0';
|
|
136
|
-
id: string | number;
|
|
137
|
-
result?: unknown;
|
|
138
|
-
error?: {
|
|
139
|
-
code: number;
|
|
140
|
-
message: string;
|
|
141
|
-
data?: unknown;
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Handle a JSON-RPC request
|
|
146
|
-
*/
|
|
147
|
-
declare function handleJsonRpcRequest(server: McpServer, request: JsonRpcRequest): Promise<JsonRpcResponse>;
|
|
148
|
-
/**
|
|
149
|
-
* Start the MCP server with stdio transport
|
|
150
|
-
*
|
|
151
|
-
* Reads JSON-RPC requests from stdin, writes responses to stdout.
|
|
152
|
-
* This is the standard way to run an MCP server for Claude Desktop.
|
|
153
|
-
*/
|
|
154
|
-
declare function startStdioServer(config?: McpServerConfig): Promise<void>;
|
|
155
|
-
|
|
156
|
-
export { type McpServer, type McpServerConfig, type McpToolInfo, applyStyleTool, closeDocumentTool, coreMcpTools, createMcpServer, deleteTextTool, formatTextTool, getDocumentInfoTool, getDocumentTextTool, handleJsonRpcRequest, insertTextTool, loadDocumentTool, replaceTextTool, saveDocumentTool, startStdioServer };
|
package/dist/mcp-reexport.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
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 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
|
-
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
|
-
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
|
-
Returns all text concatenated with paragraph breaks.
|
|
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
|
-
`),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
|
-
`).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=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
|
-
`);}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
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
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$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
|
-
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
|
-
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
|
-
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
|
-
Returns all text concatenated with paragraph breaks.
|
|
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
|
-
`),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
|
-
`).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$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
|
-
`);}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 +0,0 @@
|
|
|
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}});
|