@eternalheart/vue-file-preview 1.7.2 → 1.8.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.
Files changed (54) hide show
  1. package/README.md +28 -0
  2. package/README.zh-CN.md +28 -0
  3. package/lib/FilePreviewContent.vue.d.ts +25 -11
  4. package/lib/FilePreviewEmbed.vue.d.ts +20 -11
  5. package/lib/FilePreviewModal.vue.d.ts +20 -11
  6. package/lib/chunks/{EmptyState.vue_vue_type_script_setup_true_lang-Dna6LmVT.mjs → EmptyState.vue_vue_type_script_setup_true_lang-98G0nOSe.mjs} +1 -1
  7. package/lib/chunks/{avifLoader-CAUzjn-d-dPsP28D5.mjs → avifLoader-CAUzjn-d-BaqsWKGB.mjs} +1 -1
  8. package/lib/chunks/{heicLoader-D_9PukkA-T-k1DSgY.mjs → heicLoader-D_9PukkA-C9OkgWGg.mjs} +1 -1
  9. package/lib/chunks/index-B5B5upNy.mjs +112 -0
  10. package/lib/chunks/{index-cRhwUlQN.mjs → index-B9xl_UYv.mjs} +26 -26
  11. package/lib/chunks/{index-B5hprvcF.mjs → index-BKpp6GvN.mjs} +2516 -2085
  12. package/lib/chunks/{index-oJF-hur2.mjs → index-BNNGXI8X.mjs} +1 -1
  13. package/lib/chunks/{index-eNZr1h6f.mjs → index-BV5eiYIr.mjs} +23 -23
  14. package/lib/chunks/{index-BjHEHkZ8.mjs → index-Bghv1art.mjs} +1 -1
  15. package/lib/chunks/{index-TZv0MqBH.mjs → index-Bl530kxA.mjs} +5 -5
  16. package/lib/chunks/index-CCHdh2Ta.mjs +220 -0
  17. package/lib/chunks/{index-QPk2c2Tl.mjs → index-CDd2zFE5.mjs} +2 -2
  18. package/lib/chunks/{index-C95y29OL.mjs → index-CHpO-VOr.mjs} +19 -19
  19. package/lib/chunks/index-CSxcgc5S.mjs +401 -0
  20. package/lib/chunks/{index-Cv3Sg87O.mjs → index-CcyrSSZO.mjs} +17 -17
  21. package/lib/chunks/{index-JjVQZbDt.mjs → index-CzBIAq6E.mjs} +25 -25
  22. package/lib/chunks/{index-BPutNVAf.mjs → index-D-18qa-n.mjs} +1 -1
  23. package/lib/chunks/{index-BN__EwfT.mjs → index-D4OWPWnl.mjs} +1 -1
  24. package/lib/chunks/{index-Dnyl1HQk.mjs → index-DcEoeHsV.mjs} +10 -10
  25. package/lib/chunks/{index-DInI3RTN.mjs → index-DjCn0C-U.mjs} +33 -33
  26. package/lib/chunks/{index-DHba2Axz.mjs → index-Dtr0MERf.mjs} +53 -53
  27. package/lib/chunks/{index-CqOGKCyE.mjs → index-UBINFnHY.mjs} +1 -1
  28. package/lib/chunks/{index-BlZ6RmeR.mjs → index-YyZE4Nkm.mjs} +4 -4
  29. package/lib/chunks/{index-CegPYMyO.mjs → index-mdCIanDM.mjs} +27 -27
  30. package/lib/chunks/{index-DXzvgRuo.mjs → index-s_jqndx-.mjs} +1 -1
  31. package/lib/chunks/{jp2Loader-Dig19xyo-hrIg_KJ3.mjs → jp2Loader-Dig19xyo-CD7_CVVV.mjs} +1 -1
  32. package/lib/chunks/{psdLoader-C0tKUXXl-B2cJ4s7t.mjs → psdLoader-C0tKUXXl-Bf25O3n4.mjs} +1 -1
  33. package/lib/chunks/{rawLoader-C-tPeFAB-BNV-Wmzr.mjs → rawLoader-C-tPeFAB-CZ65svhu.mjs} +5 -5
  34. package/lib/chunks/{tiffLoader-BlhByX8w-BzSrLE9Y.mjs → tiffLoader-BlhByX8w-BEFJubN7.mjs} +1 -1
  35. package/lib/chunks/{useShikiHighlight-CpL0RAQg.mjs → useShikiHighlight-axL5ux5r.mjs} +1 -1
  36. package/lib/composables/useRendererBridge.d.ts +19 -0
  37. package/lib/composables/useRequest.d.ts +1 -13
  38. package/lib/core/index.d.ts +9 -1
  39. package/lib/core/renderer-bridge/bridge.d.ts +53 -0
  40. package/lib/core/renderer-bridge/hub.d.ts +58 -0
  41. package/lib/core/renderer-bridge/types.d.ts +141 -0
  42. package/lib/core/types.d.ts +0 -7
  43. package/lib/core/utils/rendererId.d.ts +7 -0
  44. package/lib/core/utils/spreadsheetSheets.d.ts +17 -0
  45. package/lib/index.cjs +60 -60
  46. package/lib/index.css +1 -1
  47. package/lib/index.d.ts +1 -1
  48. package/lib/index.mjs +8 -8
  49. package/lib/renderers/Xlsx/index.vue.d.ts +4 -0
  50. package/lib/types.d.ts +7 -2
  51. package/package.json +1 -1
  52. package/lib/chunks/index-B_Spz6Wn.mjs +0 -359
  53. package/lib/chunks/index-DcvlMm9Q.mjs +0 -137
  54. package/lib/chunks/index-dOxDeWYi.mjs +0 -104
