@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.
Files changed (36) hide show
  1. package/README.md +3 -3
  2. package/README.zh-CN.md +3 -3
  3. package/lib/chunks/{index-CNVufPKA.mjs → index-07rgqwSI.mjs} +1 -1
  4. package/lib/chunks/{index-BjLnlWld.mjs → index-BF0-zECZ.mjs} +44 -45
  5. package/lib/chunks/{index-BkpKhifq.mjs → index-BHy2oKCa.mjs} +15 -15
  6. package/lib/chunks/{index-DHAH_W8y.mjs → index-BV8V9hEs.mjs} +26 -26
  7. package/lib/chunks/index-BnDCjh8a.mjs +320 -0
  8. package/lib/chunks/{index-CbEYsjU9.mjs → index-C-hfrxhW.mjs} +50 -50
  9. package/lib/chunks/{index-RshnMles.mjs → index-CUrAAk7J.mjs} +213 -207
  10. package/lib/chunks/index-CdsYIxSD.mjs +270 -0
  11. package/lib/chunks/{index-BW6Z1etg.mjs → index-ChMheVNW.mjs} +20 -20
  12. package/lib/chunks/index-CksNYAz_.mjs +48 -0
  13. package/lib/chunks/{index-CAM2s3GD.mjs → index-CybXawTx.mjs} +19 -19
  14. package/lib/chunks/{index-Ck-FSxNL.mjs → index-D656tL42.mjs} +21 -21
  15. package/lib/chunks/{index-Ccdi178q.mjs → index-DWWV1OKd.mjs} +77 -77
  16. package/lib/chunks/index-DXqRgna1.mjs +105 -0
  17. package/lib/chunks/{index-Cyps3Pjb.mjs → index-DcNc3goP.mjs} +131 -129
  18. package/lib/chunks/index-Dh91eAMV.mjs +329 -0
  19. package/lib/chunks/{index-DnmsSoFY.mjs → index-DxBxbEDT.mjs} +1 -1
  20. package/lib/chunks/{index-Df8-y_Ok.mjs → index-hDUlDDey.mjs} +18 -18
  21. package/lib/chunks/{index-Dl0SQhkc.mjs → index-lDd0gQfG.mjs} +35 -36
  22. package/lib/chunks/{index-C9ju7INJ.mjs → index-tOax5IQg.mjs} +26 -26
  23. package/lib/chunks/index-u7QUztr_.mjs +49 -0
  24. package/lib/chunks/{index-CeCl4UNc.mjs → index-xY2bzsk7.mjs} +3747 -1100
  25. package/lib/chunks/{useShikiHighlight-D2eoQi-e.mjs → useShikiHighlight-DwEsf_jW.mjs} +5 -5
  26. package/lib/index.cjs +74 -55
  27. package/lib/index.css +1 -1
  28. package/lib/index.mjs +7 -7
  29. package/lib/renderers/Doc/index.vue.d.ts +9 -0
  30. package/lib/renderers/Ppt/index.vue.d.ts +9 -0
  31. package/lib/renderers/lazy.d.ts +2 -0
  32. package/package.json +2 -2
  33. package/lib/chunks/index-Bts2l6ss.mjs +0 -300
  34. package/lib/chunks/index-CyXt4Rjo.mjs +0 -264
  35. package/lib/chunks/index-DXECkJ55.mjs +0 -106
  36. package/lib/chunks/index-ntrMGZWG.mjs +0 -466
package/README.md CHANGED
@@ -264,9 +264,9 @@ Differences from `FilePreviewModal`:
264
264
 
265
265
  ### Documents
266
266
  - **PDF**: Pagination, zoom
267
- - **Word**: DOCX format support
268
- - **Excel**: XLSX format support
269
- - **PowerPoint**: PPTX/PPT format support, slide preview
267
+ - **Word**: DOCX and legacy DOC (97–2003) support
268
+ - **Excel**: XLSX and legacy XLS (97–2003) support
269
+ - **PowerPoint**: PPTX and legacy PPT (97–2003) slide preview
270
270
 
