@stll/folio-vue 0.9.0 → 0.10.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 (39) hide show
  1. package/dist/{ListButtons-C1rU_Y1e.cjs → ListButtons-BcB7qvzQ.cjs} +2 -2
  2. package/dist/{ListButtons-DMnOM2pN.js → ListButtons-rpVlLZJ8.js} +388 -384
  3. package/dist/SplitCellDialog-B_TOoiMw.cjs +15 -0
  4. package/dist/{WatermarkDialog-Cf9ISDvv.js → SplitCellDialog-DRQuZsA3.js} +907 -907
  5. package/dist/components/AutocompleteCaretOverlay.types.d.ts +18 -0
  6. package/dist/components/DocxEditor/pagedEditorRef.d.ts +14 -0
  7. package/dist/components/DocxEditor/types.d.ts +27 -0
  8. package/dist/composables/index.d.ts +1 -0
  9. package/dist/composables/useColorMode.d.ts +17 -4
  10. package/dist/composables/useContextMenus.d.ts +3 -0
  11. package/dist/composables/useDocxEditor.d.ts +21 -0
  12. package/dist/composables/useDocxEditorRefApi.d.ts +13 -0
  13. package/dist/composables/useFontLifecycle.d.ts +21 -0
  14. package/dist/composables/useKeyboardShortcuts.d.ts +0 -1
  15. package/dist/composables/usePagesPointer.d.ts +5 -0
  16. package/dist/composables.cjs +2 -2
  17. package/dist/composables.js +75 -75
  18. package/dist/dialogs.cjs +1 -1
  19. package/dist/dialogs.js +2 -2
  20. package/dist/folio-vue.css +1 -1
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.d.ts +4 -1
  23. package/dist/index.js +1719 -1275
  24. package/dist/renderAsync.d.ts +4 -0
  25. package/dist/ui/folio-ui.d.ts +1 -1
  26. package/dist/ui.cjs +1 -1
  27. package/dist/ui.js +10 -10
  28. package/dist/useZoom-DBbzwfMG.cjs +1 -0
  29. package/dist/useZoom-DwDDS7hq.js +749 -0
  30. package/dist/utils/colorMode.d.ts +3 -4
  31. package/dist/utils/embeddedFonts.d.ts +7 -0
  32. package/dist/utils/fontFaces.d.ts +10 -0
  33. package/dist/utils/hostFonts.d.ts +1 -5
  34. package/package.json +1 -1
  35. package/dist/WatermarkDialog-ChJtT7Bs.cjs +0 -15
  36. package/dist/composables/useHostCallbacks.d.ts +0 -24
  37. package/dist/composables/useMenuActions.d.ts +0 -36
  38. package/dist/useZoom-BYEcnpS0.cjs +0 -1
  39. package/dist/useZoom-C0p0o54p.js +0 -656
@@ -0,0 +1,18 @@
1
+ export type AutocompleteCaretRect = {
2
+ /** Overlay-relative pixel x. */
3
+ x: number;
4
+ /** Overlay-relative pixel y (top of the cursor line). */
5
+ y: number;
6
+ /** Line height in pixels at the anchor. */
7
+ lineHeight: number;
8
+ /** Available width from the caret to the page's right content edge. */
9
+ maxWidth?: number | undefined;
10
+ };
11
+ export type AutocompleteCaretOverlayProps = {
12
+ /** Position of the autocomplete anchor, or null while idle. */
13
+ caret: AutocompleteCaretRect | null;
14
+ /** The full streamed ghost text so far. */
15
+ text: string;
16
+ /** Whether tokens are still arriving. */
17
+ isStreaming: boolean;
18
+ };
@@ -27,6 +27,10 @@ export type PagedEditorRef = {
27
27
  getState: () => EditorState | null;
28
28
  /** Get the ProseMirror EditorView. */
29
29
  getView: () => EditorView | null;
30
+ /** Get the currently active body, header/footer, or note-story view. */
31
+ getActiveView: () => EditorView | null;
32
+ /** Close the visible note story, if one is active. */
33
+ closeNoteStory: () => void;
30
34
  /**
31
35
  * Look up the persistent hidden HF EditorView by `rId`. Returns null when the
32
36
  * slot isn't mounted (no HF for that rId, or the hidden host hasn't mounted).
@@ -70,6 +74,16 @@ export type PagedEditorRef = {
70
74
  * Returns whether a matching paragraph exists in the ProseMirror document.
71
75
  */
72
76
  scrollToParaId: (paraId: string, options?: ScrollToParaIdOptions) => boolean;
77
+ /**
78
+ * Set (or clear, with `null`) the persistent passage highlight overlay. The
79
+ * range is projected onto the painted pages and painted with a translucent
80
+ * wash; it does not move the PM selection. Replaces any previous highlight.
81
+ * The overlay is cleared automatically on the next doc-changing transaction.
82
+ */
83
+ setPassageHighlight: (range: {
84
+ from: number;
85
+ to: number;
86
+ } | null) => void;
73
87
  /**
74
88
  * Resolve the page number (1-indexed) that contains the given PM position, or
75
89
  * null if no layout is available yet. Works for unrendered pages too via the
@@ -307,6 +307,21 @@ export type DocxEditorApplyDocumentOperationsOptions = {
307
307
  batch: FolioDocumentOperationBatch;
308
308
  author?: string;
309
309
  };
310
+ /**
311
+ * Outcome of {@link DocxEditorRef.highlightPassage}:
312
+ * - `"passage"`: the text matched inside the block; scrolled there and painted
313
+ * the range highlight.
314
+ * - `"block"`: the text did not match but the block resolved; behaved like
315
+ * {@link DocxEditorRef.scrollToBlock} (scroll + whole-paragraph flash where a
316
+ * paraId exists).
317
+ * - `"none"`: the block did not resolve; no-op.
318
+ */
319
+ export type HighlightPassageResult = "passage" | "block" | "none";
320
+ export type HighlightPassageOptions = {
321
+ blockId: string;
322
+ text: string;
323
+ snapshot?: FolioAIEditSnapshot;
324
+ };
310
325
  /**
311
326
  * Imperative handle exposed by the DocxEditor component.
312
327
  */
@@ -411,6 +426,18 @@ export type DocxEditorRef = {
411
426
  * accept. Without `snapshot`, falls back to a fresh-from-live-doc snapshot.
412
427
  */
413
428
  scrollToBlock: (blockId: string, snapshot?: FolioAIEditSnapshot) => boolean;
429
+ /**
430
+ * Resolve a text passage inside a block, scroll to it, and paint a persistent
431
+ * translucent highlight over the matched range. Unlike {@link scrollToBlock},
432
+ * the passage outcome does not move the PM selection, so the highlight is not
433
+ * confused with a selection. Replaces any previous passage highlight. Returns
434
+ * which outcome happened; see {@link HighlightPassageResult}. The highlight is
435
+ * ephemeral view state: cleared on the next doc-changing transaction and by
436
+ * {@link clearPassageHighlight}.
437
+ */
438
+ highlightPassage: (options: HighlightPassageOptions) => HighlightPassageResult;
439
+ /** Clear the passage highlight painted by {@link highlightPassage}, if any. */
440
+ clearPassageHighlight: () => void;
414
441
  /** Resolve a stable block or text-range target and reveal it in the editor. */
415
442
  showInDocument: (target: FolioDocumentNavigationTarget, snapshot?: FolioAIEditSnapshot) => boolean;
416
443
  /**
@@ -15,6 +15,7 @@
15
15
  * @public
16
16
  */
17
17
  export * from './useClipboard';
18
+ export * from './useColorMode';
18
19
  export * from './useDocxEditor';
19
20
  export * from './useDragAutoScroll';
20
21
  export * from './useFindReplace';
@@ -1,8 +1,21 @@
1
- import { ComputedRef } from 'vue';
1
+ import { App, ComputedRef, MaybeRefOrGetter } from 'vue';
2
2
  import { ColorMode } from '../utils/colorMode';
3
+ /** Color mode used when a host does not provide one. */
4
+ export declare const defaultColorMode: ColorMode;
3
5
  /**
4
- * Resolve the effective dark flag from a reactive `colorMode`. `'system'`
6
+ * Provide a reactive color mode to descendant folio components.
7
+ *
8
+ * Call this from a parent component's setup function. For app-wide setup, use
9
+ * {@link colorModePlugin} instead.
10
+ */
11
+ export declare const provideColorMode: (colorMode?: MaybeRefOrGetter<ColorMode>) => void;
12
+ /** Vue plugin form: `app.use(colorModePlugin, "system")`. */
13
+ export declare const colorModePlugin: {
14
+ install(app: App, colorMode?: MaybeRefOrGetter<ColorMode>): void;
15
+ };
16
+ /**
17
+ * Resolve the effective dark flag from the inherited color mode. `'system'`
5
18
  * 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
19
  */
8
- export declare function useColorMode(colorMode: () => ColorMode): ComputedRef<boolean>;
20
+ export declare function useColorMode(): ComputedRef<boolean>;
21
+ export type { ColorMode } from '../utils/colorMode';
@@ -48,6 +48,9 @@ export type UseContextMenusOptions = {
48
48
  from: number;
49
49
  to: number;
50
50
  }) => void;
51
+ onCopy?: () => void;
52
+ onCut?: () => void;
53
+ onPaste?: () => void;
51
54
  };
