@eternalheart/vue-file-preview 1.6.12 → 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-CTy7cevh.mjs → avifLoader-CAUzjn-d-C0KRpetN.mjs} +1 -1
- package/lib/chunks/{heicLoader-D_9PukkA-DdDu94xL.mjs → heicLoader-D_9PukkA-Czof_5FJ.mjs} +1 -1
- package/lib/chunks/{index-CLM9sOKN.mjs → index--612Smof.mjs} +112 -112
- package/lib/chunks/{index-De-oaCgN.mjs → index-8Vpbg2kS.mjs} +2 -2
- package/lib/chunks/{index-2VQLB2Mi.mjs → index-B21EAyWz.mjs} +53 -49
- package/lib/chunks/{index-DmEMePjL.mjs → index-BASg1cr4.mjs} +2 -2
- package/lib/chunks/index-BB0i4QqI.mjs +117 -0
- package/lib/chunks/{index-Bmqn45d_.mjs → index-BVdrGK3Q.mjs} +72 -72
- package/lib/chunks/index-BlrFFeqc.mjs +330 -0
- package/lib/chunks/index-Bp9CuvMZ.mjs +157 -0
- package/lib/chunks/{index-i-KacQvS.mjs → index-BuqPb5mP.mjs} +3 -3
- package/lib/chunks/{index-DVG1fZAv.mjs → index-BvBqDq3O.mjs} +2 -2
- package/lib/chunks/{index-D6te_qaB.mjs → index-Bxpf9v5j.mjs} +26 -26
- package/lib/chunks/{index-D9z6lQat.mjs → index-C9mAajbD.mjs} +225 -220
- package/lib/chunks/{index-CM11hSQu.mjs → index-CDg6vIbT.mjs} +11 -11
- package/lib/chunks/{index-BxmX005K.mjs → index-CWE-hKSs.mjs} +11 -11
- package/lib/chunks/{index-BPmyF7Wr.mjs → index-CY3xzGgt.mjs} +18 -18
- package/lib/chunks/{index-t9kSzzMg.mjs → index-CxKZKUJj.mjs} +521 -523
- package/lib/chunks/{index-CuiEjR23.mjs → index-D30L8tm9.mjs} +15 -15
- package/lib/chunks/{index-DOAOk6m5.mjs → index-DN4Ui0Gh.mjs} +11 -11
- package/lib/chunks/{index-CEk6FKm3.mjs → index-DZZN3kYi.mjs} +551 -531
- package/lib/chunks/{index-D6Pjjxi0.mjs → index-Dkro_8Fy.mjs} +20 -20
- package/lib/chunks/{index-CiGUKdlt.mjs → index-VdzIFJJW.mjs} +23 -23
- package/lib/chunks/{index-WcAnJA2t.mjs → index-aoXgVLBb.mjs} +14 -14
- package/lib/chunks/{jp2Loader-Dig19xyo-BBR3tcPW.mjs → jp2Loader-Dig19xyo-CKUaGhPl.mjs} +1 -1
- package/lib/chunks/{psdLoader-C0tKUXXl-DGOmJwkQ.mjs → psdLoader-C0tKUXXl-CYWoQis5.mjs} +1 -1
- package/lib/chunks/{rawLoader-C-tPeFAB-CrCtXMup.mjs → rawLoader-C-tPeFAB-C35zC8nZ.mjs} +1 -1
- package/lib/chunks/{tiffLoader-BlhByX8w-jsxHlbyu.mjs → tiffLoader-BlhByX8w-BOxg_Du5.mjs} +1 -1
- package/lib/chunks/{useShikiHighlight-BdhPCj48.mjs → useShikiHighlight-BPmcxA-h.mjs} +1 -1
- package/lib/index.cjs +59 -59
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.mjs +4 -4
- 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-Bfg5zM8l.mjs +0 -141
- package/lib/chunks/index-Cud9j9Xy.mjs +0 -322
- package/lib/chunks/index-D4jhvs5m.mjs +0 -113
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { defineComponent as S, ref as v, computed as f, watch as k, unref as d, openBlock as a, createElementBlock as u, createElementVNode as l, toDisplayString as h, createBlock as z, normalizeClass as T, normalizeStyle as B, Fragment as E, renderList as F } from "vue";
|
|
2
|
-
import { WrapText as G, Code as M, Eye as W } from "lucide-vue-next";
|
|
3
|
-
import { u as $, b as D, z as P, T as R } from "./index-CEk6FKm3.mjs";
|
|
4
|
-
import { u as V } from "./useShikiHighlight-BdhPCj48.mjs";
|
|
5
|
-
import { _ as j } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
|
|
6
|
-
import { T as q } from "./base.types-DaftHyg7.mjs";
|
|
7
|
-
const A = {
|
|
8
|
-
key: 0,
|
|
9
|
-
class: "vfp-renderer-loading"
|
|
10
|
-
}, I = { class: "vfp-renderer-loading-content" }, J = { class: "vfp-renderer-loading-text" }, K = {
|
|
11
|
-
key: 2,
|
|
12
|
-
class: "vfp-w-full vfp-h-full vfp-bg-surface-toolbar"
|
|
13
|
-
}, O = ["srcdoc", "title"], Q = {
|
|
14
|
-
key: 3,
|
|
15
|
-
class: "vfp-w-full vfp-h-full vfp-overflow-auto",
|
|
16
|
-
style: { background: "var(--fp-code-bg)" }
|
|
17
|
-
}, U = {
|
|
18
|
-
key: 4,
|
|
19
|
-
class: "vfp-w-full vfp-h-full vfp-overflow-auto",
|
|
20
|
-
style: { background: "var(--fp-code-bg)" }
|
|
21
|
-
}, X = { class: "vfp-code-gutter" }, Y = ["innerHTML"], ue = /* @__PURE__ */ S({
|
|
22
|
-
__name: "index",
|
|
23
|
-
props: {
|
|
24
|
-
url: {},
|
|
25
|
-
fileName: {}
|
|
26
|
-
},
|
|
27
|
-
setup(b, { expose: H }) {
|
|
28
|
-
const m = b, w = new q(), { t: s } = $(), C = D(), t = v(!0), o = v(!1), i = v(""), p = v(!0), c = v(null), r = f(() => P(m.fileName)), L = f(() => r.value !== "text" ? i.value : ""), { lineHtmls: _, loading: N } = V(L, r), y = f(() => r.value === "html");
|
|
29
|
-
k([t, o, p, y], () => {
|
|
30
|
-
w.notify();
|
|
31
|
-
}), k(() => m.url, async () => {
|
|
32
|
-
p.value = !0, c.value = null;
|
|
33
|
-
try {
|
|
34
|
-
const e = await R(m.url, { fetcher: C.value });
|
|
35
|
-
i.value = e;
|
|
36
|
-
} catch (e) {
|
|
37
|
-
console.error(e), c.value = s.value("text.load_failed");
|
|
38
|
-
} finally {
|
|
39
|
-
p.value = !1;
|
|
40
|
-
}
|
|
41
|
-
}, { immediate: !0 });
|
|
42
|
-
const x = f(() => i.value.split(`
|
|
43
|
-
`));
|
|
44
|
-
return H({
|
|
45
|
-
getToolbarGroups: () => {
|
|
46
|
-
const e = [];
|
|
47
|
-
return e.push({
|
|
48
|
-
items: [
|
|
49
|
-
{
|
|
50
|
-
type: "button",
|
|
51
|
-
icon: G,
|
|
52
|
-
tooltip: t.value ? s.value("toolbar.wrap_off") : s.value("toolbar.wrap_on"),
|
|
53
|
-
action: () => {
|
|
54
|
-
t.value = !t.value;
|
|
55
|
-
},
|
|
56
|
-
active: t.value
|
|
57
|
-
}
|
|
58
|
-
]
|
|
59
|
-
}), y.value && e.push({
|
|
60
|
-
items: [
|
|
61
|
-
{
|
|
62
|
-
type: "button",
|
|
63
|
-
icon: o.value ? M : W,
|
|
64
|
-
tooltip: o.value ? s.value("toolbar.source") : s.value("toolbar.preview"),
|
|
65
|
-
action: () => {
|
|
66
|
-
o.value = !o.value;
|
|
67
|
-
},
|
|
68
|
-
active: o.value
|
|
69
|
-
}
|
|
70
|
-
]
|
|
71
|
-
}), e;
|
|
72
|
-
},
|
|
73
|
-
onToolbarChange: (e) => w.subscribe(e)
|
|
74
|
-
}), (e, n) => p.value || r.value !== "text" && d(N) ? (a(), u("div", A, [
|
|
75
|
-
l("div", I, [
|
|
76
|
-
n[0] || (n[0] = l("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
77
|
-
l("span", J, h(d(s)("common.loading")), 1)
|
|
78
|
-
])
|
|
79
|
-
])) : c.value ? (a(), z(j, {
|
|
80
|
-
key: 1,
|
|
81
|
-
message: c.value
|
|
82
|
-
}, null, 8, ["message"])) : o.value && r.value === "html" ? (a(), u("div", K, [
|
|
83
|
-
l("iframe", {
|
|
84
|
-
srcdoc: i.value,
|
|
85
|
-
sandbox: "allow-same-origin",
|
|
86
|
-
class: "vfp-w-full vfp-h-full vfp-border-0",
|
|
87
|
-
title: b.fileName
|
|
88
|
-
}, null, 8, O)
|
|
89
|
-
])) : r.value === "text" || d(_).length === 0 ? (a(), u("div", Q, [
|
|
90
|
-
l("pre", {
|
|
91
|
-
class: T(["vfp-py-6 vfp-px-4 vfp-text-fg-primary vfp-font-mono vfp-text-sm", t.value ? "vfp-whitespace-pre-wrap vfp-break-words" : "vfp-whitespace-pre"])
|
|
92
|
-
}, h(i.value), 3)
|
|
93
|
-
])) : (a(), u("div", U, [
|
|
94
|
-
l("div", {
|
|
95
|
-
class: T(["vfp-code-block with-line-numbers vfp-w-full", { "no-wrap": !t.value }]),
|
|
96
|
-
style: B({ gridTemplateRows: `repeat(${x.value.length}, auto) minmax(1.5rem, 1fr)` })
|
|
97
|
-
}, [
|
|
98
|
-
(a(!0), u(E, null, F(x.value, (le, g) => (a(), u(E, { key: g }, [
|
|
99
|
-
l("span", X, h(g + 1), 1),
|
|
100
|
-
l("span", {
|
|
101
|
-
class: "vfp-code-line",
|
|
102
|
-
innerHTML: d(_)[g] ?? ""
|
|
103
|
-
}, null, 8, Y)
|
|
104
|
-
], 64))), 128)),
|
|
105
|
-
n[1] || (n[1] = l("span", { class: "vfp-code-gutter-filler" }, null, -1)),
|
|
106
|
-
n[2] || (n[2] = l("span", { class: "vfp-code-line-filler" }, null, -1))
|
|
107
|
-
], 6)
|
|
108
|
-
]));
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
export {
|
|
112
|
-
ue as default
|
|
113
|
-
};
|