@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.
Files changed (223) hide show
  1. package/LICENSE +204 -0
  2. package/dist/FindReplaceDialog-7SQOVQWH.js +1 -0
  3. package/dist/FindReplaceDialog-RK3A7MSK.mjs +1 -0
  4. package/dist/{FootnotePropertiesDialog-XQ7NIFIU.js → FootnotePropertiesDialog-2Q2SHVMR.js} +1 -1
  5. package/dist/{FootnotePropertiesDialog-TNVJJCY6.mjs → FootnotePropertiesDialog-ZKQXW3YO.mjs} +1 -1
  6. package/dist/{HyperlinkDialog-FR4IZZ7E.mjs → HyperlinkDialog-QV3CVFQU.mjs} +1 -1
  7. package/dist/HyperlinkDialog-XVAF7FVN.js +1 -0
  8. package/dist/{ImagePositionDialog-JSZSIKF5.mjs → ImagePositionDialog-EGRH3HPP.mjs} +1 -1
  9. package/dist/{ImagePositionDialog-2YXRAGZS.js → ImagePositionDialog-HIVHUTBT.js} +1 -1
  10. package/dist/ImagePropertiesDialog-67WLFIIZ.mjs +1 -0
  11. package/dist/ImagePropertiesDialog-HSM3JJ22.js +1 -0
  12. package/dist/KeyboardShortcutsDialog-B0UFuR4w.d.ts +395 -0
  13. package/dist/KeyboardShortcutsDialog-t6JKL4Aj.d.mts +395 -0
  14. package/dist/PageSetupDialog-642IAVG2.js +1 -0
  15. package/dist/PageSetupDialog-ERUQDHAY.mjs +1 -0
  16. package/dist/PluginHost-HS31VIuo.d.mts +16 -0
  17. package/dist/PluginHost-zILZO7zX.d.ts +16 -0
  18. package/dist/{SplitCellDialog-NP3JJYHD.mjs → SplitCellDialog-GFWCFCTD.mjs} +1 -1
  19. package/dist/{SplitCellDialog-JIAC3RYV.js → SplitCellDialog-M7WF7ANE.js} +1 -1
  20. package/dist/{TablePropertiesDialog-TIK4AA5M.mjs → TablePropertiesDialog-TZ7VCL6V.mjs} +1 -1
  21. package/dist/{TablePropertiesDialog-T7D4HSVP.js → TablePropertiesDialog-ZKU2FTUX.js} +1 -1
  22. package/dist/agentApi-B2Y7kexW.d.ts +486 -0
  23. package/dist/agentApi-BzUJ_kao.d.mts +486 -0
  24. package/dist/chunk-2XXILKEQ.js +1 -0
  25. package/dist/chunk-35DG3R42.js +2 -0
  26. package/dist/chunk-5UX5CD4C.js +1 -0
  27. package/dist/chunk-7QQSDIWK.mjs +2 -0
  28. package/dist/chunk-AW5TISUL.js +3 -0
  29. package/dist/chunk-B45ECEGY.js +18 -0
  30. package/dist/chunk-B7CCL7SL.mjs +2 -0
  31. package/dist/chunk-BRMTZRLJ.js +2 -0
  32. package/dist/chunk-D47GTKGU.js +2 -0
  33. package/dist/chunk-F5SERL7X.mjs +2 -0
  34. package/dist/chunk-FWPVBFKQ.mjs +1 -0
  35. package/dist/chunk-GGQK26JO.js +2 -0
  36. package/dist/chunk-GM2S2WMT.mjs +1 -0
  37. package/dist/chunk-HXDMASAR.js +1 -0
  38. package/dist/chunk-ILYKDR3C.js +1 -0
  39. package/dist/chunk-JFRDFK7V.mjs +260 -0
  40. package/dist/chunk-JPF5R2ZM.mjs +1 -0
  41. package/dist/chunk-KOXCF3CL.mjs +1 -0
  42. package/dist/chunk-KRLNX56Y.mjs +2 -0
  43. package/dist/chunk-LWOHVYKW.mjs +1 -0
  44. package/dist/chunk-MDTA25AN.mjs +60 -0
  45. package/dist/chunk-MKNSJOCN.js +70 -0
  46. package/dist/chunk-NIBCC7WQ.js +1 -0
  47. package/dist/chunk-NLFXR2VH.js +2 -0
  48. package/dist/chunk-NOLMVQNN.mjs +40 -0
  49. package/dist/chunk-ONIYA2FU.mjs +2 -0
  50. package/dist/chunk-RCIZ7OM3.mjs +70 -0
  51. package/dist/chunk-SGTUE33R.js +260 -0
  52. package/dist/{chunk-EHFEG3TX.js → chunk-SNZ57XBI.js} +1 -1
  53. package/dist/chunk-SOTWG3KJ.mjs +1 -0
  54. package/dist/chunk-TYPGB4KF.js +1 -0
  55. package/dist/chunk-U7ZW2DOO.mjs +2 -0
  56. package/dist/chunk-WO3FIV4B.js +40 -0
  57. package/dist/{chunk-PKEOQIQO.mjs → chunk-WPI3YRFO.mjs} +1 -1
  58. package/dist/chunk-XGJ2EORY.mjs +1 -0
  59. package/dist/chunk-XQZTWWRF.mjs +18 -0
  60. package/dist/chunk-Y3SEHWZ2.js +1 -0
  61. package/dist/chunk-YBEVHQCT.js +60 -0
  62. package/dist/chunk-ZVAFVHWR.mjs +3 -0
  63. package/dist/chunk-ZXPCJWVY.js +2 -0
  64. package/dist/{agentApi-DLt94vXk.d.mts → content-REFGFfEH.d.mts} +8 -755
  65. package/dist/{agentApi-DLt94vXk.d.ts → content-REFGFfEH.d.ts} +8 -755
  66. package/dist/dialogs.d.mts +25 -0
  67. package/dist/dialogs.d.ts +25 -0
  68. package/dist/dialogs.js +1 -0
  69. package/dist/dialogs.mjs +1 -0
  70. package/dist/document-Cu2vq_wS.d.mts +294 -0
  71. package/dist/document-CxOagoLQ.d.ts +294 -0
  72. package/dist/executor-WBHID2RK.mjs +1 -0
  73. package/dist/executor-Y5VUOAHY.js +1 -0
  74. package/dist/findReplace-Bue0JaXh.d.ts +138 -0
  75. package/dist/findReplace-shXbOjFQ.d.mts +138 -0
  76. package/dist/fork.d.mts +535 -0
  77. package/dist/fork.d.ts +535 -0
  78. package/dist/fork.js +1 -0
  79. package/dist/fork.mjs +1 -0
  80. package/dist/hooks.d.mts +598 -0
  81. package/dist/hooks.d.ts +598 -0
  82. package/dist/hooks.js +1 -0
  83. package/dist/hooks.mjs +1 -0
  84. package/dist/index-B5A-J9GC.d.ts +1119 -0
  85. package/dist/index-bw-PaozF.d.mts +1119 -0
  86. package/dist/index.d.mts +12 -591
  87. package/dist/index.d.ts +12 -591
  88. package/dist/index.js +1 -120
  89. package/dist/index.mjs +1 -120
  90. package/dist/layout-bridge-5GYGYKM5.mjs +1 -0
  91. package/dist/layout-bridge-QQDA7ELH.js +1 -0
  92. package/dist/plugin-api.d.mts +165 -0
  93. package/dist/plugin-api.d.ts +165 -0
  94. package/dist/plugin-api.js +1 -0
  95. package/dist/plugin-api.mjs +1 -0
  96. package/dist/processTemplate-BTBTR7AM.js +1 -0
  97. package/dist/{processTemplate-W2C5PXZB.mjs → processTemplate-MBX2KDLE.mjs} +1 -1
  98. package/dist/styles.css +1 -1
  99. package/dist/styles.d.mts +18 -0
  100. package/dist/styles.d.ts +18 -0
  101. package/dist/styles.js +1 -0
  102. package/dist/styles.mjs +1 -0
  103. package/dist/types-BF48VxkC.d.mts +18 -0
  104. package/dist/types-BF48VxkC.d.ts +18 -0
  105. package/dist/types-BnIs4sE7.d.mts +281 -0
  106. package/dist/types-BnIs4sE7.d.ts +281 -0
  107. package/dist/types-CW6HFAX6.d.ts +39 -0
  108. package/dist/types-DIsDCwTG.d.mts +39 -0
  109. package/dist/ui.d.mts +111 -552
  110. package/dist/ui.d.ts +111 -552
  111. package/dist/ui.js +111 -1
  112. package/dist/ui.mjs +111 -1
  113. package/dist/useFindReplace-DKy-s3gS.d.ts +261 -0
  114. package/dist/useFindReplace-vuoKpDKE.d.mts +261 -0
  115. package/package.json +47 -49
  116. package/dist/ClipboardManager-CVKX0v9q.d.ts +0 -464
  117. package/dist/ClipboardManager-V3aaMnWE.d.mts +0 -464
  118. package/dist/DocumentAgent-BWflKHpH.d.mts +0 -442
  119. package/dist/DocumentAgent-DsdXtetF.d.ts +0 -442
  120. package/dist/FindReplaceDialog-L3YF5HIS.mjs +0 -1
  121. package/dist/FindReplaceDialog-SEBWC5P7.js +0 -1
  122. package/dist/HyperlinkDialog-WEK6JSAC.js +0 -1
  123. package/dist/ImagePropertiesDialog-527MFLQO.mjs +0 -1
  124. package/dist/ImagePropertiesDialog-HG4K3IE7.js +0 -1
  125. package/dist/PageSetupDialog-GALVJMUB.js +0 -1
  126. package/dist/PageSetupDialog-TGQIAMI7.mjs +0 -1
  127. package/dist/TableToolbar-DUgmob2I.d.ts +0 -1273
  128. package/dist/TableToolbar-YL74HNS1.d.mts +0 -1273
  129. package/dist/chunk-23SXXIZS.js +0 -111
  130. package/dist/chunk-3F52AP2Q.js +0 -1
  131. package/dist/chunk-42O5GXM5.mjs +0 -82
  132. package/dist/chunk-54ULJEHM.mjs +0 -1
  133. package/dist/chunk-5XK326FI.mjs +0 -1
  134. package/dist/chunk-6WPRCJ5A.mjs +0 -1
  135. package/dist/chunk-76IYR7C7.mjs +0 -1
  136. package/dist/chunk-AGRIVA4G.js +0 -1
  137. package/dist/chunk-BTCQ2QI3.mjs +0 -3
  138. package/dist/chunk-BUEMG4NW.js +0 -1
  139. package/dist/chunk-BXRC4U3X.mjs +0 -2
  140. package/dist/chunk-CPAYKE6X.mjs +0 -1
  141. package/dist/chunk-DACWLFKI.mjs +0 -1
  142. package/dist/chunk-EPBFWE36.js +0 -2
  143. package/dist/chunk-FXES3YDB.js +0 -82
  144. package/dist/chunk-HI66BSGS.mjs +0 -9
  145. package/dist/chunk-INTPVEO6.mjs +0 -9
  146. package/dist/chunk-IOAGVW6Q.mjs +0 -2
  147. package/dist/chunk-JCEWC5QL.mjs +0 -4
  148. package/dist/chunk-JTIUFACT.js +0 -1
  149. package/dist/chunk-LUF7PWIC.js +0 -10
  150. package/dist/chunk-MGEN6GOE.mjs +0 -2
  151. package/dist/chunk-MOE2ZGUE.js +0 -18
  152. package/dist/chunk-MWLHJWB6.js +0 -9
  153. package/dist/chunk-OFYVDN3U.mjs +0 -2
  154. package/dist/chunk-P4VSHBGZ.js +0 -2
  155. package/dist/chunk-P5FQHIES.mjs +0 -1
  156. package/dist/chunk-PBC7XAYZ.js +0 -3
  157. package/dist/chunk-PEMB6SZT.js +0 -2
  158. package/dist/chunk-PQMSZTBB.js +0 -9
  159. package/dist/chunk-Q7UDQXAF.js +0 -1
  160. package/dist/chunk-QGTAIC5E.js +0 -1
  161. package/dist/chunk-QVPR2W5S.js +0 -1
  162. package/dist/chunk-R3QMYPL5.mjs +0 -59
  163. package/dist/chunk-RBUTXXQJ.mjs +0 -18
  164. package/dist/chunk-RRWYZ2TS.mjs +0 -111
  165. package/dist/chunk-S3STEPVO.js +0 -182
  166. package/dist/chunk-SFUM35DH.js +0 -2
  167. package/dist/chunk-SNLC6EK2.js +0 -1
  168. package/dist/chunk-TMTLIGLZ.js +0 -59
  169. package/dist/chunk-TSE2PWFX.mjs +0 -10
  170. package/dist/chunk-UKESXQS5.mjs +0 -182
  171. package/dist/chunk-UWYD42WV.js +0 -4
  172. package/dist/chunk-UXVACQCY.mjs +0 -1
  173. package/dist/chunk-W4EIKDM6.mjs +0 -2
  174. package/dist/chunk-W53SI3XW.mjs +0 -1
  175. package/dist/chunk-WNS2RBQD.js +0 -2
  176. package/dist/chunk-Z3KMSHUP.js +0 -1
  177. package/dist/core-plugins-reexport.d.mts +0 -31
  178. package/dist/core-plugins-reexport.d.ts +0 -31
  179. package/dist/core-plugins-reexport.js +0 -1
  180. package/dist/core-plugins-reexport.mjs +0 -1
  181. package/dist/core-reexport.d.mts +0 -340
  182. package/dist/core-reexport.d.ts +0 -340
  183. package/dist/core-reexport.js +0 -1
  184. package/dist/core-reexport.mjs +0 -1
  185. package/dist/documentSerializer-DtS_-oGA.d.mts +0 -664
  186. package/dist/documentSerializer-Wj1p2ASa.d.ts +0 -664
  187. package/dist/executor-C3VXF7QA.mjs +0 -1
  188. package/dist/executor-GDBV3AGV.js +0 -1
  189. package/dist/headless-reexport.d.mts +0 -197
  190. package/dist/headless-reexport.d.ts +0 -197
  191. package/dist/headless-reexport.js +0 -1
  192. package/dist/headless-reexport.mjs +0 -1
  193. package/dist/insertOperations-BTH1Asas.d.mts +0 -176
  194. package/dist/insertOperations-CbUnXAXH.d.ts +0 -176
  195. package/dist/layout-bridge-EA4DJ227.js +0 -1
  196. package/dist/layout-bridge-XDPSO6GO.mjs +0 -1
  197. package/dist/mcp-reexport.d.mts +0 -156
  198. package/dist/mcp-reexport.d.ts +0 -156
  199. package/dist/mcp-reexport.js +0 -16
  200. package/dist/mcp-reexport.mjs +0 -16
  201. package/dist/processTemplate-MJ2PCSO5.js +0 -1
  202. package/dist/react-B0W16SV6.d.ts +0 -1330
  203. package/dist/react-D0Pn1nww.d.mts +0 -1330
  204. package/dist/react.d.mts +0 -10
  205. package/dist/react.d.ts +0 -10
  206. package/dist/react.js +0 -1
  207. package/dist/react.mjs +0 -1
  208. package/dist/registry-CH9V-IX0.d.ts +0 -165
  209. package/dist/registry-CWBKYlNW.d.mts +0 -165
  210. package/dist/types-UDsUq8D3.d.mts +0 -310
  211. package/dist/types-jbivc9Lj.d.ts +0 -310
  212. package/dist/variableDetector-CdQ7ZTzA.d.mts +0 -204
  213. package/dist/variableDetector-DsRV3A9z.d.ts +0 -204
  214. package/i18n/de.json +0 -792
  215. package/i18n/en.json +0 -792
  216. package/i18n/he.json +0 -792
  217. package/i18n/pl.json +0 -792
  218. package/i18n/pt-BR.json +0 -792
  219. package/i18n/tr.json +0 -792
  220. package/i18n/zh-CN.json +0 -792
  221. /package/dist/{chunk-YC5KZSYD.js → chunk-ESZ6JRTW.js} +0 -0
  222. /package/dist/{chunk-LVGJKS7Y.mjs → chunk-TZMMD6RR.mjs} +0 -0
  223. /package/dist/{react.css → fork.css} +0 -0
