@eigenpal/docx-js-editor 0.0.11 → 0.0.13

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 (99) hide show
  1. package/dist/DocumentAgent-Ci6_T-XM.d.ts +412 -0
  2. package/dist/DocumentAgent-DEGFgYEN.d.cts +412 -0
  3. package/dist/FindReplaceDialog-BAACAU67.cjs +1 -0
  4. package/dist/FindReplaceDialog-RWYDRWHF.js +1 -0
  5. package/dist/FootnotePropertiesDialog-BC6JIPDA.cjs +1 -0
  6. package/dist/FootnotePropertiesDialog-CWQF5EBK.js +1 -0
  7. package/dist/HyperlinkDialog-EG2BSLPD.cjs +1 -0
  8. package/dist/HyperlinkDialog-YAVK64F4.js +1 -0
  9. package/dist/ImagePositionDialog-IGYS5KMK.cjs +1 -0
  10. package/dist/ImagePositionDialog-S6SMH7XH.js +1 -0
  11. package/dist/ImagePropertiesDialog-UO5QUIBS.js +1 -0
  12. package/dist/ImagePropertiesDialog-VGV4E4SN.cjs +1 -0
  13. package/dist/TablePropertiesDialog-VBOU4DID.js +1 -0
  14. package/dist/TablePropertiesDialog-WRM47JI6.cjs +1 -0
  15. package/dist/{types-BALm1KBi.d.cts → agentApi-CbVUCZRu.d.cts} +1 -308
  16. package/dist/{types-BALm1KBi.d.ts → agentApi-CbVUCZRu.d.ts} +1 -308
  17. package/dist/chunk-2ASOEN3V.js +1 -0
  18. package/dist/chunk-6MBDPZVD.js +111 -0
  19. package/dist/chunk-6YLNNCRZ.cjs +10 -0
  20. package/dist/chunk-BVQ2QRHA.cjs +4 -0
  21. package/dist/chunk-COP5BIBZ.js +10 -0
  22. package/dist/chunk-CZ7W7MCM.cjs +2 -0
  23. package/dist/chunk-E6XDMUAM.js +4 -0
  24. package/dist/chunk-EMKABJPH.js +1 -0
  25. package/dist/{chunk-TRAQI6RX.cjs → chunk-EPCZ24TY.cjs} +5 -5
  26. package/dist/chunk-ESI4BSBF.js +1 -0
  27. package/dist/chunk-FLECKDK4.cjs +58 -0
  28. package/dist/chunk-ITWEFKGQ.cjs +1 -0
  29. package/dist/chunk-KESNGXGO.js +1 -0
  30. package/dist/chunk-KVAT5SVD.js +2 -0
  31. package/dist/chunk-L34XFLQZ.cjs +1 -0
  32. package/dist/chunk-M7F2CUUD.js +2 -0
  33. package/dist/chunk-MDPDH7KS.js +58 -0
  34. package/dist/chunk-MTX3EEBJ.js +258 -0
  35. package/dist/chunk-NT2REEAA.cjs +1 -0
  36. package/dist/{chunk-PM4Y7OFN.js → chunk-OTG4NABM.js} +5 -5
  37. package/dist/chunk-OW5H5DNE.cjs +1 -0
  38. package/dist/chunk-PJVI53AH.js +2 -0
  39. package/dist/chunk-PNMZPPPI.cjs +2 -0
  40. package/dist/chunk-SF53KLDZ.cjs +1 -0
  41. package/dist/chunk-TOI5W3HK.js +8 -0
  42. package/dist/chunk-UAVOWAIF.cjs +8 -0
  43. package/dist/chunk-VN7XH644.cjs +258 -0
  44. package/dist/chunk-W4DUKACP.cjs +111 -0
  45. package/dist/chunk-XS2AQFMF.cjs +2 -0
  46. package/dist/chunk-ZDYHAYN6.js +1 -0
  47. package/dist/clipboard-BOocwmAM.d.ts +539 -0
  48. package/dist/clipboard-Cx7cb3kX.d.cts +539 -0
  49. package/dist/{colorResolver-BNj-uZ58.d.ts → colorResolver-CIDiSPWd.d.cts} +3 -411
  50. package/dist/{colorResolver-DiMquGWR.d.cts → colorResolver-KXbUgzWC.d.ts} +3 -411
  51. package/dist/core-plugins.cjs +1 -1
  52. package/dist/core-plugins.d.cts +4 -3
  53. package/dist/core-plugins.d.ts +4 -3
  54. package/dist/core-plugins.js +1 -1
  55. package/dist/core.cjs +1 -0
  56. package/dist/core.d.cts +23 -0
  57. package/dist/core.d.ts +23 -0
  58. package/dist/core.js +1 -0
  59. package/dist/headless.cjs +2 -2
  60. package/dist/headless.d.cts +8 -175
  61. package/dist/headless.d.ts +8 -175
  62. package/dist/headless.js +1 -1
  63. package/dist/index.cjs +9 -378
  64. package/dist/index.d.cts +17 -4161
  65. package/dist/index.d.ts +17 -4161
  66. package/dist/index.js +9 -378
  67. package/dist/insertOperations-CzB5b-Of.d.ts +176 -0
  68. package/dist/insertOperations-DKVmCV32.d.cts +176 -0
  69. package/dist/mcp-cli.js +21 -21
  70. package/dist/mcp.cjs +10 -10
  71. package/dist/mcp.d.cts +2 -1
  72. package/dist/mcp.d.ts +2 -1
  73. package/dist/mcp.js +9 -9
  74. package/dist/processTemplate-BHBTDAIC.js +1 -0
  75. package/dist/processTemplate-QOEAXCKA.cjs +1 -0
  76. package/dist/react-Be1YOl4z.d.ts +1356 -0
  77. package/dist/react-DPuSVbgY.d.cts +1356 -0
  78. package/dist/react.cjs +1 -0
  79. package/dist/react.css +1 -0
  80. package/dist/react.d.cts +9 -0
  81. package/dist/react.d.ts +9 -0
  82. package/dist/react.js +1 -0
  83. package/dist/{registry-CzqAPdui.d.ts → registry-D4tvj9f3.d.ts} +1 -1
  84. package/dist/{registry-BUTMLqSj.d.cts → registry-ngv6Bumt.d.cts} +1 -1
  85. package/dist/types-D96elyJF.d.cts +310 -0
  86. package/dist/types-xMzSPT4i.d.ts +310 -0
  87. package/dist/ui.cjs +1 -0
  88. package/dist/ui.d.cts +2103 -0
  89. package/dist/ui.d.ts +2103 -0
  90. package/dist/ui.js +1 -0
  91. package/dist/variableDetector-CPxKo9jP.d.cts +173 -0
  92. package/dist/variableDetector-DeM1N-_L.d.ts +173 -0
  93. package/package.json +85 -10
  94. package/dist/chunk-GQ4JYQWC.js +0 -58
  95. package/dist/chunk-H3JNHCD7.cjs +0 -10
  96. package/dist/chunk-L2UUZRZI.js +0 -10
  97. package/dist/chunk-QOIY4Y6N.cjs +0 -9
  98. package/dist/chunk-QYKJKSKZ.cjs +0 -58
  99. package/dist/chunk-TPUJJJWA.js +0 -9
package/dist/index.d.ts CHANGED
@@ -1,4067 +1,20 @@
1
- import * as React$1 from 'react';
2
- import React__default, { CSSProperties, ReactNode, Component, ErrorInfo } from 'react';
3
- import * as prosemirror_view from 'prosemirror-view';
4
- import { EditorView, DecorationSet } from 'prosemirror-view';
1
+ import { P as PluginPanelProps, E as EditorPlugin } from './react-Be1YOl4z.js';
2
+ export { A as AutoSaveStatus, C as ClipboardSelection, D as DEFAULT_SELECTION_STYLE, a as DocxEditor, b as DocxEditorHandle, c as DocxEditorProps, d as DocxEditorRef, e as ErrorBoundary, f as ErrorBoundaryProps, g as ErrorContextValue, h as ErrorNotification, i as ErrorProvider, j as ErrorSeverity, H as HIGH_CONTRAST_SELECTION_STYLE, k as HighlightRect, l as PLUGIN_HOST_STYLES, m as PanelConfig, n as ParseErrorDisplay, o as ParseErrorDisplayProps, p as PluginContext, q as PluginHost, r as PluginHostProps, s as PluginHostRef, R as RenderAsyncOptions, S as SELECTION_CSS_VARS, t as SavedDocumentData, u as SelectionHighlightConfig, v as SelectionOverlayProps, w as SelectionRange, T as TABLE_DATA_ATTRIBUTES, x as TableSelectionState, U as UnsupportedFeatureWarning, y as UnsupportedFeatureWarningProps, z as UseAutoSaveOptions, B as UseAutoSaveReturn, F as UseClipboardOptions, G as UseClipboardReturn, I as UseSelectionHighlightOptions, J as UseSelectionHighlightReturn, K as UseTableSelectionOptions, L as UseTableSelectionReturn, M as UseWheelZoomOptions, N as UseWheelZoomReturn, Z as ZOOM_PRESETS, O as areSelectionStylesInjected, Q as clampZoom, V as clearSelection, W as createSelectionChangeHandler, X as createSelectionFromDOM, Y as findNearestZoomPreset, _ as formatLastSaveTime, $ as formatStorageSize, a0 as formatZoom, a1 as generateOverlayElements, a2 as generateSelectionCSS, a3 as getAutoSaveStatusLabel, a4 as getAutoSaveStorageSize, a5 as getHighlightRectStyle, a6 as getMergedSelectionRects, a7 as getNextZoomPreset, a8 as getPreviousZoomPreset, a9 as getSelectedText, aa as getSelectionBoundingRect, ab as getSelectionRects, ac as getSelectionRuns, ad as getUserFriendlyMessage, ae as getZoomPresets, af as hasActiveSelection, ag as highlightTextRange, ah as injectSelectionStyles, ai as isAutoSaveSupported, aj as isParseError, ak as isSelectionBackwards, al as isSelectionWithin, am as isZoomPreset, an as mergeAdjacentRects, ao as normalizeSelectionDirection, ap as parseZoom, aq as removeSelectionStyles, ar as renderAsync, as as selectRange, at as useAutoSave, au as useClipboard, av as useErrorNotifications, aw as useSelectionHighlight, ax as useTableSelection, ay as useWheelZoom } from './react-Be1YOl4z.js';
3
+ export { D as DocumentAgent, a as DocxInput, t as toArrayBuffer } from './DocumentAgent-Ci6_T-XM.js';
4
+ export { A as AgentContextOptions, C as CreateEmptyDocumentOptions, E as ExtendedSelectionContext, P as ProcessTemplateOptions, a as ProcessTemplateResult, S as SelectionContextOptions, b as blendColors, c as buildExtendedSelectionContext, d as buildSelectionContext, e as colorsEqual, f as createDocumentWithText, g as createEmptyDocument, h as createRgbColor, i as createThemeColor, j as darkenColor, k as emuToPixels, l as emuToTwips, m as executeCommand, n as executeCommands, o as formatPx, p as getAgentContext, q as getContrastingColor, r as getDocumentSummary, s as getTemplateTags, t as halfPointsToPixels, u as isBlack, v as isWhite, w as lightenColor, x as parseColorString, y as parseDocx, z as pixelsToEmu, B as pixelsToTwips, D as pointsToPixels, F as processTemplate, G as processTemplateAsBlob, H as processTemplateDetailed, I as resolveColor, J as resolveHighlightColor, K as resolveShadingColor, L as serializeDocumentBody, M as serializeDocx, N as serializeSectionProperties, O as twipsToEmu, Q as twipsToPixels, R as validateTemplate } from './colorResolver-KXbUgzWC.js';
5
+ 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 './insertOperations-CzB5b-Of.js';
6
+ export { AlignmentButtons, AlignmentButtonsProps, CellBackgroundPicker, CellBackgroundPickerProps, CellColorOption, ColorOption, ColorPicker, ColorPickerProps, ContextMenu, ContextMenuProps, DEFAULT_CELL_COLORS, DialogKeyboardShortcut, FindMatch, FindOptions, FindReplaceDialog, FindReplaceDialogProps, FindReplaceOptions, FindReplaceState, FindResult, FontOption, FontPicker, FontPickerProps, FontSizePicker, FontSizePickerProps, HighlightOptions, HorizontalRuler, HorizontalRulerProps, HyperlinkData, HyperlinkDialog, HyperlinkDialogProps, ImageData, IndicatorPosition, IndicatorVariant, InsertImageDialog, InsertImageDialogProps, InsertSymbolDialog, InsertSymbolDialogProps, InsertTableDialog, InsertTableDialogProps, KeyboardShortcutsDialog, KeyboardShortcutsDialogProps, LineSpacingOption, LineSpacingPicker, LineSpacingPickerProps, ListButtons, ListButtonsProps, ListState, LoadingIndicator, LoadingIndicatorProps, LoadingOperation, LoadingSize, LoadingVariant, PasteOption, PasteSpecialDialog, PasteSpecialDialogProps, ResponsePreview, ResponsePreviewProps, ResponsePreviewState, ResponsiveToolbar, ResponsiveToolbarGroup, ResponsiveToolbarGroupProps, ResponsiveToolbarProps, SYMBOL_CATEGORIES, ShortcutCategory, StyleOption, StylePicker, StylePickerProps, SymbolCategory, TableBorderColorPicker, TableBorderColorPickerProps, TableBorderPicker, TableBorderPickerProps, TableBorderWidthPicker, TableBorderWidthPickerProps, TableCellFillPicker, TableCellFillPickerProps, TableConfig, TableInsertButtons, TableInsertButtonsProps, TableMergeButton, TableMergeButtonProps, TableMoreDropdown, TableMoreDropdownProps, TextContextAction, TextContextMenu, TextContextMenuItem, TextContextMenuProps, Toolbar, ToolbarButton, ToolbarGroup, ToolbarItem, ToolbarItemPriority, ToolbarProps, ToolbarSeparator, UnsavedIndicator, UnsavedIndicatorProps, UseFindReplaceReturn, UseKeyboardShortcutsDialogOptions, UseKeyboardShortcutsDialogReturn, UseLoadingOptions, UseLoadingReturn, UsePasteSpecialOptions, UsePasteSpecialReturn, UseResponsiveToolbarOptions, UseResponsiveToolbarReturn, UseTextContextMenuOptions, UseTextContextMenuReturn, UseUnsavedChangesOptions, UseUnsavedChangesReturn, VariablePanel, VariablePanelProps, ZoomControl, ZoomControlProps, calculateFitDimensions, clampTableConfig, createCellColorOption, createChangeTracker, createDefaultFindOptions, createDefaultListState, createDefaultTableConfig, createErrorResponse, createMockResponse, createSearchPattern, createShadingFromColor, createToolbarItem, createToolbarItems, dataUrlToBlob, delay, escapeRegexString, findAllMatches, findInDocument, findInParagraph, formatFileSize, formatShortcutKeys, formatTableDimensions, getActionShortcut, getAllActions, getAllCategories, getAllIndicatorPositions, getAllIndicatorVariants, getAllLoadingSizes, getAllLoadingVariants, getAllPasteOptions, getCategoryLabel, getCellColorName, getColorFromShading, getCommonShortcuts, getContrastingTextColor, getDefaultActions, getDefaultCellColors, getDefaultHighlightOptions, getDefaultPasteOption, getDefaultShortcuts, getDefaultTextContextMenuItems, getImageAcceptString, getImageDimensions, getLoadingVariantLabel, getMarginInUnits, getMatchCountText, getPasteOption, getRecommendedPriority, getRulerDimensions, getShortcutsByCategory, getSupportedImageExtensions, getSymbolCategories, getSymbolUnicodeInfo, getSymbolsByCategory, getTablePresets, getTextActionLabel, getTextActionShortcut, getVariantLabel, isActionAvailable, isDefaultCellColor, isEmptySearch, isPasteSpecialShortcut, isTextActionAvailable, isValidImageFile, isValidTableConfig, parseMarginFromUnits, positionToMargin, replaceAllInContent, replaceFirstInContent, scrollToMatch, searchSymbols, symbolFromCodePoint, useContextMenu, useFindReplace, useHyperlinkDialog, useInsertImageDialog, useInsertSymbolDialog, useInsertTableDialog, useKeyboardShortcutsDialog, useLoading, useLoadingOperations, usePasteSpecial, useResponsePreview, useResponsiveToolbar, useTextContextMenu, useUnsavedChanges } from './ui.js';
7
+ export { C as CLIPBOARD_TYPES, a as ClipboardContent, b as ClipboardOptions, I as INTERNAL_CLIPBOARD_TYPE, P as PageIndicatorPosition, c as PageIndicatorVariant, d as PageNavigator, e as PageNavigatorPosition, f as PageNavigatorProps, g as PageNavigatorVariant, h as PageNumberIndicator, i as PageNumberIndicatorProps, j as ParsedClipboardContent, k as PrintButton, l as PrintButtonProps, m as PrintOptions, n as PrintStyles, T as TableAction, o as TableContext, p as TableSelection, q as TableToolbar, r as TableToolbarProps, s as addColumn, t as addRow, u as calculateProgress, v as calculateScrollToPage, w as calculateVisiblePage, x as clampPageNumber, y as cleanWordHtml, z as copyParagraphs, A as copyRuns, B as createClipboardHandlers, D as createPageFormat, E as createTableContext, F as deleteColumn, G as deleteRow, H as formatPageOrdinal, J as formatPageRange, K as formatPrintPageRange, L as getCellAt, M as getColumnCount, N as getDefaultPrintOptions, O as getNavigationShortcuts, Q as getPageProgress, R as handlePasteEvent, S as htmlToRuns, U as isEditorHtml, V as isFirstPage, W as isLastPage, X as isPrintSupported, Y as isValidPageNumber, Z as isWordHtml, _ as mergeCells, $ as openPrintWindow, a0 as paragraphsToClipboardContent, a1 as parseClipboardHtml, a2 as parsePageInput, a3 as parsePageRange, a4 as readFromClipboard, a5 as runsToClipboardContent, a6 as splitCell, a7 as triggerPrint, a8 as writeToClipboard } from './clipboard-BOocwmAM.js';
8
+ export { A as AIAction, a as AIActionRequest, b as AgentCommand, c as AgentContext, d as AgentResponse, e as ApplyStyleCommand, B as BlockContent, f as BookmarkEnd, g as BookmarkStart, D as DeleteTextCommand, h as Document, i as DocumentBody, j as DocxPackage, E as Endnote, F as Field, k as FooterReference, l as Footnote, m as FormatTextCommand, H as HeaderFooter, n as HeaderReference, o as Hyperlink, I as Image, p as InsertHyperlinkCommand, q as InsertImageCommand, r as InsertTableCommand, s as InsertTextCommand, L as ListLevel, N as NumberingDefinitions, P as Paragraph, t as ParagraphContext, u as ParagraphFormatting, v as Position, R as Range, w as Relationship, x as ReplaceTextCommand, y as Run, z as RunContent, S as SectionProperties, C as SelectionContext, G as SetVariableCommand, J as Shape, K as Style, M as StyleDefinitions, O as SuggestedAction, T as Table, Q as TableCell, U as TableRow, V as TextBox, W as TextContent, X as TextFormatting, Y as Theme, Z as ThemeColorScheme, _ as ThemeFont, $ as ThemeFontScheme } from './agentApi-CbVUCZRu.js';
5
9
  import * as prosemirror_state from 'prosemirror-state';
