@brftech/filex-core 0.1.61 → 0.1.63

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 (29) hide show
  1. package/dist/{ArchiveViewer-CbUUEREI.js → ArchiveViewer-D8xRrOPd.js} +2 -2
  2. package/dist/{ArchiveViewer-CbUUEREI.js.map → ArchiveViewer-D8xRrOPd.js.map} +1 -1
  3. package/dist/{CsvViewer-72rDsQJX.js → CsvViewer-gPow-K-G.js} +2 -2
  4. package/dist/{CsvViewer-72rDsQJX.js.map → CsvViewer-gPow-K-G.js.map} +1 -1
  5. package/dist/{DrawioViewer-DSyMwGvg.js → DrawioViewer-5Z-Sh7ab.js} +2 -2
  6. package/dist/{DrawioViewer-DSyMwGvg.js.map → DrawioViewer-5Z-Sh7ab.js.map} +1 -1
  7. package/dist/{EpubViewer-DvDa17d7.js → EpubViewer-Dpjxu635.js} +2 -2
  8. package/dist/{EpubViewer-DvDa17d7.js.map → EpubViewer-Dpjxu635.js.map} +1 -1
  9. package/dist/{IpynbViewer-DibIkdsz.js → IpynbViewer-Ceqkmq9m.js} +2 -2
  10. package/dist/{IpynbViewer-DibIkdsz.js.map → IpynbViewer-Ceqkmq9m.js.map} +1 -1
  11. package/dist/{MermaidViewer-BoFLtGvl.js → MermaidViewer-qmceupn1.js} +2 -2
  12. package/dist/{MermaidViewer-BoFLtGvl.js.map → MermaidViewer-qmceupn1.js.map} +1 -1
  13. package/dist/{PsdViewer-K2iZkwax.js → PsdViewer-kVwnCUUx.js} +2 -2
  14. package/dist/{PsdViewer-K2iZkwax.js.map → PsdViewer-kVwnCUUx.js.map} +1 -1
  15. package/dist/{TiffViewer-JzDzbqpO.js → TiffViewer-Cd0YuEuL.js} +2 -2
  16. package/dist/{TiffViewer-JzDzbqpO.js.map → TiffViewer-Cd0YuEuL.js.map} +1 -1
  17. package/dist/{Viewer3D-WEMYCP8l.js → Viewer3D-b5tJm8li.js} +2 -2
  18. package/dist/{Viewer3D-WEMYCP8l.js.map → Viewer3D-b5tJm8li.js.map} +1 -1
  19. package/dist/filex-core.js +1 -1
  20. package/dist/filex-core.umd.cjs +21 -21
  21. package/dist/filex-core.umd.cjs.map +1 -1
  22. package/dist/{index-B5YT-m5Q.js → index-BkxD82VF.js} +1277 -1259
  23. package/dist/index-BkxD82VF.js.map +1 -0
  24. package/package.json +1 -1
  25. package/src/FileExplorer.vue +27 -2
  26. package/src/components/GridView.vue +1 -0
  27. package/src/components/ListView.vue +1 -0
  28. package/src/composables/useLocale.ts +3 -1
  29. package/dist/index-B5YT-m5Q.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brftech/filex-core",
3
- "version": "0.1.61",
3
+ "version": "0.1.63",
4
4
  "description": "filex core — Vue 3 source of truth for the filex file manager (FileExplorer SFC + composables + types)",
5
5
  "type": "module",
6
6
  "main": "./dist/filex-core.umd.cjs",
@@ -476,10 +476,12 @@ async function load(path?: string) {
476
476
  extension: '',
477
477
  storage: resp.adapter,
478
478
  visibility: 'private',
479
+ size: 0,
479
480
  file_size: 0,
480
481
  mime_type: 'inode/directory',
481
482
  extra_metadata: {},
482
483
  } as unknown as FileNode);
484
+ void hydrateTrashRow(resp.adapter);
483
485
  }
484
486
  // currentPath is the user-facing form: `s3-test/example` in