52
55
  export type UseContextMenusReturn = {
53
56
  contextMenu: Ref<TextContextMenuState>;
@@ -3,6 +3,7 @@ import { EditorState, Plugin } from 'prosemirror-state';
3
3
  import { EditorView } from 'prosemirror-view';
4
4
  import { FolioEditor } from '@stll/folio-core/controller/folioEditor';
5
5
  import { HeaderFooterPartKind } from '@stll/folio-core/controller/headerFooterEditorManager';
6
+ import { NoteStoryKey } from '@stll/folio-core/controller/noteEditorManager';
6
7
  import { HiddenProseMirrorCollaboration, HiddenProseMirrorRemoteSelection } from '@stll/folio-core/controller/hiddenEditorManager';
7
8
  import { FolioSelectiveSaveFlags } from '@stll/folio-core/docx/selectiveSaveFlags';
8
9
  import { TripwireResult } from '@stll/folio-core/docx/selectiveSaveTripwire';
@@ -18,12 +19,18 @@ export type UseDocxEditorOptions = {
18
19
  hiddenContainer: Ref<HTMLElement | null>;
19
20
  /** Optional separate host for persistent header/footer ProseMirror views. */
20
21
  hiddenHeaderFooterContainer?: Ref<HTMLElement | null>;
22
+ /** Visible host for the active footnote or endnote ProseMirror story. */
23
+ noteEditorContainer?: Ref<HTMLElement | null>;
21
24
  /** Container element the paginated pages are painted into. */
22
25
  pagesContainer: Ref<HTMLElement | null>;
23
26
  /** Whether the editor is read-only. Reactive. */
24
27
  readOnly?: MaybeRefOrGetter<boolean>;
25
28
  /** Gap between pages in pixels. */
26
29
  pageGap?: number;
30
+ /** Whether to paint each page's effective body-content boundary. Reactive. */
31
+ showMarginGuides?: MaybeRefOrGetter<boolean | undefined>;
32
+ /** CSS color used for margin guides. Reactive. */
33
+ marginGuideColor?: MaybeRefOrGetter<string | undefined>;
27
34
  /**
28
35
  * Stable identity of the loaded document (same across internal edits, distinct
29
36
  * per loaded file). Threaded to the hidden-editor manager's external-load
@@ -69,6 +76,12 @@ export type UseDocxEditorOptions = {
69
76
  onSelectionUpdate?: (state: EditorState) => void;
70
77
  /** Callback when the hidden EditorView is created or torn down. */
71
78
  onEditorViewReady?: (view: EditorView | null) => void;
79
+ /** Fires when the editor receives a copy event. */
80
+ onCopy?: () => void;
81
+ /** Fires when an editable editor receives a cut event. */
82
+ onCut?: () => void;
83
+ /** Fires when an editable editor receives a paste event. */
84
+ onPaste?: () => void;
72
85
  /** Callback when a read-only user action would mutate the document. */
73
86
  onReadOnlyEditAttempt?: () => void;
74
87
  /**
@@ -104,6 +117,8 @@ export type UseDocxEditorReturn = {
104
117
  remoteSelections: Ref<HiddenProseMirrorRemoteSelection[]>;
105
118
  /** Selection in the currently active persistent header/footer view. */
106
119
  headerFooterSelection: Ref<HeaderFooterSelectionState | null>;
120
+ /** The note story currently open in the visible note editor. */
121
+ activeNoteStory: Ref<NoteStoryKey | null>;
107
122
  /** True once the hidden view is mounted and a document is loaded. */
108
123
  isReady: Ref<boolean>;
109
124
  /**
@@ -139,6 +154,12 @@ export type UseDocxEditorReturn = {
139
154
  getHeaderFooterView: (rId: string) => EditorView | null;
140
155
  /** Synchronize persistent header/footer views after a document-model change. */
141
156
  syncHeaderFooterViews: () => void;
157
+ /** Open an existing footnote or endnote story. */
158
+ openNoteStory: (story: NoteStoryKey) => void;
159
+ /** Close the visible note-story editor. */
160
+ closeNoteStory: () => void;
161
+ /** Resolve the active note-story view. */
162
+ getActiveNoteView: () => EditorView | null;
142
163
  /** Access the extension command map for invoking marks / nodes / features. */
143
164
  getCommands: () => CommandMap;
144
165
  /** Focus the hidden ProseMirror view. */
@@ -42,6 +42,17 @@ export type UseDocxEditorRefApiOptions = {
42
42
  * Vue analogue of React's `PagedEditorRef.scrollToPosition`.
43
43
  */
44
44
  scrollVisiblePositionIntoView: (pmPos: number) => void;
45
+ /**
46
+ * Set (or clear, with `null`) the persistent passage-highlight range that the
47
+ * `PassageHighlightOverlay` projects and paints. Backs `highlightPassage` /
48
+ * `clearPassageHighlight`; the Vue analogue of React's
49
+ * `PagedEditorRef.setPassageHighlight`. The overlay is cleared automatically
50
+ * on the next doc-changing transaction (owned by DocxEditor.vue).
51
+ */
52
+ setPassageHighlight: (range: {
53
+ from: number;
54
+ to: number;
55
+ } | null) => void;
45
56
  /** Editor author, used as the default operation author for AI edits. */
46
57
  author: () => string;
47
58
  /**
@@ -55,6 +66,8 @@ export type UseDocxEditorRefApiOptions = {
55
66
  setComments: (comments: Comment[]) => void;
56
67
  focus: () => void;
57
68
  getDocument: () => Document | null;
69
+ getActiveView: () => EditorView | null;
70
+ closeNoteStory: () => void;
58
71
  getHeaderFooterView: (rId: string) => EditorView | null;
59
72
  setZoom: (zoom: number) => void;
60
73
  /** useDocxEditor.save returns a Blob; the ref surface exposes an ArrayBuffer. */
@@ -0,0 +1,21 @@
1
+ import { Ref } from 'vue';
2
+ import { FontDefinition } from '../components/DocxEditor/types';
3
+ export type UseFontLifecycleOptions = {
4
+ isReady: Ref<boolean>;
5
+ getDocument: () => {
6
+ originalBuffer?: ArrayBuffer | null;
7
+ } | null;
8
+ fonts: () => ReadonlyArray<FontDefinition> | undefined;
9
+ remeasure: () => void;
10
+ };
11
+ export type FontLifecycleDependencies = {
12
+ loadEmbedded: (buffer: ArrayBuffer) => Promise<FontFace[]>;
13
+ loadHost: (fonts: ReadonlyArray<FontDefinition> | undefined) => Promise<FontFace[]>;
14
+ remove: (faces: readonly FontFace[]) => void;
15
+ };
16
+ /**
17
+ * Register document-embedded and host-provided fonts for the lifetime of their
18
+ * sources. Async results from a stale document or prop value are immediately
19
+ * removed, preventing one editor load from leaking faces into the next.
20
+ */
21
+ export declare function useFontLifecycle(options: UseFontLifecycleOptions, dependencies?: FontLifecycleDependencies): void;
@@ -1,6 +1,5 @@
1
1
  import { Ref } from 'vue';
2
2
  export type UseKeyboardShortcutsOptions = {
3
- showKeyboardShortcuts: Ref<boolean>;
4
3
  showFindReplace: Ref<boolean>;
5
4
  showHyperlink: Ref<boolean>;
6
5
  /** From useZoom — handles Ctrl+= / Ctrl+- / Ctrl+0. */
@@ -2,6 +2,7 @@ import { Ref, ShallowRef } from 'vue';
2
2
  import { Command } from 'prosemirror-state';
3
3
  import { EditorView } from 'prosemirror-view';
4
4
  import { Document } from '@stll/folio-core/types/document';
5
+ import { NoteStoryKey } from '@stll/folio-core/controller/noteEditorManager';
5
6
  import { Layout } from '@stll/folio-core/layout-engine';
6
7
  import { ImageSelectionInfo } from '../components/imageSelectionTypes';
7
8
  import { HyperlinkPopupData } from '../components/ui/hyperlinkPopupTypes';
@@ -61,6 +62,10 @@ export type UsePagesPointerOptions = {
61
62
  * callers fall back to in-place mutation + `syncHfPMs()`.
62
63
  */
63
64
  setDocument: (doc: Document) => void;
65
+ /** Open a footnote or endnote story from a painted reference/body. */
66
+ openNoteStory: (story: NoteStoryKey) => void;
67
+ closeNoteStory: () => void;
68
+ getActiveNoteView: () => EditorView | null;
64
69
  };
65
70
  export type UsePagesPointerReturn = {
66
71
  tableInsertButton: Ref<TableInsertButton | null>;
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useFindReplace-ZCrdvwEk.cjs"),t=require("./useZoom-BYEcnpS0.cjs");let n=require("vue"),r=require("prosemirror-history"),i=require("@stll/folio-core/utils/clipboard"),a=require("@stll/folio-core/managers/ClipboardManager"),o=require("@stll/folio-core/managers/TableSelectionManager"),s=require("@stll/folio-core/prosemirror/utils/visualLineNavigation"),c=require("@stll/folio-core/prosemirror/utils/extractTrackedChanges");function l(e={}){let{onCopy:t,onCut:r,onPaste:a,cleanWordFormatting:o=!0,editable:s=!0,onError:c}=e,l=(0,n.ref)(!1),u=(0,n.ref)(null),d=c?{onError:c}:{};async function f(e){if(l.value)return!1;l.value=!0;try{let n=await(0,i.copyRuns)(e.runs,d);return n&&t?.(e),n}finally{l.value=!1}}async function p(e){if(l.value||!s)return!1;l.value=!0;try{let t=await(0,i.copyRuns)(e.runs,d);return t&&r?.(e),t}finally{l.value=!1}}async function m(e=!1){if(l.value||!s)return null;l.value=!0;try{if(navigator.clipboard&&navigator.clipboard.read){let t=await navigator.clipboard.read(),n=``,r=``;for(let e of t)e.types.includes(`text/html`)&&(n=await(await e.getType(`text/html`)).text()),e.types.includes(`text/plain`)&&(r=await(await e.getType(`text/plain`)).text());e&&(n=``);let s=(0,i.parseClipboardHtml)(n,r,o);return u.value=s,a?.(s,e),s}return null}catch(e){return c?.(e instanceof Error?e:Error(String(e))),null}finally{l.value=!1}}return{copy:f,cut:p,paste:m,isProcessing:l,lastPastedContent:u}}function u({isOpen:e,onClose:t,align:r=`left`}){let i=(0,n.ref)(null),a=(0,n.ref)(null),o=(0,n.ref)({position:`fixed`,top:`0px`,left:`0px`,zIndex:1e4});function s(e,t){o.value={position:`fixed`,top:e+`px`,left:t+`px`,zIndex:1e4}}function c(e){let n=e.target;n instanceof Node&&i.value&&!i.value.contains(n)&&a.value&&!a.value.contains(n)&&t()}function l(e){e.key===`Escape`&&t()}function u(e){let n=e.target;n instanceof Node&&a.value&&a.value.contains(n)||t()}function d(){document.addEventListener(`mousedown`,c),document.addEventListener(`keydown`,l),window.addEventListener(`scroll`,u,!0)}function f(){document.removeEventListener(`mousedown`,c),document.removeEventListener(`keydown`,l),window.removeEventListener(`scroll`,u,!0)}(0,n.watch)(e,e=>{if(!e){f();return}let t=i.value;if(!t)return;let n=t.getBoundingClientRect();r===`right`?requestAnimationFrame(()=>{let e=a.value;if(e){let t=e.getBoundingClientRect();s(n.bottom+4,n.right-t.width)}else s(n.bottom+4,n.left)}):s(n.bottom+4,n.left),d()}),(0,n.onScopeDispose)(f);function p(e){e.preventDefault(),e.stopPropagation()}return{containerRef:i,dropdownRef:a,dropdownStyle:o,handleMouseDown:p}}function d(e,t){let i=(0,n.computed)(()=>{t.value;let n=e.value;return n?(0,r.undoDepth)(n.state)>0:!1}),a=(0,n.computed)(()=>{t.value;let n=e.value;return n?(0,r.redoDepth)(n.state)>0:!1});function o(){let t=e.value;return t?(0,r.undo)(t.state,t.dispatch):!1}function s(){let t=e.value;return t?(0,r.redo)(t.state,t.dispatch):!1}return{canUndo:i,canRedo:a,undo:o,redo:s}}var f={backgroundColor:`rgba(26, 115, 232, 0.3)`,borderRadius:0,zIndex:0,opacity:1,mixBlendMode:`multiply`};function p(e){let t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return[];let n=t.getRangeAt(0);if(e&&!e.contains(n.commonAncestorContainer))return[];let r=0,i=0;if(e){let t=e.getBoundingClientRect();r=t.left+e.scrollLeft,i=t.top+e.scrollTop}let a=[];for(let e of n.getClientRects())e.width===0&&e.height===0||a.push({left:e.left-r,top:e.top-i,width:e.width,height:e.height});return a}function m(e,t=2){if(e.length<=1)return e;let n=[...e].sort((e,n)=>Math.abs(e.top-n.top)<t?e.left-n.left:e.top-n.top),r=n[0];if(!r)return e;let i=[],a={...r};for(let e=1;e<n.length;e++){let r=n[e];if(!r)continue;let o=Math.abs(r.top-a.top)<t,s=r.left<=a.left+a.width+t;if(o&&s){let e=Math.max(a.left+a.width,r.left+r.width);a.width=e-a.left,a.height=Math.max(a.height,r.height)}else i.push(a),a={...r}}return i.push(a),i}function h(e){return m(p(e))}function g(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function _(e){let t=window.getSelection();return!t||t.rangeCount===0?!1:e.contains(t.getRangeAt(0).commonAncestorContainer)}var v=`docx-selection-styles`,y=null;function b(){y&&=(y.remove(),null),document.getElementById(v)?.remove()}function x(e=f){b();let t=`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useFindReplace-ZCrdvwEk.cjs"),t=require("./useZoom-DBbzwfMG.cjs");let n=require("vue"),r=require("prosemirror-history"),i=require("@stll/folio-core/utils/clipboard"),a=require("@stll/folio-core/managers/ClipboardManager"),o=require("@stll/folio-core/managers/TableSelectionManager"),s=require("@stll/folio-core/prosemirror/utils/visualLineNavigation"),c=require("@stll/folio-core/prosemirror/utils/extractTrackedChanges");function l(e={}){let{onCopy:t,onCut:r,onPaste:a,cleanWordFormatting:o=!0,editable:s=!0,onError:c}=e,l=(0,n.ref)(!1),u=(0,n.ref)(null),d=c?{onError:c}:{};async function f(e){if(l.value)return!1;l.value=!0;try{let n=await(0,i.copyRuns)(e.runs,d);return n&&t?.(e),n}finally{l.value=!1}}async function p(e){if(l.value||!s)return!1;l.value=!0;try{let t=await(0,i.copyRuns)(e.runs,d);return t&&r?.(e),t}finally{l.value=!1}}async function m(e=!1){if(l.value||!s)return null;l.value=!0;try{if(navigator.clipboard&&navigator.clipboard.read){let t=await navigator.clipboard.read(),n=``,r=``;for(let e of t)e.types.includes(`text/html`)&&(n=await(await e.getType(`text/html`)).text()),e.types.includes(`text/plain`)&&(r=await(await e.getType(`text/plain`)).text());e&&(n=``);let s=(0,i.parseClipboardHtml)(n,r,o);return u.value=s,a?.(s,e),s}return null}catch(e){return c?.(e instanceof Error?e:Error(String(e))),null}finally{l.value=!1}}return{copy:f,cut:p,paste:m,isProcessing:l,lastPastedContent:u}}function u({isOpen:e,onClose:t,align:r=`left`}){let i=(0,n.ref)(null),a=(0,n.ref)(null),o=(0,n.ref)({position:`fixed`,top:`0px`,left:`0px`,zIndex:1e4});function s(e,t){o.value={position:`fixed`,top:e+`px`,left:t+`px`,zIndex:1e4}}function c(e){let n=e.target;n instanceof Node&&i.value&&!i.value.contains(n)&&a.value&&!a.value.contains(n)&&t()}function l(e){e.key===`Escape`&&t()}function u(e){let n=e.target;n instanceof Node&&a.value&&a.value.contains(n)||t()}function d(){document.addEventListener(`mousedown`,c),document.addEventListener(`keydown`,l),window.addEventListener(`scroll`,u,!0)}function f(){document.removeEventListener(`mousedown`,c),document.removeEventListener(`keydown`,l),window.removeEventListener(`scroll`,u,!0)}(0,n.watch)(e,e=>{if(!e){f();return}let t=i.value;if(!t)return;let n=t.getBoundingClientRect();r===`right`?requestAnimationFrame(()=>{let e=a.value;if(e){let t=e.getBoundingClientRect();s(n.bottom+4,n.right-t.width)}else s(n.bottom+4,n.left)}):s(n.bottom+4,n.left),d()}),(0,n.onScopeDispose)(f);function p(e){e.preventDefault(),e.stopPropagation()}return{containerRef:i,dropdownRef:a,dropdownStyle:o,handleMouseDown:p}}function d(e,t){let i=(0,n.computed)(()=>{t.value;let n=e.value;return n?(0,r.undoDepth)(n.state)>0:!1}),a=(0,n.computed)(()=>{t.value;let n=e.value;return n?(0,r.redoDepth)(n.state)>0:!1});function o(){let t=e.value;return t?(0,r.undo)(t.state,t.dispatch):!1}function s(){let t=e.value;return t?(0,r.redo)(t.state,t.dispatch):!1}return{canUndo:i,canRedo:a,undo:o,redo:s}}var f={backgroundColor:`rgba(26, 115, 232, 0.3)`,borderRadius:0,zIndex:0,opacity:1,mixBlendMode:`multiply`};function p(e){let t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return[];let n=t.getRangeAt(0);if(e&&!e.contains(n.commonAncestorContainer))return[];let r=0,i=0;if(e){let t=e.getBoundingClientRect();r=t.left+e.scrollLeft,i=t.top+e.scrollTop}let a=[];for(let e of n.getClientRects())e.width===0&&e.height===0||a.push({left:e.left-r,top:e.top-i,width:e.width,height:e.height});return a}function m(e,t=2){if(e.length<=1)return e;let n=[...e].sort((e,n)=>Math.abs(e.top-n.top)<t?e.left-n.left:e.top-n.top),r=n[0];if(!r)return e;let i=[],a={...r};for(let e=1;e<n.length;e++){let r=n[e];if(!r)continue;let o=Math.abs(r.top-a.top)<t,s=r.left<=a.left+a.width+t;if(o&&s){let e=Math.max(a.left+a.width,r.left+r.width);a.width=e-a.left,a.height=Math.max(a.height,r.height)}else i.push(a),a={...r}}return i.push(a),i}function h(e){return m(p(e))}function g(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function _(e){let t=window.getSelection();return!t||t.rangeCount===0?!1:e.contains(t.getRangeAt(0).commonAncestorContainer)}var v=`docx-selection-styles`,y=null;function b(){y&&=(y.remove(),null),document.getElementById(v)?.remove()}function x(e=f){b();let t=`
2
2
  /* DOCX Editor Selection Highlighting */
3
3
 
4
4
  .docx-editor [contenteditable="true"]::selection,
@@ -58,4 +58,4 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
58
58
  background-color: rgba(156, 39, 176, 0.2);
59
59
  border-bottom: 2px dashed rgba(156, 39, 176, 0.6);
60
60
  }
61
- `;y=document.createElement(`style`),y.id=v,y.textContent=t,document.head.appendChild(y)}function S(){return y!==null||document.getElementById(v)!==null}function C(){return window.getSelection()?.toString()??``}function w(e){let{containerRef:t,enabled:r=!0,config:i=f,useOverlay:a=!1,debounceMs:o=16,onSelectionChange:s}=e,c=(0,n.ref)(!1),l=(0,n.ref)(``),u=(0,n.ref)([]),d=(0,n.ref)(!1),p=null,m=0;function v(){let e=t.value,n=g(),r=C(),i=e?_(e):!1;c.value=n,l.value=r,d.value=i,u.value=a&&i&&e?h(e):[],s?.(n&&i,r)}function y(){v()}function b(){let e=performance.now();if(e-m<o){p&&clearTimeout(p),p=setTimeout(()=>{m=performance.now(),v(),p=null},o);return}m=e,v()}function w(e){let t={position:`absolute`,left:`${e.left}px`,top:`${e.top}px`,width:`${e.width}px`,height:`${e.height}px`,backgroundColor:i.backgroundColor,zIndex:i.zIndex??0,pointerEvents:`none`};return i.borderRadius&&(t.borderRadius=`${i.borderRadius}px`),i.borderColor&&(t.border=`1px solid ${i.borderColor}`),t}return(0,n.onMounted)(()=>{r&&(S()||x(i),document.addEventListener(`selectionchange`,b))}),(0,n.onBeforeUnmount)(()=>{document.removeEventListener(`selectionchange`,b),p&&clearTimeout(p)}),(0,n.watch)(t,()=>v()),{hasSelection:(0,n.computed)(()=>c.value),selectedText:(0,n.computed)(()=>l.value),highlightRects:(0,n.computed)(()=>u.value),isSelectionInContainer:(0,n.computed)(()=>d.value),refresh:y,getOverlayStyle:w}}function T(){let e=new o.TableSelectionManager,t=(0,n.ref)(null),r=()=>{let n=e.getSnapshot();t.value=n.tableIndex!==null&&n.rowIndex!==null&&n.columnIndex!==null?{tableIndex:n.tableIndex,rowIndex:n.rowIndex,columnIndex:n.columnIndex}:null},i=e.subscribe(r);r(),(0,n.onScopeDispose)(i);function a(t,n,r){e.selectCellCoordinates({tableIndex:t,rowIndex:n,columnIndex:r})}function s(t,n){let r=(0,o.findTableFromClick)(t,n);if(!r){e.clearSelection();return}e.selectCellCoordinates(r)}function c(){e.clearSelection()}function l(t,n,r){return e.isCellSelected(t,n,r)}return{selectedCell:t,handleCellClick:a,handleClickTarget:s,clearSelection:c,isCellSelected:l}}function E(e){let t=(0,s.createVisualLineState)();function n(t){let n=e.value;return n?(0,s.getCaretClientX)(n,t):null}function r(t){let n=e.value;return n?(0,s.findLineElementAtPosition)(n,t):null}function i(e,t){return(0,s.findPositionOnLineAtClientX)(e,t)}function a(n,r){return(0,s.handleVisualLineKeyDown)(t,n,r,e.value)}return{state:t,getCaretClientX:n,findLineElementAtPosition:r,findPositionOnLineAtClientX:i,handlePMKeyDown:a}}exports.createSelectionFromDOM=a.createSelectionFromDOM,exports.extractTrackedChanges=c.extractTrackedChanges,exports.getSelectionRuns=a.getSelectionRuns,exports.runsToClipboardContent=i.runsToClipboardContent,exports.useClipboard=l,exports.useDocxEditor=t.a,exports.useDragAutoScroll=t.i,exports.useFindReplace=e.t,exports.useFixedDropdown=u,exports.useHistory=d,exports.useSelectionHighlight=w,exports.useTableResize=t.r,exports.useTableSelection=T,exports.useTrackedChanges=t.n,exports.useVisualLineNavigation=E,exports.useWheelZoom=t.t,exports.useZoom=t.t;
61
+ `;y=document.createElement(`style`),y.id=v,y.textContent=t,document.head.appendChild(y)}function S(){return y!==null||document.getElementById(v)!==null}function C(){return window.getSelection()?.toString()??``}function w(e){let{containerRef:t,enabled:r=!0,config:i=f,useOverlay:a=!1,debounceMs:o=16,onSelectionChange:s}=e,c=(0,n.ref)(!1),l=(0,n.ref)(``),u=(0,n.ref)([]),d=(0,n.ref)(!1),p=null,m=0;function v(){let e=t.value,n=g(),r=C(),i=e?_(e):!1;c.value=n,l.value=r,d.value=i,u.value=a&&i&&e?h(e):[],s?.(n&&i,r)}function y(){v()}function b(){let e=performance.now();if(e-m<o){p&&clearTimeout(p),p=setTimeout(()=>{m=performance.now(),v(),p=null},o);return}m=e,v()}function w(e){let t={position:`absolute`,left:`${e.left}px`,top:`${e.top}px`,width:`${e.width}px`,height:`${e.height}px`,backgroundColor:i.backgroundColor,zIndex:i.zIndex??0,pointerEvents:`none`};return i.borderRadius&&(t.borderRadius=`${i.borderRadius}px`),i.borderColor&&(t.border=`1px solid ${i.borderColor}`),t}return(0,n.onMounted)(()=>{r&&(S()||x(i),document.addEventListener(`selectionchange`,b))}),(0,n.onBeforeUnmount)(()=>{document.removeEventListener(`selectionchange`,b),p&&clearTimeout(p)}),(0,n.watch)(t,()=>v()),{hasSelection:(0,n.computed)(()=>c.value),selectedText:(0,n.computed)(()=>l.value),highlightRects:(0,n.computed)(()=>u.value),isSelectionInContainer:(0,n.computed)(()=>d.value),refresh:y,getOverlayStyle:w}}function T(){let e=new o.TableSelectionManager,t=(0,n.ref)(null),r=()=>{let n=e.getSnapshot();t.value=n.tableIndex!==null&&n.rowIndex!==null&&n.columnIndex!==null?{tableIndex:n.tableIndex,rowIndex:n.rowIndex,columnIndex:n.columnIndex}:null},i=e.subscribe(r);r(),(0,n.onScopeDispose)(i);function a(t,n,r){e.selectCellCoordinates({tableIndex:t,rowIndex:n,columnIndex:r})}function s(t,n){let r=(0,o.findTableFromClick)(t,n);if(!r){e.clearSelection();return}e.selectCellCoordinates(r)}function c(){e.clearSelection()}function l(t,n,r){return e.isCellSelected(t,n,r)}return{selectedCell:t,handleCellClick:a,handleClickTarget:s,clearSelection:c,isCellSelected:l}}function E(e){let t=(0,s.createVisualLineState)();function n(t){let n=e.value;return n?(0,s.getCaretClientX)(n,t):null}function r(t){let n=e.value;return n?(0,s.findLineElementAtPosition)(n,t):null}function i(e,t){return(0,s.findPositionOnLineAtClientX)(e,t)}function a(n,r){return(0,s.handleVisualLineKeyDown)(t,n,r,e.value)}return{state:t,getCaretClientX:n,findLineElementAtPosition:r,findPositionOnLineAtClientX:i,handlePMKeyDown:a}}exports.colorModePlugin=t.o,exports.createSelectionFromDOM=a.createSelectionFromDOM,exports.defaultColorMode=t.s,exports.extractTrackedChanges=c.extractTrackedChanges,exports.getSelectionRuns=a.getSelectionRuns,exports.provideColorMode=t.c,exports.runsToClipboardContent=i.runsToClipboardContent,exports.useClipboard=l,exports.useColorMode=t.l,exports.useDocxEditor=t.a,exports.useDragAutoScroll=t.i,exports.useFindReplace=e.t,exports.useFixedDropdown=u,exports.useHistory=d,exports.useSelectionHighlight=w,exports.useTableResize=t.r,exports.useTableSelection=T,exports.useTrackedChanges=t.n,exports.useVisualLineNavigation=E,exports.useWheelZoom=t.t,exports.useZoom=t.t;
@@ -1,35 +1,35 @@
1
1
  import { t as e } from "./useFindReplace-CL8Rbc3y.js";
2
- import { a as t, i as n, n as r, o as i, r as a, t as o } from "./useZoom-C0p0o54p.js";
3
- import { computed as s, onBeforeUnmount as c, onMounted as l, onScopeDispose as u, ref as d, watch as f } from "vue";
4
- import { redo as p, redoDepth as m, undo as h, undoDepth as g } from "prosemirror-history";
5
- import { copyRuns as _, parseClipboardHtml as v, runsToClipboardContent as y } from "@stll/folio-core/utils/clipboard";
6
- import { createSelectionFromDOM as b, getSelectionRuns as x } from "@stll/folio-core/managers/ClipboardManager";
7
- import { TableSelectionManager as S, findTableFromClick as C } from "@stll/folio-core/managers/TableSelectionManager";
8
- import { createVisualLineState as w, findLineElementAtPosition as T, findPositionOnLineAtClientX as E, getCaretClientX as D, handleVisualLineKeyDown as O } from "@stll/folio-core/prosemirror/utils/visualLineNavigation";
2
+ import { a as t, c as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./useZoom-DwDDS7hq.js";
3
+ import { computed as d, onBeforeUnmount as f, onMounted as p, onScopeDispose as m, ref as h, watch as g } from "vue";
4
+ import { redo as _, redoDepth as v, undo as y, undoDepth as b } from "prosemirror-history";
5
+ import { copyRuns as x, parseClipboardHtml as S, runsToClipboardContent as C } from "@stll/folio-core/utils/clipboard";
6
+ import { createSelectionFromDOM as w, getSelectionRuns as T } from "@stll/folio-core/managers/ClipboardManager";
7
+ import { TableSelectionManager as E, findTableFromClick as D } from "@stll/folio-core/managers/TableSelectionManager";
8
+ import { createVisualLineState as O, findLineElementAtPosition as k, findPositionOnLineAtClientX as A, getCaretClientX as j, handleVisualLineKeyDown as M } from "@stll/folio-core/prosemirror/utils/visualLineNavigation";
9
9
  //#region src/composables/useClipboard.ts
10
- function k(e = {}) {
11
- let { onCopy: t, onCut: n, onPaste: r, cleanWordFormatting: i = !0, editable: a = !0, onError: o } = e, s = d(!1), c = d(null), l = o ? { onError: o } : {};
10
+ function N(e = {}) {
11
+ let { onCopy: t, onCut: n, onPaste: r, cleanWordFormatting: i = !0, editable: a = !0, onError: o } = e, s = h(!1), c = h(null), l = o ? { onError: o } : {};
12
12
  async function u(e) {
13
13
  if (s.value) return !1;
14
14
  s.value = !0;
15
15
  try {
16
- let n = await _(e.runs, l);
16
+ let n = await x(e.runs, l);
17
17
  return n && t?.(e), n;
18
18
  } finally {
19
19
  s.value = !1;
20
20
  }
21
21
  }
22
- async function f(e) {
22
+ async function d(e) {
23
23
  if (s.value || !a) return !1;
24
24
  s.value = !0;
25
25
  try {
26
- let t = await _(e.runs, l);
26
+ let t = await x(e.runs, l);
27
27
  return t && n?.(e), t;
28
28
  } finally {
29
29
  s.value = !1;
30
30
  }
31
31
  }
32
- async function p(e = !1) {
32
+ async function f(e = !1) {
33
33
  if (s.value || !a) return null;
34
34
  s.value = !0;
35
35
  try {
@@ -37,7 +37,7 @@ function k(e = {}) {
37
37
  let t = await navigator.clipboard.read(), n = "", a = "";
38
38
  for (let e of t) e.types.includes("text/html") && (n = await (await e.getType("text/html")).text()), e.types.includes("text/plain") && (a = await (await e.getType("text/plain")).text());
39
39
  e && (n = "");
40
- let o = v(n, a, i);
40
+ let o = S(n, a, i);
41
41
  return c.value = o, r?.(o, e), o;
42
42
  }
43
43
  return null;
@@ -49,16 +49,16 @@ function k(e = {}) {
49
49
  }
50
50
  return {
51
51
  copy: u,
52
- cut: f,
53
- paste: p,
52
+ cut: d,
53
+ paste: f,
54
54
  isProcessing: s,
55
55
  lastPastedContent: c
56
56
  };
57
57
  }
58
58
  //#endregion
59
59
  //#region src/composables/useFixedDropdown.ts
60
- function A({ isOpen: e, onClose: t, align: n = "left" }) {
61
- let r = d(null), i = d(null), a = d({
60
+ function P({ isOpen: e, onClose: t, align: n = "left" }) {
61
+ let r = h(null), i = h(null), a = h({
62
62
  position: "fixed",
63
63
  top: "0px",
64
64
  left: "0px",
@@ -83,15 +83,15 @@ function A({ isOpen: e, onClose: t, align: n = "left" }) {
83
83
  let n = e.target;
84
84
  n instanceof Node && i.value && i.value.contains(n) || t();
85
85
  }
86
- function p() {
86
+ function u() {
87
87
  document.addEventListener("mousedown", s), document.addEventListener("keydown", c), window.addEventListener("scroll", l, !0);
88
88
  }
89
- function m() {
89
+ function d() {
90
90
  document.removeEventListener("mousedown", s), document.removeEventListener("keydown", c), window.removeEventListener("scroll", l, !0);
91
91
  }
92
- f(e, (e) => {
92
+ g(e, (e) => {
93
93
  if (!e) {
94
- m();
94
+ d();
95
95
  return;
96
96
  }
97
97
  let t = r.value;
@@ -103,37 +103,37 @@ function A({ isOpen: e, onClose: t, align: n = "left" }) {
103
103
  let t = e.getBoundingClientRect();
104
104
  o(a.bottom + 4, a.right - t.width);
105
105
  } else o(a.bottom + 4, a.left);
106
- }) : o(a.bottom + 4, a.left), p();
107
- }), u(m);
108
- function h(e) {
106
+ }) : o(a.bottom + 4, a.left), u();
107
+ }), m(d);
108
+ function f(e) {
109
109
  e.preventDefault(), e.stopPropagation();
110
110
  }
111
111
  return {
112
112
  containerRef: r,
113
113
  dropdownRef: i,
114
114
  dropdownStyle: a,
115
- handleMouseDown: h
115
+ handleMouseDown: f
116
116
  };
117
117
  }
118
118
  //#endregion
119
119
  //#region src/composables/useHistory.ts
120
- function j(e, t) {
121
- let n = s(() => {
120
+ function F(e, t) {
121
+ let n = d(() => {
122
122
  t.value;
123
123
  let n = e.value;
124
- return n ? g(n.state) > 0 : !1;
125
- }), r = s(() => {
124
+ return n ? b(n.state) > 0 : !1;
125
+ }), r = d(() => {
126
126
  t.value;
127
127
  let n = e.value;
128
- return n ? m(n.state) > 0 : !1;
128
+ return n ? v(n.state) > 0 : !1;
129
129
  });
130
130
  function i() {
131
131
  let t = e.value;
132
- return t ? h(t.state, t.dispatch) : !1;
132
+ return t ? y(t.state, t.dispatch) : !1;
133
133
  }
134
134
  function a() {
135
135
  let t = e.value;
136
- return t ? p(t.state, t.dispatch) : !1;
136
+ return t ? _(t.state, t.dispatch) : !1;
137
137
  }
138
138
  return {
139
139
  canUndo: n,
@@ -144,14 +144,14 @@ function j(e, t) {
144
144
  }
145
145
  //#endregion
146
146
  //#region src/utils/selectionHighlight.ts
147
- var M = {
147
+ var I = {
148
148
  backgroundColor: "rgba(26, 115, 232, 0.3)",
149
149
  borderRadius: 0,
150
150
  zIndex: 0,
151
151
  opacity: 1,
152
152
  mixBlendMode: "multiply"
153
153
  };
154
- function N(e) {
154
+ function L(e) {
155
155
  let t = window.getSelection();
156
156
  if (!t || t.rangeCount === 0 || t.isCollapsed) return [];
157
157
  let n = t.getRangeAt(0);
@@ -170,7 +170,7 @@ function N(e) {
170
170
  });
171
171
  return a;
172
172
  }
173
- function P(e, t = 2) {
173
+ function R(e, t = 2) {
174
174
  if (e.length <= 1) return e;
175
175
  let n = [...e].sort((e, n) => Math.abs(e.top - n.top) < t ? e.left - n.left : e.top - n.top), r = n[0];
176
176
  if (!r) return e;
@@ -186,23 +186,23 @@ function P(e, t = 2) {
186
186
  }
187
187
  return i.push(a), i;
188
188
  }
189
- function F(e) {
190
- return P(N(e));
189
+ function z(e) {
190
+ return R(L(e));
191
191
  }
192
- function I() {
192
+ function B() {
193
193
  let e = window.getSelection();
194
194
  return e !== null && !e.isCollapsed && e.rangeCount > 0;
195
195
  }
196
- function L(e) {
196
+ function V(e) {
197
197
  let t = window.getSelection();
198
198
  return !t || t.rangeCount === 0 ? !1 : e.contains(t.getRangeAt(0).commonAncestorContainer);
199
199
  }
200
- var R = "docx-selection-styles", z = null;
201
- function B() {
202
- z &&= (z.remove(), null), document.getElementById(R)?.remove();
200
+ var H = "docx-selection-styles", U = null;
201
+ function W() {
202
+ U &&= (U.remove(), null), document.getElementById(H)?.remove();
203
203
  }
204
- function V(e = M) {
205
- B();
204
+ function G(e = I) {
205
+ W();
206
206
  let t = `
207
207
  /* DOCX Editor Selection Highlighting */
208
208
 
@@ -264,21 +264,21 @@ function V(e = M) {
264
264
  border-bottom: 2px dashed rgba(156, 39, 176, 0.6);
265
265
  }
266
266
  `;
267
- z = document.createElement("style"), z.id = R, z.textContent = t, document.head.appendChild(z);
267
+ U = document.createElement("style"), U.id = H, U.textContent = t, document.head.appendChild(U);
268
268
  }
269
- function H() {
270
- return z !== null || document.getElementById(R) !== null;
269
+ function K() {
270
+ return U !== null || document.getElementById(H) !== null;
271
271
  }
272
272
  //#endregion
273
273
  //#region src/composables/useSelectionHighlight.ts
274
- function U() {
274
+ function q() {
275
275
  return window.getSelection()?.toString() ?? "";
276
276
  }
277
- function W(e) {
278
- let { containerRef: t, enabled: n = !0, config: r = M, useOverlay: i = !1, debounceMs: a = 16, onSelectionChange: o } = e, u = d(!1), p = d(""), m = d([]), h = d(!1), g = null, _ = 0;
277
+ function J(e) {
278
+ let { containerRef: t, enabled: n = !0, config: r = I, useOverlay: i = !1, debounceMs: a = 16, onSelectionChange: o } = e, s = h(!1), c = h(""), l = h([]), u = h(!1), m = null, _ = 0;
279
279
  function v() {
280
- let e = t.value, n = I(), r = U(), a = e ? L(e) : !1;
281
- u.value = n, p.value = r, h.value = a, m.value = i && a && e ? F(e) : [], o?.(n && a, r);
280
+ let e = t.value, n = B(), r = q(), a = e ? V(e) : !1;
281
+ s.value = n, c.value = r, u.value = a, l.value = i && a && e ? z(e) : [], o?.(n && a, r);
282
282
  }
283
283
  function y() {
284
284
  v();
@@ -286,8 +286,8 @@ function W(e) {
286
286
  function b() {
287
287
  let e = performance.now();
288
288
  if (e - _ < a) {
289
- g && clearTimeout(g), g = setTimeout(() => {
290
- _ = performance.now(), v(), g = null;
289
+ m && clearTimeout(m), m = setTimeout(() => {
290
+ _ = performance.now(), v(), m = null;
291
291
  }, a);
292
292
  return;
293
293
  }
@@ -306,23 +306,23 @@ function W(e) {
306
306
  };
307
307
  return r.borderRadius && (t.borderRadius = `${r.borderRadius}px`), r.borderColor && (t.border = `1px solid ${r.borderColor}`), t;
308
308
  }
309
- return l(() => {
310
- n && (H() || V(r), document.addEventListener("selectionchange", b));
311
- }), c(() => {
312
- document.removeEventListener("selectionchange", b), g && clearTimeout(g);
313
- }), f(t, () => v()), {
314
- hasSelection: s(() => u.value),
315
- selectedText: s(() => p.value),
316
- highlightRects: s(() => m.value),
317
- isSelectionInContainer: s(() => h.value),
309
+ return p(() => {
310
+ n && (K() || G(r), document.addEventListener("selectionchange", b));
311
+ }), f(() => {
312
+ document.removeEventListener("selectionchange", b), m && clearTimeout(m);
313
+ }), g(t, () => v()), {
314
+ hasSelection: d(() => s.value),
315
+ selectedText: d(() => c.value),
316
+ highlightRects: d(() => l.value),
317
+ isSelectionInContainer: d(() => u.value),
318
318
  refresh: y,
319
319
  getOverlayStyle: x
320
320
  };
321
321
  }
322
322
  //#endregion
323
323
  //#region src/composables/useTableSelection.ts
324
- function G() {
325
- let e = new S(), t = d(null), n = () => {
324
+ function Y() {
325
+ let e = new E(), t = h(null), n = () => {
326
326
  let n = e.getSnapshot();
327
327
  t.value = n.tableIndex !== null && n.rowIndex !== null && n.columnIndex !== null ? {
328
328
  tableIndex: n.tableIndex,
@@ -330,7 +330,7 @@ function G() {
330
330
  columnIndex: n.columnIndex
331
331
  } : null;
332
332
  }, r = e.subscribe(n);
333
- n(), u(r);
333
+ n(), m(r);
334
334
  function i(t, n, r) {
335
335
  e.selectCellCoordinates({
336
336
  tableIndex: t,
@@ -339,7 +339,7 @@ function G() {
339
339
  });
340
340
  }
341
341
  function a(t, n) {
342
- let r = C(t, n);
342
+ let r = D(t, n);
343
343
  if (!r) {
344
344
  e.clearSelection();
345
345
  return;
@@ -362,21 +362,21 @@ function G() {
362
362
  }
363
363
  //#endregion
364
364
  //#region src/composables/useVisualLineNavigation.ts
365
- function K(e) {
366
- let t = w();
365
+ function X(e) {
366
+ let t = O();
367
367
  function n(t) {
368
368
  let n = e.value;
369
- return n ? D(n, t) : null;
369
+ return n ? j(n, t) : null;
370
370
  }
371
371
  function r(t) {
372
372
  let n = e.value;
373
- return n ? T(n, t) : null;
373
+ return n ? k(n, t) : null;
374
374
  }
375
375
  function i(e, t) {
376
- return E(e, t);
376
+ return A(e, t);
377
377
  }
378
378
  function a(n, r) {
379
- return O(t, n, r, e.value);
379
+ return M(t, n, r, e.value);
380
380
  }
381
381
  return {
382
382
  state: t,
@@ -387,4 +387,4 @@ function K(e) {
387
387
  };
388
388
  }
389
389
  //#endregion
390
- export { b as createSelectionFromDOM, r as extractTrackedChanges, x as getSelectionRuns, y as runsToClipboardContent, k as useClipboard, i as useDocxEditor, t as useDragAutoScroll, e as useFindReplace, A as useFixedDropdown, j as useHistory, W as useSelectionHighlight, n as useTableResize, G as useTableSelection, a as useTrackedChanges, K as useVisualLineNavigation, o as useWheelZoom, o as useZoom };
390
+ export { c as colorModePlugin, w as createSelectionFromDOM, n as defaultColorMode, a as extractTrackedChanges, T as getSelectionRuns, i as provideColorMode, C as runsToClipboardContent, N as useClipboard, u as useColorMode, o as useDocxEditor, t as useDragAutoScroll, e as useFindReplace, P as useFixedDropdown, F as useHistory, J as useSelectionHighlight, r as useTableResize, Y as useTableSelection, s as useTrackedChanges, X as useVisualLineNavigation, l as useWheelZoom, l as useZoom };