6
- import { Plugin, EditorState, Transaction, PluginKey } from 'prosemirror-state';
7
- import { T as TextFormatting, U as ParagraphFormatting, h as Document, ab as Theme, f as Table, a8 as TableCell, an as ParagraphAlignment, a4 as Style, a2 as SelectionContext, A as AIAction, l as AgentResponse, ao as StyleType, a1 as SectionProperties, ap as TabStop, aq as ShadingProperties, R as Run, e as Paragraph, ar as BreakContent, $ as RunContent } from './types-BALm1KBi.js';
8
- export { i as AIActionRequest, j as AgentCommand, k as AgentContext, m as ApplyStyleCommand, B as BlockContent, as as BookmarkEnd, at as BookmarkStart, C as CorePlugin, q as DeleteTextCommand, D as DocumentBody, r as DocxPackage, E as Endnote, au as Field, av as FooterReference, F as Footnote, t as FormatTextCommand, aw as HeaderFooter, ax as HeaderReference, H as Hyperlink, I as Image, u as InsertHyperlinkCommand, v as InsertImageCommand, w as InsertTableCommand, x as InsertTextCommand, L as ListLevel, d as McpSession, M as McpToolDefinition, N as McpToolHandler, O as McpToolResult, Q as NumberingDefinitions, S as ParagraphContext, g as Position, Y as Range, Z as Relationship, _ as ReplaceTextCommand, a3 as SetVariableCommand, ay as Shape, a5 as StyleDefinitions, a7 as SuggestedAction, a9 as TableRow, az as TextBox, aa as TextContent, aA as ThemeColorScheme, aB as ThemeFont, aC as ThemeFontScheme } from './types-BALm1KBi.js';
9
- import { a8 as DocxInput, D as DocumentAgent } from './colorResolver-BNj-uZ58.js';
10
- export { A as AgentContextOptions, C as CreateEmptyDocumentOptions, E as ExtendedSelectionContext, P as ProcessTemplateOptions, e as ProcessTemplateResult, f as SelectionContextOptions, g as blendColors, h as buildExtendedSelectionContext, i as buildSelectionContext, k as colorsEqual, n as createDocumentWithText, o as createEmptyDocument, p as createRgbColor, r as createThemeColor, s as darkenColor, t as emuToPixels, u as emuToTwips, v as executeCommand, w as executeCommands, x as formatPx, y as getAgentContext, z as getContrastingColor, B as getDocumentSummary, J as getTemplateTags, K as halfPointsToPixels, L as isBlack, M as isWhite, N as lightenColor, O as parseColorString, Q as parseDocx, R as pixelsToEmu, U as pixelsToTwips, V as pointsToPixels, X as processTemplate, Z as processTemplateAsBlob, _ as processTemplateDetailed, $ as resolveColor, a0 as resolveHighlightColor, a1 as resolveShadingColor, a2 as serializeDocumentBody, a3 as serializeDocx, a4 as serializeSectionProperties, a9 as toArrayBuffer, a5 as twipsToEmu, a6 as twipsToPixels, a7 as validateTemplate } from './colorResolver-BNj-uZ58.js';
11
- import { Node as Node$1 } from 'prosemirror-model';
12
- import * as react_jsx_runtime from 'react/jsx-runtime';
13
- export { P as PluginRegistry, p as pluginRegistry, r as registerPlugins } from './registry-CzqAPdui.js';
14
- export { docxtemplaterPlugin } from './core-plugins.js';
15
-
16
- /**
17
- * PageNumberIndicator Component
18
- *
19
- * Displays the current page number and total page count.
20
- * Can be used as a floating indicator or status bar element.
21
- */
22
-
23
- /**
24
- * Position options for the indicator
25
- */
26
- type PageIndicatorPosition = 'bottom-left' | 'bottom-center' | 'bottom-right' | 'top-left' | 'top-center' | 'top-right';
27
- /**
28
- * Style variant for the indicator
29
- */
30
- type PageIndicatorVariant = 'default' | 'minimal' | 'badge' | 'pill';
31
- /**
32
- * Props for PageNumberIndicator
33
- */
34
- interface PageNumberIndicatorProps {
35
- /** Current page number (1-indexed) */
36
- currentPage: number;
37
- /** Total number of pages */
38
- totalPages: number;
39
- /** Position of the indicator (default: 'bottom-center') */
40
- position?: PageIndicatorPosition;
41
- /** Style variant (default: 'default') */
42
- variant?: PageIndicatorVariant;
43
- /** Whether to show as floating overlay (default: true) */
44
- floating?: boolean;
45
- /** Whether to show "Page" prefix (default: true) */
46
- showPrefix?: boolean;
47
- /** Custom format function for the display text */
48
- formatText?: (current: number, total: number) => string;
49
- /** Callback when page number is clicked (for navigation) */
50
- onClick?: () => void;
51
- /** Whether the indicator is disabled */
52
- disabled?: boolean;
53
- /** Additional CSS class name */
54
- className?: string;
55
- /** Additional inline styles */
56
- style?: CSSProperties;
57
- /** Custom content (overrides default display) */
58
- children?: ReactNode;
59
- }
60
- /**
61
- * PageNumberIndicator - Displays current page and total pages
62
- */
63
- declare function PageNumberIndicator({ currentPage, totalPages, position, variant, floating, showPrefix, formatText, onClick, disabled, className, style, children, }: PageNumberIndicatorProps): React__default.ReactElement;
64
- /**
65
- * Format page number with ordinal suffix (1st, 2nd, 3rd, etc.)
66
- */
67
- declare function formatPageOrdinal(page: number): string;
68
- /**
69
- * Create a custom format function
70
- */
71
- declare function createPageFormat(template: string): (current: number, total: number) => string;
72
- /**
73
- * Get percentage progress through document
74
- */
75
- declare function getPageProgress(current: number, total: number): number;
76
- /**
77
- * Check if at first page
78
- */
79
- declare function isFirstPage(current: number): boolean;
80
- /**
81
- * Check if at last page
82
- */
83
- declare function isLastPage(current: number, total: number): boolean;
84
- /**
85
- * Calculate which page is visible given scroll position
86
- */
87
- declare function calculateVisiblePage(scrollTop: number, pageHeights: number[], pageGap?: number): number;
88
- /**
89
- * Calculate scroll position to center a page
90
- */
91
- declare function calculateScrollToPage(pageNumber: number, pageHeights: number[], containerHeight: number, pageGap?: number): number;
92
-
93
- /**
94
- * PageNavigator Component
95
- *
96
- * Provides UI for navigating between pages in a paginated document.
97
- * Includes:
98
- * - Previous/Next page buttons
99
- * - Current page display (clickable to show input)
100
- * - Page number input for direct navigation
101
- * - Keyboard navigation support
102
- */
103
-
104
- /**
105
- * Position options for the navigator
106
- */
107
- type PageNavigatorPosition = 'bottom-left' | 'bottom-center' | 'bottom-right' | 'top-left' | 'top-center' | 'top-right';
108
- /**
109
- * Style variant for the navigator
110
- */
111
- type PageNavigatorVariant = 'default' | 'compact' | 'minimal';
112
- /**
113
- * Props for PageNavigator
114
- */
115
- interface PageNavigatorProps {
116
- /** Current page number (1-indexed) */
117
- currentPage: number;
118
- /** Total number of pages */
119
- totalPages: number;
120
- /** Callback when page navigation is requested */
121
- onNavigate: (pageNumber: number) => void;
122
- /** Position of the navigator (default: 'bottom-center') */
123
- position?: PageNavigatorPosition;
124
- /** Style variant (default: 'default') */
125
- variant?: PageNavigatorVariant;
126
- /** Whether to show as floating overlay (default: true) */
127
- floating?: boolean;
128
- /** Whether to show previous/next buttons (default: true) */
129
- showButtons?: boolean;
130
- /** Whether the navigator is disabled */
131
- disabled?: boolean;
132
- /** Additional CSS class name */
133
- className?: string;
134
- /** Additional inline styles */
135
- style?: CSSProperties;
136
- }
137
- /**
138
- * PageNavigator - Navigation controls for paginated documents
139
- */
140
- declare function PageNavigator({ currentPage, totalPages, onNavigate, position, variant, floating, showButtons, disabled, className, style, }: PageNavigatorProps): React__default.ReactElement;
141
- /**
142
- * Calculate page number from keyboard input
143
- */
144
- declare function parsePageInput(input: string): number | null;
145
- /**
146
- * Validate page number
147
- */
148
- declare function isValidPageNumber(page: number, totalPages: number): boolean;
149
- /**
150
- * Clamp page number to valid range
151
- */
152
- declare function clampPageNumber(page: number, totalPages: number): number;
153
- /**
154
- * Get navigation info for keyboard shortcuts
155
- */
156
- declare function getNavigationShortcuts(): Array<{
157
- key: string;
158
- description: string;
159
- }>;
160
- /**
161
- * Format page range for display
162
- */
163
- declare function formatPageRange$1(start: number, end: number, total: number): string;
164
- /**
165
- * Calculate progress percentage
166
- */
167
- declare function calculateProgress(current: number, total: number): number;
168
-
169
- /**
170
- * Print Utilities
171
- *
172
- * Provides print functionality with:
173
- * - Print button component for toolbar
174
- * - Print-specific CSS styles
175
- * - Browser print dialog trigger
176
- * - Page range utilities
177
- */
178
-
179
- /**
180
- * Print options
181
- */
182
- interface PrintOptions {
183
- /** Whether to include headers */
184
- includeHeaders?: boolean;
185
- /** Whether to include footers */
186
- includeFooters?: boolean;
187
- /** Whether to include page numbers */
188
- includePageNumbers?: boolean;
189
- /** Page range to print (null = all) */
190
- pageRange?: {
191
- start: number;
192
- end: number;
193
- } | null;
194
- /** Scale factor for printing (1.0 = 100%) */
195
- scale?: number;
196
- /** Whether to show background colors */
197
- printBackground?: boolean;
198
- /** Margins mode */
199
- margins?: 'default' | 'none' | 'minimum';
200
- }
201
- /**
202
- * PrintButton props
203
- */
204
- interface PrintButtonProps {
205
- /** Callback when print is triggered */
206
- onPrint: () => void;
207
- /** Whether the button is disabled */
208
- disabled?: boolean;
209
- /** Button label */
210
- label?: string;
211
- /** Additional CSS class */
212
- className?: string;
213
- /** Additional inline styles */
214
- style?: CSSProperties;
215
- /** Show icon */
216
- showIcon?: boolean;
217
- /** Compact mode */
218
- compact?: boolean;
219
- }
220
- /**
221
- * PrintButton - Standalone print button for toolbar
222
- */
223
- declare function PrintButton({ onPrint, disabled, label, className, style, showIcon, compact, }: PrintButtonProps): React__default.ReactElement;
224
- /**
225
- * PrintStyles - Injects print-specific CSS
226
- */
227
- declare function PrintStyles(): React__default.ReactElement;
228
- /**
229
- * Trigger browser print dialog for the current document
230
- */
231
- declare function triggerPrint(): void;
232
- /**
233
- * Create print-optimized document view in a new window
234
- */
235
- declare function openPrintWindow(title: string | undefined, content: string): Window | null;
236
- /**
237
- * Get default print options
238
- */
239
- declare function getDefaultPrintOptions(): PrintOptions;
240
- /**
241
- * Create page range from string (e.g., "1-5", "3", "1,3,5")
242
- */
243
- declare function parsePageRange(input: string, maxPages: number): {
244
- start: number;
245
- end: number;
246
- } | null;
247
- /**
248
- * Format page range for display
249
- */
250
- declare function formatPageRange(range: {
251
- start: number;
252
- end: number;
253
- } | null, totalPages: number): string;
254
- /**
255
- * Check if browser supports good print functionality
256
- */
257
- declare function isPrintSupported(): boolean;
258
-
259
- /**
260
- * Selection State Utilities
261
- *
262
- * Extracts selection state from ProseMirror for toolbar integration.
263
- */
264
-
265
- /**
266
- * Selection state for toolbar integration
267
- */
268
- interface SelectionState {
269
- /** Whether there's an active selection (not just cursor) */
270
- hasSelection: boolean;
271
- /** Whether selection spans multiple paragraphs */
272
- isMultiParagraph: boolean;
273
- /** Current text formatting at selection/cursor */
274
- textFormatting: TextFormatting;
275
- /** Current paragraph formatting */
276
- paragraphFormatting: ParagraphFormatting;
277
- /** Current paragraph style ID (e.g., 'Heading1', 'Normal') */
278
- styleId: string | null;
279
- /** Start paragraph index */
280
- startParagraphIndex: number;
281
- /** End paragraph index */
282
- endParagraphIndex: number;
283
- }
284
-
285
- /**
286
- * Layout Engine Types
287
- *
288
- * Core types for the paginated layout engine.
289
- * Converts document blocks + measurements into positioned fragments on pages.
290
- */
291
- /**
292
- * Unique identifier for a block in the document.
293
- * Format: typically `${index}-${type}` or just the block index.
294
- */
295
- type BlockId = string | number;
296
- /**
297
- * Base fragment properties common to all fragment types.
298
- */
299
- type FragmentBase = {
300
- /** Block ID this fragment belongs to. */
301
- blockId: BlockId;
302
- /** X position on page (relative to page left). */
303
- x: number;
304
- /** Y position on page (relative to page top). */
305
- y: number;
306
- /** Width of the fragment. */
307
- width: number;
308
- /** ProseMirror start position (for click mapping). */
309
- pmStart?: number;
310
- /** ProseMirror end position (for click mapping). */
311
- pmEnd?: number;
312
- };
313
- /**
314
- * A paragraph fragment positioned on a page.
315
- * May span only part of the paragraph's lines if split across pages.
316
- */
317
- type ParagraphFragment = FragmentBase & {
318
- kind: 'paragraph';
319
- /** First line index (inclusive) from the measure. */
320
- fromLine: number;
321
- /** Last line index (exclusive) from the measure. */
322
- toLine: number;
323
- /** Height of this fragment. */
324
- height: number;
325
- /** True if this continues from a previous page. */
326
- continuesFromPrev?: boolean;
327
- /** True if this continues onto the next page. */
328
- continuesOnNext?: boolean;
329
- };
330
- /**
331
- * A table fragment positioned on a page.
332
- * May span only part of the table's rows if split across pages.
333
- */
334
- type TableFragment = FragmentBase & {
335
- kind: 'table';
336
- /** First row index (inclusive). */
337
- fromRow: number;
338
- /** Last row index (exclusive). */
339
- toRow: number;
340
- /** Height of this fragment. */
341
- height: number;
342
- /** True if this is a floating table. */
343
- isFloating?: boolean;
344
- /** True if this continues from a previous page. */
345
- continuesFromPrev?: boolean;
346
- /** True if this continues onto the next page. */
347
- continuesOnNext?: boolean;
348
- };
349
- /**
350
- * An image fragment positioned on a page.
351
- */
352
- type ImageFragment = FragmentBase & {
353
- kind: 'image';
354
- /** Height of the image. */
355
- height: number;
356
- /** True if this is an anchored/floating image. */
357
- isAnchored?: boolean;
358
- /** Z-index for layering. */
359
- zIndex?: number;
360
- };
361
- /**
362
- * Union of all fragment types.
363
- */
364
- type Fragment = ParagraphFragment | TableFragment | ImageFragment;
365
- /**
366
- * Page margin configuration.
367
- */
368
- type PageMargins = {
369
- top: number;
370
- right: number;
371
- bottom: number;
372
- left: number;
373
- /** Distance from page top to header content. */
374
- header?: number;
375
- /** Distance from page bottom to footer content. */
376
- footer?: number;
377
- };
378
- /**
379
- * A rendered page containing positioned fragments.
380
- */
381
- type Page = {
382
- /** Page number (1-indexed). */
383
- number: number;
384
- /** Fragments positioned on this page. */
385
- fragments: Fragment[];
386
- /** Page margins. */
387
- margins: PageMargins;
388
- /** Page size (width, height). */
389
- size: {
390
- w: number;
391
- h: number;
392
- };
393
- /** Page orientation. */
394
- orientation?: 'portrait' | 'landscape';
395
- /** Section index this page belongs to. */
396
- sectionIndex?: number;
397
- /** Header/footer references for this page. */
398
- headerFooterRefs?: {
399
- headerDefault?: string;
400
- headerFirst?: string;
401
- headerEven?: string;
402
- footerDefault?: string;
403
- footerFirst?: string;
404
- footerEven?: string;
405
- };
406
- /** Footnote IDs that appear on this page (for rendering). */
407
- footnoteIds?: number[];
408
- /** Height reserved for the footnote area at page bottom (pixels). */
409
- footnoteReservedHeight?: number;
410
- };
411
- /**
412
- * Column layout configuration.
413
- */
414
- type ColumnLayout = {
415
- count: number;
416
- gap: number;
417
- equalWidth?: boolean;
418
- };
419
- /**
420
- * Header/footer layout for a specific type.
421
- */
422
- type HeaderFooterLayout = {
423
- height: number;
424
- fragments: Fragment[];
425
- };
426
- /**
427
- * Final layout output ready for rendering/painting.
428
- */
429
- type Layout = {
430
- /** Default page size for the document. */
431
- pageSize: {
432
- w: number;
433
- h: number;
434
- };
435
- /** All rendered pages with positioned fragments. */
436
- pages: Page[];
437
- /** Column configuration (if multi-column). */
438
- columns?: ColumnLayout;
439
- /** Header layouts by type (default, first, even). */
440
- headers?: Record<string, HeaderFooterLayout>;
441
- /** Footer layouts by type (default, first, even). */
442
- footers?: Record<string, HeaderFooterLayout>;
443
- /** Gap between pages in pixels (for rendering). */
444
- pageGap?: number;
445
- };
446
-
447
- /**
448
- * Generic Plugin Interface for the DOCX Editor
449
- *
450
- * This module defines the EditorPlugin interface that allows
451
- * external plugins to integrate with the ProseMirror-based editor.
452
- */
453
-
454
- /**
455
- * Coordinates returned by position lookup in the rendered DOM.
456
- */
457
- interface PositionCoordinates {
458
- x: number;
459
- y: number;
460
- height: number;
461
- }
462
- /**
463
- * Context for accessing the rendered DOM in PagedEditor.
464
- *
465
- * This interface provides DOM-based position mapping that works with
466
- * the LayoutPainter output (visible pages) rather than the hidden
467
- * ProseMirror editor. Use this for rendering overlays, annotations,
468
- * and other visual elements that need to be positioned relative to
469
- * the actual rendered content.
470
- *
471
- * The rendered DOM uses data-pm-start/data-pm-end attributes on spans
472
- * to map between ProseMirror positions and DOM elements.
473
- */
474
- interface RenderedDomContext {
475
- /** The container element holding all rendered pages. */
476
- pagesContainer: HTMLElement;
477
- /**
478
- * Get pixel coordinates for a ProseMirror position in the rendered DOM.
479
- * Returns null if the position cannot be found.
480
- *
481
- * @param pmPos - ProseMirror document position
482
- * @returns Coordinates relative to the pages container, or null
483
- */
484
- getCoordinatesForPosition(pmPos: number): PositionCoordinates | null;
485
- /**
486
- * Find DOM elements that overlap with a ProseMirror position range.
487
- * Useful for highlighting or overlaying content.
488
- *
489
- * @param from - Start ProseMirror position
490
- * @param to - End ProseMirror position
491
- * @returns Array of DOM elements that intersect with the range
492
- */
493
- findElementsForRange(from: number, to: number): Element[];
494
- /**
495
- * Get bounding rectangles for a range of text, accounting for line wraps.
496
- * Returns rects relative to the pages container.
497
- *
498
- * @param from - Start ProseMirror position
499
- * @param to - End ProseMirror position
500
- * @returns Array of DOMRect-like objects for the range
501
- */
502
- getRectsForRange(from: number, to: number): Array<{
503
- x: number;
504
- y: number;
505
- width: number;
506
- height: number;
507
- }>;
508
- /** Current zoom level (1 = 100%). */
509
- zoom: number;
510
- /**
511
- * Offset of the pages container from its parent viewport.
512
- * Use this to adjust coordinates when rendering overlays in the viewport
513
- * container rather than directly in the pages container.
514
- */
515
- getContainerOffset(): {
516
- x: number;
517
- y: number;
518
- };
519
- }
520
- /**
521
- * Props passed to plugin panel components.
522
- */
523
- interface PluginPanelProps<TState = unknown> {
524
- /** Current ProseMirror editor view */
525
- editorView: EditorView | null;
526
- /** Current ProseMirror document */
527
- doc: Node$1 | null;
528
- /** Scroll editor to a specific position */
529
- scrollToPosition: (pos: number) => void;
530
- /** Select a range in the editor */
531
- selectRange: (from: number, to: number) => void;
532
- /** Plugin-specific state (managed by the plugin) */
533
- pluginState: TState;
534
- /** Width of the panel in pixels */
535
- panelWidth: number;
536
- /**
537
- * Context for the rendered DOM (LayoutPainter output).
538
- * Use this for positioning annotations relative to the visible pages.
539
- * May be null if layout hasn't completed yet.
540
- */
541
- renderedDomContext: RenderedDomContext | null;
542
- }
543
- /**
544
- * Configuration for plugin panel rendering.
545
- */
546
- interface PanelConfig {
547
- /** Where to render the panel */
548
- position: 'left' | 'right' | 'bottom';
549
- /** Default width/height of the panel */
550
- defaultSize: number;
551
- /** Minimum size */
552
- minSize?: number;
553
- /** Maximum size */
554
- maxSize?: number;
555
- /** Whether the panel is resizable */
556
- resizable?: boolean;
557
- /** Whether the panel can be collapsed */
558
- collapsible?: boolean;
559
- /** Initial collapsed state */
560
- defaultCollapsed?: boolean;
561
- }
562
- /**
563
- * Generic interface for editor plugins.
564
- *
565
- * Implement this interface to create custom plugins that can:
566
- * - Add ProseMirror plugins (decorations, keymaps, etc.)
567
- * - Render panels alongside the document
568
- * - React to editor state changes
569
- * - Inject custom styles
570
- *
571
- * @typeParam TState - The type of plugin-specific state
572
- */
573
- interface EditorPlugin<TState = any> {
574
- /** Unique plugin identifier */
575
- id: string;
576
- /** Display name for the plugin */
577
- name: string;
578
- /**
579
- * ProseMirror plugins to register with the editor.
580
- * These are merged with the editor's internal plugins.
581
- */
582
- proseMirrorPlugins?: Plugin[];
583
- /**
584
- * React component to render in the annotation panel area.
585
- * Receives editor state and callbacks for interaction.
586
- */
587
- Panel?: React.ComponentType<PluginPanelProps<TState>>;
588
- /**
589
- * Configuration for the panel (position, size, etc.)
590
- */
591
- panelConfig?: PanelConfig;
592
- /**
593
- * Called when the editor state changes.
594
- * Use this to update plugin-specific state based on document changes.
595
- *
596
- * @param view - The current ProseMirror editor view
597
- * @returns The new plugin state, or undefined to keep existing state
598
- */
599
- onStateChange?: (view: EditorView) => TState | undefined;
600
- /**
601
- * Initialize plugin state when the plugin is first loaded.
602
- *
603
- * @param view - The ProseMirror editor view (may be null initially)
604
- * @returns Initial plugin state
605
- */
606
- initialize?: (view: EditorView | null) => TState;
607
- /**
608
- * Called when the plugin is being destroyed.
609
- * Use this for cleanup (subscriptions, timers, etc.)
610
- */
611
- destroy?: () => void;
612
- /**
613
- * CSS styles to inject for this plugin.
614
- * Can be a string of CSS or a URL to a stylesheet.
615
- */
616
- styles?: string;
617
- /**
618
- * Render an overlay on top of the rendered pages.
619
- * Use this for highlights, annotations, or other visual elements
620
- * that need to be positioned relative to the document content.
621
- *
622
- * The overlay is rendered inside the viewport, positioned absolutely
623
- * over the pages container.
624
- *
625
- * @param context - The rendered DOM context for position lookup
626
- * @param state - Current plugin state
627
- * @param editorView - The editor view for dispatching transactions
628
- * @returns React node to render as overlay, or null
629
- */
630
- renderOverlay?: (context: RenderedDomContext, state: TState, editorView: EditorView | null) => ReactNode;
631
- }
632
- /**
633
- * Context value provided to plugins and panels.
634
- */
635
- interface PluginContext {
636
- /** All registered plugins */
637
- plugins: EditorPlugin[];
638
- /** Current editor view */
639
- editorView: EditorView | null;
640
- /** Set the editor view (called by editor on mount) */
641
- setEditorView: (view: EditorView | null) => void;
642
- /** Get plugin state by plugin ID */
643
- getPluginState: <T>(pluginId: string) => T | undefined;
644
- /** Update plugin state */
645
- setPluginState: <T>(pluginId: string, state: T) => void;
646
- /** Scroll to a position in the editor */
647
- scrollToPosition: (pos: number) => void;
648
- /** Select a range in the editor */
649
- selectRange: (from: number, to: number) => void;
650
- }
651
- /**
652
- * Props for the PluginHost component.
653
- */
654
- interface PluginHostProps {
655
- /** Plugins to enable */
656
- plugins: EditorPlugin[];
657
- /** The editor component (passed as child) */
658
- children: React.ReactElement;
659
- /** Class name for the host container */
660
- className?: string;
661
- }
662
- /**
663
- * Ref interface for the PluginHost component.
664
- */
665
- interface PluginHostRef {
666
- /** Get plugin state by plugin ID */
667
- getPluginState: <T>(pluginId: string) => T | undefined;
668
- /** Update plugin state for a plugin */
669
- setPluginState: <T>(pluginId: string, state: T) => void;
670
- /** Get the current editor view */
671
- getEditorView: () => EditorView | null;
672
- /** Force a refresh of all plugin states */
673
- refreshPluginStates: () => void;
674
- }
675
-
676
- interface PagedEditorRef {
677
- /** Get the current document. */
678
- getDocument(): Document | null;
679
- /** Get the ProseMirror EditorState. */
680
- getState(): EditorState | null;
681
- /** Get the ProseMirror EditorView. */
682
- getView(): EditorView | null;
683
- /** Focus the editor. */
684
- focus(): void;
685
- /** Blur the editor. */
686
- blur(): void;
687
- /** Check if focused. */
688
- isFocused(): boolean;
689
- /** Dispatch a transaction. */
690
- dispatch(tr: Transaction): void;
691
- /** Undo. */
692
- undo(): boolean;
693
- /** Redo. */
694
- redo(): boolean;
695
- /** Set selection by PM position. */
696
- setSelection(anchor: number, head?: number): void;
697
- /** Get current layout. */
698
- getLayout(): Layout | null;
699
- /** Force re-layout. */
700
- relayout(): void;
701
- /** Scroll the visible pages to bring a PM position into view. */
702
- scrollToPosition(pmPos: number): void;
703
- }
704
-
705
- /**
706
- * DocxEditor props
707
- */
708
- interface DocxEditorProps {
709
- /** Document data — ArrayBuffer, Uint8Array, Blob, or File */
710
- documentBuffer?: DocxInput | null;
711
- /** Pre-parsed document (alternative to documentBuffer) */
712
- document?: Document | null;
713
- /** Callback when document is saved */
714
- onSave?: (buffer: ArrayBuffer) => void;
715
- /** Callback when document changes */
716
- onChange?: (document: Document) => void;
717
- /** Callback when selection changes */
718
- onSelectionChange?: (state: SelectionState | null) => void;
719
- /** Callback on error */
720
- onError?: (error: Error) => void;
721
- /** Callback when fonts are loaded */
722
- onFontsLoaded?: () => void;
723
- /** External ProseMirror plugins (from PluginHost) */
724
- externalPlugins?: prosemirror_state.Plugin[];
725
- /** Callback when editor view is ready (for PluginHost) */
726
- onEditorViewReady?: (view: prosemirror_view.EditorView) => void;
727
- /** Theme for styling */
728
- theme?: Theme | null;
729
- /** Whether to show toolbar (default: true) */
730
- showToolbar?: boolean;
731
- /** Whether to show variable panel (default: true) */
732
- showVariablePanel?: boolean;
733
- /** Whether to show zoom control (default: true) */
734
- showZoomControl?: boolean;
735
- /** Whether to show page number indicator (default: true) */
736
- showPageNumbers?: boolean;
737
- /** Whether to enable interactive page navigation (default: true) */
738
- enablePageNavigation?: boolean;
739
- /** Position of page number indicator (default: 'bottom-center') */
740
- pageNumberPosition?: PageIndicatorPosition | PageNavigatorPosition;
741
- /** Variant of page number indicator (default: 'default') */
742
- pageNumberVariant?: PageIndicatorVariant | PageNavigatorVariant;
743
- /** Whether to show page margin guides/boundaries (default: false) */
744
- showMarginGuides?: boolean;
745
- /** Color for margin guides (default: '#c0c0c0') */
746
- marginGuideColor?: string;
747
- /** Whether to show horizontal ruler (default: false) */
748
- showRuler?: boolean;
749
- /** Unit for ruler display (default: 'inch') */
750
- rulerUnit?: 'inch' | 'cm';
751
- /** Initial zoom level (default: 1.0) */
752
- initialZoom?: number;
753
- /** Whether the editor is read-only. When true, hides toolbar, rulers, and variable panel */
754
- readOnly?: boolean;
755
- /** Custom toolbar actions */
756
- toolbarExtra?: ReactNode;
757
- /** Variable panel position (default: 'right') */
758
- variablePanelPosition?: 'left' | 'right';
759
- /** Variable descriptions */
760
- variableDescriptions?: Record<string, string>;
761
- /** Additional CSS class name */
762
- className?: string;
763
- /** Additional inline styles */
764
- style?: CSSProperties;
765
- /** Placeholder when no document */
766
- placeholder?: ReactNode;
767
- /** Loading indicator */
768
- loadingIndicator?: ReactNode;
769
- /** Whether to show the document outline sidebar (default: false) */
770
- showOutline?: boolean;
771
- /** Whether to show print button in toolbar (default: true) */
772
- showPrintButton?: boolean;
773
- /** Print options for print preview */
774
- printOptions?: PrintOptions;
775
- /** Callback when print is triggered */
776
- onPrint?: () => void;
777
- /** Callback when content is copied */
778
- onCopy?: () => void;
779
- /** Callback when content is cut */
780
- onCut?: () => void;
781
- /** Callback when content is pasted */
782
- onPaste?: () => void;
783
- /**
784
- * Callback when rendered DOM context is ready (for plugin overlays).
785
- * Used by PluginHost to get access to the rendered page DOM for positioning.
786
- */
787
- onRenderedDomContextReady?: (context: RenderedDomContext) => void;
788
- /**
789
- * Plugin overlays to render inside the editor viewport.
790
- * Passed from PluginHost to render plugin-specific overlays.
791
- */
792
- pluginOverlays?: ReactNode;
793
- }
794
- /**
795
- * DocxEditor ref interface
796
- */
797
- interface DocxEditorRef {
798
- /** Get the DocumentAgent for programmatic access */
799
- getAgent: () => DocumentAgent | null;
800
- /** Get the current document */
801
- getDocument: () => Document | null;
802
- /** Get the editor ref */
803
- getEditorRef: () => PagedEditorRef | null;
804
- /** Save the document to buffer */
805
- save: () => Promise<ArrayBuffer | null>;
806
- /** Set zoom level */
807
- setZoom: (zoom: number) => void;
808
- /** Get current zoom level */
809
- getZoom: () => number;
810
- /** Focus the editor */
811
- focus: () => void;
812
- /** Get current page number */
813
- getCurrentPage: () => number;
814
- /** Get total page count */
815
- getTotalPages: () => number;
816
- /** Scroll to a specific page */
817
- scrollToPage: (pageNumber: number) => void;
818
- /** Open print preview */
819
- openPrintPreview: () => void;
820
- /** Print the document directly */
821
- print: () => void;
822
- }
823
- /**
824
- * DocxEditor - Complete DOCX editor component
825
- */
826
- declare const DocxEditor: React$1.ForwardRefExoticComponent<DocxEditorProps & React$1.RefAttributes<DocxEditorRef>>;
827
-
828
- /**
829
- * Simple imperative API for rendering a DOCX editor into a DOM element.
830
- *
831
- * Usage:
832
- * ```ts
833
- * import { renderAsync } from '@eigenpal/docx-js-editor';
834
- *
835
- * const editor = await renderAsync(docxBlob, document.getElementById('container'), {
836
- * readOnly: false,
837
- * showToolbar: true,
838
- * });
839
- *
840
- * // Save the edited document
841
- * const buffer = await editor.save();
842
- *
843
- * // Clean up
844
- * editor.destroy();
845
- * ```
846
- */
847
-
848
- /**
849
- * Options for {@link renderAsync}. A subset of DocxEditorProps minus
850
- * `documentBuffer` / `document` (passed as the first argument instead).
851
- */
852
- type RenderAsyncOptions = Omit<DocxEditorProps, 'documentBuffer' | 'document'>;
853
- /**
854
- * Handle returned by {@link renderAsync} for interacting with the editor.
855
- */
856
- interface DocxEditorHandle {
857
- /** Save the document and return the DOCX as an ArrayBuffer. */
858
- save: () => Promise<ArrayBuffer | null>;
859
- /** Get the current parsed document model. */
860
- getDocument: () => Document | null;
861
- /** Focus the editor. */
862
- focus: () => void;
863
- /** Set zoom level (1.0 = 100%). */
864
- setZoom: (zoom: number) => void;
865
- /** Unmount the editor and clean up. */
866
- destroy: () => void;
867
- }
868
- /**
869
- * Render a DOCX editor into a container element.
870
- *
871
- * @param input - DOCX data as ArrayBuffer, Uint8Array, Blob, or File
872
- * @param container - DOM element to render into
873
- * @param options - Editor configuration (toolbar, readOnly, callbacks, etc.)
874
- * @returns A handle with save / destroy / getDocument methods
875
- */
876
- declare function renderAsync(input: DocxInput, container: HTMLElement, options?: RenderAsyncOptions): Promise<DocxEditorHandle>;
877
-
878
- /**
879
- * Google Fonts Loader
880
- *
881
- * Dynamically loads fonts from Google Fonts API with:
882
- * - Loading state tracking
883
- * - Duplicate prevention
884
- * - Callback notifications
885
- * - Font availability detection
886
- */
887
- /**
888
- * Load a font from Google Fonts
889
- *
890
- * @param fontFamily - The font family name to load
891
- * @param options - Optional configuration
892
- * @returns Promise resolving to true if font loaded successfully, false otherwise
893
- */
894
- declare function loadFont(fontFamily: string, options?: {
895
- weights?: number[];
896
- styles?: ('normal' | 'italic')[];
897
- }): Promise<boolean>;
898
- /**
899
- * Load multiple fonts from Google Fonts
900
- *
901
- * @param families - Array of font family names to load
902
- * @param options - Optional configuration
903
- * @returns Promise resolving when all fonts are loaded (or failed)
904
- */
905
- declare function loadFonts(families: string[], options?: {
906
- weights?: number[];
907
- styles?: ('normal' | 'italic')[];
908
- }): Promise<void>;
909
- /**
910
- * Check if a font is loaded
911
- *
912
- * @param fontFamily - The font family name to check
913
- * @returns true if the font is loaded, false otherwise
914
- */
915
- declare function isFontLoaded(fontFamily: string): boolean;
916
- /**
917
- * Check if any fonts are currently loading
918
- *
919
- * @returns true if any fonts are loading, false otherwise
920
- */
921
- declare function isLoading(): boolean;
922
- /**
923
- * Get list of all loaded fonts
924
- *
925
- * @returns Array of loaded font family names
926
- */
927
- declare function getLoadedFonts(): string[];
928
- /**
929
- * Register a callback to be notified when fonts are loaded
930
- *
931
- * @param callback - Function to call when fonts are loaded
932
- * @returns Cleanup function to remove the callback
933
- */
934
- declare function onFontsLoaded(callback: (fonts: string[]) => void): () => void;
935
- /**
936
- * Check if a font is available on the system using canvas measurement
937
- *
938
- * This uses the technique of comparing text width with the target font
939
- * vs a known fallback font. If they differ, the font is available.
940
- *
941
- * @param fontFamily - The font family name to check
942
- * @param fallbackFont - Fallback font to compare against
943
- * @returns true if font is available, false otherwise
944
- */
945
- declare function canRenderFont(fontFamily: string, fallbackFont?: string): boolean;
946
- /**
947
- * Load a font from a raw buffer (e.g., embedded in DOCX)
948
- *
949
- * @param fontFamily - The font family name
950
- * @param buffer - Font file buffer (TTF, OTF, WOFF, WOFF2)
951
- * @param options - Font options
952
- * @returns Promise resolving when font is loaded
953
- */
954
- declare function loadFontFromBuffer(fontFamily: string, buffer: ArrayBuffer, options?: {
955
- weight?: number | string;
956
- style?: 'normal' | 'italic';
957
- }): Promise<boolean>;
958
- /**
959
- * Preload a list of common document fonts
960
- *
961
- * This preloads fonts commonly used in DOCX documents that have
962
- * Google Fonts equivalents.
963
- */
964
- declare function preloadCommonFonts(): Promise<void>;
965
-
966
- /**
967
- * List type
968
- */
969
- type ListType = 'bullet' | 'numbered' | 'none';
970
- /**
971
- * List state for the current selection
972
- */
973
- interface ListState {
974
- /** Type of list (bullet, numbered, or none) */
975
- type: ListType;
976
- /** Current list level (0-8) */
977
- level: number;
978
- /** Whether the selection is in a list */
979
- isInList: boolean;
980
- /** Numbering ID if in a list */
981
- numId?: number;
982
- }
983
- /**
984
- * Props for the ListButtons component
985
- */
986
- interface ListButtonsProps {
987
- /** Current list state of the selection */
988
- listState?: ListState;
989
- /** Callback when bullet list is toggled */
990
- onBulletList?: () => void;
991
- /** Callback when numbered list is toggled */
992
- onNumberedList?: () => void;
993
- /** Callback to increase list indent */
994
- onIndent?: () => void;
995
- /** Callback to decrease list indent */
996
- onOutdent?: () => void;
997
- /** Whether the buttons are disabled */
998
- disabled?: boolean;
999
- /** Additional CSS class name */
1000
- className?: string;
1001
- /** Additional inline styles */
1002
- style?: CSSProperties;
1003
- /** Show indent/outdent buttons */
1004
- showIndentButtons?: boolean;
1005
- /** Compact mode (smaller buttons) */
1006
- compact?: boolean;
1007
- /** Whether the current paragraph has left indentation (for enabling outdent) */
1008
- hasIndent?: boolean;
1009
- }
1010
- /**
1011
- * List buttons component for bullet/numbered list controls
1012
- */
1013
- declare function ListButtons({ listState, onBulletList, onNumberedList, onIndent, onOutdent, disabled, className, style, showIndentButtons, compact, hasIndent, }: ListButtonsProps): react_jsx_runtime.JSX.Element;
1014
- /**
1015
- * Create a default list state (not in a list)
1016
- */
1017
- declare function createDefaultListState(): ListState;
1018
-
1019
- /**
1020
- * TableToolbar Component
1021
- *
1022
- * Provides controls for editing tables:
1023
- * - Add row above/below
1024
- * - Add column left/right
1025
- * - Delete row/column
1026
- * - Merge cells
1027
- * - Split cell
1028
- *
1029
- * Shows when cursor is in a table.
1030
- */
1031
-
1032
- /**
1033
- * Table editing action types
1034
- */
1035
- type TableAction = 'addRowAbove' | 'addRowBelow' | 'addColumnLeft' | 'addColumnRight' | 'deleteRow' | 'deleteColumn' | 'mergeCells' | 'splitCell' | 'deleteTable' | 'selectTable' | 'selectRow' | 'selectColumn' | 'borderAll' | 'borderOutside' | 'borderInside' | 'borderNone' | 'borderTop' | 'borderBottom' | 'borderLeft' | 'borderRight' | {
1036
- type: 'cellFillColor';
1037
- color: string | null;
1038
- } | {
1039
- type: 'borderColor';
1040
- color: string;
1041
- } | {
1042
- type: 'borderWidth';
1043
- size: number;
1044
- } | {
1045
- type: 'cellBorder';
1046
- side: 'top' | 'bottom' | 'left' | 'right' | 'all';
1047
- style: string;
1048
- size: number;
1049
- color: string;
1050
- } | {
1051
- type: 'cellVerticalAlign';
1052
- align: 'top' | 'center' | 'bottom';
1053
- } | {
1054
- type: 'cellMargins';
1055
- margins: {
1056
- top?: number;
1057
- bottom?: number;
1058
- left?: number;
1059
- right?: number;
1060
- };
1061
- } | {
1062
- type: 'cellTextDirection';
1063
- direction: string | null;
1064
- } | {
1065
- type: 'toggleNoWrap';
1066
- } | {
1067
- type: 'rowHeight';
1068
- height: number | null;
1069
- rule?: 'auto' | 'atLeast' | 'exact';
1070
- } | {
1071
- type: 'toggleHeaderRow';
1072
- } | {
1073
- type: 'distributeColumns';
1074
- } | {
1075
- type: 'autoFitContents';
1076
- } | {
1077
- type: 'tableProperties';
1078
- props: {
1079
- width?: number | null;
1080
- widthType?: string | null;
1081
- justification?: 'left' | 'center' | 'right' | null;
1082
- };
1083
- } | {
1084
- type: 'openTableProperties';
1085
- } | {
1086
- type: 'applyTableStyle';
1087
- styleId: string;
1088
- };
1089
- /**
1090
- * Selection within a table
1091
- */
1092
- interface TableSelection {
1093
- /** Index of the table in the document */
1094
- tableIndex: number;
1095
- /** Row index (0-indexed) */
1096
- rowIndex: number;
1097
- /** Column index (0-indexed) */
1098
- columnIndex: number;
1099
- /** Selected cell range for multi-cell selection */
1100
- selectedCells?: {
1101
- startRow: number;
1102
- startCol: number;
1103
- endRow: number;
1104
- endCol: number;
1105
- };
1106
- }
1107
- /**
1108
- * Context for table operations
1109
- */
1110
- interface TableContext {
1111
- /** The table being edited */
1112
- table: Table;
1113
- /** Current selection within the table */
1114
- selection: TableSelection;
1115
- /** Whether multiple cells are selected (for merge) */
1116
- hasMultiCellSelection: boolean;
1117
- /** Whether current cell can be split */
1118
- canSplitCell: boolean;
1119
- /** Total number of rows */
1120
- rowCount: number;
1121
- /** Total number of columns */
1122
- columnCount: number;
1123
- }
1124
- /**
1125
- * Props for TableToolbar component
1126
- */
1127
- interface TableToolbarProps {
1128
- /** Current table context (null if cursor not in table) */
1129
- context: TableContext | null;
1130
- /** Callback when a table action is triggered */
1131
- onAction?: (action: TableAction, context: TableContext) => void;
1132
- /** Whether the toolbar is disabled */
1133
- disabled?: boolean;
1134
- /** Additional CSS class name */
1135
- className?: string;
1136
- /** Additional inline styles */
1137
- style?: CSSProperties;
1138
- /** Show labels next to icons */
1139
- showLabels?: boolean;
1140
- /** Compact mode */
1141
- compact?: boolean;
1142
- /** Position of the toolbar */
1143
- position?: 'top' | 'floating';
1144
- /** Custom render for additional buttons */
1145
- children?: ReactNode;
1146
- }
1147
- /**
1148
- * TableToolbar - Shows table manipulation controls when cursor is in a table
1149
- */
1150
- declare function TableToolbar({ context, onAction, disabled, className, style, showLabels, compact, position, children, }: TableToolbarProps): React__default.ReactElement | null;
1151
- /**
1152
- * Create a table context from a table and selection
1153
- */
1154
- declare function createTableContext(table: Table, selection: TableSelection): TableContext;
1155
- /**
1156
- * Get column count from a table
1157
- */
1158
- declare function getColumnCount(table: Table): number;
1159
- /**
1160
- * Get cell at specific row and column index
1161
- */
1162
- declare function getCellAt(table: Table, rowIndex: number, columnIndex: number): TableCell | null;
1163
- /**
1164
- * Add a row to a table at the specified index
1165
- */
1166
- declare function addRow(table: Table, atIndex: number, position?: 'before' | 'after'): Table;
1167
- /**
1168
- * Delete a row from a table
1169
- */
1170
- declare function deleteRow(table: Table, rowIndex: number): Table;
1171
- /**
1172
- * Add a column to a table at the specified index
1173
- */
1174
- declare function addColumn(table: Table, atIndex: number, position?: 'before' | 'after'): Table;
1175
- /**
1176
- * Delete a column from a table
1177
- */
1178
- declare function deleteColumn(table: Table, columnIndex: number): Table;
1179
- /**
1180
- * Merge cells in a selection
1181
- */
1182
- declare function mergeCells(table: Table, selection: TableSelection): Table;
1183
- /**
1184
- * Split a merged cell
1185
- */
1186
- declare function splitCell(table: Table, rowIndex: number, columnIndex: number): Table;
1187
-
1188
- /**
1189
- * Current formatting state of the selection
1190
- */
1191
- interface SelectionFormatting {
1192
- /** Whether selected text is bold */
1193
- bold?: boolean;
1194
- /** Whether selected text is italic */
1195
- italic?: boolean;
1196
- /** Whether selected text is underlined */
1197
- underline?: boolean;
1198
- /** Whether selected text has strikethrough */
1199
- strike?: boolean;
1200
- /** Whether selected text is superscript */
1201
- superscript?: boolean;
1202
- /** Whether selected text is subscript */
1203
- subscript?: boolean;
1204
- /** Font family of selected text */
1205
- fontFamily?: string;
1206
- /** Font size of selected text (in half-points) */
1207
- fontSize?: number;
1208
- /** Text color */
1209
- color?: string;
1210
- /** Highlight color */
1211
- highlight?: string;
1212
- /** Paragraph alignment */
1213
- alignment?: ParagraphAlignment;
1214
- /** List state of the current paragraph */
1215
- listState?: ListState;
1216
- /** Line spacing in twips (OOXML value, 240 = single spacing) */
1217
- lineSpacing?: number;
1218
- /** Paragraph style ID */
1219
- styleId?: string;
1220
- /** Paragraph left indentation in twips */
1221
- indentLeft?: number;
1222
- }
1223
- /**
1224
- * Formatting action types
1225
- */
1226
- type FormattingAction = 'bold' | 'italic' | 'underline' | 'strikethrough' | 'superscript' | 'subscript' | 'clearFormatting' | 'bulletList' | 'numberedList' | 'indent' | 'outdent' | 'insertLink' | {
1227
- type: 'fontFamily';
1228
- value: string;
1229
- } | {
1230
- type: 'fontSize';
1231
- value: number;
1232
- } | {
1233
- type: 'textColor';
1234
- value: string;
1235
- } | {
1236
- type: 'highlightColor';
1237
- value: string;
1238
- } | {
1239
- type: 'alignment';
1240
- value: ParagraphAlignment;
1241
- } | {
1242
- type: 'lineSpacing';
1243
- value: number;
1244
- } | {
1245
- type: 'applyStyle';
1246
- value: string;
1247
- };
1248
- /**
1249
- * Props for the Toolbar component
1250
- */
1251
- interface ToolbarProps {
1252
- /** Current formatting of the selection */
1253
- currentFormatting?: SelectionFormatting;
1254
- /** Callback when a formatting action is triggered */
1255
- onFormat?: (action: FormattingAction) => void;
1256
- /** Callback for undo action */
1257
- onUndo?: () => void;
1258
- /** Callback for redo action */
1259
- onRedo?: () => void;
1260
- /** Whether undo is available */
1261
- canUndo?: boolean;
1262
- /** Whether redo is available */
1263
- canRedo?: boolean;
1264
- /** Whether the toolbar is disabled */
1265
- disabled?: boolean;
1266
- /** Additional CSS class name */
1267
- className?: string;
1268
- /** Additional inline styles */
1269
- style?: CSSProperties;
1270
- /** Whether to enable keyboard shortcuts (default: true) */
1271
- enableShortcuts?: boolean;
1272
- /** Ref to the editor container for keyboard events */
1273
- editorRef?: React__default.RefObject<HTMLElement>;
1274
- /** Custom toolbar items to render */
1275
- children?: ReactNode;
1276
- /** Whether to show font family picker (default: true) */
1277
- showFontPicker?: boolean;
1278
- /** Whether to show font size picker (default: true) */
1279
- showFontSizePicker?: boolean;
1280
- /** Whether to show text color picker (default: true) */
1281
- showTextColorPicker?: boolean;
1282
- /** Whether to show highlight color picker (default: true) */
1283
- showHighlightColorPicker?: boolean;
1284
- /** Whether to show alignment buttons (default: true) */
1285
- showAlignmentButtons?: boolean;
1286
- /** Whether to show list buttons (default: true) */
1287
- showListButtons?: boolean;
1288
- /** Whether to show line spacing picker (default: true) */
1289
- showLineSpacingPicker?: boolean;
1290
- /** Whether to show style picker (default: true) */
1291
- showStylePicker?: boolean;
1292
- /** Document styles for the style picker */
1293
- documentStyles?: Style[];
1294
- /** Theme for the style picker */
1295
- theme?: Theme | null;
1296
- /** Callback for print action */
1297
- onPrint?: () => void;
1298
- /** Whether to show print button (default: true) */
1299
- showPrintButton?: boolean;
1300
- /** Whether to show zoom control (default: true) */
1301
- showZoomControl?: boolean;
1302
- /** Current zoom level (1.0 = 100%) */
1303
- zoom?: number;
1304
- /** Callback when zoom changes */
1305
- onZoomChange?: (zoom: number) => void;
1306
- /** Callback to refocus the editor after toolbar interactions */
1307
- onRefocusEditor?: () => void;
1308
- /** Callback when a table should be inserted */
1309
- onInsertTable?: (rows: number, columns: number) => void;
1310
- /** Whether to show table insert button (default: true) */
1311
- showTableInsert?: boolean;
1312
- /** Callback when user wants to insert an image */
1313
- onInsertImage?: () => void;
1314
- /** Callback when user wants to insert a page break */
1315
- onInsertPageBreak?: () => void;
1316
- /** Callback when user wants to insert a table of contents */
1317
- onInsertTOC?: () => void;
1318
- /** Callback when user wants to insert a shape */
1319
- onInsertShape?: (data: {
1320
- shapeType: string;
1321
- width: number;
1322
- height: number;
1323
- fillColor?: string;
1324
- fillType?: string;
1325
- outlineWidth?: number;
1326
- outlineColor?: string;
1327
- }) => void;
1328
- /** Image context when an image is selected */
1329
- imageContext?: {
1330
- wrapType: string;
1331
- displayMode: string;
1332
- cssFloat: string | null;
1333
- } | null;
1334
- /** Callback when image wrap type changes */
1335
- onImageWrapType?: (wrapType: string) => void;
1336
- /** Callback for image transform (rotate/flip) */
1337
- onImageTransform?: (action: 'rotateCW' | 'rotateCCW' | 'flipH' | 'flipV') => void;
1338
- /** Callback to open image properties dialog (alt text + border) */
1339
- onOpenImageProperties?: () => void;
1340
- /** Table context when cursor is in a table */
1341
- tableContext?: {
1342
- isInTable: boolean;
1343
- rowCount?: number;
1344
- columnCount?: number;
1345
- canSplitCell?: boolean;
1346
- hasMultiCellSelection?: boolean;
1347
- } | null;
1348
- /** Callback when a table action is triggered */
1349
- onTableAction?: (action: TableAction) => void;
1350
- }
1351
- /**
1352
- * Props for individual toolbar buttons
1353
- */
1354
- interface ToolbarButtonProps {
1355
- /** Whether the button is in active/pressed state */
1356
- active?: boolean;
1357
- /** Whether the button is disabled */
1358
- disabled?: boolean;
1359
- /** Button title/tooltip */
1360
- title?: string;
1361
- /** Click handler */
1362
- onClick?: () => void;
1363
- /** Button content */
1364
- children: ReactNode;
1365
- /** Additional CSS class name */
1366
- className?: string;
1367
- /** ARIA label for accessibility */
1368
- ariaLabel?: string;
1369
- }
1370
- /**
1371
- * Props for toolbar button groups
1372
- */
1373
- interface ToolbarGroupProps$1 {
1374
- /** Group label for accessibility */
1375
- label?: string;
1376
- /** Group content */
1377
- children: ReactNode;
1378
- /** Additional CSS class name */
1379
- className?: string;
1380
- }
1381
- /**
1382
- * Individual toolbar button with shadcn styling
1383
- */
1384
- declare function ToolbarButton({ active, disabled, title, onClick, children, className, ariaLabel, }: ToolbarButtonProps): react_jsx_runtime.JSX.Element;
1385
- /**
1386
- * Toolbar button group with modern styling
1387
- */
1388
- declare function ToolbarGroup$1({ label, children, className }: ToolbarGroupProps$1): react_jsx_runtime.JSX.Element;
1389
- /**
1390
- * Toolbar separator
1391
- */
1392
- declare function ToolbarSeparator(): react_jsx_runtime.JSX.Element;
1393
- /**
1394
- * Formatting toolbar with all controls
1395
- */
1396
- declare function Toolbar({ currentFormatting, onFormat, onUndo, onRedo, canUndo, canRedo, disabled, className, style, enableShortcuts, editorRef, children, showFontPicker, showFontSizePicker, showTextColorPicker, showHighlightColorPicker, showAlignmentButtons, showListButtons, showLineSpacingPicker, showStylePicker, documentStyles, theme, onPrint, showPrintButton, showZoomControl, zoom, onZoomChange, onRefocusEditor, onInsertTable, showTableInsert, onInsertImage, onInsertPageBreak, onInsertTOC, imageContext, onImageWrapType, onImageTransform, onOpenImageProperties, tableContext, onTableAction, }: ToolbarProps): react_jsx_runtime.JSX.Element;
1397
-
1398
- /**
1399
- * VariablePanel Component
1400
- *
1401
- * A panel that lists detected template variables with input fields for values:
1402
- * - Lists detected variables from document
1403
- * - Input field for each value
1404
- * - Apply button to process template
1405
- * - Shows empty state when no variables
1406
- */
1407
-
1408
- /**
1409
- * Props for VariablePanel component
1410
- */
1411
- interface VariablePanelProps {
1412
- /** Detected variable names */
1413
- variables: string[];
1414
- /** Current variable values */
1415
- values?: Record<string, string>;
1416
- /** Callback when values change */
1417
- onValuesChange?: (values: Record<string, string>) => void;
1418
- /** Callback when Apply button is clicked */
1419
- onApply?: (values: Record<string, string>) => void;
1420
- /** Callback when Reset button is clicked */
1421
- onReset?: () => void;
1422
- /** Whether Apply is in progress */
1423
- isApplying?: boolean;
1424
- /** Whether the panel is disabled */
1425
- disabled?: boolean;
1426
- /** Additional CSS class name */
1427
- className?: string;
1428
- /** Additional inline styles */
1429
- style?: CSSProperties;
1430
- /** Panel title */
1431
- title?: string;
1432
- /** Show empty state message */
1433
- emptyMessage?: string;
1434
- /** Show variable count */
1435
- showCount?: boolean;
1436
- /** Collapsible panel */
1437
- collapsible?: boolean;
1438
- /** Initially collapsed */
1439
- defaultCollapsed?: boolean;
1440
- /** Show search filter */
1441
- showSearch?: boolean;
1442
- /** Custom variable descriptions */
1443
- descriptions?: Record<string, string>;
1444
- }
1445
- /**
1446
- * VariablePanel - Panel for managing template variable values
1447
- */
1448
- declare function VariablePanel({ variables, values: externalValues, onValuesChange, onApply, onReset, isApplying, disabled, className, style, title, emptyMessage, showCount, collapsible, defaultCollapsed, showSearch, descriptions, }: VariablePanelProps): React__default.ReactElement;
1449
-
1450
- /**
1451
- * Context Menu Component
1452
- *
1453
- * Right-click context menu for AI actions on selected text.
1454
- * Shows AI options like rewrite, expand, summarize, translate, etc.
1455
- */
1456
-
1457
- /**
1458
- * Context menu props
1459
- */
1460
- interface ContextMenuProps {
1461
- /** Whether the menu is visible */
1462
- isOpen: boolean;
1463
- /** Menu position */
1464
- position: {
1465
- x: number;
1466
- y: number;
1467
- };
1468
- /** Selected text */
1469
- selectedText: string;
1470
- /** Selection context for AI operations */
1471
- selectionContext?: SelectionContext;
1472
- /** Callback when an action is selected */
1473
- onAction: (action: AIAction, customPrompt?: string) => void;
1474
- /** Callback when menu is closed */
1475
- onClose: () => void;
1476
- /** Available actions (defaults to DEFAULT_AI_ACTIONS) */
1477
- actions?: AIAction[];
1478
- /** Whether to show custom prompt option */
1479
- showCustomPrompt?: boolean;
1480
- /** Additional className */
1481
- className?: string;
1482
- }
1483
- declare const ContextMenu: React__default.FC<ContextMenuProps>;
1484
- /**
1485
- * Hook to manage context menu state
1486
- */
1487
- declare function useContextMenu(): {
1488
- isOpen: boolean;
1489
- position: {
1490
- x: number;
1491
- y: number;
1492
- };
1493
- selectedText: string;
1494
- selectionContext: SelectionContext | undefined;
1495
- openMenu: (e: React__default.MouseEvent | MouseEvent, text: string, context?: SelectionContext) => void;
1496
- closeMenu: () => void;
1497
- };
1498
- /**
1499
- * Get action shortcuts
1500
- */
1501
- declare function getActionShortcut(action: AIAction): string | undefined;
1502
- /**
1503
- * Check if action is available for selection
1504
- */
1505
- declare function isActionAvailable(_action: AIAction, selectedText: string, _selectionContext?: SelectionContext): boolean;
1506
- /**
1507
- * Get default actions for selection
1508
- */
1509
- declare function getDefaultActions(): AIAction[];
1510
- /**
1511
- * Get all available actions
1512
- */
1513
- declare function getAllActions(): AIAction[];
1514
-
1515
- /**
1516
- * Response Preview Component
1517
- *
1518
- * Shows AI response preview with diff view before applying changes.
1519
- * Allows user to accept, reject, or edit the response.
1520
- */
1521
-
1522
- /**
1523
- * Response preview props
1524
- */
1525
- interface ResponsePreviewProps {
1526
- /** Original selected text */
1527
- originalText: string;
1528
- /** AI response (or null if loading/error) */
1529
- response: AgentResponse | null;
1530
- /** Action that was performed */
1531
- action: AIAction;
1532
- /** Whether the response is loading */
1533
- isLoading: boolean;
1534
- /** Error message if request failed */
1535
- error?: string;
1536
- /** Callback when user accepts the change */
1537
- onAccept: (newText: string) => void;
1538
- /** Callback when user rejects the change */
1539
- onReject: () => void;
1540
- /** Callback when user wants to retry */
1541
- onRetry?: () => void;
1542
- /** Allow editing before accepting */
1543
- allowEdit?: boolean;
1544
- /** Show diff view */
1545
- showDiff?: boolean;
1546
- /** Additional className */
1547
- className?: string;
1548
- /** Position for the preview */
1549
- position?: {
1550
- x: number;
1551
- y: number;
1552
- };
1553
- }
1554
- declare const ResponsePreview: React__default.FC<ResponsePreviewProps>;
1555
- /**
1556
- * State for response preview
1557
- */
1558
- interface ResponsePreviewState {
1559
- isVisible: boolean;
1560
- originalText: string;
1561
- response: AgentResponse | null;
1562
- action: AIAction;
1563
- isLoading: boolean;
1564
- error?: string;
1565
- position?: {
1566
- x: number;
1567
- y: number;
1568
- };
1569
- }
1570
- /**
1571
- * Hook to manage response preview state
1572
- */
1573
- declare function useResponsePreview(): {
1574
- state: ResponsePreviewState;
1575
- showPreview: (originalText: string, action: AIAction, position?: {
1576
- x: number;
1577
- y: number;
1578
- }) => void;
1579
- setResponse: (response: AgentResponse) => void;
1580
- setError: (error: string) => void;
1581
- hidePreview: () => void;
1582
- };
1583
- /**
1584
- * Create a mock response for testing
1585
- */
1586
- declare function createMockResponse(newText: string, warnings?: string[]): AgentResponse;
1587
- /**
1588
- * Create an error response
1589
- */
1590
- declare function createErrorResponse(error: string): AgentResponse;
1591
-
1592
- /**
1593
- * Text Context Menu Component
1594
- *
1595
- * Right-click context menu for text editing operations.
1596
- * Shows Cut, Copy, Paste, and other text editing options.
1597
- */
1598
-
1599
- /**
1600
- * Context menu action types
1601
- */
1602
- type TextContextAction = 'cut' | 'copy' | 'paste' | 'pasteAsPlainText' | 'selectAll' | 'delete' | 'separator';
1603
- /**
1604
- * Menu item configuration
1605
- */
1606
- interface TextContextMenuItem {
1607
- /** Action type */
1608
- action: TextContextAction;
1609
- /** Display label */
1610
- label: string;
1611
- /** Keyboard shortcut hint */
1612
- shortcut?: string;
1613
- /** Whether the item is disabled */
1614
- disabled?: boolean;
1615
- /** Whether to show divider after this item */
1616
- dividerAfter?: boolean;
1617
- }
1618
- /**
1619
- * Context menu props
1620
- */
1621
- interface TextContextMenuProps {
1622
- /** Whether the menu is visible */
1623
- isOpen: boolean;
1624
- /** Menu position */
1625
- position: {
1626
- x: number;
1627
- y: number;
1628
- };
1629
- /** Whether there's a selection (enables copy/cut) */
1630
- hasSelection: boolean;
1631
- /** Whether the editor is editable (enables paste/cut/delete) */
1632
- isEditable: boolean;
1633
- /** Whether clipboard has content (enables paste) */
1634
- hasClipboardContent?: boolean;
1635
- /** Callback when an action is selected */
1636
- onAction: (action: TextContextAction) => void;
1637
- /** Callback when menu is closed */
1638
- onClose: () => void;
1639
- /** Custom menu items (overrides default) */
1640
- items?: TextContextMenuItem[];
1641
- /** Additional className */
1642
- className?: string;
1643
- }
1644
- /**
1645
- * Hook options for text context menu
1646
- */
1647
- interface UseTextContextMenuOptions {
1648
- /** Whether the context menu is enabled */
1649
- enabled?: boolean;
1650
- /** Whether the editor is editable */
1651
- isEditable?: boolean;
1652
- /** Container element ref */
1653
- containerRef?: React__default.RefObject<HTMLElement>;
1654
- /** Callback when an action is triggered */
1655
- onAction?: (action: TextContextAction) => void;
1656
- }
1657
- /**
1658
- * Hook return value
1659
- */
1660
- interface UseTextContextMenuReturn {
1661
- /** Whether the menu is open */
1662
- isOpen: boolean;
1663
- /** Menu position */
1664
- position: {
1665
- x: number;
1666
- y: number;
1667
- };
1668
- /** Whether there's a text selection */
1669
- hasSelection: boolean;
1670
- /** Open the context menu */
1671
- openMenu: (event: React__default.MouseEvent | MouseEvent) => void;
1672
- /** Close the context menu */
1673
- closeMenu: () => void;
1674
- /** Handle action selection */
1675
- handleAction: (action: TextContextAction) => void;
1676
- /** Context menu event handler for onContextMenu prop */
1677
- onContextMenu: (event: React__default.MouseEvent) => void;
1678
- }
1679
- declare const TextContextMenu: React__default.FC<TextContextMenuProps>;
1680
- /**
1681
- * Hook to manage text context menu state
1682
- */
1683
- declare function useTextContextMenu(options?: UseTextContextMenuOptions): UseTextContextMenuReturn;
1684
- /**
1685
- * Get action label
1686
- */
1687
- declare function getTextActionLabel(action: TextContextAction): string;
1688
- /**
1689
- * Get action shortcut
1690
- */
1691
- declare function getTextActionShortcut(action: TextContextAction): string;
1692
- /**
1693
- * Get default menu items
1694
- */
1695
- declare function getDefaultTextContextMenuItems(): TextContextMenuItem[];
1696
- /**
1697
- * Check if action is available
1698
- */
1699
- declare function isTextActionAvailable(action: TextContextAction, hasSelection: boolean, isEditable: boolean): boolean;
1700
-
1701
- /**
1702
- * Error severity levels
1703
- */
1704
- type ErrorSeverity = 'error' | 'warning' | 'info';
1705
- /**
1706
- * Error notification
1707
- */
1708
- interface ErrorNotification {
1709
- id: string;
1710
- message: string;
1711
- severity: ErrorSeverity;
1712
- details?: string;
1713
- timestamp: number;
1714
- dismissed?: boolean;
1715
- }
1716
- /**
1717
- * Error context value
1718
- */
1719
- interface ErrorContextValue {
1720
- /** Current notifications */
1721
- notifications: ErrorNotification[];
1722
- /** Show an error notification */
1723
- showError: (message: string, details?: string) => void;
1724
- /** Show a warning notification */
1725
- showWarning: (message: string, details?: string) => void;
1726
- /** Show an info notification */
1727
- showInfo: (message: string, details?: string) => void;
1728
- /** Dismiss a notification */
1729
- dismissNotification: (id: string) => void;
1730
- /** Clear all notifications */
1731
- clearNotifications: () => void;
1732
- }
1733
- /**
1734
- * Error boundary props
1735
- */
1736
- interface ErrorBoundaryProps {
1737
- /** Child components to render */
1738
- children: ReactNode;
1739
- /** Custom fallback UI */
1740
- fallback?: ReactNode | ((error: Error, reset: () => void) => ReactNode);
1741
- /** Callback when error occurs */
1742
- onError?: (error: Error, errorInfo: ErrorInfo) => void;
1743
- /** Whether to show error details */
1744
- showDetails?: boolean;
1745
- }
1746
- /**
1747
- * Error boundary state
1748
- */
1749
- interface ErrorBoundaryState {
1750
- hasError: boolean;
1751
- error: Error | null;
1752
- errorInfo: ErrorInfo | null;
1753
- }
1754
- /**
1755
- * Hook to use error notifications
1756
- */
1757
- declare function useErrorNotifications(): ErrorContextValue;
1758
- /**
1759
- * Error notification provider
1760
- */
1761
- declare function ErrorProvider({ children }: {
1762
- children: ReactNode;
1763
- }): react_jsx_runtime.JSX.Element;
1764
- /**
1765
- * Error Boundary class component
1766
- *
1767
- * Catches render errors in child components and displays fallback UI.
1768
- */
1769
- declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
1770
- constructor(props: ErrorBoundaryProps);
1771
- static getDerivedStateFromError(error: Error): Partial<ErrorBoundaryState>;
1772
- componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
1773
- resetError: () => void;
1774
- render(): ReactNode;
1775
- }
1776
- interface ParseErrorDisplayProps {
1777
- message: string;
1778
- details?: string;
1779
- onRetry?: () => void;
1780
- className?: string;
1781
- }
1782
- /**
1783
- * Parse error display component
1784
- *
1785
- * Shows a helpful message for DOCX parsing errors.
1786
- */
1787
- declare function ParseErrorDisplay({ message, details, onRetry, className, }: ParseErrorDisplayProps): React__default.ReactElement;
1788
- interface UnsupportedFeatureWarningProps {
1789
- feature: string;
1790
- description?: string;
1791
- className?: string;
1792
- }
1793
- /**
1794
- * Unsupported feature warning component
1795
- *
1796
- * Shows a non-blocking warning for unsupported features.
1797
- */
1798
- declare function UnsupportedFeatureWarning({ feature, description, className, }: UnsupportedFeatureWarningProps): React__default.ReactElement;
1799
- /**
1800
- * Check if an error is a parse error
1801
- */
1802
- declare function isParseError(error: Error): boolean;
1803
- /**
1804
- * Get user-friendly error message
1805
- */
1806
- declare function getUserFriendlyMessage(error: Error): string;
1807
-
1808
- /**
1809
- * Zoom Control Component (Radix UI)
1810
- *
1811
- * A dropdown for controlling document zoom level using Radix Select.
1812
- */
1813
- interface ZoomLevel {
1814
- value: number;
1815
- label: string;
1816
- }
1817
- interface ZoomControlProps {
1818
- value?: number;
1819
- onChange?: (zoom: number) => void;
1820
- levels?: ZoomLevel[];
1821
- disabled?: boolean;
1822
- className?: string;
1823
- minZoom?: number;
1824
- maxZoom?: number;
1825
- showButtons?: boolean;
1826
- persistZoom?: boolean;
1827
- storageKey?: string;
1828
- compact?: boolean;
1829
- }
1830
- declare function ZoomControl({ value, onChange, levels, disabled, className, compact, }: ZoomControlProps): react_jsx_runtime.JSX.Element;
1831
-
1832
- /**
1833
- * Font Picker Component (Radix UI)
1834
- *
1835
- * A dropdown selector for choosing font families using Radix Select.
1836
- */
1837
- interface FontOption {
1838
- name: string;
1839
- fontFamily: string;
1840
- category?: 'sans-serif' | 'serif' | 'monospace' | 'other';
1841
- }
1842
- interface FontPickerProps {
1843
- value?: string;
1844
- onChange?: (fontFamily: string) => void;
1845
- fonts?: FontOption[];
1846
- disabled?: boolean;
1847
- className?: string;
1848
- placeholder?: string;
1849
- width?: number | string;
1850
- showPreview?: boolean;
1851
- }
1852
- declare function FontPicker({ value, onChange, fonts, disabled, className, placeholder, width, showPreview, }: FontPickerProps): react_jsx_runtime.JSX.Element;
1853
-
1854
- /**
1855
- * Font Size Picker Component (Google Docs Style)
1856
- *
1857
- * A font size control with minus/plus buttons and editable input.
1858
- * Features:
1859
- * - Minus button to decrease font size
1860
- * - Plus button to increase font size
1861
- * - Editable input for custom sizes
1862
- * - Click input to show dropdown with preset sizes
1863
- */
1864
- interface FontSizePickerProps {
1865
- value?: number;
1866
- onChange?: (size: number) => void;
1867
- sizes?: number[];
1868
- disabled?: boolean;
1869
- className?: string;
1870
- placeholder?: string;
1871
- width?: number | string;
1872
- minSize?: number;
1873
- maxSize?: number;
1874
- }
1875
- declare function FontSizePicker({ value, onChange, sizes, disabled, className, placeholder, minSize, maxSize, }: FontSizePickerProps): react_jsx_runtime.JSX.Element;
1876
-
1877
- /**
1878
- * Line Spacing Picker Component (Radix UI)
1879
- *
1880
- * A dropdown selector for choosing line spacing values using Radix Select.
1881
- * Styled like Google Docs with options: Single, 1.15, 1.5, Double
1882
- */
1883
- interface LineSpacingOption {
1884
- label: string;
1885
- value: number;
1886
- twipsValue: number;
1887
- }
1888
- interface LineSpacingPickerProps {
1889
- value?: number;
1890
- onChange?: (twipsValue: number) => void;
1891
- options?: LineSpacingOption[];
1892
- disabled?: boolean;
1893
- className?: string;
1894
- width?: number | string;
1895
- }
1896
- declare function LineSpacingPicker({ value, onChange, options, disabled, className, }: LineSpacingPickerProps): react_jsx_runtime.JSX.Element;
1897
-
1898
- /**
1899
- * Color option for the color grid
1900
- */
1901
- interface ColorOption {
1902
- /** Display name for the color */
1903
- name: string;
1904
- /** Hex value (without #) */
1905
- hex: string;
1906
- /** Is this a theme color? */
1907
- isTheme?: boolean;
1908
- /** Theme color slot if applicable */
1909
- themeSlot?: string;
1910
- }
1911
- /**
1912
- * Props for the ColorPicker component
1913
- */
1914
- interface ColorPickerProps {
1915
- /** Current color value */
1916
- value?: string;
1917
- /** Callback when color is selected */
1918
- onChange?: (color: string) => void;
1919
- /** Type of color picker */
1920
- type?: 'text' | 'highlight';
1921
- /** Theme for resolving theme colors */
1922
- theme?: Theme | null;
1923
- /** Custom colors to display */
1924
- colors?: ColorOption[];
1925
- /** Whether the picker is disabled */
1926
- disabled?: boolean;
1927
- /** Additional CSS class name */
1928
- className?: string;
1929
- /** Additional inline styles */
1930
- style?: CSSProperties;
1931
- /** Placeholder/tooltip text */
1932
- title?: string;
1933
- /** Custom button content */
1934
- children?: ReactNode;
1935
- /** Width of the dropdown */
1936
- dropdownWidth?: number;
1937
- /** Show "No Color" option */
1938
- showNoColor?: boolean;
1939
- /** Show "More Colors" option for custom input */
1940
- showMoreColors?: boolean;
1941
- }
1942
- /**
1943
- * Color picker component with dropdown grid
1944
- */
1945
- declare function ColorPicker({ value, onChange, type, theme: _theme, colors, disabled, className, style, title, children, dropdownWidth, showNoColor, showMoreColors, }: ColorPickerProps): react_jsx_runtime.JSX.Element;
1946
-
1947
- interface StyleOption {
1948
- styleId: string;
1949
- name: string;
1950
- type: StyleType;
1951
- isDefault?: boolean;
1952
- qFormat?: boolean;
1953
- priority?: number;
1954
- /** Font size in half-points for visual preview */
1955
- fontSize?: number;
1956
- /** Bold styling */
1957
- bold?: boolean;
1958
- /** Italic styling */
1959
- italic?: boolean;
1960
- /** Text color (RGB hex) */
1961
- color?: string;
1962
- }
1963
- interface StylePickerProps {
1964
- value?: string;
1965
- onChange?: (styleId: string) => void;
1966
- styles?: Style[];
1967
- theme?: Theme | null;
1968
- disabled?: boolean;
1969
- className?: string;
1970
- width?: number | string;
1971
- }
1972
- declare function StylePicker({ value, onChange, styles, disabled, className, width, }: StylePickerProps): react_jsx_runtime.JSX.Element;
1973
-
1974
- /**
1975
- * Props for the AlignmentButtons component
1976
- */
1977
- interface AlignmentButtonsProps {
1978
- /** Current alignment value */
1979
- value?: ParagraphAlignment;
1980
- /** Callback when alignment is changed */
1981
- onChange?: (alignment: ParagraphAlignment) => void;
1982
- /** Whether the buttons are disabled */
1983
- disabled?: boolean;
1984
- /** Additional CSS class name */
1985
- className?: string;
1986
- /** Additional inline styles */
1987
- style?: CSSProperties;
1988
- /** Show labels next to icons */
1989
- showLabels?: boolean;
1990
- /** Compact mode (smaller buttons) */
1991
- compact?: boolean;
1992
- }
1993
- /**
1994
- * Alignment dropdown component — single button with popover panel
1995
- */
1996
- declare function AlignmentButtons({ value, onChange, disabled, }: AlignmentButtonsProps): react_jsx_runtime.JSX.Element;
1997
-
1998
- /**
1999
- * HorizontalRuler Component — Google Docs style
2000
- *
2001
- * 3 handles only:
2002
- * - Left side: first-line indent (▼ down at top) + left indent (▲ up at bottom)
2003
- * - Right side: right indent (▼ down at top)
2004
- *
2005
- * Margins shown as gray zones on the ruler edges.
2006
- * Drag the boundary between gray/white to adjust page margins.
2007
- * Drag tooltip shows value during any drag.
2008
- */
2009
-
2010
- interface HorizontalRulerProps {
2011
- sectionProps?: SectionProperties | null;
2012
- zoom?: number;
2013
- editable?: boolean;
2014
- onLeftMarginChange?: (marginTwips: number) => void;
2015
- onRightMarginChange?: (marginTwips: number) => void;
2016
- onFirstLineIndentChange?: (indentTwips: number) => void;
2017
- showFirstLineIndent?: boolean;
2018
- firstLineIndent?: number;
2019
- hangingIndent?: boolean;
2020
- indentLeft?: number;
2021
- indentRight?: number;
2022
- onIndentLeftChange?: (indentTwips: number) => void;
2023
- onIndentRightChange?: (indentTwips: number) => void;
2024
- unit?: 'inch' | 'cm';
2025
- className?: string;
2026
- style?: CSSProperties;
2027
- tabStops?: TabStop[] | null;
2028
- onTabStopRemove?: (positionTwips: number) => void;
2029
- }
2030
- 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;
2031
- declare function positionToMargin(positionPx: number, side: 'left' | 'right', pageWidthPx: number, zoom: number): number;
2032
- declare function getRulerDimensions(sectionProps?: SectionProperties | null, zoom?: number): {
2033
- width: number;
2034
- leftMargin: number;
2035
- rightMargin: number;
2036
- contentWidth: number;
2037
- };
2038
- declare function getMarginInUnits(marginTwips: number, unit: 'inch' | 'cm'): string;
2039
- declare function parseMarginFromUnits(value: string, unit: 'inch' | 'cm'): number | null;
2040
-
2041
- interface TableBorderPickerProps {
2042
- onAction: (action: TableAction) => void;
2043
- disabled?: boolean;
2044
- }
2045
- declare function TableBorderPicker({ onAction, disabled }: TableBorderPickerProps): react_jsx_runtime.JSX.Element;
2046
-
2047
- interface TableBorderColorPickerProps {
2048
- onAction: (action: TableAction) => void;
2049
- disabled?: boolean;
2050
- }
2051
- declare function TableBorderColorPicker({ onAction, disabled, }: TableBorderColorPickerProps): react_jsx_runtime.JSX.Element;
2052
-
2053
- interface TableBorderWidthPickerProps {
2054
- onAction: (action: TableAction) => void;
2055
- disabled?: boolean;
2056
- }
2057
- declare function TableBorderWidthPicker({ onAction, disabled, }: TableBorderWidthPickerProps): react_jsx_runtime.JSX.Element;
2058
-
2059
- interface TableCellFillPickerProps {
2060
- onAction: (action: TableAction) => void;
2061
- disabled?: boolean;
2062
- }
2063
- declare function TableCellFillPicker({ onAction, disabled }: TableCellFillPickerProps): react_jsx_runtime.JSX.Element;
2064
-
2065
- interface TableMergeButtonProps {
2066
- onAction: (action: TableAction) => void;
2067
- disabled?: boolean;
2068
- canMerge?: boolean;
2069
- canSplit?: boolean;
2070
- }
2071
- declare function TableMergeButton({ onAction, disabled, canMerge, canSplit, }: TableMergeButtonProps): react_jsx_runtime.JSX.Element;
2072
-
2073
- interface TableInsertButtonsProps {
2074
- onAction: (action: TableAction) => void;
2075
- disabled?: boolean;
2076
- }
2077
- declare function TableInsertButtons({ onAction, disabled }: TableInsertButtonsProps): react_jsx_runtime.JSX.Element;
2078
-
2079
- interface TableMoreDropdownProps {
2080
- onAction: (action: TableAction) => void;
2081
- disabled?: boolean;
2082
- tableContext?: {
2083
- isInTable: boolean;
2084
- rowCount?: number;
2085
- columnCount?: number;
2086
- canSplitCell?: boolean;
2087
- hasMultiCellSelection?: boolean;
2088
- table?: {
2089
- attrs?: {
2090
- justification?: string;
2091
- };
2092
- };
2093
- } | null;
2094
- }
2095
- declare function TableMoreDropdown({ onAction, disabled, tableContext, }: TableMoreDropdownProps): react_jsx_runtime.JSX.Element;
2096
-
2097
- /**
2098
- * CellBackgroundPicker Component
2099
- *
2100
- * UI for changing table cell background/shading color.
2101
- * Provides a color grid similar to the text highlight picker but
2102
- * optimized for table cell backgrounds.
2103
- */
2104
-
2105
- /**
2106
- * Color option for the picker
2107
- */
2108
- interface CellColorOption {
2109
- /** Hex color value */
2110
- hex: string;
2111
- /** Display name */
2112
- name: string;
2113
- }
2114
- /**
2115
- * Props for CellBackgroundPicker
2116
- */
2117
- interface CellBackgroundPickerProps {
2118
- /** Current background color (hex) */
2119
- value?: string | null;
2120
- /** Callback when color is selected */
2121
- onChange?: (color: string | null) => void;
2122
- /** Custom color options */
2123
- colors?: CellColorOption[];
2124
- /** Whether the picker is disabled */
2125
- disabled?: boolean;
2126
- /** Additional CSS class */
2127
- className?: string;
2128
- /** Additional inline styles */
2129
- style?: CSSProperties;
2130
- /** Show "No Fill" option (default: true) */
2131
- showNoFill?: boolean;
2132
- /** Show custom color input (default: true) */
2133
- showCustomColor?: boolean;
2134
- /** Compact mode for toolbar */
2135
- compact?: boolean;
2136
- }
2137
- /**
2138
- * Default cell background colors
2139
- * Common colors for table cell backgrounds
2140
- */
2141
- declare const DEFAULT_CELL_COLORS: CellColorOption[];
2142
- /**
2143
- * CellBackgroundPicker - Color picker for table cell backgrounds
2144
- */
2145
- declare function CellBackgroundPicker({ value, onChange, colors, disabled, className, style: additionalStyle, showNoFill, showCustomColor, compact, }: CellBackgroundPickerProps): React__default.ReactElement;
2146
- /**
2147
- * Get default cell colors
2148
- */
2149
- declare function getDefaultCellColors(): CellColorOption[];
2150
- /**
2151
- * Create a color option
2152
- */
2153
- declare function createCellColorOption(hex: string, name?: string): CellColorOption;
2154
- /**
2155
- * Check if color is in the default palette
2156
- */
2157
- declare function isDefaultCellColor(hex: string): boolean;
2158
- /**
2159
- * Get color name from hex
2160
- */
2161
- declare function getCellColorName(hex: string): string;
2162
- /**
2163
- * Create ShadingProperties from color
2164
- */
2165
- declare function createShadingFromColor(color: string | null): ShadingProperties | undefined;
2166
- /**
2167
- * Get color from ShadingProperties
2168
- */
2169
- declare function getColorFromShading(shading: ShadingProperties | undefined): string | null;
2170
- /**
2171
- * Get contrasting text color (black or white) for a background
2172
- */
2173
- declare function getContrastingTextColor(bgHex: string): string;
2174
-
2175
- /**
2176
- * Unsaved Changes Indicator Component
2177
- *
2178
- * Visual indicator that shows when document has unsaved changes.
2179
- * Features:
2180
- * - Configurable appearance (dot, badge, text)
2181
- * - Pulse animation option for visibility
2182
- * - Hook for tracking changes
2183
- * - Browser beforeunload warning
2184
- */
2185
-
2186
- /**
2187
- * Indicator variant type
2188
- */
2189
- type IndicatorVariant = 'dot' | 'badge' | 'text' | 'icon';
2190
- /**
2191
- * Indicator position type
2192
- */
2193
- type IndicatorPosition = 'inline' | 'absolute-top-right' | 'absolute-top-left';
2194
- /**
2195
- * Unsaved indicator props
2196
- */
2197
- interface UnsavedIndicatorProps {
2198
- /** Whether there are unsaved changes */
2199
- hasUnsavedChanges: boolean;
2200
- /** Variant of the indicator */
2201
- variant?: IndicatorVariant;
2202
- /** Position of the indicator */
2203
- position?: IndicatorPosition;
2204
- /** Whether to show pulse animation */
2205
- showPulse?: boolean;
2206
- /** Custom label for text variant */
2207
- label?: string;
2208
- /** Custom saved label for text variant */
2209
- savedLabel?: string;
2210
- /** Whether to show indicator when saved (always show) */
2211
- showWhenSaved?: boolean;
2212
- /** Custom color for unsaved state */
2213
- unsavedColor?: string;
2214
- /** Custom color for saved state */
2215
- savedColor?: string;
2216
- /** Size in pixels (for dot/icon) */
2217
- size?: number;
2218
- /** Additional className */
2219
- className?: string;
2220
- /** Additional inline styles */
2221
- style?: React__default.CSSProperties;
2222
- /** Click handler */
2223
- onClick?: () => void;
2224
- /** Title/tooltip text */
2225
- title?: string;
2226
- }
2227
- /**
2228
- * Hook options for tracking unsaved changes
2229
- */
2230
- interface UseUnsavedChangesOptions {
2231
- /** The document to track */
2232
- document?: Document | null;
2233
- /** Whether to warn before leaving page */
2234
- warnBeforeLeave?: boolean;
2235
- /** Custom warning message */
2236
- warningMessage?: string;
2237
- /** Whether tracking is enabled */
2238
- enabled?: boolean;
2239
- /** Callback when changes status changes */
2240
- onChangeStatusChange?: (hasChanges: boolean) => void;
2241
- }
2242
- /**
2243
- * Hook return value
2244
- */
2245
- interface UseUnsavedChangesReturn {
2246
- /** Whether there are unsaved changes */
2247
- hasUnsavedChanges: boolean;
2248
- /** Mark the document as saved (resets change tracking) */
2249
- markAsSaved: () => void;
2250
- /** Mark the document as changed */
2251
- markAsChanged: () => void;
2252
- /** Reset tracking (resets baseline) */
2253
- resetTracking: (newDocument?: Document | null) => void;
2254
- /** The last saved document snapshot */
2255
- lastSavedDocument: Document | null;
2256
- /** Number of changes since last save */
2257
- changeCount: number;
2258
- }
2259
- declare const UnsavedIndicator: React__default.FC<UnsavedIndicatorProps>;
2260
- /**
2261
- * Hook to track unsaved changes in a document
2262
- */
2263
- declare function useUnsavedChanges(options?: UseUnsavedChangesOptions): UseUnsavedChangesReturn;
2264
- /**
2265
- * Get indicator variant label
2266
- */
2267
- declare function getVariantLabel(variant: IndicatorVariant): string;
2268
- /**
2269
- * Get all indicator variants
2270
- */
2271
- declare function getAllVariants(): IndicatorVariant[];
2272
- /**
2273
- * Get all indicator positions
2274
- */
2275
- declare function getAllPositions(): IndicatorPosition[];
2276
- /**
2277
- * Create a document change tracker
2278
- * Simple utility for external change tracking
2279
- */
2280
- declare function createChangeTracker(): {
2281
- markChanged: () => void;
2282
- markSaved: () => void;
2283
- getState: () => {
2284
- changeCount: number;
2285
- lastSaveTime: Date | null;
2286
- hasUnsavedChanges: boolean;
2287
- };
2288
- reset: () => void;
2289
- };
2290
-
2291
- /**
2292
- * Loading Indicator Component
2293
- *
2294
- * Displays loading states for operations with configurable appearance.
2295
- * Features:
2296
- * - Multiple spinner styles (spinner, dots, bar, pulse)
2297
- * - Overlay mode for blocking UI during operations
2298
- * - Inline mode for subtle loading indication
2299
- * - Progress bar variant
2300
- * - Hook for managing loading states
2301
- */
2302
-
2303
- /**
2304
- * Loading indicator variant
2305
- */
2306
- type LoadingVariant = 'spinner' | 'dots' | 'bar' | 'pulse' | 'progress';
2307
- /**
2308
- * Loading indicator size
2309
- */
2310
- type LoadingSize = 'small' | 'medium' | 'large';
2311
- /**
2312
- * Loading indicator props
2313
- */
2314
- interface LoadingIndicatorProps {
2315
- /** Whether loading is active */
2316
- isLoading: boolean;
2317
- /** Variant of the loading indicator */
2318
- variant?: LoadingVariant;
2319
- /** Size of the indicator */
2320
- size?: LoadingSize;
2321
- /** Loading message to display */
2322
- message?: string;
2323
- /** Whether to show as full-screen overlay */
2324
- overlay?: boolean;
2325
- /** Overlay background opacity (0-1) */
2326
- overlayOpacity?: number;
2327
- /** Progress percentage (0-100) for progress variant */
2328
- progress?: number;
2329
- /** Show progress percentage text */
2330
- showProgressText?: boolean;
2331
- /** Custom color */
2332
- color?: string;
2333
- /** Additional className */
2334
- className?: string;
2335
- /** Additional inline styles */
2336
- style?: React__default.CSSProperties;
2337
- }
2338
- /**
2339
- * Options for useLoading hook
2340
- */
2341
- interface UseLoadingOptions {
2342
- /** Initial loading state */
2343
- initialLoading?: boolean;
2344
- /** Minimum loading duration in ms (prevents flash) */
2345
- minDuration?: number;
2346
- /** Callback when loading starts */
2347
- onStart?: () => void;
2348
- /** Callback when loading ends */
2349
- onEnd?: () => void;
2350
- }
2351
- /**
2352
- * Return value of useLoading hook
2353
- */
2354
- interface UseLoadingReturn {
2355
- /** Current loading state */
2356
- isLoading: boolean;
2357
- /** Current message */
2358
- message: string | null;
2359
- /** Current progress (0-100) */
2360
- progress: number;
2361
- /** Start loading with optional message */
2362
- startLoading: (message?: string) => void;
2363
- /** Stop loading */
2364
- stopLoading: () => void;
2365
- /** Update progress (0-100) */
2366
- setProgress: (progress: number) => void;
2367
- /** Update message */
2368
- setMessage: (message: string | null) => void;
2369
- /** Wrap an async operation with loading state */
2370
- withLoading: <T>(operation: () => Promise<T>, message?: string) => Promise<T>;
2371
- }
2372
- /**
2373
- * Loading operation state
2374
- */
2375
- interface LoadingOperation {
2376
- id: string;
2377
- message?: string;
2378
- progress?: number;
2379
- startTime: number;
2380
- }
2381
- declare const LoadingIndicator: React__default.FC<LoadingIndicatorProps>;
2382
- /**
2383
- * Hook to manage loading states
2384
- */
2385
- declare function useLoading(options?: UseLoadingOptions): UseLoadingReturn;
2386
- /**
2387
- * Hook to manage multiple concurrent loading operations
2388
- */
2389
- declare function useLoadingOperations(): {
2390
- operations: LoadingOperation[];
2391
- isAnyLoading: boolean;
2392
- startOperation: (id: string, message?: string) => void;
2393
- updateOperation: (id: string, updates: Partial<LoadingOperation>) => void;
2394
- endOperation: (id: string) => void;
2395
- getOperation: (id: string) => LoadingOperation | undefined;
2396
- };
2397
- /**
2398
- * Get loading variant label
2399
- */
2400
- declare function getLoadingVariantLabel(variant: LoadingVariant): string;
2401
- /**
2402
- * Get all loading variants
2403
- */
2404
- declare function getAllLoadingVariants(): LoadingVariant[];
2405
- /**
2406
- * Get all loading sizes
2407
- */
2408
- declare function getAllLoadingSizes(): LoadingSize[];
2409
- /**
2410
- * Create a delay promise for testing loading states
2411
- */
2412
- declare function delay(ms: number): Promise<void>;
2413
-
2414
- /**
2415
- * Responsive Toolbar Component
2416
- *
2417
- * A responsive toolbar wrapper that collapses items into an overflow menu
2418
- * when the screen is narrow.
2419
- *
2420
- * Features:
2421
- * - Automatically measures available space
2422
- * - Moves items to overflow menu when they don't fit
2423
- * - Priority-based item ordering
2424
- * - Configurable breakpoints
2425
- * - ResizeObserver for dynamic resizing
2426
- */
2427
-
2428
- /**
2429
- * Priority level for toolbar items
2430
- * Lower numbers = higher priority (shown first, hidden last)
2431
- */
2432
- type ToolbarItemPriority = 1 | 2 | 3 | 4 | 5;
2433
- /**
2434
- * Toolbar item configuration
2435
- */
2436
- interface ToolbarItem {
2437
- /** Unique identifier */
2438
- id: string;
2439
- /** The content to render */
2440
- content: ReactNode;
2441
- /** Priority level (1 = highest, 5 = lowest) */
2442
- priority?: ToolbarItemPriority;
2443
- /** Minimum width in pixels (for measuring) */
2444
- minWidth?: number;
2445
- /** Whether this item should never be hidden */
2446
- alwaysVisible?: boolean;
2447
- /** Whether to show separator after this item */
2448
- separatorAfter?: boolean;
2449
- /** Group name for keeping items together */
2450
- group?: string;
2451
- }
2452
- /**
2453
- * Props for ResponsiveToolbar component
2454
- */
2455
- interface ResponsiveToolbarProps {
2456
- /** Toolbar items */
2457
- items: ToolbarItem[];
2458
- /** Additional items for overflow menu only */
2459
- overflowItems?: ToolbarItem[];
2460
- /** Whether to show overflow button even when all items fit */
2461
- alwaysShowOverflow?: boolean;
2462
- /** Custom overflow button renderer */
2463
- renderOverflowButton?: (itemCount: number, isOpen: boolean, onClick: () => void) => ReactNode;
2464
- /** Custom overflow menu renderer */
2465
- renderOverflowMenu?: (items: ToolbarItem[], onClose: () => void) => ReactNode;
2466
- /** Gap between items in pixels */
2467
- itemGap?: number;
2468
- /** Padding for the toolbar */
2469
- padding?: number | string;
2470
- /** Minimum width for overflow button */
2471
- overflowButtonWidth?: number;
2472
- /** Additional className */
2473
- className?: string;
2474
- /** Additional styles */
2475
- style?: CSSProperties;
2476
- /** Height of the toolbar */
2477
- height?: number | string;
2478
- /** Background color */
2479
- backgroundColor?: string;
2480
- /** Border styles */
2481
- borderBottom?: string;
2482
- }
2483
- /**
2484
- * Options for useResponsiveToolbar hook
2485
- */
2486
- interface UseResponsiveToolbarOptions {
2487
- /** Container ref */
2488
- containerRef: React__default.RefObject<HTMLElement | null>;
2489
- /** Total items */
2490
- items: ToolbarItem[];
2491
- /** Gap between items */
2492
- itemGap?: number;
2493
- /** Width reserved for overflow button */
2494
- overflowButtonWidth?: number;
2495
- }
2496
- /**
2497
- * Return value of useResponsiveToolbar hook
2498
- */
2499
- interface UseResponsiveToolbarReturn {
2500
- /** Items that fit in visible area */
2501
- visibleItems: ToolbarItem[];
2502
- /** Items in overflow menu */
2503
- overflowItems: ToolbarItem[];
2504
- /** Whether overflow menu is needed */
2505
- hasOverflow: boolean;
2506
- /** Force a recalculation */
2507
- recalculate: () => void;
2508
- }
2509
- /**
2510
- * Hook to calculate which items fit in the toolbar
2511
- */
2512
- declare function useResponsiveToolbar(options: UseResponsiveToolbarOptions): UseResponsiveToolbarReturn;
2513
- declare const ResponsiveToolbar: React__default.FC<ResponsiveToolbarProps>;
2514
- interface ToolbarGroupProps {
2515
- /** Group items */
2516
- children: ReactNode;
2517
- /** Gap between items */
2518
- gap?: number;
2519
- /** Whether to show separator after group */
2520
- separatorAfter?: boolean;
2521
- /** Additional className */
2522
- className?: string;
2523
- /** Additional styles */
2524
- style?: CSSProperties;
2525
- }
2526
- declare const ToolbarGroup: React__default.FC<ToolbarGroupProps>;
2527
- /**
2528
- * Create a toolbar item
2529
- */
2530
- declare function createToolbarItem(id: string, content: ReactNode, options?: Partial<Omit<ToolbarItem, 'id' | 'content'>>): ToolbarItem;
2531
- /**
2532
- * Create toolbar items from an array of configs
2533
- */
2534
- declare function createToolbarItems(configs: Array<{
2535
- id: string;
2536
- content: ReactNode;
2537
- priority?: ToolbarItemPriority;
2538
- minWidth?: number;
2539
- alwaysVisible?: boolean;
2540
- separatorAfter?: boolean;
2541
- group?: string;
2542
- }>): ToolbarItem[];
2543
- /**
2544
- * Get recommended priority for common toolbar items
2545
- */
2546
- declare function getRecommendedPriority(itemType: string): ToolbarItemPriority;
2547
-
2548
- /**
2549
- * Find & Replace Utility Functions
2550
- *
2551
- * Pure utility functions for text search, pattern matching, and document search.
2552
- * Extracted from FindReplaceDialog.tsx.
2553
- */
2554
- /**
2555
- * A single match result in the document
2556
- */
2557
- interface FindMatch {
2558
- /** Index of the paragraph containing the match */
2559
- paragraphIndex: number;
2560
- /** Index of the run/content within the paragraph */
2561
- contentIndex: number;
2562
- /** Character offset within the content */
2563
- startOffset: number;
2564
- /** Character offset for end of match */
2565
- endOffset: number;
2566
- /** The matched text */
2567
- text: string;
2568
- }
2569
- /**
2570
- * Find options for controlling search behavior
2571
- */
2572
- interface FindOptions {
2573
- /** Whether to match case */
2574
- matchCase: boolean;
2575
- /** Whether to match whole words only */
2576
- matchWholeWord: boolean;
2577
- /** Whether to use regular expressions (future) */
2578
- useRegex?: boolean;
2579
- }
2580
- /**
2581
- * Find result with all matches
2582
- */
2583
- interface FindResult {
2584
- /** All matches found */
2585
- matches: FindMatch[];
2586
- /** Total match count */
2587
- totalCount: number;
2588
- /** Current match index (0-based) */
2589
- currentIndex: number;
2590
- }
2591
- /**
2592
- * Highlight options for document rendering
2593
- */
2594
- interface HighlightOptions {
2595
- /** Background color for current match */
2596
- currentMatchColor: string;
2597
- /** Background color for other matches */
2598
- otherMatchColor: string;
2599
- }
2600
- /**
2601
- * Create default find options
2602
- */
2603
- declare function createDefaultFindOptions(): FindOptions;
2604
- /**
2605
- * Escape string for use in regex pattern
2606
- */
2607
- declare function escapeRegexString(str: string): string;
2608
- /**
2609
- * Create a regex pattern from search text and options
2610
- */
2611
- declare function createSearchPattern(searchText: string, options: FindOptions): RegExp | null;
2612
- /**
2613
- * Find all matches of search text in content
2614
- */
2615
- declare function findAllMatches(content: string, searchText: string, options: FindOptions): Array<{
2616
- start: number;
2617
- end: number;
2618
- }>;
2619
- /**
2620
- * Replace text in content
2621
- */
2622
- declare function replaceAllInContent(content: string, searchText: string, replaceText: string, options: FindOptions): string;
2623
- /**
2624
- * Replace first match in content
2625
- */
2626
- declare function replaceFirstInContent(content: string, searchText: string, replaceText: string, options: FindOptions, startIndex?: number): {
2627
- content: string;
2628
- replaced: boolean;
2629
- matchStart: number;
2630
- matchEnd: number;
2631
- };
2632
- /**
2633
- * Get match count for status display
2634
- */
2635
- declare function getMatchCountText(result: FindResult | null): string;
2636
- /**
2637
- * Check if search text is empty or whitespace-only
2638
- */
2639
- declare function isEmptySearch(searchText: string): boolean;
2640
- /**
2641
- * Get default highlight options
2642
- */
2643
- declare function getDefaultHighlightOptions(): HighlightOptions;
2644
- /**
2645
- * Find all matches in a document
2646
- */
2647
- declare function findInDocument(document: any, searchText: string, options: FindOptions): FindMatch[];
2648
- /**
2649
- * Find matches in a single paragraph
2650
- */
2651
- declare function findInParagraph(paragraph: any, searchText: string, options: FindOptions, paragraphIndex: number): FindMatch[];
2652
- /**
2653
- * Scroll to a match in the document
2654
- */
2655
- declare function scrollToMatch(containerElement: HTMLElement | null, match: FindMatch): void;
2656
-
2657
- /**
2658
- * useFindReplace Hook
2659
- *
2660
- * React hook for managing find/replace dialog state.
2661
- * Extracted from FindReplaceDialog.tsx.
2662
- */
2663
-
2664
- /**
2665
- * Options for the useFindReplace hook
2666
- */
2667
- interface FindReplaceOptions {
2668
- /** Whether to show replace functionality initially */
2669
- initialReplaceMode?: boolean;
2670
- /** Callback when matches change */
2671
- onMatchesChange?: (matches: FindMatch[]) => void;
2672
- /** Callback when current match changes */
2673
- onCurrentMatchChange?: (match: FindMatch | null, index: number) => void;
2674
- }
2675
- /**
2676
- * State for the find/replace hook
2677
- */
2678
- interface FindReplaceState {
2679
- /** Whether the dialog is open */
2680
- isOpen: boolean;
2681
- /** Current search text */
2682
- searchText: string;
2683
- /** Current replace text */
2684
- replaceText: string;
2685
- /** Find options */
2686
- options: FindOptions;
2687
- /** All matches found */
2688
- matches: FindMatch[];
2689
- /** Current match index */
2690
- currentIndex: number;
2691
- /** Whether in replace mode */
2692
- replaceMode: boolean;
2693
- }
2694
- /**
2695
- * Return type for the useFindReplace hook
2696
- */
2697
- interface UseFindReplaceReturn {
2698
- /** Current state */
2699
- state: FindReplaceState;
2700
- /** Open the find dialog */
2701
- openFind: (selectedText?: string) => void;
2702
- /** Open the replace dialog */
2703
- openReplace: (selectedText?: string) => void;
2704
- /** Close the dialog */
2705
- close: () => void;
2706
- /** Toggle dialog visibility */
2707
- toggle: () => void;
2708
- /** Update search text */
2709
- setSearchText: (text: string) => void;
2710
- /** Update replace text */
2711
- setReplaceText: (text: string) => void;
2712
- /** Update find options */
2713
- setOptions: (options: Partial<FindOptions>) => void;
2714
- /** Set search results */
2715
- setMatches: (matches: FindMatch[], currentIndex?: number) => void;
2716
- /** Go to next match */
2717
- goToNextMatch: () => number;
2718
- /** Go to previous match */
2719
- goToPreviousMatch: () => number;
2720
- /** Go to a specific match by index */
2721
- goToMatch: (index: number) => void;
2722
- /** Get current match */
2723
- getCurrentMatch: () => FindMatch | null;
2724
- /** Check if has matches */
2725
- hasMatches: () => boolean;
2726
- }
2727
- /**
2728
- * Hook for managing find/replace dialog state
2729
- */
2730
- declare function useFindReplace(hookOptions?: FindReplaceOptions): UseFindReplaceReturn;
2731
-
2732
- /**
2733
- * Find and Replace Dialog Component
2734
- *
2735
- * Modal dialog for searching and replacing text in the document.
2736
- * Supports find, find next/previous, replace, and replace all operations.
2737
- *
2738
- * Logic and utilities are in separate files:
2739
- * - findReplaceUtils.ts — Pure search/replace functions and types
2740
- * - useFindReplace.ts — React hook for dialog state management
2741
- */
2742
-
2743
- /**
2744
- * Props for the FindReplaceDialog component
2745
- */
2746
- interface FindReplaceDialogProps {
2747
- /** Whether the dialog is open */
2748
- isOpen: boolean;
2749
- /** Callback when dialog is closed */
2750
- onClose: () => void;
2751
- /** Callback when searching for text */
2752
- onFind: (searchText: string, options: FindOptions) => FindResult | null;
2753
- /** Callback when navigating to next match */
2754
- onFindNext: () => FindMatch | null;
2755
- /** Callback when navigating to previous match */
2756
- onFindPrevious: () => FindMatch | null;
2757
- /** Callback when replacing current match */
2758
- onReplace: (replaceText: string) => boolean;
2759
- /** Callback when replacing all matches */
2760
- onReplaceAll: (searchText: string, replaceText: string, options: FindOptions) => number;
2761
- /** Callback to highlight matches in document */
2762
- onHighlightMatches?: (matches: FindMatch[]) => void;
2763
- /** Callback to clear highlights */
2764
- onClearHighlights?: () => void;
2765
- /** Initial search text (e.g., from selected text) */
2766
- initialSearchText?: string;
2767
- /** Whether to start in replace mode */
2768
- replaceMode?: boolean;
2769
- /** Current match result (from external state) */
2770
- currentResult?: FindResult | null;
2771
- /** Additional CSS class */
2772
- className?: string;
2773
- /** Additional inline styles */
2774
- style?: CSSProperties;
2775
- }
2776
- /**
2777
- * FindReplaceDialog component - Modal for finding and replacing text
2778
- */
2779
- declare function FindReplaceDialog({ isOpen, onClose, onFind, onFindNext, onFindPrevious, onReplace, onReplaceAll, onHighlightMatches, onClearHighlights, initialSearchText, replaceMode, currentResult, className, style, }: FindReplaceDialogProps): React__default.ReactElement | null;
2780
-
2781
- /**
2782
- * Hyperlink Dialog Component
2783
- *
2784
- * Modal dialog for inserting and editing hyperlinks in the document.
2785
- * Supports both external URLs and internal bookmark links.
2786
- *
2787
- * Features:
2788
- * - Input for URL (http, https, mailto, tel, etc.)
2789
- * - Input for display text
2790
- * - Edit existing hyperlinks
2791
- * - Remove hyperlink option
2792
- * - Internal bookmark selection
2793
- * - Validation and error handling
2794
- */
2795
-
2796
- /**
2797
- * Hyperlink data structure for dialog
2798
- */
2799
- interface HyperlinkData {
2800
- /** URL for external link */
2801
- url?: string;
2802
- /** Display text for the link */
2803
- displayText?: string;
2804
- /** Internal bookmark name */
2805
- bookmark?: string;
2806
- /** Tooltip text */
2807
- tooltip?: string;
2808
- }
2809
- /**
2810
- * Bookmark option for internal link selection
2811
- */
2812
- interface BookmarkOption {
2813
- /** Bookmark name/ID */
2814
- name: string;
2815
- /** Optional display label */
2816
- label?: string;
2817
- }
2818
- /**
2819
- * Props for the HyperlinkDialog component
2820
- */
2821
- interface HyperlinkDialogProps {
2822
- /** Whether the dialog is open */
2823
- isOpen: boolean;
2824
- /** Callback when dialog is closed */
2825
- onClose: () => void;
2826
- /** Callback when hyperlink is inserted/updated */
2827
- onSubmit: (data: HyperlinkData) => void;
2828
- /** Callback when hyperlink is removed */
2829
- onRemove?: () => void;
2830
- /** Initial data for editing existing hyperlink */
2831
- initialData?: HyperlinkData;
2832
- /** Currently selected text (used as default display text) */
2833
- selectedText?: string;
2834
- /** Whether we're editing an existing hyperlink */
2835
- isEditing?: boolean;
2836
- /** Available bookmarks for internal links */
2837
- bookmarks?: BookmarkOption[];
2838
- /** Additional CSS class */
2839
- className?: string;
2840
- /** Additional inline styles */
2841
- style?: CSSProperties;
2842
- }
2843
- /**
2844
- * HyperlinkDialog component - Modal for inserting/editing hyperlinks
2845
- */
2846
- declare function HyperlinkDialog({ isOpen, onClose, onSubmit, onRemove, initialData, selectedText, isEditing, bookmarks, className, style, }: HyperlinkDialogProps): React__default.ReactElement | null;
2847
- /**
2848
- * Hook state for the Hyperlink dialog
2849
- */
2850
- interface UseHyperlinkDialogState {
2851
- /** Whether the dialog is open */
2852
- isOpen: boolean;
2853
- /** Initial data for the dialog (for editing) */
2854
- initialData?: HyperlinkData;
2855
- /** Currently selected text */
2856
- selectedText?: string;
2857
- /** Whether we're editing an existing hyperlink */
2858
- isEditing: boolean;
2859
- }
2860
- /**
2861
- * Hook return type for the Hyperlink dialog
2862
- */
2863
- interface UseHyperlinkDialogReturn {
2864
- /** Current state */
2865
- state: UseHyperlinkDialogState;
2866
- /** Open dialog for inserting new hyperlink */
2867
- openInsert: (selectedText?: string) => void;
2868
- /** Open dialog for editing existing hyperlink */
2869
- openEdit: (data: HyperlinkData) => void;
2870
- /** Close the dialog */
2871
- close: () => void;
2872
- /** Toggle dialog open/closed */
2873
- toggle: () => void;
2874
- }
2875
- /**
2876
- * Hook for managing Hyperlink dialog state
2877
- */
2878
- declare function useHyperlinkDialog(): UseHyperlinkDialogReturn;
2879
-
2880
- /**
2881
- * Insert Table Dialog Component
2882
- *
2883
- * Modal dialog for inserting a new table into the document.
2884
- * Provides a visual grid selector for choosing rows and columns.
2885
- *
2886
- * Features:
2887
- * - Visual grid selector (hover to select dimensions)
2888
- * - Manual row/column input
2889
- * - Preview of table dimensions
2890
- * - Quick insert with default sizes
2891
- */
2892
-
2893
- /**
2894
- * Table configuration for insertion
2895
- */
2896
- interface TableConfig {
2897
- /** Number of rows */
2898
- rows: number;
2899
- /** Number of columns */
2900
- columns: number;
2901
- }
2902
- /**
2903
- * Props for InsertTableDialog
2904
- */
2905
- interface InsertTableDialogProps {
2906
- /** Whether the dialog is open */
2907
- isOpen: boolean;
2908
- /** Callback when dialog is closed */
2909
- onClose: () => void;
2910
- /** Callback when table is inserted */
2911
- onInsert: (config: TableConfig) => void;
2912
- /** Maximum rows in grid selector (default: 8) */
2913
- maxGridRows?: number;
2914
- /** Maximum columns in grid selector (default: 10) */
2915
- maxGridColumns?: number;
2916
- /** Maximum allowed rows (default: 100) */
2917
- maxRows?: number;
2918
- /** Maximum allowed columns (default: 20) */
2919
- maxColumns?: number;
2920
- /** Additional CSS class */
2921
- className?: string;
2922
- /** Additional inline styles */
2923
- style?: CSSProperties;
2924
- }
2925
- /**
2926
- * InsertTableDialog - Modal for inserting tables with visual grid selector
2927
- */
2928
- declare function InsertTableDialog({ isOpen, onClose, onInsert, maxGridRows, maxGridColumns, maxRows, maxColumns, className, style, }: InsertTableDialogProps): React__default.ReactElement | null;
2929
- /**
2930
- * Hook for managing Insert Table dialog state
2931
- */
2932
- declare function useInsertTableDialog(): {
2933
- isOpen: boolean;
2934
- open: () => void;
2935
- close: () => void;
2936
- toggle: () => void;
2937
- };
2938
- /**
2939
- * Create a default TableConfig
2940
- */
2941
- declare function createDefaultTableConfig(rows?: number, columns?: number): TableConfig;
2942
- /**
2943
- * Validate TableConfig
2944
- */
2945
- declare function isValidTableConfig(config: TableConfig, maxRows?: number, maxColumns?: number): boolean;
2946
- /**
2947
- * Clamp TableConfig to valid range
2948
- */
2949
- declare function clampTableConfig(config: TableConfig, maxRows?: number, maxColumns?: number): TableConfig;
2950
- /**
2951
- * Format table dimensions for display
2952
- */
2953
- declare function formatTableDimensions(config: TableConfig): string;
2954
- /**
2955
- * Get common table presets
2956
- */
2957
- declare function getTablePresets(): {
2958
- label: string;
2959
- config: TableConfig;
2960
- }[];
2961
-
2962
- /**
2963
- * Insert Image Dialog Component
2964
- *
2965
- * Modal dialog for inserting images into the document.
2966
- * Supports file upload with preview and basic sizing options.
2967
- *
2968
- * Features:
2969
- * - File input for image selection
2970
- * - Drag and drop support
2971
- * - Image preview
2972
- * - Width/height controls with aspect ratio lock
2973
- * - Alt text input
2974
- */
2975
-
2976
- /**
2977
- * Image data for insertion
2978
- */
2979
- interface ImageData {
2980
- /** Base64 data URL or external URL */
2981
- src: string;
2982
- /** Image width in pixels */
2983
- width: number;
2984
- /** Image height in pixels */
2985
- height: number;
2986
- /** Alt text for accessibility */
2987
- alt?: string;
2988
- /** Original file name */
2989
- fileName?: string;
2990
- /** MIME type */
2991
- mimeType?: string;
2992
- }
2993
- /**
2994
- * Props for InsertImageDialog
2995
- */
2996
- interface InsertImageDialogProps {
2997
- /** Whether the dialog is open */
2998
- isOpen: boolean;
2999
- /** Callback when dialog is closed */
3000
- onClose: () => void;
3001
- /** Callback when image is inserted */
3002
- onInsert: (data: ImageData) => void;
3003
- /** Maximum width in pixels (default: 800) */
3004
- maxWidth?: number;
3005
- /** Maximum height in pixels (default: 600) */
3006
- maxHeight?: number;
3007
- /** Accepted file types (default: image/*) */
3008
- accept?: string;
3009
- /** Additional CSS class */
3010
- className?: string;
3011
- /** Additional inline styles */
3012
- style?: CSSProperties;
3013
- }
3014
- /**
3015
- * InsertImageDialog - Modal for inserting images with preview and sizing
3016
- */
3017
- declare function InsertImageDialog({ isOpen, onClose, onInsert, maxWidth, maxHeight, accept, className, style, }: InsertImageDialogProps): React__default.ReactElement | null;
3018
- /**
3019
- * Hook for managing Insert Image dialog state
3020
- */
3021
- declare function useInsertImageDialog(): {
3022
- isOpen: boolean;
3023
- open: () => void;
3024
- close: () => void;
3025
- toggle: () => void;
3026
- };
3027
- /**
3028
- * Check if a file is a valid image
3029
- */
3030
- declare function isValidImageFile(file: File): boolean;
3031
- /**
3032
- * Get supported image extensions
3033
- */
3034
- declare function getSupportedImageExtensions(): string[];
3035
- /**
3036
- * Get accept string for file input
3037
- */
3038
- declare function getImageAcceptString(): string;
3039
- /**
3040
- * Calculate scaled dimensions to fit within bounds
3041
- */
3042
- declare function calculateFitDimensions(originalWidth: number, originalHeight: number, maxWidth: number, maxHeight: number): {
3043
- width: number;
3044
- height: number;
3045
- };
3046
- /**
3047
- * Convert data URL to Blob
3048
- */
3049
- declare function dataUrlToBlob(dataUrl: string): Blob;
3050
- /**
3051
- * Get image dimensions from a data URL
3052
- */
3053
- declare function getImageDimensions(src: string): Promise<{
3054
- width: number;
3055
- height: number;
3056
- }>;
3057
- /**
3058
- * Format file size for display
3059
- */
3060
- declare function formatFileSize(bytes: number): string;
3061
-
3062
- /**
3063
- * Insert Symbol Dialog Component
3064
- *
3065
- * Modal dialog for inserting special characters and symbols into the document.
3066
- * Provides categorized symbol picker with search functionality.
3067
- *
3068
- * Features:
3069
- * - Categorized symbol groups
3070
- * - Recent symbols
3071
- * - Search functionality
3072
- * - Unicode character display
3073
- */
3074
-
3075
- /**
3076
- * Symbol category
3077
- */
3078
- interface SymbolCategory {
3079
- /** Category name */
3080
- name: string;
3081
- /** Display label */
3082
- label: string;
3083
- /** Symbols in this category */
3084
- symbols: string[];
3085
- }
3086
- /**
3087
- * Props for InsertSymbolDialog
3088
- */
3089
- interface InsertSymbolDialogProps {
3090
- /** Whether the dialog is open */
3091
- isOpen: boolean;
3092
- /** Callback when dialog is closed */
3093
- onClose: () => void;
3094
- /** Callback when symbol is inserted */
3095
- onInsert: (symbol: string) => void;
3096
- /** Recently used symbols */
3097
- recentSymbols?: string[];
3098
- /** Additional CSS class */
3099
- className?: string;
3100
- /** Additional inline styles */
3101
- style?: CSSProperties;
3102
- }
3103
- /**
3104
- * Default symbol categories
3105
- */
3106
- declare const SYMBOL_CATEGORIES: SymbolCategory[];
3107
- /**
3108
- * InsertSymbolDialog - Modal for inserting special characters
3109
- */
3110
- declare function InsertSymbolDialog({ isOpen, onClose, onInsert, recentSymbols, className, style, }: InsertSymbolDialogProps): React__default.ReactElement | null;
3111
- /**
3112
- * Hook for managing Insert Symbol dialog state with recent symbols
3113
- */
3114
- declare function useInsertSymbolDialog(maxRecent?: number): {
3115
- isOpen: boolean;
3116
- recentSymbols: string[];
3117
- open: () => void;
3118
- close: () => void;
3119
- toggle: () => void;
3120
- addRecent: (symbol: string) => void;
3121
- };
3122
- /**
3123
- * Get all symbol categories
3124
- */
3125
- declare function getSymbolCategories(): SymbolCategory[];
3126
- /**
3127
- * Get symbols by category name
3128
- */
3129
- declare function getSymbolsByCategory(categoryName: string): string[];
3130
- /**
3131
- * Get symbol Unicode info
3132
- */
3133
- declare function getSymbolInfo(symbol: string): {
3134
- character: string;
3135
- codePoint: string;
3136
- decimal: number;
3137
- hex: string;
3138
- };
3139
- /**
3140
- * Search symbols by query
3141
- */
3142
- declare function searchSymbols(query: string): string[];
3143
- /**
3144
- * Get symbol from Unicode code point string
3145
- */
3146
- declare function symbolFromCodePoint(codePointStr: string): string | null;
3147
-
3148
- /**
3149
- * Clipboard utilities for copy/paste with formatting
3150
- *
3151
- * Handles:
3152
- * - Copy: puts formatted HTML and plain text on clipboard
3153
- * - Paste: reads HTML clipboard, converts to runs with formatting
3154
- * - Handles paste from Word (cleans up Word HTML)
3155
- * - Ctrl+C, Ctrl+V, Ctrl+X keyboard shortcuts
3156
- */
3157
-
3158
- /**
3159
- * Clipboard content format
3160
- */
3161
- interface ClipboardContent {
3162
- /** Plain text representation */
3163
- plainText: string;
3164
- /** HTML representation */
3165
- html: string;
3166
- /** Internal format (JSON) for preserving full formatting */
3167
- internal?: string;
3168
- }
3169
- /**
3170
- * Parsed clipboard content
3171
- */
3172
- interface ParsedClipboardContent {
3173
- /** Runs parsed from clipboard */
3174
- runs: Run[];
3175
- /** Whether content came from Word */
3176
- fromWord: boolean;
3177
- /** Whether content came from our editor */
3178
- fromEditor: boolean;
3179
- /** Original plain text */
3180
- plainText: string;
3181
- }
3182
- /**
3183
- * Options for clipboard operations
3184
- */
3185
- interface ClipboardOptions {
3186
- /** Whether to include formatting in copy */
3187
- includeFormatting?: boolean;
3188
- /** Whether to clean Word-specific formatting */
3189
- cleanWordFormatting?: boolean;
3190
- /** Callback for handling errors */
3191
- onError?: (error: Error) => void;
3192
- }
3193
- /**
3194
- * Custom MIME type for internal clipboard format
3195
- */
3196
- declare const INTERNAL_CLIPBOARD_TYPE = "application/x-docx-editor";
3197
- /**
3198
- * Standard clipboard MIME types
3199
- */
3200
- declare const CLIPBOARD_TYPES: {
3201
- readonly HTML: "text/html";
3202
- readonly PLAIN: "text/plain";
3203
- };
3204
- /**
3205
- * Copy runs to clipboard with formatting
3206
- */
3207
- declare function copyRuns(runs: Run[], options?: ClipboardOptions): Promise<boolean>;
3208
- /**
3209
- * Copy paragraphs to clipboard with formatting
3210
- */
3211
- declare function copyParagraphs(paragraphs: Paragraph[], options?: ClipboardOptions): Promise<boolean>;
3212
- /**
3213
- * Convert runs to clipboard content (HTML and plain text)
3214
- */
3215
- declare function runsToClipboardContent(runs: Run[], includeFormatting?: boolean): ClipboardContent;
3216
- /**
3217
- * Convert paragraphs to clipboard content
3218
- */
3219
- declare function paragraphsToClipboardContent(paragraphs: Paragraph[], includeFormatting?: boolean): ClipboardContent;
3220
- /**
3221
- * Write content to clipboard
3222
- */
3223
- declare function writeToClipboard(content: ClipboardContent): Promise<boolean>;
3224
- /**
3225
- * Read content from clipboard
3226
- */
3227
- declare function readFromClipboard(options?: ClipboardOptions): Promise<ParsedClipboardContent | null>;
3228
- /**
3229
- * Handle paste event
3230
- */
3231
- declare function handlePasteEvent(event: ClipboardEvent, options?: ClipboardOptions): ParsedClipboardContent | null;
3232
- /**
3233
- * Parse HTML from clipboard
3234
- */
3235
- declare function parseClipboardHtml(html: string, plainText: string, cleanWordFormatting?: boolean): ParsedClipboardContent;
3236
- /**
3237
- * Check if HTML is from Microsoft Word
3238
- */
3239
- declare function isWordHtml(html: string): boolean;
3240
- /**
3241
- * Check if HTML is from our editor
3242
- */
3243
- declare function isEditorHtml(html: string): boolean;
3244
- /**
3245
- * Clean Microsoft Word HTML
3246
- */
3247
- declare function cleanWordHtml(html: string): string;
3248
- /**
3249
- * Convert HTML to runs
3250
- */
3251
- declare function htmlToRuns(html: string, plainTextFallback: string): Run[];
3252
- /**
3253
- * Create clipboard keyboard handlers for an editor
3254
- */
3255
- declare function createClipboardHandlers(options: {
3256
- onCopy?: () => {
3257
- runs: Run[];
3258
- } | null;
3259
- onCut?: () => {
3260
- runs: Run[];
3261
- } | null;
3262
- onPaste?: (content: ParsedClipboardContent) => void;
3263
- clipboardOptions?: ClipboardOptions;
3264
- }): {
3265
- handleCopy: (event: ClipboardEvent) => Promise<void>;
3266
- handleCut: (event: ClipboardEvent) => Promise<void>;
3267
- handlePaste: (event: ClipboardEvent) => void;
3268
- handleKeyDown: (event: KeyboardEvent) => Promise<void>;
3269
- };
3270
-
3271
- /**
3272
- * Paste Special Dialog Component
3273
- *
3274
- * Provides paste options for pasting content with or without formatting.
3275
- * Features:
3276
- * - Paste with formatting (default)
3277
- * - Paste as plain text (unformatted)
3278
- * - Keyboard shortcut: Ctrl+Shift+V opens dialog
3279
- */
3280
-
3281
- /**
3282
- * Paste option type
3283
- */
3284
- type PasteOption = 'formatted' | 'plainText';
3285
- /**
3286
- * Paste special dialog props
3287
- */
3288
- interface PasteSpecialDialogProps {
3289
- /** Whether the dialog is open */
3290
- isOpen: boolean;
3291
- /** Callback when dialog is closed */
3292
- onClose: () => void;
3293
- /** Callback when paste is confirmed */
3294
- onPaste: (content: ParsedClipboardContent, asPlainText: boolean) => void;
3295
- /** Optional custom position */
3296
- position?: {
3297
- x: number;
3298
- y: number;
3299
- };
3300
- /** Additional className */
3301
- className?: string;
3302
- }
3303
- /**
3304
- * Paste option item
3305
- */
3306
- interface PasteOptionItem {
3307
- id: PasteOption;
3308
- label: string;
3309
- description: string;
3310
- shortcut: string;
3311
- }
3312
- /**
3313
- * Hook return value for paste special
3314
- */
3315
- interface UsePasteSpecialReturn {
3316
- /** Whether the dialog is open */
3317
- isOpen: boolean;
3318
- /** Open the paste special dialog */
3319
- openDialog: () => void;
3320
- /** Close the dialog */
3321
- closeDialog: () => void;
3322
- /** Handle keyboard shortcut (Ctrl+Shift+V) */
3323
- handleKeyDown: (event: KeyboardEvent) => boolean;
3324
- /** Paste as plain text directly */
3325
- pasteAsPlainText: () => Promise<void>;
3326
- }
3327
- /**
3328
- * Options for usePasteSpecial hook
3329
- */
3330
- interface UsePasteSpecialOptions {
3331
- /** Callback when paste is confirmed */
3332
- onPaste?: (content: ParsedClipboardContent, asPlainText: boolean) => void;
3333
- /** Whether paste operations are enabled */
3334
- enabled?: boolean;
3335
- }
3336
- declare const PasteSpecialDialog: React__default.FC<PasteSpecialDialogProps>;
3337
- /**
3338
- * Hook to manage paste special dialog
3339
- */
3340
- declare function usePasteSpecial(options?: UsePasteSpecialOptions): UsePasteSpecialReturn;
3341
- /**
3342
- * Get paste option by id
3343
- */
3344
- declare function getPasteOption(id: PasteOption): PasteOptionItem | undefined;
3345
- /**
3346
- * Get all paste options
3347
- */
3348
- declare function getAllPasteOptions(): PasteOptionItem[];
3349
- /**
3350
- * Get default paste option
3351
- */
3352
- declare function getDefaultPasteOption(): PasteOption;
3353
- /**
3354
- * Check if paste special shortcut
3355
- */
3356
- declare function isPasteSpecialShortcut(event: KeyboardEvent): boolean;
3357
-
3358
- /**
3359
- * Keyboard Shortcuts Dialog Component
3360
- *
3361
- * Displays all available keyboard shortcuts organized by category.
3362
- * Features:
3363
- * - Categorized shortcut list
3364
- * - Search/filter functionality
3365
- * - Platform-aware modifier keys (Ctrl/Cmd)
3366
- * - Keyboard shortcut to open (Ctrl+/)
3367
- */
3368
-
3369
- /**
3370
- * Keyboard shortcut definition
3371
- */
3372
- interface KeyboardShortcut$1 {
3373
- /** Unique identifier */
3374
- id: string;
3375
- /** Display name */
3376
- name: string;
3377
- /** Description of what the shortcut does */
3378
- description: string;
3379
- /** Primary key combination (e.g., 'Ctrl+C') */
3380
- keys: string;
3381
- /** Alternative key combination */
3382
- altKeys?: string;
3383
- /** Category for grouping */
3384
- category: ShortcutCategory;
3385
- /** Whether this is a common/frequently used shortcut */
3386
- common?: boolean;
3387
- }
3388
- /**
3389
- * Shortcut category
3390
- */
3391
- type ShortcutCategory = 'editing' | 'formatting' | 'navigation' | 'clipboard' | 'selection' | 'view' | 'file' | 'other';
3392
- /**
3393
- * Dialog props
3394
- */
3395
- interface KeyboardShortcutsDialogProps {
3396
- /** Whether the dialog is open */
3397
- isOpen: boolean;
3398
- /** Close callback */
3399
- onClose: () => void;
3400
- /** Custom shortcuts (merged with defaults) */
3401
- customShortcuts?: KeyboardShortcut$1[];
3402
- /** Whether to show search */
3403
- showSearch?: boolean;
3404
- /** Additional className */
3405
- className?: string;
3406
- }
3407
- /**
3408
- * Hook options
3409
- */
3410
- interface UseKeyboardShortcutsDialogOptions {
3411
- /** Whether the dialog can be opened with Ctrl+? or F1 */
3412
- enabled?: boolean;
3413
- /** Custom open shortcut (default: Ctrl+/) */
3414
- openShortcut?: string;
3415
- }
3416
- /**
3417
- * Hook return value
3418
- */
3419
- interface UseKeyboardShortcutsDialogReturn {
3420
- /** Whether dialog is open */
3421
- isOpen: boolean;
3422
- /** Open the dialog */
3423
- open: () => void;
3424
- /** Close the dialog */
3425
- close: () => void;
3426
- /** Toggle the dialog */
3427
- toggle: () => void;
3428
- /** Keyboard event handler */
3429
- handleKeyDown: (event: KeyboardEvent) => void;
3430
- }
3431
- declare const KeyboardShortcutsDialog: React__default.FC<KeyboardShortcutsDialogProps>;
3432
- /**
3433
- * Hook to manage keyboard shortcuts dialog
3434
- */
3435
- declare function useKeyboardShortcutsDialog(options?: UseKeyboardShortcutsDialogOptions): UseKeyboardShortcutsDialogReturn;
3436
- /**
3437
- * Get all default shortcuts
3438
- */
3439
- declare function getDefaultShortcuts(): KeyboardShortcut$1[];
3440
- /**
3441
- * Get shortcuts by category
3442
- */
3443
- declare function getShortcutsByCategory(category: ShortcutCategory): KeyboardShortcut$1[];
3444
- /**
3445
- * Get common/frequently used shortcuts
3446
- */
3447
- declare function getCommonShortcuts(): KeyboardShortcut$1[];
3448
- /**
3449
- * Get category label
3450
- */
3451
- declare function getCategoryLabel(category: ShortcutCategory): string;
3452
- /**
3453
- * Get all categories
3454
- */
3455
- declare function getAllCategories(): ShortcutCategory[];
3456
- /**
3457
- * Format shortcut keys for display
3458
- */
3459
- declare function formatShortcutKeys(keys: string): string;
3460
-
3461
- /**
3462
- * useTableSelection Hook
3463
- *
3464
- * Tracks table selection state based on user clicks.
3465
- * Provides:
3466
- * - Current table context when clicking in a table cell
3467
- * - Methods to handle table actions (add row, delete column, etc.)
3468
- * - Clears selection when clicking outside tables
3469
- */
3470
-
3471
- /**
3472
- * Table selection state
3473
- */
3474
- interface TableSelectionState {
3475
- /** Current table context (null if not in a table) */
3476
- context: TableContext | null;
3477
- /** The selected table */
3478
- table: Table | null;
3479
- /** Index of the table in the document */
3480
- tableIndex: number | null;
3481
- /** Row index */
3482
- rowIndex: number | null;
3483
- /** Column index */
3484
- columnIndex: number | null;
3485
- }
3486
- /**
3487
- * Return type for useTableSelection hook
3488
- */
3489
- interface UseTableSelectionReturn {
3490
- /** Current table selection state */
3491
- state: TableSelectionState;
3492
- /** Handle click on a table cell */
3493
- handleCellClick: (tableIndex: number, rowIndex: number, columnIndex: number) => void;
3494
- /** Handle table action */
3495
- handleAction: (action: TableAction) => void;
3496
- /** Clear the selection */
3497
- clearSelection: () => void;
3498
- /** Check if a cell is selected */
3499
- isCellSelected: (tableIndex: number, rowIndex: number, columnIndex: number) => boolean;
3500
- /** The table context for the TableToolbar */
3501
- tableContext: TableContext | null;
3502
- }
3503
- /**
3504
- * Options for useTableSelection
3505
- */
3506
- interface UseTableSelectionOptions {
3507
- /** The document being edited */
3508
- document: Document | null;
3509
- /** Callback when document changes */
3510
- onChange?: (document: Document) => void;
3511
- /** Callback when table selection changes */
3512
- onSelectionChange?: (context: TableContext | null) => void;
3513
- }
3514
- /**
3515
- * Data attributes for table elements
3516
- */
3517
- declare const TABLE_DATA_ATTRIBUTES: {
3518
- /** Attribute for table index */
3519
- TABLE_INDEX: string;
3520
- /** Attribute for row index */
3521
- ROW_INDEX: string;
3522
- /** Attribute for column index */
3523
- COLUMN_INDEX: string;
3524
- /** Attribute marking a table cell */
3525
- TABLE_CELL: string;
3526
- };
3527
- /**
3528
- * Hook for tracking and managing table selection
3529
- */
3530
- declare function useTableSelection({ document: doc, onChange, onSelectionChange, }: UseTableSelectionOptions): UseTableSelectionReturn;
3531
-
3532
- /**
3533
- * useAutoSave Hook
3534
- *
3535
- * Automatically saves document state to localStorage at configurable intervals.
3536
- *
3537
- * Features:
3538
- * - Configurable save interval (default: 30 seconds)
3539
- * - Saves document JSON to localStorage
3540
- * - Recovery of saved state on load
3541
- * - Manual save trigger
3542
- * - Last save timestamp tracking
3543
- * - Save status callbacks
3544
- */
3545
-
3546
- /**
3547
- * Auto-save status
3548
- */
3549
- type AutoSaveStatus = 'idle' | 'saving' | 'saved' | 'error';
3550
- /**
3551
- * Options for useAutoSave hook
3552
- */
3553
- interface UseAutoSaveOptions {
3554
- /** Storage key for localStorage (default: 'docx-editor-autosave') */
3555
- storageKey?: string;
3556
- /** Save interval in milliseconds (default: 30000 - 30 seconds) */
3557
- interval?: number;
3558
- /** Whether auto-save is enabled (default: true) */
3559
- enabled?: boolean;
3560
- /** Maximum age of auto-save in milliseconds before it's considered stale (default: 24 hours) */
3561
- maxAge?: number;
3562
- /** Callback when save succeeds */
3563
- onSave?: (timestamp: Date) => void;
3564
- /** Callback when save fails */
3565
- onError?: (error: Error) => void;
3566
- /** Callback when recovery data is found */
3567
- onRecoveryAvailable?: (savedDocument: SavedDocumentData) => void;
3568
- /** Whether to save immediately when document changes (debounced) */
3569
- saveOnChange?: boolean;
3570
- /** Debounce delay for saveOnChange in milliseconds (default: 2000) */
3571
- debounceDelay?: number;
3572
- }
3573
- /**
3574
- * Return value of useAutoSave hook
3575
- */
3576
- interface UseAutoSaveReturn {
3577
- /** Current auto-save status */
3578
- status: AutoSaveStatus;
3579
- /** Last save timestamp */
3580
- lastSaveTime: Date | null;
3581
- /** Manually trigger a save */
3582
- save: () => Promise<boolean>;
3583
- /** Clear auto-saved data from storage */
3584
- clearAutoSave: () => void;
3585
- /** Check if there's recoverable data */
3586
- hasRecoveryData: boolean;
3587
- /** Get the saved document data for recovery */
3588
- getRecoveryData: () => SavedDocumentData | null;
3589
- /** Accept and apply recovered data */
3590
- acceptRecovery: () => Document | null;
3591
- /** Dismiss recovery (clears saved data) */
3592
- dismissRecovery: () => void;
3593
- /** Whether auto-save is currently enabled */
3594
- isEnabled: boolean;
3595
- /** Enable auto-save */
3596
- enable: () => void;
3597
- /** Disable auto-save */
3598
- disable: () => void;
3599
- }
3600
- /**
3601
- * Saved document data structure
3602
- */
3603
- interface SavedDocumentData {
3604
- /** The document JSON */
3605
- document: Document;
3606
- /** When the document was saved */
3607
- savedAt: string;
3608
- /** Version for format compatibility */
3609
- version: number;
3610
- /** Optional document identifier */
3611
- documentId?: string;
3612
- }
3613
- /**
3614
- * React hook for auto-saving document to localStorage
3615
- */
3616
- declare function useAutoSave(document: Document | null | undefined, options?: UseAutoSaveOptions): UseAutoSaveReturn;
3617
- /**
3618
- * Format last save time for display
3619
- */
3620
- declare function formatLastSaveTime(date: Date | null): string;
3621
- /**
3622
- * Get auto-save status label
3623
- */
3624
- declare function getAutoSaveStatusLabel(status: AutoSaveStatus): string;
3625
- /**
3626
- * Get storage size used by auto-save
3627
- */
3628
- declare function getAutoSaveStorageSize(storageKey?: string): number;
3629
- /**
3630
- * Format storage size for display
3631
- */
3632
- declare function formatStorageSize(bytes: number): string;
3633
- /**
3634
- * Check if auto-save is supported in this environment
3635
- */
3636
- declare function isAutoSaveSupported(): boolean;
3637
-
3638
- /**
3639
- * useWheelZoom Hook
3640
- *
3641
- * Enables Ctrl+scroll (or Cmd+scroll on Mac) to zoom in/out.
3642
- * Features:
3643
- * - Configurable zoom range and step
3644
- * - Smooth zoom transitions
3645
- * - Pinch-to-zoom support on trackpads
3646
- * - Zoom reset (Ctrl+0)
3647
- * - Zoom in/out shortcuts (Ctrl++, Ctrl+-)
3648
- */
3649
- /**
3650
- * Options for useWheelZoom hook
3651
- */
3652
- interface UseWheelZoomOptions {
3653
- /** Initial zoom level (default: 1.0) */
3654
- initialZoom?: number;
3655
- /** Minimum zoom level (default: 0.25) */
3656
- minZoom?: number;
3657
- /** Maximum zoom level (default: 4.0) */
3658
- maxZoom?: number;
3659
- /** Zoom step for each scroll event (default: 0.1) */
3660
- zoomStep?: number;
3661
- /** Whether zoom is enabled (default: true) */
3662
- enabled?: boolean;
3663
- /** Container element ref to attach wheel listener */
3664
- containerRef?: React.RefObject<HTMLElement>;
3665
- /** Callback when zoom changes */
3666
- onZoomChange?: (zoom: number) => void;
3667
- /** Whether to enable keyboard shortcuts (Ctrl++, Ctrl+-, Ctrl+0) */
3668
- enableKeyboardShortcuts?: boolean;
3669
- /** Whether to prevent default browser zoom behavior */
3670
- preventDefault?: boolean;
3671
- }
3672
- /**
3673
- * Return value of useWheelZoom hook
3674
- */
3675
- interface UseWheelZoomReturn {
3676
- /** Current zoom level */
3677
- zoom: number;
3678
- /** Set zoom level directly */
3679
- setZoom: (zoom: number) => void;
3680
- /** Zoom in by step */
3681
- zoomIn: () => void;
3682
- /** Zoom out by step */
3683
- zoomOut: () => void;
3684
- /** Reset zoom to initial level */
3685
- resetZoom: () => void;
3686
- /** Reset zoom to 100% */
3687
- zoomTo100: () => void;
3688
- /** Zoom to fit width */
3689
- zoomToFit: (containerWidth: number, contentWidth: number) => void;
3690
- /** Whether currently at minimum zoom */
3691
- isMinZoom: boolean;
3692
- /** Whether currently at maximum zoom */
3693
- isMaxZoom: boolean;
3694
- /** Zoom percentage (e.g., 100 for zoom level 1.0) */
3695
- zoomPercent: number;
3696
- /** Wheel event handler (for manual attachment) */
3697
- handleWheel: (event: WheelEvent) => void;
3698
- /** Keyboard event handler (for manual attachment) */
3699
- handleKeyDown: (event: KeyboardEvent) => void;
3700
- }
3701
- /**
3702
- * Preset zoom levels for snapping
3703
- */
3704
- declare const ZOOM_PRESETS: number[];
3705
- /**
3706
- * React hook for Ctrl+scroll zoom functionality
3707
- */
3708
- declare function useWheelZoom(options?: UseWheelZoomOptions): UseWheelZoomReturn;
3709
- /**
3710
- * Get zoom presets
3711
- */
3712
- declare function getZoomPresets(): number[];
3713
- /**
3714
- * Find nearest zoom preset
3715
- */
3716
- declare function findNearestZoomPreset(zoom: number): number;
3717
- /**
3718
- * Get next zoom preset (for zoom in)
3719
- */
3720
- declare function getNextZoomPreset(zoom: number): number;
3721
- /**
3722
- * Get previous zoom preset (for zoom out)
3723
- */
3724
- declare function getPreviousZoomPreset(zoom: number): number;
3725
- /**
3726
- * Format zoom level for display
3727
- */
3728
- declare function formatZoom(zoom: number): string;
3729
- /**
3730
- * Parse zoom from percentage string
3731
- */
3732
- declare function parseZoom(zoomString: string): number | null;
3733
- /**
3734
- * Check if zoom level is at a preset
3735
- */
3736
- declare function isZoomPreset(zoom: number): boolean;
3737
- /**
3738
- * Clamp zoom to valid range
3739
- */
3740
- declare function clampZoom(zoom: number, minZoom?: number, maxZoom?: number): number;
3741
-
3742
- /**
3743
- * Insert Operations Utility
3744
- *
3745
- * Utility functions for inserting content into the document.
3746
- * Provides functions for inserting page breaks, horizontal rules, and other elements.
3747
- */
3748
-
3749
- /**
3750
- * Insert position in the document
3751
- */
3752
- interface InsertPosition {
3753
- /** Paragraph index in the document body */
3754
- paragraphIndex: number;
3755
- /** Run index within the paragraph (optional) */
3756
- runIndex?: number;
3757
- /** Character offset within the run (optional) */
3758
- offset?: number;
3759
- }
3760
- /**
3761
- * Create a page break content element
3762
- */
3763
- declare function createPageBreak(): BreakContent;
3764
- /**
3765
- * Create a column break content element
3766
- */
3767
- declare function createColumnBreak(): BreakContent;
3768
- /**
3769
- * Create a text wrapping break (line break)
3770
- */
3771
- declare function createLineBreak(clear?: 'none' | 'left' | 'right' | 'all'): BreakContent;
3772
- /**
3773
- * Create a run containing a page break
3774
- */
3775
- declare function createPageBreakRun(): Run;
3776
- /**
3777
- * Create an empty paragraph with a page break before it
3778
- */
3779
- declare function createPageBreakParagraph(): Paragraph;
3780
- /**
3781
- * Insert a page break at a position in the document
3782
- * This inserts a new paragraph with pageBreakBefore: true
3783
- */
3784
- declare function insertPageBreak(doc: Document, position: InsertPosition): Document;
3785
- /**
3786
- * Create a horizontal rule paragraph
3787
- * Uses a paragraph with bottom border to simulate horizontal rule
3788
- */
3789
- declare function createHorizontalRule(): Paragraph;
3790
- /**
3791
- * Insert a horizontal rule at a position in the document
3792
- */
3793
- declare function insertHorizontalRule(doc: Document, position: InsertPosition): Document;
3794
- /**
3795
- * Check if content is a page break
3796
- */
3797
- declare function isPageBreak(content: RunContent): boolean;
3798
- /**
3799
- * Check if content is a column break
3800
- */
3801
- declare function isColumnBreak(content: RunContent): boolean;
3802
- /**
3803
- * Check if content is a line break
3804
- */
3805
- declare function isLineBreak(content: RunContent): boolean;
3806
- /**
3807
- * Check if content is any type of break
3808
- */
3809
- declare function isBreakContent(content: RunContent): content is BreakContent;
3810
- /**
3811
- * Check if a paragraph has pageBreakBefore
3812
- */
3813
- declare function hasPageBreakBefore(paragraph: Paragraph): boolean;
3814
- /**
3815
- * Count page breaks in a document
3816
- */
3817
- declare function countPageBreaks(doc: Document): number;
3818
- /**
3819
- * Find all page break positions in a document
3820
- */
3821
- declare function findPageBreaks(doc: Document): InsertPosition[];
3822
- /**
3823
- * Remove a page break at a specific position
3824
- */
3825
- declare function removePageBreak(doc: Document, position: InsertPosition): Document;
3826
-
3827
- /**
3828
- * Selection Highlight Utilities
3829
- *
3830
- * Provides visual highlighting for text selection across multiple runs.
3831
- * Browsers handle ::selection pseudo-element differently, especially when
3832
- * selection spans multiple elements with different backgrounds or styling.
3833
- *
3834
- * This module provides:
3835
- * - Custom selection highlight rendering
3836
- * - Programmatic selection range marking
3837
- * - Visual feedback for selection across runs
3838
- */
3839
-
3840
- /**
3841
- * Highlight rectangle representing a selected region
3842
- */
3843
- interface HighlightRect {
3844
- /** Left position in pixels */
3845
- left: number;
3846
- /** Top position in pixels */
3847
- top: number;
3848
- /** Width in pixels */
3849
- width: number;
3850
- /** Height in pixels */
3851
- height: number;
3852
- }
3853
- /**
3854
- * Selection highlight configuration
3855
- */
3856
- interface SelectionHighlightConfig {
3857
- /** Background color for selection */
3858
- backgroundColor: string;
3859
- /** Optional border color for selection */
3860
- borderColor?: string;
3861
- /** Optional border radius */
3862
- borderRadius?: number;
3863
- /** Z-index for overlay */
3864
- zIndex?: number;
3865
- /** Opacity for highlight */
3866
- opacity?: number;
3867
- /** Mix blend mode */
3868
- mixBlendMode?: CSSProperties['mixBlendMode'];
3869
- }
3870
- /**
3871
- * Selection range in document coordinates
3872
- */
3873
- interface SelectionRange {
3874
- /** Start position */
3875
- start: {
3876
- paragraphIndex: number;
3877
- contentIndex: number;
3878
- offset: number;
3879
- };
3880
- /** End position */
3881
- end: {
3882
- paragraphIndex: number;
3883
- contentIndex: number;
3884
- offset: number;
3885
- };
3886
- }
3887
- /**
3888
- * Default selection highlight style (matches Word/Google Docs)
3889
- */
3890
- declare const DEFAULT_SELECTION_STYLE: SelectionHighlightConfig;
3891
- /**
3892
- * High contrast selection style
3893
- */
3894
- declare const HIGH_CONTRAST_SELECTION_STYLE: SelectionHighlightConfig;
3895
- /**
3896
- * Selection highlight CSS custom properties
3897
- */
3898
- declare const SELECTION_CSS_VARS: {
3899
- readonly backgroundColor: "--docx-selection-bg";
3900
- readonly borderColor: "--docx-selection-border";
3901
- readonly textColor: "--docx-selection-text";
3902
- };
3903
- /**
3904
- * Get all selection rectangles from the current DOM selection
3905
- *
3906
- * Uses getClientRects() to get accurate rectangles even when
3907
- * selection spans multiple inline elements.
3908
- */
3909
- declare function getSelectionRects(containerElement?: HTMLElement | null): HighlightRect[];
3910
- /**
3911
- * Merge adjacent or overlapping rectangles
3912
- *
3913
- * This reduces the number of highlight elements needed and creates
3914
- * a cleaner visual appearance.
3915
- */
3916
- declare function mergeAdjacentRects(rects: HighlightRect[], tolerance?: number): HighlightRect[];
3917
- /**
3918
- * Get selection rectangles with merging applied
3919
- */
3920
- declare function getMergedSelectionRects(containerElement?: HTMLElement | null): HighlightRect[];
3921
- /**
3922
- * Generate CSS styles for a highlight rectangle
3923
- */
3924
- declare function getHighlightRectStyle(rect: HighlightRect, config?: SelectionHighlightConfig): CSSProperties;
3925
- /**
3926
- * Generate inline CSS for selection pseudo-elements
3927
- *
3928
- * This is used to inject consistent selection styling
3929
- * across all editable elements.
3930
- */
3931
- declare function generateSelectionCSS(selector: string, config?: SelectionHighlightConfig): string;
3932
- /**
3933
- * Check if there is an active text selection (not collapsed)
3934
- */
3935
- declare function hasActiveSelection(): boolean;
3936
- /**
3937
- * Get the selected text
3938
- */
3939
- declare function getSelectedText(): string;
3940
- /**
3941
- * Check if selection is within a specific element
3942
- */
3943
- declare function isSelectionWithin(element: HTMLElement): boolean;
3944
- /**
3945
- * Get the bounding rect of the current selection
3946
- */
3947
- declare function getSelectionBoundingRect(): DOMRect | null;
3948
- /**
3949
- * Create a selection highlight for a specific text range
3950
- *
3951
- * This is useful for find/replace highlighting, AI action previews, etc.
3952
- */
3953
- declare function highlightTextRange(_containerElement: HTMLElement, startNode: Node, startOffset: number, endNode: Node, endOffset: number): Range | null;
3954
- /**
3955
- * Select a text range programmatically
3956
- */
3957
- declare function selectRange(range: Range): void;
3958
- /**
3959
- * Clear the current selection
3960
- */
3961
- declare function clearSelection(): void;
3962
- /**
3963
- * Check if selection is backwards (focus before anchor)
3964
- */
3965
- declare function isSelectionBackwards(): boolean;
3966
- /**
3967
- * Normalize selection to always be forward (start before end)
3968
- */
3969
- declare function normalizeSelectionDirection(): void;
3970
- /**
3971
- * Inject selection highlight CSS into document
3972
- */
3973
- declare function injectSelectionStyles(config?: SelectionHighlightConfig): void;
3974
- /**
3975
- * Remove injected selection styles
3976
- */
3977
- declare function removeSelectionStyles(): void;
3978
- /**
3979
- * Check if selection styles are injected
3980
- */
3981
- declare function areSelectionStylesInjected(): boolean;
3982
- /**
3983
- * Create a selection change handler that updates highlight rects
3984
- */
3985
- declare function createSelectionChangeHandler(containerElement: HTMLElement | null, onRectsChange: (rects: HighlightRect[]) => void, merge?: boolean): () => void;
3986
-
3987
- /**
3988
- * Selection Highlight Hook
3989
- *
3990
- * A React hook that manages visual selection highlighting across multiple runs.
3991
- * Uses a combination of CSS ::selection pseudo-element styling and optional
3992
- * overlay rectangles for complex scenarios.
3993
- *
3994
- * Features:
3995
- * - Consistent selection highlighting across all text runs
3996
- * - Support for text with different backgrounds (highlighted, dark bg)
3997
- * - Optional overlay rectangles for custom highlight effects
3998
- * - Debounced updates for performance
3999
- */
4000
-
4001
- /**
4002
- * Options for the useSelectionHighlight hook
4003
- */
4004
- interface UseSelectionHighlightOptions {
4005
- /** Reference to the container element */
4006
- containerRef: React__default.RefObject<HTMLElement>;
4007
- /** Whether to enable selection highlighting */
4008
- enabled?: boolean;
4009
- /** Custom highlight configuration */
4010
- config?: SelectionHighlightConfig;
4011
- /** Whether to use overlay rectangles (default: false, uses CSS) */
4012
- useOverlay?: boolean;
4013
- /** Debounce delay for rect updates in ms (default: 16) */
4014
- debounceMs?: number;
4015
- /** Callback when selection changes */
4016
- onSelectionChange?: (hasSelection: boolean, text: string) => void;
4017
- }
4018
- /**
4019
- * Return value from the useSelectionHighlight hook
4020
- */
4021
- interface UseSelectionHighlightReturn {
4022
- /** Whether there is an active selection */
4023
- hasSelection: boolean;
4024
- /** The selected text */
4025
- selectedText: string;
4026
- /** Highlight rectangles (only populated if useOverlay is true) */
4027
- highlightRects: HighlightRect[];
4028
- /** Whether selection is within the container */
4029
- isSelectionInContainer: boolean;
4030
- /** Refresh the highlight state */
4031
- refresh: () => void;
4032
- /** Get styles for a highlight rect overlay */
4033
- getOverlayStyle: (rect: HighlightRect) => CSSProperties;
4034
- }
4035
- /**
4036
- * Hook to manage selection highlighting in the editor
4037
- */
4038
- declare function useSelectionHighlight(options: UseSelectionHighlightOptions): UseSelectionHighlightReturn;
4039
- /**
4040
- * Props for selection overlay component
4041
- */
4042
- interface SelectionOverlayProps {
4043
- /** Highlight rectangles to render */
4044
- rects: HighlightRect[];
4045
- /** Style configuration */
4046
- config?: SelectionHighlightConfig;
4047
- /** Additional class name */
4048
- className?: string;
4049
- }
4050
- /**
4051
- * Generate selection overlay elements (for use in JSX)
4052
- *
4053
- * Usage:
4054
- * ```tsx
4055
- * const { highlightRects } = useSelectionHighlight({ ... });
4056
- * return (
4057
- * <div style={{ position: 'relative' }}>
4058
- * {generateOverlayElements(highlightRects)}
4059
- * <div>... content ...</div>
4060
- * </div>
4061
- * );
4062
- * ```
4063
- */
4064
- declare function generateOverlayElements(rects: HighlightRect[], config?: SelectionHighlightConfig): React__default.ReactNode[];
10
+ import { Plugin, PluginKey } from 'prosemirror-state';
11
+ import { DecorationSet, EditorView } from 'prosemirror-view';
12
+ export { C as CorePlugin, M as McpSession, a as McpToolDefinition, b as McpToolHandler, c as McpToolResult } from './types-xMzSPT4i.js';
13
+ export { P as PluginRegistry, p as pluginRegistry, r as registerPlugins } from './registry-D4tvj9f3.js';
14
+ export { docxtemplaterPlugin } from './core-plugins.js';
15
+ import * as react_jsx_runtime from 'react/jsx-runtime';
16
+ import 'react';
17
+ import 'prosemirror-model';
4065
18
 
