@eigenpal/docx-js-editor 0.0.15 → 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.
Files changed (171) hide show
  1. package/dist/FindReplaceDialog-K4GRE4JB.cjs +2 -0
  2. package/dist/FindReplaceDialog-K4GRE4JB.cjs.map +1 -0
  3. package/dist/{FindReplaceDialog-UMXCBBST.js → FindReplaceDialog-MMDEJORP.js} +2 -1
  4. package/dist/FindReplaceDialog-MMDEJORP.js.map +1 -0
  5. package/dist/{FootnotePropertiesDialog-TYQGPWPX.js → FootnotePropertiesDialog-HG4267LR.js} +2 -1
  6. package/dist/FootnotePropertiesDialog-HG4267LR.js.map +1 -0
  7. package/dist/{FootnotePropertiesDialog-OBQXOBJE.cjs → FootnotePropertiesDialog-V3YOIJCV.cjs} +2 -1
  8. package/dist/FootnotePropertiesDialog-V3YOIJCV.cjs.map +1 -0
  9. package/dist/{HyperlinkDialog-UOERZIBM.js → HyperlinkDialog-SCSX4RP7.js} +2 -1
  10. package/dist/HyperlinkDialog-SCSX4RP7.js.map +1 -0
  11. package/dist/HyperlinkDialog-YPKURBZK.cjs +2 -0
  12. package/dist/HyperlinkDialog-YPKURBZK.cjs.map +1 -0
  13. package/dist/{ImagePositionDialog-52FDANUK.js → ImagePositionDialog-CJYJ35PI.js} +2 -1
  14. package/dist/ImagePositionDialog-CJYJ35PI.js.map +1 -0
  15. package/dist/{ImagePositionDialog-ZK5WFBRC.cjs → ImagePositionDialog-IMVI7EXA.cjs} +2 -1
  16. package/dist/ImagePositionDialog-IMVI7EXA.cjs.map +1 -0
  17. package/dist/{ImagePropertiesDialog-YPSLPSF6.js → ImagePropertiesDialog-P7WN2ALR.js} +2 -1
  18. package/dist/ImagePropertiesDialog-P7WN2ALR.js.map +1 -0
  19. package/dist/{ImagePropertiesDialog-LU44RDIY.cjs → ImagePropertiesDialog-YS4KJRN7.cjs} +2 -1
  20. package/dist/ImagePropertiesDialog-YS4KJRN7.cjs.map +1 -0
  21. package/dist/{TablePropertiesDialog-KMOYHPGF.cjs → TablePropertiesDialog-CUQXUBQN.cjs} +2 -1
  22. package/dist/TablePropertiesDialog-CUQXUBQN.cjs.map +1 -0
  23. package/dist/{TablePropertiesDialog-OUUJAA7D.js → TablePropertiesDialog-ZHAYVHPZ.js} +2 -1
  24. package/dist/TablePropertiesDialog-ZHAYVHPZ.js.map +1 -0
  25. package/dist/{clipboard-BOocwmAM.d.ts → TableToolbar-RHX9L4h9.d.cts} +2 -125
  26. package/dist/{clipboard-Cx7cb3kX.d.cts → TableToolbar-RHX9L4h9.d.ts} +2 -125
  27. package/dist/chunk-7FEY3YWC.cjs +3 -0
  28. package/dist/chunk-7FEY3YWC.cjs.map +1 -0
  29. package/dist/chunk-AL62KQYJ.js +2 -0
  30. package/dist/chunk-AL62KQYJ.js.map +1 -0
  31. package/dist/{chunk-VTAS7VZ6.cjs → chunk-DJAEBZ33.cjs} +2 -1
  32. package/dist/chunk-DJAEBZ33.cjs.map +1 -0
  33. package/dist/{chunk-CTYOM6BE.js → chunk-M2T6XKT5.js} +2 -1
  34. package/dist/chunk-M2T6XKT5.js.map +1 -0
  35. package/dist/chunk-MXGYESPA.cjs +178 -0
  36. package/dist/chunk-MXGYESPA.cjs.map +1 -0
  37. package/dist/chunk-NMYD4OJZ.js +3 -0
  38. package/dist/chunk-NMYD4OJZ.js.map +1 -0
  39. package/dist/chunk-OD33FUTO.js +178 -0
  40. package/dist/chunk-OD33FUTO.js.map +1 -0
  41. package/dist/{chunk-PJVI53AH.js → chunk-Q6HUGWO6.js} +2 -1
  42. package/dist/chunk-Q6HUGWO6.js.map +1 -0
  43. package/dist/{chunk-XS2AQFMF.cjs → chunk-S26DZVRQ.cjs} +2 -1
  44. package/dist/chunk-S26DZVRQ.cjs.map +1 -0
  45. package/dist/chunk-V3MCDVZE.cjs +2 -0
  46. package/dist/chunk-V3MCDVZE.cjs.map +1 -0
  47. package/dist/{chunk-MLSHZVL7.js → chunk-VIEW4NAF.js} +6 -5
  48. package/dist/chunk-VIEW4NAF.js.map +1 -0
  49. package/dist/{chunk-OEOUMSWH.cjs → chunk-ZX4CSEL3.cjs} +6 -5
  50. package/dist/chunk-ZX4CSEL3.cjs.map +1 -0
  51. package/dist/core-plugins-reexport.cjs +2 -0
  52. package/dist/core-plugins-reexport.cjs.map +1 -0
  53. package/dist/core-plugins-reexport.d.cts +1 -0
  54. package/dist/core-plugins-reexport.d.ts +1 -0
  55. package/dist/core-plugins-reexport.js +2 -0
  56. package/dist/core-plugins-reexport.js.map +1 -0
  57. package/dist/core-reexport.cjs +2 -0
  58. package/dist/core-reexport.cjs.map +1 -0
  59. package/dist/core-reexport.d.cts +4 -0
  60. package/dist/core-reexport.d.ts +4 -0
  61. package/dist/core-reexport.js +2 -0
  62. package/dist/core-reexport.js.map +1 -0
  63. package/dist/headless-reexport.cjs +2 -0
  64. package/dist/headless-reexport.cjs.map +1 -0
  65. package/dist/headless-reexport.d.cts +1 -0
  66. package/dist/headless-reexport.d.ts +1 -0
  67. package/dist/headless-reexport.js +2 -0
  68. package/dist/headless-reexport.js.map +1 -0
  69. package/dist/index.cjs +10 -9
  70. package/dist/index.cjs.map +1 -0
  71. package/dist/index.d.cts +28 -257
  72. package/dist/index.d.ts +28 -257
  73. package/dist/index.js +10 -9
  74. package/dist/index.js.map +1 -0
  75. package/dist/mcp-reexport.cjs +2 -0
  76. package/dist/mcp-reexport.cjs.map +1 -0
  77. package/dist/mcp-reexport.d.cts +1 -0
  78. package/dist/mcp-reexport.d.ts +1 -0
  79. package/dist/mcp-reexport.js +2 -0
  80. package/dist/mcp-reexport.js.map +1 -0
  81. package/dist/react.cjs +2 -1
  82. package/dist/react.cjs.map +1 -0
  83. package/dist/react.d.cts +860 -9
  84. package/dist/react.d.ts +860 -9
  85. package/dist/react.js +2 -1
  86. package/dist/react.js.map +1 -0
  87. package/dist/styles.css +1 -1
  88. package/dist/ui.cjs +2 -1
  89. package/dist/ui.cjs.map +1 -0
  90. package/dist/ui.d.cts +5 -3
  91. package/dist/ui.d.ts +5 -3
  92. package/dist/ui.js +2 -1
  93. package/dist/ui.js.map +1 -0
  94. package/package.json +28 -120
  95. package/LICENSE +0 -21
  96. package/README.md +0 -171
  97. package/dist/DocumentAgent-Ci6_T-XM.d.ts +0 -412
  98. package/dist/DocumentAgent-DEGFgYEN.d.cts +0 -412
  99. package/dist/FindReplaceDialog-46BE7Q2G.cjs +0 -1
  100. package/dist/HyperlinkDialog-22NH7ZLP.cjs +0 -1
  101. package/dist/agentApi-CbVUCZRu.d.cts +0 -2086
  102. package/dist/agentApi-CbVUCZRu.d.ts +0 -2086
  103. package/dist/chunk-24N3L4IL.cjs +0 -258
  104. package/dist/chunk-2ASOEN3V.js +0 -1
  105. package/dist/chunk-46OFHSPJ.cjs +0 -2
  106. package/dist/chunk-65OFYOHF.cjs +0 -58
  107. package/dist/chunk-6YFGCUHU.js +0 -4
  108. package/dist/chunk-DYQUXFE5.cjs +0 -1
  109. package/dist/chunk-EMKABJPH.js +0 -1
  110. package/dist/chunk-ESI4BSBF.js +0 -1
  111. package/dist/chunk-FYAWM7MP.cjs +0 -1
  112. package/dist/chunk-GLFFXY2X.js +0 -258
  113. package/dist/chunk-ITWEFKGQ.cjs +0 -1
  114. package/dist/chunk-JKN7TNPA.js +0 -12
  115. package/dist/chunk-KESNGXGO.js +0 -1
  116. package/dist/chunk-L34XFLQZ.cjs +0 -1
  117. package/dist/chunk-NO7WUK5E.cjs +0 -12
  118. package/dist/chunk-NT2REEAA.cjs +0 -1
  119. package/dist/chunk-O7QVCJN6.cjs +0 -4
  120. package/dist/chunk-OW5H5DNE.cjs +0 -1
  121. package/dist/chunk-OWMXCVKB.js +0 -1
  122. package/dist/chunk-PXC7ARQB.cjs +0 -1
  123. package/dist/chunk-R5SKERM2.js +0 -1
  124. package/dist/chunk-RM3ITJ2H.cjs +0 -10
  125. package/dist/chunk-SF53KLDZ.cjs +0 -1
  126. package/dist/chunk-TOI5W3HK.js +0 -8
  127. package/dist/chunk-UAVOWAIF.cjs +0 -8
  128. package/dist/chunk-ULNHBTYA.js +0 -2
  129. package/dist/chunk-UXXV4GT6.js +0 -10
  130. package/dist/chunk-VOWKSURW.cjs +0 -1
  131. package/dist/chunk-WFWLPKQA.js +0 -1
  132. package/dist/chunk-WFYRA2TH.js +0 -1
  133. package/dist/chunk-YMXKVLTU.js +0 -58
  134. package/dist/chunk-ZDYHAYN6.js +0 -1
  135. package/dist/colorResolver-CIDiSPWd.d.cts +0 -618
  136. package/dist/colorResolver-KXbUgzWC.d.ts +0 -618
  137. package/dist/core-plugins.cjs +0 -1
  138. package/dist/core-plugins.d.cts +0 -31
  139. package/dist/core-plugins.d.ts +0 -31
  140. package/dist/core-plugins.js +0 -1
  141. package/dist/core.cjs +0 -1
  142. package/dist/core.d.cts +0 -23
  143. package/dist/core.d.ts +0 -23
  144. package/dist/core.js +0 -1
  145. package/dist/executor-ITYZTNSH.cjs +0 -1
  146. package/dist/executor-TC7CLATE.js +0 -1
  147. package/dist/headless.cjs +0 -4
  148. package/dist/headless.d.cts +0 -195
  149. package/dist/headless.d.ts +0 -195
  150. package/dist/headless.js +0 -4
  151. package/dist/index.css +0 -1
  152. package/dist/insertOperations-CzB5b-Of.d.ts +0 -176
  153. package/dist/insertOperations-DKVmCV32.d.cts +0 -176
  154. package/dist/mcp-cli.js +0 -136
  155. package/dist/mcp.cjs +0 -16
  156. package/dist/mcp.d.cts +0 -156
  157. package/dist/mcp.d.ts +0 -156
  158. package/dist/mcp.js +0 -16
  159. package/dist/processTemplate-525HZL4S.cjs +0 -1
  160. package/dist/processTemplate-RJN6452W.js +0 -1
  161. package/dist/react-BZxD04XV.d.ts +0 -1350
  162. package/dist/react-D8eAYckC.d.cts +0 -1350
  163. package/dist/react.css +0 -1
  164. package/dist/registry-D4tvj9f3.d.ts +0 -165
  165. package/dist/registry-ngv6Bumt.d.cts +0 -165
  166. package/dist/selectionRects-PQEUEW35.cjs +0 -1
  167. package/dist/selectionRects-QAG5RSHD.js +0 -1
  168. package/dist/types-D96elyJF.d.cts +0 -310
  169. package/dist/types-xMzSPT4i.d.ts +0 -310
  170. package/dist/variableDetector-CPxKo9jP.d.cts +0 -173
  171. package/dist/variableDetector-DeM1N-_L.d.ts +0 -173
