@stll/folio-vue 0.2.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/dist/ListButtons-B498PX1d.js +4256 -0
  2. package/dist/ListButtons-D-zMJ7rl.cjs +4 -0
  3. package/dist/PageSetupDialog-CGBaBVzo.cjs +15 -0
  4. package/dist/PageSetupDialog-DsjAfJy0.js +4873 -0
  5. package/dist/TablePropertiesDialog-A-1Pm1f9.cjs +1 -0
  6. package/dist/TablePropertiesDialog-PyXEJC_o.js +887 -0
  7. package/dist/components/DocxEditor/pagedEditorRef.d.ts +75 -0
  8. package/dist/components/DocxEditor/types.d.ts +528 -0
  9. package/dist/components/EditorToolbarContext.d.ts +9 -0
  10. package/dist/components/FormattingBar.types.d.ts +67 -0
  11. package/dist/components/Toolbar/presets.d.ts +25 -0
  12. package/dist/components/dialogs/index.d.ts +24 -0
  13. package/dist/components/imageContextMenuTypes.d.ts +30 -0
  14. package/dist/components/imageSelectionTypes.d.ts +13 -0
  15. package/dist/components/insertTableState.d.ts +9 -0
  16. package/dist/components/sidebar/cardStyles.d.ts +1 -0
  17. package/dist/components/sidebar/cardUtils.d.ts +1 -0
  18. package/dist/components/sidebar/resolveItemPositions.d.ts +22 -0
  19. package/dist/components/sidebar/sidebarUtils.d.ts +4 -0
  20. package/dist/components/tableStylePresets.d.ts +60 -0
  21. package/dist/components/toolbarUtils.d.ts +3 -0
  22. package/dist/components/ui/AlignmentButtons.types.d.ts +13 -0
  23. package/dist/components/ui/StylePicker.types.d.ts +16 -0
  24. package/dist/components/ui/ZoomControl.types.d.ts +21 -0
  25. package/dist/components/ui/fontPickerValue.d.ts +1 -0
  26. package/dist/components/ui/hyperlinkPopupTypes.d.ts +20 -0
  27. package/dist/composables/commentMarks.d.ts +32 -0
  28. package/dist/composables/imageOverlayRect.d.ts +44 -0
  29. package/dist/composables/index.d.ts +30 -0
  30. package/dist/composables/useAutoSave.d.ts +39 -0
  31. package/dist/composables/useClipboard.d.ts +21 -0
  32. package/dist/composables/useColorMode.d.ts +8 -0
  33. package/dist/composables/useCommentLifecycle.d.ts +39 -0
  34. package/dist/composables/useCommentManagement.d.ts +47 -0
  35. package/dist/composables/useCommentSidebarItems.d.ts +24 -0
  36. package/dist/composables/useContextMenus.d.ts +64 -0
  37. package/dist/composables/useControllableBoolean.d.ts +16 -0
  38. package/dist/composables/useDocumentLifecycle.d.ts +11 -0
  39. package/dist/composables/useDocxEditor.d.ts +123 -0
  40. package/dist/composables/useDocxEditorRefApi.d.ts +68 -0
  41. package/dist/composables/useDragAutoScroll.d.ts +11 -0
  42. package/dist/composables/useFileIO.d.ts +43 -0
  43. package/dist/composables/useFindReplace.d.ts +22 -0
  44. package/dist/composables/useFixedDropdown.d.ts +14 -0
  45. package/dist/composables/useFormattingActions.d.ts +21 -0
  46. package/dist/composables/useHistory.d.ts +9 -0
  47. package/dist/composables/useHostCallbacks.d.ts +24 -0
  48. package/dist/composables/useHyperlinkManagement.d.ts +40 -0
  49. package/dist/composables/useImageActions.d.ts +25 -0
  50. package/dist/composables/useKeyboardShortcuts.d.ts +25 -0
  51. package/dist/composables/useMenuActions.d.ts +36 -0
  52. package/dist/composables/useOutlineSidebar.d.ts +24 -0
  53. package/dist/composables/usePageSetupControls.d.ts +28 -0
  54. package/dist/composables/usePagesPointer.d.ts +87 -0
  55. package/dist/composables/useParagraphStyleOptions.d.ts +18 -0
  56. package/dist/composables/usePortalClass.d.ts +8 -0
  57. package/dist/composables/useSelectionHighlight.d.ts +19 -0
  58. package/dist/composables/useSelectionSync.d.ts +30 -0
  59. package/dist/composables/useTableResize.d.ts +7 -0
  60. package/dist/composables/useTableSelection.d.ts +10 -0
  61. package/dist/composables/useToolbarDropdowns.d.ts +15 -0
  62. package/dist/composables/useToolbarFontSize.d.ts +15 -0
  63. package/dist/composables/useTrackedChanges.d.ts +12 -0
  64. package/dist/composables/useVisualLineNavigation.d.ts +11 -0
  65. package/dist/composables/useWheelZoom.d.ts +10 -0
  66. package/dist/composables/useZoom.d.ts +16 -0
  67. package/dist/composables.cjs +61 -0
  68. package/dist/composables.js +378 -0
  69. package/dist/dialogs.cjs +1 -0
  70. package/dist/dialogs.js +3 -0
  71. package/dist/folio-vue.css +2 -0
  72. package/dist/i18n/index.d.ts +36 -0
  73. package/dist/i18n/messages.d.ts +1 -0
  74. package/dist/index.cjs +1 -0
  75. package/dist/index.d.ts +50 -0
  76. package/dist/index.js +4088 -0
  77. package/dist/messages.cjs +1 -0
  78. package/dist/messages.js +1 -0
  79. package/dist/renderAsync.d.ts +35 -0
  80. package/dist/styles/index.d.ts +12 -0
  81. package/dist/styles/zIndex.d.ts +18 -0
  82. package/dist/styles.cjs +1 -0
  83. package/dist/styles.js +5 -0
  84. package/dist/ui/folio-ui.d.ts +139 -0
  85. package/dist/ui.cjs +1 -0
  86. package/dist/ui.d.ts +67 -0
  87. package/dist/ui.js +446 -0
  88. package/dist/useZoom-BryUw3Cu.cjs +1 -0
  89. package/dist/useZoom-CIIRid8U.js +626 -0
  90. package/dist/utils/aiEditRange.d.ts +26 -0
  91. package/dist/utils/autoScroll.d.ts +22 -0
  92. package/dist/utils/cardStyles.d.ts +3 -0
  93. package/dist/utils/colorMode.d.ts +32 -0
  94. package/dist/utils/comments.d.ts +20 -0
  95. package/dist/utils/cssTypes.d.ts +7 -0
  96. package/dist/utils/domQueries.d.ts +39 -0
  97. package/dist/utils/fontOptions.d.ts +26 -0
  98. package/dist/utils/hostFonts.d.ts +25 -0
  99. package/dist/utils/imageClipboard.d.ts +9 -0
  100. package/dist/utils/index.d.ts +13 -0
  101. package/dist/utils/listState.d.ts +22 -0
  102. package/dist/utils/reportIssue.d.ts +18 -0
  103. package/dist/utils/selectionHighlight.d.ts +44 -0
  104. package/dist/utils/sidebarConstants.d.ts +8 -0
  105. package/dist/utils/stylePreview.d.ts +53 -0
  106. package/dist/utils/textSelection.d.ts +40 -0
  107. package/dist/zIndex-BY0qa8Au.js +12 -0
  108. package/dist/zIndex-dFsQbASx.cjs +1 -0
  109. package/package.json +99 -0
