@postnzt/docx-js-editor 0.0.33

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 (117) hide show
  1. package/dist/ClipboardManager-C0rTRkVQ.d.ts +464 -0
  2. package/dist/ClipboardManager-CgpKW2At.d.mts +464 -0
  3. package/dist/DocumentAgent-BqA9EJ3F.d.mts +442 -0
  4. package/dist/DocumentAgent-CRCXiBT7.d.ts +442 -0
  5. package/dist/FindReplaceDialog-KNJETYJX.js +1 -0
  6. package/dist/FindReplaceDialog-YW3R4FHM.mjs +1 -0
  7. package/dist/FootnotePropertiesDialog-452A4UT5.js +1 -0
  8. package/dist/FootnotePropertiesDialog-H24AC5XK.mjs +1 -0
  9. package/dist/HyperlinkDialog-GBAYMTUE.js +1 -0
  10. package/dist/HyperlinkDialog-HNYTXDCB.mjs +1 -0
  11. package/dist/ImagePositionDialog-B4RLP2W5.mjs +1 -0
  12. package/dist/ImagePositionDialog-M65BYQQE.js +1 -0
  13. package/dist/ImagePropertiesDialog-JOGW3WDU.mjs +1 -0
  14. package/dist/ImagePropertiesDialog-O4WQSF5M.js +1 -0
  15. package/dist/PageSetupDialog-2GIBTKMJ.js +1 -0
  16. package/dist/PageSetupDialog-Q7SHEZIJ.mjs +1 -0
  17. package/dist/TablePropertiesDialog-LMXWX3FI.mjs +1 -0
  18. package/dist/TablePropertiesDialog-WOZ4ES3H.js +1 -0
  19. package/dist/agentApi-BVHzyk2l.d.mts +2239 -0
  20. package/dist/agentApi-BVHzyk2l.d.ts +2239 -0
  21. package/dist/chunk-2HDYCD2Q.mjs +1 -0
  22. package/dist/chunk-377ZVTSE.js +2 -0
  23. package/dist/chunk-37SLIJPH.mjs +58 -0
  24. package/dist/chunk-4VUZBV2S.js +1 -0
  25. package/dist/chunk-6WPRCJ5A.mjs +1 -0
  26. package/dist/chunk-7MGFEP2R.mjs +26 -0
  27. package/dist/chunk-7QTNB64A.mjs +9 -0
  28. package/dist/chunk-AARNCPWR.js +1 -0
  29. package/dist/chunk-AU5NVRHP.js +2 -0
  30. package/dist/chunk-BP3V2HDD.js +261 -0
  31. package/dist/chunk-BUEMG4NW.js +1 -0
  32. package/dist/chunk-DC65PJYE.js +4 -0
  33. package/dist/chunk-DLVLK5FT.mjs +24 -0
  34. package/dist/chunk-EV3CM6TU.js +1 -0
  35. package/dist/chunk-FVUGBRDD.js +1 -0
  36. package/dist/chunk-GZOCOWWB.mjs +2 -0
  37. package/dist/chunk-H5NTJZO4.js +1 -0
  38. package/dist/chunk-IFPN3NT3.js +3 -0
  39. package/dist/chunk-KCOGY3V2.js +10 -0
  40. package/dist/chunk-KUL2SDYC.js +26 -0
  41. package/dist/chunk-LFZXSNOF.mjs +261 -0
  42. package/dist/chunk-LYBG4YI7.mjs +1 -0
  43. package/dist/chunk-M5F4SK3W.mjs +1 -0
  44. package/dist/chunk-P7WEP4JU.js +9 -0
  45. package/dist/chunk-PB7VMDDP.js +24 -0
  46. package/dist/chunk-QAZ4233N.mjs +1 -0
  47. package/dist/chunk-QSUPYUOP.js +2 -0
  48. package/dist/chunk-QTSXJRP6.mjs +1 -0
  49. package/dist/chunk-QVPR2W5S.js +1 -0
  50. package/dist/chunk-RTFUE3KK.mjs +10 -0
  51. package/dist/chunk-SCYTWBF5.mjs +111 -0
  52. package/dist/chunk-SE5EN2QL.js +1 -0
  53. package/dist/chunk-T6X4C2QO.js +111 -0
  54. package/dist/chunk-TAUMSKRE.mjs +1 -0
  55. package/dist/chunk-W53SI3XW.mjs +1 -0
  56. package/dist/chunk-WOHFANC5.mjs +3 -0
  57. package/dist/chunk-X5A54T6S.mjs +4 -0
  58. package/dist/chunk-YKBSKEBS.mjs +2 -0
  59. package/dist/chunk-Z26WOH6R.mjs +2 -0
  60. package/dist/chunk-ZJNGMDRE.js +58 -0
  61. package/dist/clipboard-Cu80iVDh.d.ts +1181 -0
  62. package/dist/clipboard-dFROLI95.d.mts +1181 -0
  63. package/dist/colorResolver-BwI_Uxp3.d.mts +662 -0
  64. package/dist/colorResolver-Dlmk3itT.d.ts +662 -0
  65. package/dist/core-plugins-reexport.d.mts +31 -0
  66. package/dist/core-plugins-reexport.d.ts +31 -0
  67. package/dist/core-plugins-reexport.js +1 -0
  68. package/dist/core-plugins-reexport.mjs +1 -0
  69. package/dist/core-reexport.d.mts +309 -0
  70. package/dist/core-reexport.d.ts +309 -0
  71. package/dist/core-reexport.js +1 -0
  72. package/dist/core-reexport.mjs +1 -0
  73. package/dist/executor-L2MVKMXO.js +1 -0
  74. package/dist/executor-XKBCCVNY.mjs +1 -0
  75. package/dist/fontLoader-BI9ZoACv.d.ts +176 -0
  76. package/dist/fontLoader-DicgJidU.d.mts +176 -0
  77. package/dist/headless-reexport.d.mts +195 -0
  78. package/dist/headless-reexport.d.ts +195 -0
  79. package/dist/headless-reexport.js +4 -0
  80. package/dist/headless-reexport.mjs +4 -0
  81. package/dist/index.css +1 -0
  82. package/dist/index.d.mts +480 -0
  83. package/dist/index.d.ts +480 -0
  84. package/dist/index.js +112 -0
  85. package/dist/index.mjs +112 -0
  86. package/dist/lib-BCT2DRYI.mjs +1 -0
  87. package/dist/lib-U35UU4OU.js +1 -0
  88. package/dist/mcp-reexport.d.mts +156 -0
  89. package/dist/mcp-reexport.d.ts +156 -0
  90. package/dist/mcp-reexport.js +16 -0
  91. package/dist/mcp-reexport.mjs +16 -0
  92. package/dist/processTemplate-5ZST2Q5L.js +1 -0
  93. package/dist/processTemplate-LRHXOWMZ.mjs +1 -0
  94. package/dist/react-Cl2n0F5S.d.ts +1091 -0
  95. package/dist/react-DZlAKNXg.d.mts +1091 -0
  96. package/dist/react.css +1 -0
  97. package/dist/react.d.mts +10 -0
  98. package/dist/react.d.ts +10 -0
  99. package/dist/react.js +1 -0
  100. package/dist/react.mjs +1 -0
  101. package/dist/registry-D4FQ9aKX.d.mts +165 -0
  102. package/dist/registry-DrYyUXQr.d.ts +165 -0
  103. package/dist/selectionRects-DEX5THEG.js +1 -0
  104. package/dist/selectionRects-SQTAHMCH.mjs +1 -0
  105. package/dist/styles.css +1 -0
  106. package/dist/types-B3LkfO0u.d.mts +310 -0
  107. package/dist/types-igZ1x_e4.d.ts +310 -0
  108. package/dist/ui.d.mts +2005 -0
  109. package/dist/ui.d.ts +2005 -0
  110. package/dist/ui.js +1 -0
  111. package/dist/ui.mjs +1 -0
  112. package/dist/variableDetector-CIqTek7A.d.mts +204 -0
  113. package/dist/variableDetector-CkYvLv62.d.ts +204 -0
  114. package/i18n/de.json +745 -0
  115. package/i18n/en.json +745 -0
  116. package/i18n/pl.json +745 -0
  117. package/package.json +127 -0
