@heyirisai/docx-editor-vue 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +116 -0
  3. package/dist/KeyboardShortcutsDialog-B0fEvXnH.js +2799 -0
  4. package/dist/KeyboardShortcutsDialog-Cmezq6eJ.cjs +1 -0
  5. package/dist/RenderedDomContext-CHc18N_2.js +2 -0
  6. package/dist/TablePropertiesDialog-B6ncvNnv.cjs +1 -0
  7. package/dist/TablePropertiesDialog-P_vyKNTn.js +1145 -0
  8. package/dist/_plugin-vue_export-helper-B52Kst-M.js +8 -0
  9. package/dist/_plugin-vue_export-helper-CX7YVcP6.cjs +1 -0
  10. package/dist/components/DocxEditor/types.d.ts +193 -0
  11. package/dist/components/EditorToolbarContext.d.ts +9 -0
  12. package/dist/components/Toolbar/presets.d.ts +20 -0
  13. package/dist/components/dialogs/index.d.ts +27 -0
  14. package/dist/components/imageContextMenuTypes.d.ts +30 -0
  15. package/dist/components/imageSelectionTypes.d.ts +14 -0
  16. package/dist/components/insertTableState.d.ts +9 -0
  17. package/dist/components/sidebar/cardStyles.d.ts +3 -0
  18. package/dist/components/sidebar/cardUtils.d.ts +1 -0
  19. package/dist/components/sidebar/resolveItemPositions.d.ts +4 -0
  20. package/dist/components/sidebar/sidebarUtils.d.ts +4 -0
  21. package/dist/components/tableStylePresets.d.ts +53 -0
  22. package/dist/components/toolbarUtils.d.ts +1 -0
  23. package/dist/components/ui/Icons.d.ts +1 -0
  24. package/dist/components/ui/fontPickerValue.d.ts +1 -0
  25. package/dist/components/ui/fontPickerValue.test.d.ts +1 -0
  26. package/dist/components/ui/hyperlinkPopupTypes.d.ts +20 -0
  27. package/dist/composables/fileOpen.test.d.ts +1 -0
  28. package/dist/composables/imageOverlayRect.d.ts +44 -0
  29. package/dist/composables/imageOverlayRect.test.d.ts +1 -0
  30. package/dist/composables/index.d.ts +30 -0
  31. package/dist/composables/useAutoSave.d.ts +40 -0
  32. package/dist/composables/useClipboard.d.ts +22 -0
  33. package/dist/composables/useColorMode.d.ts +8 -0
  34. package/dist/composables/useCommentLifecycle.d.ts +62 -0
  35. package/dist/composables/useCommentManagement.d.ts +68 -0
  36. package/dist/composables/useCommentSidebarItems.d.ts +24 -0
  37. package/dist/composables/useCommentSidebarItems.test.d.ts +1 -0
  38. package/dist/composables/useContextMenus.cut.test.d.ts +1 -0
  39. package/dist/composables/useContextMenus.d.ts +39 -0
  40. package/dist/composables/useControllableBoolean.d.ts +16 -0
  41. package/dist/composables/useControllableBoolean.test.d.ts +1 -0
  42. package/dist/composables/useDocumentLifecycle.d.ts +11 -0
  43. package/dist/composables/useDocxEditor.d.ts +96 -0
  44. package/dist/composables/useDocxEditorRefApi.d.ts +53 -0
  45. package/dist/composables/useDragAutoScroll.d.ts +11 -0
  46. package/dist/composables/useFileIO.d.ts +41 -0
  47. package/dist/composables/useFindReplace.d.ts +34 -0
  48. package/dist/composables/useFixedDropdown.d.ts +14 -0
  49. package/dist/composables/useFontLifecycle.d.ts +12 -0
  50. package/dist/composables/useFormattingActions.d.ts +31 -0
  51. package/dist/composables/useHistory.d.ts +9 -0
  52. package/dist/composables/useHostCallbacks.d.ts +7 -0
  53. package/dist/composables/useHyperlinkManagement.d.ts +38 -0
  54. package/dist/composables/useImageActions.d.ts +24 -0
  55. package/dist/composables/useKeyboardShortcuts.d.ts +25 -0
  56. package/dist/composables/useMenuActions.d.ts +26 -0
  57. package/dist/composables/useOutlineSidebar.d.ts +24 -0
  58. package/dist/composables/useOutlineSidebar.test.d.ts +1 -0
  59. package/dist/composables/usePageSetupControls.d.ts +22 -0
  60. package/dist/composables/usePagesPointer.d.ts +86 -0
  61. package/dist/composables/useParagraphStyleOptions.d.ts +18 -0
  62. package/dist/composables/usePortalClass.d.ts +8 -0
  63. package/dist/composables/useSelectionHighlight.d.ts +19 -0
  64. package/dist/composables/useSelectionSync.d.ts +36 -0
  65. package/dist/composables/useTableResize.d.ts +7 -0
  66. package/dist/composables/useTableSelection.d.ts +10 -0
  67. package/dist/composables/useToolbarDropdowns.d.ts +15 -0
  68. package/dist/composables/useToolbarFontSize.d.ts +15 -0
  69. package/dist/composables/useTrackedChanges.d.ts +12 -0
  70. package/dist/composables/useVisualLineNavigation.d.ts +11 -0
  71. package/dist/composables/useWatermarkControls.d.ts +15 -0
  72. package/dist/composables/useWheelZoom.d.ts +10 -0
  73. package/dist/composables/useZoom.d.ts +16 -0
  74. package/dist/composables.cjs +1 -0
  75. package/dist/composables.js +401 -0
  76. package/dist/dialogs.cjs +1 -0
  77. package/dist/dialogs.js +3 -0
  78. package/dist/docx-editor-vue.css +2 -0
  79. package/dist/i18n/LocaleContext.d.ts +1 -0
  80. package/dist/i18n/index.d.ts +26 -0
  81. package/dist/index.cjs +19 -0
  82. package/dist/index.d.ts +24 -0
  83. package/dist/index.js +4449 -0
  84. package/dist/lib/utils.d.ts +10 -0
  85. package/dist/plugin-api/RenderedDomContext.d.ts +1 -0
  86. package/dist/plugin-api/index.d.ts +18 -0
  87. package/dist/plugin-api/types.d.ts +28 -0
  88. package/dist/plugin-api.cjs +1 -0
  89. package/dist/plugin-api.js +62 -0
  90. package/dist/renderAsync.d.ts +31 -0
  91. package/dist/styles/index.d.ts +12 -0
  92. package/dist/styles/zIndex.d.ts +24 -0
  93. package/dist/styles.cjs +1 -0
  94. package/dist/styles.js +5 -0
  95. package/dist/ui.cjs +18 -0
  96. package/dist/ui.d.ts +79 -0
  97. package/dist/ui.js +986 -0
  98. package/dist/useCommentSidebarItems-DBeGKNGA.cjs +1 -0
  99. package/dist/useCommentSidebarItems-DXbF857R.js +45 -0
  100. package/dist/useDragAutoScroll-CVltVfKK.js +520 -0
  101. package/dist/useDragAutoScroll-liP5PRvM.cjs +1 -0
  102. package/dist/usePortalClass-B9gFYxe0.cjs +4 -0
  103. package/dist/usePortalClass-HM-UHRlE.js +3534 -0
  104. package/dist/utils/domQueries.d.ts +39 -0
  105. package/dist/utils/imageClipboard.d.ts +9 -0
  106. package/dist/utils/refApiQueries.d.ts +10 -0
  107. package/dist/zIndex-CH0jZ7U7.cjs +1 -0
  108. package/dist/zIndex-CxELVe_L.js +12 -0
  109. package/package.json +119 -0
