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.
Files changed (105) hide show
  1. package/bin/collabmd.js +3 -2
  2. package/dist/client/assets/{CodeMirrorEditor-UCMRAMCV-BEz2BKN1.js → CodeMirrorEditor-UCMRAMCV-kJfwukbn.js} +1 -1
  3. package/dist/client/assets/{browser-BKLM0ThC-IxjwuOIz-C0mP17s1.js → browser-BKLM0ThC-BCLQGPD6-K2seJgRL.js} +1 -1
  4. package/dist/client/assets/{browser-utils-vlHL9goC.js → browser-utils-S4QYY31r.js} +1 -1
  5. package/dist/client/assets/{chunk-RUX4WMZV-BGnd3s_C.js → chunk-ISPTBLVO-BMsDq9Ha.js} +2 -2
  6. package/dist/client/assets/{chunk-4SOEAONT-C3fufoVl.js → chunk-T5WUORNS-DD7KlyY6.js} +9 -9
  7. package/dist/client/assets/{direct-engine-DdrQKpgq-4QysbH_V.js → direct-engine-DVLMOJWp-C-YL5NFb.js} +1 -1
  8. package/dist/client/assets/{dist-CXOUa90Q.js → dist-9Eodxf4G.js} +1 -1
  9. package/dist/client/assets/{dist-jVKfryIL.js → dist-B2ZNQifU.js} +1 -1
  10. package/dist/client/assets/dist-B6QCMNze.js +1 -0
  11. package/dist/client/assets/dist-BIAv19LO.js +1 -0
  12. package/dist/client/assets/{dist-Bog8M5U3.js → dist-BKYp1-dl.js} +4 -4
  13. package/dist/client/assets/{dist-DI6c02Da.js → dist-BSAZ-Hek.js} +1 -1
  14. package/dist/client/assets/{dist-DNONgI1P.js → dist-BSTbcioM.js} +1 -1
  15. package/dist/client/assets/{dist-BfpAc922.js → dist-BT9gJXCb.js} +1 -1
  16. package/dist/client/assets/{dist-CAG5sIOj.js → dist-BTVg1m-V.js} +1 -1
  17. package/dist/client/assets/{dist-GTGhtpyW.js → dist-Bi9ZIYXq.js} +1 -1
  18. package/dist/client/assets/{dist-CvVoyTRF.js → dist-BpAUe9sL.js} +1 -1
  19. package/dist/client/assets/{dist-B7fBbwrO.js → dist-Bqo-XRVG.js} +1 -1
  20. package/dist/client/assets/{dist-CUsXdnU4.js → dist-BrKhPlc9.js} +1 -1
  21. package/dist/client/assets/{dist-CYMCikZo.js → dist-CBsvKPcT.js} +1 -1
  22. package/dist/client/assets/{dist-W0FoeIxk.js → dist-CJBYh9Wy.js} +1 -1
  23. package/dist/client/assets/{dist-Ck-B8onw.js → dist-CRwfjtwz.js} +1 -1
  24. package/dist/client/assets/{dist-Dx37MHWs.js → dist-CX7Kc61C.js} +1 -1
  25. package/dist/client/assets/{dist-zHDLm1oE.js → dist-CoXN2D3R.js} +1 -1
  26. package/dist/client/assets/{dist-D4kDR0g8.js → dist-CucpLxUY.js} +1 -1
  27. package/dist/client/assets/{dist-Cu5Ze2cs.js → dist-DHBMeCxC.js} +1 -1
  28. package/dist/client/assets/dist-DLEg9d4u.js +1 -0
  29. package/dist/client/assets/{dist-Y6zYRI-A.js → dist-DOHWxIty.js} +1 -1
  30. package/dist/client/assets/{dist-DVBYH83t.js → dist-DYFBD-wW.js} +1 -1
  31. package/dist/client/assets/{dist-CsQTfQFi.js → dist-DeCV9FU4.js} +1 -1
  32. package/dist/client/assets/dist-DugWGOjQ.js +1 -0
  33. package/dist/client/assets/{dist-BVCNc-Es.js → dist-KrdpB_GB.js} +1 -1
  34. package/dist/client/assets/{dist-B_1hMrc6.js → dist-NNrRnB-f.js} +1 -1
  35. package/dist/client/assets/{dist-Da-jLrCf.js → dist-PUxZqhFe.js} +1 -1
  36. package/dist/client/assets/dist-cYiJMWHJ.js +1 -0
  37. package/dist/client/assets/dist-iKC7go4m.js +1 -0
  38. package/dist/client/assets/{dist-CKf7LlAo.js → dist-lw5TGjI6.js} +1 -1
  39. package/dist/client/assets/{dist-DGa-2MNX.js → dist-uk11ih8u.js} +1 -1
  40. package/dist/client/assets/{document-formatter-gO8qM2qY.js → document-formatter-6I63vstk.js} +1 -1
  41. package/dist/client/assets/{drawioEditor-DCkWweiy.js → drawioEditor-DNTjsjzJ.js} +1 -1
  42. package/dist/client/assets/{editor-session-DxRyr4EM.js → editor-session-D8GGkJak.js} +3 -3
  43. package/dist/client/assets/{embedpdf-DyOonRvx.js → embedpdf-TkbBYowM.js} +1 -1
  44. package/dist/client/assets/{embedpdf-DA4bA119-DsoNiPlQ.js → embedpdf-cl9qiF45-itpgqvGY.js} +2 -2
  45. package/dist/client/assets/{en-GNC3RJIS-CEy_oGTd.js → en-JTHJ2SIP-DBz9bRq4.js} +1 -1
  46. package/dist/client/assets/{estree-DCT3Jm65.js → estree-DGmLqopC.js} +17 -17
  47. package/dist/client/assets/{excalidraw-element-link-CGZ5934B.js → excalidraw-element-link-BRZOTIeI.js} +2 -2
  48. package/dist/client/assets/{excalidrawEditor-BVfSxjSO.js → excalidrawEditor-D0orhhku.js} +3 -3
  49. package/dist/client/assets/{export-page-BCo_e15t.js → export-page-CVJNMERq.js} +3 -3
  50. package/dist/client/assets/{exportDocument-DP6oE_or.js → exportDocument-DSshnmnZ.js} +2 -2
  51. package/dist/client/assets/{file-search-3hYF4cYa.js → file-search-BA8o_gs0.js} +1 -1
  52. package/dist/client/assets/{html-CBXMuS97.js → html-BryNQ_yx.js} +6 -6
  53. package/dist/client/assets/image-I42VHMUI-B2-c_ifV.js +1 -0
  54. package/dist/client/assets/index-BCgNcVNs.css +1 -0
  55. package/dist/client/assets/index-BpmR5Qqk.js +1140 -0
  56. package/dist/client/assets/{lobby-presence-Cz5jGOPg.js → lobby-presence-KJrYhMdN.js} +1 -1
  57. package/dist/client/assets/{markdown-Bo71X2X2.js → markdown-CZ1tYEW8.js} +17 -17
  58. package/dist/client/assets/{pdfium-RAgkpwfK.wasm → pdfium-BJ2Yip8Q.wasm} +0 -0
  59. package/dist/client/assets/{preview-render-compiler-ktU0SXxY.js → preview-render-compiler-BmWQStaL.js} +1 -1
  60. package/dist/client/assets/{preview-render-worker-BI2bFVqM.js → preview-render-worker-BA4VK_GY.js} +2 -2
  61. package/dist/client/assets/prod-CA0ie9yD.js +145 -0
  62. package/dist/client/assets/prod-yKJZ3E4s.js +1 -0
  63. package/dist/client/assets/{quick-switcher-controller-DSlOwOsU.js → quick-switcher-controller-B5vT9Vj5.js} +1 -1
  64. package/dist/client/assets/runtime-config-CvrkHb0n.js +1 -0
  65. package/dist/client/assets/runtime-paths-qQGhzNx4.js +1 -0
  66. package/dist/client/assets/{standalone-6z5x8CWe.js → standalone-DbyFjvTU.js} +1 -1
  67. package/dist/client/assets/{vault-api-client-BQxLVPeF.js → vault-api-client-NS_EVHJ3.js} +2 -2
  68. package/dist/client/assets/{worker-engine-m0rlHn8R-5h66k403.js → worker-engine-BCCrxWYm-CX0qJ_cG.js} +1 -1
  69. package/dist/client/assets/{workspace-sync-client-C2pdaQUN.js → workspace-sync-client-BrMtf6zN.js} +1 -1
  70. package/dist/client/drawio-editor.html +5 -5
  71. package/dist/client/excalidraw-editor.html +9 -9
  72. package/dist/client/export-document.html +1 -1
  73. package/dist/client/index.html +13 -2
  74. package/package.json +14 -14
  75. package/src/client/app/index.html +11 -0
  76. package/src/client/app/main-entry.js +30 -4
  77. package/src/client/bootstrap/collabmd-app-shell.js +3 -1
  78. package/src/client/browser-utils.js +21 -0
  79. package/src/client/domain/file-search.js +1 -1
  80. package/src/client/domain/runtime-paths.js +4 -0
  81. package/src/client/infrastructure/runtime-config.js +14 -0
  82. package/src/client/presentation/drawio-embed-controller.js +3 -1
  83. package/src/client/presentation/excalidraw-embed-controller.js +3 -1
  84. package/src/client/presentation/file-action-controller.js +21 -1
  85. package/src/client/presentation/file-explorer-view.js +24 -6
  86. package/src/client/presentation/vault-dashboard.js +63 -0
  87. package/src/client/styles/foundation/utilities.css +2 -0
  88. package/src/client/styles/layout/overlays.css +5 -0
  89. package/src/client/styles/layout/shell.css +152 -0
  90. package/src/server/config/env.js +39 -6
  91. package/src/server/infrastructure/http/create-static-handler.js +3 -1
  92. package/src/server/infrastructure/http/create-vault-api-query-handler.js +1 -1
  93. package/dist/client/assets/dist-BYBF4LtZ.js +0 -1
  94. package/dist/client/assets/dist-BnVaoRgZ.js +0 -1
  95. package/dist/client/assets/dist-CrkYYcOU.js +0 -1
  96. package/dist/client/assets/dist-D8LnhZzy.js +0 -1
  97. package/dist/client/assets/dist-DX6qtdxv.js +0 -1
  98. package/dist/client/assets/dist-DofvCYzJ.js +0 -1
  99. package/dist/client/assets/image-EJJKRVD3-BQfi5nWJ.js +0 -1
  100. package/dist/client/assets/index-BxAuGDoN.css +0 -1
  101. package/dist/client/assets/index-uw9O0z1c.js +0 -1112
  102. package/dist/client/assets/prod-DU-0VfI7.js +0 -145
  103. package/dist/client/assets/prod-cXUNdmYV.js +0 -1
  104. package/dist/client/assets/runtime-config-BFVdhnJu.js +0 -1
  105. package/dist/client/assets/runtime-paths-Cn0snt_9.js +0 -1
