@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
package/README.md CHANGED
@@ -382,6 +382,7 @@ Differences from `FilePreviewModal`:
382
382
  | `showClose` | `boolean` | ❌ | Whether to show the close button (default `true` for modal) |
383
383
  | `showNavigation` | `boolean` | ❌ | Whether to show file navigation arrows (default `true`) |
384
384
  | `loopNavigation` | `boolean` | ❌ | Whether file navigation wraps around (default `false`) |
385
+ | `emptyHint` | `'auto' \| 'always' \| 'never'` | ❌ | Empty-file hint policy: text types stay blank, structured types show hint (default `auto`) |
385
386
 
386
387
  ### FilePreviewModal Events
387
388
 
@@ -407,6 +408,7 @@ Differences from `FilePreviewModal`:
407
408
  | `showClose` | `boolean` | ❌ | `false` | Whether to show the close button (default `false` for embed) |
408
409
  | `showNavigation` | `boolean` | ❌ | `true` | Whether to show file navigation arrows |
409
410
  | `loopNavigation` | `boolean` | ❌ | `false` | Whether file navigation wraps around |
411
+ | `emptyHint` | `'auto' \| 'always' \| 'never'` | ❌ | `'auto'` | Empty-file hint policy: text types stay blank, structured types show hint |
410
412
 
411
413
  ### FilePreviewEmbed Events
412
414
 