@@ -0,0 +1,8 @@
1
+ //#region \0plugin-vue:export-helper
2
+ var e = (e, t) => {
3
+ let n = e.__vccOpts || e;
4
+ for (let [e, r] of t) n[e] = r;
5
+ return n;
6
+ };
7
+ //#endregion
8
+ export { e as t };
@@ -0,0 +1 @@
1
+ var e=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e}});
@@ -0,0 +1,193 @@
1
+ import { Plugin } from 'prosemirror-state';
2
+ import { EditorView } from 'prosemirror-view';
3
+ import { Document, Theme } from '@heyirisai/docx-editor-core/types/document';
4
+ import { Comment } from '@heyirisai/docx-editor-core/types/content';
5
+ import { SelectionState, PMContentControl } from '@heyirisai/docx-editor-core/prosemirror';
6
+ import { DocxInput, ScrollToParaIdOptions, FontDefinition } from '@heyirisai/docx-editor-core/utils';
7
+ import { FontOption } from '@heyirisai/docx-editor-core/utils/fontOptions';
8
+ import { StyleValue, VNodeChild } from 'vue';
9
+ import { EditorRefLike } from '@heyirisai/docx-editor-agents/bridge';
10
+ import { ContentControlFilter, ContentControlValue } from '@heyirisai/docx-editor-core/agent';
11
+ import { Translations } from '@heyirisai/docx-editor-i18n';
12
+ export type EditorMode = 'editing' | 'suggesting' | 'viewing';
13
+ /**
14
+ * Public props for the Vue editor component.
15
+ */
16
+ export interface DocxEditorProps {
17
+ /** Document data — ArrayBuffer, Uint8Array, Blob, or File. */
18
+ documentBuffer?: DocxInput | null;
19
+ /** Pre-parsed document model, alternative to documentBuffer. */
20
+ document?: Document | null;
21
+ /** Whether to show the main formatting toolbar. */
22
+ showToolbar?: boolean;
23
+ /**
24
+ * Whether to show `File > Open` and enable Cmd/Ctrl+O (default: true).
25
+ * Set false when you provide your own open action elsewhere.
26
+ */
27
+ showFileOpen?: boolean;
28
+ /** Whether to show the Help menu in the menu bar (default: true). */
29
+ showHelpMenu?: boolean;
30
+ /** Whether to show the title/menu bar. Vue-only chrome toggle. */
31
+ showMenuBar?: boolean;
32
+ /** Whether to show page rulers. */
33
+ showRuler?: boolean;
34
+ /** Document name shown in the title bar. */
35
+ documentName?: string;
36
+ /** Whether the editor is read-only. */
37
+ readOnly?: boolean;
38
+ /** Author name used for comments and tracked changes created in the UI. Defaults to `'User'`. */
39
+ author?: string;
40
+ /** Editor mode: direct editing, suggesting, or viewing. */
41
+ mode?: EditorMode;
42
+ /** Callback when the editing mode changes. */
43
+ onModeChange?: (mode: EditorMode) => void;
44
+ /** Controlled comments-sidebar visibility; source of truth when set. Pair with `onCommentsSidebarOpenChange`; omit for the default self-managed behavior. */
45
+ commentsSidebarOpen?: boolean;
46
+ /** Fires with the next open state whenever the editor wants to show or hide the comments sidebar. Fires in both controlled and uncontrolled modes. */
47
+ onCommentsSidebarOpenChange?: (open: boolean) => void;
48
+ /** Translation overrides merged with English fallback. */
49
+ i18n?: Translations;
50
+ /** Theme override used for toolbar color palettes when the document has no theme. */
51
+ theme?: Theme | null;
52
+ /** Color theme mode for UI styling. `'system'` follows the OS preference. */
53
+ colorMode?: 'light' | 'dark' | 'system';
54
+ /** External ProseMirror plugins supplied by the host app. */
55
+ externalPlugins?: Plugin[];
56
+ /** Whether to show the zoom controls in the toolbar. */
57
+ showZoomControl?: boolean;
58
+ /** Initial zoom level. */
59
+ initialZoom?: number;
60
+ /** Custom toolbar content appended after the built-in controls. */
61
+ toolbarExtra?: () => VNodeChild;
62
+ /** Additional CSS class name on the editor root. */
63
+ className?: string;
64
+ /** Additional inline styles on the editor root. */
65
+ style?: StyleValue;
66
+ /** Whether to show the document outline panel initially. */
67
+ showOutline?: boolean;
68
+ /** Whether to show the floating outline toggle button. */
69
+ showOutlineButton?: boolean;
70
+ /** Custom list of fonts shown in the font-family dropdown. */
71
+ fontFamilies?: ReadonlyArray<string | FontOption>;
72
+ /**
73
+ * Custom font faces to register before the editor measures text. Each entry
74
+ * injects an `@font-face` rule. Pass a URL (woff2/woff/ttf/otf), an
75
+ * ArrayBuffer, or omit `src` to load by name from Google Fonts. Multiple
76
+ * entries can share `family` to register different weights/styles.
77
+ */
78
+ fonts?: ReadonlyArray<FontDefinition>;
79
+ /**
80
+ * Text-watermark presets shown in the watermark dialog's preset dropdown.
81
+ * Omit to use the built-in MS Word phrases (`DEFAULT_WATERMARK_PRESETS`).
82
+ * Pass an empty array to hide the preset dropdown.
83
+ */
84
+ watermarkPresets?: readonly string[];
85
+ /**
86
+ * Callback fired when the print action is triggered. Pass it to enable the
87
+ * `File > Print` menu entry; omit to hide. The `editor.print()` ref method
88
+ * also invokes this callback.
89
+ */
90
+ onPrint?: () => void;
91
+ /**
92
+ * Callback when a DOCX file is selected through `File > Open` or Cmd/Ctrl+O.
93
+ * Pass it to route the picked file through your own import pipeline. Omit it
94
+ * to keep the built-in local document load behavior.
95
+ */
96
+ onOpen?: (file: File) => void | Promise<void>;
97
+ /** Disable Cmd/Ctrl+F and Cmd/Ctrl+H interception. */
98
+ disableFindReplaceShortcuts?: boolean;
99
+ /** Custom logo/icon renderer for the title bar. Slots remain preferred in templates. */
100
+ renderLogo?: () => VNodeChild;
101
+ /** Callback when the document name changes. */
102
+ onDocumentNameChange?: (name: string) => void;
103
+ /** Whether the document name is editable. */
104
+ documentNameEditable?: boolean;
105
+ /** Custom right-side actions renderer for the title bar. Slots remain preferred in templates. */
106
+ renderTitleBarRight?: () => VNodeChild;
107
+ /** Callback fired whenever the document changes. Mirrors the `@change` event. */
108
+ onChange?: (document: Document) => void;
109
+ /** Callback fired when the editor errors (parse/layout/font). Mirrors the `@error` event. */
110
+ onError?: (error: Error) => void;
111
+ /** Callback fired when the selection changes, with the current selection state (or null). */
112
+ onSelectionChange?: (state: SelectionState | null) => void;
113
+ /** Callback fired once the underlying ProseMirror EditorView is ready. */
114
+ onEditorViewReady?: (view: EditorView) => void;
115
+ /** Callback fired when a top-level comment is added via the UI. */
116
+ onCommentAdd?: (comment: Comment) => void;
117
+ /** Callback fired when a comment is resolved via the UI. Receives the comment with `done: true`. */
118
+ onCommentResolve?: (comment: Comment) => void;
119
+ /** Callback fired when a comment (and its replies) is deleted via the UI. */
120
+ onCommentDelete?: (comment: Comment) => void;
121
+ /** Callback fired when a reply is added to a comment via the UI. */
122
+ onCommentReply?: (reply: Comment, parent: Comment) => void;
123
+ /** Callback fired with the full comment array whenever it changes (add/reply/resolve/delete). */
124
+ onCommentsChange?: (comments: Comment[]) => void;
125
+ }
126
+ /**
127
+ * Public ref shape for `<DocxEditor>`. Exposes the full editor-scope
128
+ * `EditorRefLike` contract so the agent bridge can attach to either
129
+ * React or Vue without an adapter shim.
130
+ */
131
+ export type DocxEditorRef = EditorRefLike & {
132
+ /** Agent instance access is React-only today; Vue returns null for API parity. */
133
+ getAgent(): null;
134
+ /** Save the document and return DOCX bytes, matching React's component ref. */
135
+ save(): Promise<ArrayBuffer | null>;
136
+ /** Set zoom level (1.0 = 100%). */
137
+ setZoom(zoom: number): void;
138
+ /** Get current zoom level. */
139
+ getZoom(): number;
140
+ /** Focus the editor's hidden ProseMirror view. Vue-only — not in EditorRefLike. */
141
+ focus(): void;
142
+ /** Scroll to a body paragraph by Word `w14:paraId`, optionally flashing it. */
143
+ scrollToParaId(paraId: string, options?: ScrollToParaIdOptions): boolean;
144
+ /** Scroll the visible pages to a 1-indexed page number. */
145
+ scrollToPage(pageNumber: number): void;
146
+ /** Scroll to a raw ProseMirror document position. */
147
+ scrollToPosition(pmPos: number): void;
148
+ /**
149
+ * Scroll the comment with the given id into view and select its anchored
150
+ * range so the selection overlay highlights it. False when the id no longer
151
+ * resolves (the comment was deleted or its anchored text removed).
152
+ */
153
+ scrollToCommentId(commentId: number): boolean;
154
+ /**
155
+ * Scroll the tracked change with the given revision id into view and select
156
+ * its range so the selection overlay highlights it. False when the id no
157
+ * longer resolves (the change was accepted/rejected/deleted).
158
+ */
159
+ scrollToChangeId(revisionId: number): boolean;
160
+ /**
161
+ * Select the position range `[from, to]` so the selection overlay highlights
162
+ * it, and scroll its start into view. No-op for a malformed range or a
163
+ * `from` past the document end; `to` is clamped to the document size.
164
+ */
165
+ highlightRange(from: number, to: number): void;
166
+ /** Open print preview / browser print. */
167
+ openPrintPreview(): void;
168
+ /** Print the document. */
169
+ print(): void;
170
+ /** Load a pre-parsed document programmatically. */
171
+ loadDocument(doc: Document): void;
172
+ /** Load a DOCX buffer programmatically. */
173
+ loadDocumentBuffer(buffer: DocxInput): Promise<void>;
174
+ /** Tear down the editor (destroys the PM view + frees listeners). */
175
+ destroy(): void;
176
+ /** List block-level content controls (SDTs), optionally filtered by tag/alias/id/type. */
177
+ getContentControls(filter?: ContentControlFilter): PMContentControl[];
178
+ /** Scroll the first content control matching `filter` into view. False if none. */
179
+ scrollToContentControl(filter: ContentControlFilter): boolean;
180
+ /** Replace a control's content by tag with `text`. False if no match; throws if locked. */
181
+ setContentControlContent(filter: ContentControlFilter, text: string, options?: {
182
+ force?: boolean;
183
+ }): boolean;
184
+ /** Remove a control by tag (or unwrap with `keepContent`). False if no match; throws if locked. */
185
+ removeContentControl(filter: ContentControlFilter, options?: {
186
+ force?: boolean;
187
+ keepContent?: boolean;
188
+ }): boolean;
189
+ /** Set a typed value (dropdown / checkbox / date) on a control by tag. False if no match. */
190
+ setContentControlValue(filter: ContentControlFilter, value: ContentControlValue, options?: {
191
+ force?: boolean;
192
+ }): boolean;
193
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Shared toolbar prop bag — mirrors React's ToolbarProps. Loosely
3
+ * typed because the consumer surface here is just the slot-down
4
+ * channel; tightening would require dragging the entire
5
+ * ToolbarProps interface across the framework boundary.
6
+ */
7
+ export type EditorToolbarProps = Record<string, unknown>;
8
+ export declare function provideEditorToolbar(props: EditorToolbarProps): void;
9
+ export declare function useEditorToolbar(): EditorToolbarProps;
@@ -0,0 +1,20 @@
1
+ import { FontOption } from '@heyirisai/docx-editor-core/utils/fontOptions';
2
+ import { TranslationKey } from '@heyirisai/docx-editor-i18n';
3
+ export declare const defaultFonts: FontOption[];
4
+ export declare const fontSizePresets: number[];
5
+ export interface ParagraphStylePreset {
6
+ id: string;
7
+ /** Fallback label used if the i18n key resolves to nothing. */
8
+ label: string;
9
+ nameKey: TranslationKey;
10
+ }
11
+ export declare const paragraphStyles: ParagraphStylePreset[];
12
+ export interface LineSpacingPreset {
13
+ /** Fallback label; localized presets carry a `labelKey` instead. */
14
+ label: string;
15
+ labelKey?: TranslationKey;
16
+ value: number;
17
+ }
18
+ export declare const lineSpacingOptions: LineSpacingPreset[];
19
+ export declare const ZOOM_PRESETS: number[];
20
+ export declare const DEFAULT_ZOOM_PERCENT = 100;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @heyirisai/docx-editor-vue/dialogs
3
+ *
4
+ * Modal dialog components — hyperlinks, find/replace, page setup, image
5
+ * properties, and keyboard shortcuts. Mirrors the React dialogs subpath.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { HyperlinkDialog, FindReplaceDialog } from '@heyirisai/docx-editor-vue/dialogs';
10
+ * ```
11
+ *
12
+ * @packageDocumentation
13
+ * @public
14
+ */
15
+ export { default as FindReplaceDialog } from './FindReplaceDialog.vue';
16
+ export { default as FootnotePropertiesDialog } from './FootnotePropertiesDialog.vue';
17
+ export { default as HyperlinkDialog } from './HyperlinkDialog.vue';
18
+ export { default as ImagePositionDialog } from './ImagePositionDialog.vue';
19
+ export { default as ImagePropertiesDialog } from './ImagePropertiesDialog.vue';
20
+ export { default as InsertImageDialog } from './InsertImageDialog.vue';
21
+ export { default as InsertSymbolDialog } from './InsertSymbolDialog.vue';
22
+ export { default as InsertTableDialog } from './InsertTableDialog.vue';
23
+ export { default as KeyboardShortcutsDialog } from './KeyboardShortcutsDialog.vue';
24
+ export { default as PageSetupDialog } from './PageSetupDialog.vue';
25
+ export { default as PasteSpecialDialog } from './PasteSpecialDialog.vue';
26
+ export { default as SplitCellDialog } from './SplitCellDialog.vue';
27
+ export { default as TablePropertiesDialog } from './TablePropertiesDialog.vue';
@@ -0,0 +1,30 @@
1
+ import { WrapType } from '@heyirisai/docx-editor-core/docx/wrapTypes';
2
+ type ImageAttrsCssFloat = 'left' | 'right' | 'none' | null;
3
+ export interface ImageContextMenuState {
4
+ open: boolean;
5
+ position: {
6
+ x: number;
7
+ y: number;
8
+ };
9
+ pmPos: number;
10
+ currentWrapType: WrapType;
11
+ currentCssFloat?: ImageAttrsCssFloat;
12
+ inlinePositionEmu?: {
13
+ horizontalEmu: number;
14
+ verticalEmu: number;
15
+ };
16
+ }
17
+ /**
18
+ * Item appended below a divider — mirrors the React side
19
+ * (`ImageContextMenuTextAction`). `dividerAfter` lets the host group
20
+ * the items the same way Word does (Cut/Copy/Paste then divider then
21
+ * Delete).
22
+ */
23
+ export interface ImageContextMenuTextAction {
24
+ action: string;
25
+ label: string;
26
+ shortcut?: string;
27
+ disabled?: boolean;
28
+ dividerAfter?: boolean;
29
+ }
30
+ export {};
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Shared `ImageSelectionInfo` type — imported by
3
+ * `ImageSelectionOverlay.vue` (for `defineProps`) and
4
+ * `useImageActions.ts` (for the composable's `selectedImage` ref).
5
+ * Pulled out of the .vue SFC so a plain .ts module can reference it
6
+ * without going through the `*.vue` wildcard shim, which doesn't
7
+ * carry named type exports.
8
+ */
9
+ export interface ImageSelectionInfo {
10
+ element: HTMLElement;
11
+ pmPos: number;
12
+ width: number;
13
+ height: number;
14
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Last-used Insert-Table dimensions. Module-level so the dialog reopens with
3
+ * whatever the user picked last time (mirrors React lifting this to component
4
+ * state that survives reopen).
5
+ */
6
+ export declare const rememberedTableSize: {
7
+ rows: number;
8
+ cols: number;
9
+ };
@@ -0,0 +1,3 @@
1
+ import { CSSProperties } from 'vue';
2
+ export declare const CARD_STYLE_COLLAPSED: CSSProperties;
3
+ export declare const CARD_STYLE_EXPANDED: CSSProperties;
@@ -0,0 +1 @@
1
+ export * from './sidebarUtils';
@@ -0,0 +1,4 @@
1
+ import { CommentSidebarItem } from '../../composables/useCommentSidebarItems';
2
+ import { ResolvedPosition as CoreResolvedPosition } from '@heyirisai/docx-editor-core/plugin-api/resolveItemPositions';
3
+ export type ResolvedPosition = CoreResolvedPosition<CommentSidebarItem>;
4
+ export declare const resolveItemPositions: (items: CommentSidebarItem[], anchorPositions: Map<string, number>, renderedDomContext: import('@heyirisai/docx-editor-core').RenderedDomContext | null, zoom: number, cardHeights: Map<string, number>, lastKnown: Map<string, number>) => CoreResolvedPosition<CommentSidebarItem>[];
@@ -0,0 +1,4 @@
1
+ import { CSSProperties } from 'vue';
2
+ export { getCommentText, formatDate, getInitials, getAvatarColor, truncateText, type TrackedChangeEntry, } from '@heyirisai/docx-editor-core/utils/comments';
3
+ /** Inline style for an avatar bubble — mirrors React's avatarStyle(). */
4
+ export declare function avatarStyle(name: string, size?: 32 | 28): CSSProperties;
@@ -0,0 +1,53 @@
1
+ import { CSSProperties } from 'vue';
2
+ export interface TableStyleBorder {
3
+ style: string;
4
+ size?: number;
5
+ color?: {
6
+ rgb: string;
7
+ };
8
+ }
9
+ export interface TableStylePreset {
10
+ id: string;
11
+ name: string;
12
+ /** Table-level borders */
13
+ tableBorders?: {
14
+ top?: TableStyleBorder;
15
+ bottom?: TableStyleBorder;
16
+ left?: TableStyleBorder;
17
+ right?: TableStyleBorder;
18
+ insideH?: TableStyleBorder;
19
+ insideV?: TableStyleBorder;
20
+ };
21
+ /** Conditional formatting per cell position */
22
+ conditionals?: Record<string, {
23
+ backgroundColor?: string;
24
+ borders?: {
25
+ top?: TableStyleBorder | null;
26
+ bottom?: TableStyleBorder | null;
27
+ left?: TableStyleBorder | null;
28
+ right?: TableStyleBorder | null;
29
+ };
30
+ bold?: boolean;
31
+ color?: string;
32
+ }>;
33
+ /** Which conditional formatting is active by default */
34
+ look?: {
35
+ firstRow?: boolean;
36
+ lastRow?: boolean;
37
+ firstCol?: boolean;
38
+ lastCol?: boolean;
39
+ noHBand?: boolean;
40
+ noVBand?: boolean;
41
+ };
42
+ }
43
+ export declare const BUILTIN_TABLE_STYLES: TableStylePreset[];
44
+ /** Get a built-in table style preset by ID. */
45
+ export declare function getBuiltinTableStyle(styleId: string): TableStylePreset | undefined;
46
+ /** Map from built-in style ID to en.json translation key under `table.styles.*`. */
47
+ export declare const TABLE_STYLE_NAME_KEYS: Record<string, string>;
48
+ /**
49
+ * Build the per-cell inline styles for a small preview grid of the given
50
+ * preset. Shared by TableStyleGallery and InsertTableDialog so the preview
51
+ * rendering stays in one place.
52
+ */
53
+ export declare function getPreviewCells(preset: TableStylePreset, rows?: number, cols?: number): CSSProperties[];
@@ -0,0 +1 @@
1
+ export { HIGHLIGHT_HEX_TO_NAME, mapHexToHighlightName, } from '@heyirisai/docx-editor-core/utils/highlightColors';
@@ -0,0 +1 @@
1
+ export { default as MaterialSymbol } from './MaterialSymbol.vue';
@@ -0,0 +1 @@
1
+ export declare function getPrimaryFontFamily(fontFamily: string): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Shared `HyperlinkPopupData` type — imported by `HyperlinkPopup.vue`
3
+ * (for `defineProps`) and `useHyperlinkManagement.ts` (for the
4
+ * composable's `hyperlinkPopupData` ref). Pulled out of the .vue SFC so
5
+ * a plain .ts module can reference it without going through the `*.vue`
6
+ * wildcard shim, which doesn't carry named type exports.
7
+ */
8
+ export interface HyperlinkPopupData {
9
+ href: string;
10
+ displayText: string;
11
+ tooltip?: string;
12
+ /** Popup position in the editor's pages-viewport coordinate space (CSS
13
+ * pixels from its top-left). Computed once at click time. The popup
14
+ * renders inside that viewport with `position: absolute`, so the
15
+ * browser handles repositioning during scroll for free. */
16
+ position: {
17
+ top: number;
18
+ left: number;
19
+ };
20
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Pure geometry for the Vue image-selection overlay. Kept separate from the
3
+ * component so the scrollbar-gutter handling can be unit-tested without a DOM.
4
+ */
5
+ export interface OverlayRectInputs {
6
+ /** `image.getBoundingClientRect()` (viewport coords). */
7
+ imageRect: {
8
+ left: number;
9
+ top: number;
10
+ width: number;
11
+ height: number;
12
+ };
13
+ /** `offsetParent.getBoundingClientRect()` (the scroll container, viewport coords). */
14
+ parentRect: {
15
+ left: number;
16
+ top: number;
17
+ };
18
+ scrollLeft: number;
19
+ scrollTop: number;
20
+ /** `offsetParent.offsetWidth` / `.clientWidth` — used to derive the gutter. */
21
+ parentOffsetWidth: number;
22
+ parentClientWidth: number;
23
+ zoom: number;
24
+ }
25
+ export interface OverlayRect {
26
+ left: number;
27
+ top: number;
28
+ width: number;
29
+ height: number;
30
+ }
31
+ /**
32
+ * Position the overlay (absolute, inside the scroll container) over the image.
33
+ *
34
+ * The scroll container uses `scrollbar-gutter: stable both-edges`, which
35
+ * reserves an inline-start gutter that sits OUTSIDE the absolute-positioning
36
+ * origin. `getBoundingClientRect().left` is the border-box left (before the
37
+ * gutter), so `imageRect.left - parentRect.left` over-counts the left gutter
38
+ * and the frame lands shifted right by that width (issue #764). With
39
+ * `both-edges` the two gutters are equal, so the left gutter is half of the
40
+ * total reserved inline space (`offsetWidth - clientWidth`, no borders here).
41
+ * On overlay-scrollbar platforms (e.g. macOS) the reserved space is 0, so the
42
+ * correction is a no-op and behavior is unchanged.
43
+ */
44
+ export declare function computeImageOverlayRect(i: OverlayRectInputs): OverlayRect;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @heyirisai/docx-editor-vue/composables
3
+ *
4
+ * Vue composables mirroring the React `hooks` subpath — history, table
5
+ * selection, find/replace, autosave, clipboard, zoom, and the high-level
6
+ * `useDocxEditor` host composable.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { useAutoSave, useFindReplace } from '@heyirisai/docx-editor-vue/composables';
11
+ * ```
12
+ *
13
+ * @packageDocumentation
14
+ * @public
15
+ */
16
+ export * from './useAutoSave';
17
+ export * from './useClipboard';
18
+ export * from './useCommentSidebarItems';
19
+ export * from './useDocxEditor';
20
+ export * from './useDragAutoScroll';
21
+ export * from './useFindReplace';
22
+ export * from './useFixedDropdown';
23
+ export * from './useHistory';
24
+ export * from './useSelectionHighlight';
25
+ export * from './useTableResize';
26
+ export * from './useTableSelection';
27
+ export * from './useTrackedChanges';
28
+ export * from './useVisualLineNavigation';
29
+ export * from './useWheelZoom';
30
+ export * from './useZoom';
@@ -0,0 +1,40 @@
1
+ import { MaybeRef, Ref } from 'vue';
2
+ import { formatLastSaveTime, getAutoSaveStatusLabel, getAutoSaveStorageSize, formatStorageSize, isAutoSaveSupported } from '@heyirisai/docx-editor-core';
3
+ import { AutoSaveStatus, SavedDocumentData } from '@heyirisai/docx-editor-core/managers/types';
4
+ import { Document } from '@heyirisai/docx-editor-core/types/document';
5
+ export type { AutoSaveStatus, SavedDocumentData };
6
+ export { formatLastSaveTime, getAutoSaveStatusLabel, getAutoSaveStorageSize, formatStorageSize, isAutoSaveSupported, };
7
+ export interface UseAutoSaveOptions {
8
+ /** localStorage key (default: 'docx-editor-autosave') */
9
+ storageKey?: string;
10
+ /** Auto-save interval in ms (default: 30000) */
11
+ interval?: number;
12
+ /** Whether auto-save starts enabled (default: true). */
13
+ enabled?: boolean;
14
+ /** Maximum age of auto-save before it is considered stale. */
15
+ maxAge?: number;
16
+ /** Callback when save succeeds. */
17
+ onSave?: (timestamp: Date) => void;
18
+ /** Callback when save fails. */
19
+ onError?: (error: Error) => void;
20
+ /** Callback when recovery data is found. */
21
+ onRecoveryAvailable?: (savedDocument: SavedDocumentData) => void;
22
+ /** Whether document changes trigger a debounced save. */
23
+ saveOnChange?: boolean;
24
+ /** Debounce delay for saveOnChange in milliseconds. */
25
+ debounceDelay?: number;
26
+ }
27
+ export interface UseAutoSaveReturn {
28
+ status: Ref<AutoSaveStatus>;
29
+ lastSaveTime: Ref<Date | null>;
30
+ save: () => Promise<boolean>;
31
+ clearAutoSave: () => void;
32
+ hasRecoveryData: Ref<boolean>;
33
+ getRecoveryData: () => SavedDocumentData | null;
34
+ acceptRecovery: () => Document | null;
35
+ dismissRecovery: () => void;
36
+ isEnabled: Ref<boolean>;
37
+ enable: () => void;
38
+ disable: () => void;
39
+ }
40
+ export declare function useAutoSave(document: MaybeRef<Document | null | undefined>, options?: UseAutoSaveOptions): UseAutoSaveReturn;
@@ -0,0 +1,22 @@
1
+ import { Ref } from 'vue';
2
+ import { runsToClipboardContent, ParsedClipboardContent } from '@heyirisai/docx-editor-core/utils';
3
+ import { getSelectionRuns, createSelectionFromDOM, ClipboardSelection, Theme } from '@heyirisai/docx-editor-core';
4
+ export { getSelectionRuns, createSelectionFromDOM, runsToClipboardContent };
5
+ export type { ClipboardSelection };
6
+ export interface UseClipboardOptions {
7
+ onCopy?: (selection: ClipboardSelection) => void;
8
+ onCut?: (selection: ClipboardSelection) => void;
9
+ onPaste?: (content: ParsedClipboardContent, asPlainText: boolean) => void;
10
+ cleanWordFormatting?: boolean;
11
+ editable?: boolean;
12
+ onError?: (error: Error) => void;
13
+ theme?: Theme | null;
14
+ }
15
+ export interface UseClipboardReturn {
16
+ copy: (selection: ClipboardSelection) => Promise<boolean>;
17
+ cut: (selection: ClipboardSelection) => Promise<boolean>;
18
+ paste: (asPlainText?: boolean) => Promise<ParsedClipboardContent | null>;
19
+ isProcessing: Ref<boolean>;
20
+ lastPastedContent: Ref<ParsedClipboardContent | null>;
21
+ }
22
+ export declare function useClipboard(options?: UseClipboardOptions): UseClipboardReturn;
@@ -0,0 +1,8 @@
1
+ import { ComputedRef } from 'vue';
2
+ import { ColorMode } from '@heyirisai/docx-editor-core/utils';
3
+ /**
4
+ * Resolve the effective dark flag from a reactive `colorMode`. `'system'`
5
+ * follows the OS via `subscribeSystemDark` (SSR-safe; re-syncs on entry).
6
+ * Mirrors the React adapter's inline colorMode logic via the shared core helpers.
7
+ */
8
+ export declare function useColorMode(colorMode: () => ColorMode): ComputedRef<boolean>;
@@ -0,0 +1,62 @@
1
+ import { MaybeRef, Ref } from 'vue';
2
+ import { EditorView } from 'prosemirror-view';
3
+ import { Document } from '@heyirisai/docx-editor-core/types/document';
4
+ import { Comment } from '@heyirisai/docx-editor-core/types/content';
5
+ import { CommentIdAllocator } from '@heyirisai/docx-editor-core/prosemirror/commentIdAllocator';
6
+ import { TrackedChangeEntry } from '../components/sidebar/sidebarUtils';
7
+ import { CommentCallbacks } from './useCommentManagement';
8
+ export interface UseCommentLifecycleOptions {
9
+ editorView: Ref<EditorView | null>;
10
+ getDocument: () => Document | null;
11
+ comments: Ref<Comment[]>;
12
+ trackedChanges: Ref<TrackedChangeEntry[]>;
13
+ resolvedCommentIds: Ref<Set<number>>;
14
+ /** Shared per-instance ID allocator (see useCommentManagement). */
15
+ commentIdAllocator: CommentIdAllocator;
16
+ activeSidebarItem: Ref<string | null>;
17
+ showSidebar: Ref<boolean>;
18
+ isAddingComment: Ref<boolean>;
19
+ readOnly: Ref<boolean>;
20
+ zoom: Ref<number>;
21
+ stateTick: Ref<number>;
22
+ pagesRef: Ref<HTMLElement | null>;
23
+ pagesViewportRef: Ref<HTMLElement | null>;
24
+ emit: (event: string, ...args: unknown[]) => void;
25
+ /** Author name for UI-created comments (the `author` prop). */
26
+ author?: MaybeRef<string>;
27
+ /** Host-facing comment lifecycle callbacks (the `onComment*` props). */
28
+ commentCallbacks?: CommentCallbacks;
29
+ /** Get all active header/footer ProseMirror EditorViews. */
30
+ getHfPmViews?: () => Map<string, EditorView>;
31
+ }
32
+ export declare function useCommentLifecycle(opts: UseCommentLifecycleOptions): {
33
+ floatingCommentBtn: Ref<{
34
+ top: number;
35
+ left: number;
36
+ } | null, {
37
+ top: number;
38
+ left: number;
39
+ } | {
40
+ top: number;
41
+ left: number;
42
+ } | null>;
43
+ pendingCommentRange: Ref<{
44
+ from: number;
45
+ to: number;
46
+ } | null, {
47
+ from: number;
48
+ to: number;
49
+ } | {
50
+ from: number;
51
+ to: number;
52
+ } | null>;
53
+ addCommentYPosition: Ref<number | null, number | null>;
54
+ sidebarAutoOpenedRef: Ref<boolean, boolean>;
55
+ extractCommentsAndChanges: () => void;
56
+ handleAddComment: (text: string) => void;
57
+ handleCancelAddComment: () => void;
58
+ handleStartAddComment: () => void;
59
+ handleMarkerClick: (_commentId: number) => void;
60
+ recomputeFloatingCommentBtn: () => void;
61
+ recomputeActiveSidebarItem: () => void;
62
+ };