@eternalheart/vue-file-preview 1.6.12 → 1.6.13
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 +2 -0
- package/README.zh-CN.md +2 -0
- package/lib/FilePreviewContent.vue.d.ts +9 -1
- package/lib/FilePreviewEmbed.vue.d.ts +4 -1
- package/lib/FilePreviewModal.vue.d.ts +4 -1
- package/lib/chunks/EmptyState.vue_vue_type_script_setup_true_lang-C7qk6wj0.mjs +20 -0
- package/lib/chunks/RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs +32 -0
- package/lib/chunks/{avifLoader-CAUzjn-d-CTy7cevh.mjs → avifLoader-CAUzjn-d-C0KRpetN.mjs} +1 -1
- package/lib/chunks/{heicLoader-D_9PukkA-DdDu94xL.mjs → heicLoader-D_9PukkA-Czof_5FJ.mjs} +1 -1
- package/lib/chunks/{index-CLM9sOKN.mjs → index--612Smof.mjs} +112 -112
- package/lib/chunks/{index-De-oaCgN.mjs → index-8Vpbg2kS.mjs} +2 -2
- package/lib/chunks/{index-2VQLB2Mi.mjs → index-B21EAyWz.mjs} +53 -49
- package/lib/chunks/{index-DmEMePjL.mjs → index-BASg1cr4.mjs} +2 -2
- package/lib/chunks/index-BB0i4QqI.mjs +117 -0
- package/lib/chunks/{index-Bmqn45d_.mjs → index-BVdrGK3Q.mjs} +72 -72
- package/lib/chunks/index-BlrFFeqc.mjs +330 -0
- package/lib/chunks/index-Bp9CuvMZ.mjs +157 -0
- package/lib/chunks/{index-i-KacQvS.mjs → index-BuqPb5mP.mjs} +3 -3
- package/lib/chunks/{index-DVG1fZAv.mjs → index-BvBqDq3O.mjs} +2 -2
- package/lib/chunks/{index-D6te_qaB.mjs → index-Bxpf9v5j.mjs} +26 -26
- package/lib/chunks/{index-D9z6lQat.mjs → index-C9mAajbD.mjs} +225 -220
- package/lib/chunks/{index-CM11hSQu.mjs → index-CDg6vIbT.mjs} +11 -11
- package/lib/chunks/{index-BxmX005K.mjs → index-CWE-hKSs.mjs} +11 -11
- package/lib/chunks/{index-BPmyF7Wr.mjs → index-CY3xzGgt.mjs} +18 -18
- package/lib/chunks/{index-t9kSzzMg.mjs → index-CxKZKUJj.mjs} +521 -523
- package/lib/chunks/{index-CuiEjR23.mjs → index-D30L8tm9.mjs} +15 -15
- package/lib/chunks/{index-DOAOk6m5.mjs → index-DN4Ui0Gh.mjs} +11 -11
- package/lib/chunks/{index-CEk6FKm3.mjs → index-DZZN3kYi.mjs} +551 -531
- package/lib/chunks/{index-D6Pjjxi0.mjs → index-Dkro_8Fy.mjs} +20 -20
- package/lib/chunks/{index-CiGUKdlt.mjs → index-VdzIFJJW.mjs} +23 -23
- package/lib/chunks/{index-WcAnJA2t.mjs → index-aoXgVLBb.mjs} +14 -14
- package/lib/chunks/{jp2Loader-Dig19xyo-BBR3tcPW.mjs → jp2Loader-Dig19xyo-CKUaGhPl.mjs} +1 -1
- package/lib/chunks/{psdLoader-C0tKUXXl-DGOmJwkQ.mjs → psdLoader-C0tKUXXl-CYWoQis5.mjs} +1 -1
- package/lib/chunks/{rawLoader-C-tPeFAB-CrCtXMup.mjs → rawLoader-C-tPeFAB-C35zC8nZ.mjs} +1 -1
- package/lib/chunks/{tiffLoader-BlhByX8w-jsxHlbyu.mjs → tiffLoader-BlhByX8w-BOxg_Du5.mjs} +1 -1
- package/lib/chunks/{useShikiHighlight-BdhPCj48.mjs → useShikiHighlight-BPmcxA-h.mjs} +1 -1
- package/lib/index.cjs +59 -59
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.mjs +4 -4
- package/lib/renderers/EmptyState.vue.d.ts +2 -0
- package/lib/renderers/Json/index.vue.d.ts +5 -0
- package/lib/renderers/Pptx/index.vue.d.ts +3 -0
- package/lib/renderers/Text/index.vue.d.ts +3 -0
- package/lib/renderers/Xlsx/index.vue.d.ts +3 -0
- package/lib/renderers/registry.d.ts +3 -1
- package/package.json +1 -1
- package/lib/chunks/RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs +0 -30
- package/lib/chunks/index-Bfg5zM8l.mjs +0 -141
- package/lib/chunks/index-Cud9j9Xy.mjs +0 -322
- package/lib/chunks/index-D4jhvs5m.mjs +0 -113
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { u as te, _ as ne,
|
|
3
|
-
import { FileImage as we, FileText as
|
|
4
|
-
import { _ as
|
|
1
|
+
import { defineComponent as Z, ref as d, computed as $, onMounted as ie, onBeforeUnmount as J, watch as O, openBlock as r, createElementBlock as c, normalizeStyle as E, Fragment as U, createElementVNode as a, normalizeClass as F, toDisplayString as _, unref as g, withDirectives as q, renderSlot as N, vShow as V, resolveComponent as se, createVNode as H, createBlock as D, resolveDynamicComponent as A, renderList as Q, createCommentVNode as ee, defineAsyncComponent as re, withCtx as G, Teleport as ve } from "vue";
|
|
2
|
+
import { u as te, _ as ne, q as fe, s as de, c as pe, r as X, k as ue, v as ce, x as me, z as he, A as ge } from "./index-DZZN3kYi.mjs";
|
|
3
|
+
import { FileImage as we, FileText as xe, FileCode as be, File as ye, ChevronRight as ke, FolderOpen as Le, Folder as ze } from "lucide-vue-next";
|
|
4
|
+
import { _ as Y } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
5
5
|
import { T as Se } from "./base.types-DaftHyg7.mjs";
|
|
6
|
-
const Te = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-weak vfp-bg-surface-toolbar" }, _e = { class: "vfp-flex-1 vfp-min-h-0 vfp-min-w-0 vfp-w-full vfp-overflow-hidden" }, $e = { class: "vfp-flex-1 vfp-min-h-0 vfp-min-w-0 vfp-w-full vfp-overflow-hidden" },
|
|
6
|
+
const Te = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-weak vfp-bg-surface-toolbar" }, _e = { class: "vfp-flex-1 vfp-min-h-0 vfp-min-w-0 vfp-w-full vfp-overflow-hidden" }, $e = { class: "vfp-flex-1 vfp-min-h-0 vfp-min-w-0 vfp-w-full vfp-overflow-hidden" }, Re = { class: "vfp-flex-1 vfp-min-w-0 vfp-min-h-0 vfp-overflow-hidden" }, Ce = /* @__PURE__ */ Z({
|
|
7
7
|
name: "ResizableSplit",
|
|
8
8
|
__name: "ResizableSplit",
|
|
9
9
|
props: {
|
|
@@ -26,77 +26,77 @@ const Te = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
|
|
|
26
26
|
}
|
|
27
27
|
return n.initialLeftWidth;
|
|
28
28
|
})()
|
|
29
|
-
), S = d(!1), T = d(!1),
|
|
29
|
+
), S = d(!1), T = d(!1), x = d(!0), b = d("left");
|
|
30
30
|
let l = null, t = null;
|
|
31
31
|
const v = () => {
|
|
32
32
|
l && (T.value = l.matches);
|
|
33
33
|
}, L = $(
|
|
34
|
-
() => T.value &&
|
|
35
|
-
), p = $(() => T.value &&
|
|
34
|
+
() => T.value && x.value ? { width: `${f.value}px` } : void 0
|
|
35
|
+
), p = $(() => T.value && x.value), y = (i) => {
|
|
36
36
|
if (!w.value) return;
|
|
37
37
|
const k = w.value.getBoundingClientRect(), B = i.clientX - k.left, P = k.width - n.minRightWidth - 6, j = Math.min(n.maxLeftWidth, P);
|
|
38
38
|
f.value = Math.max(
|
|
39
39
|
n.minLeftWidth,
|
|
40
40
|
Math.min(j, B)
|
|
41
41
|
);
|
|
42
|
-
},
|
|
43
|
-
if (S.value && (S.value = !1, window.removeEventListener("mousemove", y), window.removeEventListener("mouseup",
|
|
42
|
+
}, R = () => {
|
|
43
|
+
if (S.value && (S.value = !1, window.removeEventListener("mousemove", y), window.removeEventListener("mouseup", R), document.body.style.cursor = "", document.body.style.userSelect = "", n.storageKey))
|
|
44
44
|
try {
|
|
45
45
|
window.localStorage.setItem(n.storageKey, String(f.value));
|
|
46
46
|
} catch {
|
|
47
47
|
}
|
|
48
48
|
}, W = (i) => {
|
|
49
|
-
i.preventDefault(), S.value = !0, window.addEventListener("mousemove", y), window.addEventListener("mouseup",
|
|
49
|
+
i.preventDefault(), S.value = !0, window.addEventListener("mousemove", y), window.addEventListener("mouseup", R), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
50
50
|
};
|
|
51
51
|
ie(() => {
|
|
52
52
|
if (typeof window < "u") {
|
|
53
53
|
l = window.matchMedia(n.desktopMedia), v(), l.addEventListener("change", v);
|
|
54
54
|
const i = () => {
|
|
55
|
-
w.value && (
|
|
55
|
+
w.value && (x.value = w.value.getBoundingClientRect().width >= n.minLeftWidth + n.minRightWidth + 6);
|
|
56
56
|
};
|
|
57
57
|
i(), t = typeof ResizeObserver < "u" ? new ResizeObserver(i) : null, t == null || t.observe(w.value);
|
|
58
58
|
}
|
|
59
59
|
}), J(() => {
|
|
60
|
-
l && l.removeEventListener("change", v), t == null || t.disconnect(), t = null, window.removeEventListener("mousemove", y), window.removeEventListener("mouseup",
|
|
61
|
-
}),
|
|
60
|
+
l && l.removeEventListener("change", v), t == null || t.disconnect(), t = null, window.removeEventListener("mousemove", y), window.removeEventListener("mouseup", R), S.value && (document.body.style.cursor = "", document.body.style.userSelect = "");
|
|
61
|
+
}), O(
|
|
62
62
|
() => n.initialLeftWidth,
|
|
63
63
|
(i) => {
|
|
64
64
|
n.storageKey || (f.value = i);
|
|
65
65
|
}
|
|
66
66
|
);
|
|
67
|
-
const
|
|
68
|
-
|
|
67
|
+
const C = (i) => {
|
|
68
|
+
b.value = i;
|
|
69
69
|
};
|
|
70
|
-
return I({ switchTab:
|
|
70
|
+
return I({ switchTab: C }), (i, k) => (r(), c("div", {
|
|
71
71
|
ref_key: "containerRef",
|
|
72
72
|
ref: w,
|
|
73
73
|
class: "vfp-w-full vfp-h-full vfp-flex vfp-flex-col md:vfp-flex-row vfp-min-h-0 vfp-min-w-0",
|
|
74
74
|
style: E(p.value ? void 0 : { flexDirection: "column" })
|
|
75
75
|
}, [
|
|
76
|
-
s.mobileTabMode && !p.value ? (r(), c(
|
|
76
|
+
s.mobileTabMode && !p.value ? (r(), c(U, { key: 0 }, [
|
|
77
77
|
a("div", Te, [
|
|
78
78
|
a("button", {
|
|
79
79
|
type: "button",
|
|
80
|
-
class:
|
|
81
|
-
onClick: k[0] || (k[0] = (B) =>
|
|
80
|
+
class: F(["vfp-flex-1 vfp-py-2.5 vfp-text-sm vfp-transition-colors", b.value === "left" ? "vfp-text-fg-primary vfp-border-b-2 vfp-border-fg-primary -vfp-mb-px" : "vfp-text-fg-secondary"]),
|
|
81
|
+
onClick: k[0] || (k[0] = (B) => C("left"))
|
|
82
82
|
}, _(s.leftTabLabel ?? g(u)("zip.file_tree")), 3),
|
|
83
83
|
a("button", {
|
|
84
84
|
type: "button",
|
|
85
|
-
class:
|
|
86
|
-
onClick: k[1] || (k[1] = (B) =>
|
|
85
|
+
class: F(["vfp-flex-1 vfp-py-2.5 vfp-text-sm vfp-transition-colors", b.value === "right" ? "vfp-text-fg-primary vfp-border-b-2 vfp-border-fg-primary -vfp-mb-px" : "vfp-text-fg-secondary"]),
|
|
86
|
+
onClick: k[1] || (k[1] = (B) => C("right"))
|
|
87
87
|
}, _(s.rightTabLabel ?? g(u)("toolbar.preview")), 3)
|
|
88
88
|
]),
|
|
89
89
|
q(a("div", _e, [
|
|
90
90
|
N(i.$slots, "left", {}, void 0, !0)
|
|
91
91
|
], 512), [
|
|
92
|
-
[V,
|
|
92
|
+
[V, b.value === "left"]
|
|
93
93
|
]),
|
|
94
94
|
q(a("div", $e, [
|
|
95
95
|
N(i.$slots, "right", {}, void 0, !0)
|
|
96
96
|
], 512), [
|
|
97
|
-
[V,
|
|
97
|
+
[V, b.value === "right"]
|
|
98
98
|
])
|
|
99
|
-
], 64)) : (r(), c(
|
|
99
|
+
], 64)) : (r(), c(U, { key: 1 }, [
|
|
100
100
|
a("div", {
|
|
101
101
|
class: "vfp-min-h-0 vfp-min-w-0 vfp-flex-shrink-0 vfp-w-full vfp-max-h-60 md:vfp-h-full md:vfp-max-h-none",
|
|
102
102
|
style: E(L.value)
|
|
@@ -106,20 +106,20 @@ const Te = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
|
|
|
106
106
|
a("div", {
|
|
107
107
|
role: "separator",
|
|
108
108
|
"aria-orientation": "vertical",
|
|
109
|
-
class:
|
|
109
|
+
class: F(["split-divider vfp-hidden md:vfp-block vfp-relative vfp-w-1.5 vfp-flex-shrink-0 vfp-cursor-col-resize vfp-transition-colors", S.value ? "dragging" : ""]),
|
|
110
110
|
style: E(p.value ? void 0 : { display: "none" }),
|
|
111
111
|
onMousedown: W
|
|
112
112
|
}, [...k[2] || (k[2] = [
|
|
113
113
|
a("span", { class: "vfp-absolute vfp-inset-y-0 hit-area" }, null, -1)
|
|
114
114
|
])], 38),
|
|
115
|
-
a("div",
|
|
115
|
+
a("div", Re, [
|
|
116
116
|
N(i.$slots, "right", {}, void 0, !0)
|
|
117
117
|
])
|
|
118
118
|
], 64))
|
|
119
119
|
], 4));
|
|
120
120
|
}
|
|
121
|
-
}), Me = /* @__PURE__ */ ne(
|
|
122
|
-
...
|
|
121
|
+
}), Me = /* @__PURE__ */ ne(Ce, [["__scopeId", "data-v-45379cb1"]]), We = { key: 0 }, Ee = { class: "vfp-truncate vfp-flex-1 vfp-min-w-0" }, De = { class: "vfp-flex-1 vfp-truncate vfp-min-w-0" }, Ie = { class: "vfp-text-xs vfp-text-fg-disabled vfp-flex-shrink-0 vfp-ml-2" }, Fe = { name: "ZipTreeItem" }, Ue = /* @__PURE__ */ Z({
|
|
122
|
+
...Fe,
|
|
123
123
|
props: {
|
|
124
124
|
node: {},
|
|
125
125
|
depth: {},
|
|
@@ -130,11 +130,11 @@ const Te = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
|
|
|
130
130
|
setup(s, { emit: I }) {
|
|
131
131
|
const n = s, u = I, w = $(() => ({ paddingLeft: `${n.depth * 14 + 10}px` })), f = $(() => n.expanded.has(n.node.path)), S = $(() => n.selectedPath === n.node.path), T = $(() => {
|
|
132
132
|
const l = fe({ name: n.node.name, type: "" });
|
|
133
|
-
return l === "image" ? we : l === "text" || l === "markdown" || l === "json" || l === "csv" || l === "xml" || l === "subtitle" ? n.node.name.endsWith(".md") || n.node.name.endsWith(".markdown") ?
|
|
134
|
-
}),
|
|
133
|
+
return l === "image" ? we : l === "text" || l === "markdown" || l === "json" || l === "csv" || l === "xml" || l === "subtitle" ? n.node.name.endsWith(".md") || n.node.name.endsWith(".markdown") ? xe : be : ye;
|
|
134
|
+
}), x = (l) => {
|
|
135
135
|
const t = l.currentTarget.getBoundingClientRect();
|
|
136
136
|
u("hover", n.node.name || "/", t);
|
|
137
|
-
},
|
|
137
|
+
}, b = () => u("leave");
|
|
138
138
|
return (l, t) => {
|
|
139
139
|
const v = se("ZipTreeItem");
|
|
140
140
|
return s.node.isDir ? (r(), c("div", We, [
|
|
@@ -143,16 +143,16 @@ const Te = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
|
|
|
143
143
|
class: "tree-row dir-row",
|
|
144
144
|
style: E(w.value),
|
|
145
145
|
onClick: t[0] || (t[0] = (L) => u("toggle", s.node.path)),
|
|
146
|
-
onMouseenter:
|
|
147
|
-
onMouseleave:
|
|
146
|
+
onMouseenter: x,
|
|
147
|
+
onMouseleave: b
|
|
148
148
|
}, [
|
|
149
149
|
H(g(ke), {
|
|
150
|
-
class:
|
|
150
|
+
class: F(["vfp-w-3.5 vfp-h-3.5 vfp-flex-shrink-0 vfp-transition-transform", { "vfp-rotate-90": f.value }])
|
|
151
151
|
}, null, 8, ["class"]),
|
|
152
|
-
(r(), D(
|
|
152
|
+
(r(), D(A(f.value ? g(Le) : g(ze)), { class: "vfp-w-4 vfp-h-4 vfp-flex-shrink-0 vfp-text-amber-300/80" })),
|
|
153
153
|
a("span", Ee, _(s.node.name || "/"), 1)
|
|
154
154
|
], 36),
|
|
155
|
-
f.value && s.node.children ? (r(!0), c(
|
|
155
|
+
f.value && s.node.children ? (r(!0), c(U, { key: 0 }, Q(s.node.children, (L) => (r(), D(v, {
|
|
156
156
|
key: L.path,
|
|
157
157
|
node: L,
|
|
158
158
|
depth: s.depth + 1,
|
|
@@ -166,35 +166,35 @@ const Te = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
|
|
|
166
166
|
])) : (r(), c("button", {
|
|
167
167
|
key: 1,
|
|
168
168
|
type: "button",
|
|
169
|
-
class:
|
|
169
|
+
class: F(["tree-row file-row", { selected: S.value }]),
|
|
170
170
|
style: E(w.value),
|
|
171
171
|
onClick: t[5] || (t[5] = (L) => u("select", s.node)),
|
|
172
|
-
onMouseenter:
|
|
173
|
-
onMouseleave:
|
|
172
|
+
onMouseenter: x,
|
|
173
|
+
onMouseleave: b
|
|
174
174
|
}, [
|
|
175
175
|
t[6] || (t[6] = a("span", { class: "vfp-w-3.5 vfp-h-3.5 vfp-flex-shrink-0" }, null, -1)),
|
|
176
|
-
(r(), D(
|
|
176
|
+
(r(), D(A(T.value), { class: "vfp-w-4 vfp-h-4 vfp-flex-shrink-0 vfp-text-fg-tertiary" })),
|
|
177
177
|
a("span", De, _(s.node.name), 1),
|
|
178
178
|
a("span", Ie, _(g(de)(s.node.size)), 1)
|
|
179
179
|
], 38));
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
|
-
}), Be = /* @__PURE__ */ ne(
|
|
182
|
+
}), Be = /* @__PURE__ */ ne(Ue, [["__scopeId", "data-v-124c382d"]]), Ke = {
|
|
183
183
|
key: 0,
|
|
184
184
|
class: "vfp-renderer-loading"
|
|
185
|
-
}, Ne = { class: "vfp-renderer-loading-content" }, He = { class: "vfp-renderer-loading-text" }, Pe = { class: "vfp-w-full vfp-h-full vfp-overflow-auto" }, je = { class: "vfp-w-full vfp-h-full vfp-flex vfp-flex-col" },
|
|
185
|
+
}, Ne = { class: "vfp-renderer-loading-content" }, He = { class: "vfp-renderer-loading-text" }, Pe = { class: "vfp-w-full vfp-h-full vfp-overflow-auto" }, je = { class: "vfp-w-full vfp-h-full vfp-flex vfp-flex-col" }, Oe = {
|
|
186
186
|
key: 0,
|
|
187
187
|
class: "vfp-renderer-loading vfp-flex-1"
|
|
188
|
-
},
|
|
188
|
+
}, Ze = { class: "vfp-renderer-loading-content" }, qe = { class: "vfp-renderer-loading-text" }, Ve = {
|
|
189
189
|
key: 1,
|
|
190
190
|
class: "vfp-flex-1"
|
|
191
|
-
},
|
|
191
|
+
}, Ae = {
|
|
192
192
|
key: 2,
|
|
193
193
|
class: "vfp-flex-1 vfp-flex vfp-items-center vfp-justify-center vfp-text-fg-muted vfp-text-sm vfp-p-6"
|
|
194
|
-
},
|
|
194
|
+
}, Ge = {
|
|
195
195
|
key: 3,
|
|
196
196
|
class: "vfp-flex-1 vfp-min-h-0 vfp-overflow-hidden vfp-flex vfp-relative vfp-z-0"
|
|
197
|
-
}, tt = /* @__PURE__ */
|
|
197
|
+
}, tt = /* @__PURE__ */ Z({
|
|
198
198
|
__name: "index",
|
|
199
199
|
props: {
|
|
200
200
|
url: {},
|
|
@@ -202,17 +202,17 @@ const Te = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
|
|
|
202
202
|
},
|
|
203
203
|
setup(s, { expose: I }) {
|
|
204
204
|
const n = re(
|
|
205
|
-
() => import("./index-
|
|
206
|
-
), u = s, w = new Se(), { t: f } = te(), S = pe(), T = d(null),
|
|
205
|
+
() => import("./index-DZZN3kYi.mjs").then((e) => e.$)
|
|
206
|
+
), u = s, w = new Se(), { t: f } = te(), S = pe(), T = d(null), x = d(null), b = d(!0), l = d(null), t = d(/* @__PURE__ */ new Set([""])), v = d(null), L = d(!1), p = d(null), y = d(null), R = d(null), W = d(null), C = () => {
|
|
207
207
|
var e;
|
|
208
208
|
(e = v.value) != null && e.blobUrl && URL.revokeObjectURL(v.value.blobUrl);
|
|
209
209
|
}, i = async () => {
|
|
210
|
-
|
|
210
|
+
C(), v.value = null, b.value = !0, l.value = null;
|
|
211
211
|
try {
|
|
212
212
|
const e = await S.value(u.url);
|
|
213
213
|
if (!e.ok) throw new ue("common.load_failed");
|
|
214
214
|
const o = await e.arrayBuffer(), m = await ce(o), z = me(m), h = he(z);
|
|
215
|
-
T.value = m,
|
|
215
|
+
T.value = m, x.value = h;
|
|
216
216
|
const M = /* @__PURE__ */ new Set([""]);
|
|
217
217
|
if (h.children)
|
|
218
218
|
for (const K of h.children) K.isDir && M.add(K.path);
|
|
@@ -220,24 +220,24 @@ const Te = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
|
|
|
220
220
|
} catch (e) {
|
|
221
221
|
console.error(e), l.value = f.value("zip.load_failed");
|
|
222
222
|
} finally {
|
|
223
|
-
|
|
223
|
+
b.value = !1;
|
|
224
224
|
}
|
|
225
225
|
};
|
|
226
|
-
|
|
226
|
+
O(() => u.url, (e) => {
|
|
227
227
|
e && i();
|
|
228
228
|
}, { immediate: !0 }), J(() => {
|
|
229
|
-
|
|
229
|
+
C();
|
|
230
230
|
});
|
|
231
231
|
const k = $(() => {
|
|
232
|
-
if (!
|
|
232
|
+
if (!x.value) return null;
|
|
233
233
|
let e = 0, o = 0, m = 0;
|
|
234
234
|
const z = (h) => {
|
|
235
235
|
var M;
|
|
236
236
|
h.isDir ? (h.path && o++, (M = h.children) == null || M.forEach(z)) : (e++, m += h.size);
|
|
237
237
|
};
|
|
238
|
-
return z(
|
|
238
|
+
return z(x.value), { files: e, dirs: o, size: m };
|
|
239
239
|
});
|
|
240
|
-
|
|
240
|
+
O(k, () => w.notify()), I({
|
|
241
241
|
getToolbarGroups: () => [],
|
|
242
242
|
onToolbarChange: (e) => w.subscribe(e)
|
|
243
243
|
});
|
|
@@ -252,29 +252,29 @@ const Te = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
|
|
|
252
252
|
}, oe = async (e) => {
|
|
253
253
|
var o, m, z;
|
|
254
254
|
if (!(!T.value || e.isDir || ((o = v.value) == null ? void 0 : o.path) === e.path || W.value === e.path)) {
|
|
255
|
-
W.value = e.path,
|
|
255
|
+
W.value = e.path, C(), v.value = null, L.value = !0, p.value = null;
|
|
256
256
|
try {
|
|
257
257
|
const h = X(e.name), M = await ge(T.value, e.path, h !== "application/octet-stream" ? h : void 0), K = URL.createObjectURL(M);
|
|
258
|
-
v.value = { path: e.path, name: e.name, size: e.size, blobUrl: K }, (m =
|
|
258
|
+
v.value = { path: e.path, name: e.name, size: e.size, blobUrl: K }, (m = R.value) == null || m.switchTab("right");
|
|
259
259
|
} catch (h) {
|
|
260
|
-
console.error(h), p.value = f.value("zip.entry_read_failed"), (z =
|
|
260
|
+
console.error(h), p.value = f.value("zip.entry_read_failed"), (z = R.value) == null || z.switchTab("right");
|
|
261
261
|
} finally {
|
|
262
262
|
L.value = !1, W.value === e.path && (W.value = null);
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
265
|
}, ae = $(() => v.value ? [{ name: v.value.name, url: v.value.blobUrl, type: X(v.value.name) }] : []);
|
|
266
|
-
return (e, o) =>
|
|
266
|
+
return (e, o) => b.value ? (r(), c("div", Ke, [
|
|
267
267
|
a("div", Ne, [
|
|
268
268
|
o[0] || (o[0] = a("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
269
269
|
a("span", He, _(g(f)("common.loading")), 1)
|
|
270
270
|
])
|
|
271
|
-
])) : l.value || !
|
|
271
|
+
])) : l.value || !x.value ? (r(), D(Y, {
|
|
272
272
|
key: 1,
|
|
273
273
|
message: l.value || g(f)("zip.parse_failed")
|
|
274
|
-
}, null, 8, ["message"])) : (r(), c(
|
|
274
|
+
}, null, 8, ["message"])) : (r(), c(U, { key: 2 }, [
|
|
275
275
|
H(Me, {
|
|
276
276
|
ref_key: "splitRef",
|
|
277
|
-
ref:
|
|
277
|
+
ref: R,
|
|
278
278
|
"initial-left-width": 280,
|
|
279
279
|
"min-left-width": 180,
|
|
280
280
|
"max-left-width": 560,
|
|
@@ -283,9 +283,9 @@ const Te = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
|
|
|
283
283
|
"left-tab-label": g(f)("zip.file_tree"),
|
|
284
284
|
"right-tab-label": g(f)("toolbar.preview")
|
|
285
285
|
}, {
|
|
286
|
-
left:
|
|
286
|
+
left: G(() => [
|
|
287
287
|
a("div", Pe, [
|
|
288
|
-
(r(!0), c(
|
|
288
|
+
(r(!0), c(U, null, Q(x.value.children || [], (m) => {
|
|
289
289
|
var z;
|
|
290
290
|
return r(), D(Be, {
|
|
291
291
|
key: m.path,
|
|
@@ -301,23 +301,23 @@ const Te = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
|
|
|
301
301
|
}), 128))
|
|
302
302
|
])
|
|
303
303
|
]),
|
|
304
|
-
right:
|
|
304
|
+
right: G(() => [
|
|
305
305
|
a("div", je, [
|
|
306
|
-
L.value ? (r(), c("div",
|
|
307
|
-
a("div",
|
|
306
|
+
L.value ? (r(), c("div", Oe, [
|
|
307
|
+
a("div", Ze, [
|
|
308
308
|
o[1] || (o[1] = a("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
309
309
|
a("span", qe, _(g(f)("common.loading")), 1)
|
|
310
310
|
])
|
|
311
311
|
])) : p.value ? (r(), c("div", Ve, [
|
|
312
|
-
H(
|
|
313
|
-
])) : v.value ? (r(), c("div",
|
|
312
|
+
H(Y, { message: p.value }, null, 8, ["message"])
|
|
313
|
+
])) : v.value ? (r(), c("div", Ge, [
|
|
314
314
|
H(g(n), {
|
|
315
315
|
mode: "embed",
|
|
316
316
|
files: ae.value,
|
|
317
317
|
"current-index": 0,
|
|
318
318
|
"zip-nesting-depth": s.nestingDepth + 1
|
|
319
319
|
}, null, 8, ["files", "zip-nesting-depth"])
|
|
320
|
-
])) : (r(), c("div",
|
|
320
|
+
])) : (r(), c("div", Ae, _(g(f)("zip.select_file")), 1))
|
|
321
321
|
])
|
|
322
322
|
]),
|
|
323
323
|
_: 1
|