@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.
Files changed (51) hide show
  1. package/README.md +2 -0
  2. package/README.zh-CN.md +2 -0
  3. package/lib/FilePreviewContent.vue.d.ts +9 -1
  4. package/lib/FilePreviewEmbed.vue.d.ts +4 -1
  5. package/lib/FilePreviewModal.vue.d.ts +4 -1
  6. package/lib/chunks/EmptyState.vue_vue_type_script_setup_true_lang-C7qk6wj0.mjs +20 -0
  7. package/lib/chunks/RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs +32 -0
  8. package/lib/chunks/{avifLoader-CAUzjn-d-CTy7cevh.mjs → avifLoader-CAUzjn-d-C0KRpetN.mjs} +1 -1
  9. package/lib/chunks/{heicLoader-D_9PukkA-DdDu94xL.mjs → heicLoader-D_9PukkA-Czof_5FJ.mjs} +1 -1
  10. package/lib/chunks/{index-CLM9sOKN.mjs → index--612Smof.mjs} +112 -112
  11. package/lib/chunks/{index-De-oaCgN.mjs → index-8Vpbg2kS.mjs} +2 -2
  12. package/lib/chunks/{index-2VQLB2Mi.mjs → index-B21EAyWz.mjs} +53 -49
  13. package/lib/chunks/{index-DmEMePjL.mjs → index-BASg1cr4.mjs} +2 -2
  14. package/lib/chunks/index-BB0i4QqI.mjs +117 -0
  15. package/lib/chunks/{index-Bmqn45d_.mjs → index-BVdrGK3Q.mjs} +72 -72
  16. package/lib/chunks/index-BlrFFeqc.mjs +330 -0
  17. package/lib/chunks/index-Bp9CuvMZ.mjs +157 -0
  18. package/lib/chunks/{index-i-KacQvS.mjs → index-BuqPb5mP.mjs} +3 -3
  19. package/lib/chunks/{index-DVG1fZAv.mjs → index-BvBqDq3O.mjs} +2 -2
  20. package/lib/chunks/{index-D6te_qaB.mjs → index-Bxpf9v5j.mjs} +26 -26
  21. package/lib/chunks/{index-D9z6lQat.mjs → index-C9mAajbD.mjs} +225 -220
  22. package/lib/chunks/{index-CM11hSQu.mjs → index-CDg6vIbT.mjs} +11 -11
  23. package/lib/chunks/{index-BxmX005K.mjs → index-CWE-hKSs.mjs} +11 -11
  24. package/lib/chunks/{index-BPmyF7Wr.mjs → index-CY3xzGgt.mjs} +18 -18
  25. package/lib/chunks/{index-t9kSzzMg.mjs → index-CxKZKUJj.mjs} +521 -523
  26. package/lib/chunks/{index-CuiEjR23.mjs → index-D30L8tm9.mjs} +15 -15
  27. package/lib/chunks/{index-DOAOk6m5.mjs → index-DN4Ui0Gh.mjs} +11 -11
  28. package/lib/chunks/{index-CEk6FKm3.mjs → index-DZZN3kYi.mjs} +551 -531
  29. package/lib/chunks/{index-D6Pjjxi0.mjs → index-Dkro_8Fy.mjs} +20 -20
  30. package/lib/chunks/{index-CiGUKdlt.mjs → index-VdzIFJJW.mjs} +23 -23
  31. package/lib/chunks/{index-WcAnJA2t.mjs → index-aoXgVLBb.mjs} +14 -14
  32. package/lib/chunks/{jp2Loader-Dig19xyo-BBR3tcPW.mjs → jp2Loader-Dig19xyo-CKUaGhPl.mjs} +1 -1
  33. package/lib/chunks/{psdLoader-C0tKUXXl-DGOmJwkQ.mjs → psdLoader-C0tKUXXl-CYWoQis5.mjs} +1 -1
  34. package/lib/chunks/{rawLoader-C-tPeFAB-CrCtXMup.mjs → rawLoader-C-tPeFAB-C35zC8nZ.mjs} +1 -1
  35. package/lib/chunks/{tiffLoader-BlhByX8w-jsxHlbyu.mjs → tiffLoader-BlhByX8w-BOxg_Du5.mjs} +1 -1
  36. package/lib/chunks/{useShikiHighlight-BdhPCj48.mjs → useShikiHighlight-BPmcxA-h.mjs} +1 -1
  37. package/lib/index.cjs +59 -59
  38. package/lib/index.css +1 -1
  39. package/lib/index.d.ts +1 -1
  40. package/lib/index.mjs +4 -4
  41. package/lib/renderers/EmptyState.vue.d.ts +2 -0
  42. package/lib/renderers/Json/index.vue.d.ts +5 -0
  43. package/lib/renderers/Pptx/index.vue.d.ts +3 -0
  44. package/lib/renderers/Text/index.vue.d.ts +3 -0
  45. package/lib/renderers/Xlsx/index.vue.d.ts +3 -0
  46. package/lib/renderers/registry.d.ts +3 -1
  47. package/package.json +1 -1
  48. package/lib/chunks/RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs +0 -30
  49. package/lib/chunks/index-Bfg5zM8l.mjs +0 -141
  50. package/lib/chunks/index-Cud9j9Xy.mjs +0 -322
  51. package/lib/chunks/index-D4jhvs5m.mjs +0 -113
