@burdenoff/microfe-files 2026.1110.2 → 2026.1111.2

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 (69) hide show
  1. package/dist/files/components/ActionMenu.d.ts +6 -0
  2. package/dist/files/components/ActionMenu.js +2 -1
  3. package/dist/files/components/ActionMenu.js.map +1 -1
  4. package/dist/files/components/ContextMenu.d.ts +6 -0
  5. package/dist/files/components/ContextMenu.js +2 -0
  6. package/dist/files/components/ContextMenu.js.map +1 -1
  7. package/dist/files/components/FileBrowser.d.ts +8 -2
  8. package/dist/files/components/FileBrowser.js +275 -238
  9. package/dist/files/components/FileBrowser.js.map +1 -1
  10. package/dist/files/components/FileCard.d.ts +5 -0
  11. package/dist/files/components/FileCard.js +98 -94
  12. package/dist/files/components/FileCard.js.map +1 -1
  13. package/dist/files/components/FileListItem.d.ts +5 -0
  14. package/dist/files/components/FileListItem.js +88 -87
  15. package/dist/files/components/FileListItem.js.map +1 -1
  16. package/dist/files/components/FilePreviewModal.d.ts +6 -1
  17. package/dist/files/components/FilePreviewModal.js +30 -29
  18. package/dist/files/components/FilePreviewModal.js.map +1 -1
  19. package/dist/files/components/FolderCard.d.ts +5 -0
  20. package/dist/files/components/FolderCard.js +108 -104
  21. package/dist/files/components/FolderCard.js.map +1 -1
  22. package/dist/files/components/ShareDialog.d.ts +12 -5
  23. package/dist/files/components/ShareDialog.js +348 -188
  24. package/dist/files/components/ShareDialog.js.map +1 -1
  25. package/dist/files/components/UploadQueue.js +1 -1
  26. package/dist/files/components/contextMenuItems.d.ts +32 -0
  27. package/dist/files/components/contextMenuItems.js +6 -2
  28. package/dist/files/components/contextMenuItems.js.map +1 -1
  29. package/dist/files/hooks/useBrowsePage.d.ts +10 -0
  30. package/dist/files/hooks/useCopyFile.d.ts +3 -0
  31. package/dist/files/hooks/useCreateFolder.d.ts +2 -0
  32. package/dist/files/hooks/useFoldersQuery.d.ts +1 -1
  33. package/dist/files/hooks/useKeyboardNavigation.js +57 -56
  34. package/dist/files/hooks/useKeyboardNavigation.js.map +1 -1
  35. package/dist/files/hooks/useMoveFile.d.ts +3 -0
  36. package/dist/files/hooks/useMoveFolder.d.ts +2 -0
  37. package/dist/files/hooks/useRenameFile.d.ts +3 -0
  38. package/dist/files/hooks/useRenameFolder.d.ts +2 -0
  39. package/dist/files/hooks/useRestoreFile.d.ts +3 -0
  40. package/dist/files/hooks/useRestoreFolder.d.ts +2 -0
  41. package/dist/files/hooks/useShareDialogPermission.d.ts +45 -0
  42. package/dist/files/hooks/useShareDialogPermission.js +31 -0
  43. package/dist/files/hooks/useShareDialogPermission.js.map +1 -0
  44. package/dist/files/hooks/useSharePermissions.d.ts +30 -0
  45. package/dist/files/hooks/useSharePermissions.js +81 -0
  46. package/dist/files/hooks/useSharePermissions.js.map +1 -0
  47. package/dist/files/hooks/useToggleStar.d.ts +5 -0
  48. package/dist/files/hooks/useUploadFile.d.ts +3 -0
  49. package/dist/files/pages/BrowserPage.js +353 -348
  50. package/dist/files/pages/BrowserPage.js.map +1 -1
  51. package/dist/files/types.d.ts +10 -2
  52. package/dist/files/utils/fileViewModel.js +7 -2
  53. package/dist/files/utils/fileViewModel.js.map +1 -1
  54. package/dist/files/utils/itemCapabilities.d.ts +84 -0
  55. package/dist/files/utils/itemCapabilities.js +54 -0
  56. package/dist/files/utils/itemCapabilities.js.map +1 -0
  57. package/dist/files/utils/sharePermission.d.ts +144 -0
  58. package/dist/files/utils/sharePermission.js +77 -0
  59. package/dist/files/utils/sharePermission.js.map +1 -0
  60. package/dist/generated/global-types.d.ts +6615 -870
  61. package/dist/generated/wspace-operations.d.ts +104 -0
  62. package/dist/generated/wspace-operations.js +1418 -39
  63. package/dist/generated/wspace-operations.js.map +1 -1
  64. package/dist/generated/wspace-types.d.ts +94395 -11225
  65. package/dist/generated/wspace-types.js.map +1 -1
  66. package/dist/translations/en.d.ts +16 -0
  67. package/dist/translations/en.js +16 -0
  68. package/dist/translations/en.js.map +1 -1
  69. package/package.json +2 -1
@@ -1,218 +1,230 @@
1
1
  import { useFilesStore as e } from "../store/filesStore.js";
2
2
  import { FileCard as t } from "./FileCard.js";
3
3
  import { FileListItem as n } from "./FileListItem.js";
