@eigenpal/docx-js-editor 0.0.25 → 0.0.26
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.
- package/dist/{chunk-R56SLH64.js → chunk-FUK46DWH.js} +4 -4
- package/dist/chunk-MUIREXKH.js +3 -0
- package/dist/chunk-OWMG5MW5.cjs +3 -0
- package/dist/chunk-S36T7OK5.cjs +258 -0
- package/dist/{chunk-3C2VHZX6.cjs → chunk-Y62HOQL2.cjs} +4 -4
- package/dist/chunk-YYBSUBRG.js +258 -0
- package/dist/{clipboard-DriRE6eS.d.ts → clipboard-CU-zASXS.d.ts} +1 -154
- package/dist/{clipboard-Bj2X5pLO.d.cts → clipboard-DBabJ6mU.d.cts} +1 -154
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +90 -7
- package/dist/index.d.ts +90 -7
- package/dist/index.js +6 -6
- package/dist/{react-Bj9uDtjg.d.ts → react-CFPWe7nV.d.ts} +11 -9
- package/dist/{react-BYRZYSPG.d.cts → react-CKqhN17E.d.cts} +11 -9
- package/dist/react.cjs +1 -1
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.cts +5 -4
- package/dist/ui.d.ts +5 -4
- package/dist/ui.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-2JOQ7WKO.js +0 -258
- package/dist/chunk-C6ELWJWO.js +0 -3
- package/dist/chunk-I5YZ4MRV.cjs +0 -3
- package/dist/chunk-RHLMVYVZ.cjs +0 -258
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { R as ReactEditorPlugin } from './react-
|
|
2
|
-
export { D as DEFAULT_SELECTION_STYLE, a as DocxEditor, b as DocxEditorHandle, c as DocxEditorProps, d as DocxEditorRef, E as EditorMode, e as EditorPlugin, f as ErrorBoundary, g as ErrorBoundaryProps, h as ErrorContextValue, i as ErrorProvider, H as HIGH_CONTRAST_SELECTION_STYLE, j as HighlightRect, P as PLUGIN_HOST_STYLES, k as ParseErrorDisplay, l as ParseErrorDisplayProps, m as PluginContext, n as PluginHost, o as PluginHostProps, p as PluginHostRef, q as RenderAsyncOptions, S as SELECTION_CSS_VARS, r as SelectionHighlightConfig, s as SelectionOverlayProps, t as SelectionRange, T as TableSelectionState, U as UnsupportedFeatureWarning, u as UnsupportedFeatureWarningProps, v as UseAutoSaveOptions, w as UseAutoSaveReturn, x as UseClipboardOptions, y as UseClipboardReturn, z as UseSelectionHighlightOptions, A as UseSelectionHighlightReturn, B as UseTableSelectionOptions, C as UseTableSelectionReturn, F as UseWheelZoomOptions, G as UseWheelZoomReturn, Z as ZOOM_PRESETS, I as areSelectionStylesInjected, J as clampZoom, K as clearSelection, L as createSelectionChangeHandler, M as findNearestZoomPreset, N as formatZoom, O as generateOverlayElements, Q as generateSelectionCSS, V as getHighlightRectStyle, W as getMergedSelectionRects, X as getNextZoomPreset, Y as getPreviousZoomPreset, _ as getSelectedText, $ as getSelectionBoundingRect, a0 as getSelectionRects, a1 as getUserFriendlyMessage, a2 as getZoomPresets, a3 as hasActiveSelection, a4 as highlightTextRange, a5 as injectSelectionStyles, a6 as isParseError, a7 as isSelectionBackwards, a8 as isSelectionWithin, a9 as isZoomPreset, aa as mergeAdjacentRects, ab as normalizeSelectionDirection, ac as parseZoom, ad as removeSelectionStyles, ae as renderAsync, af as selectRange, ag as useAutoSave, ah as useClipboard, ai as useErrorNotifications, aj as useSelectionHighlight, ak as useTableSelection, al as useWheelZoom } from './react-
|
|
1
|
+
import { R as ReactEditorPlugin } from './react-CKqhN17E.cjs';
|
|
2
|
+
export { D as DEFAULT_SELECTION_STYLE, a as DocxEditor, b as DocxEditorHandle, c as DocxEditorProps, d as DocxEditorRef, E as EditorMode, e as EditorPlugin, f as ErrorBoundary, g as ErrorBoundaryProps, h as ErrorContextValue, i as ErrorProvider, H as HIGH_CONTRAST_SELECTION_STYLE, j as HighlightRect, P as PLUGIN_HOST_STYLES, k as ParseErrorDisplay, l as ParseErrorDisplayProps, m as PluginContext, n as PluginHost, o as PluginHostProps, p as PluginHostRef, q as RenderAsyncOptions, S as SELECTION_CSS_VARS, r as SelectionHighlightConfig, s as SelectionOverlayProps, t as SelectionRange, T as TableSelectionState, U as UnsupportedFeatureWarning, u as UnsupportedFeatureWarningProps, v as UseAutoSaveOptions, w as UseAutoSaveReturn, x as UseClipboardOptions, y as UseClipboardReturn, z as UseSelectionHighlightOptions, A as UseSelectionHighlightReturn, B as UseTableSelectionOptions, C as UseTableSelectionReturn, F as UseWheelZoomOptions, G as UseWheelZoomReturn, Z as ZOOM_PRESETS, I as areSelectionStylesInjected, J as clampZoom, K as clearSelection, L as createSelectionChangeHandler, M as findNearestZoomPreset, N as formatZoom, O as generateOverlayElements, Q as generateSelectionCSS, V as getHighlightRectStyle, W as getMergedSelectionRects, X as getNextZoomPreset, Y as getPreviousZoomPreset, _ as getSelectedText, $ as getSelectionBoundingRect, a0 as getSelectionRects, a1 as getUserFriendlyMessage, a2 as getZoomPresets, a3 as hasActiveSelection, a4 as highlightTextRange, a5 as injectSelectionStyles, a6 as isParseError, a7 as isSelectionBackwards, a8 as isSelectionWithin, a9 as isZoomPreset, aa as mergeAdjacentRects, ab as normalizeSelectionDirection, ac as parseZoom, ad as removeSelectionStyles, ae as renderAsync, af as selectRange, ag as useAutoSave, ah as useClipboard, ai as useErrorNotifications, aj as useSelectionHighlight, ak as useTableSelection, al as useWheelZoom } from './react-CKqhN17E.cjs';
|
|
3
3
|
export { D as DocumentAgent, g as DocxInput, t as toArrayBuffer } from './DocumentAgent-cHf96hwL.cjs';
|
|
4
4
|
export { A as AgentContextOptions, C as CreateEmptyDocumentOptions, E as ExtendedSelectionContext, P as ProcessTemplateOptions, a as ProcessTemplateResult, b as SelectionContextOptions, c as blendColors, d as buildExtendedSelectionContext, e as buildSelectionContext, g as colorsEqual, h as createDocumentWithText, i as createEmptyDocument, j as createRgbColor, l as createThemeColor, m as darkenColor, n as emuToPixels, o as emuToTwips, p as executeCommand, q as executeCommands, r as formatPx, s as getAgentContext, t as getContrastingColor, u as getDocumentSummary, x as getTemplateTags, y as halfPointsToPixels, z as isBlack, B as isWhite, D as lightenColor, G as parseColorString, H as parseDocx, I as pixelsToEmu, J as pixelsToTwips, K as pointsToPixels, M as processTemplate, O as processTemplateAsBlob, Q as processTemplateDetailed, R as resolveColor, U as resolveHighlightColor, V as resolveShadingColor, W as serializeDocumentBody, X as serializeDocx, Y as serializeSectionProperties, Z as twipsToEmu, _ as twipsToPixels, $ as validateTemplate } from './colorResolver-yl7Xh_Qg.cjs';
|
|
5
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 './fontLoader-Daq8y8C2.cjs';
|
|
6
|
-
|
|
7
|
-
export {
|
|
6
|
+
import { ToolbarProps } from './ui.cjs';
|
|
7
|
+
export { AdvancedColorPicker, AlignmentButtons, AlignmentButtonsProps, ColorOption, ColorPicker, ColorPickerProps, ContextMenu, ContextMenuProps, 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, ToolbarSeparator, UnsavedIndicator, UnsavedIndicatorProps, UseFindReplaceReturn, UseKeyboardShortcutsDialogOptions, UseKeyboardShortcutsDialogReturn, UseLoadingOptions, UseLoadingReturn, UsePasteSpecialOptions, UsePasteSpecialReturn, UseResponsiveToolbarOptions, UseResponsiveToolbarReturn, UseTextContextMenuOptions, UseTextContextMenuReturn, UseUnsavedChangesOptions, UseUnsavedChangesReturn, ZoomControl, ZoomControlProps, calculateFitDimensions, clampTableConfig, createChangeTracker, createDefaultFindOptions, createDefaultListState, createDefaultTableConfig, createErrorResponse, createMockResponse, createSearchPattern, createToolbarItem, createToolbarItems, dataUrlToBlob, delay, escapeRegexString, findAllMatches, findInDocument, findInParagraph, formatFileSize, formatShortcutKeys, formatTableDimensions, getActionShortcut, getAllActions, getAllCategories, getAllIndicatorPositions, getAllIndicatorVariants, getAllLoadingSizes, getAllLoadingVariants, getAllPasteOptions, getCategoryLabel, getCommonShortcuts, getDefaultActions, getDefaultHighlightOptions, getDefaultPasteOption, getDefaultShortcuts, getDefaultTextContextMenuItems, getImageAcceptString, getImageDimensions, getLoadingVariantLabel, getMarginInUnits, getMatchCountText, getPasteOption, getRecommendedPriority, getRulerDimensions, getShortcutsByCategory, getSupportedImageExtensions, getSymbolCategories, getSymbolUnicodeInfo, getSymbolsByCategory, getTablePresets, getTextActionLabel, getTextActionShortcut, getVariantLabel, isActionAvailable, 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.cjs';
|
|
8
|
+
import { ReactNode } from 'react';
|
|
9
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
10
|
+
export { C as CLIPBOARD_TYPES, a as ClipboardContent, b as ClipboardOptions, I as INTERNAL_CLIPBOARD_TYPE, P as ParsedClipboardContent, c as PrintButton, d as PrintButtonProps, e as PrintOptions, f as PrintStyles, T as TableAction, g as TableContext, h as TableSelection, i as TableToolbar, j as TableToolbarProps, k as addColumn, l as addRow, m as cleanWordHtml, n as copyParagraphs, o as copyRuns, p as createClipboardHandlers, q as createTableContext, r as deleteColumn, s as deleteRow, t as formatPrintPageRange, u as getCellAt, v as getColumnCount, w as getDefaultPrintOptions, x as handlePasteEvent, y as htmlToRuns, z as isEditorHtml, A as isPrintSupported, B as isWordHtml, D as mergeCells, E as openPrintWindow, F as paragraphsToClipboardContent, G as parseClipboardHtml, H as parsePageRange, J as readFromClipboard, K as runsToClipboardContent, L as splitCell, M as triggerPrint, N as writeToClipboard } from './clipboard-DBabJ6mU.cjs';
|
|
8
11
|
export { f as AIAction, g as AIActionRequest, A as AgentCommand, h as AgentContext, i as AgentResponse, j as ApplyStyleCommand, l as BlockContent, a3 as BookmarkEnd, a4 as BookmarkStart, n as DeleteTextCommand, D as Document, d as DocumentBody, o as DocxPackage, E as Endnote, a5 as Field, a6 as FooterReference, F as Footnote, q as FormatTextCommand, a7 as HeaderFooter, a8 as HeaderReference, H as Hyperlink, I as Image, r as InsertHyperlinkCommand, s as InsertImageCommand, t as InsertTableCommand, u as InsertTextCommand, L as ListLevel, N as NumberingDefinitions, a as Paragraph, v as ParagraphContext, w as ParagraphFormatting, P as Position, R as Range, y as Relationship, z as ReplaceTextCommand, b as Run, c as RunContent, C as SectionProperties, G as SelectionContext, J as SetVariableCommand, a9 as Shape, K as Style, M as StyleDefinitions, Q as SuggestedAction, e as Table, U as TableCell, V as TableRow, aa as TextBox, W as TextContent, T as TextFormatting, X as Theme, ab as ThemeColorScheme, ac as ThemeFont, ad as ThemeFontScheme } from './agentApi-DmDuQm0e.cjs';
|
|
9
12
|
import * as prosemirror_state from 'prosemirror-state';
|
|
10
13
|
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
@@ -12,12 +15,92 @@ import { DecorationSet, EditorView } from 'prosemirror-view';
|
|
|
12
15
|
export { C as CorePlugin, e as McpSession, M as McpToolDefinition, i as McpToolHandler, j as McpToolResult } from './types-COQvtZji.cjs';
|
|
13
16
|
export { P as PluginRegistry, p as pluginRegistry, r as registerPlugins } from './registry-CXGC344v.cjs';
|
|
14
17
|
export { docxtemplaterPlugin } from './core-plugins-reexport.cjs';
|
|
15
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
16
18
|
import { k as PluginPanelProps } from './ClipboardManager-Bbo5MM_U.cjs';
|
|
17
19
|
export { d as AutoSaveStatus, e as ClipboardSelection, h as ErrorNotification, i as ErrorSeverity, j as PanelConfig, l as PositionCoordinates, R as RenderedDomContext, m as SavedDocumentData, T as TABLE_DATA_ATTRIBUTES, p as createSelectionFromDOM, t as formatLastSaveTime, u as formatStorageSize, v as getAutoSaveStatusLabel, w as getAutoSaveStorageSize, x as getSelectionRuns, z as isAutoSaveSupported } from './ClipboardManager-Bbo5MM_U.cjs';
|
|
18
|
-
import 'react';
|
|
19
20
|
import 'prosemirror-model';
|
|
20
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Props for the EditorToolbar compound component.
|
|
24
|
+
* Extends ToolbarProps with title bar-specific fields.
|
|
25
|
+
*/
|
|
26
|
+
interface EditorToolbarProps extends ToolbarProps {
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface LogoProps {
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
}
|
|
32
|
+
declare function Logo({ children }: LogoProps): react_jsx_runtime.JSX.Element;
|
|
33
|
+
interface DocumentNameProps {
|
|
34
|
+
value: string;
|
|
35
|
+
onChange?: (value: string) => void;
|
|
36
|
+
placeholder?: string;
|
|
37
|
+
editable?: boolean;
|
|
38
|
+
}
|
|
39
|
+
declare function DocumentName({ value, onChange, placeholder, editable, }: DocumentNameProps): react_jsx_runtime.JSX.Element;
|
|
40
|
+
interface TitleBarRightProps {
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
}
|
|
43
|
+
declare function TitleBarRight({ children }: TitleBarRightProps): react_jsx_runtime.JSX.Element;
|
|
44
|
+
declare function MenuBar(): react_jsx_runtime.JSX.Element;
|
|
45
|
+
interface TitleBarProps {
|
|
46
|
+
children: ReactNode;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* TitleBar layout (Google Docs style):
|
|
50
|
+
*
|
|
51
|
+
* ┌──────────┬────────────────────────────┬──────────────────┐
|
|
52
|
+
* │ │ Document Name │ │
|
|
53
|
+
* │ Logo │ │ Right Actions │
|
|
54
|
+
* │ │ File Format Insert │ │
|
|
55
|
+
* └──────────┴────────────────────────────┴──────────────────┘
|
|
56
|
+
*
|
|
57
|
+
* Logo and TitleBarRight span full height. DocumentName + MenuBar
|
|
58
|
+
* stack vertically in the center column.
|
|
59
|
+
*/
|
|
60
|
+
declare function TitleBar({ children }: TitleBarProps): react_jsx_runtime.JSX.Element;
|
|
61
|
+
|
|
62
|
+
interface FormattingBarProps extends ToolbarProps {
|
|
63
|
+
/** Custom toolbar items to render at the end */
|
|
64
|
+
children?: ReactNode;
|
|
65
|
+
/** When true, renders with display:contents so children flow in parent flex container */
|
|
66
|
+
inline?: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Icon-based formatting toolbar — undo/redo, zoom, styles, fonts,
|
|
70
|
+
* bold/italic/underline, colors, alignment, lists, table/image context, clear formatting.
|
|
71
|
+
*/
|
|
72
|
+
declare function FormattingBar(explicitProps: FormattingBarProps): react_jsx_runtime.JSX.Element;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* EditorToolbar — Google Docs-style 2-level compound component.
|
|
76
|
+
*
|
|
77
|
+
* Usage:
|
|
78
|
+
* <EditorToolbar {...toolbarProps}>
|
|
79
|
+
* <EditorToolbar.TitleBar>
|
|
80
|
+
* <EditorToolbar.Logo><MyIcon /></EditorToolbar.Logo>
|
|
81
|
+
* <EditorToolbar.DocumentName value={name} onChange={setName} />
|
|
82
|
+
* <EditorToolbar.MenuBar />
|
|
83
|
+
* <EditorToolbar.TitleBarRight>
|
|
84
|
+
* <button>Save</button>
|
|
85
|
+
* </EditorToolbar.TitleBarRight>
|
|
86
|
+
* </EditorToolbar.TitleBar>
|
|
87
|
+
* <EditorToolbar.FormattingBar />
|
|
88
|
+
* </EditorToolbar>
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
interface EditorToolbarComponent {
|
|
92
|
+
(props: EditorToolbarProps & {
|
|
93
|
+
children: ReactNode;
|
|
94
|
+
}): React.JSX.Element;
|
|
95
|
+
TitleBar: typeof TitleBar;
|
|
96
|
+
Logo: typeof Logo;
|
|
97
|
+
DocumentName: typeof DocumentName;
|
|
98
|
+
MenuBar: typeof MenuBar;
|
|
99
|
+
TitleBarRight: typeof TitleBarRight;
|
|
100
|
+
FormattingBar: typeof FormattingBar;
|
|
101
|
+
}
|
|
102
|
+
declare const EditorToolbar: EditorToolbarComponent;
|
|
103
|
+
|
|
21
104
|
/**
|
|
22
105
|
* Text Selection Utilities
|
|
23
106
|
*
|
|
@@ -401,4 +484,4 @@ declare const templatePlugin: ReactEditorPlugin<TemplatePluginState>;
|
|
|
401
484
|
*/
|
|
402
485
|
declare const VERSION = "0.0.2";
|
|
403
486
|
|
|
404
|
-
export { ANNOTATION_PANEL_STYLES, AnnotationPanel, 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 };
|
|
487
|
+
export { ANNOTATION_PANEL_STYLES, AnnotationPanel, type DocumentNameProps, EditorToolbar, type EditorToolbarProps, FormattingBar, type FormattingBarProps, type KeyboardShortcut, type LogoProps, NAVIGATION_SHORTCUTS, type NavigationAction, type NavigationDirection, type NavigationUnit, PluginPanelProps, TEMPLATE_DECORATION_STYLES, type TagType, type TemplateTag, type TitleBarProps, type TitleBarRightProps, ToolbarProps, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { R as ReactEditorPlugin } from './react-
|
|
2
|
-
export { D as DEFAULT_SELECTION_STYLE, a as DocxEditor, b as DocxEditorHandle, c as DocxEditorProps, d as DocxEditorRef, E as EditorMode, e as EditorPlugin, f as ErrorBoundary, g as ErrorBoundaryProps, h as ErrorContextValue, i as ErrorProvider, H as HIGH_CONTRAST_SELECTION_STYLE, j as HighlightRect, P as PLUGIN_HOST_STYLES, k as ParseErrorDisplay, l as ParseErrorDisplayProps, m as PluginContext, n as PluginHost, o as PluginHostProps, p as PluginHostRef, q as RenderAsyncOptions, S as SELECTION_CSS_VARS, r as SelectionHighlightConfig, s as SelectionOverlayProps, t as SelectionRange, T as TableSelectionState, U as UnsupportedFeatureWarning, u as UnsupportedFeatureWarningProps, v as UseAutoSaveOptions, w as UseAutoSaveReturn, x as UseClipboardOptions, y as UseClipboardReturn, z as UseSelectionHighlightOptions, A as UseSelectionHighlightReturn, B as UseTableSelectionOptions, C as UseTableSelectionReturn, F as UseWheelZoomOptions, G as UseWheelZoomReturn, Z as ZOOM_PRESETS, I as areSelectionStylesInjected, J as clampZoom, K as clearSelection, L as createSelectionChangeHandler, M as findNearestZoomPreset, N as formatZoom, O as generateOverlayElements, Q as generateSelectionCSS, V as getHighlightRectStyle, W as getMergedSelectionRects, X as getNextZoomPreset, Y as getPreviousZoomPreset, _ as getSelectedText, $ as getSelectionBoundingRect, a0 as getSelectionRects, a1 as getUserFriendlyMessage, a2 as getZoomPresets, a3 as hasActiveSelection, a4 as highlightTextRange, a5 as injectSelectionStyles, a6 as isParseError, a7 as isSelectionBackwards, a8 as isSelectionWithin, a9 as isZoomPreset, aa as mergeAdjacentRects, ab as normalizeSelectionDirection, ac as parseZoom, ad as removeSelectionStyles, ae as renderAsync, af as selectRange, ag as useAutoSave, ah as useClipboard, ai as useErrorNotifications, aj as useSelectionHighlight, ak as useTableSelection, al as useWheelZoom } from './react-
|
|
1
|
+
import { R as ReactEditorPlugin } from './react-CFPWe7nV.js';
|
|
2
|
+
export { D as DEFAULT_SELECTION_STYLE, a as DocxEditor, b as DocxEditorHandle, c as DocxEditorProps, d as DocxEditorRef, E as EditorMode, e as EditorPlugin, f as ErrorBoundary, g as ErrorBoundaryProps, h as ErrorContextValue, i as ErrorProvider, H as HIGH_CONTRAST_SELECTION_STYLE, j as HighlightRect, P as PLUGIN_HOST_STYLES, k as ParseErrorDisplay, l as ParseErrorDisplayProps, m as PluginContext, n as PluginHost, o as PluginHostProps, p as PluginHostRef, q as RenderAsyncOptions, S as SELECTION_CSS_VARS, r as SelectionHighlightConfig, s as SelectionOverlayProps, t as SelectionRange, T as TableSelectionState, U as UnsupportedFeatureWarning, u as UnsupportedFeatureWarningProps, v as UseAutoSaveOptions, w as UseAutoSaveReturn, x as UseClipboardOptions, y as UseClipboardReturn, z as UseSelectionHighlightOptions, A as UseSelectionHighlightReturn, B as UseTableSelectionOptions, C as UseTableSelectionReturn, F as UseWheelZoomOptions, G as UseWheelZoomReturn, Z as ZOOM_PRESETS, I as areSelectionStylesInjected, J as clampZoom, K as clearSelection, L as createSelectionChangeHandler, M as findNearestZoomPreset, N as formatZoom, O as generateOverlayElements, Q as generateSelectionCSS, V as getHighlightRectStyle, W as getMergedSelectionRects, X as getNextZoomPreset, Y as getPreviousZoomPreset, _ as getSelectedText, $ as getSelectionBoundingRect, a0 as getSelectionRects, a1 as getUserFriendlyMessage, a2 as getZoomPresets, a3 as hasActiveSelection, a4 as highlightTextRange, a5 as injectSelectionStyles, a6 as isParseError, a7 as isSelectionBackwards, a8 as isSelectionWithin, a9 as isZoomPreset, aa as mergeAdjacentRects, ab as normalizeSelectionDirection, ac as parseZoom, ad as removeSelectionStyles, ae as renderAsync, af as selectRange, ag as useAutoSave, ah as useClipboard, ai as useErrorNotifications, aj as useSelectionHighlight, ak as useTableSelection, al as useWheelZoom } from './react-CFPWe7nV.js';
|
|
3
3
|
export { D as DocumentAgent, g as DocxInput, t as toArrayBuffer } from './DocumentAgent-lHtXgMFN.js';
|
|
4
4
|
export { A as AgentContextOptions, C as CreateEmptyDocumentOptions, E as ExtendedSelectionContext, P as ProcessTemplateOptions, a as ProcessTemplateResult, b as SelectionContextOptions, c as blendColors, d as buildExtendedSelectionContext, e as buildSelectionContext, g as colorsEqual, h as createDocumentWithText, i as createEmptyDocument, j as createRgbColor, l as createThemeColor, m as darkenColor, n as emuToPixels, o as emuToTwips, p as executeCommand, q as executeCommands, r as formatPx, s as getAgentContext, t as getContrastingColor, u as getDocumentSummary, x as getTemplateTags, y as halfPointsToPixels, z as isBlack, B as isWhite, D as lightenColor, G as parseColorString, H as parseDocx, I as pixelsToEmu, J as pixelsToTwips, K as pointsToPixels, M as processTemplate, O as processTemplateAsBlob, Q as processTemplateDetailed, R as resolveColor, U as resolveHighlightColor, V as resolveShadingColor, W as serializeDocumentBody, X as serializeDocx, Y as serializeSectionProperties, Z as twipsToEmu, _ as twipsToPixels, $ as validateTemplate } from './colorResolver-BTTqW66Q.js';
|
|
5
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 './fontLoader-DQJOS1sb.js';
|
|
6
|
-
|
|
7
|
-
export {
|
|
6
|
+
import { ToolbarProps } from './ui.js';
|
|
7
|
+
export { AdvancedColorPicker, AlignmentButtons, AlignmentButtonsProps, ColorOption, ColorPicker, ColorPickerProps, ContextMenu, ContextMenuProps, 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, ToolbarSeparator, UnsavedIndicator, UnsavedIndicatorProps, UseFindReplaceReturn, UseKeyboardShortcutsDialogOptions, UseKeyboardShortcutsDialogReturn, UseLoadingOptions, UseLoadingReturn, UsePasteSpecialOptions, UsePasteSpecialReturn, UseResponsiveToolbarOptions, UseResponsiveToolbarReturn, UseTextContextMenuOptions, UseTextContextMenuReturn, UseUnsavedChangesOptions, UseUnsavedChangesReturn, ZoomControl, ZoomControlProps, calculateFitDimensions, clampTableConfig, createChangeTracker, createDefaultFindOptions, createDefaultListState, createDefaultTableConfig, createErrorResponse, createMockResponse, createSearchPattern, createToolbarItem, createToolbarItems, dataUrlToBlob, delay, escapeRegexString, findAllMatches, findInDocument, findInParagraph, formatFileSize, formatShortcutKeys, formatTableDimensions, getActionShortcut, getAllActions, getAllCategories, getAllIndicatorPositions, getAllIndicatorVariants, getAllLoadingSizes, getAllLoadingVariants, getAllPasteOptions, getCategoryLabel, getCommonShortcuts, getDefaultActions, getDefaultHighlightOptions, getDefaultPasteOption, getDefaultShortcuts, getDefaultTextContextMenuItems, getImageAcceptString, getImageDimensions, getLoadingVariantLabel, getMarginInUnits, getMatchCountText, getPasteOption, getRecommendedPriority, getRulerDimensions, getShortcutsByCategory, getSupportedImageExtensions, getSymbolCategories, getSymbolUnicodeInfo, getSymbolsByCategory, getTablePresets, getTextActionLabel, getTextActionShortcut, getVariantLabel, isActionAvailable, 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';
|
|
8
|
+
import { ReactNode } from 'react';
|
|
9
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
10
|
+
export { C as CLIPBOARD_TYPES, a as ClipboardContent, b as ClipboardOptions, I as INTERNAL_CLIPBOARD_TYPE, P as ParsedClipboardContent, c as PrintButton, d as PrintButtonProps, e as PrintOptions, f as PrintStyles, T as TableAction, g as TableContext, h as TableSelection, i as TableToolbar, j as TableToolbarProps, k as addColumn, l as addRow, m as cleanWordHtml, n as copyParagraphs, o as copyRuns, p as createClipboardHandlers, q as createTableContext, r as deleteColumn, s as deleteRow, t as formatPrintPageRange, u as getCellAt, v as getColumnCount, w as getDefaultPrintOptions, x as handlePasteEvent, y as htmlToRuns, z as isEditorHtml, A as isPrintSupported, B as isWordHtml, D as mergeCells, E as openPrintWindow, F as paragraphsToClipboardContent, G as parseClipboardHtml, H as parsePageRange, J as readFromClipboard, K as runsToClipboardContent, L as splitCell, M as triggerPrint, N as writeToClipboard } from './clipboard-CU-zASXS.js';
|
|
8
11
|
export { f as AIAction, g as AIActionRequest, A as AgentCommand, h as AgentContext, i as AgentResponse, j as ApplyStyleCommand, l as BlockContent, a3 as BookmarkEnd, a4 as BookmarkStart, n as DeleteTextCommand, D as Document, d as DocumentBody, o as DocxPackage, E as Endnote, a5 as Field, a6 as FooterReference, F as Footnote, q as FormatTextCommand, a7 as HeaderFooter, a8 as HeaderReference, H as Hyperlink, I as Image, r as InsertHyperlinkCommand, s as InsertImageCommand, t as InsertTableCommand, u as InsertTextCommand, L as ListLevel, N as NumberingDefinitions, a as Paragraph, v as ParagraphContext, w as ParagraphFormatting, P as Position, R as Range, y as Relationship, z as ReplaceTextCommand, b as Run, c as RunContent, C as SectionProperties, G as SelectionContext, J as SetVariableCommand, a9 as Shape, K as Style, M as StyleDefinitions, Q as SuggestedAction, e as Table, U as TableCell, V as TableRow, aa as TextBox, W as TextContent, T as TextFormatting, X as Theme, ab as ThemeColorScheme, ac as ThemeFont, ad as ThemeFontScheme } from './agentApi-DmDuQm0e.js';
|
|
9
12
|
import * as prosemirror_state from 'prosemirror-state';
|
|
10
13
|
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
@@ -12,12 +15,92 @@ import { DecorationSet, EditorView } from 'prosemirror-view';
|
|
|
12
15
|
export { C as CorePlugin, e as McpSession, M as McpToolDefinition, i as McpToolHandler, j as McpToolResult } from './types-BpokDLqL.js';
|
|
13
16
|
export { P as PluginRegistry, p as pluginRegistry, r as registerPlugins } from './registry-C2DPl-QW.js';
|
|
14
17
|
export { docxtemplaterPlugin } from './core-plugins-reexport.js';
|
|
15
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
16
18
|
import { k as PluginPanelProps } from './ClipboardManager-CR843H7H.js';
|
|
17
19
|
export { d as AutoSaveStatus, e as ClipboardSelection, h as ErrorNotification, i as ErrorSeverity, j as PanelConfig, l as PositionCoordinates, R as RenderedDomContext, m as SavedDocumentData, T as TABLE_DATA_ATTRIBUTES, p as createSelectionFromDOM, t as formatLastSaveTime, u as formatStorageSize, v as getAutoSaveStatusLabel, w as getAutoSaveStorageSize, x as getSelectionRuns, z as isAutoSaveSupported } from './ClipboardManager-CR843H7H.js';
|
|
18
|
-
import 'react';
|
|
19
20
|
import 'prosemirror-model';
|
|
20
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Props for the EditorToolbar compound component.
|
|
24
|
+
* Extends ToolbarProps with title bar-specific fields.
|
|
25
|
+
*/
|
|
26
|
+
interface EditorToolbarProps extends ToolbarProps {
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface LogoProps {
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
}
|
|
32
|
+
declare function Logo({ children }: LogoProps): react_jsx_runtime.JSX.Element;
|
|
33
|
+
interface DocumentNameProps {
|
|
34
|
+
value: string;
|
|
35
|
+
onChange?: (value: string) => void;
|
|
36
|
+
placeholder?: string;
|
|
37
|
+
editable?: boolean;
|
|
38
|
+
}
|
|
39
|
+
declare function DocumentName({ value, onChange, placeholder, editable, }: DocumentNameProps): react_jsx_runtime.JSX.Element;
|
|
40
|
+
interface TitleBarRightProps {
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
}
|
|
43
|
+
declare function TitleBarRight({ children }: TitleBarRightProps): react_jsx_runtime.JSX.Element;
|
|
44
|
+
declare function MenuBar(): react_jsx_runtime.JSX.Element;
|
|
45
|
+
interface TitleBarProps {
|
|
46
|
+
children: ReactNode;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* TitleBar layout (Google Docs style):
|
|
50
|
+
*
|
|
51
|
+
* ┌──────────┬────────────────────────────┬──────────────────┐
|
|
52
|
+
* │ │ Document Name │ │
|
|
53
|
+
* │ Logo │ │ Right Actions │
|
|
54
|
+
* │ │ File Format Insert │ │
|
|
55
|
+
* └──────────┴────────────────────────────┴──────────────────┘
|
|
56
|
+
*
|
|
57
|
+
* Logo and TitleBarRight span full height. DocumentName + MenuBar
|
|
58
|
+
* stack vertically in the center column.
|
|
59
|
+
*/
|
|
60
|
+
declare function TitleBar({ children }: TitleBarProps): react_jsx_runtime.JSX.Element;
|
|
61
|
+
|
|
62
|
+
interface FormattingBarProps extends ToolbarProps {
|
|
63
|
+
/** Custom toolbar items to render at the end */
|
|
64
|
+
children?: ReactNode;
|
|
65
|
+
/** When true, renders with display:contents so children flow in parent flex container */
|
|
66
|
+
inline?: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Icon-based formatting toolbar — undo/redo, zoom, styles, fonts,
|
|
70
|
+
* bold/italic/underline, colors, alignment, lists, table/image context, clear formatting.
|
|
71
|
+
*/
|
|
72
|
+
declare function FormattingBar(explicitProps: FormattingBarProps): react_jsx_runtime.JSX.Element;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* EditorToolbar — Google Docs-style 2-level compound component.
|
|
76
|
+
*
|
|
77
|
+
* Usage:
|
|
78
|
+
* <EditorToolbar {...toolbarProps}>
|
|
79
|
+
* <EditorToolbar.TitleBar>
|
|
80
|
+
* <EditorToolbar.Logo><MyIcon /></EditorToolbar.Logo>
|
|
81
|
+
* <EditorToolbar.DocumentName value={name} onChange={setName} />
|
|
82
|
+
* <EditorToolbar.MenuBar />
|
|
83
|
+
* <EditorToolbar.TitleBarRight>
|
|
84
|
+
* <button>Save</button>
|
|
85
|
+
* </EditorToolbar.TitleBarRight>
|
|
86
|
+
* </EditorToolbar.TitleBar>
|
|
87
|
+
* <EditorToolbar.FormattingBar />
|
|
88
|
+
* </EditorToolbar>
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
interface EditorToolbarComponent {
|
|
92
|
+
(props: EditorToolbarProps & {
|
|
93
|
+
children: ReactNode;
|
|
94
|
+
}): React.JSX.Element;
|
|
95
|
+
TitleBar: typeof TitleBar;
|
|
96
|
+
Logo: typeof Logo;
|
|
97
|
+
DocumentName: typeof DocumentName;
|
|
98
|
+
MenuBar: typeof MenuBar;
|
|
99
|
+
TitleBarRight: typeof TitleBarRight;
|
|
100
|
+
FormattingBar: typeof FormattingBar;
|
|
101
|
+
}
|
|
102
|
+
declare const EditorToolbar: EditorToolbarComponent;
|
|
103
|
+
|
|
21
104
|
/**
|
|
22
105
|
* Text Selection Utilities
|
|
23
106
|
*
|
|
@@ -401,4 +484,4 @@ declare const templatePlugin: ReactEditorPlugin<TemplatePluginState>;
|
|
|
401
484
|
*/
|
|
402
485
|
declare const VERSION = "0.0.2";
|
|
403
486
|
|
|
404
|
-
export { ANNOTATION_PANEL_STYLES, AnnotationPanel, 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 };
|
|
487
|
+
export { ANNOTATION_PANEL_STYLES, AnnotationPanel, type DocumentNameProps, EditorToolbar, type EditorToolbarProps, FormattingBar, type FormattingBarProps, type KeyboardShortcut, type LogoProps, NAVIGATION_SHORTCUTS, type NavigationAction, type NavigationDirection, type NavigationUnit, PluginPanelProps, TEMPLATE_DECORATION_STYLES, type TagType, type TemplateTag, type TitleBarProps, type TitleBarRightProps, ToolbarProps, 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 };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export{v as DEFAULT_SELECTION_STYLE,i as DocxEditor,c as ErrorBoundary,b as ErrorProvider,w as HIGH_CONTRAST_SELECTION_STYLE,T as PLUGIN_HOST_STYLES,d as ParseErrorDisplay,U as PluginHost,x as SELECTION_CSS_VARS,e as UnsupportedFeatureWarning,l as ZOOM_PRESETS,O as areSelectionStylesInjected,u as clampZoom,J as clearSelection,P as createSelectionChangeHandler,o as findNearestZoomPreset,r as formatZoom,R as generateOverlayElements,C as generateSelectionCSS,B as getHighlightRectStyle,A as getMergedSelectionRects,p as getNextZoomPreset,q as getPreviousZoomPreset,E as getSelectedText,G as getSelectionBoundingRect,y as getSelectionRects,g as getUserFriendlyMessage,n as getZoomPresets,D as hasActiveSelection,H as highlightTextRange,M as injectSelectionStyles,f as isParseError,K as isSelectionBackwards,F as isSelectionWithin,t as isZoomPreset,z as mergeAdjacentRects,L as normalizeSelectionDirection,s as parseZoom,N as removeSelectionStyles,j as renderAsync,I as selectRange,k as useAutoSave,S as useClipboard,a as useErrorNotifications,Q as useSelectionHighlight,h as useTableSelection,m as useWheelZoom}from'./chunk-2JOQ7WKO.js';import'./chunk-5GFXHUMP.js';export{q as ColorPicker,a as ContextMenu,$ as InsertImageDialog,ja as InsertSymbolDialog,U as InsertTableDialog,wa as KeyboardShortcutsDialog,H as LoadingIndicator,qa as PasteSpecialDialog,r as PrintButton,s as PrintStyles,g as ResponsePreview,P as ResponsiveToolbar,Q as ResponsiveToolbarGroup,ia as SYMBOL_CATEGORIES,A as TableInsertButtons,z as TableMergeButton,k as TextContextMenu,B as UnsavedIndicator,ea as calculateFitDimensions,Y as clampTableConfig,G as createChangeTracker,W as createDefaultTableConfig,j as createErrorResponse,i as createMockResponse,R as createToolbarItem,S as createToolbarItems,fa as dataUrlToBlob,N as delay,ha as formatFileSize,x as formatPrintPageRange,Da as formatShortcutKeys,Z as formatTableDimensions,c as getActionShortcut,f as getAllActions,Ca as getAllCategories,F as getAllIndicatorPositions,E as getAllIndicatorVariants,M as getAllLoadingSizes,L as getAllLoadingVariants,ta as getAllPasteOptions,Ba as getCategoryLabel,Aa as getCommonShortcuts,e as getDefaultActions,ua as getDefaultPasteOption,v as getDefaultPrintOptions,ya as getDefaultShortcuts,o as getDefaultTextContextMenuItems,da as getImageAcceptString,ga as getImageDimensions,K as getLoadingVariantLabel,sa as getPasteOption,T as getRecommendedPriority,za as getShortcutsByCategory,ca as getSupportedImageExtensions,la as getSymbolCategories,na as getSymbolUnicodeInfo,ma as getSymbolsByCategory,_ as getTablePresets,m as getTextActionLabel,n as getTextActionShortcut,D as getVariantLabel,d as isActionAvailable,va as isPasteSpecialShortcut,y as isPrintSupported,p as isTextActionAvailable,ba as isValidImageFile,X as isValidTableConfig,u as openPrintWindow,w as parsePageRange,oa as searchSymbols,pa as symbolFromCodePoint,t as triggerPrint,b as useContextMenu,aa as useInsertImageDialog,ka as useInsertSymbolDialog,V as useInsertTableDialog,xa as useKeyboardShortcutsDialog,I as useLoading,J as useLoadingOperations,ra as usePasteSpecial,h as useResponsePreview,O as useResponsiveToolbar,l as useTextContextMenu,C as useUnsavedChanges}from'./chunk-R56SLH64.js';export{h as AdvancedColorPicker,j as AlignmentButtons,ca as CLIPBOARD_TYPES,b as FontPicker,g as FontSizePicker,O as HorizontalRuler,ba as INTERNAL_CLIPBOARD_TYPE,m as LineSpacingPicker,k as ListButtons,H as PageNavigator,z as PageNumberIndicator,n as StylePicker,q as TableBorderColorPicker,p as TableBorderPicker,r as TableBorderWidthPicker,s as TableCellFillPicker,t as TableMoreDropdown,T as TableToolbar,y as Toolbar,v as ToolbarButton,w as ToolbarGroup,x as ToolbarSeparator,o as ZoomControl,Z as addColumn,X as addRow,N as calculateProgress,G as calculateScrollToPage,F as calculateVisiblePage,K as clampPageNumber,na as cleanWordHtml,ea as copyParagraphs,da as copyRuns,pa as createClipboardHandlers,l as createDefaultListState,B as createPageFormat,U as createTableContext,_ as deleteColumn,Y as deleteRow,A as formatPageOrdinal,M as formatPageRange,W as getCellAt,V as getColumnCount,R as getMarginInUnits,L as getNavigationShortcuts,C as getPageProgress,Q as getRulerDimensions,ja as handlePasteEvent,oa as htmlToRuns,ma as isEditorHtml,D as isFirstPage,E as isLastPage,J as isValidPageNumber,la as isWordHtml,$ as mergeCells,ga as paragraphsToClipboardContent,ka as parseClipboardHtml,S as parseMarginFromUnits,I as parsePageInput,P as positionToMargin,ia as readFromClipboard,fa as runsToClipboardContent,aa as splitCell,ha as writeToClipboard}from'./chunk-C6ELWJWO.js';export{n as FindReplaceDialog,a as createDefaultFindOptions,c as createSearchPattern,b as escapeRegexString,d as findAllMatches,j as findInDocument,k as findInParagraph,i as getDefaultHighlightOptions,g as getMatchCountText,h as isEmptySearch,e as replaceAllInContent,f as replaceFirstInContent,l as scrollToMatch,m as useFindReplace}from'./chunk-CTYOM6BE.js';export{d as HyperlinkDialog,m as useHyperlinkDialog}from'./chunk-PJVI53AH.js';export{x as TABLE_DATA_ATTRIBUTES,n as countPageBreaks,b as createColumnBreak,g as createHorizontalRule,c as createLineBreak,a as createPageBreak,e as createPageBreakParagraph,d as createPageBreakRun,F as createSelectionFromDOM,o as findPageBreaks,s as formatLastSaveTime,v as formatStorageSize,t as getAutoSaveStatusLabel,u as getAutoSaveStorageSize,E as getSelectionRuns,m as hasPageBreakBefore,h as insertHorizontalRule,f as insertPageBreak,w as isAutoSaveSupported,l as isBreakContent,j as isColumnBreak,k as isLineBreak,i as isPageBreak,p as removePageBreak}from'./chunk-FVUGBRDD.js';import'./chunk-QVPR2W5S.js';export{f as DocumentAgent,m as buildExtendedSelectionContext,l as buildSelectionContext,e as createDocumentWithText,d as createEmptyDocument,i as getAgentContext,k as getDocumentSummary}from'./chunk-JIKVCUR6.js';export{l as blendColors,q as colorsEqual,i as createRgbColor,h as createThemeColor,j as darkenColor,f as getContrastingColor,d as isBlack,e as isWhite,k as lightenColor,g as parseColorString,a as resolveColor,b as resolveHighlightColor,c as resolveShadingColor}from'./chunk-4VUZBV2S.js';export{o as docxtemplaterPlugin}from'./chunk-6TUCNECX.js';export{e as getTemplateTags,a as processTemplate,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-CLDB6TL7.js';export{b as serializeDocumentBody,c as serializeDocx,a as serializeSectionProperties}from'./chunk-PGEORVCG.js';export{a as executeCommand,b as executeCommands}from'./chunk-AARNCPWR.js';export{i as canRenderFont,g as getLoadedFonts,e as isFontLoaded,f as isFontsLoading,c as loadFont,j as loadFontFromBuffer,d as loadFonts,h as onFontsLoaded,n as parseDocx,k as preloadCommonFonts,m as toArrayBuffer}from'./chunk-3X3LTNK4.js';export{a as PluginRegistry,b as pluginRegistry,c as registerPlugins}from'./chunk-BUEMG4NW.js';export{c as emuToPixels,e as emuToTwips,k as formatPx,h as halfPointsToPixels,d as pixelsToEmu,b as pixelsToTwips,g as pointsToPixels,f as twipsToEmu,a as twipsToPixels}from'./chunk-SE5EN2QL.js';import'./chunk-USRMBYI6.js';import'./chunk-H5NTJZO4.js';import ye,{useState,useRef,useMemo,useCallback,useEffect}from'react';import {PluginKey,TextSelection,Plugin}from'prosemirror-state';import {DecorationSet,Decoration}from'prosemirror-view';import {jsx,jsxs}from'react/jsx-runtime';var Ba=/[\p{L}\p{N}''\-]/u,Wa=/\s/;function M(e){return !e||e.length===0?false:Ba.test(e)}function K(e){return !e||e.length===0?false:Wa.test(e)}function R(e,t){if(!e||e.length===0)return [0,0];t=Math.max(0,Math.min(t,e.length-1));let o=e[t];if(K(o)){let n=t,r=t;for(;n>0&&K(e[n-1]);)n--;for(;r<e.length&&K(e[r]);)r++;return [n,r]}if(M(o)){let n=t,r=t;for(;n>0&&M(e[n-1]);)n--;for(;r<e.length&&M(e[r]);)r++;return [n,r]}return [t,t+1]}function Fa(e,t){let[o,n]=R(e,t);return e.slice(o,n)}function Ua(e,t){let[o,n]=R(e,t);return {word:e.slice(o,n),startIndex:o,endIndex:n}}function $(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0),o=t.startContainer;if(o.nodeType===Node.TEXT_NODE){let n=o.textContent||"",r=t.startOffset,[a,i]=R(n,r);if(i>a)return t.setStart(o,a),t.setEnd(o,i),e.removeAllRanges(),e.addRange(t),true}if(o.nodeType===Node.ELEMENT_NODE){let n=o,r=q(n);if(r.length>0){let a=t.startOffset,i=null,l=a;if(a<n.childNodes.length){let p=n.childNodes[a];if(p.nodeType===Node.TEXT_NODE)i=p,l=0;else if(p instanceof Element){let d=q(p);d.length>0&&(i=d[0],l=0);}}if(!i&&r.length>0&&(i=r[0],l=0),i){let p=i.textContent||"",[d,c]=R(p,l);if(c>d){let u=document.createRange();return u.setStart(i,d),u.setEnd(i,c),e.removeAllRanges(),e.addRange(u),true}}}}return false}function za(e,t){let o=window.getSelection();if(!o)return false;let n=e.textContent||"",[r,a]=R(n,t);if(a>r){let i=document.createRange();return i.setStart(e,r),i.setEnd(e,a),o.removeAllRanges(),o.addRange(i),true}return false}function Va(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0);if(t.collapsed)return $();let o=t.startContainer,n=t.endContainer,r=t.startOffset,a=t.endOffset;if(o.nodeType===Node.TEXT_NODE){let i=o.textContent||"",[l]=R(i,t.startOffset);r=l;}if(n.nodeType===Node.TEXT_NODE){let i=n.textContent||"",l=Math.max(0,t.endOffset-1),[,p]=R(i,l);a=p;}try{return t.setStart(o,r),t.setEnd(n,a),e.removeAllRanges(),e.addRange(t),!0}catch(i){return console.warn("Could not expand selection to word boundaries:",i),false}}function J(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let o=e.getRangeAt(0).commonAncestorContainer,n=Ga(o);if(n){let r=document.createRange();return r.selectNodeContents(n),e.removeAllRanges(),e.addRange(r),true}return false}function Ga(e){if(!e)return null;let t=e;for(;t;){if(t instanceof Element&&t.hasAttribute("data-paragraph-index"))return t;t=t.parentNode;}return null}function q(e){let t=[],o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),n;for(;n=o.nextNode();)n.nodeType===Node.TEXT_NODE&&t.push(n);return t}var V=0,O=null,G=null,$a=500;function j(){V=0,G=null,O&&(clearTimeout(O),O=null);}function Q(e){return e.target!==G&&j(),V++,G=e.target,O&&clearTimeout(O),O=setTimeout(j,$a),Math.min(V,3)}function Ya(){return e=>{e.ctrlKey||e.metaKey||e.altKey||$();}}function Za(){return e=>{if(Q(e)===3){if(e.ctrlKey||e.metaKey||e.altKey)return;J();}}}function P(e){return e?/[\p{L}\p{N}_]/u.test(e):false}function Y(e){return e?/\s/.test(e):false}function Xa(e){return e?/[\p{P}]/u.test(e):false}function qa(e,t){if(t<=0)return 0;t>e.length&&(t=e.length);let o=t;for(;o>0&&Y(e[o-1]);)o--;if(o===0)return 0;for(;o>0&&P(e[o-1]);)o--;return o}function ja(e,t){if(t>=e.length)return e.length;t<0&&(t=0);let o=t;for(;o<e.length&&P(e[o]);)o++;for(;o<e.length&&Y(e[o]);)o++;return o}function ee(e,t){if(t>=e.length)return e.length;let o=t;for(;o<e.length&&P(e[o]);)o++;for(;o<e.length&&!P(e[o]);)o++;return o}function te(e,t){if(t<=0)return 0;let o=t;for(;o>0&&!P(e[o-1]);)o--;for(;o>0&&P(e[o-1]);)o--;return o}function oe(e,t){if(!window.getSelection())return null;let n=document.createRange();if(e.nodeType===Node.TEXT_NODE){n.setStart(e,Math.min(t,e.textContent?.length||0)),n.collapse(true);let a=n.getBoundingClientRect().top,i=0,l=t;for(;i<l;){let p=Math.floor((i+l)/2);n.setStart(e,p),n.collapse(true);let d=n.getBoundingClientRect();Math.abs(d.top-a)<2?l=p:i=p+1;}return {node:e,offset:i}}return null}function ne(e,t){if(!window.getSelection())return null;let n=e.textContent?.length||0,r=document.createRange();if(e.nodeType===Node.TEXT_NODE){r.setStart(e,Math.min(t,n)),r.collapse(true);let i=r.getBoundingClientRect().top,l=t,p=n;for(;l<p;){let d=Math.ceil((l+p)/2);r.setStart(e,d),r.collapse(true);let c=r.getBoundingClientRect();Math.abs(c.top-i)<2?l=d:p=d-1;}return {node:e,offset:l}}return null}function Ja(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;let t=e.getRangeAt(0);return {node:t.startContainer,offset:t.startOffset,anchorNode:e.anchorNode,anchorOffset:e.anchorOffset,focusNode:e.focusNode,focusOffset:e.focusOffset,isCollapsed:e.isCollapsed,text:e.toString()}}function H(e,t){let o=window.getSelection();if(!o)return;let n=document.createRange(),r=e.nodeType===Node.TEXT_NODE?e.textContent?.length||0:e.childNodes.length;n.setStart(e,Math.min(t,r)),n.collapse(true),o.removeAllRanges(),o.addRange(n);}function _(e,t){let o=window.getSelection();if(!(!o||!o.anchorNode))try{o.extend(e,Math.min(t,e.textContent?.length||0));}catch{let n=e.nodeType===Node.TEXT_NODE?e.textContent?.length||0:e.childNodes.length;o.setBaseAndExtent(o.anchorNode,o.anchorOffset,e,Math.min(t,n));}}function re(e,t=false){let o=window.getSelection();if(!o||o.rangeCount===0)return false;let n=o.focusNode;if(!n||n.nodeType!==Node.TEXT_NODE)return false;let r=n.textContent||"",a=o.focusOffset,i;return e==="left"?i=te(r,a):i=ee(r,a),t?_(n,i):H(n,i),true}function ae(e,t=false){let o=window.getSelection();if(!o||o.rangeCount===0)return false;let n=o.focusNode;if(!n)return false;if(n.nodeType===Node.TEXT_NODE){let i=e==="start"?oe(n,o.focusOffset):ne(n,o.focusOffset);if(i)return t?_(i.node,i.offset):H(i.node,i.offset),true}let r=n.textContent||"",a=e==="start"?0:r.length;return t?_(n,a):H(n,a),true}function ie(e){let{key:t,ctrlKey:o,metaKey:n,shiftKey:r,altKey:a}=e,i=o||n;switch(t){case "ArrowLeft":if(i)return {direction:"left",unit:"word",extend:r};break;case "ArrowRight":if(i)return {direction:"right",unit:"word",extend:r};break;case "Home":return i?{direction:"left",unit:"document",extend:r}:{direction:"left",unit:"line",extend:r};case "End":return i?{direction:"right",unit:"document",extend:r}:{direction:"right",unit:"line",extend:r}}return null}function Qa(e,t){let o=ie(e);if(!o)return false;switch(o.unit){case "word":if((o.direction==="left"||o.direction==="right")&&re(o.direction,o.extend))return e.preventDefault(),true;break;case "line":let n=o.direction==="left"?"start":"end";if(ae(n,o.extend))return e.preventDefault(),true;break;case "document":if(o.direction==="left"&&t?.onDocumentStart)return e.preventDefault(),t.onDocumentStart(),true;if(o.direction==="right"&&t?.onDocumentEnd)return e.preventDefault(),t.onDocumentEnd(),true;break}return false}function ei(e){let{key:t,ctrlKey:o,metaKey:n}=e;return !!((o||n)&&(t==="ArrowLeft"||t==="ArrowRight")||t==="Home"||t==="End")}function ti(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.focusNode;if(!t||t.nodeType!==Node.TEXT_NODE)return false;let o=t.textContent||"",n=e.focusOffset,r=n,a=n;for(;r>0&&P(o[r-1]);)r--;for(;a<o.length&&P(o[a]);)a++;if(r===a)return false;let i=document.createRange();return i.setStart(t,r),i.setEnd(t,a),e.removeAllRanges(),e.addRange(i),true}function oi(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;let t=e.focusNode;if(!t||t.nodeType!==Node.TEXT_NODE)return null;let o=t.textContent||"",n=e.focusOffset,r=n,a=n;for(;r>0&&P(o[r-1]);)r--;for(;a<o.length&&P(o[a]);)a++;return r===a?null:o.slice(r,a)}function ni(e,t){let o=e.ctrlKey||e.metaKey,n=t.ctrlKey||t.metaKey;return e.key.toLowerCase()===t.key.toLowerCase()&&o===!!n&&e.shiftKey===!!t.shiftKey&&e.altKey===!!t.altKey}var T={wordLeft:{key:"ArrowLeft",ctrlKey:true},wordRight:{key:"ArrowRight",ctrlKey:true},selectWordLeft:{key:"ArrowLeft",ctrlKey:true,shiftKey:true},selectWordRight:{key:"ArrowRight",ctrlKey:true,shiftKey:true},lineStart:{key:"Home"},lineEnd:{key:"End"},selectToLineStart:{key:"Home",shiftKey:true},selectToLineEnd:{key:"End",shiftKey:true},documentStart:{key:"Home",ctrlKey:true},documentEnd:{key:"End",ctrlKey:true},selectToDocumentStart:{key:"Home",ctrlKey:true,shiftKey:true},selectToDocumentEnd:{key:"End",ctrlKey:true,shiftKey:true}};function S(e){let t=[];if(e.ctrlKey||e.metaKey){let n=typeof navigator<"u"&&/Mac/i.test(navigator.platform);t.push(n?"\u2318":"Ctrl");}e.shiftKey&&t.push("Shift"),e.altKey&&t.push("Alt");let o=e.key;return o==="ArrowLeft"?o="\u2190":o==="ArrowRight"?o="\u2192":o==="ArrowUp"?o="\u2191":o==="ArrowDown"&&(o="\u2193"),t.push(o),t.join("+")}function ri(){return [{action:"Move by word (left)",shortcut:S(T.wordLeft)},{action:"Move by word (right)",shortcut:S(T.wordRight)},{action:"Select word (left)",shortcut:S(T.selectWordLeft)},{action:"Select word (right)",shortcut:S(T.selectWordRight)},{action:"Go to line start",shortcut:S(T.lineStart)},{action:"Go to line end",shortcut:S(T.lineEnd)},{action:"Select to line start",shortcut:S(T.selectToLineStart)},{action:"Select to line end",shortcut:S(T.selectToLineEnd)},{action:"Go to document start",shortcut:S(T.documentStart)},{action:"Go to document end",shortcut:S(T.documentEnd)},{action:"Select to document start",shortcut:S(T.selectToDocumentStart)},{action:"Select to document end",shortcut:S(T.selectToDocumentEnd)}]}var se=/\{([#/^@]?)([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}/g,m=new PluginKey("template");function li(e,t,o){return `${e}:${t}:${o}`}function le(e){let t=[];e.descendants((p,d)=>(p.isText&&p.text&&t.push({text:p.text,pos:d}),true));let o="",n=[];for(let p of t){for(let d=0;d<p.text.length;d++)n.push(p.pos+d);o+=p.text;}let r=[],a=[],i=new Map,l;for(se.lastIndex=0;(l=se.exec(o))!==null;){let[p,d,c]=l,u=n[l.index],x=n[l.index+p.length-1]+1,g;d==="#"?g="sectionStart":d==="/"?g="sectionEnd":d==="^"?g="invertedStart":d==="@"?g="raw":g="variable";let b=`${g}:${c}`,k=i.get(b)??0;i.set(b,k+1);let N={id:li(g,c,k),type:g,name:c,rawTag:p,from:u,to:x};if(g==="sectionStart"||g==="invertedStart")N.nestedVars=[],a.push(N);else if(g==="sectionEnd"){for(let s=a.length-1;s>=0;s--)if(a[s].name===c){a.splice(s,1);break}}else g==="variable"&&a.length>0&&(a[a.length-1].nestedVars?.push(c),N.insideSection=true);r.push(N);}return r}function ci(e){switch(e){case "sectionStart":case "sectionEnd":return "#3b82f6";case "invertedStart":return "#8b5cf6";case "raw":return "#ef4444";default:return "#f59e0b"}}function Z(e,t,o,n){let r=[];for(let a of t){let i=a.id===o,l=a.id===n,p=ci(a.type),d=["docx-template-tag"];i&&d.push("hovered"),l&&d.push("selected"),r.push(Decoration.inline(a.from,a.to,{class:d.join(" "),"data-tag-id":a.id,style:`background-color: ${p}22; border-radius: 2px;`}));}return DecorationSet.create(e,r)}function pi(e,t){if(e.length!==t.length)return false;for(let o=0;o<e.length;o++)if(e[o].id!==t[o].id)return false;return true}function B(){return new Plugin({key:m,state:{init(e,t){let o=le(t.doc);return {tags:o,decorations:Z(t.doc,o)}},apply(e,t,o,n){if(e.docChanged){let a=le(n.doc),i=pi(t.tags,a);return {tags:a,decorations:i?t.decorations.map(e.mapping,e.doc):Z(n.doc,a,t.hoveredId,t.selectedId),hoveredId:t.hoveredId,selectedId:t.selectedId}}let r=e.getMeta(m);if(r){let a=r.hoveredId??t.hoveredId,i=r.selectedId??t.selectedId;return {...t,hoveredId:a,selectedId:i,decorations:Z(n.doc,t.tags,a,i)}}return {...t,decorations:t.decorations.map(e.mapping,e.doc)}}},props:{decorations(e){return m.getState(e)?.decorations??DecorationSet.empty},handleClick(e,t){let n=(m.getState(e.state)?.tags??[]).find(a=>t>=a.from&&t<=a.to);return n?(e.dispatch(e.state.tr.setMeta(m,{selectedId:n.id})),true):(m.getState(e.state)?.selectedId&&e.dispatch(e.state.tr.setMeta(m,{selectedId:void 0})),false)},handleDOMEvents:{mouseover(e,t){let n=t.target.closest?.("[data-tag-id]")?.getAttribute("data-tag-id")||void 0,r=m.getState(e.state)?.hoveredId;return n!==r&&e.dispatch(e.state.tr.setMeta(m,{hoveredId:n})),false},mouseout(e,t){return t.relatedTarget?.closest?.("[data-tag-id]")||m.getState(e.state)?.hoveredId&&e.dispatch(e.state.tr.setMeta(m,{hoveredId:void 0})),false}}}})}function pe(e){return m.getState(e)?.tags??[]}function D(e,t){e.dispatch(e.state.tr.setMeta(m,{hoveredId:t}));}function L(e,t){e.dispatch(e.state.tr.setMeta(m,{selectedId:t}));}var W=`
|
|
1
|
+
export{w as DEFAULT_SELECTION_STYLE,j as DocxEditor,a as EditorToolbar,d as ErrorBoundary,c as ErrorProvider,x as HIGH_CONTRAST_SELECTION_STYLE,U as PLUGIN_HOST_STYLES,e as ParseErrorDisplay,V as PluginHost,y as SELECTION_CSS_VARS,f as UnsupportedFeatureWarning,m as ZOOM_PRESETS,P as areSelectionStylesInjected,v as clampZoom,K as clearSelection,Q as createSelectionChangeHandler,p as findNearestZoomPreset,s as formatZoom,S as generateOverlayElements,D as generateSelectionCSS,C as getHighlightRectStyle,B as getMergedSelectionRects,q as getNextZoomPreset,r as getPreviousZoomPreset,F as getSelectedText,H as getSelectionBoundingRect,z as getSelectionRects,h as getUserFriendlyMessage,o as getZoomPresets,E as hasActiveSelection,I as highlightTextRange,N as injectSelectionStyles,g as isParseError,L as isSelectionBackwards,G as isSelectionWithin,u as isZoomPreset,A as mergeAdjacentRects,M as normalizeSelectionDirection,t as parseZoom,O as removeSelectionStyles,k as renderAsync,J as selectRange,l as useAutoSave,T as useClipboard,b as useErrorNotifications,R as useSelectionHighlight,i as useTableSelection,n as useWheelZoom}from'./chunk-YYBSUBRG.js';import'./chunk-5GFXHUMP.js';export{q as ColorPicker,a as ContextMenu,$ as InsertImageDialog,ja as InsertSymbolDialog,U as InsertTableDialog,wa as KeyboardShortcutsDialog,H as LoadingIndicator,qa as PasteSpecialDialog,r as PrintButton,s as PrintStyles,g as ResponsePreview,P as ResponsiveToolbar,Q as ResponsiveToolbarGroup,ia as SYMBOL_CATEGORIES,A as TableInsertButtons,z as TableMergeButton,k as TextContextMenu,B as UnsavedIndicator,ea as calculateFitDimensions,Y as clampTableConfig,G as createChangeTracker,W as createDefaultTableConfig,j as createErrorResponse,i as createMockResponse,R as createToolbarItem,S as createToolbarItems,fa as dataUrlToBlob,N as delay,ha as formatFileSize,x as formatPrintPageRange,Da as formatShortcutKeys,Z as formatTableDimensions,c as getActionShortcut,f as getAllActions,Ca as getAllCategories,F as getAllIndicatorPositions,E as getAllIndicatorVariants,M as getAllLoadingSizes,L as getAllLoadingVariants,ta as getAllPasteOptions,Ba as getCategoryLabel,Aa as getCommonShortcuts,e as getDefaultActions,ua as getDefaultPasteOption,v as getDefaultPrintOptions,ya as getDefaultShortcuts,o as getDefaultTextContextMenuItems,da as getImageAcceptString,ga as getImageDimensions,K as getLoadingVariantLabel,sa as getPasteOption,T as getRecommendedPriority,za as getShortcutsByCategory,ca as getSupportedImageExtensions,la as getSymbolCategories,na as getSymbolUnicodeInfo,ma as getSymbolsByCategory,_ as getTablePresets,m as getTextActionLabel,n as getTextActionShortcut,D as getVariantLabel,d as isActionAvailable,va as isPasteSpecialShortcut,y as isPrintSupported,p as isTextActionAvailable,ba as isValidImageFile,X as isValidTableConfig,u as openPrintWindow,w as parsePageRange,oa as searchSymbols,pa as symbolFromCodePoint,t as triggerPrint,b as useContextMenu,aa as useInsertImageDialog,ka as useInsertSymbolDialog,V as useInsertTableDialog,xa as useKeyboardShortcutsDialog,I as useLoading,J as useLoadingOperations,ra as usePasteSpecial,h as useResponsePreview,O as useResponsiveToolbar,l as useTextContextMenu,C as useUnsavedChanges}from'./chunk-FUK46DWH.js';export{k as AdvancedColorPicker,l as AlignmentButtons,U as CLIPBOARD_TYPES,g as FontPicker,j as FontSizePicker,y as FormattingBar,E as HorizontalRuler,T as INTERNAL_CLIPBOARD_TYPE,o as LineSpacingPicker,m as ListButtons,p as StylePicker,s as TableBorderColorPicker,r as TableBorderPicker,t as TableBorderWidthPicker,u as TableCellFillPicker,v as TableMoreDropdown,J as TableToolbar,D as Toolbar,A as ToolbarButton,B as ToolbarGroup,C as ToolbarSeparator,q as ZoomControl,P as addColumn,N as addRow,da as cleanWordHtml,W as copyParagraphs,V as copyRuns,fa as createClipboardHandlers,n as createDefaultListState,K as createTableContext,Q as deleteColumn,O as deleteRow,M as getCellAt,L as getColumnCount,H as getMarginInUnits,G as getRulerDimensions,$ as handlePasteEvent,ea as htmlToRuns,ca as isEditorHtml,ba as isWordHtml,R as mergeCells,Y as paragraphsToClipboardContent,aa as parseClipboardHtml,I as parseMarginFromUnits,F as positionToMargin,_ as readFromClipboard,X as runsToClipboardContent,S as splitCell,Z as writeToClipboard}from'./chunk-MUIREXKH.js';export{n as FindReplaceDialog,a as createDefaultFindOptions,c as createSearchPattern,b as escapeRegexString,d as findAllMatches,j as findInDocument,k as findInParagraph,i as getDefaultHighlightOptions,g as getMatchCountText,h as isEmptySearch,e as replaceAllInContent,f as replaceFirstInContent,l as scrollToMatch,m as useFindReplace}from'./chunk-CTYOM6BE.js';export{d as HyperlinkDialog,m as useHyperlinkDialog}from'./chunk-PJVI53AH.js';export{x as TABLE_DATA_ATTRIBUTES,n as countPageBreaks,b as createColumnBreak,g as createHorizontalRule,c as createLineBreak,a as createPageBreak,e as createPageBreakParagraph,d as createPageBreakRun,F as createSelectionFromDOM,o as findPageBreaks,s as formatLastSaveTime,v as formatStorageSize,t as getAutoSaveStatusLabel,u as getAutoSaveStorageSize,E as getSelectionRuns,m as hasPageBreakBefore,h as insertHorizontalRule,f as insertPageBreak,w as isAutoSaveSupported,l as isBreakContent,j as isColumnBreak,k as isLineBreak,i as isPageBreak,p as removePageBreak}from'./chunk-FVUGBRDD.js';import'./chunk-QVPR2W5S.js';export{f as DocumentAgent,m as buildExtendedSelectionContext,l as buildSelectionContext,e as createDocumentWithText,d as createEmptyDocument,i as getAgentContext,k as getDocumentSummary}from'./chunk-JIKVCUR6.js';export{l as blendColors,q as colorsEqual,i as createRgbColor,h as createThemeColor,j as darkenColor,f as getContrastingColor,d as isBlack,e as isWhite,k as lightenColor,g as parseColorString,a as resolveColor,b as resolveHighlightColor,c as resolveShadingColor}from'./chunk-4VUZBV2S.js';export{o as docxtemplaterPlugin}from'./chunk-6TUCNECX.js';export{e as getTemplateTags,a as processTemplate,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-CLDB6TL7.js';export{b as serializeDocumentBody,c as serializeDocx,a as serializeSectionProperties}from'./chunk-PGEORVCG.js';export{a as executeCommand,b as executeCommands}from'./chunk-AARNCPWR.js';export{i as canRenderFont,g as getLoadedFonts,e as isFontLoaded,f as isFontsLoading,c as loadFont,j as loadFontFromBuffer,d as loadFonts,h as onFontsLoaded,n as parseDocx,k as preloadCommonFonts,m as toArrayBuffer}from'./chunk-3X3LTNK4.js';export{a as PluginRegistry,b as pluginRegistry,c as registerPlugins}from'./chunk-BUEMG4NW.js';export{c as emuToPixels,e as emuToTwips,k as formatPx,h as halfPointsToPixels,d as pixelsToEmu,b as pixelsToTwips,g as pointsToPixels,f as twipsToEmu,a as twipsToPixels}from'./chunk-SE5EN2QL.js';import'./chunk-USRMBYI6.js';import'./chunk-H5NTJZO4.js';import ye,{useState,useRef,useMemo,useCallback,useEffect}from'react';import {PluginKey,TextSelection,Plugin}from'prosemirror-state';import {DecorationSet,Decoration}from'prosemirror-view';import {jsx,jsxs}from'react/jsx-runtime';var Ra=/[\p{L}\p{N}''\-]/u,Aa=/\s/;function M(e){return !e||e.length===0?false:Ra.test(e)}function K(e){return !e||e.length===0?false:Aa.test(e)}function R(e,t){if(!e||e.length===0)return [0,0];t=Math.max(0,Math.min(t,e.length-1));let o=e[t];if(K(o)){let n=t,r=t;for(;n>0&&K(e[n-1]);)n--;for(;r<e.length&&K(e[r]);)r++;return [n,r]}if(M(o)){let n=t,r=t;for(;n>0&&M(e[n-1]);)n--;for(;r<e.length&&M(e[r]);)r++;return [n,r]}return [t,t+1]}function wa(e,t){let[o,n]=R(e,t);return e.slice(o,n)}function Ia(e,t){let[o,n]=R(e,t);return {word:e.slice(o,n),startIndex:o,endIndex:n}}function $(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0),o=t.startContainer;if(o.nodeType===Node.TEXT_NODE){let n=o.textContent||"",r=t.startOffset,[a,i]=R(n,r);if(i>a)return t.setStart(o,a),t.setEnd(o,i),e.removeAllRanges(),e.addRange(t),true}if(o.nodeType===Node.ELEMENT_NODE){let n=o,r=q(n);if(r.length>0){let a=t.startOffset,i=null,l=a;if(a<n.childNodes.length){let p=n.childNodes[a];if(p.nodeType===Node.TEXT_NODE)i=p,l=0;else if(p instanceof Element){let d=q(p);d.length>0&&(i=d[0],l=0);}}if(!i&&r.length>0&&(i=r[0],l=0),i){let p=i.textContent||"",[d,c]=R(p,l);if(c>d){let u=document.createRange();return u.setStart(i,d),u.setEnd(i,c),e.removeAllRanges(),e.addRange(u),true}}}}return false}function Na(e,t){let o=window.getSelection();if(!o)return false;let n=e.textContent||"",[r,a]=R(n,t);if(a>r){let i=document.createRange();return i.setStart(e,r),i.setEnd(e,a),o.removeAllRanges(),o.addRange(i),true}return false}function Oa(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.getRangeAt(0);if(t.collapsed)return $();let o=t.startContainer,n=t.endContainer,r=t.startOffset,a=t.endOffset;if(o.nodeType===Node.TEXT_NODE){let i=o.textContent||"",[l]=R(i,t.startOffset);r=l;}if(n.nodeType===Node.TEXT_NODE){let i=n.textContent||"",l=Math.max(0,t.endOffset-1),[,p]=R(i,l);a=p;}try{return t.setStart(o,r),t.setEnd(n,a),e.removeAllRanges(),e.addRange(t),!0}catch(i){return console.warn("Could not expand selection to word boundaries:",i),false}}function J(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let o=e.getRangeAt(0).commonAncestorContainer,n=Da(o);if(n){let r=document.createRange();return r.selectNodeContents(n),e.removeAllRanges(),e.addRange(r),true}return false}function Da(e){if(!e)return null;let t=e;for(;t;){if(t instanceof Element&&t.hasAttribute("data-paragraph-index"))return t;t=t.parentNode;}return null}function q(e){let t=[],o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),n;for(;n=o.nextNode();)n.nodeType===Node.TEXT_NODE&&t.push(n);return t}var V=0,O=null,G=null,La=500;function j(){V=0,G=null,O&&(clearTimeout(O),O=null);}function Q(e){return e.target!==G&&j(),V++,G=e.target,O&&clearTimeout(O),O=setTimeout(j,La),Math.min(V,3)}function ka(){return e=>{e.ctrlKey||e.metaKey||e.altKey||$();}}function Ma(){return e=>{if(Q(e)===3){if(e.ctrlKey||e.metaKey||e.altKey)return;J();}}}function P(e){return e?/[\p{L}\p{N}_]/u.test(e):false}function Y(e){return e?/\s/.test(e):false}function Ka(e){return e?/[\p{P}]/u.test(e):false}function Ha(e,t){if(t<=0)return 0;t>e.length&&(t=e.length);let o=t;for(;o>0&&Y(e[o-1]);)o--;if(o===0)return 0;for(;o>0&&P(e[o-1]);)o--;return o}function _a(e,t){if(t>=e.length)return e.length;t<0&&(t=0);let o=t;for(;o<e.length&&P(e[o]);)o++;for(;o<e.length&&Y(e[o]);)o++;return o}function ee(e,t){if(t>=e.length)return e.length;let o=t;for(;o<e.length&&P(e[o]);)o++;for(;o<e.length&&!P(e[o]);)o++;return o}function te(e,t){if(t<=0)return 0;let o=t;for(;o>0&&!P(e[o-1]);)o--;for(;o>0&&P(e[o-1]);)o--;return o}function oe(e,t){if(!window.getSelection())return null;let n=document.createRange();if(e.nodeType===Node.TEXT_NODE){n.setStart(e,Math.min(t,e.textContent?.length||0)),n.collapse(true);let a=n.getBoundingClientRect().top,i=0,l=t;for(;i<l;){let p=Math.floor((i+l)/2);n.setStart(e,p),n.collapse(true);let d=n.getBoundingClientRect();Math.abs(d.top-a)<2?l=p:i=p+1;}return {node:e,offset:i}}return null}function ne(e,t){if(!window.getSelection())return null;let n=e.textContent?.length||0,r=document.createRange();if(e.nodeType===Node.TEXT_NODE){r.setStart(e,Math.min(t,n)),r.collapse(true);let i=r.getBoundingClientRect().top,l=t,p=n;for(;l<p;){let d=Math.ceil((l+p)/2);r.setStart(e,d),r.collapse(true);let c=r.getBoundingClientRect();Math.abs(c.top-i)<2?l=d:p=d-1;}return {node:e,offset:l}}return null}function Ba(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;let t=e.getRangeAt(0);return {node:t.startContainer,offset:t.startOffset,anchorNode:e.anchorNode,anchorOffset:e.anchorOffset,focusNode:e.focusNode,focusOffset:e.focusOffset,isCollapsed:e.isCollapsed,text:e.toString()}}function H(e,t){let o=window.getSelection();if(!o)return;let n=document.createRange(),r=e.nodeType===Node.TEXT_NODE?e.textContent?.length||0:e.childNodes.length;n.setStart(e,Math.min(t,r)),n.collapse(true),o.removeAllRanges(),o.addRange(n);}function _(e,t){let o=window.getSelection();if(!(!o||!o.anchorNode))try{o.extend(e,Math.min(t,e.textContent?.length||0));}catch{let n=e.nodeType===Node.TEXT_NODE?e.textContent?.length||0:e.childNodes.length;o.setBaseAndExtent(o.anchorNode,o.anchorOffset,e,Math.min(t,n));}}function re(e,t=false){let o=window.getSelection();if(!o||o.rangeCount===0)return false;let n=o.focusNode;if(!n||n.nodeType!==Node.TEXT_NODE)return false;let r=n.textContent||"",a=o.focusOffset,i;return e==="left"?i=te(r,a):i=ee(r,a),t?_(n,i):H(n,i),true}function ae(e,t=false){let o=window.getSelection();if(!o||o.rangeCount===0)return false;let n=o.focusNode;if(!n)return false;if(n.nodeType===Node.TEXT_NODE){let i=e==="start"?oe(n,o.focusOffset):ne(n,o.focusOffset);if(i)return t?_(i.node,i.offset):H(i.node,i.offset),true}let r=n.textContent||"",a=e==="start"?0:r.length;return t?_(n,a):H(n,a),true}function ie(e){let{key:t,ctrlKey:o,metaKey:n,shiftKey:r,altKey:a}=e,i=o||n;switch(t){case "ArrowLeft":if(i)return {direction:"left",unit:"word",extend:r};break;case "ArrowRight":if(i)return {direction:"right",unit:"word",extend:r};break;case "Home":return i?{direction:"left",unit:"document",extend:r}:{direction:"left",unit:"line",extend:r};case "End":return i?{direction:"right",unit:"document",extend:r}:{direction:"right",unit:"line",extend:r}}return null}function Wa(e,t){let o=ie(e);if(!o)return false;switch(o.unit){case "word":if((o.direction==="left"||o.direction==="right")&&re(o.direction,o.extend))return e.preventDefault(),true;break;case "line":let n=o.direction==="left"?"start":"end";if(ae(n,o.extend))return e.preventDefault(),true;break;case "document":if(o.direction==="left"&&t?.onDocumentStart)return e.preventDefault(),t.onDocumentStart(),true;if(o.direction==="right"&&t?.onDocumentEnd)return e.preventDefault(),t.onDocumentEnd(),true;break}return false}function Fa(e){let{key:t,ctrlKey:o,metaKey:n}=e;return !!((o||n)&&(t==="ArrowLeft"||t==="ArrowRight")||t==="Home"||t==="End")}function Ua(){let e=window.getSelection();if(!e||e.rangeCount===0)return false;let t=e.focusNode;if(!t||t.nodeType!==Node.TEXT_NODE)return false;let o=t.textContent||"",n=e.focusOffset,r=n,a=n;for(;r>0&&P(o[r-1]);)r--;for(;a<o.length&&P(o[a]);)a++;if(r===a)return false;let i=document.createRange();return i.setStart(t,r),i.setEnd(t,a),e.removeAllRanges(),e.addRange(i),true}function za(){let e=window.getSelection();if(!e||e.rangeCount===0)return null;let t=e.focusNode;if(!t||t.nodeType!==Node.TEXT_NODE)return null;let o=t.textContent||"",n=e.focusOffset,r=n,a=n;for(;r>0&&P(o[r-1]);)r--;for(;a<o.length&&P(o[a]);)a++;return r===a?null:o.slice(r,a)}function Va(e,t){let o=e.ctrlKey||e.metaKey,n=t.ctrlKey||t.metaKey;return e.key.toLowerCase()===t.key.toLowerCase()&&o===!!n&&e.shiftKey===!!t.shiftKey&&e.altKey===!!t.altKey}var T={wordLeft:{key:"ArrowLeft",ctrlKey:true},wordRight:{key:"ArrowRight",ctrlKey:true},selectWordLeft:{key:"ArrowLeft",ctrlKey:true,shiftKey:true},selectWordRight:{key:"ArrowRight",ctrlKey:true,shiftKey:true},lineStart:{key:"Home"},lineEnd:{key:"End"},selectToLineStart:{key:"Home",shiftKey:true},selectToLineEnd:{key:"End",shiftKey:true},documentStart:{key:"Home",ctrlKey:true},documentEnd:{key:"End",ctrlKey:true},selectToDocumentStart:{key:"Home",ctrlKey:true,shiftKey:true},selectToDocumentEnd:{key:"End",ctrlKey:true,shiftKey:true}};function S(e){let t=[];if(e.ctrlKey||e.metaKey){let n=typeof navigator<"u"&&/Mac/i.test(navigator.platform);t.push(n?"\u2318":"Ctrl");}e.shiftKey&&t.push("Shift"),e.altKey&&t.push("Alt");let o=e.key;return o==="ArrowLeft"?o="\u2190":o==="ArrowRight"?o="\u2192":o==="ArrowUp"?o="\u2191":o==="ArrowDown"&&(o="\u2193"),t.push(o),t.join("+")}function Ga(){return [{action:"Move by word (left)",shortcut:S(T.wordLeft)},{action:"Move by word (right)",shortcut:S(T.wordRight)},{action:"Select word (left)",shortcut:S(T.selectWordLeft)},{action:"Select word (right)",shortcut:S(T.selectWordRight)},{action:"Go to line start",shortcut:S(T.lineStart)},{action:"Go to line end",shortcut:S(T.lineEnd)},{action:"Select to line start",shortcut:S(T.selectToLineStart)},{action:"Select to line end",shortcut:S(T.selectToLineEnd)},{action:"Go to document start",shortcut:S(T.documentStart)},{action:"Go to document end",shortcut:S(T.documentEnd)},{action:"Select to document start",shortcut:S(T.selectToDocumentStart)},{action:"Select to document end",shortcut:S(T.selectToDocumentEnd)}]}var se=/\{([#/^@]?)([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}/g,m=new PluginKey("template");function Xa(e,t,o){return `${e}:${t}:${o}`}function le(e){let t=[];e.descendants((p,d)=>(p.isText&&p.text&&t.push({text:p.text,pos:d}),true));let o="",n=[];for(let p of t){for(let d=0;d<p.text.length;d++)n.push(p.pos+d);o+=p.text;}let r=[],a=[],i=new Map,l;for(se.lastIndex=0;(l=se.exec(o))!==null;){let[p,d,c]=l,u=n[l.index],x=n[l.index+p.length-1]+1,g;d==="#"?g="sectionStart":d==="/"?g="sectionEnd":d==="^"?g="invertedStart":d==="@"?g="raw":g="variable";let b=`${g}:${c}`,k=i.get(b)??0;i.set(b,k+1);let w={id:Xa(g,c,k),type:g,name:c,rawTag:p,from:u,to:x};if(g==="sectionStart"||g==="invertedStart")w.nestedVars=[],a.push(w);else if(g==="sectionEnd"){for(let s=a.length-1;s>=0;s--)if(a[s].name===c){a.splice(s,1);break}}else g==="variable"&&a.length>0&&(a[a.length-1].nestedVars?.push(c),w.insideSection=true);r.push(w);}return r}function qa(e){switch(e){case "sectionStart":case "sectionEnd":return "#3b82f6";case "invertedStart":return "#8b5cf6";case "raw":return "#ef4444";default:return "#f59e0b"}}function Z(e,t,o,n){let r=[];for(let a of t){let i=a.id===o,l=a.id===n,p=qa(a.type),d=["docx-template-tag"];i&&d.push("hovered"),l&&d.push("selected"),r.push(Decoration.inline(a.from,a.to,{class:d.join(" "),"data-tag-id":a.id,style:`background-color: ${p}22; border-radius: 2px;`}));}return DecorationSet.create(e,r)}function ja(e,t){if(e.length!==t.length)return false;for(let o=0;o<e.length;o++)if(e[o].id!==t[o].id)return false;return true}function B(){return new Plugin({key:m,state:{init(e,t){let o=le(t.doc);return {tags:o,decorations:Z(t.doc,o)}},apply(e,t,o,n){if(e.docChanged){let a=le(n.doc),i=ja(t.tags,a);return {tags:a,decorations:i?t.decorations.map(e.mapping,e.doc):Z(n.doc,a,t.hoveredId,t.selectedId),hoveredId:t.hoveredId,selectedId:t.selectedId}}let r=e.getMeta(m);if(r){let a=r.hoveredId??t.hoveredId,i=r.selectedId??t.selectedId;return {...t,hoveredId:a,selectedId:i,decorations:Z(n.doc,t.tags,a,i)}}return {...t,decorations:t.decorations.map(e.mapping,e.doc)}}},props:{decorations(e){return m.getState(e)?.decorations??DecorationSet.empty},handleClick(e,t){let n=(m.getState(e.state)?.tags??[]).find(a=>t>=a.from&&t<=a.to);return n?(e.dispatch(e.state.tr.setMeta(m,{selectedId:n.id})),true):(m.getState(e.state)?.selectedId&&e.dispatch(e.state.tr.setMeta(m,{selectedId:void 0})),false)},handleDOMEvents:{mouseover(e,t){let n=t.target.closest?.("[data-tag-id]")?.getAttribute("data-tag-id")||void 0,r=m.getState(e.state)?.hoveredId;return n!==r&&e.dispatch(e.state.tr.setMeta(m,{hoveredId:n})),false},mouseout(e,t){return t.relatedTarget?.closest?.("[data-tag-id]")||m.getState(e.state)?.hoveredId&&e.dispatch(e.state.tr.setMeta(m,{hoveredId:void 0})),false}}}})}function pe(e){return m.getState(e)?.tags??[]}function D(e,t){e.dispatch(e.state.tr.setMeta(m,{hoveredId:t}));}function L(e,t){e.dispatch(e.state.tr.setMeta(m,{selectedId:t}));}var W=`
|
|
2
2
|
.docx-template-tag {
|
|
3
3
|
cursor: pointer;
|
|
4
4
|
transition: background-color 0.1s;
|
|
@@ -12,8 +12,8 @@ export{v as DEFAULT_SELECTION_STYLE,i as DocxEditor,c as ErrorBoundary,b as Erro
|
|
|
12
12
|
.docx-template-tag.selected {
|
|
13
13
|
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
|
|
14
14
|
}
|
|
15
|
-
`;var
|
|
16
|
-
Iterates over ${s.name}[]. Access nested properties via ${s.name}.property`:s.rawTag,children:[
|
|
15
|
+
`;var ti={variable:"#f59e0b",sectionStart:"#3b82f6",sectionEnd:"#3b82f6",invertedStart:"#8b5cf6",raw:"#ef4444"};function oi(e){switch(e){case "sectionStart":return "LOOP / IF";case "invertedStart":return "IF NOT";case "raw":return "HTML";default:return ""}}function U({editorView:e,pluginState:t,renderedDomContext:o}){let n=t?.tags??[],r=t?.hoveredId,a=t?.selectedId,[i,l]=useState(0),p=useRef(null),d=useRef(new Map),c=useRef([]),u=useMemo(()=>n.filter(s=>s.type!=="sectionEnd"&&!s.insideSection),[n]),x=useCallback(()=>{if(u.length===0||!o)return c.current;let s=[],h=o.getContainerOffset(),E=new Map;for(let f of c.current)E.set(f.tag.id,f.top);for(let f of u){let y=o.getRectsForRange(f.from,f.from+1);if(y.length>0){let v=y[0].y+h.y-40;s.push({tag:f,top:v});}else {let v=E.get(f.id);v!==void 0&&s.push({tag:f,top:v});}}s.sort((f,y)=>f.top-y.top);let I=6;for(let f=1;f<s.length;f++){let y=s[f-1],v=s[f],C=d.current.get(y.tag.id),N=32;C?N=C.offsetHeight:y.tag.nestedVars&&y.tag.nestedVars.length>0&&(N=42+y.tag.nestedVars.length*26),v.top<y.top+N+I&&(v.top=y.top+N+I);}return c.current=s,s},[u,o]),g=useMemo(()=>x(),[x,i]);useEffect(()=>{if(!o)return;let s=new ResizeObserver(()=>{requestAnimationFrame(()=>l(h=>h+1));});return s.observe(o.pagesContainer),()=>s.disconnect()},[o]),useEffect(()=>{let s=()=>{requestAnimationFrame(()=>l(h=>h+1));};return window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]);let b=useRef("");useEffect(()=>{let s=u.map(h=>h.id).join(",");if(s&&b.current!==s){let h=setTimeout(()=>{b.current=s,l(E=>E+1);},50);return ()=>clearTimeout(h)}},[u]);let k=s=>{e&&D(e,s);},w=s=>{if(!e)return;L(e,s.id);let{state:h}=e,E=h.tr.setSelection(TextSelection.near(h.doc.resolve(s.from)));e.dispatch(E),e.focus();};return u.length===0?null:jsx("div",{className:"template-panel",ref:p,children:jsx("div",{className:"template-panel-annotations",children:g.map(({tag:s,top:h})=>{let E=oi(s.type),I=ti[s.type],f=s.type==="sectionStart"||s.type==="invertedStart",y=s.id===r,v=s.id===a;return jsxs("div",{className:"template-annotation-anchor",style:{top:`${h}px`},children:[jsx("div",{className:"template-annotation-connector"}),jsxs("div",{ref:C=>{C?d.current.set(s.id,C):d.current.delete(s.id);},className:`template-annotation-chip ${y?"hovered":""} ${v?"selected":""}`,style:{borderLeftColor:I},onMouseEnter:()=>k(s.id),onMouseLeave:()=>k(void 0),onClick:()=>w(s),title:f?`${s.rawTag}
|
|
16
|
+
Iterates over ${s.name}[]. Access nested properties via ${s.name}.property`:s.rawTag,children:[E&&jsx("span",{className:"template-chip-badge",style:{background:I},children:E}),!E&&jsx("span",{className:"template-chip-dot",style:{color:I},children:"\u25CF"}),jsx("span",{className:"template-chip-name",children:s.name}),f&&s.nestedVars&&s.nestedVars.length>0&&jsx("div",{className:"template-chip-nested",children:s.nestedVars.map((C,N)=>jsx("span",{className:"template-nested-var",title:`Access: ${s.name}.${C}`,children:C.includes(".")?C.split(".").pop():C},N))})]})]},s.id)})})})}var z=`
|
|
17
17
|
.template-panel {
|
|
18
18
|
display: flex;
|
|
19
19
|
min-height: 100%;
|
|
@@ -124,7 +124,7 @@ Iterates over ${s.name}[]. Access nested properties via ${s.name}.property`:s.ra
|
|
|
124
124
|
background: rgba(59, 130, 246, 0.15);
|
|
125
125
|
color: #1e40af;
|
|
126
126
|
}
|
|
127
|
-
`;var
|
|
127
|
+
`;var ii={variable:"rgba(245, 158, 11, 0.3)",sectionStart:"rgba(59, 130, 246, 0.3)",sectionEnd:"rgba(59, 130, 246, 0.3)",invertedStart:"rgba(139, 92, 246, 0.3)",raw:"rgba(239, 68, 68, 0.3)"},si={variable:"rgba(245, 158, 11, 0.5)",sectionStart:"rgba(59, 130, 246, 0.5)",sectionEnd:"rgba(59, 130, 246, 0.5)",invertedStart:"rgba(139, 92, 246, 0.5)",raw:"rgba(239, 68, 68, 0.5)"};function me({context:e,tags:t,hoveredId:o,selectedId:n,onHover:r,onSelect:a}){let[i,l]=useState(0),p=useCallback(()=>{let c=e.getContainerOffset(),u=[];for(let x of t){let g=e.getRectsForRange(x.from,x.to);for(let b of g)u.push({tagId:x.id,tagType:x.type,x:b.x+c.x,y:b.y+c.y,width:b.width,height:b.height});}return u},[e,t]),d=useMemo(()=>p(),[p,i]);return useEffect(()=>{let c=()=>{requestAnimationFrame(()=>l(u=>u+1));};return window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)},[]),useEffect(()=>{let c=new ResizeObserver(()=>{requestAnimationFrame(()=>l(u=>u+1));});return c.observe(e.pagesContainer),()=>c.disconnect()},[e.pagesContainer]),d.length===0?null:jsx("div",{className:"template-highlight-overlay",children:d.map((c,u)=>{let x=c.tagId===o,g=c.tagId===n,b=x||g?si[c.tagType]:ii[c.tagType];return jsx("div",{className:`template-highlight ${x?"hovered":""} ${g?"selected":""}`,style:{position:"absolute",left:c.x,top:c.y,width:c.width,height:c.height,backgroundColor:b,borderRadius:2,cursor:"pointer"},onMouseEnter:()=>r?.(c.tagId),onMouseLeave:()=>r?.(void 0),onClick:()=>a?.(c.tagId)},`${c.tagId}-${u}`)})})}var he=`
|
|
128
128
|
.template-highlight-overlay {
|
|
129
129
|
position: absolute;
|
|
130
130
|
top: 0;
|
|
@@ -148,8 +148,8 @@ Iterates over ${s.name}[]. Access nested properties via ${s.name}.property`:s.ra
|
|
|
148
148
|
.template-highlight.selected {
|
|
149
149
|
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.6);
|
|
150
150
|
}
|
|
151
|
-
`;var
|
|
151
|
+
`;var ci=ye.memo(U,(e,t)=>{let o=e.pluginState,n=t.pluginState;if(o?.hoveredId!==n?.hoveredId||o?.selectedId!==n?.selectedId)return false;let r=o?.tags??[],a=n?.tags??[];if(r.length!==a.length)return false;for(let i=0;i<r.length;i++)if(r[i].id!==a[i].id)return false;return e.renderedDomContext===t.renderedDomContext});function Te(e={}){return {id:"template",name:"Template",proseMirrorPlugins:[B()],Panel:ci,panelConfig:{position:e.panelPosition??"right",defaultSize:e.panelWidth??280,minSize:200,maxSize:400,resizable:true,collapsible:true,defaultCollapsed:e.defaultCollapsed??false},onStateChange:o=>{let n=m.getState(o.state);if(n)return {tags:n.tags,hoveredId:n.hoveredId,selectedId:n.selectedId}},initialize:o=>({tags:[]}),renderOverlay:(o,n,r)=>!n||n.tags.length===0?null:ye.createElement(me,{context:o,tags:n.tags,hoveredId:n.hoveredId,selectedId:n.selectedId,onHover:a=>{r&&D(r,a);},onSelect:a=>{if(r){L(r,a);let i=n.tags.find(l=>l.id===a);if(i){let l=r.state.tr.setSelection(TextSelection.near(r.state.doc.resolve(i.from)));r.dispatch(l),r.focus();}}}}),styles:`
|
|
152
152
|
${W}
|
|
153
153
|
${z}
|
|
154
154
|
${he}
|
|
155
|
-
`}}var
|
|
155
|
+
`}}var pi=Te();var Di="0.0.2";export{z as ANNOTATION_PANEL_STYLES,U as AnnotationPanel,T as NAVIGATION_SHORTCUTS,W as TEMPLATE_DECORATION_STYLES,Di as VERSION,ka as createDoubleClickWordSelector,Te as createTemplatePlugin,B as createTemplateProseMirrorPlugin,Ma as createTripleClickParagraphSelector,S as describeShortcut,Ua as expandSelectionToWord,Oa as expandSelectionToWordBoundaries,_ as extendSelectionTo,ee as findNextWordStart,te as findPreviousWordStart,ne as findVisualLineEnd,oe as findVisualLineStart,Ia as findWordAt,R as findWordBoundaries,_a as findWordEnd,Ha as findWordStart,Ga as getNavigationShortcutDescriptions,Ba as getSelectionInfo,pe as getTemplatePluginTags,wa as getWordAt,za as getWordAtCursor,Q as handleClickForMultiClick,Wa as handleNavigationKey,Fa as isNavigationKey,Ka as isPunctuation,K as isWhitespace,Y as isWhitespaceChar,P as isWordChar,M as isWordCharacter,Va as matchesShortcut,re as moveByWord,ae as moveToLineEdge,ie as parseNavigationAction,J as selectParagraphAtCursor,$ as selectWordAtCursor,Na as selectWordInTextNode,D as setHoveredElement,L as setSelectedElement,H as setSelectionPosition,pi as templatePlugin,m as templatePluginKey};
|
|
@@ -5,7 +5,7 @@ import { EditorView } from 'prosemirror-view';
|
|
|
5
5
|
import * as prosemirror_state from 'prosemirror-state';
|
|
6
6
|
import { EditorState, Transaction } from 'prosemirror-state';
|
|
7
7
|
import { T as TextFormatting, w as ParagraphFormatting, D as Document, X as Theme, e as Table } from './agentApi-DmDuQm0e.js';
|
|
8
|
-
import {
|
|
8
|
+
import { e as PrintOptions, g as TableContext, T as TableAction, P as ParsedClipboardContent } from './clipboard-CU-zASXS.js';
|
|
9
9
|
import { g as DocxInput, D as DocumentAgent } from './DocumentAgent-lHtXgMFN.js';
|
|
10
10
|
import { g as EditorPluginCore, k as PluginPanelProps, R as RenderedDomContext, f as EditorHandle, h as ErrorNotification, m as SavedDocumentData, d as AutoSaveStatus, e as ClipboardSelection } from './ClipboardManager-CR843H7H.js';
|
|
11
11
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -345,14 +345,6 @@ interface DocxEditorProps {
|
|
|
345
345
|
showToolbar?: boolean;
|
|
346
346
|
/** Whether to show zoom control (default: true) */
|
|
347
347
|
showZoomControl?: boolean;
|
|
348
|
-
/** Whether to show page number indicator (default: true) */
|
|
349
|
-
showPageNumbers?: boolean;
|
|
350
|
-
/** Whether to enable interactive page navigation (default: true) */
|
|
351
|
-
enablePageNavigation?: boolean;
|
|
352
|
-
/** Position of page number indicator (default: 'bottom-center') */
|
|
353
|
-
pageNumberPosition?: PageIndicatorPosition | PageNavigatorPosition;
|
|
354
|
-
/** Variant of page number indicator (default: 'default') */
|
|
355
|
-
pageNumberVariant?: PageIndicatorVariant | PageNavigatorVariant;
|
|
356
348
|
/** Whether to show page margin guides/boundaries (default: false) */
|
|
357
349
|
showMarginGuides?: boolean;
|
|
358
350
|
/** Color for margin guides (default: '#c0c0c0') */
|
|
@@ -403,6 +395,16 @@ interface DocxEditorProps {
|
|
|
403
395
|
* Passed from PluginHost to render plugin-specific overlays.
|
|
404
396
|
*/
|
|
405
397
|
pluginOverlays?: ReactNode;
|
|
398
|
+
/** Custom logo/icon for the title bar */
|
|
399
|
+
renderLogo?: () => ReactNode;
|
|
400
|
+
/** Document name shown in the title bar */
|
|
401
|
+
documentName?: string;
|
|
402
|
+
/** Callback when document name changes */
|
|
403
|
+
onDocumentNameChange?: (name: string) => void;
|
|
404
|
+
/** Whether the document name is editable (default: true) */
|
|
405
|
+
documentNameEditable?: boolean;
|
|
406
|
+
/** Custom right-side actions for the title bar */
|
|
407
|
+
renderTitleBarRight?: () => ReactNode;
|
|
406
408
|
}
|
|
407
409
|
/**
|
|
408
410
|
* DocxEditor ref interface
|
|
@@ -5,7 +5,7 @@ import { EditorView } from 'prosemirror-view';
|
|
|
5
5
|
import * as prosemirror_state from 'prosemirror-state';
|
|
6
6
|
import { EditorState, Transaction } from 'prosemirror-state';
|
|
7
7
|
import { T as TextFormatting, w as ParagraphFormatting, D as Document, X as Theme, e as Table } from './agentApi-DmDuQm0e.cjs';
|
|
8
|
-
import {
|
|
8
|
+
import { e as PrintOptions, g as TableContext, T as TableAction, P as ParsedClipboardContent } from './clipboard-DBabJ6mU.cjs';
|
|
9
9
|
import { g as DocxInput, D as DocumentAgent } from './DocumentAgent-cHf96hwL.cjs';
|
|
10
10
|
import { g as EditorPluginCore, k as PluginPanelProps, R as RenderedDomContext, f as EditorHandle, h as ErrorNotification, m as SavedDocumentData, d as AutoSaveStatus, e as ClipboardSelection } from './ClipboardManager-Bbo5MM_U.cjs';
|
|
11
11
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -345,14 +345,6 @@ interface DocxEditorProps {
|
|
|
345
345
|
showToolbar?: boolean;
|
|
346
346
|
/** Whether to show zoom control (default: true) */
|
|
347
347
|
showZoomControl?: boolean;
|
|
348
|
-
/** Whether to show page number indicator (default: true) */
|
|
349
|
-
showPageNumbers?: boolean;
|
|
350
|
-
/** Whether to enable interactive page navigation (default: true) */
|
|
351
|
-
enablePageNavigation?: boolean;
|
|
352
|
-
/** Position of page number indicator (default: 'bottom-center') */
|
|
353
|
-
pageNumberPosition?: PageIndicatorPosition | PageNavigatorPosition;
|
|
354
|
-
/** Variant of page number indicator (default: 'default') */
|
|
355
|
-
pageNumberVariant?: PageIndicatorVariant | PageNavigatorVariant;
|
|
356
348
|
/** Whether to show page margin guides/boundaries (default: false) */
|
|
357
349
|
showMarginGuides?: boolean;
|
|
358
350
|
/** Color for margin guides (default: '#c0c0c0') */
|
|
@@ -403,6 +395,16 @@ interface DocxEditorProps {
|
|
|
403
395
|
* Passed from PluginHost to render plugin-specific overlays.
|
|
404
396
|
*/
|
|
405
397
|
pluginOverlays?: ReactNode;
|
|
398
|
+
/** Custom logo/icon for the title bar */
|
|
399
|
+
renderLogo?: () => ReactNode;
|
|
400
|
+
/** Document name shown in the title bar */
|
|
401
|
+
documentName?: string;
|
|
402
|
+
/** Callback when document name changes */
|
|
403
|
+
onDocumentNameChange?: (name: string) => void;
|
|
404
|
+
/** Whether the document name is editable (default: true) */
|
|
405
|
+
documentNameEditable?: boolean;
|
|
406
|
+
/** Custom right-side actions for the title bar */
|
|
407
|
+
renderTitleBarRight?: () => ReactNode;
|
|
406
408
|
}
|
|
407
409
|
/**
|
|
408
410
|
* DocxEditor ref interface
|
package/dist/react.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkS36T7OK5_cjs=require('./chunk-S36T7OK5.cjs');require('./chunk-4CUGBNL2.cjs'),require('./chunk-OWMG5MW5.cjs'),require('./chunk-VTAS7VZ6.cjs'),require('./chunk-XS2AQFMF.cjs');var chunk2VHQ7YOQ_cjs=require('./chunk-2VHQ7YOQ.cjs');require('./chunk-KL2RYY6G.cjs'),require('./chunk-IA4LPH2A.cjs'),require('./chunk-5ILXHRJS.cjs'),require('./chunk-B7TICMXD.cjs'),require('./chunk-PUVSVHHB.cjs'),require('./chunk-P7ZF45KZ.cjs');var chunkPIVLDW7B_cjs=require('./chunk-PIVLDW7B.cjs');require('./chunk-YS7FDEZ4.cjs'),require('./chunk-KR32M3S4.cjs'),require('./chunk-XQNCLN4T.cjs'),require('./chunk-PCJ5ACUV.cjs');Object.defineProperty(exports,"DocxEditor",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.j}});Object.defineProperty(exports,"ErrorBoundary",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.d}});Object.defineProperty(exports,"ErrorProvider",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.c}});Object.defineProperty(exports,"PLUGIN_HOST_STYLES",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.U}});Object.defineProperty(exports,"ParseErrorDisplay",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.e}});Object.defineProperty(exports,"PluginHost",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.V}});Object.defineProperty(exports,"UnsupportedFeatureWarning",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.f}});Object.defineProperty(exports,"ZOOM_PRESETS",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.m}});Object.defineProperty(exports,"clampZoom",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.v}});Object.defineProperty(exports,"findNearestZoomPreset",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.p}});Object.defineProperty(exports,"formatZoom",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.s}});Object.defineProperty(exports,"generateOverlayElements",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.S}});Object.defineProperty(exports,"getNextZoomPreset",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.q}});Object.defineProperty(exports,"getPreviousZoomPreset",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.r}});Object.defineProperty(exports,"getUserFriendlyMessage",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.h}});Object.defineProperty(exports,"getZoomPresets",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.o}});Object.defineProperty(exports,"isParseError",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.g}});Object.defineProperty(exports,"isZoomPreset",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.u}});Object.defineProperty(exports,"parseZoom",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.t}});Object.defineProperty(exports,"renderAsync",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.k}});Object.defineProperty(exports,"useAutoSave",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.l}});Object.defineProperty(exports,"useClipboard",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.T}});Object.defineProperty(exports,"useErrorNotifications",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.b}});Object.defineProperty(exports,"useSelectionHighlight",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.R}});Object.defineProperty(exports,"useTableSelection",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.i}});Object.defineProperty(exports,"useWheelZoom",{enumerable:true,get:function(){return chunkS36T7OK5_cjs.n}});Object.defineProperty(exports,"TABLE_DATA_ATTRIBUTES",{enumerable:true,get:function(){return chunk2VHQ7YOQ_cjs.x}});Object.defineProperty(exports,"createSelectionFromDOM",{enumerable:true,get:function(){return chunk2VHQ7YOQ_cjs.F}});Object.defineProperty(exports,"formatLastSaveTime",{enumerable:true,get:function(){return chunk2VHQ7YOQ_cjs.s}});Object.defineProperty(exports,"formatStorageSize",{enumerable:true,get:function(){return chunk2VHQ7YOQ_cjs.v}});Object.defineProperty(exports,"getAutoSaveStatusLabel",{enumerable:true,get:function(){return chunk2VHQ7YOQ_cjs.t}});Object.defineProperty(exports,"getAutoSaveStorageSize",{enumerable:true,get:function(){return chunk2VHQ7YOQ_cjs.u}});Object.defineProperty(exports,"getSelectionRuns",{enumerable:true,get:function(){return chunk2VHQ7YOQ_cjs.E}});Object.defineProperty(exports,"isAutoSaveSupported",{enumerable:true,get:function(){return chunk2VHQ7YOQ_cjs.w}});Object.defineProperty(exports,"toArrayBuffer",{enumerable:true,get:function(){return chunkPIVLDW7B_cjs.m}});
|