@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,311 +0,0 @@
1
- import { Document } from './types/document.mjs';
2
- import { Position, Range, AgentCommand } from './types/agentApi.mjs';
3
-
4
- /**
5
- * Core Plugin System Types
6
- *
7
- * Defines the interfaces for headless plugins that work in Node.js
8
- * without React/DOM dependencies. These plugins extend DocumentAgent
9
- * with additional commands and expose MCP tools for AI integration.
10
- */
11
-
12
- /**
13
- * Core plugin interface - headless, works in Node.js
14
- *
15
- * Plugins can:
16
- * - Register command handlers that DocumentAgent dispatches to
17
- * - Declare MCP tools that the MCP server exposes to AI clients
18
- * - Have optional initialization logic
19
- * - Declare dependencies on other plugins
20
- */
21
- interface CorePlugin {
22
- /** Unique plugin identifier */
23
- id: string;
24
- /** Human-readable plugin name */
25
- name: string;
26
- /** Plugin version (semver) */
27
- version?: string;
28
- /** Plugin description */
29
- description?: string;
30
- /**
31
- * Command handlers this plugin provides.
32
- * DocumentAgent dispatches commands to these handlers.
33
- *
34
- * @example
35
- * ```ts
36
- * commandHandlers: {
37
- * 'insertTemplateVariable': (doc, cmd) => {
38
- * // Transform document
39
- * return modifiedDoc;
40
- * },
41
- * }
42
- * ```
43
- */
44
- commandHandlers?: Record<string, CommandHandler>;
45
- /**
46
- * MCP tools this plugin exposes.
47
- * MCP server collects these from all plugins.
48
- */
49
- mcpTools?: McpToolDefinition[];
50
- /**
51
- * Optional setup when plugin is registered.
52
- * Called once during plugin registration.
53
- */
54
- initialize?: () => void | Promise<void>;
55
- /**
56
- * Optional cleanup when plugin is unregistered.
57
- */
58
- destroy?: () => void | Promise<void>;
59
- /**
60
- * Dependencies on other plugins (by ID).
61
- * The registry ensures dependencies are loaded first.
62
- */
63
- dependencies?: string[];
64
- }
65
- /**
66
- * Command handler function type
67
- *
68
- * Receives a document and a command, returns a modified document.
69
- * Must be pure/immutable - always return a new document.
70
- */
71
- type CommandHandler = (doc: Document, command: PluginCommand) => Document;
72
- /**
73
- * Extended command type for plugins
74
- *
75
- * Plugins can define custom command types beyond the built-in AgentCommand types.
76
- */
77
- interface PluginCommand {
78
- /** Command type identifier */
79
- type: string;
80
- /** Unique command ID (for undo tracking) */
81
- id?: string;
82
- /** Position for positional commands */
83
- position?: Position;
84
- /** Range for range-based commands */
85
- range?: Range;
86
- /** Additional command-specific data */
87
- [key: string]: unknown;
88
- }
89
- /**
90
- * Result of command execution
91
- */
92
- interface CommandResult {
93
- /** The modified document */
94
- document: Document;
95
- /** Whether the command succeeded */
96
- success: boolean;
97
- /** Error message if failed */
98
- error?: string;
99
- /** Metadata about the operation */
100
- metadata?: Record<string, unknown>;
101
- }
102
- /**
103
- * MCP tool definition
104
- *
105
- * Describes a tool that can be called by AI clients through the MCP server.
106
- */
107
- interface McpToolDefinition {
108
- /** Tool name (used in MCP protocol) */
109
- name: string;
110
- /** Human-readable description for AI */
111
- description: string;
112
- /**
113
- * JSON Schema for tool input validation.
114
- * Can be a Zod schema or plain JSON Schema object.
115
- */
116
- inputSchema: JsonSchema | ZodSchemaLike;
117
- /**
118
- * Handler function for the tool.
119
- * Receives validated input and returns a result.
120
- */
121
- handler: McpToolHandler;
122
- /**
123
- * Optional annotations for the tool
124
- */
125
- annotations?: McpToolAnnotations;
126
- }
127
- /**
128
- * MCP tool handler function
129
- */
130
- type McpToolHandler = (input: unknown, context: McpToolContext) => Promise<McpToolResult> | McpToolResult;
131
- /**
132
- * Context passed to MCP tool handlers
133
- */
134
- interface McpToolContext {
135
- /** Current document (if loaded) */
136
- document?: Document;
137
- /** Document buffer (if loaded) */
138
- documentBuffer?: ArrayBuffer;
139
- /** Session state */
140
- session: McpSession;
141
- /** Logger for debugging */
142
- log: (message: string, data?: unknown) => void;
143
- }
144
- /**
145
- * MCP session state
146
- *
147
- * Maintains state across tool calls within a session.
148
- */
149
- interface McpSession {
150
- /** Session ID */
151
- id: string;
152
- /** Loaded documents by ID */
153
- documents: Map<string, LoadedDocument>;
154
- /** Custom session data */
155
- data: Map<string, unknown>;
156
- }
157
- /**
158
- * A loaded document in the session
159
- */
160
- interface LoadedDocument {
161
- /** Document ID */
162
- id: string;
163
- /** Parsed document */
164
- document: Document;
165
- /** Original buffer (for repacking) */
166
- buffer?: ArrayBuffer;
167
- /** Source filename or path */
168
- source?: string;
169
- /** Last modified timestamp */
170
- lastModified: number;
171
- }
172
- /**
173
- * MCP tool result
174
- */
175
- interface McpToolResult {
176
- /** Result content */
177
- content: McpToolContent[];
178
- /** Whether this is an error result */
179
- isError?: boolean;
180
- }
181
- /**
182
- * MCP tool content types
183
- */
184
- type McpToolContent = {
185
- type: 'text';
186
- text: string;
187
- } | {
188
- type: 'image';
189
- data: string;
190
- mimeType: string;
191
- } | {
192
- type: 'resource';
193
- uri: string;
194
- mimeType?: string;
195
- text?: string;
196
- };
197
- /**
198
- * MCP tool annotations
199
- */
200
- interface McpToolAnnotations {
201
- /** Tool category for organization */
202
- category?: string;
203
- /** Whether this tool modifies the document */
204
- readOnly?: boolean;
205
- /** Estimated cost/complexity */
206
- complexity?: 'low' | 'medium' | 'high';
207
- /** Example usage */
208
- examples?: McpToolExample[];
209
- }
210
- /**
211
- * MCP tool example
212
- */
213
- interface McpToolExample {
214
- /** Example description */
215
- description: string;
216
- /** Example input */
217
- input: unknown;
218
- /** Expected output description */
219
- output?: string;
220
- }
221
- /**
222
- * JSON Schema definition (subset)
223
- */
224
- interface JsonSchema {
225
- type?: string | string[];
226
- properties?: Record<string, JsonSchema>;
227
- items?: JsonSchema;
228
- required?: string[];
229
- description?: string;
230
- enum?: unknown[];
231
- default?: unknown;
232
- minimum?: number;
233
- maximum?: number;
234
- minLength?: number;
235
- maxLength?: number;
236
- pattern?: string;
237
- format?: string;
238
- additionalProperties?: boolean | JsonSchema;
239
- anyOf?: JsonSchema[];
240
- oneOf?: JsonSchema[];
241
- allOf?: JsonSchema[];
242
- $ref?: string;
243
- }
244
- /**
245
- * Zod-like schema interface for compatibility
246
- */
247
- interface ZodSchemaLike {
248
- _def?: unknown;
249
- parse?: (data: unknown) => unknown;
250
- safeParse?: (data: unknown) => {
251
- success: boolean;
252
- data?: unknown;
253
- error?: unknown;
254
- };
255
- }
256
- /**
257
- * Check if a schema is Zod-like
258
- */
259
- declare function isZodSchema(schema: unknown): schema is ZodSchemaLike;
260
- /**
261
- * Plugin lifecycle events
262
- */
263
- type PluginEvent = {
264
- type: 'registered';
265
- plugin: CorePlugin;
266
- } | {
267
- type: 'unregistered';
268
- pluginId: string;
269
- } | {
270
- type: 'error';
271
- pluginId: string;
272
- error: Error;
273
- };
274
- /**
275
- * Plugin event listener
276
- */
277
- type PluginEventListener = (event: PluginEvent) => void;
278
- /**
279
- * Extract command type from a union
280
- */
281
- type ExtractCommand<T extends AgentCommand, Type extends string> = T extends {
282
- type: Type;
283
- } ? T : never;
284
- /**
285
- * Create a typed command handler
286
- */
287
- type TypedCommandHandler<T extends PluginCommand> = (doc: Document, command: T) => Document;
288
- /**
289
- * Plugin configuration options
290
- */
291
- interface PluginOptions {
292
- /** Enable debug logging */
293
- debug?: boolean;
294
- /** Custom configuration */
295
- config?: Record<string, unknown>;
296
- }
297
- /**
298
- * Result of plugin registration
299
- */
300
- interface PluginRegistrationResult {
301
- /** Whether registration succeeded */
302
- success: boolean;
303
- /** Registered plugin (if successful) */
304
- plugin?: CorePlugin;
305
- /** Error message (if failed) */
306
- error?: string;
307
- /** Warning messages */
308
- warnings?: string[];
309
- }
310
-
311
- export { type CommandHandler as C, type ExtractCommand as E, type JsonSchema as J, type LoadedDocument as L, type McpSession as M, type PluginCommand as P, type TypedCommandHandler as T, type ZodSchemaLike as Z, type CommandResult as a, type CorePlugin as b, type McpToolAnnotations as c, type McpToolContent as d, type McpToolContext as e, type McpToolDefinition as f, type McpToolHandler as g, type McpToolResult as h, type PluginEvent as i, type PluginEventListener as j, type PluginOptions as k, type PluginRegistrationResult as l, isZodSchema as m, type McpToolExample as n };
@@ -1,34 +0,0 @@
1
- /**
2
- * Pixels per inch at standard DPI
3
- *
4
- * @public
5
- */
6
- declare const PIXELS_PER_INCH = 96;
7
- /**
8
- * Convert EMUs to pixels (at 96 DPI)
9
- *
10
- * 1 inch = 914400 EMUs = 96 pixels
11
- * Returns 0 for null/undefined/NaN inputs.
12
- *
13
- * @public
14
- */
15
- declare function emuToPixels(emu: number | undefined | null): number;
16
- /**
17
- * Convert pixels to EMUs.
18
- * EMU coordinates in OOXML are integer-typed (xs:long); rounding here keeps
19
- * floating-point drift (e.g. 52 px → 495299.99999999994) out of the document.
20
- *
21
- * @public
22
- */
23
- declare function pixelsToEmu(px: number): number;
24
- /**
25
- * Convert points to pixels (at 96 DPI)
26
- *
27
- * 1 inch = 72 points = 96 pixels
28
- * → 1 point = 96/72 pixels = 4/3 pixels
29
- *
30
- * @public
31
- */
32
- declare function pointsToPixels(points: number): number;
33
-
34
- export { PIXELS_PER_INCH as P, pointsToPixels as a, emuToPixels as e, pixelsToEmu as p };
@@ -1,28 +0,0 @@
1
- import { E as EditorTreeNode } from '../editorTree-DO5PyDK8.mjs';
2
-
3
- /**
4
- * @packageDocumentation
5
- * @public
6
- */
7
-
8
- /**
9
- * Information about a heading found in the document.
10
- */
11
- interface HeadingInfo {
12
- /** The text content of the heading */
13
- text: string;
14
- /** Outline level (0 = Heading 1, 1 = Heading 2, etc.) */
15
- level: number;
16
- /** ProseMirror document position of the paragraph node */
17
- pmPos: number;
18
- }
19
- /**
20
- * Collect all headings from a ProseMirror document.
21
- *
22
- * Detection logic:
23
- * 1. Check `outlineLevel` attr (set by OOXML parsing or style resolution)
24
- * 2. Fallback to `styleId` matching /^[Hh]eading(\d)$/
25
- */
26
- declare function collectHeadings(doc: EditorTreeNode): HeadingInfo[];
27
-
28
- export { type HeadingInfo, collectHeadings };
@@ -1 +0,0 @@
1
- export{a as collectHeadings}from'../chunk-TYHI7RAD.mjs';import'../chunk-TTRUPDAB.mjs';
@@ -1,14 +0,0 @@
1
- /**
2
- * OOXML highlight color name <-> hex mapping. Used by both adapter
3
- * toolbars when serialising highlight selections to the
4
- * `w:highlight` attribute (which only accepts named colors).
5
- *
6
- * Lifted from packages/docx-react/src/components/toolbarUtils.ts so both
7
- * sides share the same canonical table.
8
- * @packageDocumentation
9
- * @public
10
- */
11
- declare const HIGHLIGHT_HEX_TO_NAME: Record<string, string>;
12
- declare function mapHexToHighlightName(hex: string): string | null;
13
-
14
- export { HIGHLIGHT_HEX_TO_NAME, mapHexToHighlightName };
@@ -1 +0,0 @@
1
- export{a as HIGHLIGHT_HEX_TO_NAME,b as mapHexToHighlightName}from'../chunk-YCIH2Q3E.mjs';import'../chunk-TTRUPDAB.mjs';
@@ -1,92 +0,0 @@
1
- /**
2
- * Text Selection Utilities
3
- *
4
- * Utilities for word-level and paragraph-level text selection.
5
- * Used for double-click (word) and triple-click (paragraph) selection.
6
- * @packageDocumentation
7
- * @public
8
- */
9
- /**
10
- * Check if a character is a word character
11
- */
12
- declare function isWordCharacter(char: string): boolean;
13
- /**
14
- * Check if a character is whitespace
15
- */
16
- declare function isWhitespace(char: string): boolean;
17
- /**
18
- * Find word boundaries around a position in text
19
- * Returns [startIndex, endIndex] inclusive start, exclusive end
20
- */
21
- declare function findWordBoundaries(text: string, position: number): [number, number];
22
- /**
23
- * Get the word at a position in text
24
- */
25
- declare function getWordAt(text: string, position: number): string;
26
- /**
27
- * Word selection result
28
- */
29
- interface WordSelectionResult {
30
- /** The selected word */
31
- word: string;
32
- /** Start index in the text (inclusive) */
33
- startIndex: number;
34
- /** End index in the text (exclusive) */
35
- endIndex: number;
36
- }
37
- /**
38
- * Find the word at a position and return detailed info
39
- */
40
- declare function findWordAt(text: string, position: number): WordSelectionResult;
41
- /**
42
- * Select a word at the current cursor position using the browser's native APIs.
43
- * This works reliably across different browsers and handles contentEditable well.
44
- */
45
- declare function selectWordAtCursor(): boolean;
46
- /**
47
- * Select a word in a specific text node at the given offset
48
- */
49
- declare function selectWordInTextNode(textNode: Text, offset: number): boolean;
50
- /**
51
- * Expand the current selection to word boundaries.
52
- * If there's a collapsed selection (cursor), selects the word at cursor.
53
- * If there's an existing selection, expands to include complete words.
54
- */
55
- declare function expandSelectionToWordBoundaries(): boolean;
56
- /**
57
- * Select the entire paragraph containing the current selection.
58
- * Looks for the nearest element with [data-paragraph-index] attribute.
59
- */
60
- declare function selectParagraphAtCursor(): boolean;
61
- /**
62
- * Handle click event for multi-click detection.
63
- * Call this in your click handler.
64
- * Returns the click count (1 = single, 2 = double, 3 = triple).
65
- */
66
- declare function handleClickForMultiClick(event: MouseEvent): number;
67
- /**
68
- * Create a double-click handler that selects words.
69
- * Returns a function that should be called on dblclick events.
70
- */
71
- declare function createDoubleClickWordSelector(): (event: MouseEvent) => void;
72
- /**
73
- * Create a triple-click handler that selects paragraphs.
74
- * This uses our custom click counting since browsers have inconsistent triple-click.
75
- */
76
- declare function createTripleClickParagraphSelector(): (event: MouseEvent) => void;
77
- declare const _default: {
78
- isWordCharacter: typeof isWordCharacter;
79
- isWhitespace: typeof isWhitespace;
80
- findWordBoundaries: typeof findWordBoundaries;
81
- getWordAt: typeof getWordAt;
82
- findWordAt: typeof findWordAt;
83
- selectWordAtCursor: typeof selectWordAtCursor;
84
- selectWordInTextNode: typeof selectWordInTextNode;
85
- expandSelectionToWordBoundaries: typeof expandSelectionToWordBoundaries;
86
- selectParagraphAtCursor: typeof selectParagraphAtCursor;
87
- handleClickForMultiClick: typeof handleClickForMultiClick;
88
- createDoubleClickWordSelector: typeof createDoubleClickWordSelector;
89
- createTripleClickParagraphSelector: typeof createTripleClickParagraphSelector;
90
- };
91
-
92
- export { type WordSelectionResult, createDoubleClickWordSelector, createTripleClickParagraphSelector, _default as default, expandSelectionToWordBoundaries, findWordAt, findWordBoundaries, getWordAt, handleClickForMultiClick, isWhitespace, isWordCharacter, selectParagraphAtCursor, selectWordAtCursor, selectWordInTextNode };
@@ -1 +0,0 @@
1
- export{k as createDoubleClickWordSelector,l as createTripleClickParagraphSelector,m as default,h as expandSelectionToWordBoundaries,e as findWordAt,c as findWordBoundaries,d as getWordAt,j as handleClickForMultiClick,b as isWhitespace,a as isWordCharacter,i as selectParagraphAtCursor,f as selectWordAtCursor,g as selectWordInTextNode}from'../chunk-4RCISPPE.mjs';import'../chunk-TTRUPDAB.mjs';
@@ -1,115 +0,0 @@
1
- import { Document } from './types/document.mjs';
2
- import { c as DocumentBody, P as Paragraph } from './content-sSHuWw49.mjs';
3
-
4
- /**
5
- * Variable Detector Utility
6
- *
7
- * Scans a DOCX document for template variables in the format {variable_name}
8
- * (standard docxtemplater syntax).
9
- * Returns a unique, sorted list of variable names found in the document.
10
- */
11
-
12
- /**
13
- * Result of variable detection
14
- */
15
- interface VariableDetectionResult {
16
- /** Unique variable names sorted alphabetically */
17
- variables: string[];
18
- /** Total count of variable occurrences */
19
- totalOccurrences: number;
20
- /** Variables by location */
21
- byLocation: {
22
- body: string[];
23
- headers: string[];
24
- footers: string[];
25
- footnotes: string[];
26
- endnotes: string[];
27
- textBoxes: string[];
28
- };
29
- /** Variable occurrences with positions */
30
- occurrences: VariableOccurrence[];
31
- }
32
- /**
33
- * A single variable occurrence with location info
34
- */
35
- interface VariableOccurrence {
36
- /** Variable name (without braces) */
37
- name: string;
38
- /** Location type */
39
- location: 'body' | 'header' | 'footer' | 'footnote' | 'endnote' | 'textBox';
40
- /** Paragraph index within location */
41
- paragraphIndex?: number;
42
- /** Section index (for headers/footers) */
43
- sectionIndex?: number;
44
- }
45
- /**
46
- * Detect all template variables in a document
47
- *
48
- * @param doc - The parsed document
49
- * @returns Array of unique variable names sorted alphabetically
50
- */
51
- declare function detectVariables(doc: Document): string[];
52
- /**
53
- * Detect variables with detailed information
54
- *
55
- * @param doc - The parsed document
56
- * @returns Detailed detection result
57
- */
58
- declare function detectVariablesDetailed(doc: Document): VariableDetectionResult;
59
- /**
60
- * Detect variables in document body
61
- */
62
- declare function detectVariablesInBody(body: DocumentBody): string[];
63
- /**
64
- * Detect variables in a paragraph
65
- */
66
- declare function detectVariablesInParagraph(paragraph: Paragraph): string[];
67
- /**
68
- * Extract variable names from text
69
- *
70
- * @param text - The text to search
71
- * @returns Array of variable names (without braces)
72
- */
73
- declare function extractVariablesFromText(text: string): string[];
74
- /**
75
- * Check if text contains template variables
76
- */
77
- declare function hasTemplateVariables(text: string): boolean;
78
- /**
79
- * Check if a variable name is valid
80
- */
81
- declare function isValidVariableName(name: string): boolean;
82
- /**
83
- * Sanitize a variable name
84
- */
85
- declare function sanitizeVariableName(name: string): string;
86
- /**
87
- * Format a variable name with braces (standard docxtemplater syntax)
88
- */
89
- declare function formatVariable(name: string): string;
90
- /**
91
- * Parse a variable string to get the name
92
- */
93
- declare function parseVariable(variable: string): string | null;
94
- /**
95
- * Replace variables in text with values
96
- *
97
- * @param text - The text containing variables
98
- * @param values - Map of variable name to replacement value
99
- * @returns Text with variables replaced
100
- */
101
- declare function replaceVariables(text: string, values: Record<string, string>): string;
102
- /**
103
- * Replace all variables in text with a placeholder
104
- *
105
- * @param text - The text containing variables
106
- * @param placeholder - Placeholder to use (default: empty string)
107
- * @returns Text with variables replaced
108
- */
109
- declare function removeVariables(text: string, placeholder?: string): string;
110
- /**
111
- * Check if document has any template variables
112
- */
113
- declare function documentHasVariables(doc: Document): boolean;
114
-
115
- export { type VariableDetectionResult as V, type VariableOccurrence as a, detectVariablesDetailed as b, detectVariablesInBody as c, detectVariables as d, detectVariablesInParagraph as e, documentHasVariables as f, extractVariablesFromText as g, formatVariable as h, hasTemplateVariables as i, isValidVariableName as j, replaceVariables as k, parseVariable as p, removeVariables as r, sanitizeVariableName as s };
@@ -1 +0,0 @@
1
- import'./chunk-EUUIJVM6.mjs';export{b as createEditSession,a as preloadEditWasm}from'./chunk-NEWOMDTX.mjs';import'./chunk-T4EZMUXM.mjs';import'./chunk-TTRUPDAB.mjs';
@@ -1 +0,0 @@
1
- export{l as buildDisplayListJson,o as clearMeasureFonts,g as closeDisplayList,d as hasDisplayListSession,e as hasRangeRectsRegion,h as hitTestRegionsByHandle,b as hitTestRegionsJson,m as layoutDocumentJson,p as measureParagraphJson,f as openDisplayList,q as outlineGlyphJson,a as preloadLayoutWasm,i as rangeRectsByHandle,c as rangeRectsJson,k as rangeRectsRegionByHandle,j as rangeRectsRegionJson,n as registerMeasureFont}from'./chunk-CIRN3LZA.mjs';import'./chunk-T4EZMUXM.mjs';import'./chunk-TTRUPDAB.mjs';
@@ -1,38 +0,0 @@
1
- import { Document } from './types/document.mjs';
2
- import { W as Watermark } from './content-sSHuWw49.mjs';
3
-
4
- /**
5
- * Watermark document API
6
- *
7
- * Platform-agnostic helpers for reading and applying a document watermark.
8
- * Shared by the React and Vue adapters (and the imperative ref API) so the
9
- * "Design → Watermark" behavior stays identical across frameworks.
10
- *
11
- * A watermark lives on `HeaderFooter.watermark`. MS Word repeats the same
12
- * watermark across the default, first-page, and even-page headers of every
13
- * section, so `setDocumentWatermark`:
14
- *
15
- * 1. Applies the watermark (a per-header copy) to every existing header, and
16
- * 2. Creates the header parts a section needs but lacks, so the watermark
17
- * still shows on title pages (`w:titlePg`) and even pages
18
- * (`w:evenAndOddHeaders`) and on documents that had no header at all.
19
- *
20
- * To avoid breaking header inheritance (a section that omits a header
21
- * reference inherits the previous section's header — Word's "link to
22
- * previous"), a missing `first`/`even` header part is only created when **no**
23
- * header of that type exists anywhere in the document, i.e. there is nothing to
24
- * inherit. All updates are immutable — a new `Document` is returned so the
25
- * change lands in the host's undo/redo history.
26
- */
27
-
28
- /** Read the document's watermark (the first header that carries one). */
29
- declare function getDocumentWatermark(doc: Document | null | undefined): Watermark | undefined;
30
- /**
31
- * Return a new `Document` with the watermark applied to all headers, or removed
32
- * when `watermark` is null. Creates the header parts a section needs but lacks
33
- * (default for a headerless doc; first/even for title/even pages) so the
34
- * watermark shows on every page MS Word would show it.
35
- */
36
- declare function setDocumentWatermark(doc: Document, watermark: Watermark | null): Document;
37
-
38
- export { getDocumentWatermark as g, setDocumentWatermark as s };