4066
19
  /**
4067
20
  * Text Selection Utilities
@@ -4308,103 +261,6 @@ declare function getNavigationShortcutDescriptions(): Array<{
4308
261
  shortcut: string;
4309
262
  }>;
4310
263
 
4311
- /**
4312
- * useClipboard Hook
4313
- *
4314
- * React hook for managing clipboard operations in the editor with formatting preservation.
4315
- *
4316
- * Features:
4317
- * - Copy: Copies selected runs/paragraphs to clipboard with formatting as HTML
4318
- * - Cut: Copies and removes selected content
4319
- * - Paste: Parses clipboard HTML/text and applies formatting
4320
- * - Handles Word-pasted content (cleans Word-specific markup)
4321
- * - Keyboard shortcuts (Ctrl+C, Ctrl+X, Ctrl+V)
4322
- */
4323
-
4324
- /**
4325
- * Selection data for clipboard operations
4326
- */
4327
- interface ClipboardSelection {
4328
- /** Selected text (plain text) */
4329
- text: string;
4330
- /** Selected runs */
4331
- runs: Run[];
4332
- /** Start position */
4333
- startParagraphIndex: number;
4334
- startRunIndex: number;
4335
- startOffset: number;
4336
- /** End position */
4337
- endParagraphIndex: number;
4338
- endRunIndex: number;
4339
- endOffset: number;
4340
- /** Whether selection spans multiple paragraphs */
4341
- isMultiParagraph: boolean;
4342
- }
4343
- /**
4344
- * Options for useClipboard hook
4345
- */
4346
- interface UseClipboardOptions {
4347
- /** Callback when content is copied */
4348
- onCopy?: (selection: ClipboardSelection) => void;
4349
- /** Callback when content is cut */
4350
- onCut?: (selection: ClipboardSelection) => void;
4351
- /** Callback when content is pasted */
4352
- onPaste?: (content: ParsedClipboardContent, asPlainText: boolean) => void;
4353
- /** Whether to clean Word-specific formatting */
4354
- cleanWordFormatting?: boolean;
4355
- /** Whether the editor is editable */
4356
- editable?: boolean;
4357
- /** Callback for errors */
4358
- onError?: (error: Error) => void;
4359
- }
4360
- /**
4361
- * Return value of useClipboard hook
4362
- */
4363
- interface UseClipboardReturn {
4364
- /** Copy the current selection to clipboard */
4365
- copy: (selection: ClipboardSelection) => Promise<boolean>;
4366
- /** Cut the current selection to clipboard */
4367
- cut: (selection: ClipboardSelection) => Promise<boolean>;
4368
- /** Paste from clipboard */
4369
- paste: (asPlainText?: boolean) => Promise<ParsedClipboardContent | null>;
4370
- /** Handle copy event from DOM */
4371
- handleCopy: (event: ClipboardEvent) => void;
4372
- /** Handle cut event from DOM */
4373
- handleCut: (event: ClipboardEvent) => void;
4374
- /** Handle paste event from DOM */
4375
- handlePaste: (event: ClipboardEvent) => void;
4376
- /** Handle keyboard shortcuts */
4377
- handleKeyDown: (event: KeyboardEvent) => void;
4378
- /** Whether a clipboard operation is in progress */
4379
- isProcessing: boolean;
4380
- /** Last pasted content */
4381
- lastPastedContent: ParsedClipboardContent | null;
4382
- }
4383
- /**
4384
- * Get selected runs from the current DOM selection
4385
- */
4386
- declare function getSelectionRuns(): Run[];
4387
- /**
4388
- * Create a selection object from the current DOM selection
4389
- */
4390
- declare function createSelectionFromDOM(): ClipboardSelection | null;
4391
- /**
4392
- * React hook for clipboard operations
4393
- */
4394
- declare function useClipboard(options?: UseClipboardOptions): UseClipboardReturn;
4395
-
4396
- declare const PLUGIN_HOST_STYLES = "\n.plugin-host {\n display: flex;\n width: 100%;\n height: 100%;\n overflow: visible;\n position: relative;\n}\n\n.plugin-host-editor {\n flex: 1;\n display: flex;\n flex-direction: column;\n min-width: 0;\n overflow: visible;\n}\n\n\n.plugin-panels-left,\n.plugin-panels-right {\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n background: #f8f9fa;\n border-color: #e9ecef;\n}\n\n.plugin-panels-left {\n border-right: 1px solid #e9ecef;\n}\n\n.plugin-panels-right {\n border-left: 1px solid #e9ecef;\n}\n\n.plugin-panels-bottom {\n border-top: 1px solid #e9ecef;\n background: #f8f9fa;\n}\n\n.plugin-panel {\n position: relative;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n transition: width 0.2s ease, height 0.2s ease;\n}\n\n.plugin-panel.collapsed {\n overflow: visible;\n}\n\n.plugin-panel-toggle {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 6px 8px;\n background: transparent;\n border: none;\n cursor: pointer;\n font-size: 12px;\n color: #6c757d;\n white-space: nowrap;\n}\n\n.plugin-panel.collapsed .plugin-panel-toggle {\n writing-mode: vertical-rl;\n text-orientation: mixed;\n flex-direction: column;\n height: 100%;\n padding: 8px 6px;\n}\n\n.plugin-panel-toggle:hover {\n background: #e9ecef;\n color: #495057;\n}\n\n.plugin-panel-toggle-icon {\n font-weight: bold;\n font-size: 14px;\n}\n\n.plugin-panel.collapsed .plugin-panel-toggle-icon {\n transform: rotate(90deg);\n}\n\n.plugin-panel-toggle-label {\n font-weight: 500;\n}\n\n.plugin-panel-content {\n flex: 1;\n overflow: auto;\n}\n\n/* Right panel rendered inside viewport - scrolls with content */\n.plugin-panel-in-viewport {\n position: absolute;\n top: 0;\n /* Position is set dynamically via inline styles based on page edge */\n width: 220px;\n pointer-events: auto;\n z-index: 10;\n overflow: visible;\n}\n\n.plugin-panel-in-viewport.collapsed {\n width: 32px;\n}\n\n.plugin-panel-in-viewport .plugin-panel-toggle {\n position: sticky;\n top: 0;\n background: rgba(255, 255, 255, 0.95);\n border-radius: 4px;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n}\n\n.plugin-panel-in-viewport-content {\n overflow: visible;\n position: relative;\n}\n\n/* Plugin overlay container for rendering highlights/decorations */\n.plugin-overlays-container {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n overflow: visible;\n z-index: 5;\n}\n\n.plugin-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n}\n\n.plugin-overlay > * {\n pointer-events: auto;\n}\n";
4397
- /**
4398
- * PluginHost Component
4399
- *
4400
- * Wraps the editor and provides:
4401
- * - Plugin state management
4402
- * - Panel rendering for each plugin
4403
- * - CSS injection for plugin styles
4404
- * - Callbacks for editor interaction
4405
- */
4406
- declare const PluginHost: React$1.ForwardRefExoticComponent<PluginHostProps & React$1.RefAttributes<PluginHostRef>>;
4407
-
4408
264
  /**
4409
265
  * Template tag types
4410
266
  */
