collabmd 0.1.52 → 0.1.54
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/bin/collabmd.js +3 -2
- package/dist/client/assets/{CodeMirrorEditor-UCMRAMCV-BEz2BKN1.js → CodeMirrorEditor-UCMRAMCV-kJfwukbn.js} +1 -1
- package/dist/client/assets/{browser-BKLM0ThC-IxjwuOIz-C0mP17s1.js → browser-BKLM0ThC-BCLQGPD6-K2seJgRL.js} +1 -1
- package/dist/client/assets/{browser-utils-vlHL9goC.js → browser-utils-S4QYY31r.js} +1 -1
- package/dist/client/assets/{chunk-RUX4WMZV-BGnd3s_C.js → chunk-ISPTBLVO-BMsDq9Ha.js} +2 -2
- package/dist/client/assets/{chunk-4SOEAONT-C3fufoVl.js → chunk-T5WUORNS-DD7KlyY6.js} +9 -9
- package/dist/client/assets/{direct-engine-DdrQKpgq-4QysbH_V.js → direct-engine-DVLMOJWp-C-YL5NFb.js} +1 -1
- package/dist/client/assets/{dist-CXOUa90Q.js → dist-9Eodxf4G.js} +1 -1
- package/dist/client/assets/{dist-jVKfryIL.js → dist-B2ZNQifU.js} +1 -1
- package/dist/client/assets/dist-B6QCMNze.js +1 -0
- package/dist/client/assets/dist-BIAv19LO.js +1 -0
- package/dist/client/assets/{dist-Bog8M5U3.js → dist-BKYp1-dl.js} +4 -4
- package/dist/client/assets/{dist-DI6c02Da.js → dist-BSAZ-Hek.js} +1 -1
- package/dist/client/assets/{dist-DNONgI1P.js → dist-BSTbcioM.js} +1 -1
- package/dist/client/assets/{dist-BfpAc922.js → dist-BT9gJXCb.js} +1 -1
- package/dist/client/assets/{dist-CAG5sIOj.js → dist-BTVg1m-V.js} +1 -1
- package/dist/client/assets/{dist-GTGhtpyW.js → dist-Bi9ZIYXq.js} +1 -1
- package/dist/client/assets/{dist-CvVoyTRF.js → dist-BpAUe9sL.js} +1 -1
- package/dist/client/assets/{dist-B7fBbwrO.js → dist-Bqo-XRVG.js} +1 -1
- package/dist/client/assets/{dist-CUsXdnU4.js → dist-BrKhPlc9.js} +1 -1
- package/dist/client/assets/{dist-CYMCikZo.js → dist-CBsvKPcT.js} +1 -1
- package/dist/client/assets/{dist-W0FoeIxk.js → dist-CJBYh9Wy.js} +1 -1
- package/dist/client/assets/{dist-Ck-B8onw.js → dist-CRwfjtwz.js} +1 -1
- package/dist/client/assets/{dist-Dx37MHWs.js → dist-CX7Kc61C.js} +1 -1
- package/dist/client/assets/{dist-zHDLm1oE.js → dist-CoXN2D3R.js} +1 -1
- package/dist/client/assets/{dist-D4kDR0g8.js → dist-CucpLxUY.js} +1 -1
- package/dist/client/assets/{dist-Cu5Ze2cs.js → dist-DHBMeCxC.js} +1 -1
- package/dist/client/assets/dist-DLEg9d4u.js +1 -0
- package/dist/client/assets/{dist-Y6zYRI-A.js → dist-DOHWxIty.js} +1 -1
- package/dist/client/assets/{dist-DVBYH83t.js → dist-DYFBD-wW.js} +1 -1
- package/dist/client/assets/{dist-CsQTfQFi.js → dist-DeCV9FU4.js} +1 -1
- package/dist/client/assets/dist-DugWGOjQ.js +1 -0
- package/dist/client/assets/{dist-BVCNc-Es.js → dist-KrdpB_GB.js} +1 -1
- package/dist/client/assets/{dist-B_1hMrc6.js → dist-NNrRnB-f.js} +1 -1
- package/dist/client/assets/{dist-Da-jLrCf.js → dist-PUxZqhFe.js} +1 -1
- package/dist/client/assets/dist-cYiJMWHJ.js +1 -0
- package/dist/client/assets/dist-iKC7go4m.js +1 -0
- package/dist/client/assets/{dist-CKf7LlAo.js → dist-lw5TGjI6.js} +1 -1
- package/dist/client/assets/{dist-DGa-2MNX.js → dist-uk11ih8u.js} +1 -1
- package/dist/client/assets/{document-formatter-gO8qM2qY.js → document-formatter-6I63vstk.js} +1 -1
- package/dist/client/assets/{drawioEditor-DCkWweiy.js → drawioEditor-DNTjsjzJ.js} +1 -1
- package/dist/client/assets/{editor-session-DxRyr4EM.js → editor-session-D8GGkJak.js} +3 -3
- package/dist/client/assets/{embedpdf-DyOonRvx.js → embedpdf-TkbBYowM.js} +1 -1
- package/dist/client/assets/{embedpdf-DA4bA119-DsoNiPlQ.js → embedpdf-cl9qiF45-itpgqvGY.js} +2 -2
- package/dist/client/assets/{en-GNC3RJIS-CEy_oGTd.js → en-JTHJ2SIP-DBz9bRq4.js} +1 -1
- package/dist/client/assets/{estree-DCT3Jm65.js → estree-DGmLqopC.js} +17 -17
- package/dist/client/assets/{excalidraw-element-link-CGZ5934B.js → excalidraw-element-link-BRZOTIeI.js} +2 -2
- package/dist/client/assets/{excalidrawEditor-BVfSxjSO.js → excalidrawEditor-D0orhhku.js} +3 -3
- package/dist/client/assets/{export-page-BCo_e15t.js → export-page-CVJNMERq.js} +3 -3
- package/dist/client/assets/{exportDocument-DP6oE_or.js → exportDocument-DSshnmnZ.js} +2 -2
- package/dist/client/assets/{file-search-3hYF4cYa.js → file-search-BA8o_gs0.js} +1 -1
- package/dist/client/assets/{html-CBXMuS97.js → html-BryNQ_yx.js} +6 -6
- package/dist/client/assets/image-I42VHMUI-B2-c_ifV.js +1 -0
- package/dist/client/assets/index-BCgNcVNs.css +1 -0
- package/dist/client/assets/index-BpmR5Qqk.js +1140 -0
- package/dist/client/assets/{lobby-presence-Cz5jGOPg.js → lobby-presence-KJrYhMdN.js} +1 -1
- package/dist/client/assets/{markdown-Bo71X2X2.js → markdown-CZ1tYEW8.js} +17 -17
- package/dist/client/assets/{pdfium-RAgkpwfK.wasm → pdfium-BJ2Yip8Q.wasm} +0 -0
- package/dist/client/assets/{preview-render-compiler-ktU0SXxY.js → preview-render-compiler-BmWQStaL.js} +1 -1
- package/dist/client/assets/{preview-render-worker-BI2bFVqM.js → preview-render-worker-BA4VK_GY.js} +2 -2
- package/dist/client/assets/prod-CA0ie9yD.js +145 -0
- package/dist/client/assets/prod-yKJZ3E4s.js +1 -0
- package/dist/client/assets/{quick-switcher-controller-DSlOwOsU.js → quick-switcher-controller-B5vT9Vj5.js} +1 -1
- package/dist/client/assets/runtime-config-CvrkHb0n.js +1 -0
- package/dist/client/assets/runtime-paths-qQGhzNx4.js +1 -0
- package/dist/client/assets/{standalone-6z5x8CWe.js → standalone-DbyFjvTU.js} +1 -1
- package/dist/client/assets/{vault-api-client-BQxLVPeF.js → vault-api-client-NS_EVHJ3.js} +2 -2
- package/dist/client/assets/{worker-engine-m0rlHn8R-5h66k403.js → worker-engine-BCCrxWYm-CX0qJ_cG.js} +1 -1
- package/dist/client/assets/{workspace-sync-client-C2pdaQUN.js → workspace-sync-client-BrMtf6zN.js} +1 -1
- package/dist/client/drawio-editor.html +5 -5
- package/dist/client/excalidraw-editor.html +9 -9
- package/dist/client/export-document.html +1 -1
- package/dist/client/index.html +13 -2
- package/package.json +14 -14
- package/src/client/app/index.html +11 -0
- package/src/client/app/main-entry.js +30 -4
- package/src/client/bootstrap/collabmd-app-shell.js +3 -1
- package/src/client/browser-utils.js +21 -0
- package/src/client/domain/file-search.js +1 -1
- package/src/client/domain/runtime-paths.js +4 -0
- package/src/client/infrastructure/runtime-config.js +14 -0
- package/src/client/presentation/drawio-embed-controller.js +3 -1
- package/src/client/presentation/excalidraw-embed-controller.js +3 -1
- package/src/client/presentation/file-action-controller.js +21 -1
- package/src/client/presentation/file-explorer-view.js +24 -6
- package/src/client/presentation/vault-dashboard.js +63 -0
- package/src/client/styles/foundation/utilities.css +2 -0
- package/src/client/styles/layout/overlays.css +5 -0
- package/src/client/styles/layout/shell.css +152 -0
- package/src/server/config/env.js +39 -6
- package/src/server/infrastructure/http/create-static-handler.js +3 -1
- package/src/server/infrastructure/http/create-vault-api-query-handler.js +1 -1
- package/dist/client/assets/dist-BYBF4LtZ.js +0 -1
- package/dist/client/assets/dist-BnVaoRgZ.js +0 -1
- package/dist/client/assets/dist-CrkYYcOU.js +0 -1
- package/dist/client/assets/dist-D8LnhZzy.js +0 -1
- package/dist/client/assets/dist-DX6qtdxv.js +0 -1
- package/dist/client/assets/dist-DofvCYzJ.js +0 -1
- package/dist/client/assets/image-EJJKRVD3-BQfi5nWJ.js +0 -1
- package/dist/client/assets/index-BxAuGDoN.css +0 -1
- package/dist/client/assets/index-uw9O0z1c.js +0 -1112
- package/dist/client/assets/prod-DU-0VfI7.js +0 -145
- package/dist/client/assets/prod-cXUNdmYV.js +0 -1
- package/dist/client/assets/runtime-config-BFVdhnJu.js +0 -1
- package/dist/client/assets/runtime-paths-Cn0snt_9.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as e,C as t,D as n,E as r,F as i,I as a,L as o,M as s,N as c,O as l,P as u,R as d,S as f,T as p,_ as m,a as h,b as g,c as _,d as v,f as y,g as b,h as x,i as S,j as C,k as w,l as T,m as E,n as D,o as O,p as k,r as A,s as j,t as M,u as N,v as P,w as F,x as I,y as L}from"./prod-CA0ie9yD.js";import{B as R,Br as z,Cl as B,Ct as V,Dl as H,Fs as U,Ft as W,H as G,Hi as K,I as q,Ir as J,N as Y,No as X,Oa as Z,P as Q,Po as $,Ps as ee,Qt as te,Sl as ne,Ui as re,Un as ie,Vc as ae,Xa as oe,Xr as se,Y as ce,_c as le,ao as ue,gl as de,ir as fe,it as pe,ki as me,p as he,pt as ge,q as _e,sa as ve,t as ye,tt as be,u as xe,ul as Se,wi as Ce,ys as we,z as Te,zo as Ee}from"./chunk-T5WUORNS-DD7KlyY6.js";export{k as Button,Z as CaptureUpdateAction,I as CommandPalette,ae as DEFAULT_LASER_COLOR,R as DEFAULT_OVERSCROLL,x as DefaultSidebar,u as DiagramToCodePlugin,S as Ellipsify,i as Excalidraw,n as ExcalidrawAPIContext,o as ExcalidrawAPIProvider,ee as FONT_FAMILY,Q as Fonts,A as Footer,g as LiveCollaborationTrigger,U as MIME_TYPES,N as MainMenu,de as ROUNDNESS,j as Sidebar,f as Stats,$ as THEME,s as TTDDialog,b as TTDDialogTrigger,L as TTDStreamFetch,H as UserIdleState,h as WelcomeScreen,we as applyDarkModeFilter,re as bumpVersion,me as convertToExcalidrawElements,c as defaultLang,te as elementsOverlappingBBox,t as exportToBlob,_ as exportToCanvas,M as exportToClipboard,D as exportToSvg,oe as getCommonBounds,Y as getDataURL,B as getFormFactor,C as getLibraryItemsHash,z as getNonDeletedElements,W as getSceneVersion,Ee as getStrokeWidthByKey,ge as getTextFromElements,ie as getVisibleSceneBounds,ve as hashElementsVersion,J as hashString,K as isElementLink,Ce as isInvisiblySmallElement,fe as isLinearElement,d as isSpreadsheetValidForChartType,p as languages,xe as loadFromBlob,he as loadLibraryFromBlob,pe as loadSceneOrLibraryFromBlob,e as mergeLibraryItems,se as mutateElement,V as newElementWith,X as normalizeLink,O as parseLibraryTokensFromUrl,T as parseSSEStream,P as reconcileElements,E as renderSpreadsheet,q as restoreAppState,ce as restoreElement,Te as restoreElements,be as restoreLibraryItems,Se as sceneCoordsToViewportCoords,ye as serializeAsJSON,G as serializeLibraryAsJSON,ue as setCustomTextMetricsProvider,le as throttleRAF,m as tryParseSpreadsheet,F as useEditorInterface,v as useExcalidrawAPI,a as useExcalidrawStateValue,r as useHandleLibrary,y as useI18n,l as useOnExcalidrawStateChange,w as useStylesPanelMode,ne as viewportCoordsToSceneCoords,_e as zoomToFitBounds};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./file-kind-BwMIcZbi.js";import{n as t,t as n}from"./file-search-3hYF4cYa.js";var r=`width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"`;function i(e,t){return`<svg class="${e}" ${r}>${t}</svg>`}function a(t,{className:n=`file-tree-icon`}={}){let r=e(t)??`file`,a=n;return r===`base`?i(a,`<path d="M7 4h7l5 5v11a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z"/><path d="M14 4v5h5"/><path d="M8 13h8"/><path d="M8 17h6"/><path d="M8 9h3"/>`):r===`drawio`||r===`plantuml`||r===`structurizr`?i(a,`<rect x="3" y="4" width="7" height="6" rx="1"/><rect x="14" y="4" width="7" height="6" rx="1"/><rect x="8.5" y="14" width="7" height="6" rx="1"/><path d="M10 7h4"/><path d="M17.5 10v2.5"/><path d="M6.5 10v2.5"/><path d="M6.5 12.5h11"/>`):r===`excalidraw`?i(a,`<path d="M12 19l7-7 3 3-7 7-3-3z"/><path d="M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"/><path d="M2 2l7.586 7.586"/><circle cx="11" cy="11" r="2"/>`):r===`image`?i(a,`<rect x="3" y="4" width="18" height="16" rx="2"/><circle cx="9" cy="10" r="1.5"/><path d="m21 16-5-5L7 20"/><path d="m14 14 2 2"/>`):r===`pdf`?i(a,`<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><path d="M8 15h8"/><path d="M8 18h5"/>`):r===`mermaid`?i(a,`<path d="M5 7.5c0-1.38 1.12-2.5 2.5-2.5 1.04 0 1.93.64 2.3 1.56A2.5 2.5 0 0 1 14 8.5v1"/><path d="M19 16.5c0 1.38-1.12 2.5-2.5 2.5-1.04 0-1.93-.64-2.3-1.56A2.5 2.5 0 0 1 10 15.5v-1"/><path d="M8 10.5h8"/><path d="M8 13.5h8"/><path d="M10 8.5v7"/><path d="M14 8.5v7"/>`):i(a,`<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/>`)}var o=50;function s(e=0,{truncated:t=!1}={}){let n=Number(e)||0;return`${n}${t?`+`:``} ${n===1?`match`:`matches`}`}function c(e={}){return(e.files??[]).flatMap(e=>(e.snippets??[]).map(t=>({column:t.column,file:e.file,kind:e.kind,line:t.line,matchLength:Math.max((t.matchEnd??0)-(t.matchStart??0),0),snippet:t})))}var l=class{constructor({debounceMs:e=300,resultLimit:t=o}={}){this.debounceMs=e,this.resultLimit=t,this.controller=null,this.timer=null,this.token=0}abort({invalidate:e=!0}={}){clearTimeout(this.timer),this.timer=null,e&&(this.token+=1),this.controller?.abort(),this.controller=null}schedule({isActive:e=()=>!0,onResults:t,onState:n,query:r=``,searchConfig:i={},searchText:a=null}={}){let o=Math.max(Number(i.minQueryLength)||2,1);if(this.abort(),!i.available){n?.(`Global text search requires ripgrep on the server.`);return}if(!a){n?.(`Global text search is unavailable.`);return}if(r.length<o){n?.(`Type at least ${o} characters to search file text.`);return}n?.(`Searching...`),this.timer=setTimeout(()=>{this.run({isActive:e,onResults:t,onState:n,query:r,searchText:a})},this.debounceMs)}async run({isActive:e=()=>!0,onResults:t,onState:n,query:r=``,searchText:i}={}){let a=this.token+1;this.token=a;let o=new AbortController;this.controller=o;let s=()=>e()&&a===this.token&&this.controller===o;try{let e=await i({limit:this.resultLimit,query:r,signal:o.signal});s()&&t?.(e,r)}catch(e){if(e?.name===`AbortError`||!s())return;n?.(e?.body?.error||e?.message||`Failed to search file text.`)}finally{this.controller===o&&(this.controller=null)}}},u=30,d=2**53-1,f=`quick-switcher-file-`,p=`quick-switcher-text-`,m=150;function h(e){return String(e??``).split(`/`).pop()||String(e??``)}function g(e){return n(e).fileName}function _(e){let t=n(e).displayName;return t.includes(`/`)?t.substring(0,t.lastIndexOf(`/`)):``}function v(e,t=[]){let n=e.displayName.length-e.fileName.length;return{dirPath:t.filter(e=>e<n),fileName:t.filter(e=>e>=n).map(e=>e-n)}}function y(e,t,n=[]){let r=new Set(n),i=0;for(;i<t.length;){let n=r.has(i),a=i+1;for(;a<t.length&&r.has(a)===n;)a+=1;let o=t.slice(i,a);if(n){let t=document.createElement(`mark`);t.textContent=o,e.append(t)}else e.append(o);i=a}}var b=class{constructor({getFileList:e,getFileMetadata:t=()=>[],getRecentFiles:n=()=>[],getSearchConfig:r=()=>({}),onFileSelect:i,onTextMatchSelect:a=null,searchDebounceMs:o=300,searchText:s=null}){this.getFileList=e,this.getFileMetadata=t,this.getRecentFiles=n,this.getSearchConfig=r,this.onFileSelect=i,this.onTextMatchSelect=a,this.searchDebounceMs=o,this.searchText=s,this.overlay=document.getElementById(`quickSwitcher`),this.input=document.getElementById(`quickSwitcherInput`),this.resultsList=document.getElementById(`quickSwitcherResults`),this.hint=document.getElementById(`quickSwitcherHint`),this.scope=document.getElementById(`quickSwitcherScope`),this.modeTabs=Array.from(document.querySelectorAll?.(`[data-qs-mode]`)??[]);let c=this.getSearchConfig?.()??{},u=this.modeTabs.find(e=>e.dataset.qsMode===`text`);u&&c.available===!1&&(u.disabled=!0,u.setAttribute(`title`,c.unavailableReason||`Text search is unavailable`)),this.filteredFiles=[],this.fileMatches=new Map,this.fileMatchCount=0,this.fileResultsTruncated=!1,this.fileCorpus=[],this.fileCorpusByPath=new Map,this.lastFileListRef=null,this.lastFileMetadataRef=null,this.cachedModifiedTimes=new Map,this.lastRecentFilesRef=null,this.cachedRecentRanks=new Map,this.fileFilterTimer=null,this.selectedIndex=0,this.selectedTextIndex=0,this.isOpen=!1,this.mode=`files`,this.textResults=null,this.textResultItems=[],this.textSearchRunner=new l({debounceMs:this.searchDebounceMs}),this.blockingModalHandler=()=>this.close(),this.bindEvents()}bindEvents(){document.addEventListener?.(`collabmd:close-custom-modals`,this.blockingModalHandler),this.overlay?.addEventListener(`close`,()=>this.handleClose()),this.modeTabs.forEach((e,t)=>{e.addEventListener(`click`,()=>{this.setMode(e.dataset.qsMode===`text`?`text`:`files`,{preserveInput:!0}),this.input?.focus?.()}),e.addEventListener(`keydown`,e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let n=(t+(e.key===`ArrowRight`?1:-1)+this.modeTabs.length)%this.modeTabs.length,r=this.modeTabs[n];r.disabled||(this.setMode(r.dataset.qsMode===`text`?`text`:`files`,{preserveInput:!0}),r.focus())})}),this.input?.addEventListener(`input`,()=>{if(this.mode===`text`){this.handleInput();return}this.abortTextSearch(),this.scheduleFileFilter()}),this.input?.addEventListener(`keydown`,e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),this.moveSelection(1);break;case`ArrowUp`:e.preventDefault(),this.moveSelection(-1);break;case`Enter`:e.preventDefault(),this.confirmSelection();break;case`Tab`:e.preventDefault(),this.modeTabs.filter(e=>!e.disabled).length>1&&!e.shiftKey?this.setMode(this.mode===`files`?`text`:`files`,{preserveInput:!0}):this.moveSelection(e.shiftKey?-1:1)}})}handleClose(){clearTimeout(this.fileFilterTimer),this.fileFilterTimer=null,this.abortTextSearch(),this.isOpen=!1,this.input?.setAttribute(`aria-expanded`,`false`),this.input.value=``,this.resultsList.innerHTML=``,this.setActiveDescendant(``)}open(){this.overlay&&!this.overlay.open&&(this.isOpen=!0,this.input.value=``,this.selectedIndex=0,this.selectedTextIndex=0,this.setMode(`files`,{preserveInput:!0}),this.overlay.showModal(),this.input?.setAttribute(`aria-expanded`,`true`))}close(){this.handleClose(),this.overlay?.open&&this.overlay.close()}toggle(){this.overlay?.open?this.close():this.open()}setMode(e=`files`,{preserveInput:t=!1}={}){let n=this.modeTabs.find(e=>e.dataset.qsMode===`text`),r=e===`text`&&!n?.disabled?`text`:`files`;this.mode=r,this.selectedIndex=0,this.selectedTextIndex=0,!t&&this.input&&(this.input.value=``),this.modeTabs.forEach(e=>{let t=e.dataset.qsMode===r;e.classList.toggle(`active`,t),e.setAttribute(`aria-selected`,t?`true`:`false`),e.setAttribute(`tabindex`,t?`0`:`-1`)}),this.scope?.classList.toggle(`hidden`,r!==`text`),this.scope?.setAttribute(`aria-hidden`,r===`text`?`false`:`true`),this.input&&(this.input.placeholder=r===`text`?`Search text in files...`:`Search files...`,this.input.setAttribute(`aria-label`,r===`text`?`Search text in files`:`Search files`)),this.handleInput()}handleInput(){if(this.mode===`text`){this.scheduleTextSearch();return}this.abortTextSearch(),this.filterFiles()}scheduleFileFilter(){clearTimeout(this.fileFilterTimer),this.fileFilterTimer=setTimeout(()=>{this.fileFilterTimer=null,this.isOpen&&this.mode===`files`&&this.filterFiles()},150)}filterFiles(){clearTimeout(this.fileFilterTimer),this.fileFilterTimer=null,this.resultsList?.setAttribute(`aria-busy`,`false`);let e=this.input?.value.trim().toLowerCase().replace(/\s+/gu,` `)??``,r=this.getFileList?.()??[];r!==this.lastFileListRef&&(this.lastFileListRef=r,this.fileCorpus=r.map(e=>n(e)),this.fileCorpusByPath=new Map(this.fileCorpus.map(e=>[e.filePath,e]))),this.fileMatches.clear();let i=this.getFileMetadata?.()??[];i!==this.lastFileMetadataRef&&(this.lastFileMetadataRef=i,this.cachedModifiedTimes=new Map((Array.isArray(i)?i:[]).map(e=>[e?.path,Number.isFinite(Number(e?.mtimeMs))?Number(e.mtimeMs):0])));let a=this.cachedModifiedTimes,o=this.getRecentFiles?.()??[];o!==this.lastRecentFilesRef&&(this.lastRecentFilesRef=o,this.cachedRecentRanks=new Map((Array.isArray(o)?o:[]).map((e,t)=>[e,t])));let s=this.cachedRecentRanks;if(!e)this.filteredFiles=[...this.fileCorpus].sort((e,t)=>{let n=(a.get(t.filePath)??0)-(a.get(e.filePath)??0);return n===0?(s.get(e.filePath)??d)-(s.get(t.filePath)??d):n}).slice(0,u).map(e=>e.filePath),this.fileMatchCount=this.fileCorpus.length;else{let n=[],r=0;this.fileCorpus.forEach(i=>{let a=t(i,e);if(!a)return;r+=1,this.fileMatches.set(i.filePath,a);let o={filePath:i.filePath,lowerPath:i.lowerPath,recentRank:s.get(i.filePath)??d,score:a.score},c=!1;for(let e=0;e<n.length;e+=1){let t=n[e];if(o.score>t.score||o.score===t.score&&(o.recentRank<t.recentRank||o.recentRank===t.recentRank&&o.lowerPath<t.lowerPath)){n.splice(e,0,o),c=!0;break}}!c&&n.length<u&&n.push(o),n.length>u&&(n.length=u)}),this.filteredFiles=n.map(e=>e.filePath),this.fileMatchCount=r}this.fileResultsTruncated=this.fileMatchCount>u,this.selectedIndex=0,this.renderResults(e)}renderResults(e){if(!this.resultsList)return;if(this.resultsList.innerHTML=``,this.filteredFiles.length===0){this.setActiveDescendant(``),this.hint&&(this.hint.textContent=e?`No files found`:`No files in vault`,this.hint.classList.remove(`hidden`));return}if(this.hint){let t=this.fileResultsTruncated?e?`Showing the top ${u} of ${this.fileMatchCount} matches. Refine the query to narrow results.`:`Showing the first ${u} of ${this.fileMatchCount} files.`:``;this.hint.textContent=t,this.hint.classList.toggle(`hidden`,!t)}let t=document.createDocumentFragment();this.filteredFiles.forEach((e,n)=>{let r=document.createElement(`button`);r.type=`button`,r.className=`qs-result-item`,n===this.selectedIndex&&r.classList.add(`selected`),r.id=`${f}${n}`,r.setAttribute(`role`,`option`),r.setAttribute(`aria-selected`,n===this.selectedIndex?`true`:`false`),r.dataset.index=String(n);let i=this.fileCorpusByPath.get(e),o=h(e),s=i?i.dirPath:_(e),c=this.fileMatches.get(e),l=i?v(i,c?.indices):{dirPath:[],fileName:[]},u=a(e,{className:`qs-result-icon`});r.append(document.createRange().createContextualFragment(u));let d=document.createElement(`span`);if(d.className=`qs-result-name`,y(d,o,l.fileName),r.append(d),s){let e=document.createElement(`span`);e.className=`qs-result-path`,e.title=s,y(e,s,l.dirPath),r.append(e)}r.addEventListener(`click`,()=>{this.selectedIndex=n,this.confirmSelection()}),r.addEventListener(`mouseenter`,()=>{this.selectedIndex=n,this.updateSelection()}),t.appendChild(r)}),this.resultsList.appendChild(t),this.updateSelection()}abortTextSearch({invalidate:e=!0}={}){this.textSearchRunner.abort({invalidate:e})}scheduleTextSearch(){let e=this.input?.value.trim()??``,t=this.getSearchConfig?.()??{};this.textResults=null,this.textResultItems=[],this.textSearchRunner.schedule({isActive:()=>this.isOpen&&this.mode===`text`,onResults:(e,t)=>{this.textResults=e,this.textResultItems=c(e),this.selectedTextIndex=0,this.renderTextResults(t)},onState:e=>this.renderTextState(e),query:e,searchConfig:t,searchText:this.searchText})}renderTextState(e){this.resultsList&&(this.resultsList.innerHTML=``,this.resultsList.setAttribute(`aria-busy`,e===`Searching...`?`true`:`false`),this.setActiveDescendant(``),this.hint&&(this.hint.textContent=e,this.hint.classList.remove(`hidden`)))}renderTextResults(e=``){if(!this.resultsList)return;if(this.resultsList.innerHTML=``,this.resultsList.setAttribute(`aria-busy`,`false`),!this.textResults?.files?.length||this.textResultItems.length===0){this.setActiveDescendant(``),this.renderTextState(e?`No text matches found`:`Type to search file text`);return}if(this.hint){let e=this.textResults.truncated?`Showing partial results: ${this.textResults.files.length} files and ${s(this.textResults.matchCount,{truncated:!0})}. Refine the query to narrow results.`:``;this.hint.textContent=e,this.hint.classList.toggle(`hidden`,!e)}let t=document.createDocumentFragment(),n=0;this.textResults.files.forEach(e=>{let r=document.createElement(`section`);r.className=`qs-text-group`,r.setAttribute(`role`,`group`),r.setAttribute(`aria-label`,e.file);let i=document.createElement(`div`);i.className=`qs-text-group-header`,[[`qs-text-file-name`,g(e.file)],[`qs-text-file-meta`,_(e.file)],[`qs-text-count`,s(e.matchCount,{truncated:e.truncated})]].forEach(([e,t])=>{let n=document.createElement(`span`);n.className=e,n.textContent=t,i.append(n)}),r.appendChild(i),(e.snippets??[]).forEach(e=>{let t=n,i=document.createElement(`button`);i.type=`button`,i.className=`qs-text-item`,t===this.selectedTextIndex&&i.classList.add(`selected`),i.id=`${p}${t}`,i.setAttribute(`role`,`option`),i.setAttribute(`aria-selected`,t===this.selectedTextIndex?`true`:`false`),i.dataset.textIndex=String(t);let a=document.createElement(`span`);a.className=`qs-text-line`,a.textContent=`L${e.line??1}`;let o=document.createElement(`span`);o.className=`qs-text-snippet`,this.appendHighlightedSnippet(o,e),i.append(a,o),i.addEventListener(`click`,()=>{this.selectedTextIndex=t,this.confirmSelection()}),i.addEventListener(`mouseenter`,()=>{this.selectedTextIndex=t,this.updateSelection()}),r.appendChild(i),n+=1}),t.appendChild(r)}),this.resultsList.appendChild(t),this.updateSelection()}appendHighlightedSnippet(e,t={}){let n=String(t.text??``),r=Math.min(Math.max(Number(t.matchStart)||0,0),n.length),i=Math.min(Math.max(Number(t.matchEnd)||r,r),n.length);e.append(n.slice(0,r));let a=document.createElement(`mark`);a.textContent=n.slice(r,i),e.append(a,n.slice(i))}moveSelection(e){if(this.mode===`text`){if(this.textResultItems.length===0)return;this.selectedTextIndex=(this.selectedTextIndex+e+this.textResultItems.length)%this.textResultItems.length,this.updateSelection();return}this.filteredFiles.length!==0&&(this.selectedIndex=(this.selectedIndex+e+this.filteredFiles.length)%this.filteredFiles.length,this.updateSelection())}updateSelection(){if(!this.resultsList)return;if(this.mode===`text`){let e=this.resultsList.querySelectorAll(`.qs-text-item`);e.forEach((e,t)=>{let n=t===this.selectedTextIndex;e.classList.toggle(`selected`,n),e.setAttribute(`aria-selected`,n?`true`:`false`)}),e[this.selectedTextIndex]?.scrollIntoView({block:`nearest`}),this.setActiveDescendant(e[this.selectedTextIndex]?.id??``);return}let e=this.resultsList.querySelectorAll(`.qs-result-item`);e.forEach((e,t)=>{let n=t===this.selectedIndex;e.classList.toggle(`selected`,n),e.setAttribute(`aria-selected`,n?`true`:`false`)}),e[this.selectedIndex]?.scrollIntoView({block:`nearest`}),this.setActiveDescendant(e[this.selectedIndex]?.id??``)}setActiveDescendant(e=``){this.input?.setAttribute(`aria-activedescendant`,e)}confirmSelection(){if(this.mode===`text`){let e=this.textResultItems[this.selectedTextIndex];e&&(this.close({restoreFocus:!1}),this.onTextMatchSelect?.(e));return}let e=this.filteredFiles[this.selectedIndex];e&&(this.close({restoreFocus:!1}),this.onFileSelect?.(e))}};export{m as FILE_FILTER_DEBOUNCE_MS,b as QuickSwitcherController};
|
|
1
|
+
import{r as e}from"./file-kind-BwMIcZbi.js";import{n as t,t as n}from"./file-search-BA8o_gs0.js";var r=`width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"`;function i(e,t){return`<svg class="${e}" ${r}>${t}</svg>`}function a(t,{className:n=`file-tree-icon`}={}){let r=e(t)??`file`,a=n;return r===`base`?i(a,`<path d="M7 4h7l5 5v11a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z"/><path d="M14 4v5h5"/><path d="M8 13h8"/><path d="M8 17h6"/><path d="M8 9h3"/>`):r===`drawio`||r===`plantuml`||r===`structurizr`?i(a,`<rect x="3" y="4" width="7" height="6" rx="1"/><rect x="14" y="4" width="7" height="6" rx="1"/><rect x="8.5" y="14" width="7" height="6" rx="1"/><path d="M10 7h4"/><path d="M17.5 10v2.5"/><path d="M6.5 10v2.5"/><path d="M6.5 12.5h11"/>`):r===`excalidraw`?i(a,`<path d="M12 19l7-7 3 3-7 7-3-3z"/><path d="M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"/><path d="M2 2l7.586 7.586"/><circle cx="11" cy="11" r="2"/>`):r===`image`?i(a,`<rect x="3" y="4" width="18" height="16" rx="2"/><circle cx="9" cy="10" r="1.5"/><path d="m21 16-5-5L7 20"/><path d="m14 14 2 2"/>`):r===`pdf`?i(a,`<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><path d="M8 15h8"/><path d="M8 18h5"/>`):r===`mermaid`?i(a,`<path d="M5 7.5c0-1.38 1.12-2.5 2.5-2.5 1.04 0 1.93.64 2.3 1.56A2.5 2.5 0 0 1 14 8.5v1"/><path d="M19 16.5c0 1.38-1.12 2.5-2.5 2.5-1.04 0-1.93-.64-2.3-1.56A2.5 2.5 0 0 1 10 15.5v-1"/><path d="M8 10.5h8"/><path d="M8 13.5h8"/><path d="M10 8.5v7"/><path d="M14 8.5v7"/>`):i(a,`<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/>`)}var o=50;function s(e=0,{truncated:t=!1}={}){let n=Number(e)||0;return`${n}${t?`+`:``} ${n===1?`match`:`matches`}`}function c(e={}){return(e.files??[]).flatMap(e=>(e.snippets??[]).map(t=>({column:t.column,file:e.file,kind:e.kind,line:t.line,matchLength:Math.max((t.matchEnd??0)-(t.matchStart??0),0),snippet:t})))}var l=class{constructor({debounceMs:e=300,resultLimit:t=o}={}){this.debounceMs=e,this.resultLimit=t,this.controller=null,this.timer=null,this.token=0}abort({invalidate:e=!0}={}){clearTimeout(this.timer),this.timer=null,e&&(this.token+=1),this.controller?.abort(),this.controller=null}schedule({isActive:e=()=>!0,onResults:t,onState:n,query:r=``,searchConfig:i={},searchText:a=null}={}){let o=Math.max(Number(i.minQueryLength)||2,1);if(this.abort(),!i.available){n?.(`Global text search requires ripgrep on the server.`);return}if(!a){n?.(`Global text search is unavailable.`);return}if(r.length<o){n?.(`Type at least ${o} characters to search file text.`);return}n?.(`Searching...`),this.timer=setTimeout(()=>{this.run({isActive:e,onResults:t,onState:n,query:r,searchText:a})},this.debounceMs)}async run({isActive:e=()=>!0,onResults:t,onState:n,query:r=``,searchText:i}={}){let a=this.token+1;this.token=a;let o=new AbortController;this.controller=o;let s=()=>e()&&a===this.token&&this.controller===o;try{let e=await i({limit:this.resultLimit,query:r,signal:o.signal});s()&&t?.(e,r)}catch(e){if(e?.name===`AbortError`||!s())return;n?.(e?.body?.error||e?.message||`Failed to search file text.`)}finally{this.controller===o&&(this.controller=null)}}},u=30,d=2**53-1,f=`quick-switcher-file-`,p=`quick-switcher-text-`,m=150;function h(e){return String(e??``).split(`/`).pop()||String(e??``)}function g(e){return n(e).fileName}function _(e){let t=n(e).displayName;return t.includes(`/`)?t.substring(0,t.lastIndexOf(`/`)):``}function v(e,t=[]){let n=e.displayName.length-e.fileName.length;return{dirPath:t.filter(e=>e<n),fileName:t.filter(e=>e>=n).map(e=>e-n)}}function y(e,t,n=[]){let r=new Set(n),i=0;for(;i<t.length;){let n=r.has(i),a=i+1;for(;a<t.length&&r.has(a)===n;)a+=1;let o=t.slice(i,a);if(n){let t=document.createElement(`mark`);t.textContent=o,e.append(t)}else e.append(o);i=a}}var b=class{constructor({getFileList:e,getFileMetadata:t=()=>[],getRecentFiles:n=()=>[],getSearchConfig:r=()=>({}),onFileSelect:i,onTextMatchSelect:a=null,searchDebounceMs:o=300,searchText:s=null}){this.getFileList=e,this.getFileMetadata=t,this.getRecentFiles=n,this.getSearchConfig=r,this.onFileSelect=i,this.onTextMatchSelect=a,this.searchDebounceMs=o,this.searchText=s,this.overlay=document.getElementById(`quickSwitcher`),this.input=document.getElementById(`quickSwitcherInput`),this.resultsList=document.getElementById(`quickSwitcherResults`),this.hint=document.getElementById(`quickSwitcherHint`),this.scope=document.getElementById(`quickSwitcherScope`),this.modeTabs=Array.from(document.querySelectorAll?.(`[data-qs-mode]`)??[]);let c=this.getSearchConfig?.()??{},u=this.modeTabs.find(e=>e.dataset.qsMode===`text`);u&&c.available===!1&&(u.disabled=!0,u.setAttribute(`title`,c.unavailableReason||`Text search is unavailable`)),this.filteredFiles=[],this.fileMatches=new Map,this.fileMatchCount=0,this.fileResultsTruncated=!1,this.fileCorpus=[],this.fileCorpusByPath=new Map,this.lastFileListRef=null,this.lastFileMetadataRef=null,this.cachedModifiedTimes=new Map,this.lastRecentFilesRef=null,this.cachedRecentRanks=new Map,this.fileFilterTimer=null,this.selectedIndex=0,this.selectedTextIndex=0,this.isOpen=!1,this.mode=`files`,this.textResults=null,this.textResultItems=[],this.textSearchRunner=new l({debounceMs:this.searchDebounceMs}),this.blockingModalHandler=()=>this.close(),this.bindEvents()}bindEvents(){document.addEventListener?.(`collabmd:close-custom-modals`,this.blockingModalHandler),this.overlay?.addEventListener(`close`,()=>this.handleClose()),this.modeTabs.forEach((e,t)=>{e.addEventListener(`click`,()=>{this.setMode(e.dataset.qsMode===`text`?`text`:`files`,{preserveInput:!0}),this.input?.focus?.()}),e.addEventListener(`keydown`,e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let n=(t+(e.key===`ArrowRight`?1:-1)+this.modeTabs.length)%this.modeTabs.length,r=this.modeTabs[n];r.disabled||(this.setMode(r.dataset.qsMode===`text`?`text`:`files`,{preserveInput:!0}),r.focus())})}),this.input?.addEventListener(`input`,()=>{if(this.mode===`text`){this.handleInput();return}this.abortTextSearch(),this.scheduleFileFilter()}),this.input?.addEventListener(`keydown`,e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),this.moveSelection(1);break;case`ArrowUp`:e.preventDefault(),this.moveSelection(-1);break;case`Enter`:e.preventDefault(),this.confirmSelection();break;case`Tab`:e.preventDefault(),this.modeTabs.filter(e=>!e.disabled).length>1&&!e.shiftKey?this.setMode(this.mode===`files`?`text`:`files`,{preserveInput:!0}):this.moveSelection(e.shiftKey?-1:1)}})}handleClose(){clearTimeout(this.fileFilterTimer),this.fileFilterTimer=null,this.abortTextSearch(),this.isOpen=!1,this.input?.setAttribute(`aria-expanded`,`false`),this.input.value=``,this.resultsList.innerHTML=``,this.setActiveDescendant(``)}open(){this.overlay&&!this.overlay.open&&(this.isOpen=!0,this.input.value=``,this.selectedIndex=0,this.selectedTextIndex=0,this.setMode(`files`,{preserveInput:!0}),this.overlay.showModal(),this.input?.setAttribute(`aria-expanded`,`true`))}close(){this.handleClose(),this.overlay?.open&&this.overlay.close()}toggle(){this.overlay?.open?this.close():this.open()}setMode(e=`files`,{preserveInput:t=!1}={}){let n=this.modeTabs.find(e=>e.dataset.qsMode===`text`),r=e===`text`&&!n?.disabled?`text`:`files`;this.mode=r,this.selectedIndex=0,this.selectedTextIndex=0,!t&&this.input&&(this.input.value=``),this.modeTabs.forEach(e=>{let t=e.dataset.qsMode===r;e.classList.toggle(`active`,t),e.setAttribute(`aria-selected`,t?`true`:`false`),e.setAttribute(`tabindex`,t?`0`:`-1`)}),this.scope?.classList.toggle(`hidden`,r!==`text`),this.scope?.setAttribute(`aria-hidden`,r===`text`?`false`:`true`),this.input&&(this.input.placeholder=r===`text`?`Search text in files...`:`Search files...`,this.input.setAttribute(`aria-label`,r===`text`?`Search text in files`:`Search files`)),this.handleInput()}handleInput(){if(this.mode===`text`){this.scheduleTextSearch();return}this.abortTextSearch(),this.filterFiles()}scheduleFileFilter(){clearTimeout(this.fileFilterTimer),this.fileFilterTimer=setTimeout(()=>{this.fileFilterTimer=null,this.isOpen&&this.mode===`files`&&this.filterFiles()},150)}filterFiles(){clearTimeout(this.fileFilterTimer),this.fileFilterTimer=null,this.resultsList?.setAttribute(`aria-busy`,`false`);let e=this.input?.value.trim().toLowerCase().replace(/\s+/gu,` `)??``,r=this.getFileList?.()??[];r!==this.lastFileListRef&&(this.lastFileListRef=r,this.fileCorpus=r.map(e=>n(e)),this.fileCorpusByPath=new Map(this.fileCorpus.map(e=>[e.filePath,e]))),this.fileMatches.clear();let i=this.getFileMetadata?.()??[];i!==this.lastFileMetadataRef&&(this.lastFileMetadataRef=i,this.cachedModifiedTimes=new Map((Array.isArray(i)?i:[]).map(e=>[e?.path,Number.isFinite(Number(e?.mtimeMs))?Number(e.mtimeMs):0])));let a=this.cachedModifiedTimes,o=this.getRecentFiles?.()??[];o!==this.lastRecentFilesRef&&(this.lastRecentFilesRef=o,this.cachedRecentRanks=new Map((Array.isArray(o)?o:[]).map((e,t)=>[e,t])));let s=this.cachedRecentRanks;if(!e)this.filteredFiles=[...this.fileCorpus].sort((e,t)=>{let n=(a.get(t.filePath)??0)-(a.get(e.filePath)??0);return n===0?(s.get(e.filePath)??d)-(s.get(t.filePath)??d):n}).slice(0,u).map(e=>e.filePath),this.fileMatchCount=this.fileCorpus.length;else{let n=[],r=0;this.fileCorpus.forEach(i=>{let a=t(i,e);if(!a)return;r+=1,this.fileMatches.set(i.filePath,a);let o={filePath:i.filePath,lowerPath:i.lowerPath,recentRank:s.get(i.filePath)??d,score:a.score},c=!1;for(let e=0;e<n.length;e+=1){let t=n[e];if(o.score>t.score||o.score===t.score&&(o.recentRank<t.recentRank||o.recentRank===t.recentRank&&o.lowerPath<t.lowerPath)){n.splice(e,0,o),c=!0;break}}!c&&n.length<u&&n.push(o),n.length>u&&(n.length=u)}),this.filteredFiles=n.map(e=>e.filePath),this.fileMatchCount=r}this.fileResultsTruncated=this.fileMatchCount>u,this.selectedIndex=0,this.renderResults(e)}renderResults(e){if(!this.resultsList)return;if(this.resultsList.innerHTML=``,this.filteredFiles.length===0){this.setActiveDescendant(``),this.hint&&(this.hint.textContent=e?`No files found`:`No files in vault`,this.hint.classList.remove(`hidden`));return}if(this.hint){let t=this.fileResultsTruncated?e?`Showing the top ${u} of ${this.fileMatchCount} matches. Refine the query to narrow results.`:`Showing the first ${u} of ${this.fileMatchCount} files.`:``;this.hint.textContent=t,this.hint.classList.toggle(`hidden`,!t)}let t=document.createDocumentFragment();this.filteredFiles.forEach((e,n)=>{let r=document.createElement(`button`);r.type=`button`,r.className=`qs-result-item`,n===this.selectedIndex&&r.classList.add(`selected`),r.id=`${f}${n}`,r.setAttribute(`role`,`option`),r.setAttribute(`aria-selected`,n===this.selectedIndex?`true`:`false`),r.dataset.index=String(n);let i=this.fileCorpusByPath.get(e),o=h(e),s=i?i.dirPath:_(e),c=this.fileMatches.get(e),l=i?v(i,c?.indices):{dirPath:[],fileName:[]},u=a(e,{className:`qs-result-icon`});r.append(document.createRange().createContextualFragment(u));let d=document.createElement(`span`);if(d.className=`qs-result-name`,y(d,o,l.fileName),r.append(d),s){let e=document.createElement(`span`);e.className=`qs-result-path`,e.title=s,y(e,s,l.dirPath),r.append(e)}r.addEventListener(`click`,()=>{this.selectedIndex=n,this.confirmSelection()}),r.addEventListener(`mouseenter`,()=>{this.selectedIndex=n,this.updateSelection()}),t.appendChild(r)}),this.resultsList.appendChild(t),this.updateSelection()}abortTextSearch({invalidate:e=!0}={}){this.textSearchRunner.abort({invalidate:e})}scheduleTextSearch(){let e=this.input?.value.trim()??``,t=this.getSearchConfig?.()??{};this.textResults=null,this.textResultItems=[],this.textSearchRunner.schedule({isActive:()=>this.isOpen&&this.mode===`text`,onResults:(e,t)=>{this.textResults=e,this.textResultItems=c(e),this.selectedTextIndex=0,this.renderTextResults(t)},onState:e=>this.renderTextState(e),query:e,searchConfig:t,searchText:this.searchText})}renderTextState(e){this.resultsList&&(this.resultsList.innerHTML=``,this.resultsList.setAttribute(`aria-busy`,e===`Searching...`?`true`:`false`),this.setActiveDescendant(``),this.hint&&(this.hint.textContent=e,this.hint.classList.remove(`hidden`)))}renderTextResults(e=``){if(!this.resultsList)return;if(this.resultsList.innerHTML=``,this.resultsList.setAttribute(`aria-busy`,`false`),!this.textResults?.files?.length||this.textResultItems.length===0){this.setActiveDescendant(``),this.renderTextState(e?`No text matches found`:`Type to search file text`);return}if(this.hint){let e=this.textResults.truncated?`Showing partial results: ${this.textResults.files.length} files and ${s(this.textResults.matchCount,{truncated:!0})}. Refine the query to narrow results.`:``;this.hint.textContent=e,this.hint.classList.toggle(`hidden`,!e)}let t=document.createDocumentFragment(),n=0;this.textResults.files.forEach(e=>{let r=document.createElement(`section`);r.className=`qs-text-group`,r.setAttribute(`role`,`group`),r.setAttribute(`aria-label`,e.file);let i=document.createElement(`div`);i.className=`qs-text-group-header`,[[`qs-text-file-name`,g(e.file)],[`qs-text-file-meta`,_(e.file)],[`qs-text-count`,s(e.matchCount,{truncated:e.truncated})]].forEach(([e,t])=>{let n=document.createElement(`span`);n.className=e,n.textContent=t,i.append(n)}),r.appendChild(i),(e.snippets??[]).forEach(e=>{let t=n,i=document.createElement(`button`);i.type=`button`,i.className=`qs-text-item`,t===this.selectedTextIndex&&i.classList.add(`selected`),i.id=`${p}${t}`,i.setAttribute(`role`,`option`),i.setAttribute(`aria-selected`,t===this.selectedTextIndex?`true`:`false`),i.dataset.textIndex=String(t);let a=document.createElement(`span`);a.className=`qs-text-line`,a.textContent=`L${e.line??1}`;let o=document.createElement(`span`);o.className=`qs-text-snippet`,this.appendHighlightedSnippet(o,e),i.append(a,o),i.addEventListener(`click`,()=>{this.selectedTextIndex=t,this.confirmSelection()}),i.addEventListener(`mouseenter`,()=>{this.selectedTextIndex=t,this.updateSelection()}),r.appendChild(i),n+=1}),t.appendChild(r)}),this.resultsList.appendChild(t),this.updateSelection()}appendHighlightedSnippet(e,t={}){let n=String(t.text??``),r=Math.min(Math.max(Number(t.matchStart)||0,0),n.length),i=Math.min(Math.max(Number(t.matchEnd)||r,r),n.length);e.append(n.slice(0,r));let a=document.createElement(`mark`);a.textContent=n.slice(r,i),e.append(a,n.slice(i))}moveSelection(e){if(this.mode===`text`){if(this.textResultItems.length===0)return;this.selectedTextIndex=(this.selectedTextIndex+e+this.textResultItems.length)%this.textResultItems.length,this.updateSelection();return}this.filteredFiles.length!==0&&(this.selectedIndex=(this.selectedIndex+e+this.filteredFiles.length)%this.filteredFiles.length,this.updateSelection())}updateSelection(){if(!this.resultsList)return;if(this.mode===`text`){let e=this.resultsList.querySelectorAll(`.qs-text-item`);e.forEach((e,t)=>{let n=t===this.selectedTextIndex;e.classList.toggle(`selected`,n),e.setAttribute(`aria-selected`,n?`true`:`false`)}),e[this.selectedTextIndex]?.scrollIntoView({block:`nearest`}),this.setActiveDescendant(e[this.selectedTextIndex]?.id??``);return}let e=this.resultsList.querySelectorAll(`.qs-result-item`);e.forEach((e,t)=>{let n=t===this.selectedIndex;e.classList.toggle(`selected`,n),e.setAttribute(`aria-selected`,n?`true`:`false`)}),e[this.selectedIndex]?.scrollIntoView({block:`nearest`}),this.setActiveDescendant(e[this.selectedIndex]?.id??``)}setActiveDescendant(e=``){this.input?.setAttribute(`aria-activedescendant`,e)}confirmSelection(){if(this.mode===`text`){let e=this.textResultItems[this.selectedTextIndex];e&&(this.close({restoreFocus:!1}),this.onTextMatchSelect?.(e));return}let e=this.filteredFiles[this.selectedIndex];e&&(this.close({restoreFocus:!1}),this.onFileSelect?.(e))}};export{m as FILE_FILTER_DEBOUNCE_MS,b as QuickSwitcherController};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./runtime-paths-qQGhzNx4.js";var n=Object.freeze({authError:`auth_error`,authPassword:`auth_password`,file:`file`,gitCommit:`git-commit`,gitDiff:`git-diff`,gitFileHistory:`git-file-history`,gitFilePreview:`git-file-preview`,gitHistory:`git-history`});function r(e){return String(e??``).startsWith(`git-`)}function i(e=``){let t=String(e??``),n=t.startsWith(`#`)?t.slice(1):t;return new URLSearchParams(n)}function a(e=``){let t=String(e??``);return t.startsWith(`#`)?t.slice(1):t}function o(e=``){if(!a(e).trim().includes(`=`))return!1;let t=i(e);return Object.values(n).some(e=>t.has(e))}function s(e,{anchor:t=null,column:r=null,drawioMode:i=null,elementId:a=null,elementType:o=null,line:s=null,matchLength:c=null}={}){let l=new URLSearchParams;return e&&l.set(n.file,e),i&&l.set(`drawio`,i),t&&l.set(`anchor`,String(t).trim()),a&&l.set(`element`,String(a).trim()),o===`group`&&l.set(`elementType`,`group`),s!=null&&l.set(`line`,String(Math.max(1,Math.round(Number(s)||1)))),r!=null&&l.set(`column`,String(Math.max(1,Math.round(Number(r)||1)))),c!=null&&l.set(`matchLength`,String(Math.max(0,Math.round(Number(c)||0)))),l.toString()}function c(){return e()}function l(){let e=new URL(window.location.href),n=t();n&&e.searchParams.set(`vault`,n);let r=e.searchParams.get(`file`);r&&!e.hash&&(e.hash=s(r)),e.searchParams.delete(`file`),window.history.replaceState(window.history.state,``,e)}function u(){return i(window.location.hash)}function d(e){return e===`staged`||e===`all`||e===`working-tree`?e:`all`}function f(){let e=u();if(e.has(n.gitFilePreview)){let t=e.get(n.gitFilePreview)||null;return{currentFilePath:e.get(`current`)||t,filePath:t,hash:e.get(`hash`)||null,type:`git-file-preview`}}if(e.has(n.gitFileHistory))return{filePath:e.get(n.gitFileHistory)||null,type:`git-file-history`};if(e.has(n.gitHistory))return{type:`git-history`};if(e.has(n.gitCommit))return{hash:e.get(n.gitCommit)||null,historyFilePath:e.get(`history`)||null,path:e.get(`path`)||null,type:`git-commit`};if(e.has(n.gitDiff)){let t=e.get(n.gitDiff)||null;return{filePath:t,scope:d(e.get(`scope`)||(t?`working-tree`:`all`)),type:`git-diff`}}if(e.has(n.file)){let t={anchor:e.get(`anchor`)||null,column:e.has(`column`)&&Number(e.get(`column`))||null,drawioMode:e.get(`drawio`)||null,filePath:e.get(n.file),line:e.has(`line`)&&Number(e.get(`line`))||null,matchLength:e.has(`matchLength`)&&Number(e.get(`matchLength`))||null,type:`file`},r=e.get(`element`)||``;return r&&(t.elementId=r,t.elementType=e.get(`elementType`)===`group`?`group`:`element`),t}return{type:`empty`}}function p(e,{anchor:t=null,column:n=null,drawioMode:r=null,elementId:i=null,elementType:a=null,line:o=null,matchLength:c=null}={}){window.location.hash=s(e,{anchor:t,column:n,drawioMode:r,elementId:i,elementType:a,line:o,matchLength:c})}function m({filePath:e=null,scope:t=`all`}={}){let n=new URLSearchParams;n.set(`git-diff`,e??``),n.set(`scope`,d(t)),window.location.hash=n.toString()}function h({hash:e,path:t=null,historyFilePath:n=null}={}){let r=String(e??``).trim(),i=new URLSearchParams;i.set(`git-commit`,r),n&&i.set(`history`,n),t&&i.set(`path`,t),window.location.hash=i.toString()}function g(){let e=new URLSearchParams;e.set(`git-history`,`1`),window.location.hash=e.toString()}function _({filePath:e}={}){let t=new URLSearchParams;t.set(`git-file-history`,e??``),window.location.hash=t.toString()}function v({hash:e,path:t,currentFilePath:n=null}={}){let r=String(e??``).trim(),i=new URLSearchParams;i.set(`git-file-preview`,t??``),n&&i.set(`current`,n),i.set(`hash`,r),window.location.hash=i.toString()}export{h as a,v as c,i as d,o as f,p as i,g as l,c as n,m as o,r as p,l as r,_ as s,f as t,s as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return e.endsWith(`/`)?e.slice(0,-1):e}function t(n){let r=e(String(n??``).trim());if(!r||r===`/`)return``;if(/^[a-zA-Z][a-zA-Z\d+.-]*:/u.test(r))try{return t(new URL(r).pathname)}catch{return``}return r.startsWith(`/`)?r:`/${r}`}function n(t,n){let r=e(String(t??``).trim());return!r||r===`/`?n:r.startsWith(`/`)?r:`/${r}`}function r(e,n){let r=t(e),i=String(n??``).trim();return i?/^[a-zA-Z][a-zA-Z\d+.-]*:/u.test(i)||r&&(i===r||i.startsWith(`${r}/`))?i:i===`/`?r||`/`:i.startsWith(`/`)?r?`${r}${i}`:i:r?`${r}/${i}`:`/${i}`:r||`/`}var i=`collabmd.activeVault`,a=[`/auth/`,`/hosted/`,`/agent/`,`/test/`,`/plantuml/`,`/structurizr/`];function o(e){if(e===`/api`||e===`/api/`||e===`/api/vaults`)return!1;let t=e.startsWith(`/api/`)?e.slice(4):e;return!a.some(e=>t===e.slice(0,-1)||t.startsWith(e))}function s(e=l()){let t=Array.isArray(e?.vaults)?e.vaults.map(e=>e?.id).filter(Boolean):[];if(t.length===0)return null;let n=new URLSearchParams(globalThis.window?.location?.search??``).get(`vault`);if(n&&t.includes(n))return n;try{let e=globalThis.window?.localStorage?.getItem(i);if(e&&t.includes(e))return e}catch{}return e?.activeVault&&t.includes(e.activeVault)?e.activeVault:t[0]??null}function c(e){try{globalThis.window?.localStorage?.setItem(i,String(e??``))}catch{}}function l(){let e={activeVault:``,agentAccess:{enabled:!1,endpoint:``,managed:!1},auth:{enabled:!1,implemented:!0,loginEndpoint:`/api/auth/oidc/login`,provider:``,requiresLogin:!1,sessionEndpoint:`/api/auth/session`,statusEndpoint:`/api/auth/status`,strategy:`none`},basePath:``,build:{id:``,packageVersion:``},drawioBaseUrl:`https://embed.diagrams.net`,environment:`development`,gitEnabled:!0,publicWsBaseUrl:``,search:{available:!1,backend:`ripgrep`,minQueryLength:2,unavailableReason:`ripgrep search is unavailable`,version:``},structurizrEnabled:!1,vaults:[],wikiLinkAutoCreate:!0,wsBasePath:`/ws`,...window.__COLLABMD_CONFIG__??{}},i=t(e.basePath),a={enabled:!1,implemented:!0,loginEndpoint:`/api/auth/oidc/login`,provider:``,requiresLogin:!1,sessionEndpoint:`/api/auth/session`,statusEndpoint:`/api/auth/status`,strategy:`none`,...e.auth??{}},o={id:``,packageVersion:``,...e.build??{}};return{...e,auth:{...a,loginEndpoint:r(i,a.loginEndpoint),sessionEndpoint:r(i,a.sessionEndpoint),statusEndpoint:r(i,a.statusEndpoint)},basePath:i,build:o,wsBasePath:n(e.wsBasePath,`/ws`)}}function u(e=`/`,t=l()){return r(t.basePath,e)}function d(e=`/`,t=l()){return new URL(u(e,t),window.location.origin).toString()}function f(e=`/`,t=l()){let n=String(e??``).trim();if(!n||n===`/`)return u(`/api`,t);let r=n.startsWith(`/api`)?n:`/api${n.startsWith(`/`)?n:`/${n}`}`,i=r.indexOf(`?`),a=i===-1?r:r.slice(0,i),c=i===-1?``:r.slice(i),d=s(t);return d&&o(a)?u(`/api/v/${d}${a.slice(4)}${c}`,t):u(`${a}${c}`,t)}function p(t=l()){if(![`development`,`test`].includes(t.environment))return``;let n=new URLSearchParams(window.location.search).get(`server`);if(!n)return``;try{let t=new URL(n,window.location.origin);return[`http:`,`https:`,`ws:`,`wss:`].includes(t.protocol)?e(t.toString()):``}catch{return``}}function m(t=l()){let n=s(t),r=n?`/v/${n}`:``,i=p(t);return i?`${i}${r}`:t.publicWsBaseUrl?`${e(t.publicWsBaseUrl)}${r}`:`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}${u(`${t.wsBasePath}${r}`,t)}`}export{d as a,c,u as i,l as n,m as o,f as r,p as s,s as t};
|
|
@@ -24,6 +24,6 @@ ${f}`),i.reset(f)}function Ci(e,t,n={}){return Si(e,t,n)}async function wi(e,t){
|
|
|
24
24
|
`&&(p+=ne(m.slice(0,p),`
|
|
25
25
|
`)),m=a(0,m,`
|
|
26
26
|
`,e)}return{formatted:m,cursorOffset:p,comments:d.comments}}function $i(e,t,n){return typeof t!=`number`||Number.isNaN(t)||t<0||t>e.length?n:t}function ea(e,t){let{cursorOffset:n,rangeStart:r,rangeEnd:i}=t;return n=$i(e,n,-1),r=$i(e,r,0),i=$i(e,i,e.length),{...t,cursorOffset:n,rangeStart:r,rangeEnd:i}}function ta(e,t){let{cursorOffset:n,rangeStart:r,rangeEnd:i,endOfLine:a}=ea(e,t),o=e.charAt(0)===Yi;if(o&&(e=e.slice(1),n--,r--,i--),a===`auto`&&(a=g(e)),e.includes(`\r`)){let t=t=>ne(e.slice(0,Math.max(t,0)),`\r
|
|
27
|
-
`);n-=t(n),r-=t(r),i-=t(i),e=ie(e)}return{hasBOM:o,text:e,options:ea(e,{...t,cursorOffset:n,rangeStart:r,rangeEnd:i,endOfLine:a})}}async function na(e,t){let n=await li(t);return!n.hasPragma||n.hasPragma(e)}async function ra(e,t){return(await li(t)).hasIgnorePragma?.(e)}async function ia(e,t){let{hasBOM:n,text:r,options:i}=ta(e,await Q(t));if(i.rangeStart>=i.rangeEnd&&r!==``||i.requirePragma&&!await na(r,i)||i.checkIgnorePragma&&await ra(r,i))return{formatted:e,cursorOffset:t.cursorOffset,comments:[]};let a;return i.rangeStart>0||i.rangeEnd<r.length?a=await Qi(r,i):(!i.requirePragma&&i.insertPragma&&i.printer.insertPragma&&!await na(r,i)&&(r=i.printer.insertPragma(r)),a=await Zi(r,i)),n&&(a.formatted=Yi+a.formatted,a.cursorOffset>=0&&a.cursorOffset++),a}async function aa(e,t,n){let{text:r,options:i}=ta(e,await Q(t)),a=await Ei(r,i);return n&&(n.preprocessForPrint&&(a.ast=await Ni(a.ast,i)),n.massage&&(a.ast=Li(a.ast,i))),a}async function oa(e,t){return t=await Q(t),Nt(await ji(e,t),t)}async function sa(e,t){let{formatted:n}=await ia(nt(e),{...t,parser:`__js_expression`});return n}async function ca(e,t){t=await Q(t);let{ast:n}=await Ei(e,t);return t.cursorOffset>=0&&(t={...t,...Fi(n,t)}),ji(n,t)}async function la(e,t){return Nt(e,await Q(t))}var ua={};t(ua,{builders:()=>da,printer:()=>fa,utils:()=>pa});var da={join:Ke,line:Je,softline:Ye,hardline:B,literalline:Qe,group:He,conditionalGroup:Ue,fill:Ve,lineSuffix:$e,lineSuffixBoundary:et,cursor:z,breakParent:Be,ifBreak:We,trim:tt,indent:Fe,indentIfBreak:Ge,align:R,addAlignmentToDoc:ze,markAsRoot:Le,dedentToRoot:Ie,dedent:Re,hardlineWithoutBreakParent:Xe,literallineWithoutBreakParent:Ze,label:qe,concat:e=>e},fa={printDocToString:Nt},pa={willBreak:ye,traverseDoc:he,findInDoc:_e,mapDoc:ge,removeLines:Ce,stripTrailingHardline:Te,replaceEndOfLine:Oe,canBreak:Ae},ma=`3.9.
|
|
27
|
+
`);n-=t(n),r-=t(r),i-=t(i),e=ie(e)}return{hasBOM:o,text:e,options:ea(e,{...t,cursorOffset:n,rangeStart:r,rangeEnd:i,endOfLine:a})}}async function na(e,t){let n=await li(t);return!n.hasPragma||n.hasPragma(e)}async function ra(e,t){return(await li(t)).hasIgnorePragma?.(e)}async function ia(e,t){let{hasBOM:n,text:r,options:i}=ta(e,await Q(t));if(i.rangeStart>=i.rangeEnd&&r!==``||i.requirePragma&&!await na(r,i)||i.checkIgnorePragma&&await ra(r,i))return{formatted:e,cursorOffset:t.cursorOffset,comments:[]};let a;return i.rangeStart>0||i.rangeEnd<r.length?a=await Qi(r,i):(!i.requirePragma&&i.insertPragma&&i.printer.insertPragma&&!await na(r,i)&&(r=i.printer.insertPragma(r)),a=await Zi(r,i)),n&&(a.formatted=Yi+a.formatted,a.cursorOffset>=0&&a.cursorOffset++),a}async function aa(e,t,n){let{text:r,options:i}=ta(e,await Q(t)),a=await Ei(r,i);return n&&(n.preprocessForPrint&&(a.ast=await Ni(a.ast,i)),n.massage&&(a.ast=Li(a.ast,i))),a}async function oa(e,t){return t=await Q(t),Nt(await ji(e,t),t)}async function sa(e,t){let{formatted:n}=await ia(nt(e),{...t,parser:`__js_expression`});return n}async function ca(e,t){t=await Q(t);let{ast:n}=await Ei(e,t);return t.cursorOffset>=0&&(t={...t,...Fi(n,t)}),ji(n,t)}async function la(e,t){return Nt(e,await Q(t))}var ua={};t(ua,{builders:()=>da,printer:()=>fa,utils:()=>pa});var da={join:Ke,line:Je,softline:Ye,hardline:B,literalline:Qe,group:He,conditionalGroup:Ue,fill:Ve,lineSuffix:$e,lineSuffixBoundary:et,cursor:z,breakParent:Be,ifBreak:We,trim:tt,indent:Fe,indentIfBreak:Ge,align:R,addAlignmentToDoc:ze,markAsRoot:Le,dedentToRoot:Ie,dedent:Re,hardlineWithoutBreakParent:Xe,literallineWithoutBreakParent:Ze,label:qe,concat:e=>e},fa={printDocToString:Nt},pa={willBreak:ye,traverseDoc:he,findInDoc:_e,mapDoc:ge,removeLines:Ce,stripTrailingHardline:Te,replaceEndOfLine:Oe,canBreak:Ae},ma=`3.9.8`,ha={};t(ha,{addDanglingComment:()=>nn,addLeadingComment:()=>tn,addTrailingComment:()=>rn,getAlignmentSize:()=>Ft,getIndentSize:()=>Ta,getMaxContinuousCount:()=>Oa,getNextNonSpaceNonCommentCharacter:()=>Aa,getNextNonSpaceNonCommentCharacterIndex:()=>Va,getPreferredQuote:()=>Fa,getStringWidth:()=>xt,hasNewline:()=>q,hasNewlineInRange:()=>La,hasSpaces:()=>za,isNextLineEmpty:()=>Ka,isNextLineEmptyAfterIndex:()=>Ca,isPreviousLineEmpty:()=>Ua,makeString:()=>Ga,skip:()=>W,skipEverythingButNewLine:()=>Ut,skipInlineComment:()=>_a,skipNewline:()=>K,skipSpaces:()=>G,skipToLineEnd:()=>Ht,skipTrailingComment:()=>ya,skipWhitespace:()=>Vt});function ga(e,t){if(t===!1)return!1;if(e.charAt(t)===`/`&&e.charAt(t+1)===`*`){for(let n=t+2;n<e.length;++n)if(e.charAt(n)===`*`&&e.charAt(n+1)===`/`)return n+2}return t}var _a=ga;function va(e,t){return t===!1?!1:e.charAt(t)===`/`&&e.charAt(t+1)===`/`?Ut(e,t):t}var ya=va;function ba(e,t){let n=null,r=t;for(;r!==n;)n=r,r=G(e,r),r=_a(e,r),r=ya(e,r),r=K(e,r);return r}var xa=ba;function Sa(e,t){let n=null,r=t;for(;r!==n;)n=r,r=Ht(e,r),r=_a(e,r),r=G(e,r);return r=ya(e,r),r=K(e,r),r!==!1&&q(e,r)}var Ca=Sa;function wa(e,t){let n=e.lastIndexOf(`
|
|
28
28
|
`);return n===-1?0:Ft(e.slice(n+1).match(/^[\t ]*/)[0],t)}var Ta=wa;function Ea(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function Da(e,t){let n=e.matchAll(RegExp(`(?:${Ea(t)})+`,`g`));return n.reduce||(n=[...n]),n.reduce((e,[t])=>Math.max(e,t.length),0)/t.length}var Oa=Da;function ka(e,t){let n=xa(e,t);return n===!1?``:e.charAt(n)}var Aa=ka,ja=Object.freeze({character:`'`,codePoint:39}),Ma=Object.freeze({character:`"`,codePoint:34}),Na=Object.freeze({preferred:ja,alternate:Ma}),Pa=Object.freeze({preferred:Ma,alternate:ja});function Fa(e,t){let{preferred:n,alternate:r}=t===!0||t===`'`?Na:Pa,{length:i}=e,a=0,o=0;for(let t=0;t<i;t++){let i=e.charCodeAt(t);i===n.codePoint?a++:i===r.codePoint&&o++}return(a>o?r:n).character}function Ia(e,t,n){for(let r=t;r<n;++r)if(e.charAt(r)===`
|
|
29
29
|
`)return!0;return!1}var La=Ia;function Ra(e,t,n={}){return G(e,n.backwards?t-1:t,n)!==t}var za=Ra;function Ba(e,t,n){return xa(e,n(t))}function Va(e,t){return arguments.length===2||typeof t==`number`?xa(e,t):Ba(...arguments)}function Ha(e,t,n){return hn(e,n(t))}function Ua(e,t){return arguments.length===2||typeof t==`number`?hn(e,t):Ha(...arguments)}function Wa(e,t,n){return Ca(e,n(t))}function Ga(e,t,n){let r=t===`"`?`'`:`"`;return t+a(0,e,/\\(.)|(["'])/gs,(e,i,a)=>i===r?i:a===t?`\\`+a:a||(n&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(i)?i:`\\`+i))+t}function Ka(e,t){return arguments.length===2||typeof t==`number`?Ca(e,t):Wa(...arguments)}function $(e,t=1){return async(...n)=>{let r=n[t]??{},i=r.plugins??[];return n[t]={...r,plugins:Array.isArray(i)?i:Object.values(i)},await e(...n)}}var qa=$(ia);async function Ja(e,t){let{formatted:n}=await qa(e,{...t,cursorOffset:-1});return n}async function Ya(e,t){return await Ja(e,t)===e}var Xa=$(kn,0),Za={parse:$(aa),formatAST:$(oa),formatDoc:$(sa),printToDoc:$(ca),printDocToString:$(la)};export{Za as __debug,Ya as check,n as default,ua as doc,Ja as format,qa as formatWithCursor,Xa as getSupportInfo,ha as util,ma as version};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./auth-gate-C3mlS_4N.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{
|
|
2
|
+
import{d as e,n as t}from"./runtime-config-CvrkHb0n.js";import{a as n,c as r,l as i,r as a}from"./browser-utils-S4QYY31r.js";import{r as o}from"./runtime-paths-qQGhzNx4.js";import{t as s}from"./preload-helper-BAlEavIC.js";import{_ as c,a as l,f as u,h as d,m as f,s as p}from"./file-kind-BwMIcZbi.js";var m={enabled:!1,implemented:!0,loginEndpoint:`/api/auth/oidc/login`,passwordLabel:`Password`,provider:``,requiresLogin:!1,sessionEndpoint:`/api/auth/session`,statusEndpoint:`/api/auth/status`,strategy:`none`,submitLabel:`Continue`},h=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAIAAAABc2X6AAAGsklEQVR4Ae3cA3jsShgG4Gvbtu1js7aObdu2bdbudmvbtu1VtUg2ydw7x95mstnt5rZ5voflG80/fzL72L89bOsF94J7wWgb2dSgiAzpPHmwbfPK1qWzxDNsRdb6Ar2BgtF9hSbDRbYG4mk2beuXwm+Q89yV+TmAILgHptrb5DyPtg3LhBZjBCP+RovewNZlc2TOl8nGel0HA4LA4qPhkRSM6XcHoEYk86fIfT2AQqFzYIBjMncHofkoZBWNCM1GSq+cpdpadQIMKEoRzIeXIroEkW08TObpDAiiO8F4Tga85TBnoEc8xVKZm9UNYECS0stnBCP/Ud+AnJH/SC+eAiShPTDZ3CRZPIN9CUokC6ZSYqE2wHhmKhw/2TegR2RnSFSUaRaMJccLxg7QsAQhktkTAACaAmOxkbA80h2taKIZKWzR1BFWRAQLRvXhphYdDEtcWDxxU4sOhjdDkdVYbmrRwYAgJIums3RTNWrftbHz/AmZh5MiLBAGVqOdZ4+1790inmrFvpYZuPPEATWdknmT5f7eZEN9V2N7o9zPu3XNInQte2BlcYE6tVTbltXw4kf9h5QlhW3rliBr1QcDAODsjPFlhmelqfNvKQty4S9B0KoPVgTxmWk7Tx0COMZCF6GzA3ZC0LWMwJSsTWiOXj+O6iP382KzowAAvMOhaxmAqw/Ijr4tGPsHgnbsACwxlpNNPABIIv5LIvxpzOVlkdXPNMGK8CCudi2pFi+ovRFlwLOtc7/uUgvnxhxu05LpIyD17nTu+EAw8q9HaVtXzgcAcBUMcAER/sx9YBj5pdeExr897NLtT9TVcLgRTzVcgbyHBuc9L5n8PdLJzAEwmWP1KDCMMvTp9jWf3tbC1gdQKDgMBhRBRL0GYaojO35zxOo8fZjbz5ZAZz700Anm9pLI9g+yoY7bYKrJBWJoRpk8SJ0/fDoc13QuRuNdgMmydfTBZPkGdcDDd0q1EDkOVIKzTOiDKVGY7oPLmylVYCKlL30wIKW6D44tJlSCE76nC45+CwHXfWDfdKVKcMwHdMEJ33MC7JqEqwRHvEgXnDaYE+ArMayBB3ECDAennnVKn4tUDU74gS446k1OgB3i8Z41LHmkKHtW4eGfpRpctv5/VlomlxOsTR6kKQN1H1wnptiZHpYFv27pMbqus4kxOChbySzTz8loakfukhIkYKEBEBzw6SBXk79cLQ5lXv5XuxtJAaMDdA/v+JMydVs8irBnDvB+g9QbGeY1SUFg2gTn1JD0z+cdPIVaTbym0JemeQ6FzrtzJtdFm+DT4Rh9MD9DybxNmxL03mg3g/u0MP3cbWo6GrWjbZMBg/0Id6wqAcWwEX+F/10fVzPIe2jmRW3VTiP+VBjC4bU6KgMAID9qaQt9frl3P6hSndOaP7HrxdSYPQiH92QYhvAwTRH7KdSWBL9h5j4GeugkqDpWc1oZBqaelSGNwMWNJMLjUkHxBn//zwZeH3topr+7bWxDmia0AID17gok7aTTMrTnw1KsfZTPVMhAyj9uVl5lIexqcQLs4KFpYXjpSjQw3HwrIqCBQQ5mXsZInBWtoIOac1GOqrU4IsUJwOSllsmha5iZTf3npzXnqXka+1dFmzo4D9vZgQp2TsAZvrZUIC7729WSmRlmVfz+HGExKpUCVGJj1oSQlTd+SZ9Lm4bubqKvtTkmk+OAIRhu+zMu3jEwyqTQ1d7lofWdzV0VyWSxpPJkjpOB76z7fsPfjjOHHMhBb0QzAhMUMS18nRrgOzHkz96YdPR4toNTMT+gKjq4OtatNPBCvgfcp9PD1w/wsFP14y7WA4/zu9SudVWw8HKpUC4Zw5uOLmQ//c4fGrZL8iit+WEpvMmxAIZbtrCor7uNLpj/ubpk6N6Kh059M6tINl8Qh4UUHGa73wzjNGHQ4dj7wC6JOPtLACLqkvq4WeuE2cWi/+nLt0csOKnQ1CKP+IYMWELqgPnGiLVh6O7Go8GYZpfxpDbnwkaHjpj3JfLRV7Wgb01SARxIupc6wntyfGOG9pbikRQJmzvodRg7mRq2tkkm7IbFlhktBdaBS7SsPZx1haDIbltOSwGKXxl5px7UZGaEb8gXlerEgmmMxB2KfEciTKHRAsvbmPo0nVsST1BEdH3Kyrh9bJVlQ7wmbk05USSu0PUPPWjDOtxLg5bF7h7tM42B08x//o7U0/AmrCSV3PtYiwZpS3B13MHMS/DIz4rYaBO0VM93JpwbwaJtqNfEsbwZFgEL50VtgcJLBV6wK9aKtfd+cEkvuBfcC37k9h8VGR+csPdltgAAAABJRU5ErkJggg==`;function g(){return{...m,...t().auth??{}}}function _(){return e(window.location.hash).get(`auth_password`)||``}function v(){let t=e(window.location.hash);if(!t.has(`auth_password`))return;t.delete(`auth_password`);let n=t.toString(),r=`${window.location.pathname}${window.location.search}${n?`#${n}`:``}`;window.history.replaceState(null,``,r)}function y(t){let n=e(window.location.hash),r=n.get(t)||``;if(!r)return``;n.delete(t);let i=n.toString(),a=`${window.location.pathname}${window.location.search}${i?`#${i}`:``}`;return window.history.replaceState(null,``,a),r}function b(){return`${window.location.pathname}${window.location.search}${window.location.hash}`}async function x(e){let t=await fetch(e.statusEndpoint,{headers:{Accept:`application/json`}});return i(t,`Failed to read auth status`)}function S(e){let t=e?.auth??{};if(t.strategy!==`oidc`||t.provider!==`google`)return;let n=String(e?.user?.name??``).trim();if(n)try{window.localStorage.setItem(`collabmd-user-name`,n)}catch{}}async function C(e,t){let n=await fetch(e.sessionEndpoint,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:t})});return i(n,`Authentication failed`)}function w(){let e=document.createElement(`div`);e.className=`auth-gate-overlay`;let t=document.createElement(`section`);return t.className=`auth-gate-card`,e.append(t),{card:t,overlay:e}}function T(){let e=document.createElement(`span`);e.className=`auth-gate-button__icon`,e.setAttribute(`aria-hidden`,`true`);let t=document.createElement(`img`);return t.alt=``,t.decoding=`async`,t.height=20,t.loading=`eager`,t.src=h,t.width=20,e.append(t),e}function E(e,t,{errorMessage:n=``}){e.replaceChildren();let r=document.createElement(`h1`);r.textContent=`Authentication required`;let i=document.createElement(`p`);i.textContent=`Sign in with Google to join this session.`;let a=document.createElement(`div`);a.className=`auth-gate-actions`;let o=document.createElement(`button`);o.className=`ui-button ui-button--secondary auth-gate-button auth-gate-button--google`,o.type=`button`,o.append(T(),document.createTextNode(t.submitLabel||`Continue with Google`));let s=document.createElement(`div`);s.className=`auth-gate-error`,s.textContent=n,a.append(o),e.append(r,i,s,a),o.addEventListener(`click`,()=>{let e=new URL(t.loginEndpoint,window.location.origin);e.searchParams.set(`returnTo`,b()),window.location.assign(e.toString())})}function D(e,{title:t,body:n,secondaryActionLabel:r=``,onSecondaryAction:i=null}){e.replaceChildren();let a=document.createElement(`h1`);a.textContent=t;let o=document.createElement(`p`);if(o.textContent=n,e.append(a,o),r&&typeof i==`function`){let t=document.createElement(`button`);t.className=`ui-button ui-button--secondary auth-gate-secondary-button`,t.type=`button`,t.textContent=r,t.addEventListener(`click`,()=>{i()}),e.append(t)}}function O(e,t,{onSubmit:n}){e.replaceChildren();let r=document.createElement(`h1`);r.textContent=`Authentication required`;let i=document.createElement(`p`);i.textContent=`Enter the host password to join this shared session.`;let a=document.createElement(`form`);a.className=`auth-gate-form`;let o=document.createElement(`label`);o.className=`auth-gate-label`,o.textContent=t.passwordLabel;let s=document.createElement(`input`);s.className=`ui-input auth-gate-input`,s.type=`password`,s.name=`password`,s.autocomplete=`current-password`,s.required=!0;let c=document.createElement(`div`);c.className=`auth-gate-error`;let l=document.createElement(`div`);l.className=`auth-gate-actions`;let u=document.createElement(`button`);u.className=`ui-button ui-button--primary auth-gate-button`,u.type=`submit`,u.textContent=t.submitLabel,l.append(u),o.append(s),a.append(r,i,o,c,l),e.append(a),a.addEventListener(`submit`,e=>{e.preventDefault();let t=s.value;s.disabled=!0,u.disabled=!0,c.textContent=``,n(t).catch(e=>{c.textContent=e instanceof Error?e.message:`Authentication failed`,s.disabled=!1,u.disabled=!1,s.select(),s.focus()})}),queueMicrotask(()=>{s.focus()})}async function k(){let e=g();if(!e.enabled||e.strategy===`none`)return{authenticated:!0,auth:e};await s(()=>Promise.resolve({}),__vite__mapDeps([0]),import.meta.url);let{card:t,overlay:n}=w();document.body.append(n);let r=y(`auth_error`);return new Promise(i=>{let a=(t=null)=>{v(),S(t),n.remove(),i({authenticated:!0,auth:t?.auth??e,user:t?.user??null})};(async()=>{D(t,{body:`Checking access to this session…`,title:`CollabMD`});try{let t=await x(e);if(t.authenticated){a(t);return}}catch(e){D(t,{body:e instanceof Error?`${e.message} Refresh the page and try again.`:`Failed to contact the auth service. Refresh the page and try again.`,title:`Cannot verify access`});return}if(e.strategy===`password`){let n=_();if(n)try{v(),await C(e,n),a();return}catch{}O(t,e,{onSubmit:async t=>{await C(e,t),a()}});return}if(e.strategy===`oidc`){E(t,e,{errorMessage:r}),r=``;return}D(t,{body:`This authentication strategy is not available.`,title:`Authentication unavailable`})})()})}function A(e){return!e||e.repeat||!e.metaKey&&!e.ctrlKey||e.shiftKey||e.altKey?!1:String(e.key??``).toLowerCase()===`k`||e.code===`KeyK`}function j(e){let t=String(e??``).trim().replace(/\\/g,`/`);if(!t||t.startsWith(`/`))return``;let n=t.split(`/`).map(e=>e.trim()).filter(Boolean);return n.some(e=>e===`.`||e===`..`)?``:n.join(`/`)}function M(e,t){let n=j(e),r=j(t);return n?r?`${n}/${r}`:n:r}function N(e=``){return String(e??``).replace(/\/+$/u,``).split(`/`).filter(Boolean).pop()||``}function P(e=``){let t=String(e??``).replace(/\/+$/u,``),n=t.lastIndexOf(`/`);return n>=0?t.slice(0,n):``}function F(e,t){return e.toLowerCase().endsWith(t.toLowerCase())?e:`${e}${t}`}function I(e){return`# ${c(String(e??``).split(`/`).pop()||``)||`Untitled`}\n\n`}function L(e){let t=j(e),n=l(t)?t:`${t}.base`;return{content:[`views:`,` - type: table`,` name: Table`,` order:`,` - file.name`,``].join(`
|
|
3
3
|
`),path:n}}function R(e){let t=j(e),n=u(t)?t:`${t}.mmd`;return{content:[`flowchart TD`,` A[Start] --> B{Decide}`,` B -->|Yes| C[Ship it]`,` B -->|No| D[Revise]`,``].join(`
|
|
4
4
|
`),path:n}}function z(e){let t=j(e),n=p(t)?t:`${t}.drawio`;return{content:[`<mxfile host="app.diagrams.net" modified="2026-01-01T00:00:00.000Z" agent="CollabMD" version="24.7.17">`,` <diagram id="page-1" name="Page-1">`,` <mxGraphModel dx="1200" dy="800" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">`,` <root>`,` <mxCell id="0" />`,` <mxCell id="1" parent="0" />`,` </root>`,` </mxGraphModel>`,` </diagram>`,`</mxfile>`,``].join(`
|
|
5
5
|
`),path:n}}function B(e){let t=j(e),n=f(t)?t:`${t}.puml`;return{content:[`@startuml`,`Alice -> Bob: Hello`,`@enduml`,``].join(`
|
|
6
6
|
`),path:n}}function V(e){let t=j(e),n=d(t)?t:`${t}.dsl`;return{content:`workspace "CollabMD Example" "A small Structurizr workspace" {, model {, user = person "User" "Uses the system", system = softwareSystem "Example System" "The system being documented" {, web = container "Web Application" "Serves the user interface" "JavaScript" {, home = component "Home Page" "Shows the landing page" "React", editor = component "Editor" "Edits workspace content" "React", }, api = container "API" "Handles requests" "Node.js", }, user -> system "Uses", web -> api "Calls" "HTTPS/JSON", home -> editor "Links to", }, views {, systemContext system "Context" {, include *, autoLayout, }, container system "Containers" {, include *, autoLayout, }, component web "Components" {, include *, autoLayout, }, styles {, element "Person" {, shape person, }, }, },},`.split(`,`).join(`
|
|
7
|
-
`),path:n}}function H(e){return encodeURIComponent(String(e??``))}async function U(e,{fallbackError:t,fallbackFileName:
|
|
7
|
+
`),path:n}}function H(e){return encodeURIComponent(String(e??``))}async function U(e,{fallbackError:t,fallbackFileName:r}={}){let i=await fetch(e);if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error||t)}let o=await i.blob();return a(o,n(i.headers.get(`content-disposition`)||``,r),{removeDelayMs:0,revokeDelayMs:0}),i}var W={async readTree(){let e=await fetch(o(`/files`));return i(e,`Failed to load file tree`)},async callAgentTool(e,t,{signal:n}={}){let r=await fetch(o(`/agent/tools/${encodeURIComponent(e)}`),{body:JSON.stringify(t),headers:{"Content-Type":`application/json`},method:`POST`,signal:n});return i(r,`Failed to execute ${e}`)},async readCommentOverview(){let e=await fetch(o(`/comments/overview`));return i(e,`Failed to load comment overview`)},async readFile(e){let t=await fetch(o(`/file?path=${encodeURIComponent(e)}`));return i(t,`Failed to read file`)},async readBacklinks(e,{signal:t}={}){let n=await fetch(o(`/backlinks?file=${encodeURIComponent(e)}`),{signal:t}),r=await i(n,`Failed to load backlinks`);return Array.isArray(r.backlinks)?r.backlinks:[]},async syncStructurizrWorkspace({path:e,source:t}){let n=await fetch(o(`/structurizr/sync`),{body:JSON.stringify({path:e,source:t}),headers:{"Content-Type":`application/json`},method:`POST`});return i(n,`Failed to sync Structurizr workspace`)},async renderSvg(e){let t=await fetch(o(`/plantuml/render`),{body:JSON.stringify({source:e}),headers:{"Content-Type":`application/json`},method:`POST`}),n=await i(t,`Failed to render PlantUML`);if(!n.ok||typeof n.svg!=`string`)throw Error(n.error||`Failed to render PlantUML`);return n.svg},async searchText({limit:e=50,query:t=``,signal:n=null}={}){let r=new URLSearchParams({limit:String(e),q:String(t??``)}),a=await fetch(o(`/search?${r.toString()}`),{signal:n});return i(a,`Failed to search files`)},async queryBase({activeFilePath:e=``,path:t=``,search:n=``,source:r=null,sourcePath:a=``,view:s=``}={}){let c=await fetch(o(`/base/query`),{body:JSON.stringify({activeFilePath:e,path:t,search:n,source:r,sourcePath:a,view:s}),headers:{"Content-Type":`application/json`},method:`POST`});return i(c,`Failed to query base`)},async exportBaseCsv({activeFilePath:e=``,path:t=``,search:n=``,source:r=null,sourcePath:i=``,view:a=``}={}){let s=await fetch(o(`/base/export`),{body:JSON.stringify({activeFilePath:e,path:t,search:n,source:r,sourcePath:i,view:a}),headers:{"Content-Type":`application/json`},method:`POST`});if(!s.ok){let e=await s.json().catch(()=>({}));throw Error(e.error||`Failed to export base CSV`)}return{blob:await s.blob(),contentDisposition:s.headers.get(`content-disposition`)||``}},async queryBasePropertyValues({activeFilePath:e=``,path:t=``,propertyId:n=``,query:r=``,source:a=null,sourcePath:s=``,view:c=``}={}){let l=await fetch(o(`/base/property-values`),{body:JSON.stringify({activeFilePath:e,path:t,propertyId:n,query:r,source:a,sourcePath:s,view:c}),headers:{"Content-Type":`application/json`},method:`POST`});return i(l,`Failed to load base property values`)},async transformBase({activeFilePath:e=``,mutation:t=null,path:n=``,source:r=null,sourcePath:a=``,view:s=``}={}){let c=await fetch(o(`/base/transform`),{body:JSON.stringify({activeFilePath:e,mutation:t,path:n,source:r,sourcePath:a,view:s}),headers:{"Content-Type":`application/json`},method:`POST`});return i(c,`Failed to transform base`)},async createFile({content:e,path:t,requestId:n=null}){let a=await fetch(o(`/file`),{body:JSON.stringify({content:e,path:t}),headers:r(n,{"Content-Type":`application/json`}),method:`POST`});return i(a,`Failed to create file`)},async writeFile({content:e,path:t,requestId:n=null}){let a=await fetch(o(`/file`),{body:JSON.stringify({content:e,path:t}),headers:r(n,{"Content-Type":`application/json`}),method:`PUT`});return i(a,`Failed to write file`)},async renameFile({oldPath:e,newPath:t,requestId:n=null}){let a=await fetch(o(`/file`),{body:JSON.stringify({newPath:t,oldPath:e}),headers:r(n,{"Content-Type":`application/json`}),method:`PATCH`});return i(a,`Failed to rename file`)},async deleteFile(e,{requestId:t=null}={}){let n=await fetch(o(`/file?path=${encodeURIComponent(e)}`),{headers:t?r(t):void 0,method:`DELETE`});return i(n,`Failed to delete file`)},async createDirectory(e,{requestId:t=null}={}){let n=await fetch(o(`/directory`),{body:JSON.stringify({path:e}),headers:r(t,{"Content-Type":`application/json`}),method:`POST`});return i(n,`Failed to create folder`)},async renameDirectory({oldPath:e,newPath:t,requestId:n=null}){let a=await fetch(o(`/directory`),{body:JSON.stringify({newPath:t,oldPath:e}),headers:r(n,{"Content-Type":`application/json`}),method:`PATCH`});return i(a,`Failed to rename folder`)},async deleteDirectory(e,{recursive:t=!1,requestId:n=null}={}){let a=new URLSearchParams({path:String(e??``)});t&&a.set(`recursive`,`1`);let s=await fetch(o(`/directory?${a.toString()}`),{headers:n?r(n):void 0,method:`DELETE`});return i(s,`Failed to delete folder`)},async uploadImageAttachment({file:e,fileName:t=``,sourcePath:n}){let r=await fetch(o(`/attachments`),{body:e,headers:{"Content-Type":e?.type||`application/octet-stream`,"X-CollabMD-File-Name":H(t),"X-CollabMD-Source-Path":H(n)},method:`POST`});return i(r,`Failed to upload image`)},async uploadFile({file:e,path:t,requestId:n=null}){let a=await fetch(o(`/file/upload`),{body:e,headers:r(n,{"Content-Type":e?.type||`application/octet-stream`,"X-CollabMD-File-Path":H(t)}),method:`POST`});return i(a,`Failed to upload file`)},async downloadFile(e){let t=N(e)||`download`;return U(o(`/download/file?path=${encodeURIComponent(e)}`),{fallbackError:`Failed to download file`,fallbackFileName:t})},async downloadDirectory(e){let t=N(e)||`vault`;return U(o(`/download/directory?path=${encodeURIComponent(e)}`),{fallbackError:`Failed to download folder`,fallbackFileName:`${t}.zip`})}};export{I as a,V as c,P as d,j as f,z as i,F as l,k as m,M as n,R as o,A as p,L as r,B as s,W as t,N as u};
|
package/dist/client/assets/{worker-engine-m0rlHn8R-5h66k403.js → worker-engine-BCCrxWYm-CX0qJ_cG.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{St as e,U as t,_ as n,lt as r}from"./embedpdf-
|
|
1
|
+
import{St as e,U as t,_ as n,lt as r}from"./embedpdf-cl9qiF45-itpgqvGY.js";import{r as i,t as a}from"./browser-BKLM0ThC-BCLQGPD6-K2seJgRL.js";var o=`RemoteExecutor`,s=`Worker`,c=class i{constructor(a,c){this.worker=a,this.pendingRequests=new Map,this.requestCounter=0,this.handleMessage=t=>{let n=t.data;if(n.type===`ready`)return this.logger.debug(o,s,`Worker is ready`),void this.readyTask.resolve(!0);let r=this.pendingRequests.get(n.id);if(r)switch(n.type){case`result`:this.logger.debug(o,s,`Received result for ${n.id}`),r.resolve(n.data),this.pendingRequests.delete(n.id);break;case`error`:this.logger.debug(o,s,`Received error for ${n.id}:`,n.error),n.error?r.fail(n.error):r.reject({code:e.Unknown,message:`Unknown error`}),this.pendingRequests.delete(n.id);break;case`progress`:this.logger.debug(o,s,`Received progress for ${n.id}`),r.progress(n.progress)}else this.logger.warn(o,s,`Received response for unknown request: ${n.id}`)},this.logger=c.logger??new r,this.worker.addEventListener(`message`,this.handleMessage),this.readyTask=new n,this.pendingRequests.set(i.READY_TASK_ID,this.readyTask),this.worker.postMessage({id:i.READY_TASK_ID,type:`wasmInit`,wasmUrl:c.wasmUrl,logger:c.logger?t(c.logger):void 0,fontFallback:c.fontFallback}),this.logger.debug(o,s,`RemoteExecutor created`)}generateId(){return`req-${Date.now()}-${this.requestCounter++}`}send(t,r){let i=this.generateId(),a=new n,c={id:i,type:`execute`,method:t,args:r};return this.readyTask.wait(()=>{this.pendingRequests.set(i,a),this.logger.debug(o,s,`Sending ${t} request:`,i),this.worker.postMessage(c)},n=>{this.logger.error(o,s,`Worker init failed, rejecting ${t}:`,n),a.reject({code:e.Initialization,message:`Worker initialization failed`})}),a}destroy(){this.worker.removeEventListener(`message`,this.handleMessage),this.pendingRequests.forEach((e,t)=>{t!==i.READY_TASK_ID&&(e.abort(`Worker destroyed`),this.logger.debug(o,s,`Aborted pending request: ${t}`))}),this.pendingRequests.clear(),this.worker.terminate(),this.logger.debug(o,s,`RemoteExecutor destroyed`)}openDocumentBuffer(e,t){return this.send(`openDocumentBuffer`,[e,t])}getMetadata(e){return this.send(`getMetadata`,[e])}setMetadata(e,t){return this.send(`setMetadata`,[e,t])}getDocPermissions(e){return this.send(`getDocPermissions`,[e])}getDocUserPermissions(e){return this.send(`getDocUserPermissions`,[e])}getSignatures(e){return this.send(`getSignatures`,[e])}getBookmarks(e){return this.send(`getBookmarks`,[e])}setBookmarks(e,t){return this.send(`setBookmarks`,[e,t])}deleteBookmarks(e){return this.send(`deleteBookmarks`,[e])}renderPageRaw(e,t,n){return this.send(`renderPageRaw`,[e,t,n])}renderPageRect(e,t,n,r){return this.send(`renderPageRect`,[e,t,n,r])}renderThumbnailRaw(e,t,n){return this.send(`renderThumbnailRaw`,[e,t,n])}renderPageAnnotationRaw(e,t,n,r){return this.send(`renderPageAnnotationRaw`,[e,t,n,r])}renderPageAnnotationsRaw(e,t,n){return this.send(`renderPageAnnotationsRaw`,[e,t,n])}getPageAnnotationsRaw(e,t){return this.send(`getPageAnnotationsRaw`,[e,t])}getPageAnnotations(e,t){return this.send(`getPageAnnotations`,[e,t])}createPageAnnotation(e,t,n,r){return this.send(`createPageAnnotation`,[e,t,n,r])}updatePageAnnotation(e,t,n,r){return this.send(`updatePageAnnotation`,[e,t,n,r])}removePageAnnotation(e,t,n){return this.send(`removePageAnnotation`,[e,t,n])}getPageTextRects(e,t){return this.send(`getPageTextRects`,[e,t])}searchInPage(e,t,n,r){return this.send(`searchInPage`,[e,t,n,r])}getAnnotationsBatch(e,t){return this.send(`getAnnotationsBatch`,[e,t])}searchBatch(e,t,n,r){return this.send(`searchBatch`,[e,t,n,r])}getAttachments(e){return this.send(`getAttachments`,[e])}addAttachment(e,t){return this.send(`addAttachment`,[e,t])}removeAttachment(e,t){return this.send(`removeAttachment`,[e,t])}readAttachmentContent(e,t){return this.send(`readAttachmentContent`,[e,t])}getDocumentJavaScriptActions(e){return this.send(`getDocumentJavaScriptActions`,[e])}getPageAnnoWidgets(e,t){return this.send(`getPageAnnoWidgets`,[e,t])}getPageWidgetJavaScriptActions(e,t){return this.send(`getPageWidgetJavaScriptActions`,[e,t])}setFormFieldValue(e,t,n,r){return this.send(`setFormFieldValue`,[e,t,n,r])}setFormFieldState(e,t,n,r){return this.send(`setFormFieldState`,[e,t,n,r])}renameWidgetField(e,t,n,r){return this.send(`renameWidgetField`,[e,t,n,r])}shareWidgetField(e,t,n,r,i){return this.send(`shareWidgetField`,[e,t,n,r,i])}regenerateWidgetAppearances(e,t,n){return this.send(`regenerateWidgetAppearances`,[e,t,n])}flattenPage(e,t,n){return this.send(`flattenPage`,[e,t,n])}extractPages(e,t){return this.send(`extractPages`,[e,t])}createDocument(e){return this.send(`createDocument`,[e])}importPages(e,t,n,r){return this.send(`importPages`,[e,t,n,r])}deletePage(e,t){return this.send(`deletePage`,[e,t])}extractText(e,t){return this.send(`extractText`,[e,t])}redactTextInRects(e,t,n,r){return this.send(`redactTextInRects`,[e,t,n,r])}applyRedaction(e,t,n){return this.send(`applyRedaction`,[e,t,n])}applyAllRedactions(e,t){return this.send(`applyAllRedactions`,[e,t])}flattenAnnotation(e,t,n){return this.send(`flattenAnnotation`,[e,t,n])}exportAnnotationAppearanceAsPdf(e,t,n){return this.send(`exportAnnotationAppearanceAsPdf`,[e,t,n])}exportAnnotationsAppearanceAsPdf(e,t,n){return this.send(`exportAnnotationsAppearanceAsPdf`,[e,t,n])}getTextSlices(e,t){return this.send(`getTextSlices`,[e,t])}getPageGlyphs(e,t){return this.send(`getPageGlyphs`,[e,t])}getPageGeometry(e,t){return this.send(`getPageGeometry`,[e,t])}getPageTextRuns(e,t){return this.send(`getPageTextRuns`,[e,t])}merge(e){return this.send(`merge`,[e])}mergePages(e){return this.send(`mergePages`,[e])}preparePrintDocument(e,t){return this.send(`preparePrintDocument`,[e,t])}saveAsCopy(e){return this.send(`saveAsCopy`,[e])}closeDocument(e){return this.send(`closeDocument`,[e])}closeAllDocuments(){return this.send(`closeAllDocuments`,[])}setDocumentEncryption(e,t,n,r){return this.send(`setDocumentEncryption`,[e,t,n,r])}removeEncryption(e){return this.send(`removeEncryption`,[e])}unlockOwnerPermissions(e,t){return this.send(`unlockOwnerPermissions`,[e,t])}isEncrypted(e){return this.send(`isEncrypted`,[e])}isOwnerUnlocked(e){return this.send(`isOwnerUnlocked`,[e])}};c.READY_TASK_ID=`0`;var l=c,u=`ImageEncoderPool`,d=`Encoder`,f=class{constructor(e=2,t,n){this.poolSize=e,this.workerUrl=t,this.workers=[],this.pendingTasks=new Map,this.nextWorkerId=0,this.requestCounter=0,this.logger=n??new r,this.initialize()}initialize(){this.logger.debug(u,d,`Creating worker pool with ${this.poolSize} workers`);for(let e=0;e<this.poolSize;e++)try{let t=new Worker(this.workerUrl,{type:`module`});t.onmessage=this.handleWorkerMessage.bind(this),t.onerror=this.handleWorkerError.bind(this),this.workers.push(t),this.logger.debug(u,d,`Worker ${e} created successfully`)}catch(t){this.logger.error(u,d,`Failed to create worker ${e}:`,t)}}handleWorkerMessage(e){let t=e.data,n=this.pendingTasks.get(t.id);if(n){if(this.pendingTasks.delete(t.id),t.type===`result`)n.resolve(t.data);else{let e=t.data;n.reject(Error(e.message))}}else this.logger.warn(u,d,`Received response for unknown task: ${t.id}`)}handleWorkerError(e){this.logger.error(u,d,`Worker error:`,e.message)}getNextWorker(){if(this.workers.length===0)return null;let e=this.workers[this.nextWorkerId];return this.nextWorkerId=(this.nextWorkerId+1)%this.workers.length,e}encode(e,t=`image/png`,n){return new Promise((r,i)=>{let a=this.getNextWorker();if(!a)return void i(Error(`No workers available in the pool`));let o=`encode-${Date.now()}-${this.requestCounter++}`;this.pendingTasks.set(o,{resolve:r,reject:i});let s={id:o,type:`encode`,data:{imageData:{data:e.data,width:e.width,height:e.height},imageType:t,quality:n}};this.logger.debug(u,d,`Sending encoding request ${o} (${e.width}x${e.height})`),a.postMessage(s,[e.data.buffer])})}destroy(){this.logger.debug(u,d,`Destroying worker pool`),this.pendingTasks.forEach((e,t)=>{e.reject(Error(`Worker pool destroyed`)),this.logger.debug(u,d,`Rejected pending task: ${t}`)}),this.pendingTasks.clear(),this.workers.forEach((e,t)=>{e.terminate(),this.logger.debug(u,d,`Worker ${t} terminated`)}),this.workers=[]}get activeWorkers(){return this.workers.length}get pendingTasksCount(){return this.pendingTasks.size}};function p(e,t){let{logger:n,encoderPoolSize:r,fontFallback:o}=t instanceof Object&&`debug`in t?{logger:t}:t||{},s=new l(new Worker(URL.createObjectURL(new Blob([`var Rotation = /* @__PURE__ */ ((Rotation2) => {
|
|
2
2
|
Rotation2[Rotation2["Degree0"] = 0] = "Degree0";
|
|
3
3
|
Rotation2[Rotation2["Degree90"] = 1] = "Degree90";
|
|
4
4
|
Rotation2[Rotation2["Degree180"] = 2] = "Degree180";
|
package/dist/client/assets/{workspace-sync-client-C2pdaQUN.js → workspace-sync-client-BrMtf6zN.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./runtime-paths-
|
|
1
|
+
import{o as e}from"./runtime-paths-qQGhzNx4.js";import{t}from"./yjs-B41tM6Sz.js";import{n,t as r}from"./yjs-provider-reset-guard-DpntzUDR.js";import{n as i}from"./workspace-change-CVA9dVmy.js";var a=`__workspace__`;function o(e=``){return String(e??``).trim().replace(/\\/g,`/`).split(`/`).filter(Boolean).join(`/`)}function s(e=``){let t=o(e);if(!t)return``;let n=t.lastIndexOf(`/`);return n>=0?t.slice(0,n):``}function c(e={}){return s(e?.path??``)}function l(e){if(!e?.path||!e?.type)return null;if(e.nodeType===`directory`||e.type===`directory`)return{children:[],name:e.name,path:e.path,type:`directory`};let t={name:e.name,path:e.path,type:e.type},n=Number(e.mtimeMs);return Number.isFinite(n)&&(t.mtimeMs=n),t}function u(e=[]){return e.sort((e,t)=>e.type===`directory`&&t.type!==`directory`?-1:e.type!==`directory`&&t.type===`directory`?1:e.name.localeCompare(t.name,void 0,{sensitivity:`base`})),e.forEach(e=>{Array.isArray(e.children)&&u(e.children)}),e}function d(e){return e instanceof Map?e:new Map(Object.entries(e??{}))}function f(e=[],t=`asc`){let n=t===`desc`?-1:1;return[...e].sort((e,t)=>{let r=e.split(`/`).length-t.split(`/`).length;return r===0?e.localeCompare(t,void 0,{sensitivity:`base`})*n:r*n})}var p=class{constructor(){this.entriesByPath=new Map,this.nodesByPath=new Map,this.nodeParentPathByPath=new Map,this.roots=[]}reset(e){return this.entriesByPath=d(e),this.nodesByPath=new Map,this.nodeParentPathByPath=new Map,this.roots=[],this.entriesByPath.forEach(e=>{let t=l(e);t&&this.nodesByPath.set(e.path,t)}),f(Array.from(this.nodesByPath.keys())).forEach(e=>{let t=this.nodesByPath.get(e);t&&this.attachNode(e,t,c(this.entriesByPath.get(e)))}),u(this.roots),this.roots}getTree(){return this.roots}applyMapChanges(e,t){let n=[],r=[];return e.forEach((e,t)=>{e.action===`delete`?n.push(t):r.push(t)}),f(n,`desc`).forEach(e=>{this.removeEntry(e)}),f(r).forEach(e=>{this.upsertEntry(e,t.get(e))}),u(this.roots),this.roots}removeEntry(e){let t=this.nodesByPath.get(e);if(!t){this.entriesByPath.delete(e),this.nodeParentPathByPath.delete(e);return}this.detachNode(e,t),this.nodesByPath.delete(e),this.entriesByPath.delete(e),this.nodeParentPathByPath.delete(e)}upsertEntry(e,t){if(!t?.path||!t?.type){this.removeEntry(e);return}let n=l(t);if(!n){this.removeEntry(e);return}let r=this.nodesByPath.get(e);!r||r.type===`directory`!=(n.type===`directory`)?(r&&this.detachNode(e,r),r=n,this.nodesByPath.set(e,r)):(r.name=n.name,r.path=n.path,r.type=n.type,n.mtimeMs===void 0?delete r.mtimeMs:r.mtimeMs=n.mtimeMs,r.type===`directory`&&!Array.isArray(r.children)&&(r.children=[]),r.type!==`directory`&&Array.isArray(r.children)&&delete r.children),this.entriesByPath.set(e,t),this.attachNode(e,r,c(t)),r.type===`directory`&&this.rehomeChildren(e)}detachNode(e,t){let n=this.nodeParentPathByPath.get(e)||``,r=n?this.nodesByPath.get(n)?.children:this.roots,i=r?.indexOf?.(t)??-1;i>=0&&r.splice(i,1),this.nodeParentPathByPath.delete(e)}attachNode(e,t,n=``){let r=this.nodesByPath.get(n)?.type===`directory`?n:``,i=this.nodeParentPathByPath.get(e);if(i===r)return;i!==void 0&&this.detachNode(e,t);let a=r?this.nodesByPath.get(r)?.children:this.roots;a.includes(t)||a.push(t),this.nodeParentPathByPath.set(e,r)}rehomeChildren(e){this.entriesByPath.forEach((t,n)=>{if(c(t)!==e)return;let r=this.nodesByPath.get(n);r&&this.attachNode(n,r,e)})}},m=class{constructor({onTreeChange:e=()=>{},onWorkspaceEvent:n=()=>{}}={}){this.onTreeChange=e,this.onWorkspaceEvent=n,this.ydoc=new t,this.entries=this.ydoc.getMap(`entries`),this.events=this.ydoc.getArray(`events`),this.provider=null,this._didInitialSync=!1,this.seenEventIds=new Set,this.treeModel=new p,this.handleEntriesChange=e=>{this._didInitialSync&&e&&this.onTreeChange(this.treeModel.applyMapChanges(e.changes.keys,this.entries),{changedPaths:Array.from(e.changes.keys.keys()),reset:!1})},this.handleEventsChange=()=>{if(!this._didInitialSync){this.primeEventCache();return}this.events.toArray().forEach(e=>{let t=i(e);t&&!this.seenEventIds.has(t.id)&&(this.seenEventIds.add(t.id),this.onWorkspaceEvent(t))})}}connect(){this.provider||(this._didInitialSync=!1,this.provider=new n(e(),a,this.ydoc,{disableBc:!0,maxBackoffTime:5e3}),r(this.provider),this.entries.observe(this.handleEntriesChange),this.events.observe(this.handleEventsChange),this.provider.on(`sync`,e=>{e&&!this._didInitialSync&&(this._didInitialSync=!0,this.primeEventCache(),this.onTreeChange(this.treeModel.reset(this.entries.toJSON()),{changedPaths:[],reset:!0}))}))}primeEventCache(){this.events.toArray().forEach(e=>{let t=i(e);t&&this.seenEventIds.add(t.id)})}disconnect(){this.provider&&(this.entries.unobserve(this.handleEntriesChange),this.events.unobserve(this.handleEventsChange),this.provider.disconnect(),this.provider.destroy()),this.provider=null,this._didInitialSync=!1,this.seenEventIds.clear(),this.treeModel.reset(new Map)}destroy(){this.disconnect(),this.ydoc.destroy()}};export{m as WorkspaceSyncClient};
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
<title>draw.io — CollabMD</title>
|
|
7
7
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'><rect x='3' y='4' width='17' height='24' rx='3' stroke='%232563eb' stroke-width='2'/><rect x='12' y='4' width='17' height='24' rx='3' fill='%232563eb'/><path d='M17 12h7m-7 4h7m-7 4h4' stroke='white' stroke-width='1.5'/></svg>">
|
|
8
8
|
<script defer src="./app-config.js"></script>
|
|
9
|
-
<script type="module" crossorigin src="./assets/drawioEditor-
|
|
10
|
-
<link rel="modulepreload" crossorigin href="./assets/runtime-paths-
|
|
11
|
-
<link rel="modulepreload" crossorigin href="./assets/runtime-config-
|
|
12
|
-
<link rel="modulepreload" crossorigin href="./assets/browser-utils-
|
|
9
|
+
<script type="module" crossorigin src="./assets/drawioEditor-DNTjsjzJ.js"></script>
|
|
10
|
+
<link rel="modulepreload" crossorigin href="./assets/runtime-paths-qQGhzNx4.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="./assets/runtime-config-CvrkHb0n.js">
|
|
12
|
+
<link rel="modulepreload" crossorigin href="./assets/browser-utils-S4QYY31r.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-BAlEavIC.js">
|
|
14
14
|
<link rel="modulepreload" crossorigin href="./assets/file-kind-BwMIcZbi.js">
|
|
15
|
-
<link rel="modulepreload" crossorigin href="./assets/vault-api-client-
|
|
15
|
+
<link rel="modulepreload" crossorigin href="./assets/vault-api-client-NS_EVHJ3.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="./assets/drawio-room-yBUzk-vg.js">
|
|
17
17
|
<link rel="stylesheet" crossorigin href="./assets/drawioEditor-UQQ8XHou.css">
|
|
18
18
|
<link rel="stylesheet" crossorigin href="./assets/embedded-editor-base-elU0Avik.css">
|
|
@@ -6,18 +6,18 @@
|
|
|
6
6
|
<title>Excalidraw — CollabMD</title>
|
|
7
7
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'><rect x='3' y='4' width='17' height='24' rx='3' stroke='%232563eb' stroke-width='2'/><rect x='12' y='4' width='17' height='24' rx='3' fill='%232563eb'/><path d='M17 12h7m-7 4h7m-7 4h4' stroke='white' stroke-width='1.5'/></svg>">
|
|
8
8
|
<script defer src="./app-config.js"></script>
|
|
9
|
-
<script type="module" crossorigin src="./assets/excalidrawEditor-
|
|
9
|
+
<script type="module" crossorigin src="./assets/excalidrawEditor-D0orhhku.js"></script>
|
|
10
10
|
<link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-Dd_uD5pT.js">
|
|
11
|
-
<link rel="modulepreload" crossorigin href="./assets/runtime-paths-
|
|
12
|
-
<link rel="modulepreload" crossorigin href="./assets/runtime-config-
|
|
13
|
-
<link rel="modulepreload" crossorigin href="./assets/browser-utils-
|
|
11
|
+
<link rel="modulepreload" crossorigin href="./assets/runtime-paths-qQGhzNx4.js">
|
|
12
|
+
<link rel="modulepreload" crossorigin href="./assets/runtime-config-CvrkHb0n.js">
|
|
13
|
+
<link rel="modulepreload" crossorigin href="./assets/browser-utils-S4QYY31r.js">
|
|
14
14
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-BAlEavIC.js">
|
|
15
15
|
<link rel="modulepreload" crossorigin href="./assets/file-kind-BwMIcZbi.js">
|
|
16
|
-
<link rel="modulepreload" crossorigin href="./assets/vault-api-client-
|
|
16
|
+
<link rel="modulepreload" crossorigin href="./assets/vault-api-client-NS_EVHJ3.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="./assets/jsx-runtime-DKj5X9O4.js">
|
|
18
18
|
<link rel="modulepreload" crossorigin href="./assets/chunk-SRAX5OIU-KFQikY-4.js">
|
|
19
|
-
<link rel="modulepreload" crossorigin href="./assets/chunk-
|
|
20
|
-
<link rel="modulepreload" crossorigin href="./assets/chunk-
|
|
19
|
+
<link rel="modulepreload" crossorigin href="./assets/chunk-T5WUORNS-DD7KlyY6.js">
|
|
20
|
+
<link rel="modulepreload" crossorigin href="./assets/chunk-ISPTBLVO-BMsDq9Ha.js">
|
|
21
21
|
<link rel="modulepreload" crossorigin href="./assets/chunk-DYU5D34O-DN0WQZBm.js">
|
|
22
22
|
<link rel="modulepreload" crossorigin href="./assets/chunk-Y2CYZVJY-DsF7k-Jl.js">
|
|
23
23
|
<link rel="modulepreload" crossorigin href="./assets/src-XiVvaevx.js">
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
<link rel="modulepreload" crossorigin href="./assets/chunk-LNGE3PJU-5-SxdO55.js">
|
|
49
49
|
<link rel="modulepreload" crossorigin href="./assets/chunk-TLUHSLCS-DCZhIDYA.js">
|
|
50
50
|
<link rel="modulepreload" crossorigin href="./assets/dist-Ch6Sr9KF.js">
|
|
51
|
-
<link rel="modulepreload" crossorigin href="./assets/prod-
|
|
51
|
+
<link rel="modulepreload" crossorigin href="./assets/prod-CA0ie9yD.js">
|
|
52
52
|
<link rel="modulepreload" crossorigin href="./assets/comment-threads-nJhK1yfc.js">
|
|
53
53
|
<link rel="modulepreload" crossorigin href="./assets/comment-thread-store-CHvy8GF8.js">
|
|
54
54
|
<link rel="modulepreload" crossorigin href="./assets/room-DX7lIfnu.js">
|
|
55
55
|
<link rel="modulepreload" crossorigin href="./assets/excalidraw-scene-6uROebca.js">
|
|
56
|
-
<link rel="modulepreload" crossorigin href="./assets/excalidraw-element-link-
|
|
56
|
+
<link rel="modulepreload" crossorigin href="./assets/excalidraw-element-link-BRZOTIeI.js">
|
|
57
57
|
<link rel="stylesheet" crossorigin href="./assets/excalidrawEditor-BCTFp_CV.css">
|
|
58
58
|
<link rel="stylesheet" crossorigin href="./assets/embedded-editor-base-elU0Avik.css">
|
|
59
59
|
</head>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>CollabMD Export</title>
|
|
7
7
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'><rect x='3' y='4' width='17' height='24' rx='3' stroke='%232563eb' stroke-width='2'/><rect x='12' y='4' width='17' height='24' rx='3' fill='%232563eb'/><path d='M17 12h7m-7 4h7m-7 4h4' stroke='white' stroke-width='1.5'/></svg>">
|
|
8
8
|
<script defer src="./app-config.js"></script>
|
|
9
|
-
<script type="module" crossorigin src="./assets/exportDocument-
|
|
9
|
+
<script type="module" crossorigin src="./assets/exportDocument-DSshnmnZ.js"></script>
|
|
10
10
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-BAlEavIC.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="./assets/github.min-DBihDoic.js">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="./assets/exportDocument-Ba-n1X4U.css">
|
package/dist/client/index.html
CHANGED
|
@@ -7,6 +7,16 @@
|
|
|
7
7
|
<title>CollabMD — Collaborative Markdown Vault</title>
|
|
8
8
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'><rect x='3' y='4' width='17' height='24' rx='3' stroke='%232563eb' stroke-width='2'/><rect x='12' y='4' width='17' height='24' rx='3' fill='%232563eb'/><path d='M17 12h7m-7 4h7m-7 4h4' stroke='white' stroke-width='1.5'/></svg>">
|
|
9
9
|
<script>
|
|
10
|
+
let preferredTheme;
|
|
11
|
+
try {
|
|
12
|
+
preferredTheme = window.localStorage.getItem('collabmd-theme');
|
|
13
|
+
} catch {
|
|
14
|
+
// Storage may be unavailable in restricted browser contexts.
|
|
15
|
+
}
|
|
16
|
+
document.documentElement.dataset.theme = ['light', 'dark'].includes(preferredTheme)
|
|
17
|
+
? preferredTheme
|
|
18
|
+
: window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
19
|
+
document.documentElement.dataset.workspaceLoading = 'true';
|
|
10
20
|
if (
|
|
11
21
|
window.location.hash.includes('file=')
|
|
12
22
|
|| window.location.hash.includes('git-diff=')
|
|
@@ -16,10 +26,11 @@
|
|
|
16
26
|
}
|
|
17
27
|
</script>
|
|
18
28
|
<script defer src="./app-config.js"></script>
|
|
19
|
-
<script type="module" crossorigin src="./assets/index-
|
|
20
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
29
|
+
<script type="module" crossorigin src="./assets/index-BpmR5Qqk.js"></script>
|
|
30
|
+
<link rel="stylesheet" crossorigin href="./assets/index-BCgNcVNs.css">
|
|
21
31
|
</head>
|
|
22
32
|
<body>
|
|
33
|
+
<div class="workspace-loading" id="workspaceLoading" role="status">Opening workspace…</div>
|
|
23
34
|
|
|
24
35
|
<a href="#editorContainer" class="sr-only skip-link" id="skipToEditor">Skip to editor</a>
|
|
25
36
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "collabmd",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.54",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Collaborative markdown vault — like Obsidian, but online. Serve any directory of markdown files for realtime collaborative editing.",
|
|
6
6
|
"repository": {
|
|
@@ -67,14 +67,14 @@
|
|
|
67
67
|
},
|
|
68
68
|
"license": "MIT",
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@excalidraw/fractional-indexing": "^0.18.0-
|
|
70
|
+
"@excalidraw/fractional-indexing": "^0.18.0-c0ad61c",
|
|
71
71
|
"@modelcontextprotocol/client": "^2.0.0",
|
|
72
72
|
"@modelcontextprotocol/node": "^2.0.0",
|
|
73
73
|
"@modelcontextprotocol/server": "^2.0.0",
|
|
74
|
-
"@turbodocx/html-to-docx": "^1.23.
|
|
74
|
+
"@turbodocx/html-to-docx": "^1.23.1",
|
|
75
75
|
"@vscode/markdown-it-katex": "^1.1.2",
|
|
76
76
|
"archiver": "^8.0.0",
|
|
77
|
-
"js-yaml": "^5.4.
|
|
77
|
+
"js-yaml": "^5.4.2",
|
|
78
78
|
"katex": "^0.18.7",
|
|
79
79
|
"lib0": "^0.2.117",
|
|
80
80
|
"mathml2omml": "^0.5.0",
|
|
@@ -98,34 +98,34 @@
|
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
100
|
"@codemirror/autocomplete": "^6.20.3",
|
|
101
|
-
"@codemirror/commands": "^6.11.
|
|
101
|
+
"@codemirror/commands": "^6.11.1",
|
|
102
102
|
"@codemirror/lang-html": "^6.4.12",
|
|
103
103
|
"@codemirror/lang-markdown": "^6.5.2",
|
|
104
104
|
"@codemirror/lang-yaml": "^6.1.3",
|
|
105
105
|
"@codemirror/language": "^6.12.4",
|
|
106
106
|
"@codemirror/language-data": "^6.5.2",
|
|
107
107
|
"@codemirror/search": "^6.7.2",
|
|
108
|
-
"@codemirror/state": "^6.7.
|
|
108
|
+
"@codemirror/state": "^6.7.5",
|
|
109
109
|
"@codemirror/theme-one-dark": "^6.1.3",
|
|
110
|
-
"@codemirror/view": "^6.43.
|
|
111
|
-
"@embedpdf/snippet": "2.15.
|
|
110
|
+
"@codemirror/view": "^6.43.12",
|
|
111
|
+
"@embedpdf/snippet": "2.15.1",
|
|
112
112
|
"@eslint/js": "^10.0.1",
|
|
113
|
-
"@excalidraw/excalidraw": "0.18.0-
|
|
113
|
+
"@excalidraw/excalidraw": "0.18.0-c0ad61c",
|
|
114
114
|
"@playwright/test": "^1.63.0",
|
|
115
115
|
"@replit/codemirror-vim": "^6.4.0",
|
|
116
|
-
"@vitest/browser": "^5.0.
|
|
117
|
-
"@vitest/browser-playwright": "^5.0.
|
|
118
|
-
"eslint": "^10.
|
|
116
|
+
"@vitest/browser": "^5.0.1",
|
|
117
|
+
"@vitest/browser-playwright": "^5.0.1",
|
|
118
|
+
"eslint": "^10.11.0",
|
|
119
119
|
"globals": "^17.12.0",
|
|
120
120
|
"highlight.js": "^11.12.0",
|
|
121
121
|
"markdown-it": "^15.0.2",
|
|
122
122
|
"mermaid": "^12.0.0",
|
|
123
123
|
"mermaid-formatter": "^0.3.0",
|
|
124
|
-
"prettier": "^3.9.
|
|
124
|
+
"prettier": "^3.9.8",
|
|
125
125
|
"react": "^19.3.0",
|
|
126
126
|
"react-dom": "^19.3.0",
|
|
127
127
|
"vite": "^8.3.0",
|
|
128
|
-
"vitest": "^5.0.
|
|
128
|
+
"vitest": "^5.0.1",
|
|
129
129
|
"y-codemirror.next": "^0.3.6",
|
|
130
130
|
"y-websocket": "^3.1.0"
|
|
131
131
|
}
|
|
@@ -7,6 +7,16 @@
|
|
|
7
7
|
<title>CollabMD — Collaborative Markdown Vault</title>
|
|
8
8
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'><rect x='3' y='4' width='17' height='24' rx='3' stroke='%232563eb' stroke-width='2'/><rect x='12' y='4' width='17' height='24' rx='3' fill='%232563eb'/><path d='M17 12h7m-7 4h7m-7 4h4' stroke='white' stroke-width='1.5'/></svg>">
|
|
9
9
|
<script>
|
|
10
|
+
let preferredTheme;
|
|
11
|
+
try {
|
|
12
|
+
preferredTheme = window.localStorage.getItem('collabmd-theme');
|
|
13
|
+
} catch {
|
|
14
|
+
// Storage may be unavailable in restricted browser contexts.
|
|
15
|
+
}
|
|
16
|
+
document.documentElement.dataset.theme = ['light', 'dark'].includes(preferredTheme)
|
|
17
|
+
? preferredTheme
|
|
18
|
+
: window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
19
|
+
document.documentElement.dataset.workspaceLoading = 'true';
|
|
10
20
|
if (
|
|
11
21
|
window.location.hash.includes('file=')
|
|
12
22
|
|| window.location.hash.includes('git-diff=')
|
|
@@ -18,6 +28,7 @@
|
|
|
18
28
|
<script vite-ignore defer src="./app-config.js"></script>
|
|
19
29
|
</head>
|
|
20
30
|
<body>
|
|
31
|
+
<div class="workspace-loading" id="workspaceLoading" role="status">Opening workspace…</div>
|
|
21
32
|
|
|
22
33
|
<a href="#editorContainer" class="sr-only skip-link" id="skipToEditor">Skip to editor</a>
|
|
23
34
|
|
|
@@ -1,17 +1,43 @@
|
|
|
1
1
|
import { CollabMdAppShell } from '../bootstrap/collabmd-app-shell.js';
|
|
2
2
|
import { ensureClientAuthenticated } from '../infrastructure/auth-client.js';
|
|
3
|
+
import { getRuntimeConfig, initializeWorkspaceUrl, setActiveVaultId } from '../infrastructure/runtime-config.js';
|
|
4
|
+
import { renderVaultDashboard } from '../presentation/vault-dashboard.js';
|
|
3
5
|
import '../styles/style.css';
|
|
4
6
|
|
|
5
7
|
async function start() {
|
|
6
8
|
await ensureClientAuthenticated();
|
|
9
|
+
const config = getRuntimeConfig();
|
|
10
|
+
const url = new URL(window.location.href);
|
|
11
|
+
if (config.vaultDashboard && config.vaults.length > 1
|
|
12
|
+
&& !url.searchParams.has('vault') && !url.searchParams.has('file') && !url.hash) {
|
|
13
|
+
renderVaultDashboard({
|
|
14
|
+
container: document.getElementById('workspaceLoading'),
|
|
15
|
+
vaults: config.vaults,
|
|
16
|
+
getVaultUrl: (vaultId) => {
|
|
17
|
+
const target = new URL(url);
|
|
18
|
+
target.searchParams.set('vault', vaultId);
|
|
19
|
+
return target.toString();
|
|
20
|
+
},
|
|
21
|
+
onSelect: setActiveVaultId,
|
|
22
|
+
});
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
initializeWorkspaceUrl();
|
|
7
26
|
const app = new CollabMdAppShell();
|
|
8
27
|
await app.initialize();
|
|
28
|
+
delete document.documentElement.dataset.workspaceLoading;
|
|
29
|
+
document.getElementById('workspaceLoading')?.remove();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function startWorkspace() {
|
|
33
|
+
void start().catch(() => {
|
|
34
|
+
const status = document.getElementById('workspaceLoading');
|
|
35
|
+
if (status) status.textContent = 'Unable to open the workspace. Reload to try again.';
|
|
36
|
+
});
|
|
9
37
|
}
|
|
10
38
|
|
|
11
39
|
if (document.readyState === 'loading') {
|
|
12
|
-
document.addEventListener('DOMContentLoaded',
|
|
13
|
-
void start();
|
|
14
|
-
}, { once: true });
|
|
40
|
+
document.addEventListener('DOMContentLoaded', startWorkspace, { once: true });
|
|
15
41
|
} else {
|
|
16
|
-
|
|
42
|
+
startWorkspace();
|
|
17
43
|
}
|
|
@@ -282,7 +282,9 @@ export class CollabMdAppShell {
|
|
|
282
282
|
return;
|
|
283
283
|
}
|
|
284
284
|
setActiveVaultId(vaultId);
|
|
285
|
-
window.location.
|
|
285
|
+
const url = new URL(window.location.href);
|
|
286
|
+
url.searchParams.set('vault', vaultId);
|
|
287
|
+
window.location.assign(url.toString());
|
|
286
288
|
},
|
|
287
289
|
},
|
|
288
290
|
});
|
|
@@ -119,3 +119,24 @@ export function parseDownloadFileName(contentDisposition = '', fallbackName = 'd
|
|
|
119
119
|
const asciiMatch = String(contentDisposition).match(/filename="([^"]+)"/iu);
|
|
120
120
|
return asciiMatch?.[1] || fallbackName;
|
|
121
121
|
}
|
|
122
|
+
|
|
123
|
+
export async function copyTextToClipboard(text) {
|
|
124
|
+
if (navigator.clipboard?.writeText) {
|
|
125
|
+
await navigator.clipboard.writeText(text);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// HTTP LAN workspaces do not expose the Clipboard API.
|
|
130
|
+
const previousFocus = document.activeElement;
|
|
131
|
+
const input = document.createElement('textarea');
|
|
132
|
+
input.value = text;
|
|
133
|
+
input.className = 'clipboard-fallback';
|
|
134
|
+
document.body.appendChild(input);
|
|
135
|
+
input.select();
|
|
136
|
+
try {
|
|
137
|
+
if (!document.execCommand('copy')) throw new Error('Copy failed');
|
|
138
|
+
} finally {
|
|
139
|
+
input.remove();
|
|
140
|
+
previousFocus?.focus();
|
|
141
|
+
}
|
|
142
|
+
}
|