@@ -1,22 +1,22 @@
1
- import { defineComponent as _, ref as n, watch as m, openBlock as i, createElementBlock as c, createElementVNode as r, toDisplayString as h, unref as g, createBlock as y } from "vue";
2
- import { u as w, b as k, k as x, B } from "./index-CEk6FKm3.mjs";
3
- import { _ as T } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
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
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
- }, L = ["innerHTML"], N = /* @__PURE__ */ _({
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 p = u, { t: l } = w(), d = k(), t = n(""), s = n(!0), a = n(null), v = async () => {
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(p.url);
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
22
  t.value = await B(o);
@@ -26,19 +26,19 @@ const b = {
26
26
  s.value = !1;
27
27
  }
28
28
  };
29
- return m(() => p.url, (e) => {
29
+ return _(() => i.url, (e) => {
30
30
  e && v();
31
31
  }, { immediate: !0 }), f({
32
32
  getToolbarGroups: () => []
33
- }), (e, o) => s.value ? (i(), c("div", b, [
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
- r("span", G, h(g(l)("common.loading")), 1)
36
+ r("span", G, g(h(l)("common.loading")), 1)
37
37
  ])
38
- ])) : a.value ? (i(), y(T, {
38
+ ])) : a.value ? (c(), y(T, {
39
39
  key: 1,
40
40
  message: a.value
41
- }, null, 8, ["message"])) : (i(), c("div", H, [
41
+ }, null, 8, ["message"])) : (c(), p("div", H, [
42
42
  r("div", {
43
43
  class: "vfp-legacy-ppt-wrap",
44
44
  innerHTML: t.value
@@ -1,7 +1,7 @@
1
- import { defineComponent as L, ref as u, watch as M, computed as D, openBlock as l, createElementBlock as a, createElementVNode as r, toDisplayString as d, unref as v, createBlock as H, normalizeStyle as B, Fragment as w, renderList as F } from "vue";
2
- import { u as G, b as N, T as P } from "./index-CEk6FKm3.mjs";
3
- import { u as X } from "./useShikiHighlight-BdhPCj48.mjs";
4
- import { _ as E } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
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 } = G(), b = N(), i = u(""), f = u(!0), c = u(null), T = u("xml"), { lineHtmls: _ } = X(i, T), S = (e) => {
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;
@@ -37,7 +37,7 @@ $2$3`);
37
37
  const o = new DOMParser().parseFromString(e, "application/xml");
38
38
  if (o.querySelector("parsererror")) return e;
39
39
  const n = new XMLSerializer().serializeToString(o);
40
- return S(n);
40
+ return T(n);
41
41
  } catch {
42
42
  return e;
43
43
  }
@@ -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 P(m.url, { fetcher: b.value });
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 = D(() => i.value.split(`
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(), H(E, {
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: B({ gridTemplateRows: `repeat(${h.value.length}, auto) minmax(1.5rem, 1fr)` })
73
+ style: H({ gridTemplateRows: `repeat(${h.value.length}, auto) minmax(1.5rem, 1fr)` })
74
74
  }, [
75
- (l(!0), a(w, null, F(h.value, (o, s) => (l(), a(w, { key: s }, [
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 k, openBlock as i, createElementBlock as p, createElementVNode as r, toDisplayString as B, unref as N, createBlock as I, normalizeStyle as d, Fragment as F, renderList as C } from "vue";
2
- import { u as R, b as j, m as q, k as z, H as O, c as U } from "./index-CEk6FKm3.mjs";
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-BNoENOWX.mjs";
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"], T = 1123, w = 60, H = 50, ee = 24, re = /* @__PURE__ */ M({
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(b, { expose: G }) {
18
- const E = T - w * 2, h = b, { t: f } = R(), A = j(), a = l(""), v = l(!0), c = l(null), s = l([]), m = l({}), _ = l(null), P = async () => {
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
- }, S = () => {
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(() => S()));
52
+ a.value && (await $(), requestAnimationFrame(() => L()));
53
53
  });
54
- const g = k(() => q(m.value)), D = k(() => ({
54
+ const g = k(() => q(m.value)), S = k(() => ({
55
55
  ...g.value,
56
56
  position: "absolute",
57
57
  visibility: "hidden",
58
- width: `${794 - H * 2}px`,
58
+ width: `${794 - b * 2}px`,
59
59
  pointerEvents: "none"
60
- })), L = {
60
+ })), D = {
61
61
  width: "100%",
62
62
  maxWidth: "794px",
63
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 ${H}px`
67
+ padding: `${w}px ${b}px`
68
68
  };
69
- return G({
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(N(f)("common.loading")), 1)
74
+ r("span", J, B(F(f)("common.loading")), 1)
75
75
  ])
76
- ])) : c.value ? (i(), I(W, {
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(D.value),
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(F, null, C(s.value.length > 0 ? s.value : [""], (t, o) => (i(), p("div", {
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
- ...L,
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
  }, [