@@ -1,618 +0,0 @@
1
- import { h as Document, b as AgentCommand, c as AgentContext, R as Range, C as SelectionContext, X as TextFormatting, i as DocumentBody, S as SectionProperties, ae as ColorValue, Y as Theme, af as ThemeColorSlot } from './agentApi-CbVUCZRu.js';
2
- import { a as DocxInput } from './DocumentAgent-Ci6_T-XM.js';
3
-
4
- /**
5
- * Command Executor
6
- *
7
- * Executes agent commands on a document immutably:
8
- * - Handles all command types from AgentCommand
9
- * - Preserves surrounding formatting
10
- * - Returns new document (immutable updates)
11
- */
12
-
13
- /**
14
- * Execute an agent command on a document
15
- * Returns a new document with the command applied (immutable)
16
- *
17
- * Dispatch order:
18
- * 1. Try plugin handlers first (allows plugins to override built-in commands)
19
- * 2. Fall back to built-in handlers
20
- *
21
- * @param doc - The document to modify
22
- * @param command - The command to execute
23
- * @returns New document with command applied
24
- */
25
- declare function executeCommand(doc: Document, command: AgentCommand): Document;
26
- /**
27
- * Execute multiple commands in sequence
28
- *
29
- * @param doc - The document to modify
30
- * @param commands - Commands to execute in order
31
- * @returns New document with all commands applied
32
- */
33
- declare function executeCommands(doc: Document, commands: AgentCommand[]): Document;
34
-
35
- /**
36
- * Agent Context Builder
37
- *
38
- * Generates context objects for AI/LLM consumption from DOCX documents.
39
- * The context provides a structured summary of the document that can be
40
- * used by AI agents to understand the document structure and content.
41
- *
42
- * All outputs are JSON serializable for easy transmission to AI backends.
43
- */
44
-
45
- /**
46
- * Options for building agent context
47
- */
48
- interface AgentContextOptions {
49
- /** Maximum characters per paragraph in outline (default: 100) */
50
- outlineMaxChars?: number;
51
- /** Maximum paragraphs to include in outline (default: 50) */
52
- maxOutlineParagraphs?: number;
53
- /** Include table content in context (default: false) */
54
- includeTableContent?: boolean;
55
- /** Include detailed formatting info (default: false) */
56
- includeFormatting?: boolean;
57
- }
58
- /**
59
- * Options for building selection context
60
- */
61
- interface SelectionContextOptions$1 {
62
- /** Characters of context before/after selection (default: 200) */
63
- contextChars?: number;
64
- /** Include suggested actions (default: true) */
65
- includeSuggestions?: boolean;
66
- }
67
- /**
68
- * Build agent context from a document
69
- *
70
- * @param doc - The parsed document
71
- * @param options - Context building options
72
- * @returns AgentContext object (JSON serializable)
73
- */
74
- declare function getAgentContext(doc: Document, options?: AgentContextOptions): AgentContext;
75
- /**
76
- * Build selection context for AI operations
77
- *
78
- * @param doc - The parsed document
79
- * @param range - The selected range
80
- * @param options - Selection context options
81
- * @returns SelectionContext object (JSON serializable)
82
- */
83
- declare function buildSelectionContext$1(doc: Document, range: Range, options?: SelectionContextOptions$1): SelectionContext;
84
- /**
85
- * Get a simple document summary for quick context
86
- *
87
- * @param doc - The parsed document
88
- * @returns Summary string
89
- */
90
- declare function getDocumentSummary(doc: Document): string;
91
-
92
- /**
93
- * Selection Context Builder
94
- *
95
- * Builds rich context objects from document selections for AI operations.
96
- * Includes selected text, formatting, surrounding context, and suggested actions.
97
- */
98
-
99
- /**
100
- * Options for building selection context
101
- */
102
- interface SelectionContextOptions {
103
- /** Characters of context before selection (default: 200) */
104
- contextCharsBefore?: number;
105
- /** Characters of context after selection (default: 200) */
106
- contextCharsAfter?: number;
107
- /** Include suggested actions (default: true) */
108
- includeSuggestions?: boolean;
109
- /** Include document summary (default: true) */
110
- includeDocumentSummary?: boolean;
111
- /** Maximum suggested actions (default: 8) */
112
- maxSuggestions?: number;
113
- }
114
- /**
115
- * Extended selection context with additional details
116
- */
117
- interface ExtendedSelectionContext extends SelectionContext {
118
- /** Document summary for additional context */
119
- documentSummary?: string;
120
- /** Selection word count */
121
- wordCount?: number;
122
- /** Selection character count */
123
- characterCount?: number;
124
- /** Is selection multi-paragraph */
125
- isMultiParagraph?: boolean;
126
- /** Selected paragraph indices */
127
- paragraphIndices?: number[];
128
- /** Language detection hint */
129
- detectedLanguage?: string;
130
- /** Content type hints */
131
- contentType?: 'prose' | 'list' | 'heading' | 'table' | 'mixed';
132
- }
133
- /**
134
- * Selection formatting summary
135
- */
136
- interface FormattingSummary {
137
- /** Predominant formatting */
138
- predominant: Partial<TextFormatting>;
139
- /** Is formatting consistent across selection */
140
- isConsistent: boolean;
141
- /** All formatting found */
142
- allFormatting: Partial<TextFormatting>[];
143
- }
144
- /**
145
- * Build selection context for AI operations
146
- *
147
- * @param doc - The parsed document
148
- * @param range - The selected range
149
- * @param options - Selection context options
150
- * @returns SelectionContext object
151
- */
152
- declare function buildSelectionContext(doc: Document, range: Range, options?: SelectionContextOptions): SelectionContext;
153
- /**
154
- * Build extended selection context with additional details
155
- *
156
- * @param doc - The parsed document
157
- * @param range - The selected range
158
- * @param options - Selection context options
159
- * @returns ExtendedSelectionContext object
160
- */
161
- declare function buildExtendedSelectionContext(doc: Document, range: Range, options?: SelectionContextOptions): ExtendedSelectionContext;
162
- /**
163
- * Get formatting summary for a selection
164
- *
165
- * @param doc - The parsed document
166
- * @param range - The selected range
167
- * @returns FormattingSummary object
168
- */
169
- declare function getSelectionFormattingSummary(doc: Document, range: Range): FormattingSummary;
170
-
171
- /**
172
- * Main Parser Orchestrator - Unified parseDocx function
173
- *
174
- * Coordinates all sub-parsers to produce a complete Document model.
175
- * Handles loading order, dependency resolution, and font preloading.
176
- *
177
- * Parsing order:
178
- * 1. Unzip DOCX package
179
- * 2. Parse relationships
180
- * 3. Parse theme (needed for style color/font resolution)
181
- * 4. Parse styles (depends on theme)
182
- * 5. Parse numbering
183
- * 6. Parse document body (depends on styles, theme, numbering, rels)
184
- * 7. Parse headers/footers (depends on styles, theme, numbering, rels)
185
- * 8. Parse footnotes/endnotes (depends on styles, theme, numbering, rels)
186
- * 9. Extract and load fonts
187
- * 10. Build media file map
188
- * 11. Assemble final Document
189
- */
190
-
191
- /**
192
- * Progress callback for tracking parsing stages
193
- */
194
- type ProgressCallback = (stage: string, percent: number) => void;
195
- /**
196
- * Parsing options
197
- */
198
- interface ParseOptions {
199
- /** Progress callback for tracking parsing stages */
200
- onProgress?: ProgressCallback;
201
- /** Whether to preload fonts (default: true) */
202
- preloadFonts?: boolean;
203
- /** Whether to parse headers/footers (default: true) */
204
- parseHeadersFooters?: boolean;
205
- /** Whether to parse footnotes/endnotes (default: true) */
206
- parseNotes?: boolean;
207
- /** Whether to detect template variables (default: true) */
208
- detectVariables?: boolean;
209
- }
210
- /**
211
- * Parse a DOCX file into a complete Document model
212
- *
213
- * @param input - DOCX file as ArrayBuffer, Uint8Array, Blob, or File
214
- * @param options - Parsing options
215
- * @returns Promise resolving to Document
216
- * @throws Error if parsing fails
217
- */
218
- declare function parseDocx(input: DocxInput, options?: ParseOptions): Promise<Document>;
219
-
220
- /**
221
- * Document Serializer - Serialize complete document.xml
222
- *
223
- * Converts Document objects back to valid document.xml OOXML format.
224
- * Combines all content (paragraphs, tables) with section properties
225
- * and proper namespace declarations.
226
- *
227
- * OOXML Reference:
228
- * - Document root: w:document
229
- * - Document body: w:body
230
- * - Section properties: w:sectPr
231
- */
232
-
233
- /**
234
- * Serialize section properties (w:sectPr)
235
- */
236
- declare function serializeSectionProperties(props: SectionProperties | undefined): string;
237
- /**
238
- * Serialize a DocumentBody to document.xml body content
239
- *
240
- * @param body - The document body to serialize
241
- * @returns XML string for the body element (without body tags)
242
- */
243
- declare function serializeDocumentBody(body: DocumentBody): string;
244
- /**
245
- * Serialize a complete Document to valid document.xml
246
- *
247
- * @param doc - The document to serialize
248
- * @returns Complete XML string for document.xml
249
- */
250
- declare function serializeDocument(doc: Document): string;
251
-
252
- /**
253
- * Template Processing Utility
254
- *
255
- * Uses docxtemplater to substitute template variables in DOCX documents:
256
- * - Processes {variable_name} patterns (docxtemplater default syntax)
257
- * - Preserves all formatting (fonts, styles, colors, tables)
258
- * - Error handling with useful messages
259
- */
260
- /**
261
- * Options for template processing
262
- */
263
- interface ProcessTemplateOptions {
264
- /** How to handle undefined variables */
265
- nullGetter?: 'keep' | 'empty' | 'error';
266
- /** Custom parser for variable names */
267
- parser?: (tag: string) => {
268
- get: (scope: Record<string, unknown>) => unknown;
269
- };
270
- /** Line breaks: keep raw \n or convert to w:br */
271
- linebreaks?: boolean;
272
- /** Delimiter settings */
273
- delimiters?: {
274
- start?: string;
275
- end?: string;
276
- };
277
- }
278
- /**
279
- * Result of template processing
280
- */
281
- interface ProcessTemplateResult {
282
- /** The processed document buffer */
283
- buffer: ArrayBuffer;
284
- /** Variables that were found and replaced */
285
- replacedVariables: string[];
286
- /** Variables that were not replaced (no value provided) */
287
- unreplacedVariables: string[];
288
- /** Any warnings during processing */
289
- warnings: string[];
290
- }
291
- /**
292
- * Error details from template processing
293
- */
294
- interface TemplateError {
295
- /** Error message */
296
- message: string;
297
- /** Variable name that caused the error (if applicable) */
298
- variable?: string;
299
- /** Error type */
300
- type: 'parse' | 'render' | 'undefined' | 'unknown';
301
- /** Original error */
302
- originalError?: Error;
303
- }
304
- /**
305
- * Process a DOCX template with variable substitution
306
- *
307
- * @param buffer - The DOCX file as ArrayBuffer
308
- * @param variables - Map of variable names to values
309
- * @param options - Processing options
310
- * @returns Processed DOCX as ArrayBuffer
311
- */
312
- declare function processTemplate(buffer: ArrayBuffer, variables: Record<string, string>, options?: ProcessTemplateOptions): ArrayBuffer;
313
- /**
314
- * Process template with detailed result
315
- *
316
- * @param buffer - The DOCX file as ArrayBuffer
317
- * @param variables - Map of variable names to values
318
- * @param options - Processing options
319
- * @returns Detailed processing result
320
- */
321
- declare function processTemplateDetailed(buffer: ArrayBuffer, variables: Record<string, string>, options?: ProcessTemplateOptions): ProcessTemplateResult;
322
- /**
323
- * Process template and return as Blob
324
- *
325
- * @param buffer - The DOCX file as ArrayBuffer
326
- * @param variables - Map of variable names to values
327
- * @param options - Processing options
328
- * @returns Processed DOCX as Blob
329
- */
330
- declare function processTemplateAsBlob(buffer: ArrayBuffer, variables: Record<string, string>, options?: ProcessTemplateOptions): Blob;
331
- /**
332
- * Get all template tags in a document without processing
333
- *
334
- * @param buffer - The DOCX file as ArrayBuffer
335
- * @returns List of tag names found
336
- */
337
- declare function getTemplateTags(buffer: ArrayBuffer): string[];
338
- /**
339
- * Validate that a document is a valid docxtemplater template
340
- *
341
- * @param buffer - The DOCX file as ArrayBuffer
342
- * @returns Validation result
343
- */
344
- declare function validateTemplate(buffer: ArrayBuffer): {
345
- valid: boolean;
346
- errors: TemplateError[];
347
- tags: string[];
348
- };
349
- /**
350
- * Check if all required variables have values
351
- *
352
- * @param tags - List of template tags
353
- * @param variables - Provided variable values
354
- * @returns Missing variable names
355
- */
356
- declare function getMissingVariables(tags: string[], variables: Record<string, string>): string[];
357
- /**
358
- * Preview what the document will look like after processing
359
- * Returns the document text with variables replaced (for preview purposes)
360
- *
361
- * @param buffer - The DOCX file as ArrayBuffer
362
- * @param variables - Map of variable names to values
363
- * @returns Preview text
364
- */
365
- declare function previewTemplate(buffer: ArrayBuffer, variables: Record<string, string>): string;
366
- /**
367
- * Process template with conditional sections
368
- * Supports #if, #unless, #each loops
369
- *
370
- * @param buffer - The DOCX file as ArrayBuffer
371
- * @param data - Full data object (can include arrays, nested objects)
372
- * @param options - Processing options
373
- * @returns Processed DOCX as ArrayBuffer
374
- */
375
- declare function processTemplateAdvanced(buffer: ArrayBuffer, data: Record<string, unknown>, options?: ProcessTemplateOptions): ArrayBuffer;
376
- /**
377
- * Create a template processor with preset options
378
- */
379
- declare function createTemplateProcessor(defaultOptions?: ProcessTemplateOptions): (buffer: ArrayBuffer, variables: Record<string, string>) => ArrayBuffer;
380
-
381
- /**
382
- * Create Document Utility
383
- *
384
- * Provides functions to create new documents programmatically.
385
- */
386
-
387
- /**
388
- * Options for creating an empty document
389
- */
390
- interface CreateEmptyDocumentOptions {
391
- /** Page width in twips (default: 12240 = 8.5 inches) */
392
- pageWidth?: number;
393
- /** Page height in twips (default: 15840 = 11 inches) */
394
- pageHeight?: number;
395
- /** Page orientation (default: 'portrait') */
396
- orientation?: 'portrait' | 'landscape';
397
- /** Top margin in twips (default: 1440 = 1 inch) */
398
- marginTop?: number;
399
- /** Bottom margin in twips (default: 1440 = 1 inch) */
400
- marginBottom?: number;
401
- /** Left margin in twips (default: 1440 = 1 inch) */
402
- marginLeft?: number;
403
- /** Right margin in twips (default: 1440 = 1 inch) */
404
- marginRight?: number;
405
- /** Initial text content (default: empty string) */
406
- initialText?: string;
407
- }
408
- /**
409
- * Create an empty document with a single paragraph
410
- *
411
- * @param options - Optional configuration for the document
412
- * @returns A new empty Document object
413
- *
414
- * @example
415
- * ```ts
416
- * // Create a blank document
417
- * const doc = createEmptyDocument();
418
- *
419
- * // Create with custom margins
420
- * const doc = createEmptyDocument({
421
- * marginTop: 720, // 0.5 inch
422
- * marginBottom: 720,
423
- * });
424
- *
425
- * // Create with initial text
426
- * const doc = createEmptyDocument({
427
- * initialText: 'Hello, World!'
428
- * });
429
- * ```
430
- */
431
- declare function createEmptyDocument(options?: CreateEmptyDocumentOptions): Document;
432
- /**
433
- * Create a document with a single paragraph containing the given text
434
- *
435
- * @param text - The text content for the document
436
- * @param options - Optional configuration for the document
437
- * @returns A new Document object with the specified text
438
- */
439
- declare function createDocumentWithText(text: string, options?: Omit<CreateEmptyDocumentOptions, 'initialText'>): Document;
440
-
441
- /**
442
- * Convert twips to pixels (at 96 DPI)
443
- *
444
- * 1 inch = 1440 twips = 96 pixels
445
- * → 1 twip = 96/1440 pixels = 1/15 pixels
446
- */
447
- declare function twipsToPixels(twips: number): number;
448
- /**
449
- * Convert pixels to twips
450
- */
451
- declare function pixelsToTwips(px: number): number;
452
- /**
453
- * Convert EMUs to pixels (at 96 DPI)
454
- *
455
- * 1 inch = 914400 EMUs = 96 pixels
456
- */
457
- declare function emuToPixels(emu: number): number;
458
- /**
459
- * Convert pixels to EMUs
460
- */
461
- declare function pixelsToEmu(px: number): number;
462
- /**
463
- * Convert EMUs to twips
464
- */
465
- declare function emuToTwips(emu: number): number;
466
- /**
467
- * Convert twips to EMUs
468
- */
469
- declare function twipsToEmu(twips: number): number;
470
- /**
471
- * Convert points to pixels (at 96 DPI)
472
- *
473
- * 1 inch = 72 points = 96 pixels
474
- * → 1 point = 96/72 pixels = 4/3 pixels
475
- */
476
- declare function pointsToPixels(points: number): number;
477
- /**
478
- * Convert half-points to pixels (at 96 DPI)
479
- *
480
- * Half-points are commonly used for font sizes in OOXML (w:sz).
481
- */
482
- declare function halfPointsToPixels(halfPoints: number): number;
483
- /**
484
- * Format a pixel value as CSS string
485
- */
486
- declare function formatPx(px: number): string;
487
-
488
- /**
489
- * Color Resolver - Convert OOXML colors to CSS
490
- *
491
- * Handles:
492
- * - Theme color references (accent1, dk1, etc.)
493
- * - RGB hex values
494
- * - "auto" colors (context-dependent)
495
- * - Tint/shade modifications
496
- *
497
- * OOXML Color References:
498
- * - w:color/@w:val - RGB hex or "auto"
499
- * - w:color/@w:themeColor - Theme color slot
500
- * - w:color/@w:themeTint - Tint modifier (0-255, hex)
501
- * - w:color/@w:themeShade - Shade modifier (0-255, hex)
502
- *
503
- * Tint/Shade Calculations:
504
- * - Tint makes color lighter (blend with white)
505
- * - Shade makes color darker (blend with black)
506
- * - Value is in hex (00-FF), converted to 0-1 for calculation
507
- */
508
-
509
- /**
510
- * Resolve a ColorValue to a CSS color string
511
- *
512
- * @param color - ColorValue object with rgb, themeColor, tint/shade, or auto
513
- * @param theme - Theme for resolving theme colors
514
- * @param defaultColor - Default color if auto or undefined (default: black)
515
- * @returns CSS color string (e.g., "#FF0000" or "inherit")
516
- */
517
- declare function resolveColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, defaultColor?: string): string;
518
- /**
519
- * Resolve a highlight color name to CSS
520
- *
521
- * @param highlight - Highlight color name (e.g., "yellow", "cyan")
522
- * @returns CSS color string or empty string for "none"
523
- */
524
- declare function resolveHighlightColor(highlight: string | undefined): string;
525
- /**
526
- * Resolve a shading fill or pattern color to CSS
527
- *
528
- * @param color - ColorValue for fill
529
- * @param theme - Theme for resolving theme colors
530
- * @returns CSS color string
531
- */
532
- declare function resolveShadingColor(color: ColorValue | undefined | null, theme: Theme | null | undefined): string;
533
- /**
534
- * Check if a color is effectively black
535
- *
536
- * @param color - ColorValue object
537
- * @param theme - Theme for resolving theme colors
538
- * @returns True if color resolves to black or very dark
539
- */
540
- declare function isBlack(color: ColorValue | undefined | null, theme: Theme | null | undefined): boolean;
541
- /**
542
- * Check if a color is effectively white
543
- *
544
- * @param color - ColorValue object
545
- * @param theme - Theme for resolving theme colors
546
- * @returns True if color resolves to white or very light
547
- */
548
- declare function isWhite(color: ColorValue | undefined | null, theme: Theme | null | undefined): boolean;
549
- /**
550
- * Get contrasting text color for a background
551
- *
552
- * @param backgroundColor - Background ColorValue
553
- * @param theme - Theme for resolving theme colors
554
- * @returns Black or white hex color for best contrast
555
- */
556
- declare function getContrastingColor(backgroundColor: ColorValue | undefined | null, theme: Theme | null | undefined): string;
557
- /**
558
- * Parse a color string (various formats) to ColorValue
559
- *
560
- * @param colorString - Color string like "FF0000", "auto", or theme color name
561
- * @returns ColorValue object
562
- */
563
- declare function parseColorString(colorString: string | undefined): ColorValue | undefined;
564
- /**
565
- * Create a ColorValue from theme color reference
566
- *
567
- * @param themeColor - Theme color slot name
568
- * @param tint - Optional tint modifier
569
- * @param shade - Optional shade modifier
570
- * @returns ColorValue object
571
- */
572
- declare function createThemeColor(themeColor: ThemeColorSlot, tint?: number, shade?: number): ColorValue;
573
- /**
574
- * Create a ColorValue from RGB hex
575
- *
576
- * @param hex - 6-character hex color (no #)
577
- * @returns ColorValue object
578
- */
579
- declare function createRgbColor(hex: string): ColorValue;
580
- /**
581
- * Darken a color by a percentage
582
- *
583
- * @param color - ColorValue to darken
584
- * @param theme - Theme for resolving
585
- * @param percent - Percentage to darken (0-100)
586
- * @returns CSS color string
587
- */
588
- declare function darkenColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, percent: number): string;
589
- /**
590
- * Lighten a color by a percentage
591
- *
592
- * @param color - ColorValue to lighten
593
- * @param theme - Theme for resolving
594
- * @param percent - Percentage to lighten (0-100)
595
- * @returns CSS color string
596
- */
597
- declare function lightenColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, percent: number): string;
598
- /**
599
- * Blend two colors together
600
- *
601
- * @param color1 - First color
602
- * @param color2 - Second color
603
- * @param ratio - Blend ratio (0 = all color1, 1 = all color2)
604
- * @param theme - Theme for resolving
605
- * @returns CSS color string
606
- */
607
- declare function blendColors(color1: ColorValue | undefined | null, color2: ColorValue | undefined | null, ratio: number, theme: Theme | null | undefined): string;
608
- /**
609
- * Check if two colors are equal
610
- *
611
- * @param color1 - First color
612
- * @param color2 - Second color
613
- * @param theme - Theme for resolving
614
- * @returns True if colors resolve to the same value
615
- */
616
- declare function colorsEqual(color1: ColorValue | undefined | null, color2: ColorValue | undefined | null, theme: Theme | null | undefined): boolean;
617
-
618
- export { processTemplateAdvanced as $, type AgentContextOptions as A, pixelsToTwips as B, type CreateEmptyDocumentOptions as C, pointsToPixels as D, type ExtendedSelectionContext as E, processTemplate as F, processTemplateAsBlob as G, processTemplateDetailed as H, resolveColor as I, resolveHighlightColor as J, resolveShadingColor as K, serializeDocumentBody as L, serializeDocument as M, serializeSectionProperties as N, twipsToEmu as O, type ProcessTemplateOptions as P, twipsToPixels as Q, validateTemplate as R, type SelectionContextOptions as S, type SelectionContextOptions$1 as T, type FormattingSummary as U, type TemplateError as V, buildSelectionContext$1 as W, createTemplateProcessor as X, getMissingVariables as Y, getSelectionFormattingSummary as Z, previewTemplate as _, type ProcessTemplateResult as a, blendColors as b, buildExtendedSelectionContext as c, buildSelectionContext as d, colorsEqual as e, createDocumentWithText as f, createEmptyDocument as g, createRgbColor as h, createThemeColor as i, darkenColor as j, emuToPixels as k, emuToTwips as l, executeCommand as m, executeCommands as n, formatPx as o, getAgentContext as p, getContrastingColor as q, getDocumentSummary as r, getTemplateTags as s, halfPointsToPixels as t, isBlack as u, isWhite as v, lightenColor as w, parseColorString as x, parseDocx as y, pixelsToEmu as z };
@@ -1 +0,0 @@
1
- 'use strict';var chunkRM3ITJ2H_cjs=require('./chunk-RM3ITJ2H.cjs');require('./chunk-ITWEFKGQ.cjs'),require('./chunk-NT2REEAA.cjs'),require('./chunk-NO7WUK5E.cjs');var chunkPXC7ARQB_cjs=require('./chunk-PXC7ARQB.cjs');require('./chunk-VOWKSURW.cjs');Object.defineProperty(exports,"docxtemplaterPlugin",{enumerable:true,get:function(){return chunkRM3ITJ2H_cjs.b}});Object.defineProperty(exports,"isZodSchema",{enumerable:true,get:function(){return chunkRM3ITJ2H_cjs.a}});Object.defineProperty(exports,"PluginRegistry",{enumerable:true,get:function(){return chunkPXC7ARQB_cjs.a}});Object.defineProperty(exports,"createPluginRegistrar",{enumerable:true,get:function(){return chunkPXC7ARQB_cjs.d}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunkPXC7ARQB_cjs.b}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunkPXC7ARQB_cjs.c}});
@@ -1,31 +0,0 @@
1
- import { C as CorePlugin } from './types-D96elyJF.cjs';
2
- export { e as CommandHandler, g as CommandResult, E as ExtractCommand, J as JsonSchema, L as LoadedDocument, M as McpSession, h as McpToolAnnotations, i as McpToolContent, j as McpToolContext, a as McpToolDefinition, n as McpToolExample, b as McpToolHandler, c as McpToolResult, k as PluginCommand, e as PluginCommandHandler, l as PluginEvent, f as PluginEventListener, P as PluginOptions, d as PluginRegistrationResult, a as ToolDefinition, b as ToolHandler, c as ToolResult, T as TypedCommandHandler, Z as ZodSchemaLike, m as isZodSchema } from './types-D96elyJF.cjs';
3
- export { P as PluginRegistry, c as createPluginRegistrar, p as pluginRegistry, r as registerPlugins } from './registry-ngv6Bumt.cjs';
4
- import './agentApi-CbVUCZRu.cjs';
5
-
6
- /**
7
- * Docxtemplater Plugin
8
- *
9
- * Core plugin for template variable functionality using docxtemplater.
10
- *
11
- * **Command handlers** — `insertTemplateVariable` and `replaceWithTemplateVariable`
12
- * allow DocumentAgent to programmatically insert `{variable}` placeholders.
13
- *
14
- * @example
15
- * ```ts
16
- * import { pluginRegistry } from '@eigenpal/docx-editor/core-plugins';
17
- * import { docxtemplaterPlugin } from '@eigenpal/docx-editor/core-plugins/docxtemplater';
18
- *
19
- * pluginRegistry.register(docxtemplaterPlugin);
20
- * ```
21
- */
22
-
23
- /**
24
- * Docxtemplater plugin for template variable functionality.
25
- *
26
- * Dependency validation is handled lazily by `processTemplate` at call time,
27
- * so no eager `initialize()` is needed.
28
- */
29
- declare const docxtemplaterPlugin: CorePlugin;
30
-
31
- export { CorePlugin, CorePlugin as Plugin, docxtemplaterPlugin };
@@ -1,31 +0,0 @@
1
- import { C as CorePlugin } from './types-xMzSPT4i.js';
2
- export { e as CommandHandler, g as CommandResult, E as ExtractCommand, J as JsonSchema, L as LoadedDocument, M as McpSession, h as McpToolAnnotations, i as McpToolContent, j as McpToolContext, a as McpToolDefinition, n as McpToolExample, b as McpToolHandler, c as McpToolResult, k as PluginCommand, e as PluginCommandHandler, l as PluginEvent, f as PluginEventListener, P as PluginOptions, d as PluginRegistrationResult, a as ToolDefinition, b as ToolHandler, c as ToolResult, T as TypedCommandHandler, Z as ZodSchemaLike, m as isZodSchema } from './types-xMzSPT4i.js';
3
- export { P as PluginRegistry, c as createPluginRegistrar, p as pluginRegistry, r as registerPlugins } from './registry-D4tvj9f3.js';
4
- import './agentApi-CbVUCZRu.js';
5
-
6
- /**
7
- * Docxtemplater Plugin
8
- *
9
- * Core plugin for template variable functionality using docxtemplater.
10
- *
11
- * **Command handlers** — `insertTemplateVariable` and `replaceWithTemplateVariable`
12
- * allow DocumentAgent to programmatically insert `{variable}` placeholders.
13
- *
14
- * @example
15
- * ```ts
16
- * import { pluginRegistry } from '@eigenpal/docx-editor/core-plugins';
17
- * import { docxtemplaterPlugin } from '@eigenpal/docx-editor/core-plugins/docxtemplater';
18
- *
19
- * pluginRegistry.register(docxtemplaterPlugin);
20
- * ```
21
- */
22
-
23
- /**
24
- * Docxtemplater plugin for template variable functionality.
25
- *
26
- * Dependency validation is handled lazily by `processTemplate` at call time,
27
- * so no eager `initialize()` is needed.
28
- */
29
- declare const docxtemplaterPlugin: CorePlugin;
30
-
31
- export { CorePlugin, CorePlugin as Plugin, docxtemplaterPlugin };
@@ -1 +0,0 @@
1
- export{b as docxtemplaterPlugin,a as isZodSchema}from'./chunk-UXXV4GT6.js';import'./chunk-ESI4BSBF.js';import'./chunk-2ASOEN3V.js';import'./chunk-JKN7TNPA.js';export{a as PluginRegistry,d as createPluginRegistrar,b as pluginRegistry,c as registerPlugins}from'./chunk-R5SKERM2.js';import'./chunk-OWMXCVKB.js';