package/README.zh-CN.md CHANGED
@@ -382,6 +382,7 @@ const files = [
382
382
  | `showClose` | `boolean` | ❌ | 是否显示关闭按钮(modal 模式默认 `true`) |
383
383
  | `showNavigation` | `boolean` | ❌ | 是否显示文件导航箭头(默认 `true`) |
384
384
  | `loopNavigation` | `boolean` | ❌ | 是否循环导航文件(默认 `false`) |
385
+ | `emptyHint` | `'auto' \| 'always' \| 'never'` | ❌ | 空内容提示策略(默认 `auto`):文本类保持空白,结构化类型显示提示 |
385
386
 
386
387
  ### FilePreviewModal 事件
387
388
 
@@ -407,6 +408,7 @@ const files = [
407
408
  | `showClose` | `boolean` | ❌ | `false` | 是否显示关闭按钮(embed 模式默认 `false`) |
408
409
  | `showNavigation` | `boolean` | ❌ | `true` | 是否显示文件导航箭头 |
409
410
  | `loopNavigation` | `boolean` | ❌ | `false` | 是否循环导航文件 |
411
+ | `emptyHint` | `'auto' \| 'always' \| 'never'` | ❌ | `'auto'` | 空内容提示策略:文本类保持空白,结构化类型显示提示 |
410
412
 
411
413
  ### FilePreviewEmbed 事件
412
414
 
@@ -1,4 +1,4 @@
1
- import { type PreviewFile, type PreviewFileInput, type Locale, type Messages, type Theme, type CustomRendererEventPayload, type RequestHandler, type RequestInitFactory, type ShouldFetchAsBlob } from '@eternalheart/file-preview-core';
1
+ import { type PreviewFile, type PreviewFileInput, type Locale, type Messages, type Theme, type CustomRendererEventPayload, type RequestHandler, type RequestInitFactory, type ShouldFetchAsBlob, type EmptyHintMode } from '@eternalheart/file-preview-core';
2
2
  import type { CustomRenderer } from './types';
3
3
  interface Props {
4
4
  files: PreviewFileInput[];
@@ -34,6 +34,13 @@ interface Props {
34
34
  showNavigation?: boolean;
35
35
  /** 是否循环导航文件,默认 false */
36
36
  loopNavigation?: boolean;
37
+ /**
38
+ * 空内容提示策略,默认 'auto'
39
+ * - 'auto':文本类(text/json)保持原生空白;结构化类型(xlsx/pptx)显示空提示
40
+ * - 'always':全部显示空提示,文案取 `messages['file.empty']`
41
+ * - 'never':一律保持空白
42
+ */
43
+ emptyHint?: EmptyHintMode;
37
44
  }
38
45
  declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
39
46
  close: () => any;
@@ -47,6 +54,7 @@ declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, imp
47
54
  requestInit: RequestInitFactory;
48
55
  requestHandler: RequestHandler;
49
56
  mode: "modal" | "embed";
57
+ emptyHint: EmptyHintMode;
50
58
  onClose: () => void;
51
59
  theme: Theme;
52
60
  customRenderers: CustomRenderer[];
@@ -1,4 +1,4 @@
1
- import type { PreviewFile, PreviewFileInput, Locale, Messages, Theme, CustomRendererEventPayload, RequestHandler, RequestInitFactory, ShouldFetchAsBlob } from '@eternalheart/file-preview-core';
1
+ import type { PreviewFile, PreviewFileInput, EmptyHintMode, Locale, Messages, Theme, CustomRendererEventPayload, RequestHandler, RequestInitFactory, ShouldFetchAsBlob } from '@eternalheart/file-preview-core';
2
2
  import type { CustomRenderer } from './types';
3
3
  interface Props {
4
4
  files: PreviewFileInput[];
@@ -34,6 +34,8 @@ interface Props {
34
34
  showNavigation?: boolean;
35
35
  /** 是否循环导航文件,默认 false */
36
36
  loopNavigation?: boolean;
37
+ /** 空内容提示策略,默认 'auto'(文本类空白、结构化类型提示) */
38
+ emptyHint?: EmptyHintMode;
37
39
  }
38
40
  declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
39
41
  close: () => any;
@@ -48,6 +50,7 @@ declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, imp
48
50
  requestHandler: RequestHandler;
49
51
  height: number | string;
50
52
  width: number | string;
53
+ emptyHint: EmptyHintMode;
51
54
  onClose: () => void;
52
55
  theme: Theme;
53
56
  currentIndex: number;
@@ -1,4 +1,4 @@
1
- import type { PreviewFile, PreviewFileInput, Locale, Messages, Theme, CustomRendererEventPayload, RequestHandler, RequestInitFactory, ShouldFetchAsBlob } from '@eternalheart/file-preview-core';
1
+ import type { PreviewFile, PreviewFileInput, EmptyHintMode, Locale, Messages, Theme, CustomRendererEventPayload, RequestHandler, RequestInitFactory, ShouldFetchAsBlob } from '@eternalheart/file-preview-core';
2
2
  import type { CustomRenderer } from './types';
3
3
  interface Props {
4
4
  files: PreviewFileInput[];
@@ -29,6 +29,8 @@ interface Props {
29
29
  showNavigation?: boolean;
30
30
  /** 是否循环导航文件,默认 false */
31
31
  loopNavigation?: boolean;
32
+ /** 空内容提示策略,默认 'auto'(文本类空白、结构化类型提示) */
33
+ emptyHint?: EmptyHintMode;
32
34
  }
33
35
  declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
34
36
  close: () => any;
@@ -41,6 +43,7 @@ declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, imp
41
43
  }>, {
42
44
  requestInit: RequestInitFactory;
43
45
  requestHandler: RequestHandler;
46
+ emptyHint: EmptyHintMode;
44
47
  theme: Theme;
45
48
  customRenderers: CustomRenderer[];
46
49
  locale: Locale;
@@ -0,0 +1,20 @@
1
+ import { defineComponent as s, openBlock as o, createElementBlock as p, createElementVNode as e, createVNode as n, unref as t, toDisplayString as f } from "vue";
2
+ import { FileMinus as c } from "lucide-vue-next";
3
+ import { u as i } from "./index-DZZN3kYi.mjs";
4
+ const a = { class: "vfp-renderer-empty" }, m = { class: "vfp-renderer-empty-content" }, _ = { class: "vfp-w-12 vfp-h-12 vfp-rounded-full vfp-bg-surface-2 vfp-flex vfp-items-center vfp-justify-center" }, l = { class: "vfp-renderer-empty-text" }, g = /* @__PURE__ */ s({
5
+ __name: "EmptyState",
6
+ setup(v) {
7
+ const { t: r } = i();
8
+ return (d, u) => (o(), p("div", a, [
9
+ e("div", m, [
10
+ e("div", _, [
11
+ n(t(c), { class: "vfp-w-6 vfp-h-6 vfp-text-fg-tertiary" })
12
+ ]),
13
+ e("p", l, f(t(r)("file.empty")), 1)
14
+ ])
15
+ ]));
16
+ }
17
+ });
18
+ export {
19
+ g as _
20
+ };
@@ -0,0 +1,32 @@
1
+ import { defineComponent as c, openBlock as r, createElementBlock as t, createElementVNode as o, createVNode as d, unref as l, createCommentVNode as n, toDisplayString as s } from "vue";
2
+ import { AlertCircle as a } from "lucide-vue-next";
3
+ const f = { class: "vfp-renderer-error" }, i = { class: "vfp-renderer-error-content" }, p = {
4
+ key: 0,
5
+ class: "vfp-w-12 vfp-h-12 vfp-rounded-full vfp-bg-red-500/10 vfp-flex vfp-items-center vfp-justify-center"
6
+ }, v = { class: "vfp-renderer-error-text" }, m = {
7
+ key: 0,
8
+ class: "vfp-renderer-error-detail"
9
+ }, y = /* @__PURE__ */ c({
10
+ __name: "RendererError",
11
+ props: {
12
+ message: {},
13
+ detail: {},
14
+ showIcon: { type: Boolean, default: !0 }
15
+ },
16
+ setup(e) {
17
+ return (u, _) => (r(), t("div", f, [
18
+ o("div", i, [
19
+ e.showIcon ? (r(), t("div", p, [
20
+ d(l(a), { class: "vfp-w-6 vfp-h-6 vfp-text-red-400" })
21
+ ])) : n("", !0),
22
+ o("div", null, [
23
+ o("p", v, s(e.message), 1),
24
+ e.detail ? (r(), t("p", m, s(e.detail), 1)) : n("", !0)
25
+ ])
26
+ ])
27
+ ]));
28
+ }
29
+ });
30
+ export {
31
+ y as _
32
+ };
@@ -1,4 +1,4 @@
1
- import { k as t } from "./index-CEk6FKm3.mjs";
1
+ import { k as t } from "./index-DZZN3kYi.mjs";
2
2
  let a = null;
3
3
  async function B() {
4
4
  return a !== null ? a : new Promise((o) => {
@@ -1,4 +1,4 @@
1
- import { k as o } from "./index-CEk6FKm3.mjs";
1
+ import { k as o } from "./index-DZZN3kYi.mjs";
2
2
  class l {
3
3
  /**
4
4
  * HEIC 格式浏览器均不原生支持,始终需要解码
@@ -1,12 +1,12 @@
1
- import { defineComponent as Me, ref as s, watch as H, onBeforeUnmount as te, onMounted as Re, computed as ae, openBlock as w, createElementBlock as U, normalizeStyle as le, createElementVNode as _, createTextVNode as Le, toDisplayString as y, unref as B, createCommentVNode as C, createBlock as oe, normalizeClass as ke } from "vue";
2
- import { u as Ce, f as Ee, N as Te, k as Ue, a as Ye, V as ze, Z as ne, C as Se } from "./index-CEk6FKm3.mjs";
3
- import { ZoomOut as Xe, ZoomIn as Be, Scan as De, Maximize2 as Oe, RotateCcw as We, RotateCw as Ze, RefreshCw as Pe } from "lucide-vue-next";
4
- import { _ as ie } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
5
- import { T as $e } from "./base.types-DaftHyg7.mjs";
6
- const je = {
1
+ import { defineComponent as Me, ref as s, watch as Z, onBeforeUnmount as te, onMounted as Re, computed as ae, openBlock as w, createElementBlock as U, normalizeStyle as le, createElementVNode as _, createTextVNode as Le, toDisplayString as b, unref as W, createCommentVNode as E, createBlock as ne, normalizeClass as ke } from "vue";
2
+ import { u as Ee, V as Ce, a as Te, k as Ue, n as Ye, R as ze, W as oe, s as Se } from "./index-DZZN3kYi.mjs";
3
+ import { ZoomOut as Xe, ZoomIn as We, Scan as Be, Maximize2 as De, RotateCcw as Oe, RotateCw as Pe, RefreshCw as $e } from "lucide-vue-next";
4
+ import { _ as ie } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
5
+ import { T as je } from "./base.types-DaftHyg7.mjs";
6
+ const He = {
7
7
  key: 0,
8
8
  class: "vfp-absolute vfp-inset-0 vfp-renderer-loading vfp-bg-surface-1/80 vfp-z-10"
9
- }, He = { class: "vfp-renderer-loading-content" }, Ne = { class: "vfp-renderer-loading-text vfp-text-fg-secondary" }, Ve = { key: 0 }, Ge = {
9
+ }, Ze = { class: "vfp-renderer-loading-content" }, Ve = { class: "vfp-renderer-loading-text" }, Ne = { key: 0 }, Ge = {
10
10
  key: 2,
11
11
  class: "vfp-renderer-loading"
12
12
  }, Ie = { class: "vfp-renderer-loading-content" }, Qe = { class: "vfp-renderer-loading-text" }, Ae = ["src"], Fe = {
@@ -23,10 +23,10 @@ const je = {
23
23
  file: {}
24
24
  },
25
25
  setup(se, { expose: ue }) {
26
- const d = se, G = new $e(), { t: i } = Ce(), u = s(1), E = s(0), T = s(!1), M = s(null), p = s(!1), D = s(0), R = s(null), L = s(""), k = s(1), Y = s(1), I = s(!1), l = s({ x: 0, y: 0 }), b = s(!1);
26
+ const f = se, G = new je(), { t: i } = Ee(), u = s(1), C = s(0), T = s(!1), M = s(null), p = s(!1), B = s(0), R = s(null), L = s(""), k = s(1), Y = s(1), I = s(!1), l = s({ x: 0, y: 0 }), y = s(!1);
27
27
  let z = { x: 0, y: 0 };
28
28
  const m = s(1), v = s({ width: 0, height: 0 });
29
- H([u, E], () => {
29
+ Z([u, C], () => {
30
30
  G.notify();
31
31
  }), ue({
32
32
  getToolbarGroups: () => [
@@ -46,7 +46,7 @@ const je = {
46
46
  },
47
47
  {
48
48
  type: "button",
49
- icon: Be,
49
+ icon: We,
50
50
  tooltip: i.value("toolbar.zoom_in"),
51
51
  action: re,
52
52
  disabled: u.value >= 10
@@ -57,15 +57,15 @@ const je = {
57
57
  items: [
58
58
  {
59
59
  type: "button",
60
- icon: De,
60
+ icon: Be,
61
61
  tooltip: i.value("toolbar.fit_to_window"),
62
62
  action: Q
63
63
  },
64
64
  {
65
65
  type: "button",
66
- icon: Oe,
66
+ icon: De,
67
67
  tooltip: i.value("toolbar.original_size"),
68
- action: de
68
+ action: fe
69
69
  }
70
70
  ]
71
71
  },
@@ -73,13 +73,13 @@ const je = {
73
73
  items: [
74
74
  {
75
75
  type: "button",
76
- icon: We,
76
+ icon: Oe,
77
77
  tooltip: i.value("toolbar.rotate_left"),
78
- action: fe
78
+ action: de
79
79
  },
80
80
  {
81
81
  type: "button",
82
- icon: Ze,
82
+ icon: Pe,
83
83
  tooltip: i.value("toolbar.rotate_right"),
84
84
  action: ve
85
85
  }
@@ -89,7 +89,7 @@ const je = {
89
89
  items: [
90
90
  {
91
91
  type: "button",
92
- icon: Pe,
92
+ icon: $e,
93
93
  tooltip: i.value("toolbar.reset"),
94
94
  action: he
95
95
  }
@@ -103,11 +103,11 @@ const je = {
103
103
  }, ce = () => {
104
104
  u.value = Math.max(u.value - 0.1, 0.01);
105
105
  }, ve = () => {
106
- E.value = (E.value + 90) % 360;
107
- }, fe = () => {
108
- E.value = (E.value - 90 + 360) % 360;
106
+ C.value = (C.value + 90) % 360;
109
107
  }, de = () => {
110
- u.value = 1, E.value = 0, l.value = { x: 0, y: 0 };
108
+ C.value = (C.value - 90 + 360) % 360;
109
+ }, fe = () => {
110
+ u.value = 1, C.value = 0, l.value = { x: 0, y: 0 };
111
111
  }, he = () => {
112
112
  Q();
113
113
  }, Q = () => {
@@ -116,69 +116,69 @@ const je = {
116
116
  u.value = Math.max(0.01, Math.min(10, Math.min(a, r))), l.value = { x: 0, y: 0 };
117
117
  }
118
118
  }, pe = s(null), h = s(null);
119
- let S = null, O = null, W = null;
119
+ let S = null, D = null, O = null;
120
120
  const g = /* @__PURE__ */ new Map();
121
- let Z = !1, P = 0, A = 1, N = { x: 0, y: 0 }, F = 0;
122
- H(
123
- () => [d.url, d.file],
121
+ let P = !1, $ = 0, A = 1, V = { x: 0, y: 0 }, F = 0;
122
+ Z(
123
+ () => [f.url, f.file],
124
124
  async () => {
125
- if (L.value = "", T.value = !1, M.value = null, p.value = !1, R.value = null, D.value = 0, l.value = { x: 0, y: 0 }, m.value = 1, u.value = 1, k.value = 1, Y.value = 1, I.value = !1, S && (URL.revokeObjectURL(S), S = null), g.forEach((e) => URL.revokeObjectURL(e)), g.clear(), O = null, W = null, !d.file) {
126
- L.value = d.url;
125
+ if (L.value = "", T.value = !1, M.value = null, p.value = !1, R.value = null, B.value = 0, l.value = { x: 0, y: 0 }, m.value = 1, u.value = 1, k.value = 1, Y.value = 1, I.value = !1, S && (URL.revokeObjectURL(S), S = null), g.forEach((e) => URL.revokeObjectURL(e)), g.clear(), D = null, O = null, !f.file) {
126
+ L.value = f.url;
127
127
  return;
128
128
  }
129
129
  try {
130
- const e = await Ee(d.file), t = await Te(e);
130
+ const e = await Ce(f.file), t = await Te(e);
131
131
  if (!t || !await t.needsDecode(e)) {
132
- L.value = d.url;
132
+ L.value = f.url;
133
133
  return;
134
134
  }
135
135
  p.value = !0;
136
136
  let a;
137
- if (d.file instanceof Blob)
138
- a = d.file;
139
- else if (d.file.file instanceof Blob)
140
- a = d.file.file;
137
+ if (f.file instanceof Blob)
138
+ a = f.file;
139
+ else if (f.file.file instanceof Blob)
140
+ a = f.file.file;
141
141
  else {
142
- const n = await fetch(d.url);
143
- if (!n.ok) throw new Ue("file.load_failed");
144
- a = await n.blob();
142
+ const o = await fetch(f.url);
143
+ if (!o.ok) throw new Ue("file.load_failed");
144
+ a = await o.blob();
145
145
  }
146
- if (O = a, W = t, e.startsWith("image/x-") && (I.value = !0), t.getMetadata)
146
+ if (D = a, O = t, e.startsWith("image/x-") && (I.value = !0), t.getMetadata)
147
147
  try {
148
- const n = await t.getMetadata(a);
149
- n.pageCount && n.pageCount > 1 && (Y.value = n.pageCount);
148
+ const o = await t.getMetadata(a);
149
+ o.pageCount && o.pageCount > 1 && (Y.value = o.pageCount);
150
150
  } catch {
151
151
  }
152
152
  const c = {
153
153
  page: 1,
154
154
  fullQuality: !1,
155
- onProgress: (n) => {
156
- D.value = n;
155
+ onProgress: (o) => {
156
+ B.value = o;
157
157
  }
158
158
  };
159
- let o;
159
+ let n;
160
160
  if (Ye(e))
161
161
  try {
162
- o = await ze(
162
+ n = await ze(
163
163
  e,
164
164
  await a.arrayBuffer(),
165
165
  { page: 1, fullQuality: !1 }
166
166
  );
167
167
  } catch {
168
- o = await t.decode(a, c);
168
+ n = await t.decode(a, c);
169
169
  }
170
170
  else
171
- o = await t.decode(a, c);
172
- const f = typeof o == "string" ? o : URL.createObjectURL(o);
173
- S = f, g.set(1, f), L.value = f, p.value = !1;
171
+ n = await t.decode(a, c);
172
+ const d = typeof n == "string" ? n : URL.createObjectURL(n);
173
+ S = d, g.set(1, d), L.value = d, p.value = !1;
174
174
  } catch (e) {
175
- R.value = ne(i.value, e) || i.value("image.decode_failed"), p.value = !1;
175
+ R.value = oe(i.value, e) || i.value("image.decode_failed"), p.value = !1;
176
176
  }
177
177
  },
178
178
  { immediate: !0 }
179
179
  );
180
180
  const K = async (e) => {
181
- if (!O || !W || e < 1 || e > Y.value) return;
181
+ if (!D || !O || e < 1 || e > Y.value) return;
182
182
  const t = g.get(e);
183
183
  if (t) {
184
184
  k.value = e, L.value = t;
@@ -186,32 +186,32 @@ const je = {
186
186
  }
187
187
  p.value = !0;
188
188
  try {
189
- const a = await W.decode(O, { page: e }), r = typeof a == "string" ? a : URL.createObjectURL(a);
189
+ const a = await O.decode(D, { page: e }), r = typeof a == "string" ? a : URL.createObjectURL(a);
190
190
  if (g.size >= 10) {
191
191
  const c = g.keys().next().value;
192
192
  if (c !== void 0) {
193
- const o = g.get(c);
194
- o && URL.revokeObjectURL(o), g.delete(c);
193
+ const n = g.get(c);
194
+ n && URL.revokeObjectURL(n), g.delete(c);
195
195
  }
196
196
  }
197
197
  g.set(e, r), k.value = e, L.value = r, p.value = !1;
198
198
  } catch (a) {
199
- R.value = ne(i.value, a) || i.value("image.page_decode_failed"), p.value = !1;
199
+ R.value = oe(i.value, a) || i.value("image.page_decode_failed"), p.value = !1;
200
200
  }
201
201
  };
202
202
  te(() => {
203
203
  S && URL.revokeObjectURL(S), g.forEach((t) => URL.revokeObjectURL(t)), g.clear();
204
204
  const e = h.value;
205
- e && e.removeEventListener("wheel", V);
206
- }), H(u, (e) => {
205
+ e && e.removeEventListener("wheel", N);
206
+ }), Z(u, (e) => {
207
207
  m.value = e;
208
- }), H(m, (e) => {
208
+ }), Z(m, (e) => {
209
209
  u.value = e;
210
210
  });
211
- const $ = (e, t) => {
211
+ const j = (e, t) => {
212
212
  const a = h.value;
213
213
  if (!a || v.value.width === 0) return e;
214
- const r = a.clientWidth, c = a.clientHeight, o = v.value.width * t, f = v.value.height * t, n = Math.min(80, r * 0.15, c * 0.15), x = (r + o) / 2 - n, X = (c + f) / 2 - n;
214
+ const r = a.clientWidth, c = a.clientHeight, n = v.value.width * t, d = v.value.height * t, o = Math.min(80, r * 0.15, c * 0.15), x = (r + n) / 2 - o, X = (c + d) / 2 - o;
215
215
  return {
216
216
  x: x > 0 ? Math.max(-x, Math.min(x, e.x)) : 0,
217
217
  y: X > 0 ? Math.max(-X, Math.min(X, e.y)) : 0
@@ -220,40 +220,40 @@ const je = {
220
220
  T.value = !0;
221
221
  const t = e.currentTarget;
222
222
  if (v.value = { width: t.naturalWidth, height: t.naturalHeight }, h.value && v.value.width > 0 && v.value.height > 0) {
223
- const a = h.value.clientWidth, r = h.value.clientHeight, c = a / v.value.width, o = r / v.value.height, f = Math.min(c, o);
224
- u.value = Math.max(0.01, Math.min(10, f)), l.value = { x: 0, y: 0 };
223
+ const a = h.value.clientWidth, r = h.value.clientHeight, c = a / v.value.width, n = r / v.value.height, d = Math.min(c, n);
224
+ u.value = Math.max(0.01, Math.min(10, d)), l.value = { x: 0, y: 0 };
225
225
  }
226
226
  }, ge = () => {
227
227
  M.value = i.value("image.load_failed"), T.value = !0;
228
- }, ye = () => {
228
+ }, be = () => {
229
229
  l.value = { x: 0, y: 0 }, u.value = 1;
230
- }, V = (e) => {
230
+ }, N = (e) => {
231
231
  e.preventDefault(), e.stopPropagation();
232
232
  const t = h.value;
233
233
  if (!t) return;
234
- const a = t.getBoundingClientRect(), r = e.clientX - a.left - a.width / 2, c = e.clientY - a.top - a.height / 2, o = e.deltaY > 0 ? -0.05 : 0.05, f = m.value, n = Math.max(0.01, Math.min(10, f + o)), x = n / f;
235
- l.value = $(
234
+ const a = t.getBoundingClientRect(), r = e.clientX - a.left - a.width / 2, c = e.clientY - a.top - a.height / 2, n = e.deltaY > 0 ? -0.05 : 0.05, d = m.value, o = Math.max(0.01, Math.min(10, d + n)), x = o / d;
235
+ l.value = j(
236
236
  {
237
237
  x: r - x * (r - l.value.x),
238
238
  y: c - x * (c - l.value.y)
239
239
  },
240
- n
241
- ), m.value = n;
240
+ o
241
+ ), m.value = o;
242
242
  };
243
243
  Re(() => {
244
244
  const e = h.value;
245
- e && (e.addEventListener("wheel", V, { passive: !1 }), e.addEventListener("touchstart", J, { passive: !1 }), e.addEventListener("touchmove", ee, { passive: !1 }), e.addEventListener("touchend", j), e.addEventListener("touchcancel", j));
245
+ e && (e.addEventListener("wheel", N, { passive: !1 }), e.addEventListener("touchstart", J, { passive: !1 }), e.addEventListener("touchmove", ee, { passive: !1 }), e.addEventListener("touchend", H), e.addEventListener("touchcancel", H));
246
246
  }), te(() => {
247
247
  const e = h.value;
248
- e && (e.removeEventListener("wheel", V), e.removeEventListener("touchstart", J), e.removeEventListener("touchmove", ee), e.removeEventListener("touchend", j), e.removeEventListener("touchcancel", j));
248
+ e && (e.removeEventListener("wheel", N), e.removeEventListener("touchstart", J), e.removeEventListener("touchmove", ee), e.removeEventListener("touchend", H), e.removeEventListener("touchcancel", H));
249
249
  });
250
- const be = (e) => {
251
- Z || e.button === 0 && (b.value = !0, z = {
250
+ const ye = (e) => {
251
+ P || e.button === 0 && (y.value = !0, z = {
252
252
  x: e.clientX - l.value.x,
253
253
  y: e.clientY - l.value.y
254
254
  });
255
255
  }, xe = (e) => {
256
- Z || b.value && (l.value = $(
256
+ P || y.value && (l.value = j(
257
257
  {
258
258
  x: e.clientX - z.x,
259
259
  y: e.clientY - z.y
@@ -261,26 +261,26 @@ const je = {
261
261
  m.value
262
262
  ));
263
263
  }, q = () => {
264
- Z || (b.value = !1);
264
+ P || (y.value = !1);
265
265
  }, J = (e) => {
266
- Z = !0, e.preventDefault();
266
+ P = !0, e.preventDefault();
267
267
  const t = e.touches;
268
268
  if (t.length === 1) {
269
- b.value = !0, z = {
269
+ y.value = !0, z = {
270
270
  x: t[0].clientX - l.value.x,
271
271
  y: t[0].clientY - l.value.y
272
272
  };
273
273
  const a = Date.now();
274
274
  a - F < 300 && (l.value = { x: 0, y: 0 }, u.value = 1), F = a;
275
- } else t.length === 2 && (b.value = !1, P = Math.hypot(
275
+ } else t.length === 2 && (y.value = !1, $ = Math.hypot(
276
276
  t[1].clientX - t[0].clientX,
277
277
  t[1].clientY - t[0].clientY
278
- ), A = m.value, N = { ...l.value });
278
+ ), A = m.value, V = { ...l.value });
279
279
  }, ee = (e) => {
280
280
  e.preventDefault();
281
281
  const t = e.touches;
282
- if (t.length === 1 && b.value)
283
- l.value = $(
282
+ if (t.length === 1 && y.value)
283
+ l.value = j(
284
284
  {
285
285
  x: t[0].clientX - z.x,
286
286
  y: t[0].clientY - z.y
@@ -294,58 +294,58 @@ const je = {
294
294
  t[1].clientX - t[0].clientX,
295
295
  t[1].clientY - t[0].clientY
296
296
  );
297
- if (Math.abs(r - P) < 5) return;
298
- const c = r / P, o = Math.max(0.01, Math.min(10, A * c)), f = a.getBoundingClientRect(), n = (t[0].clientX + t[1].clientX) / 2 - f.left - f.width / 2, x = (t[0].clientY + t[1].clientY) / 2 - f.top - f.height / 2, X = o / m.value;
299
- l.value = $(
297
+ if (Math.abs(r - $) < 5) return;
298
+ const c = r / $, n = Math.max(0.01, Math.min(10, A * c)), d = a.getBoundingClientRect(), o = (t[0].clientX + t[1].clientX) / 2 - d.left - d.width / 2, x = (t[0].clientY + t[1].clientY) / 2 - d.top - d.height / 2, X = n / m.value;
299
+ l.value = j(
300
300
  {
301
- x: n - X * (n - N.x),
302
- y: x - X * (x - N.y)
301
+ x: o - X * (o - V.x),
302
+ y: x - X * (x - V.y)
303
303
  },
304
- o
305
- ), m.value = o;
304
+ n
305
+ ), m.value = n;
306
306
  }
307
- }, j = () => {
308
- b.value = !1, P = 0;
307
+ }, H = () => {
308
+ y.value = !1, $ = 0;
309
309
  }, we = ae(() => ({
310
- transform: `translate(${l.value.x}px, ${l.value.y}px) scale(${m.value}) rotate(${E.value}deg)`,
310
+ transform: `translate(${l.value.x}px, ${l.value.y}px) scale(${m.value}) rotate(${C.value}deg)`,
311
311
  transformOrigin: "center",
312
- transition: b.value ? "none" : "transform 0.3s ease-out",
312
+ transition: y.value ? "none" : "transform 0.3s ease-out",
313
313
  opacity: T.value && !M.value && !R.value ? 1 : 0
314
- })), _e = ae(() => d.fileSize == null ? "" : ` · ${Se(d.fileSize)}`);
314
+ })), _e = ae(() => f.fileSize == null ? "" : ` · ${Se(f.fileSize)}`);
315
315
  return (e, t) => (w(), U("div", {
316
316
  ref_key: "containerRef",
317
317
  ref: h,
318
318
  class: "vfp-relative vfp-flex vfp-items-center vfp-justify-center vfp-w-full vfp-h-full vfp-overflow-hidden",
319
- style: le({ cursor: b.value ? "grabbing" : "grab", touchAction: "none" }),
320
- onMousedown: be,
319
+ style: le({ cursor: y.value ? "grabbing" : "grab", touchAction: "none" }),
320
+ onMousedown: ye,
321
321
  onMousemove: xe,
322
322
  onMouseup: q,
323
323
  onMouseleave: q
324
324
  }, [
325
- p.value ? (w(), U("div", je, [
326
- _("div", He, [
325
+ p.value ? (w(), U("div", He, [
326
+ _("div", Ze, [
327
327
  t[2] || (t[2] = _("div", { class: "vfp-renderer-spinner" }, null, -1)),
328
- _("p", Ne, [
329
- Le(y(B(i)("image.decoding")) + " ", 1),
330
- D.value > 0 ? (w(), U("span", Ve, y(Math.round(D.value)) + "%", 1)) : C("", !0)
328
+ _("p", Ve, [
329
+ Le(b(W(i)("image.decoding")) + " ", 1),
330
+ B.value > 0 ? (w(), U("span", Ne, b(Math.round(B.value)) + "%", 1)) : E("", !0)
331
331
  ])
332
332
  ])
333
- ])) : C("", !0),
334
- R.value ? (w(), oe(ie, {
333
+ ])) : E("", !0),
334
+ R.value ? (w(), ne(ie, {
335
335
  key: 1,
336
- message: B(i)("image.decode_failed"),
336
+ message: W(i)("image.decode_failed"),
337
337
  detail: R.value
338
- }, null, 8, ["message", "detail"])) : C("", !0),
338
+ }, null, 8, ["message", "detail"])) : E("", !0),
339
339
  !T.value && !M.value && !p.value && !R.value ? (w(), U("div", Ge, [
340
340
  _("div", Ie, [
341
341
  t[3] || (t[3] = _("div", { class: "vfp-renderer-spinner" }, null, -1)),
342
- _("span", Qe, y(B(i)("common.loading")), 1)
342
+ _("span", Qe, b(W(i)("common.loading")), 1)
343
343
  ])
344
- ])) : C("", !0),
345
- M.value ? (w(), oe(ie, {
344
+ ])) : E("", !0),
345
+ M.value ? (w(), ne(ie, {
346
346
  key: 3,
347
347
  message: M.value
348
- }, null, 8, ["message"])) : C("", !0),
348
+ }, null, 8, ["message"])) : E("", !0),
349
349
  L.value ? (w(), U("img", {
350
350
  key: 4,
351
351
  ref_key: "imgRef",
@@ -357,24 +357,24 @@ const je = {
357
357
  draggable: !1,
358
358
  onLoad: me,
359
359
  onError: ge,
360
- onDblclick: ye
361
- }, null, 46, Ae)) : C("", !0),
362
- T.value && !M.value && v.value.width > 0 ? (w(), U("div", Fe, y(v.value.width) + " × " + y(v.value.height) + y(_e.value), 1)) : C("", !0),
360
+ onDblclick: be
361
+ }, null, 46, Ae)) : E("", !0),
362
+ T.value && !M.value && v.value.width > 0 ? (w(), U("div", Fe, b(v.value.width) + " × " + b(v.value.height) + b(_e.value), 1)) : E("", !0),
363
363
  Y.value > 1 ? (w(), U("div", Ke, [
364
364
  _("button", {
365
365
  type: "button",
366
366
  disabled: k.value <= 1 || p.value,
367
367
  class: "vfp-px-2 vfp-py-0.5 vfp-rounded hover:vfp-bg-surface-nav-hover disabled:vfp-opacity-40 disabled:vfp-cursor-not-allowed",
368
368
  onClick: t[0] || (t[0] = (a) => K(k.value - 1))
369
- }, y(B(i)("toolbar.prev_page")), 9, qe),
370
- _("span", Je, y(k.value) + " / " + y(Y.value), 1),
369
+ }, b(W(i)("toolbar.prev_page")), 9, qe),
370
+ _("span", Je, b(k.value) + " / " + b(Y.value), 1),
371
371
  _("button", {
372
372
  type: "button",
373
373
  disabled: k.value >= Y.value || p.value,
374
374
  class: "vfp-px-2 vfp-py-0.5 vfp-rounded hover:vfp-bg-surface-nav-hover disabled:vfp-opacity-40 disabled:vfp-cursor-not-allowed",
375
375
  onClick: t[1] || (t[1] = (a) => K(k.value + 1))
376
- }, y(B(i)("toolbar.next_page")), 9, et)
377
- ])) : C("", !0)
376
+ }, b(W(i)("toolbar.next_page")), 9, et)
377
+ ])) : E("", !0)
378
378
  ], 36));
379
379
  }
380
380
  });
@@ -1,8 +1,8 @@
1
1
  import { defineComponent as be, ref as c, watch as ce, onMounted as ue, onBeforeUnmount as ve, openBlock as S, createElementBlock as D, createBlock as Se, createCommentVNode as W, createElementVNode as u, toDisplayString as de, unref as B, normalizeStyle as U, createVNode as me, h as N } from "vue";
2
- import { u as Ne, b as Re, k as he, _ as ze } from "./index-CEk6FKm3.mjs";
2
+ import { u as Ne, c as Re, k as he, _ as ze } from "./index-DZZN3kYi.mjs";
3
3
  import { List as Ae, ChevronLeft as Le, ChevronRight as Fe, Minimize2 as Pe, Maximize2 as He, X as $e } from "lucide-vue-next";
4
4
  import "foliate-js/view.js";
5
- import { _ as De } from "./RendererError.vue_vue_type_script_setup_true_lang-BNoENOWX.mjs";
5
+ import { _ as De } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
6
6
  import { T as We } from "./base.types-DaftHyg7.mjs";
7
7
  const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-center vfp-bg-surface-1 vfp-overflow-hidden" }, Ue = {
8
8
  key: 1,