@eigenpal/docx-js-editor 0.0.16 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FindReplaceDialog-K4GRE4JB.cjs +2 -0
- package/dist/FindReplaceDialog-K4GRE4JB.cjs.map +1 -0
- package/dist/{FindReplaceDialog-UMXCBBST.js → FindReplaceDialog-MMDEJORP.js} +2 -1
- package/dist/FindReplaceDialog-MMDEJORP.js.map +1 -0
- package/dist/{FootnotePropertiesDialog-TYQGPWPX.js → FootnotePropertiesDialog-HG4267LR.js} +2 -1
- package/dist/FootnotePropertiesDialog-HG4267LR.js.map +1 -0
- package/dist/{FootnotePropertiesDialog-OBQXOBJE.cjs → FootnotePropertiesDialog-V3YOIJCV.cjs} +2 -1
- package/dist/FootnotePropertiesDialog-V3YOIJCV.cjs.map +1 -0
- package/dist/{HyperlinkDialog-UOERZIBM.js → HyperlinkDialog-SCSX4RP7.js} +2 -1
- package/dist/HyperlinkDialog-SCSX4RP7.js.map +1 -0
- package/dist/HyperlinkDialog-YPKURBZK.cjs +2 -0
- package/dist/HyperlinkDialog-YPKURBZK.cjs.map +1 -0
- package/dist/{ImagePositionDialog-52FDANUK.js → ImagePositionDialog-CJYJ35PI.js} +2 -1
- package/dist/ImagePositionDialog-CJYJ35PI.js.map +1 -0
- package/dist/{ImagePositionDialog-ZK5WFBRC.cjs → ImagePositionDialog-IMVI7EXA.cjs} +2 -1
- package/dist/ImagePositionDialog-IMVI7EXA.cjs.map +1 -0
- package/dist/{ImagePropertiesDialog-YPSLPSF6.js → ImagePropertiesDialog-P7WN2ALR.js} +2 -1
- package/dist/ImagePropertiesDialog-P7WN2ALR.js.map +1 -0
- package/dist/{ImagePropertiesDialog-LU44RDIY.cjs → ImagePropertiesDialog-YS4KJRN7.cjs} +2 -1
- package/dist/ImagePropertiesDialog-YS4KJRN7.cjs.map +1 -0
- package/dist/{TablePropertiesDialog-KMOYHPGF.cjs → TablePropertiesDialog-CUQXUBQN.cjs} +2 -1
- package/dist/TablePropertiesDialog-CUQXUBQN.cjs.map +1 -0
- package/dist/{TablePropertiesDialog-OUUJAA7D.js → TablePropertiesDialog-ZHAYVHPZ.js} +2 -1
- package/dist/TablePropertiesDialog-ZHAYVHPZ.js.map +1 -0
- package/dist/{clipboard-BOocwmAM.d.ts → TableToolbar-RHX9L4h9.d.cts} +2 -125
- package/dist/{clipboard-Cx7cb3kX.d.cts → TableToolbar-RHX9L4h9.d.ts} +2 -125
- package/dist/chunk-7FEY3YWC.cjs +3 -0
- package/dist/chunk-7FEY3YWC.cjs.map +1 -0
- package/dist/chunk-AL62KQYJ.js +2 -0
- package/dist/chunk-AL62KQYJ.js.map +1 -0
- package/dist/{chunk-VTAS7VZ6.cjs → chunk-DJAEBZ33.cjs} +2 -1
- package/dist/chunk-DJAEBZ33.cjs.map +1 -0
- package/dist/{chunk-CTYOM6BE.js → chunk-M2T6XKT5.js} +2 -1
- package/dist/chunk-M2T6XKT5.js.map +1 -0
- package/dist/chunk-MXGYESPA.cjs +178 -0
- package/dist/chunk-MXGYESPA.cjs.map +1 -0
- package/dist/chunk-NMYD4OJZ.js +3 -0
- package/dist/chunk-NMYD4OJZ.js.map +1 -0
- package/dist/chunk-OD33FUTO.js +178 -0
- package/dist/chunk-OD33FUTO.js.map +1 -0
- package/dist/{chunk-PJVI53AH.js → chunk-Q6HUGWO6.js} +2 -1
- package/dist/chunk-Q6HUGWO6.js.map +1 -0
- package/dist/{chunk-XS2AQFMF.cjs → chunk-S26DZVRQ.cjs} +2 -1
- package/dist/chunk-S26DZVRQ.cjs.map +1 -0
- package/dist/chunk-V3MCDVZE.cjs +2 -0
- package/dist/chunk-V3MCDVZE.cjs.map +1 -0
- package/dist/{chunk-MLSHZVL7.js → chunk-VIEW4NAF.js} +6 -5
- package/dist/chunk-VIEW4NAF.js.map +1 -0
- package/dist/{chunk-OEOUMSWH.cjs → chunk-ZX4CSEL3.cjs} +6 -5
- package/dist/chunk-ZX4CSEL3.cjs.map +1 -0
- package/dist/core-plugins-reexport.cjs +2 -0
- package/dist/core-plugins-reexport.cjs.map +1 -0
- package/dist/core-plugins-reexport.d.cts +1 -0
- package/dist/core-plugins-reexport.d.ts +1 -0
- package/dist/core-plugins-reexport.js +2 -0
- package/dist/core-plugins-reexport.js.map +1 -0
- package/dist/core-reexport.cjs +2 -0
- package/dist/core-reexport.cjs.map +1 -0
- package/dist/core-reexport.d.cts +4 -0
- package/dist/core-reexport.d.ts +4 -0
- package/dist/core-reexport.js +2 -0
- package/dist/core-reexport.js.map +1 -0
- package/dist/headless-reexport.cjs +2 -0
- package/dist/headless-reexport.cjs.map +1 -0
- package/dist/headless-reexport.d.cts +1 -0
- package/dist/headless-reexport.d.ts +1 -0
- package/dist/headless-reexport.js +2 -0
- package/dist/headless-reexport.js.map +1 -0
- package/dist/index.cjs +10 -9
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +28 -257
- package/dist/index.d.ts +28 -257
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -0
- package/dist/mcp-reexport.cjs +2 -0
- package/dist/mcp-reexport.cjs.map +1 -0
- package/dist/mcp-reexport.d.cts +1 -0
- package/dist/mcp-reexport.d.ts +1 -0
- package/dist/mcp-reexport.js +2 -0
- package/dist/mcp-reexport.js.map +1 -0
- package/dist/react.cjs +2 -1
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +860 -9
- package/dist/react.d.ts +860 -9
- package/dist/react.js +2 -1
- package/dist/react.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/ui.cjs +2 -1
- package/dist/ui.cjs.map +1 -0
- package/dist/ui.d.cts +5 -3
- package/dist/ui.d.ts +5 -3
- package/dist/ui.js +2 -1
- package/dist/ui.js.map +1 -0
- package/package.json +27 -87
- package/LICENSE +0 -21
- package/README.md +0 -171
- package/dist/DocumentAgent-Ci6_T-XM.d.ts +0 -412
- package/dist/DocumentAgent-DEGFgYEN.d.cts +0 -412
- package/dist/FindReplaceDialog-46BE7Q2G.cjs +0 -1
- package/dist/HyperlinkDialog-22NH7ZLP.cjs +0 -1
- package/dist/agentApi-CbVUCZRu.d.cts +0 -2086
- package/dist/agentApi-CbVUCZRu.d.ts +0 -2086
- package/dist/chunk-24N3L4IL.cjs +0 -258
- package/dist/chunk-2ASOEN3V.js +0 -1
- package/dist/chunk-46OFHSPJ.cjs +0 -2
- package/dist/chunk-65OFYOHF.cjs +0 -58
- package/dist/chunk-6YFGCUHU.js +0 -4
- package/dist/chunk-DYQUXFE5.cjs +0 -1
- package/dist/chunk-EMKABJPH.js +0 -1
- package/dist/chunk-ESI4BSBF.js +0 -1
- package/dist/chunk-FYAWM7MP.cjs +0 -1
- package/dist/chunk-GLFFXY2X.js +0 -258
- package/dist/chunk-ITWEFKGQ.cjs +0 -1
- package/dist/chunk-JKN7TNPA.js +0 -12
- package/dist/chunk-KESNGXGO.js +0 -1
- package/dist/chunk-L34XFLQZ.cjs +0 -1
- package/dist/chunk-NO7WUK5E.cjs +0 -12
- package/dist/chunk-NT2REEAA.cjs +0 -1
- package/dist/chunk-O7QVCJN6.cjs +0 -4
- package/dist/chunk-OW5H5DNE.cjs +0 -1
- package/dist/chunk-OWMXCVKB.js +0 -1
- package/dist/chunk-PXC7ARQB.cjs +0 -1
- package/dist/chunk-R5SKERM2.js +0 -1
- package/dist/chunk-RM3ITJ2H.cjs +0 -10
- package/dist/chunk-SF53KLDZ.cjs +0 -1
- package/dist/chunk-TOI5W3HK.js +0 -8
- package/dist/chunk-UAVOWAIF.cjs +0 -8
- package/dist/chunk-ULNHBTYA.js +0 -2
- package/dist/chunk-UXXV4GT6.js +0 -10
- package/dist/chunk-VOWKSURW.cjs +0 -1
- package/dist/chunk-WFWLPKQA.js +0 -1
- package/dist/chunk-WFYRA2TH.js +0 -1
- package/dist/chunk-YMXKVLTU.js +0 -58
- package/dist/chunk-ZDYHAYN6.js +0 -1
- package/dist/colorResolver-CIDiSPWd.d.cts +0 -618
- package/dist/colorResolver-KXbUgzWC.d.ts +0 -618
- package/dist/core-plugins.cjs +0 -1
- package/dist/core-plugins.d.cts +0 -31
- package/dist/core-plugins.d.ts +0 -31
- package/dist/core-plugins.js +0 -1
- package/dist/core.cjs +0 -1
- package/dist/core.d.cts +0 -23
- package/dist/core.d.ts +0 -23
- package/dist/core.js +0 -1
- package/dist/executor-ITYZTNSH.cjs +0 -1
- package/dist/executor-TC7CLATE.js +0 -1
- package/dist/headless.cjs +0 -4
- package/dist/headless.d.cts +0 -195
- package/dist/headless.d.ts +0 -195
- package/dist/headless.js +0 -4
- package/dist/index.css +0 -1
- package/dist/insertOperations-CzB5b-Of.d.ts +0 -176
- package/dist/insertOperations-DKVmCV32.d.cts +0 -176
- package/dist/mcp-cli.js +0 -136
- package/dist/mcp.cjs +0 -16
- package/dist/mcp.d.cts +0 -156
- package/dist/mcp.d.ts +0 -156
- package/dist/mcp.js +0 -16
- package/dist/processTemplate-525HZL4S.cjs +0 -1
- package/dist/processTemplate-RJN6452W.js +0 -1
- package/dist/react-BZxD04XV.d.ts +0 -1350
- package/dist/react-D8eAYckC.d.cts +0 -1350
- package/dist/react.css +0 -1
- package/dist/registry-D4tvj9f3.d.ts +0 -165
- package/dist/registry-ngv6Bumt.d.cts +0 -165
- package/dist/selectionRects-PQEUEW35.cjs +0 -1
- package/dist/selectionRects-QAG5RSHD.js +0 -1
- package/dist/types-D96elyJF.d.cts +0 -310
- package/dist/types-xMzSPT4i.d.ts +0 -310
- package/dist/variableDetector-CPxKo9jP.d.cts +0 -173
- package/dist/variableDetector-DeM1N-_L.d.ts +0 -173
package/dist/types-xMzSPT4i.d.ts
DELETED
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
import { h as Document, v as Position, R as Range, b as AgentCommand } from './agentApi-CbVUCZRu.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Core Plugin System Types
|
|
5
|
-
*
|
|
6
|
-
* Defines the interfaces for headless plugins that work in Node.js
|
|
7
|
-
* without React/DOM dependencies. These plugins extend DocumentAgent
|
|
8
|
-
* with additional commands and expose MCP tools for AI integration.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Core plugin interface - headless, works in Node.js
|
|
13
|
-
*
|
|
14
|
-
* Plugins can:
|
|
15
|
-
* - Register command handlers that DocumentAgent dispatches to
|
|
16
|
-
* - Declare MCP tools that the MCP server exposes to AI clients
|
|
17
|
-
* - Have optional initialization logic
|
|
18
|
-
* - Declare dependencies on other plugins
|
|
19
|
-
*/
|
|
20
|
-
interface CorePlugin {
|
|
21
|
-
/** Unique plugin identifier */
|
|
22
|
-
id: string;
|
|
23
|
-
/** Human-readable plugin name */
|
|
24
|
-
name: string;
|
|
25
|
-
/** Plugin version (semver) */
|
|
26
|
-
version?: string;
|
|
27
|
-
/** Plugin description */
|
|
28
|
-
description?: string;
|
|
29
|
-
/**
|
|
30
|
-
* Command handlers this plugin provides.
|
|
31
|
-
* DocumentAgent dispatches commands to these handlers.
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```ts
|
|
35
|
-
* commandHandlers: {
|
|
36
|
-
* 'insertTemplateVariable': (doc, cmd) => {
|
|
37
|
-
* // Transform document
|
|
38
|
-
* return modifiedDoc;
|
|
39
|
-
* },
|
|
40
|
-
* }
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
commandHandlers?: Record<string, CommandHandler>;
|
|
44
|
-
/**
|
|
45
|
-
* MCP tools this plugin exposes.
|
|
46
|
-
* MCP server collects these from all plugins.
|
|
47
|
-
*/
|
|
48
|
-
mcpTools?: McpToolDefinition[];
|
|
49
|
-
/**
|
|
50
|
-
* Optional setup when plugin is registered.
|
|
51
|
-
* Called once during plugin registration.
|
|
52
|
-
*/
|
|
53
|
-
initialize?: () => void | Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Optional cleanup when plugin is unregistered.
|
|
56
|
-
*/
|
|
57
|
-
destroy?: () => void | Promise<void>;
|
|
58
|
-
/**
|
|
59
|
-
* Dependencies on other plugins (by ID).
|
|
60
|
-
* The registry ensures dependencies are loaded first.
|
|
61
|
-
*/
|
|
62
|
-
dependencies?: string[];
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Command handler function type
|
|
66
|
-
*
|
|
67
|
-
* Receives a document and a command, returns a modified document.
|
|
68
|
-
* Must be pure/immutable - always return a new document.
|
|
69
|
-
*/
|
|
70
|
-
type CommandHandler = (doc: Document, command: PluginCommand) => Document;
|
|
71
|
-
/**
|
|
72
|
-
* Extended command type for plugins
|
|
73
|
-
*
|
|
74
|
-
* Plugins can define custom command types beyond the built-in AgentCommand types.
|
|
75
|
-
*/
|
|
76
|
-
interface PluginCommand {
|
|
77
|
-
/** Command type identifier */
|
|
78
|
-
type: string;
|
|
79
|
-
/** Unique command ID (for undo tracking) */
|
|
80
|
-
id?: string;
|
|
81
|
-
/** Position for positional commands */
|
|
82
|
-
position?: Position;
|
|
83
|
-
/** Range for range-based commands */
|
|
84
|
-
range?: Range;
|
|
85
|
-
/** Additional command-specific data */
|
|
86
|
-
[key: string]: unknown;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Result of command execution
|
|
90
|
-
*/
|
|
91
|
-
interface CommandResult {
|
|
92
|
-
/** The modified document */
|
|
93
|
-
document: Document;
|
|
94
|
-
/** Whether the command succeeded */
|
|
95
|
-
success: boolean;
|
|
96
|
-
/** Error message if failed */
|
|
97
|
-
error?: string;
|
|
98
|
-
/** Metadata about the operation */
|
|
99
|
-
metadata?: Record<string, unknown>;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* MCP tool definition
|
|
103
|
-
*
|
|
104
|
-
* Describes a tool that can be called by AI clients through the MCP server.
|
|
105
|
-
*/
|
|
106
|
-
interface McpToolDefinition {
|
|
107
|
-
/** Tool name (used in MCP protocol) */
|
|
108
|
-
name: string;
|
|
109
|
-
/** Human-readable description for AI */
|
|
110
|
-
description: string;
|
|
111
|
-
/**
|
|
112
|
-
* JSON Schema for tool input validation.
|
|
113
|
-
* Can be a Zod schema or plain JSON Schema object.
|
|
114
|
-
*/
|
|
115
|
-
inputSchema: JsonSchema | ZodSchemaLike;
|
|
116
|
-
/**
|
|
117
|
-
* Handler function for the tool.
|
|
118
|
-
* Receives validated input and returns a result.
|
|
119
|
-
*/
|
|
120
|
-
handler: McpToolHandler;
|
|
121
|
-
/**
|
|
122
|
-
* Optional annotations for the tool
|
|
123
|
-
*/
|
|
124
|
-
annotations?: McpToolAnnotations;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* MCP tool handler function
|
|
128
|
-
*/
|
|
129
|
-
type McpToolHandler = (input: unknown, context: McpToolContext) => Promise<McpToolResult> | McpToolResult;
|
|
130
|
-
/**
|
|
131
|
-
* Context passed to MCP tool handlers
|
|
132
|
-
*/
|
|
133
|
-
interface McpToolContext {
|
|
134
|
-
/** Current document (if loaded) */
|
|
135
|
-
document?: Document;
|
|
136
|
-
/** Document buffer (if loaded) */
|
|
137
|
-
documentBuffer?: ArrayBuffer;
|
|
138
|
-
/** Session state */
|
|
139
|
-
session: McpSession;
|
|
140
|
-
/** Logger for debugging */
|
|
141
|
-
log: (message: string, data?: unknown) => void;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* MCP session state
|
|
145
|
-
*
|
|
146
|
-
* Maintains state across tool calls within a session.
|
|
147
|
-
*/
|
|
148
|
-
interface McpSession {
|
|
149
|
-
/** Session ID */
|
|
150
|
-
id: string;
|
|
151
|
-
/** Loaded documents by ID */
|
|
152
|
-
documents: Map<string, LoadedDocument>;
|
|
153
|
-
/** Custom session data */
|
|
154
|
-
data: Map<string, unknown>;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* A loaded document in the session
|
|
158
|
-
*/
|
|
159
|
-
interface LoadedDocument {
|
|
160
|
-
/** Document ID */
|
|
161
|
-
id: string;
|
|
162
|
-
/** Parsed document */
|
|
163
|
-
document: Document;
|
|
164
|
-
/** Original buffer (for repacking) */
|
|
165
|
-
buffer?: ArrayBuffer;
|
|
166
|
-
/** Source filename or path */
|
|
167
|
-
source?: string;
|
|
168
|
-
/** Last modified timestamp */
|
|
169
|
-
lastModified: number;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* MCP tool result
|
|
173
|
-
*/
|
|
174
|
-
interface McpToolResult {
|
|
175
|
-
/** Result content */
|
|
176
|
-
content: McpToolContent[];
|
|
177
|
-
/** Whether this is an error result */
|
|
178
|
-
isError?: boolean;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* MCP tool content types
|
|
182
|
-
*/
|
|
183
|
-
type McpToolContent = {
|
|
184
|
-
type: 'text';
|
|
185
|
-
text: string;
|
|
186
|
-
} | {
|
|
187
|
-
type: 'image';
|
|
188
|
-
data: string;
|
|
189
|
-
mimeType: string;
|
|
190
|
-
} | {
|
|
191
|
-
type: 'resource';
|
|
192
|
-
uri: string;
|
|
193
|
-
mimeType?: string;
|
|
194
|
-
text?: string;
|
|
195
|
-
};
|
|
196
|
-
/**
|
|
197
|
-
* MCP tool annotations
|
|
198
|
-
*/
|
|
199
|
-
interface McpToolAnnotations {
|
|
200
|
-
/** Tool category for organization */
|
|
201
|
-
category?: string;
|
|
202
|
-
/** Whether this tool modifies the document */
|
|
203
|
-
readOnly?: boolean;
|
|
204
|
-
/** Estimated cost/complexity */
|
|
205
|
-
complexity?: 'low' | 'medium' | 'high';
|
|
206
|
-
/** Example usage */
|
|
207
|
-
examples?: McpToolExample[];
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* MCP tool example
|
|
211
|
-
*/
|
|
212
|
-
interface McpToolExample {
|
|
213
|
-
/** Example description */
|
|
214
|
-
description: string;
|
|
215
|
-
/** Example input */
|
|
216
|
-
input: unknown;
|
|
217
|
-
/** Expected output description */
|
|
218
|
-
output?: string;
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* JSON Schema definition (subset)
|
|
222
|
-
*/
|
|
223
|
-
interface JsonSchema {
|
|
224
|
-
type?: string | string[];
|
|
225
|
-
properties?: Record<string, JsonSchema>;
|
|
226
|
-
items?: JsonSchema;
|
|
227
|
-
required?: string[];
|
|
228
|
-
description?: string;
|
|
229
|
-
enum?: unknown[];
|
|
230
|
-
default?: unknown;
|
|
231
|
-
minimum?: number;
|
|
232
|
-
maximum?: number;
|
|
233
|
-
minLength?: number;
|
|
234
|
-
maxLength?: number;
|
|
235
|
-
pattern?: string;
|
|
236
|
-
format?: string;
|
|
237
|
-
additionalProperties?: boolean | JsonSchema;
|
|
238
|
-
anyOf?: JsonSchema[];
|
|
239
|
-
oneOf?: JsonSchema[];
|
|
240
|
-
allOf?: JsonSchema[];
|
|
241
|
-
$ref?: string;
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Zod-like schema interface for compatibility
|
|
245
|
-
*/
|
|
246
|
-
interface ZodSchemaLike {
|
|
247
|
-
_def?: unknown;
|
|
248
|
-
parse?: (data: unknown) => unknown;
|
|
249
|
-
safeParse?: (data: unknown) => {
|
|
250
|
-
success: boolean;
|
|
251
|
-
data?: unknown;
|
|
252
|
-
error?: unknown;
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Check if a schema is Zod-like
|
|
257
|
-
*/
|
|
258
|
-
declare function isZodSchema(schema: unknown): schema is ZodSchemaLike;
|
|
259
|
-
/**
|
|
260
|
-
* Plugin lifecycle events
|
|
261
|
-
*/
|
|
262
|
-
type PluginEvent = {
|
|
263
|
-
type: 'registered';
|
|
264
|
-
plugin: CorePlugin;
|
|
265
|
-
} | {
|
|
266
|
-
type: 'unregistered';
|
|
267
|
-
pluginId: string;
|
|
268
|
-
} | {
|
|
269
|
-
type: 'error';
|
|
270
|
-
pluginId: string;
|
|
271
|
-
error: Error;
|
|
272
|
-
};
|
|
273
|
-
/**
|
|
274
|
-
* Plugin event listener
|
|
275
|
-
*/
|
|
276
|
-
type PluginEventListener = (event: PluginEvent) => void;
|
|
277
|
-
/**
|
|
278
|
-
* Extract command type from a union
|
|
279
|
-
*/
|
|
280
|
-
type ExtractCommand<T extends AgentCommand, Type extends string> = T extends {
|
|
281
|
-
type: Type;
|
|
282
|
-
} ? T : never;
|
|
283
|
-
/**
|
|
284
|
-
* Create a typed command handler
|
|
285
|
-
*/
|
|
286
|
-
type TypedCommandHandler<T extends PluginCommand> = (doc: Document, command: T) => Document;
|
|
287
|
-
/**
|
|
288
|
-
* Plugin configuration options
|
|
289
|
-
*/
|
|
290
|
-
interface PluginOptions {
|
|
291
|
-
/** Enable debug logging */
|
|
292
|
-
debug?: boolean;
|
|
293
|
-
/** Custom configuration */
|
|
294
|
-
config?: Record<string, unknown>;
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* Result of plugin registration
|
|
298
|
-
*/
|
|
299
|
-
interface PluginRegistrationResult {
|
|
300
|
-
/** Whether registration succeeded */
|
|
301
|
-
success: boolean;
|
|
302
|
-
/** Registered plugin (if successful) */
|
|
303
|
-
plugin?: CorePlugin;
|
|
304
|
-
/** Error message (if failed) */
|
|
305
|
-
error?: string;
|
|
306
|
-
/** Warning messages */
|
|
307
|
-
warnings?: string[];
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
export { type CorePlugin as C, type ExtractCommand as E, type JsonSchema as J, type LoadedDocument as L, type McpSession as M, type PluginOptions as P, type TypedCommandHandler as T, type ZodSchemaLike as Z, type McpToolDefinition as a, type McpToolHandler as b, type McpToolResult as c, type PluginRegistrationResult as d, type CommandHandler as e, type PluginEventListener as f, type CommandResult as g, type McpToolAnnotations as h, type McpToolContent as i, type McpToolContext as j, type PluginCommand as k, type PluginEvent as l, isZodSchema as m, type McpToolExample as n };
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { h as Document, i as DocumentBody, P as Paragraph } from './agentApi-CbVUCZRu.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* DOCX Repacker - Repack modified document into valid DOCX
|
|
5
|
-
*
|
|
6
|
-
* Takes a Document with modified content and creates a new DOCX file
|
|
7
|
-
* by updating document.xml while preserving all other files from
|
|
8
|
-
* the original ZIP archive.
|
|
9
|
-
*
|
|
10
|
-
* This ensures round-trip fidelity:
|
|
11
|
-
* - styles.xml, theme1.xml, fontTable.xml remain untouched
|
|
12
|
-
* - Media files preserved
|
|
13
|
-
* - Relationships preserved
|
|
14
|
-
* - Only document.xml is updated with new content
|
|
15
|
-
*
|
|
16
|
-
* OOXML Package Structure:
|
|
17
|
-
* - [Content_Types].xml - Content type declarations
|
|
18
|
-
* - _rels/.rels - Package relationships
|
|
19
|
-
* - word/document.xml - Main document (modified)
|
|
20
|
-
* - word/styles.xml - Styles (preserved)
|
|
21
|
-
* - word/theme/theme1.xml - Theme (preserved)
|
|
22
|
-
* - word/numbering.xml - Numbering (preserved)
|
|
23
|
-
* - word/fontTable.xml - Font table (preserved)
|
|
24
|
-
* - word/settings.xml - Settings (preserved)
|
|
25
|
-
* - word/header*.xml - Headers (preserved)
|
|
26
|
-
* - word/footer*.xml - Footers (preserved)
|
|
27
|
-
* - word/footnotes.xml - Footnotes (preserved)
|
|
28
|
-
* - word/endnotes.xml - Endnotes (preserved)
|
|
29
|
-
* - word/media/* - Media files (preserved)
|
|
30
|
-
* - word/_rels/document.xml.rels - Document relationships (preserved)
|
|
31
|
-
* - docProps/* - Document properties (preserved)
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Options for repacking DOCX
|
|
36
|
-
*/
|
|
37
|
-
interface RepackOptions {
|
|
38
|
-
/** Compression level (0-9, default: 6) */
|
|
39
|
-
compressionLevel?: number;
|
|
40
|
-
/** Whether to update modification date in docProps/core.xml */
|
|
41
|
-
updateModifiedDate?: boolean;
|
|
42
|
-
/** Custom modifier name for lastModifiedBy */
|
|
43
|
-
modifiedBy?: string;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Repack a Document into a valid DOCX file
|
|
47
|
-
*
|
|
48
|
-
* @param doc - Document with modified content
|
|
49
|
-
* @param options - Optional repack options
|
|
50
|
-
* @returns Promise resolving to DOCX as ArrayBuffer
|
|
51
|
-
* @throws Error if document has no original buffer for round-trip
|
|
52
|
-
*/
|
|
53
|
-
declare function repackDocx(doc: Document, options?: RepackOptions): Promise<ArrayBuffer>;
|
|
54
|
-
/**
|
|
55
|
-
* Create a new DOCX from a Document (without requiring original buffer)
|
|
56
|
-
*
|
|
57
|
-
* @param doc - Document to serialize
|
|
58
|
-
* @returns Promise resolving to DOCX as ArrayBuffer
|
|
59
|
-
*/
|
|
60
|
-
declare function createDocx(doc: Document): Promise<ArrayBuffer>;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Variable Detector Utility
|
|
64
|
-
*
|
|
65
|
-
* Scans a DOCX document for template variables in the format {variable_name}
|
|
66
|
-
* (standard docxtemplater syntax).
|
|
67
|
-
* Returns a unique, sorted list of variable names found in the document.
|
|
68
|
-
*/
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Result of variable detection
|
|
72
|
-
*/
|
|
73
|
-
interface VariableDetectionResult {
|
|
74
|
-
/** Unique variable names sorted alphabetically */
|
|
75
|
-
variables: string[];
|
|
76
|
-
/** Total count of variable occurrences */
|
|
77
|
-
totalOccurrences: number;
|
|
78
|
-
/** Variables by location */
|
|
79
|
-
byLocation: {
|
|
80
|
-
body: string[];
|
|
81
|
-
headers: string[];
|
|
82
|
-
footers: string[];
|
|
83
|
-
footnotes: string[];
|
|
84
|
-
endnotes: string[];
|
|
85
|
-
textBoxes: string[];
|
|
86
|
-
};
|
|
87
|
-
/** Variable occurrences with positions */
|
|
88
|
-
occurrences: VariableOccurrence[];
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* A single variable occurrence with location info
|
|
92
|
-
*/
|
|
93
|
-
interface VariableOccurrence {
|
|
94
|
-
/** Variable name (without braces) */
|
|
95
|
-
name: string;
|
|
96
|
-
/** Location type */
|
|
97
|
-
location: 'body' | 'header' | 'footer' | 'footnote' | 'endnote' | 'textBox';
|
|
98
|
-
/** Paragraph index within location */
|
|
99
|
-
paragraphIndex?: number;
|
|
100
|
-
/** Section index (for headers/footers) */
|
|
101
|
-
sectionIndex?: number;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Detect all template variables in a document
|
|
105
|
-
*
|
|
106
|
-
* @param doc - The parsed document
|
|
107
|
-
* @returns Array of unique variable names sorted alphabetically
|
|
108
|
-
*/
|
|
109
|
-
declare function detectVariables(doc: Document): string[];
|
|
110
|
-
/**
|
|
111
|
-
* Detect variables with detailed information
|
|
112
|
-
*
|
|
113
|
-
* @param doc - The parsed document
|
|
114
|
-
* @returns Detailed detection result
|
|
115
|
-
*/
|
|
116
|
-
declare function detectVariablesDetailed(doc: Document): VariableDetectionResult;
|
|
117
|
-
/**
|
|
118
|
-
* Detect variables in document body
|
|
119
|
-
*/
|
|
120
|
-
declare function detectVariablesInBody(body: DocumentBody): string[];
|
|
121
|
-
/**
|
|
122
|
-
* Detect variables in a paragraph
|
|
123
|
-
*/
|
|
124
|
-
declare function detectVariablesInParagraph(paragraph: Paragraph): string[];
|
|
125
|
-
/**
|
|
126
|
-
* Extract variable names from text
|
|
127
|
-
*
|
|
128
|
-
* @param text - The text to search
|
|
129
|
-
* @returns Array of variable names (without braces)
|
|
130
|
-
*/
|
|
131
|
-
declare function extractVariablesFromText(text: string): string[];
|
|
132
|
-
/**
|
|
133
|
-
* Check if text contains template variables
|
|
134
|
-
*/
|
|
135
|
-
declare function hasTemplateVariables(text: string): boolean;
|
|
136
|
-
/**
|
|
137
|
-
* Check if a variable name is valid
|
|
138
|
-
*/
|
|
139
|
-
declare function isValidVariableName(name: string): boolean;
|
|
140
|
-
/**
|
|
141
|
-
* Sanitize a variable name
|
|
142
|
-
*/
|
|
143
|
-
declare function sanitizeVariableName(name: string): string;
|
|
144
|
-
/**
|
|
145
|
-
* Format a variable name with braces (standard docxtemplater syntax)
|
|
146
|
-
*/
|
|
147
|
-
declare function formatVariable(name: string): string;
|
|
148
|
-
/**
|
|
149
|
-
* Parse a variable string to get the name
|
|
150
|
-
*/
|
|
151
|
-
declare function parseVariable(variable: string): string | null;
|
|
152
|
-
/**
|
|
153
|
-
* Replace variables in text with values
|
|
154
|
-
*
|
|
155
|
-
* @param text - The text containing variables
|
|
156
|
-
* @param values - Map of variable name to replacement value
|
|
157
|
-
* @returns Text with variables replaced
|
|
158
|
-
*/
|
|
159
|
-
declare function replaceVariables(text: string, values: Record<string, string>): string;
|
|
160
|
-
/**
|
|
161
|
-
* Replace all variables in text with a placeholder
|
|
162
|
-
*
|
|
163
|
-
* @param text - The text containing variables
|
|
164
|
-
* @param placeholder - Placeholder to use (default: empty string)
|
|
165
|
-
* @returns Text with variables replaced
|
|
166
|
-
*/
|
|
167
|
-
declare function removeVariables(text: string, placeholder?: string): string;
|
|
168
|
-
/**
|
|
169
|
-
* Check if document has any template variables
|
|
170
|
-
*/
|
|
171
|
-
declare function documentHasVariables(doc: Document): boolean;
|
|
172
|
-
|
|
173
|
-
export { type VariableDetectionResult as V, type VariableOccurrence as a, detectVariablesDetailed as b, createDocx as c, detectVariables as d, detectVariablesInBody as e, detectVariablesInParagraph as f, documentHasVariables as g, extractVariablesFromText as h, formatVariable as i, hasTemplateVariables as j, isValidVariableName as k, repackDocx as l, replaceVariables as m, parseVariable as p, removeVariables as r, sanitizeVariableName as s };
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { h as Document, i as DocumentBody, P as Paragraph } from './agentApi-CbVUCZRu.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* DOCX Repacker - Repack modified document into valid DOCX
|
|
5
|
-
*
|
|
6
|
-
* Takes a Document with modified content and creates a new DOCX file
|
|
7
|
-
* by updating document.xml while preserving all other files from
|
|
8
|
-
* the original ZIP archive.
|
|
9
|
-
*
|
|
10
|
-
* This ensures round-trip fidelity:
|
|
11
|
-
* - styles.xml, theme1.xml, fontTable.xml remain untouched
|
|
12
|
-
* - Media files preserved
|
|
13
|
-
* - Relationships preserved
|
|
14
|
-
* - Only document.xml is updated with new content
|
|
15
|
-
*
|
|
16
|
-
* OOXML Package Structure:
|
|
17
|
-
* - [Content_Types].xml - Content type declarations
|
|
18
|
-
* - _rels/.rels - Package relationships
|
|
19
|
-
* - word/document.xml - Main document (modified)
|
|
20
|
-
* - word/styles.xml - Styles (preserved)
|
|
21
|
-
* - word/theme/theme1.xml - Theme (preserved)
|
|
22
|
-
* - word/numbering.xml - Numbering (preserved)
|
|
23
|
-
* - word/fontTable.xml - Font table (preserved)
|
|
24
|
-
* - word/settings.xml - Settings (preserved)
|
|
25
|
-
* - word/header*.xml - Headers (preserved)
|
|
26
|
-
* - word/footer*.xml - Footers (preserved)
|
|
27
|
-
* - word/footnotes.xml - Footnotes (preserved)
|
|
28
|
-
* - word/endnotes.xml - Endnotes (preserved)
|
|
29
|
-
* - word/media/* - Media files (preserved)
|
|
30
|
-
* - word/_rels/document.xml.rels - Document relationships (preserved)
|
|
31
|
-
* - docProps/* - Document properties (preserved)
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Options for repacking DOCX
|
|
36
|
-
*/
|
|
37
|
-
interface RepackOptions {
|
|
38
|
-
/** Compression level (0-9, default: 6) */
|
|
39
|
-
compressionLevel?: number;
|
|
40
|
-
/** Whether to update modification date in docProps/core.xml */
|
|
41
|
-
updateModifiedDate?: boolean;
|
|
42
|
-
/** Custom modifier name for lastModifiedBy */
|
|
43
|
-
modifiedBy?: string;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Repack a Document into a valid DOCX file
|
|
47
|
-
*
|
|
48
|
-
* @param doc - Document with modified content
|
|
49
|
-
* @param options - Optional repack options
|
|
50
|
-
* @returns Promise resolving to DOCX as ArrayBuffer
|
|
51
|
-
* @throws Error if document has no original buffer for round-trip
|
|
52
|
-
*/
|
|
53
|
-
declare function repackDocx(doc: Document, options?: RepackOptions): Promise<ArrayBuffer>;
|
|
54
|
-
/**
|
|
55
|
-
* Create a new DOCX from a Document (without requiring original buffer)
|
|
56
|
-
*
|
|
57
|
-
* @param doc - Document to serialize
|
|
58
|
-
* @returns Promise resolving to DOCX as ArrayBuffer
|
|
59
|
-
*/
|
|
60
|
-
declare function createDocx(doc: Document): Promise<ArrayBuffer>;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Variable Detector Utility
|
|
64
|
-
*
|
|
65
|
-
* Scans a DOCX document for template variables in the format {variable_name}
|
|
66
|
-
* (standard docxtemplater syntax).
|
|
67
|
-
* Returns a unique, sorted list of variable names found in the document.
|
|
68
|
-
*/
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Result of variable detection
|
|
72
|
-
*/
|
|
73
|
-
interface VariableDetectionResult {
|
|
74
|
-
/** Unique variable names sorted alphabetically */
|
|
75
|
-
variables: string[];
|
|
76
|
-
/** Total count of variable occurrences */
|
|
77
|
-
totalOccurrences: number;
|
|
78
|
-
/** Variables by location */
|
|
79
|
-
byLocation: {
|
|
80
|
-
body: string[];
|
|
81
|
-
headers: string[];
|
|
82
|
-
footers: string[];
|
|
83
|
-
footnotes: string[];
|
|
84
|
-
endnotes: string[];
|
|
85
|
-
textBoxes: string[];
|
|
86
|
-
};
|
|
87
|
-
/** Variable occurrences with positions */
|
|
88
|
-
occurrences: VariableOccurrence[];
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* A single variable occurrence with location info
|
|
92
|
-
*/
|
|
93
|
-
interface VariableOccurrence {
|
|
94
|
-
/** Variable name (without braces) */
|
|
95
|
-
name: string;
|
|
96
|
-
/** Location type */
|
|
97
|
-
location: 'body' | 'header' | 'footer' | 'footnote' | 'endnote' | 'textBox';
|
|
98
|
-
/** Paragraph index within location */
|
|
99
|
-
paragraphIndex?: number;
|
|
100
|
-
/** Section index (for headers/footers) */
|
|
101
|
-
sectionIndex?: number;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Detect all template variables in a document
|
|
105
|
-
*
|
|
106
|
-
* @param doc - The parsed document
|
|
107
|
-
* @returns Array of unique variable names sorted alphabetically
|
|
108
|
-
*/
|
|
109
|
-
declare function detectVariables(doc: Document): string[];
|
|
110
|
-
/**
|
|
111
|
-
* Detect variables with detailed information
|
|
112
|
-
*
|
|
113
|
-
* @param doc - The parsed document
|
|
114
|
-
* @returns Detailed detection result
|
|
115
|
-
*/
|
|
116
|
-
declare function detectVariablesDetailed(doc: Document): VariableDetectionResult;
|
|
117
|
-
/**
|
|
118
|
-
* Detect variables in document body
|
|
119
|
-
*/
|
|
120
|
-
declare function detectVariablesInBody(body: DocumentBody): string[];
|
|
121
|
-
/**
|
|
122
|
-
* Detect variables in a paragraph
|
|
123
|
-
*/
|
|
124
|
-
declare function detectVariablesInParagraph(paragraph: Paragraph): string[];
|
|
125
|
-
/**
|
|
126
|
-
* Extract variable names from text
|
|
127
|
-
*
|
|
128
|
-
* @param text - The text to search
|
|
129
|
-
* @returns Array of variable names (without braces)
|
|
130
|
-
*/
|
|
131
|
-
declare function extractVariablesFromText(text: string): string[];
|
|
132
|
-
/**
|
|
133
|
-
* Check if text contains template variables
|
|
134
|
-
*/
|
|
135
|
-
declare function hasTemplateVariables(text: string): boolean;
|
|
136
|
-
/**
|
|
137
|
-
* Check if a variable name is valid
|
|
138
|
-
*/
|
|
139
|
-
declare function isValidVariableName(name: string): boolean;
|
|
140
|
-
/**
|
|
141
|
-
* Sanitize a variable name
|
|
142
|
-
*/
|
|
143
|
-
declare function sanitizeVariableName(name: string): string;
|
|
144
|
-
/**
|
|
145
|
-
* Format a variable name with braces (standard docxtemplater syntax)
|
|
146
|
-
*/
|
|
147
|
-
declare function formatVariable(name: string): string;
|
|
148
|
-
/**
|
|
149
|
-
* Parse a variable string to get the name
|
|
150
|
-
*/
|
|
151
|
-
declare function parseVariable(variable: string): string | null;
|
|
152
|
-
/**
|
|
153
|
-
* Replace variables in text with values
|
|
154
|
-
*
|
|
155
|
-
* @param text - The text containing variables
|
|
156
|
-
* @param values - Map of variable name to replacement value
|
|
157
|
-
* @returns Text with variables replaced
|
|
158
|
-
*/
|
|
159
|
-
declare function replaceVariables(text: string, values: Record<string, string>): string;
|
|
160
|
-
/**
|
|
161
|
-
* Replace all variables in text with a placeholder
|
|
162
|
-
*
|
|
163
|
-
* @param text - The text containing variables
|
|
164
|
-
* @param placeholder - Placeholder to use (default: empty string)
|
|
165
|
-
* @returns Text with variables replaced
|
|
166
|
-
*/
|
|
167
|
-
declare function removeVariables(text: string, placeholder?: string): string;
|
|
168
|
-
/**
|
|
169
|
-
* Check if document has any template variables
|
|
170
|
-
*/
|
|
171
|
-
declare function documentHasVariables(doc: Document): boolean;
|
|
172
|
-
|
|
173
|
-
export { type VariableDetectionResult as V, type VariableOccurrence as a, detectVariablesDetailed as b, createDocx as c, detectVariables as d, detectVariablesInBody as e, detectVariablesInParagraph as f, documentHasVariables as g, extractVariablesFromText as h, formatVariable as i, hasTemplateVariables as j, isValidVariableName as k, repackDocx as l, replaceVariables as m, parseVariable as p, removeVariables as r, sanitizeVariableName as s };
|