@@ -1,104 +0,0 @@
1
- import { defineComponent as D, ref as m, onMounted as z, watch as M, onBeforeUnmount as G, openBlock as v, createElementBlock as w, createElementVNode as g, toDisplayString as N, unref as S, createCommentVNode as b, createBlock as B, normalizeStyle as C } from "vue";
2
- import { S as H } from "./index-CyBXARuf.mjs";
3
- import { u as R, a as W, b as E, f as F, G as L, Y as O, Q } from "./index-B5hprvcF.mjs";
4
- import { _ as V } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
5
- const Y = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full" }, q = {
6
- key: 0,
7
- class: "vfp-absolute vfp-inset-0 vfp-renderer-loading vfp-bg-surface-toolbar vfp-backdrop-blur-sm vfp-z-10"
8
- }, A = { class: "vfp-renderer-loading-content" }, I = { class: "vfp-renderer-loading-text" }, K = /* @__PURE__ */ D({
9
- __name: "index",
10
- props: {
11
- url: {},
12
- fileName: {}
13
- },
14
- setup(y, { expose: T }) {
15
- const a = y, { t: d } = R(), k = W(), h = E(), r = m(!0), n = m(null), l = m(null);
16
- let o = null, u = null, i = null, c = { width: 0, height: 0 };
17
- const p = () => {
18
- if (!l.value) return { width: 800, height: 600 };
19
- const e = l.value.clientWidth, t = l.value.clientHeight, s = e > 100 ? e : 800, f = t > 100 ? t : 600;
20
- return { width: s, height: f };
21
- }, _ = () => {
22
- if (!l.value || !o) return;
23
- l.value.innerHTML = "";
24
- const { width: e, height: t } = p(), s = e < 640;
25
- new H(l.value, {
26
- mode: "read",
27
- showToolbar: !1,
28
- showContextmenu: !1,
29
- showGrid: !0,
30
- row: {
31
- len: 100,
32
- height: 25
33
- },
34
- col: {
35
- len: 26,
36
- width: s ? 80 : 100,
37
- indexWidth: s ? 40 : 60,
38
- minWidth: s ? 40 : 60
39
- },
40
- view: {
41
- height: () => t,
42
- width: () => e
43
- }
44
- }).loadData(o);
45
- }, x = async () => {
46
- if (h.begin(a.url), !!l.value) {
47
- r.value = !0, n.value = null;
48
- try {
49
- const e = await F(a.url, { fetcher: k.value }), t = L(e, { delimiter: O(a.fileName) });
50
- o = Q(t.header, t.rows, a.fileName), _(), r.value = !1, h.ready();
51
- } catch (e) {
52
- console.error(d.value("csv.parse_failed") + ":", e), n.value = d.value("csv.load_failed"), r.value = !1, h.error(e);
53
- }
54
- }
55
- };
56
- return z(() => {
57
- if (!l.value) return;
58
- let e = !0;
59
- u = new ResizeObserver(() => {
60
- if (e) {
61
- e = !1, c = p();
62
- return;
63
- }
64
- const t = p(), s = Math.abs(c.width - t.width), f = Math.abs(c.height - t.height);
65
- s < 10 && f < 10 || (c = t, i !== null && clearTimeout(i), i = window.setTimeout(() => {
66
- o && _();
67
- }, 500));
68
- }), u.observe(l.value), setTimeout(() => {
69
- requestAnimationFrame(() => x());
70
- }, 100);
71
- }), M(
72
- () => a.url,
73
- () => {
74
- x();
75
- }
76
- ), G(() => {
77
- u && u.disconnect(), i !== null && clearTimeout(i), o = null, l.value && (l.value.innerHTML = "");
78
- }), T({
79
- getToolbarGroups: () => []
80
- }), (e, t) => (v(), w("div", Y, [
81
- r.value ? (v(), w("div", q, [
82
- g("div", A, [
83
- t[0] || (t[0] = g("div", { class: "vfp-renderer-spinner" }, null, -1)),
84
- g("p", I, N(S(d)("csv.loading")), 1)
85
- ])
86
- ])) : b("", !0),
87
- n.value && !r.value ? (v(), B(V, {
88
- key: 1,
89
- message: n.value,
90
- class: "vfp-absolute vfp-inset-0 vfp-bg-surface-toolbar vfp-backdrop-blur-sm vfp-z-10"
91
- }, null, 8, ["message"])) : b("", !0),
92
- n.value ? b("", !0) : (v(), w("div", {
93
- key: 2,
94
- ref_key: "containerRef",
95
- ref: l,
96
- class: "xlsx-spreadsheet-container vfp-w-full vfp-h-full",
97
- style: C({ opacity: r.value ? 0 : 1 })
98
- }, null, 4))
99
- ]));
100
- }
101
- });
102
- export {
103
- K as default
104
- };