@eternalheart/react-file-preview 1.3.12 → 1.3.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.
- package/README.md +27 -0
- package/README.zh-CN.md +27 -0
- package/lib/chunks/{index-CA8OvqPT.mjs → index-8pqs-pW7.mjs} +3 -3
- package/lib/chunks/{index-CA8OvqPT.mjs.map → index-8pqs-pW7.mjs.map} +1 -1
- package/lib/chunks/{index-BPsJtP6e.mjs → index-B0QA380T.mjs} +2 -2
- package/lib/chunks/{index-BPsJtP6e.mjs.map → index-B0QA380T.mjs.map} +1 -1
- package/lib/chunks/{index-CJGtdAy7.mjs → index-B2IlXQPc.mjs} +2 -2
- package/lib/chunks/{index-CJGtdAy7.mjs.map → index-B2IlXQPc.mjs.map} +1 -1
- package/lib/chunks/{index-DJZWizxK.mjs → index-BgMhDDkd.mjs} +2 -2
- package/lib/chunks/{index-DJZWizxK.mjs.map → index-BgMhDDkd.mjs.map} +1 -1
- package/lib/chunks/{index-DAo4n3Mq.mjs → index-BvjPzMFc.mjs} +2 -2
- package/lib/chunks/{index-DAo4n3Mq.mjs.map → index-BvjPzMFc.mjs.map} +1 -1
- package/lib/chunks/{index-vaILKWGV.mjs → index-C8r2-Evl.mjs} +3 -3
- package/lib/chunks/{index-vaILKWGV.mjs.map → index-C8r2-Evl.mjs.map} +1 -1
- package/lib/chunks/{index-BBvL23cc.mjs → index-CIqtwqgy.mjs} +2 -2
- package/lib/chunks/{index-BBvL23cc.mjs.map → index-CIqtwqgy.mjs.map} +1 -1
- package/lib/chunks/{index-DrgP7cc7.mjs → index-CRn7LdHD.mjs} +3 -3
- package/lib/chunks/{index-DrgP7cc7.mjs.map → index-CRn7LdHD.mjs.map} +1 -1
- package/lib/chunks/{index-BCbSb9Ob.mjs → index-CWCNvV2X.mjs} +21 -21
- package/lib/chunks/{index-BCbSb9Ob.mjs.map → index-CWCNvV2X.mjs.map} +1 -1
- package/lib/chunks/{index-DlptjfMf.mjs → index-Ctf8mG_u.mjs} +2 -2
- package/lib/chunks/{index-DlptjfMf.mjs.map → index-Ctf8mG_u.mjs.map} +1 -1
- package/lib/chunks/{index-DRCA7PhQ.mjs → index-DN4Lc1dx.mjs} +2 -2
- package/lib/chunks/{index-DRCA7PhQ.mjs.map → index-DN4Lc1dx.mjs.map} +1 -1
- package/lib/chunks/{index-DdkkEzw3.mjs → index-DYNPnFww.mjs} +2 -2
- package/lib/chunks/{index-DdkkEzw3.mjs.map → index-DYNPnFww.mjs.map} +1 -1
- package/lib/chunks/{index-D2t64h6I.mjs → index-DZxzCMp2.mjs} +2 -2
- package/lib/chunks/{index-D2t64h6I.mjs.map → index-DZxzCMp2.mjs.map} +1 -1
- package/lib/chunks/index-DfkP0zX3.mjs +357 -0
- package/lib/chunks/index-DfkP0zX3.mjs.map +1 -0
- package/lib/chunks/{index-DCTwUpKS.mjs → index-DqXfw2eb.mjs} +2 -2
- package/lib/chunks/{index-DCTwUpKS.mjs.map → index-DqXfw2eb.mjs.map} +1 -1
- package/lib/chunks/index-DtZwBUd0.mjs +270 -0
- package/lib/chunks/index-DtZwBUd0.mjs.map +1 -0
- package/lib/chunks/{index-qEUWJYQ5.mjs → index-_EpQHlUY.mjs} +2 -2
- package/lib/chunks/{index-qEUWJYQ5.mjs.map → index-_EpQHlUY.mjs.map} +1 -1
- package/lib/chunks/{index-Cxf4CLJZ.mjs → index-p4mew8Hx.mjs} +2 -2
- package/lib/chunks/{index-Cxf4CLJZ.mjs.map → index-p4mew8Hx.mjs.map} +1 -1
- package/lib/chunks/{index-Dx8aLIDX.mjs → index-sft0uUd7.mjs} +2 -2
- package/lib/chunks/{index-Dx8aLIDX.mjs.map → index-sft0uUd7.mjs.map} +1 -1
- package/lib/chunks/{useShikiHighlight-Cq02e63J.mjs → useShikiHighlight-CDDi36pF.mjs} +2 -2
- package/lib/chunks/{useShikiHighlight-Cq02e63J.mjs.map → useShikiHighlight-CDDi36pF.mjs.map} +1 -1
- package/lib/components/ResizableSplit.d.ts +12 -2
- package/lib/components/ResizableSplit.d.ts.map +1 -1
- package/lib/index.cjs +30 -30
- package/lib/index.cjs.map +1 -1
- package/lib/index.css +1 -1
- package/lib/index.mjs +1 -1
- package/lib/renderers/Image/index.d.ts.map +1 -1
- package/lib/renderers/Zip/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/lib/chunks/index-CeQf1qNC.mjs +0 -301
- package/lib/chunks/index-CeQf1qNC.mjs.map +0 -1
- package/lib/chunks/index-fhiaa9rv.mjs +0 -222
- package/lib/chunks/index-fhiaa9rv.mjs.map +0 -1
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { jsxs as X, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { useState as i, useRef as d, useEffect as j, useCallback as x } from "react";
|
|
3
|
+
import { motion as Le } from "framer-motion";
|
|
4
|
+
import { Loader2 as Me } from "lucide-react";
|
|
5
|
+
import { u as Re, G as Ee, q as Ue } from "./index-CWCNvV2X.mjs";
|
|
6
|
+
import { R as pe } from "./RendererError-BH6fzLrN.mjs";
|
|
7
|
+
const Be = ({
|
|
8
|
+
url: F,
|
|
9
|
+
zoom: Z,
|
|
10
|
+
rotation: he,
|
|
11
|
+
resetKey: ee,
|
|
12
|
+
fileSize: L,
|
|
13
|
+
file: P,
|
|
14
|
+
onZoomChange: o,
|
|
15
|
+
onNaturalWidthChange: A,
|
|
16
|
+
onNaturalHeightChange: H
|
|
17
|
+
}) => {
|
|
18
|
+
const te = Re(), [q, K] = i(!1), [M, re] = i(null), [G, y] = i(!1), [ne, ce] = i(0), [k, Q] = i(null), [se, R] = i(""), [B, z] = i(1), [T, ae] = i(1), [p, b] = i({ x: 0, y: 0 }), [E, $] = i(!1), [U, oe] = i({ x: 0, y: 0 }), [v, D] = i(1), [g, me] = i({ width: 0, height: 0 }), be = d(null), N = d(null), Y = d(null), O = d(null), S = d(null), f = d(/* @__PURE__ */ new Map()), W = d(!1), _ = d(0), ie = d(1), J = d({ x: 0, y: 0 }), le = d(0);
|
|
19
|
+
j(() => {
|
|
20
|
+
let e = !1;
|
|
21
|
+
return (async () => {
|
|
22
|
+
if (R(""), K(!1), re(null), y(!1), Q(null), ce(0), b({ x: 0, y: 0 }), D(1), z(1), ae(1), Y.current && (URL.revokeObjectURL(Y.current), Y.current = null), f.current.forEach((r) => URL.revokeObjectURL(r)), f.current.clear(), O.current = null, S.current = null, !P) {
|
|
23
|
+
e || R(F);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
const r = await Ee(P), n = await Ue(r);
|
|
28
|
+
if (!n || !await n.needsDecode(r)) {
|
|
29
|
+
e || R(F);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
y(!0);
|
|
33
|
+
let c;
|
|
34
|
+
if (P instanceof Blob)
|
|
35
|
+
c = P;
|
|
36
|
+
else {
|
|
37
|
+
const s = await fetch(F);
|
|
38
|
+
if (!s.ok) throw new Error("Failed to fetch file");
|
|
39
|
+
c = await s.blob();
|
|
40
|
+
}
|
|
41
|
+
if (e) return;
|
|
42
|
+
if (O.current = c, S.current = n, O.current = c, S.current = n, n.getMetadata)
|
|
43
|
+
try {
|
|
44
|
+
const s = await n.getMetadata(c);
|
|
45
|
+
!e && s.pageCount && s.pageCount > 1 && ae(s.pageCount);
|
|
46
|
+
} catch {
|
|
47
|
+
}
|
|
48
|
+
const a = await n.decode(c, {
|
|
49
|
+
page: 1,
|
|
50
|
+
fullQuality: !1,
|
|
51
|
+
onProgress: (s) => {
|
|
52
|
+
e || ce(s);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
if (e) return;
|
|
56
|
+
const l = typeof a == "string" ? a : URL.createObjectURL(a);
|
|
57
|
+
Y.current = l, f.current.set(1, l), R(l), y(!1);
|
|
58
|
+
} catch (r) {
|
|
59
|
+
e || (Q((r == null ? void 0 : r.message) || "解码失败"), y(!1));
|
|
60
|
+
}
|
|
61
|
+
})(), () => {
|
|
62
|
+
e = !0;
|
|
63
|
+
};
|
|
64
|
+
}, [F, P]);
|
|
65
|
+
const fe = x(async (e) => {
|
|
66
|
+
if (!O.current || !S.current || e < 1 || e > T) return;
|
|
67
|
+
const t = f.current.get(e);
|
|
68
|
+
if (t) {
|
|
69
|
+
z(e), R(t);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
y(!0);
|
|
73
|
+
try {
|
|
74
|
+
const r = await S.current.decode(O.current, { page: e }), n = typeof r == "string" ? r : URL.createObjectURL(r);
|
|
75
|
+
if (f.current.size >= 10) {
|
|
76
|
+
const c = f.current.keys().next().value;
|
|
77
|
+
if (c !== void 0) {
|
|
78
|
+
const a = f.current.get(c);
|
|
79
|
+
a && URL.revokeObjectURL(a), f.current.delete(c);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
f.current.set(e, n), z(e), R(n), y(!1);
|
|
83
|
+
} catch (r) {
|
|
84
|
+
Q((r == null ? void 0 : r.message) || "翻页解码失败"), y(!1);
|
|
85
|
+
}
|
|
86
|
+
}, [T]);
|
|
87
|
+
j(() => () => {
|
|
88
|
+
Y.current && URL.revokeObjectURL(Y.current), f.current.forEach((e) => URL.revokeObjectURL(e)), f.current.clear();
|
|
89
|
+
}, []), j(() => {
|
|
90
|
+
D(Z);
|
|
91
|
+
}, [Z]), j(() => {
|
|
92
|
+
ee !== void 0 && b({ x: 0, y: 0 });
|
|
93
|
+
}, [ee]);
|
|
94
|
+
const ve = (e) => {
|
|
95
|
+
K(!0);
|
|
96
|
+
const t = e.currentTarget;
|
|
97
|
+
me({ width: t.naturalWidth, height: t.naturalHeight }), A == null || A(t.naturalWidth), H == null || H(t.naturalHeight);
|
|
98
|
+
}, w = x((e, t) => {
|
|
99
|
+
const r = N.current;
|
|
100
|
+
if (!r || g.width === 0) return e;
|
|
101
|
+
const n = r.clientWidth, c = r.clientHeight, a = g.width * t, l = g.height * t, s = Math.min(80, n * 0.15, c * 0.15), u = (n + a) / 2 - s, h = (c + l) / 2 - s;
|
|
102
|
+
return {
|
|
103
|
+
x: u > 0 ? Math.max(-u, Math.min(u, e.x)) : 0,
|
|
104
|
+
y: h > 0 ? Math.max(-h, Math.min(h, e.y)) : 0
|
|
105
|
+
};
|
|
106
|
+
}, [g]), xe = () => {
|
|
107
|
+
re(te("image.load_failed")), K(!0);
|
|
108
|
+
}, ye = () => {
|
|
109
|
+
b({ x: 0, y: 0 }), D(1), o == null || o(1);
|
|
110
|
+
}, V = x((e) => {
|
|
111
|
+
W.current = !0, e.preventDefault();
|
|
112
|
+
const t = e.touches;
|
|
113
|
+
if (t.length === 1) {
|
|
114
|
+
$(!0), oe({
|
|
115
|
+
x: t[0].clientX - p.x,
|
|
116
|
+
y: t[0].clientY - p.y
|
|
117
|
+
});
|
|
118
|
+
const r = Date.now();
|
|
119
|
+
r - le.current < 300 && (b({ x: 0, y: 0 }), D(1), o == null || o(1)), le.current = r;
|
|
120
|
+
} else if (t.length === 2) {
|
|
121
|
+
$(!1);
|
|
122
|
+
const r = Math.hypot(
|
|
123
|
+
t[1].clientX - t[0].clientX,
|
|
124
|
+
t[1].clientY - t[0].clientY
|
|
125
|
+
);
|
|
126
|
+
_.current = r, ie.current = v, J.current = { ...p };
|
|
127
|
+
}
|
|
128
|
+
}, [p, v, o]), C = x((e) => {
|
|
129
|
+
e.preventDefault();
|
|
130
|
+
const t = e.touches;
|
|
131
|
+
if (t.length === 1 && E)
|
|
132
|
+
b(w({
|
|
133
|
+
x: t[0].clientX - U.x,
|
|
134
|
+
y: t[0].clientY - U.y
|
|
135
|
+
}, v));
|
|
136
|
+
else if (t.length === 2) {
|
|
137
|
+
const r = N.current;
|
|
138
|
+
if (!r) return;
|
|
139
|
+
const n = Math.hypot(
|
|
140
|
+
t[1].clientX - t[0].clientX,
|
|
141
|
+
t[1].clientY - t[0].clientY
|
|
142
|
+
);
|
|
143
|
+
if (Math.abs(n - _.current) < 5) return;
|
|
144
|
+
const c = n / _.current, a = Math.max(0.01, Math.min(10, ie.current * c)), l = r.getBoundingClientRect(), s = (t[0].clientX + t[1].clientX) / 2 - l.left - l.width / 2, u = (t[0].clientY + t[1].clientY) / 2 - l.top - l.height / 2, h = a / v;
|
|
145
|
+
b(w({
|
|
146
|
+
x: s - h * (s - J.current.x),
|
|
147
|
+
y: u - h * (u - J.current.y)
|
|
148
|
+
}, a)), D(a), o == null || o(a);
|
|
149
|
+
}
|
|
150
|
+
}, [E, U, v, w, o]), I = x(() => {
|
|
151
|
+
$(!1), _.current = 0;
|
|
152
|
+
}, []);
|
|
153
|
+
j(() => {
|
|
154
|
+
const e = N.current;
|
|
155
|
+
if (!e) return;
|
|
156
|
+
const t = (r) => {
|
|
157
|
+
r.preventDefault(), r.stopPropagation();
|
|
158
|
+
const n = e.getBoundingClientRect(), c = r.clientX - n.left - n.width / 2, a = r.clientY - n.top - n.height / 2, l = r.deltaY > 0 ? -0.05 : 0.05;
|
|
159
|
+
D((s) => {
|
|
160
|
+
const u = Math.max(0.01, Math.min(10, s + l)), h = u / s;
|
|
161
|
+
return b((de) => w({
|
|
162
|
+
x: c - h * (c - de.x),
|
|
163
|
+
y: a - h * (a - de.y)
|
|
164
|
+
}, u)), o == null || o(u), u;
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
|
|
168
|
+
}, [o, w]), j(() => {
|
|
169
|
+
const e = N.current;
|
|
170
|
+
if (e)
|
|
171
|
+
return e.addEventListener("touchstart", V, { passive: !1 }), e.addEventListener("touchmove", C, { passive: !1 }), e.addEventListener("touchend", I), e.addEventListener("touchcancel", I), () => {
|
|
172
|
+
e.removeEventListener("touchstart", V), e.removeEventListener("touchmove", C), e.removeEventListener("touchend", I), e.removeEventListener("touchcancel", I);
|
|
173
|
+
};
|
|
174
|
+
}, [V, C, I]);
|
|
175
|
+
const ge = x((e) => {
|
|
176
|
+
W.current || e.button === 0 && ($(!0), oe({
|
|
177
|
+
x: e.clientX - p.x,
|
|
178
|
+
y: e.clientY - p.y
|
|
179
|
+
}));
|
|
180
|
+
}, [p]), we = x((e) => {
|
|
181
|
+
W.current || E && b(w({
|
|
182
|
+
x: e.clientX - U.x,
|
|
183
|
+
y: e.clientY - U.y
|
|
184
|
+
}, v));
|
|
185
|
+
}, [E, U, v, w]), ue = x(() => {
|
|
186
|
+
W.current || $(!1);
|
|
187
|
+
}, []);
|
|
188
|
+
return /* @__PURE__ */ X(
|
|
189
|
+
"div",
|
|
190
|
+
{
|
|
191
|
+
ref: N,
|
|
192
|
+
className: "rfp-relative rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full rfp-overflow-hidden",
|
|
193
|
+
onMouseDown: ge,
|
|
194
|
+
onMouseMove: we,
|
|
195
|
+
onMouseUp: ue,
|
|
196
|
+
onMouseLeave: ue,
|
|
197
|
+
style: { cursor: E ? "grabbing" : "grab", touchAction: "none" },
|
|
198
|
+
children: [
|
|
199
|
+
G && /* @__PURE__ */ X("div", { className: "rfp-absolute rfp-inset-0 rfp-flex rfp-flex-col rfp-items-center rfp-justify-center rfp-bg-surface-1/80 rfp-z-10", children: [
|
|
200
|
+
/* @__PURE__ */ m(Me, { className: "rfp-w-12 rfp-h-12 rfp-text-fg-primary rfp-animate-spin" }),
|
|
201
|
+
/* @__PURE__ */ X("p", { className: "rfp-mt-4 rfp-text-fg-secondary", children: [
|
|
202
|
+
"正在解码... ",
|
|
203
|
+
ne > 0 && `${Math.round(ne)}%`
|
|
204
|
+
] })
|
|
205
|
+
] }),
|
|
206
|
+
k && /* @__PURE__ */ m("div", { className: "rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-bg-surface-1/80 rfp-z-10", children: /* @__PURE__ */ m(pe, { message: te("image.decode_failed"), detail: k }) }),
|
|
207
|
+
!q && !M && !G && !k && /* @__PURE__ */ m("div", { className: "rfp-flex rfp-items-center rfp-justify-center", children: /* @__PURE__ */ m("div", { className: "rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin" }) }),
|
|
208
|
+
M && /* @__PURE__ */ m(pe, { message: M }),
|
|
209
|
+
se && /* @__PURE__ */ m(
|
|
210
|
+
Le.img,
|
|
211
|
+
{
|
|
212
|
+
ref: be,
|
|
213
|
+
src: se,
|
|
214
|
+
alt: "Preview",
|
|
215
|
+
className: `rfp-max-w-none rfp-select-none ${!q || M || k ? "rfp-hidden" : ""}`,
|
|
216
|
+
style: {
|
|
217
|
+
transform: `translate(${p.x}px, ${p.y}px) scale(${v}) rotate(${he}deg)`,
|
|
218
|
+
transformOrigin: "center",
|
|
219
|
+
transition: E ? "none" : "transform 0.3s ease-out"
|
|
220
|
+
},
|
|
221
|
+
onLoad: ve,
|
|
222
|
+
onError: xe,
|
|
223
|
+
onDoubleClick: ye,
|
|
224
|
+
initial: { opacity: 0 },
|
|
225
|
+
animate: { opacity: q && !M && !k ? 1 : 0 },
|
|
226
|
+
transition: { duration: 0.3 },
|
|
227
|
+
draggable: !1
|
|
228
|
+
}
|
|
229
|
+
),
|
|
230
|
+
q && !M && g.width > 0 && /* @__PURE__ */ X("div", { className: "rfp-absolute rfp-bottom-2 rfp-right-3 rfp-text-[10px] rfp-text-fg-disabled hover:rfp-text-fg-secondary rfp-transition-colors rfp-pointer-events-auto rfp-select-none rfp-cursor-default", children: [
|
|
231
|
+
g.width,
|
|
232
|
+
" × ",
|
|
233
|
+
g.height,
|
|
234
|
+
L != null && ` · ${L < 1024 ? `${L} B` : L < 1024 * 1024 ? `${(L / 1024).toFixed(1)} KB` : `${(L / (1024 * 1024)).toFixed(1)} MB`}`
|
|
235
|
+
] }),
|
|
236
|
+
T > 1 && /* @__PURE__ */ X("div", { className: "rfp-absolute rfp-bottom-2 rfp-left-1/2 -rfp-translate-x-1/2 rfp-flex rfp-items-center rfp-gap-2 rfp-px-3 rfp-py-1.5 rfp-bg-surface-toolbar rfp-border rfp-border-line rfp-rounded-lg rfp-text-sm rfp-text-fg-primary rfp-shadow-md", children: [
|
|
237
|
+
/* @__PURE__ */ m(
|
|
238
|
+
"button",
|
|
239
|
+
{
|
|
240
|
+
type: "button",
|
|
241
|
+
onClick: () => fe(B - 1),
|
|
242
|
+
disabled: B <= 1 || G,
|
|
243
|
+
className: "rfp-px-2 rfp-py-0.5 rfp-rounded hover:rfp-bg-surface-nav-hover disabled:rfp-opacity-40 disabled:rfp-cursor-not-allowed",
|
|
244
|
+
children: "上一页"
|
|
245
|
+
}
|
|
246
|
+
),
|
|
247
|
+
/* @__PURE__ */ X("span", { className: "rfp-text-fg-secondary rfp-tabular-nums", children: [
|
|
248
|
+
B,
|
|
249
|
+
" / ",
|
|
250
|
+
T
|
|
251
|
+
] }),
|
|
252
|
+
/* @__PURE__ */ m(
|
|
253
|
+
"button",
|
|
254
|
+
{
|
|
255
|
+
type: "button",
|
|
256
|
+
onClick: () => fe(B + 1),
|
|
257
|
+
disabled: B >= T || G,
|
|
258
|
+
className: "rfp-px-2 rfp-py-0.5 rfp-rounded hover:rfp-bg-surface-nav-hover disabled:rfp-opacity-40 disabled:rfp-cursor-not-allowed",
|
|
259
|
+
children: "下一页"
|
|
260
|
+
}
|
|
261
|
+
)
|
|
262
|
+
] })
|
|
263
|
+
]
|
|
264
|
+
}
|
|
265
|
+
);
|
|
266
|
+
};
|
|
267
|
+
export {
|
|
268
|
+
Be as ImageRenderer
|
|
269
|
+
};
|
|
270
|
+
//# sourceMappingURL=index-DtZwBUd0.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DtZwBUd0.mjs","sources":["../../src/renderers/Image/index.tsx"],"sourcesContent":["import { useState, useEffect, useRef, useCallback } from 'react';\nimport { motion } from 'framer-motion';\nimport { Loader2 } from 'lucide-react';\nimport { useTranslator } from '../../i18n/LocaleContext';\nimport { detectImageFormat, getLoaderForMimeType } from '@eternalheart/file-preview-core';\nimport type { PreviewFile } from '@eternalheart/file-preview-core';\nimport { RendererError } from '../RendererError';\n\ninterface ImageRendererProps {\n url: string;\n zoom: number;\n rotation: number;\n resetKey?: number;\n fileSize?: number;\n file?: PreviewFile | File;\n onZoomChange?: (zoom: number) => void;\n onNaturalWidthChange?: (width: number) => void;\n onNaturalHeightChange?: (height: number) => void;\n}\n\nexport const ImageRenderer: React.FC<ImageRendererProps> = ({\n url,\n zoom,\n rotation,\n resetKey,\n fileSize,\n file,\n onZoomChange,\n onNaturalWidthChange,\n onNaturalHeightChange\n}) => {\n const t = useTranslator();\n const [loaded, setLoaded] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [decoding, setDecoding] = useState(false);\n const [decodeProgress, setDecodeProgress] = useState(0);\n const [decodeError, setDecodeError] = useState<string | null>(null);\n const [imageSrc, setImageSrc] = useState<string>('');\n const [currentPage, setCurrentPage] = useState(1);\n const [totalPages, setTotalPages] = useState(1);\n const [position, setPosition] = useState({ x: 0, y: 0 });\n const [isDragging, setIsDragging] = useState(false);\n const [dragStart, setDragStart] = useState({ x: 0, y: 0 });\n const [internalZoom, setInternalZoom] = useState(1);\n const [naturalSize, setNaturalSize] = useState({ width: 0, height: 0 });\n const imgRef = useRef<HTMLImageElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const blobUrlRef = useRef<string | null>(null);\n const fileBlobRef = useRef<Blob | null>(null);\n const loaderRef = useRef<any>(null);\n const pageCacheRef = useRef<Map<number, string>>(new Map());\n const isTouchDevice = useRef(false);\n const touchStartDistance = useRef(0);\n const touchStartZoom = useRef(1);\n const touchStartPos = useRef({ x: 0, y: 0 });\n const lastTapTime = useRef(0);\n\n // 解码逻辑:检测格式并按需解码\n useEffect(() => {\n let cancelled = false;\n\n const decodeIfNeeded = async () => {\n // 重置状态:清空 src 以避免上一张图片的 onLoad/onError 误触发到新文件\n setImageSrc('');\n setLoaded(false);\n setError(null);\n setDecoding(false);\n setDecodeError(null);\n setDecodeProgress(0);\n setPosition({ x: 0, y: 0 });\n setInternalZoom(1);\n setCurrentPage(1);\n setTotalPages(1);\n\n // 清理旧的 blob URL 与缓存\n if (blobUrlRef.current) {\n URL.revokeObjectURL(blobUrlRef.current);\n blobUrlRef.current = null;\n }\n pageCacheRef.current.forEach((url) => URL.revokeObjectURL(url));\n pageCacheRef.current.clear();\n fileBlobRef.current = null;\n loaderRef.current = null;\n\n // 如果没有 file 对象,直接使用 url\n if (!file) {\n if (!cancelled) setImageSrc(url);\n return;\n }\n\n try {\n // 检测图片格式\n const mimeType = await detectImageFormat(file);\n const loader = await getLoaderForMimeType(mimeType);\n\n // 如果不需要解码,直接使用原 URL\n if (!loader || !(await loader.needsDecode(mimeType))) {\n if (!cancelled) setImageSrc(url);\n return;\n }\n\n // 需要解码\n setDecoding(true);\n\n // 获取文件 Blob\n let fileBlob: Blob;\n if (file instanceof Blob) {\n fileBlob = file;\n } else {\n const response = await fetch(url);\n if (!response.ok) throw new Error('Failed to fetch file');\n fileBlob = await response.blob();\n }\n\n if (cancelled) return;\n\n // 缓存 Blob 与 loader 以便后续翻页\n fileBlobRef.current = fileBlob;\n loaderRef.current = loader;\n\n // 缓存 Blob 与 loader 以便后续翻页\n fileBlobRef.current = fileBlob;\n loaderRef.current = loader;\n\n // 获取元数据(用于检测多页 TIFF)\n if (loader.getMetadata) {\n try {\n const metadata = await loader.getMetadata(fileBlob);\n if (!cancelled && metadata.pageCount && metadata.pageCount > 1) {\n setTotalPages(metadata.pageCount);\n }\n } catch {\n // 忽略元数据获取失败\n }\n }\n\n // 调用 loader 解码(第 1 页 / 缩略图模式)\n const decodedBlob = await loader.decode(fileBlob, {\n page: 1,\n fullQuality: false,\n onProgress: (percent: number) => {\n if (!cancelled) {\n setDecodeProgress(percent);\n }\n },\n });\n\n if (cancelled) return;\n\n // 生成 blob URL\n const blobUrl = typeof decodedBlob === 'string'\n ? decodedBlob\n : URL.createObjectURL(decodedBlob);\n\n blobUrlRef.current = blobUrl;\n pageCacheRef.current.set(1, blobUrl);\n setImageSrc(blobUrl);\n setDecoding(false);\n } catch (err: any) {\n if (!cancelled) {\n setDecodeError(err?.message || '解码失败');\n setDecoding(false);\n }\n }\n };\n\n decodeIfNeeded();\n\n return () => {\n cancelled = true;\n };\n }, [url, file]);\n\n // 多页 TIFF 翻页:切换页码时重新解码\n const handlePageChange = useCallback(async (page: number) => {\n if (!fileBlobRef.current || !loaderRef.current) return;\n if (page < 1 || page > totalPages) return;\n\n // 命中缓存:直接切换\n const cached = pageCacheRef.current.get(page);\n if (cached) {\n setCurrentPage(page);\n setImageSrc(cached);\n return;\n }\n\n // 解码新页面\n setDecoding(true);\n try {\n const decodedBlob = await loaderRef.current.decode(fileBlobRef.current, { page });\n const blobUrl = typeof decodedBlob === 'string'\n ? decodedBlob\n : URL.createObjectURL(decodedBlob);\n\n // LRU:缓存超过 10 页时删除最早的\n if (pageCacheRef.current.size >= 10) {\n const firstKey = pageCacheRef.current.keys().next().value;\n if (firstKey !== undefined) {\n const oldUrl = pageCacheRef.current.get(firstKey);\n if (oldUrl) URL.revokeObjectURL(oldUrl);\n pageCacheRef.current.delete(firstKey);\n }\n }\n\n pageCacheRef.current.set(page, blobUrl);\n setCurrentPage(page);\n setImageSrc(blobUrl);\n setDecoding(false);\n } catch (err: any) {\n setDecodeError(err?.message || '翻页解码失败');\n setDecoding(false);\n }\n }, [totalPages]);\n\n // Cleanup blob URL on unmount\n useEffect(() => {\n return () => {\n if (blobUrlRef.current) {\n URL.revokeObjectURL(blobUrlRef.current);\n }\n pageCacheRef.current.forEach((url) => URL.revokeObjectURL(url));\n pageCacheRef.current.clear();\n };\n }, []);\n\n // 当外部 zoom 改变时,同步内部 zoom\n useEffect(() => {\n setInternalZoom(zoom);\n }, [zoom]);\n\n // 适应窗口/原始尺寸等操作时重置位置居中\n useEffect(() => {\n if (resetKey !== undefined) {\n setPosition({ x: 0, y: 0 });\n }\n }, [resetKey]);\n\n const handleLoad = (e: React.SyntheticEvent<HTMLImageElement>) => {\n setLoaded(true);\n const img = e.currentTarget;\n setNaturalSize({ width: img.naturalWidth, height: img.naturalHeight });\n onNaturalWidthChange?.(img.naturalWidth);\n onNaturalHeightChange?.(img.naturalHeight);\n };\n\n // 边界限制:确保图片至少有一部分可见\n const clampPosition = useCallback((pos: { x: number; y: number }, currentZoom: number) => {\n const container = containerRef.current;\n if (!container || naturalSize.width === 0) return pos;\n\n const containerW = container.clientWidth;\n const containerH = container.clientHeight;\n const imgW = naturalSize.width * currentZoom;\n const imgH = naturalSize.height * currentZoom;\n\n // 至少保留 margin px 的图片在视口内\n const margin = Math.min(80, containerW * 0.15, containerH * 0.15);\n const rangeX = (containerW + imgW) / 2 - margin;\n const rangeY = (containerH + imgH) / 2 - margin;\n\n return {\n x: rangeX > 0 ? Math.max(-rangeX, Math.min(rangeX, pos.x)) : 0,\n y: rangeY > 0 ? Math.max(-rangeY, Math.min(rangeY, pos.y)) : 0,\n };\n }, [naturalSize]);\n\n const handleError = () => {\n setError(t('image.load_failed'));\n setLoaded(true);\n };\n\n // 双击复原:居中 + 缩放100%\n const handleDoubleClick = () => {\n setPosition({ x: 0, y: 0 });\n setInternalZoom(1);\n onZoomChange?.(1);\n };\n\n // 触屏事件处理\n const handleTouchStart = useCallback((e: TouchEvent) => {\n isTouchDevice.current = true;\n e.preventDefault();\n\n const touches = e.touches;\n if (touches.length === 1) {\n // 单指拖拽\n setIsDragging(true);\n setDragStart({\n x: touches[0].clientX - position.x,\n y: touches[0].clientY - position.y,\n });\n\n // 双击检测\n const now = Date.now();\n if (now - lastTapTime.current < 300) {\n // 双击复原:居中 + 缩放100%\n setPosition({ x: 0, y: 0 });\n setInternalZoom(1);\n onZoomChange?.(1);\n }\n lastTapTime.current = now;\n } else if (touches.length === 2) {\n // 双指缩放初始化\n setIsDragging(false);\n const distance = Math.hypot(\n touches[1].clientX - touches[0].clientX,\n touches[1].clientY - touches[0].clientY\n );\n touchStartDistance.current = distance;\n touchStartZoom.current = internalZoom;\n touchStartPos.current = { ...position };\n }\n }, [position, internalZoom, onZoomChange]);\n\n const handleTouchMove = useCallback((e: TouchEvent) => {\n e.preventDefault();\n\n const touches = e.touches;\n if (touches.length === 1 && isDragging) {\n // 单指拖拽\n setPosition(clampPosition({\n x: touches[0].clientX - dragStart.x,\n y: touches[0].clientY - dragStart.y,\n }, internalZoom));\n } else if (touches.length === 2) {\n // 双指缩放\n const container = containerRef.current;\n if (!container) return;\n\n const distance = Math.hypot(\n touches[1].clientX - touches[0].clientX,\n touches[1].clientY - touches[0].clientY\n );\n\n // 最小距离变化阈值,防止抖动\n if (Math.abs(distance - touchStartDistance.current) < 5) return;\n\n const scale = distance / touchStartDistance.current;\n const newZoom = Math.max(0.01, Math.min(10, touchStartZoom.current * scale));\n\n // 双指中心点作为缩放原点\n const rect = container.getBoundingClientRect();\n const centerX = (touches[0].clientX + touches[1].clientX) / 2 - rect.left - rect.width / 2;\n const centerY = (touches[0].clientY + touches[1].clientY) / 2 - rect.top - rect.height / 2;\n\n const zoomScale = newZoom / internalZoom;\n setPosition(clampPosition({\n x: centerX - zoomScale * (centerX - touchStartPos.current.x),\n y: centerY - zoomScale * (centerY - touchStartPos.current.y),\n }, newZoom));\n\n setInternalZoom(newZoom);\n onZoomChange?.(newZoom);\n }\n }, [isDragging, dragStart, internalZoom, clampPosition, onZoomChange]);\n\n const handleTouchEnd = useCallback(() => {\n setIsDragging(false);\n touchStartDistance.current = 0;\n }, []);\n\n // 鼠标滚轮缩放 —— 以鼠标位置为缩放原点\n // 使用原生事件 + passive: false,确保 preventDefault 生效,\n // 避免滚轮事件冒泡触发外层(如嵌入模式下的页面滚动)\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const handleWheelNative = (e: WheelEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n const rect = container.getBoundingClientRect();\n const mouseX = e.clientX - rect.left - rect.width / 2;\n const mouseY = e.clientY - rect.top - rect.height / 2;\n\n const delta = e.deltaY > 0 ? -0.05 : 0.05;\n\n setInternalZoom(prev => {\n const newZoom = Math.max(0.01, Math.min(10, prev + delta));\n const scale = newZoom / prev;\n\n setPosition(pos => clampPosition({\n x: mouseX - scale * (mouseX - pos.x),\n y: mouseY - scale * (mouseY - pos.y),\n }, newZoom));\n\n onZoomChange?.(newZoom);\n return newZoom;\n });\n };\n\n container.addEventListener('wheel', handleWheelNative, { passive: false });\n return () => container.removeEventListener('wheel', handleWheelNative);\n }, [onZoomChange, clampPosition]);\n\n // 触屏事件监听器\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n container.addEventListener('touchstart', handleTouchStart, { passive: false });\n container.addEventListener('touchmove', handleTouchMove, { passive: false });\n container.addEventListener('touchend', handleTouchEnd);\n container.addEventListener('touchcancel', handleTouchEnd);\n\n return () => {\n container.removeEventListener('touchstart', handleTouchStart);\n container.removeEventListener('touchmove', handleTouchMove);\n container.removeEventListener('touchend', handleTouchEnd);\n container.removeEventListener('touchcancel', handleTouchEnd);\n };\n }, [handleTouchStart, handleTouchMove, handleTouchEnd]);\n\n const handleMouseDown = useCallback((e: React.MouseEvent) => {\n if (isTouchDevice.current) return;\n if (e.button !== 0) return;\n setIsDragging(true);\n setDragStart({\n x: e.clientX - position.x,\n y: e.clientY - position.y,\n });\n }, [position]);\n\n const handleMouseMove = useCallback((e: React.MouseEvent) => {\n if (isTouchDevice.current) return;\n if (!isDragging) return;\n setPosition(clampPosition({\n x: e.clientX - dragStart.x,\n y: e.clientY - dragStart.y,\n }, internalZoom));\n }, [isDragging, dragStart, internalZoom, clampPosition]);\n\n const handleMouseUp = useCallback(() => {\n if (isTouchDevice.current) return;\n setIsDragging(false);\n }, []);\n\n return (\n <div\n ref={containerRef}\n className=\"rfp-relative rfp-flex rfp-items-center rfp-justify-center rfp-w-full rfp-h-full rfp-overflow-hidden\"\n onMouseDown={handleMouseDown}\n onMouseMove={handleMouseMove}\n onMouseUp={handleMouseUp}\n onMouseLeave={handleMouseUp}\n style={{ cursor: isDragging ? 'grabbing' : 'grab', touchAction: 'none' }}\n >\n {/* 解码中 */}\n {decoding && (\n <div className=\"rfp-absolute rfp-inset-0 rfp-flex rfp-flex-col rfp-items-center rfp-justify-center rfp-bg-surface-1/80 rfp-z-10\">\n <Loader2 className=\"rfp-w-12 rfp-h-12 rfp-text-fg-primary rfp-animate-spin\" />\n <p className=\"rfp-mt-4 rfp-text-fg-secondary\">\n 正在解码... {decodeProgress > 0 && `${Math.round(decodeProgress)}%`}\n </p>\n </div>\n )}\n\n {/* 解码错误 */}\n {decodeError && (\n <div className=\"rfp-absolute rfp-inset-0 rfp-flex rfp-items-center rfp-justify-center rfp-bg-surface-1/80 rfp-z-10\">\n <RendererError message={t('image.decode_failed')} detail={decodeError} />\n </div>\n )}\n\n {!loaded && !error && !decoding && !decodeError && (\n <div className=\"rfp-flex rfp-items-center rfp-justify-center\">\n <div className=\"rfp-w-12 rfp-h-12 rfp-border-4 rfp-border-line-strong rfp-border-t-spinner-head rfp-rounded-full rfp-animate-spin\" />\n </div>\n )}\n\n {error && (\n <RendererError message={error} />\n )}\n\n {imageSrc && (\n <motion.img\n ref={imgRef}\n src={imageSrc}\n alt=\"Preview\"\n className={`rfp-max-w-none rfp-select-none ${!loaded || error || decodeError ? 'rfp-hidden' : ''}`}\n style={{\n transform: `translate(${position.x}px, ${position.y}px) scale(${internalZoom}) rotate(${rotation}deg)`,\n transformOrigin: 'center',\n transition: isDragging ? 'none' : 'transform 0.3s ease-out',\n }}\n onLoad={handleLoad}\n onError={handleError}\n onDoubleClick={handleDoubleClick}\n initial={{ opacity: 0 }}\n animate={{ opacity: loaded && !error && !decodeError ? 1 : 0 }}\n transition={{ duration: 0.3 }}\n draggable={false}\n />\n )}\n\n {/* 右下角分辨率 */}\n {loaded && !error && naturalSize.width > 0 && (\n <div className=\"rfp-absolute rfp-bottom-2 rfp-right-3 rfp-text-[10px] rfp-text-fg-disabled hover:rfp-text-fg-secondary rfp-transition-colors rfp-pointer-events-auto rfp-select-none rfp-cursor-default\">\n {naturalSize.width} × {naturalSize.height}{fileSize != null && ` · ${fileSize < 1024 ? `${fileSize} B` : fileSize < 1024 * 1024 ? `${(fileSize / 1024).toFixed(1)} KB` : `${(fileSize / (1024 * 1024)).toFixed(1)} MB`}`}\n </div>\n )}\n\n {/* 多页 TIFF 翻页器 */}\n {totalPages > 1 && (\n <div className=\"rfp-absolute rfp-bottom-2 rfp-left-1/2 -rfp-translate-x-1/2 rfp-flex rfp-items-center rfp-gap-2 rfp-px-3 rfp-py-1.5 rfp-bg-surface-toolbar rfp-border rfp-border-line rfp-rounded-lg rfp-text-sm rfp-text-fg-primary rfp-shadow-md\">\n <button\n type=\"button\"\n onClick={() => handlePageChange(currentPage - 1)}\n disabled={currentPage <= 1 || decoding}\n className=\"rfp-px-2 rfp-py-0.5 rfp-rounded hover:rfp-bg-surface-nav-hover disabled:rfp-opacity-40 disabled:rfp-cursor-not-allowed\"\n >\n 上一页\n </button>\n <span className=\"rfp-text-fg-secondary rfp-tabular-nums\">\n {currentPage} / {totalPages}\n </span>\n <button\n type=\"button\"\n onClick={() => handlePageChange(currentPage + 1)}\n disabled={currentPage >= totalPages || decoding}\n className=\"rfp-px-2 rfp-py-0.5 rfp-rounded hover:rfp-bg-surface-nav-hover disabled:rfp-opacity-40 disabled:rfp-cursor-not-allowed\"\n >\n 下一页\n </button>\n </div>\n )}\n </div>\n );\n};\n"],"names":["ImageRenderer","url","zoom","rotation","resetKey","fileSize","file","onZoomChange","onNaturalWidthChange","onNaturalHeightChange","t","useTranslator","loaded","setLoaded","useState","error","setError","decoding","setDecoding","decodeProgress","setDecodeProgress","decodeError","setDecodeError","imageSrc","setImageSrc","currentPage","setCurrentPage","totalPages","setTotalPages","position","setPosition","isDragging","setIsDragging","dragStart","setDragStart","internalZoom","setInternalZoom","naturalSize","setNaturalSize","imgRef","useRef","containerRef","blobUrlRef","fileBlobRef","loaderRef","pageCacheRef","isTouchDevice","touchStartDistance","touchStartZoom","touchStartPos","lastTapTime","useEffect","cancelled","mimeType","detectImageFormat","loader","getLoaderForMimeType","fileBlob","response","metadata","decodedBlob","percent","blobUrl","err","handlePageChange","useCallback","page","cached","firstKey","oldUrl","handleLoad","img","clampPosition","pos","currentZoom","container","containerW","containerH","imgW","imgH","margin","rangeX","rangeY","handleError","handleDoubleClick","handleTouchStart","touches","now","distance","handleTouchMove","scale","newZoom","rect","centerX","centerY","zoomScale","handleTouchEnd","handleWheelNative","e","mouseX","mouseY","delta","prev","handleMouseDown","handleMouseMove","handleMouseUp","jsxs","jsx","Loader2","RendererError","motion"],"mappings":";;;;;;AAoBO,MAAMA,KAA8C,CAAC;AAAA,EAC1D,KAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,uBAAAC;AACF,MAAM;AACJ,QAAMC,KAAIC,GAAA,GACJ,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpC,CAACC,GAAOC,EAAQ,IAAIF,EAAwB,IAAI,GAChD,CAACG,GAAUC,CAAW,IAAIJ,EAAS,EAAK,GACxC,CAACK,IAAgBC,EAAiB,IAAIN,EAAS,CAAC,GAChD,CAACO,GAAaC,CAAc,IAAIR,EAAwB,IAAI,GAC5D,CAACS,IAAUC,CAAW,IAAIV,EAAiB,EAAE,GAC7C,CAACW,GAAaC,CAAc,IAAIZ,EAAS,CAAC,GAC1C,CAACa,GAAYC,EAAa,IAAId,EAAS,CAAC,GACxC,CAACe,GAAUC,CAAW,IAAIhB,EAAS,EAAE,GAAG,GAAG,GAAG,GAAG,GACjD,CAACiB,GAAYC,CAAa,IAAIlB,EAAS,EAAK,GAC5C,CAACmB,GAAWC,EAAY,IAAIpB,EAAS,EAAE,GAAG,GAAG,GAAG,GAAG,GACnD,CAACqB,GAAcC,CAAe,IAAItB,EAAS,CAAC,GAC5C,CAACuB,GAAaC,EAAc,IAAIxB,EAAS,EAAE,OAAO,GAAG,QAAQ,GAAG,GAChEyB,KAASC,EAAyB,IAAI,GACtCC,IAAeD,EAAuB,IAAI,GAC1CE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,YAAIE;AAAA,UAAA,GACnB;AAAA,UACA,gBAAAgF;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAS,MAAM3C,GAAiBvC,IAAc,CAAC;AAAA,cAC/C,UAAUA,KAAeE,KAAcV;AAAA,cACvC,WAAU;AAAA,cACX,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAED,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as k, jsxs as A, Fragment as Z } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as S, useState as I, useEffect as h, useCallback as x } from "react";
|
|
3
3
|
import { ChevronDown as P, ChevronRight as K } from "lucide-react";
|
|
4
|
-
import { u as M, a as C, b as ee, E as ne } from "./index-
|
|
4
|
+
import { u as M, a as C, b as ee, E as ne } from "./index-CWCNvV2X.mjs";
|
|
5
5
|
import { R as te } from "./RendererError-BH6fzLrN.mjs";
|
|
6
6
|
function le(e, u = !1) {
|
|
7
7
|
const p = e.length;
|
|
@@ -591,4 +591,4 @@ const ae = ({ url: e }) => {
|
|
|
591
591
|
export {
|
|
592
592
|
ae as JsonRenderer
|
|
593
593
|
};
|
|
594
|
-
//# sourceMappingURL=index-
|
|
594
|
+
//# sourceMappingURL=index-_EpQHlUY.mjs.map
|