@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.
Files changed (125) hide show
  1. package/dist/badge-react.d.ts +2 -2
  2. package/dist/badge-react.js +1 -1
  3. package/dist/badge.d.ts +1 -1
  4. package/dist/badge.js +1 -1
  5. package/dist/browse.d.ts +1 -1
  6. package/dist/browse.js +1 -1
  7. package/dist/chunk-0mx45c8q.js +2 -0
  8. package/dist/chunk-13ret1k0.js +188 -0
  9. package/dist/chunk-2343nj4p.js +2 -0
  10. package/dist/chunk-2n0p7j2f.js +2 -0
  11. package/dist/chunk-2ss7362z.js +2 -0
  12. package/dist/chunk-34qgf6be.js +2 -0
  13. package/dist/chunk-3fpcak8h.js +2 -0
  14. package/dist/chunk-4rfsdwgj.js +2 -0
  15. package/dist/chunk-52ccz07b.js +2 -0
  16. package/dist/chunk-563we221.js +2 -0
  17. package/dist/chunk-8765ztht.js +2 -0
  18. package/dist/chunk-8gmexfjt.js +3 -0
  19. package/dist/chunk-8sdw30dr.js +2 -0
  20. package/dist/chunk-ayvem7j8.js +2 -0
  21. package/dist/chunk-bh4wjd78.js +2 -0
  22. package/dist/chunk-dep1erts.js +2 -0
  23. package/dist/chunk-fkz75xv1.js +2 -0
  24. package/dist/chunk-g3pmrhm2.js +2 -0
  25. package/dist/chunk-j234gbr1.js +4 -0
  26. package/dist/chunk-j2mc48dt.js +2 -0
  27. package/dist/chunk-jxs49r5w.js +2 -0
  28. package/dist/chunk-kzjc8c8g.js +3 -0
  29. package/dist/chunk-m3kvhnag.js +3 -0
  30. package/dist/chunk-m6a9k1p0.js +2 -0
  31. package/dist/chunk-mafn36hy.js +2 -0
  32. package/dist/chunk-mz5601y4.js +2 -0
  33. package/dist/chunk-n7wnyds6.js +2 -0
  34. package/dist/chunk-n9sgwcq1.js +2 -0
  35. package/dist/chunk-nf37g7p6.js +2 -0
  36. package/dist/chunk-njfqtysa.js +2 -0
  37. package/dist/chunk-nk64fv7b.js +2 -0
  38. package/dist/chunk-p7y39rr7.js +2 -0
  39. package/dist/chunk-pbxjprxa.js +2 -0
  40. package/dist/chunk-pc21jzd8.js +3 -0
  41. package/dist/chunk-qabnvepm.js +2 -0
  42. package/dist/chunk-qf5g053e.js +2 -0
  43. package/dist/chunk-rg43mads.js +2 -0
  44. package/dist/chunk-t4vq7jva.js +2 -0
  45. package/dist/chunk-vpew2mps.js +2 -0
  46. package/dist/chunk-vtjd21bw.js +8 -0
  47. package/dist/chunk-ws1dtw35.js +2 -0
  48. package/dist/chunk-zf44znpx.js +2 -0
  49. package/dist/content/chat-condense.d.ts +4 -4
  50. package/dist/content/chat-condense.js +1 -1
  51. package/dist/content/collab.d.ts +1 -1
  52. package/dist/content/collab.js +1 -1
  53. package/dist/content/comment-anchors.js +1 -2
  54. package/dist/content/comment-decorations.d.ts +1 -1
  55. package/dist/content/comment-decorations.js +1 -3
  56. package/dist/content/comment-drawer.d.ts +2 -2
  57. package/dist/content/comment-drawer.js +1 -1
  58. package/dist/content/comment-mentions.d.ts +1 -1
  59. package/dist/content/comment-mentions.js +1 -1
  60. package/dist/content/comment-surface.d.ts +3 -3
  61. package/dist/content/comment-surface.js +1 -1
  62. package/dist/content/condense-task.d.ts +2 -2
  63. package/dist/content/condense-task.js +1 -1
  64. package/dist/content/condense.d.ts +3 -3
  65. package/dist/content/condense.js +1 -1
  66. package/dist/content/editor.d.ts +1 -1
  67. package/dist/content/editor.js +1 -1
  68. package/dist/content/file-actions.d.ts +4 -4
  69. package/dist/content/file-actions.js +1 -1
  70. package/dist/content/file-link.d.ts +1 -1
  71. package/dist/content/file-link.js +1 -1
  72. package/dist/content/frontmatter-panel.js +1 -1
  73. package/dist/content/frontmatter.js +1 -7
  74. package/dist/content/host.d.ts +2 -2
  75. package/dist/content/host.js +1 -1
  76. package/dist/content/html-bridge.js +1 -187
  77. package/dist/content/html-comments.js +1 -1
  78. package/dist/content/markdown-comments.d.ts +1 -1
  79. package/dist/content/markdown-comments.js +1 -2
  80. package/dist/content/mention-picker.d.ts +2 -2
  81. package/dist/content/mention-picker.js +1 -1
  82. package/dist/content/save-version.d.ts +1 -1
  83. package/dist/content/save-version.js +1 -1
  84. package/dist/content/translations.d.ts +1 -1
  85. package/dist/content/translations.js +1 -1
  86. package/dist/content/use-file-comments.d.ts +1 -1
  87. package/dist/content/use-file-comments.js +1 -1
  88. package/dist/content/yuplink.d.ts +1 -1
  89. package/dist/content/yuplink.js +1 -2
  90. package/dist/content.d.ts +10 -10
  91. package/dist/content.js +1 -1
  92. package/dist/core.d.ts +4 -4
  93. package/dist/core.js +1 -1
  94. package/dist/files.d.ts +1 -1
  95. package/dist/files.js +1 -1
  96. package/dist/global-search.js +1 -1
  97. package/dist/icons.js +1 -1
  98. package/dist/launcher.d.ts +3 -3
  99. package/dist/launcher.js +1 -2
  100. package/dist/locales.d.ts +2 -2
  101. package/dist/locales.js +1 -1
  102. package/dist/mass-delete.d.ts +3 -3
  103. package/dist/mass-delete.js +1 -1
  104. package/dist/notifications.js +1 -1
  105. package/dist/pinned-docs.js +1 -1
  106. package/dist/pinned.d.ts +3 -3
  107. package/dist/pinned.js +1 -1
  108. package/dist/react.d.ts +14 -14
  109. package/dist/react.js +1 -1
  110. package/dist/roots.d.ts +1 -1
  111. package/dist/roots.js +1 -1
  112. package/dist/settings.d.ts +3 -3
  113. package/dist/settings.js +1 -1
  114. package/dist/sharing.d.ts +3 -3
  115. package/dist/sharing.js +1 -1
  116. package/dist/status.d.ts +4 -4
  117. package/dist/status.js +1 -1
  118. package/dist/summary.d.ts +1 -1
  119. package/dist/summary.js +1 -1
  120. package/dist/tauri.d.ts +1 -1
  121. package/dist/transfer-feed.d.ts +1 -1
  122. package/dist/transfer-feed.js +1 -1
  123. package/dist/ui.d.ts +3 -3
  124. package/dist/ui.js +1 -1
  125. package/package.json +11 -11
@@ -1,7 +1,7 @@
1
1
  import type { ReactNode } from "react";