@@ -0,0 +1,18 @@
1
+ import { ComputedRef } from 'vue';
2
+ import { StylePreviewProps } from '../utils/stylePreview';
3
+ import { Style } from '@stll/folio-core/types/document';
4
+ import { TranslationKey } from '../components/Toolbar/presets';
5
+ export type ResolvedStyle = {
6
+ id: string;
7
+ label: string;
8
+ previewStyle: StylePreviewProps;
9
+ };
10
+ export type UseParagraphStyleOptionsReturn = {
11
+ resolvedParagraphStyles: ComputedRef<ResolvedStyle[]>;
12
+ currentStyleLabel: ComputedRef<string>;
13
+ };
14
+ export declare function useParagraphStyleOptions(opts: {
15
+ documentStyles: () => Style[] | undefined;
16
+ currentStyleId: () => string;
17
+ t: (key: TranslationKey) => string;
18
+ }): UseParagraphStyleOptionsReturn;
@@ -0,0 +1,8 @@
1
+ import { ComputedRef, MaybeRef } from 'vue';
2
+ export declare function provideDocxPortalClass(isDark: MaybeRef<boolean>): void;
3
+ /**
4
+ * Class binding to apply to a teleported root so it inherits the editor's
5
+ * `--doc-*` tokens and theme. Falls back to a light `.ep-root` when used
6
+ * outside a provider (e.g. an isolated component test).
7
+ */
8
+ export declare function useDocxPortalClass(): ComputedRef<Record<string, boolean>>;
@@ -0,0 +1,19 @@
1
+ import { Ref, ComputedRef, CSSProperties } from 'vue';
2
+ import { HighlightRect, SelectionHighlightConfig } from '../utils/selectionHighlight';
3
+ export type UseSelectionHighlightOptions = {
4
+ containerRef: Ref<HTMLElement | null>;
5
+ enabled?: boolean;
6
+ config?: SelectionHighlightConfig;
7
+ useOverlay?: boolean;
8
+ debounceMs?: number;
9
+ onSelectionChange?: (hasSelection: boolean, text: string) => void;
10
+ };
11
+ export type UseSelectionHighlightReturn = {
12
+ hasSelection: ComputedRef<boolean>;
13
+ selectedText: ComputedRef<string>;
14
+ highlightRects: ComputedRef<HighlightRect[]>;
15
+ isSelectionInContainer: ComputedRef<boolean>;
16
+ refresh: () => void;
17
+ getOverlayStyle: (rect: HighlightRect) => CSSProperties;
18
+ };
19
+ export declare function useSelectionHighlight(options: UseSelectionHighlightOptions): UseSelectionHighlightReturn;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Selection-overlay composable — owns the text-caret blink + selection-rect
3
+ * painter, the cell-selection highlight, and the image-selection sync that
4
+ * re-derives `selectedImage` from the live PM NodeSelection.
5
+ *
6
+ * PORT-BLOCKED (multiple absent dependencies):
7
+ * - `applyCellSelectionHighlight` — absent from our core. Upstream ships it in
8
+ * `layout-bridge/cellSelectionHighlight.ts`; our `layout-bridge` barrel does
9
+ * not expose it (see CORE-API-MAP Table 4, PORT). The multi-cell highlight
10
+ * branch cannot run without it.
11
+ * - `findImageElement` — absent from our core `layout-painter` barrel (which
12
+ * exposes only `renderPages`/`LayoutPainter`/registry); it is a PORT item.
13
+ * The image-overlay sync (`syncSelectedImageToSelection`) depends on it.
14
+ * - `../components/imageSelectionTypes` (`ImageSelectionInfo`) — the Vue-package
15
+ * image-selection type module has not been ported.
16
+ * - `../styles/zIndex` (`Z_INDEX`) — the Vue-package z-index token module does
17
+ * not exist in our fork (there is no `styles/` dir).
18
+ *
19
+ * The DOM primitives it also uses DO resolve, but at drifted paths
20
+ * (`getSelectionRectsFromDom`/`getCaretPositionFromDom` →
21
+ * `@stll/folio-core/layout-bridge/dom/clickToPositionDom`; `findBodyPmAnchor` →
22
+ * `@stll/folio-core/layout-bridge/dom/findBodyPmSpans`). With the four blockers
23
+ * above there is no coherent working subset, so the whole composable is blocked.
24
+ *
25
+ * Unblock: PORT `applyCellSelectionHighlight` and `findImageElement` into core
26
+ * (or a core barrel), then port the `imageSelectionTypes` + `styles/zIndex`
27
+ * Vue-package modules, and re-point the DOM-primitive imports to the drifted
28
+ * paths above.
29
+ */
30
+ export {};
@@ -0,0 +1,7 @@
1
+ import { EditorView } from 'prosemirror-view';
2
+ export type UseTableResizeReturn = {
3
+ tryStartResize: (e: MouseEvent, view: EditorView) => boolean;
4
+ install: () => () => void;
5
+ isResizing: () => boolean;
6
+ };
7
+ export declare function useTableResize(): UseTableResizeReturn;
@@ -0,0 +1,10 @@
1
+ import { Ref } from 'vue';
2
+ import { CellCoordinates } from '@stll/folio-core/managers/types';
3
+ export type UseTableSelectionReturn = {
4
+ selectedCell: Ref<CellCoordinates | null>;
5
+ handleCellClick: (tableIndex: number, rowIndex: number, columnIndex: number) => void;
6
+ handleClickTarget: (target: EventTarget | null, container?: HTMLElement | null) => void;
7
+ clearSelection: () => void;
8
+ isCellSelected: (tableIndex: number, rowIndex: number, columnIndex: number) => boolean;
9
+ };
10
+ export declare function useTableSelection(): UseTableSelectionReturn;
@@ -0,0 +1,15 @@
1
+ import { Ref, CSSProperties } from 'vue';
2
+ export type UseToolbarDropdownsOptions = {
3
+ zoom: Ref<HTMLElement | null>;
4
+ style: Ref<HTMLElement | null>;
5
+ font: Ref<HTMLElement | null>;
6
+ size: Ref<HTMLElement | null>;
7
+ align: Ref<HTMLElement | null>;
8
+ spacing: Ref<HTMLElement | null>;
9
+ };
10
+ export declare function useToolbarDropdowns(refs: UseToolbarDropdownsOptions): {
11
+ openDropdown: Ref<string | null, string | null>;
12
+ dropdownMenuStyle: import('vue').ComputedRef<CSSProperties>;
13
+ toggleDropdown: (name: string) => void;
14
+ recomputeDropdownPos: (name: string) => void;
15
+ };
@@ -0,0 +1,15 @@
1
+ import { Ref, ComputedRef } from 'vue';
2
+ export type UseToolbarFontSizeReturn = {
3
+ onSizeFocus: () => void;
4
+ onSizeInput: () => void;
5
+ commitFontSize: (e: Event) => void;
6
+ pickFontSize: (size: number) => void;
7
+ increaseFontSize: () => void;
8
+ decreaseFontSize: () => void;
9
+ };
10
+ export declare function useToolbarFontSize(opts: {
11
+ currentFontSize: ComputedRef<number>;
12
+ openDropdown: Ref<string | null>;
13
+ recomputeDropdownPos: (name: string) => void;
14
+ execCommand: (name: string, ...args: unknown[]) => void;
15
+ }): UseToolbarFontSizeReturn;
@@ -0,0 +1,12 @@
1
+ import { Ref } from 'vue';
2
+ import { EditorView } from 'prosemirror-view';
3
+ import { extractTrackedChanges, TrackedChangesResult } from '@stll/folio-core/prosemirror/utils/extractTrackedChanges';
4
+ export type { TrackedChangesResult };
5
+ export { extractTrackedChanges };
6
+ export type { TrackedChangeEntry } from '../utils/comments';
7
+ /**
8
+ * Pass the editor view ref + a stateTick that bumps on every PM
9
+ * transaction (the same tick the Toolbar listens to). The computed
10
+ * re-runs whenever the tick advances.
11
+ */
12
+ export declare function useTrackedChanges(view: Ref<EditorView | null>, stateTick: Ref<number>): import('vue').ComputedRef<TrackedChangesResult>;
@@ -0,0 +1,11 @@
1
+ import { Ref } from 'vue';
2
+ import { createVisualLineState } from '@stll/folio-core/prosemirror/utils/visualLineNavigation';
3
+ import { EditorView } from 'prosemirror-view';
4
+ export type UseVisualLineNavigationReturn = {
5
+ state: ReturnType<typeof createVisualLineState>;
6
+ getCaretClientX: (pmPos: number) => number | null;
7
+ findLineElementAtPosition: (pmPos: number) => HTMLElement | null;
8
+ findPositionOnLineAtClientX: (line: HTMLElement, clientX: number) => number | null;
9
+ handlePMKeyDown: (view: EditorView, event: KeyboardEvent) => boolean;
10
+ };
11
+ export declare function useVisualLineNavigation(pagesContainer: Ref<HTMLElement | null>): UseVisualLineNavigationReturn;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Alias for cross-adapter parity — the React adapter has
3
+ * `useWheelZoom.ts` (Ctrl+wheel zoom + Ctrl+= / Ctrl+- / Ctrl+0
4
+ * shortcuts). Vue rolls the same behaviour into `useZoom`, which
5
+ * already exposes `handleWheel` and `installShortcuts()`. This file
6
+ * re-exports under the React-style name so plugin code can call
7
+ * `useWheelZoom()` either way and get the same composable.
8
+ */
9
+ export { useZoom as useWheelZoom } from './useZoom';
10
+ export type { UseZoomReturn } from './useZoom';
@@ -0,0 +1,16 @@
1
+ import { Ref, ComputedRef } from 'vue';
2
+ export type UseZoomReturn = {
3
+ zoom: Ref<number>;
4
+ zoomPercent: ComputedRef<number>;
5
+ isMinZoom: ComputedRef<boolean>;
6
+ isMaxZoom: ComputedRef<boolean>;
7
+ setZoom: (level: number) => void;
8
+ zoomIn: () => void;
9
+ zoomOut: () => void;
10
+ resetZoom: () => void;
11
+ handleWheel: (e: WheelEvent) => void;
12
+ handleKeyDown: (e: KeyboardEvent) => void;
13
+ installShortcuts: () => void;
14
+ ZOOM_PRESETS: number[];
15
+ };
16
+ export declare function useZoom(initialZoom?: number): UseZoomReturn;
@@ -0,0 +1,61 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useZoom-BryUw3Cu.cjs");let t=require("vue"),n=require("prosemirror-history"),r=require("@stll/folio-core/utils/clipboard"),i=require("@stll/folio-core/managers/ClipboardManager"),a=require("@stll/folio-core/managers/TableSelectionManager"),o=require("@stll/folio-core/prosemirror/utils/visualLineNavigation"),s=require("@stll/folio-core/prosemirror/utils/extractTrackedChanges");function c(e={}){let{onCopy:n,onCut:i,onPaste:a,cleanWordFormatting:o=!0,editable:s=!0,onError:c}=e,l=(0,t.ref)(!1),u=(0,t.ref)(null),d=c?{onError:c}:{};async function f(e){if(l.value)return!1;l.value=!0;try{let t=await(0,r.copyRuns)(e.runs,d);return t&&n?.(e),t}finally{l.value=!1}}async function p(e){if(l.value||!s)return!1;l.value=!0;try{let t=await(0,r.copyRuns)(e.runs,d);return t&&i?.(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=``,i=``;for(let e of t)e.types.includes(`text/html`)&&(n=await(await e.getType(`text/html`)).text()),e.types.includes(`text/plain`)&&(i=await(await e.getType(`text/plain`)).text());e&&(n=``);let s=(0,r.parseClipboardHtml)(n,i,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 l({isOpen:e,onClose:n,align:r=`left`}){let i=(0,t.ref)(null),a=(0,t.ref)(null),o=(0,t.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 t=e.target;t instanceof Node&&i.value&&!i.value.contains(t)&&a.value&&!a.value.contains(t)&&n()}function l(e){e.key===`Escape`&&n()}function u(e){let t=e.target;t instanceof Node&&a.value&&a.value.contains(t)||n()}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,t.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,t.onScopeDispose)(f);function p(e){e.preventDefault(),e.stopPropagation()}return{containerRef:i,dropdownRef:a,dropdownStyle:o,handleMouseDown:p}}function u(e,r){let i=(0,t.computed)(()=>{r.value;let t=e.value;return t?(0,n.undoDepth)(t.state)>0:!1}),a=(0,t.computed)(()=>{r.value;let t=e.value;return t?(0,n.redoDepth)(t.state)>0:!1});function o(){let t=e.value;return t?(0,n.undo)(t.state,t.dispatch):!1}function s(){let t=e.value;return t?(0,n.redo)(t.state,t.dispatch):!1}return{canUndo:i,canRedo:a,undo:o,redo:s}}var d={backgroundColor:`rgba(26, 115, 232, 0.3)`,borderRadius:0,zIndex:0,opacity:1,mixBlendMode:`multiply`};function f(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 p(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 m(e){return p(f(e))}function h(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function g(e){let t=window.getSelection();return!t||t.rangeCount===0?!1:e.contains(t.getRangeAt(0).commonAncestorContainer)}var _=`docx-selection-styles`,v=null;function y(){v&&=(v.remove(),null),document.getElementById(_)?.remove()}function b(e=d){y();let t=`
2
+ /* DOCX Editor Selection Highlighting */
3
+
4
+ .docx-editor [contenteditable="true"]::selection,
5
+ .docx-editor [contenteditable="true"] *::selection,
6
+ .docx-run-editable::selection,
7
+ .docx-run-editable *::selection {
8
+ background-color: ${e.backgroundColor} !important;
9
+ color: inherit !important;
10
+ }
11
+
12
+ .docx-editor [contenteditable="true"]::-moz-selection,
13
+ .docx-editor [contenteditable="true"] *::-moz-selection,
14
+ .docx-run-editable::-moz-selection,
15
+ .docx-run-editable *::-moz-selection {
16
+ background-color: ${e.backgroundColor} !important;
17
+ color: inherit !important;
18
+ }
19
+
20
+ .docx-run-highlighted::selection,
21
+ .docx-run-highlighted *::selection {
22
+ background-color: rgba(26, 115, 232, 0.5) !important;
23
+ }
24
+
25
+ .docx-run-highlighted::-moz-selection,
26
+ .docx-run-highlighted *::-moz-selection {
27
+ background-color: rgba(26, 115, 232, 0.5) !important;
28
+ }
29
+
30
+ .docx-run-dark-bg::selection,
31
+ .docx-run-dark-bg *::selection {
32
+ background-color: rgba(100, 181, 246, 0.5) !important;
33
+ }
34
+
35
+ .docx-run-dark-bg::-moz-selection,
36
+ .docx-run-dark-bg *::-moz-selection {
37
+ background-color: rgba(100, 181, 246, 0.5) !important;
38
+ }
39
+
40
+ .docx-selection-highlight {
41
+ background-color: ${e.backgroundColor};
42
+ ${e.borderRadius?`border-radius: ${e.borderRadius}px;`:``}
43
+ ${e.mixBlendMode?`mix-blend-mode: ${e.mixBlendMode};`:``}
44
+ }
45
+
46
+ .docx-find-highlight {
47
+ background-color: rgba(255, 235, 59, 0.5);
48
+ border-radius: 2px;
49
+ }
50
+
51
+ .docx-find-highlight-current {
52
+ background-color: rgba(255, 152, 0, 0.6);
53
+ border-radius: 2px;
54
+ outline: 2px solid rgba(255, 152, 0, 0.8);
55
+ }
56
+
57
+ .docx-ai-selection-preview {
58
+ background-color: rgba(156, 39, 176, 0.2);
59
+ border-bottom: 2px dashed rgba(156, 39, 176, 0.6);
60
+ }
61
+ `;v=document.createElement(`style`),v.id=_,v.textContent=t,document.head.appendChild(v)}function x(){return v!==null||document.getElementById(_)!==null}function S(){return window.getSelection()?.toString()??``}function C(e){let{containerRef:n,enabled:r=!0,config:i=d,useOverlay:a=!1,debounceMs:o=16,onSelectionChange:s}=e,c=(0,t.ref)(!1),l=(0,t.ref)(``),u=(0,t.ref)([]),f=(0,t.ref)(!1),p=null,_=0;function v(){let e=n.value,t=h(),r=S(),i=e?g(e):!1;c.value=t,l.value=r,f.value=i,u.value=a&&i&&e?m(e):[],s?.(t&&i,r)}function y(){v()}function C(){let e=performance.now();if(e-_<o){p&&clearTimeout(p),p=setTimeout(()=>{_=performance.now(),v(),p=null},o);return}_=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,t.onMounted)(()=>{r&&(x()||b(i),document.addEventListener(`selectionchange`,C))}),(0,t.onBeforeUnmount)(()=>{document.removeEventListener(`selectionchange`,C),p&&clearTimeout(p)}),(0,t.watch)(n,()=>v()),{hasSelection:(0,t.computed)(()=>c.value),selectedText:(0,t.computed)(()=>l.value),highlightRects:(0,t.computed)(()=>u.value),isSelectionInContainer:(0,t.computed)(()=>f.value),refresh:y,getOverlayStyle:w}}function w(){let e=new a.TableSelectionManager,n=(0,t.ref)(null),r=()=>{let t=e.getSnapshot();n.value=t.tableIndex!==null&&t.rowIndex!==null&&t.columnIndex!==null?{tableIndex:t.tableIndex,rowIndex:t.rowIndex,columnIndex:t.columnIndex}:null},i=e.subscribe(r);r(),(0,t.onScopeDispose)(i);function o(e,t,n){}function s(t,n){(0,a.findTableFromClick)(t,n)||e.clearSelection()}function c(){e.clearSelection()}function l(t,n,r){return e.isCellSelected(t,n,r)}return{selectedCell:n,handleCellClick:o,handleClickTarget:s,clearSelection:c,isCellSelected:l}}function T(e){let t=(0,o.createVisualLineState)();function n(t){let n=e.value;return n?(0,o.getCaretClientX)(n,t):null}function r(t){let n=e.value;return n?(0,o.findLineElementAtPosition)(n,t):null}function i(e,t){return(0,o.findPositionOnLineAtClientX)(e,t)}function a(n,r){return(0,o.handleVisualLineKeyDown)(t,n,r,e.value)}return{state:t,getCaretClientX:n,findLineElementAtPosition:r,findPositionOnLineAtClientX:i,handlePMKeyDown:a}}exports.createSelectionFromDOM=i.createSelectionFromDOM,exports.extractTrackedChanges=s.extractTrackedChanges,exports.getSelectionRuns=i.getSelectionRuns,exports.runsToClipboardContent=r.runsToClipboardContent,exports.useClipboard=c,exports.useDocxEditor=e.a,exports.useDragAutoScroll=e.i,exports.useFixedDropdown=l,exports.useHistory=u,exports.useSelectionHighlight=C,exports.useTableResize=e.r,exports.useTableSelection=w,exports.useTrackedChanges=e.n,exports.useVisualLineNavigation=T,exports.useWheelZoom=e.t,exports.useZoom=e.t;
@@ -0,0 +1,378 @@
1
+ import { a as e, i as t, n, o as r, r as i, t as a } from "./useZoom-CIIRid8U.js";
2
+ import { computed as o, onBeforeUnmount as s, onMounted as c, onScopeDispose as l, ref as u, watch as d } from "vue";
3
+ import { redo as f, redoDepth as p, undo as m, undoDepth as h } from "prosemirror-history";
4
+ import { copyRuns as g, parseClipboardHtml as _, runsToClipboardContent as v } from "@stll/folio-core/utils/clipboard";
5
+ import { createSelectionFromDOM as y, getSelectionRuns as b } from "@stll/folio-core/managers/ClipboardManager";
6
+ import { TableSelectionManager as x, findTableFromClick as S } from "@stll/folio-core/managers/TableSelectionManager";
7
+ import { createVisualLineState as C, findLineElementAtPosition as w, findPositionOnLineAtClientX as T, getCaretClientX as E, handleVisualLineKeyDown as D } from "@stll/folio-core/prosemirror/utils/visualLineNavigation";
8
+ //#region src/composables/useClipboard.ts
9
+ function O(e = {}) {
10
+ let { onCopy: t, onCut: n, onPaste: r, cleanWordFormatting: i = !0, editable: a = !0, onError: o } = e, s = u(!1), c = u(null), l = o ? { onError: o } : {};
11
+ async function d(e) {
12
+ if (s.value) return !1;
13
+ s.value = !0;
14
+ try {
15
+ let n = await g(e.runs, l);
16
+ return n && t?.(e), n;
17
+ } finally {
18
+ s.value = !1;
19
+ }
20
+ }
21
+ async function f(e) {
22
+ if (s.value || !a) return !1;
23
+ s.value = !0;
24
+ try {
25
+ let t = await g(e.runs, l);
26
+ return t && n?.(e), t;
27
+ } finally {
28
+ s.value = !1;
29
+ }
30
+ }
31
+ async function p(e = !1) {
32
+ if (s.value || !a) return null;
33
+ s.value = !0;
34
+ try {
35
+ if (navigator.clipboard && navigator.clipboard.read) {
36
+ let t = await navigator.clipboard.read(), n = "", a = "";
37
+ 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());
38
+ e && (n = "");
39
+ let o = _(n, a, i);
40
+ return c.value = o, r?.(o, e), o;
41
+ }
42
+ return null;
43
+ } catch (e) {
44
+ return o?.(e instanceof Error ? e : Error(String(e))), null;
45
+ } finally {
46
+ s.value = !1;
47
+ }
48
+ }
49
+ return {
50
+ copy: d,
51
+ cut: f,
52
+ paste: p,
53
+ isProcessing: s,
54
+ lastPastedContent: c
55
+ };
56
+ }
57
+ //#endregion
58
+ //#region src/composables/useFixedDropdown.ts
59
+ function k({ isOpen: e, onClose: t, align: n = "left" }) {
60
+ let r = u(null), i = u(null), a = u({
61
+ position: "fixed",
62
+ top: "0px",
63
+ left: "0px",
64
+ zIndex: 1e4
65
+ });
66
+ function o(e, t) {
67
+ a.value = {
68
+ position: "fixed",
69
+ top: e + "px",
70
+ left: t + "px",
71
+ zIndex: 1e4
72
+ };
73
+ }
74
+ function s(e) {
75
+ let n = e.target;
76
+ n instanceof Node && r.value && !r.value.contains(n) && i.value && !i.value.contains(n) && t();
77
+ }
78
+ function c(e) {
79
+ e.key === "Escape" && t();
80
+ }
81
+ function f(e) {
82
+ let n = e.target;
83
+ n instanceof Node && i.value && i.value.contains(n) || t();
84
+ }
85
+ function p() {
86
+ document.addEventListener("mousedown", s), document.addEventListener("keydown", c), window.addEventListener("scroll", f, !0);
87
+ }
88
+ function m() {
89
+ document.removeEventListener("mousedown", s), document.removeEventListener("keydown", c), window.removeEventListener("scroll", f, !0);
90
+ }
91
+ d(e, (e) => {
92
+ if (!e) {
93
+ m();
94
+ return;
95
+ }
96
+ let t = r.value;
97
+ if (!t) return;
98
+ let a = t.getBoundingClientRect();
99
+ n === "right" ? requestAnimationFrame(() => {
100
+ let e = i.value;
101
+ if (e) {
102
+ let t = e.getBoundingClientRect();
103
+ o(a.bottom + 4, a.right - t.width);
104
+ } else o(a.bottom + 4, a.left);
105
+ }) : o(a.bottom + 4, a.left), p();
106
+ }), l(m);
107
+ function h(e) {
108
+ e.preventDefault(), e.stopPropagation();
109
+ }
110
+ return {
111
+ containerRef: r,
112
+ dropdownRef: i,
113
+ dropdownStyle: a,
114
+ handleMouseDown: h
115
+ };
116
+ }
117
+ //#endregion
118
+ //#region src/composables/useHistory.ts
119
+ function A(e, t) {
120
+ let n = o(() => {
121
+ t.value;
122
+ let n = e.value;
123
+ return n ? h(n.state) > 0 : !1;
124
+ }), r = o(() => {
125
+ t.value;
126
+ let n = e.value;
127
+ return n ? p(n.state) > 0 : !1;
128
+ });
129
+ function i() {
130
+ let t = e.value;
131
+ return t ? m(t.state, t.dispatch) : !1;
132
+ }
133
+ function a() {
134
+ let t = e.value;
135
+ return t ? f(t.state, t.dispatch) : !1;
136
+ }
137
+ return {
138
+ canUndo: n,
139
+ canRedo: r,
140
+ undo: i,
141
+ redo: a
142
+ };
143
+ }
144
+ //#endregion
145
+ //#region src/utils/selectionHighlight.ts
146
+ var j = {
147
+ backgroundColor: "rgba(26, 115, 232, 0.3)",
148
+ borderRadius: 0,
149
+ zIndex: 0,
150
+ opacity: 1,
151
+ mixBlendMode: "multiply"
152
+ };
153
+ function M(e) {
154
+ let t = window.getSelection();
155
+ if (!t || t.rangeCount === 0 || t.isCollapsed) return [];
156
+ let n = t.getRangeAt(0);
157
+ if (e && !e.contains(n.commonAncestorContainer)) return [];
158
+ let r = 0, i = 0;
159
+ if (e) {
160
+ let t = e.getBoundingClientRect();
161
+ r = t.left + e.scrollLeft, i = t.top + e.scrollTop;
162
+ }
163
+ let a = [];
164
+ for (let e of n.getClientRects()) e.width === 0 && e.height === 0 || a.push({
165
+ left: e.left - r,
166
+ top: e.top - i,
167
+ width: e.width,
168
+ height: e.height
169
+ });
170
+ return a;
171
+ }
172
+ function N(e, t = 2) {
173
+ if (e.length <= 1) return e;
174
+ let n = [...e].sort((e, n) => Math.abs(e.top - n.top) < t ? e.left - n.left : e.top - n.top), r = n[0];
175
+ if (!r) return e;
176
+ let i = [], a = { ...r };
177
+ for (let e = 1; e < n.length; e++) {
178
+ let r = n[e];
179
+ if (!r) continue;
180
+ let o = Math.abs(r.top - a.top) < t, s = r.left <= a.left + a.width + t;
181
+ if (o && s) {
182
+ let e = Math.max(a.left + a.width, r.left + r.width);
183
+ a.width = e - a.left, a.height = Math.max(a.height, r.height);
184
+ } else i.push(a), a = { ...r };
185
+ }
186
+ return i.push(a), i;
187
+ }
188
+ function P(e) {
189
+ return N(M(e));
190
+ }
191
+ function F() {
192
+ let e = window.getSelection();
193
+ return e !== null && !e.isCollapsed && e.rangeCount > 0;
194
+ }
195
+ function I(e) {
196
+ let t = window.getSelection();
197
+ return !t || t.rangeCount === 0 ? !1 : e.contains(t.getRangeAt(0).commonAncestorContainer);
198
+ }
199
+ var L = "docx-selection-styles", R = null;
200
+ function z() {
201
+ R &&= (R.remove(), null), document.getElementById(L)?.remove();
202
+ }
203
+ function B(e = j) {
204
+ z();
205
+ let t = `
206
+ /* DOCX Editor Selection Highlighting */
207
+
208
+ .docx-editor [contenteditable="true"]::selection,
209
+ .docx-editor [contenteditable="true"] *::selection,
210
+ .docx-run-editable::selection,
211
+ .docx-run-editable *::selection {
212
+ background-color: ${e.backgroundColor} !important;
213
+ color: inherit !important;
214
+ }
215
+
216
+ .docx-editor [contenteditable="true"]::-moz-selection,
217
+ .docx-editor [contenteditable="true"] *::-moz-selection,
218
+ .docx-run-editable::-moz-selection,
219
+ .docx-run-editable *::-moz-selection {
220
+ background-color: ${e.backgroundColor} !important;
221
+ color: inherit !important;
222
+ }
223
+
224
+ .docx-run-highlighted::selection,
225
+ .docx-run-highlighted *::selection {
226
+ background-color: rgba(26, 115, 232, 0.5) !important;
227
+ }
228
+
229
+ .docx-run-highlighted::-moz-selection,
230
+ .docx-run-highlighted *::-moz-selection {
231
+ background-color: rgba(26, 115, 232, 0.5) !important;
232
+ }
233
+
234
+ .docx-run-dark-bg::selection,
235
+ .docx-run-dark-bg *::selection {
236
+ background-color: rgba(100, 181, 246, 0.5) !important;
237
+ }
238
+
239
+ .docx-run-dark-bg::-moz-selection,
240
+ .docx-run-dark-bg *::-moz-selection {
241
+ background-color: rgba(100, 181, 246, 0.5) !important;
242
+ }
243
+
244
+ .docx-selection-highlight {
245
+ background-color: ${e.backgroundColor};
246
+ ${e.borderRadius ? `border-radius: ${e.borderRadius}px;` : ""}
247
+ ${e.mixBlendMode ? `mix-blend-mode: ${e.mixBlendMode};` : ""}
248
+ }
249
+
250
+ .docx-find-highlight {
251
+ background-color: rgba(255, 235, 59, 0.5);
252
+ border-radius: 2px;
253
+ }
254
+
255
+ .docx-find-highlight-current {
256
+ background-color: rgba(255, 152, 0, 0.6);
257
+ border-radius: 2px;
258
+ outline: 2px solid rgba(255, 152, 0, 0.8);
259
+ }
260
+
261
+ .docx-ai-selection-preview {
262
+ background-color: rgba(156, 39, 176, 0.2);
263
+ border-bottom: 2px dashed rgba(156, 39, 176, 0.6);
264
+ }
265
+ `;
266
+ R = document.createElement("style"), R.id = L, R.textContent = t, document.head.appendChild(R);
267
+ }
268
+ function V() {
269
+ return R !== null || document.getElementById(L) !== null;
270
+ }
271
+ //#endregion
272
+ //#region src/composables/useSelectionHighlight.ts
273
+ function H() {
274
+ return window.getSelection()?.toString() ?? "";
275
+ }
276
+ function U(e) {
277
+ let { containerRef: t, enabled: n = !0, config: r = j, useOverlay: i = !1, debounceMs: a = 16, onSelectionChange: l } = e, f = u(!1), p = u(""), m = u([]), h = u(!1), g = null, _ = 0;
278
+ function v() {
279
+ let e = t.value, n = F(), r = H(), a = e ? I(e) : !1;
280
+ f.value = n, p.value = r, h.value = a, m.value = i && a && e ? P(e) : [], l?.(n && a, r);
281
+ }
282
+ function y() {
283
+ v();
284
+ }
285
+ function b() {
286
+ let e = performance.now();
287
+ if (e - _ < a) {
288
+ g && clearTimeout(g), g = setTimeout(() => {
289
+ _ = performance.now(), v(), g = null;
290
+ }, a);
291
+ return;
292
+ }
293
+ _ = e, v();
294
+ }
295
+ function x(e) {
296
+ let t = {
297
+ position: "absolute",
298
+ left: `${e.left}px`,
299
+ top: `${e.top}px`,
300
+ width: `${e.width}px`,
301
+ height: `${e.height}px`,
302
+ backgroundColor: r.backgroundColor,
303
+ zIndex: r.zIndex ?? 0,
304
+ pointerEvents: "none"
305
+ };
306
+ return r.borderRadius && (t.borderRadius = `${r.borderRadius}px`), r.borderColor && (t.border = `1px solid ${r.borderColor}`), t;
307
+ }
308
+ return c(() => {
309
+ n && (V() || B(r), document.addEventListener("selectionchange", b));
310
+ }), s(() => {
311
+ document.removeEventListener("selectionchange", b), g && clearTimeout(g);
312
+ }), d(t, () => v()), {
313
+ hasSelection: o(() => f.value),
314
+ selectedText: o(() => p.value),
315
+ highlightRects: o(() => m.value),
316
+ isSelectionInContainer: o(() => h.value),
317
+ refresh: y,
318
+ getOverlayStyle: x
319
+ };
320
+ }
321
+ //#endregion
322
+ //#region src/composables/useTableSelection.ts
323
+ function W() {
324
+ let e = new x(), t = u(null), n = () => {
325
+ let n = e.getSnapshot();
326
+ t.value = n.tableIndex !== null && n.rowIndex !== null && n.columnIndex !== null ? {
327
+ tableIndex: n.tableIndex,
328
+ rowIndex: n.rowIndex,
329
+ columnIndex: n.columnIndex
330
+ } : null;
331
+ }, r = e.subscribe(n);
332
+ n(), l(r);
333
+ function i(e, t, n) {}
334
+ function a(t, n) {
335
+ S(t, n) || e.clearSelection();
336
+ }
337
+ function o() {
338
+ e.clearSelection();
339
+ }
340
+ function s(t, n, r) {
341
+ return e.isCellSelected(t, n, r);
342
+ }
343
+ return {
344
+ selectedCell: t,
345
+ handleCellClick: i,
346
+ handleClickTarget: a,
347
+ clearSelection: o,
348
+ isCellSelected: s
349
+ };
350
+ }
351
+ //#endregion
352
+ //#region src/composables/useVisualLineNavigation.ts
353
+ function G(e) {
354
+ let t = C();
355
+ function n(t) {
356
+ let n = e.value;
357
+ return n ? E(n, t) : null;
358
+ }
359
+ function r(t) {
360
+ let n = e.value;
361
+ return n ? w(n, t) : null;
362
+ }
363
+ function i(e, t) {
364
+ return T(e, t);
365
+ }
366
+ function a(n, r) {
367
+ return D(t, n, r, e.value);
368
+ }
369
+ return {
370
+ state: t,
371
+ getCaretClientX: n,
372
+ findLineElementAtPosition: r,
373
+ findPositionOnLineAtClientX: i,
374
+ handlePMKeyDown: a
375
+ };
376
+ }
377
+ //#endregion
378
+ export { y as createSelectionFromDOM, n as extractTrackedChanges, b as getSelectionRuns, v as runsToClipboardContent, O as useClipboard, r as useDocxEditor, e as useDragAutoScroll, k as useFixedDropdown, A as useHistory, U as useSelectionHighlight, t as useTableResize, W as useTableSelection, i as useTrackedChanges, G as useVisualLineNavigation, a as useWheelZoom, a as useZoom };
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./PageSetupDialog-CGBaBVzo.cjs"),t=require("./TablePropertiesDialog-A-1Pm1f9.cjs");exports.FindReplaceDialog=e.a,exports.FootnotePropertiesDialog=t.i,exports.HyperlinkDialog=e.i,exports.ImagePositionDialog=t.r,exports.ImagePropertiesDialog=e.r,exports.InsertSymbolDialog=e.n,exports.InsertTableDialog=t.n,exports.PageSetupDialog=e.t,exports.TablePropertiesDialog=t.t;
@@ -0,0 +1,3 @@
1
+ import { a as e, i as t, n, r, t as i } from "./PageSetupDialog-DsjAfJy0.js";
2
+ import { i as a, n as o, r as s, t as c } from "./TablePropertiesDialog-PyXEJC_o.js";
3
+ export { e as FindReplaceDialog, a as FootnotePropertiesDialog, t as HyperlinkDialog, s as ImagePositionDialog, r as ImagePropertiesDialog, n as InsertSymbolDialog, o as InsertTableDialog, i as PageSetupDialog, c as TablePropertiesDialog };