@eternalheart/vue-file-preview 1.7.0 → 1.7.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 +2 -0
- package/README.zh-CN.md +2 -0
- package/lib/FilePreviewContent.vue.d.ts +9 -1
- package/lib/FilePreviewEmbed.vue.d.ts +6 -1
- package/lib/FilePreviewModal.vue.d.ts +6 -1
- package/lib/chunks/{EmptyState.vue_vue_type_script_setup_true_lang--ZOobbGi.mjs → EmptyState.vue_vue_type_script_setup_true_lang-DSQp7H-K.mjs} +1 -1
- package/lib/chunks/{avifLoader-CAUzjn-d-CnJpGYJ2.mjs → avifLoader-CAUzjn-d-Cf00sjt2.mjs} +1 -1
- package/lib/chunks/{heicLoader-D_9PukkA-g_dLrWLP.mjs → heicLoader-D_9PukkA-cn1P7b2x.mjs} +1 -1
- package/lib/chunks/{index-C8lyQPe3.mjs → index-0VXtKKev.mjs} +3 -3
- package/lib/chunks/index-0fXL30y0.mjs +333 -0
- package/lib/chunks/{index-CWPdNhoe.mjs → index-B1AwVHWI.mjs} +60 -60
- package/lib/chunks/{index-C4hIk6pa.mjs → index-B77rFiau.mjs} +2 -2
- package/lib/chunks/{index-BzwJ0VWu.mjs → index-BB10as16.mjs} +33 -33
- package/lib/chunks/{index-BfOWoMpY.mjs → index-BBIn-k4u.mjs} +77 -77
- package/lib/chunks/{index-6XZXYqbp.mjs → index-BSzaI9ea.mjs} +29 -32
- package/lib/chunks/{index-Bg8poMIm.mjs → index-BZvy39tn.mjs} +29 -29
- package/lib/chunks/{index-zLQlyNR2.mjs → index-BlJEM2Lb.mjs} +62 -62
- package/lib/chunks/{index-z9RqL2wI.mjs → index-CZlnxQFA.mjs} +453 -453
- package/lib/chunks/{index-BPSzwMOC.mjs → index-ClhTPqDI.mjs} +46 -46
- package/lib/chunks/{index-Bf94DwQu.mjs → index-D690gnNu.mjs} +24 -24
- package/lib/chunks/index-D7WykPYL.mjs +51 -0
- package/lib/chunks/{index-c-pYJEmH.mjs → index-DBzyeU0G.mjs} +1028 -989
- package/lib/chunks/{index-LPGxJDnT.mjs → index-DKFX5ToE.mjs} +18 -18
- package/lib/chunks/{index-aKiIuKKx.mjs → index-DRmKaFXK.mjs} +50 -50
- package/lib/chunks/{index-D5IF9F-D.mjs → index-DXf3wXT5.mjs} +22 -22
- package/lib/chunks/{index-CrVQPnFj.mjs → index-Dp7QQjNH.mjs} +18 -18
- package/lib/chunks/{index-BYQ9S7Mk.mjs → index-FzI__DHC.mjs} +30 -30
- package/lib/chunks/{index-DZe0BxAB.mjs → index-PWjCziZG.mjs} +20 -20
- package/lib/chunks/{index-DM8Dfl-m.mjs → index-bT6XWKO_.mjs} +15 -15
- package/lib/chunks/{index-DFeKS8tR.mjs → index-tX9VR6Vo.mjs} +22 -22
- package/lib/chunks/{jp2Loader-Dig19xyo-fCO1knZ0.mjs → jp2Loader-Dig19xyo-D-OEDL3n.mjs} +1 -1
- package/lib/chunks/{psdLoader-C0tKUXXl-DihMskai.mjs → psdLoader-C0tKUXXl-CVN06LUc.mjs} +1 -1
- package/lib/chunks/{rawLoader-C-tPeFAB-BSfDPl-z.mjs → rawLoader-C-tPeFAB-DBqcJPFK.mjs} +1 -1
- package/lib/chunks/{tiffLoader-BlhByX8w-JY5DaTre.mjs → tiffLoader-BlhByX8w-8-0icdyL.mjs} +1 -1
- package/lib/chunks/{useShikiHighlight-C-ztcJBE.mjs → useShikiHighlight-a_GUszuU.mjs} +1 -1
- package/lib/composables/usePreviewEvents.d.ts +2 -2
- package/lib/core/events.d.ts +18 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/index.cjs +48 -48
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.mjs +5 -5
- package/package.json +1 -1
- package/lib/chunks/index-C41YET0_.mjs +0 -51
- package/lib/chunks/index-GFcSJEwj.mjs +0 -330
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as O, ref as d, computed as C, onMounted as re, onBeforeUnmount as Y, watch as
|
|
2
|
-
import { u as te,
|
|
1
|
+
import { defineComponent as O, ref as d, computed as C, onMounted as re, onBeforeUnmount as Y, watch as P, openBlock as v, createElementBlock as u, normalizeStyle as W, Fragment as B, createElementVNode as i, normalizeClass as U, toDisplayString as T, unref as g, withDirectives as V, renderSlot as N, vShow as Z, resolveComponent as ve, createVNode as j, createBlock as D, resolveDynamicComponent as q, renderList as Q, createCommentVNode as ee, defineAsyncComponent as fe, withCtx as G, Teleport as de } from "vue";
|
|
2
|
+
import { u as te, d as ne, j as pe, A as ue, a as ce, b as me, W as X, J as he, k as ge, l as we, H as be, m as xe } from "./index-DBzyeU0G.mjs";
|
|
3
3
|
import { FileImage as ye, FileText as ke, FileCode as Le, File as ze, ChevronRight as Se, FolderOpen as Te, Folder as _e } from "lucide-vue-next";
|
|
4
|
-
import { _ as
|
|
4
|
+
import { _ as J } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
5
5
|
import { T as $e } from "./base.types-DaftHyg7.mjs";
|
|
6
6
|
const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-weak vfp-bg-surface-toolbar" }, Ce = { class: "vfp-flex-1 vfp-min-h-0 vfp-min-w-0 vfp-w-full vfp-overflow-hidden" }, Ee = { class: "vfp-flex-1 vfp-min-h-0 vfp-min-w-0 vfp-w-full vfp-overflow-hidden" }, Me = { class: "vfp-flex-1 vfp-min-w-0 vfp-min-h-0 vfp-overflow-hidden" }, We = /* @__PURE__ */ O({
|
|
7
7
|
name: "ResizableSplit",
|
|
@@ -26,46 +26,46 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
|
|
|
26
26
|
}
|
|
27
27
|
return n.initialLeftWidth;
|
|
28
28
|
})()
|
|
29
|
-
),
|
|
29
|
+
), z = d(!1), y = d(!1), _ = d(!0), b = d("left");
|
|
30
30
|
let o = null, t = null;
|
|
31
|
-
const
|
|
32
|
-
o && (
|
|
33
|
-
},
|
|
34
|
-
() =>
|
|
35
|
-
), a = C(() =>
|
|
31
|
+
const k = () => {
|
|
32
|
+
o && (y.value = o.matches);
|
|
33
|
+
}, x = C(
|
|
34
|
+
() => y.value && _.value ? { width: `${f.value}px` } : void 0
|
|
35
|
+
), a = C(() => y.value && _.value), S = (l) => {
|
|
36
36
|
if (!w.value) return;
|
|
37
|
-
const c = w.value.getBoundingClientRect(), F = l.clientX - c.left,
|
|
37
|
+
const c = w.value.getBoundingClientRect(), F = l.clientX - c.left, K = c.width - n.minRightWidth - 6, A = Math.min(n.maxLeftWidth, K);
|
|
38
38
|
f.value = Math.max(
|
|
39
39
|
n.minLeftWidth,
|
|
40
|
-
Math.min(
|
|
40
|
+
Math.min(A, F)
|
|
41
41
|
);
|
|
42
42
|
}, $ = () => {
|
|
43
|
-
if (
|
|
43
|
+
if (z.value && (z.value = !1, window.removeEventListener("mousemove", S), window.removeEventListener("mouseup", $), 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
|
}, R = (l) => {
|
|
49
|
-
l.preventDefault(),
|
|
49
|
+
l.preventDefault(), z.value = !0, window.addEventListener("mousemove", S), window.addEventListener("mouseup", $), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
50
50
|
};
|
|
51
51
|
re(() => {
|
|
52
52
|
if (typeof window < "u") {
|
|
53
|
-
o = window.matchMedia(n.desktopMedia),
|
|
53
|
+
o = window.matchMedia(n.desktopMedia), k(), o.addEventListener("change", k);
|
|
54
54
|
const l = () => {
|
|
55
55
|
w.value && (_.value = w.value.getBoundingClientRect().width >= n.minLeftWidth + n.minRightWidth + 6);
|
|
56
56
|
};
|
|
57
57
|
l(), t = typeof ResizeObserver < "u" ? new ResizeObserver(l) : null, t == null || t.observe(w.value);
|
|
58
58
|
}
|
|
59
59
|
}), Y(() => {
|
|
60
|
-
o && o.removeEventListener("change",
|
|
61
|
-
}),
|
|
60
|
+
o && o.removeEventListener("change", k), t == null || t.disconnect(), t = null, window.removeEventListener("mousemove", S), window.removeEventListener("mouseup", $), z.value && (document.body.style.cursor = "", document.body.style.userSelect = "");
|
|
61
|
+
}), P(
|
|
62
62
|
() => n.initialLeftWidth,
|
|
63
63
|
(l) => {
|
|
64
64
|
n.storageKey || (f.value = l);
|
|
65
65
|
}
|
|
66
66
|
);
|
|
67
67
|
const E = (l) => {
|
|
68
|
-
|
|
68
|
+
b.value = l;
|
|
69
69
|
};
|
|
70
70
|
return I({ switchTab: E }), (l, c) => (v(), u("div", {
|
|
71
71
|
ref_key: "containerRef",
|
|
@@ -77,36 +77,36 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
|
|
|
77
77
|
i("div", Re, [
|
|
78
78
|
i("button", {
|
|
79
79
|
type: "button",
|
|
80
|
-
class: U(["vfp-flex-1 vfp-py-2.5 vfp-text-sm vfp-transition-colors",
|
|
80
|
+
class: U(["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
81
|
onClick: c[0] || (c[0] = (F) => E("left"))
|
|
82
82
|
}, T(r.leftTabLabel ?? g(p)("zip.file_tree")), 3),
|
|
83
83
|
i("button", {
|
|
84
84
|
type: "button",
|
|
85
|
-
class: U(["vfp-flex-1 vfp-py-2.5 vfp-text-sm vfp-transition-colors",
|
|
85
|
+
class: U(["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
86
|
onClick: c[1] || (c[1] = (F) => E("right"))
|
|
87
87
|
}, T(r.rightTabLabel ?? g(p)("toolbar.preview")), 3)
|
|
88
88
|
]),
|
|
89
89
|
V(i("div", Ce, [
|
|
90
90
|
N(l.$slots, "left", {}, void 0, !0)
|
|
91
91
|
], 512), [
|
|
92
|
-
[Z,
|
|
92
|
+
[Z, b.value === "left"]
|
|
93
93
|
]),
|
|
94
94
|
V(i("div", Ee, [
|
|
95
95
|
N(l.$slots, "right", {}, void 0, !0)
|
|
96
96
|
], 512), [
|
|
97
|
-
[Z,
|
|
97
|
+
[Z, b.value === "right"]
|
|
98
98
|
])
|
|
99
99
|
], 64)) : (v(), u(B, { key: 1 }, [
|
|
100
100
|
i("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
|
-
style: W(
|
|
102
|
+
style: W(x.value)
|
|
103
103
|
}, [
|
|
104
104
|
N(l.$slots, "left", {}, void 0, !0)
|
|
105
105
|
], 4),
|
|
106
106
|
i("div", {
|
|
107
107
|
role: "separator",
|
|
108
108
|
"aria-orientation": "vertical",
|
|
109
|
-
class: U(["split-divider vfp-hidden md:vfp-block vfp-relative vfp-w-1.5 vfp-flex-shrink-0 vfp-cursor-col-resize vfp-transition-colors",
|
|
109
|
+
class: U(["split-divider vfp-hidden md:vfp-block vfp-relative vfp-w-1.5 vfp-flex-shrink-0 vfp-cursor-col-resize vfp-transition-colors", z.value ? "dragging" : ""]),
|
|
110
110
|
style: W(a.value ? void 0 : { display: "none" }),
|
|
111
111
|
onMousedown: R
|
|
112
112
|
}, [...c[2] || (c[2] = [
|
|
@@ -128,33 +128,33 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
|
|
|
128
128
|
},
|
|
129
129
|
emits: ["toggle", "select", "hover", "leave"],
|
|
130
130
|
setup(r, { emit: I }) {
|
|
131
|
-
const n = r, p = I, w = C(() => ({ paddingLeft: `${n.depth * 14 + 10}px` })), f = C(() => n.expanded.has(n.node.path)),
|
|
131
|
+
const n = r, p = I, w = C(() => ({ paddingLeft: `${n.depth * 14 + 10}px` })), f = C(() => n.expanded.has(n.node.path)), z = C(() => n.selectedPath === n.node.path), y = C(() => {
|
|
132
132
|
const o = pe({ name: n.node.name, type: "" });
|
|
133
133
|
return o === "image" ? ye : o === "text" || o === "markdown" || o === "json" || o === "csv" || o === "xml" || o === "subtitle" ? n.node.name.endsWith(".md") || n.node.name.endsWith(".markdown") ? ke : Le : ze;
|
|
134
134
|
}), _ = (o) => {
|
|
135
135
|
const t = o.currentTarget.getBoundingClientRect();
|
|
136
136
|
p("hover", n.node.name || "/", t);
|
|
137
|
-
},
|
|
137
|
+
}, b = () => p("leave");
|
|
138
138
|
return (o, t) => {
|
|
139
|
-
const
|
|
139
|
+
const k = ve("ZipTreeItem");
|
|
140
140
|
return r.node.isDir ? (v(), u("div", Ie, [
|
|
141
141
|
i("button", {
|
|
142
142
|
type: "button",
|
|
143
143
|
class: "tree-row dir-row",
|
|
144
144
|
style: W(w.value),
|
|
145
|
-
onClick: t[0] || (t[0] = (
|
|
145
|
+
onClick: t[0] || (t[0] = (x) => p("toggle", r.node.path)),
|
|
146
146
|
onMouseenter: _,
|
|
147
|
-
onMouseleave:
|
|
147
|
+
onMouseleave: b
|
|
148
148
|
}, [
|
|
149
|
-
|
|
149
|
+
j(g(Se), {
|
|
150
150
|
class: U(["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
152
|
(v(), D(q(f.value ? g(Te) : g(_e)), { class: "vfp-w-4 vfp-h-4 vfp-flex-shrink-0 vfp-text-amber-300/80" })),
|
|
153
153
|
i("span", Fe, T(r.node.name || "/"), 1)
|
|
154
154
|
], 36),
|
|
155
|
-
f.value && r.node.children ? (v(!0), u(B, { key: 0 }, Q(r.node.children, (
|
|
156
|
-
key:
|
|
157
|
-
node:
|
|
155
|
+
f.value && r.node.children ? (v(!0), u(B, { key: 0 }, Q(r.node.children, (x) => (v(), D(k, {
|
|
156
|
+
key: x.path,
|
|
157
|
+
node: x,
|
|
158
158
|
depth: r.depth + 1,
|
|
159
159
|
"selected-path": r.selectedPath,
|
|
160
160
|
expanded: r.expanded,
|
|
@@ -166,29 +166,29 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
|
|
|
166
166
|
])) : (v(), u("button", {
|
|
167
167
|
key: 1,
|
|
168
168
|
type: "button",
|
|
169
|
-
class: U(["tree-row file-row", { selected:
|
|
169
|
+
class: U(["tree-row file-row", { selected: z.value }]),
|
|
170
170
|
style: W(w.value),
|
|
171
|
-
onClick: t[5] || (t[5] = (
|
|
171
|
+
onClick: t[5] || (t[5] = (x) => p("select", r.node)),
|
|
172
172
|
onMouseenter: _,
|
|
173
|
-
onMouseleave:
|
|
173
|
+
onMouseleave: b
|
|
174
174
|
}, [
|
|
175
175
|
t[6] || (t[6] = i("span", { class: "vfp-w-3.5 vfp-h-3.5 vfp-flex-shrink-0" }, null, -1)),
|
|
176
|
-
(v(), D(q(
|
|
176
|
+
(v(), D(q(y.value), { class: "vfp-w-4 vfp-h-4 vfp-flex-shrink-0 vfp-text-fg-tertiary" })),
|
|
177
177
|
i("span", Ue, T(r.node.name), 1),
|
|
178
178
|
i("span", Be, T(g(ue)(r.node.size)), 1)
|
|
179
179
|
], 38));
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
|
-
}),
|
|
182
|
+
}), je = /* @__PURE__ */ ne(Ne, [["__scopeId", "data-v-124c382d"]]), Ke = {
|
|
183
183
|
key: 0,
|
|
184
184
|
class: "vfp-renderer-loading"
|
|
185
|
-
},
|
|
185
|
+
}, Pe = { class: "vfp-renderer-loading-content" }, Oe = { class: "vfp-renderer-loading-text" }, Ae = { class: "vfp-w-full vfp-h-full vfp-overflow-auto" }, Ve = { class: "vfp-w-full vfp-h-full vfp-flex vfp-flex-col" }, Ze = {
|
|
186
186
|
key: 0,
|
|
187
187
|
class: "vfp-renderer-loading vfp-flex-1"
|
|
188
|
-
}, qe = { class: "vfp-renderer-loading-content" }, Ge = { class: "vfp-renderer-loading-text" },
|
|
188
|
+
}, qe = { class: "vfp-renderer-loading-content" }, Ge = { class: "vfp-renderer-loading-text" }, Xe = {
|
|
189
189
|
key: 1,
|
|
190
190
|
class: "vfp-flex-1"
|
|
191
|
-
},
|
|
191
|
+
}, Je = {
|
|
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
|
}, Ye = {
|
|
@@ -202,79 +202,79 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
|
|
|
202
202
|
},
|
|
203
203
|
setup(r, { expose: I }) {
|
|
204
204
|
const n = fe(
|
|
205
|
-
() => import("./index-
|
|
206
|
-
), p = r, w = new $e(), { t: f } = te(),
|
|
207
|
-
|
|
208
|
-
},
|
|
205
|
+
() => import("./index-DBzyeU0G.mjs").then((e) => e.a2)
|
|
206
|
+
), p = r, w = new $e(), { t: f } = te(), z = ce(), y = me(), _ = (e) => {
|
|
207
|
+
y.error(e.error, e.stage);
|
|
208
|
+
}, b = d(null), o = d(null), t = d(!0), k = d(null), x = d(/* @__PURE__ */ new Set([""])), a = d(null), S = d(!1), $ = d(null), R = d(null), E = d(null), l = d(null), c = () => {
|
|
209
209
|
var e;
|
|
210
210
|
(e = a.value) != null && e.blobUrl && URL.revokeObjectURL(a.value.blobUrl);
|
|
211
211
|
}, F = async () => {
|
|
212
|
-
|
|
212
|
+
y.begin(p.url), c(), a.value = null, t.value = !0, k.value = null;
|
|
213
213
|
try {
|
|
214
|
-
const e = await
|
|
214
|
+
const e = await z.value(p.url);
|
|
215
215
|
if (!e.ok) throw new he("common.load_failed");
|
|
216
|
-
const s = await e.arrayBuffer(), m = await ge(s),
|
|
217
|
-
|
|
216
|
+
const s = await e.arrayBuffer(), m = await ge(s), L = we(m), h = be(L);
|
|
217
|
+
b.value = m, o.value = h;
|
|
218
218
|
const M = /* @__PURE__ */ new Set([""]);
|
|
219
219
|
if (h.children)
|
|
220
220
|
for (const H of h.children) H.isDir && M.add(H.path);
|
|
221
|
-
|
|
221
|
+
x.value = M, y.ready();
|
|
222
222
|
} catch (e) {
|
|
223
|
-
console.error(e),
|
|
223
|
+
console.error(e), k.value = f.value("zip.load_failed"), y.error(e);
|
|
224
224
|
} finally {
|
|
225
225
|
t.value = !1;
|
|
226
226
|
}
|
|
227
227
|
};
|
|
228
|
-
|
|
228
|
+
P(() => p.url, (e) => {
|
|
229
229
|
e && F();
|
|
230
230
|
}, { immediate: !0 }), Y(() => {
|
|
231
231
|
c();
|
|
232
232
|
});
|
|
233
|
-
const
|
|
233
|
+
const K = C(() => {
|
|
234
234
|
if (!o.value) return null;
|
|
235
235
|
let e = 0, s = 0, m = 0;
|
|
236
|
-
const
|
|
236
|
+
const L = (h) => {
|
|
237
237
|
var M;
|
|
238
|
-
h.isDir ? (h.path && s++, (M = h.children) == null || M.forEach(
|
|
238
|
+
h.isDir ? (h.path && s++, (M = h.children) == null || M.forEach(L)) : (e++, m += h.size);
|
|
239
239
|
};
|
|
240
|
-
return
|
|
240
|
+
return L(o.value), { files: e, dirs: s, size: m };
|
|
241
241
|
});
|
|
242
|
-
|
|
242
|
+
P(K, () => w.notify()), I({
|
|
243
243
|
getToolbarGroups: () => [],
|
|
244
244
|
onToolbarChange: (e) => w.subscribe(e)
|
|
245
245
|
});
|
|
246
246
|
const le = (e) => {
|
|
247
|
-
const s = new Set(
|
|
248
|
-
s.has(e) ? s.delete(e) : s.add(e),
|
|
247
|
+
const s = new Set(x.value);
|
|
248
|
+
s.has(e) ? s.delete(e) : s.add(e), x.value = s;
|
|
249
249
|
}, oe = (e, s) => {
|
|
250
250
|
const m = typeof window < "u" ? window.innerWidth - 328 : s.right + 8;
|
|
251
251
|
R.value = { text: e, x: Math.max(8, Math.min(s.right + 8, m)), y: s.top + s.height / 2 };
|
|
252
252
|
}, ae = () => {
|
|
253
253
|
R.value = null;
|
|
254
254
|
}, se = async (e) => {
|
|
255
|
-
var s, m,
|
|
256
|
-
if (!(!
|
|
255
|
+
var s, m, L;
|
|
256
|
+
if (!(!b.value || e.isDir || ((s = a.value) == null ? void 0 : s.path) === e.path || l.value === e.path)) {
|
|
257
257
|
l.value = e.path, c(), a.value = null, S.value = !0, $.value = null;
|
|
258
258
|
try {
|
|
259
|
-
const h =
|
|
259
|
+
const h = X(e.name), M = await xe(b.value, e.path, h !== "application/octet-stream" ? h : void 0), H = URL.createObjectURL(M);
|
|
260
260
|
a.value = { path: e.path, name: e.name, size: e.size, blobUrl: H }, (m = E.value) == null || m.switchTab("right");
|
|
261
261
|
} catch (h) {
|
|
262
|
-
console.error(h), $.value = f.value("zip.entry_read_failed"), (
|
|
262
|
+
console.error(h), $.value = f.value("zip.entry_read_failed"), (L = E.value) == null || L.switchTab("right");
|
|
263
263
|
} finally {
|
|
264
264
|
S.value = !1, l.value === e.path && (l.value = null);
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
|
-
}, ie = C(() => a.value ? [{ name: a.value.name, url: a.value.blobUrl, type:
|
|
268
|
-
return (e, s) => t.value ? (v(), u("div",
|
|
269
|
-
i("div",
|
|
267
|
+
}, ie = C(() => a.value ? [{ name: a.value.name, url: a.value.blobUrl, type: X(a.value.name) }] : []);
|
|
268
|
+
return (e, s) => t.value ? (v(), u("div", Ke, [
|
|
269
|
+
i("div", Pe, [
|
|
270
270
|
s[0] || (s[0] = i("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
271
271
|
i("span", Oe, T(g(f)("common.loading")), 1)
|
|
272
272
|
])
|
|
273
|
-
])) :
|
|
273
|
+
])) : k.value || !o.value ? (v(), D(J, {
|
|
274
274
|
key: 1,
|
|
275
|
-
message:
|
|
275
|
+
message: k.value || g(f)("zip.parse_failed")
|
|
276
276
|
}, null, 8, ["message"])) : (v(), u(B, { key: 2 }, [
|
|
277
|
-
|
|
277
|
+
j(De, {
|
|
278
278
|
ref_key: "splitRef",
|
|
279
279
|
ref: E,
|
|
280
280
|
"initial-left-width": 280,
|
|
@@ -286,15 +286,15 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
|
|
|
286
286
|
"right-tab-label": g(f)("toolbar.preview")
|
|
287
287
|
}, {
|
|
288
288
|
left: G(() => [
|
|
289
|
-
i("div",
|
|
289
|
+
i("div", Ae, [
|
|
290
290
|
(v(!0), u(B, null, Q(o.value.children || [], (m) => {
|
|
291
|
-
var
|
|
292
|
-
return v(), D(
|
|
291
|
+
var L;
|
|
292
|
+
return v(), D(je, {
|
|
293
293
|
key: m.path,
|
|
294
294
|
node: m,
|
|
295
295
|
depth: 0,
|
|
296
|
-
"selected-path": ((
|
|
297
|
-
expanded:
|
|
296
|
+
"selected-path": ((L = a.value) == null ? void 0 : L.path) ?? null,
|
|
297
|
+
expanded: x.value,
|
|
298
298
|
onToggle: le,
|
|
299
299
|
onSelect: se,
|
|
300
300
|
onHover: oe,
|
|
@@ -310,17 +310,17 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
|
|
|
310
310
|
s[1] || (s[1] = i("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
311
311
|
i("span", Ge, T(g(f)("common.loading")), 1)
|
|
312
312
|
])
|
|
313
|
-
])) : $.value ? (v(), u("div",
|
|
314
|
-
|
|
313
|
+
])) : $.value ? (v(), u("div", Xe, [
|
|
314
|
+
j(J, { message: $.value }, null, 8, ["message"])
|
|
315
315
|
])) : a.value ? (v(), u("div", Ye, [
|
|
316
|
-
|
|
316
|
+
j(g(n), {
|
|
317
317
|
mode: "embed",
|
|
318
318
|
files: ie.value,
|
|
319
319
|
"current-index": 0,
|
|
320
320
|
"zip-nesting-depth": r.nestingDepth + 1,
|
|
321
321
|
onError: _
|
|
322
322
|
}, null, 8, ["files", "zip-nesting-depth"])
|
|
323
|
-
])) : (v(), u("div",
|
|
323
|
+
])) : (v(), u("div", Je, T(g(f)("zip.select_file")), 1))
|
|
324
324
|
])
|
|
325
325
|
]),
|
|
326
326
|
_: 1
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { u as
|
|
1
|
+
import { defineComponent as A, ref as h, watch as T, computed as p, openBlock as r, createElementBlock as o, createElementVNode as s, toDisplayString as a, unref as n, createBlock as D, normalizeClass as B, Fragment as w, renderList as C, createCommentVNode as E } from "vue";
|
|
2
|
+
import { u as I, a as J, b as M, i as O, o as f, f as P, d as R } from "./index-DBzyeU0G.mjs";
|
|
3
3
|
import { _ as X } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
4
4
|
const Y = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "vfp-renderer-loading vfp-bg-[#0f0f12]"
|
|
7
|
-
}, $ = { class: "vfp-renderer-loading-content" }, j = { class: "vfp-renderer-loading-text" }, q = { class: "content-scroll" }, H = { class: "timeline" },
|
|
7
|
+
}, $ = { class: "vfp-renderer-loading-content" }, j = { class: "vfp-renderer-loading-text" }, q = { class: "content-scroll" }, H = { class: "timeline" }, K = { class: "cues" }, Q = { class: "cue-meta" }, U = { class: "cue-time" }, W = { class: "cue-time" }, Z = { class: "cue-id" }, ee = {
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "cue-style"
|
|
10
10
|
}, se = {
|
|
11
11
|
key: 0,
|
|
12
12
|
class: "cue-words"
|
|
13
|
-
}, te = ["title"], le = { class: "cue-word-time" }, re = { class: "cue-word-text" }, ae = { class: "status-pill" }, oe = /* @__PURE__ */
|
|
13
|
+
}, te = ["title"], le = { class: "cue-word-time" }, re = { class: "cue-word-text" }, ae = { class: "status-pill" }, oe = /* @__PURE__ */ A({
|
|
14
14
|
__name: "index",
|
|
15
15
|
props: {
|
|
16
16
|
url: {},
|
|
17
17
|
fileName: {}
|
|
18
18
|
},
|
|
19
19
|
setup(F, { expose: N }) {
|
|
20
|
-
const i = F, { t: u } =
|
|
20
|
+
const i = F, { t: u } = I(), L = J(), d = M(), m = h(""), _ = h(!0), v = h(null), S = {
|
|
21
21
|
srt: "srt",
|
|
22
22
|
vtt: "vtt",
|
|
23
23
|
lrc: "lrc",
|
|
@@ -32,16 +32,16 @@ const Y = {
|
|
|
32
32
|
return S[t];
|
|
33
33
|
};
|
|
34
34
|
T(() => i.url, async () => {
|
|
35
|
-
|
|
35
|
+
d.begin(i.url), _.value = !0, v.value = null;
|
|
36
36
|
try {
|
|
37
37
|
m.value = await P(i.url, { fetcher: L.value });
|
|
38
38
|
} catch (e) {
|
|
39
|
-
console.error(e),
|
|
39
|
+
console.error(e), v.value = u.value("subtitle.load_failed"), d.error(e);
|
|
40
40
|
} finally {
|
|
41
41
|
_.value = !1;
|
|
42
42
|
}
|
|
43
43
|
}, { immediate: !0 });
|
|
44
|
-
const x =
|
|
44
|
+
const x = p(() => {
|
|
45
45
|
if (!m.value) return { value: null, error: null };
|
|
46
46
|
try {
|
|
47
47
|
return { value: O(m.value, G(i.fileName)), error: null };
|
|
@@ -49,19 +49,16 @@ const Y = {
|
|
|
49
49
|
return console.error(e), { value: null, error: e };
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
|
-
T(
|
|
53
|
-
()
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
const c = v(() => x.value.value), g = v(() => {
|
|
52
|
+
T(x, (e) => {
|
|
53
|
+
e.error ? d.error(e.error) : e.value && d.ready();
|
|
54
|
+
});
|
|
55
|
+
const c = p(() => x.value.value), y = p(() => {
|
|
59
56
|
var e, t;
|
|
60
57
|
return ((e = c.value) == null ? void 0 : e.format) === "lrc" || ((t = c.value) == null ? void 0 : t.format) === "elrc";
|
|
61
|
-
}), b =
|
|
58
|
+
}), b = p(() => {
|
|
62
59
|
var e;
|
|
63
60
|
return ((e = c.value) == null ? void 0 : e.metadata) ?? {};
|
|
64
|
-
}), V = (e) =>
|
|
61
|
+
}), V = (e) => f(e).slice(3, 8);
|
|
65
62
|
return N({
|
|
66
63
|
getToolbarGroups: () => []
|
|
67
64
|
}), (e, t) => _.value ? (r(), o("div", Y, [
|
|
@@ -69,49 +66,49 @@ const Y = {
|
|
|
69
66
|
t[0] || (t[0] = s("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
70
67
|
s("span", j, a(n(u)("common.loading")), 1)
|
|
71
68
|
])
|
|
72
|
-
])) :
|
|
69
|
+
])) : v.value || !c.value ? (r(), D(X, {
|
|
73
70
|
key: 1,
|
|
74
|
-
message:
|
|
71
|
+
message: v.value || n(u)("subtitle.parse_failed"),
|
|
75
72
|
class: "vfp-bg-[#0f0f12]"
|
|
76
73
|
}, null, 8, ["message"])) : (r(), o("div", {
|
|
77
74
|
key: 2,
|
|
78
|
-
class: B(["vfp-relative vfp-w-full vfp-h-full vfp-bg-[#0f0f12]",
|
|
75
|
+
class: B(["vfp-relative vfp-w-full vfp-h-full vfp-bg-[#0f0f12]", y.value ? "flavor-lyric" : "flavor-subtitle"])
|
|
79
76
|
}, [
|
|
80
77
|
s("div", q, [
|
|
81
78
|
s("div", H, [
|
|
82
79
|
t[3] || (t[3] = s("div", { class: "timeline-line" }, null, -1)),
|
|
83
|
-
s("ol",
|
|
80
|
+
s("ol", K, [
|
|
84
81
|
(r(!0), o(w, null, C(c.value.cues, (l, k) => (r(), o("li", {
|
|
85
82
|
key: "cue-" + k,
|
|
86
83
|
class: "cue-row"
|
|
87
84
|
}, [
|
|
88
85
|
t[2] || (t[2] = s("div", { class: "cue-dot" }, null, -1)),
|
|
89
|
-
s("div",
|
|
90
|
-
s("span",
|
|
86
|
+
s("div", Q, [
|
|
87
|
+
s("span", U, a(n(f)(l.start)), 1),
|
|
91
88
|
t[1] || (t[1] = s("span", { class: "cue-arrow" }, "→", -1)),
|
|
92
|
-
s("span",
|
|
89
|
+
s("span", W, a(n(f)(l.end)), 1),
|
|
93
90
|
s("span", Z, "#" + a(l.id ?? k + 1), 1),
|
|
94
91
|
l.style ? (r(), o("span", ee, a(l.style), 1)) : E("", !0)
|
|
95
92
|
]),
|
|
96
93
|
l.words && l.words.length > 0 ? (r(), o("div", se, [
|
|
97
|
-
(r(!0), o(w, null, C(l.words, (
|
|
98
|
-
key: "w-" +
|
|
94
|
+
(r(!0), o(w, null, C(l.words, (g, z) => (r(), o("span", {
|
|
95
|
+
key: "w-" + z,
|
|
99
96
|
class: "cue-word",
|
|
100
|
-
title: n(
|
|
97
|
+
title: n(f)(g.start)
|
|
101
98
|
}, [
|
|
102
|
-
s("span", le, a(V(
|
|
103
|
-
s("span", re, a(
|
|
99
|
+
s("span", le, a(V(g.start)), 1),
|
|
100
|
+
s("span", re, a(g.text), 1)
|
|
104
101
|
], 8, te))), 128))
|
|
105
102
|
])) : (r(), o("p", {
|
|
106
103
|
key: 1,
|
|
107
|
-
class: B(["cue-text", { lyric:
|
|
104
|
+
class: B(["cue-text", { lyric: y.value }])
|
|
108
105
|
}, a(l.text), 3))
|
|
109
106
|
]))), 128))
|
|
110
107
|
])
|
|
111
108
|
])
|
|
112
109
|
]),
|
|
113
110
|
s("div", ae, [
|
|
114
|
-
s("span", null, a(c.value.cues.length) + " " + a(
|
|
111
|
+
s("span", null, a(c.value.cues.length) + " " + a(y.value ? n(u)("subtitle.lines") : n(u)("subtitle.cues")), 1),
|
|
115
112
|
b.value.length ? (r(), o(w, { key: 0 }, [
|
|
116
113
|
t[4] || (t[4] = s("span", { class: "dot" }, "·", -1)),
|
|
117
114
|
s("span", null, a(b.value.length), 1)
|
|
@@ -119,7 +116,7 @@ const Y = {
|
|
|
119
116
|
])
|
|
120
117
|
], 2));
|
|
121
118
|
}
|
|
122
|
-
}), ve = /* @__PURE__ */ R(oe, [["__scopeId", "data-v-
|
|
119
|
+
}), ve = /* @__PURE__ */ R(oe, [["__scopeId", "data-v-f89221c5"]]);
|
|
123
120
|
export {
|
|
124
121
|
ve as default
|
|
125
122
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as $, ref as f, computed as d, watch as T, unref as m, openBlock as t, createElementBlock as i, createElementVNode as l, toDisplayString as
|
|
1
|
+
import { defineComponent as $, ref as f, computed as d, watch as T, unref as m, openBlock as t, createElementBlock as i, createElementVNode as l, toDisplayString as _, createBlock as E, normalizeClass as H, normalizeStyle as z, Fragment as S, renderList as G } from "vue";
|
|
2
2
|
import { WrapText as M, Code as P, Eye as W } from "lucide-vue-next";
|
|
3
|
-
import { u as
|
|
4
|
-
import { u as
|
|
5
|
-
import { _ as
|
|
6
|
-
import { _ as
|
|
7
|
-
import { T as
|
|
8
|
-
const
|
|
3
|
+
import { u as X, a as D, b as R, X as V, S as j, T as q, f as A } from "./index-DBzyeU0G.mjs";
|
|
4
|
+
import { u as I } from "./useShikiHighlight-a_GUszuU.mjs";
|
|
5
|
+
import { _ as J } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
6
|
+
import { _ as K } from "./EmptyState.vue_vue_type_script_setup_true_lang-DSQp7H-K.mjs";
|
|
7
|
+
import { T as O } from "./base.types-DaftHyg7.mjs";
|
|
8
|
+
const Q = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "vfp-renderer-loading"
|
|
11
|
-
},
|
|
11
|
+
}, U = { class: "vfp-renderer-loading-content" }, Y = { class: "vfp-renderer-loading-text" }, Z = {
|
|
12
12
|
key: 3,
|
|
13
13
|
class: "vfp-w-full vfp-h-full vfp-bg-surface-toolbar"
|
|
14
14
|
}, ee = ["srcdoc", "title"], le = {
|
|
@@ -26,26 +26,26 @@ const U = {
|
|
|
26
26
|
fileName: {},
|
|
27
27
|
emptyHint: {}
|
|
28
28
|
},
|
|
29
|
-
setup(
|
|
30
|
-
const v =
|
|
31
|
-
() => !p.value && !c.value &&
|
|
29
|
+
setup(b, { expose: C }) {
|
|
30
|
+
const v = b, w = new O(), { t: s } = X(), L = D(), g = R(), o = f(!0), a = f(!1), r = f(""), p = f(!0), c = f(null), n = d(() => V(v.fileName)), N = d(() => n.value !== "text" ? r.value : ""), { lineHtmls: y, loading: B } = I(N, n), x = d(() => n.value === "html"), F = d(
|
|
31
|
+
() => !p.value && !c.value && j(r.value) && q(v.emptyHint, "textual")
|
|
32
32
|
);
|
|
33
33
|
T([o, a, p, x], () => {
|
|
34
|
-
|
|
34
|
+
w.notify();
|
|
35
35
|
}), T(() => v.url, async () => {
|
|
36
|
-
|
|
36
|
+
g.begin(v.url), p.value = !0, c.value = null;
|
|
37
37
|
try {
|
|
38
|
-
const e = await
|
|
39
|
-
r.value = e;
|
|
38
|
+
const e = await A(v.url, { fetcher: L.value });
|
|
39
|
+
r.value = e, g.ready();
|
|
40
40
|
} catch (e) {
|
|
41
|
-
console.error(e), c.value = s.value("text.load_failed"),
|
|
41
|
+
console.error(e), c.value = s.value("text.load_failed"), g.error(e);
|
|
42
42
|
} finally {
|
|
43
43
|
p.value = !1;
|
|
44
44
|
}
|
|
45
45
|
}, { immediate: !0 });
|
|
46
46
|
const k = d(() => r.value.split(`
|
|
47
47
|
`));
|
|
48
|
-
return
|
|
48
|
+
return C({
|
|
49
49
|
getToolbarGroups: () => {
|
|
50
50
|
const e = [];
|
|
51
51
|
return e.push({
|
|
@@ -74,36 +74,36 @@ const U = {
|
|
|
74
74
|
]
|
|
75
75
|
}), e;
|
|
76
76
|
},
|
|
77
|
-
onToolbarChange: (e) =>
|
|
78
|
-
}), (e, u) => p.value || n.value !== "text" && m(B) ? (t(), i("div",
|
|
79
|
-
l("div",
|
|
77
|
+
onToolbarChange: (e) => w.subscribe(e)
|
|
78
|
+
}), (e, u) => p.value || n.value !== "text" && m(B) ? (t(), i("div", Q, [
|
|
79
|
+
l("div", U, [
|
|
80
80
|
u[0] || (u[0] = l("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
81
|
-
l("span", Y,
|
|
81
|
+
l("span", Y, _(m(s)("common.loading")), 1)
|
|
82
82
|
])
|
|
83
|
-
])) : c.value ? (t(), E(
|
|
83
|
+
])) : c.value ? (t(), E(J, {
|
|
84
84
|
key: 1,
|
|
85
85
|
message: c.value
|
|
86
|
-
}, null, 8, ["message"])) : F.value ? (t(), E(
|
|
86
|
+
}, null, 8, ["message"])) : F.value ? (t(), E(K, { key: 2 })) : a.value && n.value === "html" ? (t(), i("div", Z, [
|
|
87
87
|
l("iframe", {
|
|
88
88
|
srcdoc: r.value,
|
|
89
89
|
sandbox: "allow-same-origin",
|
|
90
90
|
class: "vfp-w-full vfp-h-full vfp-border-0",
|
|
91
|
-
title:
|
|
91
|
+
title: b.fileName
|
|
92
92
|
}, null, 8, ee)
|
|
93
|
-
])) : n.value === "text" || m(
|
|
93
|
+
])) : n.value === "text" || m(y).length === 0 ? (t(), i("div", le, [
|
|
94
94
|
l("pre", {
|
|
95
95
|
class: H(["vfp-py-6 vfp-px-4 vfp-text-fg-primary vfp-font-mono vfp-text-sm", o.value ? "vfp-whitespace-pre-wrap vfp-break-words" : "vfp-whitespace-pre"])
|
|
96
|
-
},
|
|
96
|
+
}, _(r.value), 3)
|
|
97
97
|
])) : (t(), i("div", te, [
|
|
98
98
|
l("div", {
|
|
99
99
|
class: H(["vfp-code-block with-line-numbers vfp-w-full", { "no-wrap": !o.value }]),
|
|
100
100
|
style: z({ gridTemplateRows: `repeat(${k.value.length}, auto) minmax(1.5rem, 1fr)` })
|
|
101
101
|
}, [
|
|
102
|
-
(t(!0), i(
|
|
103
|
-
l("span", oe, h
|
|
102
|
+
(t(!0), i(S, null, G(k.value, (ne, h) => (t(), i(S, { key: h }, [
|
|
103
|
+
l("span", oe, _(h + 1), 1),
|
|
104
104
|
l("span", {
|
|
105
105
|
class: "vfp-code-line",
|
|
106
|
-
innerHTML: m(
|
|
106
|
+
innerHTML: m(y)[h] ?? ""
|
|
107
107
|
}, null, 8, ae)
|
|
108
108
|
], 64))), 128)),
|
|
109
109
|
u[1] || (u[1] = l("span", { class: "vfp-code-gutter-filler" }, null, -1)),
|