@stll/folio-vue 0.25.0 → 0.26.1

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 (117) hide show
  1. package/dist/SplitCellDialog-DfMw2Ev2.cjs +15 -0
  2. package/dist/{SplitCellDialog-CSqbtDum.js → SplitCellDialog-bNeugz_3.js} +1737 -1757
  3. package/dist/{ListButtons-BeELtp_-.js → StylePicker-DfIQUq6G.js} +1158 -1164
  4. package/dist/StylePicker-ynX3GzFu.cjs +4 -0
  5. package/dist/components/DocxEditor/DocxEditorDialogs.vue.d.ts +4 -10
  6. package/dist/components/DocxEditor/pagedEditorRef.d.ts +1 -1
  7. package/dist/components/DocxEditor/types.d.ts +18 -9
  8. package/dist/components/DocxEditor.vue.d.ts +7 -4
  9. package/dist/components/InlineHeaderFooterEditor.vue.d.ts +2 -2
  10. package/dist/components/OutlineToggleButton.vue.d.ts +21 -0
  11. package/dist/components/ReviewControls.vue.d.ts +2 -2
  12. package/dist/components/Toolbar.vue.d.ts +9 -9
  13. package/dist/components/UnifiedSidebar.vue.d.ts +2 -2
  14. package/dist/components/dialogs/FindReplaceDialog.vue.d.ts +3 -11
  15. package/dist/components/dialogs/FootnotePropertiesDialog.vue.d.ts +2 -2
  16. package/dist/components/dialogs/HyperlinkDialog.vue.d.ts +2 -2
  17. package/dist/components/dialogs/ImagePositionDialog.vue.d.ts +2 -2
  18. package/dist/components/dialogs/PageSetupDialog.vue.d.ts +2 -2
  19. package/dist/components/dialogs/SetNumberingValueDialog.vue.d.ts +2 -2
  20. package/dist/components/dialogs/TablePropertiesDialog.vue.d.ts +2 -2
  21. package/dist/components/dialogs/WatermarkDialog.vue.d.ts +2 -2
  22. package/dist/components/sidebar/CommentCard.vue.d.ts +2 -2
  23. package/dist/components/sidebar/TrackedChangeCard.vue.d.ts +2 -2
  24. package/dist/components/sidebar/cardStyles.d.ts +1 -1
  25. package/dist/components/tableStylePresets.d.ts +1 -1
  26. package/dist/components/ui/Button.vue.d.ts +1 -1
  27. package/dist/components/ui/FontSizePicker.vue.d.ts +1 -1
  28. package/dist/components/ui/HorizontalRuler.vue.d.ts +2 -2
  29. package/dist/components/ui/HyperlinkPopup.vue.d.ts +4 -4
  30. package/dist/components/ui/Input.vue.d.ts +1 -1
  31. package/dist/components/ui/ListButtons.vue.d.ts +1 -1
  32. package/dist/components/ui/OutlineRail.vue.d.ts +1 -1
  33. package/dist/components/ui/TableMoreDropdown.vue.d.ts +1 -1
  34. package/dist/components/ui/TableToolbar.vue.d.ts +1 -1
  35. package/dist/components/ui/VerticalRuler.vue.d.ts +2 -2
  36. package/dist/components/ui/icon-paths.json.d.ts +18 -6
  37. package/dist/composables/useAutoSave.d.ts +1 -1
  38. package/dist/composables/useClipboard.d.ts +2 -2
  39. package/dist/composables/useCommentLifecycle.d.ts +1 -1
  40. package/dist/composables/useCommentManagement.d.ts +1 -1
  41. package/dist/composables/useContextMenus.d.ts +2 -2
  42. package/dist/composables/useDocxEditor.d.ts +4 -4
  43. package/dist/composables/useDocxEditorRefApi.d.ts +6 -4
  44. package/dist/composables/useFindReplace.d.ts +36 -18
  45. package/dist/composables/useFixedDropdown.d.ts +1 -1
  46. package/dist/composables/useFormattingActions.d.ts +1 -1
  47. package/dist/composables/useHistory.d.ts +1 -1
  48. package/dist/composables/useHyperlinkManagement.d.ts +1 -1
  49. package/dist/composables/useImageActions.d.ts +1 -1
  50. package/dist/composables/useOutlineSidebar.d.ts +1 -1
  51. package/dist/composables/usePageSetupControls.d.ts +1 -1
  52. package/dist/composables/usePagesPointer.d.ts +3 -3
  53. package/dist/composables/useParagraphStyleOptions.d.ts +1 -1
  54. package/dist/composables/useSelectionHighlight.d.ts +1 -1
  55. package/dist/composables/useSelectionSync.d.ts +1 -1
  56. package/dist/composables/useToolbarDropdowns.d.ts +1 -1
  57. package/dist/composables/useToolbarFontSize.d.ts +1 -1
  58. package/dist/composables/useTrackedChanges.d.ts +1 -1
  59. package/dist/composables/useVisualLineNavigation.d.ts +1 -1
  60. package/dist/composables/useZoom.d.ts +1 -1
  61. package/dist/composables.cjs +2 -2
  62. package/dist/composables.js +65 -72
  63. package/dist/dialogs.cjs +1 -1
  64. package/dist/dialogs.js +1 -2
  65. package/dist/folio-vue.css +1 -1
  66. package/dist/index.cjs +1 -1
  67. package/dist/index.d.ts +5 -4
  68. package/dist/index.js +4816 -4831
  69. package/dist/messages/ar.cjs +1 -1
  70. package/dist/messages/ar.js +1 -2
  71. package/dist/messages/cs.cjs +1 -1
  72. package/dist/messages/cs.js +1 -2
  73. package/dist/messages/de.cjs +1 -1
  74. package/dist/messages/de.js +1 -2
  75. package/dist/messages/en.cjs +1 -1
  76. package/dist/messages/en.js +1 -2
  77. package/dist/messages/es.cjs +1 -1
  78. package/dist/messages/es.js +1 -2
  79. package/dist/messages/et.cjs +1 -1
  80. package/dist/messages/et.js +1 -2
  81. package/dist/messages/fr.cjs +1 -1
  82. package/dist/messages/fr.js +1 -2
  83. package/dist/messages/he.cjs +1 -1
  84. package/dist/messages/he.js +1 -2
  85. package/dist/messages/hi.cjs +1 -1
  86. package/dist/messages/hi.js +1 -2
  87. package/dist/messages/hu.cjs +1 -1
  88. package/dist/messages/hu.js +1 -2
  89. package/dist/messages/locales.js +1 -2
  90. package/dist/messages/lt.cjs +1 -1
  91. package/dist/messages/lt.js +1 -2
  92. package/dist/messages/lv.cjs +1 -1
  93. package/dist/messages/lv.js +1 -2
  94. package/dist/messages/pl.cjs +1 -1
  95. package/dist/messages/pl.js +1 -2
  96. package/dist/messages/pt-BR.cjs +1 -1
  97. package/dist/messages/pt-BR.js +1 -2
  98. package/dist/messages/sk.cjs +1 -1
  99. package/dist/messages/sk.js +1 -2
  100. package/dist/messages/tr.cjs +1 -1
  101. package/dist/messages/tr.js +1 -2
  102. package/dist/messages/zh-CN.cjs +1 -1
  103. package/dist/messages/zh-CN.js +1 -2
  104. package/dist/{rolldown-runtime-C6qsp3rV.cjs → rolldown-runtime-CYJQrBu7.cjs} +1 -1
  105. package/dist/ui.cjs +1 -1
  106. package/dist/ui.d.ts +1 -1
  107. package/dist/ui.js +21 -27
  108. package/dist/useZoom-Bwnae1jX.cjs +1 -0
  109. package/dist/useZoom-CX0mrPQY.js +996 -0
  110. package/dist/utils/viewportPosition.d.ts +1 -1
  111. package/package.json +13 -13
  112. package/dist/ListButtons-B8HxA64I.cjs +0 -4
  113. package/dist/SplitCellDialog-DzKBu09z.cjs +0 -15
  114. package/dist/useFindReplace-BbW0xWo7.js +0 -74
  115. package/dist/useFindReplace-neQmDh2i.cjs +0 -1
  116. package/dist/useZoom-B1miNAf_.cjs +0 -1
  117. package/dist/useZoom-Bw5gp69V.js +0 -887
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useFindReplace-neQmDh2i.cjs"),t=require("./useZoom-B1miNAf_.cjs");let n=require("vue"),r=require("prosemirror-history"),i=require("@stll/folio-core/utils/textEncoding"),a=require("@stll/folio-core/utils/clipboard"),o=require("@stll/folio-core/managers/ClipboardManager"),s=require("@stll/folio-core/managers/TableSelectionManager"),c=require("@stll/folio-core/prosemirror/utils/visualLineNavigation"),l=require("@stll/folio-core/prosemirror/utils/extractTrackedChanges");function u(e={}){let{onCopy:t,onCut:r,onPaste:o,cleanWordFormatting:s=!0,editable:c=!0,onError:l}=e,u=(0,n.ref)(!1),d=(0,n.ref)(null),f=l?{onError:l}:{};async function p(e){if(u.value)return!1;u.value=!0;try{let n=await(0,a.copyRuns)(e.runs,f);return n&&t?.(e),n}finally{u.value=!1}}async function m(e){if(u.value||!c)return!1;u.value=!0;try{let t=await(0,a.copyRuns)(e.runs,f);return t&&r?.(e),t}finally{u.value=!1}}async function h(e=!1){if(u.value||!c)return null;u.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(0,i.readBlobText)(await e.getType(`text/html`))),e.types.includes(`text/plain`)&&(r=await(0,i.readBlobText)(await e.getType(`text/plain`)));e&&(n=``);let c=(0,a.parseClipboardHtml)(n,r,s);return d.value=c,o?.(c,e),c}return null}catch(e){return l?.(e instanceof Error?e:Error(String(e))),null}finally{u.value=!1}}return{copy:p,cut:m,paste:h,isProcessing:u,lastPastedContent:d}}function d({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 f(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 p={backgroundColor:`rgba(26, 115, 232, 0.3)`,borderRadius:0,zIndex:0,opacity:1,mixBlendMode:`multiply`};function m(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 h(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 g(e){return h(m(e))}function _(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function v(e){let t=window.getSelection();return!t||t.rangeCount===0?!1:e.contains(t.getRangeAt(0).commonAncestorContainer)}var y=`docx-selection-styles`,b=null;function x(){b&&=(b.remove(),null),document.getElementById(y)?.remove()}function S(e=p){x();let t=`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useZoom-Bwnae1jX.cjs");let t=require("vue"),n=require("@stll/folio-core/utils/textEncoding"),r=require("prosemirror-history"),i=require("@stll/folio-core/utils/documentPointerDown"),a=require("@stll/folio-core/managers/ClipboardManager"),o=require("@stll/folio-core/utils/clipboard"),s=require("@stll/folio-core/managers/TableSelectionManager"),c=require("@stll/folio-core/prosemirror/utils/visualLineNavigation"),l=require("@stll/folio-core/prosemirror/utils/extractTrackedChanges");function u(e={}){let{onCopy:r,onCut:i,onPaste:a,cleanWordFormatting:s=!0,editable:c=!0,onError:l}=e,u=(0,t.ref)(!1),d=(0,t.ref)(null),f=l?{onError:l}:{};async function p(e){if(u.value)return!1;u.value=!0;try{let t=await(0,o.copyRuns)(e.runs,f);return t&&r?.(e),t}finally{u.value=!1}}async function m(e){if(u.value||!c)return!1;u.value=!0;try{let t=await(0,o.copyRuns)(e.runs,f);return t&&i?.(e),t}finally{u.value=!1}}async function h(e=!1){if(u.value||!c)return null;u.value=!0;try{if(navigator.clipboard&&navigator.clipboard.read){let t=await navigator.clipboard.read(),r=``,i=``;for(let e of t)e.types.includes(`text/html`)&&(r=await(0,n.readBlobText)(await e.getType(`text/html`))),e.types.includes(`text/plain`)&&(i=await(0,n.readBlobText)(await e.getType(`text/plain`)));e&&(r=``);let c=(0,o.parseClipboardHtml)(r,i,s);return d.value=c,a?.(c,e),c}return null}catch(e){return l?.(e instanceof Error?e:Error(String(e))),null}finally{u.value=!1}}return{copy:p,cut:m,paste:h,isProcessing:u,lastPastedContent:d}}function d({isOpen:e,onClose:n,align:r=`left`}){let a=(0,t.ref)(null),o=(0,t.ref)(null),s=(0,t.ref)({position:`fixed`,top:`0px`,left:`0px`,zIndex:1e4});function c(e,t){s.value={position:`fixed`,top:e+`px`,left:t+`px`,zIndex:1e4}}function l(e){let t=e.target;t instanceof Node&&a.value&&!a.value.contains(t)&&o.value&&!o.value.contains(t)&&n()}function u(e){e.key===`Escape`&&n()}function d(e){let t=e.target;t instanceof Node&&o.value&&o.value.contains(t)||n()}let f;function p(){f=(0,i.onDocumentPointerDown)(document,l),document.addEventListener(`keydown`,u),window.addEventListener(`scroll`,d,!0)}function m(){f?.(),f=void 0,document.removeEventListener(`keydown`,u),window.removeEventListener(`scroll`,d,!0)}(0,t.watch)(e,e=>{if(!e){m();return}let t=a.value;if(!t)return;let n=t.getBoundingClientRect();r===`right`?requestAnimationFrame(()=>{let e=o.value;if(e){let t=e.getBoundingClientRect();c(n.bottom+4,n.right-t.width)}else c(n.bottom+4,n.left)}):c(n.bottom+4,n.left),p()}),(0,t.onScopeDispose)(m);function h(e){e.preventDefault(),e.stopPropagation()}return{containerRef:a,dropdownRef:o,dropdownStyle:s,handleMouseDown:h}}function f(e,n){let i=(0,t.computed)(()=>{n.value;let t=e.value;return t?(0,r.undoDepth)(t.state)>0:!1}),a=(0,t.computed)(()=>{n.value;let t=e.value;return t?(0,r.redoDepth)(t.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 p={backgroundColor:`rgba(26, 115, 232, 0.3)`,borderRadius:0,zIndex:0,opacity:1,mixBlendMode:`multiply`};function m(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 h(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 g(e){return h(m(e))}function _(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function v(e){let t=window.getSelection();return!t||t.rangeCount===0?!1:e.contains(t.getRangeAt(0).commonAncestorContainer)}var y=`docx-selection-styles`,b=null;function x(){b&&=(b.remove(),null),document.getElementById(y)?.remove()}function S(e=p){x();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
- `;b=document.createElement(`style`),b.id=y,b.textContent=t,document.head.appendChild(b)}function C(){return b!==null||document.getElementById(y)!==null}function w(){return window.getSelection()?.toString()??``}function T(e){let{containerRef:t,enabled:r=!0,config:i=p,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),f=null,m=0;function h(){let e=t.value,n=_(),r=w(),i=e?v(e):!1;c.value=n,l.value=r,d.value=i,u.value=a&&i&&e?g(e):[],s?.(n&&i,r)}function y(){h()}function b(){let e=performance.now();if(e-m<o){f&&clearTimeout(f),f=setTimeout(()=>{m=performance.now(),h(),f=null},o);return}m=e,h()}function x(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&&(C()||S(i),document.addEventListener(`selectionchange`,b))}),(0,n.onBeforeUnmount)(()=>{document.removeEventListener(`selectionchange`,b),f&&clearTimeout(f)}),(0,n.watch)(t,()=>h()),{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:x}}function E(){let e=new s.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 o(t,n){let r=(0,s.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:o,clearSelection:c,isCellSelected:l}}function D(e){let t=(0,c.createVisualLineState)();function n(t){let n=e.value;return n?(0,c.getCaretClientX)(n,t):null}function r(t){let n=e.value;return n?(0,c.findLineElementAtPosition)(n,t):null}function i(e,t){return(0,c.findPositionOnLineAtClientX)(e,t)}function a(n,r){return(0,c.handleVisualLineKeyDown)(t,n,r,e.value)}return{state:t,getCaretClientX:n,findLineElementAtPosition:r,findPositionOnLineAtClientX:i,handlePMKeyDown:a}}exports.colorModePlugin=t.o,exports.createSelectionFromDOM=o.createSelectionFromDOM,exports.defaultColorMode=t.s,exports.extractTrackedChanges=l.extractTrackedChanges,exports.getSelectionRuns=o.getSelectionRuns,exports.provideColorMode=t.c,exports.runsToClipboardContent=a.runsToClipboardContent,exports.useClipboard=u,exports.useColorMode=t.l,exports.useDocxEditor=t.a,exports.useDragAutoScroll=t.i,exports.useFindReplace=e.t,exports.useFixedDropdown=d,exports.useHistory=f,exports.useSelectionHighlight=T,exports.useTableResize=t.r,exports.useTableSelection=E,exports.useTrackedChanges=t.n,exports.useVisualLineNavigation=D,exports.useWheelZoom=t.t,exports.useZoom=t.t;
61
+ `;b=document.createElement(`style`),b.id=y,b.textContent=t,document.head.appendChild(b)}function C(){return b!==null||document.getElementById(y)!==null}function w(){return window.getSelection()?.toString()??``}function T(e){let{containerRef:n,enabled:r=!0,config:i=p,useOverlay:a=!1,debounceMs:o=16,onSelectionChange:s}=e,c=(0,t.ref)(!1),l=(0,t.ref)(``),u=(0,t.ref)([]),d=(0,t.ref)(!1),f=null,m=0;function h(){let e=n.value,t=_(),r=w(),i=e?v(e):!1;c.value=t,l.value=r,d.value=i,u.value=a&&i&&e?g(e):[],s?.(t&&i,r)}function y(){h()}function b(){let e=performance.now();e-m<o?(f&&clearTimeout(f),f=setTimeout(()=>{m=performance.now(),h(),f=null},o)):(m=e,h())}function x(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&&(C()||S(i),document.addEventListener(`selectionchange`,b))}),(0,t.onBeforeUnmount)(()=>{document.removeEventListener(`selectionchange`,b),f&&clearTimeout(f)}),(0,t.watch)(n,()=>h()),{hasSelection:(0,t.computed)(()=>c.value),selectedText:(0,t.computed)(()=>l.value),highlightRects:(0,t.computed)(()=>u.value),isSelectionInContainer:(0,t.computed)(()=>d.value),refresh:y,getOverlayStyle:x}}function E(){let e=new s.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 a(t,n,r){e.selectCellCoordinates({tableIndex:t,rowIndex:n,columnIndex:r})}function o(t,n){let r=(0,s.findTableFromClick)(t,n);r?e.selectCellCoordinates(r):e.clearSelection()}function c(){e.clearSelection()}function l(t,n,r){return e.isCellSelected(t,n,r)}return{selectedCell:n,handleCellClick:a,handleClickTarget:o,clearSelection:c,isCellSelected:l}}function D(e){let t=(0,c.createVisualLineState)();function n(t){let n=e.value;return n?(0,c.getCaretClientX)(n,t):null}function r(t){let n=e.value;return n?(0,c.findLineElementAtPosition)(n,t):null}function i(e,t){return(0,c.findPositionOnLineAtClientX)(e,t)}function a(n,r){return(0,c.handleVisualLineKeyDown)(t,n,r,e.value)}return{state:t,getCaretClientX:n,findLineElementAtPosition:r,findPositionOnLineAtClientX:i,handlePMKeyDown:a}}exports.colorModePlugin=e.s,Object.defineProperty(exports,"createSelectionFromDOM",{enumerable:!0,get:function(){return a.createSelectionFromDOM}}),exports.defaultColorMode=e.c,Object.defineProperty(exports,"extractTrackedChanges",{enumerable:!0,get:function(){return l.extractTrackedChanges}}),Object.defineProperty(exports,"getSelectionRuns",{enumerable:!0,get:function(){return a.getSelectionRuns}}),exports.provideColorMode=e.l,Object.defineProperty(exports,"runsToClipboardContent",{enumerable:!0,get:function(){return o.runsToClipboardContent}}),exports.useClipboard=u,exports.useColorMode=e.u,exports.useDocxEditor=e.o,exports.useDragAutoScroll=e.i,exports.useFindReplace=e.a,exports.useFixedDropdown=d,exports.useHistory=f,exports.useSelectionHighlight=T,exports.useTableResize=e.r,exports.useTableSelection=E,exports.useTrackedChanges=e.n,exports.useVisualLineNavigation=D,exports.useWheelZoom=e.t,exports.useZoom=e.t;
@@ -1,20 +1,20 @@
1
- import { t as e } from "./useFindReplace-BbW0xWo7.js";
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-Bw5gp69V.js";
1
+ import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./useZoom-CX0mrPQY.js";
3
2
  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 { readBlobText as x } from "@stll/folio-core/utils/textEncoding";
6
- import { copyRuns as S, parseClipboardHtml as C, runsToClipboardContent as w } from "@stll/folio-core/utils/clipboard";
7
- import { createSelectionFromDOM as T, getSelectionRuns as E } from "@stll/folio-core/managers/ClipboardManager";
8
- import { TableSelectionManager as D, findTableFromClick as O } from "@stll/folio-core/managers/TableSelectionManager";
9
- import { createVisualLineState as k, findLineElementAtPosition as A, findPositionOnLineAtClientX as j, getCaretClientX as M, handleVisualLineKeyDown as N } from "@stll/folio-core/prosemirror/utils/visualLineNavigation";
3
+ import { readBlobText as _ } from "@stll/folio-core/utils/textEncoding";
4
+ import { redo as v, redoDepth as y, undo as b, undoDepth as x } from "prosemirror-history";
5
+ import { onDocumentPointerDown as S } from "@stll/folio-core/utils/documentPointerDown";
6
+ import { createSelectionFromDOM as C, getSelectionRuns as w } from "@stll/folio-core/managers/ClipboardManager";
7
+ import { copyRuns as T, parseClipboardHtml as E, runsToClipboardContent as D } from "@stll/folio-core/utils/clipboard";
8
+ import { TableSelectionManager as O, findTableFromClick as k } from "@stll/folio-core/managers/TableSelectionManager";
9
+ import { createVisualLineState as A, findLineElementAtPosition as j, findPositionOnLineAtClientX as M, getCaretClientX as N, handleVisualLineKeyDown as P } from "@stll/folio-core/prosemirror/utils/visualLineNavigation";
10
10
  //#region src/composables/useClipboard.ts
11
- function P(e = {}) {
11
+ function F(e = {}) {
12
12
  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 } : {};
13
13
  async function u(e) {
14
14
  if (s.value) return !1;
15
15
  s.value = !0;
16
16
  try {
17
- let n = await S(e.runs, l);
17
+ let n = await T(e.runs, l);
18
18
  return n && t?.(e), n;
19
19
  } finally {
20
20
  s.value = !1;
@@ -24,7 +24,7 @@ function P(e = {}) {
24
24
  if (s.value || !a) return !1;
25
25
  s.value = !0;
26
26
  try {
27
- let t = await S(e.runs, l);
27
+ let t = await T(e.runs, l);
28
28
  return t && n?.(e), t;
29
29
  } finally {
30
30
  s.value = !1;
@@ -36,9 +36,9 @@ function P(e = {}) {
36
36
  try {
37
37
  if (navigator.clipboard && navigator.clipboard.read) {
38
38
  let t = await navigator.clipboard.read(), n = "", a = "";
39
- for (let e of t) e.types.includes("text/html") && (n = await x(await e.getType("text/html"))), e.types.includes("text/plain") && (a = await x(await e.getType("text/plain")));
39
+ for (let e of t) e.types.includes("text/html") && (n = await _(await e.getType("text/html"))), e.types.includes("text/plain") && (a = await _(await e.getType("text/plain")));
40
40
  e && (n = "");
41
- let o = C(n, a, i);
41
+ let o = E(n, a, i);
42
42
  return c.value = o, r?.(o, e), o;
43
43
  }
44
44
  return null;
@@ -58,7 +58,7 @@ function P(e = {}) {
58
58
  }
59
59
  //#endregion
60
60
  //#region src/composables/useFixedDropdown.ts
61
- function F({ isOpen: e, onClose: t, align: n = "left" }) {
61
+ function I({ isOpen: e, onClose: t, align: n = "left" }) {
62
62
  let r = h(null), i = h(null), a = h({
63
63
  position: "fixed",
64
64
  top: "0px",
@@ -84,15 +84,16 @@ function F({ isOpen: e, onClose: t, align: n = "left" }) {
84
84
  let n = e.target;
85
85
  n instanceof Node && i.value && i.value.contains(n) || t();
86
86
  }
87
- function u() {
88
- document.addEventListener("mousedown", s), document.addEventListener("keydown", c), window.addEventListener("scroll", l, !0);
89
- }
87
+ let u;
90
88
  function d() {
91
- document.removeEventListener("mousedown", s), document.removeEventListener("keydown", c), window.removeEventListener("scroll", l, !0);
89
+ u = S(document, s), document.addEventListener("keydown", c), window.addEventListener("scroll", l, !0);
90
+ }
91
+ function f() {
92
+ u?.(), u = void 0, document.removeEventListener("keydown", c), window.removeEventListener("scroll", l, !0);
92
93
  }
93
94
  g(e, (e) => {
94
95
  if (!e) {
95
- d();
96
+ f();
96
97
  return;
97
98
  }
98
99
  let t = r.value;
@@ -104,37 +105,37 @@ function F({ isOpen: e, onClose: t, align: n = "left" }) {
104
105
  let t = e.getBoundingClientRect();
105
106
  o(a.bottom + 4, a.right - t.width);
106
107
  } else o(a.bottom + 4, a.left);
107
- }) : o(a.bottom + 4, a.left), u();
108
- }), m(d);
109
- function f(e) {
108
+ }) : o(a.bottom + 4, a.left), d();
109
+ }), m(f);
110
+ function p(e) {
110
111
  e.preventDefault(), e.stopPropagation();
111
112
  }
112
113
  return {
113
114
  containerRef: r,
114
115
  dropdownRef: i,
115
116
  dropdownStyle: a,
116
- handleMouseDown: f
117
+ handleMouseDown: p
117
118
  };
118
119
  }
119
120
  //#endregion
120
121
  //#region src/composables/useHistory.ts
121
- function I(e, t) {
122
+ function L(e, t) {
122
123
  let n = d(() => {
123
124
  t.value;
124
125
  let n = e.value;
125
- return n ? b(n.state) > 0 : !1;
126
+ return n ? x(n.state) > 0 : !1;
126
127
  }), r = d(() => {
127
128
  t.value;
128
129
  let n = e.value;
129
- return n ? v(n.state) > 0 : !1;
130
+ return n ? y(n.state) > 0 : !1;
130
131
  });
131
132
  function i() {
132
133
  let t = e.value;
133
- return t ? y(t.state, t.dispatch) : !1;
134
+ return t ? b(t.state, t.dispatch) : !1;
134
135
  }
135
136
  function a() {
136
137
  let t = e.value;
137
- return t ? _(t.state, t.dispatch) : !1;
138
+ return t ? v(t.state, t.dispatch) : !1;
138
139
  }
139
140
  return {
140
141
  canUndo: n,
@@ -145,14 +146,14 @@ function I(e, t) {
145
146
  }
146
147
  //#endregion
147
148
  //#region src/utils/selectionHighlight.ts
148
- var L = {
149
+ var R = {
149
150
  backgroundColor: "rgba(26, 115, 232, 0.3)",
150
151
  borderRadius: 0,
151
152
  zIndex: 0,
152
153
  opacity: 1,
153
154
  mixBlendMode: "multiply"
154
155
  };
155
- function R(e) {
156
+ function z(e) {
156
157
  let t = window.getSelection();
157
158
  if (!t || t.rangeCount === 0 || t.isCollapsed) return [];
158
159
  let n = t.getRangeAt(0);
@@ -163,7 +164,7 @@ function R(e) {
163
164
  r = t.left + e.scrollLeft, i = t.top + e.scrollTop;
164
165
  }
165
166
  let a = [];
166
- for (let e of n.getClientRects()) e.width === 0 && e.height === 0 || a.push({
167
+ for (let e of n.getClientRects()) (e.width !== 0 || e.height !== 0) && a.push({
167
168
  left: e.left - r,
168
169
  top: e.top - i,
169
170
  width: e.width,
@@ -171,7 +172,7 @@ function R(e) {
171
172
  });
172
173
  return a;
173
174
  }
174
- function z(e, t = 2) {
175
+ function B(e, t = 2) {
175
176
  if (e.length <= 1) return e;
176
177
  let n = [...e].sort((e, n) => Math.abs(e.top - n.top) < t ? e.left - n.left : e.top - n.top), r = n[0];
177
178
  if (!r) return e;
@@ -187,23 +188,23 @@ function z(e, t = 2) {
187
188
  }
188
189
  return i.push(a), i;
189
190
  }
190
- function B(e) {
191
- return z(R(e));
191
+ function V(e) {
192
+ return B(z(e));
192
193
  }
193
- function V() {
194
+ function H() {
194
195
  let e = window.getSelection();
195
196
  return e !== null && !e.isCollapsed && e.rangeCount > 0;
196
197
  }
197
- function H(e) {
198
+ function U(e) {
198
199
  let t = window.getSelection();
199
200
  return !t || t.rangeCount === 0 ? !1 : e.contains(t.getRangeAt(0).commonAncestorContainer);
200
201
  }
201
- var U = "docx-selection-styles", W = null;
202
- function G() {
203
- W &&= (W.remove(), null), document.getElementById(U)?.remove();
202
+ var W = "docx-selection-styles", G = null;
203
+ function K() {
204
+ G &&= (G.remove(), null), document.getElementById(W)?.remove();
204
205
  }
205
- function K(e = L) {
206
- G();
206
+ function q(e = R) {
207
+ K();
207
208
  let t = `
208
209
  /* DOCX Editor Selection Highlighting */
209
210
 
@@ -265,34 +266,30 @@ function K(e = L) {
265
266
  border-bottom: 2px dashed rgba(156, 39, 176, 0.6);
266
267
  }
267
268
  `;
268
- W = document.createElement("style"), W.id = U, W.textContent = t, document.head.appendChild(W);
269
+ G = document.createElement("style"), G.id = W, G.textContent = t, document.head.appendChild(G);
269
270
  }
270
- function q() {
271
- return W !== null || document.getElementById(U) !== null;
271
+ function J() {
272
+ return G !== null || document.getElementById(W) !== null;
272
273
  }
273
274
  //#endregion
274
275
  //#region src/composables/useSelectionHighlight.ts
275
- function J() {
276
+ function Y() {
276
277
  return window.getSelection()?.toString() ?? "";
277
278
  }
278
- function Y(e) {
279
- let { containerRef: t, enabled: n = !0, config: r = L, useOverlay: i = !1, debounceMs: a = 16, onSelectionChange: o } = e, s = h(!1), c = h(""), l = h([]), u = h(!1), m = null, _ = 0;
279
+ function X(e) {
280
+ let { containerRef: t, enabled: n = !0, config: r = R, useOverlay: i = !1, debounceMs: a = 16, onSelectionChange: o } = e, s = h(!1), c = h(""), l = h([]), u = h(!1), m = null, _ = 0;
280
281
  function v() {
281
- let e = t.value, n = V(), r = J(), a = e ? H(e) : !1;
282
- s.value = n, c.value = r, u.value = a, l.value = i && a && e ? B(e) : [], o?.(n && a, r);
282
+ let e = t.value, n = H(), r = Y(), a = e ? U(e) : !1;
283
+ s.value = n, c.value = r, u.value = a, l.value = i && a && e ? V(e) : [], o?.(n && a, r);
283
284
  }
284
285
  function y() {
285
286
  v();
286
287
  }
287
288
  function b() {
288
289
  let e = performance.now();
289
- if (e - _ < a) {
290
- m && clearTimeout(m), m = setTimeout(() => {
291
- _ = performance.now(), v(), m = null;
292
- }, a);
293
- return;
294
- }
295
- _ = e, v();
290
+ e - _ < a ? (m && clearTimeout(m), m = setTimeout(() => {
291
+ _ = performance.now(), v(), m = null;
292
+ }, a)) : (_ = e, v());
296
293
  }
297
294
  function x(e) {
298
295
  let t = {
@@ -308,7 +305,7 @@ function Y(e) {
308
305
  return r.borderRadius && (t.borderRadius = `${r.borderRadius}px`), r.borderColor && (t.border = `1px solid ${r.borderColor}`), t;
309
306
  }
310
307
  return p(() => {
311
- n && (q() || K(r), document.addEventListener("selectionchange", b));
308
+ n && (J() || q(r), document.addEventListener("selectionchange", b));
312
309
  }), f(() => {
313
310
  document.removeEventListener("selectionchange", b), m && clearTimeout(m);
314
311
  }), g(t, () => v()), {
@@ -322,8 +319,8 @@ function Y(e) {
322
319
  }
323
320
  //#endregion
324
321
  //#region src/composables/useTableSelection.ts
325
- function X() {
326
- let e = new D(), t = h(null), n = () => {
322
+ function Z() {
323
+ let e = new O(), t = h(null), n = () => {
327
324
  let n = e.getSnapshot();
328
325
  t.value = n.tableIndex !== null && n.rowIndex !== null && n.columnIndex !== null ? {
329
326
  tableIndex: n.tableIndex,
@@ -340,12 +337,8 @@ function X() {
340
337
  });
341
338
  }
342
339
  function a(t, n) {
343
- let r = O(t, n);
344
- if (!r) {
345
- e.clearSelection();
346
- return;
347
- }
348
- e.selectCellCoordinates(r);
340
+ let r = k(t, n);
341
+ r ? e.selectCellCoordinates(r) : e.clearSelection();
349
342
  }
350
343
  function o() {
351
344
  e.clearSelection();
@@ -363,21 +356,21 @@ function X() {
363
356
  }
364
357
  //#endregion
365
358
  //#region src/composables/useVisualLineNavigation.ts
366
- function Z(e) {
367
- let t = k();
359
+ function Q(e) {
360
+ let t = A();
368
361
  function n(t) {
369
362
  let n = e.value;
370
- return n ? M(n, t) : null;
363
+ return n ? N(n, t) : null;
371
364
  }
372
365
  function r(t) {
373
366
  let n = e.value;
374
- return n ? A(n, t) : null;
367
+ return n ? j(n, t) : null;
375
368
  }
376
369
  function i(e, t) {
377
- return j(e, t);
370
+ return M(e, t);
378
371
  }
379
372
  function a(n, r) {
380
- return N(t, n, r, e.value);
373
+ return P(t, n, r, e.value);
381
374
  }
382
375
  return {
383
376
  state: t,
@@ -388,4 +381,4 @@ function Z(e) {
388
381
  };
389
382
  }
390
383
  //#endregion
391
- export { c as colorModePlugin, T as createSelectionFromDOM, n as defaultColorMode, a as extractTrackedChanges, E as getSelectionRuns, i as provideColorMode, w as runsToClipboardContent, P as useClipboard, u as useColorMode, o as useDocxEditor, t as useDragAutoScroll, e as useFindReplace, F as useFixedDropdown, I as useHistory, Y as useSelectionHighlight, r as useTableResize, X as useTableSelection, s as useTrackedChanges, Z as useVisualLineNavigation, l as useWheelZoom, l as useZoom };
384
+ export { t as colorModePlugin, C as createSelectionFromDOM, i as defaultColorMode, a as extractTrackedChanges, w as getSelectionRuns, u as provideColorMode, D as runsToClipboardContent, F as useClipboard, n as useColorMode, c as useDocxEditor, e as useDragAutoScroll, o as useFindReplace, I as useFixedDropdown, L as useHistory, X as useSelectionHighlight, r as useTableResize, Z as useTableSelection, s as useTrackedChanges, Q as useVisualLineNavigation, l as useWheelZoom, l as useZoom };
package/dist/dialogs.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./SplitCellDialog-DzKBu09z.cjs");exports.FindReplaceDialog=e.m,exports.FootnotePropertiesDialog=e.s,exports.HyperlinkDialog=e.p,exports.ImagePositionDialog=e.o,exports.ImagePropertiesDialog=e.f,exports.InsertImageDialog=e.a,exports.InsertSymbolDialog=e.d,exports.InsertTableDialog=e.r,exports.PageSetupDialog=e.u,exports.PasteSpecialDialog=e.n,exports.SplitCellDialog=e.t,exports.TablePropertiesDialog=e.l,exports.WatermarkDialog=e.c;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./SplitCellDialog-DfMw2Ev2.cjs");exports.FindReplaceDialog=e.m,exports.FootnotePropertiesDialog=e.s,exports.HyperlinkDialog=e.p,exports.ImagePositionDialog=e.o,exports.ImagePropertiesDialog=e.f,exports.InsertImageDialog=e.a,exports.InsertSymbolDialog=e.d,exports.InsertTableDialog=e.r,exports.PageSetupDialog=e.u,exports.PasteSpecialDialog=e.n,exports.SplitCellDialog=e.t,exports.TablePropertiesDialog=e.l,exports.WatermarkDialog=e.c;
package/dist/dialogs.js CHANGED
@@ -1,2 +1 @@
1
- import { a as e, c as t, d as n, f as r, l as i, m as a, n as o, o as s, p as c, r as l, s as u, t as d, u as f } from "./SplitCellDialog-CSqbtDum.js";
2
- export { a as FindReplaceDialog, u as FootnotePropertiesDialog, c as HyperlinkDialog, s as ImagePositionDialog, r as ImagePropertiesDialog, e as InsertImageDialog, n as InsertSymbolDialog, l as InsertTableDialog, f as PageSetupDialog, o as PasteSpecialDialog, d as SplitCellDialog, i as TablePropertiesDialog, t as WatermarkDialog };
1
+ export { m as FindReplaceDialog, s as FootnotePropertiesDialog, p as HyperlinkDialog, o as ImagePositionDialog, f as ImagePropertiesDialog, a as InsertImageDialog, d as InsertSymbolDialog, r as InsertTableDialog, u as PageSetupDialog, n as PasteSpecialDialog, t as SplitCellDialog, l as TablePropertiesDialog, c as WatermarkDialog } from "./SplitCellDialog-bNeugz_3.js";