@betteroffice/docx 0.0.1 → 0.0.3

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 (165) hide show
  1. package/README.md +19 -0
  2. package/dist/chunk-AEQOEQJ7.mjs +57 -0
  3. package/dist/chunk-AZ52IWB6.mjs +16 -0
  4. package/dist/{chunk-SINEY6ZF.mjs → chunk-B4IR6YP4.mjs} +1 -1
  5. package/dist/chunk-GGEGIQRK.mjs +1 -0
  6. package/dist/chunk-IFT6DUJX.mjs +1 -0
  7. package/dist/chunk-J7LNO6SM.mjs +1 -0
  8. package/dist/{chunk-H3JCIGWK.mjs → chunk-NJHOPXZW.mjs} +1 -1
  9. package/dist/{chunk-KXNZFTTK.mjs → chunk-WBH3SXI6.mjs} +1 -1
  10. package/dist/chunk-WON6K4FY.mjs +1 -0
  11. package/dist/chunk-Y7RUNRU2.mjs +1 -0
  12. package/dist/collaboration/index.d.mts +65 -0
  13. package/dist/collaboration/index.mjs +1 -0
  14. package/dist/{content-sSHuWw49.d.mts → content-MOZ6hKP4.d.mts} +357 -357
  15. package/dist/core.d.mts +148 -341
  16. package/dist/core.mjs +1 -1
  17. package/dist/{displayListQueries-p-ijSzdh.d.mts → displayListQueries-BJlo7Jkz.d.mts} +24 -6
  18. package/dist/docx/index.d.mts +40 -520
  19. package/dist/docx/index.mjs +2 -2
  20. package/dist/editor/index.d.mts +36 -151
  21. package/dist/editor/index.mjs +1 -1
  22. package/dist/{fontLoader-Bx6DK6-2.d.mts → fontLoader-aSewHMKF.d.mts} +65 -63
  23. package/dist/{formatting-DoL7KBSL.d.mts → formatting-D1EPSaJP.d.mts} +1 -1
  24. package/dist/{rustDisplayList-dqunvwxH.d.mts → frameDelta-D965X8yK.d.mts} +3 -274
  25. package/dist/generated/edit/docx_edit_bg.wasm +0 -0
  26. package/dist/generated/layout/docx_layout_bg.wasm +0 -0
  27. package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
  28. package/dist/generated/parse/docx_parse_bg.wasm +0 -0
  29. package/dist/index-Dx4Z3lkz.d.mts +1010 -0
  30. package/dist/layout/index.d.mts +19 -240
  31. package/dist/layout/index.mjs +1 -1
  32. package/dist/layout/pagination/index.d.mts +10 -58
  33. package/dist/layout/pagination/index.mjs +1 -1
  34. package/dist/layout/render/index.d.mts +11 -11
  35. package/dist/layout/render/index.mjs +1 -1
  36. package/dist/plugin-api/RenderedDomContext.d.mts +9 -9
  37. package/dist/plugin-api/index.d.mts +191 -6
  38. package/dist/plugin-api/resolveItemPositions.d.mts +4 -5
  39. package/dist/rustDisplayList-BRuZBqdL.d.mts +278 -0
  40. package/dist/rustMeasureSource-D1KsQvVC.d.mts +106 -0
  41. package/dist/selectiveSave-CVoajSKE.d.mts +56 -0
  42. package/dist/styles/index.d.mts +4 -39
  43. package/dist/styles/index.mjs +1 -1
  44. package/dist/{styles-VxNcXLdi.d.mts → styles-Dn_o3Vo5.d.mts} +2 -2
  45. package/dist/types/content.d.mts +2 -2
  46. package/dist/types/document.d.mts +40 -14
  47. package/dist/{types-DNrYr6yQ.d.mts → types-BfqUl2h_.d.mts} +3 -71
  48. package/dist/utils/comments.d.mts +2 -2
  49. package/dist/utils/index.d.mts +110 -576
  50. package/dist/utils/index.mjs +1 -84
  51. package/dist/utils/stylePreview.d.mts +2 -2
  52. package/dist/utils/units.d.mts +33 -2
  53. package/dist/wasm-DO3BUV7C.mjs +1 -0
  54. package/dist/wasm-NWXX4H5G.mjs +1 -0
  55. package/dist/wasm-edit.d.mts +14 -5
  56. package/dist/wasm-edit.mjs +1 -1
  57. package/dist/wasm-layout.d.mts +10 -1
  58. package/dist/wasm-layout.mjs +1 -1
  59. package/dist/wasm-opc.mjs +1 -1
  60. package/dist/wasm-parse.mjs +1 -1
  61. package/dist/yrs/index.d.mts +6 -881
  62. package/dist/yrs/index.mjs +1 -1
  63. package/dist/yrs/residentEngineWorker.mjs +1 -1
  64. package/package.json +16 -139
  65. package/dist/Subscribable-DOz6Ohoo.d.mts +0 -33
  66. package/dist/agent/index.d.mts +0 -531
  67. package/dist/agent/index.mjs +0 -1
  68. package/dist/chunk-34K66SY4.mjs +0 -1
  69. package/dist/chunk-4RCISPPE.mjs +0 -1
  70. package/dist/chunk-52GB3Y42.mjs +0 -1
  71. package/dist/chunk-6NEKRDXF.mjs +0 -1
  72. package/dist/chunk-6PW4CWUG.mjs +0 -1
  73. package/dist/chunk-7DEIW7FL.mjs +0 -1
  74. package/dist/chunk-7PCO5I2O.mjs +0 -1
  75. package/dist/chunk-BI3B33LI.mjs +0 -1
  76. package/dist/chunk-BIQWVK5P.mjs +0 -2
  77. package/dist/chunk-CIRN3LZA.mjs +0 -1
  78. package/dist/chunk-DXKG3HQ5.mjs +0 -16
  79. package/dist/chunk-FPZBTOD6.mjs +0 -1
  80. package/dist/chunk-FZIA7OFY.mjs +0 -1
  81. package/dist/chunk-GWKJ2Y4Y.mjs +0 -1
  82. package/dist/chunk-HJGAQIU7.mjs +0 -2
  83. package/dist/chunk-I6KKMUUC.mjs +0 -1
  84. package/dist/chunk-IL5JZJT7.mjs +0 -1
  85. package/dist/chunk-JY6ILTNS.mjs +0 -1
  86. package/dist/chunk-KEE52TT5.mjs +0 -1
  87. package/dist/chunk-KVKLLTDP.mjs +0 -58
  88. package/dist/chunk-L5ISVQ3W.mjs +0 -1
  89. package/dist/chunk-LDUWIM7M.mjs +0 -1
  90. package/dist/chunk-N5Q3YN64.mjs +0 -1
  91. package/dist/chunk-NEWOMDTX.mjs +0 -1
  92. package/dist/chunk-O2QSE2I7.mjs +0 -1
  93. package/dist/chunk-OJOHXQNQ.mjs +0 -1
  94. package/dist/chunk-OMR3TWCD.mjs +0 -2
  95. package/dist/chunk-P3KDV4M2.mjs +0 -1
  96. package/dist/chunk-Q7PO7V73.mjs +0 -1
  97. package/dist/chunk-QOUFE3VX.mjs +0 -1
  98. package/dist/chunk-TYHI7RAD.mjs +0 -1
  99. package/dist/chunk-UIEJWORW.mjs +0 -1
  100. package/dist/chunk-VAOUFAUH.mjs +0 -1
  101. package/dist/chunk-VBOTMRXV.mjs +0 -1
  102. package/dist/chunk-VCER63GQ.mjs +0 -1
  103. package/dist/chunk-WAUF2UC7.mjs +0 -2
  104. package/dist/chunk-X4XDO3LZ.mjs +0 -1
  105. package/dist/chunk-XQBCCJBO.mjs +0 -9
  106. package/dist/chunk-XWUOLYRQ.mjs +0 -2
  107. package/dist/chunk-XYH6XWP3.mjs +0 -10
  108. package/dist/chunk-YBIM6UJV.mjs +0 -8
  109. package/dist/chunk-YCIH2Q3E.mjs +0 -1
  110. package/dist/chunk-ZOV5KL7C.mjs +0 -1
  111. package/dist/colorResolver-n0o7H7ep.d.mts +0 -290
  112. package/dist/core-plugins.d.mts +0 -37
  113. package/dist/core-plugins.mjs +0 -1
  114. package/dist/docx/parser.d.mts +0 -41
  115. package/dist/docx/parser.mjs +0 -1
  116. package/dist/docx/rezip.d.mts +0 -148
  117. package/dist/docx/rezip.mjs +0 -1
  118. package/dist/docx/serializer/index.d.mts +0 -42
  119. package/dist/docx/serializer/index.mjs +0 -1
  120. package/dist/editorTree-DO5PyDK8.d.mts +0 -37
  121. package/dist/executor-7O2RBJ2B.mjs +0 -1
  122. package/dist/headerFooterLayout-0zPT64Qc.d.mts +0 -316
  123. package/dist/headless.d.mts +0 -69
  124. package/dist/headless.mjs +0 -1
  125. package/dist/layout/flow/index.d.mts +0 -149
  126. package/dist/layout/flow/index.mjs +0 -1
  127. package/dist/layout/measure/index.d.mts +0 -324
  128. package/dist/layout/measure/index.mjs +0 -1
  129. package/dist/layout/pagination/types.d.mts +0 -4
  130. package/dist/layout/pagination/types.mjs +0 -1
  131. package/dist/managers/AutoSaveManager.d.mts +0 -81
  132. package/dist/managers/AutoSaveManager.mjs +0 -1
  133. package/dist/managers/TableSelectionManager.d.mts +0 -74
  134. package/dist/managers/TableSelectionManager.mjs +0 -1
  135. package/dist/managers/types.d.mts +0 -113
  136. package/dist/managers/types.mjs +0 -0
  137. package/dist/mcp-cli.mjs +0 -142
  138. package/dist/mcp.d.mts +0 -162
  139. package/dist/mcp.mjs +0 -16
  140. package/dist/measureBlocksPipeline-Df0Bbrwy.d.mts +0 -109
  141. package/dist/measuredBlock-DZwz8zhD.d.mts +0 -26
  142. package/dist/plugin-api/types.d.mts +0 -193
  143. package/dist/plugin-api/types.mjs +0 -0
  144. package/dist/processTemplate-HDUIZFJ5.mjs +0 -1
  145. package/dist/registry-DMM5VTdT.d.mts +0 -165
  146. package/dist/rustPagination-Bj2hq013.d.mts +0 -106
  147. package/dist/sectionConfigs-DW3J8q0X.d.mts +0 -55
  148. package/dist/selectionContext-Buc9BCU1.d.mts +0 -570
  149. package/dist/selectiveSave-oFBJ1n71.d.mts +0 -16
  150. package/dist/selectiveXmlPatch-ypkxlTD_.d.mts +0 -23
  151. package/dist/settingsParser-CcGvtmCK.d.mts +0 -33
  152. package/dist/types/agentApi.d.mts +0 -456
  153. package/dist/types/agentApi.mjs +0 -1
  154. package/dist/types-dYdjUZMo.d.mts +0 -311
  155. package/dist/units-O5Y02RKQ.d.mts +0 -34
  156. package/dist/utils/headingCollector.d.mts +0 -28
  157. package/dist/utils/headingCollector.mjs +0 -1
  158. package/dist/utils/highlightColors.d.mts +0 -14
  159. package/dist/utils/highlightColors.mjs +0 -1
  160. package/dist/utils/textSelection.d.mts +0 -92
  161. package/dist/utils/textSelection.mjs +0 -1
  162. package/dist/variableDetector-Borj29SF.d.mts +0 -115
  163. package/dist/wasm-FZQ5XB2Y.mjs +0 -1
  164. package/dist/wasm-SA237OSP.mjs +0 -1
  165. package/dist/watermarkApi-DCxjutkg.d.mts +0 -38