@@ -4543,4 +399,4 @@ declare const templatePlugin: EditorPlugin<TemplatePluginState>;
4543
399
  */
4544
400
  declare const VERSION = "0.0.2";
4545
401
 
4546
- export { AIAction, ANNOTATION_PANEL_STYLES, AgentResponse, AlignmentButtons, type AlignmentButtonsProps, AnnotationPanel, type AutoSaveStatus, CLIPBOARD_TYPES, CellBackgroundPicker, type CellBackgroundPickerProps, type CellColorOption, type ClipboardContent, type ClipboardOptions, type ClipboardSelection, type ColorOption, ColorPicker, type ColorPickerProps, ContextMenu, type ContextMenuProps, DEFAULT_CELL_COLORS, DEFAULT_SELECTION_STYLE, type KeyboardShortcut$1 as DialogKeyboardShortcut, Document, DocumentAgent, DocxEditor, type DocxEditorHandle, type DocxEditorProps, type DocxEditorRef, DocxInput, type EditorPlugin, ErrorBoundary, type ErrorBoundaryProps, type ErrorContextValue, type ErrorNotification, ErrorProvider, type ErrorSeverity, type FindMatch, type FindOptions, FindReplaceDialog, type FindReplaceDialogProps, type FindReplaceOptions, type FindReplaceState, type FindResult, type FontOption, FontPicker, type FontPickerProps, FontSizePicker, type FontSizePickerProps, HIGH_CONTRAST_SELECTION_STYLE, type HighlightOptions, type HighlightRect, HorizontalRuler, type HorizontalRulerProps, type HyperlinkData, HyperlinkDialog, type HyperlinkDialogProps, INTERNAL_CLIPBOARD_TYPE, type ImageData, type IndicatorPosition, type IndicatorVariant, InsertImageDialog, type InsertImageDialogProps, type InsertPosition, InsertSymbolDialog, type InsertSymbolDialogProps, InsertTableDialog, type InsertTableDialogProps, type KeyboardShortcut, KeyboardShortcutsDialog, type KeyboardShortcutsDialogProps, type LineSpacingOption, LineSpacingPicker, type LineSpacingPickerProps, ListButtons, type ListButtonsProps, type ListState, LoadingIndicator, type LoadingIndicatorProps, type LoadingOperation, type LoadingSize, type LoadingVariant, NAVIGATION_SHORTCUTS, type NavigationAction, type NavigationDirection, type NavigationUnit, PLUGIN_HOST_STYLES, type PageIndicatorPosition, type PageIndicatorVariant, PageNavigator, type PageNavigatorPosition, type PageNavigatorProps, type PageNavigatorVariant, PageNumberIndicator, type PageNumberIndicatorProps, type PanelConfig, Paragraph, ParagraphFormatting, ParseErrorDisplay, type ParseErrorDisplayProps, type ParsedClipboardContent, type PasteOption, PasteSpecialDialog, type PasteSpecialDialogProps, type PluginContext, PluginHost, type PluginHostProps, type PluginHostRef, type PluginPanelProps, PrintButton, type PrintButtonProps, type PrintOptions, PrintStyles, type RenderAsyncOptions, ResponsePreview, type ResponsePreviewProps, type ResponsePreviewState, ResponsiveToolbar, ToolbarGroup as ResponsiveToolbarGroup, type ToolbarGroupProps as ResponsiveToolbarGroupProps, type ResponsiveToolbarProps, Run, RunContent, SELECTION_CSS_VARS, SYMBOL_CATEGORIES, type SavedDocumentData, SectionProperties, SelectionContext, type SelectionHighlightConfig, type SelectionOverlayProps, type SelectionRange, type ShortcutCategory, Style, type StyleOption, StylePicker, type StylePickerProps, type SymbolCategory, TABLE_DATA_ATTRIBUTES, TEMPLATE_DECORATION_STYLES, Table, type TableAction, TableBorderColorPicker, type TableBorderColorPickerProps, TableBorderPicker, type TableBorderPickerProps, TableBorderWidthPicker, type TableBorderWidthPickerProps, TableCell, TableCellFillPicker, type TableCellFillPickerProps, type TableConfig, type TableContext, TableInsertButtons, type TableInsertButtonsProps, TableMergeButton, type TableMergeButtonProps, TableMoreDropdown, type TableMoreDropdownProps, type TableSelection, type TableSelectionState, TableToolbar, type TableToolbarProps, type TagType, type TemplateTag, type TextContextAction, TextContextMenu, type TextContextMenuItem, type TextContextMenuProps, TextFormatting, Theme, Toolbar, ToolbarButton, ToolbarGroup$1 as ToolbarGroup, type ToolbarItem, type ToolbarItemPriority, type ToolbarProps, ToolbarSeparator, UnsavedIndicator, type UnsavedIndicatorProps, UnsupportedFeatureWarning, type UnsupportedFeatureWarningProps, type UseAutoSaveOptions, type UseAutoSaveReturn, type UseClipboardOptions, type UseClipboardReturn, type UseFindReplaceReturn, type UseKeyboardShortcutsDialogOptions, type UseKeyboardShortcutsDialogReturn, type UseLoadingOptions, type UseLoadingReturn, type UsePasteSpecialOptions, type UsePasteSpecialReturn, type UseResponsiveToolbarOptions, type UseResponsiveToolbarReturn, type UseSelectionHighlightOptions, type UseSelectionHighlightReturn, type UseTableSelectionOptions, type UseTableSelectionReturn, type UseTextContextMenuOptions, type UseTextContextMenuReturn, type UseUnsavedChangesOptions, type UseUnsavedChangesReturn, type UseWheelZoomOptions, type UseWheelZoomReturn, VERSION, VariablePanel, type VariablePanelProps, type WordSelectionResult, ZOOM_PRESETS, ZoomControl, type ZoomControlProps, addColumn, addRow, areSelectionStylesInjected, calculateFitDimensions, calculateProgress, calculateScrollToPage, calculateVisiblePage, canRenderFont, clampPageNumber, clampTableConfig, clampZoom, cleanWordHtml, clearSelection, copyParagraphs, copyRuns, countPageBreaks, createCellColorOption, createChangeTracker, createClipboardHandlers, createColumnBreak, createDefaultFindOptions, createDefaultListState, createDefaultTableConfig, createDoubleClickWordSelector, createErrorResponse, createHorizontalRule, createLineBreak, createMockResponse, createPageBreak, createPageBreakParagraph, createPageBreakRun, createPageFormat, createSearchPattern, createSelectionChangeHandler, createSelectionFromDOM, createShadingFromColor, createTableContext, createPlugin as createTemplatePlugin, createTemplatePlugin as createTemplateProseMirrorPlugin, createToolbarItem, createToolbarItems, createTripleClickParagraphSelector, dataUrlToBlob, delay, deleteColumn, deleteRow, describeShortcut, escapeRegexString, expandSelectionToWord, expandSelectionToWordBoundaries, extendSelectionTo, findAllMatches, findInDocument, findInParagraph, findNearestZoomPreset, findNextWordStart, findPageBreaks, findPreviousWordStart, findVisualLineEnd, findVisualLineStart, findWordAt, findWordBoundaries, findWordEnd, findWordStart, formatFileSize, formatLastSaveTime, formatPageOrdinal, formatPageRange$1 as formatPageRange, formatPageRange as formatPrintPageRange, formatShortcutKeys, formatStorageSize, formatTableDimensions, formatZoom, generateOverlayElements, generateSelectionCSS, getActionShortcut, getAllActions, getAllCategories, getAllPositions as getAllIndicatorPositions, getAllVariants as getAllIndicatorVariants, getAllLoadingSizes, getAllLoadingVariants, getAllPasteOptions, getAutoSaveStatusLabel, getAutoSaveStorageSize, getCategoryLabel, getCellAt, getCellColorName, getColorFromShading, getColumnCount, getCommonShortcuts, getContrastingTextColor, getDefaultActions, getDefaultCellColors, getDefaultHighlightOptions, getDefaultPasteOption, getDefaultPrintOptions, getDefaultShortcuts, getDefaultTextContextMenuItems, getHighlightRectStyle, getImageAcceptString, getImageDimensions, getLoadedFonts, getLoadingVariantLabel, getMarginInUnits, getMatchCountText, getMergedSelectionRects, getNavigationShortcutDescriptions, getNavigationShortcuts, getNextZoomPreset, getPageProgress, getPasteOption, getPreviousZoomPreset, getRecommendedPriority, getRulerDimensions, getSelectedText, getSelectionBoundingRect, getSelectionInfo, getSelectionRects, getSelectionRuns, getShortcutsByCategory, getSupportedImageExtensions, getSymbolCategories, getSymbolInfo as getSymbolUnicodeInfo, getSymbolsByCategory, getTablePresets, getTemplateTags as getTemplatePluginTags, getTextActionLabel, getTextActionShortcut, getUserFriendlyMessage, getVariantLabel, getWordAt, getWordAtCursor, getZoomPresets, handleClickForMultiClick, handleNavigationKey, handlePasteEvent, hasActiveSelection, hasPageBreakBefore, highlightTextRange, htmlToRuns, injectSelectionStyles, insertHorizontalRule, insertPageBreak, isActionAvailable, isAutoSaveSupported, isBreakContent, isColumnBreak, isDefaultCellColor, isEditorHtml, isEmptySearch, isFirstPage, isFontLoaded, isLoading as isFontsLoading, isLastPage, isLineBreak, isNavigationKey, isPageBreak, isParseError, isPasteSpecialShortcut, isPrintSupported, isPunctuation, isSelectionBackwards, isSelectionWithin, isTextActionAvailable, isValidImageFile, isValidPageNumber, isValidTableConfig, isWhitespace$1 as isWhitespace, isWhitespace as isWhitespaceChar, isWordCharacter as isWordChar, isWordCharacter$1 as isWordCharacter, isWordHtml, isZoomPreset, loadFont, loadFontFromBuffer, loadFonts, matchesShortcut, mergeAdjacentRects, mergeCells, moveByWord, moveToLineEdge, normalizeSelectionDirection, onFontsLoaded, openPrintWindow, paragraphsToClipboardContent, parseClipboardHtml, parseMarginFromUnits, parseNavigationAction, parsePageInput, parsePageRange, parseZoom, positionToMargin, preloadCommonFonts, readFromClipboard, removePageBreak, removeSelectionStyles, renderAsync, replaceAllInContent, replaceFirstInContent, runsToClipboardContent, scrollToMatch, searchSymbols, selectParagraphAtCursor, selectRange, selectWordAtCursor, selectWordInTextNode, setHoveredElement, setSelectedElement, setSelectionPosition, splitCell, symbolFromCodePoint, templatePlugin, templatePluginKey, triggerPrint, useAutoSave, useClipboard, useContextMenu, useErrorNotifications, useFindReplace, useHyperlinkDialog, useInsertImageDialog, useInsertSymbolDialog, useInsertTableDialog, useKeyboardShortcutsDialog, useLoading, useLoadingOperations, usePasteSpecial, useResponsePreview, useResponsiveToolbar, useSelectionHighlight, useTableSelection, useTextContextMenu, useUnsavedChanges, useWheelZoom, writeToClipboard };
402
+ export { ANNOTATION_PANEL_STYLES, AnnotationPanel, EditorPlugin, type KeyboardShortcut, NAVIGATION_SHORTCUTS, type NavigationAction, type NavigationDirection, type NavigationUnit, PluginPanelProps, TEMPLATE_DECORATION_STYLES, type TagType, type TemplateTag, VERSION, type WordSelectionResult, createDoubleClickWordSelector, createPlugin as createTemplatePlugin, createTemplatePlugin as createTemplateProseMirrorPlugin, createTripleClickParagraphSelector, describeShortcut, expandSelectionToWord, expandSelectionToWordBoundaries, extendSelectionTo, findNextWordStart, findPreviousWordStart, findVisualLineEnd, findVisualLineStart, findWordAt, findWordBoundaries, findWordEnd, findWordStart, getNavigationShortcutDescriptions, getSelectionInfo, getTemplateTags as getTemplatePluginTags, getWordAt, getWordAtCursor, handleClickForMultiClick, handleNavigationKey, isNavigationKey, isPunctuation, isWhitespace$1 as isWhitespace, isWhitespace as isWhitespaceChar, isWordCharacter as isWordChar, isWordCharacter$1 as isWordCharacter, matchesShortcut, moveByWord, moveToLineEdge, parseNavigationAction, selectParagraphAtCursor, selectWordAtCursor, selectWordInTextNode, setHoveredElement, setSelectedElement, setSelectionPosition, templatePlugin, templatePluginKey };