@@ -1,664 +0,0 @@
1
- import { D as Document, A as AgentCommand, h as AgentContext, R as Range, W as SelectionContext, T as TextFormatting, ao as ColorValue, a3 as Theme, ap as ThemeColorSlot, al as ThemeColorScheme, d as DocumentBody, V as SectionProperties } from './agentApi-DLt94vXk.mjs';
2
- import { g as DocxInput } from './DocumentAgent-BWflKHpH.mjs';
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
- * Convert twips to pixels (at 96 DPI)
173
- *
174
- * 1 inch = 1440 twips = 96 pixels
175
- * → 1 twip = 96/1440 pixels = 1/15 pixels
176
- */
177
- declare function twipsToPixels(twips: number): number;
178
- /**
179
- * Convert pixels to twips
180
- */
181
- declare function pixelsToTwips(px: number): number;
182
- /**
183
- * Convert EMUs to pixels (at 96 DPI)
184
- *
185
- * 1 inch = 914400 EMUs = 96 pixels
186
- * Returns 0 for null/undefined/NaN inputs.
187
- */
188
- declare function emuToPixels(emu: number | undefined | null): number;
189
- /**
190
- * Convert pixels to EMUs.
191
- * EMU coordinates in OOXML are integer-typed (xs:long); rounding here keeps
192
- * floating-point drift (e.g. 52 px → 495299.99999999994) out of the document.
193
- */
194
- declare function pixelsToEmu(px: number): number;
195
- /**
196
- * Convert EMUs to twips
197
- */
198
- declare function emuToTwips(emu: number): number;
199
- /**
200
- * Convert twips to EMUs
201
- */
202
- declare function twipsToEmu(twips: number): number;
203
- /**
204
- * Convert points to pixels (at 96 DPI)
205
- *
206
- * 1 inch = 72 points = 96 pixels
207
- * → 1 point = 96/72 pixels = 4/3 pixels
208
- */
209
- declare function pointsToPixels(points: number): number;
210
- /**
211
- * Convert half-points to pixels (at 96 DPI)
212
- *
213
- * Half-points are commonly used for font sizes in OOXML (w:sz).
214
- */
215
- declare function halfPointsToPixels(halfPoints: number): number;
216
- /**
217
- * Format a pixel value as CSS string
218
- */
219
- declare function formatPx(px: number): string;
220
-
221
- /**
222
- * Color Resolver - Convert OOXML colors to CSS
223
- *
224
- * Handles:
225
- * - Theme color references (accent1, dk1, etc.)
226
- * - RGB hex values
227
- * - "auto" colors (context-dependent)
228
- * - Tint/shade modifications
229
- *
230
- * OOXML Color References:
231
- * - w:color/@w:val - RGB hex or "auto"
232
- * - w:color/@w:themeColor - Theme color slot
233
- * - w:color/@w:themeTint - Tint modifier (0-255, hex)
234
- * - w:color/@w:themeShade - Shade modifier (0-255, hex)
235
- *
236
- * Tint/Shade Calculations:
237
- * - Tint makes color lighter (blend with white)
238
- * - Shade makes color darker (blend with black)
239
- * - Value is in hex (00-FF), converted to 0-1 for calculation
240
- */
241
-
242
- /**
243
- * Resolve a ColorValue to a CSS color string
244
- *
245
- * @param color - ColorValue object with rgb, themeColor, tint/shade, or auto
246
- * @param theme - Theme for resolving theme colors
247
- * @param defaultColor - Default color if auto or undefined (default: black)
248
- * @returns CSS color string (e.g., "#FF0000" or "inherit")
249
- */
250
- declare function resolveColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, defaultColor?: string): string;
251
- /**
252
- * Resolve a highlight color name to CSS
253
- *
254
- * @param highlight - Highlight color name (e.g., "yellow", "cyan")
255
- * @returns CSS color string or empty string for "none"
256
- */
257
- declare function resolveHighlightColor(highlight: string | undefined): string;
258
- /**
259
- * Resolve a shading fill or pattern color to CSS
260
- *
261
- * @param color - ColorValue for fill
262
- * @param theme - Theme for resolving theme colors
263
- * @returns CSS color string
264
- */
265
- declare function resolveShadingColor(color: ColorValue | undefined | null, theme: Theme | null | undefined): string;
266
- /**
267
- * Check if a color is effectively black
268
- *
269
- * @param color - ColorValue object
270
- * @param theme - Theme for resolving theme colors
271
- * @returns True if color resolves to black or very dark
272
- */
273
- declare function isBlack(color: ColorValue | undefined | null, theme: Theme | null | undefined): boolean;
274
- /**
275
- * Check if a color is effectively white
276
- *
277
- * @param color - ColorValue object
278
- * @param theme - Theme for resolving theme colors
279
- * @returns True if color resolves to white or very light
280
- */
281
- declare function isWhite(color: ColorValue | undefined | null, theme: Theme | null | undefined): boolean;
282
- /**
283
- * Get contrasting text color for a background
284
- *
285
- * @param backgroundColor - Background ColorValue
286
- * @param theme - Theme for resolving theme colors
287
- * @returns Black or white hex color for best contrast
288
- */
289
- declare function getContrastingColor(backgroundColor: ColorValue | undefined | null, theme: Theme | null | undefined): string;
290
- /**
291
- * Parse a color string (various formats) to ColorValue
292
- *
293
- * @param colorString - Color string like "FF0000", "auto", or theme color name
294
- * @returns ColorValue object
295
- */
296
- declare function parseColorString(colorString: string | undefined): ColorValue | undefined;
297
- /**
298
- * Create a ColorValue from theme color reference
299
- *
300
- * @param themeColor - Theme color slot name
301
- * @param tint - Optional tint modifier
302
- * @param shade - Optional shade modifier
303
- * @returns ColorValue object
304
- */
305
- declare function createThemeColor(themeColor: ThemeColorSlot, tint?: number, shade?: number): ColorValue;
306
- /**
307
- * Create a ColorValue from RGB hex
308
- *
309
- * @param hex - 6-character hex color (no #)
310
- * @returns ColorValue object
311
- */
312
- declare function createRgbColor(hex: string): ColorValue;
313
- /**
314
- * Darken a color by a percentage
315
- *
316
- * @param color - ColorValue to darken
317
- * @param theme - Theme for resolving
318
- * @param percent - Percentage to darken (0-100)
319
- * @returns CSS color string
320
- */
321
- declare function darkenColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, percent: number): string;
322
- /**
323
- * Lighten a color by a percentage
324
- *
325
- * @param color - ColorValue to lighten
326
- * @param theme - Theme for resolving
327
- * @param percent - Percentage to lighten (0-100)
328
- * @returns CSS color string
329
- */
330
- declare function lightenColor(color: ColorValue | undefined | null, theme: Theme | null | undefined, percent: number): string;
331
- /**
332
- * Blend two colors together
333
- *
334
- * @param color1 - First color
335
- * @param color2 - Second color
336
- * @param ratio - Blend ratio (0 = all color1, 1 = all color2)
337
- * @param theme - Theme for resolving
338
- * @returns CSS color string
339
- */
340
- declare function blendColors(color1: ColorValue | undefined | null, color2: ColorValue | undefined | null, ratio: number, theme: Theme | null | undefined): string;
341
- /**
342
- * Ensure a hex color string has a '#' prefix.
343
- */
344
- declare function ensureHexPrefix(hex: string): string;
345
- /**
346
- * Resolve a highlight color value to a CSS-ready string.
347
- * Tries OOXML named highlight first, then ensures hex prefix.
348
- */
349
- declare function resolveHighlightToCss(value: string): string;
350
- /**
351
- * Theme color matrix cell
352
- */
353
- interface ThemeMatrixCell {
354
- /** Resolved hex color (6 chars, no #) */
355
- hex: string;
356
- /** Theme color slot */
357
- themeSlot: ThemeColorSlot;
358
- /** Tint hex modifier if applicable (e.g., "CC") */
359
- tint?: string;
360
- /** Shade hex modifier if applicable (e.g., "BF") */
361
- shade?: string;
362
- /** Human-readable label (e.g., "Accent 1, Lighter 60%") */
363
- label: string;
364
- }
365
- /**
366
- * Compute a single tinted or shaded hex color from a base color.
367
- *
368
- * @param baseHex - 6-character hex color (no #)
369
- * @param type - 'tint' to lighten, 'shade' to darken
370
- * @param fraction - Amount (0-1). For tint: 0=no change, 1=white. For shade: 0=black, 1=no change.
371
- * @returns 6-character hex color (no #)
372
- */
373
- declare function getThemeTintShadeHex(baseHex: string, type: 'tint' | 'shade', fraction: number): string;
374
- /**
375
- * Generate the 10×6 theme color matrix for an advanced color picker.
376
- *
377
- * Columns: lt1, dk1, lt2, dk2, accent1-6 (matches Word's order)
378
- * Rows: base, 80% tint, 60% tint, 40% tint, 25% shade, 50% shade
379
- *
380
- * @param colorScheme - Theme color scheme (falls back to Office 2016 defaults)
381
- * @returns 6 rows × 10 columns of ThemeMatrixCell
382
- */
383
- declare function generateThemeTintShadeMatrix(colorScheme?: ThemeColorScheme | null): ThemeMatrixCell[][];
384
- /**
385
- * Check if two colors are equal
386
- *
387
- * @param color1 - First color
388
- * @param color2 - Second color
389
- * @param theme - Theme for resolving
390
- * @returns True if colors resolve to the same value
391
- */
392
- declare function colorsEqual(color1: ColorValue | undefined | null, color2: ColorValue | undefined | null, theme: Theme | null | undefined): boolean;
393
-
394
- /**
395
- * Create Document Utility
396
- *
397
- * Provides functions to create new documents programmatically.
398
- */
399
-
400
- /**
401
- * Options for creating an empty document
402
- */
403
- interface CreateEmptyDocumentOptions {
404
- /** Page width in twips (default: 12240 = 8.5 inches) */
405
- pageWidth?: number;
406
- /** Page height in twips (default: 15840 = 11 inches) */
407
- pageHeight?: number;
408
- /** Page orientation (default: 'portrait') */
409
- orientation?: 'portrait' | 'landscape';
410
- /** Top margin in twips (default: 1440 = 1 inch) */
411
- marginTop?: number;
412
- /** Bottom margin in twips (default: 1440 = 1 inch) */
413
- marginBottom?: number;
414
- /** Left margin in twips (default: 1440 = 1 inch) */
415
- marginLeft?: number;
416
- /** Right margin in twips (default: 1440 = 1 inch) */
417
- marginRight?: number;
418
- /** Initial text content (default: empty string) */
419
- initialText?: string;
420
- }
421
- /**
422
- * Create an empty document with a single paragraph
423
- *
424
- * @param options - Optional configuration for the document
425
- * @returns A new empty Document object
426
- *
427
- * @example
428
- * ```ts
429
- * // Create a blank document
430
- * const doc = createEmptyDocument();
431
- *
432
- * // Create with custom margins
433
- * const doc = createEmptyDocument({
434
- * marginTop: 720, // 0.5 inch
435
- * marginBottom: 720,
436
- * });
437
- *
438
- * // Create with initial text
439
- * const doc = createEmptyDocument({
440
- * initialText: 'Hello, World!'
441
- * });
442
- * ```
443
- */
444
- declare function createEmptyDocument(options?: CreateEmptyDocumentOptions): Document;
445
- /**
446
- * Create a document with a single paragraph containing the given text
447
- *
448
- * @param text - The text content for the document
449
- * @param options - Optional configuration for the document
450
- * @returns A new Document object with the specified text
451
- */
452
- declare function createDocumentWithText(text: string, options?: Omit<CreateEmptyDocumentOptions, 'initialText'>): Document;
453
-
454
- /**
455
- * Template Processing Utility
456
- *
457
- * Uses docxtemplater to substitute template variables in DOCX documents:
458
- * - Processes {variable_name} patterns (docxtemplater default syntax)
459
- * - Preserves all formatting (fonts, styles, colors, tables)
460
- * - Error handling with useful messages
461
- */
462
- /**
463
- * Options for template processing
464
- */
465
- interface ProcessTemplateOptions {
466
- /** How to handle undefined variables */
467
- nullGetter?: 'keep' | 'empty' | 'error';
468
- /** Custom parser for variable names */
469
- parser?: (tag: string) => {
470
- get: (scope: Record<string, unknown>) => unknown;
471
- };
472
- /** Line breaks: keep raw \n or convert to w:br */
473
- linebreaks?: boolean;
474
- /** Delimiter settings */
475
- delimiters?: {
476
- start?: string;
477
- end?: string;
478
- };
479
- }
480
- /**
481
- * Result of template processing
482
- */
483
- interface ProcessTemplateResult {
484
- /** The processed document buffer */
485
- buffer: ArrayBuffer;
486
- /** Variables that were found and replaced */
487
- replacedVariables: string[];
488
- /** Variables that were not replaced (no value provided) */
489
- unreplacedVariables: string[];
490
- /** Any warnings during processing */
491
- warnings: string[];
492
- }
493
- /**
494
- * Error details from template processing
495
- */
496
- interface TemplateError {
497
- /** Error message */
498
- message: string;
499
- /** Variable name that caused the error (if applicable) */
500
- variable?: string;
501
- /** Error type */
502
- type: 'parse' | 'render' | 'undefined' | 'unknown';
503
- /** Original error */
504
- originalError?: Error;
505
- }
506
- /**
507
- * Process a DOCX template with variable substitution
508
- *
509
- * @param buffer - The DOCX file as ArrayBuffer
510
- * @param variables - Map of variable names to values
511
- * @param options - Processing options
512
- * @returns Processed DOCX as ArrayBuffer
513
- */
514
- declare function processTemplate(buffer: ArrayBuffer, variables: Record<string, string>, options?: ProcessTemplateOptions): ArrayBuffer;
515
- /**
516
- * Process template with detailed result
517
- *
518
- * @param buffer - The DOCX file as ArrayBuffer
519
- * @param variables - Map of variable names to values
520
- * @param options - Processing options
521
- * @returns Detailed processing result
522
- */
523
- declare function processTemplateDetailed(buffer: ArrayBuffer, variables: Record<string, string>, options?: ProcessTemplateOptions): ProcessTemplateResult;
524
- /**
525
- * Process template and return as Blob
526
- *
527
- * @param buffer - The DOCX file as ArrayBuffer
528
- * @param variables - Map of variable names to values
529
- * @param options - Processing options
530
- * @returns Processed DOCX as Blob
531
- */
532
- declare function processTemplateAsBlob(buffer: ArrayBuffer, variables: Record<string, string>, options?: ProcessTemplateOptions): Blob;
533
- /**
534
- * Get all template tags in a document without processing
535
- *
536
- * @param buffer - The DOCX file as ArrayBuffer
537
- * @returns List of tag names found
538
- */
539
- declare function getTemplateTags(buffer: ArrayBuffer): string[];
540
- /**
541
- * Validate that a document is a valid docxtemplater template
542
- *
543
- * @param buffer - The DOCX file as ArrayBuffer
544
- * @returns Validation result
545
- */
546
- declare function validateTemplate(buffer: ArrayBuffer): {
547
- valid: boolean;
548
- errors: TemplateError[];
549
- tags: string[];
550
- };
551
- /**
552
- * Check if all required variables have values
553
- *
554
- * @param tags - List of template tags
555
- * @param variables - Provided variable values
556
- * @returns Missing variable names
557
- */
558
- declare function getMissingVariables(tags: string[], variables: Record<string, string>): string[];
559
- /**
560
- * Preview what the document will look like after processing
561
- * Returns the document text with variables replaced (for preview purposes)
562
- *
563
- * @param buffer - The DOCX file as ArrayBuffer
564
- * @param variables - Map of variable names to values
565
- * @returns Preview text
566
- */
567
- declare function previewTemplate(buffer: ArrayBuffer, variables: Record<string, string>): string;
568
- /**
569
- * Process template with conditional sections
570
- * Supports #if, #unless, #each loops
571
- *
572
- * @param buffer - The DOCX file as ArrayBuffer
573
- * @param data - Full data object (can include arrays, nested objects)
574
- * @param options - Processing options
575
- * @returns Processed DOCX as ArrayBuffer
576
- */
577
- declare function processTemplateAdvanced(buffer: ArrayBuffer, data: Record<string, unknown>, options?: ProcessTemplateOptions): ArrayBuffer;
578
- /**
579
- * Create a template processor with preset options
580
- */
581
- declare function createTemplateProcessor(defaultOptions?: ProcessTemplateOptions): (buffer: ArrayBuffer, variables: Record<string, string>) => ArrayBuffer;
582
-
583
- /**
584
- * Main Parser Orchestrator - Unified parseDocx function
585
- *
586
- * Coordinates all sub-parsers to produce a complete Document model.
587
- * Handles loading order, dependency resolution, and font preloading.
588
- *
589
- * Parsing order:
590
- * 1. Unzip DOCX package
591
- * 2. Parse relationships
592
- * 3. Parse theme (needed for style color/font resolution)
593
- * 4. Parse styles (depends on theme)
594
- * 5. Parse numbering
595
- * 6. Parse document body (depends on styles, theme, numbering, rels)
596
- * 7. Parse headers/footers (depends on styles, theme, numbering, rels)
597
- * 8. Parse footnotes/endnotes (depends on styles, theme, numbering, rels)
598
- * 9. Extract and load fonts
599
- * 10. Build media file map
600
- * 11. Assemble final Document
601
- */
602
-
603
- /**
604
- * Progress callback for tracking parsing stages
605
- */
606
- type ProgressCallback = (stage: string, percent: number) => void;
607
- /**
608
- * Parsing options
609
- */
610
- interface ParseOptions {
611
- /** Progress callback for tracking parsing stages */
612
- onProgress?: ProgressCallback;
613
- /** Whether to preload fonts (default: true) */
614
- preloadFonts?: boolean;
615
- /** Whether to parse headers/footers (default: true) */
616
- parseHeadersFooters?: boolean;
617
- /** Whether to parse footnotes/endnotes (default: true) */
618
- parseNotes?: boolean;
619
- /** Whether to detect template variables (default: true) */
620
- detectVariables?: boolean;
621
- }
622
- /**
623
- * Parse a DOCX file into a complete Document model
624
- *
625
- * @param input - DOCX file as ArrayBuffer, Uint8Array, Blob, or File
626
- * @param options - Parsing options
627
- * @returns Promise resolving to Document
628
- * @throws Error if parsing fails
629
- */
630
- declare function parseDocx(input: DocxInput, options?: ParseOptions): Promise<Document>;
631
-
632
- /**
633
- * Document Serializer - Serialize complete document.xml
634
- *
635
- * Converts Document objects back to valid document.xml OOXML format.
636
- * Combines all content (paragraphs, tables) with section properties
637
- * and proper namespace declarations.
638
- *
639
- * OOXML Reference:
640
- * - Document root: w:document
641
- * - Document body: w:body
642
- * - Section properties: w:sectPr
643
- */
644
-
645
- /**
646
- * Serialize section properties (w:sectPr)
647
- */
648
- declare function serializeSectionProperties(props: SectionProperties | undefined): string;
649
- /**
650
- * Serialize a DocumentBody to document.xml body content
651
- *
652
- * @param body - The document body to serialize
653
- * @returns XML string for the body element (without body tags)
654
- */
655
- declare function serializeDocumentBody(body: DocumentBody): string;
656
- /**
657
- * Serialize a complete Document to valid document.xml
658
- *
659
- * @param doc - The document to serialize
660
- * @returns Complete XML string for document.xml
661
- */
662
- declare function serializeDocument(doc: Document): string;
663
-
664
- export { validateTemplate as $, type AgentContextOptions as A, isWhite as B, type CreateEmptyDocumentOptions as C, lightenColor as D, type ExtendedSelectionContext as E, type FormattingSummary as F, parseColorString as G, parseDocx as H, pixelsToEmu as I, pixelsToTwips as J, pointsToPixels as K, previewTemplate as L, processTemplate as M, processTemplateAdvanced as N, processTemplateAsBlob as O, type ProcessTemplateOptions as P, processTemplateDetailed as Q, resolveColor as R, type SelectionContextOptions$1 as S, type TemplateError as T, resolveHighlightColor as U, resolveShadingColor as V, serializeDocumentBody as W, serializeDocument as X, serializeSectionProperties as Y, twipsToEmu as Z, twipsToPixels as _, type ProcessTemplateResult as a, type ThemeMatrixCell as a0, ensureHexPrefix as a1, generateThemeTintShadeMatrix as a2, getThemeTintShadeHex as a3, resolveHighlightToCss as a4, type SelectionContextOptions as b, blendColors as c, buildExtendedSelectionContext as d, buildSelectionContext as e, buildSelectionContext$1 as f, colorsEqual as g, createDocumentWithText as h, createEmptyDocument as i, createRgbColor as j, createTemplateProcessor as k, createThemeColor as l, darkenColor as m, emuToPixels as n, emuToTwips as o, executeCommand as p, executeCommands as q, formatPx as r, getAgentContext as s, getContrastingColor as t, getDocumentSummary as u, getMissingVariables as v, getSelectionFormattingSummary as w, getTemplateTags as x, halfPointsToPixels as y, isBlack as z };