@sqren/docx-editor-react 1.7.0-fork.0

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 (80) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +122 -0
  3. package/dist/FindReplaceDialog-HM63BMXE.js +1 -0
  4. package/dist/FindReplaceDialog-KU5TEIBJ.mjs +1 -0
  5. package/dist/FootnotePropertiesDialog-TV2BGQDC.js +1 -0
  6. package/dist/FootnotePropertiesDialog-W3YHM4BV.mjs +1 -0
  7. package/dist/HyperlinkDialog-7MEQJIYP.js +1 -0
  8. package/dist/HyperlinkDialog-ZYH7ZHRF.mjs +1 -0
  9. package/dist/ImagePositionDialog-HEWYR6Q3.mjs +1 -0
  10. package/dist/ImagePositionDialog-LSCCQORZ.js +1 -0
  11. package/dist/ImagePropertiesDialog-RAB47C6M.mjs +1 -0
  12. package/dist/ImagePropertiesDialog-Z4M6XKFG.js +1 -0
  13. package/dist/KeyboardShortcutsDialog-B-h3NAat.d.mts +415 -0
  14. package/dist/KeyboardShortcutsDialog-B-h3NAat.d.ts +415 -0
  15. package/dist/PageSetupDialog-AIGIXO3E.mjs +1 -0
  16. package/dist/PageSetupDialog-LWYOYKEU.js +1 -0
  17. package/dist/PrintPreview-DEhwRBC_.d.mts +93 -0
  18. package/dist/PrintPreview-DEhwRBC_.d.ts +93 -0
  19. package/dist/SplitCellDialog-45W7SDPY.js +1 -0
  20. package/dist/SplitCellDialog-IFBKYCD6.mjs +1 -0
  21. package/dist/TablePropertiesDialog-TMLKGOOW.mjs +1 -0
  22. package/dist/TablePropertiesDialog-VCDCPM3R.js +1 -0
  23. package/dist/WatermarkDialog-KRL7WMIS.mjs +1 -0
  24. package/dist/WatermarkDialog-XGLAH3TK.js +1 -0
  25. package/dist/chunk-4Y4JFAPY.mjs +2 -0
  26. package/dist/chunk-74OM4KEH.js +2 -0
  27. package/dist/chunk-7VWJSV3T.js +2 -0
  28. package/dist/chunk-BABMU5KA.mjs +2 -0
  29. package/dist/chunk-BJ5RZW6Y.js +1 -0
  30. package/dist/chunk-BMBP5UFA.mjs +1 -0
  31. package/dist/chunk-BZO4G5M6.js +1 -0
  32. package/dist/chunk-GM2S2WMT.mjs +1 -0
  33. package/dist/chunk-GNIO6SOS.js +1 -0
  34. package/dist/chunk-GWXEFL3H.js +1 -0
  35. package/dist/chunk-IVFYCMAM.mjs +1 -0
  36. package/dist/chunk-J72K2BOS.mjs +2 -0
  37. package/dist/chunk-L4MDZW2J.js +1 -0
  38. package/dist/chunk-LNONBJQM.js +1 -0
  39. package/dist/chunk-NIBCC7WQ.js +1 -0
  40. package/dist/chunk-O6M2HAIZ.mjs +1 -0
  41. package/dist/chunk-OCA7BO3G.mjs +1 -0
  42. package/dist/chunk-OHNO4NRQ.mjs +1 -0
  43. package/dist/chunk-P5ZOUQIK.mjs +1 -0
  44. package/dist/chunk-P6METJHI.mjs +2 -0
  45. package/dist/chunk-PSBO3UDN.js +1 -0
  46. package/dist/chunk-QD7BVJV3.js +2 -0
  47. package/dist/chunk-WFGAQC2B.mjs +1 -0
  48. package/dist/chunk-WNWY6WX7.js +2 -0
  49. package/dist/chunk-YY52FSUR.js +1 -0
  50. package/dist/chunk-ZFZJRL2R.mjs +1 -0
  51. package/dist/dialogs.d.mts +40 -0
  52. package/dist/dialogs.d.ts +40 -0
  53. package/dist/dialogs.js +1 -0
  54. package/dist/dialogs.mjs +1 -0
  55. package/dist/hooks.d.mts +513 -0
  56. package/dist/hooks.d.ts +513 -0
  57. package/dist/hooks.js +1 -0
  58. package/dist/hooks.mjs +1 -0
  59. package/dist/index.d.mts +683 -0
  60. package/dist/index.d.ts +683 -0
  61. package/dist/index.js +32 -0
  62. package/dist/index.mjs +32 -0
  63. package/dist/plugin-api.d.mts +90 -0
  64. package/dist/plugin-api.d.ts +90 -0
  65. package/dist/plugin-api.js +246 -0
  66. package/dist/plugin-api.mjs +246 -0
  67. package/dist/styles.css +1 -0
  68. package/dist/styles.d.mts +13 -0
  69. package/dist/styles.d.ts +13 -0
  70. package/dist/styles.js +1 -0
  71. package/dist/styles.mjs +1 -0
  72. package/dist/types-D35gNE-_.d.mts +106 -0
  73. package/dist/types-D35gNE-_.d.ts +106 -0
  74. package/dist/ui.d.mts +1568 -0
  75. package/dist/ui.d.ts +1568 -0
  76. package/dist/ui.js +111 -0
  77. package/dist/ui.mjs +111 -0
  78. package/dist/useFindReplace-Bc2ubEeV.d.mts +219 -0
  79. package/dist/useFindReplace-Bc2ubEeV.d.ts +219 -0
  80. package/package.json +137 -0
