@brftech/filex-core 0.1.56 → 0.1.60

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 (82) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +108 -108
  3. package/dist/{ArchiveViewer-CJdaw5x3.js → ArchiveViewer-CbUUEREI.js} +20 -20
  4. package/dist/ArchiveViewer-CbUUEREI.js.map +1 -0
  5. package/dist/{CsvViewer-QYx_tePQ.js → CsvViewer-72rDsQJX.js} +3 -3
  6. package/dist/CsvViewer-72rDsQJX.js.map +1 -0
  7. package/dist/{DrawioViewer-GWt0TyB7.js → DrawioViewer-DSyMwGvg.js} +7 -7
  8. package/dist/DrawioViewer-DSyMwGvg.js.map +1 -0
  9. package/dist/{EpubViewer-Je0ywklQ.js → EpubViewer-DvDa17d7.js} +3 -3
  10. package/dist/EpubViewer-DvDa17d7.js.map +1 -0
  11. package/dist/{IpynbViewer-TsB4gqP-.js → IpynbViewer-DibIkdsz.js} +3 -3
  12. package/dist/IpynbViewer-DibIkdsz.js.map +1 -0
  13. package/dist/{MermaidViewer-CXfeDS-7.js → MermaidViewer-BoFLtGvl.js} +3 -3
  14. package/dist/MermaidViewer-BoFLtGvl.js.map +1 -0
  15. package/dist/{PsdViewer-VtPpxKVe.js → PsdViewer-K2iZkwax.js} +3 -3
  16. package/dist/PsdViewer-K2iZkwax.js.map +1 -0
  17. package/dist/{TiffViewer-OINn9bbb.js → TiffViewer-JzDzbqpO.js} +3 -3
  18. package/dist/TiffViewer-JzDzbqpO.js.map +1 -0
  19. package/dist/{Viewer3D-xvvyiWHd.js → Viewer3D-WEMYCP8l.js} +7 -7
  20. package/dist/Viewer3D-WEMYCP8l.js.map +1 -0
  21. package/dist/filex-core.js +1 -1
  22. package/dist/filex-core.umd.cjs +4 -4
  23. package/dist/filex-core.umd.cjs.map +1 -1
  24. package/dist/{index-CmSYzt6L.js → index-B5YT-m5Q.js} +209 -209
  25. package/dist/index-B5YT-m5Q.js.map +1 -0
  26. package/dist/style.css +1 -1
  27. package/dist/useViewerFetch-czqbd2Lj.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/components/Breadcrumb.vue +282 -282
  30. package/src/components/ContextMenu.vue +152 -152
  31. package/src/components/GridView.vue +166 -166
  32. package/src/components/ListView.vue +212 -212
  33. package/src/components/PendingOpsTray.vue +91 -91
  34. package/src/components/RecentlyOpened.vue +155 -155
  35. package/src/components/StarButton.vue +101 -101
  36. package/src/components/TagPicker.vue +184 -184
  37. package/src/components/Toolbar.vue +220 -220
  38. package/src/components/UploadProgress.vue +78 -78
  39. package/src/composables/useFileApi.ts +692 -692
  40. package/src/composables/useKeyboardShortcuts.ts +144 -144
  41. package/src/composables/useLocale.ts +60 -60
  42. package/src/composables/useMonacoLoader.ts +98 -98
  43. package/src/composables/usePendingOps.ts +200 -200
  44. package/src/composables/useSelection.ts +81 -81
  45. package/src/composables/useUploadChunked.ts +250 -250
  46. package/src/composables/useViewerFetch.ts +58 -58
  47. package/src/index.ts +80 -80
  48. package/src/locales/en.ts +122 -122
  49. package/src/locales/index.ts +12 -12
  50. package/src/locales/tr.ts +122 -122
  51. package/src/modals/DeleteConfirmModal.vue +32 -32
  52. package/src/modals/Modal.vue +104 -104
  53. package/src/modals/NewFolderModal.vue +64 -64
  54. package/src/modals/PermissionsModal.vue +815 -815
  55. package/src/modals/PreviewModal.vue +1070 -1070
  56. package/src/modals/RenameModal.vue +58 -58
  57. package/src/modals/ShareModal.vue +135 -135
  58. package/src/styles/base.css +1224 -1224
  59. package/src/styles/variables.css +90 -90
  60. package/src/types/FileNode.ts +136 -136
  61. package/src/types/index.ts +27 -27
  62. package/src/types/peers.d.ts +45 -45
  63. package/src/viewers/ArchiveViewer.vue +186 -186
  64. package/src/viewers/CsvViewer.vue +319 -319
  65. package/src/viewers/DrawioViewer.vue +243 -243
  66. package/src/viewers/EpubViewer.vue +307 -307
  67. package/src/viewers/IpynbViewer.vue +365 -365
  68. package/src/viewers/MermaidViewer.vue +259 -259
  69. package/src/viewers/PdfViewer.vue +562 -562
  70. package/src/viewers/PsdViewer.vue +264 -264
  71. package/src/viewers/TiffViewer.vue +273 -273
  72. package/src/viewers/Viewer3D.vue +120 -120
  73. package/dist/ArchiveViewer-CJdaw5x3.js.map +0 -1
  74. package/dist/CsvViewer-QYx_tePQ.js.map +0 -1
  75. package/dist/DrawioViewer-GWt0TyB7.js.map +0 -1
  76. package/dist/EpubViewer-Je0ywklQ.js.map +0 -1
  77. package/dist/IpynbViewer-TsB4gqP-.js.map +0 -1
  78. package/dist/MermaidViewer-CXfeDS-7.js.map +0 -1
  79. package/dist/PsdViewer-VtPpxKVe.js.map +0 -1
  80. package/dist/TiffViewer-OINn9bbb.js.map +0 -1
  81. package/dist/Viewer3D-xvvyiWHd.js.map +0 -1
  82. package/dist/index-CmSYzt6L.js.map +0 -1