4
- import { FolderCard as ee } from "./FolderCard.js";
5
- import { ActionMenu as te } from "./ActionMenu.js";
6
- import { ContextMenu as r } from "./ContextMenu.js";
7
- import { createFileMenuItems as ne, createFolderMenuItems as i } from "./contextMenuItems.js";
8
- import { sortFiles as a } from "../utils/index.js";
9
- import { tWithFallback as o } from "../utils/i18n.js";
10
- import { useDragDrop as re } from "../hooks/useDragDrop.js";
11
- import { useState as s } from "react";
12
- import { Folder as ie, Star as ae } from "lucide-react";
13
- import { Fragment as oe, jsx as c, jsxs as l } from "react/jsx-runtime";
14
- import { useI18n as se } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
4
+ import { FolderCard as r } from "./FolderCard.js";
5
+ import { ActionMenu as ee } from "./ActionMenu.js";
6
+ import { ContextMenu as te } from "./ContextMenu.js";
7
+ import { createFileMenuItems as ne, createFolderMenuItems as re } from "./contextMenuItems.js";
8
+ import { sortFiles as ie } from "../utils/index.js";
9
+ import { tWithFallback as i } from "../utils/i18n.js";
10
+ import { useSharePermissions as ae } from "../hooks/useSharePermissions.js";
11
+ import { shareEntryDeniedReason as oe, sharePermissionMessages as se } from "../utils/sharePermission.js";
12
+ import { canStartFileDrag as ce, canStartFolderDrag as le, fileCapabilities as a, folderCapabilities as o, isShareOffered as ue, shareLookupTarget as de } from "../utils/itemCapabilities.js";
13
+ import { useDragDrop as fe } from "../hooks/useDragDrop.js";
14
+ import { useState as pe } from "react";
15
+ import { Folder as me, Star as he } from "lucide-react";
16
+ import { Fragment as ge, jsx as s, jsxs as c } from "react/jsx-runtime";
17
+ import { useI18n as _e } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
15
18
  // src/files/components/FileBrowser.tsx
