@eternalheart/vue-file-preview 1.6.13 → 1.7.0
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 +17 -6
- package/lib/FilePreviewEmbed.vue.d.ts +14 -6
- package/lib/FilePreviewModal.vue.d.ts +14 -6
- package/lib/chunks/{EmptyState.vue_vue_type_script_setup_true_lang-C7qk6wj0.mjs → EmptyState.vue_vue_type_script_setup_true_lang--ZOobbGi.mjs} +1 -1
- package/lib/chunks/{avifLoader-CAUzjn-d-C0KRpetN.mjs → avifLoader-CAUzjn-d-CnJpGYJ2.mjs} +1 -1
- package/lib/chunks/{heicLoader-D_9PukkA-Czof_5FJ.mjs → heicLoader-D_9PukkA-g_dLrWLP.mjs} +1 -1
- package/lib/chunks/index-6XZXYqbp.mjs +125 -0
- package/lib/chunks/{index-B21EAyWz.mjs → index-BPSzwMOC.mjs} +51 -51
- package/lib/chunks/index-BYQ9S7Mk.mjs +104 -0
- package/lib/chunks/{index-8Vpbg2kS.mjs → index-Bf94DwQu.mjs} +105 -104
- package/lib/chunks/index-BfOWoMpY.mjs +359 -0
- package/lib/chunks/index-Bg8poMIm.mjs +117 -0
- package/lib/chunks/index-BzwJ0VWu.mjs +108 -0
- package/lib/chunks/index-C41YET0_.mjs +51 -0
- package/lib/chunks/{index-BvBqDq3O.mjs → index-C4hIk6pa.mjs} +2023 -2023
- package/lib/chunks/{index-BASg1cr4.mjs → index-C8lyQPe3.mjs} +1018 -1018
- package/lib/chunks/{index-C9mAajbD.mjs → index-CWPdNhoe.mjs} +200 -200
- package/lib/chunks/{index-BuqPb5mP.mjs → index-CrVQPnFj.mjs} +112 -112
- package/lib/chunks/{index-D30L8tm9.mjs → index-D5IF9F-D.mjs} +57 -57
- package/lib/chunks/{index-DN4Ui0Gh.mjs → index-DFeKS8tR.mjs} +120 -120
- package/lib/chunks/index-DM8Dfl-m.mjs +52 -0
- package/lib/chunks/index-DZe0BxAB.mjs +90 -0
- package/lib/chunks/{index-BlrFFeqc.mjs → index-GFcSJEwj.mjs} +75 -75
- package/lib/chunks/{index-Dkro_8Fy.mjs → index-LPGxJDnT.mjs} +32 -32
- package/lib/chunks/index-aKiIuKKx.mjs +157 -0
- package/lib/chunks/{index-DZZN3kYi.mjs → index-c-pYJEmH.mjs} +1589 -1394
- package/lib/chunks/{index-CxKZKUJj.mjs → index-z9RqL2wI.mjs} +1651 -1651
- package/lib/chunks/index-zLQlyNR2.mjs +383 -0
- package/lib/chunks/{jp2Loader-Dig19xyo-CKUaGhPl.mjs → jp2Loader-Dig19xyo-fCO1knZ0.mjs} +1 -1
- package/lib/chunks/{psdLoader-C0tKUXXl-CYWoQis5.mjs → psdLoader-C0tKUXXl-DihMskai.mjs} +1 -1
- package/lib/chunks/{rawLoader-C-tPeFAB-C35zC8nZ.mjs → rawLoader-C-tPeFAB-BSfDPl-z.mjs} +5 -5
- package/lib/chunks/{tiffLoader-BlhByX8w-BOxg_Du5.mjs → tiffLoader-BlhByX8w-JY5DaTre.mjs} +1 -1
- package/lib/chunks/{useShikiHighlight-BPmcxA-h.mjs → useShikiHighlight-C-ztcJBE.mjs} +1 -1
- package/lib/composables/useAudioPlayer.d.ts +1 -1
- package/lib/composables/usePreviewEvents.d.ts +27 -0
- package/lib/composables/useRequest.d.ts +16 -4
- package/lib/composables/useThemeMode.d.ts +1 -1
- package/lib/composables/useTranslator.d.ts +2 -2
- package/lib/core/events.d.ts +52 -0
- package/lib/core/i18n/index.d.ts +29 -0
- package/lib/core/i18n/messages/en-US.d.ts +5 -0
- package/lib/core/i18n/messages/index.d.ts +9 -0
- package/lib/core/i18n/messages/zh-CN.d.ts +5 -0
- package/lib/core/i18n/types.d.ts +23 -0
- package/lib/core/index.d.ts +34 -0
- package/lib/core/loaders/avifLoader.d.ts +22 -0
- package/lib/core/loaders/heicLoader.d.ts +21 -0
- package/lib/core/loaders/jp2Loader.d.ts +16 -0
- package/lib/core/loaders/jp2Worker.d.ts +1 -0
- package/lib/core/loaders/psdLoader.d.ts +14 -0
- package/lib/core/loaders/rawLoader.d.ts +14 -0
- package/lib/core/loaders/registry.d.ts +32 -0
- package/lib/core/loaders/tiffLoader.d.ts +28 -0
- package/lib/core/loaders/types.d.ts +56 -0
- package/lib/core/types.d.ts +89 -0
- package/lib/core/utils/csvParser.d.ts +31 -0
- package/lib/core/utils/emptyState.d.ts +28 -0
- package/lib/core/utils/excelDataConverter.d.ts +61 -0
- package/lib/core/utils/fileNormalizer.d.ts +21 -0
- package/lib/core/utils/fileType.d.ts +21 -0
- package/lib/core/utils/legacy-office/doc.d.ts +25 -0
- package/lib/core/utils/legacy-office/index.d.ts +8 -0
- package/lib/core/utils/legacy-office/ole.d.ts +8 -0
- package/lib/core/utils/legacy-office/ppt.d.ts +79 -0
- package/lib/core/utils/legacy-office/xls.d.ts +28 -0
- package/lib/core/utils/mimeTypes.d.ts +29 -0
- package/lib/core/utils/ooxml/docx.d.ts +17 -0
- package/lib/core/utils/ooxml/index.d.ts +4 -0
- package/lib/core/utils/ooxml/pptx.d.ts +7 -0
- package/lib/core/utils/ooxml/xml.d.ts +15 -0
- package/lib/core/utils/ooxml/zip.d.ts +3 -0
- package/lib/core/utils/pdfWorker.d.ts +61 -0
- package/lib/core/utils/previewMode.d.ts +7 -0
- package/lib/core/utils/request.d.ts +49 -0
- package/lib/core/utils/subtitleParser.d.ts +44 -0
- package/lib/core/utils/textDecoder.d.ts +30 -0
- package/lib/core/utils/uint8ArrayPolyfill.d.ts +18 -0
- package/lib/core/utils/zipReader.d.ts +51 -0
- package/lib/core/workers/imageDecoder.worker.d.ts +31 -0
- package/lib/core/workers/workerClient.d.ts +14 -0
- package/lib/i18n/localeKey.d.ts +1 -1
- package/lib/index.cjs +60 -60
- package/lib/index.css +1 -1
- package/lib/index.d.ts +11 -9
- package/lib/index.mjs +15 -12
- package/lib/renderers/Audio/index.vue.d.ts +1 -1
- package/lib/renderers/Cad/index.vue.d.ts +1 -1
- package/lib/renderers/Cad/toolbar.d.ts +2 -2
- package/lib/renderers/Csv/index.vue.d.ts +1 -1
- package/lib/renderers/Doc/index.vue.d.ts +1 -1
- package/lib/renderers/Docx/index.vue.d.ts +1 -1
- package/lib/renderers/Epub/index.vue.d.ts +1 -1
- package/lib/renderers/Font/index.vue.d.ts +1 -1
- package/lib/renderers/Image/index.vue.d.ts +2 -2
- package/lib/renderers/Json/index.vue.d.ts +2 -2
- package/lib/renderers/Markdown/index.vue.d.ts +1 -1
- package/lib/renderers/Mobi/index.vue.d.ts +1 -1
- package/lib/renderers/Msg/index.vue.d.ts +1 -1
- package/lib/renderers/Pdf/index.vue.d.ts +1 -1
- package/lib/renderers/Ppt/index.vue.d.ts +1 -1
- package/lib/renderers/Pptx/index.vue.d.ts +2 -2
- package/lib/renderers/Subtitle/index.vue.d.ts +1 -1
- package/lib/renderers/Text/index.vue.d.ts +2 -2
- package/lib/renderers/Unsupported/index.vue.d.ts +1 -1
- package/lib/renderers/Video/index.vue.d.ts +1 -1
- package/lib/renderers/Xlsx/index.vue.d.ts +2 -2
- package/lib/renderers/Xml/index.vue.d.ts +1 -1
- package/lib/renderers/Zip/TreeItem.vue.d.ts +1 -1
- package/lib/renderers/Zip/index.vue.d.ts +1 -1
- package/lib/renderers/base.types.d.ts +1 -1
- package/lib/renderers/registry.d.ts +1 -1
- package/lib/types.d.ts +3 -3
- package/package.json +2 -2
- package/lib/chunks/index--612Smof.mjs +0 -383
- package/lib/chunks/index-BB0i4QqI.mjs +0 -117
- package/lib/chunks/index-BVdrGK3Q.mjs +0 -356
- package/lib/chunks/index-Bp9CuvMZ.mjs +0 -157
- package/lib/chunks/index-Bxpf9v5j.mjs +0 -104
- package/lib/chunks/index-CDg6vIbT.mjs +0 -51
- package/lib/chunks/index-CWE-hKSs.mjs +0 -90
- package/lib/chunks/index-CY3xzGgt.mjs +0 -108
- package/lib/chunks/index-VdzIFJJW.mjs +0 -118
- package/lib/chunks/index-aoXgVLBb.mjs +0 -52
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { List as
|
|
4
|
-
import { u as
|
|
5
|
-
import { _ as
|
|
6
|
-
import { T as
|
|
7
|
-
const
|
|
1
|
+
import { defineComponent as ce, ref as d, watch as Y, onMounted as fe, onBeforeUnmount as pe, openBlock as h, createElementBlock as m, createBlock as ve, createCommentVNode as W, createElementVNode as p, toDisplayString as L, unref as N, normalizeStyle as z, createVNode as de, Fragment as O, renderList as Z } from "vue";
|
|
2
|
+
import he from "@likecoin/epub-ts";
|
|
3
|
+
import { List as me, ChevronLeft as ge, ChevronRight as be, Minimize2 as xe, Maximize2 as we, X as ye } from "lucide-vue-next";
|
|
4
|
+
import { u as ke, a as _e, b as Te } from "./index-c-pYJEmH.mjs";
|
|
5
|
+
import { _ as ze } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
6
|
+
import { T as Ce } from "./base.types-DaftHyg7.mjs";
|
|
7
|
+
const Se = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-center vfp-bg-surface-1 vfp-overflow-hidden" }, We = {
|
|
8
8
|
key: 1,
|
|
9
9
|
class: "vfp-absolute vfp-inset-0 vfp-renderer-loading vfp-z-10"
|
|
10
|
-
},
|
|
10
|
+
}, Me = { class: "vfp-renderer-loading-content" }, Ee = { class: "vfp-renderer-loading-text" }, $e = {
|
|
11
11
|
class: "vfp-flex vfp-items-center vfp-justify-between vfp-flex-shrink-0",
|
|
12
12
|
style: { padding: "12px 16px", "border-bottom": "1px solid rgba(255,255,255,0.1)" }
|
|
13
|
-
},
|
|
13
|
+
}, He = { style: { color: "white", "font-weight": "500", "font-size": "14px" } }, Re = {
|
|
14
14
|
class: "vfp-flex-1 vfp-overflow-y-auto",
|
|
15
15
|
style: { padding: "8px 4px" }
|
|
16
|
-
},
|
|
16
|
+
}, Le = ["title", "onClick", "onMouseenter", "onMouseleave"], Ae = ["title", "onClick", "onMouseenter", "onMouseleave"], Fe = 794, Ie = /* @__PURE__ */ ce({
|
|
17
17
|
__name: "index",
|
|
18
18
|
props: {
|
|
19
19
|
url: {}
|
|
20
20
|
},
|
|
21
|
-
setup(
|
|
22
|
-
const
|
|
23
|
-
|
|
21
|
+
setup(ee, { expose: te }) {
|
|
22
|
+
const C = ee, q = new Ce(), { t: v } = ke(), oe = _e(), G = Te(), g = d(1), w = d(1), r = d(null), M = d(!0), y = d(null), b = d(!1), x = d([]), s = d(!1), A = d("");
|
|
23
|
+
Y([g, w, b, s, () => x.value.length], () => {
|
|
24
24
|
q.notify();
|
|
25
25
|
});
|
|
26
26
|
let c = null, e = null, k = 0, _ = null;
|
|
27
|
-
const
|
|
27
|
+
const I = () => {
|
|
28
28
|
var t;
|
|
29
29
|
try {
|
|
30
30
|
(t = e == null ? void 0 : e.destroy) == null || t.call(e);
|
|
@@ -35,28 +35,28 @@ const ze = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
35
35
|
} catch {
|
|
36
36
|
}
|
|
37
37
|
e = null, c = null, k = 0, _ = null;
|
|
38
|
-
}, oe = () => {
|
|
39
|
-
e == null || e.prev();
|
|
40
38
|
}, ae = () => {
|
|
41
|
-
e == null || e.
|
|
39
|
+
e == null || e.prev();
|
|
42
40
|
}, re = () => {
|
|
41
|
+
e == null || e.next();
|
|
42
|
+
}, le = () => {
|
|
43
43
|
b.value = !b.value, setTimeout(() => {
|
|
44
44
|
r.value && e && (e.resize(r.value.offsetWidth, r.value.offsetHeight), _ && e.display(_), P());
|
|
45
45
|
}, 350);
|
|
46
|
-
},
|
|
46
|
+
}, ne = () => {
|
|
47
47
|
s.value = !s.value;
|
|
48
|
-
},
|
|
48
|
+
}, V = (t) => {
|
|
49
49
|
A.value = t, e == null || e.display(t), s.value = !1;
|
|
50
50
|
}, f = (t) => t === A.value;
|
|
51
|
-
|
|
51
|
+
te({
|
|
52
52
|
getToolbarGroups: () => [
|
|
53
53
|
{
|
|
54
54
|
items: [
|
|
55
55
|
{
|
|
56
56
|
type: "button",
|
|
57
|
-
icon:
|
|
57
|
+
icon: me,
|
|
58
58
|
tooltip: v.value("toolbar.toc"),
|
|
59
|
-
action:
|
|
59
|
+
action: ne,
|
|
60
60
|
disabled: x.value.length === 0,
|
|
61
61
|
active: s.value
|
|
62
62
|
}
|
|
@@ -66,9 +66,9 @@ const ze = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
66
66
|
items: [
|
|
67
67
|
{
|
|
68
68
|
type: "button",
|
|
69
|
-
icon:
|
|
69
|
+
icon: ge,
|
|
70
70
|
tooltip: v.value("toolbar.prev_page"),
|
|
71
|
-
action:
|
|
71
|
+
action: ae,
|
|
72
72
|
disabled: g.value <= 1
|
|
73
73
|
},
|
|
74
74
|
{
|
|
@@ -78,9 +78,9 @@ const ze = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
80
|
type: "button",
|
|
81
|
-
icon:
|
|
81
|
+
icon: be,
|
|
82
82
|
tooltip: v.value("toolbar.next_page"),
|
|
83
|
-
action:
|
|
83
|
+
action: re,
|
|
84
84
|
disabled: g.value >= w.value
|
|
85
85
|
}
|
|
86
86
|
]
|
|
@@ -89,9 +89,9 @@ const ze = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
89
89
|
items: [
|
|
90
90
|
{
|
|
91
91
|
type: "button",
|
|
92
|
-
icon: b.value ?
|
|
92
|
+
icon: b.value ? xe : we,
|
|
93
93
|
tooltip: b.value ? v.value("toolbar.normal_width") : v.value("toolbar.full_width"),
|
|
94
|
-
action:
|
|
94
|
+
action: le,
|
|
95
95
|
active: b.value
|
|
96
96
|
}
|
|
97
97
|
]
|
|
@@ -99,13 +99,13 @@ const ze = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
99
99
|
],
|
|
100
100
|
onToolbarChange: (t) => q.subscribe(t)
|
|
101
101
|
});
|
|
102
|
-
const
|
|
103
|
-
if (r.value) {
|
|
104
|
-
M.value = !0, y.value = null, x.value = [], s.value = !1, r.value.innerHTML = "",
|
|
102
|
+
const X = async () => {
|
|
103
|
+
if (G.begin(C.url), !!r.value) {
|
|
104
|
+
M.value = !0, y.value = null, x.value = [], s.value = !1, r.value.innerHTML = "", I();
|
|
105
105
|
try {
|
|
106
|
-
let t =
|
|
107
|
-
|
|
108
|
-
const l =
|
|
106
|
+
let t = C.url;
|
|
107
|
+
C.url.startsWith("blob:") && (t = await (await oe.value(C.url)).arrayBuffer());
|
|
108
|
+
const l = he(t);
|
|
109
109
|
c = l;
|
|
110
110
|
const o = new Promise((a, n) => {
|
|
111
111
|
l.on("openFailed", (i) => {
|
|
@@ -146,27 +146,27 @@ const ze = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
146
146
|
});
|
|
147
147
|
const T = await Promise.race([c.loaded.navigation, o]);
|
|
148
148
|
Array.isArray(T == null ? void 0 : T.toc) && (x.value = T.toc), await Promise.race([e.display(), o]), M.value = !1, g.value = 1, w.value = k || 1, e.on("relocated", (a) => {
|
|
149
|
-
var
|
|
149
|
+
var U, J, K;
|
|
150
150
|
const n = a;
|
|
151
|
-
if ((
|
|
152
|
-
const B = n.start.href, D = [],
|
|
153
|
-
for (const H of
|
|
151
|
+
if ((U = n == null ? void 0 : n.start) != null && U.cfi && (_ = n.start.cfi), (J = n == null ? void 0 : n.start) != null && J.href) {
|
|
152
|
+
const B = n.start.href, D = [], Q = (ue) => {
|
|
153
|
+
for (const H of ue) {
|
|
154
154
|
const R = H.href.split("#")[0];
|
|
155
|
-
R && (B === R || B.endsWith("/" + R) || B.endsWith(R)) && D.push(H.href), H.subitems &&
|
|
155
|
+
R && (B === R || B.endsWith("/" + R) || B.endsWith(R)) && D.push(H.href), H.subitems && Q(H.subitems);
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
|
-
|
|
158
|
+
Q(x.value), D.length === 1 && (A.value = D[0]);
|
|
159
159
|
}
|
|
160
|
-
const i = (
|
|
160
|
+
const i = (K = n == null ? void 0 : n.start) == null ? void 0 : K.location;
|
|
161
161
|
typeof i == "number" && k > 0 && (g.value = i + 1, w.value = k);
|
|
162
162
|
});
|
|
163
163
|
} catch (t) {
|
|
164
|
-
console.error(v.value("epub.load_failed") + ":", t), y.value = v.value("epub.load_failed"), M.value = !1;
|
|
164
|
+
console.error(v.value("epub.load_failed") + ":", t), y.value = v.value("epub.load_failed"), M.value = !1, G.error(t);
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
};
|
|
168
|
-
let E = null,
|
|
169
|
-
const
|
|
168
|
+
let E = null, S = null, $ = { width: 0, height: 0 }, j = !0;
|
|
169
|
+
const ie = () => {
|
|
170
170
|
if (!(!r.value || !e)) {
|
|
171
171
|
if (e.resize(r.value.offsetWidth, r.value.offsetHeight), _)
|
|
172
172
|
try {
|
|
@@ -175,15 +175,15 @@ const ze = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
175
175
|
}
|
|
176
176
|
P();
|
|
177
177
|
}
|
|
178
|
-
},
|
|
178
|
+
}, se = () => {
|
|
179
179
|
r.value && (E = new ResizeObserver(() => {
|
|
180
180
|
if (!r.value) return;
|
|
181
|
-
if (
|
|
182
|
-
|
|
181
|
+
if (j) {
|
|
182
|
+
j = !1, $ = { width: r.value.offsetWidth, height: r.value.offsetHeight };
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
185
|
const t = { width: r.value.offsetWidth, height: r.value.offsetHeight }, l = Math.abs($.width - t.width), o = Math.abs($.height - t.height);
|
|
186
|
-
l < 10 && o < 10 || ($ = t,
|
|
186
|
+
l < 10 && o < 10 || ($ = t, S !== null && clearTimeout(S), S = window.setTimeout(ie, 350));
|
|
187
187
|
}), E.observe(r.value));
|
|
188
188
|
};
|
|
189
189
|
let u = null;
|
|
@@ -205,24 +205,24 @@ const ze = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
205
205
|
};
|
|
206
206
|
requestAnimationFrame(t);
|
|
207
207
|
};
|
|
208
|
-
return
|
|
209
|
-
|
|
210
|
-
}),
|
|
211
|
-
t &&
|
|
212
|
-
}),
|
|
213
|
-
E && E.disconnect(),
|
|
214
|
-
}), (t, l) => (h(), m("div",
|
|
215
|
-
y.value ? (h(),
|
|
208
|
+
return fe(() => {
|
|
209
|
+
X(), se(), P();
|
|
210
|
+
}), Y(() => C.url, (t) => {
|
|
211
|
+
t && X();
|
|
212
|
+
}), pe(() => {
|
|
213
|
+
E && E.disconnect(), S !== null && clearTimeout(S), u == null || u.removeEventListener("scroll", F), I();
|
|
214
|
+
}), (t, l) => (h(), m("div", Se, [
|
|
215
|
+
y.value ? (h(), ve(ze, {
|
|
216
216
|
key: 0,
|
|
217
217
|
message: y.value,
|
|
218
218
|
class: "vfp-absolute vfp-inset-0"
|
|
219
|
-
}, null, 8, ["message"])) :
|
|
220
|
-
M.value && !y.value ? (h(), m("div",
|
|
221
|
-
p("div",
|
|
219
|
+
}, null, 8, ["message"])) : W("", !0),
|
|
220
|
+
M.value && !y.value ? (h(), m("div", We, [
|
|
221
|
+
p("div", Me, [
|
|
222
222
|
l[2] || (l[2] = p("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
223
|
-
p("span",
|
|
223
|
+
p("span", Ee, L(N(v)("common.loading")), 1)
|
|
224
224
|
])
|
|
225
|
-
])) :
|
|
225
|
+
])) : W("", !0),
|
|
226
226
|
x.value.length > 0 ? (h(), m("div", {
|
|
227
227
|
key: 2,
|
|
228
228
|
class: "vfp-absolute vfp-inset-0 vfp-z-20 vfp-flex",
|
|
@@ -240,17 +240,17 @@ const ze = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
240
240
|
transition: "transform 0.3s ease"
|
|
241
241
|
})
|
|
242
242
|
}, [
|
|
243
|
-
p("div",
|
|
244
|
-
p("span",
|
|
243
|
+
p("div", $e, [
|
|
244
|
+
p("span", He, L(N(v)("toolbar.toc")), 1),
|
|
245
245
|
p("button", {
|
|
246
246
|
style: { color: "rgba(255,255,255,0.6)", background: "none", border: "none", cursor: "pointer", padding: "4px" },
|
|
247
247
|
onClick: l[0] || (l[0] = (o) => s.value = !1)
|
|
248
248
|
}, [
|
|
249
|
-
|
|
249
|
+
de(N(ye), { style: { width: "16px", height: "16px" } })
|
|
250
250
|
])
|
|
251
251
|
]),
|
|
252
|
-
p("div",
|
|
253
|
-
(h(!0), m(O, null,
|
|
252
|
+
p("div", Re, [
|
|
253
|
+
(h(!0), m(O, null, Z(x.value, (o, T) => (h(), m(O, {
|
|
254
254
|
key: `${o.href}-${T}`
|
|
255
255
|
}, [
|
|
256
256
|
p("button", {
|
|
@@ -272,11 +272,11 @@ const ze = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
272
272
|
transition: "all 0.15s"
|
|
273
273
|
}),
|
|
274
274
|
title: o.label,
|
|
275
|
-
onClick: (a) =>
|
|
275
|
+
onClick: (a) => V(o.href),
|
|
276
276
|
onMouseenter: (a) => !f(o.href) && (a.target.style.background = "rgba(255,255,255,0.1)"),
|
|
277
277
|
onMouseleave: (a) => !f(o.href) && (a.target.style.background = "none")
|
|
278
|
-
}, L(o.label.trim()), 45,
|
|
279
|
-
o.subitems && o.subitems.length > 0 ? (h(!0), m(O, { key: 0 },
|
|
278
|
+
}, L(o.label.trim()), 45, Le),
|
|
279
|
+
o.subitems && o.subitems.length > 0 ? (h(!0), m(O, { key: 0 }, Z(o.subitems, (a, n) => (h(), m("button", {
|
|
280
280
|
key: `${a.href}-${n}`,
|
|
281
281
|
style: z({
|
|
282
282
|
width: "100%",
|
|
@@ -296,10 +296,10 @@ const ze = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
296
296
|
transition: "all 0.15s"
|
|
297
297
|
}),
|
|
298
298
|
title: a.label,
|
|
299
|
-
onClick: (i) =>
|
|
299
|
+
onClick: (i) => V(a.href),
|
|
300
300
|
onMouseenter: (i) => !f(a.href) && (i.target.style.background = "rgba(255,255,255,0.1)"),
|
|
301
301
|
onMouseleave: (i) => !f(a.href) && (i.target.style.background = "none")
|
|
302
|
-
}, L(a.label.trim()), 45,
|
|
302
|
+
}, L(a.label.trim()), 45, Ae))), 128)) : W("", !0)
|
|
303
303
|
], 64))), 128))
|
|
304
304
|
])
|
|
305
305
|
], 4),
|
|
@@ -308,14 +308,14 @@ const ze = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
308
308
|
style: z({ background: s.value ? "rgba(0,0,0,0.3)" : "transparent", transition: "background 0.3s" }),
|
|
309
309
|
onClick: l[1] || (l[1] = (o) => s.value = !1)
|
|
310
310
|
}, null, 4)
|
|
311
|
-
], 4)) :
|
|
312
|
-
y.value ?
|
|
311
|
+
], 4)) : W("", !0),
|
|
312
|
+
y.value ? W("", !0) : (h(), m("div", {
|
|
313
313
|
key: 3,
|
|
314
314
|
ref_key: "viewerRef",
|
|
315
315
|
ref: r,
|
|
316
316
|
class: "vfp-h-full vfp-bg-surface-toolbar",
|
|
317
317
|
style: z({
|
|
318
|
-
width: b.value ? "100%" : `${
|
|
318
|
+
width: b.value ? "100%" : `${Fe}px`,
|
|
319
319
|
maxWidth: "100%",
|
|
320
320
|
transition: "width 0.3s ease",
|
|
321
321
|
boxShadow: "0 1px 3px rgba(0,0,0,0.12)",
|
|
@@ -326,5 +326,5 @@ const ze = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
326
326
|
}
|
|
327
327
|
});
|
|
328
328
|
export {
|
|
329
|
-
|
|
329
|
+
Ie as default
|
|
330
330
|
};
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { defineComponent as h, ref 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 j, unref as D, createCommentVNode as P } from "vue";
|
|
2
|
+
import B from "video.js";
|
|
3
|
+
import { u as N, b as R, j as y } from "./index-c-pYJEmH.mjs";
|
|
4
|
+
import { _ as S } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
5
|
+
const U = {
|
|
6
6
|
key: 1,
|
|
7
7
|
class: "vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"
|
|
8
|
-
},
|
|
8
|
+
}, V = { 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({
|
|
12
12
|
__name: "index",
|
|
13
13
|
props: {
|
|
14
14
|
url: {},
|
|
15
15
|
fileName: {},
|
|
16
16
|
mimeType: {}
|
|
17
17
|
},
|
|
18
|
-
setup(
|
|
19
|
-
const o =
|
|
18
|
+
setup(g, { expose: k }) {
|
|
19
|
+
const o = g, { t } = N(), d = R(), T = /* @__PURE__ */ new Set(["avi", "wmv", "flv"]), i = c(null), u = c(!0), p = c(null);
|
|
20
20
|
let e = null;
|
|
21
|
-
const
|
|
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 (
|
|
27
|
-
const s =
|
|
28
|
-
if (
|
|
26
|
+
if (d.begin(o.url), !p.value || e) return;
|
|
27
|
+
const s = b(o.url, o.fileName);
|
|
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() })
|
|
@@ -33,13 +33,13 @@ const S = {
|
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
const r = document.createElement("video-js");
|
|
36
|
-
r.classList.add("vjs-big-play-centered", "rfp-video-player"),
|
|
37
|
-
const
|
|
36
|
+
r.classList.add("vjs-big-play-centered", "rfp-video-player"), p.value.appendChild(r);
|
|
37
|
+
const v = y(o.url, o.mimeType);
|
|
38
38
|
let n;
|
|
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:
|
|
42
|
+
] : n = [{ src: o.url, type: v }], e = B(r, {
|
|
43
43
|
controls: !0,
|
|
44
44
|
fill: !0,
|
|
45
45
|
preload: "auto",
|
|
@@ -67,8 +67,8 @@ const S = {
|
|
|
67
67
|
},
|
|
68
68
|
sources: n
|
|
69
69
|
});
|
|
70
|
-
const
|
|
71
|
-
|
|
70
|
+
const m = e.el().querySelector("video");
|
|
71
|
+
m && (m.style.objectFit = "contain"), e.on("loadeddata", () => {
|
|
72
72
|
u.value = !1;
|
|
73
73
|
}), e.on("error", () => {
|
|
74
74
|
const l = e == null ? void 0 : e.error();
|
|
@@ -80,32 +80,32 @@ const S = {
|
|
|
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
|
-
}, u.value = !1;
|
|
83
|
+
}, u.value = !1, d.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
|
-
e && !e.isDisposed() && e.src({ src: o.url, type: y(o.url, o.mimeType) });
|
|
88
|
+
d.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 ? (
|
|
94
|
+
}), (s, r) => i.value ? (f(), C(S, {
|
|
95
95
|
key: 0,
|
|
96
96
|
message: i.value.title,
|
|
97
97
|
detail: i.value.detail
|
|
98
|
-
}, null, 8, ["message", "detail"])) : (
|
|
99
|
-
a("div",
|
|
100
|
-
u.value ? (
|
|
101
|
-
a("div",
|
|
98
|
+
}, null, 8, ["message", "detail"])) : (f(), _("div", U, [
|
|
99
|
+
a("div", V, [
|
|
100
|
+
u.value ? (f(), _("div", q, [
|
|
101
|
+
a("div", L, [
|
|
102
102
|
r[0] || (r[0] = a("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
103
|
-
a("p",
|
|
103
|
+
a("p", G, j(D(t)("video.loading")), 1)
|
|
104
104
|
])
|
|
105
|
-
])) :
|
|
105
|
+
])) : P("", !0),
|
|
106
106
|
a("div", {
|
|
107
107
|
ref_key: "videoContainerRef",
|
|
108
|
-
ref:
|
|
108
|
+
ref: p,
|
|
109
109
|
class: "vfp-overflow-hidden vfp-w-full vfp-h-full",
|
|
110
110
|
style: { "box-shadow": "0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05)" }
|
|
111
111
|
}, null, 512)
|
|
@@ -114,5 +114,5 @@ const S = {
|
|
|
114
114
|
}
|
|
115
115
|
});
|
|
116
116
|
export {
|
|
117
|
-
|
|
117
|
+
X as default
|
|
118
118
|
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { defineComponent as N, ref as v, onMounted as q, watch as A, onBeforeUnmount as I, computed as O, openBlock as p, createElementBlock as h, createElementVNode as E, toDisplayString as S, unref as R, createCommentVNode as b, createVNode as z, normalizeStyle as $ } from "vue";
|
|
2
|
+
import { u as G, a as J, b as U, s as j, J as k, V as K, p as Q } from "./index-c-pYJEmH.mjs";
|
|
3
|
+
import { init as D } from "pptx-preview";
|
|
4
|
+
import { _ as X } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
5
|
+
import { _ as Y } from "./EmptyState.vue_vue_type_script_setup_true_lang--ZOobbGi.mjs";
|
|
6
|
+
const Z = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full" }, ee = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "vfp-renderer-overlay vfp-renderer-loading"
|
|
9
|
+
}, te = { class: "vfp-renderer-loading-content" }, re = { class: "vfp-renderer-loading-text" }, ie = {
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "vfp-renderer-overlay"
|
|
12
|
+
}, le = {
|
|
13
|
+
key: 2,
|
|
14
|
+
class: "vfp-renderer-overlay"
|
|
15
|
+
}, de = /* @__PURE__ */ N({
|
|
16
|
+
__name: "index",
|
|
17
|
+
props: {
|
|
18
|
+
url: {},
|
|
19
|
+
tiled: { type: Boolean, default: !0 },
|
|
20
|
+
emptyHint: {}
|
|
21
|
+
},
|
|
22
|
+
setup(H, { expose: V }) {
|
|
23
|
+
const o = H, { t: s } = G(), W = J(), M = U(), n = v(!0), u = v(null), m = v(!1), w = v(0), i = v(null);
|
|
24
|
+
let l = null, y = null, c = null, f = null, _ = { width: 0, height: 0 }, B = 9 / 16;
|
|
25
|
+
const g = () => {
|
|
26
|
+
var d;
|
|
27
|
+
if (!i.value) return { width: 960, height: 540 };
|
|
28
|
+
const t = i.value.clientWidth, e = ((d = i.value.parentElement) == null ? void 0 : d.clientWidth) || 0, r = t > 100 ? t : e > 100 ? e : 300, a = Math.floor(r * B);
|
|
29
|
+
return { width: r, height: a };
|
|
30
|
+
}, P = async () => {
|
|
31
|
+
if (!(!i.value || !c || w.value === 0))
|
|
32
|
+
try {
|
|
33
|
+
if (l)
|
|
34
|
+
try {
|
|
35
|
+
l.destroy();
|
|
36
|
+
} catch {
|
|
37
|
+
}
|
|
38
|
+
i.value.innerHTML = "";
|
|
39
|
+
const t = g();
|
|
40
|
+
l = D(i.value, {
|
|
41
|
+
width: t.width,
|
|
42
|
+
height: o.tiled ? t.height * w.value : t.height,
|
|
43
|
+
mode: o.tiled ? "list" : "slide"
|
|
44
|
+
}), await l.preview(c);
|
|
45
|
+
} catch {
|
|
46
|
+
}
|
|
47
|
+
}, C = async () => {
|
|
48
|
+
if (M.begin(o.url), !i.value) return;
|
|
49
|
+
n.value = !0, u.value = null, m.value = !1;
|
|
50
|
+
let t = window.setTimeout(() => {
|
|
51
|
+
u.value = s.value("pptx.timeout"), n.value = !1;
|
|
52
|
+
}, 3e4);
|
|
53
|
+
try {
|
|
54
|
+
const e = await W.value(o.url, {
|
|
55
|
+
mode: "cors",
|
|
56
|
+
credentials: "omit",
|
|
57
|
+
redirect: "follow"
|
|
58
|
+
});
|
|
59
|
+
if (!e.ok)
|
|
60
|
+
throw e.status === 404 ? new Error(s.value("pptx.not_found")) : e.status === 403 ? new k("file.forbidden") : e.status >= 500 ? new k("file.server_error") : new k("file.load_failed_status", { status: e.status });
|
|
61
|
+
const r = await e.arrayBuffer();
|
|
62
|
+
if (r.byteLength === 0) {
|
|
63
|
+
t !== null && clearTimeout(t), m.value = !0, n.value = !1;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
c = r, B = (await K(r)).ratio;
|
|
67
|
+
const a = document.createElement("div");
|
|
68
|
+
a.style.cssText = "position:absolute;left:-9999px;top:-9999px;visibility:hidden", document.body.appendChild(a);
|
|
69
|
+
try {
|
|
70
|
+
const d = D(a, {
|
|
71
|
+
width: 100,
|
|
72
|
+
height: 100,
|
|
73
|
+
mode: "slide"
|
|
74
|
+
});
|
|
75
|
+
try {
|
|
76
|
+
await d.preview(r);
|
|
77
|
+
} catch {
|
|
78
|
+
throw new Error(s.value("pptx.invalid_format"));
|
|
79
|
+
}
|
|
80
|
+
const x = d.slideCount;
|
|
81
|
+
if (!x || x === 0) throw new Error(s.value("pptx.no_pages"));
|
|
82
|
+
d.destroy(), w.value = x, i.value && (i.value.innerHTML = "");
|
|
83
|
+
const T = g();
|
|
84
|
+
l = D(i.value, {
|
|
85
|
+
width: T.width,
|
|
86
|
+
height: o.tiled ? T.height * x : T.height,
|
|
87
|
+
mode: o.tiled ? "list" : "slide"
|
|
88
|
+
}), await l.preview(r), t !== null && (clearTimeout(t), t = null), n.value = !1;
|
|
89
|
+
} finally {
|
|
90
|
+
document.body.contains(a) && document.body.removeChild(a);
|
|
91
|
+
}
|
|
92
|
+
} catch (e) {
|
|
93
|
+
t !== null && clearTimeout(t);
|
|
94
|
+
let r = s.value("pptx.parse_failed");
|
|
95
|
+
e instanceof Error ? r = Q(s.value, e) : typeof e == "string" && (r = e), u.value = r, n.value = !1, M.error(e);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
q(() => {
|
|
99
|
+
if (!i.value) return;
|
|
100
|
+
let t = !0;
|
|
101
|
+
y = new ResizeObserver(() => {
|
|
102
|
+
if (t) {
|
|
103
|
+
t = !1, _ = g();
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const e = g(), r = Math.abs(_.width - e.width), a = Math.abs(_.height - e.height);
|
|
107
|
+
r < 10 && a < 10 || (_ = e, f !== null && clearTimeout(f), f = window.setTimeout(() => {
|
|
108
|
+
l && c && P();
|
|
109
|
+
}, 800));
|
|
110
|
+
}), y.observe(i.value), setTimeout(() => {
|
|
111
|
+
requestAnimationFrame(() => requestAnimationFrame(() => C()));
|
|
112
|
+
}, 150);
|
|
113
|
+
}), A(
|
|
114
|
+
() => o.url,
|
|
115
|
+
(t) => {
|
|
116
|
+
t && C();
|
|
117
|
+
}
|
|
118
|
+
), I(() => {
|
|
119
|
+
if (y && y.disconnect(), f !== null && clearTimeout(f), c = null, w.value = 0, l)
|
|
120
|
+
try {
|
|
121
|
+
l.destroy();
|
|
122
|
+
} catch {
|
|
123
|
+
}
|
|
124
|
+
l = null;
|
|
125
|
+
});
|
|
126
|
+
const F = () => [], L = O(() => j(o.emptyHint, "structured"));
|
|
127
|
+
return V({
|
|
128
|
+
getToolbarGroups: F
|
|
129
|
+
}), (t, e) => (p(), h("div", Z, [
|
|
130
|
+
n.value ? (p(), h("div", ee, [
|
|
131
|
+
E("div", te, [
|
|
132
|
+
e[0] || (e[0] = E("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
133
|
+
E("p", re, S(R(s)("pptx.loading")), 1)
|
|
134
|
+
])
|
|
135
|
+
])) : b("", !0),
|
|
136
|
+
m.value && !n.value && L.value ? (p(), h("div", ie, [
|
|
137
|
+
z(Y)
|
|
138
|
+
])) : b("", !0),
|
|
139
|
+
u.value && !n.value ? (p(), h("div", le, [
|
|
140
|
+
z(X, {
|
|
141
|
+
message: R(s)("pptx.load_failed"),
|
|
142
|
+
detail: u.value
|
|
143
|
+
}, null, 8, ["message", "detail"])
|
|
144
|
+
])) : b("", !0),
|
|
145
|
+
u.value ? b("", !0) : (p(), h("div", {
|
|
146
|
+
key: 3,
|
|
147
|
+
ref_key: "containerRef",
|
|
148
|
+
ref: i,
|
|
149
|
+
class: "pptx-wrapper vfp-w-full vfp-max-w-full md:vfp-max-w-6xl",
|
|
150
|
+
style: $({ opacity: n.value || m.value ? 0 : 1 })
|
|
151
|
+
}, null, 4))
|
|
152
|
+
]));
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
export {
|
|
156
|
+
de as default
|
|
157
|
+
};
|