@@ -1,290 +0,0 @@
1
- import { Document } from './types/document.mjs';
2
- import { C as ColorValue, a as Theme, z as ThemeColorSlot } from './formatting-DoL7KBSL.mjs';
3
-
4
- /**
5
- * Template Processing Utility
6
- *
7
- * Uses docxtemplater to substitute template variables in DOCX documents:
8
- * - Processes {variable_name} patterns (docxtemplater default syntax)
9
- * - Preserves all formatting (fonts, styles, colors, tables)
10
- * - Error handling with useful messages
11
- */
12
- /**
13
- * Options for template processing
14
- */
15
- interface ProcessTemplateOptions {
16
- /** How to handle undefined variables */
17
- nullGetter?: 'keep' | 'empty' | 'error';
18
- /** Custom parser for variable names */
19
- parser?: (tag: string) => {
20
- get: (scope: Record<string, unknown>) => unknown;
21
- };
22
- /** Line breaks: keep raw \n or convert to w:br */
23
- linebreaks?: boolean;
24
- /** Delimiter settings */
25
- delimiters?: {
26
- start?: string;
27
- end?: string;
28
- };
29
- }
30
- /**
31
- * Result of template processing
32
- */
33
- interface ProcessTemplateResult {
34
- /** The processed document buffer */
35
- buffer: ArrayBuffer;
36
- /** Variables that were found and replaced */
37
- replacedVariables: string[];
38
- /** Variables that were not replaced (no value provided) */
39
- unreplacedVariables: string[];
40
- /** Any warnings during processing */
41
- warnings: string[];
42
- }
43
- /**
44
- * Error details from template processing
45
- */
46
- interface TemplateError {
47
- /** Error message */
48
- message: string;
49
- /** Variable name that caused the error (if applicable) */
50
- variable?: string;
51
- /** Error type */
52
- type: 'parse' | 'render' | 'undefined' | 'unknown';
53
- /** Original error */
54
- originalError?: Error;
55
- }
56
- /**
57
- * Process a DOCX template with variable substitution
58
- *
59
- * @param buffer - The DOCX file as ArrayBuffer
60
- * @param variables - Map of variable names to values
61
- * @param options - Processing options
62
- * @returns Processed DOCX as ArrayBuffer
63
- */
64
- declare function processTemplate(buffer: ArrayBuffer, variables: Record<string, string>, options?: ProcessTemplateOptions): ArrayBuffer;
65
- /**
66
- * Process template with detailed result
67
- *
68
- * @param buffer - The DOCX file as ArrayBuffer
69
- * @param variables - Map of variable names to values
70
- * @param options - Processing options
71
- * @returns Detailed processing result
72
- */
73
- declare function processTemplateDetailed(buffer: ArrayBuffer, variables: Record<string, string>, options?: ProcessTemplateOptions): ProcessTemplateResult;
74
- /**
75
- * Process template and return as Blob
76
- *
77
- * @param buffer - The DOCX file as ArrayBuffer
78
- * @param variables - Map of variable names to values
79
- * @param options - Processing options
80
- * @returns Processed DOCX as Blob
81
- */
82
- declare function processTemplateAsBlob(buffer: ArrayBuffer, variables: Record<string, string>, options?: ProcessTemplateOptions): Blob;
83
- /**
84
- * Process template and trigger download
85
- *
86
- * @param buffer - The DOCX file as ArrayBuffer
87
- * @param variables - Map of variable names to values
88
- * @param filename - Output filename (without extension)
89
- * @param options - Processing options
90
- */
91
- declare function processTemplateAndDownload(buffer: ArrayBuffer, variables: Record<string, string>, filename?: string, options?: ProcessTemplateOptions): void;
92
- /**
93
- * Get all template tags in a document without processing
94
- *
95
- * @param buffer - The DOCX file as ArrayBuffer
96
- * @returns List of tag names found
97
- */
98
- declare function getTemplateTags(buffer: ArrayBuffer): string[];
99
- /**
100
- * Validate that a document is a valid docxtemplater template
101
- *
102
- * @param buffer - The DOCX file as ArrayBuffer
103
- * @returns Validation result
104
- */
105
- declare function validateTemplate(buffer: ArrayBuffer): {
106
- valid: boolean;
107
- errors: TemplateError[];
108
- tags: string[];
109
- };
110
- /**
111
- * Check if all required variables have values
112
- *
113
- * @param tags - List of template tags
114
- * @param variables - Provided variable values
115
- * @returns Missing variable names
116
- */
117
- declare function getMissingVariables(tags: string[], variables: Record<string, string>): string[];
118
- /**
119
- * Preview what the document will look like after processing
120
- * Returns the document text with variables replaced (for preview purposes)
121
- *
122
- * @param buffer - The DOCX file as ArrayBuffer
123
- * @param variables - Map of variable names to values
124
- * @returns Preview text
125
- */
126
- declare function previewTemplate(buffer: ArrayBuffer, variables: Record<string, string>): string;
127
- /**
128
- * Process template with conditional sections
129
- * Supports #if, #unless, #each loops
130
- *
131
- * @param buffer - The DOCX file as ArrayBuffer
132
- * @param data - Full data object (can include arrays, nested objects)
133
- * @param options - Processing options
134
- * @returns Processed DOCX as ArrayBuffer
135
- */
136
- declare function processTemplateAdvanced(buffer: ArrayBuffer, data: Record<string, unknown>, options?: ProcessTemplateOptions): ArrayBuffer;
137
- /**
138
- * Create a template processor with preset options
139
- */
140
- declare function createTemplateProcessor(defaultOptions?: ProcessTemplateOptions): (buffer: ArrayBuffer, variables: Record<string, string>) => ArrayBuffer;
141
-
142
- /**
143
- * Create Document Utility
144
- *
145
- * Provides functions to create new documents programmatically.
146
- */
147
-
148
- /**
149
- * Options for creating an empty document
150
- */
151
- interface CreateEmptyDocumentOptions {
152
- /** Page width in twips (default: 12240 = 8.5 inches) */
153
- pageWidth?: number;
154
- /** Page height in twips (default: 15840 = 11 inches) */
155
- pageHeight?: number;
156
- /** Page orientation (default: 'portrait') */
157
- orientation?: 'portrait' | 'landscape';
158
- /** Top margin in twips (default: 1440 = 1 inch) */
159
- marginTop?: number;
160
- /** Bottom margin in twips (default: 1440 = 1 inch) */
161
- marginBottom?: number;
162
- /** Left margin in twips (default: 1440 = 1 inch) */
163
- marginLeft?: number;
164
- /** Right margin in twips (default: 1440 = 1 inch) */
165
- marginRight?: number;
166
- /** Initial text content (default: empty string) */
167
- initialText?: string;
168
- }
169
- /**
170
- * Create an empty document with a single paragraph
171
- *
172
- * @param options - Optional configuration for the document
173
- * @returns A new empty Document object
174
- *
175
- * @example
176
- * ```ts
177
- * // Create a blank document
178
- * const doc = createEmptyDocument();
179
- *
180
- * // Create with custom margins
181
- * const doc = createEmptyDocument({
182
- * marginTop: 720, // 0.5 inch
183
- * marginBottom: 720,
184
- * });
185
- *
186
- * // Create with initial text
187
- * const doc = createEmptyDocument({
188
- * initialText: 'Hello, World!'
189
- * });
190
- * ```
191
- */
192
- declare function createEmptyDocument(options?: CreateEmptyDocumentOptions): Document;
193
- /**
194
- * Create a document with a single paragraph containing the given text
195
- *
196
- * @param text - The text content for the document
197
- * @param options - Optional configuration for the document
198
- * @returns A new Document object with the specified text
199
- */
200
- declare function createDocumentWithText(text: string, options?: Omit<CreateEmptyDocumentOptions, 'initialText'>): Document;
201
-
202
- /**
203
- * Color Resolver - Convert OOXML colors to CSS
204
- *
205
- * The generic color machinery (theme slots, tint/shade math, blending, the
206
- * picker matrix) is re-exported here. This module keeps the WordprocessingML-
207
- * specific pieces: w:highlight named colors, w:shd shading semantics, and
208
- * ColorValue construction helpers.
209
- *
210
- * OOXML Color References:
211
- * - w:color/@w:val - RGB hex or "auto"
212
- * - w:color/@w:themeColor - Theme color slot
213
- * - w:color/@w:themeTint - Tint modifier (0-255, hex)
214
- * - w:color/@w:themeShade - Shade modifier (0-255, hex)
215
- */
216
-
217
- /**
218
- * Resolve a highlight color name to CSS
219
- *
220
- * @param highlight - Highlight color name (e.g., "yellow", "cyan")
221
- * @returns CSS color string or empty string for "none"
222
- */
223
- declare function resolveHighlightColor(highlight: string | undefined): string;
224
- /**
225
- * Resolve a shading fill or pattern color to CSS
226
- *
227
- * @param color - ColorValue for fill
228
- * @param theme - Theme for resolving theme colors
229
- * @returns CSS color string
230
- */
231
- declare function resolveShadingColor(color: ColorValue | undefined | null, theme: Theme | null | undefined): string;
232
- /**
233
- * Check if a color is effectively black
234
- *
235
- * @param color - ColorValue object
236
- * @param theme - Theme for resolving theme colors
237
- * @returns True if color resolves to black or very dark
238
- */
239
- declare function isBlack(color: ColorValue | undefined | null, theme: Theme | null | undefined): boolean;
240
- /**
241
- * Check if a color is effectively white
242
- *
243
- * @param color - ColorValue object
244
- * @param theme - Theme for resolving theme colors
245
- * @returns True if color resolves to white or very light
246
- */
247
- declare function isWhite(color: ColorValue | undefined | null, theme: Theme | null | undefined): boolean;
248
- /**
249
- * Parse a color string (various formats) to ColorValue
250
- *
251
- * @param colorString - Color string like "FF0000", "auto", or theme color name
252
- * @returns ColorValue object
253
- */
254
- declare function parseColorString(colorString: string | undefined): ColorValue | undefined;
255
- /**
256
- * Create a ColorValue from theme color reference
257
- *
258
- * @param themeColor - Theme color slot name
259
- * @param tint - Optional tint modifier
260
- * @param shade - Optional shade modifier
261
- * @returns ColorValue object
262
- */
263
- declare function createThemeColor(themeColor: ThemeColorSlot, tint?: number, shade?: number): ColorValue;
264
- /**
265
- * Create a ColorValue from RGB hex
266
- *
267
- * @param hex - 6-character hex color (no #)
268
- * @returns ColorValue object
269
- */
270
- declare function createRgbColor(hex: string): ColorValue;
271
- /**
272
- * Ensure a hex color string has a '#' prefix.
273
- */
274
- declare function ensureHexPrefix(hex: string): string;
275
- /**
276
- * Resolve a highlight color value to a CSS-ready string.
277
- * Tries OOXML named highlight first, then ensures hex prefix.
278
- */
279
- declare function resolveHighlightToCss(value: string): string;
280
- /**
281
- * Check if two colors are equal
282
- *
283
- * @param color1 - First color
284
- * @param color2 - Second color
285
- * @param theme - Theme for resolving
286
- * @returns True if colors resolve to the same value
287
- */
288
- declare function colorsEqual(color1: ColorValue | undefined | null, color2: ColorValue | undefined | null, theme: Theme | null | undefined): boolean;
289
-
290
- export { type CreateEmptyDocumentOptions as C, type ProcessTemplateOptions as P, type TemplateError as T, type ProcessTemplateResult as a, createDocumentWithText as b, colorsEqual as c, createEmptyDocument as d, createRgbColor as e, createTemplateProcessor as f, createThemeColor as g, getMissingVariables as h, getTemplateTags as i, isBlack as j, isWhite as k, previewTemplate as l, processTemplate as m, processTemplateAdvanced as n, processTemplateAsBlob as o, parseColorString as p, processTemplateDetailed as q, resolveHighlightColor as r, resolveShadingColor as s, ensureHexPrefix as t, resolveHighlightToCss as u, validateTemplate as v, processTemplateAndDownload as w };
@@ -1,37 +0,0 @@
1
- import { b as CorePlugin } from './types-dYdjUZMo.mjs';
2
- export { C as CommandHandler, a as CommandResult, E as ExtractCommand, J as JsonSchema, L as LoadedDocument, M as McpSession, c as McpToolAnnotations, d as McpToolContent, e as McpToolContext, f as McpToolDefinition, n as McpToolExample, g as McpToolHandler, h as McpToolResult, P as PluginCommand, C as PluginCommandHandler, i as PluginEvent, j as PluginEventListener, k as PluginOptions, l as PluginRegistrationResult, f as ToolDefinition, g as ToolHandler, h as ToolResult, T as TypedCommandHandler, Z as ZodSchemaLike, m as isZodSchema } from './types-dYdjUZMo.mjs';
3
- export { P as PluginRegistry, c as createPluginRegistrar, p as pluginRegistry, r as registerPlugins } from './registry-DMM5VTdT.mjs';
4
- import './types/document.mjs';
5
- import './content-sSHuWw49.mjs';
6
- import './formatting-DoL7KBSL.mjs';
7
- import './docx/wrapTypes.mjs';
8
- import './styles-VxNcXLdi.mjs';
9
- import './settingsParser-CcGvtmCK.mjs';
10
- import './types/agentApi.mjs';
11
-
12
- /**
13
- * Docxtemplater Plugin
14
- *
15
- * Core plugin for template variable functionality using docxtemplater.
16
- *
17
- * **Command handlers** — `insertTemplateVariable` and `replaceWithTemplateVariable`
18
- * allow DocumentAgent to programmatically insert `{variable}` placeholders.
19
- *
20
- * @example
21
- * ```ts
22
- * import { pluginRegistry } from '@betteroffice/docx/core-plugins';
23
- * import { docxtemplaterPlugin } from '@betteroffice/docx/core-plugins/docxtemplater';
24
- *
25
- * pluginRegistry.register(docxtemplaterPlugin);
26
- * ```
27
- */
28
-
29
- /**
30
- * Docxtemplater plugin for template variable functionality.
31
- *
32
- * Dependency validation is handled lazily by `processTemplate` at call time,
33
- * so no eager `initialize()` is needed.
34
- */
35
- declare const docxtemplaterPlugin: CorePlugin;
36
-
37
- export { CorePlugin, CorePlugin as Plugin, docxtemplaterPlugin };
@@ -1 +0,0 @@
1
- export{b as docxtemplaterPlugin,a as isZodSchema}from'./chunk-XYH6XWP3.mjs';import'./chunk-O2QSE2I7.mjs';import'./chunk-UIEJWORW.mjs';export{a as PluginRegistry,d as createPluginRegistrar,b as pluginRegistry,c as registerPlugins}from'./chunk-VBOTMRXV.mjs';import'./chunk-LDUWIM7M.mjs';import'./chunk-DXKG3HQ5.mjs';import'./chunk-FPZBTOD6.mjs';import'./chunk-H3JCIGWK.mjs';import'./chunk-SINEY6ZF.mjs';import'./chunk-T4EZMUXM.mjs';import'./chunk-TTRUPDAB.mjs';
@@ -1,41 +0,0 @@
1
- import { Document } from '../types/document.mjs';
2
- import { D as DocxInput } from '../docxInput-DTbCa48g.mjs';
3
- import '../content-sSHuWw49.mjs';
4
- import '../formatting-DoL7KBSL.mjs';
5
- import './wrapTypes.mjs';
6
- import '../styles-VxNcXLdi.mjs';
7
- import '../settingsParser-CcGvtmCK.mjs';
8
-
9
- /**
10
- * Public DOCX parser facade.
11
- *
12
- * Rust S9 owns ZIP/XML parsing. TypeScript only normalizes host inputs,
13
- * rehydrates the public `Document`, reports progress, and registers fonts.
14
- * @packageDocumentation
15
- * @public
16
- */
17
-
18
- type ProgressCallback = (stage: string, percent: number) => void;
19
- interface ParseOptions {
20
- onProgress?: ProgressCallback;
21
- preloadFonts?: boolean;
22
- parseHeadersFooters?: boolean;
23
- parseNotes?: boolean;
24
- detectVariables?: boolean;
25
- }
26
- declare function parseDocx(input: DocxInput, options?: ParseOptions): Promise<Document>;
27
- declare function quickParseDocx(buffer: ArrayBuffer): Promise<Document>;
28
- declare function fullParseDocx(buffer: ArrayBuffer, onProgress?: ProgressCallback): Promise<Document>;
29
- declare function getDocxVariables(buffer: ArrayBuffer): Promise<string[]>;
30
- declare function getDocxSummary(buffer: ArrayBuffer): Promise<{
31
- hasDocument: boolean;
32
- hasStyles: boolean;
33
- hasTheme: boolean;
34
- hasNumbering: boolean;
35
- headerCount: number;
36
- footerCount: number;
37
- mediaCount: number;
38
- variableCount: number;
39
- }>;
40
-
41
- export { type ParseOptions, type ProgressCallback, fullParseDocx, getDocxSummary, getDocxVariables, parseDocx, quickParseDocx };
@@ -1 +0,0 @@
1
- export{c as fullParseDocx,e as getDocxSummary,d as getDocxVariables,a as parseDocx,b as quickParseDocx}from'../chunk-LDUWIM7M.mjs';import'../chunk-DXKG3HQ5.mjs';import'../chunk-FPZBTOD6.mjs';import'../chunk-H3JCIGWK.mjs';import'../chunk-SINEY6ZF.mjs';import'../chunk-T4EZMUXM.mjs';import'../chunk-TTRUPDAB.mjs';
@@ -1,148 +0,0 @@
1
- import { Document } from '../types/document.mjs';
2
- import '../content-sSHuWw49.mjs';
3
- import '../formatting-DoL7KBSL.mjs';
4
- import './wrapTypes.mjs';
5
- import '../styles-VxNcXLdi.mjs';
6
- import '../settingsParser-CcGvtmCK.mjs';
7
-
8
- /**
9
- * Zip-container READ facade for the DOCX open path.
10
- *
11
- * Backed by the inlined docx-container wasm (see ./wasm): every non-directory
12
- * entry is inflated in Rust — with the decompression-bomb and path-traversal
13
- * guards enforced there by construction — and exposed as a normalized, eager
14
- * read view. Consumers pull parts by path.
15
- *
16
- * Read path only. The write/rezip builder assembles a parts map and hands it
17
- * to the same wasm container via `rezipContainer` (see ./rezip).
18
- */
19
- /**
20
- * Eager, normalized read view of an OPC (DOCX) container. All entries are
21
- * already materialized; lookups are synchronous.
22
- */
23
- interface ZipContainerReader {
24
- paths(): string[];
25
- file(path: string): Uint8Array | null;
26
- text(path: string): string | null;
27
- }
28
-
29
- /**
30
- * Legacy raw-package shape retained for the public rezip compatibility
31
- * signature. Live parsing no longer constructs it; Rust S9 owns extraction.
32
- */
33
- interface RawDocxContent {
34
- documentXml: string | null;
35
- stylesXml: string | null;
36
- themeXml: string | null;
37
- numberingXml: string | null;
38
- fontTableXml: string | null;
39
- settingsXml: string | null;
40
- webSettingsXml: string | null;
41
- headers: Map<string, string>;
42
- footers: Map<string, string>;
43
- footnotesXml: string | null;
44
- endnotesXml: string | null;
45
- commentsXml: string | null;
46
- commentsExtensibleXml: string | null;
47
- commentsExtendedXml: string | null;
48
- documentRels: string | null;
49
- packageRels: string | null;
50
- contentTypesXml: string | null;
51
- corePropsXml: string | null;
52
- appPropsXml: string | null;
53
- customPropsXml: string | null;
54
- media: Map<string, ArrayBuffer>;
55
- fonts: Map<string, ArrayBuffer>;
56
- allXml: Map<string, string>;
57
- container: ZipContainerReader;
58
- originalBuffer: ArrayBuffer;
59
- }
60
-
61
- /**
62
- * Part Enumeration
63
- *
64
- * Shared helpers for walking the parts of a DOCX package (body, headers,
65
- * footers, footnotes, endnotes) when registering newly inserted images and
66
- * hyperlinks against each part's rels file.
67
- */
68
-
69
- /**
70
- * The assembled DOCX package as a `path -> bytes` map. Both the full-repack and
71
- * selective-save flows build one of these and hand it to the wasm container.
72
- */
73
- type PartsMap = Map<string, Uint8Array>;
74
- /**
75
- * Find the highest rId number in a relationships XML string.
76
- */
77
- declare function findMaxRId(relsXml: string): number;
78
-
79
- /**
80
- * Empty DOCX Template
81
- *
82
- * Produces a minimal valid DOCX package — Content Types, package + document
83
- * rels, an empty body with the standard letter-size section, default
84
- * Calibri 11 styles, and core/app properties. Used as the base for
85
- * `createDocx()` when the caller has no existing buffer.
86
- */
87
- /**
88
- * Create a new empty DOCX file.
89
- *
90
- * @returns Promise resolving to minimal DOCX as ArrayBuffer
91
- */
92
- declare function createEmptyDocx(): Promise<ArrayBuffer>;
93
-
94
- /**
95
- * Public DOCX package I/O wrappers.
96
- *
97
- * Model serialization and selective package writing are Rust-owned. The
98
- * TypeScript kept here is compatibility glue for public ZIP utilities and host
99
- * values; package inflation/deflation continues through `docx-container` wasm.
100
- * @packageDocumentation
101
- * @public
102
- */
103
-
104
- declare const COMMENTS_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml";
105
- declare const COMMENTS_EXTENDED_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml";
106
- declare const COMMENTS_IDS_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml";
107
- declare const COMMENTS_EXTENSIBLE_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml";
108
- interface RepackOptions {
109
- /** Retained for signature compatibility; `docx-container` chooses compression. */
110
- compressionLevel?: number;
111
- updateModifiedDate?: boolean;
112
- modifiedBy?: string;
113
- }
114
- /** Repack a public Document through the live Rust S13 writer. */
115
- declare function repackDocx(doc: Document, options?: RepackOptions): Promise<ArrayBuffer>;
116
- declare function repackDocxFromRaw(doc: Document, rawContent: RawDocxContent, options?: RepackOptions): Promise<ArrayBuffer>;
117
- declare function updateDocumentXml(originalBuffer: ArrayBuffer, newDocumentXml: string, options?: RepackOptions): Promise<ArrayBuffer>;
118
- declare function updateXmlFile(originalBuffer: ArrayBuffer, path: string, content: string, options?: RepackOptions): Promise<ArrayBuffer>;
119
- declare function updateMultipleFiles(originalBuffer: ArrayBuffer, updates: Map<string, string | ArrayBuffer>, options?: RepackOptions): Promise<ArrayBuffer>;
120
- declare function applyUpdatesToZip(pkg: PartsMap, updates: Map<string, string | ArrayBuffer>, _options?: RepackOptions): Promise<ArrayBuffer>;
121
- declare function addRelationship(originalBuffer: ArrayBuffer, relationship: {
122
- type: string;
123
- target: string;
124
- targetMode?: 'External' | 'Internal';
125
- }): Promise<{
126
- buffer: ArrayBuffer;
127
- rId: string;
128
- }>;
129
- declare function addMedia(originalBuffer: ArrayBuffer, filename: string, data: ArrayBuffer, mimeType: string): Promise<{
130
- buffer: ArrayBuffer;
131
- rId: string;
132
- path: string;
133
- }>;
134
- declare function updateCoreProperties(corePropsXml: string, options: {
135
- updateModifiedDate?: boolean;
136
- modifiedBy?: string;
137
- }): string;
138
- declare function validateDocx(buffer: ArrayBuffer): Promise<{
139
- valid: boolean;
140
- errors: string[];
141
- warnings: string[];
142
- }>;
143
- declare function isDocxBuffer(buffer: ArrayBuffer): boolean;
144
- declare function createDocx(doc: Document): Promise<ArrayBuffer>;
145
- /** Compatibility helper for callers that update header/footer parts directly. */
146
- declare function collectHeaderFooterUpdates(doc: Document): Map<string, string>;
147
-
148
- export { COMMENTS_CONTENT_TYPE, COMMENTS_EXTENDED_CONTENT_TYPE, COMMENTS_EXTENSIBLE_CONTENT_TYPE, COMMENTS_IDS_CONTENT_TYPE, type PartsMap, type RepackOptions, addMedia, addRelationship, applyUpdatesToZip, collectHeaderFooterUpdates, createDocx, createEmptyDocx, repackDocx as default, findMaxRId, isDocxBuffer, repackDocx, repackDocxFromRaw, updateCoreProperties, updateDocumentXml, updateMultipleFiles, updateXmlFile, validateDocx };
@@ -1 +0,0 @@
1
- export{d as COMMENTS_CONTENT_TYPE,e as COMMENTS_EXTENDED_CONTENT_TYPE,g as COMMENTS_EXTENSIBLE_CONTENT_TYPE,f as COMMENTS_IDS_CONTENT_TYPE,o as addMedia,n as addRelationship,m as applyUpdatesToZip,t as collectHeaderFooterUpdates,s as createDocx,c as createEmptyDocx,u as default,a as findMaxRId,r as isDocxBuffer,h as repackDocx,i as repackDocxFromRaw,p as updateCoreProperties,j as updateDocumentXml,l as updateMultipleFiles,k as updateXmlFile,q as validateDocx}from'../chunk-KVKLLTDP.mjs';import'../chunk-BIQWVK5P.mjs';import'../chunk-H3JCIGWK.mjs';import'../chunk-N5Q3YN64.mjs';import'../chunk-SINEY6ZF.mjs';import'../chunk-T4EZMUXM.mjs';import'../chunk-TTRUPDAB.mjs';
@@ -1,42 +0,0 @@
1
- import { Document } from '../../types/document.mjs';
2
- import { c as DocumentBody, S as SectionProperties, B as BlockContent, C as Comment, E as Endnote, F as Footnote, m as HeaderFooter, P as Paragraph, R as Run, T as Table } from '../../content-sSHuWw49.mjs';
3
- import '../../formatting-DoL7KBSL.mjs';
4
- import '../../styles-VxNcXLdi.mjs';
5
- import '../../settingsParser-CcGvtmCK.mjs';
6
- import '../wrapTypes.mjs';
7
-
8
- /**
9
- * DOCX XML serializers.
10
- *
11
- * The public synchronous serializer surface is retained for compatibility, but
12
- * all OOXML emission is owned by the Rust writer. The fixed context only
13
- * supplies deterministic IDs to standalone XML calls; package saves use the
14
- * source-package hash and clock through {@link ../rustSaveFacade}.
15
- * @packageDocumentation
16
- * @public
17
- */
18
-
19
- /** Serialize a single block content item. */
20
- declare function serializeBlockContent(block: BlockContent): string;
21
- /** Serialize a complete `word/document.xml` part. */
22
- declare function serializeDocument(doc: Document): string;
23
- /** Serialize the contents of `w:body`, without the body tags. */
24
- declare function serializeDocumentBody(body: DocumentBody): string;
25
- /** Serialize section properties. */
26
- declare function serializeSectionProperties(props: SectionProperties | undefined): string;
27
- /** Serialize one paragraph. */
28
- declare function serializeParagraph(paragraph: Paragraph): string;
29
- /** Serialize one run. */
30
- declare function serializeRun(run: Run): string;
31
- /** Serialize one table. */
32
- declare function serializeTable(table: Table): string;
33
- /** Serialize a header or footer part. */
34
- declare function serializeHeaderFooter(hf: HeaderFooter): string;
35
- /** Serialize the comments part. */
36
- declare function serializeComments(comments: Comment[]): string;
37
- /** Serialize the footnotes part. */
38
- declare function serializeFootnotes(footnotes: Footnote[]): string;
39
- /** Serialize the endnotes part. */
40
- declare function serializeEndnotes(endnotes: Endnote[]): string;
41
-
42
- export { serializeBlockContent, serializeComments, serializeDocument, serializeDocumentBody, serializeEndnotes, serializeFootnotes, serializeHeaderFooter, serializeParagraph, serializeRun, serializeSectionProperties, serializeTable };
@@ -1 +0,0 @@
1
- export{a as serializeBlockContent,i as serializeComments,b as serializeDocument,c as serializeDocumentBody,k as serializeEndnotes,j as serializeFootnotes,h as serializeHeaderFooter,e as serializeParagraph,f as serializeRun,d as serializeSectionProperties,g as serializeTable}from'../../chunk-N5Q3YN64.mjs';import'../../chunk-SINEY6ZF.mjs';import'../../chunk-T4EZMUXM.mjs';import'../../chunk-TTRUPDAB.mjs';
@@ -1,37 +0,0 @@
1
- /**
2
- * Structural mark contract consumed by the legacy tree-to-layout adapter.
3
- * @public
4
- */
5
- interface EditorTreeMark {
6
- readonly type: {
7
- readonly name: string;
8
- };
9
- readonly attrs: Record<string, any>;
10
- }
11
- /**
12
- * Structural node contract consumed by renderer-side tree walkers.
13
- *
14
- * The contract deliberately describes only the immutable tree operations the
15
- * renderer needs, so core does not depend on any editor implementation.
16
- * @public
17
- */
18
- interface EditorTreeNode {
19
- readonly type: {
20
- readonly name: string;
21
- create(...args: any[]): EditorTreeNode;
22
- };
23
- readonly attrs: Record<string, any>;
24
- readonly marks: readonly EditorTreeMark[];
25
- readonly nodeSize: number;
26
- readonly content: {
27
- readonly size: number;
28
- };
29
- readonly isText: boolean;
30
- readonly isTextblock: boolean;
31
- readonly isInline: boolean;
32
- readonly text?: string | null;
33
- forEach(callback: (node: EditorTreeNode, offset: number, index: number) => void): void;
34
- descendants(callback: (node: EditorTreeNode, pos: number) => boolean | void): void;
35
- }
36
-
37
- export type { EditorTreeNode as E };
@@ -1 +0,0 @@
1
- export{a as executeCommand,b as executeCommands}from'./chunk-6PW4CWUG.mjs';import'./chunk-KXNZFTTK.mjs';import'./chunk-VBOTMRXV.mjs';import'./chunk-3UBMCDME.mjs';import'./chunk-TTRUPDAB.mjs';