@@ -0,0 +1,31 @@
1
+ import { C as CorePlugin } from './types-igZ1x_e4.js';
2
+ export { b as CommandHandler, d as CommandResult, E as ExtractCommand, J as JsonSchema, L as LoadedDocument, e as McpSession, f as McpToolAnnotations, g as McpToolContent, h as McpToolContext, M as McpToolDefinition, n as McpToolExample, i as McpToolHandler, j as McpToolResult, k as PluginCommand, b as PluginCommandHandler, l as PluginEvent, c as PluginEventListener, P as PluginOptions, a as PluginRegistrationResult, M as ToolDefinition, i as ToolHandler, j as ToolResult, T as TypedCommandHandler, Z as ZodSchemaLike, m as isZodSchema } from './types-igZ1x_e4.js';
3
+ export { P as PluginRegistry, c as createPluginRegistrar, p as pluginRegistry, r as registerPlugins } from './registry-DrYyUXQr.js';
4
+ import './agentApi-BVHzyk2l.js';
5
+
6
+ /**
7
+ * Docxtemplater Plugin
8
+ *
9
+ * Core plugin for template variable functionality using docxtemplater.
10
+ *
11
+ * **Command handlers** — `insertTemplateVariable` and `replaceWithTemplateVariable`
12
+ * allow DocumentAgent to programmatically insert `{variable}` placeholders.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * import { pluginRegistry } from '@postnzt/docx-editor/core-plugins';
17
+ * import { docxtemplaterPlugin } from '@postnzt/docx-editor/core-plugins/docxtemplater';
18
+ *
19
+ * pluginRegistry.register(docxtemplaterPlugin);
20
+ * ```
21
+ */
22
+
23
+ /**
24
+ * Docxtemplater plugin for template variable functionality.
25
+ *
26
+ * Dependency validation is handled lazily by `processTemplate` at call time,
27
+ * so no eager `initialize()` is needed.
28
+ */
29
+ declare const docxtemplaterPlugin: CorePlugin;
30
+
31
+ export { CorePlugin, CorePlugin as Plugin, docxtemplaterPlugin };
@@ -0,0 +1 @@
1
+ 'use strict';var chunkKCOGY3V2_js=require('./chunk-KCOGY3V2.js');require('./chunk-PB7VMDDP.js'),require('./chunk-KUL2SDYC.js');var chunkBUEMG4NW_js=require('./chunk-BUEMG4NW.js');require('./chunk-SE5EN2QL.js'),require('./chunk-IFPN3NT3.js'),require('./chunk-H5NTJZO4.js');Object.defineProperty(exports,"docxtemplaterPlugin",{enumerable:true,get:function(){return chunkKCOGY3V2_js.o}});Object.defineProperty(exports,"isZodSchema",{enumerable:true,get:function(){return chunkKCOGY3V2_js.n}});Object.defineProperty(exports,"PluginRegistry",{enumerable:true,get:function(){return chunkBUEMG4NW_js.a}});Object.defineProperty(exports,"createPluginRegistrar",{enumerable:true,get:function(){return chunkBUEMG4NW_js.d}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunkBUEMG4NW_js.b}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunkBUEMG4NW_js.c}});
@@ -0,0 +1 @@
1
+ export{o as docxtemplaterPlugin,n as isZodSchema}from'./chunk-RTFUE3KK.mjs';import'./chunk-DLVLK5FT.mjs';import'./chunk-7MGFEP2R.mjs';export{a as PluginRegistry,d as createPluginRegistrar,b as pluginRegistry,c as registerPlugins}from'./chunk-W53SI3XW.mjs';import'./chunk-LYBG4YI7.mjs';import'./chunk-WOHFANC5.mjs';import'./chunk-TAUMSKRE.mjs';
@@ -0,0 +1,309 @@
1
+ import { D as Document } from './agentApi-BVHzyk2l.mjs';
2
+ export { f as AIAction, g as AIActionRequest, A as AgentCommand, h as AgentContext, i as AgentResponse, j as ApplyStyleCommand, l as BlockContent, ad as BookmarkEnd, ae as BookmarkStart, p as DeleteTextCommand, d as DocumentBody, r as DocxPackage, E as Endnote, af as Field, ag as FooterReference, F as Footnote, t as FormatTextCommand, ah as HeaderFooter, ai as HeaderReference, H as Hyperlink, I as Image, u as InsertHyperlinkCommand, v as InsertImageCommand, w as InsertTableCommand, x as InsertTextCommand, L as ListLevel, N as NumberingDefinitions, a as Paragraph, J as ParagraphContext, K as ParagraphFormatting, P as Position, R as Range, Q as Relationship, S as ReplaceTextCommand, b as Run, c as RunContent, V as SectionProperties, W as SelectionContext, X as SetVariableCommand, aj as Shape, Y as Style, Z as StyleDefinitions, $ as SuggestedAction, e as Table, a0 as TableCell, a1 as TableRow, ak as TextBox, a2 as TextContent, T as TextFormatting, a3 as Theme, al as ThemeColorScheme, am as ThemeFont, an as ThemeFontScheme } from './agentApi-BVHzyk2l.mjs';
3
+ export { A as AgentContextOptions, C as CreateEmptyDocumentOptions, E as ExtendedSelectionContext, P as ProcessTemplateOptions, a as ProcessTemplateResult, b as SelectionContextOptions, a0 as ThemeMatrixCell, c as blendColors, d as buildExtendedSelectionContext, e as buildSelectionContext, g as colorsEqual, h as createDocumentWithText, i as createEmptyDocument, j as createRgbColor, l as createThemeColor, m as darkenColor, n as emuToPixels, o as emuToTwips, a1 as ensureHexPrefix, p as executeCommand, q as executeCommands, r as formatPx, a2 as generateThemeTintShadeMatrix, s as getAgentContext, t as getContrastingColor, u as getDocumentSummary, x as getTemplateTags, a3 as getThemeTintShadeHex, y as halfPointsToPixels, z as isBlack, B as isWhite, D as lightenColor, G as parseColorString, H as parseDocx, I as pixelsToEmu, J as pixelsToTwips, K as pointsToPixels, M as processTemplate, O as processTemplateAsBlob, Q as processTemplateDetailed, R as resolveColor, U as resolveHighlightColor, a4 as resolveHighlightToCss, V as resolveShadingColor, W as serializeDocumentBody, X as serializeDocx, Y as serializeSectionProperties, Z as twipsToEmu, _ as twipsToPixels, $ as validateTemplate } from './colorResolver-BwI_Uxp3.mjs';
4
+ import { S as Subscribable, E as ErrorManagerSnapshot, P as PluginLifecycleSnapshot, a as PluginLifecycleConfig } from './ClipboardManager-CgpKW2At.mjs';
5
+ export { A as AutoSaveManager, b as AutoSaveManagerOptions, c as AutoSaveSnapshot, d as AutoSaveStatus, C as CellCoordinates, e as ClipboardSelection, f as EditorHandle, g as EditorPluginCore, h as ErrorNotification, i as ErrorSeverity, j as PanelConfig, k as PluginPanelProps, l as PositionCoordinates, R as RenderedDomContext, m as SavedDocumentData, T as TABLE_DATA_ATTRIBUTES, n as TableSelectionManager, o as TableSelectionSnapshot, p as createSelectionFromDOM, q as deleteTableFromDocument, r as extractFormattingFromElement, s as findTableFromClick, t as formatLastSaveTime, u as formatStorageSize, v as getAutoSaveStatusLabel, w as getAutoSaveStorageSize, x as getSelectionRuns, y as getTableFromDocument, z as isAutoSaveSupported, B as rgbToHex, D as updateTableInDocument } from './ClipboardManager-CgpKW2At.mjs';
6
+ export { C as CorePlugin, e as McpSession, M as McpToolDefinition, i as McpToolHandler, j as McpToolResult } from './types-B3LkfO0u.mjs';
7
+ export { D as DocumentAgent, g as DocxInput, d as attemptSelectiveSave, t as toArrayBuffer } from './DocumentAgent-BqA9EJ3F.mjs';
8
+ export { I as InsertPosition, c as canRenderFont, a as countPageBreaks, b as createColumnBreak, d as createHorizontalRule, e as createLineBreak, f as createPageBreak, g as createPageBreakParagraph, h as createPageBreakRun, i as findPageBreaks, j as getLoadedFonts, k as hasPageBreakBefore, l as insertHorizontalRule, m as insertPageBreak, n as isBreakContent, o as isColumnBreak, p as isFontLoaded, q as isFontsLoading, r as isLineBreak, s as isPageBreak, t as loadFont, u as loadFontFromBuffer, v as loadFonts, w as onFontsLoaded, x as preloadCommonFonts, y as removePageBreak } from './fontLoader-DicgJidU.mjs';
9
+ import { EditorView } from 'prosemirror-view';
10
+ export { P as PluginRegistry, p as pluginRegistry, r as registerPlugins } from './registry-D4FQ9aKX.mjs';
11
+ export { V as VariableDetectionResult, a as VariableOccurrence, b as buildPatchedDocumentXml, c as createDocx, d as detectVariables, e as detectVariablesDetailed, f as detectVariablesInBody, g as detectVariablesInParagraph, h as documentHasVariables, i as extractVariablesFromText, j as formatVariable, k as hasTemplateVariables, l as isValidVariableName, p as parseVariable, r as removeVariables, m as repackDocx, n as replaceVariables, s as sanitizeVariableName, u as updateMultipleFiles, v as validatePatchSafety } from './variableDetector-CIqTek7A.mjs';
12
+ export { docxtemplaterPlugin } from './core-plugins-reexport.mjs';
13
+ import 'prosemirror-state';
14
+ import 'prosemirror-model';
15
+
16
+ /**
17
+ * ErrorManager
18
+ *
19
+ * Framework-agnostic pub/sub error notification system.
20
+ * Replaces React's `componentDidCatch` + context pattern for error notifications.
21
+ *
22
+ * Usage with React:
23
+ * ```ts
24
+ * const { notifications } = useSyncExternalStore(manager.subscribe, manager.getSnapshot);
25
+ * ```
26
+ */
27
+
28
+ declare class ErrorManager extends Subscribable<ErrorManagerSnapshot> {
29
+ private notifications;
30
+ private idCounter;
31
+ private timers;
32
+ constructor();
33
+ /** Show an error notification (persistent, not auto-dismissed). */
34
+ showError(message: string, details?: string): string;
35
+ /** Show a warning notification (auto-dismissed after 5s). */
36
+ showWarning(message: string, details?: string): string;
37
+ /** Show an info notification (auto-dismissed after 5s). */
38
+ showInfo(message: string, details?: string): string;
39
+ /** Dismiss a notification by ID. */
40
+ dismiss(id: string): void;
41
+ /** Clear all notifications and cancel pending timers. */
42
+ clearAll(): void;
43
+ /** Destroy the manager and clean up all timers. */
44
+ destroy(): void;
45
+ private addNotification;
46
+ private emitSnapshot;
47
+ }
48
+
49
+ /**
50
+ * PluginLifecycleManager
51
+ *
52
+ * Framework-agnostic class for managing editor plugin lifecycle.
53
+ * Extracted from React's `PluginHost.tsx`.
54
+ *
55
+ * Handles:
56
+ * - Plugin initialization and state tracking
57
+ * - Plugin state updates via `updateStates()`
58
+ * - Plugin destroy/cleanup
59
+ *
60
+ * Does NOT handle (framework hosts are responsible for):
61
+ * - CSS injection (use the exported `injectStyles` utility)
62
+ * - DOM event listeners / dispatch wrapping
63
+ */
64
+
65
+ /** Inject CSS styles into the document head. Returns a cleanup function. */
66
+ declare function injectStyles(pluginId: string, css: string): () => void;
67
+ declare class PluginLifecycleManager extends Subscribable<PluginLifecycleSnapshot> {
68
+ private plugins;
69
+ private pluginStates;
70
+ private version;
71
+ constructor();
72
+ /**
73
+ * Initialize plugins with an editor view.
74
+ * Calls `plugin.initialize(editorView)` for each plugin.
75
+ *
76
+ * Note: CSS injection and DOM event listeners are the responsibility
77
+ * of the framework-specific host (e.g. React PluginHost).
78
+ */
79
+ initialize(plugins: PluginLifecycleConfig[], editorView: EditorView): void;
80
+ /**
81
+ * Update all plugin states by calling `onStateChange` on each plugin.
82
+ * Returns true if any plugin state changed.
83
+ */
84
+ updateStates(editorView: EditorView): boolean;
85
+ /** Get plugin state by ID. */
86
+ getPluginState<T>(pluginId: string): T | undefined;
87
+ /** Set plugin state by ID. */
88
+ setPluginState<T>(pluginId: string, state: T): void;
89
+ /** Destroy all plugins and clean up. */
90
+ destroy(): void;
91
+ private destroyPlugins;
92
+ private emitSnapshot;
93
+ }
94
+
95
+ /**
96
+ * LayoutCoordinator
97
+ *
98
+ * Framework-agnostic class coordinating the PM state → layout engine →
99
+ * layout painter → selection overlay pipeline.
100
+ *
101
+ * Extracted from PagedEditor.tsx. Manages:
102
+ * - Layout pipeline state (blocks, measures, layout)
103
+ * - Selection state (selectionRects, caretPosition)
104
+ * - Drag selection state
105
+ * - Column resize state
106
+ * - Image interaction state
107
+ *
108
+ * Usage with React:
109
+ * ```ts
110
+ * const snapshot = useSyncExternalStore(coordinator.subscribe, coordinator.getSnapshot);
111
+ * ```
112
+ *
113
+ * NOTE: This class defines the state shape and subscription pattern.
114
+ * Full integration with PagedEditor is done incrementally.
115
+ */
116
+
117
+ /** Selection rectangle for rendering selection overlays */
118
+ interface SelectionRect {
119
+ x: number;
120
+ y: number;
121
+ width: number;
122
+ height: number;
123
+ pageIndex: number;
124
+ }
125
+ /** Caret position for rendering the blinking cursor */
126
+ interface CaretPosition {
127
+ x: number;
128
+ y: number;
129
+ height: number;
130
+ pageIndex: number;
131
+ }
132
+ /** Info about the currently selected/hovered image */
133
+ interface ImageSelectionInfo {
134
+ pmPos: number;
135
+ pageIndex: number;
136
+ rect: {
137
+ x: number;
138
+ y: number;
139
+ width: number;
140
+ height: number;
141
+ };
142
+ widthEmu: number;
143
+ heightEmu: number;
144
+ isInline: boolean;
145
+ }
146
+ /** Column resize tracking state */
147
+ interface ColumnResizeState {
148
+ isResizing: boolean;
149
+ startX: number;
150
+ columnIndex: number;
151
+ tablePmStart: number;
152
+ originalWidths: {
153
+ left: number;
154
+ right: number;
155
+ };
156
+ }
157
+ /** The full snapshot exposed to UI frameworks */
158
+ interface LayoutCoordinatorSnapshot {
159
+ /** Computed page layout, null until first computation */
160
+ hasLayout: boolean;
161
+ /** Selection rectangles for range selection overlay */
162
+ selectionRects: SelectionRect[];
163
+ /** Caret position for cursor overlay */
164
+ caretPosition: CaretPosition | null;
165
+ /** Currently selected/hovered image */
166
+ selectedImageInfo: ImageSelectionInfo | null;
167
+ /** Whether the editor is focused */
168
+ isFocused: boolean;
169
+ /** Whether a text drag is in progress */
170
+ isDragging: boolean;
171
+ /** Whether a column resize is in progress */
172
+ isResizingColumn: boolean;
173
+ /** Whether an image interaction is in progress */
174
+ isImageInteracting: boolean;
175
+ /** Version counter — incremented on every state change */
176
+ version: number;
177
+ }
178
+ declare class LayoutCoordinator extends Subscribable<LayoutCoordinatorSnapshot> {
179
+ private _hasLayout;
180
+ private _selectionRects;
181
+ private _caretPosition;
182
+ private _isDragging;
183
+ private _dragAnchor;
184
+ private _columnResize;
185
+ private _selectedImageInfo;
186
+ private _isImageInteracting;
187
+ private _isFocused;
188
+ private _version;
189
+ constructor();
190
+ /** Notify that layout has been computed. */
191
+ setLayoutReady(hasLayout: boolean): void;
192
+ /** Update selection rectangles and caret position. */
193
+ updateSelection(selectionRects: SelectionRect[], caretPosition: CaretPosition | null): void;
194
+ /** Start a drag selection from the given PM anchor position. */
195
+ startDrag(anchor: number): void;
196
+ /** End drag selection. */
197
+ endDrag(): void;
198
+ /** Get the drag anchor position. */
199
+ getDragAnchor(): number | null;
200
+ /** Start resizing a table column. */
201
+ startColumnResize(tablePmStart: number, columnIndex: number, startX: number, originalWidths: {
202
+ left: number;
203
+ right: number;
204
+ }): void;
205
+ /** End column resize. */
206
+ endColumnResize(): void;
207
+ /** Get current column resize state. */
208
+ getColumnResize(): ColumnResizeState;
209
+ /** Set the currently selected image. */
210
+ setSelectedImage(imageInfo: ImageSelectionInfo | null): void;
211
+ /** Clear the image selection. */
212
+ clearSelectedImage(): void;
213
+ /** Set whether an image interaction (resize/move) is in progress. */
214
+ setImageInteracting(interacting: boolean): void;
215
+ /** Update focus state. */
216
+ setFocused(focused: boolean): void;
217
+ private emitSnapshot;
218
+ }
219
+
220
+ /**
221
+ * EditorCoordinator
222
+ *
223
+ * Framework-agnostic class managing the document editor lifecycle:
224
+ * - Document parsing and loading
225
+ * - Font loading coordination
226
+ * - Zoom level management
227
+ * - Extension manager initialization
228
+ * - Agent command execution
229
+ *
230
+ * Extracted from DocxEditor.tsx.
231
+ *
232
+ * Usage with React:
233
+ * ```ts
234
+ * const snapshot = useSyncExternalStore(coordinator.subscribe, coordinator.getSnapshot);
235
+ * ```
236
+ *
237
+ * NOTE: This class defines the state shape and coordination logic.
238
+ * Full integration with DocxEditor is done incrementally.
239
+ */
240
+
241
+ /** Editor loading state */
242
+ type EditorLoadingState = 'idle' | 'parsing' | 'loading-fonts' | 'ready' | 'error';
243
+ /** Configuration for EditorCoordinator */
244
+ interface EditorCoordinatorOptions {
245
+ /** Initial zoom level (default: 1.0) */
246
+ initialZoom?: number;
247
+ /** Callback when the document changes */
248
+ onChange?: (document: Document) => void;
249
+ /** Callback when an error occurs */
250
+ onError?: (error: Error) => void;
251
+ }
252
+ /** The full snapshot exposed to UI frameworks */
253
+ interface EditorCoordinatorSnapshot {
254
+ /** Current loading state */
255
+ loadingState: EditorLoadingState;
256
+ /** Error message if loadingState is 'error' */
257
+ parseError: string | null;
258
+ /** Whether the editor is ready for interaction */
259
+ isReady: boolean;
260
+ /** Current zoom level (1.0 = 100%) */
261
+ zoom: number;
262
+ /** Whether fonts have been loaded */
263
+ fontsLoaded: boolean;
264
+ /** Version counter */
265
+ version: number;
266
+ }
267
+ declare class EditorCoordinator extends Subscribable<EditorCoordinatorSnapshot> {
268
+ private _loadingState;
269
+ private _parseError;
270
+ private _zoom;
271
+ private _fontsLoaded;
272
+ private _document;
273
+ private _version;
274
+ private onChangeCallback?;
275
+ private onErrorCallback?;
276
+ constructor(options?: EditorCoordinatorOptions);
277
+ /** Signal that document parsing has started. */
278
+ setParsingStarted(): void;
279
+ /** Signal that document parsing completed successfully. */
280
+ setDocumentLoaded(document: Document): void;
281
+ /** Signal that font loading completed. */
282
+ setFontsLoaded(): void;
283
+ /** Signal that an error occurred during loading. */
284
+ setLoadError(error: Error): void;
285
+ /** Get the current document. */
286
+ getDocument(): Document | null;
287
+ /** Update the document (after edits). */
288
+ updateDocument(document: Document): void;
289
+ /** Set the zoom level (1.0 = 100%). */
290
+ setZoom(zoom: number): void;
291
+ /** Get the current zoom level. */
292
+ getZoom(): number;
293
+ private emitSnapshot;
294
+ }
295
+
296
+ /**
297
+ * @postnzt/docx-js-editor/core
298
+ *
299
+ * Core entry point — types, parser, serializer, and utilities.
300
+ * No React or ProseMirror dependencies.
301
+ *
302
+ * @example
303
+ * ```ts
304
+ * import { parseDocx, serializeDocx, resolveColor } from '@postnzt/docx-js-editor/core';
305
+ * ```
306
+ */
307
+ declare const VERSION = "0.0.2";
308
+
309
+ export { type CaretPosition, type ColumnResizeState, Document, EditorCoordinator, type EditorCoordinatorOptions, type EditorCoordinatorSnapshot, type EditorLoadingState, ErrorManager, ErrorManagerSnapshot, type ImageSelectionInfo, LayoutCoordinator, type LayoutCoordinatorSnapshot, PluginLifecycleConfig, PluginLifecycleManager, PluginLifecycleSnapshot, type SelectionRect, Subscribable, VERSION, injectStyles };
@@ -0,0 +1,309 @@
1
+ import { D as Document } from './agentApi-BVHzyk2l.js';
2
+ export { f as AIAction, g as AIActionRequest, A as AgentCommand, h as AgentContext, i as AgentResponse, j as ApplyStyleCommand, l as BlockContent, ad as BookmarkEnd, ae as BookmarkStart, p as DeleteTextCommand, d as DocumentBody, r as DocxPackage, E as Endnote, af as Field, ag as FooterReference, F as Footnote, t as FormatTextCommand, ah as HeaderFooter, ai as HeaderReference, H as Hyperlink, I as Image, u as InsertHyperlinkCommand, v as InsertImageCommand, w as InsertTableCommand, x as InsertTextCommand, L as ListLevel, N as NumberingDefinitions, a as Paragraph, J as ParagraphContext, K as ParagraphFormatting, P as Position, R as Range, Q as Relationship, S as ReplaceTextCommand, b as Run, c as RunContent, V as SectionProperties, W as SelectionContext, X as SetVariableCommand, aj as Shape, Y as Style, Z as StyleDefinitions, $ as SuggestedAction, e as Table, a0 as TableCell, a1 as TableRow, ak as TextBox, a2 as TextContent, T as TextFormatting, a3 as Theme, al as ThemeColorScheme, am as ThemeFont, an as ThemeFontScheme } from './agentApi-BVHzyk2l.js';
3
+ export { A as AgentContextOptions, C as CreateEmptyDocumentOptions, E as ExtendedSelectionContext, P as ProcessTemplateOptions, a as ProcessTemplateResult, b as SelectionContextOptions, a0 as ThemeMatrixCell, c as blendColors, d as buildExtendedSelectionContext, e as buildSelectionContext, g as colorsEqual, h as createDocumentWithText, i as createEmptyDocument, j as createRgbColor, l as createThemeColor, m as darkenColor, n as emuToPixels, o as emuToTwips, a1 as ensureHexPrefix, p as executeCommand, q as executeCommands, r as formatPx, a2 as generateThemeTintShadeMatrix, s as getAgentContext, t as getContrastingColor, u as getDocumentSummary, x as getTemplateTags, a3 as getThemeTintShadeHex, y as halfPointsToPixels, z as isBlack, B as isWhite, D as lightenColor, G as parseColorString, H as parseDocx, I as pixelsToEmu, J as pixelsToTwips, K as pointsToPixels, M as processTemplate, O as processTemplateAsBlob, Q as processTemplateDetailed, R as resolveColor, U as resolveHighlightColor, a4 as resolveHighlightToCss, V as resolveShadingColor, W as serializeDocumentBody, X as serializeDocx, Y as serializeSectionProperties, Z as twipsToEmu, _ as twipsToPixels, $ as validateTemplate } from './colorResolver-Dlmk3itT.js';
4
+ import { S as Subscribable, E as ErrorManagerSnapshot, P as PluginLifecycleSnapshot, a as PluginLifecycleConfig } from './ClipboardManager-C0rTRkVQ.js';
5
+ export { A as AutoSaveManager, b as AutoSaveManagerOptions, c as AutoSaveSnapshot, d as AutoSaveStatus, C as CellCoordinates, e as ClipboardSelection, f as EditorHandle, g as EditorPluginCore, h as ErrorNotification, i as ErrorSeverity, j as PanelConfig, k as PluginPanelProps, l as PositionCoordinates, R as RenderedDomContext, m as SavedDocumentData, T as TABLE_DATA_ATTRIBUTES, n as TableSelectionManager, o as TableSelectionSnapshot, p as createSelectionFromDOM, q as deleteTableFromDocument, r as extractFormattingFromElement, s as findTableFromClick, t as formatLastSaveTime, u as formatStorageSize, v as getAutoSaveStatusLabel, w as getAutoSaveStorageSize, x as getSelectionRuns, y as getTableFromDocument, z as isAutoSaveSupported, B as rgbToHex, D as updateTableInDocument } from './ClipboardManager-C0rTRkVQ.js';
6
+ export { C as CorePlugin, e as McpSession, M as McpToolDefinition, i as McpToolHandler, j as McpToolResult } from './types-igZ1x_e4.js';
7
+ export { D as DocumentAgent, g as DocxInput, d as attemptSelectiveSave, t as toArrayBuffer } from './DocumentAgent-CRCXiBT7.js';
8
+ export { I as InsertPosition, c as canRenderFont, a as countPageBreaks, b as createColumnBreak, d as createHorizontalRule, e as createLineBreak, f as createPageBreak, g as createPageBreakParagraph, h as createPageBreakRun, i as findPageBreaks, j as getLoadedFonts, k as hasPageBreakBefore, l as insertHorizontalRule, m as insertPageBreak, n as isBreakContent, o as isColumnBreak, p as isFontLoaded, q as isFontsLoading, r as isLineBreak, s as isPageBreak, t as loadFont, u as loadFontFromBuffer, v as loadFonts, w as onFontsLoaded, x as preloadCommonFonts, y as removePageBreak } from './fontLoader-BI9ZoACv.js';
9
+ import { EditorView } from 'prosemirror-view';
10
+ export { P as PluginRegistry, p as pluginRegistry, r as registerPlugins } from './registry-DrYyUXQr.js';
11
+ export { V as VariableDetectionResult, a as VariableOccurrence, b as buildPatchedDocumentXml, c as createDocx, d as detectVariables, e as detectVariablesDetailed, f as detectVariablesInBody, g as detectVariablesInParagraph, h as documentHasVariables, i as extractVariablesFromText, j as formatVariable, k as hasTemplateVariables, l as isValidVariableName, p as parseVariable, r as removeVariables, m as repackDocx, n as replaceVariables, s as sanitizeVariableName, u as updateMultipleFiles, v as validatePatchSafety } from './variableDetector-CkYvLv62.js';
12
+ export { docxtemplaterPlugin } from './core-plugins-reexport.js';
13
+ import 'prosemirror-state';
14
+ import 'prosemirror-model';
15
+
16
+ /**
17
+ * ErrorManager
18
+ *
19
+ * Framework-agnostic pub/sub error notification system.
20
+ * Replaces React's `componentDidCatch` + context pattern for error notifications.
21
+ *
22
+ * Usage with React:
23
+ * ```ts
24
+ * const { notifications } = useSyncExternalStore(manager.subscribe, manager.getSnapshot);
25
+ * ```
26
+ */
27
+
28
+ declare class ErrorManager extends Subscribable<ErrorManagerSnapshot> {
29
+ private notifications;
30
+ private idCounter;
31
+ private timers;
32
+ constructor();
33
+ /** Show an error notification (persistent, not auto-dismissed). */
34
+ showError(message: string, details?: string): string;
35
+ /** Show a warning notification (auto-dismissed after 5s). */
36
+ showWarning(message: string, details?: string): string;
37
+ /** Show an info notification (auto-dismissed after 5s). */
38
+ showInfo(message: string, details?: string): string;
39
+ /** Dismiss a notification by ID. */
40
+ dismiss(id: string): void;
41
+ /** Clear all notifications and cancel pending timers. */
42
+ clearAll(): void;
43
+ /** Destroy the manager and clean up all timers. */
44
+ destroy(): void;
45
+ private addNotification;
46
+ private emitSnapshot;
47
+ }
48
+
49
+ /**
50
+ * PluginLifecycleManager
51
+ *
52
+ * Framework-agnostic class for managing editor plugin lifecycle.
53
+ * Extracted from React's `PluginHost.tsx`.
54
+ *
55
+ * Handles:
56
+ * - Plugin initialization and state tracking
57
+ * - Plugin state updates via `updateStates()`
58
+ * - Plugin destroy/cleanup
59
+ *
60
+ * Does NOT handle (framework hosts are responsible for):
61
+ * - CSS injection (use the exported `injectStyles` utility)
62
+ * - DOM event listeners / dispatch wrapping
63
+ */
64
+
65
+ /** Inject CSS styles into the document head. Returns a cleanup function. */
66
+ declare function injectStyles(pluginId: string, css: string): () => void;
67
+ declare class PluginLifecycleManager extends Subscribable<PluginLifecycleSnapshot> {
68
+ private plugins;
69
+ private pluginStates;
70
+ private version;
71
+ constructor();
72
+ /**
73
+ * Initialize plugins with an editor view.
74
+ * Calls `plugin.initialize(editorView)` for each plugin.
75
+ *
76
+ * Note: CSS injection and DOM event listeners are the responsibility
77
+ * of the framework-specific host (e.g. React PluginHost).
78
+ */
79
+ initialize(plugins: PluginLifecycleConfig[], editorView: EditorView): void;
80
+ /**
81
+ * Update all plugin states by calling `onStateChange` on each plugin.
82
+ * Returns true if any plugin state changed.
83
+ */
84
+ updateStates(editorView: EditorView): boolean;
85
+ /** Get plugin state by ID. */
86
+ getPluginState<T>(pluginId: string): T | undefined;
87
+ /** Set plugin state by ID. */
88
+ setPluginState<T>(pluginId: string, state: T): void;
89
+ /** Destroy all plugins and clean up. */
90
+ destroy(): void;
91
+ private destroyPlugins;
92
+ private emitSnapshot;
93
+ }
94
+
95
+ /**
96
+ * LayoutCoordinator
97
+ *
98
+ * Framework-agnostic class coordinating the PM state → layout engine →
99
+ * layout painter → selection overlay pipeline.
100
+ *
101
+ * Extracted from PagedEditor.tsx. Manages:
102
+ * - Layout pipeline state (blocks, measures, layout)
103
+ * - Selection state (selectionRects, caretPosition)
104
+ * - Drag selection state
105
+ * - Column resize state
106
+ * - Image interaction state
107
+ *
108
+ * Usage with React:
109
+ * ```ts
110
+ * const snapshot = useSyncExternalStore(coordinator.subscribe, coordinator.getSnapshot);
111
+ * ```
112
+ *
113
+ * NOTE: This class defines the state shape and subscription pattern.
114
+ * Full integration with PagedEditor is done incrementally.
115
+ */
116
+
117
+ /** Selection rectangle for rendering selection overlays */
118
+ interface SelectionRect {
119
+ x: number;
120
+ y: number;
121
+ width: number;
122
+ height: number;
123
+ pageIndex: number;
124
+ }
125
+ /** Caret position for rendering the blinking cursor */
126
+ interface CaretPosition {
127
+ x: number;
128
+ y: number;
129
+ height: number;
130
+ pageIndex: number;
131
+ }
132
+ /** Info about the currently selected/hovered image */
133
+ interface ImageSelectionInfo {
134
+ pmPos: number;
135
+ pageIndex: number;
136
+ rect: {
137
+ x: number;
138
+ y: number;
139
+ width: number;
140
+ height: number;
141
+ };
142
+ widthEmu: number;
143
+ heightEmu: number;
144
+ isInline: boolean;
145
+ }
146
+ /** Column resize tracking state */
147
+ interface ColumnResizeState {
148
+ isResizing: boolean;
149
+ startX: number;
150
+ columnIndex: number;
151
+ tablePmStart: number;
152
+ originalWidths: {
153
+ left: number;
154
+ right: number;
155
+ };
156
+ }
157
+ /** The full snapshot exposed to UI frameworks */
158
+ interface LayoutCoordinatorSnapshot {
159
+ /** Computed page layout, null until first computation */
160
+ hasLayout: boolean;
161
+ /** Selection rectangles for range selection overlay */
162
+ selectionRects: SelectionRect[];
163
+ /** Caret position for cursor overlay */
164
+ caretPosition: CaretPosition | null;
165
+ /** Currently selected/hovered image */
166
+ selectedImageInfo: ImageSelectionInfo | null;
167
+ /** Whether the editor is focused */
168
+ isFocused: boolean;
169
+ /** Whether a text drag is in progress */
170
+ isDragging: boolean;
171
+ /** Whether a column resize is in progress */
172
+ isResizingColumn: boolean;
173
+ /** Whether an image interaction is in progress */
174
+ isImageInteracting: boolean;
175
+ /** Version counter — incremented on every state change */
176
+ version: number;
177
+ }
178
+ declare class LayoutCoordinator extends Subscribable<LayoutCoordinatorSnapshot> {
179
+ private _hasLayout;
180
+ private _selectionRects;
181
+ private _caretPosition;
182
+ private _isDragging;
183
+ private _dragAnchor;
184
+ private _columnResize;
185
+ private _selectedImageInfo;
186
+ private _isImageInteracting;
187
+ private _isFocused;
188
+ private _version;
189
+ constructor();
190
+ /** Notify that layout has been computed. */
191
+ setLayoutReady(hasLayout: boolean): void;
192
+ /** Update selection rectangles and caret position. */
193
+ updateSelection(selectionRects: SelectionRect[], caretPosition: CaretPosition | null): void;
194
+ /** Start a drag selection from the given PM anchor position. */
195
+ startDrag(anchor: number): void;
196
+ /** End drag selection. */
197
+ endDrag(): void;
198
+ /** Get the drag anchor position. */
199
+ getDragAnchor(): number | null;
200
+ /** Start resizing a table column. */
201
+ startColumnResize(tablePmStart: number, columnIndex: number, startX: number, originalWidths: {
202
+ left: number;
203
+ right: number;
204
+ }): void;
205
+ /** End column resize. */
206
+ endColumnResize(): void;
207
+ /** Get current column resize state. */
208
+ getColumnResize(): ColumnResizeState;
209
+ /** Set the currently selected image. */
210
+ setSelectedImage(imageInfo: ImageSelectionInfo | null): void;
211
+ /** Clear the image selection. */
212
+ clearSelectedImage(): void;
213
+ /** Set whether an image interaction (resize/move) is in progress. */
214
+ setImageInteracting(interacting: boolean): void;
215
+ /** Update focus state. */
216
+ setFocused(focused: boolean): void;
217
+ private emitSnapshot;
218
+ }
219
+
220
+ /**
221
+ * EditorCoordinator
222
+ *
223
+ * Framework-agnostic class managing the document editor lifecycle:
224
+ * - Document parsing and loading
225
+ * - Font loading coordination
226
+ * - Zoom level management
227
+ * - Extension manager initialization
228
+ * - Agent command execution
229
+ *
230
+ * Extracted from DocxEditor.tsx.
231
+ *
232
+ * Usage with React:
233
+ * ```ts
234
+ * const snapshot = useSyncExternalStore(coordinator.subscribe, coordinator.getSnapshot);
235
+ * ```
236
+ *
237
+ * NOTE: This class defines the state shape and coordination logic.
238
+ * Full integration with DocxEditor is done incrementally.
239
+ */
240
+
241
+ /** Editor loading state */
242
+ type EditorLoadingState = 'idle' | 'parsing' | 'loading-fonts' | 'ready' | 'error';
243
+ /** Configuration for EditorCoordinator */
244
+ interface EditorCoordinatorOptions {
245
+ /** Initial zoom level (default: 1.0) */
246
+ initialZoom?: number;
247
+ /** Callback when the document changes */
248
+ onChange?: (document: Document) => void;
249
+ /** Callback when an error occurs */
250
+ onError?: (error: Error) => void;
251
+ }
252
+ /** The full snapshot exposed to UI frameworks */
253
+ interface EditorCoordinatorSnapshot {
254
+ /** Current loading state */
255
+ loadingState: EditorLoadingState;
256
+ /** Error message if loadingState is 'error' */
257
+ parseError: string | null;
258
+ /** Whether the editor is ready for interaction */
259
+ isReady: boolean;
260
+ /** Current zoom level (1.0 = 100%) */
261
+ zoom: number;
262
+ /** Whether fonts have been loaded */
263
+ fontsLoaded: boolean;
264
+ /** Version counter */
265
+ version: number;
266
+ }
267
+ declare class EditorCoordinator extends Subscribable<EditorCoordinatorSnapshot> {
268
+ private _loadingState;
269
+ private _parseError;
270
+ private _zoom;
271
+ private _fontsLoaded;
272
+ private _document;
273
+ private _version;
274
+ private onChangeCallback?;
275
+ private onErrorCallback?;
276
+ constructor(options?: EditorCoordinatorOptions);
277
+ /** Signal that document parsing has started. */
278
+ setParsingStarted(): void;
279
+ /** Signal that document parsing completed successfully. */
280
+ setDocumentLoaded(document: Document): void;
281
+ /** Signal that font loading completed. */
282
+ setFontsLoaded(): void;
283
+ /** Signal that an error occurred during loading. */
284
+ setLoadError(error: Error): void;
285
+ /** Get the current document. */
286
+ getDocument(): Document | null;
287
+ /** Update the document (after edits). */
288
+ updateDocument(document: Document): void;
289
+ /** Set the zoom level (1.0 = 100%). */
290
+ setZoom(zoom: number): void;
291
+ /** Get the current zoom level. */
292
+ getZoom(): number;
293
+ private emitSnapshot;
294
+ }
295
+
296
+ /**
297
+ * @postnzt/docx-js-editor/core
298
+ *
299
+ * Core entry point — types, parser, serializer, and utilities.
300
+ * No React or ProseMirror dependencies.
301
+ *
302
+ * @example
303
+ * ```ts
304
+ * import { parseDocx, serializeDocx, resolveColor } from '@postnzt/docx-js-editor/core';
305
+ * ```
306
+ */
307
+ declare const VERSION = "0.0.2";
308
+
309
+ export { type CaretPosition, type ColumnResizeState, Document, EditorCoordinator, type EditorCoordinatorOptions, type EditorCoordinatorSnapshot, type EditorLoadingState, ErrorManager, ErrorManagerSnapshot, type ImageSelectionInfo, LayoutCoordinator, type LayoutCoordinatorSnapshot, PluginLifecycleConfig, PluginLifecycleManager, PluginLifecycleSnapshot, type SelectionRect, Subscribable, VERSION, injectStyles };