@alwith/module-drive 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/badge-react.d.ts +2 -2
- package/dist/badge-react.js +1 -1
- package/dist/badge.d.ts +1 -1
- package/dist/badge.js +1 -1
- package/dist/browse.d.ts +1 -1
- package/dist/browse.js +1 -1
- package/dist/chunk-0mx45c8q.js +2 -0
- package/dist/chunk-13ret1k0.js +188 -0
- package/dist/chunk-2343nj4p.js +2 -0
- package/dist/chunk-2n0p7j2f.js +2 -0
- package/dist/chunk-2ss7362z.js +2 -0
- package/dist/chunk-34qgf6be.js +2 -0
- package/dist/chunk-3fpcak8h.js +2 -0
- package/dist/chunk-4rfsdwgj.js +2 -0
- package/dist/chunk-52ccz07b.js +2 -0
- package/dist/chunk-563we221.js +2 -0
- package/dist/chunk-8765ztht.js +2 -0
- package/dist/chunk-8gmexfjt.js +3 -0
- package/dist/chunk-8sdw30dr.js +2 -0
- package/dist/chunk-ayvem7j8.js +2 -0
- package/dist/chunk-bh4wjd78.js +2 -0
- package/dist/chunk-dep1erts.js +2 -0
- package/dist/chunk-fkz75xv1.js +2 -0
- package/dist/chunk-g3pmrhm2.js +2 -0
- package/dist/chunk-j234gbr1.js +4 -0
- package/dist/chunk-j2mc48dt.js +2 -0
- package/dist/chunk-jxs49r5w.js +2 -0
- package/dist/chunk-kzjc8c8g.js +3 -0
- package/dist/chunk-m3kvhnag.js +3 -0
- package/dist/chunk-m6a9k1p0.js +2 -0
- package/dist/chunk-mafn36hy.js +2 -0
- package/dist/chunk-mz5601y4.js +2 -0
- package/dist/chunk-n7wnyds6.js +2 -0
- package/dist/chunk-n9sgwcq1.js +2 -0
- package/dist/chunk-nf37g7p6.js +2 -0
- package/dist/chunk-njfqtysa.js +2 -0
- package/dist/chunk-nk64fv7b.js +2 -0
- package/dist/chunk-p7y39rr7.js +2 -0
- package/dist/chunk-pbxjprxa.js +2 -0
- package/dist/chunk-pc21jzd8.js +3 -0
- package/dist/chunk-qabnvepm.js +2 -0
- package/dist/chunk-qf5g053e.js +2 -0
- package/dist/chunk-rg43mads.js +2 -0
- package/dist/chunk-t4vq7jva.js +2 -0
- package/dist/chunk-vpew2mps.js +2 -0
- package/dist/chunk-vtjd21bw.js +8 -0
- package/dist/chunk-ws1dtw35.js +2 -0
- package/dist/chunk-zf44znpx.js +2 -0
- package/dist/content/chat-condense.d.ts +4 -4
- package/dist/content/chat-condense.js +1 -1
- package/dist/content/collab.d.ts +1 -1
- package/dist/content/collab.js +1 -1
- package/dist/content/comment-anchors.js +1 -2
- package/dist/content/comment-decorations.d.ts +1 -1
- package/dist/content/comment-decorations.js +1 -3
- package/dist/content/comment-drawer.d.ts +2 -2
- package/dist/content/comment-drawer.js +1 -1
- package/dist/content/comment-mentions.d.ts +1 -1
- package/dist/content/comment-mentions.js +1 -1
- package/dist/content/comment-surface.d.ts +3 -3
- package/dist/content/comment-surface.js +1 -1
- package/dist/content/condense-task.d.ts +2 -2
- package/dist/content/condense-task.js +1 -1
- package/dist/content/condense.d.ts +3 -3
- package/dist/content/condense.js +1 -1
- package/dist/content/editor.d.ts +1 -1
- package/dist/content/editor.js +1 -1
- package/dist/content/file-actions.d.ts +4 -4
- package/dist/content/file-actions.js +1 -1
- package/dist/content/file-link.d.ts +1 -1
- package/dist/content/file-link.js +1 -1
- package/dist/content/frontmatter-panel.js +1 -1
- package/dist/content/frontmatter.js +1 -7
- package/dist/content/host.d.ts +2 -2
- package/dist/content/host.js +1 -1
- package/dist/content/html-bridge.js +1 -187
- package/dist/content/html-comments.js +1 -1
- package/dist/content/markdown-comments.d.ts +1 -1
- package/dist/content/markdown-comments.js +1 -2
- package/dist/content/mention-picker.d.ts +2 -2
- package/dist/content/mention-picker.js +1 -1
- package/dist/content/save-version.d.ts +1 -1
- package/dist/content/save-version.js +1 -1
- package/dist/content/translations.d.ts +1 -1
- package/dist/content/translations.js +1 -1
- package/dist/content/use-file-comments.d.ts +1 -1
- package/dist/content/use-file-comments.js +1 -1
- package/dist/content/yuplink.d.ts +1 -1
- package/dist/content/yuplink.js +1 -2
- package/dist/content.d.ts +10 -10
- package/dist/content.js +1 -1
- package/dist/core.d.ts +4 -4
- package/dist/core.js +1 -1
- package/dist/files.d.ts +1 -1
- package/dist/files.js +1 -1
- package/dist/global-search.js +1 -1
- package/dist/icons.js +1 -1
- package/dist/launcher.d.ts +3 -3
- package/dist/launcher.js +1 -2
- package/dist/locales.d.ts +2 -2
- package/dist/locales.js +1 -1
- package/dist/mass-delete.d.ts +3 -3
- package/dist/mass-delete.js +1 -1
- package/dist/notifications.js +1 -1
- package/dist/pinned-docs.js +1 -1
- package/dist/pinned.d.ts +3 -3
- package/dist/pinned.js +1 -1
- package/dist/react.d.ts +14 -14
- package/dist/react.js +1 -1
- package/dist/roots.d.ts +1 -1
- package/dist/roots.js +1 -1
- package/dist/settings.d.ts +3 -3
- package/dist/settings.js +1 -1
- package/dist/sharing.d.ts +3 -3
- package/dist/sharing.js +1 -1
- package/dist/status.d.ts +4 -4
- package/dist/status.js +1 -1
- package/dist/summary.d.ts +1 -1
- package/dist/summary.js +1 -1
- package/dist/tauri.d.ts +1 -1
- package/dist/transfer-feed.d.ts +1 -1
- package/dist/transfer-feed.js +1 -1
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +1 -1
- package/package.json +11 -11
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{m,A,Pe,Ee}from"./chunk-2343nj4p.js";import{be,we}from"./chunk-dep1erts.js";import{l}from"./chunk-n7wnyds6.js";import{e}from"./chunk-3fpcak8h.js";import{u}from"./chunk-ayvem7j8.js";import{N}from"./chunk-p7y39rr7.js";import{t,n,r,c,D,d}from"./chunk-ws1dtw35.js";import{ke}from"./chunk-2n0p7j2f.js";import{useEffect as Q,useMemo as X,useRef as U,useState as E}from"react";import{jsxDEV as a,Fragment as z}from"react/jsx-dev-runtime";function ve(o){let{controller:f,controls:j,host:v,locale:M="en",onOpenSettings:L}=o,{Button:R}=j,{snapshot:b}=t(f),{busy:P,error:S,run:I}=n(),[T,F]=E(!1),[q,p]=E(null),[V,x]=E(null),[K,W]=E([]),[B,k]=E(null),y=e(M);Q(()=>{if(W([]),p(null),k(null),!b?.running)return;let i=!0;return Promise.all([f.request({type:"ownershipGuard"}),f.request({type:"shared"})]).then(([w,C])=>{if(w.type!=="ownershipGuard"||C.type!=="shared")throw Error("Invalid Drive launcher response");if(i)p(w.data),W(C.data),k(null)}).catch((w)=>{if(i)k(String(w))}),()=>{i=!1}},[f,b?.generation,b?.running]);let g=b?.webBaseUrl?.replace(/\/+$/,""),H=async(i)=>{let w=r(v),C=b?.roots.find((O)=>String(O.projectId)===String(i.projectId)),h=async()=>{if(!g)throw Error(y("shared.notInDrive",{name:i.name}));await w.onOpenExternal(i.resourceType==="FILE"?`${g}/file/${encodeURIComponent(String(i.resourceId))}`:`${g}/shared`)};if(!C){await h();return}if(await f.request({type:"land",projectId:C.projectId}),i.localPath&&await w.pathExists(i.localPath)){await w.onOpenEntry({path:i.localPath,isDirectory:i.resourceType==="FOLDER"});return}if(i.resourceType==="FILE"){let O=await f.request({type:"localPath",fileId:i.resourceId});if(O.type!=="path")throw Error("Invalid Drive file path response");if(O.data&&await w.pathExists(O.data)){await w.onOpenEntry({path:O.data,isDirectory:!1});return}await h();return}let s=i.folderPath?`${C.localPath}/${i.folderPath}`:null;if(s&&await w.pathExists(s)){await w.onOpenEntry({path:s,isDirectory:!0});return}throw await w.onOpenEntry({path:C.localPath,isDirectory:!0}),Error(y("shared.folderMissing",{name:i.name}))};return a(z,{children:[a("header",{className:"alwith-drive-toolbar",children:[a("strong",{children:y("title")},void 0,!1,void 0,this),a("div",{className:"alwith-drive-actions",children:[a(d,{controls:j,label:y("panel.new"),items:[{label:y("newProject.title"),onSelect:()=>F(!0)},...g?[{label:y("panel.importFromFeishu"),onSelect:()=>I(()=>r(v).onOpenExternal(`${g}/admin/mirrors`))}]:[]],children:a(l,{name:"plus"},void 0,!1,void 0,this)},void 0,!1,void 0,this),a(d,{controls:j,label:y("panel.more"),items:[{label:y("panel.refresh"),disabled:P,onSelect:()=>I(()=>f.request({type:"sync"}))},...g?[{label:y("panel.openWeb"),onSelect:()=>I(()=>r(v).onOpenExternal(g))},{label:y("panel.importFromFeishu"),onSelect:()=>I(()=>r(v).onOpenExternal(`${g}/admin/mirrors`))}]:[],...L?[{label:y("openSettings"),onSelect:L}]:[]]},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),a(ee,{...o},void 0,!1,void 0,this),a(u,{message:S||B},void 0,!1,void 0,this),q?.active&&a("aside",{className:"alwith-drive-notice",children:[a("p",{children:y("panel.guard.notice",{count:q.unknownPersonalRoots})},void 0,!1,void 0,this),a(R,{variant:"ghost",disabled:P,onClick:()=>I(async()=>{if(await o.confirm(y("panel.guard.confirmDesc",{count:q.unknownPersonalRoots})))await f.request({type:"syncAllPersonal",enabled:!0}),p({...q,active:!1,syncAllPersonal:!0})}),children:y("panel.guard.syncAll")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("div",{className:"alwith-drive-navigation",children:[v&&a(ke,{controller:f,onOpenProject:o.onOpenProject,host:v,controls:j,locale:M,generation:b?.generation},void 0,!1,void 0,this),K.length>0&&a("details",{open:!0,className:"alwith-drive-group",children:[a("summary",{children:[y("shared.title")," ",a("span",{children:K.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this),K.map((i)=>{let w=`${i.resourceType}:${i.resourceId}`,C=()=>I(async()=>{x(w);try{await H(i)}finally{x(null)}});return a(d,{controls:j,context:!0,label:i.name,items:[{label:y("shared.open"),onSelect:C,disabled:P},...g?[{label:y("shared.openWeb"),onSelect:()=>I(()=>r(v).onOpenExternal(`${g}/shared`))}]:[]],children:a(R,{variant:"ghost",className:"alwith-drive-nav-open",disabled:P,title:y("shared.rowTitle",{name:i.name,project:i.projectName??"",by:i.grantedByName??""}),onClick:C,children:[a(l,{name:V===w?"loading":i.resourceType==="FOLDER"?"folder":"file"},void 0,!1,void 0,this),a("span",{children:i.name},void 0,!1,void 0,this),a("small",{children:y(`grants.level.${i.level}`)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},w,!1,void 0,this)})]},void 0,!0,void 0,this),Pe(b?.roots??[]).map((i)=>a(Z,{...o,group:i},i.nodePath??i.legacy,!1,void 0,this)),!(b?.roots??[]).some(m)&&a("p",{children:y("panel.empty")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T&&a(te,{...o,onClose:()=>F(!1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Z({group:o,...f}){let[j,v]=E(o.items.length<=30),[M,L]=E(j),[R,b]=E(""),P=e(f.locale),S=o.legacy==="shared",I=S?o.items.filter((p)=>p.scope==="PERSONAL"):[],T=S?o.items.filter((p)=>p.scope!=="PERSONAL"):o.items,F=T.filter((p)=>p.name.toLowerCase().includes(R.trim().toLowerCase())),{Input:q}=f.controls;return a("details",{className:"alwith-drive-group",open:j,onToggle:(p)=>{if(v(p.currentTarget.open),p.currentTarget.open)L(!0)},children:[a("summary",{children:[o.label??P(`panel.groups.${o.legacy??"shared"}`),a("span",{children:o.items.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this),M&&a(z,{children:[T.length>30&&a(q,{placeholder:P("panel.filter"),"aria-label":P("panel.filter"),value:R,onChange:(p)=>b(p.target.value)},void 0,!1,void 0,this),F.map((p)=>a(J,{...f,root:p},String(p.projectId),!1,void 0,this)),!F.length&&!I.length&&a("p",{children:P("panel.filterEmpty")},void 0,!1,void 0,this),I.length>0&&a(_,{...f,roots:I},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function _({roots:o,...f}){let[j,v]=E(""),[M,L]=E(!1),{Input:R}=f.controls,b=e(f.locale);return a("details",{className:"alwith-drive-group",onToggle:(P)=>{if(P.currentTarget.open)L(!0)},children:[a("summary",{children:[b("panel.groups.otherPersonal"),a("span",{children:o.length},void 0,!1,void 0,this)]},void 0,!0,void 0,this),M&&a(z,{children:[a(R,{"aria-label":b("panel.filter"),placeholder:b("panel.filter"),value:j,onChange:(P)=>v(P.target.value)},void 0,!1,void 0,this),o.filter((P)=>P.name.toLowerCase().includes(j.toLowerCase())).map((P)=>a(J,{...f,root:P},String(P.projectId),!1,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function J({root:o,controller:f,controls:j,host:v,onOpenProject:M,currentProject:L,locale:R}){let{Button:b}=j,{snapshot:P}=t(f),{busy:S,error:I,run:T}=n(),[F,q]=E(!1),p=e(R),V=P?.projects.find((k)=>String(k.projectId)===String(o.projectId)),x=F?Ee(V,S):null,K=()=>T(async()=>{if(q(!0),v&&await v.pathExists(o.localPath)&&(await v.readDirectory(o.localPath)).length>0){await M(o),q(!1);return}let k=await f.request({type:"land",projectId:o.projectId});if(k.type!=="root")throw Error("Drive did not return a landed project");await M(k.data),q(!1)}),W=P?.webBaseUrl?.replace(/\/+$/,""),B=[{label:p("panel.open"),onSelect:K},{label:p("condense.action"),disabled:S,onSelect:()=>T(()=>{let k=r(v);if(!k.onCondense)throw Error("Knowledge integration is unavailable");return k.onCondense(o)})},{label:p("pinned.pin"),onSelect:()=>T(()=>r(v).onPinnedDocsChange(N(r(v).pinnedDocs,{path:o.localPath,name:o.name,kind:"dir"})))},...o.cursor!==null?[{label:p("panel.reveal"),onSelect:()=>T(()=>r(v).onRevealPath(o.localPath))}]:[],...W?[{label:p("panel.openWeb"),onSelect:()=>T(()=>r(v).onOpenExternal(`${W}/project/${encodeURIComponent(o.projectKey)}`))}]:[]];return a(z,{children:[a(d,{controls:j,context:!0,label:o.name,items:B,children:a("div",{className:"alwith-drive-nav-row","data-active":L===o.localPath,children:[a(b,{variant:"ghost",className:"alwith-drive-nav-open",title:o.drivePath,"aria-label":o.name,disabled:S,onClick:K,children:[a(l,{name:S?"loading":o.kind==="KNOWLEDGE"?"book":"folder"},void 0,!1,void 0,this),a("span",{children:o.name},void 0,!1,void 0,this),a("small",{children:x?p(`panel.status.${x.kind==="syncing"&&x.total>0?"syncingProgress":x.kind}`,x.kind==="syncing"?{done:x.done,total:x.total}:x.kind==="partial"?{count:x.failed}:{}):p(`panel.containers.${A(o)}`)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),o.cursor!==null&&v?.renderProjectActions?.(o),a(b,{variant:"ghost",size:"icon-xs",className:"alwith-drive-condense-trigger",title:p("condense.action"),"aria-label":p("condense.action"),disabled:S,onClick:B[1].onSelect,children:a(l,{name:"sparkles"},void 0,!1,void 0,this)},void 0,!1,void 0,this),a(d,{controls:j,label:`${o.name} ${p("panel.more")}`,items:B},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),a(u,{message:I},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ee({controller:o,controls:{Input:f,Button:j},host:v,locale:M}){let{snapshot:L}=t(o),[R,b]=E(""),[P,S]=E([]),[I,T]=E(!1),{error:F,run:q}=n(),[p,V]=E(!1),[x,K]=E(null),W=U(0),B=U(!1),k=U(null),y=U(null),g=e(M),H=(L?.roots??[]).filter((h)=>h.selected).map((h)=>h.localPath).toSorted().join("\x00"),i=()=>{if(B.current||y.current?.signature===H&&Date.now()-y.current.at<60000)return;let h=++W.current,s=L?.generation,O=()=>h===W.current&&s===o.getSnapshot().snapshot?.generation;B.current=!0,V(!0),K(null),be((L?.roots??[]).filter(m),async(G)=>{if(!O())return[];return r(v).readDirectory(G)}).then((G)=>{if(!O())return;S(G.entries),T(G.truncated),K(G.errors.length?G.errors.map((Y)=>`${Y.path}: ${Y.message}`).join(`
|
|
2
|
+
`):null),y.current={signature:H,at:Date.now()}}).catch((G)=>{if(O())K(G instanceof Error?G.message:String(G))}).finally(()=>{if(O())B.current=!1,V(!1)})};Q(()=>{let h=(s)=>{if(s.key.toLowerCase()==="k"&&(s.metaKey||s.ctrlKey)&&!s.altKey&&!s.shiftKey)s.preventDefault(),k.current?.querySelector("input")?.focus()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[]),Q(()=>{let h=W;return W.current++,B.current=!1,V(!1),K(null),S([]),b(""),T(!1),y.current=null,()=>{h.current++}},[o,H,L?.generation]);let w=X(()=>we(P,R),[P,R]),C=(h)=>q(async()=>{await r(v).onOpenEntry({path:h.path,isDirectory:h.isDirectory}),b("")});return a("div",{ref:k,className:"alwith-drive-search",children:[a(f,{placeholder:`${g("search.placeholder")} ⌘K`,"aria-label":g("search.placeholder"),value:R,onFocus:i,onChange:(h)=>b(h.target.value),onKeyDown:(h)=>{if(h.key==="Escape")b("");if(h.key==="Enter"&&w[0])C(w[0])}},void 0,!1,void 0,this),a(u,{message:F||x},void 0,!1,void 0,this),R.trim()&&a("div",{className:"alwith-drive-search-results",children:[!w.length&&a("p",{children:g(p?"search.indexing":"search.empty")},void 0,!1,void 0,this),w.map((h)=>a(j,{variant:"ghost",className:"alwith-drive-search-result",onClick:()=>C(h),children:a("span",{children:[a(l,{name:h.isDirectory?"folder":"file"},void 0,!1,void 0,this)," ",h.name,a("small",{children:[h.projectName," · ",h.relPath]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},h.path,!1,void 0,this)),I&&a("p",{children:g("search.truncated")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function te({controller:o,controls:f,onOpenProject:j,onClose:v,locale:M}){let[L,R]=E([]),[b,P]=E([]),[S,I]=E("PERSONAL"),[T,F]=E(""),[q,p]=E(""),[V,x]=E(""),[K,W]=E(null),{busy:B,error:k,run:y}=n(),g=e(M),{Button:H,Input:i}=f;Q(()=>{let s=!0;return Promise.all([o.request({type:"templates"}),o.request({type:"departments"})]).then(([O,G])=>{if(O.type!=="templates"||G.type!=="departments")throw Error("Invalid project choices");if(s)R(O.data),P(G.data),F(String(O.data[0]?.id??"")),p(String(G.data[0]?.id??""))}).catch((O)=>{if(s)W(String(O))}),()=>{s=!1}},[o]);let w=L.find((s)=>String(s.id)===T),C=b.find((s)=>String(s.id)===q),h=S==="DEPT"||S==="TEAM";return a(D,{controls:f,open:!0,onOpenChange:(s)=>{if(!s&&!B)v()},title:g("newProject.title"),description:g("newProject.desc"),children:a("div",{className:"alwith-drive-form",children:[(k||K)&&a("p",{role:"alert",className:"alwith-drive-error",children:k||K},void 0,!1,void 0,this),a("label",{children:[g("newProject.name"),a(i,{autoFocus:!0,placeholder:g("newProject.namePlaceholder"),value:V,onChange:(s)=>x(s.target.value)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("label",{children:[g("newProject.scope"),a(c,{controls:f,value:S,onValueChange:(s)=>I(s),options:["PERSONAL","DEPT","TEAM","COMPANY"].map((s)=>({value:s,label:g(`newProject.scopes.${s}`)}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),h&&a("label",{children:[g("newProject.department"),a(c,{controls:f,value:q,onValueChange:p,options:b.map((s)=>({value:String(s.id),label:s.name}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("label",{children:[g("newProject.template"),a(c,{controls:f,value:T,onValueChange:F,options:L.map((s)=>({value:String(s.id),label:`${g(`panel.containers.${s.kind==="KNOWLEDGE"?"knowledge":"material"}`)} · ${s.name}${s.description?` · ${s.description}`:""}`}))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w&&a("p",{children:g("newProject.preview",{node:h?C?.name??g(`newProject.scopes.${S}`):g(`newProject.scopes.${S}`),container:g(`panel.containers.${w.kind==="KNOWLEDGE"?"knowledge":"material"}`)})},void 0,!1,void 0,this),a("div",{className:"alwith-drive-actions",children:[a(H,{variant:"outline",disabled:B,onClick:v,children:g("newProject.cancel")},void 0,!1,void 0,this),a(H,{disabled:B||!V.trim()||!w||h&&!C,onClick:()=>y(async()=>{if(!w)throw Error("Select a template");let s=await o.request({type:"createProject",request:{templateId:w.id,name:V.trim(),scope:S,departmentId:h?C?.id:null,topicId:null}});if(s.type!=="root")throw Error("Created project is unavailable");await j(s.data),v()}),children:g(B?"newProject.creating":"newProject.create")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}
|
|
3
|
+
export{ve};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{editorViewCtx as m,parserCtx as u}from"@milkdown/core";import{updateYFragment as y,ySyncPluginKey as g}from"y-prosemirror";import{WebsocketProvider as C}from"y-websocket";import*as p from"yjs";var nt={author:"AI"},ce="author",rt="AI";function b(t){let e=/^---\r?\n[\s\S]*?\r?\n---[ \t]*(?:\r?\n|$)/.exec(t);if(!e)return{frontmatter:"",body:t};return{frontmatter:e[0],body:t.slice(e[0].length)}}var ot="prosemirror",f=["#f97316","#10b981","#3b82f6","#a855f7","#ec4899","#14b8a6","#eab308","#ef4444"];function de(t){let e=0;for(let o of t)e=e*31+o.charCodeAt(0)>>>0;return f[e%f.length]}function ue(t){let e=[];for(let[o,r]of t.getStates()){if(o===t.clientID)continue;let n=r.user;if(!n)continue;e.push({clientId:o,user:n})}return e.toSorted((o,r)=>o.clientId-r.clientId)}function pe(t,e){let o=new p.Doc,r=new C(t.serverUrl,t.room,o,{params:{token:t.token},maxBackoffTime:5000}),n=r.awareness;n.setLocalStateField("user",e),n.setLocalStateField(ce,e.name);let d=()=>{},i=new Promise((c)=>{let s=!1,a=(l)=>{if(s)return;s=!0,c(l)};d=a,r.on("sync",(l)=>{if(l)a(!0)}),r.on("connection-error",()=>a(!1)),r.on("connection-close",()=>a(!1))});return{doc:o,provider:r,awareness:n,ready:i,destroy:()=>{d(!1),n.setLocalState(null),r.destroy(),o.destroy()}}}function me(t,e,o,r){let n=t.get(m),i=g.getState(n.state)?.binding;if(!i)return!1;let c=t.get(u)(o);if(!c)throw Error("Failed to parse disk Markdown");let{doc:s,awareness:a}=e,l=s.getXmlFragment(ot);a.setLocalStateField(ce,rt);try{s.transact(()=>{y(s,l,c,i)},nt)}finally{a.setLocalStateField(ce,r)}return!0}
|
|
2
|
+
export{nt,ce,rt,b,ot,de,ue,pe,me};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createContext as p,useContext as c}from"react";import{jsxDEV as e}from"react/jsx-dev-runtime";var r=p(null);function Be({host:t,children:n}){return e(r.Provider,{value:t,children:n},void 0,!1,void 0,this)}function o(){let t=c(r);if(!t)throw Error("Drive content requires a host provider");return t}function i(t){let n=o();return{t:n.translate,i18n:{language:n.language}}}function s(...t){return t.filter(Boolean).join(" ")}function a(t){let n=o().controls.Button;return e(n,{...t},void 0,!1,void 0,this)}function L(t){let n=o().controls.Input;return e(n,{...t},void 0,!1,void 0,this)}function P(t){let n=o().controls.Textarea;return e(n,{...t},void 0,!1,void 0,this)}function re(t){let n=o().controls.Checkbox;return e(n,{...t},void 0,!1,void 0,this)}
|
|
2
|
+
export{Be,o,i,s,a,L,P,re};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function Ke(e){return`drive.engine.${e.kind}`}function ye(e){let o=e.some((r)=>r.direction==="upload"),n=e.some((r)=>r.direction==="download");if(o&&!n)return"notUploaded";if(n&&!o)return"notDownloaded";return"transferFailed"}function Ye(e,o=[]){let n=e?.state??{kind:"idle"};if(n.kind==="error")return{key:"drive.summary.error",count:0,tone:"trouble"};let r=e?.conflicts.length??0;if(r>0)return{key:"drive.summary.conflicts",count:r,tone:"trouble"};let t=e?.failed??0;if(t>0)return{key:`drive.summary.${ye(o)}`,count:t,tone:"trouble"};let i=e?.errors.length??0;if(i>0)return{key:"drive.summary.failed",count:i,tone:"trouble"};let d=(e?.downloading??0)+(e?.uploading??0)+(e?.pending??0);if(d>0)return{key:"drive.summary.syncing",count:d,tone:"busy"};if(n.kind==="paused")return{key:"drive.summary.paused",count:0,tone:"calm"};if(n.kind==="scanning")return{key:"drive.summary.scanning",count:0,tone:"busy"};return{key:"drive.summary.upToDate",count:0,tone:"calm"}}
|
|
2
|
+
export{Ke,ye,Ye};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsxDEV as e,Fragment as a}from"react/jsx-dev-runtime";var t={folder:e("path",{d:"M20 20H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5l2 2h9a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2Z"},void 0,!1,void 0,this),book:e(a,{children:e("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),file:e(a,{children:[e("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"},void 0,!1,void 0,this),e("path",{d:"M14 2v6h6M8 13h8M8 17h6"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),plus:e("path",{d:"M12 5v14M5 12h14"},void 0,!1,void 0,this),sparkles:e(a,{children:[e("path",{d:"m12 3 2.5 6.5L21 12l-6.5 2.5L12 21l-2.5-6.5L3 12l6.5-2.5L12 3Z"},void 0,!1,void 0,this),e("path",{d:"M5 3v4M3 5h4M19 17v4M17 19h4"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),loading:e("path",{d:"M12 2a10 10 0 1 1-10 10"},void 0,!1,void 0,this),up:e("path",{d:"m6 9 6-6 6 6M12 3v18"},void 0,!1,void 0,this),down:e("path",{d:"m6 15 6 6 6-6M12 3v18"},void 0,!1,void 0,this),check:e("path",{d:"m20 6-11 11-5-5"},void 0,!1,void 0,this)};function l({name:o}){return e("svg",{className:`alwith-drive-icon${o==="loading"?"alwith-drive-spin":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t[o]},void 0,!1,void 0,this)}
|
|
2
|
+
export{l};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b,de,ue,pe,me}from"./chunk-m6a9k1p0.js";import{oe,ie}from"./chunk-j234gbr1.js";import{ee}from"./chunk-nf37g7p6.js";import{Y}from"./chunk-13ret1k0.js";import{G}from"./chunk-j2mc48dt.js";import{H}from"./chunk-kzjc8c8g.js";import{Z}from"./chunk-34qgf6be.js";import{EditorStatus as A,editorViewCtx as T}from"@milkdown/core";import{collab as L,collabServiceCtx as R}from"@milkdown/plugin-collab";import{$prose as _,getMarkdown as U}from"@milkdown/utils";import{useSyncExternalStore as K}from"react";import{jsxDEV as u,Fragment as q}from"react/jsx-dev-runtime";function B(r,a,d){let v=crypto.randomUUID(),D=oe(),S=new Set,o={mode:a.dirty?"local":"probing",peers:[],frontmatter:"",canWrite:!d.readOnly,savingVersion:!1},y=a,i=!1,w=!1,c=null,f=null,C=null,I=null,O=null,h=r.generation,M=!1,N=()=>o.mode==="blocked",n=(e)=>{o={...o,...e};for(let t of S)t()},F=Z(r,a.path,()=>!i&&!d.readOnly&&o.mode==="live"&&o.canWrite,(e)=>{if(!i)n({savingVersion:e})}),p=async()=>{if(!w)return;w=!1,r.collaborationOwner(a.path,v,!1),await r.transport.request({type:"collabEnd",path:a.path,ownerId:v})},g=()=>{if(C)clearInterval(C),C=null;if(f){if(c!==null&&c.status===A.Created)c.action((e)=>e.get(R).disconnect());f.destroy(),f=null}},m=()=>{if(c!==null&&c.status===A.Created)c.action((e)=>e.get(T).setProps({editable:()=>!d.readOnly&&o.canWrite&&o.mode!=="probing"}))},P=(e)=>{g(),n({mode:"blocked",canWrite:!1,peers:[]}),m(),p().catch(r.onError),r.onError(e)},V=async()=>{let e=await r.transport.request({type:"collabSession",path:a.path,ownerId:v});if(e.type!=="collabSession")throw Error("Invalid collaboration heartbeat response");if(i||o.mode==="blocked"){w=e.data!==null,await p();return}if(!e.data)throw Error("Collaboration access is no longer available");if(JSON.stringify([e.data.serverUrl,e.data.room,e.data.token])!==O)throw Error("Drive collaboration credentials changed; reopen this document to reconnect");n({canWrite:e.data.canWrite}),m()};function z(){let e=K((t)=>(S.add(t),()=>S.delete(t)),()=>o,()=>o);return u(q,{children:[u(H,{bridge:D},void 0,!1,void 0,this),e.mode==="live"&&u(q,{children:[u("div",{className:"text-muted-foreground flex gap-2 text-xs",role:"status",children:[r.translate("editor.markdown.collab.live"),!e.canWrite&&r.translate("editor.markdown.collab.readOnly"),e.peers.map((t)=>u("span",{children:t.user.name},t.clientId,!1,void 0,this))]},void 0,!0,void 0,this),u(ee,{frontmatter:e.frontmatter,readOnly:!e.canWrite||d.readOnly,saving:e.savingVersion,onChange:(t)=>{if(!c||!e.canWrite||d.readOnly)return;n({frontmatter:t}),d.onChange(t+c.action(U())),d.onSave()},onSaveVersion:()=>{F()}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}return{configure(e){e.use(L).use(_(()=>ie(D)))},async ready(e){if(c=e,i)return;if(y.dirty){n({mode:"local"}),m();return}try{let t=await r.transport.subscribe((s)=>{if(i||o.mode==="blocked"||o.mode==="local")return;if(s.payload.type==="snapshot"&&(!s.payload.data.configured||!s.payload.data.running)){P(Error("Drive collaboration stopped; the current document is preserved read only"));return}if(o.mode==="live"&&h!==void 0&&s.generation!==h)h=s.generation,V().catch(P);else h=s.generation});if(i){t();return}I=t;let l=await r.transport.request({type:"collabSession",path:a.path,ownerId:v});if(l.type!=="collabSession")throw Error("Invalid collaboration session response");if(w=l.data!==null,w)r.collaborationOwner(a.path,v,!0);if(i||N()){await p();return}if(y.dirty){await p(),n({mode:"local"}),m();return}if(!l.data){n({mode:"local"}),m();return}O=JSON.stringify([l.data.serverUrl,l.data.room,l.data.token]),f=pe(l.data,{name:r.userName,color:de(r.userName)});let k=await f.ready;if(i||N()){await p();return}if(!k){g(),await p(),n({mode:"local"}),m();return}if(y.dirty){g(),await p(),n({mode:"local"}),m();return}let{frontmatter:W,body:J}=b(y.text);M=!0,n({mode:"live",frontmatter:W,canWrite:l.data.canWrite});let E=f;e.action((s)=>{s.get(R).bindDoc(E.doc).setAwareness(E.awareness).applyTemplate(J).connect()});let x=()=>n({peers:ue(E.awareness)});E.awareness.on("change",x),x(),m(),C=setInterval(()=>{V().catch((s)=>{if(!i)P(s)})},300000)}catch(t){if(g(),await p().catch(r.onError),!i)n({mode:"local"}),m(),r.onError(t)}},dispose(){i=!0,I?.(),I=null,g(),p().catch(r.onError)},editable:()=>o.mode!=="probing"&&o.canWrite,serialize:(e)=>M?o.frontmatter+e:e,applyExternal(e,t){if(y=t,!f||o.mode!=="live")return!1;let{frontmatter:l,body:k}=b(t.text);if(n({frontmatter:l}),k!==e.action(U()))e.action((W)=>{if(!me(W,f,k,r.userName))throw Error("Collaboration binding is not ready")});return!0},render:()=>u(z,{},void 0,!1,void 0,this)}}function Me(r){return{createMarkdownIntegration:(a,d)=>B(r,a,d),htmlIntegration:{transform:(a)=>`${a}<script>${Y.replaceAll(/<\/script/gi,String.raw`<\/script`)}</script>`,render:(a)=>u(G,{iframeRef:a},void 0,!1,void 0,this)}}}
|
|
2
|
+
export{B,Me};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j,te,ne}from"./chunk-vtjd21bw.js";import{i,s,a,L}from"./chunk-mafn36hy.js";import{ChevronRightIcon as z,PlusIcon as I,XIcon as B}from"lucide-react";import{useEffect as P,useRef as D,useState as x}from"react";import{jsxDEV as o}from"react/jsx-dev-runtime";function ee({frontmatter:n,readOnly:u,saving:v,onChange:C,onSaveVersion:E}){let{t:m}=i("common"),[b,g]=x(!1),f=D(0),R=(t)=>j(t).map((e)=>({id:f.current++,entry:e})),[d,l]=x(()=>R(n)),[h,w]=x(n);P(()=>{if(n===h)return;w(n),l(j(n).map((t)=>({id:f.current++,entry:t})))},[n,h]);let c=(t)=>{l(t);let e=te(t.map((r)=>r.entry));if(w(e),e!==n)C(e)},y=(t,e)=>{l((r)=>r.map((p)=>p.id===t?{...p,entry:{...p.entry,...e}}:p))},F=(t)=>c(d.filter((e)=>e.id!==t)),N=(t)=>{if(t&&d.some((e)=>e.entry.key===t))return;l((e)=>[...e,{id:f.current++,entry:{key:t,value:"",list:t==="topics"||t==="tags"}}]),g(!0)},k=d.map((t)=>t.entry),S=k.filter((t)=>t.raw===void 0).length;return o("div",{className:"border-border/60 mb-3 rounded-md border text-xs","data-testid":"frontmatter-panel",children:[o("div",{className:"flex items-center gap-1 px-2 py-1",children:[o("button",{type:"button",className:"text-muted-foreground hover:text-foreground flex flex-1 items-center gap-1 text-start",onClick:()=>g((t)=>!t),children:[o(z,{className:s("size-3.5 transition-transform",b&&"rotate-90")},void 0,!1,void 0,this),o("span",{className:"font-medium",children:m("editor.markdown.frontmatter.title")},void 0,!1,void 0,this),o("span",{className:"text-muted-foreground",children:m("editor.markdown.frontmatter.count",{count:S})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),o(a,{variant:"outline",size:"sm",className:"h-6 px-2 text-[11px]",disabled:u||v,onClick:E,children:v?m("editor.markdown.frontmatter.saving"):m("editor.markdown.frontmatter.saveVersion")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b&&o("div",{className:"border-border/60 flex flex-col gap-1 border-t px-2 py-2",children:[d.map(({id:t,entry:e})=>e.raw!==void 0?o("pre",{className:"text-muted-foreground m-0 overflow-x-auto font-mono text-[11px] whitespace-pre",children:e.raw},t,!1,void 0,this):o("div",{className:"flex items-center gap-1",children:[o(L,{className:"h-6 w-28 shrink-0 px-1.5 font-mono text-[11px]",value:e.key,disabled:u,placeholder:"key",onChange:(r)=>y(t,{key:r.target.value}),onBlur:()=>c(d)},void 0,!1,void 0,this),o(L,{className:"h-6 min-w-0 flex-1 px-1.5 text-[11px]",value:e.value,disabled:u,placeholder:e.list?m("editor.markdown.frontmatter.listPlaceholder"):"",onChange:(r)=>y(t,{value:r.target.value}),onBlur:()=>c(d),onKeyDown:(r)=>{if(r.key==="Enter")r.preventDefault(),c(d)}},void 0,!1,void 0,this),!u&&o("button",{type:"button",className:"text-muted-foreground hover:text-destructive flex size-5 shrink-0 items-center justify-center rounded",title:m("editor.markdown.frontmatter.remove"),onClick:()=>F(t),children:o(B,{className:"size-3"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},t,!0,void 0,this)),!u&&o("div",{className:"flex flex-wrap items-center gap-1 pt-1",children:[o(I,{className:"text-muted-foreground size-3"},void 0,!1,void 0,this),ne.filter((t)=>!k.some((e)=>e.key===t)).map((t)=>o("button",{type:"button",className:"text-muted-foreground hover:text-foreground hover:bg-accent rounded px-1.5 py-0.5 font-mono text-[11px]",onClick:()=>N(t),children:t},t,!1,void 0,this)),o("button",{type:"button",className:"text-muted-foreground hover:text-foreground hover:bg-accent rounded px-1.5 py-0.5 text-[11px]",onClick:()=>N(""),children:m("editor.markdown.frontmatter.addCustom")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}
|
|
2
|
+
export{ee};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function k(t,r){return`${t.replace(/\/+$/,"")}/file/${encodeURIComponent(String(r))}`}function R(t){return`alwith://yup-drive/file/${encodeURIComponent(String(t))}`}function qe(t){let r=/^\/file\/([^/]+)$/.exec(t);if(!r)return null;let e;try{e=decodeURIComponent(r[1])}catch{return null}if(e==="")return null;if(!/^\d+$/.test(e))return e;let n=Number(e);return Number.isSafeInteger(n)?n:e}
|
|
2
|
+
export{k,R,qe};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var ft=20,z={active:[],recent:[]};function at(e,t){return`${String(e)}\x00${t}`}function p(e){if(e==="uploading")return"up";if(e==="downloading")return"down";return null}function f(e){return e==="synced"||e==="readOnly"||e==="collab"}function u(e){let t=e.split("/").pop();return t!==void 0&&t.length>0?t:e}function xe(e,t,a){let n=at(t.projectId,t.path),c=p(t.state);if(c!==null){let r=e.active.find((o)=>o.key===n),l={key:n,projectId:t.projectId,path:t.path,localPath:t.localPath,name:u(t.path),direction:c,size:t.size??r?.size??0,startedAt:r?.direction===c?r.startedAt:a};return{active:[...e.active.filter((o)=>o.key!==n),l],recent:e.recent}}let i=e.active.find((r)=>r.key===n);if(i===void 0)return e;let s=e.active.filter((r)=>r.key!==n);if(!f(t.state))return{active:s,recent:e.recent};let d=[{key:n,path:i.path,localPath:t.localPath||i.localPath,name:i.name,direction:i.direction,size:t.size!==void 0&&t.size>0?t.size:i.size,completedAt:a},...e.recent.filter((r)=>r.key!==n)].slice(0,20);return{active:s,recent:d}}
|
|
2
|
+
export{ft,z,at,xe};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function p(e){return e.replaceAll("\\","/").replace(/\/+$/,"")||e}function U(e,n){let t=p(n);return e.some((i)=>p(i.path)===t)}function Re(e,n){if(U(e,n.path))return[...e];return[...e,{path:p(n.path),name:n.name,kind:n.kind}]}function C(e,n){let t=p(n);return e.filter((i)=>p(i.path)!==t)}function N(e,n){return U(e,n.path)?C(e,n.path):Re(e,n)}function yt(e,n){return e.filter((t)=>n(t.path))}function Qe(e){if(!Array.isArray(e))return[];let n=[];for(let t of e){if(typeof t!=="object"||t===null)continue;let{path:i,name:o}=t;if(typeof i!=="string"||i==="")continue;let r=p(i);if(n.some((d)=>d.path===r))continue;let{kind:a}=t;n.push({path:r,name:typeof o==="string"&&o!==""?o:st(r),kind:a==="dir"?"dir":"file"})}return n}function st(e){let n=p(e),t=n.lastIndexOf("/");return t!==-1?n.slice(t+1):n}
|
|
2
|
+
export{p,U,Re,C,N,yt,Qe,st};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var r=new WeakMap;class $e{controller;scope;notify;state;listeners=new Set;timer;unsubscribe;conflicts=new Set;fileStates=new Map;invalid=!1;inFlight=!1;failures=0;cancelSent=!1;generation;constructor(t,e,s){this.controller=t;this.scope=e;this.generation=t.getSnapshot().snapshot?.generation,this.state={phase:"idle",job:s??null,unsynced:null,error:null,uploadIssue:null,stale:!1,cancelling:!1}}getSnapshot=()=>this.state;subscribe=(t)=>(this.listeners.add(t),()=>{this.listeners.delete(t)});publish(t){let e=this.state.phase;if(this.state={...this.state,...t},e!==this.state.phase&&(this.state.phase==="succeeded"||this.state.phase==="failed")){if(this.state.phase==="succeeded"||this.listeners.size===0)this.notify?.(this.state.phase)}this.listeners.forEach((s)=>s())}watch(){if(this.unsubscribe)return;this.conflicts=new Set(this.controller.getSnapshot().snapshot?.status?.conflicts.map((t)=>`${t.localPath}:${t.at}`)),this.fileStates=new Map(this.controller.getSnapshot().snapshot?.files.map((t)=>[t.localPath,t.state])),this.unsubscribe=this.controller.subscribe(()=>{let t=this.controller.getSnapshot().snapshot;if(this.state.phase==="uploading"&&t){for(let e of t.status?.conflicts??[]){let s=`${e.localPath}:${e.at}`;if(String(e.projectId)===String(this.scope.projectId)&&!this.conflicts.has(s))this.publish({uploadIssue:e.path});this.conflicts.add(s)}for(let e of t.files){if(String(e.projectId)===String(this.scope.projectId)&&this.fileStates.get(e.localPath)!==e.state&&["conflict","error","forbidden"].includes(e.state))this.publish({uploadIssue:e.path});this.fileStates.set(e.localPath,e.state)}}if(this.controller.getSnapshot().snapshot?.generation!==this.generation)this.invalid=!0,this.stop(),this.publish({phase:"failed",error:"Drive profile changed while the request was pending",cancelling:!1,stale:!0})})}stop(){if(this.timer)clearTimeout(this.timer);this.timer=void 0,this.unsubscribe?.(),this.unsubscribe=void 0}accept(t){let e=t.status==="SUCCEEDED"?"succeeded":t.status==="FAILED"?"failed":t.status==="CANCELLED"?"cancelled":"running";if(this.publish({job:t,phase:e,error:t.status==="FAILED"?t.error||"Condense job failed":null,cancelling:e==="running"&&this.state.cancelling}),e!=="running")this.stop()}resume=()=>{if(this.invalid||["succeeded","failed","cancelled","unsynced"].includes(this.state.phase)||this.state.phase==="idle"&&!this.state.job)return;if(this.watch(),this.state.phase==="idle"&&this.state.job)this.accept(this.state.job);if(this.state.phase==="running"&&!this.timer&&!this.inFlight)this.schedule()};schedule(){if(this.invalid||this.state.phase!=="running")return;this.timer=setTimeout(()=>{this.timer=void 0,this.poll()},Math.min(30000,2000*2**Math.min(this.failures,4)))}async poll(){if(this.invalid||this.inFlight||!this.state.job)return;this.inFlight=!0;try{let t=await this.controller.request({type:"job",jobId:this.state.job.id});if(t.type!=="job")throw Error("Invalid condense job response");if(this.invalid)return;this.failures=0,this.accept(t.data)}catch(t){if(!this.invalid&&++this.failures>=3)this.publish({error:String(t)})}finally{this.inFlight=!1,this.schedule()}}start=async(t=!1)=>{if(this.invalid||this.inFlight||["uploading","starting","running"].includes(this.state.phase))return;this.watch(),this.inFlight=!0,this.cancelSent=!1,this.publish({phase:t?"starting":"uploading",job:null,unsynced:null,error:null,uploadIssue:null,stale:!1,cancelling:!1});try{if(!this.controller.getSnapshot().snapshot?.running)throw Error("Drive sync is not running");if(!t){let s=await this.controller.request({type:"condensePreflight",projectId:this.scope.projectId,scopePath:this.scope.scopePath});if(s.type!=="unsynced")throw Error("Invalid condense preflight response");if(this.invalid)return;if(this.state.cancelling){this.publish({phase:"cancelled",cancelling:!1});return}if(s.data.pending>0){this.publish({phase:"unsynced",unsynced:s.data});return}}this.publish({phase:"starting"});let e=await this.controller.request({type:"condenseStart",projectId:this.scope.projectId,scopePath:this.scope.scopePath});if(e.type!=="job")throw Error("Invalid condense start response");if(this.invalid)return;if(this.accept(e.data),this.state.cancelling)await this.cancelRemote()}catch(e){if(!this.invalid)this.publish({phase:"failed",error:String(e),cancelling:!1})}finally{if(this.inFlight=!1,this.state.phase==="running")this.schedule();else this.stop()}};async cancelRemote(){if(this.cancelSent||!this.state.job)return;this.cancelSent=!0;try{await this.controller.request({type:"cancelJob",jobId:this.state.job.id})}catch(t){if(this.cancelSent=!1,!this.invalid)this.publish({cancelling:!1,error:String(t)})}}cancel=async()=>{if(this.invalid||this.state.cancelling)return;if(this.publish({cancelling:!0,error:null}),this.state.job)await this.cancelRemote()};adopt=(t)=>{this.watch(),this.accept(t),this.resume()}}function O(t,e,s){let i=r.get(t);if(!i)i=new Map,r.set(t,i);let a=JSON.stringify([t.getSnapshot().snapshot?.generation,e.projectId,e.scopePath]),n=i.get(a);if(!n||s&&n.getSnapshot().job?.id!==s.id)n=new $e(t,e,s),i.set(a,n);return n}
|
|
2
|
+
export{$e,O};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
function d(r,t){let e=[],n=r.indexOf(t);while(n>=0)e.push(n),n=r.indexOf(t,n+1);return e}function f(r,t){if(r.length===0)return null;if(t===null)return r[0];let e=r[0],n=Math.abs(e-t);for(let u of r.slice(1)){let l=Math.abs(u-t);if(l<n)e=u,n=l}return e}function m(r){let t="",e=[];for(let n=0;n<r.length;n++){let u=r[n];if(u===`
|
|
2
|
+
`||u==="\r")continue;t+=u,e.push(n)}return{stripped:t,originalIndex:e}}function v(r,t,e){if(t.length===0)return null;let n=f(d(r,t),e);if(n!==null)return{start:n,end:n+t.length};let u=t.replaceAll(/[\r\n]+/g,"");if(u.length===0)return null;let{stripped:l,originalIndex:i}=m(r),s=null;if(e!==null){let c=i.findIndex((g)=>g>=e);s=c===-1?l.length:c}let o=f(d(l,u),s);if(o===null)return null;return{start:i[o],end:i[o+u.length-1]+1}}function q(r,t){for(let n of r)if(t>=n.start&&t<n.end)return n.origin+(t-n.start);let e=r.at(-1);if(t===e?.end)return e.origin+(e.end-e.start);return null}function le(r){let t=[];for(let e of r){if(e.deleted===!0)continue;let n=e.quote;if(n===void 0||n===null||n.length===0)continue;t.push({threadId:e.id,index:t.length+1,quote:n,quoteOffset:e.quoteOffset??null})}return t}
|
|
3
|
+
export{v,q,le};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var ut=180;function ge(n,r){let i=n.slice(0,r),e=i.lastIndexOf("@");if(e===-1)return null;let t=e===0?"":i[e-1];if(t!==""&&!/\s/.test(t))return null;let o=i.slice(e+1);if(/\s/.test(o))return null;return{start:e,query:o}}function w(n){return n.name||n.employeeNo||String(n.id)}function he(n,r,i){let e=`@${w(i)} `;return{body:n.slice(0,r.start)+e+n.slice(r.start+1+r.query.length),caret:r.start+e.length}}function M(n,r){let i=[],e=new Set;for(let t of r){if(e.has(String(t.id)))continue;if(!n.includes(`@${w(t)}`))continue;e.add(String(t.id)),i.push(t.id)}return i.length===0?null:i}function fe(n,r,i){let e=null,t=0,o=!1;return{query(l){if(o=!1,e!==null)clearTimeout(e);let u=l.trim();if(u===""){t+=1,r([]);return}let c=++t;e=setTimeout(()=>{n(u).catch((s)=>{if(c===t&&!o)i(s);return[]}).then((s)=>{if(c!==t||o)return;r(s)})},180)},cancel:()=>{if(o=!0,e!==null)clearTimeout(e);e=null,t+=1}}}
|
|
2
|
+
export{ut,ge,w,he,M,fe};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e}from"./chunk-3fpcak8h.js";import{z,xe}from"./chunk-nk64fv7b.js";import{t,n,r}from"./chunk-ws1dtw35.js";import{ArrowDownIcon as F,ArrowUpIcon as j,PauseIcon as T,PlayIcon as q,RefreshCwIcon as U,SettingsIcon as E}from"lucide-react";import{useEffect as A,useState as k}from"react";import{jsxDEV as a,Fragment as L}from"react/jsx-dev-runtime";var D=new WeakMap;function De(o){let[c,w]=k(()=>D.get(o)?.feed??z);return A(()=>{let g=()=>{let f=o.getSnapshot().snapshot;if(!f)return;let d=D.get(o);if(d?.generation!==f.generation)d={generation:f.generation,feed:z,files:new Map},D.set(o,d);for(let h of f.files){let v=`${h.projectId}\x00${h.path}`,u=`${h.state}\x00${h.size}`;if(d.files.get(v)!==u)d.files.set(v,u),d.feed=xe(d.feed,h,Date.now())}w(d.feed)};return g(),o.subscribe(g)},[o]),c}function S(o){if(o<1024)return`${o} B`;if(o<1048576)return`${(o/1024).toFixed(1)} KB`;if(o<1073741824)return`${(o/1048576).toFixed(1)} MB`;return`${(o/1073741824).toFixed(1)} GB`}function Ie({controller:o,controls:{Button:c},locale:w,host:g,confirm:f,feed:d,onOpenSettings:h}){let{snapshot:v}=t(o),{busy:u,error:C,run:p}=n(),[y,x]=k([]),[I,P]=k(null),i=e(w),l=v?.status,N=l?.state.kind==="paused",M=l?.state.kind==="syncing"||l?.state.kind==="scanning";return A(()=>{if(!v?.running)return;let s=!0;return o.request({type:"failedUploads"}).then((m)=>{if(m.type!=="failedUploads")throw Error("Invalid failed transfers response");if(s)x(m.data),P(null)}).catch((m)=>{if(s)P(String(m))}),()=>{s=!1}},[o,v?.generation,v?.running,l?.failed]),a(L,{children:[a("header",{className:"alwith-drive-status-header",children:[a("h2",{children:i("title")},void 0,!1,void 0,this),a("div",{className:"alwith-drive-status-tools",children:[a(c,{className:"alwith-drive-status-icon",variant:"ghost",size:"icon-xs","aria-label":i("syncNow"),title:i("syncNow"),disabled:u||N,onClick:()=>p(()=>o.request({type:"sync"})),children:a(U,{className:M?"alwith-drive-spin":void 0,"aria-hidden":"true"},void 0,!1,void 0,this)},void 0,!1,void 0,this),a(c,{className:"alwith-drive-status-icon",variant:"ghost",size:"icon-xs","aria-label":i(N?"resume":"pause"),title:i(N?"resume":"pause"),disabled:u,onClick:()=>p(()=>o.request({type:"pause",paused:!N})),children:N?a(q,{"aria-hidden":"true"},void 0,!1,void 0,this):a(T,{"aria-hidden":"true"},void 0,!1,void 0,this)},void 0,!1,void 0,this),h&&a(c,{className:"alwith-drive-status-icon",variant:"ghost",size:"icon-xs","aria-label":i("openSettings"),title:i("openSettings"),onClick:h,children:a(E,{"aria-hidden":"true"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),(C||I)&&a("p",{role:"alert",className:"alwith-drive-error",children:C||I},void 0,!1,void 0,this),a("dl",{className:"alwith-drive-status-grid",children:[a("dt",{children:i("panel.state")},void 0,!1,void 0,this),a("dd",{role:"status",children:[l?i(`engine.${l.state.kind}`):i("engine.paused"),l?.state.kind==="error"&&` · ${l.state.message==="DEVICE_MISMATCH"?i("deviceMismatch"):l.state.message}`]},void 0,!0,void 0,this),a("dt",{children:i("panel.progress")},void 0,!1,void 0,this),a("dd",{children:i("panel.progressValue",{downloading:l?.downloading??0,uploading:(l?.uploading??0)+(l?.pending??0),synced:l?.synced??0})},void 0,!1,void 0,this),a("dt",{children:i("panel.lastSync")},void 0,!1,void 0,this),a("dd",{children:l?.lastSyncAt?new Date(l.lastSyncAt).toLocaleString(w):i("panel.never")},void 0,!1,void 0,this),a("dt",{children:i("panel.push")},void 0,!1,void 0,this),a("dd",{children:i(l?.pushConnected?"panel.pushLive":"panel.pushPolling")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),d.active.length>0&&a("section",{className:"alwith-drive-status-section",children:[a("h3",{children:i("panel.inFlight",{count:d.active.length})},void 0,!1,void 0,this),a("ul",{className:"alwith-drive-status-list alwith-drive-status-active",children:d.active.map((s)=>a("li",{className:"alwith-drive-status-file",children:[s.direction==="up"?a(j,{className:"alwith-drive-upload","aria-hidden":"true"},void 0,!1,void 0,this):a(F,{className:"alwith-drive-download","aria-hidden":"true"},void 0,!1,void 0,this),a(c,{className:"alwith-drive-status-filename",variant:"ghost",title:s.path,onClick:()=>p(()=>r(g).onRevealPath(s.localPath)),children:s.name},void 0,!1,void 0,this),a("span",{className:"alwith-drive-status-trailing",children:S(s.size)},void 0,!1,void 0,this)]},s.key,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),d.recent.length>0&&a("section",{className:"alwith-drive-status-section",children:[a("h3",{children:i("panel.recentDone",{count:d.recent.length})},void 0,!1,void 0,this),a("ul",{className:"alwith-drive-status-list",children:d.recent.map((s)=>a("li",{className:"alwith-drive-status-file",children:[s.direction==="up"?a(j,{className:"alwith-drive-upload","aria-hidden":"true"},void 0,!1,void 0,this):a(F,{className:"alwith-drive-download","aria-hidden":"true"},void 0,!1,void 0,this),a(c,{className:"alwith-drive-status-filename",variant:"ghost",title:s.path,onClick:()=>p(()=>r(g).onRevealPath(s.localPath)),children:s.name},void 0,!1,void 0,this),a("span",{className:"alwith-drive-status-trailing",children:new Date(s.completedAt).toLocaleTimeString(w)},void 0,!1,void 0,this)]},`${s.key}:${s.completedAt}`,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(l?.conflicts.length??0)>0&&a("section",{className:"alwith-drive-status-section",children:[a("h3",{children:i("panel.conflicts",{count:l?.conflicts.length??0})},void 0,!1,void 0,this),a("ul",{className:"alwith-drive-status-list alwith-drive-status-active",children:l?.conflicts.map((s)=>a("li",{className:"alwith-drive-status-file",children:[a("span",{className:"alwith-drive-status-filename",title:s.localPath,children:s.path},void 0,!1,void 0,this),a(c,{className:"alwith-drive-status-link",variant:"ghost",onClick:()=>p(()=>r(g).onRevealPath(s.conflictCopyPath??s.localPath)),children:i("panel.reveal")},void 0,!1,void 0,this)]},`${s.localPath}:${s.at}`,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y.length>0&&a("section",{className:"alwith-drive-status-section",children:[a("header",{children:[a("h3",{children:i("panel.transferFailed",{count:y.length})},void 0,!1,void 0,this),a(c,{variant:"outline",disabled:u,onClick:()=>p(()=>o.request({type:"retryUploads"})),children:i("panel.retryNow")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y.map((s)=>a("div",{className:"alwith-drive-failure",children:[a("div",{className:"alwith-drive-row",children:[a("strong",{children:[i(`panel.direction.${s.direction}`)," · ",s.name]},void 0,!0,void 0,this),a(c,{variant:"ghost",disabled:u,onClick:()=>p(()=>o.request(s.direction==="download"?{type:"download",projectId:s.projectId,path:s.path}:{type:"retryUpload",projectId:s.projectId,path:s.path})),children:i("panel.retryOne")},void 0,!1,void 0,this),s.localPath&&a(c,{variant:"ghost",onClick:()=>p(()=>r(g).onRevealPath(s.localPath)),children:i("panel.reveal")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("p",{children:s.path},void 0,!1,void 0,this),a("p",{className:"alwith-drive-error",children:s.message},void 0,!1,void 0,this),a("small",{children:i(!s.retryable?"panel.notUploadedMetaSettled":new Date(s.nextAttemptAt).getTime()<=Date.now()?"panel.notUploadedMetaDue":"panel.notUploadedMeta",{attempts:s.attempts,next:new Date(s.nextAttemptAt).toLocaleTimeString(w)})},void 0,!1,void 0,this)]},`${s.projectId}:${s.path}`,!0,void 0,this))]},void 0,!0,void 0,this),v?.pendingDeletes.map((s)=>a("aside",{className:"alwith-drive-notice",children:[a("h3",{children:i("massDelete.title",{count:s.count})},void 0,!1,void 0,this),a("p",{children:i("massDelete.desc",{count:s.count,project:s.drivePath})},void 0,!1,void 0,this),a("div",{className:"alwith-drive-actions",children:[a(c,{variant:"outline",disabled:u,onClick:()=>p(()=>o.request({type:"cancelDeletes",projectId:s.projectId})),children:i("massDelete.cancel")},void 0,!1,void 0,this),a(c,{variant:"destructive",disabled:u,onClick:()=>p(async()=>{if(await f(i("massDelete.desc",{count:s.count,project:s.drivePath})))await o.request({type:"confirmDeletes",projectId:s.projectId})}),children:i("massDelete.confirm")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},String(s.projectId),!0,void 0,this)),((l?.errors.length??0)>0||l?.state.kind==="error")&&a("section",{className:"alwith-drive-status-section",children:[a("header",{children:[a("h3",{children:i("panel.errors",{count:l?.errors.length??0})},void 0,!1,void 0,this),a(c,{className:"alwith-drive-status-link",variant:"ghost",disabled:u,onClick:()=>p(()=>o.request({type:"reconcile",projectId:null})),children:i("panel.reconcile")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("ul",{className:"alwith-drive-status-list",children:l?.errors.map((s,m)=>a("li",{children:[s.path&&`${s.path} · `,s.message]},`${s.at}:${m}`,!0,void 0,this))},void 0,!1,void 0,this),a("p",{children:i("panel.reconcileHint")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!d.active.length&&!d.recent.length&&!y.length&&!l?.conflicts.length&&!l?.errors.length&&l?.state.kind==="idle"&&a("p",{className:"alwith-drive-status-quiet",children:i("panel.allQuiet")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}
|
|
2
|
+
export{De,S,Ie};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{le}from"./chunk-pc21jzd8.js";import{V}from"./chunk-zf44znpx.js";import{K}from"./chunk-2ss7362z.js";import{createContext as y,useCallback as u,useContext as I,useEffect as m,useMemo as d,useRef as R,useState as q}from"react";import{jsxDEV as h}from"react/jsx-dev-runtime";var x=(n)=>n.replace(/\.yupcloud$/,"");function T(n,t){if(n===null||t===null)return n===t;if(n.selection?.quote!==t.selection?.quote||n.selection?.quoteOffset!==t.selection?.quoteOffset)return!1;if(n.focusRequest?.threadId!==t.focusRequest?.threadId||n.focusRequest?.nonce!==t.focusRequest?.nonce)return!1;if(n.anchoredThreadIds.size!==t.anchoredThreadIds.size)return!1;for(let e of n.anchoredThreadIds)if(!t.anchoredThreadIds.has(e))return!1;return!0}var p=y(null);function W(n){return x(n)}function f(n){let t=I(p)??v,{publish:e}=t;return m(()=>{e(n)}),m(()=>()=>e(null),[e]),t}var v={source:{context:null,comments:[],loading:!1,reload:async()=>{},create:async()=>{},update:async()=>{},remove:async()=>{},apply:async()=>{}},anchors:[],publish:()=>{}};function Oe({path:n,children:t}){let e=K(W(n)),c=R(null),[r,C]=q(null),l=u((o)=>{c.current=o,C((i)=>T(i,o)?i:o)},[]),S=u(()=>c.current?.onSelectionUsed(),[]),A=u((o)=>c.current?.onFocusQuote(o),[]),{comments:a}=e,s=d(()=>le(a.map((o)=>({...o,id:String(o.id)}))),[a]),g=d(()=>({source:e,anchors:s,publish:l}),[e,s,l]);return h(p.Provider,{value:g,children:[t,e.context!==null&&h(V,{context:e.context,comments:e.comments,loading:e.loading,create:e.create,update:e.update,remove:e.remove,apply:e.apply,selection:r?.selection??null,onSelectionUsed:S,onFocusQuote:A,focusRequest:r?.focusRequest??null,anchoredThreadIds:r?.anchoredThreadIds??F,anchors:s},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var F=new Set;
|
|
2
|
+
export{W,f,Oe};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var o={synced:{icon:"check",className:"text-primary",spin:!1},pending:{icon:"circle-dot",className:"text-primary",spin:!1},uploading:{icon:"cloud-upload",className:"text-primary",spin:!0},conflict:{icon:"triangle-alert",className:"text-destructive",spin:!1},cloudOnly:{icon:"cloud",className:"text-muted-foreground",spin:!1},notDownloaded:{icon:"cloud-download",className:"text-primary",spin:!1},downloading:{icon:"loader-circle",className:"text-primary",spin:!0},ignored:{icon:"eye-off",className:"text-muted-foreground",spin:!1},skippedTooLarge:{icon:"circle-slash",className:"text-primary",spin:!1},forbidden:{icon:"lock",className:"text-muted-foreground",spin:!1},readOnly:{icon:"file-lock",className:"text-primary",spin:!1},error:{icon:"circle-x",className:"text-destructive",spin:!1},collab:{icon:"users",className:"text-primary",spin:!1}};function g(e){return{state:e,labelKey:`drive.state.${e}`,...o[e]}}function T(e,r){let a=`${e}/`,t=null;for(let[i,l]of r){if(!i.startsWith(a))continue;if(l==="conflict")return g("conflict");if(l==="error")t="error"}return t?g(t):null}
|
|
2
|
+
export{g,T};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function pt(n){return n.scope==="PERSONAL"&&n.isMine!==!1}function mt(n){return n.scope==="PERSONAL"&&n.isMine===!1}function gt(n){return n?.active===!0}function Ce(n){if(!n.syncEnabled)return!1;return n.pinned||!n.selected}function ht(n){return{total:n.skipped.length,pinned:n.skipped.filter((e)=>e.reason==="pinned").length,pendingChanges:n.skipped.filter((e)=>e.reason==="pendingChanges").length}}
|
|
2
|
+
export{pt,mt,gt,Ce,ht};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var h=new Set(["topics","tags","keywords","owners","reviewers","专题","标签"]);function f(n){let t=n.trim();if(t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")))return t.slice(1,-1);return t}function m(n){return n.split(",").map((t)=>f(t)).filter((t)=>t.length>0)}function j(n){let t=n.replace(/^---\r?\n/,"").replace(/(^|\r?\n)---[ \t]*(?:\r?\n|$)$/,"");if(!t.trim())return[];let e=t.split(/\r?\n/),i=[],r=0;while(r<e.length){let o=e[r];if(!o.trim()||o.trimStart().startsWith("#")){r++;continue}let c=/^([A-Za-z0-9_\-一-鿿㐀-䶿.]+)\s*:(.*)$/.exec(o);if(!c||/^\s/.test(o)){let a=i.at(-1);if(a?.raw!==void 0)a.raw+=`
|
|
2
|
+
${o}`;else i.push({key:"",value:"",list:!1,raw:o});r++;continue}let u=c[1],l=c[2].trim();if(l===""&&e[r+1]!==void 0&&/^\s+-\s/.test(e[r+1])){let a=[],s=r+1;while(s<e.length&&/^\s+-\s/.test(e[s]))a.push(f(e[s].replace(/^\s+-\s?/,""))),s++;i.push({key:u,value:a.join("、"),list:!0}),r=s;continue}if(l===""||l==="|"||l===">"||l==="|-"||l===">-"){let a=o,s=r+1;while(s<e.length&&(/^\s+\S/.test(e[s])||!e[s].trim()))a+=`
|
|
3
|
+
${e[s]}`,s++;i.push({key:u,value:"",list:!1,raw:a.replace(/\n+$/,"")}),r=s;continue}if(l.startsWith("[")&&l.endsWith("]"))i.push({key:u,value:m(l.slice(1,-1)).join("、"),list:!0});else i.push({key:u,value:f(l),list:h.has(u.toLowerCase())});r++}return i}function g(n){if(n==="")return!0;if(/^[\d.+-]/.test(n)&&!Number.isNaN(Number(n)))return!1;if(/^(true|false|null|yes|no|~)$/i.test(n))return!1;return/[:#[\]{}&*!|>'"%@`,]/.test(n)||/^\s|\s$/.test(n)}function p(n){let t=n.trim();if(!g(t))return t;return`"${t.replaceAll("\\",String.raw`\\`).replaceAll('"',String.raw`\"`)}"`}function te(n){let t=[];for(let e of n){if(e.raw!==void 0){t.push(e.raw);continue}let i=e.key.trim();if(!i)continue;if(e.list){let r=e.value.split(/[、,,]/).map((o)=>o.trim()).filter((o)=>o.length>0);t.push(`${i}: [${r.map(p).join(", ")}]`)}else t.push(`${i}: ${p(e.value)}`)}if(t.length===0)return"";return`---
|
|
4
|
+
${t.join(`
|
|
5
|
+
`)}
|
|
6
|
+
---
|
|
7
|
+
`}var ne=["title","status","owner","topics","department","tags","updated"];
|
|
8
|
+
export{j,te,ne};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useRef as g,useState as p,useSyncExternalStore as v}from"react";import{jsxDEV as a}from"react/jsx-dev-runtime";function t(e){return v(e.subscribe,e.getSnapshot,e.getSnapshot)}function n(){let[e,o]=p(!1),[i,s]=p(null),l=g(!1);return{busy:e,error:i,run(h){if(l.current)return;l.current=!0,o(!0),s(null),h().catch((u)=>s(u instanceof Error?u.message:String(u))).finally(()=>{l.current=!1,o(!1)})}}}function r(e){if(!e)throw Error("Drive host integration is required for this action");return e}function c({controls:e,...o}){let i=e.Select;if(!i)throw Error("The host must supply its shadcn Select control");return a(i,{...o},void 0,!1,void 0,this)}function D({controls:e,...o}){let i=e.Dialog;if(!i)throw Error("The host must supply its shadcn Dialog control");return a(i,{...o},void 0,!1,void 0,this)}function d({controls:e,context:o=!1,...i}){let s=o?e.ContextMenu:e.Menu;if(!s)throw Error(`The host must supply its shadcn ${o?"ContextMenu":"DropdownMenu"} control`);return a(s,{...i},void 0,!1,void 0,this)}function I({controls:e,...o}){if(e.Switch){let s=e.Switch;return a(s,{...o},void 0,!1,void 0,this)}let i=e.Input;return a(i,{type:"checkbox",role:"switch",checked:o.checked,disabled:o.disabled,"aria-label":o["aria-label"],onChange:(s)=>o.onCheckedChange(s.target.checked)},void 0,!1,void 0,this)}
|
|
2
|
+
export{t,n,r,c,D,d,I};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{o,i,s,a,P,re}from"./chunk-mafn36hy.js";import{ge,he,M}from"./chunk-qabnvepm.js";import{J,Q}from"./chunk-bh4wjd78.js";import{CheckIcon as ae,ChevronLeftIcon as ie,ChevronRightIcon as le,Loader2Icon as de,MessageSquareIcon as ue,QuoteIcon as me,WifiOffIcon as ce}from"lucide-react";import{useCallback as Y,useEffect as _,useLayoutEffect as pe,useMemo as fe,useRef as ee,useState as k}from"react";import{createPortal as be}from"react-dom";import{jsxDEV as e,Fragment as ke}from"react/jsx-dev-runtime";var R=(t)=>String(t);function xe(){let{t,i18n:n}=i("common");return Y((l)=>{let b=/[Z+]|[+-]\d\d:\d\d$/.test(l)?l:`${l}Z`,d=new Date(b).getTime();if(Number.isNaN(d))return l;let u=Math.floor((Date.now()-d)/60000);if(u<1)return t("drive.comments.justNow");if(u<60)return t("drive.comments.minutesAgo",{count:u});let m=Math.floor(u/60);if(m<24)return t("drive.comments.hoursAgo",{count:m});let r=Math.floor(m/24);if(r<7)return t("drive.comments.daysAgo",{count:r});return new Date(d).toLocaleDateString(n.language)},[t,n.language])}var Z=["#f97316","#10b981","#3b82f6","#a855f7","#ec4899","#14b8a6","#eab308","#ef4444"];function ve(t){let n=0;for(let l of t)n=n*31+l.charCodeAt(0)>>>0;return Z[n%Z.length]}function ye(t){return t.filter((n)=>!n.deleted).length}function V({context:t,comments:n,loading:l,create:b,update:d,remove:u,apply:m,selection:r,onSelectionUsed:N,onFocusQuote:w,focusRequest:f,anchoredThreadIds:h,anchors:x}){let{t:p}=i("common"),[S,C]=k(!1),[q,A]=k(null),[B,z]=k(null),[D,I]=k(!1),[O,W]=k(null),[E,U]=k(!1),L=ee(new Map),{pushConnected:oe,notify:F}=o(),se=fe(()=>new Map(x.map((g)=>[g.threadId,g.index])),[x]);_(()=>{if(f===null)return;let{threadId:g}=f;C(!0);let c=L.current.get(g);if(c)c.scrollIntoView({behavior:"smooth",block:"nearest"});W(g);let v=setTimeout(()=>W((T)=>T===g?null:T),1200);return()=>clearTimeout(v)},[f]),_(()=>{if(r!==null)C(!0)},[r]);let H=Y(async(g)=>{I(!0);try{return await b(g),A(null),N(),!0}catch(c){return F.error(p("drive.comments.submitFailed"),{description:String(c)}),!1}finally{I(!1)}},[b,N,p,F]),j=ye(n);if(!S)return e("button",{type:"button","aria-label":p("drive.comments.expand"),title:p("drive.comments.title"),"data-testid":"comment-rail",onClick:()=>C(!0),className:"bg-background/95 hover:bg-accent absolute top-0 right-0 bottom-0 z-10 flex w-8 shrink-0 flex-col items-center gap-2 border-l pt-2 backdrop-blur",children:[e(ie,{className:"text-muted-foreground size-3.5"},void 0,!1,void 0,this),e(ue,{className:"text-muted-foreground size-3.5"},void 0,!1,void 0,this),j>0&&e("span",{className:"bg-primary text-primary-foreground flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-[10px] font-semibold",children:j},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return e("div",{"data-testid":"comment-drawer",className:"bg-background/98 absolute top-0 right-0 bottom-0 z-10 flex w-80 flex-col border-l shadow-[-4px_0_12px_rgba(0,0,0,0.08)] backdrop-blur",children:[e("div",{className:"flex h-8 shrink-0 items-center gap-1.5 border-b px-2",children:[e("button",{type:"button","aria-label":p("drive.comments.collapse"),className:"text-muted-foreground hover:text-foreground",onClick:()=>C(!1),children:e(le,{className:"size-3.5"},void 0,!1,void 0,this)},void 0,!1,void 0,this),e("span",{className:"text-[11px] font-semibold tracking-wide uppercase",children:p("drive.comments.title")},void 0,!1,void 0,this),e("span",{className:"text-muted-foreground text-[11px]",children:j},void 0,!1,void 0,this),e("div",{className:"flex-1"},void 0,!1,void 0,this),!oe&&e("span",{className:"text-muted-foreground flex items-center gap-1 text-[10px]",title:p("drive.comments.offlineHint"),children:[e(ce,{className:"size-3"},void 0,!1,void 0,this),p("drive.comments.offline")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),e("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 py-2",children:[r===null&&!E&&e(a,{variant:"outline",size:"sm",className:"mb-2 h-7 w-full text-[11px]",onClick:()=>U(!0),children:p("drive.comments.newForFile")},void 0,!1,void 0,this),r===null&&E&&e(G,{quote:null,busy:D,onCancel:()=>U(!1),onSubmit:(g,c,v)=>{H({body:g,parentId:null,quote:null,quoteOffset:null,suggestedReplacement:null,mentionedUserIds:v}).then((T)=>{if(T)U(!1)})}},void 0,!1,void 0,this),r!==null&&e(G,{quote:r.quote,busy:D,onCancel:N,onSubmit:(g,c,v)=>H({body:g,parentId:null,quote:r.quote,quoteOffset:r.quoteOffset,suggestedReplacement:c,mentionedUserIds:v})},`${r.quote}:${r.quoteOffset}`,!1,void 0,this),l&&e("div",{className:"text-muted-foreground flex items-center gap-2 py-6 text-xs",children:[e(de,{className:"size-3.5 animate-spin"},void 0,!1,void 0,this),p("drive.comments.loading")]},void 0,!0,void 0,this),!l&&n.length===0&&r===null&&!E&&e("div",{className:"text-muted-foreground py-6 text-center text-xs",children:p("drive.comments.empty")},void 0,!1,void 0,this),n.map((g)=>e(Ne,{comment:g,context:t,anchorNumber:h.has(R(g.id))?se.get(R(g.id))??null:null,flashing:O===R(g.id),replying:q===R(g.id),editing:B,busy:D,registerRef:(c,v)=>{if(v)L.current.set(c,v);else L.current.delete(c)},onFocusQuote:w,onStartReply:(c)=>A((v)=>v===c?null:c),onStartEdit:z,onSubmitReply:(c)=>H({body:c,parentId:g.id,quote:null,quoteOffset:null,suggestedReplacement:null,mentionedUserIds:null}),onSubmitEdit:async(c,v)=>{I(!0);try{await d(c,v),z(null)}catch(T){F.error(p("drive.comments.submitFailed"),{description:String(T)})}finally{I(!1)}},onDelete:async(c)=>{I(!0);try{await u(c)}catch(v){F.error(p("drive.comments.deleteFailed"),{description:String(v)})}finally{I(!1)}},onApply:async(c)=>{I(!0);try{await m(c),F.success(p("drive.comments.applied"))}catch(v){F.error(p("drive.comments.applyFailed"),{description:String(v)})}finally{I(!1)}}},R(g.id),!1,void 0,this))]},void 0,!0,void 0,this),r===null&&e("div",{className:"text-muted-foreground shrink-0 border-t px-2 py-1.5 text-[10px] leading-4",children:p("drive.comments.selectHint")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function K(t){let n=ee(null);return pe(()=>{let l=n.current;if(!l)return;l.style.height="auto",l.style.height=`${l.scrollHeight}px`},[t]),n}function te({value:t,onChange:n,onPicked:l,placeholder:b,rows:d=2,autoFocus:u}){let m=K(t),[r,N]=k(null),w=(f,h)=>N(ge(f,h));return e("div",{className:"relative",children:[e(P,{ref:m,value:t,onChange:(f)=>{n(f.target.value),w(f.target.value,f.target.selectionStart??f.target.value.length)},onKeyUp:(f)=>{let h=f.currentTarget;w(h.value,h.selectionStart??h.value.length)},onBlur:()=>N(null),placeholder:b,rows:d,className:"min-h-14 overflow-hidden text-xs",autoFocus:u},void 0,!1,void 0,this),e(J,{mention:r,onPick:(f)=>{if(r===null)return;let h=he(t,r,f);n(h.body),l(f),N(null),requestAnimationFrame(()=>{m.current?.focus(),m.current?.setSelectionRange(h.caret,h.caret)})}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function G({quote:t,busy:n,onCancel:l,onSubmit:b}){let{t:d}=i("common"),[u,m]=k(""),[r,N]=k(!1),[w,f]=k(""),h=K(w),[x,p]=k([]),S=u.trim().length>0&&(!r||w.trim().length>0);return e("div",{className:"border-primary/60 mb-2 rounded-md border p-2 shadow-sm","data-testid":"comment-compose",children:[t!==null&&e(ke,{children:[e(ne,{text:t},void 0,!1,void 0,this),e("label",{className:"text-muted-foreground my-1.5 flex cursor-pointer items-center gap-1.5 text-[11px]",children:[e(re,{checked:r,onCheckedChange:(C)=>N(C===!0)},void 0,!1,void 0,this),d("drive.comments.suggestEdit")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),r&&e(P,{ref:h,value:w,onChange:(C)=>f(C.target.value),placeholder:d("drive.comments.suggestPlaceholder"),rows:2,className:"mb-1.5 min-h-14 overflow-hidden text-xs"},void 0,!1,void 0,this),e(te,{value:u,onChange:m,onPicked:(C)=>p((q)=>[...q,C]),placeholder:d("drive.comments.placeholder"),autoFocus:!0},void 0,!1,void 0,this),e("div",{className:"mt-1.5 flex justify-end gap-1.5",children:[e(a,{variant:"ghost",size:"sm",className:"h-6 px-2 text-[11px]",onClick:l,children:d("drive.comments.cancel")},void 0,!1,void 0,this),e(a,{size:"sm",className:"h-6 px-2 text-[11px]",disabled:!S||n,onClick:()=>b(u.trim(),r?w.trim():null,M(u,x)),children:d("drive.comments.send")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function ne({text:t,onClick:n}){if(!n)return e("blockquote",{className:"block rounded-e border-s-[3px] border-amber-600 bg-amber-50 px-2 py-1 text-[11px] leading-snug break-words whitespace-pre-wrap text-amber-800 dark:bg-amber-950/40 dark:text-amber-300",children:t},void 0,!1,void 0,this);return e("button",{type:"button",className:s("block rounded-e border-s-[3px] border-amber-600 bg-amber-50 px-2 py-1 text-[11px] leading-snug break-words whitespace-pre-wrap text-amber-800 dark:bg-amber-950/40 dark:text-amber-300","w-full cursor-pointer text-start"),onClick:n,children:t},void 0,!1,void 0,this)}function Ne(t){let{comment:n,flashing:l,replying:b,registerRef:d}=t,u=R(n.id);return e("div",{ref:(m)=>d(u,m),"data-testid":"comment-thread",className:s("mb-2 rounded-md border px-2 py-1.5 transition-colors",l&&"bg-primary/10"),children:[e(X,{...t,comment:n,depth:0},void 0,!1,void 0,this),(n.replies??[]).map((m)=>e("div",{className:"bg-muted/40 ms-3 mt-1.5 rounded px-2 py-1",children:e(X,{...t,comment:m,depth:1},void 0,!1,void 0,this)},R(m.id),!1,void 0,this)),b&&e(Ce,{busy:t.busy,onCancel:()=>t.onStartReply(u),onSubmit:(m,r)=>t.onSubmitReply(m,r)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function X({comment:t,context:n,anchorNumber:l,editing:b,busy:d,depth:u,onFocusQuote:m,onStartReply:r,onStartEdit:N,onSubmitEdit:w,onDelete:f,onApply:h}){let{t:x}=i("common"),p=xe(),S=R(t.id),C=t.authorName??"?",q=R(t.authorId)===R(n.currentUserId),A=b===S,[B,z]=k(t.body??""),D=K(B);if(_(()=>{if(A)z(t.body??"")},[A,t.body]),t.deleted)return e("div",{className:"text-muted-foreground py-0.5 text-[11px] italic",children:x("drive.comments.deletedPlaceholder")},void 0,!1,void 0,this);let I=n.isOwner&&u===0&&t.suggestedReplacement!==void 0&&t.suggestedReplacement!==null&&t.suggestedReplacement.length>0&&(t.appliedAt===void 0||t.appliedAt===null);return e("div",{className:"group/comment flex gap-2",children:[e("span",{className:"mt-0.5 flex shrink-0 items-center justify-center rounded-full font-semibold text-white",style:{backgroundColor:ve(C),width:u===0?22:18,height:u===0?22:18,fontSize:u===0?10:9},children:C.slice(0,1).toUpperCase()},void 0,!1,void 0,this),e("div",{className:"min-w-0 flex-1",children:[e("div",{className:"flex flex-wrap items-center gap-1 text-[11px]",children:[l!==null&&e("span",{className:"flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-amber-500 px-1 text-[9px] font-semibold text-white",children:l},void 0,!1,void 0,this),e("span",{className:"font-semibold",children:C},void 0,!1,void 0,this),t.isAi&&e("span",{className:"rounded bg-amber-100 px-1 text-[9px] font-semibold text-amber-800 dark:bg-amber-900 dark:text-amber-200",children:x("drive.comments.aiBadge")},void 0,!1,void 0,this),e("span",{className:"text-muted-foreground",children:p(t.createdAt)},void 0,!1,void 0,this),t.updatedAt!==void 0&&t.updatedAt!==null&&t.updatedAt!==t.createdAt&&e("span",{className:"text-muted-foreground",children:x("drive.comments.edited")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.quote!==void 0&&t.quote!==null&&t.quote.length>0&&e("div",{className:"mt-1",children:e(ne,{text:t.quote,onClick:()=>m(S)},void 0,!1,void 0,this)},void 0,!1,void 0,this),A?e("div",{className:"mt-1",children:[e(P,{ref:D,value:B,onChange:(O)=>z(O.target.value),rows:2,className:"min-h-14 overflow-hidden text-xs",autoFocus:!0},void 0,!1,void 0,this),e("div",{className:"mt-1 flex justify-end gap-1.5",children:[e(a,{variant:"ghost",size:"sm",className:"h-6 px-2 text-[11px]",onClick:()=>N(null),children:x("drive.comments.cancel")},void 0,!1,void 0,this),e(a,{size:"sm",className:"h-6 px-2 text-[11px]",disabled:d||B.trim().length===0,onClick:()=>w(t.id,B.trim()),children:x("drive.comments.save")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):e("p",{className:"mt-0.5 text-xs leading-snug break-words whitespace-pre-wrap",children:e(Q,{body:t.body??"",mentions:t.mentions},void 0,!1,void 0,this)},void 0,!1,void 0,this),t.suggestedReplacement!==void 0&&t.suggestedReplacement!==null&&t.suggestedReplacement.length>0&&e("div",{className:"mt-1 rounded border-s-[3px] border-emerald-500 bg-emerald-500/10 px-2 py-1",children:[e("div",{className:"text-[10px] font-semibold text-emerald-700 dark:text-emerald-400",children:x("drive.comments.suggestLabel")},void 0,!1,void 0,this),e("div",{className:"text-[11px] leading-snug break-words whitespace-pre-wrap",children:t.suggestedReplacement},void 0,!1,void 0,this),t.appliedAt!==void 0&&t.appliedAt!==null&&e("div",{className:"mt-0.5 flex items-center gap-1 text-[10px] text-emerald-700 dark:text-emerald-400",children:[e(ae,{className:"size-3"},void 0,!1,void 0,this),x("drive.comments.appliedBy",{name:t.appliedBy?.name??"?"})]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),!A&&e("div",{className:"mt-0.5 flex gap-2 text-[10px] opacity-0 transition-opacity group-hover/comment:opacity-100 focus-within:opacity-100",children:[u===0&&e("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:()=>r(S),children:x("drive.comments.reply")},void 0,!1,void 0,this),q&&e("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:()=>N(S),children:x("drive.comments.edit")},void 0,!1,void 0,this),q&&e("button",{type:"button",className:"text-destructive hover:underline",disabled:d,onClick:()=>f(t.id),children:x("drive.comments.delete")},void 0,!1,void 0,this),I&&e("button",{type:"button",className:"font-semibold text-emerald-600 hover:underline",disabled:d,onClick:()=>h(t.id),children:x("drive.comments.applyAction")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Ce({busy:t,onCancel:n,onSubmit:l}){let{t:b}=i("common"),[d,u]=k(""),[m,r]=k([]);return e("div",{className:"ms-3 mt-1.5","data-testid":"comment-reply",children:[e(te,{value:d,onChange:u,onPicked:(N)=>r((w)=>[...w,N]),placeholder:b("drive.comments.replyPlaceholder"),autoFocus:!0},void 0,!1,void 0,this),e("div",{className:"mt-1 flex justify-end gap-1.5",children:[e(a,{variant:"ghost",size:"sm",className:"h-6 px-2 text-[11px]",onClick:n,children:b("drive.comments.cancel")},void 0,!1,void 0,this),e(a,{size:"sm",className:"h-6 px-2 text-[11px]",disabled:t||d.trim().length===0,onClick:()=>l(d.trim(),M(d,m)),children:b("drive.comments.send")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function y({rect:t,onClick:n}){let{t:l}=i("common");return be(e("button",{type:"button","data-testid":"comment-selection-button",onMouseDown:(b)=>b.preventDefault(),onClick:n,className:"bg-primary text-primary-foreground fixed z-[9999] flex items-center gap-1 rounded px-2 py-1 text-[11px] shadow-md",style:{left:t.left,top:Math.max(t.top-32,8)},children:[e(me,{className:"size-3"},void 0,!1,void 0,this),l("drive.comments.commentOnSelection")]},void 0,!0,void 0,this),document.body)}
|
|
2
|
+
export{V,y};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type { DriveController, Job, RemoteId } from "../core
|
|
3
|
-
import { type DriveLocale } from "../locales
|
|
4
|
-
import type { DriveControls } from "../react
|
|
5
|
-
import type { CondenseScope } from "./condense
|
|
2
|
+
import type { DriveController, Job, RemoteId } from "../core";
|
|
3
|
+
import { type DriveLocale } from "../locales";
|
|
4
|
+
import type { DriveControls } from "../react";
|
|
5
|
+
import type { CondenseScope } from "./condense";
|
|
6
6
|
export declare const CONDENSE_SILENCE_MS: number;
|
|
7
7
|
export interface CondenseSnoozeHost {
|
|
8
8
|
readSnooze: (projectId: RemoteId) => Promise<number | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Xe,et,tt,je}from"../chunk-jxs49r5w.js";import"../chunk-563we221.js";import"../chunk-njfqtysa.js";import"../chunk-3fpcak8h.js";export{Xe as CONDENSE_SILENCE_MS,je as ChatCondenseEntry,tt as dismissCondenseProposal,et as pendingCondenseProposal};
|
package/dist/content/collab.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Ctx } from "@milkdown/ctx";
|
|
|
2
2
|
import type { Awareness } from "y-protocols/awareness";
|
|
3
3
|
import { WebsocketProvider } from "y-websocket";
|
|
4
4
|
import * as Y from "yjs";
|
|
5
|
-
import type { CollabSession } from "../contract
|
|
5
|
+
import type { CollabSession } from "../contract";
|
|
6
6
|
export declare const AI_ORIGIN: {
|
|
7
7
|
readonly author: "AI";
|
|
8
8
|
};
|
package/dist/content/collab.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{nt,ce,rt,b,ot,de,ue,pe,me}from"../chunk-m6a9k1p0.js";export{rt as AI_AUTHOR,nt as AI_ORIGIN,ce as AUTHOR_FIELD,ot as FRAGMENT_NAME,me as applyDiskMarkdown,de as colorFor,pe as connectCollab,ue as listCollaborators,b as splitFrontmatter};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
`||r==="\r")continue;t+=r,e.push(n)}return{stripped:t,originalIndex:e}}function g(l,t,e){if(t.length===0)return null;let n=d(f(l,t),e);if(n!==null)return{start:n,end:n+t.length};let r=t.replaceAll(/[\r\n]+/g,"");if(r.length===0)return null;let{stripped:i,originalIndex:o}=h(l),c=null;if(e!==null){let s=o.findIndex((a)=>a>=e);c=s===-1?i.length:s}let u=d(f(i,r),c);if(u===null)return null;return{start:o[u],end:o[u+r.length-1]+1}}function p(l,t){for(let n of l)if(t>=n.start&&t<n.end)return n.origin+(t-n.start);let e=l.at(-1);if(t===e?.end)return e.origin+(e.end-e.start);return null}function x(l){let t=[];for(let e of l){if(e.deleted===!0)continue;let n=e.quote;if(n===void 0||n===null||n.length===0)continue;t.push({threadId:e.id,index:t.length+1,quote:n,quoteOffset:e.quoteOffset??null})}return t}export{x as collectAnchors,g as locateQuote,p as originAt};
|
|
1
|
+
import{v,q,le}from"../chunk-pc21jzd8.js";export{le as collectAnchors,v as locateQuote,q as originAt};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Node as ProseNode } from "@milkdown/prose/model";
|
|
2
2
|
import { Plugin, PluginKey } from "@milkdown/prose/state";
|
|
3
3
|
import { DecorationSet, type EditorView } from "@milkdown/prose/view";
|
|
4
|
-
import { type CommentAnchor, type TextSegment } from "./comment-anchors
|
|
4
|
+
import { type CommentAnchor, type TextSegment } from "./comment-anchors";
|
|
5
5
|
export declare const commentAnchorsKey: PluginKey<CommentAnchorsState>;
|
|
6
6
|
export type CommentAnchorsState = {
|
|
7
7
|
anchors: CommentAnchor[];
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`))e.push({start:t.length,end:t.length+1,origin:s}),t+=`
|
|
3
|
-
`;return!0}),{text:t,segments:e}}function C(n,e,t){if(e.length===0)return{decorations:h.empty,anchored:[]};let{text:r,segments:s}=A(n),o=[],i=[];for(let c of e){let l=k(r,c.quote,c.quoteOffset);if(l===null)continue;let m=g(s,l.start),d=g(s,l.end);if(m===null||d===null||d<=m)continue;o.push(f.inline(m,d,{class:"yup-comment-highlight","data-thread-id":c.threadId})),o.push(f.widget(d,()=>{let a=document.createElement("span");return a.className="yup-comment-marker",a.dataset.threadId=c.threadId,a.textContent=String(c.index),a.addEventListener("mousedown",(p)=>p.preventDefault()),a.addEventListener("click",()=>t.onMarkerClick(c.threadId)),a})),i.push(c.threadId)}return{decorations:h.create(n,o),anchored:i}}function S(n){let e="";return new x({key:u,state:{init:()=>({anchors:[],decorations:h.empty,anchored:[]}),apply(t,r,s,o){let i=t.getMeta(u);if(i===void 0&&!t.docChanged)return r;let c=i??r.anchors;return{anchors:c,...C(o.doc,c,n)}}},props:{decorations:(t)=>u.getState(t)?.decorations??h.empty},view:(t)=>(n.view=t,{update(r){let s=u.getState(r.state)?.anchored??[],o=s.join(",");if(o===e)return;e=o,n.onAnchoredChange(s)},destroy(){n.view=null}})})}function M(n,e){n.dispatch(n.state.tr.setMeta(u,e))}function E(n,e){for(let t of n){let r=t.end-t.start;if(e>=t.origin&&e<t.origin+r)return t.start+(e-t.origin)}return null}export{E as charIndexAt,u as commentAnchorsKey,S as commentAnchorsPlugin,D as createCommentAnchorBridge,A as flattenDocument,M as pushAnchors};
|
|
1
|
+
import{E,oe,F,ie,ae,se}from"../chunk-j234gbr1.js";import"../chunk-pc21jzd8.js";export{se as charIndexAt,E as commentAnchorsKey,ie as commentAnchorsPlugin,oe as createCommentAnchorBridge,F as flattenDocument,ae as pushAnchors};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type { CommentContext, FileComment, RemoteId } from "../contract
|
|
3
|
-
import type { CommentAnchor } from "./comment-anchors
|
|
2
|
+
import type { CommentContext, FileComment, RemoteId } from "../contract";
|
|
3
|
+
import type { CommentAnchor } from "./comment-anchors";
|
|
4
4
|
export type CommentSelection = {
|
|
5
5
|
quote: string;
|
|
6
6
|
quoteOffset: number | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,jsxs as o,Fragment as te}from"react/jsx-runtime";import{CheckIcon as ne,ChevronLeftIcon as re,ChevronRightIcon as se,Loader2Icon as ae,MessageSquareIcon as le,QuoteIcon as oe,WifiOffIcon as ie}from"lucide-react";import{useCallback as V,useEffect as _,useLayoutEffect as de,useMemo as ce,useRef as W,useState as v}from"react";import{createPortal as ue}from"react-dom";import{Button as R,Checkbox as me,Textarea as E,useTranslation as q}from"./host.js";import{MentionedBody as pe,MentionPicker as fe}from"./mention-picker.js";import{activeMentionQuery as he,applyMention as ge,collectMentionedIds as Z}from"./comment-mentions.js";import{cn as G,useContentHost as xe}from"./host.js";var k=(e)=>String(e);function be(){let{t:e,i18n:n}=q("common");return V((s)=>{let p=/[Z+]|[+-]\d\d:\d\d$/.test(s)?s:`${s}Z`,a=new Date(p).getTime();if(Number.isNaN(a))return s;let l=Math.floor((Date.now()-a)/60000);if(l<1)return e("drive.comments.justNow");if(l<60)return e("drive.comments.minutesAgo",{count:l});let i=Math.floor(l/60);if(i<24)return e("drive.comments.hoursAgo",{count:i});let r=Math.floor(i/24);if(r<7)return e("drive.comments.daysAgo",{count:r});return new Date(a).toLocaleDateString(n.language)},[e,n.language])}var Q=["#f97316","#10b981","#3b82f6","#a855f7","#ec4899","#14b8a6","#eab308","#ef4444"];function ve(e){let n=0;for(let s of e)n=n*31+s.charCodeAt(0)>>>0;return Q[n%Q.length]}function ye(e){return e.filter((n)=>n.deleted!==!0).length}function Fe({context:e,comments:n,loading:s,create:p,update:a,remove:l,apply:i,selection:r,onSelectionUsed:x,onFocusQuote:y,focusRequest:m,anchoredThreadIds:g,anchors:f}){let{t:c}=q("common"),[w,b]=v(!1),[S,C]=v(null),[A,F]=v(null),[M,N]=v(!1),[T,H]=v(null),[B,j]=v(!1),D=W(new Map),{pushConnected:Y,notify:z}=xe(),ee=ce(()=>new Map(f.map((u)=>[u.threadId,u.index])),[f]);_(()=>{if(m===null)return;let{threadId:u}=m;b(!0);let d=D.current.get(u);if(d)d.scrollIntoView({behavior:"smooth",block:"nearest"});H(u);let h=setTimeout(()=>H((I)=>I===u?null:I),1200);return()=>clearTimeout(h)},[m]),_(()=>{if(r!==null)b(!0)},[r]);let O=V(async(u)=>{N(!0);try{return await p(u),C(null),x(),!0}catch(d){return z.error(c("drive.comments.submitFailed"),{description:String(d)}),!1}finally{N(!1)}},[p,x,c,z]),P=ye(n);if(!w)return o("button",{type:"button","aria-label":c("drive.comments.expand"),title:c("drive.comments.title"),"data-testid":"comment-rail",onClick:()=>b(!0),className:"bg-background/95 hover:bg-accent absolute top-0 right-0 bottom-0 z-10 flex w-8 shrink-0 flex-col items-center gap-2 border-l pt-2 backdrop-blur",children:[t(re,{className:"text-muted-foreground size-3.5"}),t(le,{className:"text-muted-foreground size-3.5"}),P>0&&t("span",{className:"bg-primary text-primary-foreground flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-[10px] font-semibold",children:P})]});return o("div",{"data-testid":"comment-drawer",className:"bg-background/98 absolute top-0 right-0 bottom-0 z-10 flex w-80 flex-col border-l shadow-[-4px_0_12px_rgba(0,0,0,0.08)] backdrop-blur",children:[o("div",{className:"flex h-8 shrink-0 items-center gap-1.5 border-b px-2",children:[t("button",{type:"button","aria-label":c("drive.comments.collapse"),className:"text-muted-foreground hover:text-foreground",onClick:()=>b(!1),children:t(se,{className:"size-3.5"})}),t("span",{className:"text-[11px] font-semibold tracking-wide uppercase",children:c("drive.comments.title")}),t("span",{className:"text-muted-foreground text-[11px]",children:P}),t("div",{className:"flex-1"}),!Y&&o("span",{className:"text-muted-foreground flex items-center gap-1 text-[10px]",title:c("drive.comments.offlineHint"),children:[t(ie,{className:"size-3"}),c("drive.comments.offline")]})]}),o("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 py-2",children:[r===null&&!B&&t(R,{variant:"outline",size:"sm",className:"mb-2 h-7 w-full text-[11px]",onClick:()=>j(!0),children:c("drive.comments.newForFile")}),r===null&&B&&t(K,{quote:null,busy:M,onCancel:()=>j(!1),onSubmit:(u,d,h)=>{O({body:u,parentId:null,quote:null,quoteOffset:null,suggestedReplacement:null,mentionedUserIds:h}).then((I)=>{if(I)j(!1)})}}),r!==null&&t(K,{quote:r.quote,busy:M,onCancel:x,onSubmit:(u,d,h)=>O({body:u,parentId:null,quote:r.quote,quoteOffset:r.quoteOffset,suggestedReplacement:d,mentionedUserIds:h})},`${r.quote}:${r.quoteOffset}`),s&&o("div",{className:"text-muted-foreground flex items-center gap-2 py-6 text-xs",children:[t(ae,{className:"size-3.5 animate-spin"}),c("drive.comments.loading")]}),!s&&n.length===0&&r===null&&!B&&t("div",{className:"text-muted-foreground py-6 text-center text-xs",children:c("drive.comments.empty")}),n.map((u)=>t(Ne,{comment:u,context:e,anchorNumber:g.has(k(u.id))?ee.get(k(u.id))??null:null,flashing:T===k(u.id),replying:S===k(u.id),editing:A,busy:M,registerRef:(d,h)=>{if(h)D.current.set(d,h);else D.current.delete(d)},onFocusQuote:y,onStartReply:(d)=>C((h)=>h===d?null:d),onStartEdit:F,onSubmitReply:(d)=>O({body:d,parentId:u.id,quote:null,quoteOffset:null,suggestedReplacement:null,mentionedUserIds:null}),onSubmitEdit:async(d,h)=>{N(!0);try{await a(d,h),F(null)}catch(I){z.error(c("drive.comments.submitFailed"),{description:String(I)})}finally{N(!1)}},onDelete:async(d)=>{N(!0);try{await l(d)}catch(h){z.error(c("drive.comments.deleteFailed"),{description:String(h)})}finally{N(!1)}},onApply:async(d)=>{N(!0);try{await i(d),z.success(c("drive.comments.applied"))}catch(h){z.error(c("drive.comments.applyFailed"),{description:String(h)})}finally{N(!1)}}},k(u.id)))]}),r===null&&t("div",{className:"text-muted-foreground shrink-0 border-t px-2 py-1.5 text-[10px] leading-4",children:c("drive.comments.selectHint")})]})}function L(e){let n=W(null);return de(()=>{let s=n.current;if(!s)return;s.style.height="auto",s.style.height=`${s.scrollHeight}px`},[e]),n}function J({value:e,onChange:n,onPicked:s,placeholder:p,rows:a=2,autoFocus:l}){let i=L(e),[r,x]=v(null),y=(m,g)=>x(he(m,g));return o("div",{className:"relative",children:[t(E,{ref:i,value:e,onChange:(m)=>{n(m.target.value),y(m.target.value,m.target.selectionStart??m.target.value.length)},onKeyUp:(m)=>{let g=m.currentTarget;y(g.value,g.selectionStart??g.value.length)},onBlur:()=>x(null),placeholder:p,rows:a,className:"min-h-14 overflow-hidden text-xs",autoFocus:l}),t(fe,{mention:r,onPick:(m)=>{if(r===null)return;let g=ge(e,r,m);n(g.body),s(m),x(null),requestAnimationFrame(()=>{i.current?.focus(),i.current?.setSelectionRange(g.caret,g.caret)})}})]})}function K({quote:e,busy:n,onCancel:s,onSubmit:p}){let{t:a}=q("common"),[l,i]=v(""),[r,x]=v(!1),[y,m]=v(""),g=L(y),[f,c]=v([]),w=l.trim().length>0&&(!r||y.trim().length>0);return o("div",{className:"border-primary/60 mb-2 rounded-md border p-2 shadow-sm","data-testid":"comment-compose",children:[e!==null&&o(te,{children:[t(X,{text:e}),o("label",{className:"text-muted-foreground my-1.5 flex cursor-pointer items-center gap-1.5 text-[11px]",children:[t(me,{checked:r,onCheckedChange:(b)=>x(b===!0)}),a("drive.comments.suggestEdit")]})]}),r&&t(E,{ref:g,value:y,onChange:(b)=>m(b.target.value),placeholder:a("drive.comments.suggestPlaceholder"),rows:2,className:"mb-1.5 min-h-14 overflow-hidden text-xs"}),t(J,{value:l,onChange:i,onPicked:(b)=>c((S)=>[...S,b]),placeholder:a("drive.comments.placeholder"),autoFocus:!0}),o("div",{className:"mt-1.5 flex justify-end gap-1.5",children:[t(R,{variant:"ghost",size:"sm",className:"h-6 px-2 text-[11px]",onClick:s,children:a("drive.comments.cancel")}),t(R,{size:"sm",className:"h-6 px-2 text-[11px]",disabled:!w||n,onClick:()=>p(l.trim(),r?y.trim():null,Z(l,f)),children:a("drive.comments.send")})]})]})}function X({text:e,onClick:n}){if(!n)return t("blockquote",{className:"block rounded-e border-s-[3px] border-amber-600 bg-amber-50 px-2 py-1 text-[11px] leading-snug break-words whitespace-pre-wrap text-amber-800 dark:bg-amber-950/40 dark:text-amber-300",children:e});return t("button",{type:"button",className:G("block rounded-e border-s-[3px] border-amber-600 bg-amber-50 px-2 py-1 text-[11px] leading-snug break-words whitespace-pre-wrap text-amber-800 dark:bg-amber-950/40 dark:text-amber-300","w-full cursor-pointer text-start"),onClick:n,children:e})}function Ne(e){let{comment:n,flashing:s,replying:p,registerRef:a}=e,l=k(n.id);return o("div",{ref:(i)=>a(l,i),"data-testid":"comment-thread",className:G("mb-2 rounded-md border px-2 py-1.5 transition-colors",s&&"bg-primary/10"),children:[t(U,{...e,comment:n,depth:0}),(n.replies??[]).map((i)=>t("div",{className:"bg-muted/40 ms-3 mt-1.5 rounded px-2 py-1",children:t(U,{...e,comment:i,depth:1})},k(i.id))),p&&t(ke,{busy:e.busy,onCancel:()=>e.onStartReply(l),onSubmit:(i,r)=>e.onSubmitReply(i,r)})]})}function U({comment:e,context:n,anchorNumber:s,editing:p,busy:a,depth:l,onFocusQuote:i,onStartReply:r,onStartEdit:x,onSubmitEdit:y,onDelete:m,onApply:g}){let{t:f}=q("common"),c=be(),w=k(e.id),b=e.authorName??"?",S=k(e.authorId)===k(n.currentUserId),C=p===w,[A,F]=v(e.body??""),M=L(A);if(_(()=>{if(C)F(e.body??"")},[C,e.body]),e.deleted===!0)return t("div",{className:"text-muted-foreground py-0.5 text-[11px] italic",children:f("drive.comments.deletedPlaceholder")});let N=n.isOwner&&l===0&&e.suggestedReplacement!==void 0&&e.suggestedReplacement!==null&&e.suggestedReplacement.length>0&&(e.appliedAt===void 0||e.appliedAt===null);return o("div",{className:"group/comment flex gap-2",children:[t("span",{className:"mt-0.5 flex shrink-0 items-center justify-center rounded-full font-semibold text-white",style:{backgroundColor:ve(b),width:l===0?22:18,height:l===0?22:18,fontSize:l===0?10:9},children:b.slice(0,1).toUpperCase()}),o("div",{className:"min-w-0 flex-1",children:[o("div",{className:"flex flex-wrap items-center gap-1 text-[11px]",children:[s!==null&&t("span",{className:"flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-amber-500 px-1 text-[9px] font-semibold text-white",children:s}),t("span",{className:"font-semibold",children:b}),e.isAi===!0&&t("span",{className:"rounded bg-amber-100 px-1 text-[9px] font-semibold text-amber-800 dark:bg-amber-900 dark:text-amber-200",children:f("drive.comments.aiBadge")}),t("span",{className:"text-muted-foreground",children:c(e.createdAt)}),e.updatedAt!==void 0&&e.updatedAt!==null&&e.updatedAt!==e.createdAt&&t("span",{className:"text-muted-foreground",children:f("drive.comments.edited")})]}),e.quote!==void 0&&e.quote!==null&&e.quote.length>0&&t("div",{className:"mt-1",children:t(X,{text:e.quote,onClick:()=>i(w)})}),C?o("div",{className:"mt-1",children:[t(E,{ref:M,value:A,onChange:(T)=>F(T.target.value),rows:2,className:"min-h-14 overflow-hidden text-xs",autoFocus:!0}),o("div",{className:"mt-1 flex justify-end gap-1.5",children:[t(R,{variant:"ghost",size:"sm",className:"h-6 px-2 text-[11px]",onClick:()=>x(null),children:f("drive.comments.cancel")}),t(R,{size:"sm",className:"h-6 px-2 text-[11px]",disabled:a||A.trim().length===0,onClick:()=>y(e.id,A.trim()),children:f("drive.comments.save")})]})]}):t("p",{className:"mt-0.5 text-xs leading-snug break-words whitespace-pre-wrap",children:t(pe,{body:e.body??"",mentions:e.mentions})}),e.suggestedReplacement!==void 0&&e.suggestedReplacement!==null&&e.suggestedReplacement.length>0&&o("div",{className:"mt-1 rounded border-s-[3px] border-emerald-500 bg-emerald-500/10 px-2 py-1",children:[t("div",{className:"text-[10px] font-semibold text-emerald-700 dark:text-emerald-400",children:f("drive.comments.suggestLabel")}),t("div",{className:"text-[11px] leading-snug break-words whitespace-pre-wrap",children:e.suggestedReplacement}),e.appliedAt!==void 0&&e.appliedAt!==null&&o("div",{className:"mt-0.5 flex items-center gap-1 text-[10px] text-emerald-700 dark:text-emerald-400",children:[t(ne,{className:"size-3"}),f("drive.comments.appliedBy",{name:e.appliedBy?.name??"?"})]})]}),!C&&o("div",{className:"mt-0.5 flex gap-2 text-[10px] opacity-0 transition-opacity group-hover/comment:opacity-100 focus-within:opacity-100",children:[l===0&&t("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:()=>r(w),children:f("drive.comments.reply")}),S&&t("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:()=>x(w),children:f("drive.comments.edit")}),S&&t("button",{type:"button",className:"text-destructive hover:underline",disabled:a,onClick:()=>m(e.id),children:f("drive.comments.delete")}),N&&t("button",{type:"button",className:"font-semibold text-emerald-600 hover:underline",disabled:a,onClick:()=>g(e.id),children:f("drive.comments.applyAction")})]})]})]})}function ke({busy:e,onCancel:n,onSubmit:s}){let{t:p}=q("common"),[a,l]=v(""),[i,r]=v([]);return o("div",{className:"ms-3 mt-1.5","data-testid":"comment-reply",children:[t(J,{value:a,onChange:l,onPicked:(x)=>r((y)=>[...y,x]),placeholder:p("drive.comments.replyPlaceholder"),autoFocus:!0}),o("div",{className:"mt-1 flex justify-end gap-1.5",children:[t(R,{variant:"ghost",size:"sm",className:"h-6 px-2 text-[11px]",onClick:n,children:p("drive.comments.cancel")}),t(R,{size:"sm",className:"h-6 px-2 text-[11px]",disabled:e||a.trim().length===0,onClick:()=>s(a.trim(),Z(a,i)),children:p("drive.comments.send")})]})]})}function Me({rect:e,onClick:n}){let{t:s}=q("common");return ue(o("button",{type:"button","data-testid":"comment-selection-button",onMouseDown:(p)=>p.preventDefault(),onClick:n,className:"bg-primary text-primary-foreground fixed z-[9999] flex items-center gap-1 rounded px-2 py-1 text-[11px] shadow-md",style:{left:e.left,top:Math.max(e.top-32,8)},children:[t(oe,{className:"size-3"}),s("drive.comments.commentOnSelection")]}),document.body)}export{Fe as CommentDrawer,Me as SelectionCommentButton};
|
|
1
|
+
import{V,y}from"../chunk-zf44znpx.js";import"../chunk-bh4wjd78.js";import"../chunk-mafn36hy.js";import"../chunk-qabnvepm.js";export{V as CommentDrawer,y as SelectionCommentButton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{ut,ge,w,he,M,fe}from"../chunk-qabnvepm.js";export{ut as MENTION_DEBOUNCE_MS,ge as activeMentionQuery,he as applyMention,M as collectMentionedIds,fe as createDebouncedSearch,w as mentionNameOf};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import { type CommentAnchor } from "./comment-anchors
|
|
3
|
-
import { type CommentSelection } from "./comment-drawer
|
|
4
|
-
import { type FileComments } from "./use-file-comments
|
|
2
|
+
import { type CommentAnchor } from "./comment-anchors";
|
|
3
|
+
import { type CommentSelection } from "./comment-drawer";
|
|
4
|
+
import { type FileComments } from "./use-file-comments";
|
|
5
5
|
export type CommentAnchoring = {
|
|
6
6
|
selection: CommentSelection | null;
|
|
7
7
|
onSelectionUsed: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{W,f,Oe}from"../chunk-rg43mads.js";import"../chunk-2ss7362z.js";import"../chunk-zf44znpx.js";import"../chunk-bh4wjd78.js";import"../chunk-mafn36hy.js";import"../chunk-pc21jzd8.js";import"../chunk-qabnvepm.js";export{Oe as CommentSurface,W as commentPathOf,f as useCommentAnchoring};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DriveController, Job, UnsyncedSummary } from "../core
|
|
2
|
-
import type { CondenseScope } from "./condense
|
|
1
|
+
import type { DriveController, Job, UnsyncedSummary } from "../core";
|
|
2
|
+
import type { CondenseScope } from "./condense";
|
|
3
3
|
type Phase = "idle" | "uploading" | "unsynced" | "starting" | "running" | "succeeded" | "failed" | "cancelled";
|
|
4
4
|
interface TaskState {
|
|
5
5
|
phase: Phase;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{$e,O}from"../chunk-pbxjprxa.js";export{$e as CondenseTask,O as condenseTask};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type { DriveController, Job, RemoteId } from "../core
|
|
3
|
-
import { type DriveLocale } from "../locales
|
|
4
|
-
import type { DriveControls } from "../react
|
|
2
|
+
import type { DriveController, Job, RemoteId } from "../core";
|
|
3
|
+
import { type DriveLocale } from "../locales";
|
|
4
|
+
import type { DriveControls } from "../react";
|
|
5
5
|
export interface CondenseScope {
|
|
6
6
|
projectId: RemoteId;
|
|
7
7
|
projectName: string;
|
package/dist/content/condense.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Ge}from"../chunk-4rfsdwgj.js";import"../chunk-pbxjprxa.js";import"../chunk-ayvem7j8.js";import"../chunk-ws1dtw35.js";import"../chunk-3fpcak8h.js";export{Ge as DriveCondense};
|
package/dist/content/editor.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EditorDocument } from "@alwith/module-editor/core";
|
|
2
2
|
import type { MarkdownIntegration, PreviewContext, PreviewHost } from "@alwith/module-editor/previews";
|
|
3
|
-
import type { DriveContentHost } from "./host
|
|
3
|
+
import type { DriveContentHost } from "./host";
|
|
4
4
|
export declare function createDriveMarkdownIntegration(host: DriveContentHost, document: EditorDocument, context: PreviewContext): MarkdownIntegration;
|
|
5
5
|
export declare function drivePreviewIntegrations(host: DriveContentHost): Pick<PreviewHost, "createMarkdownIntegration" | "htmlIntegration">;
|
package/dist/content/editor.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{B,Me}from"../chunk-n9sgwcq1.js";import"../chunk-j2mc48dt.js";import"../chunk-kzjc8c8g.js";import"../chunk-rg43mads.js";import"../chunk-2ss7362z.js";import"../chunk-13ret1k0.js";import"../chunk-zf44znpx.js";import"../chunk-bh4wjd78.js";import"../chunk-34qgf6be.js";import"../chunk-nf37g7p6.js";import"../chunk-vtjd21bw.js";import"../chunk-mafn36hy.js";import"../chunk-j234gbr1.js";import"../chunk-pc21jzd8.js";import"../chunk-m6a9k1p0.js";import"../chunk-qabnvepm.js";export{B as createDriveMarkdownIntegration,Me as drivePreviewIntegrations};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type { DriveController, RemoteId, RootInfo } from "../core
|
|
3
|
-
import type { DriveLocale } from "../locales
|
|
4
|
-
import type { DriveControls } from "../react
|
|
5
|
-
import type { CondenseScope } from "./condense
|
|
2
|
+
import type { DriveController, RemoteId, RootInfo } from "../core";
|
|
3
|
+
import type { DriveLocale } from "../locales";
|
|
4
|
+
import type { DriveControls } from "../react";
|
|
5
|
+
import type { CondenseScope } from "./condense";
|
|
6
6
|
type KnownRoot = Pick<RootInfo, "projectId" | "name" | "localPath" | "drivePath">;
|
|
7
7
|
export declare function resolveDriveRoot<R extends KnownRoot>(path: string, roots: readonly R[]): {
|
|
8
8
|
root: R;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{x,h,Le,Fe}from"../chunk-563we221.js";import"../chunk-njfqtysa.js";export{Le as DriveFileActions,Fe as DriveMoveDialog,h as resolveCondenseScope,x as resolveDriveRoot};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RemoteId } from "../contract
|
|
1
|
+
import type { RemoteId } from "../contract";
|
|
2
2
|
export declare function driveFileWebUrl(webBaseUrl: string, fileId: RemoteId): string;
|
|
3
3
|
export declare function driveFileDeepLink(fileId: RemoteId): string;
|
|
4
4
|
export declare function parseDriveFileDeepLinkPath(pathname: string): RemoteId | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{k,R,qe}from"../chunk-njfqtysa.js";export{R as driveFileDeepLink,k as driveFileWebUrl,qe as parseDriveFileDeepLinkPath};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ee}from"../chunk-nf37g7p6.js";import"../chunk-vtjd21bw.js";import"../chunk-mafn36hy.js";export{ee as FrontmatterPanel};
|