@@ -1 +1 @@
1
- import"./runtime-config-BFVdhnJu.js";import{o as e}from"./runtime-paths-Cn0snt_9.js";import{t}from"./yjs-B41tM6Sz.js";import{n,t as r}from"./yjs-provider-reset-guard-DpntzUDR.js";import{t as i}from"./room-DX7lIfnu.js";var a=`__lobby__`;function o(e){return String(e??``).replace(/\s+/g,` `).trim().slice(0,280)||null}function s(e){return globalThis.crypto?.randomUUID?.()??`${e||`user`}-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function c(e){if(!e||typeof e!=`object`||typeof e.id!=`string`)return null;let t=e.workspaceChange&&typeof e.workspaceChange==`object`?e.workspaceChange:{};return{action:typeof e.action==`string`?e.action:`git`,createdAt:Number.isFinite(e.createdAt)?e.createdAt:Date.now(),id:e.id,peerId:typeof e.peerId==`string`?e.peerId:null,sourceRef:typeof e.sourceRef==`string`?e.sourceRef:null,workspaceChange:{changedPaths:Array.isArray(t.changedPaths)?t.changedPaths.filter(Boolean):[],deletedPaths:Array.isArray(t.deletedPaths)?t.deletedPaths.filter(Boolean):[],refreshExplorer:t.refreshExplorer!==!1,renamedPaths:Array.isArray(t.renamedPaths)?t.renamedPaths.filter(e=>e?.oldPath&&e?.newPath):[]}}}var l=class{constructor({preferredUserName:n,onChange:r,onChatChange:a,onWorkspaceEvent:o}){this.onChange=r,this.onChatChange=a,this.onWorkspaceEvent=o,this.wsBaseUrl=e(),this.ydoc=new t,this.chatMessages=this.ydoc.getArray(`chat-messages`),this.workspaceEvents=this.ydoc.getArray(`workspace-events`),this.provider=null,this.awareness=null,this.localUser=i(n),this.currentFile=null,this._connected=!1,this._didInitialSync=!1,this.seenWorkspaceEventIds=new Set,this.handleAwarenessChange=()=>{this._emitChange()},this.handleChatMessagesChange=()=>{this._emitChatChange()},this.handleWorkspaceEventsChange=()=>{this._emitWorkspaceEvents()}}connect(){this.provider||(this._didInitialSync=!1,this.provider=new n(this.wsBaseUrl,a,this.ydoc,{disableBc:!0,maxBackoffTime:5e3}),r(this.provider),this.awareness=this.provider.awareness,this.awareness.setLocalStateField(`user`,this.localUser),this.awareness.setLocalStateField(`currentFile`,this.currentFile),this.awareness.on(`change`,this.handleAwarenessChange),this.chatMessages.observe(this.handleChatMessagesChange),this.workspaceEvents.observe(this.handleWorkspaceEventsChange),this.provider.on(`status`,({status:e})=>{this._connected=e===`connected`,this._emitChange()}),this.provider.on(`sync`,e=>{e&&!this._didInitialSync&&(this._didInitialSync=!0,this._primeWorkspaceEventCache(),this._emitChange(),this._emitChatChange({initial:!0}))}))}setCurrentFile(e){this.currentFile=e,this.awareness&&this.awareness.setLocalStateField(`currentFile`,e)}setUserName(e){e&&(this.localUser={...this.localUser,name:e},this.awareness&&this.awareness.setLocalStateField(`user`,this.localUser))}getLocalUser(){return this.localUser}sendChatMessage(e){let t=o(e);if(!t)return null;let n={createdAt:Date.now(),filePath:this.currentFile??null,id:s(this.localUser.peerId),peerId:this.localUser.peerId,text:t,userColor:this.localUser.color,userName:this.localUser.name};return this.ydoc.transact(()=>{this.chatMessages.push([n]);let e=this.chatMessages.length-40;e>0&&this.chatMessages.delete(0,e)},`lobby-chat-message`),n}sendWorkspaceEvent({action:e=`git`,sourceRef:t=null,workspaceChange:n={}}={}){let r=c({action:e,createdAt:Date.now(),id:s(this.localUser.peerId),peerId:this.localUser.peerId,sourceRef:t,workspaceChange:n});return r?(this.ydoc.transact(()=>{this.workspaceEvents.push([r]);let e=this.workspaceEvents.length-40;e>0&&this.workspaceEvents.delete(0,e)},`lobby-workspace-event`),this.seenWorkspaceEventIds.add(r.id),r):null}getMessages(){return this.chatMessages.toArray().filter(e=>e&&typeof e.id==`string`&&typeof e.peerId==`string`&&typeof e.text==`string`&&typeof e.userName==`string`)}getUsers(){if(!this.awareness)return[];let e=[];return this.awareness.getStates().forEach((t,n)=>{t.user&&e.push({...t.user,clientId:n,currentFile:t.currentFile??null,isLocal:n===this.awareness.clientID})}),e}getConnectionState(){return this._connected?{status:`connected`,unreachable:!1}:this.provider?{status:`connecting`,unreachable:!1}:{status:`disconnected`,unreachable:!1}}disconnect(){this.provider&&(this.awareness?.off(`change`,this.handleAwarenessChange),this.chatMessages?.unobserve(this.handleChatMessagesChange),this.workspaceEvents?.unobserve(this.handleWorkspaceEventsChange)),this.provider?.disconnect(),this.provider?.destroy(),this.provider=null,this.awareness=null,this._connected=!1,this._didInitialSync=!1,this.seenWorkspaceEventIds.clear()}destroy(){this.disconnect(),this.ydoc?.destroy(),this.ydoc=null}_emitChange(){this.onChange?.(this.getUsers())}_emitChatChange(e={}){this.onChatChange?.(this.getMessages(),e)}_primeWorkspaceEventCache(){this.workspaceEvents.toArray().forEach(e=>{let t=c(e);t&&this.seenWorkspaceEventIds.add(t.id)})}_emitWorkspaceEvents(){if(!this._didInitialSync){this._primeWorkspaceEventCache();return}this.workspaceEvents.toArray().forEach(e=>{let t=c(e);t&&!this.seenWorkspaceEventIds.has(t.id)&&(this.seenWorkspaceEventIds.add(t.id),t.peerId!==this.localUser.peerId&&this.onWorkspaceEvent?.(t))})}};export{l as LobbyPresence};
1
+ import"./runtime-config-CvrkHb0n.js";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{t as i}from"./room-DX7lIfnu.js";var a=`__lobby__`;function o(e){return String(e??``).replace(/\s+/g,` `).trim().slice(0,280)||null}function s(e){return globalThis.crypto?.randomUUID?.()??`${e||`user`}-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function c(e){if(!e||typeof e!=`object`||typeof e.id!=`string`)return null;let t=e.workspaceChange&&typeof e.workspaceChange==`object`?e.workspaceChange:{};return{action:typeof e.action==`string`?e.action:`git`,createdAt:Number.isFinite(e.createdAt)?e.createdAt:Date.now(),id:e.id,peerId:typeof e.peerId==`string`?e.peerId:null,sourceRef:typeof e.sourceRef==`string`?e.sourceRef:null,workspaceChange:{changedPaths:Array.isArray(t.changedPaths)?t.changedPaths.filter(Boolean):[],deletedPaths:Array.isArray(t.deletedPaths)?t.deletedPaths.filter(Boolean):[],refreshExplorer:t.refreshExplorer!==!1,renamedPaths:Array.isArray(t.renamedPaths)?t.renamedPaths.filter(e=>e?.oldPath&&e?.newPath):[]}}}var l=class{constructor({preferredUserName:n,onChange:r,onChatChange:a,onWorkspaceEvent:o}){this.onChange=r,this.onChatChange=a,this.onWorkspaceEvent=o,this.wsBaseUrl=e(),this.ydoc=new t,this.chatMessages=this.ydoc.getArray(`chat-messages`),this.workspaceEvents=this.ydoc.getArray(`workspace-events`),this.provider=null,this.awareness=null,this.localUser=i(n),this.currentFile=null,this._connected=!1,this._didInitialSync=!1,this.seenWorkspaceEventIds=new Set,this.handleAwarenessChange=()=>{this._emitChange()},this.handleChatMessagesChange=()=>{this._emitChatChange()},this.handleWorkspaceEventsChange=()=>{this._emitWorkspaceEvents()}}connect(){this.provider||(this._didInitialSync=!1,this.provider=new n(this.wsBaseUrl,a,this.ydoc,{disableBc:!0,maxBackoffTime:5e3}),r(this.provider),this.awareness=this.provider.awareness,this.awareness.setLocalStateField(`user`,this.localUser),this.awareness.setLocalStateField(`currentFile`,this.currentFile),this.awareness.on(`change`,this.handleAwarenessChange),this.chatMessages.observe(this.handleChatMessagesChange),this.workspaceEvents.observe(this.handleWorkspaceEventsChange),this.provider.on(`status`,({status:e})=>{this._connected=e===`connected`,this._emitChange()}),this.provider.on(`sync`,e=>{e&&!this._didInitialSync&&(this._didInitialSync=!0,this._primeWorkspaceEventCache(),this._emitChange(),this._emitChatChange({initial:!0}))}))}setCurrentFile(e){this.currentFile=e,this.awareness&&this.awareness.setLocalStateField(`currentFile`,e)}setUserName(e){e&&(this.localUser={...this.localUser,name:e},this.awareness&&this.awareness.setLocalStateField(`user`,this.localUser))}getLocalUser(){return this.localUser}sendChatMessage(e){let t=o(e);if(!t)return null;let n={createdAt:Date.now(),filePath:this.currentFile??null,id:s(this.localUser.peerId),peerId:this.localUser.peerId,text:t,userColor:this.localUser.color,userName:this.localUser.name};return this.ydoc.transact(()=>{this.chatMessages.push([n]);let e=this.chatMessages.length-40;e>0&&this.chatMessages.delete(0,e)},`lobby-chat-message`),n}sendWorkspaceEvent({action:e=`git`,sourceRef:t=null,workspaceChange:n={}}={}){let r=c({action:e,createdAt:Date.now(),id:s(this.localUser.peerId),peerId:this.localUser.peerId,sourceRef:t,workspaceChange:n});return r?(this.ydoc.transact(()=>{this.workspaceEvents.push([r]);let e=this.workspaceEvents.length-40;e>0&&this.workspaceEvents.delete(0,e)},`lobby-workspace-event`),this.seenWorkspaceEventIds.add(r.id),r):null}getMessages(){return this.chatMessages.toArray().filter(e=>e&&typeof e.id==`string`&&typeof e.peerId==`string`&&typeof e.text==`string`&&typeof e.userName==`string`)}getUsers(){if(!this.awareness)return[];let e=[];return this.awareness.getStates().forEach((t,n)=>{t.user&&e.push({...t.user,clientId:n,currentFile:t.currentFile??null,isLocal:n===this.awareness.clientID})}),e}getConnectionState(){return this._connected?{status:`connected`,unreachable:!1}:this.provider?{status:`connecting`,unreachable:!1}:{status:`disconnected`,unreachable:!1}}disconnect(){this.provider&&(this.awareness?.off(`change`,this.handleAwarenessChange),this.chatMessages?.unobserve(this.handleChatMessagesChange),this.workspaceEvents?.unobserve(this.handleWorkspaceEventsChange)),this.provider?.disconnect(),this.provider?.destroy(),this.provider=null,this.awareness=null,this._connected=!1,this._didInitialSync=!1,this.seenWorkspaceEventIds.clear()}destroy(){this.disconnect(),this.ydoc?.destroy(),this.ydoc=null}_emitChange(){this.onChange?.(this.getUsers())}_emitChatChange(e={}){this.onChatChange?.(this.getMessages(),e)}_primeWorkspaceEventCache(){this.workspaceEvents.toArray().forEach(e=>{let t=c(e);t&&this.seenWorkspaceEventIds.add(t.id)})}_emitWorkspaceEvents(){if(!this._didInitialSync){this._primeWorkspaceEventCache();return}this.workspaceEvents.toArray().forEach(e=>{let t=c(e);t&&!this.seenWorkspaceEventIds.has(t.id)&&(this.seenWorkspaceEventIds.add(t.id),t.peerId!==this.localUser.peerId&&this.onWorkspaceEvent?.(t))})}};export{l as LobbyPresence};