@brftech/filex-core 0.40.0 → 0.41.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -25
- package/dist/ArchiveViewer-DxxjhYZD.js +124 -0
- package/dist/ArchiveViewer-DxxjhYZD.js.map +1 -0
- package/dist/CsvViewer-CyuwENI_.js +141 -0
- package/dist/CsvViewer-CyuwENI_.js.map +1 -0
- package/dist/{DrawioViewer-BNALOB04.js → DrawioViewer-BIYsTX97.js} +48 -42
- package/dist/DrawioViewer-BIYsTX97.js.map +1 -0
- package/dist/EpubViewer-K9PjCMmS.js +163 -0
- package/dist/EpubViewer-K9PjCMmS.js.map +1 -0
- package/dist/IpynbViewer-DYU6Zgz2.js +184 -0
- package/dist/IpynbViewer-DYU6Zgz2.js.map +1 -0
- package/dist/MermaidViewer-Bp73aId8.js +137 -0
- package/dist/MermaidViewer-Bp73aId8.js.map +1 -0
- package/dist/PsdViewer-C2eLivw1.js +122 -0
- package/dist/PsdViewer-C2eLivw1.js.map +1 -0
- package/dist/TiffViewer-DsHg5gcz.js +142 -0
- package/dist/TiffViewer-DsHg5gcz.js.map +1 -0
- package/dist/Viewer3D-C_dc2HN9.js +75 -0
- package/dist/Viewer3D-C_dc2HN9.js.map +1 -0
- package/dist/filex-core.js +218 -20361
- package/dist/filex-core.js.map +1 -1
- package/dist/filex-core.umd.cjs +61 -62
- package/dist/filex-core.umd.cjs.map +1 -1
- package/dist/index-vxMZpYb-.js +26700 -0
- package/dist/index-vxMZpYb-.js.map +1 -0
- package/dist/index.d.ts +4212 -862
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/FileExplorer.vue +2154 -506
- package/src/components/AdvancedSearch.vue +870 -0
- package/src/components/Breadcrumb.vue +191 -19
- package/src/components/CommandPalette.vue +66 -22
- package/src/components/ConnectionsPanel.vue +6 -2
- package/src/components/ContextMenu.vue +39 -2
- package/src/components/EncryptedFolderModal.vue +31 -25
- package/src/components/FilePane.vue +951 -0
- package/src/components/FilterBar.vue +568 -72
- package/src/components/GalleryView.vue +172 -56
- package/src/components/GridView.vue +331 -82
- package/src/components/HomeView.vue +331 -0
- package/src/components/InspectorPanel.vue +296 -53
- package/src/components/ListView.vue +1173 -194
- package/src/components/NFSExportsPanel.vue +7 -4
- package/src/components/OnboardingTour.vue +156 -33
- package/src/components/QuickLook.vue +26 -1
- package/src/components/RecentlyOpened.vue +17 -2
- package/src/components/S3KeysPanel.vue +7 -4
- package/src/components/SSHKeysPanel.vue +7 -4
- package/src/components/ShortcutSettings.vue +6 -2
- package/src/components/ShortcutsHelp.vue +4 -1
- package/src/components/SideNav.vue +206 -140
- package/src/components/StorageFields.vue +19 -1
- package/src/components/TabBar.vue +87 -1
- package/src/components/TagPicker.vue +77 -6
- package/src/components/ThemeGallery.vue +13 -198
- package/src/components/ThemePalette.vue +244 -0
- package/src/components/TimeZoneDialog.vue +135 -0
- package/src/components/TimeZonePicker.vue +696 -0
- package/src/components/TokensPanel.vue +35 -14
- package/src/components/Toolbar.vue +953 -465
- package/src/components/ViewSwitcher.vue +9 -4
- package/src/composables/useConnections.ts +35 -4
- package/src/composables/useExplorerTimeZone.ts +89 -0
- package/src/composables/useFileApi.ts +53 -4
- package/src/composables/useLocale.ts +382 -26
- package/src/composables/useRowTouch.ts +95 -0
- package/src/index.ts +177 -3
- package/src/lib/actionIcons.ts +330 -0
- package/src/lib/advSearch.ts +162 -0
- package/src/lib/dateGroups.ts +197 -0
- package/src/lib/destinationTree.ts +235 -0
- package/src/lib/downloadSelection.ts +154 -0
- package/src/lib/fileFilters.ts +319 -12
- package/src/lib/fileIcons.ts +299 -5
- package/src/lib/filePreview.ts +605 -0
- package/src/lib/listing.ts +72 -0
- package/src/lib/shareTtl.ts +31 -2
- package/src/lib/sortOrder.ts +459 -0
- package/src/lib/themes.ts +151 -116
- package/src/lib/timezone.ts +501 -0
- package/src/lib/uiProfile.ts +82 -0
- package/src/lib/viewPrefs.ts +1036 -0
- package/src/locales/en.ts +416 -26
- package/src/locales/tr.ts +409 -26
- package/src/modals/ConvertModal.vue +23 -3
- package/src/modals/DestinationPickerModal.vue +341 -0
- package/src/modals/Modal.vue +18 -4
- package/src/modals/NewDocumentModal.vue +525 -0
- package/src/modals/NewFolderModal.vue +15 -9
- package/src/modals/PermissionsModal.vue +557 -476
- package/src/modals/PreviewModal.vue +516 -156
- package/src/styles/base.css +5409 -8
- package/src/styles/variables.css +139 -65
- package/src/types/Connections.ts +9 -0
- package/src/types/ExplorerConfig.ts +144 -39
- package/src/types/FileNode.ts +28 -0
- package/src/viewers/ArchiveViewer.vue +46 -8
- package/src/viewers/CsvViewer.vue +19 -2
- package/src/viewers/DrawioViewer.vue +12 -1
- package/src/viewers/EpubViewer.vue +50 -6
- package/src/viewers/IpynbViewer.vue +19 -2
- package/src/viewers/MermaidViewer.vue +20 -3
- package/src/viewers/PdfViewer.vue +24 -4
- package/src/viewers/PsdViewer.vue +28 -4
- package/src/viewers/TiffViewer.vue +19 -2
- package/src/viewers/Viewer3D.vue +36 -2
- package/dist/ArchiveViewer-Cdfv9LFC.js +0 -99
- package/dist/ArchiveViewer-Cdfv9LFC.js.map +0 -1
- package/dist/CsvViewer-CqWeV8VO.js +0 -131
- package/dist/CsvViewer-CqWeV8VO.js.map +0 -1
- package/dist/DrawioViewer-BNALOB04.js.map +0 -1
- package/dist/EpubViewer-BPmlImG7.js +0 -145
- package/dist/EpubViewer-BPmlImG7.js.map +0 -1
- package/dist/IpynbViewer-CDlQmuCV.js +0 -175
- package/dist/IpynbViewer-CDlQmuCV.js.map +0 -1
- package/dist/MermaidViewer-sfZWdR-d.js +0 -127
- package/dist/MermaidViewer-sfZWdR-d.js.map +0 -1
- package/dist/PsdViewer-DwuySZsb.js +0 -112
- package/dist/PsdViewer-DwuySZsb.js.map +0 -1
- package/dist/TiffViewer-BDQ3d3CQ.js +0 -132
- package/dist/TiffViewer-BDQ3d3CQ.js.map +0 -1
- package/dist/Viewer3D-CJJJgkuv.js +0 -60
- package/dist/Viewer3D-CJJJgkuv.js.map +0 -1
- package/src/components/SecondaryPane.vue +0 -447
- package/src/modals/ShareModal.vue +0 -139
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TiffViewer-BDQ3d3CQ.js","sources":["../src/viewers/TiffViewer.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * TiffViewer — multi-page TIFF preview via `utif`.\n *\n * Lazy-imports `utif` (~50 KB). Decodes IFDs once, paints the active\n * page to a `<canvas>` via `UTIF.toRGBA8`. Page navigation (1/N) +\n * zoom in/out controls. Browser <img> can't render TIFF natively, so\n * the canvas pipeline is the only option short of server-side\n * conversion.\n */\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';\nimport { fetchViewerArrayBuffer } from '../composables/useViewerFetch';\n\nconst props = defineProps<{\n url: string;\n mime?: string;\n ext: string;\n t?: (key: string) => string;\n authHeaders?: () => Record<string, string> | Promise<Record<string, string>>;\n authCredentials?: RequestCredentials;\n}>();\n\nconst canvasEl = ref<HTMLCanvasElement | null>(null);\nconst error = ref<string | null>(null);\nconst loading = ref(true);\nconst scale = ref(1);\nconst pageIndex = ref(0);\nconst pageCount = ref(0);\nconst pageDims = ref<{ width: number; height: number }>({ width: 0, height: 0 });\n\nlet UTIF: any = null;\nlet ifds: any[] | null = null;\nlet renderToken = 0;\n\nasync function ensureUtif(): Promise<any | null> {\n if (UTIF) return UTIF;\n try {\n const mod = await import(/* @vite-ignore */ 'utif');\n UTIF = mod.default ?? mod;\n return UTIF;\n } catch {\n return null;\n }\n}\n\nasync function load(): Promise<void> {\n loading.value = true;\n error.value = null;\n ifds = null;\n pageIndex.value = 0;\n pageCount.value = 0;\n const myToken = ++renderToken;\n\n const lib = await ensureUtif();\n if (myToken !== renderToken) return;\n if (!lib) {\n error.value = props.t\n ? props.t('viewer.peer_not_installed')\n : 'TIFF viewer requires `utif` — install or use download.';\n loading.value = false;\n return;\n }\n\n try {\n const buf = await fetchViewerArrayBuffer({\n url: props.url,\n headers: (await props.authHeaders?.()) ?? {},\n credentials: props.authCredentials,\n });\n if (myToken !== renderToken) return;\n ifds = lib.decode(buf);\n pageCount.value = ifds?.length ?? 0;\n if (pageCount.value === 0) {\n throw new Error('No pages decoded');\n }\n paint();\n } catch (err) {\n error.value = err instanceof Error ? err.message : 'TIFF decode failed';\n } finally {\n loading.value = false;\n }\n}\n\nfunction paint(): void {\n if (!UTIF || !ifds || !canvasEl.value) return;\n const idx = Math.max(0, Math.min(pageIndex.value, ifds.length - 1));\n const ifd = ifds[idx];\n try {\n UTIF.decodeImage(undefined, ifd);\n } catch {\n // some images already decoded — UTIF.decodeImage is idempotent on\n // older versions.\n }\n const rgba = UTIF.toRGBA8(ifd);\n const w = ifd.width;\n const h = ifd.height;\n pageDims.value = { width: w, height: h };\n const canvas = canvasEl.value;\n canvas.width = w;\n canvas.height = h;\n const ctx = canvas.getContext('2d');\n if (!ctx) return;\n const imageData = ctx.createImageData(w, h);\n imageData.data.set(rgba);\n ctx.putImageData(imageData, 0, 0);\n}\n\nfunction next(): void {\n if (pageIndex.value < pageCount.value - 1) {\n pageIndex.value++;\n paint();\n }\n}\nfunction prev(): void {\n if (pageIndex.value > 0) {\n pageIndex.value--;\n paint();\n }\n}\nfunction zoomIn(): void {\n scale.value = Math.min(8, scale.value * 1.25);\n}\nfunction zoomOut(): void {\n scale.value = Math.max(0.1, scale.value / 1.25);\n}\nfunction reset(): void {\n scale.value = 1;\n}\n\nonMounted(load);\nonBeforeUnmount(() => {\n renderToken++;\n ifds = null;\n});\n\nwatch(() => props.url, load);\n\nconst pageLabel = computed(() => {\n const m = (props.t && props.t('viewer.page_n_of_m')) || 'Page {n} of {m}';\n return m.replace('{n}', String(pageIndex.value + 1)).replace('{m}', String(pageCount.value));\n});\n\nfunction tt(key: string, fallback: string): string {\n return props.t ? props.t(key) : fallback;\n}\n</script>\n\n<template>\n <div class=\"filex-viewer-tiff\">\n <div class=\"filex-viewer-tiff__pane\">\n <div v-if=\"error\" class=\"filex-viewer-fallback\">\n <span class=\"filex-viewer-fallback__icon\">🖼️</span>\n <p>{{ error }}</p>\n </div>\n <div v-else-if=\"loading\" class=\"filex-viewer-fallback\">\n <span class=\"filex-viewer-fallback__icon\">⏳</span>\n <p>{{ tt('viewer.loading', 'Loading…') }}</p>\n </div>\n <canvas\n v-show=\"!loading && !error\"\n ref=\"canvasEl\"\n :style=\"{ imageRendering: 'pixelated' }\"\n />\n <div v-if=\"!loading && !error && pageCount > 1\" class=\"filex-viewer-tiff__pager\">\n <button\n type=\"button\"\n class=\"filex-viewer-btn\"\n :disabled=\"pageIndex === 0\"\n @click=\"prev\"\n >‹</button>\n <span class=\"filex-viewer-tiff__pages\">{{ pageLabel }}</span>\n <button\n type=\"button\"\n class=\"filex-viewer-btn\"\n :disabled=\"pageIndex >= pageCount - 1\"\n @click=\"next\"\n >›</button>\n </div>\n </div>\n </div>\n</template>\n\n<style>\n/* ⚠ NOT `scoped`, deliberately. Vue's scoped styles compile to\n `.cls[data-v-HASH]`, and in the web-component build the hash baked into\n this CSS does not match the one Vue stamps onto the DOM — so every rule\n here silently stopped applying. Measured in the desktop app: the share\n dialog had `position: static`, no background and no radius, i.e. raw\n unstyled HTML, in EVERY embedded surface.\n Safe to drop: every selector below is prefixed (fx-/fe-/filex-), so\n there is nothing here that can leak into a host page. */\n.filex-viewer-tiff__pager {\n position: absolute;\n bottom: 12px;\n left: 50%;\n transform: translateX(-50%);\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 4px 8px;\n background: var(--fe-bg-elev, rgba(255, 255, 255, 0.9));\n border: 1px solid var(--fe-border, #e2e6ed);\n border-radius: 6px;\n backdrop-filter: blur(4px);\n}\n.filex-viewer-tiff__pages {\n font-size: 12px;\n font-variant-numeric: tabular-nums;\n}\n.filex-viewer-tiff {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n min-height: 70vh;\n background: var(--fe-bg, #fff);\n}\n.filex-viewer-tiff__bar {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 8px 12px;\n background: var(--fe-bg-elev, #f7f8fa);\n border-bottom: 1px solid var(--fe-border, #e2e6ed);\n font-size: 13px;\n}\n.filex-viewer-tiff__pages {\n min-width: 110px;\n text-align: center;\n font-variant-numeric: tabular-nums;\n font-size: 12px;\n}\n.filex-viewer-tiff__zoom {\n min-width: 50px;\n text-align: center;\n font-variant-numeric: tabular-nums;\n font-size: 12px;\n}\n.filex-viewer-spacer { flex: 1; }\n.filex-viewer-tiff__pane {\n flex: 1;\n overflow: auto;\n padding: 16px;\n background: #2a2d33;\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n}\n.filex-viewer-tiff__pane canvas {\n background: #fff;\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);\n}\n.filex-viewer-fallback {\n text-align: center;\n padding: 32px;\n color: #c8cdd6;\n margin: auto;\n}\n.filex-viewer-fallback__icon {\n font-size: 48px;\n display: block;\n margin-bottom: 12px;\n}\n.filex-viewer-btn {\n border: 1px solid var(--fe-border, #e2e6ed);\n background: var(--fe-bg, #fff);\n color: var(--fe-text, #1a1e27);\n padding: 4px 10px;\n border-radius: 4px;\n cursor: pointer;\n font: inherit;\n font-size: 12px;\n}\n.filex-viewer-btn:hover:not(:disabled) {\n background: var(--fe-bg-hover, #edf0f5);\n}\n.filex-viewer-btn:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n</style>\n"],"names":["props","__props","canvasEl","ref","error","loading","pageIndex","pageCount","pageDims","UTIF","ifds","renderToken","ensureUtif","mod","n","load","myToken","lib","buf","fetchViewerArrayBuffer","_a","paint","err","idx","ifd","rgba","w","h","canvas","ctx","imageData","next","prev","onMounted","onBeforeUnmount","watch","pageLabel","computed","tt","key","fallback","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_hoisted_2","_hoisted_3","_cache","_hoisted_4","_vShow","_hoisted_5","_hoisted_6","_hoisted_7","_toDisplayString","_hoisted_8"],"mappings":";;;;;;;;;;;;;;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6DC,EAAnBjB,EAAA,KAAS,GAAA,CAAA;AAAA,UACnDQ,EAKW,UAAA;AAAA,YAJT,MAAK;AAAA,YACL,OAAM;AAAA,YACL,UAAUtC,EAAA,SAAaC,EAAA,QAAS;AAAA,YAChC,SAAOwB;AAAA,UAAA,GACT,KAAC,GAAAuB,CAAA;AAAA,QAAA;;;;;"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { defineComponent as w, computed as f, ref as c, onMounted as m, watch as x, resolveComponent as y, openBlock as a, createElementBlock as i, createBlock as _, createElementVNode as n, toDisplayString as u } from "vue";
|
|
2
|
-
const k = { class: "filex-viewer-3d" }, h = {
|
|
3
|
-
key: 1,
|
|
4
|
-
class: "filex-viewer-fallback"
|
|
5
|
-
}, g = {
|
|
6
|
-
key: 2,
|
|
7
|
-
class: "filex-viewer-fallback"
|
|
8
|
-
}, S = /* @__PURE__ */ w({
|
|
9
|
-
__name: "Viewer3D",
|
|
10
|
-
props: {
|
|
11
|
-
url: {},
|
|
12
|
-
mime: {},
|
|
13
|
-
ext: {},
|
|
14
|
-
t: { type: Function }
|
|
15
|
-
},
|
|
16
|
-
setup(l) {
|
|
17
|
-
const e = l, d = /* @__PURE__ */ new Set(["glb", "gltf", "usdz"]), v = f(() => d.has((e.ext || "").toLowerCase())), t = c(null), r = c(!1);
|
|
18
|
-
async function s() {
|
|
19
|
-
if (r.value = !1, t.value = null, !v.value) {
|
|
20
|
-
t.value = e.t ? e.t("viewer.format_unsupported_3d") : `3D format ".${e.ext}" not supported in browser preview — please download.`;
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
try {
|
|
24
|
-
await import(
|
|
25
|
-
/* @vite-ignore */
|
|
26
|
-
"@google/model-viewer"
|
|
27
|
-
), r.value = !0;
|
|
28
|
-
} catch {
|
|
29
|
-
t.value = e.t ? e.t("viewer.peer_not_installed") : "3D viewer requires `@google/model-viewer` — install or use download.";
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return m(s), x(() => e.url, () => {
|
|
33
|
-
s();
|
|
34
|
-
}), (b, o) => {
|
|
35
|
-
const p = y("model-viewer");
|
|
36
|
-
return a(), i("div", k, [
|
|
37
|
-
r.value && !t.value ? (a(), _(p, {
|
|
38
|
-
key: 0,
|
|
39
|
-
src: l.url,
|
|
40
|
-
"auto-rotate": "",
|
|
41
|
-
"camera-controls": "",
|
|
42
|
-
"touch-action": "pan-y",
|
|
43
|
-
"shadow-intensity": "1",
|
|
44
|
-
alt: l.ext + " model",
|
|
45
|
-
style: { width: "100%", height: "100%", "min-height": "480px", display: "block" }
|
|
46
|
-
}, null, 8, ["src", "alt"])) : t.value ? (a(), i("div", h, [
|
|
47
|
-
o[0] || (o[0] = n("span", { class: "filex-viewer-fallback__icon" }, "📦", -1)),
|
|
48
|
-
n("p", null, u(t.value), 1)
|
|
49
|
-
])) : (a(), i("div", g, [
|
|
50
|
-
o[1] || (o[1] = n("span", { class: "filex-viewer-fallback__icon" }, "⏳", -1)),
|
|
51
|
-
n("p", null, u(l.t ? l.t("viewer.loading") : "Loading…"), 1)
|
|
52
|
-
]))
|
|
53
|
-
]);
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
export {
|
|
58
|
-
S as default
|
|
59
|
-
};
|
|
60
|
-
//# sourceMappingURL=Viewer3D-CJJJgkuv.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Viewer3D-CJJJgkuv.js","sources":["../src/viewers/Viewer3D.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Viewer3D — 3D model preview via `@google/model-viewer`.\n *\n * Lazy-imports the `@google/model-viewer` web component (~80 KB).\n *\n * Format support: model-viewer **only** understands glTF (`.gltf`,\n * `.glb`) and USDZ (iOS). For unsupported formats (`.stl`, `.obj`,\n * `.fbx`, `.3ds`) we deliberately render a download fallback instead\n * of feeding them to model-viewer — earlier code did the latter,\n * which surfaced as `JSON.parse(<ascii STL>)` SyntaxError because\n * model-viewer parses the response body as glTF JSON. (sweep-2026-05-09\n * bugs 19-20.)\n *\n * GLB rendering size: model-viewer mounts its canvas inside a\n * shadow root that doesn't always inherit `height: 100%` from\n * flexbox parents — we pin explicit sizing on the host element\n * to avoid the \"Framebuffer is incomplete: zero size\" warning.\n * (sweep-2026-05-09 bug 21.)\n */\nimport { computed, onMounted, ref, watch } from 'vue';\n\nconst props = defineProps<{\n url: string;\n mime?: string;\n ext: string;\n /** Locale-aware error/loading messages. */\n t?: (key: string) => string;\n}>();\n\nconst SUPPORTED_EXTS = new Set(['glb', 'gltf', 'usdz']);\n\nconst isSupported = computed(() => SUPPORTED_EXTS.has((props.ext || '').toLowerCase()));\n\nconst error = ref<string | null>(null);\nconst ready = ref(false);\n\nasync function load(): Promise<void> {\n ready.value = false;\n error.value = null;\n // Bail out early for formats model-viewer can't parse — feeding\n // them to <model-viewer> triggers JSON.parse SyntaxError because\n // it expects glTF JSON.\n if (!isSupported.value) {\n error.value = props.t\n ? props.t('viewer.format_unsupported_3d')\n : `3D format \".${props.ext}\" not supported in browser preview — please download.`;\n return;\n }\n try {\n await import(/* @vite-ignore */ '@google/model-viewer');\n ready.value = true;\n } catch {\n error.value = props.t\n ? props.t('viewer.peer_not_installed')\n : '3D viewer requires `@google/model-viewer` — install or use download.';\n }\n}\n\nonMounted(load);\n\nwatch(() => props.url, () => {\n // Re-evaluate on URL change (different file may need different\n // fallback message).\n load();\n});\n</script>\n\n<template>\n <div class=\"filex-viewer-3d\">\n <model-viewer\n v-if=\"ready && !error\"\n :src=\"url\"\n auto-rotate\n camera-controls\n touch-action=\"pan-y\"\n shadow-intensity=\"1\"\n :alt=\"ext + ' model'\"\n style=\"width: 100%; height: 100%; min-height: 480px; display: block\"\n />\n <div v-else-if=\"error\" class=\"filex-viewer-fallback\">\n <span class=\"filex-viewer-fallback__icon\">📦</span>\n <p>{{ error }}</p>\n </div>\n <div v-else class=\"filex-viewer-fallback\">\n <span class=\"filex-viewer-fallback__icon\">⏳</span>\n <p>{{ t ? t('viewer.loading') : 'Loading…' }}</p>\n </div>\n </div>\n</template>\n\n<style>\n/* ⚠ NOT `scoped`, deliberately. Vue's scoped styles compile to\n `.cls[data-v-HASH]`, and in the web-component build the hash baked into\n this CSS does not match the one Vue stamps onto the DOM — so every rule\n here silently stopped applying. Measured in the desktop app: the share\n dialog had `position: static`, no background and no radius, i.e. raw\n unstyled HTML, in EVERY embedded surface.\n Safe to drop: every selector below is prefixed (fx-/fe-/filex-), so\n there is nothing here that can leak into a host page. */\n.filex-viewer-3d {\n width: 100%;\n height: 100%;\n min-height: 480px;\n background: #1a1a1a;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.filex-viewer-3d model-viewer {\n width: 100%;\n height: 100%;\n min-height: 480px;\n background: #1a1a1a;\n display: block;\n}\n.filex-viewer-fallback {\n text-align: center;\n color: #c8cdd6;\n padding: 32px;\n max-width: 480px;\n}\n.filex-viewer-fallback__icon {\n font-size: 48px;\n display: block;\n margin-bottom: 12px;\n}\n</style>\n"],"names":["props","__props","SUPPORTED_EXTS","isSupported","computed","error","ref","ready","load","onMounted","watch","_openBlock","_createElementBlock","_hoisted_1","_createBlock","_component_model_viewer","_hoisted_2","_cache","_createElementVNode","_hoisted_3","_toDisplayString"],"mappings":";;;;;;;;;;;;;;;;AAsBA,UAAMA,IAAQC,GAQRC,IAAiB,oBAAI,IAAI,CAAC,OAAO,QAAQ,MAAM,CAAC,GAEhDC,IAAcC,EAAS,MAAMF,EAAe,KAAKF,EAAM,OAAO,IAAI,YAAA,CAAa,CAAC,GAEhFK,IAAQC,EAAmB,IAAI,GAC/BC,IAAQD,EAAI,EAAK;AAEvB,mBAAeE,IAAsB;AAMnC,UALAD,EAAM,QAAQ,IACdF,EAAM,QAAQ,MAIV,CAACF,EAAY,OAAO;AACtB,QAAAE,EAAM,QAAQL,EAAM,IAChBA,EAAM,EAAE,8BAA8B,IACtC,eAAeA,EAAM,GAAG;AAC5B;AAAA,MACF;AACA,UAAI;AACF,cA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its own path + its own listing — fetched through
|
|
6
|
-
* the SAME FileApi instance the host already constructed (`api.index`,
|
|
7
|
-
* no copied fetch logic) — a small breadcrumb, double-click navigation,
|
|
8
|
-
* click selection and drag&drop in BOTH directions. No toolbar, no
|
|
9
|
-
* inspector, no upload: those belong to the main panel.
|
|
10
|
-
*
|
|
11
|
-
* Path semantics, confinement (`clamp`) and wire-form resolution
|
|
12
|
-
* (`qualify` / `toUser`) are injected from the host so the pane can
|
|
13
|
-
* never drift from the main panel's multi-storage / rootFloor rules.
|
|
14
|
-
*
|
|
15
|
-
* Cross-pane transfers only EMIT (`transfer`); the host decides
|
|
16
|
-
* move-vs-copy and runs the existing ops APIs. Unscoped styles
|
|
17
|
-
* (`fe-split*` in base.css) — webcomponent data-v rule.
|
|
18
|
-
*/
|
|
19
|
-
import { computed, ref } from 'vue';
|
|
20
|
-
import type { FileApi } from '../composables/useFileApi';
|
|
21
|
-
import type { FileNode, ViewMode } from '../types/FileNode';
|
|
22
|
-
import type { LocaleCode } from '../types/ExplorerConfig';
|
|
23
|
-
import { useLocale } from '../composables/useLocale';
|
|
24
|
-
import { filterListing, injectTrashRow, hydrateTrashRow } from '../lib/listing';
|
|
25
|
-
import ListView from './ListView.vue';
|
|
26
|
-
import GridView from './GridView.vue';
|
|
27
|
-
import GalleryView from './GalleryView.vue';
|
|
28
|
-
|
|
29
|
-
// Same literals ListView/GridView already hardcode for the internal DnD
|
|
30
|
-
// channel; `-src` carries the origin directory so the host can move (and
|
|
31
|
-
// undo) correctly across panes.
|
|
32
|
-
const FE_DND_MIME = 'application/x-brf-files';
|
|
33
|
-
const FE_DND_SRC_MIME = 'application/x-brf-files-src';
|
|
34
|
-
import { hasInternalDrag, internalDragItems, internalDragOrigin } from '../lib/dragOut';
|
|
35
|
-
|
|
36
|
-
const props = defineProps<{
|
|
37
|
-
api: FileApi;
|
|
38
|
-
/** Opening location, in the host's `currentPath` form. */
|
|
39
|
-
initialPath: string;
|
|
40
|
-
locale: LocaleCode;
|
|
41
|
-
/** Host's own qualify(): user path → wire `<adapter>://<rel>`. */
|
|
42
|
-
qualify: (p: string) => string;
|
|
43
|
-
/** Host's wire → user-path converter (multi-storage aware). */
|
|
44
|
-
toUser: (wire: string) => string;
|
|
45
|
-
/** Host's rootFloor clamp — keeps the pane inside the confine. */
|
|
46
|
-
clamp: (p: string) => string;
|
|
47
|
-
/** Label for the root crumb (adapter name / storage list). */
|
|
48
|
-
rootLabel: string;
|
|
49
|
-
/** rootFloor (user-path form, '' when unconfined) — trims crumbs. */
|
|
50
|
-
floor?: string;
|
|
51
|
-
/** Multi-storage mode: '' is the virtual drives root (no fetch). */
|
|
52
|
-
multiRoot?: boolean;
|
|
53
|
-
/** Synthesized storage rows for the virtual drives root. */
|
|
54
|
-
virtualRows?: () => FileNode[];
|
|
55
|
-
/** Active-panel highlight (keyboard target). */
|
|
56
|
-
active?: boolean;
|
|
57
|
-
/** ui-fix — the pane renders the SAME view components as the main
|
|
58
|
-
* panel (list/grid/gallery) instead of its own flat list. */
|
|
59
|
-
viewMode?: ViewMode;
|
|
60
|
-
/** ui-fix — authenticated thumb resolver, forwarded to grid/gallery. */
|
|
61
|
-
thumbSrc?: (n: FileNode) => string | null;
|
|
62
|
-
/** Desktop selective sync badge resolver, forwarded to the views. */
|
|
63
|
-
keepBadgeFor?: (n: FileNode) => 'kept' | 'syncing' | 'cloud' | 'partial' | null;
|
|
64
|
-
/** ui-fix — mirror the main panel's virtual `.trash` row at storage root
|
|
65
|
-
* so both split panes list identical rows (no row-offset). Defaults on. */
|
|
66
|
-
trashVisible?: boolean;
|
|
67
|
-
/**
|
|
68
|
-
* The navigation panel is already offering Trash, so neither pane draws the
|
|
69
|
-
* virtual row. Passed down rather than worked out here: the panel belongs to
|
|
70
|
-
* the host explorer, and a pane that guessed at it is how the two halves of a
|
|
71
|
-
* split end up listing different rows.
|
|
72
|
-
*/
|
|
73
|
-
navOffersTrash?: boolean;
|
|
74
|
-
}>();
|
|
75
|
-
|
|
76
|
-
const emit = defineEmits<{
|
|
77
|
-
(e: 'navigate', path: string): void;
|
|
78
|
-
(e: 'activate'): void;
|
|
79
|
-
(e: 'close'): void;
|
|
80
|
-
(e: 'open-tab', path: string): void;
|
|
81
|
-
(e: 'transfer', p: { sources: string[]; targetWire: string; originWire?: string }): void;
|
|
82
|
-
/* ui-fix — right-click inside the side pane: the menu is opened by the main
|
|
83
|
-
* component (FileExplorer). node=null → right-click on empty space (nothing
|
|
84
|
-
* selected, so "Paste" only). */
|
|
85
|
-
(e: 'context', node: FileNode | null, ev: MouseEvent): void;
|
|
86
|
-
/* ui-fix — when the trash row is opened: the trash view belongs to the main
|
|
87
|
-
* panel (it carries the restore actions), so the host opens it via loadTrash(). */
|
|
88
|
-
(e: 'open-trash'): void;
|
|
89
|
-
}>();
|
|
90
|
-
|
|
91
|
-
const { t } = useLocale(() => props.locale);
|
|
92
|
-
|
|
93
|
-
const path = ref<string>('');
|
|
94
|
-
const files = ref<FileNode[]>([]);
|
|
95
|
-
const loading = ref(false);
|
|
96
|
-
const error = ref('');
|
|
97
|
-
const selected = ref(new Set<string>());
|
|
98
|
-
|
|
99
|
-
function isStorageRow(n: FileNode): boolean {
|
|
100
|
-
return n.mime_type === 'inode/storage';
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const atVirtualRoot = computed(
|
|
104
|
-
() => !!props.multiRoot && !(path.value ?? '').replace(/^\/+|\/+$/g, ''),
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
async function loadPane(target?: string): Promise<void> {
|
|
108
|
-
const requested = props.clamp(target ?? path.value ?? '');
|
|
109
|
-
loading.value = true;
|
|
110
|
-
error.value = '';
|
|
111
|
-
try {
|
|
112
|
-
// Multi-storage virtual root: synthesize the drives list, no backend
|
|
113
|
-
// call — mirrors the main panel's load() branch.
|
|
114
|
-
if (props.multiRoot && !requested) {
|
|
115
|
-
files.value = props.virtualRows ? props.virtualRows() : [];
|
|
116
|
-
path.value = '';
|
|
117
|
-
selected.value = new Set();
|
|
118
|
-
emit('navigate', '');
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
const resp = await props.api.index(props.qualify(requested));
|
|
122
|
-
// Same internal-entry filter + virtual `.trash` row as the main panel
|
|
123
|
-
// (shared helpers → both split panes list identical rows, no offset).
|
|
124
|
-
files.value = filterListing(resp.files);
|
|
125
|
-
if (
|
|
126
|
-
injectTrashRow(files.value, resp.adapter, resp.dirname, props.trashVisible !== false, {
|
|
127
|
-
// ⚠ The panel is a sibling of BOTH panes. If it is offering Trash, this
|
|
128
|
-
// pane must drop the row too — otherwise the duplication is not removed,
|
|
129
|
-
// it just moves to the right-hand half of a split.
|
|
130
|
-
navOffersTrash: props.navOffersTrash,
|
|
131
|
-
})
|
|
132
|
-
) {
|
|
133
|
-
void hydrateTrashRow(files.value, resp.adapter, props.api);
|
|
134
|
-
}
|
|
135
|
-
path.value = props.toUser(resp.dirname);
|
|
136
|
-
selected.value = new Set();
|
|
137
|
-
emit('navigate', path.value);
|
|
138
|
-
} catch (err) {
|
|
139
|
-
error.value = err instanceof Error ? err.message : String(err);
|
|
140
|
-
} finally {
|
|
141
|
-
loading.value = false;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
void loadPane(props.initialPath ?? '');
|
|
146
|
-
|
|
147
|
-
// ------------------------------------------------------------------
|
|
148
|
-
// Breadcrumb
|
|
149
|
-
// ------------------------------------------------------------------
|
|
150
|
-
|
|
151
|
-
interface Crumb {
|
|
152
|
-
label: string;
|
|
153
|
-
target: string;
|
|
154
|
-
last: boolean;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
const crumbs = computed<Crumb[]>(() => {
|
|
158
|
-
const clean = (path.value || '').replace(/^\/+|\/+$/g, '');
|
|
159
|
-
const segs = clean ? clean.split('/') : [];
|
|
160
|
-
const floor = (props.floor || '').replace(/^\/+|\/+$/g, '');
|
|
161
|
-
const out: Crumb[] = [];
|
|
162
|
-
let acc = '';
|
|
163
|
-
for (const s of segs) {
|
|
164
|
-
acc = acc ? `${acc}/${s}` : s;
|
|
165
|
-
// Confined embeds: hide the segments strictly ABOVE the floor — the
|
|
166
|
-
// floor segment itself acts as the pane's root crumb.
|
|
167
|
-
if (floor && !(acc === floor || acc.startsWith(floor + '/'))) continue;
|
|
168
|
-
out.push({ label: s, target: acc, last: false });
|
|
169
|
-
}
|
|
170
|
-
if (out.length > 0) out[out.length - 1].last = true;
|
|
171
|
-
return out;
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
const showRootCrumb = computed(() => !props.floor);
|
|
175
|
-
|
|
176
|
-
function crumbGo(target: string) {
|
|
177
|
-
emit('activate');
|
|
178
|
-
void loadPane(target);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// ------------------------------------------------------------------
|
|
182
|
-
// Selection + navigation
|
|
183
|
-
// ------------------------------------------------------------------
|
|
184
|
-
|
|
185
|
-
/* ui-fix — adapter for the shared view components' click contract
|
|
186
|
-
* ({ctrl, shift} mod object instead of a MouseEvent). Shift behaves as
|
|
187
|
-
* ctrl here: the pane keeps a simple Set, no range anchor. */
|
|
188
|
-
function onViewClick(n: FileNode, mod: { ctrl: boolean; shift: boolean }) {
|
|
189
|
-
emit('activate');
|
|
190
|
-
const multi = mod.ctrl || mod.shift;
|
|
191
|
-
const next = new Set<string>(multi ? selected.value : []);
|
|
192
|
-
if (multi && next.has(n.path)) next.delete(n.path);
|
|
193
|
-
else next.add(n.path);
|
|
194
|
-
selected.value = next;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/* ui-fix — right-click on a pane item: activate + select it, then let the
|
|
198
|
-
* host open the pane context menu (its actions are pane-routed). Selecting
|
|
199
|
-
* first keeps the menu's targets on THIS pane, not the main panel. */
|
|
200
|
-
function onViewContext(n: FileNode, ev: MouseEvent) {
|
|
201
|
-
ev.preventDefault();
|
|
202
|
-
ev.stopPropagation();
|
|
203
|
-
emit('activate');
|
|
204
|
-
if (!selected.value.has(n.path)) selected.value = new Set([n.path]);
|
|
205
|
-
emit('context', n, ev);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/* ui-fix — right-click on empty space (the background): a selection-less menu
|
|
209
|
-
* ("Paste" only) → pasting files into an empty / into the current folder. The
|
|
210
|
-
* row menu calls stopProp, so this only fires on genuinely empty space. */
|
|
211
|
-
function onBgContext(ev: MouseEvent) {
|
|
212
|
-
ev.preventDefault();
|
|
213
|
-
ev.stopPropagation(); // don't bubble into the canvas menu on the FileExplorer root
|
|
214
|
-
emit('activate');
|
|
215
|
-
selected.value = new Set();
|
|
216
|
-
emit('context', null, ev);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/* ui-fix — drop-into from the shared views: same payload path as the
|
|
220
|
-
* old flat rows (dir check + wire-qualified row paths). */
|
|
221
|
-
function onViewDropInto(target: FileNode, ev: DragEvent) {
|
|
222
|
-
dropBg.value = false;
|
|
223
|
-
if (target.type !== 'dir' || isStorageRow(target)) return;
|
|
224
|
-
if (!acceptDrag(ev)) return;
|
|
225
|
-
handleDropPayload(ev, target.path);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
function onRowDbl(n: FileNode) {
|
|
229
|
-
if (n.type !== 'dir') return;
|
|
230
|
-
// The virtual `.trash` row opens the backend trash listing (restore
|
|
231
|
-
// actions) — that view lives in the main panel; let the host open it.
|
|
232
|
-
if (n.basename === '.trash') {
|
|
233
|
-
emit('activate');
|
|
234
|
-
emit('open-trash');
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
void loadPane(isStorageRow(n) ? n.path : props.toUser(n.path));
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
function clearSelection() {
|
|
241
|
-
selected.value = new Set();
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// ------------------------------------------------------------------
|
|
245
|
-
// Drag source
|
|
246
|
-
// ------------------------------------------------------------------
|
|
247
|
-
|
|
248
|
-
function onRowDragStart(n: FileNode, ev: DragEvent) {
|
|
249
|
-
if (!ev.dataTransfer) return;
|
|
250
|
-
if (isStorageRow(n) || atVirtualRoot.value || n.basename === '.trash') {
|
|
251
|
-
ev.preventDefault();
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
if (!selected.value.has(n.path)) selected.value = new Set([n.path]);
|
|
255
|
-
const items = files.value
|
|
256
|
-
.filter((f) => selected.value.has(f.path) && !isStorageRow(f))
|
|
257
|
-
.map((f) => ({ path: f.path, basename: f.basename, type: f.type }));
|
|
258
|
-
if (items.length === 0) {
|
|
259
|
-
ev.preventDefault();
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
ev.dataTransfer.setData(FE_DND_MIME, JSON.stringify(items));
|
|
263
|
-
ev.dataTransfer.setData(FE_DND_SRC_MIME, props.qualify(path.value));
|
|
264
|
-
ev.dataTransfer.setData('text/plain', items.map((i) => i.path).join('\n'));
|
|
265
|
-
ev.dataTransfer.effectAllowed = 'move';
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// ------------------------------------------------------------------
|
|
269
|
-
// Drop target (dir rows + pane background)
|
|
270
|
-
// ------------------------------------------------------------------
|
|
271
|
-
|
|
272
|
-
const dropBg = ref(false);
|
|
273
|
-
|
|
274
|
-
function acceptDrag(ev: DragEvent): boolean {
|
|
275
|
-
return hasInternalDrag(ev);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
function handleDropPayload(ev: DragEvent, targetWire: string) {
|
|
279
|
-
const items = internalDragItems(ev);
|
|
280
|
-
if (!items || !targetWire) return;
|
|
281
|
-
const origin = internalDragOrigin(ev);
|
|
282
|
-
const sources = items
|
|
283
|
-
.map((i) => i.path)
|
|
284
|
-
.filter((p) => p && p !== targetWire && !targetWire.startsWith(p + '/'));
|
|
285
|
-
if (sources.length === 0) return;
|
|
286
|
-
ev.preventDefault();
|
|
287
|
-
ev.stopPropagation();
|
|
288
|
-
emit('transfer', { sources, targetWire, originWire: origin });
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
function onBgDragOver(ev: DragEvent) {
|
|
292
|
-
if (!acceptDrag(ev) || atVirtualRoot.value) return;
|
|
293
|
-
ev.preventDefault();
|
|
294
|
-
ev.stopPropagation();
|
|
295
|
-
if (ev.dataTransfer) ev.dataTransfer.dropEffect = 'move';
|
|
296
|
-
dropBg.value = true;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
function onBgDragLeave() {
|
|
300
|
-
dropBg.value = false;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
function onBgDrop(ev: DragEvent) {
|
|
304
|
-
dropBg.value = false;
|
|
305
|
-
if (!acceptDrag(ev) || atVirtualRoot.value) return;
|
|
306
|
-
handleDropPayload(ev, props.qualify(path.value));
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
// ------------------------------------------------------------------
|
|
310
|
-
// Host API (keyboard routing when this pane is active)
|
|
311
|
-
// ------------------------------------------------------------------
|
|
312
|
-
|
|
313
|
-
function goUp() {
|
|
314
|
-
const cur = (path.value ?? '').replace(/^\/+|\/+$/g, '');
|
|
315
|
-
const floor = (props.floor || '').replace(/^\/+|\/+$/g, '');
|
|
316
|
-
if (!cur || cur === floor) return;
|
|
317
|
-
const idx = cur.lastIndexOf('/');
|
|
318
|
-
void loadPane(idx === -1 ? '' : cur.slice(0, idx));
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
function selectAll() {
|
|
322
|
-
selected.value = new Set(files.value.filter((f) => !isStorageRow(f)).map((f) => f.path));
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
function selectedNodes(): FileNode[] {
|
|
326
|
-
return files.value.filter((f) => selected.value.has(f.path));
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
function openSelected() {
|
|
330
|
-
const n = selectedNodes()[0];
|
|
331
|
-
if (n && n.type === 'dir') onRowDbl(n);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
function reload(): Promise<void> {
|
|
335
|
-
return loadPane();
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
function getPath(): string {
|
|
339
|
-
return path.value;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
defineExpose({ reload, goUp, selectAll, openSelected, selectedNodes, getPath });
|
|
343
|
-
</script>
|
|
344
|
-
|
|
345
|
-
<template>
|
|
346
|
-
<section
|
|
347
|
-
class="fe-split"
|
|
348
|
-
:class="{ 'fe-pane--focus': active }"
|
|
349
|
-
role="region"
|
|
350
|
-
:aria-label="t('split.pane')"
|
|
351
|
-
@pointerdown="emit('activate')"
|
|
352
|
-
>
|
|
353
|
-
<header class="fe-split__crumbs">
|
|
354
|
-
<button
|
|
355
|
-
v-if="showRootCrumb"
|
|
356
|
-
type="button"
|
|
357
|
-
class="fe-split__crumb"
|
|
358
|
-
:class="{ 'is-last': crumbs.length === 0 }"
|
|
359
|
-
:title="rootLabel"
|
|
360
|
-
@click="crumbGo('')"
|
|
361
|
-
>{{ rootLabel }}</button>
|
|
362
|
-
<template v-for="c in crumbs" :key="c.target">
|
|
363
|
-
<span class="fe-split__sep" aria-hidden="true">›</span>
|
|
364
|
-
<button
|
|
365
|
-
type="button"
|
|
366
|
-
class="fe-split__crumb"
|
|
367
|
-
:class="{ 'is-last': c.last }"
|
|
368
|
-
:title="c.label"
|
|
369
|
-
@click="crumbGo(c.target)"
|
|
370
|
-
>{{ c.label }}</button>
|
|
371
|
-
</template>
|
|
372
|
-
<span class="fe-split__spacer"></span>
|
|
373
|
-
<button
|
|
374
|
-
type="button"
|
|
375
|
-
class="fe-split__closebtn"
|
|
376
|
-
:aria-label="t('split.close')"
|
|
377
|
-
:title="t('split.close')"
|
|
378
|
-
@click="emit('close')"
|
|
379
|
-
>×</button>
|
|
380
|
-
</header>
|
|
381
|
-
|
|
382
|
-
<div
|
|
383
|
-
class="fe-split__body"
|
|
384
|
-
:class="{ 'is-dropover': dropBg }"
|
|
385
|
-
@click.self="clearSelection"
|
|
386
|
-
@contextmenu="onBgContext"
|
|
387
|
-
@dragover="onBgDragOver"
|
|
388
|
-
@dragleave="onBgDragLeave"
|
|
389
|
-
@drop="onBgDrop"
|
|
390
|
-
>
|
|
391
|
-
<div v-if="loading && files.length === 0" class="fe-split__state" role="status">
|
|
392
|
-
{{ t('loading') }}
|
|
393
|
-
</div>
|
|
394
|
-
<div v-else-if="error" class="fe-split__state">
|
|
395
|
-
<span>{{ t('split.error') }}</span>
|
|
396
|
-
<button type="button" class="fe-btn" @click="() => loadPane()">
|
|
397
|
-
{{ t('split.retry') }}
|
|
398
|
-
</button>
|
|
399
|
-
</div>
|
|
400
|
-
<div v-else-if="files.length === 0" class="fe-split__state">
|
|
401
|
-
{{ t('empty.folder') }}
|
|
402
|
-
</div>
|
|
403
|
-
<!-- ui-fix — the same view components (list/grid/gallery), driven by the
|
|
404
|
-
pane's own viewMode; the old flat fe-split__list is gone. -->
|
|
405
|
-
<ListView
|
|
406
|
-
v-else-if="(viewMode ?? 'list') === 'list'"
|
|
407
|
-
:files="files"
|
|
408
|
-
:selected="selected"
|
|
409
|
-
:locale="locale"
|
|
410
|
-
:loading="loading"
|
|
411
|
-
:keep-badge-for="keepBadgeFor"
|
|
412
|
-
@click-row="onViewClick"
|
|
413
|
-
@dbl-row="onRowDbl"
|
|
414
|
-
@context-row="onViewContext"
|
|
415
|
-
@item-drag-start="onRowDragStart"
|
|
416
|
-
@item-drop-into="onViewDropInto"
|
|
417
|
-
/>
|
|
418
|
-
<GridView
|
|
419
|
-
v-else-if="viewMode === 'grid'"
|
|
420
|
-
:files="files"
|
|
421
|
-
:selected="selected"
|
|
422
|
-
:locale="locale"
|
|
423
|
-
:loading="loading"
|
|
424
|
-
:thumb-src="thumbSrc"
|
|
425
|
-
:keep-badge-for="keepBadgeFor"
|
|
426
|
-
@click-card="onViewClick"
|
|
427
|
-
@dbl-card="onRowDbl"
|
|
428
|
-
@context-card="onViewContext"
|
|
429
|
-
@item-drag-start="onRowDragStart"
|
|
430
|
-
@item-drop-into="onViewDropInto"
|
|
431
|
-
/>
|
|
432
|
-
<GalleryView
|
|
433
|
-
v-else
|
|
434
|
-
:files="files"
|
|
435
|
-
:selected="selected"
|
|
436
|
-
:locale="locale"
|
|
437
|
-
:loading="loading"
|
|
438
|
-
:thumb-src="thumbSrc"
|
|
439
|
-
@click-card="onViewClick"
|
|
440
|
-
@dbl-card="onRowDbl"
|
|
441
|
-
@context-card="onViewContext"
|
|
442
|
-
@item-drag-start="onRowDragStart"
|
|
443
|
-
@item-drop-into="onViewDropInto"
|
|
444
|
-
/>
|
|
445
|
-
</div>
|
|
446
|
-
</section>
|
|
447
|
-
</template>
|