@eternalheart/vue-file-preview 1.6.11 → 1.6.13
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 +4 -1
- package/lib/FilePreviewModal.vue.d.ts +4 -1
- package/lib/chunks/EmptyState.vue_vue_type_script_setup_true_lang-C7qk6wj0.mjs +20 -0
- package/lib/chunks/RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs +32 -0
- package/lib/chunks/{avifLoader-CAUzjn-d-Bv80osgL.mjs → avifLoader-CAUzjn-d-C0KRpetN.mjs} +1 -1
- package/lib/chunks/{heicLoader-D_9PukkA-c40agcEu.mjs → heicLoader-D_9PukkA-Czof_5FJ.mjs} +1 -1
- package/lib/chunks/{index-CO713RPO.mjs → index--612Smof.mjs} +118 -118
- package/lib/chunks/{index-Dw6YZA28.mjs → index-8Vpbg2kS.mjs} +2 -2
- package/lib/chunks/index-B21EAyWz.mjs +137 -0
- package/lib/chunks/{index-CrLeFRdr.mjs → index-BASg1cr4.mjs} +2 -2
- package/lib/chunks/index-BB0i4QqI.mjs +117 -0
- package/lib/chunks/{index-C92b547K.mjs → index-BVdrGK3Q.mjs} +80 -80
- package/lib/chunks/index-BlrFFeqc.mjs +330 -0
- package/lib/chunks/index-Bp9CuvMZ.mjs +157 -0
- package/lib/chunks/index-BuqPb5mP.mjs +306 -0
- package/lib/chunks/{index-Df-1MbYj.mjs → index-BvBqDq3O.mjs} +2 -2
- package/lib/chunks/{index-BkqPtbFz.mjs → index-Bxpf9v5j.mjs} +29 -29
- package/lib/chunks/{index-DpY9eMSI.mjs → index-C9mAajbD.mjs} +231 -226
- package/lib/chunks/{index-DTZVumT8.mjs → index-CDg6vIbT.mjs} +14 -14
- package/lib/chunks/{index-By8q8XPn.mjs → index-CWE-hKSs.mjs} +10 -10
- package/lib/chunks/{index-DbOpSm8f.mjs → index-CY3xzGgt.mjs} +19 -19
- package/lib/chunks/{index-C8pOqpTq.mjs → index-CxKZKUJj.mjs} +521 -523
- package/lib/chunks/{index-Cyg4lWK-.mjs → index-D30L8tm9.mjs} +12 -12
- package/lib/chunks/{index-DfC_cA90.mjs → index-DN4Ui0Gh.mjs} +24 -24
- package/lib/chunks/{index-B3uQ1OoT.mjs → index-DZZN3kYi.mjs} +832 -812
- package/lib/chunks/{index-BpKvjFVp.mjs → index-Dkro_8Fy.mjs} +20 -20
- package/lib/chunks/{index-B35jLxPz.mjs → index-VdzIFJJW.mjs} +26 -26
- package/lib/chunks/{index--D2MwF_x.mjs → index-aoXgVLBb.mjs} +10 -10
- package/lib/chunks/{jp2Loader-Dig19xyo-82PXw2fC.mjs → jp2Loader-Dig19xyo-CKUaGhPl.mjs} +1 -1
- package/lib/chunks/{psdLoader-C0tKUXXl-DRn7RYLA.mjs → psdLoader-C0tKUXXl-CYWoQis5.mjs} +1 -1
- package/lib/chunks/{rawLoader-C-tPeFAB-DP397Cnq.mjs → rawLoader-C-tPeFAB-C35zC8nZ.mjs} +1 -1
- package/lib/chunks/{tiffLoader-BlhByX8w-BC52z4Tf.mjs → tiffLoader-BlhByX8w-BOxg_Du5.mjs} +1 -1
- package/lib/chunks/{useShikiHighlight-DSyCygls.mjs → useShikiHighlight-BPmcxA-h.mjs} +1 -1
- package/lib/index.cjs +63 -63
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.mjs +6 -6
- package/lib/renderers/Cad/toolbar.d.ts +1 -0
- package/lib/renderers/EmptyState.vue.d.ts +2 -0
- package/lib/renderers/Json/index.vue.d.ts +5 -0
- package/lib/renderers/Pptx/index.vue.d.ts +3 -0
- package/lib/renderers/Text/index.vue.d.ts +3 -0
- package/lib/renderers/Xlsx/index.vue.d.ts +3 -0
- package/lib/renderers/registry.d.ts +3 -1
- package/package.json +1 -1
- package/lib/chunks/RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs +0 -30
- package/lib/chunks/index-2xdBoG-I.mjs +0 -141
- package/lib/chunks/index-B2xLxhp0.mjs +0 -133
- package/lib/chunks/index-DKJ_iQ70.mjs +0 -295
- package/lib/chunks/index-DMwZXKa4.mjs +0 -322
- package/lib/chunks/index-DyP3rhuf.mjs +0 -113
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { u as w,
|
|
3
|
-
import { _ as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as m, ref as n, watch as _, openBlock as c, createElementBlock as p, createElementVNode as r, toDisplayString as g, unref as h, createBlock as y } from "vue";
|
|
2
|
+
import { u as w, c as k, k as x, B } from "./index-DZZN3kYi.mjs";
|
|
3
|
+
import { _ as T } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
4
|
+
const b = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "vfp-renderer-loading"
|
|
7
7
|
}, E = { class: "vfp-renderer-loading-content" }, G = { class: "vfp-renderer-loading-text" }, H = {
|
|
8
8
|
key: 2,
|
|
9
9
|
class: "vfp-w-full vfp-h-full vfp-overflow-auto vfp-py-6 vfp-px-4"
|
|
10
|
-
},
|
|
10
|
+
}, L = ["innerHTML"], N = /* @__PURE__ */ m({
|
|
11
11
|
__name: "index",
|
|
12
12
|
props: {
|
|
13
13
|
url: {}
|
|
14
14
|
},
|
|
15
15
|
setup(u, { expose: f }) {
|
|
16
|
-
const
|
|
16
|
+
const i = u, { t: l } = w(), d = k(), t = n(""), s = n(!0), a = n(null), v = async () => {
|
|
17
17
|
s.value = !0, a.value = null, t.value = "";
|
|
18
18
|
try {
|
|
19
|
-
const e = await d.value(
|
|
19
|
+
const e = await d.value(i.url);
|
|
20
20
|
if (!e.ok) throw new x("file.load_failed");
|
|
21
21
|
const o = await e.arrayBuffer();
|
|
22
|
-
t.value = await
|
|
22
|
+
t.value = await B(o);
|
|
23
23
|
} catch (e) {
|
|
24
24
|
console.error(l.value("ppt.parse_failed") + ":", e), a.value = l.value("ppt.parse_failed");
|
|
25
25
|
} finally {
|
|
26
26
|
s.value = !1;
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
return
|
|
29
|
+
return _(() => i.url, (e) => {
|
|
30
30
|
e && v();
|
|
31
31
|
}, { immediate: !0 }), f({
|
|
32
32
|
getToolbarGroups: () => []
|
|
33
|
-
}), (e, o) => s.value ? (
|
|
33
|
+
}), (e, o) => s.value ? (c(), p("div", b, [
|
|
34
34
|
r("div", E, [
|
|
35
35
|
o[0] || (o[0] = r("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
36
36
|
r("span", G, g(h(l)("common.loading")), 1)
|
|
37
37
|
])
|
|
38
|
-
])) : a.value ? (
|
|
38
|
+
])) : a.value ? (c(), y(T, {
|
|
39
39
|
key: 1,
|
|
40
40
|
message: a.value
|
|
41
|
-
}, null, 8, ["message"])) : (
|
|
41
|
+
}, null, 8, ["message"])) : (c(), p("div", H, [
|
|
42
42
|
r("div", {
|
|
43
43
|
class: "vfp-legacy-ppt-wrap",
|
|
44
44
|
innerHTML: t.value
|
|
45
|
-
}, null, 8,
|
|
45
|
+
}, null, 8, L)
|
|
46
46
|
]));
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
export {
|
|
50
|
-
|
|
50
|
+
N as default
|
|
51
51
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as L, ref as u, watch as M, computed as
|
|
2
|
-
import { u as
|
|
3
|
-
import { u as
|
|
4
|
-
import { _ as E } from "./RendererError.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { defineComponent as L, ref as u, watch as M, computed as X, openBlock as l, createElementBlock as a, createElementVNode as r, toDisplayString as d, unref as v, createBlock as D, normalizeStyle as H, Fragment as w, renderList as B } from "vue";
|
|
2
|
+
import { u as F, c as G, X as N } from "./index-DZZN3kYi.mjs";
|
|
3
|
+
import { u as P } from "./useShikiHighlight-BPmcxA-h.mjs";
|
|
4
|
+
import { _ as E } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
5
5
|
const j = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "vfp-renderer-loading"
|
|
@@ -20,7 +20,7 @@ const j = {
|
|
|
20
20
|
fileName: {}
|
|
21
21
|
},
|
|
22
22
|
setup(k, { expose: x }) {
|
|
23
|
-
const m = k, { t: g } =
|
|
23
|
+
const m = k, { t: g } = F(), b = G(), i = u(""), f = u(!0), c = u(null), S = u("xml"), { lineHtmls: _ } = P(i, S), T = (e) => {
|
|
24
24
|
const t = " ", o = /(>)(<)(\/*)/g, s = e.replace(o, `$1
|
|
25
25
|
$2$3`);
|
|
26
26
|
let n = 0;
|
|
@@ -45,7 +45,7 @@ $2$3`);
|
|
|
45
45
|
M(() => m.url, async () => {
|
|
46
46
|
f.value = !0, c.value = null;
|
|
47
47
|
try {
|
|
48
|
-
const e = await
|
|
48
|
+
const e = await N(m.url, { fetcher: b.value });
|
|
49
49
|
i.value = $(e);
|
|
50
50
|
} catch (e) {
|
|
51
51
|
console.error(e), c.value = g.value("xml.load_failed");
|
|
@@ -53,7 +53,7 @@ $2$3`);
|
|
|
53
53
|
f.value = !1;
|
|
54
54
|
}
|
|
55
55
|
}, { immediate: !0 });
|
|
56
|
-
const h =
|
|
56
|
+
const h = X(() => i.value.split(`
|
|
57
57
|
`));
|
|
58
58
|
return x({
|
|
59
59
|
getToolbarGroups: () => []
|
|
@@ -62,7 +62,7 @@ $2$3`);
|
|
|
62
62
|
t[0] || (t[0] = r("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
63
63
|
r("span", A, d(v(g)("common.loading")), 1)
|
|
64
64
|
])
|
|
65
|
-
])) : c.value ? (l(),
|
|
65
|
+
])) : c.value ? (l(), D(E, {
|
|
66
66
|
key: 1,
|
|
67
67
|
message: c.value
|
|
68
68
|
}, null, 8, ["message"])) : v(_).length === 0 ? (l(), a("div", C, [
|
|
@@ -70,9 +70,9 @@ $2$3`);
|
|
|
70
70
|
])) : (l(), a("div", O, [
|
|
71
71
|
r("div", {
|
|
72
72
|
class: "vfp-code-block with-line-numbers vfp-w-full",
|
|
73
|
-
style:
|
|
73
|
+
style: H({ gridTemplateRows: `repeat(${h.value.length}, auto) minmax(1.5rem, 1fr)` })
|
|
74
74
|
}, [
|
|
75
|
-
(l(!0), a(w, null,
|
|
75
|
+
(l(!0), a(w, null, B(h.value, (o, s) => (l(), a(w, { key: s }, [
|
|
76
76
|
r("span", R, d(s + 1), 1),
|
|
77
77
|
r("span", {
|
|
78
78
|
class: "vfp-code-line",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as M, ref as l, watch as y, nextTick as $, computed as
|
|
2
|
-
import { u as R,
|
|
1
|
+
import { defineComponent as M, ref as l, watch as y, nextTick as $, computed as k, openBlock as i, createElementBlock as p, createElementVNode as r, toDisplayString as B, unref as F, createBlock as N, normalizeStyle as d, Fragment as I, renderList as C } from "vue";
|
|
2
|
+
import { u as R, c as j, L as q, k as z, d as O, F as U } from "./index-DZZN3kYi.mjs";
|
|
3
3
|
import V from "mammoth";
|
|
4
|
-
import { _ as W } from "./RendererError.vue_vue_type_script_setup_true_lang-
|
|
4
|
+
import { _ as W } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
5
5
|
const X = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "vfp-renderer-loading"
|
|
@@ -9,13 +9,13 @@ const X = {
|
|
|
9
9
|
key: 2,
|
|
10
10
|
class: "vfp-docx-container vfp-w-full vfp-h-full vfp-overflow-auto",
|
|
11
11
|
style: { background: "rgba(0, 0, 0, 0.15)" }
|
|
12
|
-
}, Q = ["innerHTML"], Z = ["innerHTML"],
|
|
12
|
+
}, Q = ["innerHTML"], Z = ["innerHTML"], T = 1123, w = 60, b = 50, ee = 24, re = /* @__PURE__ */ M({
|
|
13
13
|
__name: "index",
|
|
14
14
|
props: {
|
|
15
15
|
url: {}
|
|
16
16
|
},
|
|
17
|
-
setup(
|
|
18
|
-
const E =
|
|
17
|
+
setup(G, { expose: H }) {
|
|
18
|
+
const E = T - w * 2, h = G, { t: f } = R(), A = j(), a = l(""), v = l(!0), c = l(null), s = l([]), m = l({}), _ = l(null), P = async () => {
|
|
19
19
|
v.value = !0, c.value = null, a.value = "", s.value = [], m.value = {};
|
|
20
20
|
try {
|
|
21
21
|
const e = await A.value(h.url);
|
|
@@ -30,7 +30,7 @@ const X = {
|
|
|
30
30
|
} finally {
|
|
31
31
|
v.value = !1;
|
|
32
32
|
}
|
|
33
|
-
},
|
|
33
|
+
}, L = () => {
|
|
34
34
|
const e = _.value;
|
|
35
35
|
if (!e || !a.value) return;
|
|
36
36
|
const n = Array.from(e.children);
|
|
@@ -49,48 +49,48 @@ const X = {
|
|
|
49
49
|
y(() => h.url, (e) => {
|
|
50
50
|
e && P();
|
|
51
51
|
}, { immediate: !0 }), y(a, async () => {
|
|
52
|
-
a.value && (await $(), requestAnimationFrame(() =>
|
|
52
|
+
a.value && (await $(), requestAnimationFrame(() => L()));
|
|
53
53
|
});
|
|
54
|
-
const g =
|
|
54
|
+
const g = k(() => q(m.value)), S = k(() => ({
|
|
55
55
|
...g.value,
|
|
56
56
|
position: "absolute",
|
|
57
57
|
visibility: "hidden",
|
|
58
|
-
width: `${794 -
|
|
58
|
+
width: `${794 - b * 2}px`,
|
|
59
59
|
pointerEvents: "none"
|
|
60
|
-
})),
|
|
60
|
+
})), D = {
|
|
61
61
|
width: "100%",
|
|
62
62
|
maxWidth: "794px",
|
|
63
|
-
minHeight: `${
|
|
63
|
+
minHeight: `${T}px`,
|
|
64
64
|
background: "white",
|
|
65
65
|
boxShadow: "0 2px 12px rgba(0, 0, 0, 0.15)",
|
|
66
66
|
flexShrink: 0,
|
|
67
|
-
padding: `${w}px ${
|
|
67
|
+
padding: `${w}px ${b}px`
|
|
68
68
|
};
|
|
69
|
-
return
|
|
69
|
+
return H({
|
|
70
70
|
getToolbarGroups: () => []
|
|
71
71
|
}), (e, n) => v.value ? (i(), p("div", X, [
|
|
72
72
|
r("div", Y, [
|
|
73
73
|
n[0] || (n[0] = r("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
74
|
-
r("span", J, B(
|
|
74
|
+
r("span", J, B(F(f)("common.loading")), 1)
|
|
75
75
|
])
|
|
76
|
-
])) : c.value ? (i(),
|
|
76
|
+
])) : c.value ? (i(), N(W, {
|
|
77
77
|
key: 1,
|
|
78
78
|
message: c.value
|
|
79
79
|
}, null, 8, ["message"])) : (i(), p("div", K, [
|
|
80
80
|
r("div", {
|
|
81
81
|
ref_key: "measureRef",
|
|
82
82
|
ref: _,
|
|
83
|
-
style: d(
|
|
83
|
+
style: d(S.value),
|
|
84
84
|
innerHTML: a.value
|
|
85
85
|
}, null, 12, Q),
|
|
86
86
|
r("div", {
|
|
87
87
|
class: "vfp-flex vfp-flex-col vfp-items-center",
|
|
88
88
|
style: d({ gap: `${ee}px` })
|
|
89
89
|
}, [
|
|
90
|
-
(i(!0), p(
|
|
90
|
+
(i(!0), p(I, null, C(s.value.length > 0 ? s.value : [""], (t, o) => (i(), p("div", {
|
|
91
91
|
key: o,
|
|
92
92
|
style: d({
|
|
93
|
-
...
|
|
93
|
+
...D,
|
|
94
94
|
boxShadow: "0 4px 6px rgba(0, 0, 0, 0.07), 0 10px 20px rgba(0, 0, 0, 0.10)"
|
|
95
95
|
})
|
|
96
96
|
}, [
|