485
487
  // multi-storage mode, the bare relative path otherwise.
@@ -500,6 +502,29 @@ function stripAdapter(p: string): string {
500
502
  return idx === -1 ? p : p.slice(idx + 3);
501
503
  }
502
504
 
505
+ // hydrateTrashRow — the virtual `.trash` row is synthesized with no size/date;
506
+ // fill both from the backend trash listing (total bytes + newest deletion) so
507
+ // the row reads like a real folder instead of "— / —". Best-effort and
508
+ // non-blocking: the row appears immediately and updates when the listing lands.
509
+ async function hydrateTrashRow(storage: string) {
510
+ try {
511
+ const { entries } = await api.listTrash(storage);
512
+ const row = files.value.find((f) => f.basename === '.trash');
513
+ if (!row) return;
514
+ let total = 0;
515
+ let newest = 0;
516
+ for (const e of entries) {
517
+ total += e.size || 0;
518
+ const ts = Date.parse(e.deleted_at);
519
+ if (!Number.isNaN(ts) && ts > newest) newest = ts;
520
+ }
521
+ row.size = total;
522
+ if (newest > 0) row.last_modified = newest;
523
+ } catch {
524
+ /* keep the bare row */
525
+ }
526
+ }
527
+
503
528
  // loadTrash — show the backend trash (soft-deleted nodes) as a flat listing.
504
529
  // Entered by opening the virtual `.trash` row. Each row keeps its node `id`
505
530
  // so restore can target it. Permanent delete is admin-only / auto-purge, so
@@ -744,7 +769,7 @@ function openNode(n: FileNode) {
744
769
  // standalone editor route, regardless of file type. The editor page
745
770
  // picks the right viewer (OnlyOffice for office, Monaco for code/
746
771
  // text, drawio iframe for .drawio, image/PDF/3D viewers otherwise)
747
- // and wires save-on-change. This is the shape the origin app ships and
772
+ // and wires save-on-change. This is the shape brf-mono ships and
748
773
  // what users expect from a Files-style file manager.
749
774
  //
750
775
  // Capability gate: if we already know the required backend is offline
@@ -802,7 +827,7 @@ async function restoreSelection(targets?: FileNode[]) {
802
827
  await loadTrash();
803
828
  return;
804
829
  }
805
- // Legacy path-based restore (the origin app `.trash/` convention).
830
+ // Legacy path-based restore (brf-mono `.trash/` convention).
806
831
  if (!api.endpoints.restore) return;
807
832
  const items = nodes.map((n) => n.path); // qualified
808
833
  const { restored } = await api.restore(items);
@@ -92,6 +92,7 @@ function parentDir(path: string): string {
92
92
  }
93
93
 
94
94
  function iconFor(n: FileNode): string {
95
+ if (n.basename === '.trash') return '🗑';
95
96
  if (n.mime_type === 'inode/storage') return '💾';
96
97
  if (n.type === 'dir') return '📁';
97
98
  const e = (n.extension || '').toLowerCase();
@@ -112,6 +112,7 @@ function cancelPress() {
112
112
  }
113
113
 
114
114
  function iconFor(n: FileNode): string {
115
+ if (n.basename === '.trash') return '🗑';
115
116
  if (n.mime_type === 'inode/storage') return '💾';
116
117
  if (n.type === 'dir') return '📁';
117
118
  const e = (n.extension || '').toLowerCase();
@@ -24,7 +24,9 @@ export function useLocale(localeRef: Ref<LocaleCode> | (() => LocaleCode)) {
24
24
  }
25
25
 
26
26
  function formatSize(bytes: number | undefined | null): string {
27
- if (bytes == null || bytes <= 0) return '—';
27
+ if (bytes == null || bytes < 0) return '—';
28
+ // A real zero (empty file / empty folder) is information, not absence.
29
+ if (bytes === 0) return `0 ${t('unit.bytes')}`;
28
30
  const units: Array<[number, string]> = [
29
31
  [1024 ** 4, 'unit.tb'],
30
32
  [1024 ** 3, 'unit.gb'],