@@ -1,186 +1,186 @@
1
- <script setup lang="ts">
2
- /**
3
- * ArchiveViewer — minimal zip / archive contents preview.
4
- *
5
- * Hits `POST /api/files/archive/list` with the adapter-qualified path
6
- * and renders the member list as a flat table (name, size, mtime).
7
- * Read-only — extraction is exposed elsewhere (context menu / actions
8
- * panel). The viewer's job is just "what's inside?" so the user can
9
- * decide whether to extract or download.
10
- */
11
- import { computed, onMounted, ref, watch } from 'vue';
12
-
13
- interface ArchiveEntry {
14
- name: string;
15
- size: number;
16
- mtime?: string;
17
- is_dir?: boolean;
18
- }
19
-
20
- const props = defineProps<{
21
- url: string;
22
- filePath?: string;
23
- ext: string;
24
- t?: (key: string) => string;
25
- authHeaders?: () => Record<string, string>;
26
- authCredentials?: RequestCredentials;
27
- }>();
28
-
29
- const entries = ref<ArchiveEntry[]>([]);
30
- const loading = ref(true);
31
- const error = ref<string | null>(null);
32
-
33
- function tt(key: string, fallback: string): string {
34
- return props.t ? props.t(key) : fallback;
35
- }
36
-
37
- function fmtSize(n: number): string {
38
- if (n < 1024) return `${n} B`;
39
- if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
40
- if (n < 1024 * 1024 * 1024) return `${(n / (1024 * 1024)).toFixed(1)} MB`;
41
- return `${(n / (1024 * 1024 * 1024)).toFixed(2)} GB`;
42
- }
43
-
44
- async function load(): Promise<void> {
45
- loading.value = true;
46
- error.value = null;
47
- entries.value = [];
48
- // The viewer is mounted with the resolved file path. Hit the API
49
- // endpoint with the same adapter-qualified path the preview URL
50
- // points at — the backend resolves storage + relative path itself.
51
- if (!props.filePath) {
52
- error.value = tt('viewer.archive.error', 'Could not read archive contents.');
53
- loading.value = false;
54
- return;
55
- }
56
- try {
57
- const res = await fetch('/api/files/archive/list', {
58
- method: 'POST',
59
- credentials: props.authCredentials || 'include',
60
- headers: {
61
- 'Content-Type': 'application/json',
62
- ...(props.authHeaders ? props.authHeaders() : {}),
63
- },
64
- body: JSON.stringify({ path: props.filePath }),
65
- });
66
- if (!res.ok) {
67
- throw new Error(`${res.status} ${res.statusText}`);
68
- }
69
- const body = (await res.json()) as { entries?: ArchiveEntry[] };
70
- entries.value = body.entries ?? [];
71
- } catch (err) {
72
- error.value = err instanceof Error ? err.message : tt('viewer.archive.error', 'Could not read archive contents.');
73
- } finally {
74
- loading.value = false;
75
- }
76
- }
77
-
78
- onMounted(load);
79
- watch(() => props.filePath, load);
80
-
81
- const totalSize = computed(() => entries.value.reduce((sum, e) => sum + (e.size || 0), 0));
82
- const fileCount = computed(() => entries.value.filter((e) => !e.is_dir).length);
83
- </script>
84
-
85
- <template>
86
- <div class="filex-viewer-archive">
87
- <div v-if="error" class="filex-viewer-fallback">
88
- <span class="filex-viewer-fallback__icon">🗜️</span>
89
- <p>{{ error }}</p>
90
- </div>
91
- <div v-else-if="loading" class="filex-viewer-fallback">
92
- <span class="filex-viewer-fallback__icon">⏳</span>
93
- <p>{{ tt('viewer.loading', 'Loading…') }}</p>
94
- </div>
95
- <div v-else-if="entries.length === 0" class="filex-viewer-fallback">
96
- <span class="filex-viewer-fallback__icon">🗜️</span>
97
- <p>{{ tt('viewer.archive.empty', 'Archive is empty.') }}</p>
98
- </div>
99
- <div v-else class="filex-viewer-archive__pane">
100
- <div class="filex-viewer-archive__summary">
101
- {{ fileCount }} {{ tt('viewer.archive.entries', '{n} files').replace('{n}', String(fileCount)) }}
102
- · {{ fmtSize(totalSize) }}
103
- </div>
104
- <table class="filex-viewer-archive__table">
105
- <thead>
106
- <tr>
107
- <th>{{ tt('viewer.name', 'Name') }}</th>
108
- <th class="filex-viewer-archive__size">{{ tt('viewer.size', 'Size') }}</th>
109
- </tr>
110
- </thead>
111
- <tbody>
112
- <tr v-for="(e, i) in entries" :key="i" :data-dir="e.is_dir ? '1' : '0'">
113
- <td>
114
- <span class="filex-viewer-archive__icon">{{ e.is_dir ? '📁' : '📄' }}</span>
115
- {{ e.name }}
116
- </td>
117
- <td class="filex-viewer-archive__size">{{ e.is_dir ? '' : fmtSize(e.size) }}</td>
118
- </tr>
119
- </tbody>
120
- </table>
121
- </div>
122
- </div>
123
- </template>
124
-
125
- <style scoped>
126
- .filex-viewer-archive {
127
- display: flex;
128
- flex-direction: column;
129
- width: 100%;
130
- height: 100%;
131
- min-height: 70vh;
132
- background: var(--fe-bg, #fff);
133
- color: var(--fe-text, #1a1e27);
134
- }
135
- .filex-viewer-archive__pane {
136
- flex: 1;
137
- overflow: auto;
138
- padding: 16px 20px;
139
- }
140
- .filex-viewer-archive__summary {
141
- font-size: 12px;
142
- color: var(--fe-text-muted, #5a6475);
143
- margin-bottom: 12px;
144
- font-variant-numeric: tabular-nums;
145
- }
146
- .filex-viewer-archive__table {
147
- width: 100%;
148
- border-collapse: collapse;
149
- font-size: 13px;
150
- font-family: var(--fe-font-mono, monospace);
151
- }
152
- .filex-viewer-archive__table th,
153
- .filex-viewer-archive__table td {
154
- padding: 6px 12px;
155
- border-bottom: 1px solid var(--fe-border, #e2e6ed);
156
- text-align: left;
157
- }
158
- .filex-viewer-archive__table th {
159
- background: var(--fe-bg-elev, #f7f8fa);
160
- font-weight: 600;
161
- position: sticky;
162
- top: 0;
163
- }
164
- .filex-viewer-archive__size {
165
- text-align: right;
166
- font-variant-numeric: tabular-nums;
167
- white-space: nowrap;
168
- color: var(--fe-text-muted, #5a6475);
169
- }
170
- .filex-viewer-archive__icon {
171
- margin-right: 6px;
172
- }
173
- .filex-viewer-archive__table tr[data-dir="1"] {
174
- color: var(--fe-text-muted, #5a6475);
175
- }
176
- .filex-viewer-fallback {
177
- text-align: center;
178
- padding: 32px;
179
- color: var(--fe-text-muted, #5a6475);
180
- }
181
- .filex-viewer-fallback__icon {
182
- font-size: 48px;
183
- display: block;
184
- margin-bottom: 12px;
185
- }
186
- </style>
1
+ <script setup lang="ts">
2
+ /**
3
+ * ArchiveViewer — minimal zip / archive contents preview.
4
+ *
5
+ * Hits `POST /api/files/archive/list` with the adapter-qualified path
6
+ * and renders the member list as a flat table (name, size, mtime).
7
+ * Read-only — extraction is exposed elsewhere (context menu / actions
8
+ * panel). The viewer's job is just "what's inside?" so the user can
9
+ * decide whether to extract or download.
10
+ */
11
+ import { computed, onMounted, ref, watch } from 'vue';
12
+
13
+ interface ArchiveEntry {
14
+ name: string;
15
+ size: number;
16
+ mtime?: string;
17
+ is_dir?: boolean;
18
+ }
19
+
20
+ const props = defineProps<{
21
+ url: string;
22
+ filePath?: string;
23
+ ext: string;
24
+ t?: (key: string) => string;
25
+ authHeaders?: () => Record<string, string>;
26
+ authCredentials?: RequestCredentials;
27
+ }>();
28
+
29
+ const entries = ref<ArchiveEntry[]>([]);
30
+ const loading = ref(true);
31
+ const error = ref<string | null>(null);
32
+
33
+ function tt(key: string, fallback: string): string {
34
+ return props.t ? props.t(key) : fallback;
35
+ }
36
+
37
+ function fmtSize(n: number): string {
38
+ if (n < 1024) return `${n} B`;
39
+ if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
40
+ if (n < 1024 * 1024 * 1024) return `${(n / (1024 * 1024)).toFixed(1)} MB`;
41
+ return `${(n / (1024 * 1024 * 1024)).toFixed(2)} GB`;
42
+ }
43
+
44
+ async function load(): Promise<void> {
45
+ loading.value = true;
46
+ error.value = null;
47
+ entries.value = [];
48
+ // The viewer is mounted with the resolved file path. Hit the API
49
+ // endpoint with the same adapter-qualified path the preview URL
50
+ // points at — the backend resolves storage + relative path itself.
51
+ if (!props.filePath) {
52
+ error.value = tt('viewer.archive.error', 'Could not read archive contents.');
53
+ loading.value = false;
54
+ return;
55
+ }
56
+ try {
57
+ const res = await fetch('/api/files/archive/list', {
58
+ method: 'POST',
59
+ credentials: props.authCredentials || 'include',
60
+ headers: {
61
+ 'Content-Type': 'application/json',
62
+ ...(props.authHeaders ? props.authHeaders() : {}),
63
+ },
64
+ body: JSON.stringify({ path: props.filePath }),
65
+ });
66
+ if (!res.ok) {
67
+ throw new Error(`${res.status} ${res.statusText}`);
68
+ }
69
+ const body = (await res.json()) as { entries?: ArchiveEntry[] };
70
+ entries.value = body.entries ?? [];
71
+ } catch (err) {
72
+ error.value = err instanceof Error ? err.message : tt('viewer.archive.error', 'Could not read archive contents.');
73
+ } finally {
74
+ loading.value = false;
75
+ }
76
+ }
77
+
78
+ onMounted(load);
79
+ watch(() => props.filePath, load);
80
+
81
+ const totalSize = computed(() => entries.value.reduce((sum, e) => sum + (e.size || 0), 0));
82
+ const fileCount = computed(() => entries.value.filter((e) => !e.is_dir).length);
83
+ </script>
84
+
85
+ <template>
86
+ <div class="filex-viewer-archive">
87
+ <div v-if="error" class="filex-viewer-fallback">
88
+ <span class="filex-viewer-fallback__icon">🗜️</span>
89
+ <p>{{ error }}</p>
90
+ </div>
91
+ <div v-else-if="loading" class="filex-viewer-fallback">
92
+ <span class="filex-viewer-fallback__icon">⏳</span>
93
+ <p>{{ tt('viewer.loading', 'Loading…') }}</p>
94
+ </div>
95
+ <div v-else-if="entries.length === 0" class="filex-viewer-fallback">
96
+ <span class="filex-viewer-fallback__icon">🗜️</span>
97
+ <p>{{ tt('viewer.archive.empty', 'Archive is empty.') }}</p>
98
+ </div>
99
+ <div v-else class="filex-viewer-archive__pane">
100
+ <div class="filex-viewer-archive__summary">
101
+ {{ fileCount }} {{ tt('viewer.archive.entries', '{n} files').replace('{n}', String(fileCount)) }}
102
+ · {{ fmtSize(totalSize) }}
103
+ </div>
104
+ <table class="filex-viewer-archive__table">
105
+ <thead>
106
+ <tr>
107
+ <th>{{ tt('viewer.name', 'Name') }}</th>
108
+ <th class="filex-viewer-archive__size">{{ tt('viewer.size', 'Size') }}</th>
109
+ </tr>
110
+ </thead>
111
+ <tbody>
112
+ <tr v-for="(e, i) in entries" :key="i" :data-dir="e.is_dir ? '1' : '0'">
113
+ <td>
114
+ <span class="filex-viewer-archive__icon">{{ e.is_dir ? '📁' : '📄' }}</span>
115
+ {{ e.name }}
116
+ </td>
117
+ <td class="filex-viewer-archive__size">{{ e.is_dir ? '' : fmtSize(e.size) }}</td>
118
+ </tr>
119
+ </tbody>
120
+ </table>
121
+ </div>
122
+ </div>
123
+ </template>
124
+
125
+ <style scoped>
126
+ .filex-viewer-archive {
127
+ display: flex;
128
+ flex-direction: column;
129
+ width: 100%;
130
+ height: 100%;
131
+ min-height: 70vh;
132
+ background: var(--fe-bg, #fff);
133
+ color: var(--fe-text, #1a1e27);
134
+ }
135
+ .filex-viewer-archive__pane {
136
+ flex: 1;
137
+ overflow: auto;
138
+ padding: 16px 20px;
139
+ }
140
+ .filex-viewer-archive__summary {
141
+ font-size: 12px;
142
+ color: var(--fe-text-muted, #5a6475);
143
+ margin-bottom: 12px;
144
+ font-variant-numeric: tabular-nums;
145
+ }
146
+ .filex-viewer-archive__table {
147
+ width: 100%;
148
+ border-collapse: collapse;
149
+ font-size: 13px;
150
+ font-family: var(--fe-font-mono, monospace);
151
+ }
152
+ .filex-viewer-archive__table th,
153
+ .filex-viewer-archive__table td {
154
+ padding: 6px 12px;
155
+ border-bottom: 1px solid var(--fe-border, #e2e6ed);
156
+ text-align: left;
157
+ }
158
+ .filex-viewer-archive__table th {
159
+ background: var(--fe-bg-elev, #f7f8fa);
160
+ font-weight: 600;
161
+ position: sticky;
162
+ top: 0;
163
+ }
164
+ .filex-viewer-archive__size {
165
+ text-align: right;
166
+ font-variant-numeric: tabular-nums;
167
+ white-space: nowrap;
168
+ color: var(--fe-text-muted, #5a6475);
169
+ }
170
+ .filex-viewer-archive__icon {
171
+ margin-right: 6px;
172
+ }
173
+ .filex-viewer-archive__table tr[data-dir="1"] {
174
+ color: var(--fe-text-muted, #5a6475);
175
+ }
176
+ .filex-viewer-fallback {
177
+ text-align: center;
178
+ padding: 32px;
179
+ color: var(--fe-text-muted, #5a6475);
180
+ }
181
+ .filex-viewer-fallback__icon {
182
+ font-size: 48px;
183
+ display: block;
184
+ margin-bottom: 12px;
185
+ }
186
+ </style>