@eternalheart/vue-file-preview 1.7.0 → 1.7.2
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-Dna6LmVT.mjs} +1 -1
- package/lib/chunks/{avifLoader-CAUzjn-d-CnJpGYJ2.mjs → avifLoader-CAUzjn-d-dPsP28D5.mjs} +1 -1
- package/lib/chunks/{heicLoader-D_9PukkA-g_dLrWLP.mjs → heicLoader-D_9PukkA-T-k1DSgY.mjs} +1 -1
- package/lib/chunks/{index-c-pYJEmH.mjs → index-B5hprvcF.mjs} +1747 -1709
- package/lib/chunks/index-BN__EwfT.mjs +333 -0
- package/lib/chunks/{index-z9RqL2wI.mjs → index-BPutNVAf.mjs} +453 -453
- package/lib/chunks/{index-BfOWoMpY.mjs → index-B_Spz6Wn.mjs} +77 -77
- package/lib/chunks/{index-D5IF9F-D.mjs → index-BjHEHkZ8.mjs} +22 -22
- package/lib/chunks/{index-LPGxJDnT.mjs → index-BlZ6RmeR.mjs} +18 -18
- package/lib/chunks/{index-CrVQPnFj.mjs → index-C95y29OL.mjs} +18 -18
- package/lib/chunks/{index-DFeKS8tR.mjs → index-CegPYMyO.mjs} +22 -22
- package/lib/chunks/{index-C4hIk6pa.mjs → index-CqOGKCyE.mjs} +2 -2
- package/lib/chunks/{index-6XZXYqbp.mjs → index-Cv3Sg87O.mjs} +29 -32
- package/lib/chunks/{index-zLQlyNR2.mjs → index-DHba2Axz.mjs} +62 -62
- package/lib/chunks/{index-CWPdNhoe.mjs → index-DInI3RTN.mjs} +60 -60
- package/lib/chunks/{index-C8lyQPe3.mjs → index-DXzvgRuo.mjs} +3 -3
- package/lib/chunks/{index-BPSzwMOC.mjs → index-DcvlMm9Q.mjs} +46 -46
- package/lib/chunks/index-Dnyl1HQk.mjs +51 -0
- package/lib/chunks/{index-aKiIuKKx.mjs → index-JjVQZbDt.mjs} +50 -50
- package/lib/chunks/{index-DZe0BxAB.mjs → index-QPk2c2Tl.mjs} +20 -20
- package/lib/chunks/{index-DM8Dfl-m.mjs → index-TZv0MqBH.mjs} +15 -15
- package/lib/chunks/{index-BzwJ0VWu.mjs → index-cRhwUlQN.mjs} +33 -33
- package/lib/chunks/{index-BYQ9S7Mk.mjs → index-dOxDeWYi.mjs} +30 -30
- package/lib/chunks/{index-Bg8poMIm.mjs → index-eNZr1h6f.mjs} +29 -29
- package/lib/chunks/{index-Bf94DwQu.mjs → index-oJF-hur2.mjs} +24 -24
- package/lib/chunks/{jp2Loader-Dig19xyo-fCO1knZ0.mjs → jp2Loader-Dig19xyo-hrIg_KJ3.mjs} +1 -1
- package/lib/chunks/{psdLoader-C0tKUXXl-DihMskai.mjs → psdLoader-C0tKUXXl-B2cJ4s7t.mjs} +1 -1
- package/lib/chunks/{rawLoader-C-tPeFAB-BSfDPl-z.mjs → rawLoader-C-tPeFAB-BNV-Wmzr.mjs} +1 -1
- package/lib/chunks/{tiffLoader-BlhByX8w-JY5DaTre.mjs → tiffLoader-BlhByX8w-BzSrLE9Y.mjs} +1 -1
- package/lib/chunks/{useShikiHighlight-C-ztcJBE.mjs → useShikiHighlight-CpL0RAQg.mjs} +1 -1
- package/lib/composables/usePreviewEvents.d.ts +2 -2
- package/lib/composables/useRequest.d.ts +8 -2
- package/lib/core/events.d.ts +18 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/index.cjs +54 -54
- 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-B5hprvcF.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-B5hprvcF.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
|
|
@@ -3,13 +3,13 @@ import F from "markdown-it";
|
|
|
3
3
|
import W from "@traptitech/markdown-it-katex";
|
|
4
4
|
import { codeToHtml as L } from "shiki";
|
|
5
5
|
import { Code as z, Eye as J } from "lucide-vue-next";
|
|
6
|
-
import { u as Q, a as U, b as X,
|
|
6
|
+
import { u as Q, a as U, b as X, e as Z, f as ee, d as te } from "./index-B5hprvcF.mjs";
|
|
7
7
|
import { _ as oe } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
8
8
|
import { T as re } from "./base.types-DaftHyg7.mjs";
|
|
9
9
|
const ne = {
|
|
10
10
|
key: 0,
|
|
11
11
|
class: "vfp-renderer-loading"
|
|
12
|
-
}, se = { class: "vfp-renderer-loading-content" },
|
|
12
|
+
}, se = { class: "vfp-renderer-loading-content" }, ae = { class: "vfp-renderer-loading-text" }, le = {
|
|
13
13
|
key: 2,
|
|
14
14
|
class: "vfp-w-full vfp-h-full vfp-overflow-auto",
|
|
15
15
|
style: { background: "var(--fp-code-bg)" }
|
|
@@ -25,9 +25,9 @@ const ne = {
|
|
|
25
25
|
url: {}
|
|
26
26
|
},
|
|
27
27
|
setup(G, { expose: $ }) {
|
|
28
|
-
const _ = G,
|
|
28
|
+
const _ = G, T = new re(), { t: l } = Q(), j = U(), b = X(), A = Z(), x = O(() => A.value === "light" ? "github-light" : "github-dark"), c = i("preview"), C = i(""), v = i(""), h = i(""), u = i(!0), f = i(null), m = i(null);
|
|
29
29
|
k([c, u], () => {
|
|
30
|
-
|
|
30
|
+
T.notify();
|
|
31
31
|
}), $({
|
|
32
32
|
getToolbarGroups: () => {
|
|
33
33
|
const e = [];
|
|
@@ -36,7 +36,7 @@ const ne = {
|
|
|
36
36
|
{
|
|
37
37
|
type: "button",
|
|
38
38
|
icon: c.value === "preview" ? z : J,
|
|
39
|
-
tooltip: c.value === "preview" ?
|
|
39
|
+
tooltip: c.value === "preview" ? l.value("toolbar.source") : l.value("toolbar.preview"),
|
|
40
40
|
action: () => {
|
|
41
41
|
c.value = c.value === "preview" ? "source" : "preview";
|
|
42
42
|
},
|
|
@@ -45,7 +45,7 @@ const ne = {
|
|
|
45
45
|
]
|
|
46
46
|
}), e;
|
|
47
47
|
},
|
|
48
|
-
onToolbarChange: (e) =>
|
|
48
|
+
onToolbarChange: (e) => T.subscribe(e)
|
|
49
49
|
});
|
|
50
50
|
const s = new F({
|
|
51
51
|
html: !0,
|
|
@@ -74,21 +74,21 @@ const ne = {
|
|
|
74
74
|
const I = s.renderer.rules.table_close || ((e, r, t, n, o) => o.renderToken(e, r, t));
|
|
75
75
|
s.renderer.rules.table_close = (e, r, t, n, o) => I(e, r, t, n, o) + "</div>";
|
|
76
76
|
const M = async () => {
|
|
77
|
-
|
|
77
|
+
b.begin(_.url), u.value = !0, f.value = null;
|
|
78
78
|
try {
|
|
79
79
|
const e = await ee(_.url, { fetcher: j.value });
|
|
80
|
-
|
|
80
|
+
C.value = e, v.value = s.render(e), u.value = !1, b.ready();
|
|
81
81
|
try {
|
|
82
|
-
h.value = await L(e, { lang: "markdown", theme:
|
|
82
|
+
h.value = await L(e, { lang: "markdown", theme: x.value });
|
|
83
83
|
} catch {
|
|
84
84
|
h.value = "";
|
|
85
85
|
}
|
|
86
86
|
} catch (e) {
|
|
87
|
-
console.error(e), f.value =
|
|
87
|
+
console.error(e), f.value = l.value("markdown.load_failed"), u.value = !1, b.error(e);
|
|
88
88
|
}
|
|
89
89
|
}, S = (e, r) => {
|
|
90
90
|
const t = document.createElement("button");
|
|
91
|
-
return t.type = "button", t.className = r ? "code-copy-btn" : "code-copy-btn code-copy-float", t.title =
|
|
91
|
+
return t.type = "button", t.className = r ? "code-copy-btn" : "code-copy-btn code-copy-float", t.title = l.value("markdown.copy_code"), t.innerHTML = r ? q : V, t.addEventListener("click", async (n) => {
|
|
92
92
|
n.stopPropagation();
|
|
93
93
|
try {
|
|
94
94
|
await navigator.clipboard.writeText(e);
|
|
@@ -96,8 +96,8 @@ const ne = {
|
|
|
96
96
|
const o = document.createElement("textarea");
|
|
97
97
|
o.value = e, document.body.appendChild(o), o.select(), document.execCommand("copy"), document.body.removeChild(o);
|
|
98
98
|
}
|
|
99
|
-
t.innerHTML = r ? pe : ve, t.title =
|
|
100
|
-
t.innerHTML = r ? q : V, t.title =
|
|
99
|
+
t.innerHTML = r ? pe : ve, t.title = l.value("markdown.copied"), setTimeout(() => {
|
|
100
|
+
t.innerHTML = r ? q : V, t.title = l.value("markdown.copy_code");
|
|
101
101
|
}, 2e3);
|
|
102
102
|
}), t;
|
|
103
103
|
}, D = async () => {
|
|
@@ -105,9 +105,9 @@ const ne = {
|
|
|
105
105
|
if (!m.value) return;
|
|
106
106
|
const e = m.value.querySelectorAll('pre[data-shiki-pending="1"]');
|
|
107
107
|
for (const o of e) {
|
|
108
|
-
const w = o.getAttribute("data-lang") || "text",
|
|
108
|
+
const w = o.getAttribute("data-lang") || "text", a = ((t = o.querySelector("code")) == null ? void 0 : t.textContent) || "";
|
|
109
109
|
try {
|
|
110
|
-
const g = await L(
|
|
110
|
+
const g = await L(a, { lang: w, theme: x.value }), H = document.createElement("div");
|
|
111
111
|
H.innerHTML = g;
|
|
112
112
|
const E = H.firstElementChild;
|
|
113
113
|
E && o.replaceWith(E);
|
|
@@ -118,28 +118,28 @@ const ne = {
|
|
|
118
118
|
const r = m.value.querySelectorAll(".code-block-wrapper");
|
|
119
119
|
for (const o of r) {
|
|
120
120
|
if (o.querySelector(".code-copy-btn")) continue;
|
|
121
|
-
const w = o.querySelector(".code-block-header"),
|
|
121
|
+
const w = o.querySelector(".code-block-header"), a = o.querySelector("pre"), g = ((n = a == null ? void 0 : a.querySelector("code")) == null ? void 0 : n.textContent) ?? (a == null ? void 0 : a.textContent) ?? "";
|
|
122
122
|
w ? w.appendChild(S(g, !0)) : o.appendChild(S(g, !1));
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
125
|
return k(() => _.url, M, { immediate: !0 }), k(v, async () => {
|
|
126
126
|
v.value && (await R(), D());
|
|
127
|
-
}), k(
|
|
128
|
-
|
|
127
|
+
}), k(x, () => {
|
|
128
|
+
C.value && M();
|
|
129
129
|
}), (e, r) => u.value ? (d(), p("div", ne, [
|
|
130
130
|
y("div", se, [
|
|
131
131
|
r[0] || (r[0] = y("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
132
|
-
y("span",
|
|
132
|
+
y("span", ae, B(N(l)("common.loading")), 1)
|
|
133
133
|
])
|
|
134
134
|
])) : f.value ? (d(), Y(oe, {
|
|
135
135
|
key: 1,
|
|
136
136
|
message: f.value
|
|
137
|
-
}, null, 8, ["message"])) : c.value === "source" ? (d(), p("div",
|
|
137
|
+
}, null, 8, ["message"])) : c.value === "source" ? (d(), p("div", le, [
|
|
138
138
|
h.value ? (d(), p("div", {
|
|
139
139
|
key: 1,
|
|
140
140
|
class: "shiki-wrapper",
|
|
141
141
|
innerHTML: h.value
|
|
142
|
-
}, null, 8, ie)) : (d(), p("pre", ce, B(
|
|
142
|
+
}, null, 8, ie)) : (d(), p("pre", ce, B(C.value), 1))
|
|
143
143
|
])) : (d(), p("div", de, [
|
|
144
144
|
y("div", {
|
|
145
145
|
ref_key: "containerRef",
|
|
@@ -149,7 +149,7 @@ const ne = {
|
|
|
149
149
|
}, null, 8, ue)
|
|
150
150
|
]));
|
|
151
151
|
}
|
|
152
|
-
}), Ce = /* @__PURE__ */ te(he, [["__scopeId", "data-v-
|
|
152
|
+
}), Ce = /* @__PURE__ */ te(he, [["__scopeId", "data-v-67620d24"]]);
|
|
153
153
|
export {
|
|
154
154
|
Ce as default
|
|
155
155
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as h, ref as c, onMounted as w, watch as x, onBeforeUnmount as E, openBlock as f, createBlock as C, createElementBlock as _, createElementVNode as a, toDisplayString as
|
|
2
|
-
import
|
|
3
|
-
import { u as
|
|
4
|
-
import { _ as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as h, ref as c, onMounted as w, watch as x, onBeforeUnmount as E, openBlock as f, createBlock as C, createElementBlock as _, createElementVNode as a, toDisplayString as B, unref as D, createCommentVNode as P } from "vue";
|
|
2
|
+
import N from "video.js";
|
|
3
|
+
import { u as R, b as S, B as y } from "./index-B5hprvcF.mjs";
|
|
4
|
+
import { _ as U } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
5
|
+
const V = {
|
|
6
6
|
key: 1,
|
|
7
7
|
class: "vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"
|
|
8
|
-
},
|
|
8
|
+
}, j = { class: "vfp-w-full vfp-h-full vfp-relative" }, q = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "vfp-absolute vfp-inset-0 vfp-renderer-loading vfp-bg-surface-3 vfp-backdrop-blur-sm vfp-z-10"
|
|
11
11
|
}, L = { class: "vfp-renderer-loading-content" }, G = { class: "vfp-renderer-loading-text" }, X = /* @__PURE__ */ h({
|
|
@@ -16,20 +16,20 @@ const U = {
|
|
|
16
16
|
mimeType: {}
|
|
17
17
|
},
|
|
18
18
|
setup(g, { expose: k }) {
|
|
19
|
-
const o = g, { t } =
|
|
19
|
+
const o = g, { t } = R(), u = S(), T = /* @__PURE__ */ new Set(["avi", "wmv", "flv"]), i = c(null), d = c(!0), p = c(null);
|
|
20
20
|
let e = null;
|
|
21
21
|
const b = (s, r) => {
|
|
22
22
|
var n;
|
|
23
23
|
return ((n = (r || s).split(".").pop()) == null ? void 0 : n.toLowerCase().split("?")[0]) || "";
|
|
24
24
|
};
|
|
25
25
|
return w(() => {
|
|
26
|
-
if (
|
|
26
|
+
if (u.begin(o.url), !p.value || e) return;
|
|
27
27
|
const s = b(o.url, o.fileName);
|
|
28
28
|
if (T.has(s)) {
|
|
29
29
|
i.value = {
|
|
30
30
|
title: t.value("video.unsupported_title"),
|
|
31
31
|
detail: t.value("video.unsupported_detail", { format: s.toUpperCase() })
|
|
32
|
-
},
|
|
32
|
+
}, d.value = !1;
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
const r = document.createElement("video-js");
|
|
@@ -39,7 +39,7 @@ const U = {
|
|
|
39
39
|
v === "video/quicktime" ? n = [
|
|
40
40
|
{ src: o.url, type: "video/quicktime" },
|
|
41
41
|
{ src: o.url, type: "video/mp4" }
|
|
42
|
-
] : n = [{ src: o.url, type: v }], e =
|
|
42
|
+
] : n = [{ src: o.url, type: v }], e = N(r, {
|
|
43
43
|
controls: !0,
|
|
44
44
|
fill: !0,
|
|
45
45
|
preload: "auto",
|
|
@@ -69,7 +69,7 @@ const U = {
|
|
|
69
69
|
});
|
|
70
70
|
const m = e.el().querySelector("video");
|
|
71
71
|
m && (m.style.objectFit = "contain"), e.on("loadeddata", () => {
|
|
72
|
-
|
|
72
|
+
d.value = !1, u.ready();
|
|
73
73
|
}), e.on("error", () => {
|
|
74
74
|
const l = e == null ? void 0 : e.error();
|
|
75
75
|
console.warn("[VideoRenderer] Video playback error:", (l == null ? void 0 : l.message) || "Unknown error"), (l == null ? void 0 : l.code) === 4 ? i.value = {
|
|
@@ -80,27 +80,27 @@ const U = {
|
|
|
80
80
|
} : i.value = {
|
|
81
81
|
title: t.value("video.load_failed"),
|
|
82
82
|
detail: (l == null ? void 0 : l.message) || t.value("common.unknown_error")
|
|
83
|
-
},
|
|
83
|
+
}, d.value = !1, u.error(l ?? new Error("video load failed"), (l == null ? void 0 : l.code) === 2 ? "request" : "parse");
|
|
84
84
|
});
|
|
85
85
|
}), x(
|
|
86
86
|
[() => o.url, () => o.mimeType],
|
|
87
87
|
() => {
|
|
88
|
-
|
|
88
|
+
u.begin(o.url), e && !e.isDisposed() && e.src({ src: o.url, type: y(o.url, o.mimeType) });
|
|
89
89
|
}
|
|
90
90
|
), E(() => {
|
|
91
91
|
e && !e.isDisposed() && (e.dispose(), e = null);
|
|
92
92
|
}), k({
|
|
93
93
|
getToolbarGroups: () => []
|
|
94
|
-
}), (s, r) => i.value ? (f(), C(
|
|
94
|
+
}), (s, r) => i.value ? (f(), C(U, {
|
|
95
95
|
key: 0,
|
|
96
96
|
message: i.value.title,
|
|
97
97
|
detail: i.value.detail
|
|
98
|
-
}, null, 8, ["message", "detail"])) : (f(), _("div",
|
|
99
|
-
a("div",
|
|
100
|
-
|
|
98
|
+
}, null, 8, ["message", "detail"])) : (f(), _("div", V, [
|
|
99
|
+
a("div", j, [
|
|
100
|
+
d.value ? (f(), _("div", q, [
|
|
101
101
|
a("div", L, [
|
|
102
102
|
r[0] || (r[0] = a("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
103
|
-
a("p", G,
|
|
103
|
+
a("p", G, B(D(t)("video.loading")), 1)
|
|
104
104
|
])
|
|
105
105
|
])) : P("", !0),
|
|
106
106
|
a("div", {
|