@eternalheart/vue-file-preview 1.6.4 → 1.6.6
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 +3 -3
- package/README.zh-CN.md +3 -3
- package/lib/chunks/{index-CNVufPKA.mjs → index-07rgqwSI.mjs} +1 -1
- package/lib/chunks/{index-BjLnlWld.mjs → index-BF0-zECZ.mjs} +44 -45
- package/lib/chunks/{index-BkpKhifq.mjs → index-BHy2oKCa.mjs} +15 -15
- package/lib/chunks/{index-DHAH_W8y.mjs → index-BV8V9hEs.mjs} +26 -26
- package/lib/chunks/index-BnDCjh8a.mjs +320 -0
- package/lib/chunks/{index-CbEYsjU9.mjs → index-C-hfrxhW.mjs} +50 -50
- package/lib/chunks/{index-RshnMles.mjs → index-CUrAAk7J.mjs} +213 -207
- package/lib/chunks/index-CdsYIxSD.mjs +270 -0
- package/lib/chunks/{index-BW6Z1etg.mjs → index-ChMheVNW.mjs} +20 -20
- package/lib/chunks/index-CksNYAz_.mjs +48 -0
- package/lib/chunks/{index-CAM2s3GD.mjs → index-CybXawTx.mjs} +19 -19
- package/lib/chunks/{index-Ck-FSxNL.mjs → index-D656tL42.mjs} +21 -21
- package/lib/chunks/{index-Ccdi178q.mjs → index-DWWV1OKd.mjs} +77 -77
- package/lib/chunks/index-DXqRgna1.mjs +105 -0
- package/lib/chunks/{index-Cyps3Pjb.mjs → index-DcNc3goP.mjs} +131 -129
- package/lib/chunks/index-Dh91eAMV.mjs +329 -0
- package/lib/chunks/{index-DnmsSoFY.mjs → index-DxBxbEDT.mjs} +1 -1
- package/lib/chunks/{index-Df8-y_Ok.mjs → index-hDUlDDey.mjs} +18 -18
- package/lib/chunks/{index-Dl0SQhkc.mjs → index-lDd0gQfG.mjs} +35 -36
- package/lib/chunks/{index-C9ju7INJ.mjs → index-tOax5IQg.mjs} +26 -26
- package/lib/chunks/index-u7QUztr_.mjs +49 -0
- package/lib/chunks/{index-CeCl4UNc.mjs → index-xY2bzsk7.mjs} +3747 -1100
- package/lib/chunks/{useShikiHighlight-D2eoQi-e.mjs → useShikiHighlight-DwEsf_jW.mjs} +5 -5
- package/lib/index.cjs +74 -55
- package/lib/index.css +1 -1
- package/lib/index.mjs +7 -7
- package/lib/renderers/Doc/index.vue.d.ts +9 -0
- package/lib/renderers/Ppt/index.vue.d.ts +9 -0
- package/lib/renderers/lazy.d.ts +2 -0
- package/package.json +2 -2
- package/lib/chunks/index-Bts2l6ss.mjs +0 -300
- package/lib/chunks/index-CyXt4Rjo.mjs +0 -264
- package/lib/chunks/index-DXECkJ55.mjs +0 -106
- package/lib/chunks/index-ntrMGZWG.mjs +0 -466
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { ref as f, watch as q, onUnmounted as W, defineComponent as X, toRef as J, computed as B, onMounted as K, onBeforeUnmount as Q, unref as e, openBlock as _, createBlock as V, createElementBlock as H, createElementVNode as a, normalizeClass as D, createVNode as E, toDisplayString as N, normalizeStyle as O, resolveDynamicComponent as Y, Transition as Z, withCtx as ee, createCommentVNode as te } from "vue";
|
|
2
|
+
import { VolumeX as ae, Volume1 as oe, Volume2 as ne, AudioLines as le, Pause as se, Play as re, SkipBack as ie, SkipForward as fe, Repeat as ve } from "lucide-vue-next";
|
|
3
|
+
import { r as ue, u as pe } from "./index-xY2bzsk7.mjs";
|
|
4
|
+
import { _ as de } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
|
|
5
|
+
function ce(L) {
|
|
6
|
+
const v = f(null), y = f(!1), p = f(!0), n = f(0), T = f(0), g = f(1), x = f(!1), h = f(!1), u = f(null);
|
|
7
|
+
let r = null;
|
|
8
|
+
const d = () => {
|
|
9
|
+
const t = v.value;
|
|
10
|
+
if (!t) return;
|
|
11
|
+
p.value = !0, u.value = null;
|
|
12
|
+
const l = () => {
|
|
13
|
+
isNaN(t.currentTime) || (n.value = t.currentTime);
|
|
14
|
+
}, s = () => {
|
|
15
|
+
!isNaN(t.duration) && isFinite(t.duration) && (T.value = t.duration);
|
|
16
|
+
}, c = () => {
|
|
17
|
+
p.value = !1, s();
|
|
18
|
+
}, b = () => {
|
|
19
|
+
p.value = !0;
|
|
20
|
+
}, w = () => {
|
|
21
|
+
p.value = !1, y.value = !0;
|
|
22
|
+
}, m = () => {
|
|
23
|
+
y.value = !0;
|
|
24
|
+
}, k = () => {
|
|
25
|
+
y.value = !1;
|
|
26
|
+
}, M = () => {
|
|
27
|
+
y.value = !1;
|
|
28
|
+
}, P = () => {
|
|
29
|
+
u.value = "音频加载失败", p.value = !1;
|
|
30
|
+
};
|
|
31
|
+
t.addEventListener("timeupdate", l), t.addEventListener("loadedmetadata", s), t.addEventListener("durationchange", s), t.addEventListener("canplay", c), t.addEventListener("waiting", b), t.addEventListener("playing", w), t.addEventListener("play", m), t.addEventListener("pause", k), t.addEventListener("ended", M), t.addEventListener("error", P), t.readyState >= 3 ? (p.value = !1, s()) : t.readyState >= 1 && s(), r = () => {
|
|
32
|
+
t.removeEventListener("timeupdate", l), t.removeEventListener("loadedmetadata", s), t.removeEventListener("durationchange", s), t.removeEventListener("canplay", c), t.removeEventListener("waiting", b), t.removeEventListener("playing", w), t.removeEventListener("play", m), t.removeEventListener("pause", k), t.removeEventListener("ended", M), t.removeEventListener("error", P);
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
return q(
|
|
36
|
+
L,
|
|
37
|
+
() => {
|
|
38
|
+
r == null || r(), r = null, requestAnimationFrame(() => d());
|
|
39
|
+
},
|
|
40
|
+
{ flush: "post" }
|
|
41
|
+
), q(
|
|
42
|
+
v,
|
|
43
|
+
(t) => {
|
|
44
|
+
t && d();
|
|
45
|
+
},
|
|
46
|
+
{ flush: "post" }
|
|
47
|
+
), W(() => {
|
|
48
|
+
r == null || r(), r = null;
|
|
49
|
+
}), {
|
|
50
|
+
audioRef: v,
|
|
51
|
+
isPlaying: y,
|
|
52
|
+
isLoading: p,
|
|
53
|
+
isLoop: h,
|
|
54
|
+
currentTime: n,
|
|
55
|
+
duration: T,
|
|
56
|
+
volume: g,
|
|
57
|
+
isMuted: x,
|
|
58
|
+
error: u,
|
|
59
|
+
togglePlay: () => {
|
|
60
|
+
const t = v.value;
|
|
61
|
+
t && (t.paused ? t.play().catch(() => {
|
|
62
|
+
}) : t.pause());
|
|
63
|
+
},
|
|
64
|
+
seek: (t) => {
|
|
65
|
+
const l = v.value;
|
|
66
|
+
l && (l.currentTime = t, n.value = t);
|
|
67
|
+
},
|
|
68
|
+
skip: (t) => {
|
|
69
|
+
const l = v.value;
|
|
70
|
+
l && (l.currentTime = Math.max(
|
|
71
|
+
0,
|
|
72
|
+
Math.min(l.currentTime + t, l.duration || 1 / 0)
|
|
73
|
+
));
|
|
74
|
+
},
|
|
75
|
+
setVolume: (t) => {
|
|
76
|
+
const l = v.value;
|
|
77
|
+
if (!l) return;
|
|
78
|
+
const s = Math.max(0, Math.min(1, t));
|
|
79
|
+
l.volume = s, g.value = s, s > 0 && (l.muted = !1, x.value = !1);
|
|
80
|
+
},
|
|
81
|
+
toggleMute: () => {
|
|
82
|
+
const t = v.value;
|
|
83
|
+
t && (t.muted = !t.muted, x.value = t.muted);
|
|
84
|
+
},
|
|
85
|
+
toggleLoop: () => {
|
|
86
|
+
const t = v.value;
|
|
87
|
+
if (!t) return;
|
|
88
|
+
const l = !t.loop;
|
|
89
|
+
t.loop = l, h.value = l;
|
|
90
|
+
},
|
|
91
|
+
formatTime: ue
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
const me = {
|
|
95
|
+
key: 1,
|
|
96
|
+
class: "vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full vfp-p-4 vfp-select-none vfp-overflow-auto"
|
|
97
|
+
}, ge = { class: "vfp-w-full vfp-max-w-xl vfp-flex-shrink-0 vfp-rounded-lg vfp-border vfp-border-line-weak vfp-bg-surface-1 vfp-p-4" }, xe = { class: "vfp-flex vfp-items-center vfp-gap-3 vfp-mb-4" }, ye = { class: "vfp-min-w-0 vfp-flex-1 vfp-truncate vfp-text-sm vfp-font-medium vfp-text-fg-primary" }, he = { class: "vfp-flex vfp-items-center vfp-gap-3 vfp-mb-4" }, be = { class: "vfp-w-9 vfp-flex-shrink-0 vfp-text-right vfp-text-[11px] vfp-text-fg-tertiary vfp-tabular-nums" }, we = { class: "vfp-relative vfp-h-4 vfp-flex vfp-flex-1 vfp-items-center" }, ke = { class: "vfp-absolute vfp-left-[6px] vfp-right-[6px] vfp-h-[3px] vfp-rounded-full vfp-bg-surface-3" }, _e = ["max", "value", "disabled", "aria-label"], Le = { class: "vfp-w-9 vfp-flex-shrink-0 vfp-text-[11px] vfp-text-fg-tertiary vfp-tabular-nums" }, Ee = { class: "vfp-flex vfp-items-center vfp-gap-1" }, Te = ["title", "aria-label"], Me = ["title", "aria-label"], Pe = ["title", "aria-label"], Ce = ["title", "aria-label"], Ve = ["title", "aria-label"], Ne = {
|
|
98
|
+
class: "vfp-flex vfp-flex-col vfp-items-center vfp-gap-2",
|
|
99
|
+
style: { height: "100px" }
|
|
100
|
+
}, je = {
|
|
101
|
+
class: "vfp-relative vfp-flex vfp-items-center vfp-justify-center",
|
|
102
|
+
style: { width: "24px", height: "80px" }
|
|
103
|
+
}, Re = ["value", "aria-label"], Fe = { class: "vfp-text-[10px] vfp-tabular-nums vfp-text-fg-tertiary" }, Se = ["src"], Ue = /* @__PURE__ */ X({
|
|
104
|
+
__name: "index",
|
|
105
|
+
props: {
|
|
106
|
+
url: {},
|
|
107
|
+
fileName: {}
|
|
108
|
+
},
|
|
109
|
+
setup(L, { expose: v }) {
|
|
110
|
+
const p = J(L, "url"), { t: n } = pe(), {
|
|
111
|
+
audioRef: T,
|
|
112
|
+
isPlaying: g,
|
|
113
|
+
isLoop: x,
|
|
114
|
+
currentTime: h,
|
|
115
|
+
duration: u,
|
|
116
|
+
volume: r,
|
|
117
|
+
isMuted: d,
|
|
118
|
+
error: j,
|
|
119
|
+
togglePlay: R,
|
|
120
|
+
seek: F,
|
|
121
|
+
skip: S,
|
|
122
|
+
setVolume: I,
|
|
123
|
+
toggleMute: $,
|
|
124
|
+
toggleLoop: t,
|
|
125
|
+
formatTime: l
|
|
126
|
+
} = ce(p), s = f(!1), c = f(!1), b = f(0), w = f(null);
|
|
127
|
+
let m = null;
|
|
128
|
+
const k = B(() => c.value ? b.value : h.value), M = B(() => u.value > 0 ? k.value / u.value : 0), P = B(() => d.value || r.value === 0 ? ae : r.value < 0.5 ? oe : ne), A = (G) => {
|
|
129
|
+
w.value && !w.value.contains(G.target) && (s.value = !1);
|
|
130
|
+
};
|
|
131
|
+
K(() => {
|
|
132
|
+
document.addEventListener("mousedown", A);
|
|
133
|
+
}), Q(() => {
|
|
134
|
+
document.removeEventListener("mousedown", A), m !== null && clearTimeout(m);
|
|
135
|
+
});
|
|
136
|
+
const U = () => {
|
|
137
|
+
m !== null && clearTimeout(m), s.value = !0;
|
|
138
|
+
}, z = () => {
|
|
139
|
+
m = window.setTimeout(() => {
|
|
140
|
+
s.value = !1;
|
|
141
|
+
}, 300);
|
|
142
|
+
};
|
|
143
|
+
return v({
|
|
144
|
+
getToolbarGroups: () => []
|
|
145
|
+
}), (G, o) => e(j) ? (_(), V(de, {
|
|
146
|
+
key: 0,
|
|
147
|
+
message: e(j)
|
|
148
|
+
}, null, 8, ["message"])) : (_(), H("div", me, [
|
|
149
|
+
a("div", ge, [
|
|
150
|
+
a("div", xe, [
|
|
151
|
+
a("div", {
|
|
152
|
+
"aria-hidden": "true",
|
|
153
|
+
class: D([
|
|
154
|
+
"vfp-audio-mark vfp-w-10 vfp-h-10 vfp-flex vfp-items-center vfp-justify-center vfp-rounded-md vfp-flex-shrink-0",
|
|
155
|
+
e(g) ? "vfp-audio-mark-playing" : ""
|
|
156
|
+
])
|
|
157
|
+
}, [
|
|
158
|
+
E(e(le), { class: "vfp-w-5 vfp-h-5" })
|
|
159
|
+
], 2),
|
|
160
|
+
a("div", ye, N(L.fileName), 1)
|
|
161
|
+
]),
|
|
162
|
+
a("div", he, [
|
|
163
|
+
a("span", be, N(e(l)(k.value)), 1),
|
|
164
|
+
a("div", we, [
|
|
165
|
+
a("div", ke, [
|
|
166
|
+
a("div", {
|
|
167
|
+
class: "vfp-h-full vfp-rounded-full vfp-pointer-events-none",
|
|
168
|
+
style: O({
|
|
169
|
+
width: `${M.value * 100}%`,
|
|
170
|
+
background: "var(--fp-player-progress)",
|
|
171
|
+
transition: c.value ? "none" : "width 0.1s linear"
|
|
172
|
+
})
|
|
173
|
+
}, null, 4)
|
|
174
|
+
]),
|
|
175
|
+
a("input", {
|
|
176
|
+
type: "range",
|
|
177
|
+
min: "0",
|
|
178
|
+
max: e(u) > 0 ? e(u) : e(h) || 100,
|
|
179
|
+
step: "any",
|
|
180
|
+
value: k.value,
|
|
181
|
+
disabled: e(u) <= 0,
|
|
182
|
+
"aria-label": e(n)("audio.aria.progress"),
|
|
183
|
+
class: "audio-slider vfp-absolute vfp-w-full",
|
|
184
|
+
onPointerdown: o[0] || (o[0] = () => {
|
|
185
|
+
b.value = e(h), c.value = !0;
|
|
186
|
+
}),
|
|
187
|
+
onInput: o[1] || (o[1] = (i) => {
|
|
188
|
+
const C = parseFloat(i.target.value);
|
|
189
|
+
c.value ? b.value = C : e(F)(C);
|
|
190
|
+
}),
|
|
191
|
+
onPointerup: o[2] || (o[2] = (i) => {
|
|
192
|
+
const C = parseFloat(i.target.value);
|
|
193
|
+
e(F)(C), c.value = !1;
|
|
194
|
+
}),
|
|
195
|
+
onPointercancel: o[3] || (o[3] = (i) => c.value = !1)
|
|
196
|
+
}, null, 40, _e)
|
|
197
|
+
]),
|
|
198
|
+
a("span", Le, N(e(u) > 0 ? e(l)(e(u)) : "--:--"), 1)
|
|
199
|
+
]),
|
|
200
|
+
a("div", Ee, [
|
|
201
|
+
a("button", {
|
|
202
|
+
type: "button",
|
|
203
|
+
class: "vfp-audio-control vfp-w-10 vfp-h-10 vfp-rounded-md vfp-flex vfp-items-center vfp-justify-center vfp-flex-shrink-0",
|
|
204
|
+
style: {
|
|
205
|
+
background: "var(--fp-player-progress)",
|
|
206
|
+
color: "var(--fp-fg-inverse)"
|
|
207
|
+
},
|
|
208
|
+
title: e(g) ? e(n)("audio.aria.pause") : e(n)("audio.aria.play"),
|
|
209
|
+
"aria-label": e(g) ? e(n)("audio.aria.pause") : e(n)("audio.aria.play"),
|
|
210
|
+
onClick: o[4] || (o[4] = //@ts-ignore
|
|
211
|
+
(...i) => e(R) && e(R)(...i))
|
|
212
|
+
}, [
|
|
213
|
+
e(g) ? (_(), V(e(se), {
|
|
214
|
+
key: 0,
|
|
215
|
+
class: "vfp-w-5 vfp-h-5"
|
|
216
|
+
})) : (_(), V(e(re), {
|
|
217
|
+
key: 1,
|
|
218
|
+
class: "vfp-w-5 vfp-h-5 vfp-ml-0.5"
|
|
219
|
+
}))
|
|
220
|
+
], 8, Te),
|
|
221
|
+
a("button", {
|
|
222
|
+
type: "button",
|
|
223
|
+
class: "vfp-audio-control vfp-w-9 vfp-h-9 vfp-rounded-md vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors vfp-text-fg-secondary hover:vfp-bg-surface-3 vfp-flex-shrink-0",
|
|
224
|
+
title: e(n)("audio.aria.backward_10"),
|
|
225
|
+
"aria-label": e(n)("audio.aria.backward_10"),
|
|
226
|
+
onClick: o[5] || (o[5] = (i) => e(S)(-10))
|
|
227
|
+
}, [
|
|
228
|
+
E(e(ie), { class: "vfp-w-[18px] vfp-h-[18px]" })
|
|
229
|
+
], 8, Me),
|
|
230
|
+
a("button", {
|
|
231
|
+
type: "button",
|
|
232
|
+
class: "vfp-audio-control vfp-w-9 vfp-h-9 vfp-rounded-md vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors vfp-text-fg-secondary hover:vfp-bg-surface-3 vfp-flex-shrink-0",
|
|
233
|
+
title: e(n)("audio.aria.forward_10"),
|
|
234
|
+
"aria-label": e(n)("audio.aria.forward_10"),
|
|
235
|
+
onClick: o[6] || (o[6] = (i) => e(S)(10))
|
|
236
|
+
}, [
|
|
237
|
+
E(e(fe), { class: "vfp-w-[18px] vfp-h-[18px]" })
|
|
238
|
+
], 8, Pe),
|
|
239
|
+
o[11] || (o[11] = a("div", { class: "vfp-w-px vfp-h-5 vfp-mx-1 vfp-bg-divide" }, null, -1)),
|
|
240
|
+
a("button", {
|
|
241
|
+
type: "button",
|
|
242
|
+
class: D([
|
|
243
|
+
"vfp-audio-control vfp-w-9 vfp-h-9 vfp-rounded-md vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors vfp-flex-shrink-0",
|
|
244
|
+
e(x) ? "vfp-bg-surface-3 vfp-text-fg-primary" : "vfp-text-fg-tertiary hover:vfp-bg-surface-3"
|
|
245
|
+
]),
|
|
246
|
+
title: e(x) ? e(n)("audio.aria.loop_off") : e(n)("audio.aria.loop_on"),
|
|
247
|
+
"aria-label": e(x) ? e(n)("audio.aria.loop_off") : e(n)("audio.aria.loop_on"),
|
|
248
|
+
onClick: o[7] || (o[7] = //@ts-ignore
|
|
249
|
+
(...i) => e(t) && e(t)(...i))
|
|
250
|
+
}, [
|
|
251
|
+
E(e(ve), { class: "vfp-w-4 vfp-h-4" })
|
|
252
|
+
], 10, Ce),
|
|
253
|
+
o[12] || (o[12] = a("div", { class: "vfp-flex-1" }, null, -1)),
|
|
254
|
+
a("div", {
|
|
255
|
+
ref_key: "volumeRef",
|
|
256
|
+
ref: w,
|
|
257
|
+
class: "vfp-relative",
|
|
258
|
+
onMouseenter: U,
|
|
259
|
+
onMouseleave: z
|
|
260
|
+
}, [
|
|
261
|
+
a("button", {
|
|
262
|
+
type: "button",
|
|
263
|
+
class: D([
|
|
264
|
+
"vfp-audio-control vfp-w-9 vfp-h-9 vfp-rounded-md vfp-flex vfp-items-center vfp-justify-center vfp-transition-colors vfp-flex-shrink-0",
|
|
265
|
+
s.value ? "vfp-bg-surface-3 vfp-text-fg-primary" : "vfp-text-fg-secondary hover:vfp-bg-surface-3"
|
|
266
|
+
]),
|
|
267
|
+
title: e(d) ? e(n)("audio.aria.unmute") : e(n)("audio.aria.mute"),
|
|
268
|
+
"aria-label": e(d) ? e(n)("audio.aria.unmute") : e(n)("audio.aria.mute"),
|
|
269
|
+
onClick: o[8] || (o[8] = //@ts-ignore
|
|
270
|
+
(...i) => e($) && e($)(...i))
|
|
271
|
+
}, [
|
|
272
|
+
(_(), V(Y(P.value), { class: "vfp-w-4 vfp-h-4" }))
|
|
273
|
+
], 10, Ve),
|
|
274
|
+
E(Z, { name: "vfp-fade" }, {
|
|
275
|
+
default: ee(() => [
|
|
276
|
+
s.value ? (_(), H("div", {
|
|
277
|
+
key: 0,
|
|
278
|
+
class: "vfp-absolute vfp-right-0 vfp-bottom-full vfp-mb-2 vfp-w-[54px] vfp-rounded-md vfp-p-3 vfp-border vfp-bg-surface-toolbar vfp-border-line",
|
|
279
|
+
onMouseenter: U,
|
|
280
|
+
onMouseleave: z
|
|
281
|
+
}, [
|
|
282
|
+
a("div", Ne, [
|
|
283
|
+
a("div", je, [
|
|
284
|
+
o[10] || (o[10] = a("div", {
|
|
285
|
+
class: "vfp-absolute vfp-rounded-full vfp-bg-surface-2",
|
|
286
|
+
style: { width: "3px", height: "100%" }
|
|
287
|
+
}, null, -1)),
|
|
288
|
+
a("div", {
|
|
289
|
+
class: "vfp-absolute vfp-bottom-0 vfp-rounded-full vfp-pointer-events-none",
|
|
290
|
+
style: O({
|
|
291
|
+
width: "3px",
|
|
292
|
+
height: `${(e(d) ? 0 : e(r)) * 100}%`,
|
|
293
|
+
background: "var(--fp-player-progress)",
|
|
294
|
+
transition: "height 0.1s linear"
|
|
295
|
+
})
|
|
296
|
+
}, null, 4),
|
|
297
|
+
a("input", {
|
|
298
|
+
type: "range",
|
|
299
|
+
min: "0",
|
|
300
|
+
max: "1",
|
|
301
|
+
step: "0.01",
|
|
302
|
+
value: e(d) ? 0 : e(r),
|
|
303
|
+
"aria-label": e(n)("audio.aria.volume"),
|
|
304
|
+
class: "volume-slider-vertical vfp-absolute",
|
|
305
|
+
style: { width: "80px", height: "24px", transform: "rotate(-90deg)", "transform-origin": "center center" },
|
|
306
|
+
onInput: o[9] || (o[9] = (i) => e(I)(parseFloat(i.target.value)))
|
|
307
|
+
}, null, 40, Re)
|
|
308
|
+
]),
|
|
309
|
+
a("span", Fe, N(Math.round((e(d) ? 0 : e(r)) * 100)), 1)
|
|
310
|
+
])
|
|
311
|
+
], 32)) : te("", !0)
|
|
312
|
+
]),
|
|
313
|
+
_: 1
|
|
314
|
+
})
|
|
315
|
+
], 544)
|
|
316
|
+
])
|
|
317
|
+
]),
|
|
318
|
+
a("audio", {
|
|
319
|
+
ref_key: "audioRef",
|
|
320
|
+
ref: T,
|
|
321
|
+
src: L.url,
|
|
322
|
+
class: "vfp-hidden"
|
|
323
|
+
}, null, 8, Se)
|
|
324
|
+
]));
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
export {
|
|
328
|
+
Ue as default
|
|
329
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as Os, ref as Ie, onMounted as ws, onBeforeUnmount as Es, watch as Mr, openBlock as ge, createElementBlock as ke, normalizeStyle as Pr, toDisplayString as K, computed as mt, createElementVNode as P, unref as ae, createBlock as Br, Fragment as Dn, createCommentVNode as Wt, withDirectives as Nr, vModelText as _r, renderList as Gr, createVNode as qt } from "vue";
|
|
2
|
-
import { u as Hr,
|
|
2
|
+
import { u as Hr, b as Vr, c as zr } from "./index-xY2bzsk7.mjs";
|
|
3
3
|
import { _ as jr } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
|
|
4
4
|
var mn = 0, Rs = -3;
|
|
5
5
|
function at() {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as P, computed as D, ref as c, watch as k, nextTick as K, openBlock as d, createElementBlock as u, createElementVNode as H, createBlock as O, toDisplayString as R } from "vue";
|
|
2
2
|
import N from "markdown-it";
|
|
3
3
|
import Y from "@traptitech/markdown-it-katex";
|
|
4
4
|
import { codeToHtml as E } from "shiki";
|
|
5
5
|
import { Code as F, Eye as W } from "lucide-vue-next";
|
|
6
|
-
import { u as z,
|
|
6
|
+
import { u as z, b as J, c as Q, e as U, _ as X } from "./index-xY2bzsk7.mjs";
|
|
7
7
|
import { _ as Z } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
|
|
8
8
|
import { T as ee } from "./base.types-DaftHyg7.mjs";
|
|
9
9
|
const te = {
|
|
@@ -19,14 +19,14 @@ const te = {
|
|
|
19
19
|
}, ne = ["innerHTML"], le = {
|
|
20
20
|
key: 3,
|
|
21
21
|
class: "vfp-w-full vfp-h-full vfp-overflow-auto vfp-py-6 vfp-px-4"
|
|
22
|
-
},
|
|
22
|
+
}, se = ["innerHTML"], B = '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>', L = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>', ae = '<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>', ce = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>', ie = /* @__PURE__ */ P({
|
|
23
23
|
__name: "index",
|
|
24
24
|
props: {
|
|
25
25
|
url: {}
|
|
26
26
|
},
|
|
27
27
|
setup(q, { expose: V }) {
|
|
28
|
-
const _ = q, x = new ee(), { t: i } = z(), j = J(), G = Q(), y =
|
|
29
|
-
k([
|
|
28
|
+
const _ = q, x = new ee(), { t: i } = z(), j = J(), G = Q(), y = D(() => G.value === "light" ? "github-light" : "github-dark"), a = c("preview"), b = c(""), v = c(""), f = c(""), p = c(!0), h = c(null), m = c(null);
|
|
29
|
+
k([a, p], () => {
|
|
30
30
|
x.notify();
|
|
31
31
|
}), V({
|
|
32
32
|
getToolbarGroups: () => {
|
|
@@ -35,12 +35,12 @@ const te = {
|
|
|
35
35
|
items: [
|
|
36
36
|
{
|
|
37
37
|
type: "button",
|
|
38
|
-
icon:
|
|
39
|
-
tooltip:
|
|
38
|
+
icon: a.value === "preview" ? F : W,
|
|
39
|
+
tooltip: a.value === "preview" ? i.value("toolbar.source") : i.value("toolbar.preview"),
|
|
40
40
|
action: () => {
|
|
41
|
-
|
|
41
|
+
a.value = a.value === "preview" ? "source" : "preview";
|
|
42
42
|
},
|
|
43
|
-
active:
|
|
43
|
+
active: a.value === "source"
|
|
44
44
|
}
|
|
45
45
|
]
|
|
46
46
|
}), e;
|
|
@@ -96,18 +96,18 @@ const te = {
|
|
|
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 ?
|
|
99
|
+
t.innerHTML = r ? ae : ce, t.title = i.value("markdown.copied"), setTimeout(() => {
|
|
100
100
|
t.innerHTML = r ? B : L, t.title = i.value("markdown.copy_code");
|
|
101
101
|
}, 2e3);
|
|
102
102
|
}), t;
|
|
103
|
-
},
|
|
103
|
+
}, I = async () => {
|
|
104
104
|
var t, n;
|
|
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", s = ((t = o.querySelector("code")) == null ? void 0 : t.textContent) || "";
|
|
109
109
|
try {
|
|
110
|
-
const g = await E(
|
|
110
|
+
const g = await E(s, { lang: w, theme: y.value }), M = document.createElement("div");
|
|
111
111
|
M.innerHTML = g;
|
|
112
112
|
const S = M.firstElementChild;
|
|
113
113
|
S && o.replaceWith(S);
|
|
@@ -118,20 +118,20 @@ const te = {
|
|
|
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"), s = o.querySelector("pre"), g = ((n = s == null ? void 0 : s.querySelector("code")) == null ? void 0 : n.textContent) ?? (s == null ? void 0 : s.textContent) ?? "";
|
|
122
122
|
w ? w.appendChild(T(g, !0)) : o.appendChild(T(g, !1));
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
125
|
return k(() => _.url, C, { immediate: !0 }), k(v, async () => {
|
|
126
|
-
v.value && (await
|
|
126
|
+
v.value && (await K(), I());
|
|
127
127
|
}), k(y, () => {
|
|
128
128
|
b.value && C();
|
|
129
129
|
}), (e, r) => p.value ? (d(), u("div", te, [...r[0] || (r[0] = [
|
|
130
130
|
H("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)
|
|
131
|
-
])])) : h.value ? (d(),
|
|
131
|
+
])])) : h.value ? (d(), O(Z, {
|
|
132
132
|
key: 1,
|
|
133
133
|
message: h.value
|
|
134
|
-
}, null, 8, ["message"])) :
|
|
134
|
+
}, null, 8, ["message"])) : a.value === "source" ? (d(), u("div", oe, [
|
|
135
135
|
f.value ? (d(), u("div", {
|
|
136
136
|
key: 1,
|
|
137
137
|
class: "shiki-wrapper",
|
|
@@ -143,7 +143,7 @@ const te = {
|
|
|
143
143
|
ref: m,
|
|
144
144
|
class: "markdown-body",
|
|
145
145
|
innerHTML: v.value
|
|
146
|
-
}, null, 8,
|
|
146
|
+
}, null, 8, se)
|
|
147
147
|
]));
|
|
148
148
|
}
|
|
149
149
|
}), ke = /* @__PURE__ */ X(ie, [["__scopeId", "data-v-e65958df"]]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as x, ref as d, onMounted as b, watch as w, onBeforeUnmount as T, openBlock as f, createBlock as E, createElementBlock as m, createElementVNode as
|
|
1
|
+
import { defineComponent as x, ref as d, onMounted as b, watch as w, onBeforeUnmount as T, openBlock as f, createBlock as E, createElementBlock as m, createElementVNode as a, toDisplayString as C, unref as D, createCommentVNode as j } from "vue";
|
|
2
2
|
import B from "video.js";
|
|
3
|
-
import { u as N,
|
|
3
|
+
import { u as N, n as _ } from "./index-xY2bzsk7.mjs";
|
|
4
4
|
import { _ as P } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
|
|
5
5
|
const R = {
|
|
6
6
|
key: 1,
|
|
@@ -8,37 +8,37 @@ const R = {
|
|
|
8
8
|
}, S = { class: "vfp-w-full vfp-h-full vfp-relative" }, U = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-surface-3 vfp-backdrop-blur-sm vfp-z-10"
|
|
11
|
-
}, V = { class: "vfp-text-center" }, q = { class: "vfp-text-sm vfp-text-fg-secondary vfp-font-medium" },
|
|
11
|
+
}, V = { class: "vfp-text-center" }, q = { class: "vfp-text-sm vfp-text-fg-secondary vfp-font-medium" }, M = /* @__PURE__ */ x({
|
|
12
12
|
__name: "index",
|
|
13
13
|
props: {
|
|
14
14
|
url: {},
|
|
15
15
|
fileName: {}
|
|
16
16
|
},
|
|
17
17
|
setup(y, { expose: g }) {
|
|
18
|
-
const
|
|
18
|
+
const o = y, { t: l } = N(), h = /* @__PURE__ */ new Set(["avi", "wmv", "flv"]), i = d(null), u = d(!0), v = d(null);
|
|
19
19
|
let e = null;
|
|
20
|
-
const k = (
|
|
21
|
-
var
|
|
22
|
-
return ((
|
|
20
|
+
const k = (s, r) => {
|
|
21
|
+
var n;
|
|
22
|
+
return ((n = (r || s).split(".").pop()) == null ? void 0 : n.toLowerCase().split("?")[0]) || "";
|
|
23
23
|
};
|
|
24
24
|
return b(() => {
|
|
25
|
-
if (!
|
|
26
|
-
const
|
|
27
|
-
if (h.has(
|
|
25
|
+
if (!v.value || e) return;
|
|
26
|
+
const s = k(o.url, o.fileName);
|
|
27
|
+
if (h.has(s)) {
|
|
28
28
|
i.value = {
|
|
29
29
|
title: l.value("video.unsupported_title"),
|
|
30
|
-
detail: l.value("video.unsupported_detail", { format:
|
|
30
|
+
detail: l.value("video.unsupported_detail", { format: s.toUpperCase() })
|
|
31
31
|
}, u.value = !1;
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
let
|
|
38
|
-
|
|
39
|
-
{ src:
|
|
40
|
-
{ src:
|
|
41
|
-
] :
|
|
34
|
+
const r = document.createElement("video-js");
|
|
35
|
+
r.classList.add("vjs-big-play-centered", "rfp-video-player"), v.value.appendChild(r);
|
|
36
|
+
const p = _(o.url);
|
|
37
|
+
let n;
|
|
38
|
+
p === "video/quicktime" ? n = [
|
|
39
|
+
{ src: o.url, type: "video/quicktime" },
|
|
40
|
+
{ src: o.url, type: "video/mp4" }
|
|
41
|
+
] : n = [{ src: o.url, type: p }], e = B(r, {
|
|
42
42
|
controls: !0,
|
|
43
43
|
fill: !0,
|
|
44
44
|
preload: "auto",
|
|
@@ -50,11 +50,10 @@ const R = {
|
|
|
50
50
|
"timeDivider",
|
|
51
51
|
"durationDisplay",
|
|
52
52
|
"progressControl",
|
|
53
|
-
"remainingTimeDisplay",
|
|
54
53
|
"fullscreenToggle"
|
|
55
54
|
],
|
|
56
55
|
volumePanel: {
|
|
57
|
-
inline: !
|
|
56
|
+
inline: !0
|
|
58
57
|
}
|
|
59
58
|
},
|
|
60
59
|
html5: {
|
|
@@ -65,47 +64,47 @@ const R = {
|
|
|
65
64
|
nativeAudioTracks: !1,
|
|
66
65
|
nativeTextTracks: !1
|
|
67
66
|
},
|
|
68
|
-
sources:
|
|
67
|
+
sources: n
|
|
69
68
|
});
|
|
70
69
|
const c = e.el().querySelector("video");
|
|
71
70
|
c && (c.style.objectFit = "contain"), e.on("loadeddata", () => {
|
|
72
71
|
u.value = !1;
|
|
73
72
|
}), e.on("error", () => {
|
|
74
|
-
const
|
|
75
|
-
console.warn("[VideoRenderer] Video playback error:", (
|
|
73
|
+
const t = e == null ? void 0 : e.error();
|
|
74
|
+
console.warn("[VideoRenderer] Video playback error:", (t == null ? void 0 : t.message) || "Unknown error"), (t == null ? void 0 : t.code) === 4 ? i.value = {
|
|
76
75
|
title: l.value("video.unsupported_title"),
|
|
77
76
|
detail: l.value("video.unsupported_detail", {
|
|
78
|
-
format:
|
|
77
|
+
format: s ? s.toUpperCase() : l.value("common.unknown_error")
|
|
79
78
|
})
|
|
80
79
|
} : i.value = {
|
|
81
80
|
title: l.value("video.load_failed"),
|
|
82
|
-
detail: (
|
|
81
|
+
detail: (t == null ? void 0 : t.message) || l.value("common.unknown_error")
|
|
83
82
|
}, u.value = !1;
|
|
84
83
|
});
|
|
85
84
|
}), w(
|
|
86
|
-
() =>
|
|
85
|
+
() => o.url,
|
|
87
86
|
() => {
|
|
88
|
-
e && !e.isDisposed() && e.src({ src:
|
|
87
|
+
e && !e.isDisposed() && e.src({ src: o.url, type: _(o.url) });
|
|
89
88
|
}
|
|
90
89
|
), T(() => {
|
|
91
90
|
e && !e.isDisposed() && (e.dispose(), e = null);
|
|
92
91
|
}), g({
|
|
93
92
|
getToolbarGroups: () => []
|
|
94
|
-
}), (
|
|
93
|
+
}), (s, r) => i.value ? (f(), E(P, {
|
|
95
94
|
key: 0,
|
|
96
95
|
message: i.value.title,
|
|
97
96
|
detail: i.value.detail
|
|
98
97
|
}, null, 8, ["message", "detail"])) : (f(), m("div", R, [
|
|
99
|
-
|
|
98
|
+
a("div", S, [
|
|
100
99
|
u.value ? (f(), m("div", U, [
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
a("div", V, [
|
|
101
|
+
r[0] || (r[0] = a("div", { class: "vfp-w-12 vfp-h-12 vfp-mx-auto vfp-mb-3 vfp-border-4 vfp-border-line-strong vfp-border-t-spinner-head vfp-rounded-full vfp-animate-spin" }, null, -1)),
|
|
102
|
+
a("p", q, C(D(l)("video.loading")), 1)
|
|
104
103
|
])
|
|
105
104
|
])) : j("", !0),
|
|
106
|
-
|
|
105
|
+
a("div", {
|
|
107
106
|
ref_key: "videoContainerRef",
|
|
108
|
-
ref:
|
|
107
|
+
ref: v,
|
|
109
108
|
class: "vfp-overflow-hidden vfp-w-full vfp-h-full",
|
|
110
109
|
style: { "box-shadow": "0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05)" }
|
|
111
110
|
}, null, 512)
|
|
@@ -114,5 +113,5 @@ const R = {
|
|
|
114
113
|
}
|
|
115
114
|
});
|
|
116
115
|
export {
|
|
117
|
-
|
|
116
|
+
M as default
|
|
118
117
|
};
|