@zeke-02/docx-editor 0.5.2 → 0.5.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 (211) hide show
  1. package/LICENSE +204 -0
  2. package/dist/FindReplaceDialog-7SQOVQWH.js +1 -0
  3. package/dist/FindReplaceDialog-RK3A7MSK.mjs +1 -0
  4. package/dist/{FootnotePropertiesDialog-XQ7NIFIU.js → FootnotePropertiesDialog-2Q2SHVMR.js} +1 -1
  5. package/dist/{FootnotePropertiesDialog-TNVJJCY6.mjs → FootnotePropertiesDialog-ZKQXW3YO.mjs} +1 -1
  6. package/dist/{HyperlinkDialog-FR4IZZ7E.mjs → HyperlinkDialog-QV3CVFQU.mjs} +1 -1
  7. package/dist/HyperlinkDialog-XVAF7FVN.js +1 -0
  8. package/dist/{ImagePositionDialog-JSZSIKF5.mjs → ImagePositionDialog-EGRH3HPP.mjs} +1 -1
  9. package/dist/{ImagePositionDialog-2YXRAGZS.js → ImagePositionDialog-HIVHUTBT.js} +1 -1
  10. package/dist/ImagePropertiesDialog-67WLFIIZ.mjs +1 -0
  11. package/dist/ImagePropertiesDialog-HSM3JJ22.js +1 -0
  12. package/dist/KeyboardShortcutsDialog-5D_FoAp6.d.ts +395 -0
  13. package/dist/KeyboardShortcutsDialog-D7ihAj18.d.mts +395 -0
  14. package/dist/PageSetupDialog-642IAVG2.js +1 -0
  15. package/dist/PageSetupDialog-ERUQDHAY.mjs +1 -0
  16. package/dist/{SplitCellDialog-NP3JJYHD.mjs → SplitCellDialog-GFWCFCTD.mjs} +1 -1
  17. package/dist/{SplitCellDialog-JIAC3RYV.js → SplitCellDialog-M7WF7ANE.js} +1 -1
  18. package/dist/{TablePropertiesDialog-TIK4AA5M.mjs → TablePropertiesDialog-TZ7VCL6V.mjs} +1 -1
  19. package/dist/{TablePropertiesDialog-T7D4HSVP.js → TablePropertiesDialog-ZKU2FTUX.js} +1 -1
  20. package/dist/agentApi-C41hiW-n.d.mts +486 -0
  21. package/dist/agentApi-D4AZmNfB.d.ts +486 -0
  22. package/dist/chunk-2XXILKEQ.js +1 -0
  23. package/dist/chunk-35DG3R42.js +2 -0
  24. package/dist/chunk-47VJOBJD.mjs +60 -0
  25. package/dist/chunk-5UX5CD4C.js +1 -0
  26. package/dist/chunk-7QQSDIWK.mjs +2 -0
  27. package/dist/chunk-AW5TISUL.js +3 -0
  28. package/dist/chunk-AYMGSTNG.js +1 -0
  29. package/dist/chunk-B45ECEGY.js +18 -0
  30. package/dist/chunk-B7CCL7SL.mjs +2 -0
  31. package/dist/chunk-BRMTZRLJ.js +2 -0
  32. package/dist/chunk-D47GTKGU.js +2 -0
  33. package/dist/chunk-E6MQXELR.js +1 -0
  34. package/dist/chunk-F5SERL7X.mjs +2 -0
  35. package/dist/chunk-FWPVBFKQ.mjs +1 -0
  36. package/dist/chunk-GGQK26JO.js +2 -0
  37. package/dist/chunk-GM2S2WMT.mjs +1 -0
  38. package/dist/chunk-ILYKDR3C.js +1 -0
  39. package/dist/chunk-IP5NAYHL.js +60 -0
  40. package/dist/chunk-JPF5R2ZM.mjs +1 -0
  41. package/dist/chunk-KOXCF3CL.mjs +1 -0
  42. package/dist/chunk-KRLNX56Y.mjs +2 -0
  43. package/dist/chunk-LUJ6HCMH.mjs +1 -0
  44. package/dist/chunk-MKNSJOCN.js +70 -0
  45. package/dist/chunk-NIBCC7WQ.js +1 -0
  46. package/dist/chunk-NLFXR2VH.js +2 -0
  47. package/dist/chunk-ONIYA2FU.mjs +2 -0
  48. package/dist/chunk-ONNHQWAX.mjs +1 -0
  49. package/dist/chunk-RCIZ7OM3.mjs +70 -0
  50. package/dist/{chunk-EHFEG3TX.js → chunk-SNZ57XBI.js} +1 -1
  51. package/dist/chunk-SOTWG3KJ.mjs +1 -0
  52. package/dist/chunk-TYPGB4KF.js +1 -0
  53. package/dist/chunk-U7ZW2DOO.mjs +2 -0
  54. package/dist/{chunk-PKEOQIQO.mjs → chunk-WPI3YRFO.mjs} +1 -1
  55. package/dist/chunk-XQZTWWRF.mjs +18 -0
  56. package/dist/chunk-ZVAFVHWR.mjs +3 -0
  57. package/dist/chunk-ZXPCJWVY.js +2 -0
  58. package/dist/{agentApi-DLt94vXk.d.mts → content-B2MzIMwA.d.mts} +8 -755
  59. package/dist/{agentApi-DLt94vXk.d.ts → content-B2MzIMwA.d.ts} +8 -755
  60. package/dist/dialogs.d.mts +25 -0
  61. package/dist/dialogs.d.ts +25 -0
  62. package/dist/dialogs.js +1 -0
  63. package/dist/dialogs.mjs +1 -0
  64. package/dist/document-DZ_ZeZEH.d.ts +294 -0
  65. package/dist/document-Di1qGqLS.d.mts +294 -0
  66. package/dist/executor-EPEB53SJ.js +1 -0
  67. package/dist/executor-TVJ6K6MW.mjs +1 -0
  68. package/dist/findReplace-CpIoILbP.d.mts +138 -0
  69. package/dist/findReplace-pkMskVJU.d.ts +138 -0
  70. package/dist/hooks.d.mts +598 -0
  71. package/dist/hooks.d.ts +598 -0
  72. package/dist/hooks.js +1 -0
  73. package/dist/hooks.mjs +1 -0
  74. package/dist/index.d.mts +1013 -483
  75. package/dist/index.d.ts +1013 -483
  76. package/dist/index.js +40 -120
  77. package/dist/index.mjs +40 -120
  78. package/dist/layout-bridge-5GYGYKM5.mjs +1 -0
  79. package/dist/layout-bridge-QQDA7ELH.js +1 -0
  80. package/dist/plugin-api.d.mts +176 -0
  81. package/dist/plugin-api.d.ts +176 -0
  82. package/dist/plugin-api.js +260 -0
  83. package/dist/plugin-api.mjs +260 -0
  84. package/dist/processTemplate-BTBTR7AM.js +1 -0
  85. package/dist/{processTemplate-W2C5PXZB.mjs → processTemplate-MBX2KDLE.mjs} +1 -1
  86. package/dist/styles.css +1 -1
  87. package/dist/styles.d.mts +18 -0
  88. package/dist/styles.d.ts +18 -0
  89. package/dist/styles.js +1 -0
  90. package/dist/styles.mjs +1 -0
  91. package/dist/types-Bd_YzkhG.d.mts +281 -0
  92. package/dist/types-Bd_YzkhG.d.ts +281 -0
  93. package/dist/types-CkfDgB0O.d.mts +39 -0
  94. package/dist/types-DZUhB7Ao.d.mts +18 -0
  95. package/dist/types-DZUhB7Ao.d.ts +18 -0
  96. package/dist/types-DcxHFUSc.d.ts +39 -0
  97. package/dist/ui.d.mts +111 -552
  98. package/dist/ui.d.ts +111 -552
  99. package/dist/ui.js +111 -1
  100. package/dist/ui.mjs +111 -1
  101. package/dist/useFindReplace-DDs533b-.d.mts +261 -0
  102. package/dist/useFindReplace-eyhMSZZf.d.ts +261 -0
  103. package/package.json +41 -43
  104. package/dist/ClipboardManager-CVKX0v9q.d.ts +0 -464
  105. package/dist/ClipboardManager-V3aaMnWE.d.mts +0 -464
  106. package/dist/DocumentAgent-BWflKHpH.d.mts +0 -442
  107. package/dist/DocumentAgent-DsdXtetF.d.ts +0 -442
  108. package/dist/FindReplaceDialog-L3YF5HIS.mjs +0 -1
  109. package/dist/FindReplaceDialog-SEBWC5P7.js +0 -1
  110. package/dist/HyperlinkDialog-WEK6JSAC.js +0 -1
  111. package/dist/ImagePropertiesDialog-527MFLQO.mjs +0 -1
  112. package/dist/ImagePropertiesDialog-HG4K3IE7.js +0 -1
  113. package/dist/PageSetupDialog-GALVJMUB.js +0 -1
  114. package/dist/PageSetupDialog-TGQIAMI7.mjs +0 -1
  115. package/dist/TableToolbar-DUgmob2I.d.ts +0 -1273
  116. package/dist/TableToolbar-YL74HNS1.d.mts +0 -1273
  117. package/dist/chunk-23SXXIZS.js +0 -111
  118. package/dist/chunk-3F52AP2Q.js +0 -1
  119. package/dist/chunk-42O5GXM5.mjs +0 -82
  120. package/dist/chunk-54ULJEHM.mjs +0 -1
  121. package/dist/chunk-5XK326FI.mjs +0 -1
  122. package/dist/chunk-6WPRCJ5A.mjs +0 -1
  123. package/dist/chunk-76IYR7C7.mjs +0 -1
  124. package/dist/chunk-AGRIVA4G.js +0 -1
  125. package/dist/chunk-BTCQ2QI3.mjs +0 -3
  126. package/dist/chunk-BUEMG4NW.js +0 -1
  127. package/dist/chunk-BXRC4U3X.mjs +0 -2
  128. package/dist/chunk-CPAYKE6X.mjs +0 -1
  129. package/dist/chunk-DACWLFKI.mjs +0 -1
  130. package/dist/chunk-EPBFWE36.js +0 -2
  131. package/dist/chunk-FXES3YDB.js +0 -82
  132. package/dist/chunk-HI66BSGS.mjs +0 -9
  133. package/dist/chunk-INTPVEO6.mjs +0 -9
  134. package/dist/chunk-IOAGVW6Q.mjs +0 -2
  135. package/dist/chunk-JCEWC5QL.mjs +0 -4
  136. package/dist/chunk-JTIUFACT.js +0 -1
  137. package/dist/chunk-LUF7PWIC.js +0 -10
  138. package/dist/chunk-MGEN6GOE.mjs +0 -2
  139. package/dist/chunk-MOE2ZGUE.js +0 -18
  140. package/dist/chunk-MWLHJWB6.js +0 -9
  141. package/dist/chunk-OFYVDN3U.mjs +0 -2
  142. package/dist/chunk-P4VSHBGZ.js +0 -2
  143. package/dist/chunk-P5FQHIES.mjs +0 -1
  144. package/dist/chunk-PBC7XAYZ.js +0 -3
  145. package/dist/chunk-PEMB6SZT.js +0 -2
  146. package/dist/chunk-PQMSZTBB.js +0 -9
  147. package/dist/chunk-Q7UDQXAF.js +0 -1
  148. package/dist/chunk-QGTAIC5E.js +0 -1
  149. package/dist/chunk-QVPR2W5S.js +0 -1
  150. package/dist/chunk-R3QMYPL5.mjs +0 -59
  151. package/dist/chunk-RBUTXXQJ.mjs +0 -18
  152. package/dist/chunk-RRWYZ2TS.mjs +0 -111
  153. package/dist/chunk-S3STEPVO.js +0 -182
  154. package/dist/chunk-SFUM35DH.js +0 -2
  155. package/dist/chunk-SNLC6EK2.js +0 -1
  156. package/dist/chunk-TMTLIGLZ.js +0 -59
  157. package/dist/chunk-TSE2PWFX.mjs +0 -10
  158. package/dist/chunk-UKESXQS5.mjs +0 -182
  159. package/dist/chunk-UWYD42WV.js +0 -4
  160. package/dist/chunk-UXVACQCY.mjs +0 -1
  161. package/dist/chunk-W4EIKDM6.mjs +0 -2
  162. package/dist/chunk-W53SI3XW.mjs +0 -1
  163. package/dist/chunk-WNS2RBQD.js +0 -2
  164. package/dist/chunk-Z3KMSHUP.js +0 -1
  165. package/dist/core-plugins-reexport.d.mts +0 -31
  166. package/dist/core-plugins-reexport.d.ts +0 -31
  167. package/dist/core-plugins-reexport.js +0 -1
  168. package/dist/core-plugins-reexport.mjs +0 -1
  169. package/dist/core-reexport.d.mts +0 -340
  170. package/dist/core-reexport.d.ts +0 -340
  171. package/dist/core-reexport.js +0 -1
  172. package/dist/core-reexport.mjs +0 -1
  173. package/dist/documentSerializer-DtS_-oGA.d.mts +0 -664
  174. package/dist/documentSerializer-Wj1p2ASa.d.ts +0 -664
  175. package/dist/executor-C3VXF7QA.mjs +0 -1
  176. package/dist/executor-GDBV3AGV.js +0 -1
  177. package/dist/headless-reexport.d.mts +0 -197
  178. package/dist/headless-reexport.d.ts +0 -197
  179. package/dist/headless-reexport.js +0 -1
  180. package/dist/headless-reexport.mjs +0 -1
  181. package/dist/insertOperations-BTH1Asas.d.mts +0 -176
  182. package/dist/insertOperations-CbUnXAXH.d.ts +0 -176
  183. package/dist/layout-bridge-EA4DJ227.js +0 -1
  184. package/dist/layout-bridge-XDPSO6GO.mjs +0 -1
  185. package/dist/mcp-reexport.d.mts +0 -156
  186. package/dist/mcp-reexport.d.ts +0 -156
  187. package/dist/mcp-reexport.js +0 -16
  188. package/dist/mcp-reexport.mjs +0 -16
  189. package/dist/processTemplate-MJ2PCSO5.js +0 -1
  190. package/dist/react-B0W16SV6.d.ts +0 -1330
  191. package/dist/react-D0Pn1nww.d.mts +0 -1330
  192. package/dist/react.css +0 -1
  193. package/dist/react.d.mts +0 -10
  194. package/dist/react.d.ts +0 -10
  195. package/dist/react.js +0 -1
  196. package/dist/react.mjs +0 -1
  197. package/dist/registry-CH9V-IX0.d.ts +0 -165
  198. package/dist/registry-CWBKYlNW.d.mts +0 -165
  199. package/dist/types-UDsUq8D3.d.mts +0 -310
  200. package/dist/types-jbivc9Lj.d.ts +0 -310
  201. package/dist/variableDetector-CdQ7ZTzA.d.mts +0 -204
  202. package/dist/variableDetector-DsRV3A9z.d.ts +0 -204
  203. package/i18n/de.json +0 -792
  204. package/i18n/en.json +0 -792
  205. package/i18n/he.json +0 -792
  206. package/i18n/pl.json +0 -792
  207. package/i18n/pt-BR.json +0 -792
  208. package/i18n/tr.json +0 -792
  209. package/i18n/zh-CN.json +0 -792
  210. /package/dist/{chunk-YC5KZSYD.js → chunk-ESZ6JRTW.js} +0 -0
  211. /package/dist/{chunk-LVGJKS7Y.mjs → chunk-TZMMD6RR.mjs} +0 -0
