@eternalheart/vue-file-preview 1.6.7 → 1.6.8
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 +17 -3
- package/README.zh-CN.md +17 -3
- package/lib/chunks/{index-06Ivpw6V.mjs → index-B1OYfn_2.mjs} +1 -1
- package/lib/chunks/{index-DoqCnKkl.mjs → index-BJpiAJuf.mjs} +2 -2
- package/lib/chunks/{index-CK43N0Ho.mjs → index-BgtFv2mf.mjs} +1 -1
- package/lib/chunks/{index-DlIRXpmw.mjs → index-C3isZ_ue.mjs} +1 -1
- package/lib/chunks/{index-BflKoE04.mjs → index-CG01fzip.mjs} +1 -1
- package/lib/chunks/{index-CXAEvuVP.mjs → index-CJYCIk06.mjs} +1 -1
- package/lib/chunks/{index-B3jcS1UB.mjs → index-CRTvjRyt.mjs} +1 -1
- package/lib/chunks/{index-Cv0lIWeI.mjs → index-CVN9K0qA.mjs} +1 -1
- package/lib/chunks/{index-BgTW_P3u.mjs → index-CodGY6nz.mjs} +1 -1
- package/lib/chunks/{index-CR3QkKJt.mjs → index-D18co0be.mjs} +1 -1
- package/lib/chunks/{index-CBN0qoP1.mjs → index-D4O2OC-3.mjs} +1 -1
- package/lib/chunks/index-D5JP7cnv.mjs +110 -0
- package/lib/chunks/{index-B6UNmyiS.mjs → index-D6tN6EZR.mjs} +1 -1
- package/lib/chunks/{index-Cr7raBmi.mjs → index-DJAZU94G.mjs} +1 -1
- package/lib/chunks/{index-sPfLaVRe.mjs → index-DL3r7NGE.mjs} +1 -1
- package/lib/chunks/{index-D_XKzCZJ.mjs → index-DYI-zHxA.mjs} +1 -1
- package/lib/chunks/{index--sqXkUEP.mjs → index-DbQYYr9C.mjs} +1 -1
- package/lib/chunks/{index-DdbaVSB8.mjs → index-Hj5oboUU.mjs} +529 -534
- package/lib/chunks/{index-CyIp8Xfg.mjs → index-TlmEk0Wz.mjs} +1 -1
- package/lib/chunks/{index-Xta2zHnj.mjs → index-XEPcqTt4.mjs} +1 -1
- package/lib/chunks/index-Z3_lfqRQ.mjs +348 -0
- package/lib/chunks/{index-CSY197_j.mjs → index-bgq5MUC6.mjs} +1 -1
- package/lib/chunks/{useShikiHighlight-J62fUszo.mjs → useShikiHighlight-xcK26Bn3.mjs} +1 -1
- package/lib/index.cjs +18 -18
- package/lib/index.css +1 -1
- package/lib/index.mjs +1 -1
- package/package.json +1 -1
- package/lib/chunks/index-BWNmKHd0.mjs +0 -110
- package/lib/chunks/index-BmsJxBJa.mjs +0 -320
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as m, ref as a, watch as _, openBlock as s, createElementBlock as f, createElementVNode as p, createBlock as h } from "vue";
|
|
2
|
-
import { u as w, b as y, S as g } from "./index-
|
|
2
|
+
import { u as w, b as y, S as g } from "./index-Hj5oboUU.mjs";
|
|
3
3
|
import { _ as b } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
|
|
4
4
|
const k = {
|
|
5
5
|
key: 0,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as $, ref as y, watch as G, computed as h, openBlock as a, createElementBlock as r, createElementVNode as e, createBlock as S, unref as u, normalizeClass as x, Fragment as g, renderList as k, toDisplayString as o, createCommentVNode as T } from "vue";
|
|
2
|
-
import { u as V, b as j, M as z, $ as d, e as A, _ as D } from "./index-
|
|
2
|
+
import { u as V, b as j, M as z, $ as d, e as A, _ as D } from "./index-Hj5oboUU.mjs";
|
|
3
3
|
import { _ as I } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
|
|
4
4
|
const O = {
|
|
5
5
|
key: 0,
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import { defineComponent as H, ref as v, computed as z, onMounted as oe, onBeforeUnmount as A, watch as K, openBlock as s, createElementBlock as c, normalizeStyle as E, Fragment as U, createElementVNode as f, normalizeClass as F, toDisplayString as C, withDirectives as O, renderSlot as _, vShow as Z, resolveComponent as ae, createVNode as N, unref as M, createBlock as W, resolveDynamicComponent as q, renderList as Y, createCommentVNode as J, defineAsyncComponent as ie, withCtx as G, Teleport as se } from "vue";
|
|
2
|
+
import { _ as Q, V as re, R as fe, u as ve, b as de, f as X, h as pe, I as ue, K as ce, w as me } from "./index-Hj5oboUU.mjs";
|
|
3
|
+
import { FileImage as he, FileText as we, FileCode as xe, File as ge, ChevronRight as be, FolderOpen as ye, Folder as ke } from "lucide-vue-next";
|
|
4
|
+
import { _ as Le } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
|
|
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" }, ze = { 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-h-0 vfp-min-w-0 vfp-w-full vfp-overflow-hidden" }, $e = { class: "vfp-flex-1 vfp-min-w-0 vfp-min-h-0 vfp-overflow-hidden" }, Ce = /* @__PURE__ */ H({
|
|
7
|
+
name: "ResizableSplit",
|
|
8
|
+
__name: "ResizableSplit",
|
|
9
|
+
props: {
|
|
10
|
+
initialLeftWidth: { default: 280 },
|
|
11
|
+
minLeftWidth: { default: 160 },
|
|
12
|
+
maxLeftWidth: { default: 640 },
|
|
13
|
+
minRightWidth: { default: 200 },
|
|
14
|
+
storageKey: {},
|
|
15
|
+
desktopMedia: { default: "(min-width: 768px)" },
|
|
16
|
+
mobileTabMode: { type: Boolean, default: !1 },
|
|
17
|
+
leftTabLabel: { default: "文件树" },
|
|
18
|
+
rightTabLabel: { default: "预览" }
|
|
19
|
+
},
|
|
20
|
+
setup(i, { expose: D }) {
|
|
21
|
+
const t = i, r = v(null), k = v(
|
|
22
|
+
(() => {
|
|
23
|
+
if (t.storageKey && typeof window < "u") {
|
|
24
|
+
const o = Number(window.localStorage.getItem(t.storageKey));
|
|
25
|
+
if (!isNaN(o) && o > 0) return o;
|
|
26
|
+
}
|
|
27
|
+
return t.initialLeftWidth;
|
|
28
|
+
})()
|
|
29
|
+
), w = v(!1), R = v(!1), S = v(!0), u = v("left");
|
|
30
|
+
let m = null, l = null;
|
|
31
|
+
const n = () => {
|
|
32
|
+
m && (R.value = m.matches);
|
|
33
|
+
}, d = z(
|
|
34
|
+
() => R.value && S.value ? { width: `${k.value}px` } : void 0
|
|
35
|
+
), x = z(() => R.value && S.value), p = (o) => {
|
|
36
|
+
if (!r.value) return;
|
|
37
|
+
const y = r.value.getBoundingClientRect(), I = o.clientX - y.left, P = y.width - t.minRightWidth - 6, j = Math.min(t.maxLeftWidth, P);
|
|
38
|
+
k.value = Math.max(
|
|
39
|
+
t.minLeftWidth,
|
|
40
|
+
Math.min(j, I)
|
|
41
|
+
);
|
|
42
|
+
}, g = () => {
|
|
43
|
+
if (w.value && (w.value = !1, window.removeEventListener("mousemove", p), window.removeEventListener("mouseup", g), document.body.style.cursor = "", document.body.style.userSelect = "", t.storageKey))
|
|
44
|
+
try {
|
|
45
|
+
window.localStorage.setItem(t.storageKey, String(k.value));
|
|
46
|
+
} catch {
|
|
47
|
+
}
|
|
48
|
+
}, B = (o) => {
|
|
49
|
+
o.preventDefault(), w.value = !0, window.addEventListener("mousemove", p), window.addEventListener("mouseup", g), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
50
|
+
};
|
|
51
|
+
oe(() => {
|
|
52
|
+
if (typeof window < "u") {
|
|
53
|
+
m = window.matchMedia(t.desktopMedia), n(), m.addEventListener("change", n);
|
|
54
|
+
const o = () => {
|
|
55
|
+
r.value && (S.value = r.value.getBoundingClientRect().width >= t.minLeftWidth + t.minRightWidth + 6);
|
|
56
|
+
};
|
|
57
|
+
o(), l = typeof ResizeObserver < "u" ? new ResizeObserver(o) : null, l == null || l.observe(r.value);
|
|
58
|
+
}
|
|
59
|
+
}), A(() => {
|
|
60
|
+
m && m.removeEventListener("change", n), l == null || l.disconnect(), l = null, window.removeEventListener("mousemove", p), window.removeEventListener("mouseup", g), w.value && (document.body.style.cursor = "", document.body.style.userSelect = "");
|
|
61
|
+
}), K(
|
|
62
|
+
() => t.initialLeftWidth,
|
|
63
|
+
(o) => {
|
|
64
|
+
t.storageKey || (k.value = o);
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
const T = (o) => {
|
|
68
|
+
u.value = o;
|
|
69
|
+
};
|
|
70
|
+
return D({ switchTab: T }), (o, y) => (s(), c("div", {
|
|
71
|
+
ref_key: "containerRef",
|
|
72
|
+
ref: r,
|
|
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
|
+
style: E(x.value ? void 0 : { flexDirection: "column" })
|
|
75
|
+
}, [
|
|
76
|
+
i.mobileTabMode && !x.value ? (s(), c(U, { key: 0 }, [
|
|
77
|
+
f("div", Te, [
|
|
78
|
+
f("button", {
|
|
79
|
+
type: "button",
|
|
80
|
+
class: F(["vfp-flex-1 vfp-py-2.5 vfp-text-sm vfp-transition-colors", u.value === "left" ? "vfp-text-fg-primary vfp-border-b-2 vfp-border-fg-primary -vfp-mb-px" : "vfp-text-fg-secondary"]),
|
|
81
|
+
onClick: y[0] || (y[0] = (I) => T("left"))
|
|
82
|
+
}, C(i.leftTabLabel), 3),
|
|
83
|
+
f("button", {
|
|
84
|
+
type: "button",
|
|
85
|
+
class: F(["vfp-flex-1 vfp-py-2.5 vfp-text-sm vfp-transition-colors", u.value === "right" ? "vfp-text-fg-primary vfp-border-b-2 vfp-border-fg-primary -vfp-mb-px" : "vfp-text-fg-secondary"]),
|
|
86
|
+
onClick: y[1] || (y[1] = (I) => T("right"))
|
|
87
|
+
}, C(i.rightTabLabel), 3)
|
|
88
|
+
]),
|
|
89
|
+
O(f("div", ze, [
|
|
90
|
+
_(o.$slots, "left", {}, void 0, !0)
|
|
91
|
+
], 512), [
|
|
92
|
+
[Z, u.value === "left"]
|
|
93
|
+
]),
|
|
94
|
+
O(f("div", Re, [
|
|
95
|
+
_(o.$slots, "right", {}, void 0, !0)
|
|
96
|
+
], 512), [
|
|
97
|
+
[Z, u.value === "right"]
|
|
98
|
+
])
|
|
99
|
+
], 64)) : (s(), c(U, { key: 1 }, [
|
|
100
|
+
f("div", {
|
|
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
|
+
style: E(d.value)
|
|
103
|
+
}, [
|
|
104
|
+
_(o.$slots, "left", {}, void 0, !0)
|
|
105
|
+
], 4),
|
|
106
|
+
f("div", {
|
|
107
|
+
role: "separator",
|
|
108
|
+
"aria-orientation": "vertical",
|
|
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", w.value ? "dragging" : ""]),
|
|
110
|
+
style: E(x.value ? void 0 : { display: "none" }),
|
|
111
|
+
onMousedown: B
|
|
112
|
+
}, [...y[2] || (y[2] = [
|
|
113
|
+
f("span", { class: "vfp-absolute vfp-inset-y-0 hit-area" }, null, -1)
|
|
114
|
+
])], 38),
|
|
115
|
+
f("div", $e, [
|
|
116
|
+
_(o.$slots, "right", {}, void 0, !0)
|
|
117
|
+
])
|
|
118
|
+
], 64))
|
|
119
|
+
], 4));
|
|
120
|
+
}
|
|
121
|
+
}), Me = /* @__PURE__ */ Q(Ce, [["__scopeId", "data-v-f34907bf"]]), Ee = { key: 0 }, We = { 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__ */ H({
|
|
122
|
+
...Fe,
|
|
123
|
+
props: {
|
|
124
|
+
node: {},
|
|
125
|
+
depth: {},
|
|
126
|
+
selectedPath: {},
|
|
127
|
+
expanded: {}
|
|
128
|
+
},
|
|
129
|
+
emits: ["toggle", "select", "hover", "leave"],
|
|
130
|
+
setup(i, { emit: D }) {
|
|
131
|
+
const t = i, r = D, k = z(() => ({ paddingLeft: `${t.depth * 14 + 10}px` })), w = z(() => t.expanded.has(t.node.path)), R = z(() => t.selectedPath === t.node.path), S = z(() => {
|
|
132
|
+
const l = re({ name: t.node.name, type: "" });
|
|
133
|
+
return l === "image" ? he : l === "text" || l === "markdown" || l === "json" || l === "csv" || l === "xml" || l === "subtitle" ? t.node.name.endsWith(".md") || t.node.name.endsWith(".markdown") ? we : xe : ge;
|
|
134
|
+
}), u = (l) => {
|
|
135
|
+
const n = l.currentTarget.getBoundingClientRect();
|
|
136
|
+
r("hover", t.node.name || "/", n);
|
|
137
|
+
}, m = () => r("leave");
|
|
138
|
+
return (l, n) => {
|
|
139
|
+
const d = ae("ZipTreeItem");
|
|
140
|
+
return i.node.isDir ? (s(), c("div", Ee, [
|
|
141
|
+
f("button", {
|
|
142
|
+
type: "button",
|
|
143
|
+
class: "tree-row dir-row",
|
|
144
|
+
style: E(k.value),
|
|
145
|
+
onClick: n[0] || (n[0] = (x) => r("toggle", i.node.path)),
|
|
146
|
+
onMouseenter: u,
|
|
147
|
+
onMouseleave: m
|
|
148
|
+
}, [
|
|
149
|
+
N(M(be), {
|
|
150
|
+
class: F(["vfp-w-3.5 vfp-h-3.5 vfp-flex-shrink-0 vfp-transition-transform", { "vfp-rotate-90": w.value }])
|
|
151
|
+
}, null, 8, ["class"]),
|
|
152
|
+
(s(), W(q(w.value ? M(ye) : M(ke)), { class: "vfp-w-4 vfp-h-4 vfp-flex-shrink-0 vfp-text-amber-300/80" })),
|
|
153
|
+
f("span", We, C(i.node.name || "/"), 1)
|
|
154
|
+
], 36),
|
|
155
|
+
w.value && i.node.children ? (s(!0), c(U, { key: 0 }, Y(i.node.children, (x) => (s(), W(d, {
|
|
156
|
+
key: x.path,
|
|
157
|
+
node: x,
|
|
158
|
+
depth: i.depth + 1,
|
|
159
|
+
"selected-path": i.selectedPath,
|
|
160
|
+
expanded: i.expanded,
|
|
161
|
+
onToggle: n[1] || (n[1] = (p) => r("toggle", p)),
|
|
162
|
+
onSelect: n[2] || (n[2] = (p) => r("select", p)),
|
|
163
|
+
onHover: n[3] || (n[3] = (p, g) => r("hover", p, g)),
|
|
164
|
+
onLeave: n[4] || (n[4] = (p) => r("leave"))
|
|
165
|
+
}, null, 8, ["node", "depth", "selected-path", "expanded"]))), 128)) : J("", !0)
|
|
166
|
+
])) : (s(), c("button", {
|
|
167
|
+
key: 1,
|
|
168
|
+
type: "button",
|
|
169
|
+
class: F(["tree-row file-row", { selected: R.value }]),
|
|
170
|
+
style: E(k.value),
|
|
171
|
+
onClick: n[5] || (n[5] = (x) => r("select", i.node)),
|
|
172
|
+
onMouseenter: u,
|
|
173
|
+
onMouseleave: m
|
|
174
|
+
}, [
|
|
175
|
+
n[6] || (n[6] = f("span", { class: "vfp-w-3.5 vfp-h-3.5 vfp-flex-shrink-0" }, null, -1)),
|
|
176
|
+
(s(), W(q(S.value), { class: "vfp-w-4 vfp-h-4 vfp-flex-shrink-0 vfp-text-fg-tertiary" })),
|
|
177
|
+
f("span", De, C(i.node.name), 1),
|
|
178
|
+
f("span", Ie, C(M(fe)(i.node.size)), 1)
|
|
179
|
+
], 38));
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}), Be = /* @__PURE__ */ Q(Ue, [["__scopeId", "data-v-124c382d"]]), _e = {
|
|
183
|
+
key: 0,
|
|
184
|
+
class: "vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"
|
|
185
|
+
}, je = { class: "vfp-w-full vfp-h-full vfp-overflow-auto" }, Ke = { class: "vfp-w-full vfp-h-full vfp-flex vfp-flex-col" }, Ne = {
|
|
186
|
+
key: 0,
|
|
187
|
+
class: "vfp-flex-1 vfp-flex vfp-items-center vfp-justify-center vfp-text-fg-muted vfp-text-sm vfp-p-6"
|
|
188
|
+
}, He = {
|
|
189
|
+
key: 1,
|
|
190
|
+
class: "vfp-flex-1 vfp-flex vfp-items-center vfp-justify-center"
|
|
191
|
+
}, Pe = {
|
|
192
|
+
key: 2,
|
|
193
|
+
class: "vfp-flex-1 vfp-flex vfp-items-center vfp-justify-center vfp-text-fg-secondary"
|
|
194
|
+
}, Ve = {
|
|
195
|
+
key: 3,
|
|
196
|
+
class: "vfp-flex-1 vfp-min-h-0 vfp-overflow-hidden vfp-flex vfp-relative vfp-z-0"
|
|
197
|
+
}, Ae = /* @__PURE__ */ H({
|
|
198
|
+
__name: "index",
|
|
199
|
+
props: {
|
|
200
|
+
url: {},
|
|
201
|
+
nestingDepth: { default: 0 }
|
|
202
|
+
},
|
|
203
|
+
setup(i, { expose: D }) {
|
|
204
|
+
const t = ie(
|
|
205
|
+
() => import("./index-Hj5oboUU.mjs").then((e) => e.x)
|
|
206
|
+
), r = i, k = new Se(), { t: w } = ve(), R = de(), S = v(null), u = v(null), m = v(!0), l = v(null), n = v(/* @__PURE__ */ new Set([""])), d = v(null), x = v(!1), p = v(null), g = v(null), B = v(null), T = v(null), o = () => {
|
|
207
|
+
var e;
|
|
208
|
+
(e = d.value) != null && e.blobUrl && URL.revokeObjectURL(d.value.blobUrl);
|
|
209
|
+
}, y = async () => {
|
|
210
|
+
o(), d.value = null, m.value = !0, l.value = null;
|
|
211
|
+
try {
|
|
212
|
+
const e = await R.value(r.url);
|
|
213
|
+
if (!e.ok) throw new Error("加载失败");
|
|
214
|
+
const a = await e.arrayBuffer(), h = await pe(a), b = ue(h), L = ce(b);
|
|
215
|
+
S.value = h, u.value = L;
|
|
216
|
+
const $ = /* @__PURE__ */ new Set([""]);
|
|
217
|
+
if (L.children)
|
|
218
|
+
for (const V of L.children) V.isDir && $.add(V.path);
|
|
219
|
+
n.value = $;
|
|
220
|
+
} catch (e) {
|
|
221
|
+
console.error(e), l.value = w.value("zip.load_failed");
|
|
222
|
+
} finally {
|
|
223
|
+
m.value = !1;
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
K(() => r.url, (e) => {
|
|
227
|
+
e && y();
|
|
228
|
+
}, { immediate: !0 }), A(() => {
|
|
229
|
+
o();
|
|
230
|
+
});
|
|
231
|
+
const I = z(() => {
|
|
232
|
+
if (!u.value) return null;
|
|
233
|
+
let e = 0, a = 0, h = 0;
|
|
234
|
+
const b = (L) => {
|
|
235
|
+
var $;
|
|
236
|
+
L.isDir ? (L.path && a++, ($ = L.children) == null || $.forEach(b)) : (e++, h += L.size);
|
|
237
|
+
};
|
|
238
|
+
return b(u.value), { files: e, dirs: a, size: h };
|
|
239
|
+
});
|
|
240
|
+
K(I, () => k.notify()), D({
|
|
241
|
+
getToolbarGroups: () => [],
|
|
242
|
+
onToolbarChange: (e) => k.subscribe(e)
|
|
243
|
+
});
|
|
244
|
+
const j = (e) => {
|
|
245
|
+
const a = new Set(n.value);
|
|
246
|
+
a.has(e) ? a.delete(e) : a.add(e), n.value = a;
|
|
247
|
+
}, ee = (e, a) => {
|
|
248
|
+
const h = typeof window < "u" ? window.innerWidth - 328 : a.right + 8;
|
|
249
|
+
g.value = { text: e, x: Math.max(8, Math.min(a.right + 8, h)), y: a.top + a.height / 2 };
|
|
250
|
+
}, te = () => {
|
|
251
|
+
g.value = null;
|
|
252
|
+
}, ne = async (e) => {
|
|
253
|
+
var a, h;
|
|
254
|
+
if (!(!S.value || e.isDir || ((a = d.value) == null ? void 0 : a.path) === e.path || T.value === e.path)) {
|
|
255
|
+
T.value = e.path, o(), x.value = !0, p.value = null;
|
|
256
|
+
try {
|
|
257
|
+
const b = X(e.name), L = await me(S.value, e.path, b !== "application/octet-stream" ? b : void 0), $ = URL.createObjectURL(L);
|
|
258
|
+
d.value = { path: e.path, name: e.name, size: e.size, blobUrl: $ }, (h = B.value) == null || h.switchTab("right");
|
|
259
|
+
} catch (b) {
|
|
260
|
+
console.error(b), p.value = "条目读取失败";
|
|
261
|
+
} finally {
|
|
262
|
+
x.value = !1, T.value === e.path && (T.value = null);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}, le = z(() => d.value ? [{ name: d.value.name, url: d.value.blobUrl, type: X(d.value.name) }] : []);
|
|
266
|
+
return (e, a) => m.value ? (s(), c("div", _e, [...a[0] || (a[0] = [
|
|
267
|
+
f("div", { class: "vfp-w-12 vfp-h-12 vfp-border-4 vfp-border-line-strong vfp-border-t-spinner-head vfp-rounded-full vfp-animate-spin" }, null, -1)
|
|
268
|
+
])])) : l.value || !u.value ? (s(), W(Le, {
|
|
269
|
+
key: 1,
|
|
270
|
+
message: l.value || M(w)("zip.parse_failed")
|
|
271
|
+
}, null, 8, ["message"])) : (s(), c(U, { key: 2 }, [
|
|
272
|
+
N(Me, {
|
|
273
|
+
ref_key: "splitRef",
|
|
274
|
+
ref: B,
|
|
275
|
+
"initial-left-width": 280,
|
|
276
|
+
"min-left-width": 180,
|
|
277
|
+
"max-left-width": 560,
|
|
278
|
+
"storage-key": "vfp-zip-split-left",
|
|
279
|
+
"mobile-tab-mode": "",
|
|
280
|
+
"left-tab-label": "文件树",
|
|
281
|
+
"right-tab-label": "预览"
|
|
282
|
+
}, {
|
|
283
|
+
left: G(() => [
|
|
284
|
+
f("div", je, [
|
|
285
|
+
(s(!0), c(U, null, Y(u.value.children || [], (h) => {
|
|
286
|
+
var b;
|
|
287
|
+
return s(), W(Be, {
|
|
288
|
+
key: h.path,
|
|
289
|
+
node: h,
|
|
290
|
+
depth: 0,
|
|
291
|
+
"selected-path": ((b = d.value) == null ? void 0 : b.path) ?? null,
|
|
292
|
+
expanded: n.value,
|
|
293
|
+
onToggle: j,
|
|
294
|
+
onSelect: ne,
|
|
295
|
+
onHover: ee,
|
|
296
|
+
onLeave: te
|
|
297
|
+
}, null, 8, ["node", "selected-path", "expanded"]);
|
|
298
|
+
}), 128))
|
|
299
|
+
])
|
|
300
|
+
]),
|
|
301
|
+
right: G(() => [
|
|
302
|
+
f("div", Ke, [
|
|
303
|
+
d.value ? x.value ? (s(), c("div", He, [...a[1] || (a[1] = [
|
|
304
|
+
f("div", { class: "vfp-w-8 vfp-h-8 vfp-border-4 vfp-border-line-strong vfp-border-t-spinner-head vfp-rounded-full vfp-animate-spin" }, null, -1)
|
|
305
|
+
])])) : p.value ? (s(), c("div", Pe, C(p.value), 1)) : (s(), c("div", Ve, [
|
|
306
|
+
N(M(t), {
|
|
307
|
+
mode: "embed",
|
|
308
|
+
files: le.value,
|
|
309
|
+
"current-index": 0,
|
|
310
|
+
"zip-nesting-depth": i.nestingDepth + 1
|
|
311
|
+
}, null, 8, ["files", "zip-nesting-depth"])
|
|
312
|
+
])) : (s(), c("div", Ne, " 从左侧选择一个文件以预览 "))
|
|
313
|
+
])
|
|
314
|
+
]),
|
|
315
|
+
_: 1
|
|
316
|
+
}, 512),
|
|
317
|
+
(s(), W(se, { to: "body" }, [
|
|
318
|
+
g.value ? (s(), c("div", {
|
|
319
|
+
key: 0,
|
|
320
|
+
class: "vfp-zip-tip",
|
|
321
|
+
style: E({
|
|
322
|
+
position: "fixed",
|
|
323
|
+
zIndex: 2147483647,
|
|
324
|
+
pointerEvents: "none",
|
|
325
|
+
display: "block",
|
|
326
|
+
transform: "translateY(-50%)",
|
|
327
|
+
padding: "4px 8px",
|
|
328
|
+
background: "rgba(0, 0, 0, 0.85)",
|
|
329
|
+
color: "#fff",
|
|
330
|
+
fontSize: "12px",
|
|
331
|
+
lineHeight: 1.5,
|
|
332
|
+
borderRadius: "4px",
|
|
333
|
+
whiteSpace: "nowrap",
|
|
334
|
+
maxWidth: "min(320px, calc(100vw - 16px))",
|
|
335
|
+
overflow: "hidden",
|
|
336
|
+
textOverflow: "ellipsis",
|
|
337
|
+
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.3)",
|
|
338
|
+
left: g.value.x + "px",
|
|
339
|
+
top: g.value.y + "px"
|
|
340
|
+
})
|
|
341
|
+
}, C(g.value.text), 5)) : J("", !0)
|
|
342
|
+
]))
|
|
343
|
+
], 64));
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
export {
|
|
347
|
+
Ae as default
|
|
348
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as d, ref as U, watch as h, openBlock as $, createElementBlock as q, createElementVNode as x, createBlock as K, createVNode as C, unref as ee, h as g, inject as ne, computed as H } from "vue";
|
|
2
|
-
import { u as le, b as te, e as ie, L as ue, G as fe, c as oe } from "./index-
|
|
2
|
+
import { u as le, b as te, e as ie, L as ue, G as fe, c as oe } from "./index-Hj5oboUU.mjs";
|
|
3
3
|
import { _ as se } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
|
|
4
4
|
import { ChevronDown as ce, ChevronRight as pe } from "lucide-vue-next";
|
|
5
5
|
function ke(e, f = !1) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ref as i, watch as m } from "vue";
|
|
2
2
|
import { codeToHtml as h } from "shiki";
|
|
3
|
-
import { c as f } from "./index-
|
|
3
|
+
import { c as f } from "./index-Hj5oboUU.mjs";
|
|
4
4
|
function T(t, n) {
|
|
5
5
|
const a = f(), e = i(""), r = i([]), l = i(!0);
|
|
6
6
|
return m([t, n, a], async () => {
|