@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,5 +1,5 @@
1
1
  import { defineComponent as ge, ref as u, watch as ce, onMounted as ve, onBeforeUnmount as de, openBlock as N, createElementBlock as D, createBlock as Ne, createCommentVNode as W, createElementVNode as c, toDisplayString as me, unref as B, normalizeStyle as U, createVNode as be, h as R } from "vue";
2
- import { u as Re, a as ze, b as Ae, J as he, d as Le } from "./index-B5hprvcF.mjs";
2
+ import { u as Re, a as ze, b as Ae, k as he, n as Le } from "./index-BKpp6GvN.mjs";
3
3
  import { List as Pe, ChevronLeft as Fe, ChevronRight as He, Minimize2 as $e, Maximize2 as De, X as We } from "lucide-vue-next";
4
4
  import "foliate-js/view.js";
5
5
  import { _ as Be } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
@@ -1,14 +1,14 @@
1
- import { defineComponent as $, ref as f, computed as d, watch as T, unref as m, openBlock as t, createElementBlock as i, createElementVNode as l, toDisplayString as _, createBlock as E, normalizeClass as H, normalizeStyle as z, Fragment as S, renderList as G } from "vue";
2
- import { WrapText as M, Code as P, Eye as W } from "lucide-vue-next";
3
- import { u as X, a as D, b as R, X as V, S as j, T as q, f as A } from "./index-B5hprvcF.mjs";
4
- import { u as I } from "./useShikiHighlight-CpL0RAQg.mjs";
5
- import { _ as J } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
6
- import { _ as K } from "./EmptyState.vue_vue_type_script_setup_true_lang-Dna6LmVT.mjs";
7
- import { T as O } from "./base.types-DaftHyg7.mjs";
8
- const Q = {
1
+ import { defineComponent as F, ref as f, computed as d, watch as T, unref as m, openBlock as t, createElementBlock as i, createElementVNode as l, toDisplayString as _, createBlock as E, normalizeClass as H, normalizeStyle as P, Fragment as C, renderList as $ } from "vue";
2
+ import { WrapText as z, Code as M, Eye as W } from "lucide-vue-next";
3
+ import { u as D, a as R, b as V, P as j, G as q, l as A, t as I } from "./index-BKpp6GvN.mjs";
4
+ import { u as J } from "./useShikiHighlight-axL5ux5r.mjs";
5
+ import { _ as K } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
6
+ import { _ as O } from "./EmptyState.vue_vue_type_script_setup_true_lang-98G0nOSe.mjs";
7
+ import { T as Q } from "./base.types-DaftHyg7.mjs";
8
+ const U = {
9
9
  key: 0,
10
10
  class: "vfp-renderer-loading"
11
- }, U = { class: "vfp-renderer-loading-content" }, Y = { class: "vfp-renderer-loading-text" }, Z = {
11
+ }, X = { class: "vfp-renderer-loading-content" }, Y = { class: "vfp-renderer-loading-text" }, Z = {
12
12
  key: 3,
13
13
  class: "vfp-w-full vfp-h-full vfp-bg-surface-toolbar"
14
14
  }, ee = ["srcdoc", "title"], le = {
@@ -19,23 +19,23 @@ const Q = {
19
19
  key: 5,
20
20
  class: "vfp-w-full vfp-h-full vfp-overflow-auto",
21
21
  style: { background: "var(--fp-code-bg)" }
22
- }, oe = { class: "vfp-code-gutter" }, ae = ["innerHTML"], me = /* @__PURE__ */ $({
22
+ }, oe = { class: "vfp-code-gutter" }, ae = ["innerHTML"], me = /* @__PURE__ */ F({
23
23
  __name: "index",
24
24
  props: {
25
25
  url: {},
26
26
  fileName: {},
27
27
  emptyHint: {}
28
28
  },
29
- setup(b, { expose: C }) {
30
- const v = b, w = new O(), { t: s } = X(), L = D(), g = R(), o = f(!0), a = f(!1), r = f(""), p = f(!0), c = f(null), n = d(() => V(v.fileName)), N = d(() => n.value !== "text" ? r.value : ""), { lineHtmls: y, loading: B } = I(N, n), x = d(() => n.value === "html"), F = d(
31
- () => !p.value && !c.value && j(r.value) && q(v.emptyHint, "textual")
29
+ setup(b, { expose: G }) {
30
+ const v = b, w = new Q(), { t: s } = D(), L = R(), g = V(), o = f(!0), a = f(!1), r = f(""), p = f(!0), c = f(null), n = d(() => j(v.fileName)), N = d(() => n.value !== "text" ? r.value : ""), { lineHtmls: y, loading: S } = J(N, n), x = d(() => n.value === "html"), B = d(
31
+ () => !p.value && !c.value && q(r.value) && A(v.emptyHint, "textual")
32
32
  );
33
33
  T([o, a, p, x], () => {
34
34
  w.notify();
35
35
  }), T(() => v.url, async () => {
36
36
  g.begin(v.url), p.value = !0, c.value = null;
37
37
  try {
38
- const e = await A(v.url, { fetcher: L.value });
38
+ const e = await I(v.url, { fetcher: L.value });
39
39
  r.value = e, g.ready();
40
40
  } catch (e) {
41
41
  console.error(e), c.value = s.value("text.load_failed"), g.error(e);
@@ -45,14 +45,14 @@ const Q = {
45
45
  }, { immediate: !0 });
46
46
  const k = d(() => r.value.split(`
47
47
  `));
48
- return C({
48
+ return G({
49
49
  getToolbarGroups: () => {
50
50
  const e = [];
51
51
  return e.push({
52
52
  items: [
53
53
  {
54
54
  type: "button",
55
- icon: M,
55
+ icon: z,
56
56
  tooltip: o.value ? s.value("toolbar.wrap_off") : s.value("toolbar.wrap_on"),
57
57
  action: () => {
58
58
  o.value = !o.value;
@@ -64,7 +64,7 @@ const Q = {
64
64
  items: [
65
65
  {
66
66
  type: "button",
67
- icon: a.value ? P : W,
67
+ icon: a.value ? M : W,
68
68
  tooltip: a.value ? s.value("toolbar.source") : s.value("toolbar.preview"),
69
69
  action: () => {
70
70
  a.value = !a.value;
@@ -75,15 +75,15 @@ const Q = {
75
75
  }), e;
76
76
  },
77
77
  onToolbarChange: (e) => w.subscribe(e)
78
- }), (e, u) => p.value || n.value !== "text" && m(B) ? (t(), i("div", Q, [
79
- l("div", U, [
78
+ }), (e, u) => p.value || n.value !== "text" && m(S) ? (t(), i("div", U, [
79
+ l("div", X, [
80
80
  u[0] || (u[0] = l("div", { class: "vfp-renderer-spinner" }, null, -1)),
81
81
  l("span", Y, _(m(s)("common.loading")), 1)
82
82
  ])
83
- ])) : c.value ? (t(), E(J, {
83
+ ])) : c.value ? (t(), E(K, {
84
84
  key: 1,
85
85
  message: c.value
86
- }, null, 8, ["message"])) : F.value ? (t(), E(K, { key: 2 })) : a.value && n.value === "html" ? (t(), i("div", Z, [
86
+ }, null, 8, ["message"])) : B.value ? (t(), E(O, { key: 2 })) : a.value && n.value === "html" ? (t(), i("div", Z, [
87
87
  l("iframe", {
88
88
  srcdoc: r.value,
89
89
  sandbox: "allow-same-origin",
@@ -97,9 +97,9 @@ const Q = {
97
97
  ])) : (t(), i("div", te, [
98
98
  l("div", {
99
99
  class: H(["vfp-code-block with-line-numbers vfp-w-full", { "no-wrap": !o.value }]),
100
- style: z({ gridTemplateRows: `repeat(${k.value.length}, auto) minmax(1.5rem, 1fr)` })
100
+ style: P({ gridTemplateRows: `repeat(${k.value.length}, auto) minmax(1.5rem, 1fr)` })
101
101
  }, [
102
- (t(!0), i(S, null, G(k.value, (ne, h) => (t(), i(S, { key: h }, [
102
+ (t(!0), i(C, null, $(k.value, (ne, h) => (t(), i(C, { key: h }, [
103
103
  l("span", oe, _(h + 1), 1),
104
104
  l("span", {
105
105
  class: "vfp-code-line",
@@ -3,7 +3,7 @@ import F from "markdown-it";
3
3
  import W from "@traptitech/markdown-it-katex";
4
4
  import { codeToHtml as L } from "shiki";
5
5
  import { Code as z, Eye as J } from "lucide-vue-next";
6
- import { u as Q, a as U, b as X, e as Z, f as ee, d as te } from "./index-B5hprvcF.mjs";
6
+ import { u as Q, a as U, b as X, p as Z, t as ee, n as te } from "./index-BKpp6GvN.mjs";
7
7
  import { _ as oe } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
8
8
  import { T as re } from "./base.types-DaftHyg7.mjs";
9
9
  const ne = {
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as m, ref as i, watch as h, openBlock as f, createElementBlock as u, createElementVNode as o, toDisplayString as g, unref as y, createBlock as w } from "vue";
2
- import { u as x, a as k, b, J as T, q as B } from "./index-B5hprvcF.mjs";
2
+ import { u as x, a as k, b, k as T, S as B } from "./index-BKpp6GvN.mjs";
3
3
  import { _ as E } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
4
4
  const D = {
5
5
  key: 0,
@@ -7,7 +7,7 @@ const D = {
7
7
  }, G = { class: "vfp-renderer-loading-content" }, H = { class: "vfp-renderer-loading-text" }, L = {
8
8
  key: 2,
9
9
  class: "vfp-docx-container vfp-w-full vfp-h-full vfp-overflow-auto vfp-py-6 vfp-px-4"
10
- }, M = { class: "vfp-flex vfp-flex-col vfp-items-center" }, N = { class: "vfp-legacy-doc-paper" }, q = ["innerHTML"], S = /* @__PURE__ */ m({
10
+ }, M = { class: "vfp-flex vfp-flex-col vfp-items-center" }, S = { class: "vfp-legacy-doc-paper" }, C = ["innerHTML"], V = /* @__PURE__ */ m({
11
11
  __name: "index",
12
12
  props: {
13
13
  url: {}
@@ -40,13 +40,13 @@ const D = {
40
40
  message: r.value
41
41
  }, null, 8, ["message"])) : (f(), u("div", L, [
42
42
  o("div", M, [
43
- o("div", N, [
44
- o("div", { innerHTML: n.value }, null, 8, q)
43
+ o("div", S, [
44
+ o("div", { innerHTML: n.value }, null, 8, C)
45
45
  ])
46
46
  ])
47
47
  ]));
48
48
  }
49
49
  });
50
50
  export {
51
- S as default
51
+ V as default
52
52
  };
@@ -0,0 +1,220 @@
1
+ import { defineComponent as ne, ref as A, onMounted as re, watch as q, onBeforeUnmount as se, openBlock as T, createElementBlock as N, createElementVNode as D, toDisplayString as ae, unref as J, createCommentVNode as L, createVNode as le, normalizeStyle as ie } from "vue";
2
+ import { u as oe, a as ue, b as ce, d as fe, B as R, k, f as he, R as de, r as ve, e as pe, V as me, j as ge, A as P, i as we, h as xe } from "./index-BKpp6GvN.mjs";
3
+ import Se from "exceljs";
4
+ import { S as be } from "./index-CyBXARuf.mjs";
5
+ import { _ as ye } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
6
+ const _e = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full" }, Te = {
7
+ key: 0,
8
+ class: "vfp-renderer-overlay vfp-renderer-loading"
9
+ }, Ne = { class: "vfp-renderer-loading-content" }, ke = { class: "vfp-renderer-loading-text" }, Ie = {
10
+ key: 1,
11
+ class: "vfp-renderer-overlay"
12
+ }, Le = /* @__PURE__ */ ne({
13
+ __name: "index",
14
+ props: {
15
+ url: {},
16
+ emptyHint: {},
17
+ activeSheetName: {},
18
+ activeSheetIndex: {}
19
+ },
20
+ setup(U, { expose: X }) {
21
+ async function $(e) {
22
+ try {
23
+ return await new Se.Workbook().xlsx.load(e.slice().buffer);
24
+ } catch (t) {
25
+ throw t instanceof TypeError && /sheets/i.test(t.message) ? new k("xlsx.invalid_format") : t;
26
+ }
27
+ }
28
+ const i = U, { t: u } = oe(), K = ue(), I = ce(), c = A(!0), d = A(null), s = A(null);
29
+ let B = null, f = null, o = [], E = 100, l = { sheets: [], sheetName: "", sheetIndex: 0 }, v = null, p = null, g = null, F = !1, w = !1, x = !1, W = -1, S = null, m = null, b = { width: 0, height: 0 };
30
+ const C = () => B, H = (e) => {
31
+ _.emit("xlsx:sheet-change", { ...l, sheets: [...l.sheets] }, e);
32
+ }, Q = (e) => {
33
+ const t = P(o, e), n = t.sheetIndex !== l.sheetIndex || t.sheetName !== l.sheetName;
34
+ return l = t, n;
35
+ }, Y = (e) => {
36
+ const t = Q(e), n = g ?? (F ? "api" : "user"), r = w, a = x;
37
+ g = null, w = !1, x = !1, !a && (!t && !r || H(n));
38
+ }, G = () => {
39
+ const e = _.getGeneration();
40
+ W !== e && (W = e, H("init"));
41
+ }, O = (e, t, n = {}) => {
42
+ const r = C();
43
+ if (!(r != null && r.bottombar) || e < 0 || e >= r.bottombar.items.length) return !1;
44
+ g = t, w = !!n.force, x = !!n.silent, F = t === "api";
45
+ try {
46
+ r.bottombar.clickSwap2(r.bottombar.items[e]);
47
+ } finally {
48
+ F = !1, g = null, w = !1, x = !1;
49
+ }
50
+ return !0;
51
+ }, y = (e, t, n = !1) => {
52
+ const r = R(o, e);
53
+ if (r < 0) {
54
+ o.length === 0 && (v = e);
55
+ return;
56
+ }
57
+ !n && r === l.sheetIndex || O(r, t, { force: n });
58
+ }, Z = {
59
+ kind: "xlsx",
60
+ setActiveSheet: (e) => {
61
+ y({ name: e }, "api", !0);
62
+ },
63
+ setActiveSheetIndex: (e) => {
64
+ y({ index: e }, "api", !0);
65
+ },
66
+ getSheetState: () => ({ ...l, sheets: [...l.sheets] })
67
+ }, _ = fe({
68
+ id: "xlsx",
69
+ getState: () => ({ ...l, sheets: [...l.sheets] }),
70
+ attach: (e) => {
71
+ var a;
72
+ const t = (a = C()) == null ? void 0 : a.bottombar;
73
+ if (!t) return;
74
+ const n = t.swapFunc, r = (h) => {
75
+ n(h), Y(h);
76
+ };
77
+ return t.swapFunc = r, e.signal.addEventListener("abort", () => {
78
+ t.swapFunc === r && (t.swapFunc = n);
79
+ }), () => {
80
+ t.swapFunc === r && (t.swapFunc = n);
81
+ };
82
+ },
83
+ destroyNative: () => {
84
+ s.value && (s.value.innerHTML = "");
85
+ },
86
+ getController: () => Z
87
+ }), M = () => {
88
+ if (!s.value) return { width: 800, height: 600 };
89
+ const e = s.value.clientWidth, t = s.value.clientHeight, n = e > 100 ? e : 800, r = t > 100 ? t : 600;
90
+ return { width: n, height: r };
91
+ }, ee = () => {
92
+ if (v) {
93
+ const e = R(o, v);
94
+ if (e >= 0)
95
+ return v = null, e;
96
+ }
97
+ if (p) {
98
+ const e = R(o, { name: p });
99
+ if (e >= 0) return e;
100
+ }
101
+ return 0;
102
+ }, V = ({ initial: e, preserveSheet: t = !1 }) => {
103
+ if (!s.value || !f) return;
104
+ _.releaseNative(), t && (p = l.sheetName), s.value.innerHTML = "";
105
+ const { width: n, height: r } = M(), a = n < 640, h = new be(s.value, {
106
+ mode: "read",
107
+ showToolbar: !1,
108
+ showContextmenu: !1,
109
+ showGrid: !0,
110
+ row: {
111
+ len: E,
112
+ height: 25
113
+ },
114
+ col: {
115
+ len: 26,
116
+ width: a ? 80 : 100,
117
+ indexWidth: a ? 40 : 60,
118
+ minWidth: a ? 40 : 60
119
+ },
120
+ view: {
121
+ height: () => r,
122
+ width: () => n
123
+ }
124
+ });
125
+ h.loadData(f), B = h;
126
+ const j = ee();
127
+ p = null, _.setNative(h, s.value), j > 0 && O(j, "init", { silent: !0 }), e || G();
128
+ }, z = async () => {
129
+ if (I.begin(i.url), !!s.value) {
130
+ c.value = !0, d.value = null, p = null;
131
+ try {
132
+ const e = await K.value(i.url, {
133
+ mode: "cors",
134
+ credentials: "omit",
135
+ redirect: "follow"
136
+ });
137
+ if (!e.ok)
138
+ throw e.status === 404 ? new Error(u.value("xlsx.not_found")) : e.status === 403 ? new k("file.forbidden") : new k("file.load_failed_status", { status: e.status });
139
+ const t = he(await e.arrayBuffer());
140
+ let n;
141
+ if (t.byteLength === 0)
142
+ n = [{ name: "Sheet1" }];
143
+ else if (de(t)) {
144
+ const a = ve(t);
145
+ if (!a || !Array.isArray(a.sheets))
146
+ throw new k("xlsx.invalid_legacy_data");
147
+ n = pe(a);
148
+ } else
149
+ n = me(
150
+ await $(t)
151
+ );
152
+ f = n.length ? n : [{ name: "Sheet1" }], o = ge(f).map((a) => ({ name: a })), l = P(o, 0);
153
+ const r = te();
154
+ r && (v = r), E = we(n), V({ initial: !0 }), c.value = !1, I.ready(), G();
155
+ } catch (e) {
156
+ console.error(u.value("xlsx.parse_failed") + ":", e);
157
+ let t = u.value("xlsx.parse_failed");
158
+ e instanceof Error && (t = xe(u.value, e)), d.value = t, c.value = !1, I.error(e);
159
+ }
160
+ }
161
+ }, te = () => typeof i.activeSheetName == "string" && i.activeSheetName ? { name: i.activeSheetName } : typeof i.activeSheetIndex == "number" ? { index: i.activeSheetIndex } : null;
162
+ return re(() => {
163
+ if (!s.value) return;
164
+ let e = !0;
165
+ S = new ResizeObserver(() => {
166
+ if (e) {
167
+ e = !1, b = M();
168
+ return;
169
+ }
170
+ const t = M(), n = Math.abs(b.width - t.width), r = Math.abs(b.height - t.height);
171
+ n < 10 && r < 10 || (b = t, m !== null && clearTimeout(m), m = window.setTimeout(() => {
172
+ f && V({ initial: !1, preserveSheet: !0 });
173
+ }, 500));
174
+ }), S.observe(s.value), setTimeout(() => {
175
+ requestAnimationFrame(() => z());
176
+ }, 100);
177
+ }), q(
178
+ () => i.url,
179
+ (e) => {
180
+ e && z();
181
+ }
182
+ ), q(
183
+ () => [i.activeSheetName, i.activeSheetIndex],
184
+ ([e, t]) => {
185
+ if (typeof e == "string" && e) {
186
+ y({ name: e }, "api");
187
+ return;
188
+ }
189
+ typeof t == "number" && y({ index: t }, "api");
190
+ }
191
+ ), se(() => {
192
+ S && S.disconnect(), m !== null && clearTimeout(m), B = null, f = null, E = 100, s.value && (s.value.innerHTML = "");
193
+ }), X({
194
+ getToolbarGroups: () => []
195
+ }), (e, t) => (T(), N("div", _e, [
196
+ c.value ? (T(), N("div", Te, [
197
+ D("div", Ne, [
198
+ t[0] || (t[0] = D("div", { class: "vfp-renderer-spinner" }, null, -1)),
199
+ D("p", ke, ae(J(u)("xlsx.loading")), 1)
200
+ ])
201
+ ])) : L("", !0),
202
+ d.value && !c.value ? (T(), N("div", Ie, [
203
+ le(ye, {
204
+ message: J(u)("xlsx.load_failed"),
205
+ detail: d.value
206
+ }, null, 8, ["message", "detail"])
207
+ ])) : L("", !0),
208
+ d.value ? L("", !0) : (T(), N("div", {
209
+ key: 2,
210
+ ref_key: "containerRef",
211
+ ref: s,
212
+ class: "xlsx-spreadsheet-container vfp-w-full vfp-h-full",
213
+ style: ie({ opacity: c.value ? 0 : 1 })
214
+ }, null, 4))
215
+ ]));
216
+ }
217
+ });
218
+ export {
219
+ Le as default
220
+ };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as M, ref as u, watch as D, computed as H, openBlock as l, createElementBlock as a, createElementVNode as t, toDisplayString as m, unref as g, createBlock as P, normalizeStyle as B, Fragment as k, renderList as E } from "vue";
2
- import { u as F, a as G, b as N, f as X } from "./index-B5hprvcF.mjs";
3
- import { u as j } from "./useShikiHighlight-CpL0RAQg.mjs";
2
+ import { u as F, a as G, b as N, t as X } from "./index-BKpp6GvN.mjs";
3
+ import { u as j } from "./useShikiHighlight-axL5ux5r.mjs";
4
4
  import { _ as q } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
5
5
  const A = {
6
6
  key: 0,
@@ -1,5 +1,5 @@
1
- import { defineComponent as re, ref as z, onMounted as se, onUnmounted as ae, watch as le, openBlock as U, createElementBlock as V, createVNode as fe, createCommentVNode as q, createElementVNode as k, toDisplayString as ue, unref as de } from "vue";
2
- import { u as ce, a as pe, b as me, J as ve } from "./index-B5hprvcF.mjs";
1
+ import { defineComponent as re, ref as z, onMounted as se, onUnmounted as ae, watch as le, openBlock as H, createElementBlock as U, createVNode as fe, createCommentVNode as J, createElementVNode as V, toDisplayString as ue, unref as de } from "vue";
2
+ import { u as ce, a as pe, b as me, k as ve } from "./index-BKpp6GvN.mjs";
3
3
  import * as o from "three";
4
4
  import { OrbitControls as ge } from "three/examples/jsm/controls/OrbitControls";
5
5
  import { DXFLoader as he } from "three-dxf-loader";
@@ -68,7 +68,7 @@ const Ae = {
68
68
  }, Re = {
69
69
  key: 1,
70
70
  class: "vfp-absolute vfp-inset-0 vfp-renderer-loading vfp-bg-surface-3 vfp-z-10"
71
- }, Se = { class: "vfp-renderer-loading-content" }, ze = { class: "vfp-renderer-loading-text" }, ke = /* @__PURE__ */ re({
71
+ }, Se = { class: "vfp-renderer-loading-content" }, ze = { class: "vfp-renderer-loading-text" }, Ve = /* @__PURE__ */ re({
72
72
  __name: "index",
73
73
  props: {
74
74
  url: {},
@@ -95,7 +95,7 @@ const Ae = {
95
95
  e.near = Math.max(g * 1e-3, 1e-4), e.far = Math.max(a * 4, i.length() * 2 + g * 4, e.near * 100), e.position.set(i.x + a, i.y + a, i.z + a), e.lookAt(i), t.target.copy(i), t.update(), e.updateProjectionMatrix();
96
96
  }, v = m, { t: A } = ce(), Y = pe(), N = me(), x = z(null), P = z(!0), _ = z(null), T = z(!1), F = z(!0), G = z(!0);
97
97
  let r = null, f = null, d = null, u = null, C = null, p = null, w = null, R = null, D = null, S = null, M = !1, L = !0;
98
- const O = new xe(), H = (e, t, i) => {
98
+ const O = new xe(), k = (e, t, i) => {
99
99
  var s, c, g;
100
100
  return i != null && i.name ? ((s = i.name.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "" : t ? ((c = t.split(".").pop()) == null ? void 0 : c.toLowerCase()) || "" : ((g = e.split(".").pop()) == null ? void 0 : g.toLowerCase().split("?")[0]) || "";
101
101
  }, Z = () => {
@@ -130,7 +130,7 @@ const Ae = {
130
130
  b({
131
131
  getToolbarGroups: () => _e({
132
132
  cadRef: { resetView: Z, toggleWireframe: $, toggleGrid: K, toggleAxes: Q },
133
- isDxf: H(v.url, v.fileName, v.file) === "dxf",
133
+ isDxf: k(v.url, v.fileName, v.file) === "dxf",
134
134
  wireframe: T.value,
135
135
  showGrid: F.value,
136
136
  showAxes: G.value,
@@ -151,7 +151,7 @@ const Ae = {
151
151
  M = !1, S = new AbortController();
152
152
  const e = x.value, t = e.clientWidth, i = e.clientHeight;
153
153
  r = new o.Scene(), r.background = new o.Color(1710618);
154
- const s = H(v.url, v.fileName, v.file) === "dxf", c = Math.max(t, 1) / Math.max(i, 1);
154
+ const s = k(v.url, v.fileName, v.file) === "dxf", c = Math.max(t, 1) / Math.max(i, 1);
155
155
  f = s ? new o.OrthographicCamera(-c, c, 1, -1, 0, 1e6) : new o.PerspectiveCamera(45, c, 0.01, 1e6), f.position.set(100, 100, 100), d = new o.WebGLRenderer({ antialias: !0 }), d.setSize(t, i), d.setPixelRatio(Math.min(window.devicePixelRatio, 2)), L = !0, e.appendChild(d.domElement), u = new ge(f, d.domElement), u.enableDamping = !0, u.dampingFactor = 0.05, s && (u.enableRotate = !1, u.screenSpacePanning = !0, u.mouseButtons.LEFT = o.MOUSE.PAN, u.touches.ONE = o.TOUCH.PAN, u.touches.TWO = o.TOUCH.DOLLY_PAN);
156
156
  const g = new o.AmbientLight(16777215, 0.6);
157
157
  r.add(g);
@@ -166,7 +166,7 @@ const Ae = {
166
166
  l(), R = new ResizeObserver(ie), R.observe(e);
167
167
  }, oe = () => {
168
168
  if (N.begin(v.url), !r || !f || !u || M) return;
169
- const e = H(v.url, v.fileName, v.file);
169
+ const e = k(v.url, v.fileName, v.file);
170
170
  let t;
171
171
  const i = new o.LoadingManager();
172
172
  if (e === "dxf")
@@ -275,32 +275,32 @@ const Ae = {
275
275
  if (!x.value || !f || !d || M) return;
276
276
  const e = x.value.clientWidth, t = x.value.clientHeight;
277
277
  e <= 0 || t <= 0 || (f instanceof o.OrthographicCamera ? (f.right = f.top * e / t, f.left = -f.right) : f.aspect = e / t, f.updateProjectionMatrix(), d.setSize(e, t), L = !0);
278
- }, J = () => {
278
+ }, q = () => {
279
279
  M = !0, S && S.abort(), D !== null && (cancelAnimationFrame(D), D = null), R == null || R.disconnect(), R = null, C && (te(C), r == null || r.remove(C), C = null), p && (p.geometry.dispose(), p.material.dispose(), r == null || r.remove(p), p = null), w && (w.geometry.dispose(), w.material.dispose(), r == null || r.remove(w), w = null), u == null || u.dispose(), d == null || d.dispose(), x.value && (d != null && d.domElement) && x.value.contains(d.domElement) && x.value.removeChild(d.domElement), r = null, f = null, d = null, u = null;
280
280
  };
281
281
  return se(() => {
282
282
  I();
283
283
  }), ae(() => {
284
- J();
284
+ q();
285
285
  }), le(() => v.url, () => {
286
- J(), P.value = !0, _.value = null, x.value && I();
287
- }), (e, t) => (U(), V("div", {
286
+ q(), P.value = !0, _.value = null, x.value && I();
287
+ }), (e, t) => (H(), U("div", {
288
288
  ref_key: "containerRef",
289
289
  ref: x,
290
290
  class: "vfp-relative vfp-w-full vfp-h-full vfp-bg-media-bg"
291
291
  }, [
292
- _.value ? (U(), V("div", Ae, [
292
+ _.value ? (H(), U("div", Ae, [
293
293
  fe(ye, { message: _.value }, null, 8, ["message"])
294
- ])) : q("", !0),
295
- P.value ? (U(), V("div", Re, [
296
- k("div", Se, [
297
- t[0] || (t[0] = k("div", { class: "vfp-renderer-spinner" }, null, -1)),
298
- k("p", ze, ue(de(A)("cad.loading")), 1)
294
+ ])) : J("", !0),
295
+ P.value ? (H(), U("div", Re, [
296
+ V("div", Se, [
297
+ t[0] || (t[0] = V("div", { class: "vfp-renderer-spinner" }, null, -1)),
298
+ V("p", ze, ue(de(A)("cad.loading")), 1)
299
299
  ])
300
- ])) : q("", !0)
300
+ ])) : J("", !0)
301
301
  ], 512));
302
302
  }
303
303
  });
304
304
  export {
305
- ke as default
305
+ Ve as default
306
306
  };