@@ -0,0 +1,281 @@
1
+ import { EditorView } from 'prosemirror-view';
2
+ import { ReactNode } from 'react';
3
+ import { Plugin } from 'prosemirror-state';
4
+ import { Node } from 'prosemirror-model';
5
+
6
+ /**
7
+ * Framework-Agnostic Plugin Interface for the DOCX Editor
8
+ *
9
+ * Core plugin types that can be used by any framework (React, Vue, etc.).
10
+ * Framework-specific adapters extend EditorPluginCore with their own
11
+ * UI rendering capabilities (e.g., ReactEditorPlugin, VueEditorPlugin).
12
+ */
13
+
14
+ /**
15
+ * Coordinates returned by position lookup in the rendered DOM.
16
+ */
17
+ interface PositionCoordinates {
18
+ x: number;
19
+ y: number;
20
+ height: number;
21
+ }
22
+ /**
23
+ * Context for accessing the rendered DOM in the paged editor.
24
+ *
25
+ * Provides DOM-based position mapping that works with the LayoutPainter
26
+ * output (visible pages). Use this for rendering overlays, annotations,
27
+ * and other visual elements positioned relative to rendered content.
28
+ *
29
+ * The rendered DOM uses data-pm-start/data-pm-end attributes on spans
30
+ * to map between ProseMirror positions and DOM elements.
31
+ */
32
+ interface RenderedDomContext {
33
+ /** The container element holding all rendered pages. */
34
+ pagesContainer: HTMLElement;
35
+ /**
36
+ * Get pixel coordinates for a ProseMirror position in the rendered DOM.
37
+ * Returns null if the position cannot be found.
38
+ */
39
+ getCoordinatesForPosition(pmPos: number): PositionCoordinates | null;
40
+ /**
41
+ * Find DOM elements that overlap with a ProseMirror position range.
42
+ */
43
+ findElementsForRange(from: number, to: number): Element[];
44
+ /**
45
+ * Get bounding rectangles for a range of text, accounting for line wraps.
46
+ * Returns rects relative to the pages container.
47
+ */
48
+ getRectsForRange(from: number, to: number): Array<{
49
+ x: number;
50
+ y: number;
51
+ width: number;
52
+ height: number;
53
+ }>;
54
+ /** Current zoom level (1 = 100%). */
55
+ zoom: number;
56
+ /**
57
+ * Offset of the pages container from its parent viewport.
58
+ */
59
+ getContainerOffset(): {
60
+ x: number;
61
+ y: number;
62
+ };
63
+ }
64
+ /**
65
+ * Props passed to plugin panel components (framework-agnostic base).
66
+ */
67
+ interface PluginPanelProps<TState = unknown> {
68
+ /** Current ProseMirror editor view */
69
+ editorView: EditorView | null;
70
+ /** Current ProseMirror document */
71
+ doc: Node | null;
72
+ /** Scroll editor to a specific position */
73
+ scrollToPosition: (pos: number) => void;
74
+ /** Select a range in the editor */
75
+ selectRange: (from: number, to: number) => void;
76
+ /** Plugin-specific state (managed by the plugin) */
77
+ pluginState: TState;
78
+ /** Width of the panel in pixels */
79
+ panelWidth: number;
80
+ /**
81
+ * Context for the rendered DOM (LayoutPainter output).
82
+ * May be null if layout hasn't completed yet.
83
+ */
84
+ renderedDomContext: RenderedDomContext | null;
85
+ }
86
+ /**
87
+ * Configuration for plugin panel rendering.
88
+ */
89
+ interface PanelConfig {
90
+ /** Where to render the panel */
91
+ position: 'left' | 'right' | 'bottom';
92
+ /** Default width/height of the panel */
93
+ defaultSize: number;
94
+ /** Minimum size */
95
+ minSize?: number;
96
+ /** Maximum size */
97
+ maxSize?: number;
98
+ /** Whether the panel is resizable */
99
+ resizable?: boolean;
100
+ /** Whether the panel can be collapsed */
101
+ collapsible?: boolean;
102
+ /** Initial collapsed state */
103
+ defaultCollapsed?: boolean;
104
+ }
105
+ /**
106
+ * Framework-agnostic core plugin interface.
107
+ *
108
+ * Contains all non-UI plugin capabilities:
109
+ * - ProseMirror plugins (decorations, keymaps, etc.)
110
+ * - State management (initialize, onStateChange, destroy)
111
+ * - CSS injection
112
+ * - Panel configuration
113
+ *
114
+ * Framework adapters (ReactEditorPlugin, VueEditorPlugin) extend this
115
+ * with their own Panel component type and renderOverlay function.
116
+ */
117
+ interface EditorPluginCore<TState = any> {
118
+ /** Unique plugin identifier */
119
+ id: string;
120
+ /** Display name for the plugin */
121
+ name: string;
122
+ /**
123
+ * ProseMirror plugins to register with the editor.
124
+ * These are merged with the editor's internal plugins.
125
+ */
126
+ proseMirrorPlugins?: Plugin[];
127
+ /**
128
+ * Configuration for the panel (position, size, etc.)
129
+ */
130
+ panelConfig?: PanelConfig;
131
+ /**
132
+ * Called when the editor state changes.
133
+ * Use this to update plugin-specific state based on document changes.
134
+ */
135
+ onStateChange?: (view: EditorView) => TState | undefined;
136
+ /**
137
+ * Initialize plugin state when the plugin is first loaded.
138
+ */
139
+ initialize?: (view: EditorView | null) => TState;
140
+ /**
141
+ * Called when the plugin is being destroyed.
142
+ * Use this for cleanup (subscriptions, timers, etc.)
143
+ */
144
+ destroy?: () => void;
145
+ /**
146
+ * CSS styles to inject for this plugin.
147
+ * Can be a string of CSS or a URL to a stylesheet.
148
+ */
149
+ styles?: string;
150
+ }
151
+ /**
152
+ * A sidebar item anchored to a document position.
153
+ * Framework adapters extend this with rendering capabilities.
154
+ */
155
+ interface SidebarItem {
156
+ /** Unique ID for this item (used as React key and for overlap resolution). */
157
+ id: string;
158
+ /** ProseMirror document position this item anchors to. */
159
+ anchorPos: number;
160
+ /** Optional key into the anchorPositions Map (e.g. "comment-42", "revision-7"). */
161
+ anchorKey?: string;
162
+ /** Sort priority within items at the same anchor Y. Lower = first. Default: 0. */
163
+ priority?: number;
164
+ /** Temporary items (e.g. "add comment" input) skip entrance animation. */
165
+ isTemporary?: boolean;
166
+ /** Pre-computed Y position (scroll-container coords, pre-zoom). Overrides anchor resolution. */
167
+ fixedY?: number;
168
+ }
169
+ /**
170
+ * Context provided to plugins when computing sidebar items.
171
+ */
172
+ interface SidebarItemContext {
173
+ editorView: EditorView | null;
174
+ renderedDomContext: RenderedDomContext | null;
175
+ /** Pre-computed Y positions from layout engine (keys like "comment-{id}"). */
176
+ anchorPositions: Map<string, number>;
177
+ zoom: number;
178
+ }
179
+
180
+ /**
181
+ * React Plugin Interface for the DOCX Editor
182
+ *
183
+ * Extends the framework-agnostic EditorPluginCore with React-specific
184
+ * UI rendering capabilities (Panel component, renderOverlay).
185
+ */
186
+
187
+ /**
188
+ * React-specific editor plugin interface.
189
+ *
190
+ * Extends EditorPluginCore with:
191
+ * - Panel: React component for rendering in the annotation panel
192
+ * - renderOverlay: Function returning ReactNode for overlay rendering
193
+ */
194
+ /**
195
+ * Render props passed to each sidebar item.
196
+ */
197
+ interface SidebarItemRenderProps {
198
+ /** Whether this item is currently expanded/active. */
199
+ isExpanded: boolean;
200
+ /** Toggle expand/collapse for this item. */
201
+ onToggleExpand: () => void;
202
+ /** Ref callback to measure the rendered card height. */
203
+ measureRef: (el: HTMLDivElement | null) => void;
204
+ }
205
+ /**
206
+ * A sidebar item with React rendering, anchored to a document position.
207
+ */
208
+ interface ReactSidebarItem extends SidebarItem {
209
+ /** Render the card content. */
210
+ render: (props: SidebarItemRenderProps) => ReactNode;
211
+ /** Estimated height in pixels (for pre-layout before measurement). Default: 40. */
212
+ estimatedHeight?: number;
213
+ }
214
+ interface ReactEditorPlugin<TState = any> extends EditorPluginCore<TState> {
215
+ /**
216
+ * React component to render in the annotation panel area.
217
+ * Receives editor state and callbacks for interaction.
218
+ */
219
+ Panel?: React.ComponentType<PluginPanelProps<TState>>;
220
+ /**
221
+ * Render an overlay on top of the rendered pages.
222
+ * Use this for highlights, annotations, or other visual elements
223
+ * that need to be positioned relative to the document content.
224
+ */
225
+ renderOverlay?: (context: RenderedDomContext, state: TState, editorView: EditorView | null) => ReactNode;
226
+ /**
227
+ * Provide sidebar items anchored to document positions.
228
+ * Called whenever plugin state changes.
229
+ * Items from all plugins are merged and laid out together in a unified sidebar.
230
+ */
231
+ getSidebarItems?: (state: TState, context: SidebarItemContext) => ReactSidebarItem[];
232
+ }
233
+ /**
234
+ * Backwards-compatible alias — EditorPlugin is now ReactEditorPlugin.
235
+ */
236
+ type EditorPlugin<TState = any> = ReactEditorPlugin<TState>;
237
+ /**
238
+ * Context value provided to plugins and panels.
239
+ */
240
+ interface PluginContext {
241
+ /** All registered plugins */
242
+ plugins: EditorPlugin[];
243
+ /** Current editor view */
244
+ editorView: EditorView | null;
245
+ /** Set the editor view (called by editor on mount) */
246
+ setEditorView: (view: EditorView | null) => void;
247
+ /** Get plugin state by plugin ID */
248
+ getPluginState: <T>(pluginId: string) => T | undefined;
249
+ /** Update plugin state */
250
+ setPluginState: <T>(pluginId: string, state: T) => void;
251
+ /** Scroll to a position in the editor */
252
+ scrollToPosition: (pos: number) => void;
253
+ /** Select a range in the editor */
254
+ selectRange: (from: number, to: number) => void;
255
+ }
256
+ /**
257
+ * Props for the PluginHost component.
258
+ */
259
+ interface PluginHostProps {
260
+ /** Plugins to enable */
261
+ plugins: EditorPlugin[];
262
+ /** The editor component (passed as child) */
263
+ children: React.ReactElement;
264
+ /** Class name for the host container */
265
+ className?: string;
266
+ }
267
+ /**
268
+ * Ref interface for the PluginHost component.
269
+ */
270
+ interface PluginHostRef {
271
+ /** Get plugin state by plugin ID */
272
+ getPluginState: <T>(pluginId: string) => T | undefined;
273
+ /** Update plugin state for a plugin */
274
+ setPluginState: <T>(pluginId: string, state: T) => void;
275
+ /** Get the current editor view */
276
+ getEditorView: () => EditorView | null;
277
+ /** Force a refresh of all plugin states */
278
+ refreshPluginStates: () => void;
279
+ }
280
+
281
+ export type { EditorPlugin as E, PluginHostProps as P, RenderedDomContext as R, SidebarItem as S, ReactSidebarItem as a, PluginHostRef as b, PositionCoordinates as c, ReactEditorPlugin as d, PanelConfig as e, PluginContext as f, PluginPanelProps as g, SidebarItemContext as h, SidebarItemRenderProps as i };
@@ -0,0 +1,39 @@
1
+ import { D as Document } from './document-Di1qGqLS.mjs';
2
+
3
+ /**
4
+ * Manager Types
5
+ *
6
+ * Framework-agnostic interfaces for the editor's manager classes.
7
+ */
8
+
9
+ /**
10
+ * Framework-agnostic interface for an imperatively mounted editor instance.
11
+ *
12
+ * Returned by `renderAsync()` implementations (React, Vue, etc.).
13
+ * Consumers use this to interact with the editor programmatically.
14
+ */
15
+ interface EditorHandle {
16
+ /** Save the document and return the DOCX as a Blob. */
17
+ save(): Promise<Blob | null>;
18
+ /** Get the current parsed document model. */
19
+ getDocument(): Document | null;
20
+ /** Focus the editor. */
21
+ focus(): void;
22
+ /** Unmount the editor and clean up. */
23
+ destroy(): void;
24
+ }
25
+ /** Auto-save status */
26
+ type AutoSaveStatus = 'idle' | 'saving' | 'saved' | 'error';
27
+ /** Saved document data structure */
28
+ interface SavedDocumentData {
29
+ /** The document JSON */
30
+ document: Document;
31
+ /** When the document was saved */
32
+ savedAt: string;
33
+ /** Version for format compatibility */
34
+ version: number;
35
+ /** Optional document identifier */
36
+ documentId?: string;
37
+ }
38
+
39
+ export type { AutoSaveStatus as A, EditorHandle as E, SavedDocumentData as S };
@@ -0,0 +1,18 @@
1
+ import en from '@eigenpal/docx-editor-i18n/en.json';
2
+
3
+ /** Auto-derived from en.json — never manually maintained */
4
+ type LocaleStrings = typeof en;
5
+ /** Recursively makes all properties optional */
6
+ type DeepPartial<T> = {
7
+ [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K] | null;
8
+ };
9
+ type PartialLocaleStrings = DeepPartial<LocaleStrings>;
10
+ /** Consumer-facing type for the i18n prop. */
11
+ type Translations = PartialLocaleStrings;
12
+ /** Generates a union of all valid dot-notation paths through a nested object type */
13
+ type DotPath<T, Prefix extends string = ''> = {
14
+ [K in keyof T & string]: T[K] extends Record<string, unknown> ? DotPath<T[K], `${Prefix}${K}.`> : `${Prefix}${K}`;
15
+ }[keyof T & string];
16
+ type TranslationKey = DotPath<LocaleStrings>;
17
+
18
+ export type { LocaleStrings as L, PartialLocaleStrings as P, Translations as T, TranslationKey as a };
@@ -0,0 +1,18 @@
1
+ import en from '@eigenpal/docx-editor-i18n/en.json';
2
+
3
+ /** Auto-derived from en.json — never manually maintained */
4
+ type LocaleStrings = typeof en;
5
+ /** Recursively makes all properties optional */
6
+ type DeepPartial<T> = {
7
+ [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K] | null;
8
+ };
9
+ type PartialLocaleStrings = DeepPartial<LocaleStrings>;
10
+ /** Consumer-facing type for the i18n prop. */
11
+ type Translations = PartialLocaleStrings;
12
+ /** Generates a union of all valid dot-notation paths through a nested object type */
13
+ type DotPath<T, Prefix extends string = ''> = {
14
+ [K in keyof T & string]: T[K] extends Record<string, unknown> ? DotPath<T[K], `${Prefix}${K}.`> : `${Prefix}${K}`;
15
+ }[keyof T & string];
16
+ type TranslationKey = DotPath<LocaleStrings>;
17
+
18
+ export type { LocaleStrings as L, PartialLocaleStrings as P, Translations as T, TranslationKey as a };
@@ -0,0 +1,39 @@
1
+ import { D as Document } from './document-DZ_ZeZEH.js';
2
+
3
+ /**
4
+ * Manager Types
5
+ *
6
+ * Framework-agnostic interfaces for the editor's manager classes.
7
+ */
8
+
9
+ /**
10
+ * Framework-agnostic interface for an imperatively mounted editor instance.
11
+ *
12
+ * Returned by `renderAsync()` implementations (React, Vue, etc.).
13
+ * Consumers use this to interact with the editor programmatically.
14
+ */
15
+ interface EditorHandle {
16
+ /** Save the document and return the DOCX as a Blob. */
17
+ save(): Promise<Blob | null>;
18
+ /** Get the current parsed document model. */
19
+ getDocument(): Document | null;
20
+ /** Focus the editor. */
21
+ focus(): void;
22
+ /** Unmount the editor and clean up. */
23
+ destroy(): void;
24
+ }
25
+ /** Auto-save status */
26
+ type AutoSaveStatus = 'idle' | 'saving' | 'saved' | 'error';
27
+ /** Saved document data structure */
28
+ interface SavedDocumentData {
29
+ /** The document JSON */
30
+ document: Document;
31
+ /** When the document was saved */
32
+ savedAt: string;
33
+ /** Version for format compatibility */
34
+ version: number;
35
+ /** Optional document identifier */
36
+ documentId?: string;
37
+ }
38
+
39
+ export type { AutoSaveStatus as A, EditorHandle as E, SavedDocumentData as S };