@eigenpal/docx-js-editor 0.0.16 → 0.0.17
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/FindReplaceDialog-K4GRE4JB.cjs +2 -0
- package/dist/FindReplaceDialog-K4GRE4JB.cjs.map +1 -0
- package/dist/{FindReplaceDialog-UMXCBBST.js → FindReplaceDialog-MMDEJORP.js} +2 -1
- package/dist/FindReplaceDialog-MMDEJORP.js.map +1 -0
- package/dist/{FootnotePropertiesDialog-TYQGPWPX.js → FootnotePropertiesDialog-HG4267LR.js} +2 -1
- package/dist/FootnotePropertiesDialog-HG4267LR.js.map +1 -0
- package/dist/{FootnotePropertiesDialog-OBQXOBJE.cjs → FootnotePropertiesDialog-V3YOIJCV.cjs} +2 -1
- package/dist/FootnotePropertiesDialog-V3YOIJCV.cjs.map +1 -0
- package/dist/{HyperlinkDialog-UOERZIBM.js → HyperlinkDialog-SCSX4RP7.js} +2 -1
- package/dist/HyperlinkDialog-SCSX4RP7.js.map +1 -0
- package/dist/HyperlinkDialog-YPKURBZK.cjs +2 -0
- package/dist/HyperlinkDialog-YPKURBZK.cjs.map +1 -0
- package/dist/{ImagePositionDialog-52FDANUK.js → ImagePositionDialog-CJYJ35PI.js} +2 -1
- package/dist/ImagePositionDialog-CJYJ35PI.js.map +1 -0
- package/dist/{ImagePositionDialog-ZK5WFBRC.cjs → ImagePositionDialog-IMVI7EXA.cjs} +2 -1
- package/dist/ImagePositionDialog-IMVI7EXA.cjs.map +1 -0
- package/dist/{ImagePropertiesDialog-YPSLPSF6.js → ImagePropertiesDialog-P7WN2ALR.js} +2 -1
- package/dist/ImagePropertiesDialog-P7WN2ALR.js.map +1 -0
- package/dist/{ImagePropertiesDialog-LU44RDIY.cjs → ImagePropertiesDialog-YS4KJRN7.cjs} +2 -1
- package/dist/ImagePropertiesDialog-YS4KJRN7.cjs.map +1 -0
- package/dist/{TablePropertiesDialog-KMOYHPGF.cjs → TablePropertiesDialog-CUQXUBQN.cjs} +2 -1
- package/dist/TablePropertiesDialog-CUQXUBQN.cjs.map +1 -0
- package/dist/{TablePropertiesDialog-OUUJAA7D.js → TablePropertiesDialog-ZHAYVHPZ.js} +2 -1
- package/dist/TablePropertiesDialog-ZHAYVHPZ.js.map +1 -0
- package/dist/{clipboard-BOocwmAM.d.ts → TableToolbar-RHX9L4h9.d.cts} +2 -125
- package/dist/{clipboard-Cx7cb3kX.d.cts → TableToolbar-RHX9L4h9.d.ts} +2 -125
- package/dist/chunk-7FEY3YWC.cjs +3 -0
- package/dist/chunk-7FEY3YWC.cjs.map +1 -0
- package/dist/chunk-AL62KQYJ.js +2 -0
- package/dist/chunk-AL62KQYJ.js.map +1 -0
- package/dist/{chunk-VTAS7VZ6.cjs → chunk-DJAEBZ33.cjs} +2 -1
- package/dist/chunk-DJAEBZ33.cjs.map +1 -0
- package/dist/{chunk-CTYOM6BE.js → chunk-M2T6XKT5.js} +2 -1
- package/dist/chunk-M2T6XKT5.js.map +1 -0
- package/dist/chunk-MXGYESPA.cjs +178 -0
- package/dist/chunk-MXGYESPA.cjs.map +1 -0
- package/dist/chunk-NMYD4OJZ.js +3 -0
- package/dist/chunk-NMYD4OJZ.js.map +1 -0
- package/dist/chunk-OD33FUTO.js +178 -0
- package/dist/chunk-OD33FUTO.js.map +1 -0
- package/dist/{chunk-PJVI53AH.js → chunk-Q6HUGWO6.js} +2 -1
- package/dist/chunk-Q6HUGWO6.js.map +1 -0
- package/dist/{chunk-XS2AQFMF.cjs → chunk-S26DZVRQ.cjs} +2 -1
- package/dist/chunk-S26DZVRQ.cjs.map +1 -0
- package/dist/chunk-V3MCDVZE.cjs +2 -0
- package/dist/chunk-V3MCDVZE.cjs.map +1 -0
- package/dist/{chunk-MLSHZVL7.js → chunk-VIEW4NAF.js} +6 -5
- package/dist/chunk-VIEW4NAF.js.map +1 -0
- package/dist/{chunk-OEOUMSWH.cjs → chunk-ZX4CSEL3.cjs} +6 -5
- package/dist/chunk-ZX4CSEL3.cjs.map +1 -0
- package/dist/core-plugins-reexport.cjs +2 -0
- package/dist/core-plugins-reexport.cjs.map +1 -0
- package/dist/core-plugins-reexport.d.cts +1 -0
- package/dist/core-plugins-reexport.d.ts +1 -0
- package/dist/core-plugins-reexport.js +2 -0
- package/dist/core-plugins-reexport.js.map +1 -0
- package/dist/core-reexport.cjs +2 -0
- package/dist/core-reexport.cjs.map +1 -0
- package/dist/core-reexport.d.cts +4 -0
- package/dist/core-reexport.d.ts +4 -0
- package/dist/core-reexport.js +2 -0
- package/dist/core-reexport.js.map +1 -0
- package/dist/headless-reexport.cjs +2 -0
- package/dist/headless-reexport.cjs.map +1 -0
- package/dist/headless-reexport.d.cts +1 -0
- package/dist/headless-reexport.d.ts +1 -0
- package/dist/headless-reexport.js +2 -0
- package/dist/headless-reexport.js.map +1 -0
- package/dist/index.cjs +10 -9
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +28 -257
- package/dist/index.d.ts +28 -257
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -0
- package/dist/mcp-reexport.cjs +2 -0
- package/dist/mcp-reexport.cjs.map +1 -0
- package/dist/mcp-reexport.d.cts +1 -0
- package/dist/mcp-reexport.d.ts +1 -0
- package/dist/mcp-reexport.js +2 -0
- package/dist/mcp-reexport.js.map +1 -0
- package/dist/react.cjs +2 -1
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +860 -9
- package/dist/react.d.ts +860 -9
- package/dist/react.js +2 -1
- package/dist/react.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/ui.cjs +2 -1
- package/dist/ui.cjs.map +1 -0
- package/dist/ui.d.cts +5 -3
- package/dist/ui.d.ts +5 -3
- package/dist/ui.js +2 -1
- package/dist/ui.js.map +1 -0
- package/package.json +27 -87
- package/LICENSE +0 -21
- package/README.md +0 -171
- package/dist/DocumentAgent-Ci6_T-XM.d.ts +0 -412
- package/dist/DocumentAgent-DEGFgYEN.d.cts +0 -412
- package/dist/FindReplaceDialog-46BE7Q2G.cjs +0 -1
- package/dist/HyperlinkDialog-22NH7ZLP.cjs +0 -1
- package/dist/agentApi-CbVUCZRu.d.cts +0 -2086
- package/dist/agentApi-CbVUCZRu.d.ts +0 -2086
- package/dist/chunk-24N3L4IL.cjs +0 -258
- package/dist/chunk-2ASOEN3V.js +0 -1
- package/dist/chunk-46OFHSPJ.cjs +0 -2
- package/dist/chunk-65OFYOHF.cjs +0 -58
- package/dist/chunk-6YFGCUHU.js +0 -4
- package/dist/chunk-DYQUXFE5.cjs +0 -1
- package/dist/chunk-EMKABJPH.js +0 -1
- package/dist/chunk-ESI4BSBF.js +0 -1
- package/dist/chunk-FYAWM7MP.cjs +0 -1
- package/dist/chunk-GLFFXY2X.js +0 -258
- package/dist/chunk-ITWEFKGQ.cjs +0 -1
- package/dist/chunk-JKN7TNPA.js +0 -12
- package/dist/chunk-KESNGXGO.js +0 -1
- package/dist/chunk-L34XFLQZ.cjs +0 -1
- package/dist/chunk-NO7WUK5E.cjs +0 -12
- package/dist/chunk-NT2REEAA.cjs +0 -1
- package/dist/chunk-O7QVCJN6.cjs +0 -4
- package/dist/chunk-OW5H5DNE.cjs +0 -1
- package/dist/chunk-OWMXCVKB.js +0 -1
- package/dist/chunk-PXC7ARQB.cjs +0 -1
- package/dist/chunk-R5SKERM2.js +0 -1
- package/dist/chunk-RM3ITJ2H.cjs +0 -10
- package/dist/chunk-SF53KLDZ.cjs +0 -1
- package/dist/chunk-TOI5W3HK.js +0 -8
- package/dist/chunk-UAVOWAIF.cjs +0 -8
- package/dist/chunk-ULNHBTYA.js +0 -2
- package/dist/chunk-UXXV4GT6.js +0 -10
- package/dist/chunk-VOWKSURW.cjs +0 -1
- package/dist/chunk-WFWLPKQA.js +0 -1
- package/dist/chunk-WFYRA2TH.js +0 -1
- package/dist/chunk-YMXKVLTU.js +0 -58
- package/dist/chunk-ZDYHAYN6.js +0 -1
- package/dist/colorResolver-CIDiSPWd.d.cts +0 -618
- package/dist/colorResolver-KXbUgzWC.d.ts +0 -618
- package/dist/core-plugins.cjs +0 -1
- package/dist/core-plugins.d.cts +0 -31
- package/dist/core-plugins.d.ts +0 -31
- package/dist/core-plugins.js +0 -1
- package/dist/core.cjs +0 -1
- package/dist/core.d.cts +0 -23
- package/dist/core.d.ts +0 -23
- package/dist/core.js +0 -1
- package/dist/executor-ITYZTNSH.cjs +0 -1
- package/dist/executor-TC7CLATE.js +0 -1
- package/dist/headless.cjs +0 -4
- package/dist/headless.d.cts +0 -195
- package/dist/headless.d.ts +0 -195
- package/dist/headless.js +0 -4
- package/dist/index.css +0 -1
- package/dist/insertOperations-CzB5b-Of.d.ts +0 -176
- package/dist/insertOperations-DKVmCV32.d.cts +0 -176
- package/dist/mcp-cli.js +0 -136
- package/dist/mcp.cjs +0 -16
- package/dist/mcp.d.cts +0 -156
- package/dist/mcp.d.ts +0 -156
- package/dist/mcp.js +0 -16
- package/dist/processTemplate-525HZL4S.cjs +0 -1
- package/dist/processTemplate-RJN6452W.js +0 -1
- package/dist/react-BZxD04XV.d.ts +0 -1350
- package/dist/react-D8eAYckC.d.cts +0 -1350
- package/dist/react.css +0 -1
- package/dist/registry-D4tvj9f3.d.ts +0 -165
- package/dist/registry-ngv6Bumt.d.cts +0 -165
- package/dist/selectionRects-PQEUEW35.cjs +0 -1
- package/dist/selectionRects-QAG5RSHD.js +0 -1
- package/dist/types-D96elyJF.d.cts +0 -310
- package/dist/types-xMzSPT4i.d.ts +0 -310
- package/dist/variableDetector-CPxKo9jP.d.cts +0 -173
- package/dist/variableDetector-DeM1N-_L.d.ts +0 -173
package/dist/index.d.ts
CHANGED
|
@@ -1,265 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
1
|
+
import { EditorPlugin } from './react.js';
|
|
2
|
+
export { AutoSaveStatus, ClipboardSelection, DocxEditor, DocxEditorHandle, DocxEditorProps, DocxEditorRef, ErrorBoundary, ErrorBoundaryProps, ErrorContextValue, ErrorNotification, ErrorProvider, ErrorSeverity, PLUGIN_HOST_STYLES, ParseErrorDisplay, ParseErrorDisplayProps, PluginContext, PluginHost, PluginHostProps, PluginHostRef, RenderAsyncOptions, SavedDocumentData, SelectionOverlayProps, TABLE_DATA_ATTRIBUTES, TableSelectionState, UnsupportedFeatureWarning, UnsupportedFeatureWarningProps, UseAutoSaveOptions, UseAutoSaveReturn, UseClipboardOptions, UseClipboardReturn, UseSelectionHighlightOptions, UseSelectionHighlightReturn, UseTableSelectionOptions, UseTableSelectionReturn, UseWheelZoomOptions, UseWheelZoomReturn, ZOOM_PRESETS, clampZoom, createSelectionFromDOM, findNearestZoomPreset, formatLastSaveTime, formatStorageSize, formatZoom, generateOverlayElements, getAutoSaveStatusLabel, getAutoSaveStorageSize, getNextZoomPreset, getPreviousZoomPreset, getSelectionRuns, getUserFriendlyMessage, getZoomPresets, isAutoSaveSupported, isParseError, isZoomPreset, parseZoom, renderAsync, useAutoSave, useClipboard, useErrorNotifications, useSelectionHighlight, useTableSelection, useWheelZoom } from './react.js';
|
|
3
|
+
export { DocxInput, toArrayBuffer } from '@eigenpal/docx-core/utils/docxInput';
|
|
4
|
+
export { DocumentAgent } from '@eigenpal/docx-core/agent/DocumentAgent';
|
|
5
|
+
export { executeCommand, executeCommands } from '@eigenpal/docx-core/agent/executor';
|
|
6
|
+
export { AgentContextOptions, getAgentContext, getDocumentSummary } from '@eigenpal/docx-core/agent/context';
|
|
7
|
+
export { ExtendedSelectionContext, SelectionContextOptions, buildExtendedSelectionContext, buildSelectionContext } from '@eigenpal/docx-core/agent/selectionContext';
|
|
8
|
+
export { parseDocx } from '@eigenpal/docx-core/docx/parser';
|
|
9
|
+
export { serializeDocumentBody, serializeDocument as serializeDocx, serializeSectionProperties } from '@eigenpal/docx-core/docx/serializer/documentSerializer';
|
|
10
|
+
export { ProcessTemplateOptions, ProcessTemplateResult, getTemplateTags, processTemplate, processTemplateAsBlob, processTemplateDetailed, validateTemplate } from '@eigenpal/docx-core/utils/processTemplate';
|
|
11
|
+
export { CreateEmptyDocumentOptions, createDocumentWithText, createEmptyDocument } from '@eigenpal/docx-core/utils/createDocument';
|
|
12
|
+
export { canRenderFont, getLoadedFonts, isFontLoaded, isLoading as isFontsLoading, loadFont, loadFontFromBuffer, loadFonts, onFontsLoaded, preloadCommonFonts } from '@eigenpal/docx-core/utils/fontLoader';
|
|
6
13
|
export { AlignmentButtons, AlignmentButtonsProps, CellBackgroundPicker, CellBackgroundPickerProps, CellColorOption, ColorOption, ColorPicker, ColorPickerProps, ContextMenu, ContextMenuProps, DEFAULT_CELL_COLORS, DialogKeyboardShortcut, FindMatch, FindOptions, FindReplaceDialog, FindReplaceDialogProps, FindReplaceOptions, FindReplaceState, FindResult, FontOption, FontPicker, FontPickerProps, FontSizePicker, FontSizePickerProps, HighlightOptions, HorizontalRuler, HorizontalRulerProps, HyperlinkData, HyperlinkDialog, HyperlinkDialogProps, ImageData, IndicatorPosition, IndicatorVariant, InsertImageDialog, InsertImageDialogProps, InsertSymbolDialog, InsertSymbolDialogProps, InsertTableDialog, InsertTableDialogProps, KeyboardShortcutsDialog, KeyboardShortcutsDialogProps, LineSpacingOption, LineSpacingPicker, LineSpacingPickerProps, ListButtons, ListButtonsProps, ListState, LoadingIndicator, LoadingIndicatorProps, LoadingOperation, LoadingSize, LoadingVariant, PasteOption, PasteSpecialDialog, PasteSpecialDialogProps, ResponsePreview, ResponsePreviewProps, ResponsePreviewState, ResponsiveToolbar, ResponsiveToolbarGroup, ResponsiveToolbarGroupProps, ResponsiveToolbarProps, SYMBOL_CATEGORIES, ShortcutCategory, StyleOption, StylePicker, StylePickerProps, SymbolCategory, TableBorderColorPicker, TableBorderColorPickerProps, TableBorderPicker, TableBorderPickerProps, TableBorderWidthPicker, TableBorderWidthPickerProps, TableCellFillPicker, TableCellFillPickerProps, TableConfig, TableInsertButtons, TableInsertButtonsProps, TableMergeButton, TableMergeButtonProps, TableMoreDropdown, TableMoreDropdownProps, TextContextAction, TextContextMenu, TextContextMenuItem, TextContextMenuProps, Toolbar, ToolbarButton, ToolbarGroup, ToolbarItem, ToolbarItemPriority, ToolbarProps, ToolbarSeparator, UnsavedIndicator, UnsavedIndicatorProps, UseFindReplaceReturn, UseKeyboardShortcutsDialogOptions, UseKeyboardShortcutsDialogReturn, UseLoadingOptions, UseLoadingReturn, UsePasteSpecialOptions, UsePasteSpecialReturn, UseResponsiveToolbarOptions, UseResponsiveToolbarReturn, UseTextContextMenuOptions, UseTextContextMenuReturn, UseUnsavedChangesOptions, UseUnsavedChangesReturn, ZoomControl, ZoomControlProps, calculateFitDimensions, clampTableConfig, createCellColorOption, createChangeTracker, createDefaultFindOptions, createDefaultListState, createDefaultTableConfig, createErrorResponse, createMockResponse, createSearchPattern, createShadingFromColor, createToolbarItem, createToolbarItems, dataUrlToBlob, delay, escapeRegexString, findAllMatches, findInDocument, findInParagraph, formatFileSize, formatShortcutKeys, formatTableDimensions, getActionShortcut, getAllActions, getAllCategories, getAllIndicatorPositions, getAllIndicatorVariants, getAllLoadingSizes, getAllLoadingVariants, getAllPasteOptions, getCategoryLabel, getCellColorName, getColorFromShading, getCommonShortcuts, getContrastingTextColor, getDefaultActions, getDefaultCellColors, getDefaultHighlightOptions, getDefaultPasteOption, getDefaultShortcuts, getDefaultTextContextMenuItems, getImageAcceptString, getImageDimensions, getLoadingVariantLabel, getMarginInUnits, getMatchCountText, getPasteOption, getRecommendedPriority, getRulerDimensions, getShortcutsByCategory, getSupportedImageExtensions, getSymbolCategories, getSymbolUnicodeInfo, getSymbolsByCategory, getTablePresets, getTextActionLabel, getTextActionShortcut, getVariantLabel, isActionAvailable, isDefaultCellColor, isEmptySearch, isPasteSpecialShortcut, isTextActionAvailable, isValidImageFile, isValidTableConfig, parseMarginFromUnits, positionToMargin, replaceAllInContent, replaceFirstInContent, scrollToMatch, searchSymbols, symbolFromCodePoint, useContextMenu, useFindReplace, useHyperlinkDialog, useInsertImageDialog, useInsertSymbolDialog, useInsertTableDialog, useKeyboardShortcutsDialog, useLoading, useLoadingOperations, usePasteSpecial, useResponsePreview, useResponsiveToolbar, useTextContextMenu, useUnsavedChanges } from './ui.js';
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
14
|
+
export { P as PageIndicatorPosition, a as PageIndicatorVariant, b as PageNavigator, c as PageNavigatorPosition, d as PageNavigatorProps, e as PageNavigatorVariant, f as PageNumberIndicator, g as PageNumberIndicatorProps, h as PrintButton, i as PrintButtonProps, j as PrintOptions, k as PrintStyles, T as TableAction, l as TableContext, m as TableSelection, n as TableToolbar, o as TableToolbarProps, p as addColumn, q as addRow, r as calculateProgress, s as calculateScrollToPage, t as calculateVisiblePage, u as clampPageNumber, v as createPageFormat, w as createTableContext, x as deleteColumn, y as deleteRow, z as formatPageOrdinal, A as formatPageRange, B as formatPrintPageRange, C as getCellAt, D as getColumnCount, E as getDefaultPrintOptions, F as getNavigationShortcuts, G as getPageProgress, H as isFirstPage, I as isLastPage, J as isPrintSupported, K as isValidPageNumber, L as mergeCells, M as openPrintWindow, N as parsePageInput, O as parsePageRange, Q as splitCell, R as triggerPrint } from './TableToolbar-RHX9L4h9.js';
|
|
15
|
+
export { BlockContent, BookmarkEnd, BookmarkStart, Document, DocumentBody, DocxPackage, Endnote, Field, FooterReference, Footnote, HeaderFooter, HeaderReference, Hyperlink, Image, ListLevel, NumberingDefinitions, Paragraph, ParagraphFormatting, Relationship, Run, RunContent, SectionProperties, Shape, Style, StyleDefinitions, Table, TableCell, TableRow, TextBox, TextContent, TextFormatting, Theme, ThemeColorScheme, ThemeFont, ThemeFontScheme } from '@eigenpal/docx-core/types/document';
|
|
16
|
+
export { AIAction, AIActionRequest, AgentCommand, AgentContext, AgentResponse, ApplyStyleCommand, DeleteTextCommand, FormatTextCommand, InsertHyperlinkCommand, InsertImageCommand, InsertTableCommand, InsertTextCommand, ParagraphContext, Position, Range, ReplaceTextCommand, SelectionContext, SetVariableCommand, SuggestedAction } from '@eigenpal/docx-core/types/agentApi';
|
|
17
|
+
export { emuToPixels, emuToTwips, formatPx, halfPointsToPixels, pixelsToEmu, pixelsToTwips, pointsToPixels, twipsToEmu, twipsToPixels } from '@eigenpal/docx-core/utils/units';
|
|
18
|
+
export { blendColors, colorsEqual, createRgbColor, createThemeColor, darkenColor, getContrastingColor, isBlack, isWhite, lightenColor, parseColorString, resolveColor, resolveHighlightColor, resolveShadingColor } from '@eigenpal/docx-core/utils/colorResolver';
|
|
19
|
+
export { InsertPosition, countPageBreaks, createColumnBreak, createHorizontalRule, createLineBreak, createPageBreak, createPageBreakParagraph, createPageBreakRun, findPageBreaks, hasPageBreakBefore, insertHorizontalRule, insertPageBreak, isBreakContent, isColumnBreak, isLineBreak, isPageBreak, removePageBreak } from '@eigenpal/docx-core/utils/insertOperations';
|
|
20
|
+
export { DEFAULT_SELECTION_STYLE, HIGH_CONTRAST_SELECTION_STYLE, HighlightRect, SELECTION_CSS_VARS, SelectionHighlightConfig, SelectionRange, areSelectionStylesInjected, clearSelection, createSelectionChangeHandler, generateSelectionCSS, getHighlightRectStyle, getMergedSelectionRects, getSelectedText, getSelectionBoundingRect, getSelectionRects, hasActiveSelection, highlightTextRange, injectSelectionStyles, isSelectionBackwards, isSelectionWithin, mergeAdjacentRects, normalizeSelectionDirection, removeSelectionStyles, selectRange } from '@eigenpal/docx-core/utils/selectionHighlight';
|
|
21
|
+
export { WordSelectionResult, createDoubleClickWordSelector, createTripleClickParagraphSelector, expandSelectionToWordBoundaries, findWordAt, findWordBoundaries, getWordAt, handleClickForMultiClick, isWhitespace, isWordCharacter, selectParagraphAtCursor, selectWordAtCursor, selectWordInTextNode } from '@eigenpal/docx-core/utils/textSelection';
|
|
22
|
+
export { KeyboardShortcut, NAVIGATION_SHORTCUTS, NavigationAction, NavigationDirection, NavigationUnit, describeShortcut, expandSelectionToWord, extendSelectionTo, findNextWordStart, findPreviousWordStart, findVisualLineEnd, findVisualLineStart, findWordEnd, findWordStart, getNavigationShortcutDescriptions, getSelectionInfo, getWordAtCursor, handleNavigationKey, isNavigationKey, isPunctuation, isWhitespace as isWhitespaceChar, isWordCharacter as isWordChar, matchesShortcut, moveByWord, moveToLineEdge, parseNavigationAction, setSelectionPosition } from '@eigenpal/docx-core/utils/keyboardNavigation';
|
|
23
|
+
export { CLIPBOARD_TYPES, ClipboardContent, ClipboardOptions, INTERNAL_CLIPBOARD_TYPE, ParsedClipboardContent, cleanWordHtml, copyParagraphs, copyRuns, createClipboardHandlers, handlePasteEvent, htmlToRuns, isEditorHtml, isWordHtml, paragraphsToClipboardContent, parseClipboardHtml, readFromClipboard, runsToClipboardContent, writeToClipboard } from '@eigenpal/docx-core/utils/clipboard';
|
|
9
24
|
import * as prosemirror_state from 'prosemirror-state';
|
|
10
25
|
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
11
26
|
import { DecorationSet, EditorView } from 'prosemirror-view';
|
|
12
|
-
export {
|
|
13
|
-
export { P as PluginRegistry, p as pluginRegistry, r as registerPlugins } from './registry-D4tvj9f3.js';
|
|
14
|
-
export { docxtemplaterPlugin } from './core-plugins.js';
|
|
27
|
+
export { CorePlugin, McpSession, McpToolDefinition, McpToolHandler, McpToolResult, PluginRegistry, docxtemplaterPlugin, pluginRegistry, registerPlugins } from '@eigenpal/docx-core/core-plugins';
|
|
15
28
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
29
|
+
import { PluginPanelProps } from '@eigenpal/docx-core/plugin-api/types';
|
|
30
|
+
export { PanelConfig, PluginPanelProps, PositionCoordinates, RenderedDomContext } from '@eigenpal/docx-core/plugin-api/types';
|
|
16
31
|
import 'react';
|
|
17
|
-
import 'prosemirror
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Text Selection Utilities
|
|
21
|
-
*
|
|
22
|
-
* Utilities for word-level and paragraph-level text selection.
|
|
23
|
-
* Used for double-click (word) and triple-click (paragraph) selection.
|
|
24
|
-
*/
|
|
25
|
-
/**
|
|
26
|
-
* Check if a character is a word character
|
|
27
|
-
*/
|
|
28
|
-
declare function isWordCharacter$1(char: string): boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Check if a character is whitespace
|
|
31
|
-
*/
|
|
32
|
-
declare function isWhitespace$1(char: string): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Find word boundaries around a position in text
|
|
35
|
-
* Returns [startIndex, endIndex] inclusive start, exclusive end
|
|
36
|
-
*/
|
|
37
|
-
declare function findWordBoundaries(text: string, position: number): [number, number];
|
|
38
|
-
/**
|
|
39
|
-
* Get the word at a position in text
|
|
40
|
-
*/
|
|
41
|
-
declare function getWordAt(text: string, position: number): string;
|
|
42
|
-
/**
|
|
43
|
-
* Word selection result
|
|
44
|
-
*/
|
|
45
|
-
interface WordSelectionResult {
|
|
46
|
-
/** The selected word */
|
|
47
|
-
word: string;
|
|
48
|
-
/** Start index in the text (inclusive) */
|
|
49
|
-
startIndex: number;
|
|
50
|
-
/** End index in the text (exclusive) */
|
|
51
|
-
endIndex: number;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Find the word at a position and return detailed info
|
|
55
|
-
*/
|
|
56
|
-
declare function findWordAt(text: string, position: number): WordSelectionResult;
|
|
57
|
-
/**
|
|
58
|
-
* Select a word at the current cursor position using the browser's native APIs.
|
|
59
|
-
* This works reliably across different browsers and handles contentEditable well.
|
|
60
|
-
*/
|
|
61
|
-
declare function selectWordAtCursor(): boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Select a word in a specific text node at the given offset
|
|
64
|
-
*/
|
|
65
|
-
declare function selectWordInTextNode(textNode: Text, offset: number): boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Expand the current selection to word boundaries.
|
|
68
|
-
* If there's a collapsed selection (cursor), selects the word at cursor.
|
|
69
|
-
* If there's an existing selection, expands to include complete words.
|
|
70
|
-
*/
|
|
71
|
-
declare function expandSelectionToWordBoundaries(): boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Select the entire paragraph containing the current selection.
|
|
74
|
-
* Looks for the nearest element with [data-paragraph-index] attribute.
|
|
75
|
-
*/
|
|
76
|
-
declare function selectParagraphAtCursor(): boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Handle click event for multi-click detection.
|
|
79
|
-
* Call this in your click handler.
|
|
80
|
-
* Returns the click count (1 = single, 2 = double, 3 = triple).
|
|
81
|
-
*/
|
|
82
|
-
declare function handleClickForMultiClick(event: MouseEvent): number;
|
|
83
|
-
/**
|
|
84
|
-
* Create a double-click handler that selects words.
|
|
85
|
-
* Returns a function that should be called on dblclick events.
|
|
86
|
-
*/
|
|
87
|
-
declare function createDoubleClickWordSelector(): (event: MouseEvent) => void;
|
|
88
|
-
/**
|
|
89
|
-
* Create a triple-click handler that selects paragraphs.
|
|
90
|
-
* This uses our custom click counting since browsers have inconsistent triple-click.
|
|
91
|
-
*/
|
|
92
|
-
declare function createTripleClickParagraphSelector(): (event: MouseEvent) => void;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Keyboard Navigation Utilities
|
|
96
|
-
*
|
|
97
|
-
* Provides enhanced keyboard navigation for the editor:
|
|
98
|
-
* - Ctrl+Left/Right: Move by word
|
|
99
|
-
* - Home/End: Move to start/end of line
|
|
100
|
-
* - Ctrl+Home/End: Move to start/end of document
|
|
101
|
-
* - Ctrl+Shift+Left/Right: Select by word
|
|
102
|
-
* - Shift+Home/End: Select to start/end of line
|
|
103
|
-
*/
|
|
104
|
-
/**
|
|
105
|
-
* Navigation direction
|
|
106
|
-
*/
|
|
107
|
-
type NavigationDirection = 'left' | 'right' | 'up' | 'down';
|
|
108
|
-
/**
|
|
109
|
-
* Navigation unit
|
|
110
|
-
*/
|
|
111
|
-
type NavigationUnit = 'character' | 'word' | 'line' | 'paragraph' | 'document';
|
|
112
|
-
/**
|
|
113
|
-
* Keyboard navigation action
|
|
114
|
-
*/
|
|
115
|
-
interface NavigationAction {
|
|
116
|
-
/** Direction to navigate */
|
|
117
|
-
direction: NavigationDirection;
|
|
118
|
-
/** Unit of movement */
|
|
119
|
-
unit: NavigationUnit;
|
|
120
|
-
/** Whether to extend selection */
|
|
121
|
-
extend: boolean;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Keyboard shortcut definition
|
|
125
|
-
*/
|
|
126
|
-
interface KeyboardShortcut {
|
|
127
|
-
key: string;
|
|
128
|
-
ctrlKey?: boolean;
|
|
129
|
-
metaKey?: boolean;
|
|
130
|
-
shiftKey?: boolean;
|
|
131
|
-
altKey?: boolean;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Check if a character is a word character (letter, digit, or underscore)
|
|
135
|
-
*/
|
|
136
|
-
declare function isWordCharacter(char: string): boolean;
|
|
137
|
-
/**
|
|
138
|
-
* Check if a character is whitespace
|
|
139
|
-
*/
|
|
140
|
-
declare function isWhitespace(char: string): boolean;
|
|
141
|
-
/**
|
|
142
|
-
* Check if a character is a punctuation character
|
|
143
|
-
*/
|
|
144
|
-
declare function isPunctuation(char: string): boolean;
|
|
145
|
-
/**
|
|
146
|
-
* Find the start of the current or previous word
|
|
147
|
-
*/
|
|
148
|
-
declare function findWordStart(text: string, position: number): number;
|
|
149
|
-
/**
|
|
150
|
-
* Find the end of the current or next word
|
|
151
|
-
*/
|
|
152
|
-
declare function findWordEnd(text: string, position: number): number;
|
|
153
|
-
/**
|
|
154
|
-
* Find the next word start (for Ctrl+Right navigation)
|
|
155
|
-
*/
|
|
156
|
-
declare function findNextWordStart(text: string, position: number): number;
|
|
157
|
-
/**
|
|
158
|
-
* Find the previous word start (for Ctrl+Left navigation)
|
|
159
|
-
*/
|
|
160
|
-
declare function findPreviousWordStart(text: string, position: number): number;
|
|
161
|
-
/**
|
|
162
|
-
* Find the start of the current line in a text node
|
|
163
|
-
* Uses visual line detection based on bounding rectangles
|
|
164
|
-
*/
|
|
165
|
-
declare function findVisualLineStart(container: Node, offset: number): {
|
|
166
|
-
node: Node;
|
|
167
|
-
offset: number;
|
|
168
|
-
} | null;
|
|
169
|
-
/**
|
|
170
|
-
* Find the end of the current line in a text node
|
|
171
|
-
* Uses visual line detection based on bounding rectangles
|
|
172
|
-
*/
|
|
173
|
-
declare function findVisualLineEnd(container: Node, offset: number): {
|
|
174
|
-
node: Node;
|
|
175
|
-
offset: number;
|
|
176
|
-
} | null;
|
|
177
|
-
/**
|
|
178
|
-
* Get the current selection info
|
|
179
|
-
*/
|
|
180
|
-
declare function getSelectionInfo(): {
|
|
181
|
-
node: Node;
|
|
182
|
-
offset: number;
|
|
183
|
-
anchorNode: Node | null;
|
|
184
|
-
anchorOffset: number;
|
|
185
|
-
focusNode: Node | null;
|
|
186
|
-
focusOffset: number;
|
|
187
|
-
isCollapsed: boolean;
|
|
188
|
-
text: string;
|
|
189
|
-
} | null;
|
|
190
|
-
/**
|
|
191
|
-
* Set the selection to a specific position
|
|
192
|
-
*/
|
|
193
|
-
declare function setSelectionPosition(node: Node, offset: number): void;
|
|
194
|
-
/**
|
|
195
|
-
* Extend selection to a specific position
|
|
196
|
-
*/
|
|
197
|
-
declare function extendSelectionTo(node: Node, offset: number): void;
|
|
198
|
-
/**
|
|
199
|
-
* Move selection by word in a text node
|
|
200
|
-
*/
|
|
201
|
-
declare function moveByWord(direction: 'left' | 'right', extend?: boolean): boolean;
|
|
202
|
-
/**
|
|
203
|
-
* Move to start/end of line
|
|
204
|
-
*/
|
|
205
|
-
declare function moveToLineEdge(edge: 'start' | 'end', extend?: boolean): boolean;
|
|
206
|
-
/**
|
|
207
|
-
* Parse a keyboard event into a navigation action
|
|
208
|
-
*/
|
|
209
|
-
declare function parseNavigationAction(event: KeyboardEvent): NavigationAction | null;
|
|
210
|
-
/**
|
|
211
|
-
* Handle a keyboard navigation event
|
|
212
|
-
* Returns true if the event was handled
|
|
213
|
-
*/
|
|
214
|
-
declare function handleNavigationKey(event: KeyboardEvent, options?: {
|
|
215
|
-
onDocumentStart?: () => void;
|
|
216
|
-
onDocumentEnd?: () => void;
|
|
217
|
-
}): boolean;
|
|
218
|
-
/**
|
|
219
|
-
* Check if an event is a navigation key event
|
|
220
|
-
*/
|
|
221
|
-
declare function isNavigationKey(event: KeyboardEvent): boolean;
|
|
222
|
-
/**
|
|
223
|
-
* Expand selection to word boundaries
|
|
224
|
-
* Used for double-click word selection
|
|
225
|
-
*/
|
|
226
|
-
declare function expandSelectionToWord(): boolean;
|
|
227
|
-
/**
|
|
228
|
-
* Get the word at the current cursor position
|
|
229
|
-
*/
|
|
230
|
-
declare function getWordAtCursor(): string | null;
|
|
231
|
-
/**
|
|
232
|
-
* Check if a keyboard event matches a shortcut definition
|
|
233
|
-
*/
|
|
234
|
-
declare function matchesShortcut(event: KeyboardEvent, shortcut: KeyboardShortcut): boolean;
|
|
235
|
-
/**
|
|
236
|
-
* Common navigation shortcuts
|
|
237
|
-
*/
|
|
238
|
-
declare const NAVIGATION_SHORTCUTS: {
|
|
239
|
-
readonly wordLeft: KeyboardShortcut;
|
|
240
|
-
readonly wordRight: KeyboardShortcut;
|
|
241
|
-
readonly selectWordLeft: KeyboardShortcut;
|
|
242
|
-
readonly selectWordRight: KeyboardShortcut;
|
|
243
|
-
readonly lineStart: KeyboardShortcut;
|
|
244
|
-
readonly lineEnd: KeyboardShortcut;
|
|
245
|
-
readonly selectToLineStart: KeyboardShortcut;
|
|
246
|
-
readonly selectToLineEnd: KeyboardShortcut;
|
|
247
|
-
readonly documentStart: KeyboardShortcut;
|
|
248
|
-
readonly documentEnd: KeyboardShortcut;
|
|
249
|
-
readonly selectToDocumentStart: KeyboardShortcut;
|
|
250
|
-
readonly selectToDocumentEnd: KeyboardShortcut;
|
|
251
|
-
};
|
|
252
|
-
/**
|
|
253
|
-
* Get a human-readable description of a shortcut
|
|
254
|
-
*/
|
|
255
|
-
declare function describeShortcut(shortcut: KeyboardShortcut): string;
|
|
256
|
-
/**
|
|
257
|
-
* Get all navigation shortcuts with descriptions
|
|
258
|
-
*/
|
|
259
|
-
declare function getNavigationShortcutDescriptions(): Array<{
|
|
260
|
-
action: string;
|
|
261
|
-
shortcut: string;
|
|
262
|
-
}>;
|
|
32
|
+
import '@eigenpal/docx-core/prosemirror';
|
|
33
|
+
import '@eigenpal/docx-core/layout-engine/types';
|
|
263
34
|
|
|
264
35
|
/**
|
|
265
36
|
* Template tag types
|
|
@@ -399,4 +170,4 @@ declare const templatePlugin: EditorPlugin<TemplatePluginState>;
|
|
|
399
170
|
*/
|
|
400
171
|
declare const VERSION = "0.0.2";
|
|
401
172
|
|
|
402
|
-
export { ANNOTATION_PANEL_STYLES, AnnotationPanel, EditorPlugin,
|
|
173
|
+
export { ANNOTATION_PANEL_STYLES, AnnotationPanel, EditorPlugin, TEMPLATE_DECORATION_STYLES, type TagType, type TemplateTag, VERSION, createPlugin as createTemplatePlugin, createTemplatePlugin as createTemplateProseMirrorPlugin, getTemplateTags as getTemplatePluginTags, setHoveredElement, setSelectedElement, templatePlugin, templatePluginKey };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export{n as countPageBreaks,b as createColumnBreak,g as createHorizontalRule,c as createLineBreak,a as createPageBreak,e as createPageBreakParagraph,d as createPageBreakRun,o as findPageBreaks,m as hasPageBreakBefore,h as insertHorizontalRule,f as insertPageBreak,l as isBreakContent,j as isColumnBreak,k as isLineBreak,i as isPageBreak,p as removePageBreak}from'./chunk-KESNGXGO.js';export{e as buildExtendedSelectionContext,d as buildSelectionContext,h as createDocumentWithText,g as createEmptyDocument,a as getAgentContext,c as getDocumentSummary}from'./chunk-TOI5W3HK.js';export{B as DEFAULT_SELECTION_STYLE,j as DocxEditor,c as ErrorBoundary,b as ErrorProvider,C as HIGH_CONTRAST_SELECTION_STYLE,$ as PLUGIN_HOST_STYLES,d as ParseErrorDisplay,aa as PluginHost,D as SELECTION_CSS_VARS,h as TABLE_DATA_ATTRIBUTES,e as UnsupportedFeatureWarning,r as ZOOM_PRESETS,U as areSelectionStylesInjected,A as clampZoom,P as clearSelection,V as createSelectionChangeHandler,Z as createSelectionFromDOM,u as findNearestZoomPreset,m as formatLastSaveTime,p as formatStorageSize,x as formatZoom,X as generateOverlayElements,I as generateSelectionCSS,n as getAutoSaveStatusLabel,o as getAutoSaveStorageSize,H as getHighlightRectStyle,G as getMergedSelectionRects,v as getNextZoomPreset,w as getPreviousZoomPreset,K as getSelectedText,M as getSelectionBoundingRect,E as getSelectionRects,Y as getSelectionRuns,g as getUserFriendlyMessage,t as getZoomPresets,J as hasActiveSelection,N as highlightTextRange,S as injectSelectionStyles,q as isAutoSaveSupported,f as isParseError,Q as isSelectionBackwards,L as isSelectionWithin,z as isZoomPreset,F as mergeAdjacentRects,R as normalizeSelectionDirection,y as parseZoom,T as removeSelectionStyles,k as renderAsync,O as selectRange,l as useAutoSave,_ as useClipboard,a as useErrorNotifications,W as useSelectionHighlight,i as useTableSelection,s as useWheelZoom}from'./chunk-GLFFXY2X.js';import'./chunk-WFYRA2TH.js';export{a as DocumentAgent}from'./chunk-ULNHBTYA.js';export{B as CellBackgroundPicker,a as ContextMenu,A as DEFAULT_CELL_COLORS,ha as InsertImageDialog,ra as InsertSymbolDialog,aa as InsertTableDialog,Ea as KeyboardShortcutsDialog,P as LoadingIndicator,ya as PasteSpecialDialog,q as PrintButton,r as PrintStyles,g as ResponsePreview,X as ResponsiveToolbar,Y as ResponsiveToolbarGroup,qa as SYMBOL_CATEGORIES,z as TableInsertButtons,y as TableMergeButton,k as TextContextMenu,J as UnsavedIndicator,ma as calculateFitDimensions,ea as clampTableConfig,D as createCellColorOption,O as createChangeTracker,ca as createDefaultTableConfig,j as createErrorResponse,i as createMockResponse,G as createShadingFromColor,Z as createToolbarItem,_ as createToolbarItems,na as dataUrlToBlob,V as delay,pa as formatFileSize,w as formatPrintPageRange,La as formatShortcutKeys,fa as formatTableDimensions,c as getActionShortcut,f as getAllActions,Ka as getAllCategories,N as getAllIndicatorPositions,M as getAllIndicatorVariants,U as getAllLoadingSizes,T as getAllLoadingVariants,Ba as getAllPasteOptions,Ja as getCategoryLabel,F as getCellColorName,H as getColorFromShading,Ia as getCommonShortcuts,I as getContrastingTextColor,e as getDefaultActions,C as getDefaultCellColors,Ca as getDefaultPasteOption,u as getDefaultPrintOptions,Ga as getDefaultShortcuts,o as getDefaultTextContextMenuItems,la as getImageAcceptString,oa as getImageDimensions,S as getLoadingVariantLabel,Aa as getPasteOption,$ as getRecommendedPriority,Ha as getShortcutsByCategory,ka as getSupportedImageExtensions,ta as getSymbolCategories,va as getSymbolUnicodeInfo,ua as getSymbolsByCategory,ga as getTablePresets,m as getTextActionLabel,n as getTextActionShortcut,L as getVariantLabel,d as isActionAvailable,E as isDefaultCellColor,Da as isPasteSpecialShortcut,x as isPrintSupported,p as isTextActionAvailable,ja as isValidImageFile,da as isValidTableConfig,t as openPrintWindow,v as parsePageRange,wa as searchSymbols,xa as symbolFromCodePoint,s as triggerPrint,b as useContextMenu,ia as useInsertImageDialog,sa as useInsertSymbolDialog,ba as useInsertTableDialog,Fa as useKeyboardShortcutsDialog,Q as useLoading,R as useLoadingOperations,za as usePasteSpecial,h as useResponsePreview,W as useResponsiveToolbar,l as useTextContextMenu,K as useUnsavedChanges}from'./chunk-MLSHZVL7.js';import'./chunk-EMKABJPH.js';import {qa as qa$1}from'./chunk-6YFGCUHU.js';export{i as AlignmentButtons,ba as CLIPBOARD_TYPES,g as ColorPicker,b as FontPicker,f as FontSizePicker,N as HorizontalRuler,aa as INTERNAL_CLIPBOARD_TYPE,l as LineSpacingPicker,j as ListButtons,G as PageNavigator,y as PageNumberIndicator,m as StylePicker,p as TableBorderColorPicker,o as TableBorderPicker,q as TableBorderWidthPicker,r as TableCellFillPicker,s as TableMoreDropdown,S as TableToolbar,x as Toolbar,u as ToolbarButton,v as ToolbarGroup,w as ToolbarSeparator,n as ZoomControl,Y as addColumn,W as addRow,M as calculateProgress,F as calculateScrollToPage,E as calculateVisiblePage,J as clampPageNumber,ma as cleanWordHtml,da as copyParagraphs,ca as copyRuns,oa as createClipboardHandlers,k as createDefaultListState,A as createPageFormat,T as createTableContext,Z as deleteColumn,X as deleteRow,z as formatPageOrdinal,L as formatPageRange,V as getCellAt,U as getColumnCount,Q as getMarginInUnits,K as getNavigationShortcuts,B as getPageProgress,P as getRulerDimensions,ia as handlePasteEvent,na as htmlToRuns,la as isEditorHtml,C as isFirstPage,D as isLastPage,I as isValidPageNumber,ka as isWordHtml,_ as mergeCells,fa as paragraphsToClipboardContent,ja as parseClipboardHtml,R as parseMarginFromUnits,H as parsePageInput,O as positionToMargin,ha as readFromClipboard,ea as runsToClipboardContent,$ as splitCell,ga as writeToClipboard}from'./chunk-6YFGCUHU.js';export{d as HyperlinkDialog,m as useHyperlinkDialog}from'./chunk-PJVI53AH.js';export{l as blendColors,m as colorsEqual,i as createRgbColor,h as createThemeColor,j as darkenColor,p as emuToPixels,r as emuToTwips,x as formatPx,f as getContrastingColor,u as halfPointsToPixels,d as isBlack,e as isWhite,k as lightenColor,g as parseColorString,q as pixelsToEmu,o as pixelsToTwips,t as pointsToPixels,a as resolveColor,b as resolveHighlightColor,c as resolveShadingColor,s as twipsToEmu,n as twipsToPixels}from'./chunk-ZDYHAYN6.js';export{b as docxtemplaterPlugin}from'./chunk-UXXV4GT6.js';export{e as getTemplateTags,a as processTemplate,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-ESI4BSBF.js';import'./chunk-2ASOEN3V.js';export{b as serializeDocumentBody,c as serializeDocx,a as serializeSectionProperties}from'./chunk-YMXKVLTU.js';export{a as executeCommand,b as executeCommands}from'./chunk-WFWLPKQA.js';export{k as canRenderFont,i as getLoadedFonts,g as isFontLoaded,h as isFontsLoading,e as loadFont,l as loadFontFromBuffer,f as loadFonts,j as onFontsLoaded,p as parseDocx,m as preloadCommonFonts,o as toArrayBuffer}from'./chunk-JKN7TNPA.js';export{a as PluginRegistry,b as pluginRegistry,c as registerPlugins}from'./chunk-R5SKERM2.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';import'./chunk-OWMXCVKB.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 Za=/[\p{L}\p{N}''\-]/u,Xa=/\s/;function M(e){return !e||e.length===0?false:Za.test(e)}function K(e){return !e||e.length===0?false:Xa.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 qa(e,t){let[o,n]=R(e,t);return e.slice(o,n)}function ja(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 Ja(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 Qa(){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=ei(o);if(n){let r=document.createRange();return r.selectNodeContents(n),e.removeAllRanges(),e.addRange(r),true}return false}function ei(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,ti=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,ti),Math.min(V,3)}function oi(){return e=>{e.ctrlKey||e.metaKey||e.altKey||$();}}function ni(){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 ri(e){return e?/[\p{P}]/u.test(e):false}function ai(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 ii(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 si(){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 li(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 ci(e){let{key:t,ctrlKey:o,metaKey:n}=e;return !!((o||n)&&(t==="ArrowLeft"||t==="ArrowRight")||t==="Home"||t==="End")}function pi(){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 di(){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 ui(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 gi(){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)}]}qa$1();var se=/\{([#/^@]?)([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}/g,m=new PluginKey("template");function yi(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:yi(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 Ti(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=Ti(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 Si(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=Si(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 F=`
|
|
1
|
+
export{j as DocxEditor,c as ErrorBoundary,b as ErrorProvider,G as PLUGIN_HOST_STYLES,d as ParseErrorDisplay,H as PluginHost,h as TABLE_DATA_ATTRIBUTES,e as UnsupportedFeatureWarning,r as ZOOM_PRESETS,A as clampZoom,E as createSelectionFromDOM,u as findNearestZoomPreset,m as formatLastSaveTime,p as formatStorageSize,x as formatZoom,C as generateOverlayElements,n as getAutoSaveStatusLabel,o as getAutoSaveStorageSize,v as getNextZoomPreset,w as getPreviousZoomPreset,D as getSelectionRuns,g as getUserFriendlyMessage,t as getZoomPresets,q as isAutoSaveSupported,f as isParseError,z as isZoomPreset,y as parseZoom,k as renderAsync,l as useAutoSave,F as useClipboard,a as useErrorNotifications,B as useSelectionHighlight,i as useTableSelection,s as useWheelZoom}from'./chunk-OD33FUTO.js';export{B as CellBackgroundPicker,a as ContextMenu,A as DEFAULT_CELL_COLORS,ha as InsertImageDialog,ra as InsertSymbolDialog,aa as InsertTableDialog,Ea as KeyboardShortcutsDialog,P as LoadingIndicator,ya as PasteSpecialDialog,q as PrintButton,r as PrintStyles,g as ResponsePreview,X as ResponsiveToolbar,Y as ResponsiveToolbarGroup,qa as SYMBOL_CATEGORIES,z as TableInsertButtons,y as TableMergeButton,k as TextContextMenu,J as UnsavedIndicator,ma as calculateFitDimensions,ea as clampTableConfig,D as createCellColorOption,O as createChangeTracker,ca as createDefaultTableConfig,j as createErrorResponse,i as createMockResponse,G as createShadingFromColor,Z as createToolbarItem,_ as createToolbarItems,na as dataUrlToBlob,V as delay,pa as formatFileSize,w as formatPrintPageRange,La as formatShortcutKeys,fa as formatTableDimensions,c as getActionShortcut,f as getAllActions,Ka as getAllCategories,N as getAllIndicatorPositions,M as getAllIndicatorVariants,U as getAllLoadingSizes,T as getAllLoadingVariants,Ba as getAllPasteOptions,Ja as getCategoryLabel,F as getCellColorName,H as getColorFromShading,Ia as getCommonShortcuts,I as getContrastingTextColor,e as getDefaultActions,C as getDefaultCellColors,Ca as getDefaultPasteOption,u as getDefaultPrintOptions,Ga as getDefaultShortcuts,o as getDefaultTextContextMenuItems,la as getImageAcceptString,oa as getImageDimensions,S as getLoadingVariantLabel,Aa as getPasteOption,$ as getRecommendedPriority,Ha as getShortcutsByCategory,ka as getSupportedImageExtensions,ta as getSymbolCategories,va as getSymbolUnicodeInfo,ua as getSymbolsByCategory,ga as getTablePresets,m as getTextActionLabel,n as getTextActionShortcut,L as getVariantLabel,d as isActionAvailable,E as isDefaultCellColor,Da as isPasteSpecialShortcut,x as isPrintSupported,p as isTextActionAvailable,ja as isValidImageFile,da as isValidTableConfig,t as openPrintWindow,v as parsePageRange,wa as searchSymbols,xa as symbolFromCodePoint,s as triggerPrint,b as useContextMenu,ia as useInsertImageDialog,sa as useInsertSymbolDialog,ba as useInsertTableDialog,Fa as useKeyboardShortcutsDialog,Q as useLoading,R as useLoadingOperations,za as usePasteSpecial,h as useResponsePreview,W as useResponsiveToolbar,l as useTextContextMenu,K as useUnsavedChanges}from'./chunk-VIEW4NAF.js';export{i as AlignmentButtons,g as ColorPicker,b as FontPicker,f as FontSizePicker,N as HorizontalRuler,l as LineSpacingPicker,j as ListButtons,G as PageNavigator,y as PageNumberIndicator,m as StylePicker,p as TableBorderColorPicker,o as TableBorderPicker,q as TableBorderWidthPicker,r as TableCellFillPicker,s as TableMoreDropdown,S as TableToolbar,x as Toolbar,u as ToolbarButton,v as ToolbarGroup,w as ToolbarSeparator,n as ZoomControl,Y as addColumn,W as addRow,M as calculateProgress,F as calculateScrollToPage,E as calculateVisiblePage,J as clampPageNumber,k as createDefaultListState,A as createPageFormat,T as createTableContext,Z as deleteColumn,X as deleteRow,z as formatPageOrdinal,L as formatPageRange,V as getCellAt,U as getColumnCount,Q as getMarginInUnits,K as getNavigationShortcuts,B as getPageProgress,P as getRulerDimensions,C as isFirstPage,D as isLastPage,I as isValidPageNumber,_ as mergeCells,R as parseMarginFromUnits,H as parsePageInput,O as positionToMargin,$ as splitCell}from'./chunk-NMYD4OJZ.js';export{d as HyperlinkDialog,m as useHyperlinkDialog}from'./chunk-Q6HUGWO6.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-M2T6XKT5.js';import'./chunk-AL62KQYJ.js';export{toArrayBuffer}from'@eigenpal/docx-core/utils/docxInput';export{DocumentAgent}from'@eigenpal/docx-core/agent/DocumentAgent';export{executeCommand,executeCommands}from'@eigenpal/docx-core/agent/executor';export{getAgentContext,getDocumentSummary}from'@eigenpal/docx-core/agent/context';export{buildExtendedSelectionContext,buildSelectionContext}from'@eigenpal/docx-core/agent/selectionContext';export{parseDocx}from'@eigenpal/docx-core/docx/parser';export{serializeDocumentBody,serializeDocument as serializeDocx,serializeSectionProperties}from'@eigenpal/docx-core/docx/serializer/documentSerializer';export{getTemplateTags,processTemplate,processTemplateAsBlob,processTemplateDetailed,validateTemplate}from'@eigenpal/docx-core/utils/processTemplate';export{createDocumentWithText,createEmptyDocument}from'@eigenpal/docx-core/utils/createDocument';export{canRenderFont,getLoadedFonts,isFontLoaded,isLoading as isFontsLoading,loadFont,loadFontFromBuffer,loadFonts,onFontsLoaded,preloadCommonFonts}from'@eigenpal/docx-core/utils/fontLoader';export{emuToPixels,emuToTwips,formatPx,halfPointsToPixels,pixelsToEmu,pixelsToTwips,pointsToPixels,twipsToEmu,twipsToPixels}from'@eigenpal/docx-core/utils/units';export{blendColors,colorsEqual,createRgbColor,createThemeColor,darkenColor,getContrastingColor,isBlack,isWhite,lightenColor,parseColorString,resolveColor,resolveHighlightColor,resolveShadingColor}from'@eigenpal/docx-core/utils/colorResolver';export{countPageBreaks,createColumnBreak,createHorizontalRule,createLineBreak,createPageBreak,createPageBreakParagraph,createPageBreakRun,findPageBreaks,hasPageBreakBefore,insertHorizontalRule,insertPageBreak,isBreakContent,isColumnBreak,isLineBreak,isPageBreak,removePageBreak}from'@eigenpal/docx-core/utils/insertOperations';export{DEFAULT_SELECTION_STYLE,HIGH_CONTRAST_SELECTION_STYLE,SELECTION_CSS_VARS,areSelectionStylesInjected,clearSelection,createSelectionChangeHandler,generateSelectionCSS,getHighlightRectStyle,getMergedSelectionRects,getSelectedText,getSelectionBoundingRect,getSelectionRects,hasActiveSelection,highlightTextRange,injectSelectionStyles,isSelectionBackwards,isSelectionWithin,mergeAdjacentRects,normalizeSelectionDirection,removeSelectionStyles,selectRange}from'@eigenpal/docx-core/utils/selectionHighlight';export{createDoubleClickWordSelector,createTripleClickParagraphSelector,expandSelectionToWordBoundaries,findWordAt,findWordBoundaries,getWordAt,handleClickForMultiClick,isWhitespace,isWordCharacter,selectParagraphAtCursor,selectWordAtCursor,selectWordInTextNode}from'@eigenpal/docx-core/utils/textSelection';export{NAVIGATION_SHORTCUTS,describeShortcut,expandSelectionToWord,extendSelectionTo,findNextWordStart,findPreviousWordStart,findVisualLineEnd,findVisualLineStart,findWordEnd,findWordStart,getNavigationShortcutDescriptions,getSelectionInfo,getWordAtCursor,handleNavigationKey,isNavigationKey,isPunctuation,isWhitespace as isWhitespaceChar,isWordCharacter as isWordChar,matchesShortcut,moveByWord,moveToLineEdge,parseNavigationAction,setSelectionPosition}from'@eigenpal/docx-core/utils/keyboardNavigation';export{CLIPBOARD_TYPES,INTERNAL_CLIPBOARD_TYPE,cleanWordHtml,copyParagraphs,copyRuns,createClipboardHandlers,handlePasteEvent,htmlToRuns,isEditorHtml,isWordHtml,paragraphsToClipboardContent,parseClipboardHtml,readFromClipboard,runsToClipboardContent,writeToClipboard}from'@eigenpal/docx-core/utils/clipboard';import Y,{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';export{PluginRegistry,docxtemplaterPlugin,pluginRegistry,registerPlugins}from'@eigenpal/docx-core/core-plugins';var w=/\{([#/^@]?)([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}/g,g=new PluginKey("template");function Rr(e,o,r){return `${e}:${o}:${r}`}function B(e){let o=[];e.descendants((u,p)=>(u.isText&&u.text&&o.push({text:u.text,pos:p}),true));let r="",n=[];for(let u of o){for(let p=0;p<u.text.length;p++)n.push(u.pos+p);r+=u.text;}let i=[],a=[],l=new Map,m;for(w.lastIndex=0;(m=w.exec(r))!==null;){let[u,p,s]=m,f=n[m.index],h=n[m.index+u.length-1]+1,c;p==="#"?c="sectionStart":p==="/"?c="sectionEnd":p==="^"?c="invertedStart":p==="@"?c="raw":c="variable";let P=`${c}:${s}`,L=l.get(P)??0;l.set(P,L+1);let v={id:Rr(c,s,L),type:c,name:s,rawTag:u,from:f,to:h};if(c==="sectionStart"||c==="invertedStart")v.nestedVars=[],a.push(v);else if(c==="sectionEnd"){for(let t=a.length-1;t>=0;t--)if(a[t].name===s){a.splice(t,1);break}}else c==="variable"&&a.length>0&&(a[a.length-1].nestedVars?.push(s),v.insideSection=true);i.push(v);}return i}function Ar(e){switch(e){case "sectionStart":case "sectionEnd":return "#3b82f6";case "invertedStart":return "#8b5cf6";case "raw":return "#ef4444";default:return "#f59e0b"}}function N(e,o,r,n){let i=[];for(let a of o){let l=a.id===r,m=a.id===n,u=Ar(a.type),p=["docx-template-tag"];l&&p.push("hovered"),m&&p.push("selected"),i.push(Decoration.inline(a.from,a.to,{class:p.join(" "),"data-tag-id":a.id,style:`background-color: ${u}22; border-radius: 2px;`}));}return DecorationSet.create(e,i)}function Lr(e,o){if(e.length!==o.length)return false;for(let r=0;r<e.length;r++)if(e[r].id!==o[r].id)return false;return true}function O(){return new Plugin({key:g,state:{init(e,o){let r=B(o.doc);return {tags:r,decorations:N(o.doc,r)}},apply(e,o,r,n){if(e.docChanged){let a=B(n.doc),l=Lr(o.tags,a);return {tags:a,decorations:l?o.decorations.map(e.mapping,e.doc):N(n.doc,a,o.hoveredId,o.selectedId),hoveredId:o.hoveredId,selectedId:o.selectedId}}let i=e.getMeta(g);if(i){let a=i.hoveredId??o.hoveredId,l=i.selectedId??o.selectedId;return {...o,hoveredId:a,selectedId:l,decorations:N(n.doc,o.tags,a,l)}}return {...o,decorations:o.decorations.map(e.mapping,e.doc)}}},props:{decorations(e){return g.getState(e)?.decorations??DecorationSet.empty},handleClick(e,o){let n=(g.getState(e.state)?.tags??[]).find(a=>o>=a.from&&o<=a.to);return n?(e.dispatch(e.state.tr.setMeta(g,{selectedId:n.id})),true):(g.getState(e.state)?.selectedId&&e.dispatch(e.state.tr.setMeta(g,{selectedId:void 0})),false)},handleDOMEvents:{mouseover(e,o){let n=o.target.closest?.("[data-tag-id]")?.getAttribute("data-tag-id")||void 0,i=g.getState(e.state)?.hoveredId;return n!==i&&e.dispatch(e.state.tr.setMeta(g,{hoveredId:n})),false},mouseout(e,o){return o.relatedTarget?.closest?.("[data-tag-id]")||g.getState(e.state)?.hoveredId&&e.dispatch(e.state.tr.setMeta(g,{hoveredId:void 0})),false}}}})}function U(e){return g.getState(e)?.tags??[]}function R(e,o){e.dispatch(e.state.tr.setMeta(g,{hoveredId:o}));}function A(e,o){e.dispatch(e.state.tr.setMeta(g,{selectedId:o}));}var D=`
|
|
2
2
|
.docx-template-tag {
|
|
3
3
|
cursor: pointer;
|
|
4
4
|
transition: background-color 0.1s;
|
|
@@ -12,8 +12,8 @@ export{n as countPageBreaks,b as createColumnBreak,g as createHorizontalRule,c a
|
|
|
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 ${
|
|
15
|
+
`;var Hr={variable:"#f59e0b",sectionStart:"#3b82f6",sectionEnd:"#3b82f6",invertedStart:"#8b5cf6",raw:"#ef4444"};function Mr(e){switch(e){case "sectionStart":return "LOOP / IF";case "invertedStart":return "IF NOT";case "raw":return "HTML";default:return ""}}function H({editorView:e,pluginState:o,renderedDomContext:r}){let n=o?.tags??[],i=o?.hoveredId,a=o?.selectedId,[l,m]=useState(0),u=useRef(null),p=useRef(new Map),s=useRef([]),f=useMemo(()=>n.filter(t=>t.type!=="sectionEnd"&&!t.insideSection),[n]),h=useCallback(()=>{if(f.length===0||!r)return s.current;let t=[],T=r.getContainerOffset(),S=new Map;for(let d of s.current)S.set(d.tag.id,d.top);for(let d of f){let y=r.getRectsForRange(d.from,d.from+1);if(y.length>0){let b=y[0].y+T.y-40;t.push({tag:d,top:b});}else {let b=S.get(d.id);b!==void 0&&t.push({tag:d,top:b});}}t.sort((d,y)=>d.top-y.top);let I=6;for(let d=1;d<t.length;d++){let y=t[d-1],b=t[d],x=p.current.get(y.tag.id),E=32;x?E=x.offsetHeight:y.tag.nestedVars&&y.tag.nestedVars.length>0&&(E=42+y.tag.nestedVars.length*26),b.top<y.top+E+I&&(b.top=y.top+E+I);}return s.current=t,t},[f,r]),c=useMemo(()=>h(),[h,l]);useEffect(()=>{if(!r)return;let t=new ResizeObserver(()=>{requestAnimationFrame(()=>m(T=>T+1));});return t.observe(r.pagesContainer),()=>t.disconnect()},[r]),useEffect(()=>{let t=()=>{requestAnimationFrame(()=>m(T=>T+1));};return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);let P=useRef("");useEffect(()=>{let t=f.map(T=>T.id).join(",");if(t&&P.current!==t){let T=setTimeout(()=>{P.current=t,m(S=>S+1);},50);return ()=>clearTimeout(T)}},[f]);let L=t=>{e&&R(e,t);},v=t=>{if(!e)return;A(e,t.id);let{state:T}=e,S=T.tr.setSelection(TextSelection.near(T.doc.resolve(t.from)));e.dispatch(S),e.focus();};return f.length===0?null:jsx("div",{className:"template-panel",ref:u,children:jsx("div",{className:"template-panel-annotations",children:c.map(({tag:t,top:T})=>{let S=Mr(t.type),I=Hr[t.type],d=t.type==="sectionStart"||t.type==="invertedStart",y=t.id===i,b=t.id===a;return jsxs("div",{className:"template-annotation-anchor",style:{top:`${T}px`},children:[jsx("div",{className:"template-annotation-connector"}),jsxs("div",{ref:x=>{x?p.current.set(t.id,x):p.current.delete(t.id);},className:`template-annotation-chip ${y?"hovered":""} ${b?"selected":""}`,style:{borderLeftColor:I},onMouseEnter:()=>L(t.id),onMouseLeave:()=>L(void 0),onClick:()=>v(t),title:d?`${t.rawTag}
|
|
16
|
+
Iterates over ${t.name}[]. Access nested properties via ${t.name}.property`:t.rawTag,children:[S&&jsx("span",{className:"template-chip-badge",style:{background:I},children:S}),!S&&jsx("span",{className:"template-chip-dot",style:{color:I},children:"\u25CF"}),jsx("span",{className:"template-chip-name",children:t.name}),d&&t.nestedVars&&t.nestedVars.length>0&&jsx("div",{className:"template-chip-nested",children:t.nestedVars.map((x,E)=>jsx("span",{className:"template-nested-var",title:`Access: ${t.name}.${x}`,children:x.includes(".")?x.split(".").pop():x},E))})]})]},t.id)})})})}var M=`
|
|
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 Br={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)"},_r={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 G({context:e,tags:o,hoveredId:r,selectedId:n,onHover:i,onSelect:a}){let[l,m]=useState(0),u=useCallback(()=>{let s=e.getContainerOffset(),f=[];for(let h of o){let c=e.getRectsForRange(h.from,h.to);for(let P of c)f.push({tagId:h.id,tagType:h.type,x:P.x+s.x,y:P.y+s.y,width:P.width,height:P.height});}return f},[e,o]),p=useMemo(()=>u(),[u,l]);return useEffect(()=>{let s=()=>{requestAnimationFrame(()=>m(f=>f+1));};return window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]),useEffect(()=>{let s=new ResizeObserver(()=>{requestAnimationFrame(()=>m(f=>f+1));});return s.observe(e.pagesContainer),()=>s.disconnect()},[e.pagesContainer]),p.length===0?null:jsx("div",{className:"template-highlight-overlay",children:p.map((s,f)=>{let h=s.tagId===r,c=s.tagId===n,P=h||c?_r[s.tagType]:Br[s.tagType];return jsx("div",{className:`template-highlight ${h?"hovered":""} ${c?"selected":""}`,style:{position:"absolute",left:s.x,top:s.y,width:s.width,height:s.height,backgroundColor:P,borderRadius:2,cursor:"pointer"},onMouseEnter:()=>i?.(s.tagId),onMouseLeave:()=>i?.(void 0),onClick:()=>a?.(s.tagId)},`${s.tagId}-${f}`)})})}var K=`
|
|
128
128
|
.template-highlight-overlay {
|
|
129
129
|
position: absolute;
|
|
130
130
|
top: 0;
|
|
@@ -148,8 +148,9 @@ 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
|
|
152
|
-
${
|
|
153
|
-
${
|
|
154
|
-
${
|
|
155
|
-
`}}var
|
|
151
|
+
`;var zr=Y.memo(H,(e,o)=>{let r=e.pluginState,n=o.pluginState;if(r?.hoveredId!==n?.hoveredId||r?.selectedId!==n?.selectedId)return false;let i=r?.tags??[],a=n?.tags??[];if(i.length!==a.length)return false;for(let l=0;l<i.length;l++)if(i[l].id!==a[l].id)return false;return e.renderedDomContext===o.renderedDomContext});function Z(e={}){return {id:"template",name:"Template",proseMirrorPlugins:[O()],Panel:zr,panelConfig:{position:e.panelPosition??"right",defaultSize:e.panelWidth??280,minSize:200,maxSize:400,resizable:true,collapsible:true,defaultCollapsed:e.defaultCollapsed??false},onStateChange:r=>{let n=g.getState(r.state);if(n)return {tags:n.tags,hoveredId:n.hoveredId,selectedId:n.selectedId}},initialize:r=>({tags:[]}),renderOverlay:(r,n,i)=>!n||n.tags.length===0?null:Y.createElement(G,{context:r,tags:n.tags,hoveredId:n.hoveredId,selectedId:n.selectedId,onHover:a=>{i&&R(i,a);},onSelect:a=>{if(i){A(i,a);let l=n.tags.find(m=>m.id===a);if(l){let m=i.state.tr.setSelection(TextSelection.near(i.state.doc.resolve(l.from)));i.dispatch(m),i.focus();}}}}),styles:`
|
|
152
|
+
${D}
|
|
153
|
+
${M}
|
|
154
|
+
${K}
|
|
155
|
+
`}}var Wr=Z();var pn="0.0.2";export{M as ANNOTATION_PANEL_STYLES,H as AnnotationPanel,D as TEMPLATE_DECORATION_STYLES,pn as VERSION,Z as createTemplatePlugin,O as createTemplateProseMirrorPlugin,U as getTemplatePluginTags,R as setHoveredElement,A as setSelectedElement,Wr as templatePlugin,g as templatePluginKey};//# sourceMappingURL=index.js.map
|
|
156
|
+
//# sourceMappingURL=index.js.map
|