@stll/folio-vue 0.9.0 → 0.11.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.
- package/dist/{ListButtons-C1rU_Y1e.cjs → ListButtons-24sQYGSe.cjs} +2 -2
- package/dist/{ListButtons-DMnOM2pN.js → ListButtons-CAw3PKiv.js} +388 -384
- package/dist/SplitCellDialog-DJ-z75hr.cjs +15 -0
- package/dist/{WatermarkDialog-Cf9ISDvv.js → SplitCellDialog-DUzOQhr6.js} +990 -978
- package/dist/components/AutocompleteCaretOverlay.types.d.ts +18 -0
- package/dist/components/DocxEditor/pagedEditorRef.d.ts +14 -0
- package/dist/components/DocxEditor/types.d.ts +60 -0
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/useColorMode.d.ts +17 -4
- package/dist/composables/useCommentManagement.d.ts +8 -2
- package/dist/composables/useContextMenus.d.ts +3 -0
- package/dist/composables/useDocxEditor.d.ts +21 -0
- package/dist/composables/useDocxEditorRefApi.d.ts +18 -2
- package/dist/composables/useFontLifecycle.d.ts +22 -0
- package/dist/composables/useKeyboardShortcuts.d.ts +0 -1
- package/dist/composables/usePagesPointer.d.ts +5 -0
- package/dist/composables.cjs +2 -2
- package/dist/composables.js +75 -75
- package/dist/dialogs.cjs +1 -1
- package/dist/dialogs.js +2 -2
- package/dist/folio-vue.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +1762 -1278
- package/dist/renderAsync.d.ts +4 -0
- package/dist/ui/folio-ui.d.ts +1 -1
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +10 -10
- package/dist/useZoom-DBbzwfMG.cjs +1 -0
- package/dist/useZoom-DwDDS7hq.js +749 -0
- package/dist/utils/colorMode.d.ts +3 -4
- package/dist/utils/embeddedFonts.d.ts +20 -0
- package/dist/utils/fontFaces.d.ts +10 -0
- package/dist/utils/hostFonts.d.ts +1 -5
- package/package.json +2 -2
- package/dist/WatermarkDialog-ChJtT7Bs.cjs +0 -15
- package/dist/composables/useHostCallbacks.d.ts +0 -24
- package/dist/composables/useMenuActions.d.ts +0 -36
- package/dist/useZoom-BYEcnpS0.cjs +0 -1
- package/dist/useZoom-C0p0o54p.js +0 -656
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
2
|
-
import { EditorView } from 'prosemirror-view';
|
|
3
|
-
import { Command } from 'prosemirror-state';
|
|
4
|
-
/**
|
|
5
|
-
* A toolbar/menu command factory: called with whatever arguments the
|
|
6
|
-
* specific command needs, it returns a ProseMirror `Command`. The
|
|
7
|
-
* argument list is heterogeneous across commands (some take none,
|
|
8
|
-
* `insertTable` takes rows/cols), so it is typed structurally rather
|
|
9
|
-
* than per-command.
|
|
10
|
-
*/
|
|
11
|
-
type CommandFactory = (...args: readonly unknown[]) => Command;
|
|
12
|
-
export type UseMenuActionsOptions = {
|
|
13
|
-
editorView: Ref<EditorView | null>;
|
|
14
|
-
getCommands: () => Record<string, CommandFactory>;
|
|
15
|
-
docxInputRef: Ref<HTMLInputElement | null>;
|
|
16
|
-
imageInputRef: Ref<HTMLInputElement | null>;
|
|
17
|
-
showPageSetup: Ref<boolean>;
|
|
18
|
-
showWatermark: Ref<boolean>;
|
|
19
|
-
showHyperlink: Ref<boolean>;
|
|
20
|
-
showInsertSymbol: Ref<boolean>;
|
|
21
|
-
showKeyboardShortcuts: Ref<boolean>;
|
|
22
|
-
handleClearFormatting: () => void;
|
|
23
|
-
handleInsertPageBreak: () => void;
|
|
24
|
-
handleInsertSectionBreakNextPage: () => void;
|
|
25
|
-
handleInsertSectionBreakContinuous: () => void;
|
|
26
|
-
handleToggleOutline: () => void;
|
|
27
|
-
handleToggleSidebar: () => void;
|
|
28
|
-
downloadCurrentDocument: () => Promise<void>;
|
|
29
|
-
emit: (event: string, ...args: unknown[]) => void;
|
|
30
|
-
};
|
|
31
|
-
export declare function useMenuActions(opts: UseMenuActionsOptions): {
|
|
32
|
-
handleMenuAction: (action: string) => void;
|
|
33
|
-
handleMenuTableInsert: (rows: number, cols: number) => void;
|
|
34
|
-
execSimpleCommand: (name: string) => void;
|
|
35
|
-
};
|
|
36
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e=require("vue"),t=require("@stll/folio-core/paged-layout/sectionGeometry"),n=require("@stll/folio-core/prosemirror/plugins/anonymizationDecorations"),r=require("@stll/folio-core/prosemirror/plugins/templateDirectives"),i=require("@stll/folio-core/prosemirror/plugins/suggestionMode"),a=require("@stll/folio-core/controller/folioEditor"),o=require("@stll/folio-core/controller/folioEditorEvents"),s=require("@stll/folio-core/controller/collaborationModules"),c=require("@stll/folio-core/controller/headerFooterEditorManager"),l=require("@stll/folio-core/controller/hiddenEditorManager"),u=require("@stll/folio-core/controller/layoutPipeline"),d=require("@stll/folio-core/controller/layoutScheduler"),f=require("@stll/folio-core/controller/layoutSession"),p=require("@stll/folio-core/docx/parser"),m=require("@stll/folio-core/docx/footnoteParser"),h=require("@stll/folio-core/layout-bridge/convert/headerFooterLayout"),g=require("@stll/folio-core/layout-engine"),_=require("@stll/folio-core/layout-painter"),ee=require("@stll/folio-core/paged-layout/LayoutSelectionGate"),v=require("@stll/folio-core/paged-layout/transactionDirtyRange"),y=require("@stll/folio-core/prosemirror/conversion/fromProseDoc"),te=require("@stll/folio-core/prosemirror/extensions/ExtensionManager"),b=require("@stll/folio-core/prosemirror/extensions/features/ParagraphChangeTrackerExtension"),ne=require("@stll/folio-core/prosemirror/extensions/StarterKit"),re=require("@stll/folio-core/prosemirror/plugins/templatePreviewValues"),ie=require("@stll/folio-core/prosemirror/plugins/templateSlashMenu"),ae=require("@stll/folio-core/utils/headerFooter"),oe=require("@stll/folio-core/utils/findVerticalScrollParent"),x=require("@stll/folio-core/prosemirror/tableResize"),S=require("@stll/folio-core/prosemirror/utils/extractTrackedChanges"),C=require("@stll/folio-core/utils/zoom");var se=24,ce=32,le=96,ue=250,de=[];function fe(e){let n=e?.columnCount??1;if(n<=1)return;let r={count:n,gap:(0,t.twipsToPixels)(e?.columnSpace??720),equalWidth:e?.equalWidth??!0};return e?.separator!==void 0&&(r.separator=e.separator),r}function pe(e,t,n,r,i,a){if(!e)return;let o=t?{...a,rId:t}:a,s=t?n?.getView(t):null;return s?(0,h.convertHeaderFooterPmDocToContent)(s.state.doc,r,i,o):(0,h.convertHeaderFooterToContent)(e,r,i,o)}function me(e,t,n,r,i){if(!e||e.size===0)return;let a=new Map;for(let[o,s]of e){let e=pe(s,o,t,n,r,i);e&&a.set(o,e)}return a.size>0?a:void 0}function he(e,t,n){let r=new Map;if(!n||!n.package.footnotes)return r;let i=new Map;for(let e of n.package.footnotes)e.noteType&&e.noteType!==`normal`||i.set(e.id,e);for(let[n,a]of e){let e=[];for(let n of a){let r=i.get(n);if(!r)continue;let a=t.get(n),o=a?.displayNumber??0;e.push({displayNumber:String(o),text:(0,m.getFootnoteText)(r),...a?{content:{blocks:a.blocks,measures:a.measures,height:a.height}}:{}})}e.length>0&&r.set(n,e)}return r}var ge=new Set([`black`,`blue`,`cyan`,`darkBlue`,`darkCyan`,`darkGray`,`darkGreen`,`darkMagenta`,`darkRed`,`darkYellow`,`green`,`lightGray`,`magenta`,`none`,`red`,`white`,`yellow`]);function _e(e){let t=[],n=(e,r)=>{for(let[n,i]of e.marks.entries())i.type.name===`highlight`&&!ge.has(String(i.attrs.color))&&t.push(`${r}.marks[${n}]=${JSON.stringify(i.attrs)}`);e.forEach((e,t,i)=>{n(e,`${r}.content[${i}]`)})};return n(e,`doc`),t.join(`; `)}function ve(){return typeof document>`u`||!(`fonts`in document)||document.fonts.status===`loaded`}function ye(m){let{hiddenContainer:h,hiddenHeaderFooterContainer:oe,pagesContainer:x,readOnly:S=!1,pageGap:C=se,documentKey:ge,password:ye,editorMode:w,author:T,externalPlugins:be=[],collaboration:E,onAnonymizationMatchesChange:xe,showTemplateDirectives:Se,onSlashMenuChange:Ce,onSlashMenuKeyAction:D,onChange:O,onError:k,onSelectionUpdate:A,onEditorViewReady:we,onReadOnlyEditAttempt:Te,featureFlags:Ee,onSelectiveSaveTripwire:De}=m,Oe=oe??h,j=(0,e.shallowRef)(null),M=(0,e.shallowRef)(null),N=(0,e.shallowRef)(null),P=(0,e.shallowRef)(null),F=(0,e.shallowRef)([]),I=(0,e.shallowRef)(null),L=(0,e.shallowRef)(null),ke=(0,e.shallowRef)([]),Ae=(0,e.shallowRef)([]),R=(0,e.ref)(!1),z=(0,e.ref)(null),B=(0,e.ref)(!1),V=new te.ExtensionManager((0,ne.createStarterKit)());V.buildSchema(),V.initializeRuntime();let je=(0,i.createSuggestionModePlugin)(!1),Me=(0,n.createAnonymizationDecorationsPlugin)({onMatchesChange:e=>xe?.(e)}),H=(0,r.createTemplateDirectivesPlugin)(),U=(0,ie.templateSlashMenuPlugin)({onChange:e=>Ce?.(e),onKeyAction:e=>D?.(e)??!1}),Ne=(0,re.createTemplatePreviewValuesPlugin)(),W=()=>(0,e.toValue)(Se)===!0;function Pe(){return[je,...be,...(0,e.toValue)(E)?.plugins??[],Me,...W()?[H,U]:[],Ne]}let G=(0,o.createFolioEditorEmitter)(),K=new ee.LayoutSelectionGate,Fe=(0,f.createLayoutSession)(),Ie=new _.LayoutPainter({pageGap:C,showShadow:!0}),q=(0,c.createHeaderFooterEditorManager)({getHost:()=>Oe.value,getDocument:()=>j.value,getStyles:()=>j.value?.package.styles??null,getTheme:()=>j.value?.package.theme??null,onTransaction:({rId:e,kind:t,view:n,docChanged:r,selectionChanged:i})=>{if(r){B.value=!0;let e=M.value;e&&Y.schedule(e.state,null)}if(r||i){let{from:r,to:i}=n.state.selection;I.value={from:r,kind:t,rId:e,to:i},A?.(n.state),G.emit(`selectionChange`,{from:r,to:i})}K.requestRender()}});function Le(e){e.layout&&(L.value=e.layout),e.blocks&&(ke.value=e.blocks),e.measures&&(Ae.value=e.measures),e.blockLookup&&Ie.setBlockLookup(e.blockLookup),e.layout&&G.emit(`layoutComplete`,e.layout)}function J(e,n={}){let r=x.value,i=r instanceof HTMLDivElement?r:null,a=j.value,o=a?.package.document,s=o?.sections?.[0]?.properties??o?.finalSectionProperties??null,c=(0,t.getPageSize)(s),l=(0,t.getMargins)(s),d=fe(s),f=c.w-l.left-l.right,p=a?.package.styles??null,m=a?.package.theme??null,h=a?.package.settings?.defaultTabStop,_=a?.package.settings,ee=_!==void 0&&`mirrorMargins`in _&&_.mirrorMargins===!0,v=(0,ae.resolveHeaderFooterContent)(a?.package);try{Le((0,u.runLayoutPipeline)({contentWidth:f,columns:d,pageSize:c,margins:l,pageGap:C,syncCoordinator:K,headerContent:v.headerContent,footerContent:v.footerContent,firstPageHeaderContent:v.firstPageHeaderContent,firstPageFooterContent:v.firstPageFooterContent,headerContentRId:v.activeHeaderRId,footerContentRId:v.activeFooterRId,firstPageHeaderContentRId:v.activeFirstHeaderRId,firstPageFooterContentRId:v.activeFirstFooterRId,sectionHeaderFooterRefs:(0,g.resolveSectionHeaderFooterRefs)(a),theme:m,sectionProperties:s,document:a,defaultTabStop:h,mirrorMargins:ee,styles:p,layout:L.value,hfPMs:q,painter:Ie,pagesContainer:i,session:Fe,renderHfFromContentOrPm:pe,renderHeaderFooterContentByRId:me,documentFontsAreLoaded:ve,buildFootnoteRenderItems:he,describeInvalidHighlightMarks:_e,emptyTemplatePreviewEntries:de},e,n))}catch(e){let t=e instanceof Error?e:Error(String(e));k?.(t)}}let Y=(0,d.createLayoutScheduler)({runLayout:(e,t)=>J(e,t),debounceMs:ce,maxDelayMs:le,clock:d.browserClock}),X=null;function Re(){X!==null&&(window.clearTimeout(X),X=null);let e=M.value,t=j.value;if(!(!e||!t))try{let n=(0,y.fromProseDoc)(e.state.doc,t);j.value=n,q.sync(),O?.(n),G.emit(`docChange`,n)}catch(e){k?.(e instanceof Error?e:Error(String(e)))}}function ze(){X!==null&&window.clearTimeout(X),X=window.setTimeout(()=>{X=null,Re()},ue)}let Z=(0,l.createHiddenEditorManager)({getHost:()=>h.value,getDocument:()=>j.value,getStyles:()=>j.value?.package.styles??null,getExtensionManager:()=>V,getExternalPlugins:Pe,getCollaboration:()=>(0,e.toValue)(E),getCollaborationModules:()=>P.value,getPrecomputedInitialState:()=>null,getReadOnly:()=>(0,e.toValue)(S),getDocumentKey:()=>(0,e.toValue)(ge),getDocumentContext:()=>j.value,onTransaction:Be,onSelectionChange:e=>{N.value=e,A?.(e),G.emit(`selectionChange`,{from:e.selection.from,to:e.selection.to})},onKeyDown:()=>!1,onReadOnlyEditAttempt:()=>Te?.(),onEditorViewReady:Ve,onEditorViewDestroy:()=>{M.value=null,R.value=!1,we?.(null)},onRemoteSelectionsChange:e=>{F.value=e}}),Q=()=>{let t=(0,e.toValue)(E)?.awareness,n=P.value,r=Z.getView();F.value=t&&n&&r?(0,l.collectRemoteSelections)(r.state,t,n):[]};(0,e.watch)(()=>(0,e.toValue)(E),(e,t,n)=>{if(F.value=[],!e){P.value=null,Z.retryViewCreation(),Z.syncExternalDocument();return}let r=!1;n(()=>{r=!0}),P.value=null,(0,s.loadCollaborationModules)().then(e=>{r||(P.value=e,Z.retryViewCreation(),Z.syncExternalDocument(),Q())},e=>{r||(P.value=null,k?.(e instanceof Error?e:Error(String(e))))})},{immediate:!0}),(0,e.watch)(()=>({awareness:(0,e.toValue)(E)?.awareness,modules:P.value,view:M.value}),({awareness:e,modules:t,view:n},r,i)=>{if(!e||!t||!n){F.value=[];return}e.on(`change`,Q),Q(),i(()=>{e.off(`change`,Q),F.value=[]})},{flush:`post`});function Be(e,t){N.value=t,e.docChanged&&(B.value=!0,K.incrementStateSeq(),Y.schedule(t,(0,v.getTransactionDirtyRange)(e)),ze()),K.requestRender()}function Ve(t){M.value=t,N.value=t.state,R.value=!0,J(t.state,{reason:`initial`}),K.requestRender(),Ue(t),we?.(t),(0,e.toValue)(S)||requestAnimationFrame(()=>{M.value===t&&t.focus()})}let He=(0,a.createFolioEditor)({getEditorApi:()=>Z.api,getLayout:()=>L.value,runLayout:(e,t)=>J(e,t),emitter:G});function Ue(t){(0,i.setSuggestionMode)((0,e.toValue)(w)===`suggesting`,t.state,t.dispatch,(0,e.toValue)(T))}(0,e.watch)([()=>(0,e.toValue)(w),()=>(0,e.toValue)(T)],()=>{let e=M.value;e&&Ue(e)}),(0,e.watch)(()=>(0,e.toValue)(S),()=>Z.syncEditable());function We(e){let t=W();if(t===e.state.plugins.includes(H))return;let n=e.state.plugins.filter(e=>e!==H&&e!==U);if(t){let e=n.indexOf(Ne),t=e===-1?n.length:e;n.splice(t,0,H,U)}e.updateState(e.state.reconfigure({plugins:n}))}(0,e.watch)(()=>W(),()=>{let e=M.value;e&&We(e)});function Ge(){Z.ensureView()}function Ke(){B.value=!1,I.value=null,Y.dispose(),Z.destroyView(),q.sync(),Z.ensureView(),Z.getView()||qe()}function qe(){let t=j.value;if(!(!t||(0,e.toValue)(E)))try{let e=(0,l.createHiddenEditorState)({document:t,styles:t.package.styles??null,manager:V,externalPlugins:Pe(),collaborationModules:null,reason:`mount`});N.value=e,J(e,{reason:`initial`})}catch(e){k?.(e instanceof Error?e:Error(String(e)))}}(0,e.watch)([h,x,Oe],()=>{h.value&&j.value&&!Z.getView()&&Ge(),q.sync()},{flush:`post`});async function Je(t){z.value=null,R.value=!1;try{let n=await(0,p.parseDocx)(t,{password:(0,e.toValue)(ye)});j.value=n,Ke()}catch(e){let t=e instanceof Error?e:Error(String(e));z.value=t.message,k?.(t)}}function Ye(e){z.value=null,j.value=e,Ke()}async function Xe(t){let n=M.value,r=j.value;if(!n||!r)return null;let i=q.snapshotDocument(r),a=n.state,{resolveSelectiveSaveFlags:o}=await import(`@stll/folio-core/docx/selectiveSaveFlags`),s=o((0,e.toValue)(Ee)),c=(0,y.fromProseDoc)(a.doc,i),l=c.originalBuffer??null,u=s.selectiveSave&&t?.selective!==!1,d=u||s.selectiveSaveTripwire,{repackDocx:f,createDocx:p}=await import(`@stll/folio-core/docx/rezip`),m=null;if(d&&l){let{attemptSelectiveSave:e}=await import(`@stll/folio-core/docx/selectiveSave`);m=await e(c,l,{changedParaIds:(0,b.getChangedParagraphIds)(a),structuralChange:(0,b.hasStructuralChanges)(a),hasUntrackedChanges:(0,b.hasUntrackedChanges)(a),maxBytes:s.selectiveSaveMaxBytes})}let h=u?m:null,g=null;if(!h)g=l?await f(c):await p(c),h=g;else if(s.selectiveSaveTripwire)try{g=await f(c)}catch{}if(s.selectiveSaveTripwire&&g&&De)try{let{compareSelectiveVsFull:e}=await import(`@stll/folio-core/docx/selectiveSaveTripwire`);De(await e(m,g))}catch{}return j.value=c,q.sync(),B.value=!1,new Blob([h],{type:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`})}function Ze(){let e=j.value;return e?q.snapshotDocument(e):null}function Qe(e){j.value=e,q.sync()}function $e(e){return q.getView(e)}function et(){q.sync()}function tt(){return V.getCommands()}function nt(){M.value?.focus()}function rt(){let e=M.value;e&&J(e.state,{reason:`manual`})}function $(){Y.dispose(),X!==null&&(window.clearTimeout(X),X=null),Z.destroyView(),F.value=[],q.destroy(),V.destroy(),N.value=null,L.value=null,j.value=null,R.value=!1}return(0,e.onScopeDispose)($),{editor:He,editorView:M,editorState:N,remoteSelections:F,headerFooterSelection:I,isReady:R,isDirty:B,parseError:z,layout:L,blocks:ke,measures:Ae,syncCoordinator:K,loadBuffer:Je,loadDocument:Ye,save:Xe,getDocument:Ze,setDocument:Qe,getHeaderFooterView:$e,syncHeaderFooterViews:et,getCommands:tt,focus:nt,reLayout:rt,destroy:$}}function w(e,t){if(t<e.top+40){let n=Math.max(0,e.top+40-t);return-Math.min(12,n/40*12)}if(t>e.bottom-40){let n=Math.max(0,t-(e.bottom-40));return Math.min(12,n/40*12)}return 0}function T({pagesContainer:t,onScrollExtendSelection:n}){let r=null,i=0,a=0,o=!1,s=null;function c(){if(s)return s;let e=t.value;return e?(s=(0,oe.findVerticalScrollParent)(e),s):null}function l(){o=!1,r!==null&&(cancelAnimationFrame(r),r=null)}function u(){if(!o)return;let e=c();if(!e)return;let t=w(e.getBoundingClientRect(),a);t!==0&&(e.scrollTop+=t,n(i,a)),r=requestAnimationFrame(u)}function d(){o||(o=!0,r=requestAnimationFrame(u))}function f(e,t){if(i=e,a=t,!o){let e=c();if(!e)return;let n=e.getBoundingClientRect();(t<n.top+40||t>n.bottom-40)&&d()}}return(0,e.onScopeDispose)(()=>l()),{updateMousePosition:f,stopAutoScroll:l}}function be(){let e={active:!1,startX:0,handle:null,columnIndex:0,tablePmStart:0,origWidths:{left:0,right:0}},t={active:!1,startY:0,handle:null,rowIndex:0,isEdge:!1,tablePmStart:0,origHeight:0},n={active:!1,startX:0,handle:null,columnIndex:0,tablePmStart:0,origWidth:0},r=null;function i(){return e.active||t.active||n.active}function a(i,a){let o=i.target;return o instanceof HTMLElement?o.classList.contains(`layout-table-resize-handle`)?(i.preventDefault(),i.stopPropagation(),r=a,e.active=!0,e.startX=i.clientX,e.handle=o,o.classList.add(`dragging`),e.columnIndex=parseInt(o.dataset.columnIndex??`0`,10),e.tablePmStart=parseInt(o.dataset.tablePmStart??`0`,10),E(a,e),!0):o.classList.contains(`layout-table-row-resize-handle`)||o.classList.contains(`layout-table-edge-handle-bottom`)?(i.preventDefault(),i.stopPropagation(),r=a,t.active=!0,t.startY=i.clientY,t.handle=o,t.isEdge=o.dataset.isEdge===`bottom`,o.classList.add(`dragging`),t.rowIndex=parseInt(o.dataset.rowIndex??`0`,10),t.tablePmStart=parseInt(o.dataset.tablePmStart??`0`,10),xe(a,t,o),!0):o.classList.contains(`layout-table-edge-handle-right`)?(i.preventDefault(),i.stopPropagation(),r=a,n.active=!0,n.startX=i.clientX,n.handle=o,o.classList.add(`dragging`),n.columnIndex=parseInt(o.dataset.columnIndex??`0`,10),n.tablePmStart=parseInt(o.dataset.tablePmStart??`0`,10),Se(a,n),!0):!1:!1}function o(r){if(e.active&&e.handle){r.preventDefault();let t=r.clientX-e.startX,n=parseFloat(e.handle.style.left);e.handle.style.left=`${n+t}px`,e.startX=r.clientX;let i=Math.round(t*x.TWIPS_PER_PIXEL),a=e.origWidths.left+i,o=e.origWidths.right-i;a>=x.MIN_CELL_WIDTH_TWIPS&&o>=x.MIN_CELL_WIDTH_TWIPS&&(e.origWidths={left:a,right:o});return}if(t.active&&t.handle){r.preventDefault();let e=r.clientY-t.startY,n=parseFloat(t.handle.style.top);t.handle.style.top=`${n+e}px`,t.startY=r.clientY;let i=Math.round(e*x.TWIPS_PER_PIXEL),a=t.origHeight+i;a>=x.MIN_ROW_HEIGHT_TWIPS&&(t.origHeight=a);return}if(n.active&&n.handle){r.preventDefault();let e=r.clientX-n.startX,t=parseFloat(n.handle.style.left);n.handle.style.left=`${t+e}px`,n.startX=r.clientX;let i=Math.round(e*x.TWIPS_PER_PIXEL),a=n.origWidth+i;a>=x.MIN_CELL_WIDTH_TWIPS&&(n.origWidth=a)}}function s(i){if(e.active){e.active=!1,e.handle?.classList.remove(`dragging`),r&&(0,x.commitColumnResize)(r,{pmStart:e.tablePmStart,colIdx:e.columnIndex,newLeft:e.origWidths.left,newRight:e.origWidths.right}),e.handle=null;return}if(t.active){t.active=!1,t.handle?.classList.remove(`dragging`),r&&(0,x.commitRowResize)(r,{pmStart:t.tablePmStart,rowIdx:t.rowIndex,newHeight:t.origHeight}),t.handle=null;return}n.active&&(n.active=!1,n.handle?.classList.remove(`dragging`),r&&(0,x.commitRightEdgeResize)(r,{pmStart:n.tablePmStart,colIdx:n.columnIndex,newWidth:n.origWidth}),n.handle=null)}function c(){return document.addEventListener(`mousemove`,o),document.addEventListener(`mouseup`,s),()=>{document.removeEventListener(`mousemove`,o),document.removeEventListener(`mouseup`,s)}}return{tryStartResize:a,install:c,isResizing:i}}function E(e,t){let n=(0,x.readColumnWidths)(e,t.tablePmStart,t.columnIndex);n&&(t.origWidths=n)}function xe(e,t,n){let r=(0,x.readRowHeight)(e,t.tablePmStart,t.rowIndex);if(r!=null){t.origHeight=r;return}let i=n.closest(`.layout-table`)?.querySelector(`[data-row-index="${t.rowIndex}"]`),a=i?i.getBoundingClientRect().height:30;t.origHeight=Math.round(a*x.TWIPS_PER_PIXEL)}function Se(e,t){let n=(0,x.readColumnWidthAt)(e,t.tablePmStart,t.columnIndex);n!=null&&(t.origWidth=n)}function Ce(t,n){return(0,e.computed)(()=>(n.value,(0,S.extractTrackedChanges)(t.value?.state??null)))}var D=C.ZOOM_MIN,O=C.ZOOM_MAX,k=[.5,.75,1,1.25,1.5,2];function A(t=1){let n=(0,e.ref)(Math.max(D,Math.min(O,t))),r=(0,e.computed)(()=>Math.round(n.value*100)),i=(0,e.computed)(()=>n.value<=D),a=(0,e.computed)(()=>n.value>=O);function o(e){n.value=Math.max(D,Math.min(O,Math.round(e*100)/100))}function s(){o(n.value+C.ZOOM_STEP)}function c(){o(n.value-C.ZOOM_STEP)}function l(){o(1)}function u(e){(e.ctrlKey||e.metaKey)&&(e.preventDefault(),e.deltaY<0?s():c())}function d(e){(e.ctrlKey||e.metaKey)&&(e.shiftKey||e.altKey||(e.key===`=`||e.key===`+`?(e.preventDefault(),s()):e.key===`-`?(e.preventDefault(),c()):e.key===`0`&&(e.preventDefault(),l())))}function f(){(0,e.onMounted)(()=>document.addEventListener(`keydown`,d)),(0,e.onBeforeUnmount)(()=>document.removeEventListener(`keydown`,d))}return{zoom:n,zoomPercent:r,isMinZoom:i,isMaxZoom:a,setZoom:o,zoomIn:s,zoomOut:c,resetZoom:l,handleWheel:u,handleKeyDown:d,installShortcuts:f,ZOOM_PRESETS:k}}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return A}});
|