271
271
  ### Fonts
272
272
  - **Formats**: TTF, OTF, WOFF, WOFF2
package/README.zh-CN.md CHANGED
@@ -264,9 +264,9 @@ const files = [
264
264
 
265
265
  ### 文档
266
266
  - **PDF**: 分页浏览、缩放
267
- - **Word**: DOCX 格式支持
268
- - **Excel**: XLSX 格式支持
269
- - **PowerPoint**: PPTX/PPT 格式支持、幻灯片预览
267
+ - **Word**: DOCX 与旧版 DOC(97–2003)支持
268
+ - **Excel**: XLSX 与旧版 XLS(97–2003)支持
269
+ - **PowerPoint**: PPTX 与旧版 PPT(97–2003)幻灯片预览
270
270
 
271
271
  ### 字体
272
272
  - **格式**: TTF, OTF, WOFF, WOFF2
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as er, ref as qe, watch as tr, computed as te, openBlock as J, createElementBlock as Q, createElementVNode as F, createBlock as rr, unref as se, toDisplayString as ne, createVNode as he, createCommentVNode as oe, normalizeStyle as ir, Fragment as nr, renderList as ar, createTextVNode as sr, normalizeClass as or } from "vue";
2
2
  import { User as cr, Users as Ve, Calendar as mt, Clock as Et, Tag as gt, Mail as fr, Paperclip as ur, Hash as hr } from "lucide-vue-next";
3
- import { u as lr, a as dr, _ as pr } from "./index-CeCl4UNc.mjs";
3
+ import { u as lr, b as dr, _ as pr } from "./index-xY2bzsk7.mjs";
4
4
  import { _ as yr } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
5
5
  var fe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