2
- import type { DriveController } from "./core.js";
3
- import { type DriveLocale } from "./locales.js";
4
- import { type DriveControls } from "./ui.js";
2
+ import type { DriveController } from "./core";
3
+ import { type DriveLocale } from "./locales";
4
+ import { type DriveControls } from "./ui";
5
5
  export declare function DriveMassDeleteDialog({ controller, controls, locale }: {
6
6
  controller: DriveController;
7
7
  controls: DriveControls;
@@ -1 +1 @@
1
- import{jsx as s,jsxs as u}from"react/jsx-runtime";import{driveTranslator as m}from"./locales.js";import{DriveModal as D,useDrive as v,useDriveAction as h}from"./ui.js";function x({controller:r,controls:o,locale:n}){let{snapshot:e}=v(r),t=e?.pendingDeletes[0];if(!t)return null;return s(j,{controller:r,controls:o,locale:n,current:t},`${e.generation}:${t.projectId}`)}function j({controller:r,controls:o,locale:n,current:e}){let t=m(n),{Button:c}=o,{busy:i,error:l,run:a}=h(),d=()=>a(()=>r.request({type:"cancelDeletes",projectId:e.projectId}));return u(D,{controls:o,open:!0,title:t("massDelete.title",{count:e.count}),description:t("massDelete.desc",{count:e.count,project:e.drivePath}),onOpenChange:(p)=>{if(!p&&!i)d()},children:[l&&s("p",{role:"alert",className:"alwith-drive-error",children:l}),u("div",{className:"alwith-drive-actions",children:[s(c,{type:"button",variant:"outline",autoFocus:!0,disabled:i,onClick:d,children:t("massDelete.cancel")}),s(c,{type:"button",variant:"destructive",disabled:i,onClick:()=>a(()=>r.request({type:"confirmDeletes",projectId:e.projectId})),children:t("massDelete.confirm")})]})]})}export{x as DriveMassDeleteDialog};
1
+ import{He}from"./chunk-52ccz07b.js";import"./chunk-ws1dtw35.js";import"./chunk-3fpcak8h.js";export{He as DriveMassDeleteDialog};
@@ -1 +1 @@
1
- import{jsx as i}from"react/jsx-runtime";import{createContext as l,useContext as x,useEffect as a,useMemo as p}from"react";var c=l(null);function h({notify:r,children:t}){let u=p(()=>{let o=new Map;return{success:(e)=>r.success(e),error:(e)=>{let n=Date.now();for(let[s,f]of o)if(n-f>=30000)o.delete(s);if(o.has(e))return;o.set(e,n),r.error(e)}}},[r]);return i(c.Provider,{value:u,children:t})}function v(){return x(c)}function w({message:r}){let t=v();return a(()=>{if(r&&t)t.error(r)},[r,t]),!t&&r?i("p",{role:"alert",className:"alwith-drive-error",children:r}):null}export{w as DriveNotice,h as DriveNotificationProvider,v as useDriveNotifications};
1
+ import{Ve,_,u}from"./chunk-ayvem7j8.js";export{u as DriveNotice,Ve as DriveNotificationProvider,_ as useDriveNotifications};
@@ -1 +1 @@
1
- function o(t){return t.replaceAll("\\","/").replace(/\/+$/,"")||t}function p(t,n){let e=o(n);return t.some((r)=>o(r.path)===e)}function c(t,n){if(p(t,n.path))return[...t];return[...t,{path:o(n.path),name:n.name,kind:n.kind}]}function s(t,n){let e=o(n);return t.filter((r)=>o(r.path)!==e)}function d(t,n){return p(t,n.path)?s(t,n.path):c(t,n)}function m(t,n){return t.filter((e)=>n(e.path))}function x(t){if(!Array.isArray(t))return[];let n=[];for(let e of t){if(typeof e!=="object"||e===null)continue;let{path:r,name:i}=e;if(typeof r!=="string"||r==="")continue;let a=o(r);if(n.some((f)=>f.path===a))continue;let{kind:u}=e;n.push({path:a,name:typeof i==="string"&&i!==""?i:h(a),kind:u==="dir"?"dir":"file"})}return n}function h(t){let n=o(t),e=n.lastIndexOf("/");return e!==-1?n.slice(e+1):n}export{c as addPinned,h as basenameOf,p as isPinned,o as normalizePinnedPath,x as parsePinnedDocs,m as prunePinned,s as removePinned,d as togglePinned};
1
+ import{p,U,Re,C,N,yt,Qe,st}from"./chunk-p7y39rr7.js";export{Re as addPinned,st as basenameOf,U as isPinned,p as normalizePinnedPath,Qe as parsePinnedDocs,yt as prunePinned,C as removePinned,N as togglePinned};
package/dist/pinned.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { type ReactNode } from "react";
2
- import type { DriveController, RootInfo } from "./core.js";
3
- import { type DriveLocale } from "./locales.js";
4
- import { type DriveControls, type DriveHost } from "./ui.js";
2
+ import type { DriveController, RootInfo } from "./core";
3
+ import { type DriveLocale } from "./locales";
4
+ import { type DriveControls, type DriveHost } from "./ui";
5
5
  export declare function DrivePinnedDocs({ host, controls, locale, generation, controller, onOpenProject }: {
6
6
  host: DriveHost;
7
7
  controls: DriveControls;
package/dist/pinned.js CHANGED
@@ -1 +1 @@
1
- import{jsx as r,jsxs as l}from"react/jsx-runtime";import{useEffect as I,useEffectEvent as w,useState as c}from"react";import{DriveIcon as N}from"./icons.js";import{driveTranslator as T}from"./locales.js";import{removePinned as b}from"./pinned-docs.js";import{DriveMenu as M,useDriveAction as O}from"./ui.js";function G({host:n,controls:d,locale:D,generation:x,controller:s,onOpenProject:E}){let{Button:j}=d,p=T(D),{error:m,run:u}=O(),[h,f]=c(new Set),[v,g]=c(null),[P,S]=c(!0),k=n.pinnedDocs.map((t)=>t.path).join("\x00"),y=w(()=>n.pinnedDocs),C=w((t)=>n.pathExists(t));if(I(()=>{let t=!0;f(new Set),g(null);let o=y(),i=s.getSnapshot().snapshot?.roots??[];return Promise.all(o.map(async(e)=>({path:e.path,exists:i.some((a)=>a.drivePath&&a.localPath===e.path&&e.kind==="dir")||await C(e.path)}))).then((e)=>{if(t)f(new Set(e.filter((a)=>!a.exists).map((a)=>a.path)))}).catch((e)=>{if(t)g(String(e))}),()=>{t=!1}},[k,x,n.pathExists,s]),!n.pinnedDocs.length)return null;return l("details",{open:P,onToggle:(t)=>S(t.currentTarget.open),className:"alwith-drive-group",children:[l("summary",{children:[p("pinned.title"),r("span",{children:n.pinnedDocs.length})]}),(m||v)&&r("p",{role:"alert",className:"alwith-drive-error",children:m||v}),n.pinnedDocs.map((t)=>r(M,{controls:d,context:!0,label:t.name,items:[{label:p("pinned.unpin"),onSelect:()=>u(()=>n.onPinnedDocsChange(b(n.pinnedDocs,t.path)))}],children:l(j,{variant:"ghost",className:"alwith-drive-nav-open","data-missing":h.has(t.path),title:h.has(t.path)?`${t.path} — ${p("pinned.missing")}`:t.path,onClick:()=>u(async()=>{let o=s.getSnapshot().snapshot?.roots.find((i)=>i.drivePath&&i.localPath===t.path&&t.kind==="dir");if(o&&!await n.pathExists(t.path)){let i=await s.request({type:"land",projectId:o.projectId});if(i.type!=="root")throw Error("Drive did not return a landed project");await E(i.data);return}if(h.has(t.path)||!await n.pathExists(t.path))throw Error(p("pinned.missing"));await n.onOpenEntry({path:t.path,isDirectory:t.kind==="dir"})}),children:[r(N,{name:t.kind==="dir"?"folder":"file"}),r("span",{children:t.name})]})},t.path))]})}export{G as DrivePinnedDocs};
1
+ import{ke}from"./chunk-2n0p7j2f.js";import"./chunk-n7wnyds6.js";import"./chunk-p7y39rr7.js";import"./chunk-ws1dtw35.js";import"./chunk-3fpcak8h.js";export{ke as DrivePinnedDocs};
package/dist/react.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- export { DriveNotificationProvider } from "./notifications.js";
1
+ export { DriveNotificationProvider } from "./notifications";
2
2
  import type { ReactNode } from "react";
3
- import type { DriveController, RootInfo } from "./core.js";
4
- import { type DriveLocale } from "./locales.js";
5
- import { type DriveControls, type DriveHost } from "./ui.js";
6
- export { DriveSharing } from "./sharing.js";
7
- export { useDrive } from "./ui.js";
8
- export type { DriveControls, DriveHost, DriveMenuProps } from "./ui.js";
9
- export { driveTranslator, driveLocales, type DriveLocale } from "./locales.js";
10
- export { addPinned, removePinned, togglePinned, parsePinnedDocs, isPinned, type PinnedDoc } from "./pinned-docs.js";
11
- export type { ReadDirLike } from "./global-search.js";
3
+ import type { DriveController, RootInfo } from "./core";
4
+ import { type DriveLocale } from "./locales";
5
+ import { type DriveControls, type DriveHost } from "./ui";
6
+ export { DriveSharing } from "./sharing";
7
+ export { useDrive } from "./ui";
8
+ export type { DriveControls, DriveHost, DriveMenuProps } from "./ui";
9
+ export { driveTranslator, driveLocales, type DriveLocale } from "./locales";
10
+ export { addPinned, removePinned, togglePinned, parsePinnedDocs, isPinned, type PinnedDoc } from "./pinned-docs";
11
+ export type { ReadDirLike } from "./global-search";
12
12
  export interface DrivePanelProps {
13
13
  controller: DriveController;
14
14
  controls: DriveControls;
@@ -23,7 +23,7 @@ export interface DrivePanelProps {
23
23
  chooseDirectory?: () => Promise<string | null>;
24
24
  }
25
25
  export declare function DrivePanel(props: DrivePanelProps): ReactNode;
26
- export { summarize, failureKey, engineStateKey } from "./summary.js";
27
- export { DriveBadge } from "./badge-react.js";
28
- export { badgeFor, aggregateDirBadge, type DriveBadgeDescriptor } from "./badge.js";
29
- export { DriveMassDeleteDialog } from "./mass-delete.js";
26
+ export { summarize, failureKey, engineStateKey } from "./summary";
27
+ export { DriveBadge } from "./badge-react";
28
+ export { badgeFor, aggregateDirBadge, type DriveBadgeDescriptor } from "./badge";
29
+ export { DriveMassDeleteDialog } from "./mass-delete";
package/dist/react.js CHANGED
@@ -1 +1 @@
1
- import{jsx as r,Fragment as d,jsxs as l}from"react/jsx-runtime";import{DriveNotice as u}from"./notifications.js";import{DriveNotificationProvider as C}from"./notifications.js";import{DriveLauncher as v}from"./launcher.js";import{driveTranslator as h}from"./locales.js";import{DriveSettings as p}from"./settings.js";import{DriveStatus as D,useTransferFeed as x}from"./status.js";import{useDrive as P,useDriveAction as b}from"./ui.js";import{DriveSharing as K}from"./sharing.js";import{useDrive as z}from"./ui.js";import{driveTranslator as H,driveLocales as M}from"./locales.js";import{addPinned as q,removePinned as E,togglePinned as G,parsePinnedDocs as J,isPinned as Q}from"./pinned-docs.js";import{summarize as U,failureKey as V,engineStateKey as W}from"./summary.js";import{DriveBadge as Y}from"./badge-react.js";import{badgeFor as ee,aggregateDirBadge as re}from"./badge.js";import{DriveMassDeleteDialog as ie}from"./mass-delete.js";function T(i){let{controller:s,controls:{Button:c},mode:e="all",locale:m}=i,{connected:f,snapshot:t,error:a}=P(s),o=b(),g=x(s),n=h(m);return l("section",{className:`alwith-drive alwith-drive-${e}`,"aria-label":n("title"),children:[e==="launcher"?r(u,{message:a||o.error||t?.error}):(a||o.error||t?.error)&&r("p",{role:"alert",className:"alwith-drive-error",children:a||o.error||t?.error}),!f?e==="settings"&&(o.busy||!(a||o.error))?r("p",{role:"status",className:"alwith-drive-muted",children:n("panel.connecting")}):r(c,{disabled:o.busy,onClick:()=>o.run(()=>s.attach()),children:n("panel.refresh")}):e==="settings"||!t?.configured&&e==="all"?r(p,{...i}):!t?.configured?l(d,{children:[r("p",{children:n("panel.signInHint")}),r(c,{variant:"outline",onClick:i.onOpenSettings,children:n("panel.signIn")})]}):l(d,{children:[(e==="launcher"||e==="all")&&r(v,{...i}),(e==="status"||e==="all")&&r(D,{...i,feed:g})]})]})}export{Y as DriveBadge,ie as DriveMassDeleteDialog,C as DriveNotificationProvider,T as DrivePanel,K as DriveSharing,q as addPinned,re as aggregateDirBadge,ee as badgeFor,M as driveLocales,H as driveTranslator,W as engineStateKey,V as failureKey,Q as isPinned,J as parsePinnedDocs,E as removePinned,U as summarize,G as togglePinned,z as useDrive};
1
+ import{Ve,u}from"./chunk-ayvem7j8.js";import"./chunk-2343nj4p.js";import"./chunk-dep1erts.js";import"./chunk-n7wnyds6.js";import{Ne,e}from"./chunk-3fpcak8h.js";import{U,Re,C,N,Qe}from"./chunk-p7y39rr7.js";import{t,n}from"./chunk-ws1dtw35.js";import"./chunk-2n0p7j2f.js";import{ve}from"./chunk-m3kvhnag.js";import"./chunk-vpew2mps.js";import"./chunk-nk64fv7b.js";import{De,Ie}from"./chunk-qf5g053e.js";import{Se}from"./chunk-8765ztht.js";import{We}from"./chunk-g3pmrhm2.js";import{Ke,ye,Ye}from"./chunk-mz5601y4.js";import{g,T}from"./chunk-t4vq7jva.js";import{Ze}from"./chunk-0mx45c8q.js";import{He}from"./chunk-52ccz07b.js";import{jsxDEV as r,Fragment as v}from"react/jsx-dev-runtime";function L(a){let{controller:p,controls:{Button:m},mode:o="all",locale:d}=a,{connected:D,snapshot:l,error:c}=t(p),i=n(),f=De(p),s=e(d);return r("section",{className:`alwith-drive alwith-drive-${o}`,"aria-label":s("title"),children:[o==="launcher"?r(u,{message:c||i.error||l?.error},void 0,!1,void 0,this):(c||i.error||l?.error)&&r("p",{role:"alert",className:"alwith-drive-error",children:c||i.error||l?.error},void 0,!1,void 0,this),!D?o==="settings"&&(i.busy||!(c||i.error))?r("p",{role:"status",className:"alwith-drive-muted",children:s("panel.connecting")},void 0,!1,void 0,this):r(m,{disabled:i.busy,onClick:()=>i.run(()=>p.attach()),children:s("panel.refresh")},void 0,!1,void 0,this):o==="settings"||!l?.configured&&o==="all"?r(Se,{...a},void 0,!1,void 0,this):!l?.configured?r(v,{children:[r("p",{children:s("panel.signInHint")},void 0,!1,void 0,this),r(m,{variant:"outline",onClick:a.onOpenSettings,children:s("panel.signIn")},void 0,!1,void 0,this)]},void 0,!0,void 0,this):r(v,{children:[(o==="launcher"||o==="all")&&r(ve,{...a},void 0,!1,void 0,this),(o==="status"||o==="all")&&r(Ie,{...a,feed:f},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}export{Ze as DriveBadge,He as DriveMassDeleteDialog,Ve as DriveNotificationProvider,L as DrivePanel,We as DriveSharing,Re as addPinned,T as aggregateDirBadge,g as badgeFor,Ne as driveLocales,e as driveTranslator,Ke as engineStateKey,ye as failureKey,U as isPinned,Qe as parsePinnedDocs,C as removePinned,Ye as summarize,N as togglePinned,t as useDrive};
package/dist/roots.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { CleanupReport, OwnershipGuard, RootInfo } from "./core.js";
1
+ import type { CleanupReport, OwnershipGuard, RootInfo } from "./core";
2
2
  export declare function isOwnPersonal(root: RootInfo): boolean;
3
3
  export declare function isOtherPersonal(root: RootInfo): boolean;
4
4
  export declare function shouldWarnOwnershipGuard(guard: OwnershipGuard | null): boolean;
package/dist/roots.js CHANGED
@@ -1 +1 @@
1
- function i(e){return e.scope==="PERSONAL"&&e.isMine!==!1}function s(e){return e.scope==="PERSONAL"&&e.isMine===!1}function t(e){return e?.active===!0}function r(e){if(!e.syncEnabled)return!1;return e.pinned||!e.selected}function p(e){return{total:e.skipped.length,pinned:e.skipped.filter((n)=>n.reason==="pinned").length,pendingChanges:e.skipped.filter((n)=>n.reason==="pendingChanges").length}}export{r as canToggleSync,s as isOtherPersonal,i as isOwnPersonal,t as shouldWarnOwnershipGuard,p as skippedCounts};
1
+ import{pt,mt,gt,Ce,ht}from"./chunk-vpew2mps.js";export{Ce as canToggleSync,mt as isOtherPersonal,pt as isOwnPersonal,gt as shouldWarnOwnershipGuard,ht as skippedCounts};
@@ -1,7 +1,7 @@
1
1
  import { type ReactNode } from "react";
2
- import type { DriveController } from "./core.js";
3
- import { type DriveLocale } from "./locales.js";
4
- import { type DriveControls, type DriveHost } from "./ui.js";
2
+ import type { DriveController } from "./core";
3
+ import { type DriveLocale } from "./locales";
4
+ import { type DriveControls, type DriveHost } from "./ui";
5
5
  export interface DriveSettingsProps {
6
6
  controller: DriveController;
7
7
  controls: DriveControls;
package/dist/settings.js CHANGED
@@ -1 +1 @@
1
- import{jsx as n,jsxs as t,Fragment as te}from"react/jsx-runtime";import{useEffect as q,useState as h}from"react";import{driveTranslator as ae}from"./locales.js";import{canToggleSync as se}from"./roots.js";import{formatDriveBytes as G}from"./status.js";import{DriveSwitch as P,requireHost as le,useDrive as oe,useDriveAction as de}from"./ui.js";function ve({controller:l,controls:w,host:I,locale:_,defaultBaseUrl:R="",chooseDirectory:K,confirm:D}){let{Button:u,Input:b,Dialog:S}=w,{snapshot:a}=oe(l),{busy:o,error:z,run:s}=de(),[p,H]=h(a?.baseUrl||R),[v,E]=h(a?.localRoot??""),[x,j]=h(""),[re,A]=h(!1),[k,W]=h(null),[C,J]=h(""),[f,Q]=h(null),[V,N]=h([]),[g,O]=h(null),[y,X]=h(null),[c,U]=h(null),[B,M]=h(null),[Y,T]=h(null),[Z,ee]=h(null),i=ae(_,"settings"),F=ae(_);q(()=>{H(a?.baseUrl||R),E(a?.localRoot??""),j(""),X(null),U(null),Q(null),N([])},[a?.generation,R,a?.baseUrl,a?.localRoot]),q(()=>{if(M(null),!a?.configured)return;let e=!0;return Promise.all([l.request({type:"maxAutoDownloadMb"}),l.request({type:"configuration"})]).then(([r,d])=>{if(r.type!=="maxAutoDownloadMb"||d.type!=="configuration")throw Error("Invalid Drive preferences");if(e)J(String(r.data)),Q(d.data),M(null)}).catch((r)=>{if(e)M(String(r))}),()=>{e=!1}},[l,a?.generation,a?.configured]),q(()=>{if(T(null),O(null),N([]),!a?.configured||!a.running)return;let e=!0;return Promise.all([l.request({type:"ownershipGuard"}),l.request({type:"skillMirrors"})]).then(([r,d])=>{if(r.type!=="ownershipGuard"||d.type!=="skillMirrors")throw Error("Invalid Drive runtime preferences");if(e)O(r.data),N(d.data),T(null)}).catch((r)=>{if(e)T(String(r))}),()=>{e=!1}},[l,a?.generation,a?.configured,a?.running]),q(()=>{if(ee(null),a?.configured||!/^https?:\/\/\S+$/.test(p)){A(!1);return}let e=!0,r=setTimeout(()=>{l.request({type:"ssoConfig",baseUrl:p.trim()}).then((d)=>{if(d.type!=="ssoConfig")throw Error("Invalid SSO configuration");if(e)A(d.data.enabled)}).catch((d)=>{if(e)A(!1),ee(String(d))})},300);return()=>{e=!1,clearTimeout(r)}},[l,a?.configured,p]);let ie=async(e)=>{let r=x.trim();j("");let d=await l.request(e?{type:"ssoLogin",baseUrl:p.trim(),localRoot:v.trim()}:{type:"login",baseUrl:p.trim(),localRoot:v.trim(),token:r});if(d.type==="rootOwnershipConfirmation"){if(!S)throw await l.request({type:"resolveRootOwnership",generation:d.data.generation,accept:!1}),Error("Drive directory confirmation requires a dialog host");W({generation:d.data.generation,localRoot:d.data.localRoot});return}await l.request({type:"start"})},L=async(e)=>{if(!k)throw Error("No pending Drive directory confirmation");try{if(await l.request({type:"resolveRootOwnership",generation:k.generation,accept:e}),e)await l.request({type:"start"})}finally{W(null)}},m=a?.running??!1;return t(te,{children:[S&&k&&n(S,{open:!0,title:i("ownership.title"),description:i("ownership.description",{path:k.localRoot}),onOpenChange:(e)=>{if(!e&&!o)s(()=>L(!1))},children:t("div",{className:"alwith-drive-actions",children:[n(u,{variant:"outline",disabled:o,onClick:()=>s(()=>L(!1)),children:i("ownership.cancel")}),n(u,{disabled:o,onClick:()=>s(()=>L(!0)),children:i("ownership.continue")})]})}),n("header",{children:n("h2",{children:F("title")})}),(z||B||Y||Z)&&n("p",{role:"alert",className:"alwith-drive-error",children:z||B||Y||Z}),t("section",{className:"alwith-drive-setting",children:[t("div",{children:[n("h3",{children:i("login.title")}),n("p",{children:a?.configured?f===null?i(B?"login.loadFailed":"login.loading"):f.deviceId?i("login.registered",{deviceId:f.deviceId}):i("login.unregistered"):i("login.desc")})]}),a?.configured?t("div",{className:"alwith-drive-actions",children:[n(u,{variant:"outline",disabled:o,onClick:()=>s(async()=>{if(await D(i("login.logout")))await l.request({type:"logout"})}),children:i("login.logout")}),!m&&n(u,{disabled:o,onClick:()=>s(()=>l.request({type:"start"})),children:F("resume")})]}):t("form",{className:"alwith-drive-form",onSubmit:(e)=>{e.preventDefault(),s(()=>ie(!1))},children:[n(b,{type:"password",autoComplete:"off","aria-label":i("login.tokenPlaceholder"),placeholder:i("login.tokenPlaceholder"),value:x,onChange:(e)=>j(e.target.value)}),t("div",{className:"alwith-drive-actions",children:[n(u,{type:"submit",disabled:o||!x.trim()||!p.trim()||!v.trim(),children:i("login.register")}),re&&n(u,{type:"button",variant:"outline",disabled:o||!v.trim(),onClick:()=>s(()=>ie(!0)),children:i("sso.open")})]})]})]}),t("section",{className:"alwith-drive-setting",children:[t("div",{children:[n("h3",{children:i("localRoot.title")}),n("p",{children:v})]}),t("div",{className:"alwith-drive-actions",children:[!a?.configured&&n(b,{value:v,"aria-label":i("localRoot.title"),onChange:(e)=>E(e.target.value)}),K&&n(u,{variant:"outline",disabled:o,onClick:()=>s(async()=>{let e=await K();if(!e)return;if(a?.configured){if(!f)throw Error("Drive configuration is still loading");await l.request({type:"reconfigure",localRoot:e,userName:f.userName??""})}E(e)}),children:i("localRoot.choose")})]})]}),a?.configured&&t(te,{children:[t("section",{className:"alwith-drive-setting",children:[t("div",{children:[n("h3",{children:i("maxAutoDownload.title")}),n("p",{children:i("maxAutoDownload.desc")})]}),t("div",{className:"alwith-drive-actions",children:[n(b,{type:"number",min:0,max:1048576,step:1,"aria-label":i("maxAutoDownload.title"),value:C,onChange:(e)=>J(e.target.value),onBlur:()=>{if(/^\d+$/.test(C)&&Number(C)<=1048576)s(()=>l.request({type:"setMaxAutoDownloadMb",megabytes:Number(C)}))},disabled:o}),n("small",{children:i("maxAutoDownload.unit")})]})]}),t("section",{className:"alwith-drive-setting",children:[t("div",{children:[n("h3",{children:i("pause.title")}),n("p",{children:i("pause.desc")})]}),n(P,{controls:w,"aria-label":i("pause.title"),checked:a.status?.state.kind==="paused",disabled:o||!m,onCheckedChange:(e)=>s(()=>l.request({type:"pause",paused:e}))})]}),g&&g.unknownPersonalRoots>g.threshold&&t("section",{className:"alwith-drive-setting",children:[t("div",{children:[n("h3",{children:i("guard.title")}),n("p",{children:i("guard.desc",{count:g.unknownPersonalRoots})})]}),n(P,{controls:w,"aria-label":i("guard.title"),checked:g.syncAllPersonal,disabled:o,onCheckedChange:(e)=>{let r=e;s(async()=>{if(r&&!await D(F("panel.guard.confirmDesc",{count:g.unknownPersonalRoots})))return;await l.request({type:"syncAllPersonal",enabled:r}),O({...g,syncAllPersonal:r,active:!r})})}})]}),t("details",{children:[n("summary",{children:i("roots.title")}),a.roots.filter((e)=>e.kind!=="SKILL"&&e.projectKey!=="ai-session-archive").map((e)=>t("label",{className:"alwith-drive-setting",children:[t("span",{children:[e.drivePath||e.name,!e.canWrite&&t("small",{children:[" · ",i("roots.readOnly")]})]}),n(P,{controls:w,"aria-label":e.name,checked:e.selected,disabled:o||!m||!se(e),onCheckedChange:(r)=>s(()=>l.request({type:"pin",projectId:e.projectId,pinned:r}))})]},String(e.projectId)))]}),t("section",{className:"alwith-drive-setting",children:[t("div",{children:[n("h3",{children:i("usage.title")}),n("p",{children:i("usage.desc")})]}),n(u,{variant:"outline",disabled:o||!m,onClick:()=>s(async()=>{let e=await l.request({type:"diskUsage",limit:20});if(e.type!=="diskUsage")throw Error("Invalid disk usage response");X(e.data)}),children:i("usage.action")})]}),y&&t("section",{children:[n("p",{children:i("usage.total",{size:G(y.totalBytes),count:y.totalFiles})}),n("h4",{children:i("usage.byProject")}),y.projects.map((e)=>t(u,{variant:"ghost",className:"alwith-drive-row",onClick:()=>s(()=>le(I).onRevealPath(e.localPath)),children:[n("span",{children:e.name}),t("small",{children:[G(e.bytes)," · ",i("usage.files",{count:e.files})]})]},String(e.projectId))),n("h4",{children:i("usage.byFile")}),y.files.map((e)=>t(u,{variant:"ghost",className:"alwith-drive-row",onClick:()=>s(()=>le(I).onRevealPath(e.localPath)),children:[t("span",{children:[e.projectName," / ",e.path]}),n("small",{children:G(e.bytes)})]},e.localPath))]}),t("section",{className:"alwith-drive-setting",children:[t("div",{children:[n("h3",{children:i("cleanup.title")}),n("p",{children:i("cleanup.desc")})]}),n(u,{variant:"outline",disabled:o||!m,onClick:()=>s(async()=>{let e=await l.request({type:"cleanupScan"});if(e.type!=="cleanup")throw Error("Invalid cleanup response");U(e.data)}),children:i("cleanup.scan")})]}),c&&t("section",{children:[!c.candidates.length&&!c.moved.length&&n("p",{children:i("cleanup.nothing")}),c.candidates.map((e)=>t("p",{children:[e.drivePath," · ",e.files]},e.localPath)),c.skipped.length>0&&t("p",{children:[i("cleanup.skipped",{count:c.skipped.length}),":"," ",c.skipped.map((e)=>`${e.name} (${i(e.reason==="pinned"?"cleanup.skippedPinned":"cleanup.skippedPending",{count:1})})`).join(", ")]}),c.failed.map((e)=>n("p",{className:"alwith-drive-error",children:e},e)),c.moved.length>0?n("p",{children:i("cleanup.done",{count:c.moved.length,dir:c.stagingDir})}):c.candidates.length>0&&n(u,{variant:"outline",disabled:o,onClick:()=>s(async()=>{if(!await D(i("cleanup.confirm",{count:c.candidates.length,dir:c.stagingDir})))return;let e=await l.request({type:"cleanup",paths:c.candidates.map((r)=>r.localPath)});if(e.type!=="cleanup")throw Error("Invalid cleanup response");U(e.data)}),children:i("cleanup.move")})]}),t("section",{className:"alwith-drive-setting",children:[t("div",{children:[n("h3",{children:i("cloudOnly.title")}),n("p",{children:i("cloudOnly.desc")})]}),n(u,{variant:"outline",disabled:o||!m,onClick:()=>s(()=>l.request({type:"recheckCloudOnly"})),children:i("cloudOnly.action")})]}),I?.integrations,t("section",{children:[n("h3",{children:i("skills.title")}),n("p",{children:i("skills.desc")}),V.map((e)=>t("div",{className:"alwith-drive-setting",children:[t("div",{children:[n("strong",{children:e.name}),n("p",{children:e.skillsPath??e.localPath}),t("small",{children:[i(e.installed?"skills.installed":"skills.notInstalled")," ·"," ",i(e.pinned?"skills.manual":e.autoInstalled?"skills.auto":"skills.notAuto")]})]}),n(P,{controls:w,checked:e.autoInstalled||e.pinned,"aria-label":e.name,disabled:o||!m||e.autoInstalled,onCheckedChange:(r)=>{let d=r;s(async()=>{await l.request({type:"pin",projectId:e.projectId,pinned:d});let ne=await l.request({type:"skillMirrors"});if(ne.type!=="skillMirrors")throw Error("Invalid skill installation response");N(ne.data)})}})]},String(e.projectId))),!V.length&&n("p",{children:i("skills.empty")})]})]}),t("details",{children:[n("summary",{children:i("advanced.title")}),t("label",{children:[i("server.title"),n(b,{type:"url",value:p,disabled:o||a?.configured,onChange:(e)=>H(e.target.value)})]}),n("p",{children:i("server.desc")}),a?.webBaseUrl&&t("p",{children:[i("webBase.title"),": ",a.webBaseUrl]})]})]})}export{ve as DriveSettings};
1
+ import{Se}from"./chunk-8765ztht.js";import"./chunk-vpew2mps.js";import"./chunk-qf5g053e.js";import"./chunk-nk64fv7b.js";import"./chunk-ws1dtw35.js";import"./chunk-3fpcak8h.js";export{Se as DriveSettings};
package/dist/sharing.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { type ReactNode } from "react";
2
- import type { DriveController } from "./core.js";
3
- import { type DriveLocale } from "./locales.js";
4
- import { type DriveControls, type DriveHost } from "./ui.js";
2
+ import type { DriveController } from "./core";
3
+ import { type DriveLocale } from "./locales";
4
+ import { type DriveControls, type DriveHost } from "./ui";
5
5
  export declare function DriveSharing({ controller, path, controls, confirm, locale, host }: {
6
6
  controller: DriveController;
7
7
  path: string;
package/dist/sharing.js CHANGED
@@ -1 +1 @@
1
- import{jsx as s,jsxs as u,Fragment as U}from"react/jsx-runtime";import{useEffect as z,useRef as ee,useState as i}from"react";import{driveTranslator as te}from"./locales.js";import{DriveChoice as O,useDriveAction as se}from"./ui.js";function le({controller:l,path:h,controls:L,confirm:F,locale:K="en",host:P}){let{Button:p,Input:X}=L,t=te(K),[b,R]=i([]),[_,G]=i(h),[c,A]=i(null),[v,j]=i(null),[d,Y]=i("USER"),[w,f]=i(""),[M,C]=i([]),[E,I]=i(null),[D,Z]=i("VIEW"),[k,y]=i(null),[W,q]=i(null),[S,x]=i(!0),o=ee(0),{busy:m,error:V,run:g}=se();z(()=>{let e=o,r=++o.current;return x(!0),j(null),A(null),R([]),G(h),y(null),q(null),I(null),f(""),(async()=>{let a=await l.request({type:"grantTarget",path:h.replace(/\.yupcloud$/,"")});if(a.type!=="grantTarget")throw Error("Invalid sharing target");if(r!==o.current)return;if(A(a.data),a.data){let n=await l.request({type:"grants",target:a.data});if(n.type!=="grants")throw Error("Invalid sharing response");if(r===o.current)j(n.data)}})().catch((a)=>{if(r===o.current)q(String(a))}).finally(()=>{if(r===o.current)x(!1)}),()=>{e.current++}},[l,h]),z(()=>{if(C([]),I(null),!w.trim()||d==="ALL")return;let e=!0,r=setTimeout(()=>{l.request({type:d==="USER"?"searchUsers":"searchDepartments",query:w.trim()}).then((a)=>{if(!e)return;if(a.type==="users")C(a.data.map((n)=>({id:n.id,name:n.name??n.employeeNo??String(n.id)})));else if(a.type==="departments")C(a.data.map((n)=>({id:n.id,name:n.path??n.name})));else throw Error("Invalid collaborator search response")}).catch((a)=>{if(e)q(String(a))})},250);return()=>{e=!1,clearTimeout(r)}},[l,w,d]);let B=async(e,r,a=!1)=>{let n=o.current,Q=await l.request({type:"grants",target:e});if(n!==o.current)return;if(Q.type!=="grants")throw Error("Invalid sharing source response");if(a)R(b.slice(0,-1));else if(c)R([...b,{target:c,label:_}]);A(e),G(r),j(Q.data),y(null),I(null),f("")},N=async(e)=>{let r=o.current,a=await l.request(e);if(r!==o.current)return;if(a.type!=="grantWrite")throw Error("Invalid sharing update");if(a.data.kind==="applied")j(a.data.list),I(null),f(""),y(null);else if(a.data.kind==="custom")y(t("grants.customHint"));else y(t("grants.inheritedRemove.title",{name:"",source:a.data.inheritedFrom.display??t("grants.inheritedRemove.unknown")}))},J=l.getSnapshot().snapshot?.roots.filter((e)=>e.drivePath&&(h===e.localPath||h.startsWith(`${e.localPath}/`))).toSorted((e,r)=>r.localPath.length-e.localPath.length)[0],T=v?.callerLevel==="MANAGE",H=["VIEW","EDIT","MANAGE"].map((e)=>({value:e,label:t(`grants.level.${e}`)}));return u("div",{className:"alwith-drive alwith-drive-sharing","aria-busy":m||S,children:[s("h3",{children:t("grants.title")}),s("p",{children:_}),b.length>0&&s(p,{variant:"ghost",disabled:m,onClick:()=>g(async()=>{let e=b.at(-1);if(e)await B(e.target,e.label,!0)}),children:t("grants.back",{name:b.at(-1)?.label??h})}),(V||W)&&s("p",{className:"alwith-drive-error",role:"alert",children:V||W}),S&&s("p",{children:t("grants.loading")}),k&&s("p",{role:"status",children:k}),!S&&!c&&s("p",{children:t("grants.notInCloud")}),v&&u(U,{children:[s("h4",{children:t("grants.who.title")}),!T&&s("p",{children:t("grants.readOnly")}),(v.implicit??[]).map((e,r)=>u("div",{className:"alwith-drive-row",children:[u("span",{children:[e.subjectDisplay,s("small",{children:t(`grants.implicit.${["PROJECT_MANAGER","OWNER","FOLDER_CREATOR","GLOBAL_ADMIN"].includes(e.reason??"")?e.reason:"other"}`)})]}),s("small",{children:t(`grants.level.${e.level}`)})]},`implicit:${r}`)),(v.grants??[]).map((e)=>u("div",{className:"alwith-drive-row",children:[u("span",{children:[e.subjectDisplay??(e.subjectType==="ALL"?t("grants.add.all"):String(e.subjectId)),e.inherited&&(e.sourceResourceId!=null&&(e.source==="FILE"||e.source==="FOLDER")?s(p,{variant:"ghost",disabled:m,onClick:()=>g(()=>B({kind:e.source,id:e.sourceResourceId},e.sourceDisplay??String(e.sourceResourceId))),children:t("grants.who.inheritedFrom",{source:e.sourceDisplay??String(e.sourceResourceId)})}):s("small",{children:t("grants.who.inheritedFrom",{source:e.sourceDisplay??t("grants.who.space")})})),e.level==="CUSTOM"&&s("small",{title:(e.actions??[]).join(", "),children:t("grants.customHint")})]}),T&&e.editable&&!e.inherited&&e.level!=="CUSTOM"&&["USER","DEPT","ALL"].includes(e.subjectType)&&c?u(U,{children:[s(O,{controls:L,"aria-label":`${e.subjectDisplay??e.subjectId} ${t("grants.level.label")}`,value:e.level,options:H,disabled:m,onValueChange:(r)=>g(()=>N({type:"setGrant",target:c,request:{subjectType:e.subjectType,subjectId:e.subjectId,level:r}}))}),s(p,{variant:"ghost",disabled:m,onClick:()=>g(async()=>{if(await F(`${t("grants.remove")} ${e.subjectDisplay??e.subjectId}?`))await N({type:"removeGrant",target:c,subjectType:e.subjectType,subjectId:e.subjectId})}),children:t("grants.remove")})]}):s("small",{children:t(`grants.level.${e.level}`)})]},`${e.subjectType}:${e.subjectId}`)),!v.grants?.length&&!v.implicit?.length&&s("p",{children:t("grants.who.empty")})]}),T&&c&&u("section",{className:"alwith-drive-form",children:[s("h4",{children:t("grants.add.title")}),s(O,{controls:L,value:d,onValueChange:(e)=>{Y(e),f("")},options:["USER","DEPT","ALL"].map((e)=>({value:e,label:t(`grants.add.${e}`)}))}),d==="ALL"?s("p",{children:t("grants.add.allDesc")}):u(U,{children:[s(X,{value:w,onChange:(e)=>f(e.target.value),"aria-label":t(d==="USER"?"grants.add.searchUser":"grants.add.searchDept"),placeholder:t(d==="USER"?"grants.add.searchUser":"grants.add.searchDept")}),u("div",{children:[M.map((e)=>s(p,{variant:"ghost","aria-pressed":E?.id===e.id,onClick:()=>I(e),children:e.name},String(e.id))),w.trim()&&!M.length&&s("p",{children:t("grants.add.empty")})]}),E&&s("p",{children:t("grants.add.picked",{name:E.name})})]}),s(O,{controls:L,"aria-label":t("grants.level.label"),value:D,onValueChange:(e)=>Z(e),options:H}),s(p,{disabled:m||d!=="ALL"&&!E,onClick:()=>g(async()=>{let e=d==="ALL"?{id:0,name:t("grants.add.all")}:E;if(!e)throw Error("Select a collaborator");if(d==="ALL"&&!await F(`${t("grants.add.allDesc")} · ${t(`grants.level.${D}`)}?`))return;await N({type:"setGrant",target:c,request:{subjectType:d,subjectId:e.id,level:D}})}),children:t("grants.add.submit")})]}),!T&&!S&&(c?.kind==="FILE"||J)&&s(p,{variant:"outline",disabled:m,onClick:()=>g(async()=>{let e=await l.request(c?.kind==="FILE"?{type:"requestAccess",requestType:"FILE_ACCESS",targetId:c.id,message:null}:{type:"requestAccess",requestType:"PROJECT_JOIN",targetId:J.projectId,message:null});if(e.type!=="accessRequest")throw Error("Invalid access request response");y(t(e.data==="submitted"?"access.submitted":"access.alreadyPending"))}),children:t("access.request")}),k&&P&&l.getSnapshot().snapshot?.webBaseUrl&&s(p,{variant:"outline",onClick:()=>g(()=>P.onOpenExternal(l.getSnapshot().snapshot.webBaseUrl)),children:t("panel.openWeb")})]})}export{le as DriveSharing};
1
+ import{We}from"./chunk-g3pmrhm2.js";import"./chunk-ws1dtw35.js";import"./chunk-3fpcak8h.js";export{We as DriveSharing};
package/dist/status.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { type ReactNode } from "react";
2
- import type { DriveController } from "./core.js";
3
- import { type DriveLocale } from "./locales.js";
4
- import { type TransferFeed } from "./transfer-feed.js";
5
- import { type DriveControls, type DriveHost } from "./ui.js";
2
+ import type { DriveController } from "./core";
3
+ import { type DriveLocale } from "./locales";
4
+ import { type TransferFeed } from "./transfer-feed";
5
+ import { type DriveControls, type DriveHost } from "./ui";
6
6
  export declare function useTransferFeed(controller: DriveController): TransferFeed;
7
7
  export declare function formatDriveBytes(bytes: number): string;
8
8
  export declare function DriveStatus({ controller, controls: { Button }, locale, host, confirm, feed, onOpenSettings }: {
package/dist/status.js CHANGED
@@ -1 +1 @@
1
- import{jsx as a,jsxs as n,Fragment as F}from"react/jsx-runtime";import{ArrowDownIcon as j,ArrowUpIcon as P,PauseIcon as q,PlayIcon as M,RefreshCwIcon as E,SettingsIcon as U}from"lucide-react";import{useEffect as x,useState as y}from"react";import{driveTranslator as T}from"./locales.js";import{applyFileState as z,EMPTY_FEED as C}from"./transfer-feed.js";import{requireHost as m,useDrive as L,useDriveAction as R}from"./ui.js";var N=new WeakMap;function W(s){let[r,u]=y(()=>N.get(s)?.feed??C);return x(()=>{let p=()=>{let v=s.getSnapshot().snapshot;if(!v)return;let l=N.get(s);if(l?.generation!==v.generation)l={generation:v.generation,feed:C,files:new Map},N.set(s,l);for(let o of v.files){let h=`${o.projectId}\x00${o.path}`,c=`${o.state}\x00${o.size}`;if(l.files.get(h)!==c)l.files.set(h,c),l.feed=z(l.feed,o,Date.now())}u(l.feed)};return p(),s.subscribe(p)},[s]),r}function _(s){if(s<1024)return`${s} B`;if(s<1048576)return`${(s/1024).toFixed(1)} KB`;if(s<1073741824)return`${(s/1048576).toFixed(1)} MB`;return`${(s/1073741824).toFixed(1)} GB`}function Y({controller:s,controls:{Button:r},locale:u,host:p,confirm:v,feed:l,onOpenSettings:o}){let{snapshot:h}=L(s),{busy:c,error:k,run:d}=R(),[f,S]=y([]),[D,I]=y(null),t=T(u),i=h?.status,w=i?.state.kind==="paused",A=i?.state.kind==="syncing"||i?.state.kind==="scanning";return x(()=>{if(!h?.running)return;let e=!0;return s.request({type:"failedUploads"}).then((g)=>{if(g.type!=="failedUploads")throw Error("Invalid failed transfers response");if(e)S(g.data),I(null)}).catch((g)=>{if(e)I(String(g))}),()=>{e=!1}},[s,h?.generation,h?.running,i?.failed]),n(F,{children:[n("header",{className:"alwith-drive-status-header",children:[a("h2",{children:t("title")}),n("div",{className:"alwith-drive-status-tools",children:[a(r,{className:"alwith-drive-status-icon",variant:"ghost",size:"icon-xs","aria-label":t("syncNow"),title:t("syncNow"),disabled:c||w,onClick:()=>d(()=>s.request({type:"sync"})),children:a(E,{className:A?"alwith-drive-spin":void 0,"aria-hidden":"true"})}),a(r,{className:"alwith-drive-status-icon",variant:"ghost",size:"icon-xs","aria-label":t(w?"resume":"pause"),title:t(w?"resume":"pause"),disabled:c,onClick:()=>d(()=>s.request({type:"pause",paused:!w})),children:w?a(M,{"aria-hidden":"true"}):a(q,{"aria-hidden":"true"})}),o&&a(r,{className:"alwith-drive-status-icon",variant:"ghost",size:"icon-xs","aria-label":t("openSettings"),title:t("openSettings"),onClick:o,children:a(U,{"aria-hidden":"true"})})]})]}),(k||D)&&a("p",{role:"alert",className:"alwith-drive-error",children:k||D}),n("dl",{className:"alwith-drive-status-grid",children:[a("dt",{children:t("panel.state")}),n("dd",{role:"status",children:[i?t(`engine.${i.state.kind}`):t("engine.paused"),i?.state.kind==="error"&&` · ${i.state.message==="DEVICE_MISMATCH"?t("deviceMismatch"):i.state.message}`]}),a("dt",{children:t("panel.progress")}),a("dd",{children:t("panel.progressValue",{downloading:i?.downloading??0,uploading:(i?.uploading??0)+(i?.pending??0),synced:i?.synced??0})}),a("dt",{children:t("panel.lastSync")}),a("dd",{children:i?.lastSyncAt?new Date(i.lastSyncAt).toLocaleString(u):t("panel.never")}),a("dt",{children:t("panel.push")}),a("dd",{children:t(i?.pushConnected?"panel.pushLive":"panel.pushPolling")})]}),l.active.length>0&&n("section",{className:"alwith-drive-status-section",children:[a("h3",{children:t("panel.inFlight",{count:l.active.length})}),a("ul",{className:"alwith-drive-status-list alwith-drive-status-active",children:l.active.map((e)=>n("li",{className:"alwith-drive-status-file",children:[e.direction==="up"?a(P,{className:"alwith-drive-upload","aria-hidden":"true"}):a(j,{className:"alwith-drive-download","aria-hidden":"true"}),a(r,{className:"alwith-drive-status-filename",variant:"ghost",title:e.path,onClick:()=>d(()=>m(p).onRevealPath(e.localPath)),children:e.name}),a("span",{className:"alwith-drive-status-trailing",children:_(e.size)})]},e.key))})]}),l.recent.length>0&&n("section",{className:"alwith-drive-status-section",children:[a("h3",{children:t("panel.recentDone",{count:l.recent.length})}),a("ul",{className:"alwith-drive-status-list",children:l.recent.map((e)=>n("li",{className:"alwith-drive-status-file",children:[e.direction==="up"?a(P,{className:"alwith-drive-upload","aria-hidden":"true"}):a(j,{className:"alwith-drive-download","aria-hidden":"true"}),a(r,{className:"alwith-drive-status-filename",variant:"ghost",title:e.path,onClick:()=>d(()=>m(p).onRevealPath(e.localPath)),children:e.name}),a("span",{className:"alwith-drive-status-trailing",children:new Date(e.completedAt).toLocaleTimeString(u)})]},`${e.key}:${e.completedAt}`))})]}),(i?.conflicts.length??0)>0&&n("section",{className:"alwith-drive-status-section",children:[a("h3",{children:t("panel.conflicts",{count:i?.conflicts.length??0})}),a("ul",{className:"alwith-drive-status-list alwith-drive-status-active",children:i?.conflicts.map((e)=>n("li",{className:"alwith-drive-status-file",children:[a("span",{className:"alwith-drive-status-filename",title:e.localPath,children:e.path}),a(r,{className:"alwith-drive-status-link",variant:"ghost",onClick:()=>d(()=>m(p).onRevealPath(e.conflictCopyPath??e.localPath)),children:t("panel.reveal")})]},`${e.localPath}:${e.at}`))})]}),f.length>0&&n("section",{className:"alwith-drive-status-section",children:[n("header",{children:[a("h3",{children:t("panel.transferFailed",{count:f.length})}),a(r,{variant:"outline",disabled:c,onClick:()=>d(()=>s.request({type:"retryUploads"})),children:t("panel.retryNow")})]}),f.map((e)=>n("div",{className:"alwith-drive-failure",children:[n("div",{className:"alwith-drive-row",children:[n("strong",{children:[t(`panel.direction.${e.direction}`)," · ",e.name]}),a(r,{variant:"ghost",disabled:c,onClick:()=>d(()=>s.request(e.direction==="download"?{type:"download",projectId:e.projectId,path:e.path}:{type:"retryUpload",projectId:e.projectId,path:e.path})),children:t("panel.retryOne")}),e.localPath&&a(r,{variant:"ghost",onClick:()=>d(()=>m(p).onRevealPath(e.localPath)),children:t("panel.reveal")})]}),a("p",{children:e.path}),a("p",{className:"alwith-drive-error",children:e.message}),a("small",{children:t(!e.retryable?"panel.notUploadedMetaSettled":new Date(e.nextAttemptAt).getTime()<=Date.now()?"panel.notUploadedMetaDue":"panel.notUploadedMeta",{attempts:e.attempts,next:new Date(e.nextAttemptAt).toLocaleTimeString(u)})})]},`${e.projectId}:${e.path}`))]}),h?.pendingDeletes.map((e)=>n("aside",{className:"alwith-drive-notice",children:[a("h3",{children:t("massDelete.title",{count:e.count})}),a("p",{children:t("massDelete.desc",{count:e.count,project:e.drivePath})}),n("div",{className:"alwith-drive-actions",children:[a(r,{variant:"outline",disabled:c,onClick:()=>d(()=>s.request({type:"cancelDeletes",projectId:e.projectId})),children:t("massDelete.cancel")}),a(r,{variant:"destructive",disabled:c,onClick:()=>d(async()=>{if(await v(t("massDelete.desc",{count:e.count,project:e.drivePath})))await s.request({type:"confirmDeletes",projectId:e.projectId})}),children:t("massDelete.confirm")})]})]},String(e.projectId))),((i?.errors.length??0)>0||i?.state.kind==="error")&&n("section",{className:"alwith-drive-status-section",children:[n("header",{children:[a("h3",{children:t("panel.errors",{count:i?.errors.length??0})}),a(r,{className:"alwith-drive-status-link",variant:"ghost",disabled:c,onClick:()=>d(()=>s.request({type:"reconcile",projectId:null})),children:t("panel.reconcile")})]}),a("ul",{className:"alwith-drive-status-list",children:i?.errors.map((e,g)=>n("li",{children:[e.path&&`${e.path} · `,e.message]},`${e.at}:${g}`))}),a("p",{children:t("panel.reconcileHint")})]}),!l.active.length&&!l.recent.length&&!f.length&&!i?.conflicts.length&&!i?.errors.length&&i?.state.kind==="idle"&&a("p",{className:"alwith-drive-status-quiet",children:t("panel.allQuiet")})]})}export{Y as DriveStatus,_ as formatDriveBytes,W as useTransferFeed};
1
+ import{De,S,Ie}from"./chunk-qf5g053e.js";import"./chunk-nk64fv7b.js";import"./chunk-ws1dtw35.js";import"./chunk-3fpcak8h.js";export{Ie as DriveStatus,S as formatDriveBytes,De as useTransferFeed};
package/dist/summary.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { EngineState, FailedUpload, StatusSnapshot } from "./core.js";
1
+ import type { EngineState, FailedUpload, StatusSnapshot } from "./core";
2
2
  export declare function engineStateKey(state: EngineState): `drive.engine.${EngineState["kind"]}`;
3
3
  type SummaryKey = "drive.summary.error" | "drive.summary.conflicts" | "drive.summary.notUploaded" | "drive.summary.notDownloaded" | "drive.summary.transferFailed" | "drive.summary.failed" | "drive.summary.syncing" | "drive.summary.paused" | "drive.summary.scanning" | "drive.summary.upToDate";
4
4
  export declare function failureKey(failures: readonly FailedUpload[]): "notUploaded" | "notDownloaded" | "transferFailed";
package/dist/summary.js CHANGED
@@ -1 +1 @@
1
- function c(n){return`drive.engine.${n.kind}`}function u(n){let o=n.some((r)=>r.direction==="upload"),e=n.some((r)=>r.direction==="download");if(o&&!e)return"notUploaded";if(e&&!o)return"notDownloaded";return"transferFailed"}function a(n,o=[]){let e=n?.state??{kind:"idle"};if(e.kind==="error")return{key:"drive.summary.error",count:0,tone:"trouble"};let r=n?.conflicts.length??0;if(r>0)return{key:"drive.summary.conflicts",count:r,tone:"trouble"};let t=n?.failed??0;if(t>0)return{key:`drive.summary.${u(o)}`,count:t,tone:"trouble"};let i=n?.errors.length??0;if(i>0)return{key:"drive.summary.failed",count:i,tone:"trouble"};let d=(n?.downloading??0)+(n?.uploading??0)+(n?.pending??0);if(d>0)return{key:"drive.summary.syncing",count:d,tone:"busy"};if(e.kind==="paused")return{key:"drive.summary.paused",count:0,tone:"calm"};if(e.kind==="scanning")return{key:"drive.summary.scanning",count:0,tone:"busy"};return{key:"drive.summary.upToDate",count:0,tone:"calm"}}export{c as engineStateKey,u as failureKey,a as summarize};
1
+ import{Ke,ye,Ye}from"./chunk-mz5601y4.js";export{Ke as engineStateKey,ye as failureKey,Ye as summarize};
package/dist/tauri.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { DriveEvent, DriveRequest, DriveResponse, DriveTransport } from "./core.js";
1
+ import type { DriveEvent, DriveRequest, DriveResponse, DriveTransport } from "./core";
2
2
  export interface NativeDriveHost {
3
3
  invoke: (request: DriveRequest) => Promise<DriveResponse>;
4
4
  listen: (listener: (event: DriveEvent) => void) => Promise<() => void>;
@@ -1,4 +1,4 @@
1
- import type { FileState, RemoteId } from "./core.js";
1
+ import type { FileState, RemoteId } from "./core";
2
2
  export declare const RECENT_LIMIT = 20;
3
3
  export type TransferDirection = "up" | "down";
4
4
  export interface ActiveTransfer {
@@ -1 +1 @@
1
- var v=20,z={active:[],recent:[]};function l(t,e){return`${String(t)}\x00${e}`}function s(t){if(t==="uploading")return"up";if(t==="downloading")return"down";return null}function f(t){return t==="synced"||t==="readOnly"||t==="collab"}function h(t){let e=t.split("/").pop();return e!==void 0&&e.length>0?e:t}function E(t,e,a){let r=l(e.projectId,e.path),i=s(e.state);if(i!==null){let n=t.active.find((o)=>o.key===r),p={key:r,projectId:e.projectId,path:e.path,localPath:e.localPath,name:h(e.path),direction:i,size:e.size??n?.size??0,startedAt:n?.direction===i?n.startedAt:a};return{active:[...t.active.filter((o)=>o.key!==r),p],recent:t.recent}}let c=t.active.find((n)=>n.key===r);if(c===void 0)return t;let u=t.active.filter((n)=>n.key!==r);if(!f(e.state))return{active:u,recent:t.recent};let d=[{key:r,path:c.path,localPath:e.localPath||c.localPath,name:c.name,direction:c.direction,size:e.size!==void 0&&e.size>0?e.size:c.size,completedAt:a},...t.recent.filter((n)=>n.key!==r)].slice(0,20);return{active:u,recent:d}}export{z as EMPTY_FEED,v as RECENT_LIMIT,E as applyFileState,l as transferKey};
1
+ import{ft,z,at,xe}from"./chunk-nk64fv7b.js";export{z as EMPTY_FEED,ft as RECENT_LIMIT,xe as applyFileState,at as transferKey};
package/dist/ui.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { type ButtonHTMLAttributes, type ComponentType, type InputHTMLAttributes, type ReactNode } from "react";
2
- import type { DriveController, DriveState, RootInfo } from "./core.js";
3
- import type { ReadDirLike } from "./global-search.js";
4
- import type { PinnedDoc } from "./pinned-docs.js";
2
+ import type { DriveController, DriveState, RootInfo } from "./core";
3
+ import type { ReadDirLike } from "./global-search";
4
+ import type { PinnedDoc } from "./pinned-docs";
5
5
  export interface DriveMenuProps {
6
6
  label: string;
7
7
  children?: ReactNode;
package/dist/ui.js CHANGED
@@ -1 +1 @@
1
- import{jsx as o}from"react/jsx-runtime";import{useRef as a,useState as s,useSyncExternalStore as h}from"react";function d(e){return h(e.subscribe,e.getSnapshot,e.getSnapshot)}function p(){let[e,t]=s(!1),[r,n]=s(null),i=a(!1);return{busy:e,error:r,run(c){if(i.current)return;i.current=!0,t(!0),n(null),c().catch((u)=>n(u instanceof Error?u.message:String(u))).finally(()=>{i.current=!1,t(!1)})}}}function w(e){if(!e)throw Error("Drive host integration is required for this action");return e}function S({controls:e,...t}){let r=e.Select;if(!r)throw Error("The host must supply its shadcn Select control");return o(r,{...t})}function g({controls:e,...t}){let r=e.Dialog;if(!r)throw Error("The host must supply its shadcn Dialog control");return o(r,{...t})}function x({controls:e,context:t=!1,...r}){let n=t?e.ContextMenu:e.Menu;if(!n)throw Error(`The host must supply its shadcn ${t?"ContextMenu":"DropdownMenu"} control`);return o(n,{...r})}function D({controls:e,...t}){if(e.Switch){let n=e.Switch;return o(n,{...t})}let r=e.Input;return o(r,{type:"checkbox",role:"switch",checked:t.checked,disabled:t.disabled,"aria-label":t["aria-label"],onChange:(n)=>t.onCheckedChange(n.target.checked)})}export{S as DriveChoice,x as DriveMenu,g as DriveModal,D as DriveSwitch,w as requireHost,d as useDrive,p as useDriveAction};
1
+ import{t,n,r,c,D,d,I}from"./chunk-ws1dtw35.js";export{c as DriveChoice,d as DriveMenu,D as DriveModal,I as DriveSwitch,r as requireHost,t as useDrive,n as useDriveAction};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alwith/module-drive",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "files": [
@@ -45,8 +45,8 @@
45
45
  "prepack": "bun run build && bun ../../scripts/verify-module-package.ts drive"
46
46
  },
47
47
  "peerDependencies": {
48
- "react": "^19.0.0",
49
- "react-dom": "^19.0.0",
48
+ "react": "^19.3.1",
49
+ "react-dom": "^19.3.1",
50
50
  "@milkdown/core": "^7.22.2",
51
51
  "@milkdown/ctx": "^7.22.2",
52
52
  "@milkdown/prose": "^7.22.2",
@@ -56,22 +56,22 @@
56
56
  "y-prosemirror": "^1.3.7",
57
57
  "y-protocols": "^1.0.7",
58
58
  "y-websocket": "^3.1.0",
59
- "lucide-react": "^1.54.0",
59
+ "lucide-react": "^1.61.0",
60
60
  "@alwith/module-editor": "^0.1.0-rc.8"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/react": "^19.3.0",
64
64
  "@types/react-dom": "^19.3.0",
65
- "@milkdown/core": "^7.22.2",
66
- "@milkdown/ctx": "^7.22.2",
67
- "@milkdown/prose": "^7.22.2",
68
- "@milkdown/utils": "^7.22.2",
69
- "@milkdown/plugin-collab": "^7.22.2",
65
+ "@milkdown/core": "^7.22.3",
66
+ "@milkdown/ctx": "^7.22.3",
67
+ "@milkdown/prose": "^7.22.3",
68
+ "@milkdown/utils": "^7.22.3",
69
+ "@milkdown/plugin-collab": "^7.22.3",
70
70
  "yjs": "^13.6.33",
71
71
  "y-prosemirror": "^1.3.7",
72
72
  "y-protocols": "^1.0.7",
73
73
  "y-websocket": "^3.1.0",
74
- "lucide-react": "^1.54.0",
74
+ "lucide-react": "^1.61.0",
75
75
  "@alwith/module-editor": "workspace:*"
76
76
  },
77
77
  "peerDependenciesMeta": {
@@ -114,7 +114,7 @@
114
114
  "registry": "https://registry.npmjs.org"
115
115
  },
116
116
  "dependencies": {
117
- "@alwith/native-kit": "0.1.0"
117
+ "@alwith/native-kit": "0.1.1"
118
118
  },
119
119
  "repository": {
120
120
  "type": "git",