package/dist/ui.d.mts ADDED
@@ -0,0 +1,1568 @@
1
+ /**
2
+ * @eigenpal/docx-editor-react/ui
3
+ *
4
+ * UI entry point — Toolbar, pickers, dialogs, and UI components.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * import { Toolbar, FontPicker, ColorPicker } from '@eigenpal/docx-editor-react/ui';
9
+ * ```
10
+ *
11
+ * @packageDocumentation
12
+ * @public
13
+ */
14
+ import React__default, { CSSProperties, ReactNode } from 'react';
15
+ import * as react_jsx_runtime from 'react/jsx-runtime';
16
+ import { Table, TableCell, ParagraphAlignment, ColorValue, Style, Theme, StyleType, SectionProperties, TabStop, Document } from '@eigenpal/docx-editor-core/types/document';
17
+ import { FontOption } from '@eigenpal/docx-editor-core/utils/fontOptions';
18
+ export { FontOption } from '@eigenpal/docx-editor-core/utils/fontOptions';
19
+ import { ListState } from '@eigenpal/docx-editor-core/utils/listState';
20
+ export { ListState, createDefaultListState } from '@eigenpal/docx-editor-core/utils/listState';
21
+ import { T as TableSelection, a as TableContext, b as TableSplitConfig, c as TableAction } from './useFindReplace-Bc2ubEeV.mjs';
22
+ export { F as FindReplaceOptions, d as FindReplaceState, e as TableToolbar, f as TableToolbarProps, U as UseFindReplaceReturn, u as useFindReplace } from './useFindReplace-Bc2ubEeV.mjs';
23
+ import { SelectionContext, AIAction, AgentResponse } from '@eigenpal/docx-editor-core/types/agentApi';
24
+ import { TranslationKey } from '@eigenpal/docx-editor-i18n';
25
+ export { a as PrintButton, b as PrintButtonProps, P as PrintOptions, c as PrintStyles, f as formatPrintPageRange, g as getDefaultPrintOptions, i as isPrintSupported, o as openPrintWindow, p as parsePageRange, t as triggerPrint } from './PrintPreview-DEhwRBC_.mjs';
26
+ export { K as DialogKeyboardShortcut, F as FindReplaceDialog, a as FindReplaceDialogProps, H as HyperlinkData, b as HyperlinkDialog, c as HyperlinkDialogProps, d as KeyboardShortcutsDialog, e as KeyboardShortcutsDialogProps, P as PasteOption, f as PasteSpecialDialog, g as PasteSpecialDialogProps, S as ShortcutCategory, U as UseKeyboardShortcutsDialogOptions, h as UseKeyboardShortcutsDialogReturn, i as UsePasteSpecialOptions, j as UsePasteSpecialReturn, k as formatShortcutKeys, l as getAllCategories, m as getAllPasteOptions, n as getCategoryLabel, o as getCommonShortcuts, p as getDefaultPasteOption, q as getDefaultShortcuts, r as getPasteOption, s as getShortcutsByCategory, t as isPasteSpecialShortcut, u as useHyperlinkDialog, v as useKeyboardShortcutsDialog, w as usePasteSpecial } from './KeyboardShortcutsDialog-B-h3NAat.mjs';
27
+ export { FindMatch, FindOptions, FindResult, HighlightOptions, createDefaultFindOptions, createSearchPattern, escapeRegexString, findAllMatches, findInDocument, findInParagraph, getDefaultHighlightOptions, getMatchCountText, isEmptySearch, replaceAllInContent, replaceFirstInContent, scrollToMatch } from '@eigenpal/docx-editor-core/utils/findReplace';
28
+ import '@eigenpal/docx-editor-core/utils';
29
+
30
+ interface FontPickerProps {
31
+ value?: string;
32
+ onChange?: (fontFamily: string) => void;
33
+ fonts?: FontOption[];
34
+ disabled?: boolean;
35
+ className?: string;
36
+ placeholder?: string;
37
+ width?: number | string;
38
+ showPreview?: boolean;
39
+ }
40
+ declare function FontPicker({ value, onChange, fonts, disabled, className, placeholder, width, showPreview, }: FontPickerProps): react_jsx_runtime.JSX.Element;
41
+
42
+ /**
43
+ * Props for the ListButtons component
44
+ */
45
+ interface ListButtonsProps {
46
+ /** Current list state of the selection */
47
+ listState?: ListState;
48
+ /** Callback when bullet list is toggled */
49
+ onBulletList?: () => void;
50
+ /** Callback when numbered list is toggled */
51
+ onNumberedList?: () => void;
52
+ /** Callback to increase list indent */
53
+ onIndent?: () => void;
54
+ /** Callback to decrease list indent */
55
+ onOutdent?: () => void;
56
+ /** Whether the buttons are disabled */
57
+ disabled?: boolean;
58
+ /** Additional CSS class name */
59
+ className?: string;
60
+ /** Additional inline styles */
61
+ style?: CSSProperties;
62
+ /** Show indent/outdent buttons */
63
+ showIndentButtons?: boolean;
64
+ /** Compact mode (smaller buttons) */
65
+ compact?: boolean;
66
+ /** Whether the current paragraph has left indentation (for enabling outdent) */
67
+ hasIndent?: boolean;
68
+ }
69
+ /**
70
+ * List buttons component for bullet/numbered list controls
71
+ */
72
+ declare function ListButtons({ listState, onBulletList, onNumberedList, onIndent, onOutdent, disabled, className, style, showIndentButtons, compact, hasIndent, }: ListButtonsProps): react_jsx_runtime.JSX.Element;
73
+
74
+ /**
75
+ * Document-model table operations — pure functions over the Table type:
76
+ * row/column add+delete, cell merge/split, selection bounds + lookups,
77
+ * grid-anchor calculations for irregular merged tables. Used by
78
+ * TableToolbar.tsx and the React table-selection hook; published from
79
+ * `@eigenpal/docx-editor-react`.
80
+ */
81
+
82
+ /**
83
+ * Create a table context from a table and selection
84
+ */
85
+ declare function createTableContext(table: Table, selection: TableSelection): TableContext;
86
+ /**
87
+ * Get column count from a table
88
+ */
89
+ declare function getColumnCount(table: Table): number;
90
+ /**
91
+ * Get cell at specific row and column index
92
+ */
93
+ declare function getCellAt(table: Table, rowIndex: number, columnIndex: number): TableCell | null;
94
+ declare function getTableSplitCellDialogConfig(table: Table, rowIndex: number, columnIndex: number): TableSplitConfig | null;
95
+ declare function splitTableCell(table: Table, rowIndex: number, columnIndex: number, rows: number, cols: number): Table;
96
+ /**
97
+ * Add a row to a table at the specified index
98
+ */
99
+ declare function addRow(table: Table, atIndex: number, position?: 'before' | 'after'): Table;
100
+ /**
101
+ * Delete a row from a table
102
+ */
103
+ declare function deleteRow(table: Table, rowIndex: number): Table;
104
+ /**
105
+ * Add a column to a table at the specified index
106
+ */
107
+ declare function addColumn(table: Table, atIndex: number, position?: 'before' | 'after'): Table;
108
+ /**
109
+ * Delete a column from a table
110
+ */
111
+ declare function deleteColumn(table: Table, columnIndex: number): Table;
112
+ /**
113
+ * Merge cells in a selection
114
+ */
115
+ declare function mergeCells(table: Table, selection: TableSelection): Table;
116
+ /**
117
+ * Backward-compatible helper for callers that still use the older merged-cell
118
+ * split behavior directly.
119
+ *
120
+ * User-facing Split cell is now dialog-driven. For document-model tables, use
121
+ * `getTableSplitCellDialogConfig()` and `splitTableCell()` instead.
122
+ */
123
+ declare function splitCell(table: Table, rowIndex: number, columnIndex: number): Table;
124
+
125
+ /**
126
+ * Current formatting state of the selection
127
+ */
128
+ interface SelectionFormatting {
129
+ /** Whether selected text is bold */
130
+ bold?: boolean;
131
+ /** Whether selected text is italic */
132
+ italic?: boolean;
133
+ /** Whether selected text is underlined */
134
+ underline?: boolean;
135
+ /** Whether selected text has strikethrough */
136
+ strike?: boolean;
137
+ /** Whether selected text is superscript */
138
+ superscript?: boolean;
139
+ /** Whether selected text is subscript */
140
+ subscript?: boolean;
141
+ /** Font family of selected text */
142
+ fontFamily?: string;
143
+ /** Font size of selected text (in half-points) */
144
+ fontSize?: number;
145
+ /** Text color */
146
+ color?: string;
147
+ /** Highlight color */
148
+ highlight?: string;
149
+ /** Paragraph alignment */
150
+ alignment?: ParagraphAlignment;
151
+ /** List state of the current paragraph */
152
+ listState?: ListState;
153
+ /** Line spacing in twips (OOXML value, 240 = single spacing) */
154
+ lineSpacing?: number;
155
+ /** Paragraph style ID */
156
+ styleId?: string;
157
+ /** Paragraph left indentation in twips */
158
+ indentLeft?: number;
159
+ /** Whether the paragraph is RTL (bidi) */
160
+ bidi?: boolean;
161
+ }
162
+ /**
163
+ * Formatting action types
164
+ */
165
+ type FormattingAction = 'bold' | 'italic' | 'underline' | 'strikethrough' | 'superscript' | 'subscript' | 'clearFormatting' | 'bulletList' | 'numberedList' | 'indent' | 'outdent' | 'insertLink' | 'setRtl' | 'setLtr' | {
166
+ type: 'fontFamily';
167
+ value: string;
168
+ } | {
169
+ type: 'fontSize';
170
+ value: number;
171
+ } | {
172
+ type: 'textColor';
173
+ value: ColorValue | string;
174
+ } | {
175
+ type: 'highlightColor';
176
+ value: string;
177
+ } | {
178
+ type: 'alignment';
179
+ value: ParagraphAlignment;
180
+ } | {
181
+ type: 'lineSpacing';
182
+ value: number;
183
+ } | {
184
+ type: 'applyStyle';
185
+ value: string;
186
+ };
187
+ /**
188
+ * Props for the Toolbar (formatting rail) component
189
+ */
190
+ interface ToolbarProps {
191
+ /** Current formatting of the selection */
192
+ currentFormatting?: SelectionFormatting;
193
+ /** Callback when a formatting action is triggered */
194
+ onFormat?: (action: FormattingAction) => void;
195
+ /** Callback for undo action */
196
+ onUndo?: () => void;
197
+ /** Callback for redo action */
198
+ onRedo?: () => void;
199
+ /** Whether undo is available */
200
+ canUndo?: boolean;
201
+ /** Whether redo is available */
202
+ canRedo?: boolean;
203
+ /** Whether the toolbar is disabled */
204
+ disabled?: boolean;
205
+ /** Additional CSS class name */
206
+ className?: string;
207
+ /** Additional inline styles */
208
+ style?: CSSProperties;
209
+ /** Whether to enable keyboard shortcuts (default: true) */
210
+ enableShortcuts?: boolean;
211
+ /** Ref to the editor container for keyboard events */
212
+ editorRef?: React__default.RefObject<HTMLElement>;
213
+ /** Custom toolbar items to render at the end */
214
+ children?: ReactNode;
215
+ /** When true, renders with display:contents so children flow in the parent flex container */
216
+ inline?: boolean;
217
+ /** Whether to show font family picker (default: true) */
218
+ showFontPicker?: boolean;
219
+ /**
220
+ * Custom list of fonts in the toolbar dropdown. When omitted, the built-in
221
+ * 12-font default is used. Strings render in the "Other" group; pass
222
+ * `FontOption[]` for category grouping and CSS fallback chains.
223
+ * An empty array renders an empty (but enabled) dropdown.
224
+ */
225
+ fontFamilies?: ReadonlyArray<string | FontOption>;
226
+ /** Whether to show font size picker (default: true) */
227
+ showFontSizePicker?: boolean;
228
+ /** Whether to show text color picker (default: true) */
229
+ showTextColorPicker?: boolean;
230
+ /** Whether to show highlight color picker (default: true) */
231
+ showHighlightColorPicker?: boolean;
232
+ /** Whether to show alignment buttons (default: true) */
233
+ showAlignmentButtons?: boolean;
234
+ /** Whether to show list buttons (default: true) */
235
+ showListButtons?: boolean;
236
+ /** Whether to show line spacing picker (default: true) */
237
+ showLineSpacingPicker?: boolean;
238
+ /** Whether to show style picker (default: true) */
239
+ showStylePicker?: boolean;
240
+ /** Document styles for the style picker */
241
+ documentStyles?: Style[];
242
+ /** Theme for the style picker / color picker theme matrix */
243
+ theme?: Theme | null;
244
+ /** Callback for print action. Set to enable the File > Print menu entry. */
245
+ onPrint?: () => void;
246
+ /** Callback to open/import a DOCX file (File → Open) */
247
+ onOpen?: () => void;
248
+ /** Callback to save/download the current DOCX (File → Save) */
249
+ onSave?: () => void;
250
+ /** Whether to show zoom control (default: true) */
251
+ showZoomControl?: boolean;
252
+ /** Current zoom level (1.0 = 100%) */
253
+ zoom?: number;
254
+ /** Callback when zoom changes */
255
+ onZoomChange?: (zoom: number) => void;
256
+ /** Callback to refocus the editor after toolbar interactions */
257
+ onRefocusEditor?: () => void;
258
+ /** Callback when a table should be inserted */
259
+ onInsertTable?: (rows: number, columns: number) => void;
260
+ /** Whether to show table insert button (default: true) */
261
+ showTableInsert?: boolean;
262
+ /** Callback when user wants to insert an image */
263
+ onInsertImage?: () => void;
264
+ /** Callback when user wants to insert a page break */
265
+ onInsertPageBreak?: () => void;
266
+ /** Callback when user wants to insert a "next page" section break */
267
+ onInsertSectionBreakNextPage?: () => void;
268
+ /** Callback when user wants to insert a "continuous" section break */
269
+ onInsertSectionBreakContinuous?: () => void;
270
+ /** Callback when user wants to insert a table of contents */
271
+ onInsertTOC?: () => void;
272
+ /** Callback when user wants to insert a shape */
273
+ onInsertShape?: (data: {
274
+ shapeType: string;
275
+ width: number;
276
+ height: number;
277
+ fillColor?: string;
278
+ fillType?: string;
279
+ outlineWidth?: number;
280
+ outlineColor?: string;
281
+ }) => void;
282
+ /** Image context when an image is selected */
283
+ imageContext?: {
284
+ wrapType: string;
285
+ displayMode: string;
286
+ cssFloat: string | null;
287
+ } | null;
288
+ /** Callback when image wrap type changes */
289
+ onImageWrapType?: (wrapType: string) => void;
290
+ /** Callback for image transform (rotate/flip) */
291
+ onImageTransform?: (action: 'rotateCW' | 'rotateCCW' | 'flipH' | 'flipV') => void;
292
+ /** Callback to open image properties dialog (alt text + border) */
293
+ onOpenImageProperties?: () => void;
294
+ /** Callback to open page setup dialog */
295
+ onPageSetup?: () => void;
296
+ /** Callback to open the watermark dialog */
297
+ onWatermark?: () => void;
298
+ /** Table context when cursor is in a table */
299
+ tableContext?: {
300
+ isInTable: boolean;
301
+ rowCount?: number;
302
+ columnCount?: number;
303
+ canSplitCell?: boolean;
304
+ hasMultiCellSelection?: boolean;
305
+ cellBorderColor?: ColorValue;
306
+ cellBackgroundColor?: string;
307
+ } | null;
308
+ /** Callback when a table action is triggered */
309
+ onTableAction?: (action: TableAction) => void;
310
+ }
311
+ /**
312
+ * Props for individual toolbar buttons
313
+ */
314
+ interface ToolbarButtonProps {
315
+ /** Whether the button is in active/pressed state */
316
+ active?: boolean;
317
+ /** Whether the button is disabled */
318
+ disabled?: boolean;
319
+ /** Button title/tooltip */
320
+ title?: string;
321
+ /** Click handler */
322
+ onClick?: () => void;
323
+ /** Button content */
324
+ children: ReactNode;
325
+ /** Additional CSS class name */
326
+ className?: string;
327
+ /** ARIA label for accessibility */
328
+ ariaLabel?: string;
329
+ }
330
+ /**
331
+ * Props for toolbar button groups
332
+ */
333
+ interface ToolbarGroupProps$1 {
334
+ /** Group label for accessibility */
335
+ label?: string;
336
+ /** Group content */
337
+ children: ReactNode;
338
+ /** Additional CSS class name */
339
+ className?: string;
340
+ }
341
+ /**
342
+ * Individual toolbar button with shadcn styling
343
+ */
344
+ declare function ToolbarButton({ active, disabled, title, onClick, children, className, ariaLabel, }: ToolbarButtonProps): react_jsx_runtime.JSX.Element;
345
+ /**
346
+ * Toolbar button group with modern styling
347
+ */
348
+ declare function ToolbarGroup$1({ label, children, className }: ToolbarGroupProps$1): react_jsx_runtime.JSX.Element;
349
+ /**
350
+ * Toolbar separator
351
+ */
352
+ declare function ToolbarSeparator(): react_jsx_runtime.JSX.Element;
353
+ /**
354
+ * Icon-based formatting toolbar — undo/redo, zoom, styles, fonts,
355
+ * bold/italic/underline, colors, alignment, lists, table/image context, clear formatting.
356
+ */
357
+ declare function Toolbar(explicitProps: ToolbarProps): react_jsx_runtime.JSX.Element;
358
+
359
+ /**
360
+ * Props for the EditorToolbar compound component.
361
+ * Extends ToolbarProps with title bar-specific fields.
362
+ */
363
+ interface EditorToolbarProps extends ToolbarProps {
364
+ }
365
+
366
+ interface LogoProps {
367
+ children: ReactNode;
368
+ }
369
+ declare function Logo({ children }: LogoProps): react_jsx_runtime.JSX.Element;
370
+ interface DocumentNameProps {
371
+ value: string;
372
+ onChange?: (value: string) => void;
373
+ placeholder?: string;
374
+ editable?: boolean;
375
+ }
376
+ declare function DocumentName({ value, onChange, placeholder, editable }: DocumentNameProps): react_jsx_runtime.JSX.Element;
377
+ interface TitleBarRightProps {
378
+ children: ReactNode;
379
+ }
380
+ declare function TitleBarRight({ children }: TitleBarRightProps): react_jsx_runtime.JSX.Element;
381
+ declare function MenuBar(): react_jsx_runtime.JSX.Element;
382
+ interface TitleBarProps {
383
+ children: ReactNode;
384
+ }
385
+ /**
386
+ * TitleBar layout (Google Docs style):
387
+ *
388
+ * ┌──────────┬────────────────────────────┬──────────────────┐
389
+ * │ │ Document Name │ │
390
+ * │ Logo │ │ Right Actions │
391
+ * │ │ File Format Insert │ │
392
+ * └──────────┴────────────────────────────┴──────────────────┘
393
+ *
394
+ * Logo and TitleBarRight span full height. DocumentName + MenuBar
395
+ * stack vertically in the center column.
396
+ */
397
+ declare function TitleBar({ children }: TitleBarProps): react_jsx_runtime.JSX.Element;
398
+
399
+ /**
400
+ * EditorToolbar — Google Docs-style 2-level compound component.
401
+ *
402
+ * Usage:
403
+ * <EditorToolbar {...toolbarProps}>
404
+ * <EditorToolbar.TitleBar>
405
+ * <EditorToolbar.Logo><MyIcon /></EditorToolbar.Logo>
406
+ * <EditorToolbar.DocumentName value={name} onChange={setName} />
407
+ * <EditorToolbar.MenuBar />
408
+ * <EditorToolbar.TitleBarRight>
409
+ * <button>Save</button>
410
+ * </EditorToolbar.TitleBarRight>
411
+ * </EditorToolbar.TitleBar>
412
+ * <EditorToolbar.Toolbar />
413
+ * </EditorToolbar>
414
+ */
415
+
416
+ interface EditorToolbarComponent {
417
+ (props: EditorToolbarProps & {
418
+ children: ReactNode;
419
+ }): React.JSX.Element;
420
+ TitleBar: typeof TitleBar;
421
+ Logo: typeof Logo;
422
+ DocumentName: typeof DocumentName;
423
+ MenuBar: typeof MenuBar;
424
+ TitleBarRight: typeof TitleBarRight;
425
+ Toolbar: typeof Toolbar;
426
+ }
427
+ declare const EditorToolbar: EditorToolbarComponent;
428
+
429
+ /**
430
+ * Context Menu Component
431
+ *
432
+ * Right-click context menu for AI actions on selected text.
433
+ * Shows AI options like rewrite, expand, summarize, translate, etc.
434
+ */
435
+
436
+ /**
437
+ * Context menu props
438
+ */
439
+ interface ContextMenuProps {
440
+ /** Whether the menu is visible */
441
+ isOpen: boolean;
442
+ /** Menu position */
443
+ position: {
444
+ x: number;
445
+ y: number;
446
+ };
447
+ /** Selected text */
448
+ selectedText: string;
449
+ /** Selection context for AI operations */
450
+ selectionContext?: SelectionContext;
451
+ /** Callback when an action is selected */
452
+ onAction: (action: AIAction, customPrompt?: string) => void;
453
+ /** Callback when menu is closed */
454
+ onClose: () => void;
455
+ /** Available actions (defaults to DEFAULT_AI_ACTIONS) */
456
+ actions?: AIAction[];
457
+ /** Whether to show custom prompt option */
458
+ showCustomPrompt?: boolean;
459
+ /** Additional className */
460
+ className?: string;
461
+ }
462
+ declare const ContextMenu: React__default.FC<ContextMenuProps>;
463
+ /**
464
+ * Hook to manage context menu state
465
+ */
466
+ declare function useContextMenu(): {
467
+ isOpen: boolean;
468
+ position: {
469
+ x: number;
470
+ y: number;
471
+ };
472
+ selectedText: string;
473
+ selectionContext: SelectionContext | undefined;
474
+ openMenu: (e: React__default.MouseEvent | MouseEvent, text: string, context?: SelectionContext) => void;
475
+ closeMenu: () => void;
476
+ };
477
+ /**
478
+ * Get action shortcuts
479
+ */
480
+ declare function getActionShortcut(action: AIAction): string | undefined;
481
+ /**
482
+ * Check if action is available for selection
483
+ */
484
+ declare function isActionAvailable(_action: AIAction, selectedText: string, _selectionContext?: SelectionContext): boolean;
485
+ /**
486
+ * Get default actions for selection
487
+ */
488
+ declare function getDefaultActions(): AIAction[];
489
+ /**
490
+ * Get all available actions
491
+ */
492
+ declare function getAllActions(): AIAction[];
493
+
494
+ /**
495
+ * Response Preview Component
496
+ *
497
+ * Shows AI response preview with diff view before applying changes.
498
+ * Allows user to accept, reject, or edit the response.
499
+ */
500
+
501
+ /**
502
+ * Response preview props
503
+ */
504
+ interface ResponsePreviewProps {
505
+ /** Original selected text */
506
+ originalText: string;
507
+ /** AI response (or null if loading/error) */
508
+ response: AgentResponse | null;
509
+ /** Action that was performed */
510
+ action: AIAction;
511
+ /** Whether the response is loading */
512
+ isLoading: boolean;
513
+ /** Error message if request failed */
514
+ error?: string;
515
+ /** Callback when user accepts the change */
516
+ onAccept: (newText: string) => void;
517
+ /** Callback when user rejects the change */
518
+ onReject: () => void;
519
+ /** Callback when user wants to retry */
520
+ onRetry?: () => void;
521
+ /** Allow editing before accepting */
522
+ allowEdit?: boolean;
523
+ /** Show diff view */
524
+ showDiff?: boolean;
525
+ /** Additional className */
526
+ className?: string;
527
+ /** Position for the preview */
528
+ position?: {
529
+ x: number;
530
+ y: number;
531
+ };
532
+ }
533
+ declare const ResponsePreview: React__default.FC<ResponsePreviewProps>;
534
+ /**
535
+ * State for response preview
536
+ */
537
+ interface ResponsePreviewState {
538
+ isVisible: boolean;
539
+ originalText: string;
540
+ response: AgentResponse | null;
541
+ action: AIAction;
542
+ isLoading: boolean;
543
+ error?: string;
544
+ position?: {
545
+ x: number;
546
+ y: number;
547
+ };
548
+ }
549
+ /**
550
+ * Hook to manage response preview state
551
+ */
552
+ declare function useResponsePreview(): {
553
+ state: ResponsePreviewState;
554
+ showPreview: (originalText: string, action: AIAction, position?: {
555
+ x: number;
556
+ y: number;
557
+ }) => void;
558
+ setResponse: (response: AgentResponse) => void;
559
+ setError: (error: string) => void;
560
+ hidePreview: () => void;
561
+ };
562
+ /**
563
+ * Create a mock response for testing
564
+ */
565
+ declare function createMockResponse(newText: string, warnings?: string[]): AgentResponse;
566
+ /**
567
+ * Create an error response
568
+ */
569
+ declare function createErrorResponse(error: string): AgentResponse;
570
+
571
+ /**
572
+ * Text Context Menu Component
573
+ *
574
+ * Right-click context menu for text editing operations.
575
+ * Shows Cut, Copy, Paste, and other text editing options.
576
+ */
577
+
578
+ /**
579
+ * Context menu action types
580
+ */
581
+ type TextContextAction = 'cut' | 'copy' | 'paste' | 'pasteAsPlainText' | 'selectAll' | 'delete' | 'separator' | 'addRowAbove' | 'addRowBelow' | 'deleteRow' | 'addColumnLeft' | 'addColumnRight' | 'deleteColumn' | 'mergeCells' | 'splitCell' | 'addComment';
582
+ /**
583
+ * Menu item configuration
584
+ */
585
+ interface TextContextMenuItem {
586
+ /** Action type */
587
+ action: TextContextAction;
588
+ /** Display label */
589
+ label: string;
590
+ /** Keyboard shortcut hint */
591
+ shortcut?: string;
592
+ /** Whether the item is disabled */
593
+ disabled?: boolean;
594
+ /** Whether to show divider after this item */
595
+ dividerAfter?: boolean;
596
+ }
597
+ /**
598
+ * Context menu props
599
+ */
600
+ interface TextContextMenuProps {
601
+ /** Whether the menu is visible */
602
+ isOpen: boolean;
603
+ /** Menu position */
604
+ position: {
605
+ x: number;
606
+ y: number;
607
+ };
608
+ /** Whether there's a selection (enables copy/cut) */
609
+ hasSelection: boolean;
610
+ /** Whether the editor is editable (enables paste/cut/delete) */
611
+ isEditable: boolean;
612
+ /** Whether clipboard has content (enables paste) */
613
+ hasClipboardContent?: boolean;
614
+ /** Callback when an action is selected */
615
+ onAction: (action: TextContextAction) => void;
616
+ /** Callback when menu is closed */
617
+ onClose: () => void;
618
+ /** Custom menu items (overrides default) */
619
+ items?: TextContextMenuItem[];
620
+ /** Additional className */
621
+ className?: string;
622
+ }
623
+ /**
624
+ * Hook options for text context menu
625
+ */
626
+ interface UseTextContextMenuOptions {
627
+ /** Whether the context menu is enabled */
628
+ enabled?: boolean;
629
+ /** Whether the editor is editable */
630
+ isEditable?: boolean;
631
+ /** Container element ref */
632
+ containerRef?: React__default.RefObject<HTMLElement>;
633
+ /** Callback when an action is triggered */
634
+ onAction?: (action: TextContextAction) => void;
635
+ }
636
+ /**
637
+ * Hook return value
638
+ */
639
+ interface UseTextContextMenuReturn {
640
+ /** Whether the menu is open */
641
+ isOpen: boolean;
642
+ /** Menu position */
643
+ position: {
644
+ x: number;
645
+ y: number;
646
+ };
647
+ /** Whether there's a text selection */
648
+ hasSelection: boolean;
649
+ /** Open the context menu */
650
+ openMenu: (event: React__default.MouseEvent | MouseEvent) => void;
651
+ /** Close the context menu */
652
+ closeMenu: () => void;
653
+ /** Handle action selection */
654
+ handleAction: (action: TextContextAction) => void;
655
+ /** Context menu event handler for onContextMenu prop */
656
+ onContextMenu: (event: React__default.MouseEvent) => void;
657
+ }
658
+ declare const TextContextMenu: React__default.FC<TextContextMenuProps>;
659
+ /**
660
+ * Hook to manage text context menu state
661
+ */
662
+ declare function useTextContextMenu(options?: UseTextContextMenuOptions): UseTextContextMenuReturn;
663
+ /**
664
+ * Get action label
665
+ */
666
+ declare function getTextActionLabel(action: TextContextAction): string;
667
+ /**
668
+ * Get action shortcut
669
+ */
670
+ declare function getTextActionShortcut(action: TextContextAction): string;
671
+ /**
672
+ * Get default menu item definitions (untranslated, use translation keys)
673
+ */
674
+ declare function getDefaultTextContextMenuItems(): TextContextMenuItem[];
675
+ /**
676
+ * Check if action is available
677
+ */
678
+ declare function isTextActionAvailable(action: TextContextAction, hasSelection: boolean, isEditable: boolean): boolean;
679
+
680
+ /**
681
+ * Zoom Control Component
682
+ *
683
+ * A − / + stepper around a Radix Select: the buttons step through the zoom
684
+ * levels and the middle % opens a dropdown for a direct pick. Matches the Vue
685
+ * toolbar's zoom stepper and the font-size stepper.
686
+ */
687
+ interface ZoomLevel {
688
+ value: number;
689
+ label: string;
690
+ }
691
+ interface ZoomControlProps {
692
+ value?: number;
693
+ onChange?: (zoom: number) => void;
694
+ levels?: ZoomLevel[];
695
+ disabled?: boolean;
696
+ className?: string;
697
+ compact?: boolean;
698
+ }
699
+ declare function ZoomControl({ value, onChange, levels, disabled, className, compact, }: ZoomControlProps): react_jsx_runtime.JSX.Element;
700
+
701
+ /**
702
+ * Font Size Picker Component (Google Docs Style)
703
+ *
704
+ * A font size control with minus/plus buttons and editable input.
705
+ * Features:
706
+ * - Minus button to decrease font size
707
+ * - Plus button to increase font size
708
+ * - Editable input for custom sizes
709
+ * - Click input to show dropdown with preset sizes
710
+ */
711
+ interface FontSizePickerProps {
712
+ value?: number;
713
+ onChange?: (size: number) => void;
714
+ sizes?: number[];
715
+ disabled?: boolean;
716
+ className?: string;
717
+ placeholder?: string;
718
+ width?: number | string;
719
+ minSize?: number;
720
+ maxSize?: number;
721
+ }
722
+
723
+ declare function FontSizePicker({ value, onChange, sizes, disabled, className, placeholder, minSize, maxSize, }: FontSizePickerProps): react_jsx_runtime.JSX.Element;
724
+
725
+ interface LineSpacingOption {
726
+ label: string;
727
+ labelKey?: TranslationKey;
728
+ value: number;
729
+ twipsValue: number;
730
+ }
731
+ interface LineSpacingPickerProps {
732
+ value?: number;
733
+ onChange?: (twipsValue: number) => void;
734
+ options?: LineSpacingOption[];
735
+ disabled?: boolean;
736
+ className?: string;
737
+ width?: number | string;
738
+ }
739
+ declare function LineSpacingPicker({ value, onChange, options, disabled, className, }: LineSpacingPickerProps): react_jsx_runtime.JSX.Element;
740
+
741
+ type ColorPickerMode = 'text' | 'highlight' | 'border';
742
+ interface ColorPickerProps {
743
+ mode: ColorPickerMode;
744
+ value?: ColorValue | string;
745
+ onChange?: (color: ColorValue | string) => void;
746
+ theme?: Theme | null;
747
+ disabled?: boolean;
748
+ className?: string;
749
+ style?: CSSProperties;
750
+ title?: string;
751
+ /** Override the default icon for the mode */
752
+ icon?: string;
753
+ /** Override the auto/no-color button label */
754
+ autoLabel?: string;
755
+ /**
756
+ * Word-style split button. When true (default), renders two halves:
757
+ * - left (apply): re-applies the last picked color directly
758
+ * - right (arrow): opens the color picker
759
+ * When false, the legacy single button is rendered (one click toggles dropdown).
760
+ */
761
+ splitButton?: boolean;
762
+ /**
763
+ * Initial "last picked" color used by the apply half before the user picks
764
+ * anything. Defaults: text → red, highlight → yellow, border → black.
765
+ */
766
+ defaultColor?: ColorValue | string;
767
+ }
768
+ declare function ColorPicker({ mode, value, onChange, theme, disabled, className, style, title, icon: iconOverride, autoLabel, splitButton, defaultColor, }: ColorPickerProps): react_jsx_runtime.JSX.Element;
769
+
770
+ interface StyleOption {
771
+ styleId: string;
772
+ name: string;
773
+ nameKey?: TranslationKey;
774
+ type: StyleType;
775
+ isDefault?: boolean;
776
+ qFormat?: boolean;
777
+ priority?: number;
778
+ /** Font size in half-points for visual preview */
779
+ fontSize?: number;
780
+ /** Bold styling */
781
+ bold?: boolean;
782
+ /** Italic styling */
783
+ italic?: boolean;
784
+ /** Text color (RGB hex) */
785
+ color?: string;
786
+ }
787
+ interface StylePickerProps {
788
+ value?: string;
789
+ onChange?: (styleId: string) => void;
790
+ styles?: Style[];
791
+ theme?: Theme | null;
792
+ disabled?: boolean;
793
+ className?: string;
794
+ width?: number | string;
795
+ }
796
+ declare function StylePicker({ value, onChange, styles, disabled, className, width, }: StylePickerProps): react_jsx_runtime.JSX.Element;
797
+
798
+ /**
799
+ * Props for the AlignmentButtons component
800
+ */
801
+ interface AlignmentButtonsProps {
802
+ /** Current alignment value */
803
+ value?: ParagraphAlignment;
804
+ /** Callback when alignment is changed */
805
+ onChange?: (alignment: ParagraphAlignment) => void;
806
+ /** Whether the buttons are disabled */
807
+ disabled?: boolean;
808
+ /** Additional CSS class name */
809
+ className?: string;
810
+ /** Additional inline styles */
811
+ style?: CSSProperties;
812
+ /** Show labels next to icons */
813
+ showLabels?: boolean;
814
+ /** Compact mode (smaller buttons) */
815
+ compact?: boolean;
816
+ }
817
+ /**
818
+ * Alignment dropdown component — single button with popover panel
819
+ */
820
+ declare function AlignmentButtons({ value, onChange, disabled, }: AlignmentButtonsProps): react_jsx_runtime.JSX.Element;
821
+
822
+ /**
823
+ * HorizontalRuler Component — Google Docs style
824
+ *
825
+ * 3 handles only:
826
+ * - Left side: first-line indent (▼ down at top) + left indent (▲ up at bottom)
827
+ * - Right side: right indent (▼ down at top)
828
+ *
829
+ * Margins shown as gray zones on the ruler edges.
830
+ * Drag the boundary between gray/white to adjust page margins.
831
+ * Drag tooltip shows value during any drag.
832
+ */
833
+
834
+ interface HorizontalRulerProps {
835
+ sectionProps?: SectionProperties | null;
836
+ zoom?: number;
837
+ editable?: boolean;
838
+ onLeftMarginChange?: (marginTwips: number) => void;
839
+ onRightMarginChange?: (marginTwips: number) => void;
840
+ onFirstLineIndentChange?: (indentTwips: number) => void;
841
+ showFirstLineIndent?: boolean;
842
+ firstLineIndent?: number;
843
+ hangingIndent?: boolean;
844
+ indentLeft?: number;
845
+ indentRight?: number;
846
+ onIndentLeftChange?: (indentTwips: number) => void;
847
+ onIndentRightChange?: (indentTwips: number) => void;
848
+ unit?: 'inch' | 'cm';
849
+ className?: string;
850
+ style?: CSSProperties;
851
+ tabStops?: TabStop[] | null;
852
+ onTabStopRemove?: (positionTwips: number) => void;
853
+ }
854
+ declare function HorizontalRuler({ sectionProps, zoom, editable, onLeftMarginChange, onRightMarginChange, onFirstLineIndentChange, showFirstLineIndent, firstLineIndent, hangingIndent, indentLeft, indentRight, onIndentLeftChange, onIndentRightChange, unit, className, style, tabStops, onTabStopRemove, }: HorizontalRulerProps): React__default.ReactElement;
855
+ declare function positionToMargin(positionPx: number, side: 'left' | 'right', pageWidthPx: number, zoom: number): number;
856
+ declare function getRulerDimensions(sectionProps?: SectionProperties | null, zoom?: number): {
857
+ width: number;
858
+ leftMargin: number;
859
+ rightMargin: number;
860
+ contentWidth: number;
861
+ };
862
+ declare function getMarginInUnits(marginTwips: number, unit: 'inch' | 'cm'): string;
863
+ declare function parseMarginFromUnits(value: string, unit: 'inch' | 'cm'): number | null;
864
+
865
+ interface TableBorderPickerProps {
866
+ onAction: (action: TableAction) => void;
867
+ disabled?: boolean;
868
+ }
869
+ declare function TableBorderPicker({ onAction, disabled }: TableBorderPickerProps): react_jsx_runtime.JSX.Element;
870
+
871
+ interface TableBorderColorPickerProps {
872
+ onAction: (action: TableAction) => void;
873
+ disabled?: boolean;
874
+ theme?: Theme | null;
875
+ /** Current border color (RGB hex without #) */
876
+ value?: string;
877
+ }
878
+ declare function TableBorderColorPicker({ onAction, disabled, theme, value, }: TableBorderColorPickerProps): react_jsx_runtime.JSX.Element;
879
+
880
+ interface TableBorderWidthPickerProps {
881
+ onAction: (action: TableAction) => void;
882
+ disabled?: boolean;
883
+ }
884
+ declare function TableBorderWidthPicker({ onAction, disabled, }: TableBorderWidthPickerProps): react_jsx_runtime.JSX.Element;
885
+
886
+ interface TableCellFillPickerProps {
887
+ onAction: (action: TableAction) => void;
888
+ disabled?: boolean;
889
+ theme?: Theme | null;
890
+ /** Current fill color (RGB hex without #) */
891
+ value?: string;
892
+ }
893
+ declare function TableCellFillPicker({ onAction, disabled, theme, value, }: TableCellFillPickerProps): react_jsx_runtime.JSX.Element;
894
+
895
+ interface TableMergeButtonProps {
896
+ onAction: (action: TableAction) => void;
897
+ disabled?: boolean;
898
+ canMerge?: boolean;
899
+ canSplit?: boolean;
900
+ }
901
+ declare function TableMergeButton({ onAction, disabled, canMerge, canSplit, }: TableMergeButtonProps): react_jsx_runtime.JSX.Element;
902
+
903
+ interface TableInsertButtonsProps {
904
+ onAction: (action: TableAction) => void;
905
+ disabled?: boolean;
906
+ }
907
+ declare function TableInsertButtons({ onAction, disabled }: TableInsertButtonsProps): react_jsx_runtime.JSX.Element;
908
+
909
+ interface TableMoreDropdownProps {
910
+ onAction: (action: TableAction) => void;
911
+ disabled?: boolean;
912
+ tableContext?: {
913
+ isInTable: boolean;
914
+ rowCount?: number;
915
+ columnCount?: number;
916
+ canSplitCell?: boolean;
917
+ hasMultiCellSelection?: boolean;
918
+ table?: {
919
+ attrs?: {
920
+ justification?: string;
921
+ };
922
+ };
923
+ } | null;
924
+ }
925
+ declare function TableMoreDropdown({ onAction, disabled, tableContext, }: TableMoreDropdownProps): react_jsx_runtime.JSX.Element;
926
+
927
+ /**
928
+ * Unsaved Changes Indicator Component
929
+ *
930
+ * Visual indicator that shows when document has unsaved changes.
931
+ * Features:
932
+ * - Configurable appearance (dot, badge, text)
933
+ * - Pulse animation option for visibility
934
+ * - Hook for tracking changes
935
+ * - Browser beforeunload warning
936
+ */
937
+
938
+ /**
939
+ * Indicator variant type
940
+ */
941
+ type IndicatorVariant = 'dot' | 'badge' | 'text' | 'icon';
942
+ /**
943
+ * Indicator position type
944
+ */
945
+ type IndicatorPosition = 'inline' | 'absolute-top-right' | 'absolute-top-left';
946
+ /**
947
+ * Unsaved indicator props
948
+ */
949
+ interface UnsavedIndicatorProps {
950
+ /** Whether there are unsaved changes */
951
+ hasUnsavedChanges: boolean;
952
+ /** Variant of the indicator */
953
+ variant?: IndicatorVariant;
954
+ /** Position of the indicator */
955
+ position?: IndicatorPosition;
956
+ /** Whether to show pulse animation */
957
+ showPulse?: boolean;
958
+ /** Custom label for text variant */
959
+ label?: string;
960
+ /** Custom saved label for text variant */
961
+ savedLabel?: string;
962
+ /** Whether to show indicator when saved (always show) */
963
+ showWhenSaved?: boolean;
964
+ /** Custom color for unsaved state */
965
+ unsavedColor?: string;
966
+ /** Custom color for saved state */
967
+ savedColor?: string;
968
+ /** Size in pixels (for dot/icon) */
969
+ size?: number;
970
+ /** Additional className */
971
+ className?: string;
972
+ /** Additional inline styles */
973
+ style?: React__default.CSSProperties;
974
+ /** Click handler */
975
+ onClick?: () => void;
976
+ /** Title/tooltip text */
977
+ title?: string;
978
+ }
979
+ /**
980
+ * Hook options for tracking unsaved changes
981
+ */
982
+ interface UseUnsavedChangesOptions {
983
+ /** The document to track */
984
+ document?: Document | null;
985
+ /** Whether to warn before leaving page */
986
+ warnBeforeLeave?: boolean;
987
+ /** Custom warning message */
988
+ warningMessage?: string;
989
+ /** Whether tracking is enabled */
990
+ enabled?: boolean;
991
+ /** Callback when changes status changes */
992
+ onChangeStatusChange?: (hasChanges: boolean) => void;
993
+ }
994
+ /**
995
+ * Hook return value
996
+ */
997
+ interface UseUnsavedChangesReturn {
998
+ /** Whether there are unsaved changes */
999
+ hasUnsavedChanges: boolean;
1000
+ /** Mark the document as saved (resets change tracking) */
1001
+ markAsSaved: () => void;
1002
+ /** Mark the document as changed */
1003
+ markAsChanged: () => void;
1004
+ /** Reset tracking (resets baseline) */
1005
+ resetTracking: (newDocument?: Document | null) => void;
1006
+ /** The last saved document snapshot */
1007
+ lastSavedDocument: Document | null;
1008
+ /** Number of changes since last save */
1009
+ changeCount: number;
1010
+ }
1011
+ declare const UnsavedIndicator: React__default.FC<UnsavedIndicatorProps>;
1012
+ /**
1013
+ * Hook to track unsaved changes in a document
1014
+ */
1015
+ declare function useUnsavedChanges(options?: UseUnsavedChangesOptions): UseUnsavedChangesReturn;
1016
+ /**
1017
+ * Get indicator variant label
1018
+ */
1019
+ declare function getVariantLabel(variant: IndicatorVariant): string;
1020
+ /**
1021
+ * Get all indicator variants
1022
+ */
1023
+ declare function getAllVariants(): IndicatorVariant[];
1024
+ /**
1025
+ * Get all indicator positions
1026
+ */
1027
+ declare function getAllPositions(): IndicatorPosition[];
1028
+ /**
1029
+ * Create a document change tracker
1030
+ * Simple utility for external change tracking
1031
+ */
1032
+ declare function createChangeTracker(): {
1033
+ markChanged: () => void;
1034
+ markSaved: () => void;
1035
+ getState: () => {
1036
+ changeCount: number;
1037
+ lastSaveTime: Date | null;
1038
+ hasUnsavedChanges: boolean;
1039
+ };
1040
+ reset: () => void;
1041
+ };
1042
+
1043
+ /**
1044
+ * Loading Indicator Component
1045
+ *
1046
+ * Displays loading states for operations with configurable appearance.
1047
+ * Features:
1048
+ * - Multiple spinner styles (spinner, dots, bar, pulse)
1049
+ * - Overlay mode for blocking UI during operations
1050
+ * - Inline mode for subtle loading indication
1051
+ * - Progress bar variant
1052
+ * - Hook for managing loading states
1053
+ */
1054
+
1055
+ /**
1056
+ * Loading indicator variant
1057
+ */
1058
+ type LoadingVariant = 'spinner' | 'dots' | 'bar' | 'pulse' | 'progress';
1059
+ /**
1060
+ * Loading indicator size
1061
+ */
1062
+ type LoadingSize = 'small' | 'medium' | 'large';
1063
+ /**
1064
+ * Loading indicator props
1065
+ */
1066
+ interface LoadingIndicatorProps {
1067
+ /** Whether loading is active */
1068
+ isLoading: boolean;
1069
+ /** Variant of the loading indicator */
1070
+ variant?: LoadingVariant;
1071
+ /** Size of the indicator */
1072
+ size?: LoadingSize;
1073
+ /** Loading message to display */
1074
+ message?: string;
1075
+ /** Whether to show as full-screen overlay */
1076
+ overlay?: boolean;
1077
+ /** Overlay background opacity (0-1) */
1078
+ overlayOpacity?: number;
1079
+ /** Progress percentage (0-100) for progress variant */
1080
+ progress?: number;
1081
+ /** Show progress percentage text */
1082
+ showProgressText?: boolean;
1083
+ /** Custom color */
1084
+ color?: string;
1085
+ /** Additional className */
1086
+ className?: string;
1087
+ /** Additional inline styles */
1088
+ style?: React__default.CSSProperties;
1089
+ }
1090
+ /**
1091
+ * Options for useLoading hook
1092
+ */
1093
+ interface UseLoadingOptions {
1094
+ /** Initial loading state */
1095
+ initialLoading?: boolean;
1096
+ /** Minimum loading duration in ms (prevents flash) */
1097
+ minDuration?: number;
1098
+ /** Callback when loading starts */
1099
+ onStart?: () => void;
1100
+ /** Callback when loading ends */
1101
+ onEnd?: () => void;
1102
+ }
1103
+ /**
1104
+ * Return value of useLoading hook
1105
+ */
1106
+ interface UseLoadingReturn {
1107
+ /** Current loading state */
1108
+ isLoading: boolean;
1109
+ /** Current message */
1110
+ message: string | null;
1111
+ /** Current progress (0-100) */
1112
+ progress: number;
1113
+ /** Start loading with optional message */
1114
+ startLoading: (message?: string) => void;
1115
+ /** Stop loading */
1116
+ stopLoading: () => void;
1117
+ /** Update progress (0-100) */
1118
+ setProgress: (progress: number) => void;
1119
+ /** Update message */
1120
+ setMessage: (message: string | null) => void;
1121
+ /** Wrap an async operation with loading state */
1122
+ withLoading: <T>(operation: () => Promise<T>, message?: string) => Promise<T>;
1123
+ }
1124
+ /**
1125
+ * Loading operation state
1126
+ */
1127
+ interface LoadingOperation {
1128
+ id: string;
1129
+ message?: string;
1130
+ progress?: number;
1131
+ startTime: number;
1132
+ }
1133
+ declare const LoadingIndicator: React__default.FC<LoadingIndicatorProps>;
1134
+ /**
1135
+ * Hook to manage loading states
1136
+ */
1137
+ declare function useLoading(options?: UseLoadingOptions): UseLoadingReturn;
1138
+ /**
1139
+ * Hook to manage multiple concurrent loading operations
1140
+ */
1141
+ declare function useLoadingOperations(): {
1142
+ operations: LoadingOperation[];
1143
+ isAnyLoading: boolean;
1144
+ startOperation: (id: string, message?: string) => void;
1145
+ updateOperation: (id: string, updates: Partial<LoadingOperation>) => void;
1146
+ endOperation: (id: string) => void;
1147
+ getOperation: (id: string) => LoadingOperation | undefined;
1148
+ };
1149
+ /**
1150
+ * Get loading variant label
1151
+ */
1152
+ declare function getLoadingVariantLabel(variant: LoadingVariant): string;
1153
+ /**
1154
+ * Get all loading variants
1155
+ */
1156
+ declare function getAllLoadingVariants(): LoadingVariant[];
1157
+ /**
1158
+ * Get all loading sizes
1159
+ */
1160
+ declare function getAllLoadingSizes(): LoadingSize[];
1161
+ /**
1162
+ * Create a delay promise for testing loading states
1163
+ */
1164
+ declare function delay(ms: number): Promise<void>;
1165
+
1166
+ /**
1167
+ * Responsive Toolbar Component
1168
+ *
1169
+ * A responsive toolbar wrapper that collapses items into an overflow menu
1170
+ * when the screen is narrow.
1171
+ *
1172
+ * Features:
1173
+ * - Automatically measures available space
1174
+ * - Moves items to overflow menu when they don't fit
1175
+ * - Priority-based item ordering
1176
+ * - Configurable breakpoints
1177
+ * - ResizeObserver for dynamic resizing
1178
+ */
1179
+
1180
+ /**
1181
+ * Priority level for toolbar items
1182
+ * Lower numbers = higher priority (shown first, hidden last)
1183
+ */
1184
+ type ToolbarItemPriority = 1 | 2 | 3 | 4 | 5;
1185
+ /**
1186
+ * Toolbar item configuration
1187
+ */
1188
+ interface ToolbarItem {
1189
+ /** Unique identifier */
1190
+ id: string;
1191
+ /** The content to render */
1192
+ content: ReactNode;
1193
+ /** Priority level (1 = highest, 5 = lowest) */
1194
+ priority?: ToolbarItemPriority;
1195
+ /** Minimum width in pixels (for measuring) */
1196
+ minWidth?: number;
1197
+ /** Whether this item should never be hidden */
1198
+ alwaysVisible?: boolean;
1199
+ /** Whether to show separator after this item */
1200
+ separatorAfter?: boolean;
1201
+ /** Group name for keeping items together */
1202
+ group?: string;
1203
+ }
1204
+ /**
1205
+ * Props for ResponsiveToolbar component
1206
+ */
1207
+ interface ResponsiveToolbarProps {
1208
+ /** Toolbar items */
1209
+ items: ToolbarItem[];
1210
+ /** Additional items for overflow menu only */
1211
+ overflowItems?: ToolbarItem[];
1212
+ /** Whether to show overflow button even when all items fit */
1213
+ alwaysShowOverflow?: boolean;
1214
+ /** Custom overflow button renderer */
1215
+ renderOverflowButton?: (itemCount: number, isOpen: boolean, onClick: () => void) => ReactNode;
1216
+ /** Custom overflow menu renderer */
1217
+ renderOverflowMenu?: (items: ToolbarItem[], onClose: () => void) => ReactNode;
1218
+ /** Gap between items in pixels */
1219
+ itemGap?: number;
1220
+ /** Padding for the toolbar */
1221
+ padding?: number | string;
1222
+ /** Minimum width for overflow button */
1223
+ overflowButtonWidth?: number;
1224
+ /** Additional className */
1225
+ className?: string;
1226
+ /** Additional styles */
1227
+ style?: CSSProperties;
1228
+ /** Height of the toolbar */
1229
+ height?: number | string;
1230
+ /** Background color */
1231
+ backgroundColor?: string;
1232
+ /** Border styles */
1233
+ borderBottom?: string;
1234
+ }
1235
+ /**
1236
+ * Options for useResponsiveToolbar hook
1237
+ */
1238
+ interface UseResponsiveToolbarOptions {
1239
+ /** Container ref */
1240
+ containerRef: React__default.RefObject<HTMLElement | null>;
1241
+ /** Total items */
1242
+ items: ToolbarItem[];
1243
+ /** Gap between items */
1244
+ itemGap?: number;
1245
+ /** Width reserved for overflow button */
1246
+ overflowButtonWidth?: number;
1247
+ }
1248
+ /**
1249
+ * Return value of useResponsiveToolbar hook
1250
+ */
1251
+ interface UseResponsiveToolbarReturn {
1252
+ /** Items that fit in visible area */
1253
+ visibleItems: ToolbarItem[];
1254
+ /** Items in overflow menu */
1255
+ overflowItems: ToolbarItem[];
1256
+ /** Whether overflow menu is needed */
1257
+ hasOverflow: boolean;
1258
+ /** Force a recalculation */
1259
+ recalculate: () => void;
1260
+ }
1261
+ /**
1262
+ * Hook to calculate which items fit in the toolbar
1263
+ */
1264
+ declare function useResponsiveToolbar(options: UseResponsiveToolbarOptions): UseResponsiveToolbarReturn;
1265
+ declare const ResponsiveToolbar: React__default.FC<ResponsiveToolbarProps>;
1266
+ interface ToolbarGroupProps {
1267
+ /** Group items */
1268
+ children: ReactNode;
1269
+ /** Gap between items */
1270
+ gap?: number;
1271
+ /** Whether to show separator after group */
1272
+ separatorAfter?: boolean;
1273
+ /** Additional className */
1274
+ className?: string;
1275
+ /** Additional styles */
1276
+ style?: CSSProperties;
1277
+ }
1278
+ declare const ToolbarGroup: React__default.FC<ToolbarGroupProps>;
1279
+ /**
1280
+ * Create a toolbar item
1281
+ */
1282
+ declare function createToolbarItem(id: string, content: ReactNode, options?: Partial<Omit<ToolbarItem, 'id' | 'content'>>): ToolbarItem;
1283
+ /**
1284
+ * Create toolbar items from an array of configs
1285
+ */
1286
+ declare function createToolbarItems(configs: Array<{
1287
+ id: string;
1288
+ content: ReactNode;
1289
+ priority?: ToolbarItemPriority;
1290
+ minWidth?: number;
1291
+ alwaysVisible?: boolean;
1292
+ separatorAfter?: boolean;
1293
+ group?: string;
1294
+ }>): ToolbarItem[];
1295
+ /**
1296
+ * Get recommended priority for common toolbar items
1297
+ */
1298
+ declare function getRecommendedPriority(itemType: string): ToolbarItemPriority;
1299
+
1300
+ /**
1301
+ * Insert Table Dialog Component
1302
+ *
1303
+ * Modal dialog for inserting a new table into the document.
1304
+ * Provides a visual grid selector for choosing rows and columns.
1305
+ *
1306
+ * Features:
1307
+ * - Visual grid selector (hover to select dimensions)
1308
+ * - Manual row/column input
1309
+ * - Preview of table dimensions
1310
+ * - Quick insert with default sizes
1311
+ */
1312
+
1313
+ /**
1314
+ * Table configuration for insertion
1315
+ */
1316
+ interface TableConfig {
1317
+ /** Number of rows */
1318
+ rows: number;
1319
+ /** Number of columns */
1320
+ columns: number;
1321
+ }
1322
+ /**
1323
+ * Props for InsertTableDialog
1324
+ */
1325
+ interface InsertTableDialogProps {
1326
+ /** Whether the dialog is open */
1327
+ isOpen: boolean;
1328
+ /** Callback when dialog is closed */
1329
+ onClose: () => void;
1330
+ /** Callback when table is inserted */
1331
+ onInsert: (config: TableConfig) => void;
1332
+ /** Maximum rows in grid selector (default: 8) */
1333
+ maxGridRows?: number;
1334
+ /** Maximum columns in grid selector (default: 10) */
1335
+ maxGridColumns?: number;
1336
+ /** Maximum allowed rows (default: 100) */
1337
+ maxRows?: number;
1338
+ /** Maximum allowed columns (default: 20) */
1339
+ maxColumns?: number;
1340
+ /** Additional CSS class */
1341
+ className?: string;
1342
+ /** Additional inline styles */
1343
+ style?: CSSProperties;
1344
+ }
1345
+ /**
1346
+ * InsertTableDialog - Modal for inserting tables with visual grid selector
1347
+ */
1348
+ declare function InsertTableDialog({ isOpen, onClose, onInsert, maxGridRows, maxGridColumns, maxRows, maxColumns, className, style, }: InsertTableDialogProps): React__default.ReactElement | null;
1349
+ /**
1350
+ * Hook for managing Insert Table dialog state
1351
+ */
1352
+ declare function useInsertTableDialog(): {
1353
+ isOpen: boolean;
1354
+ open: () => void;
1355
+ close: () => void;
1356
+ toggle: () => void;
1357
+ };
1358
+ /**
1359
+ * Create a default TableConfig
1360
+ */
1361
+ declare function createDefaultTableConfig(rows?: number, columns?: number): TableConfig;
1362
+ /**
1363
+ * Validate TableConfig
1364
+ */
1365
+ declare function isValidTableConfig(config: TableConfig, maxRows?: number, maxColumns?: number): boolean;
1366
+ /**
1367
+ * Clamp TableConfig to valid range
1368
+ */
1369
+ declare function clampTableConfig(config: TableConfig, maxRows?: number, maxColumns?: number): TableConfig;
1370
+ /**
1371
+ * Format table dimensions for display
1372
+ */
1373
+ declare function formatTableDimensions(config: TableConfig): string;
1374
+ /**
1375
+ * Get common table presets
1376
+ */
1377
+ declare function getTablePresets(): {
1378
+ label: string;
1379
+ config: TableConfig;
1380
+ }[];
1381
+
1382
+ /**
1383
+ * Insert Image Dialog Component
1384
+ *
1385
+ * Modal dialog for inserting images into the document.
1386
+ * Supports file upload with preview and basic sizing options.
1387
+ *
1388
+ * Features:
1389
+ * - File input for image selection
1390
+ * - Drag and drop support
1391
+ * - Image preview
1392
+ * - Width/height controls with aspect ratio lock
1393
+ * - Alt text input
1394
+ */
1395
+
1396
+ /**
1397
+ * Image data for insertion
1398
+ */
1399
+ interface ImageData {
1400
+ /** Base64 data URL or external URL */
1401
+ src: string;
1402
+ /** Image width in pixels */
1403
+ width: number;
1404
+ /** Image height in pixels */
1405
+ height: number;
1406
+ /** Alt text for accessibility */
1407
+ alt?: string;
1408
+ /** Original file name */
1409
+ fileName?: string;
1410
+ /** MIME type */
1411
+ mimeType?: string;
1412
+ }
1413
+ /**
1414
+ * Props for InsertImageDialog
1415
+ */
1416
+ interface InsertImageDialogProps {
1417
+ /** Whether the dialog is open */
1418
+ isOpen: boolean;
1419
+ /** Callback when dialog is closed */
1420
+ onClose: () => void;
1421
+ /** Callback when image is inserted */
1422
+ onInsert: (data: ImageData) => void;
1423
+ /** Maximum width in pixels (default: 800) */
1424
+ maxWidth?: number;
1425
+ /** Maximum height in pixels (default: 600) */
1426
+ maxHeight?: number;
1427
+ /** Accepted file types (default: image/*) */
1428
+ accept?: string;
1429
+ /** Additional CSS class */
1430
+ className?: string;
1431
+ /** Additional inline styles */
1432
+ style?: CSSProperties;
1433
+ }
1434
+ /**
1435
+ * InsertImageDialog - Modal for inserting images with preview and sizing
1436
+ */
1437
+ declare function InsertImageDialog({ isOpen, onClose, onInsert, maxWidth, maxHeight, accept, className, style, }: InsertImageDialogProps): React__default.ReactElement | null;
1438
+ /**
1439
+ * Hook for managing Insert Image dialog state
1440
+ */
1441
+ declare function useInsertImageDialog(): {
1442
+ isOpen: boolean;
1443
+ open: () => void;
1444
+ close: () => void;
1445
+ toggle: () => void;
1446
+ };
1447
+ /**
1448
+ * Check if a file is a valid image
1449
+ */
1450
+ declare function isValidImageFile(file: File): boolean;
1451
+ /**
1452
+ * Get supported image extensions
1453
+ */
1454
+ declare function getSupportedImageExtensions(): string[];
1455
+ /**
1456
+ * Get accept string for file input
1457
+ */
1458
+ declare function getImageAcceptString(): string;
1459
+ /**
1460
+ * Calculate scaled dimensions to fit within bounds
1461
+ */
1462
+ declare function calculateFitDimensions(originalWidth: number, originalHeight: number, maxWidth: number, maxHeight: number): {
1463
+ width: number;
1464
+ height: number;
1465
+ };
1466
+ /**
1467
+ * Convert data URL to Blob
1468
+ */
1469
+ declare function dataUrlToBlob(dataUrl: string): Blob;
1470
+ /**
1471
+ * Get image dimensions from a data URL
1472
+ */
1473
+ declare function getImageDimensions(src: string): Promise<{
1474
+ width: number;
1475
+ height: number;
1476
+ }>;
1477
+ /**
1478
+ * Format file size for display
1479
+ */
1480
+ declare function formatFileSize(bytes: number): string;
1481
+
1482
+ /**
1483
+ * Insert Symbol Dialog Component
1484
+ *
1485
+ * Modal dialog for inserting special characters and symbols into the document.
1486
+ * Provides categorized symbol picker with search functionality.
1487
+ *
1488
+ * Features:
1489
+ * - Categorized symbol groups
1490
+ * - Recent symbols
1491
+ * - Search functionality
1492
+ * - Unicode character display
1493
+ */
1494
+
1495
+ /**
1496
+ * Symbol category
1497
+ */
1498
+ interface SymbolCategory {
1499
+ /** Category name */
1500
+ name: string;
1501
+ /** Display label */
1502
+ label: string;
1503
+ /** Symbols in this category */
1504
+ symbols: string[];
1505
+ }
1506
+ /**
1507
+ * Props for InsertSymbolDialog
1508
+ */
1509
+ interface InsertSymbolDialogProps {
1510
+ /** Whether the dialog is open */
1511
+ isOpen: boolean;
1512
+ /** Callback when dialog is closed */
1513
+ onClose: () => void;
1514
+ /** Callback when symbol is inserted */
1515
+ onInsert: (symbol: string) => void;
1516
+ /** Recently used symbols */
1517
+ recentSymbols?: string[];
1518
+ /** Additional CSS class */
1519
+ className?: string;
1520
+ /** Additional inline styles */
1521
+ style?: CSSProperties;
1522
+ }
1523
+ /**
1524
+ * Default symbol categories
1525
+ */
1526
+ declare const SYMBOL_CATEGORIES: SymbolCategory[];
1527
+ /**
1528
+ * InsertSymbolDialog - Modal for inserting special characters
1529
+ */
1530
+ declare function InsertSymbolDialog({ isOpen, onClose, onInsert, recentSymbols, className, style, }: InsertSymbolDialogProps): React__default.ReactElement | null;
1531
+ /**
1532
+ * Hook for managing Insert Symbol dialog state with recent symbols
1533
+ */
1534
+ declare function useInsertSymbolDialog(maxRecent?: number): {
1535
+ isOpen: boolean;
1536
+ recentSymbols: string[];
1537
+ open: () => void;
1538
+ close: () => void;
1539
+ toggle: () => void;
1540
+ addRecent: (symbol: string) => void;
1541
+ };
1542
+ /**
1543
+ * Get all symbol categories
1544
+ */
1545
+ declare function getSymbolCategories(): SymbolCategory[];
1546
+ /**
1547
+ * Get symbols by category name
1548
+ */
1549
+ declare function getSymbolsByCategory(categoryName: string): string[];
1550
+ /**
1551
+ * Get symbol Unicode info
1552
+ */
1553
+ declare function getSymbolInfo(symbol: string): {
1554
+ character: string;
1555
+ codePoint: string;
1556
+ decimal: number;
1557
+ hex: string;
1558
+ };
1559
+ /**
1560
+ * Search symbols by query
1561
+ */
1562
+ declare function searchSymbols(query: string): string[];
1563
+ /**
1564
+ * Get symbol from Unicode code point string
1565
+ */
1566
+ declare function symbolFromCodePoint(codePointStr: string): string | null;
1567
+
1568
+ export { AlignmentButtons, type AlignmentButtonsProps, ColorPicker, type ColorPickerMode, type ColorPickerProps, ContextMenu, type ContextMenuProps, type DocumentNameProps, EditorToolbar, type EditorToolbarProps, FontPicker, type FontPickerProps, FontSizePicker, type FontSizePickerProps, HorizontalRuler, type HorizontalRulerProps, type ImageData, type IndicatorPosition, type IndicatorVariant, InsertImageDialog, type InsertImageDialogProps, InsertSymbolDialog, type InsertSymbolDialogProps, InsertTableDialog, type InsertTableDialogProps, type LineSpacingOption, LineSpacingPicker, type LineSpacingPickerProps, ListButtons, type ListButtonsProps, LoadingIndicator, type LoadingIndicatorProps, type LoadingOperation, type LoadingSize, type LoadingVariant, type LogoProps, ResponsePreview, type ResponsePreviewProps, type ResponsePreviewState, ResponsiveToolbar, ToolbarGroup as ResponsiveToolbarGroup, type ToolbarGroupProps as ResponsiveToolbarGroupProps, type ResponsiveToolbarProps, SYMBOL_CATEGORIES, type StyleOption, StylePicker, type StylePickerProps, type SymbolCategory, TableAction, TableBorderColorPicker, type TableBorderColorPickerProps, TableBorderPicker, type TableBorderPickerProps, TableBorderWidthPicker, type TableBorderWidthPickerProps, TableCellFillPicker, type TableCellFillPickerProps, type TableConfig, TableContext, TableInsertButtons, type TableInsertButtonsProps, TableMergeButton, type TableMergeButtonProps, TableMoreDropdown, type TableMoreDropdownProps, TableSelection, TableSplitConfig, type TextContextAction, TextContextMenu, type TextContextMenuItem, type TextContextMenuProps, type TitleBarProps, type TitleBarRightProps, Toolbar, ToolbarButton, ToolbarGroup$1 as ToolbarGroup, type ToolbarItem, type ToolbarItemPriority, type ToolbarProps, ToolbarSeparator, UnsavedIndicator, type UnsavedIndicatorProps, type UseLoadingOptions, type UseLoadingReturn, type UseResponsiveToolbarOptions, type UseResponsiveToolbarReturn, type UseTextContextMenuOptions, type UseTextContextMenuReturn, type UseUnsavedChangesOptions, type UseUnsavedChangesReturn, ZoomControl, type ZoomControlProps, addColumn, addRow, calculateFitDimensions, clampTableConfig, createChangeTracker, createDefaultTableConfig, createErrorResponse, createMockResponse, createTableContext, createToolbarItem, createToolbarItems, dataUrlToBlob, delay, deleteColumn, deleteRow, formatFileSize, formatTableDimensions, getActionShortcut, getAllActions, getAllPositions as getAllIndicatorPositions, getAllVariants as getAllIndicatorVariants, getAllLoadingSizes, getAllLoadingVariants, getCellAt, getColumnCount, getDefaultActions, getDefaultTextContextMenuItems, getImageAcceptString, getImageDimensions, getLoadingVariantLabel, getMarginInUnits, getRecommendedPriority, getRulerDimensions, getSupportedImageExtensions, getSymbolCategories, getSymbolInfo as getSymbolUnicodeInfo, getSymbolsByCategory, getTablePresets, getTableSplitCellDialogConfig, getTextActionLabel, getTextActionShortcut, getVariantLabel, isActionAvailable, isTextActionAvailable, isValidImageFile, isValidTableConfig, mergeCells, parseMarginFromUnits, positionToMargin, searchSymbols, splitCell, splitTableCell, symbolFromCodePoint, useContextMenu, useInsertImageDialog, useInsertSymbolDialog, useInsertTableDialog, useLoading, useLoadingOperations, useResponsePreview, useResponsiveToolbar, useTextContextMenu, useUnsavedChanges };