6
6
  function br(e) {
@@ -1,28 +1,28 @@
1
- import { defineComponent as E, ref as p, onMounted as D, watch as M, onBeforeUnmount as z, openBlock as v, createElementBlock as h, createElementVNode as m, toDisplayString as B, unref as _, createCommentVNode as w, createBlock as S, normalizeStyle as W } from "vue";
2
- import H from "exceljs";
3
- import { S as R } from "./index-CyBXARuf.mjs";
4
- import { u as C, a as G, K as L } from "./index-CeCl4UNc.mjs";
5
- import { _ as F } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
6
- const I = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full" }, K = {
1
+ import { defineComponent as E, ref as p, onMounted as D, watch as M, onBeforeUnmount as z, openBlock as v, createElementBlock as h, createElementVNode as m, toDisplayString as B, unref as _, createCommentVNode as w, createBlock as S, normalizeStyle as C } from "vue";
2
+ import W from "exceljs";
3
+ import { S as H } from "./index-CyBXARuf.mjs";
4
+ import { u as R, b as G, C as L, s as F, y as N, g as O } from "./index-xY2bzsk7.mjs";
5
+ import { _ as V } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
6
+ const $ = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full" }, j = {
7
7
  key: 0,
8
8
  class: "vfp-absolute vfp-inset-0 vfp-flex vfp-items-center vfp-justify-center vfp-bg-surface-toolbar vfp-backdrop-blur-sm vfp-z-10"
9
- }, N = { class: "vfp-text-center" }, O = { class: "vfp-text-xs md:vfp-text-sm vfp-text-fg-secondary vfp-font-medium" }, U = /* @__PURE__ */ E({
9
+ }, q = { class: "vfp-text-center" }, A = { class: "vfp-text-xs md:vfp-text-sm vfp-text-fg-secondary vfp-font-medium" }, X = /* @__PURE__ */ E({
10
10
  __name: "index",
11
11
  props: {
12
12
  url: {}
13
13
  },
14
14
  setup(y, { expose: k }) {
15
- const x = y, { t: f } = C(), T = G(), s = p(!0), l = p(null), r = p(null);
16
- let n = null, u = null, a = null, c = { width: 0, height: 0 };
15
+ const g = y, { t: i } = R(), T = G(), o = p(!0), l = p(null), r = p(null);
16
+ let a = null, f = null, n = null, u = { width: 0, height: 0 };
17
17
  const d = () => {
18
18
  if (!r.value) return { width: 800, height: 600 };
19
- const e = r.value.clientWidth, t = r.value.clientHeight, o = e > 100 ? e : 800, i = t > 100 ? t : 600;
20
- return { width: o, height: i };
21
- }, b = () => {
22
- if (!r.value || !n) return;
19
+ const e = r.value.clientWidth, t = r.value.clientHeight, s = e > 100 ? e : 800, c = t > 100 ? t : 600;
20
+ return { width: s, height: c };
21
+ }, x = () => {
22
+ if (!r.value || !a) return;
23
23
  r.value.innerHTML = "";
24
- const { width: e, height: t } = d(), o = e < 640;
25
- new R(r.value, {
24
+ const { width: e, height: t } = d(), s = e < 640;
25
+ new H(r.value, {
26
26
  mode: "read",
27
27
  showToolbar: !1,
28
28
  showContextmenu: !1,
@@ -33,72 +33,71 @@ const I = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-fu
33
33
  },
34
34
  col: {
35
35
  len: 26,
36
- width: o ? 80 : 100,
37
- indexWidth: o ? 40 : 60,
38
- minWidth: o ? 40 : 60
36
+ width: s ? 80 : 100,
37
+ indexWidth: s ? 40 : 60,
38
+ minWidth: s ? 40 : 60
39
39
  },
40
40
  view: {
41
41
  height: () => t,
42
42
  width: () => e
43
43
  }
44
- }).loadData(n);
45
- }, g = async () => {
44
+ }).loadData(a);
45
+ }, b = async () => {
46
46
  if (r.value) {
47
- s.value = !0, l.value = null;
47
+ o.value = !0, l.value = null;
48
48
  try {
49
- const e = await T.value(x.url, {
49
+ const e = await T.value(g.url, {
50
50
  mode: "cors",
51
51
  credentials: "omit",
52
52
  redirect: "follow"
53
53
  });
54
54
  if (!e.ok)
55
- throw e.status === 404 ? new Error(f.value("xlsx.not_found")) : e.status === 403 ? new Error("无权限访问此文件") : new Error(`文件加载失败 (${e.status})`);
55
+ throw e.status === 404 ? new Error(i.value("xlsx.not_found")) : e.status === 403 ? new Error("无权限访问此文件") : new Error(`文件加载失败 (${e.status})`);
56
56
  const t = await e.arrayBuffer();
57
57
  if (t.byteLength === 0)
58
58
  throw new Error("文件为空");
59
- const o = new H.Workbook();
60
- await o.xlsx.load(t), n = L(o), b(), s.value = !1;
59
+ a = L(t) ? F(N(t)) : O(await new W.Workbook().xlsx.load(t)), x(), o.value = !1;
61
60
  } catch (e) {
62
61
  console.error("Excel 解析错误:", e);
63
- let t = f.value("xlsx.parse_failed");
64
- e instanceof Error && (t = e.message), l.value = t, s.value = !1;
62
+ let t = i.value("xlsx.parse_failed");
63
+ e instanceof Error && (t = e.message), l.value = t, o.value = !1;
65
64
  }
66
65
  }
67
66
  };
68
67
  return D(() => {
69
68
  if (!r.value) return;
70
69
  let e = !0;
71
- u = new ResizeObserver(() => {
70
+ f = new ResizeObserver(() => {
72
71
  if (e) {
73
- e = !1, c = d();
72
+ e = !1, u = d();
74
73
  return;
75
74
  }
76
- const t = d(), o = Math.abs(c.width - t.width), i = Math.abs(c.height - t.height);
77
- o < 10 && i < 10 || (c = t, a !== null && clearTimeout(a), a = window.setTimeout(() => {
78
- n && b();
75
+ const t = d(), s = Math.abs(u.width - t.width), c = Math.abs(u.height - t.height);
76
+ s < 10 && c < 10 || (u = t, n !== null && clearTimeout(n), n = window.setTimeout(() => {
77
+ a && x();
79
78
  }, 500));
80
- }), u.observe(r.value), setTimeout(() => {
81
- requestAnimationFrame(() => g());
79
+ }), f.observe(r.value), setTimeout(() => {
80
+ requestAnimationFrame(() => b());
82
81
  }, 100);
83
82
  }), M(
84
- () => x.url,
83
+ () => g.url,
85
84
  (e) => {
86
- e && g();
85
+ e && b();
87
86
  }
88
87
  ), z(() => {
89
- u && u.disconnect(), a !== null && clearTimeout(a), n = null, r.value && (r.value.innerHTML = "");
88
+ f && f.disconnect(), n !== null && clearTimeout(n), a = null, r.value && (r.value.innerHTML = "");
90
89
  }), k({
91
90
  getToolbarGroups: () => []
92
- }), (e, t) => (v(), h("div", I, [
93
- s.value ? (v(), h("div", K, [
94
- m("div", N, [
91
+ }), (e, t) => (v(), h("div", $, [
92
+ o.value ? (v(), h("div", j, [
93
+ m("div", q, [
95
94
  t[0] || (t[0] = m("div", { class: "vfp-w-10 vfp-h-10 md:vfp-w-12 md: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)),
96
- m("p", O, B(_(f)("xlsx.loading")), 1)
95
+ m("p", A, B(_(i)("xlsx.loading")), 1)
97
96
  ])
98
97
  ])) : w("", !0),
99
- l.value && !s.value ? (v(), S(F, {
98
+ l.value && !o.value ? (v(), S(V, {
100
99
  key: 1,
101
- message: _(f)("xlsx.load_failed"),
100
+ message: _(i)("xlsx.load_failed"),
102
101
  detail: l.value,
103
102
  class: "vfp-absolute vfp-inset-0 vfp-bg-surface-toolbar vfp-backdrop-blur-sm vfp-z-10"
104
103
  }, null, 8, ["message", "detail"])) : w("", !0),
@@ -107,11 +106,11 @@ const I = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-fu
107
106
  ref_key: "containerRef",
108
107
  ref: r,
109
108
  class: "xlsx-spreadsheet-container vfp-w-full vfp-h-full",
110
- style: W({ opacity: s.value ? 0 : 1 })
109
+ style: C({ opacity: o.value ? 0 : 1 })
111
110
  }, null, 4))
112
111
  ]));
113
112
  }
114
113
  });
115
114
  export {
116
- U as default
115
+ X as default
117
116
  };
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as ie, ref as c, watch as U, onMounted as se, onBeforeUnmount as ue, openBlock as p, createElementBlock as v, createBlock as fe, createCommentVNode as C, createElementVNode as h, normalizeStyle as T, toDisplayString as N, unref as J, createVNode as ce, Fragment as O, renderList as K } from "vue";
2
2
  import pe from "@likecoin/epub-ts";
3
- import { List as ve, ChevronLeft as he, ChevronRight as de, Minimize2 as me, Maximize2 as be, X as ge } from "lucide-vue-next";
4
- import { u as xe, a as ye } from "./index-CeCl4UNc.mjs";
3
+ import { List as ve, ChevronLeft as he, ChevronRight as de, Minimize2 as be, Maximize2 as me, X as ge } from "lucide-vue-next";
4
+ import { u as xe, b as ye } from "./index-xY2bzsk7.mjs";
5
5
  import { _ as we } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
6
6
  import { T as ke } from "./base.types-DaftHyg7.mjs";
7
7
  const _e = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-center vfp-bg-surface-1 vfp-overflow-hidden" }, Te = {
@@ -19,8 +19,8 @@ const _e = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
19
19
  url: {}
20
20
  },
21
21
  setup(Q, { expose: Y }) {
22
- const S = Q, P = new ke(), { t: d } = xe(), Z = ye(), m = c(1), y = c(1), l = c(null), W = c(!0), w = c(null), b = c(!1), g = c([]), i = c(!1), L = c("");
23
- U([m, y, b, i, () => g.value.length], () => {
22
+ const S = Q, P = new ke(), { t: d } = xe(), Z = ye(), b = c(1), y = c(1), l = c(null), W = c(!0), w = c(null), m = c(!1), g = c([]), i = c(!1), L = c("");
23
+ U([b, y, m, i, () => g.value.length], () => {
24
24
  P.notify();
25
25
  });
26
26
  let s = null, e = null, k = 0, _ = null;
@@ -40,7 +40,7 @@ const _e = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
40
40
  }, te = () => {
41
41
  e == null || e.next();
42
42
  }, oe = () => {
43
- b.value = !b.value, setTimeout(() => {
43
+ m.value = !m.value, setTimeout(() => {
44
44
  l.value && e && (e.resize(l.value.offsetWidth, l.value.offsetHeight), _ && e.display(_), F());
45
45
  }, 350);
46
46
  }, ae = () => {
@@ -69,11 +69,11 @@ const _e = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
69
69
  icon: he,
70
70
  tooltip: d.value("toolbar.prev_page"),
71
71
  action: ee,
72
- disabled: m.value <= 1
72
+ disabled: b.value <= 1
73
73
  },
74
74
  {
75
75
  type: "text",
76
- content: `${m.value} / ${y.value}`,
76
+ content: `${b.value} / ${y.value}`,
77
77
  minWidth: "4rem"
78
78
  },
79
79
  {
@@ -81,7 +81,7 @@ const _e = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
81
81
  icon: de,
82
82
  tooltip: d.value("toolbar.next_page"),
83
83
  action: te,
84
- disabled: m.value >= y.value
84
+ disabled: b.value >= y.value
85
85
  }
86
86
  ]
87
87
  },
@@ -89,10 +89,10 @@ const _e = { 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 ? me : be,
93
- tooltip: b.value ? d.value("toolbar.normal_width") : d.value("toolbar.full_width"),
92
+ icon: m.value ? be : me,
93
+ tooltip: m.value ? d.value("toolbar.normal_width") : d.value("toolbar.full_width"),
94
94
  action: oe,
95
- active: b.value
95
+ active: m.value
96
96
  }
97
97
  ]
98
98
  }
@@ -133,11 +133,11 @@ const _e = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
133
133
  if (!s) return;
134
134
  k = s.locations.length();
135
135
  const t = e == null ? void 0 : e.currentLocation(), n = ((a = t == null ? void 0 : t.start) == null ? void 0 : a.location) ?? 0;
136
- m.value = n + 1, y.value = k;
136
+ b.value = n + 1, y.value = k;
137
137
  }).catch(() => {
138
138
  });
139
139
  const r = await s.loaded.navigation;
140
- Array.isArray(r == null ? void 0 : r.toc) && (g.value = r.toc), await e.display(), W.value = !1, m.value = 1, y.value = k || 1, e.on("relocated", (t) => {
140
+ Array.isArray(r == null ? void 0 : r.toc) && (g.value = r.toc), await e.display(), W.value = !1, b.value = 1, y.value = k || 1, e.on("relocated", (t) => {
141
141
  var H, x, V;
142
142
  const n = t;
143
143
  if ((H = n == null ? void 0 : n.start) != null && H.cfi && (_ = n.start.cfi), (x = n == null ? void 0 : n.start) != null && x.href) {
@@ -150,7 +150,7 @@ const _e = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
150
150
  X(g.value), D.length === 1 && (L.value = D[0]);
151
151
  }
152
152
  const a = (V = n == null ? void 0 : n.start) == null ? void 0 : V.location;
153
- typeof a == "number" && k > 0 && (m.value = a + 1, y.value = k);
153
+ typeof a == "number" && k > 0 && (b.value = a + 1, y.value = k);
154
154
  });
155
155
  } catch (o) {
156
156
  console.error("EPUB 加载错误:", o), w.value = d.value("epub.load_failed"), W.value = !1;
@@ -304,7 +304,7 @@ const _e = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
304
304
  ref: l,
305
305
  class: "vfp-h-full vfp-bg-surface-toolbar",
306
306
  style: T({
307
- width: b.value ? "100%" : `${$e}px`,
307
+ width: m.value ? "100%" : `${$e}px`,
308
308
  maxWidth: "100%",
309
309
  transition: "width 0.3s ease",
310
310
  boxShadow: "0 1px 3px rgba(0,0,0,0.12)",
@@ -1,37 +1,37 @@
1
- import { defineComponent as M, ref as f, computed as c, watch as _, openBlock as a, createElementBlock as s, createElementVNode as l, createBlock as S, unref as x, normalizeClass as k, toDisplayString as T, normalizeStyle as B, Fragment as N, renderList as F } from "vue";
2
- import { WrapText as L, Code as z, Eye as G } from "lucide-vue-next";
3
- import { u as O, a as W, N as $, O as j } from "./index-CeCl4UNc.mjs";
4
- import { u as D } from "./useShikiHighlight-D2eoQi-e.mjs";
5
- import { _ as P } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
6
- import { T as R } from "./base.types-DaftHyg7.mjs";
7
- const V = {
1
+ import { defineComponent as S, ref as f, computed as c, watch as _, openBlock as a, createElementBlock as s, createElementVNode as l, createBlock as B, unref as x, normalizeClass as k, toDisplayString as T, normalizeStyle as F, Fragment as E, renderList as L } from "vue";
2
+ import { WrapText as z, Code as G, Eye as M } from "lucide-vue-next";
3
+ import { u as W, b as $, k as j, e as D } from "./index-xY2bzsk7.mjs";
4
+ import { u as P } from "./useShikiHighlight-DwEsf_jW.mjs";
5
+ import { _ as R } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
6
+ import { T as V } from "./base.types-DaftHyg7.mjs";
7
+ const q = {
8
8
  key: 0,
9
9
  class: "vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full"
10
- }, q = {
10
+ }, A = {
11
11
  key: 2,
12
12
  class: "vfp-w-full vfp-h-full vfp-bg-surface-toolbar"
13
- }, A = ["srcdoc", "title"], I = {
13
+ }, I = ["srcdoc", "title"], J = {
14
14
  key: 3,
15
15
  class: "vfp-w-full vfp-h-full vfp-overflow-auto",
16
16
  style: { background: "var(--fp-code-bg)" }
17
- }, J = {
17
+ }, K = {
18
18
  key: 4,
19
19
  class: "vfp-w-full vfp-h-full vfp-overflow-auto",
20
20
  style: { background: "var(--fp-code-bg)" }
21
- }, K = { class: "vfp-code-gutter" }, Q = ["innerHTML"], re = /* @__PURE__ */ M({
21
+ }, O = { class: "vfp-code-gutter" }, Q = ["innerHTML"], re = /* @__PURE__ */ S({
22
22
  __name: "index",
23
23
  props: {
24
24
  url: {},
25
25
  fileName: {}
26
26
  },
27
- setup(h, { expose: E }) {
28
- const m = h, b = new R(), { t: n } = O(), H = W(), t = f(!0), o = f(!1), u = f(""), p = f(!0), i = f(null), v = c(() => $(m.fileName)), C = c(() => v.value !== "text" ? u.value : ""), { lineHtmls: g } = D(C, v), w = c(() => v.value === "html");
27
+ setup(h, { expose: H }) {
28
+ const m = h, b = new V(), { t: n } = W(), C = $(), t = f(!0), o = f(!1), u = f(""), p = f(!0), i = f(null), v = c(() => j(m.fileName)), N = c(() => v.value !== "text" ? u.value : ""), { lineHtmls: g } = P(N, v), w = c(() => v.value === "html");
29
29
  _([t, o, p, w], () => {
30
30
  b.notify();
31
31
  }), _(() => m.url, async () => {
32
32
  p.value = !0, i.value = null;
33
33
  try {
34
- const e = await j(m.url, { fetcher: H.value });
34
+ const e = await D(m.url, { fetcher: C.value });
35
35
  u.value = e;
36
36
  } catch (e) {
37
37
  console.error(e), i.value = n.value("text.load_failed");
@@ -41,14 +41,14 @@ const V = {
41
41
  }, { immediate: !0 });
42
42
  const y = c(() => u.value.split(`
43
43
  `));
44
- return E({
44
+ return H({
45
45
  getToolbarGroups: () => {
46
46
  const e = [];
47
47
  return e.push({
48
48
  items: [
49
49
  {
50
50
  type: "button",
51
- icon: L,
51
+ icon: z,
52
52
  tooltip: t.value ? n.value("toolbar.wrap_off") : n.value("toolbar.wrap_on"),
53
53
  action: () => {
54
54
  t.value = !t.value;
@@ -60,7 +60,7 @@ const V = {
60
60
  items: [
61
61
  {
62
62
  type: "button",
63
- icon: o.value ? z : G,
63
+ icon: o.value ? G : M,
64
64
  tooltip: o.value ? n.value("toolbar.source") : n.value("toolbar.preview"),
65
65
  action: () => {
66
66
  o.value = !o.value;
@@ -71,29 +71,29 @@ const V = {
71
71
  }), e;
72
72
  },
73
73
  onToolbarChange: (e) => b.subscribe(e)
74
- }), (e, r) => p.value ? (a(), s("div", V, [...r[0] || (r[0] = [
74
+ }), (e, r) => p.value ? (a(), s("div", q, [...r[0] || (r[0] = [
75
75
  l("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)
76
- ])])) : i.value ? (a(), S(P, {
76
+ ])])) : i.value ? (a(), B(R, {
77
77
  key: 1,
78
78
  message: i.value
79
- }, null, 8, ["message"])) : o.value && v.value === "html" ? (a(), s("div", q, [
79
+ }, null, 8, ["message"])) : o.value && v.value === "html" ? (a(), s("div", A, [
80
80
  l("iframe", {
81
81
  srcdoc: u.value,
82
82
  sandbox: "allow-same-origin",
83
83
  class: "vfp-w-full vfp-h-full vfp-border-0",
84
84
  title: h.fileName
85
- }, null, 8, A)
86
- ])) : v.value === "text" || x(g).length === 0 ? (a(), s("div", I, [
85
+ }, null, 8, I)
86
+ ])) : v.value === "text" || x(g).length === 0 ? (a(), s("div", J, [
87
87
  l("pre", {
88
88
  class: k(["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"])
89
89
  }, T(u.value), 3)
90
- ])) : (a(), s("div", J, [
90
+ ])) : (a(), s("div", K, [
91
91
  l("div", {
92
92
  class: k(["vfp-code-block with-line-numbers vfp-w-full", { "no-wrap": !t.value }]),
93
- style: B({ gridTemplateRows: `repeat(${y.value.length}, auto) minmax(1.5rem, 1fr)` })
93
+ style: F({ gridTemplateRows: `repeat(${y.value.length}, auto) minmax(1.5rem, 1fr)` })
94
94
  }, [
95
- (a(!0), s(N, null, F(y.value, (Y, d) => (a(), s(N, { key: d }, [
96
- l("span", K, T(d + 1), 1),
95
+ (a(!0), s(E, null, L(y.value, (Y, d) => (a(), s(E, { key: d }, [
96
+ l("span", O, T(d + 1), 1),
97
97
  l("span", {
98
98
  class: "vfp-code-line",
99
99
  innerHTML: x(g)[d] ?? ""