16
- var u = ({ files: u, folders: d, loading: ce = !1, error: le = null, preserveSortOrder: ue = !1, onFilePreview: de, onFileShare: f, onFileDelete: p, onFileRestore: m, onFileFavorite: h, onFileRename: g, onFileDownload: _, onFileCopy: v, onFileMove: y, onFileInfo: b, onFileActivity: x, onFolderOpen: S, onFolderShare: C, onFolderDelete: w, onFolderRestore: T, onFolderRename: E, onFolderFavorite: D, onFolderCopy: fe, onFolderMove: O, onFolderInfo: k, onFolderActivity: pe, onMoveFile: me, onCopyFile: he, onMoveFolder: ge, onCopyFolder: _e }) => {
17
- let { t: A } = se(), { viewMode: j, sortBy: M, sortDirection: N, selectedFiles: P, selectedFolders: F } = e(), [ve, ye] = s(null), [I, L] = s({
19
+ var l = ({ files: l, folders: u, loading: ve = !1, error: ye = null, preserveSortOrder: be = !1, onFilePreview: xe, onFileShare: d, onFileDelete: f, onFileRestore: p, onFileFavorite: m, onFileRename: h, onFileDownload: g, onFileCopy: _, onFileMove: v, onFileInfo: y, onFileActivity: b, onFolderOpen: x, onFolderShare: S, onFolderDelete: C, onFolderRestore: w, onFolderRename: T, onFolderFavorite: E, onFolderCopy: Se, onFolderMove: D, onFolderInfo: O, onFolderActivity: Ce, onMoveFile: we, onCopyFile: Te, onMoveFolder: Ee, onCopyFolder: De }) => {
20
+ let { t: k } = _e(), { viewMode: Oe, sortBy: ke, sortDirection: Ae, selectedFiles: je, selectedFolders: Me } = e(), [Ne, Pe] = pe(null), [Fe, A] = pe({
18
21
  draggedItem: null,
19
22
  dropTargetFolderId: null
20
- }), [R, z] = s(null), { draggedItem: B, startDrag: be, endDrag: xe, handleDrop: Se } = re({
21
- onMoveFile: me,
22
- onCopyFile: he,
23
- onMoveFolder: ge,
24
- onCopyFolder: _e
25
- }), Ce = (e, t) => {
26
- be({
23
+ }), [j, M] = pe(null), N = ae(), { draggedItem: P, startDrag: Ie, endDrag: Le, handleDrop: Re } = fe({
24
+ onMoveFile: we,
25
+ onCopyFile: Te,
26
+ onMoveFolder: Ee,
27
+ onCopyFolder: De
28
+ }), ze = (e, t) => {
29
+ ce(e, t) && (Ie({
27
30
  type: "file",
28
31
  item: e,
29
32
  operation: t
30
- }), L({
33
+ }), A({
31
34
  draggedItem: {
32
35
  type: "file",
33
36
  item: e,
34
37
  operation: t
35
38
  },
36
39
  dropTargetFolderId: null
37
- });
38
- }, we = (e, t) => {
39
- be({
40
+ }));
41
+ }, Be = (e, t) => {
42
+ le(e, t) && (Ie({
40
43
  type: "folder",
41
44
  item: e,
42
45
  operation: t
43
- }), L({
46
+ }), A({
44
47
  draggedItem: {
45
48
  type: "folder",
46
49
  item: e,
47
50
  operation: t
48
51
  },
49
52
  dropTargetFolderId: null
50
- });
51
- }, V = () => {
52
- xe(), L({
53
+ }));
54
+ }, Ve = () => {
55
+ Le(), A({
53
56
  draggedItem: null,
54
57
  dropTargetFolderId: null
55
58
  });
56
- }, Te = async (e) => {
57
- B && (await Se(e.id), L({
59
+ }, He = async (e) => {
60
+ P && (await Re(e.id), A({
58
61
  draggedItem: null,
59
62
  dropTargetFolderId: null
60
63
  }));
61
- }, Ee = (e) => {
62
- L((t) => ({
64
+ }, Ue = (e) => {
65
+ A((t) => ({
63
66
  ...t,
64
67
  dropTargetFolderId: e
65
68
  }));
66
- }, De = () => {
67
- L((e) => ({
69
+ }, We = () => {
70
+ A((e) => ({
68
71
  ...e,
69
72
  dropTargetFolderId: null
70
73
  }));
71
- }, Oe = (e, t, n) => {
72
- z({
74
+ }, Ge = (e, t, n) => {
75
+ let r = B(e);
76
+ d && r && N.ensure(r), M({
73
77
  item: e,
74
78
  type: "file",
75
79
  x: t,
76
80
  y: n
77
81
  });
78
- }, ke = (e, t, n) => {
79
- z({
82
+ }, Ke = (e, t, n) => {
83
+ let r = K(e);
84
+ S && r && N.ensure(r), M({
80
85
  item: e,
81
86
  type: "folder",
82
87
  x: t,
83
88
  y: n
84
89
  });
85
- }, H = () => {
86
- z(null);
87
- }, U = (e) => e.canRead === !0 || e.canUpdate === !0 || e.canWrite === !0, W = (e) => e.canUpdate === !0 || e.canWrite === !0, G = (e) => e.canShare === !0 || W(e), K = (e) => e.canDelete === !0, q = (e) => e.canRead === !0 || e.permissions?.canRead === !0, J = (e) => e.canUpdate === !0 || e.permissions?.canWrite === !0, Y = (e) => e.permissions?.canShare === !0 || J(e), X = (e) => e.canDelete === !0 || e.permissions?.canDelete === !0, Z = () => {
88
- if (!R) return [];
89
- if (R.type === "file") {
90
- let e = R.item;
90
+ }, qe = () => {
91
+ M(null);
92
+ }, Je = (e) => a(e).canPreview, F = (e) => a(e).canCopy, I = (e) => a(e).canUpdate, L = (e) => a(e).canMove, R = (e) => a(e).canDelete, Ye = (e) => L(e) || F(e), z = (e) => ue(a(e).share), B = (e) => de(a(e).share), Xe = (e) => o(e).canOpen, V = (e) => o(e).canUpdate, H = (e) => o(e).canMove, U = (e) => o(e).canDelete, Ze = (e) => H(e) || !!De, W = (e) => o(e).canAcceptDrop, G = (e) => ue(o(e).share), K = (e) => de(o(e).share), Qe = se(k), $e = (e) => e ? oe(N.statusOf(e), Qe) : void 0, q = (e) => $e(B(e)), J = (e) => $e(K(e)), Y = d ? (e) => {
93
+ let t = B(e);
94
+ d(e, t ? N.guard(t) : void 0);
95
+ } : void 0, X = S ? (e) => {
96
+ let t = K(e);
97
+ S(e, t ? N.guard(t) : void 0);
98
+ } : void 0, Z = (e) => !e || !(e.kind === "file" ? d : S) ? {} : {
99
+ onPointerOver: () => N.prefetch(e),
100
+ onPointerDown: () => N.ensure(e),
101
+ onFocus: () => N.ensure(e)
102
+ }, et = () => {
103
+ if (!j) return [];
104
+ if (j.type === "file") {
105
+ let e = j.item;
91
106
  return ne({
92
- onShare: f && G(e) ? () => f(e) : void 0,
93
- onDownload: _ && U(e) ? () => _(e) : void 0,
94
- onCopy: v && U(e) ? () => v(e) : void 0,
95
- onRename: g && W(e) ? () => g(e) : void 0,
96
- onStar: h && W(e) ? () => h(e) : void 0,
97
- onMove: y && W(e) ? () => y(e) : void 0,
98
- onInfo: b ? () => b(e) : void 0,
99
- onActivity: x ? () => x(e) : void 0,
100
- onDelete: p && K(e) ? () => p(e) : void 0,
101
- onRestore: m && W(e) ? () => m(e) : void 0,
107
+ onShare: Y && z(e) ? () => Y(e) : void 0,
108
+ shareDeniedReason: q(e),
109
+ onDownload: g ? () => g(e) : void 0,
110
+ onCopy: _ && F(e) ? () => _(e) : void 0,
111
+ onRename: h && I(e) ? () => h(e) : void 0,
112
+ onStar: m && I(e) ? () => m(e) : void 0,
113
+ onMove: v && L(e) ? () => v(e) : void 0,
114
+ onInfo: y ? () => y(e) : void 0,
115
+ onActivity: b ? () => b(e) : void 0,
116
+ onDelete: f && R(e) ? () => f(e) : void 0,
117
+ onRestore: p ? () => p(e) : void 0,
102
118
  isStarred: e.starred
103
- }, A);
119
+ }, k);
104
120
  }
105
121
  {
106
- let e = R.item;
107
- return i({
108
- onShare: C && Y(e) ? () => C(e) : void 0,
109
- onRename: E && J(e) ? () => E(e) : void 0,
110
- onStar: D && J(e) ? () => D(e) : void 0,
111
- onMove: O && J(e) ? () => O(e) : void 0,
112
- onInfo: k ? () => k(e) : void 0,
113
- onDelete: w && X(e) ? () => w(e) : void 0,
114
- onRestore: T && J(e) ? () => T(e) : void 0,
122
+ let e = j.item;
123
+ return re({
124
+ onShare: X && G(e) ? () => X(e) : void 0,
125
+ shareDeniedReason: J(e),
126
+ onRename: T && V(e) ? () => T(e) : void 0,
127
+ onStar: E && V(e) ? () => E(e) : void 0,
128
+ onMove: D && H(e) ? () => D(e) : void 0,
129
+ onInfo: O ? () => O(e) : void 0,
130
+ onDelete: C && U(e) ? () => C(e) : void 0,
131
+ onRestore: w ? () => w(e) : void 0,
115
132
  isStarred: e.starred
116
- }, A);
133
+ }, k);
117
134
  }
118
- }, Q = ue ? u : a(u, M, N), $ = ue ? d : a(d, M, N);
119
- return ce ? /* @__PURE__ */ c("div", {
135
+ }, Q = be ? l : ie(l, ke, Ae), $ = be ? u : ie(u, ke, Ae);
136
+ return ve ? /* @__PURE__ */ s("div", {
120
137
  className: "@container p-page-padding",
121
138
  role: "status",
122
139
  "aria-busy": "true",
123
- "aria-label": o(A, "files.browser.loading", "Loading files…"),
124
- children: /* @__PURE__ */ c("div", {
140
+ "aria-label": i(k, "files.browser.loading", "Loading files…"),
141
+ children: /* @__PURE__ */ s("div", {
125
142
  className: "grid grid-cols-2 gap-4 @md:grid-cols-3 @lg:grid-cols-4 @xl:grid-cols-5",
126
- children: Array.from({ length: 10 }).map((e, t) => /* @__PURE__ */ l("div", {
143
+ children: Array.from({ length: 10 }).map((e, t) => /* @__PURE__ */ c("div", {
127
144
  className: "overflow-hidden rounded-card border border-border-seam bg-bg-surface",
128
- children: [/* @__PURE__ */ c("div", { className: "aspect-[4/3] w-full animate-vc-shimmer bg-bg-sunken" }), /* @__PURE__ */ l("div", {
145
+ children: [/* @__PURE__ */ s("div", { className: "aspect-[4/3] w-full animate-vc-shimmer bg-bg-sunken" }), /* @__PURE__ */ c("div", {
129
146
  className: "space-y-2 p-3",
130
- children: [/* @__PURE__ */ c("div", { className: "h-3 w-3/4 animate-vc-shimmer rounded bg-bg-sunken" }), /* @__PURE__ */ c("div", { className: "h-3 w-1/2 animate-vc-shimmer rounded bg-bg-sunken" })]
147
+ children: [/* @__PURE__ */ s("div", { className: "h-3 w-3/4 animate-vc-shimmer rounded bg-bg-sunken" }), /* @__PURE__ */ s("div", { className: "h-3 w-1/2 animate-vc-shimmer rounded bg-bg-sunken" })]
131
148
  })]
132
149
  }, t))
133
150
  })
134
- }) : le ? /* @__PURE__ */ c("div", {
151
+ }) : ye ? /* @__PURE__ */ s("div", {
135
152
  className: "flex items-center justify-center min-h-[500px]",
136
- children: /* @__PURE__ */ l("div", {
153
+ children: /* @__PURE__ */ c("div", {
137
154
  className: "text-center max-w-md",
138
155
  children: [
139
- /* @__PURE__ */ c("div", {
156
+ /* @__PURE__ */ s("div", {
140
157
  className: "mb-3 text-xl font-semibold text-status-error-text",
141
- children: o(A, "files.browser.loadError", "Failed to load files")
158
+ children: i(k, "files.browser.loadError", "Failed to load files")
142
159
  }),
143
- /* @__PURE__ */ c("p", {
160
+ /* @__PURE__ */ s("p", {
144
161
  className: "mb-6 text-sm text-text-secondary",
145
- children: le.message || o(A, "files.browser.unexpectedError", "An unexpected error occurred")
162
+ children: ye.message || i(k, "files.browser.unexpectedError", "An unexpected error occurred")
146
163
  }),
147
- /* @__PURE__ */ c("button", {
164
+ /* @__PURE__ */ s("button", {
148
165
  type: "button",
149
166
  onClick: () => window.location.reload(),
150
167
  className: "rounded-lg bg-action-primary-bg px-6 py-2.5 text-sm font-medium text-text-inverse transition-colors hover:bg-action-primary-bg-hover",
151
- children: o(A, "files.browser.retry", "Retry")
168
+ children: i(k, "files.browser.retry", "Retry")
152
169
  })
153
170
  ]
154
171
  })
155
- }) : u.length === 0 && d.length === 0 ? /* @__PURE__ */ c(oe, { children: R && /* @__PURE__ */ c(r, {
156
- x: R.x,
157
- y: R.y,
158
- onClose: H,
159
- items: Z()
160
- }) }) : j === "list" ? j === "list" ? /* @__PURE__ */ l("div", {
172
+ }) : l.length === 0 && u.length === 0 ? /* @__PURE__ */ s(ge, { children: j && /* @__PURE__ */ s(te, {
173
+ x: j.x,
174
+ y: j.y,
175
+ onClose: qe,
176
+ items: et()
177
+ }) }) : Oe === "list" ? Oe === "list" ? /* @__PURE__ */ c("div", {
161
178
  className: "@container bg-bg-canvas",
162
179
  children: [
163
- /* @__PURE__ */ l("div", {
180
+ /* @__PURE__ */ c("div", {
164
181
  className: "hidden @md:flex items-center gap-3 px-3 py-2 bg-bg-surface border-b border-border-seam text-text-secondary font-text-sm font-weight-medium",
165
182
  children: [
166
- /* @__PURE__ */ c("div", { className: "flex-shrink-0 w-4" }),
167
- /* @__PURE__ */ c("div", { className: "flex-shrink-0 w-6" }),
168
- /* @__PURE__ */ c("div", {
183
+ /* @__PURE__ */ s("div", { className: "flex-shrink-0 w-4" }),
184
+ /* @__PURE__ */ s("div", { className: "flex-shrink-0 w-6" }),
185
+ /* @__PURE__ */ s("div", {
169
186
  className: "flex-1",
170
- children: o(A, "files.browser.name", "Name")
187
+ children: i(k, "files.browser.name", "Name")
171
188
  }),
172
- /* @__PURE__ */ c("div", {
189
+ /* @__PURE__ */ s("div", {
173
190
  className: "hidden @lg:block flex-shrink-0 w-40",
174
- children: o(A, "files.browser.owner", "Owner")
191
+ children: i(k, "files.browser.owner", "Owner")
175
192
  }),
176
- /* @__PURE__ */ c("div", {
193
+ /* @__PURE__ */ s("div", {
177
194
  className: "hidden @md:block flex-shrink-0 w-24 text-right",
178
- children: o(A, "files.browser.size", "Size")
195
+ children: i(k, "files.browser.size", "Size")
179
196
  }),
180
- /* @__PURE__ */ c("div", {
197
+ /* @__PURE__ */ s("div", {
181
198
  className: "hidden @lg:block flex-shrink-0 w-32 text-right",
182
- children: o(A, "files.browser.modified", "Modified")
199
+ children: i(k, "files.browser.modified", "Modified")
183
200
  }),
184
- /* @__PURE__ */ c("div", { className: "flex-shrink-0 w-32" })
201
+ /* @__PURE__ */ s("div", { className: "flex-shrink-0 w-32" })
185
202
  ]
186
203
  }),
187
- /* @__PURE__ */ l("div", {
204
+ /* @__PURE__ */ c("div", {
188
205
  className: "divide-y divide-border-subtle",
189
- children: [$.map((t) => /* @__PURE__ */ l("div", {
190
- className: `group flex items-center gap-3 border-b border-border-seam bg-bg-surface p-3 transition-colors hover:bg-bg-sunken focus-within:bg-bg-sunken ${I.dropTargetFolderId === t.id && B?.item.id !== t.id ? "bg-action-primary-bg/10" : ""} ${B?.item.id === t.id ? "opacity-50" : ""}`,
206
+ children: [$.map((t) => /* @__PURE__ */ c("div", {
207
+ className: `group flex items-center gap-3 border-b border-border-seam bg-bg-surface p-3 transition-colors hover:bg-bg-sunken focus-within:bg-bg-sunken ${Fe.dropTargetFolderId === t.id && P?.item.id !== t.id ? "bg-action-primary-bg/10" : ""} ${P?.item.id === t.id ? "opacity-50" : ""}`,
191
208
  onClick: () => {
192
- q(t) && S?.(t);
193
- },
194
- onKeyDown: (e) => {
195
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), q(t) && S?.(t));
209
+ Xe(t) && x?.(t);
196
210
  },
197
211
  onDragOver: (e) => {
198
- B && B.item.id !== t.id && J(t) && (e.preventDefault(), Ee(t.id));
212
+ P && P.item.id !== t.id && W(t) && (e.preventDefault(), Ue(t.id));
199
213
  },
200
- onDragLeave: De,
214
+ onDragLeave: We,
201
215
  onDrop: async (e) => {
202
- e.preventDefault(), B && B.item.id !== t.id && J(t) && await Te(t);
216
+ e.preventDefault(), P && P.item.id !== t.id && W(t) && await He(t);
203
217
  },
204
218
  onContextMenu: (e) => {
205
- e.preventDefault(), ke(t, e.clientX, e.clientY);
219
+ e.preventDefault(), Ke(t, e.clientX, e.clientY);
206
220
  },
207
- role: "button",
208
- tabIndex: 0,
209
- "aria-label": o(A, "files.browser.openFolder", "Open folder"),
221
+ ...Z(K(t)),
210
222
  children: [
211
- /* @__PURE__ */ c("div", {
223
+ /* @__PURE__ */ s("div", {
212
224
  className: "flex-shrink-0",
213
- children: /* @__PURE__ */ c("input", {
225
+ children: /* @__PURE__ */ s("input", {
214
226
  type: "checkbox",
215
- checked: F.has(t.id),
227
+ checked: Me.has(t.id),
216
228
  onChange: (n) => {
217
229
  n.stopPropagation(), e.getState().toggleFolderSelection(t.id);
218
230
  },
@@ -220,66 +232,72 @@ var u = ({ files: u, folders: d, loading: ce = !1, error: le = null, preserveSor
220
232
  "aria-label": `Select ${t.name}`
221
233
  })
222
234
  }),
223
- /* @__PURE__ */ c(ie, { className: "size-6 text-action-primary-bg flex-shrink-0" }),
224
- /* @__PURE__ */ c("div", {
235
+ /* @__PURE__ */ s(me, { className: "size-6 text-action-primary-bg flex-shrink-0" }),
236
+ /* @__PURE__ */ s("div", {
225
237
  className: "flex-1 min-w-0",
226
- children: /* @__PURE__ */ l("div", {
238
+ children: /* @__PURE__ */ c("div", {
227
239
  className: "flex items-center gap-2",
228
- children: [/* @__PURE__ */ c("span", {
229
- className: "font-text-md font-weight-medium text-text-primary truncate",
240
+ children: [/* @__PURE__ */ s("button", {
241
+ type: "button",
242
+ onClick: (e) => {
243
+ e.stopPropagation(), Xe(t) && x?.(t);
244
+ },
245
+ className: "min-w-0 truncate rounded-sm text-left font-text-md font-weight-medium text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-action-primary-bg",
246
+ "aria-label": `${i(k, "files.browser.openFolder", "Open folder")} ${t.name}`,
230
247
  children: t.name
231
- }), t.starred && /* @__PURE__ */ c(ae, { className: "size-3 flex-shrink-0 fill-status-warning-text text-status-warning-text" })]
248
+ }), t.starred && /* @__PURE__ */ s(he, { className: "size-3 flex-shrink-0 fill-status-warning-text text-status-warning-text" })]
232
249
  })
233
250
  }),
234
- /* @__PURE__ */ c("div", {
251
+ /* @__PURE__ */ s("div", {
235
252
  className: "hidden @lg:block flex-shrink-0 w-40",
236
- children: t.createdBy && /* @__PURE__ */ l("div", {
253
+ children: t.createdBy && /* @__PURE__ */ c("div", {
237
254
  className: "flex items-center gap-2",
238
- children: [t.createdBy.avatar && /* @__PURE__ */ c("img", {
255
+ children: [t.createdBy.avatar && /* @__PURE__ */ s("img", {
239
256
  src: t.createdBy.avatar,
240
257
  alt: t.createdBy.name,
241
258
  className: "size-6 rounded-full"
242
- }), /* @__PURE__ */ c("span", {
259
+ }), /* @__PURE__ */ s("span", {
243
260
  className: "font-text-sm text-text-secondary truncate",
244
261
  children: t.createdBy.name
245
262
  })]
246
263
  })
247
264
  }),
248
- /* @__PURE__ */ c("div", {
265
+ /* @__PURE__ */ s("div", {
249
266
  className: "hidden @md:block flex-shrink-0 w-24 text-right",
250
- children: /* @__PURE__ */ l("span", {
267
+ children: /* @__PURE__ */ c("span", {
251
268
  className: "font-text-sm text-text-secondary",
252
269
  children: [
253
270
  (t.filesCount ?? 0) + (t.subfoldersCount ?? 0),
254
271
  " ",
255
- o(A, "files.browser.items", "items")
272
+ i(k, "files.browser.items", "items")
256
273
  ]
257
274
  })
258
275
  }),
259
- /* @__PURE__ */ c("div", {
276
+ /* @__PURE__ */ s("div", {
260
277
  className: "hidden @lg:block flex-shrink-0 w-32 text-right",
261
- children: /* @__PURE__ */ c("span", {
278
+ children: /* @__PURE__ */ s("span", {
262
279
  className: "font-text-sm text-text-secondary",
263
280
  children: new Date(t.updatedAt).toLocaleDateString()
264
281
  })
265
282
  }),
266
- /* @__PURE__ */ l("div", {
283
+ /* @__PURE__ */ c("div", {
267
284
  className: "flex w-32 flex-shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",
268
285
  children: [
269
- Y(t) && C && /* @__PURE__ */ c("button", {
286
+ G(t) && X && /* @__PURE__ */ s("button", {
270
287
  type: "button",
271
288
  onClick: (e) => {
272
- e.stopPropagation(), C(t);
289
+ e.stopPropagation(), X(t);
273
290
  },
274
- className: "p-1.5 hover:bg-action-ghost-bg-hover rounded transition-colors",
275
- "aria-label": o(A, "files.browser.share", "Share"),
276
- title: o(A, "files.browser.shareFolder", "Share folder"),
277
- children: /* @__PURE__ */ c("svg", {
291
+ "data-share-denied": J(t) !== void 0 || void 0,
292
+ className: `p-1.5 rounded transition-colors hover:bg-action-ghost-bg-hover ${J(t) === void 0 ? "" : "opacity-50"}`,
293
+ "aria-label": i(k, "files.browser.share", "Share"),
294
+ title: J(t) ?? i(k, "files.browser.shareFolder", "Share folder"),
295
+ children: /* @__PURE__ */ s("svg", {
278
296
  className: "size-4 text-text-primary",
279
297
  fill: "none",
280
298
  viewBox: "0 0 24 24",
281
299
  stroke: "currentColor",
282
- children: /* @__PURE__ */ c("path", {
300
+ children: /* @__PURE__ */ s("path", {
283
301
  strokeLinecap: "round",
284
302
  strokeLinejoin: "round",
285
303
  strokeWidth: 2,
@@ -287,20 +305,20 @@ var u = ({ files: u, folders: d, loading: ce = !1, error: le = null, preserveSor
287
305
  })
288
306
  })
289
307
  }),
290
- J(t) && E && /* @__PURE__ */ c("button", {
308
+ V(t) && T && /* @__PURE__ */ s("button", {
291
309
  type: "button",
292
310
  onClick: (e) => {
293
- e.stopPropagation(), E(t);
311
+ e.stopPropagation(), T(t);
294
312
  },
295
313
  className: "hidden @md:block p-1.5 hover:bg-action-ghost-bg-hover rounded transition-colors",
296
- "aria-label": o(A, "files.browser.rename", "Rename"),
297
- title: o(A, "files.browser.rename", "Rename"),
298
- children: /* @__PURE__ */ c("svg", {
314
+ "aria-label": i(k, "files.browser.rename", "Rename"),
315
+ title: i(k, "files.browser.rename", "Rename"),
316
+ children: /* @__PURE__ */ s("svg", {
299
317
  className: "size-4 text-text-primary",
300
318
  fill: "none",
301
319
  viewBox: "0 0 24 24",
302
320
  stroke: "currentColor",
303
- children: /* @__PURE__ */ c("path", {
321
+ children: /* @__PURE__ */ s("path", {
304
322
  strokeLinecap: "round",
305
323
  strokeLinejoin: "round",
306
324
  strokeWidth: 2,
@@ -308,20 +326,20 @@ var u = ({ files: u, folders: d, loading: ce = !1, error: le = null, preserveSor
308
326
  })
309
327
  })
310
328
  }),
311
- X(t) && w && /* @__PURE__ */ c("button", {
329
+ U(t) && C && /* @__PURE__ */ s("button", {
312
330
  type: "button",
313
331
  onClick: (e) => {
314
- e.stopPropagation(), w(t);
332
+ e.stopPropagation(), C(t);
315
333
  },
316
334
  className: "p-1.5 hover:bg-action-danger-bg-hover rounded transition-colors",
317
- "aria-label": o(A, "files.browser.delete", "Delete"),
318
- title: o(A, "files.browser.delete", "Delete"),
319
- children: /* @__PURE__ */ c("svg", {
335
+ "aria-label": i(k, "files.browser.delete", "Delete"),
336
+ title: i(k, "files.browser.delete", "Delete"),
337
+ children: /* @__PURE__ */ s("svg", {
320
338
  className: "size-4 text-status-error-text",
321
339
  fill: "none",
322
340
  viewBox: "0 0 24 24",
323
341
  stroke: "currentColor",
324
- children: /* @__PURE__ */ c("path", {
342
+ children: /* @__PURE__ */ s("path", {
325
343
  strokeLinecap: "round",
326
344
  strokeLinejoin: "round",
327
345
  strokeWidth: 2,
@@ -329,120 +347,139 @@ var u = ({ files: u, folders: d, loading: ce = !1, error: le = null, preserveSor
329
347
  })
330
348
  })
331
349
  }),
332
- /* @__PURE__ */ c("div", {
350
+ /* @__PURE__ */ s("div", {
333
351
  onClick: (e) => e.stopPropagation(),
334
- children: /* @__PURE__ */ c(te, {
335
- items: i({
336
- onShare: Y(t) && C ? () => C(t) : void 0,
337
- onRename: J(t) && E ? () => E(t) : void 0,
338
- onStar: J(t) && D ? () => D(t) : void 0,
339
- onMove: J(t) && O ? () => O(t) : void 0,
340
- onInfo: () => k?.(t),
341
- onRestore: J(t) && T ? () => T(t) : void 0,
342
- onDelete: X(t) && w ? () => w(t) : void 0,
352
+ children: /* @__PURE__ */ s(ee, {
353
+ items: re({
354
+ onShare: G(t) && X ? () => X(t) : void 0,
355
+ shareDeniedReason: J(t),
356
+ onRename: V(t) && T ? () => T(t) : void 0,
357
+ onStar: V(t) && E ? () => E(t) : void 0,
358
+ onMove: H(t) && D ? () => D(t) : void 0,
359
+ onInfo: () => O?.(t),
360
+ onRestore: w ? () => w(t) : void 0,
361
+ onDelete: U(t) && C ? () => C(t) : void 0,
343
362
  isStarred: t.starred
344
- }, A),
345
- isOpen: ve === t.id,
346
- onToggle: (e) => ye(e ? t.id : null)
363
+ }, k),
364
+ isOpen: Ne === t.id,
365
+ onToggle: (e) => {
366
+ let n = K(t);
367
+ e && S && n && N.ensure(n), Pe(e ? t.id : null);
368
+ }
347
369
  })
348
370
  })
349
371
  ]
350
372
  })
351
373
  ]
352
- }, t.id)), Q.map((e) => /* @__PURE__ */ c(n, {
353
- file: e,
354
- isSelected: P.has(e.id),
355
- isDragging: B?.item.id === e.id,
356
- onPreview: U(e) ? de : void 0,
357
- onShare: G(e) ? f : void 0,
358
- onDelete: K(e) ? p : void 0,
359
- onRestore: W(e) ? m : void 0,
360
- onFavorite: W(e) ? h : void 0,
361
- onRename: W(e) ? g : void 0,
362
- onDownload: U(e) ? _ : void 0,
363
- onCopy: U(e) ? v : void 0,
364
- onMove: W(e) ? y : void 0,
365
- onInfo: b,
366
- onActivity: x,
367
- onDragStart: W(e) ? Ce : void 0,
368
- onDragEnd: V,
369
- onContextMenu: Oe
374
+ }, t.id)), Q.map((e) => /* @__PURE__ */ s("div", {
375
+ className: "contents",
376
+ ...Z(B(e)),
377
+ children: /* @__PURE__ */ s(n, {
378
+ file: e,
379
+ isSelected: je.has(e.id),
380
+ isDragging: P?.item.id === e.id,
381
+ onPreview: Je(e) ? xe : void 0,
382
+ onShare: z(e) ? Y : void 0,
383
+ shareDeniedReason: q(e),
384
+ onDelete: R(e) ? f : void 0,
385
+ onRestore: p,
386
+ onFavorite: I(e) ? m : void 0,
387
+ onRename: I(e) ? h : void 0,
388
+ onDownload: g,
389
+ onCopy: F(e) ? _ : void 0,
390
+ onMove: L(e) ? v : void 0,
391
+ onInfo: y,
392
+ onActivity: b,
393
+ onDragStart: Ye(e) ? ze : void 0,
394
+ onDragEnd: Ve,
395
+ onContextMenu: Ge
396
+ })
370
397
  }, e.id))]
371
398
  }),
372
- R && /* @__PURE__ */ c(r, {
373
- x: R.x,
374
- y: R.y,
375
- onClose: H,
376
- items: Z()
399
+ j && /* @__PURE__ */ s(te, {
400
+ x: j.x,
401
+ y: j.y,
402
+ onClose: qe,
403
+ items: et()
377
404
  })
378
405
  ]
379
- }) : null : /* @__PURE__ */ l("div", {
406
+ }) : null : /* @__PURE__ */ c("div", {
380
407
  className: "@container bg-bg-canvas p-page-padding",
381
408
  children: [
382
- $.length > 0 && /* @__PURE__ */ l("div", {
409
+ $.length > 0 && /* @__PURE__ */ c("div", {
383
410
  className: Q.length > 0 ? "mb-6" : "",
384
- children: [Q.length > 0 && /* @__PURE__ */ c("h2", {
411
+ children: [Q.length > 0 && /* @__PURE__ */ s("h2", {
385
412
  className: "text-xs font-semibold text-text-tertiary uppercase tracking-wider mb-3 px-1",
386
- children: o(A, "files.browser.section.folders", "Folders")
387
- }), /* @__PURE__ */ c("div", {
413
+ children: i(k, "files.browser.section.folders", "Folders")
414
+ }), /* @__PURE__ */ s("div", {
388
415
  className: "grid grid-cols-1 @sm:grid-cols-2 @lg:grid-cols-3 @xl:grid-cols-4 gap-2",
389
- children: $.map((e) => /* @__PURE__ */ c(ee, {
390
- folder: e,
391
- isSelected: F.has(e.id),
392
- isDragging: B?.item.id === e.id,
393
- isDropTarget: I.dropTargetFolderId === e.id,
394
- draggedItem: B,
395
- onOpen: q(e) ? S : void 0,
396
- onShare: Y(e) ? C : void 0,
397
- onDelete: X(e) ? w : void 0,
398
- onRestore: J(e) ? T : void 0,
399
- onRename: J(e) ? E : void 0,
400
- onFavorite: J(e) ? D : void 0,
401
- onCopy: fe,
402
- onMove: J(e) ? O : void 0,
403
- onInfo: k,
404
- onActivity: pe,
405
- onDragStart: J(e) ? we : void 0,
406
- onDragEnd: V,
407
- onDrop: J(e) ? Te : void 0,
408
- onContextMenu: ke
416
+ children: $.map((e) => /* @__PURE__ */ s("div", {
417
+ className: "contents",
418
+ ...Z(K(e)),
419
+ children: /* @__PURE__ */ s(r, {
420
+ folder: e,
421
+ isSelected: Me.has(e.id),
422
+ isDragging: P?.item.id === e.id,
423
+ isDropTarget: Fe.dropTargetFolderId === e.id,
424
+ draggedItem: P,
425
+ onOpen: Xe(e) ? x : void 0,
426
+ onShare: G(e) ? X : void 0,
427
+ shareDeniedReason: J(e),
428
+ onDelete: U(e) ? C : void 0,
429
+ onRestore: w,
430
+ onRename: V(e) ? T : void 0,
431
+ onFavorite: V(e) ? E : void 0,
432
+ onCopy: Se,
433
+ onMove: H(e) ? D : void 0,
434
+ onInfo: O,
435
+ onActivity: Ce,
436
+ onDragStart: Ze(e) ? Be : void 0,
437
+ onDragEnd: Ve,
438
+ onDrop: W(e) ? He : void 0,
439
+ onContextMenu: Ke
440
+ })
409
441
  }, e.id))
410
442
  })]
411
443
  }),
412
- Q.length > 0 && /* @__PURE__ */ l("div", { children: [$.length > 0 && /* @__PURE__ */ c("h2", {
444
+ Q.length > 0 && /* @__PURE__ */ c("div", { children: [$.length > 0 && /* @__PURE__ */ s("h2", {
413
445
  className: "text-xs font-semibold text-text-tertiary uppercase tracking-wider mb-3 px-1",
414
- children: o(A, "files.browser.section.files", "Files")
415
- }), /* @__PURE__ */ c("div", {
446
+ children: i(k, "files.browser.section.files", "Files")
447
+ }), /* @__PURE__ */ s("div", {
416
448
  className: "grid grid-cols-2 @md:grid-cols-3 @lg:grid-cols-4 @xl:grid-cols-5 gap-4",
417
- children: Q.map((e) => /* @__PURE__ */ c(t, {
418
- file: e,
419
- isSelected: P.has(e.id),
420
- isDragging: B?.item.id === e.id,
421
- onPreview: U(e) ? de : void 0,
422
- onShare: G(e) ? f : void 0,
423
- onDelete: K(e) ? p : void 0,
424
- onRestore: W(e) ? m : void 0,
425
- onFavorite: W(e) ? h : void 0,
426
- onRename: W(e) ? g : void 0,
427
- onDownload: U(e) ? _ : void 0,
428
- onCopy: U(e) ? v : void 0,
429
- onMove: W(e) ? y : void 0,
430
- onInfo: b,
431
- onActivity: x,
432
- onDragStart: W(e) ? Ce : void 0,
433
- onDragEnd: V,
434
- onContextMenu: Oe
449
+ children: Q.map((e) => /* @__PURE__ */ s("div", {
450
+ className: "contents",
451
+ ...Z(B(e)),
452
+ children: /* @__PURE__ */ s(t, {
453
+ file: e,
454
+ isSelected: je.has(e.id),
455
+ isDragging: P?.item.id === e.id,
456
+ onPreview: Je(e) ? xe : void 0,
457
+ onShare: z(e) ? Y : void 0,
458
+ shareDeniedReason: q(e),
459
+ onDelete: R(e) ? f : void 0,
460
+ onRestore: p,
461
+ onFavorite: I(e) ? m : void 0,
462
+ onRename: I(e) ? h : void 0,
463
+ onDownload: g,
464
+ onCopy: F(e) ? _ : void 0,
465
+ onMove: L(e) ? v : void 0,
466
+ onInfo: y,
467
+ onActivity: b,
468
+ onDragStart: Ye(e) ? ze : void 0,
469
+ onDragEnd: Ve,
470
+ onContextMenu: Ge
471
+ })
435
472
  }, e.id))
436
473
  })] }),
437
- R && /* @__PURE__ */ c(r, {
438
- x: R.x,
439
- y: R.y,
440
- onClose: H,
441
- items: Z()
474
+ j && /* @__PURE__ */ s(te, {
475
+ x: j.x,
476
+ y: j.y,
477
+ onClose: qe,
478
+ items: et()
442
479
  })
443
480
  ]
444
481
  });
445
482
  };
446
- export { u as FileBrowser };
483
+ export { l as FileBrowser };
447
484
 
448
485
  //# sourceMappingURL=FileBrowser.js.map