@react-pdf-kit/viewer 2.3.0-beta.0 → 2.3.0-beta.2
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/dist/{Combination-479e39c6.js → Combination-17ab8af1.js} +184 -187
- package/dist/RPSplitter-3438b930.js +109 -0
- package/dist/assets/style.css +1 -1
- package/dist/assets/style.js +8 -8
- package/dist/components/RPPages.js +126 -126
- package/dist/components/layout/RPDefaultLayout.js +3 -3
- package/dist/components/layout/RPLayout.js +3 -3
- package/dist/components/layout/sidebar/RPSidebar.js +1 -1
- package/dist/components/layout/sidebar/RPSplitter.js +1 -1
- package/dist/components/layout/toolbar/DocumentDialog.js +1 -1
- package/dist/components/layout/toolbar/DocumentProperties.js +2 -2
- package/dist/components/layout/toolbar/FileDownloadTool.js +2 -2
- package/dist/components/layout/toolbar/FileUploadTool.js +2 -2
- package/dist/components/layout/toolbar/FullScreenTool.js +2 -2
- package/dist/components/layout/toolbar/MenuItem.js +2 -2
- package/dist/components/layout/toolbar/MenuSeparator.js +2 -2
- package/dist/components/layout/toolbar/MostPageTool.js +2 -2
- package/dist/components/layout/toolbar/OtherTool.js +2 -2
- package/dist/components/layout/toolbar/PrintTool.js +2 -2
- package/dist/components/layout/toolbar/RPMenuItem.js +2 -2
- package/dist/components/layout/toolbar/RPMoreOptions.js +2 -2
- package/dist/components/layout/toolbar/RPToolbar.js +2 -2
- package/dist/components/layout/toolbar/RPToolbarEnd.js +2 -2
- package/dist/components/layout/toolbar/RotateTool.js +2 -2
- package/dist/components/layout/toolbar/ScrollModeTool.js +2 -2
- package/dist/components/layout/toolbar/SearchTool.js +2 -2
- package/dist/components/layout/toolbar/SelectionModeTool.js +2 -2
- package/dist/components/layout/toolbar/ToolbarCustom.js +1 -1
- package/dist/components/layout/toolbar/ToolbarDefault.js +3 -3
- package/dist/components/layout/toolbar/ToolbarLayout.js +3 -3
- package/dist/components/layout/toolbar/ViewModeTool.js +2 -2
- package/dist/components/layout/toolbar/ZoomTool.js +2 -2
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +1 -1
- package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +3 -3
- package/dist/components/layout/toolbar/tools/FirstPageTool.js +3 -3
- package/dist/components/layout/toolbar/tools/LastPageTool.js +3 -3
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +2 -2
- package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +2 -2
- package/dist/components/ui/DropDown.js +2 -2
- package/dist/index-0b2a9a20.js +11698 -0
- package/dist/{index-535ad364.js → index-11f3cd64.js} +1 -1
- package/dist/main.js +3 -3
- package/dist/utils/hooks/useLicense.js +106 -84
- package/package.json +3 -1
- package/dist/RPSplitter-925c8ff7.js +0 -72
|
@@ -3,7 +3,7 @@ import K from "react";
|
|
|
3
3
|
import { c as re, a as k, g as pe, f as ye, P as L, b as g, d as ae, j as Te, i as _n } from "./index-113053cf.js";
|
|
4
4
|
import { jsx as s } from "react/jsx-runtime";
|
|
5
5
|
import { a as ge, u as me, D as Rn } from "./index-23911b43.js";
|
|
6
|
-
import { h as In, u as En, F as Sn, R as bn, P as Pn } from "./Combination-
|
|
6
|
+
import { h as In, u as En, F as Sn, R as bn, P as Pn } from "./Combination-17ab8af1.js";
|
|
7
7
|
import { c as xe, A as Dn, C as yn, a as Tn, R as xn } from "./index-d0f0aa9a.js";
|
|
8
8
|
function Ae(e) {
|
|
9
9
|
const o = e + "CollectionProvider", [n, t] = re(o), [r, c] = n(
|
package/dist/main.js
CHANGED
|
@@ -139,11 +139,11 @@ import "./components/layout/toolbar/RPToolbarEnd.js";
|
|
|
139
139
|
import "./components/layout/toolbar/FileUploadTool.js";
|
|
140
140
|
import "./components/icons/FileUploadDefaultIcon.js";
|
|
141
141
|
import "./components/layout/toolbar/MenuItem.js";
|
|
142
|
-
import "./index-
|
|
142
|
+
import "./index-11f3cd64.js";
|
|
143
143
|
import "./index-113053cf.js";
|
|
144
144
|
import "react-dom";
|
|
145
145
|
import "./index-23911b43.js";
|
|
146
|
-
import "./Combination-
|
|
146
|
+
import "./Combination-17ab8af1.js";
|
|
147
147
|
import "./index-d0f0aa9a.js";
|
|
148
148
|
import "./index-ada501c4.js";
|
|
149
149
|
import "./components/layout/toolbar/DarkModeTool.js";
|
|
@@ -193,7 +193,7 @@ import "./utils/zoom.js";
|
|
|
193
193
|
import "./components/ui/LoadingIndicator.js";
|
|
194
194
|
import "./components/layout/sidebar/RPSidebar.js";
|
|
195
195
|
import "./components/icons/Thumbnail.js";
|
|
196
|
-
import "./RPSplitter-
|
|
196
|
+
import "./RPSplitter-3438b930.js";
|
|
197
197
|
import "./components/layout/sidebar/Thumbnails.js";
|
|
198
198
|
import "./components/layout/sidebar/Thumbnail.js";
|
|
199
199
|
import "./utils/hooks/useInfiniteScroll.js";
|
|
@@ -1,29 +1,8 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { LicenseType as
|
|
3
|
-
import { appConsole as
|
|
1
|
+
import { useState as E, useCallback as y, useEffect as b } from "react";
|
|
2
|
+
import { LicenseType as L } from "../types.js";
|
|
3
|
+
import { appConsole as c } from "../appConsole.js";
|
|
4
4
|
import "../../de_DE-a553b162.js";
|
|
5
|
-
const
|
|
6
|
-
invalidLicense: `You are currently using without a valid license. ${d}`,
|
|
7
|
-
mismatchedDomain: `Your license key is not valid for the current domain / IP. ${d}`,
|
|
8
|
-
expired: `Your license key has expired. ${d}`,
|
|
9
|
-
exceededVersion: "Your license does not support the current version of React PDF. The library version you are using exceeds the supported range of your license.",
|
|
10
|
-
invalidSignature: "Invalid license key: Signature mismatch"
|
|
11
|
-
};
|
|
12
|
-
function S(n) {
|
|
13
|
-
const t = n.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s+/g, ""), e = atob(t), r = new Uint8Array(e.length);
|
|
14
|
-
for (let i = 0; i < e.length; i++)
|
|
15
|
-
r[i] = e.charCodeAt(i);
|
|
16
|
-
return r.buffer;
|
|
17
|
-
}
|
|
18
|
-
function y(n) {
|
|
19
|
-
const t = atob(n), e = new Uint8Array(t.length);
|
|
20
|
-
for (let r = 0; r < t.length; r++)
|
|
21
|
-
e[r] = t.charCodeAt(r);
|
|
22
|
-
return e.buffer;
|
|
23
|
-
}
|
|
24
|
-
async function I(n, t = "SHA-256") {
|
|
25
|
-
try {
|
|
26
|
-
const { data: e, signature: r } = JSON.parse(atob(n)), i = S(`-----BEGIN PUBLIC KEY-----
|
|
5
|
+
const A = /* @__PURE__ */ new Date("2026-03-31T09:28:25.744Z"), w = `-----BEGIN PUBLIC KEY-----
|
|
27
6
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIokvErJ0Fctu0jduSAx
|
|
28
7
|
gr+5Har/VSuZLlOunS28hnlqqA+OF1apHL7RYkjBosS15yvviYdLrVWYHpHnoY4b
|
|
29
8
|
HLQ9I6YX6FMB9T/VbB4xLdVdKvfi8r49aTScl5EKuSpgpPgz2VSJTfvVGcRuth/Y
|
|
@@ -31,89 +10,132 @@ Bm7PPGYdL2l2gvKDxchmmsHFPukGki9L4JOUeIVX0GXAxabENckaEH/iC1NZhX+W
|
|
|
31
10
|
vXnpHeHuIIKlZ16LSivXNgo6BH2Z3GFdg4G3cAaXr6qNP8fsacYNqv2SpTW1viFD
|
|
32
11
|
vzcGRabN25gpJAp9/syeScefWH3OiJY1lmw88oTiJbjIoiq6AkPhfn3G9mF54nvR
|
|
33
12
|
kwIDAQAB
|
|
34
|
-
-----END PUBLIC KEY
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
13
|
+
-----END PUBLIC KEY-----`, f = "Please visit https://www.react-pdf.dev/manage-license/ to generate a new license key.", o = {
|
|
14
|
+
invalidLicense: `You are currently using without a valid license. ${f}`,
|
|
15
|
+
mismatchedDomain: `Your license key is not valid for the current domain / IP. ${f}`,
|
|
16
|
+
expired: `Your license key has expired. ${f}`,
|
|
17
|
+
exceededVersion: "Your license does not support the current version of React PDF. The library version you are using exceeds the supported range of your license.",
|
|
18
|
+
invalidSignature: "Invalid license key: Signature mismatch"
|
|
19
|
+
};
|
|
20
|
+
function S(a) {
|
|
21
|
+
const i = a.replace(/-----BEGIN PUBLIC KEY-----/, "").replace(/-----END PUBLIC KEY-----/, "").replace(/\s+/g, ""), e = atob(i), t = new Uint8Array(e.length);
|
|
22
|
+
for (let r = 0; r < e.length; r++)
|
|
23
|
+
t[r] = e.charCodeAt(r);
|
|
24
|
+
return t.buffer;
|
|
25
|
+
}
|
|
26
|
+
function I(a) {
|
|
27
|
+
const i = atob(a), e = new Uint8Array(i.length);
|
|
28
|
+
for (let t = 0; t < i.length; t++)
|
|
29
|
+
e[t] = i.charCodeAt(t);
|
|
30
|
+
return e.buffer;
|
|
31
|
+
}
|
|
32
|
+
async function T(a) {
|
|
33
|
+
try {
|
|
34
|
+
const i = await import("../../index-0b2a9a20.js").then((u) => u.i), e = (i == null ? void 0 : i.default) ?? i, t = e.pki.publicKeyFromPem(w), r = atob(a.data), n = e.util.decode64(a.signature), s = e.md.sha256.create();
|
|
35
|
+
s.update(r, "utf8");
|
|
36
|
+
const d = e.pss.create({
|
|
37
|
+
md: e.md.sha256.create(),
|
|
38
|
+
mgf: e.mgf.mgf1.create(e.md.sha256.create()),
|
|
39
|
+
saltLength: 32
|
|
40
|
+
});
|
|
41
|
+
return t.verify(s.digest().bytes(), n, d);
|
|
42
|
+
} catch (i) {
|
|
43
|
+
return c.debug("[License] node-forge verify failed:", i), !1;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async function B(a, i = "SHA-256") {
|
|
47
|
+
var e;
|
|
48
|
+
try {
|
|
49
|
+
const t = JSON.parse(atob(a));
|
|
50
|
+
let r = !1;
|
|
51
|
+
try {
|
|
52
|
+
if ((e = window.crypto) != null && e.subtle) {
|
|
53
|
+
const n = S(w), s = await window.crypto.subtle.importKey(
|
|
54
|
+
"spki",
|
|
55
|
+
n,
|
|
56
|
+
{ name: "RSA-PSS", hash: i },
|
|
57
|
+
!0,
|
|
58
|
+
["verify"]
|
|
59
|
+
);
|
|
60
|
+
r = await window.crypto.subtle.verify(
|
|
61
|
+
{ name: "RSA-PSS", saltLength: 32 },
|
|
62
|
+
s,
|
|
63
|
+
I(t.signature),
|
|
64
|
+
new TextEncoder().encode(atob(t.data))
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
} catch (n) {
|
|
68
|
+
c.debug("[License] crypto.subtle verify failed, trying node-forge fallback:", n);
|
|
69
|
+
}
|
|
70
|
+
if (r || (r = await T(t)), !r)
|
|
71
|
+
throw new Error(o.invalidSignature);
|
|
72
|
+
return JSON.parse(atob(t.data));
|
|
73
|
+
} catch (t) {
|
|
74
|
+
throw t instanceof Error && t.message === o.invalidSignature ? t : new Error(o.invalidLicense);
|
|
53
75
|
}
|
|
54
76
|
}
|
|
55
|
-
const
|
|
56
|
-
switch (
|
|
77
|
+
const N = (a, i) => {
|
|
78
|
+
switch (a) {
|
|
57
79
|
case "specific":
|
|
58
|
-
return
|
|
80
|
+
return i === window.location.host;
|
|
59
81
|
case "wildcard":
|
|
60
|
-
return
|
|
82
|
+
return i ? window.location.host.includes(i) : !1;
|
|
61
83
|
}
|
|
62
|
-
},
|
|
84
|
+
}, m = {
|
|
63
85
|
isValid: !0,
|
|
64
|
-
invalidatedMessage:
|
|
86
|
+
invalidatedMessage: o.invalidLicense,
|
|
65
87
|
type: void 0
|
|
66
|
-
},
|
|
67
|
-
const [
|
|
68
|
-
if (e((
|
|
69
|
-
throw e({ ...
|
|
70
|
-
let
|
|
88
|
+
}, V = (a) => {
|
|
89
|
+
const [i, e] = E(m), t = y(async () => {
|
|
90
|
+
if (e((l) => ({ ...l, validating: !0 })), !a)
|
|
91
|
+
throw e({ ...m, validating: !1 }), new Error(o.invalidLicense);
|
|
92
|
+
let r;
|
|
71
93
|
try {
|
|
72
|
-
|
|
73
|
-
} catch (
|
|
74
|
-
throw
|
|
94
|
+
r = await B(a);
|
|
95
|
+
} catch (l) {
|
|
96
|
+
throw c.warn(l.message), new Error(l.message);
|
|
75
97
|
}
|
|
76
|
-
|
|
77
|
-
const { avu:
|
|
78
|
-
if (!
|
|
98
|
+
c.debug(">>> validatedLicense", r);
|
|
99
|
+
const { avu: n, exp: s, dmt: d, dm: u, t: g } = r;
|
|
100
|
+
if (!s)
|
|
79
101
|
throw new Error("License is missing expiration timestamp");
|
|
80
|
-
if (
|
|
102
|
+
if (s > Number.MAX_SAFE_INTEGER / 1e3)
|
|
81
103
|
throw new Error("Invalid expiration timestamp: value too large");
|
|
82
|
-
const v = new Date(
|
|
83
|
-
if (v.getTime() <
|
|
84
|
-
throw new Error(
|
|
85
|
-
if (!
|
|
104
|
+
const v = new Date(s * 1e3), h = (/* @__PURE__ */ new Date()).getTime();
|
|
105
|
+
if (v.getTime() < h)
|
|
106
|
+
throw new Error(o.expired);
|
|
107
|
+
if (!n)
|
|
86
108
|
throw new Error("License is missing available until version timestamp");
|
|
87
|
-
if (
|
|
109
|
+
if (n > Number.MAX_SAFE_INTEGER / 1e3)
|
|
88
110
|
throw new Error("Invalid available until version timestamp: value too large");
|
|
89
|
-
const
|
|
90
|
-
if (
|
|
91
|
-
throw new Error(
|
|
92
|
-
if (
|
|
93
|
-
throw new Error(
|
|
111
|
+
const p = new Date(n * 1e3);
|
|
112
|
+
if (c.debug("availableUntilTimestamp", p), p.getTime() < A.getTime())
|
|
113
|
+
throw new Error(o.exceededVersion);
|
|
114
|
+
if (g !== L.Custom && !N(d, u))
|
|
115
|
+
throw new Error(o.mismatchedDomain);
|
|
94
116
|
return {
|
|
95
117
|
isValid: !0,
|
|
96
|
-
type:
|
|
118
|
+
type: g,
|
|
97
119
|
invalidatedMessage: void 0
|
|
98
120
|
};
|
|
99
|
-
}, [
|
|
100
|
-
return
|
|
101
|
-
|
|
121
|
+
}, [a]);
|
|
122
|
+
return b(() => {
|
|
123
|
+
t().then(({ isValid: r, type: n, invalidatedMessage: s }) => {
|
|
102
124
|
e({
|
|
103
|
-
isValid:
|
|
104
|
-
type:
|
|
105
|
-
invalidatedMessage:
|
|
125
|
+
isValid: r,
|
|
126
|
+
type: n,
|
|
127
|
+
invalidatedMessage: s,
|
|
106
128
|
validating: !1
|
|
107
129
|
});
|
|
108
|
-
}).catch((
|
|
130
|
+
}).catch((r) => {
|
|
109
131
|
e({
|
|
110
|
-
...
|
|
132
|
+
...m,
|
|
111
133
|
isValid: !1,
|
|
112
134
|
validating: !1
|
|
113
|
-
}),
|
|
135
|
+
}), c.warn(r.message);
|
|
114
136
|
});
|
|
115
|
-
}, [
|
|
137
|
+
}, [t]), i;
|
|
116
138
|
};
|
|
117
139
|
export {
|
|
118
|
-
|
|
140
|
+
V as useLicense
|
|
119
141
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-pdf-kit/viewer",
|
|
3
|
-
"version": "2.3.0-beta.
|
|
3
|
+
"version": "2.3.0-beta.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.",
|
|
6
6
|
"keywords": [
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"@radix-ui/react-checkbox": "^1.3.3",
|
|
41
41
|
"@radix-ui/react-popover": "^1.1.15",
|
|
42
42
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
43
|
+
"node-forge": "^1.3.3",
|
|
43
44
|
"pdfjs-dist": "5.4.530",
|
|
44
45
|
"react-virtualized-auto-sizer": "^1.0.24",
|
|
45
46
|
"react-window": "^1.8.10"
|
|
@@ -50,6 +51,7 @@
|
|
|
50
51
|
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
|
51
52
|
"@rollup/plugin-commonjs": "^28.0.1",
|
|
52
53
|
"@tanstack/eslint-plugin-query": "^5.60.1",
|
|
54
|
+
"@types/node-forge": "^1.3.14",
|
|
53
55
|
"@types/react": "^18.2.14",
|
|
54
56
|
"@types/react-dom": "^18.2.6",
|
|
55
57
|
"@types/react-window": "^1.8.8",
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { jsx as N } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as w, useState as T, useCallback as f, useEffect as v } from "react";
|
|
3
|
-
import { THUMBNAIL_MIN_WIDTH as s } from "./utils/constants.js";
|
|
4
|
-
import { useLayoutContainer as A } from "./contexts/LayoutContainerContext.js";
|
|
5
|
-
const P = {
|
|
6
|
-
"rp-sidebar-content-wrapper": "_rp-sidebar-content-wrapper_ppg43_1",
|
|
7
|
-
"rp-sidebar-content": "_rp-sidebar-content_ppg43_1",
|
|
8
|
-
"rp-thumbnails-wrapper": "_rp-thumbnails-wrapper_ppg43_17",
|
|
9
|
-
"rp-thumbnails-wrapper-dragging": "_rp-thumbnails-wrapper-dragging_ppg43_24",
|
|
10
|
-
"rp-thumbnails-wrapper-hidden": "_rp-thumbnails-wrapper-hidden_ppg43_28"
|
|
11
|
-
}, L = {
|
|
12
|
-
"rp-thumbnail-dragger": "_rp-thumbnail-dragger_17ndw_2",
|
|
13
|
-
"rp-thumbnail-dragger-dragging": "_rp-thumbnail-dragger-dragging_17ndw_12"
|
|
14
|
-
}, R = {
|
|
15
|
-
"rp-thumbnail-dragger": "_rp-thumbnail-dragger_8o6id_1",
|
|
16
|
-
"rp-thumbnail-dragger-dragging": "_rp-thumbnail-dragger-dragging_8o6id_14"
|
|
17
|
-
}, S = (o) => {
|
|
18
|
-
o.preventDefault(), o.stopPropagation();
|
|
19
|
-
}, z = (o) => {
|
|
20
|
-
const { onWidthChange: t, thumbnailRef: x, leftSidebarRef: E, isRPLayout: y } = o, n = w(null), M = w(0), c = w(null), [a, B] = T(s), { container: b } = A(), I = f((r) => {
|
|
21
|
-
var u, l, m, d, p, g, W, D;
|
|
22
|
-
S(r);
|
|
23
|
-
const e = ((l = (u = n.current) == null ? void 0 : u.getBoundingClientRect()) == null ? void 0 : l.left) ?? 0, i = ((d = (m = x.current) == null ? void 0 : m.getBoundingClientRect()) == null ? void 0 : d.width) ?? 0;
|
|
24
|
-
c.current = { x: e, y: 0 }, M.current = i, (p = n.current) == null || p.classList.add(L["rp-thumbnail-dragger-dragging"]), (g = n.current) == null || g.classList.add(R["rp-thumbnail-dragger-dragging"]), (D = (W = n.current) == null ? void 0 : W.closest('[data-rp="thumbnailSidebar"]')) == null || D.classList.add(
|
|
25
|
-
P["rp-thumbnails-wrapper"],
|
|
26
|
-
P["rp-thumbnails-wrapper-dragging"]
|
|
27
|
-
);
|
|
28
|
-
}, []), h = f((r) => {
|
|
29
|
-
var e, i;
|
|
30
|
-
S(r), c.current = null, (e = n.current) == null || e.classList.remove(L["rp-thumbnail-dragger-dragging"]), (i = n.current) == null || i.classList.remove(R["rp-thumbnail-dragger-dragging"]);
|
|
31
|
-
}, []), _ = f(
|
|
32
|
-
(r) => {
|
|
33
|
-
if (!c.current)
|
|
34
|
-
return;
|
|
35
|
-
const e = r.clientX - c.current.x, i = Math.max(
|
|
36
|
-
s,
|
|
37
|
-
Math.min(M.current + e, a)
|
|
38
|
-
);
|
|
39
|
-
t == null || t(i), S(r);
|
|
40
|
-
},
|
|
41
|
-
[t, a]
|
|
42
|
-
);
|
|
43
|
-
return v(() => {
|
|
44
|
-
if (!b)
|
|
45
|
-
return;
|
|
46
|
-
const r = new ResizeObserver(([e]) => {
|
|
47
|
-
var d, p, g;
|
|
48
|
-
const i = ((d = n.current) == null ? void 0 : d.offsetWidth) ?? 0, u = ((g = (p = E.current) == null ? void 0 : p.getBoundingClientRect()) == null ? void 0 : g.width) ?? 0, l = e.contentRect.width / 2, m = i + u;
|
|
49
|
-
B(l - m);
|
|
50
|
-
});
|
|
51
|
-
return r.observe(b), () => {
|
|
52
|
-
r.disconnect();
|
|
53
|
-
};
|
|
54
|
-
}, [b, E]), v(() => {
|
|
55
|
-
var e;
|
|
56
|
-
const r = ((e = x.current) == null ? void 0 : e.clientWidth) ?? s;
|
|
57
|
-
r > a ? t == null || t(a) : a >= s && r < s && (t == null || t(s));
|
|
58
|
-
}, [a, t]), v(() => (window.addEventListener("pointermove", _), window.addEventListener("pointerup", h), () => {
|
|
59
|
-
window.removeEventListener("pointermove", _), window.removeEventListener("pointerup", h);
|
|
60
|
-
}), [_, h]), /* @__PURE__ */ N(
|
|
61
|
-
"div",
|
|
62
|
-
{
|
|
63
|
-
ref: n,
|
|
64
|
-
className: y ? R["rp-thumbnail-dragger"] : L["rp-thumbnail-dragger"],
|
|
65
|
-
onPointerDown: I
|
|
66
|
-
}
|
|
67
|
-
);
|
|
68
|
-
};
|
|
69
|
-
export {
|
|
70
|
-
z as R,
|
|
71
|
-
P as c
|
|
72
|
-
};
|