@xiping/react-components 1.0.39 → 1.0.43

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 (37) hide show
  1. package/dist/cjs/components/flip-text/FlipText.js +1 -1
  2. package/dist/cjs/components/gradient-text/index.d.ts +10 -0
  3. package/dist/cjs/components/gradient-text/index.js +1 -0
  4. package/dist/cjs/components/hyper-text/index.js +1 -1
  5. package/dist/cjs/components/image-viewer/ImageViewer.js +1 -9
  6. package/dist/cjs/components/pinch-content/PinchContent.d.ts +17 -1
  7. package/dist/cjs/components/pinch-content/PinchContent.js +1 -1
  8. package/dist/cjs/components/split-text/SplitText.js +1 -1
  9. package/dist/cjs/components/text-type/TextType.d.ts +26 -0
  10. package/dist/cjs/components/text-type/TextType.js +1 -0
  11. package/dist/cjs/components/text-type/index.d.ts +3 -0
  12. package/dist/cjs/components/typing-animation/index.js +1 -1
  13. package/dist/cjs/components/variable-proximity/index.d.ts +15 -0
  14. package/dist/cjs/components/variable-proximity/index.js +1 -0
  15. package/dist/cjs/components/video-dialog/VideoDialog.js +1 -1
  16. package/dist/cjs/index.d.ts +3 -0
  17. package/dist/cjs/index.js +1 -1
  18. package/dist/cjs/react-components.css +1 -1
  19. package/dist/es/components/flip-text/FlipText.js +15 -14
  20. package/dist/es/components/gradient-text/index.d.ts +10 -0
  21. package/dist/es/components/gradient-text/index.js +22 -0
  22. package/dist/es/components/hyper-text/index.js +27 -25
  23. package/dist/es/components/image-viewer/ImageViewer.js +106 -101
  24. package/dist/es/components/pinch-content/PinchContent.d.ts +17 -1
  25. package/dist/es/components/pinch-content/PinchContent.js +120 -79
  26. package/dist/es/components/split-text/SplitText.js +37 -35
  27. package/dist/es/components/text-type/TextType.d.ts +26 -0
  28. package/dist/es/components/text-type/TextType.js +116 -0
  29. package/dist/es/components/text-type/index.d.ts +3 -0
  30. package/dist/es/components/typing-animation/index.js +11 -13
  31. package/dist/es/components/variable-proximity/index.d.ts +15 -0
  32. package/dist/es/components/variable-proximity/index.js +140 -0
  33. package/dist/es/components/video-dialog/VideoDialog.js +35 -48
  34. package/dist/es/index.d.ts +3 -0
  35. package/dist/es/index.js +60 -54
  36. package/dist/es/react-components.css +1 -1
  37. package/package.json +37 -37
@@ -0,0 +1,22 @@
1
+ import { jsxs as f, jsx as t } from "react/jsx-runtime";
2
+ /* empty css */
3
+ function l({
4
+ children: e,
5
+ className: i = "",
6
+ colors: n = ["#40ffaa", "#4079ff", "#40ffaa", "#4079ff", "#40ffaa"],
7
+ animationSpeed: r = 8,
8
+ showBorder: s = !1
9
+ }) {
10
+ const a = {
11
+ backgroundImage: `linear-gradient(to right, ${n.join(", ")})`,
12
+ animationDuration: `${r}s`
13
+ };
14
+ return /* @__PURE__ */ f("div", { className: `animated-gradient-text ${i}`, children: [
15
+ s && /* @__PURE__ */ t("div", { className: "gradient-overlay", style: a }),
16
+ /* @__PURE__ */ t("div", { className: "text-content", style: a, children: e })
17
+ ] });
18
+ }
19
+ export {
20
+ l as GradientText,
21
+ l as default
22
+ };
@@ -1,69 +1,71 @@
1
1
  "use client";
2
- import { jsx as u } from "react/jsx-runtime";
3
- import { cn as g } from "../../utils/utils.js";
2
+ import { jsx as p } from "react/jsx-runtime";
3
+ import { cn as h } from "../../utils/utils.js";
4
4
  import { motion as x, AnimatePresence as U } from "motion/react";
5
- import { useState as M, useRef as h, useEffect as I } from "react";
5
+ import { useState as M, useRef as d, useEffect as I } from "react";
6
+ /* empty css */
6
7
  const j = Object.freeze(
7
8
  "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("")
8
9
  ), q = (n) => Math.floor(Math.random() * n);
9
- function z({
10
+ function B({
10
11
  children: n,
11
12
  className: C,
12
- duration: f = 800,
13
- delay: r = 0,
13
+ duration: u = 800,
14
+ delay: o = 0,
14
15
  as: E = "div",
15
- startOnView: p = !1,
16
+ startOnView: f = !1,
16
17
  animateOnHover: F = !0,
17
18
  characterSet: s = j,
18
19
  ...R
19
20
  }) {
20
21
  const b = x.create(E, {
21
22
  forwardMotionProps: !0
22
- }), [v, w] = M(
23
+ }), [v, y] = M(
23
24
  () => n.split("")
24
- ), [i, o] = M(!1), a = h(0), m = h(null), D = () => {
25
- F && !i && (a.current = 0, o(!0));
25
+ ), [i, r] = M(!1), a = d(0), m = d(null), D = () => {
26
+ F && !i && (a.current = 0, r(!0));
26
27
  };
27
28
  return I(() => {
28
- if (!p) {
29
+ if (!f) {
29
30
  const t = setTimeout(() => {
30
- o(!0);
31
- }, r);
31
+ r(!0);
32
+ }, o);
32
33
  return () => clearTimeout(t);
33
34
  }
34
35
  const e = new IntersectionObserver(
35
36
  ([t]) => {
36
37
  t.isIntersecting && (setTimeout(() => {
37
- o(!0);
38
- }, r), e.disconnect());
38
+ r(!0);
39
+ }, o), e.disconnect());
39
40
  },
40
41
  { threshold: 0.1, rootMargin: "-30% 0px -30% 0px" }
41
42
  );
42
43
  return m.current && e.observe(m.current), () => e.disconnect();
43
- }, [r, p]), I(() => {
44
+ }, [o, f]), I(() => {
44
45
  if (!i) return;
45
46
  const e = n.length, t = performance.now();
46
47
  let c;
47
48
  const l = (H) => {
48
- const N = H - t, T = Math.min(N / f, 1);
49
- a.current = T * e, w(
49
+ const N = H - t, g = Math.min(N / u, 1);
50
+ a.current = g * e, y(
50
51
  (P) => P.map(
51
- (A, d) => A === " " ? A : d <= a.current ? n[d] : s[q(s.length)]
52
+ (T, A) => T === " " ? T : A <= a.current ? n[A] : s[q(s.length)]
52
53
  )
53
- ), T < 1 ? c = requestAnimationFrame(l) : o(!1);
54
+ ), g < 1 ? c = requestAnimationFrame(l) : r(!1);
54
55
  };
55
56
  return c = requestAnimationFrame(l), () => cancelAnimationFrame(c);
56
- }, [n, f, i, s]), /* @__PURE__ */ u(
57
+ }, [n, u, i, s]), // eslint-disable-next-line react-hooks/static-components
58
+ /* @__PURE__ */ p(
57
59
  b,
58
60
  {
59
61
  ref: m,
60
- className: g("overflow-hidden py-2 text-4xl font-bold", C),
62
+ className: h("xiping-hyper-container", C),
61
63
  onMouseEnter: D,
62
64
  ...R,
63
- children: /* @__PURE__ */ u(U, { children: v.map((e, t) => /* @__PURE__ */ u(
65
+ children: /* @__PURE__ */ p(U, { children: v.map((e, t) => /* @__PURE__ */ p(
64
66
  x.span,
65
67
  {
66
- className: g("font-mono", e === " " ? "w-3" : ""),
68
+ className: h("xiping-hyper-char", e === " " ? "xiping-hyper-space" : ""),
67
69
  children: e.toUpperCase()
68
70
  },
69
71
  t
@@ -72,5 +74,5 @@ function z({
72
74
  );
73
75
  }
74
76
  export {
75
- z as HyperText
77
+ B as HyperText
76
78
  };
@@ -1,98 +1,118 @@
1
1
  "use client";
2
- import { jsx as e, jsxs as i } from "react/jsx-runtime";
3
- import { Modal as S, ModalContent as D, cn as c, Spinner as O } from "@heroui/react";
4
- import U from "../pinch-content/PinchContent.js";
5
- import A from "./ImageThumbnails.js";
6
- import { useState as u, useEffect as B } from "react";
7
- import P from "clsx";
8
- import { Download as T, X as H } from "lucide-react";
9
- import { AnimatePresence as V, motion as W } from "motion/react";
10
- const p = (o) => {
11
- o.target.closest(".image-viewer-main-content") && o.preventDefault();
12
- }, Z = (o) => {
2
+ import { jsx as n, jsxs as h } from "react/jsx-runtime";
3
+ import { Modal as z, ModalContent as O, Spinner as S } from "@heroui/react";
4
+ import P from "../pinch-content/PinchContent.js";
5
+ import V from "./ImageThumbnails.js";
6
+ import { useState as v, useCallback as b, useEffect as x } from "react";
7
+ import X from "clsx";
8
+ import { Download as B, X as K } from "lucide-react";
9
+ import { AnimatePresence as W, motion as _ } from "motion/react";
10
+ import { cn as f } from "../../utils/utils.js";
11
+ /* empty css */
12
+ const C = (c) => {
13
+ c.target.closest(".xiping-main-content") && c.preventDefault();
14
+ }, ne = (c) => {
13
15
  const {
14
- isOpen: t,
15
- onClose: g,
16
- imgSrc: l,
17
- thumbnailImages: w,
18
- canDownload: b = !1,
19
- wrapperClassName: v,
20
- closeClassName: y,
21
- downloadClassName: x,
22
- toolWrapperClassName: C,
23
- initialIndex: I = 0
24
- } = o, a = Array.isArray(l) ? l : [l], N = w || a, L = Math.max(0, Math.min(I, a.length - 1)), [s, E] = u(L), [j, r] = u(!0), m = () => {
25
- r(!0), g();
26
- }, k = async () => {
27
- const d = a[s];
16
+ isOpen: a,
17
+ onClose: w,
18
+ imgSrc: d,
19
+ thumbnailImages: N,
20
+ canDownload: y = !1,
21
+ wrapperClassName: I,
22
+ closeClassName: E,
23
+ downloadClassName: L,
24
+ toolWrapperClassName: k,
25
+ initialIndex: D = 0
26
+ } = c, o = Array.isArray(d) ? d : [d], A = N || o, R = Math.max(
27
+ 0,
28
+ Math.min(D, o.length - 1)
29
+ ), [l, g] = v(R), [M, p] = v(!0), m = b(() => {
30
+ p(!0), w();
31
+ }, [w]), T = async () => {
32
+ const i = o[l];
28
33
  try {
29
- const R = await (await fetch(d)).blob(), h = window.URL.createObjectURL(R), n = document.createElement("a");
30
- n.href = h, n.download = d.split("/").pop() || "image", document.body.appendChild(n), n.click(), window.URL.revokeObjectURL(h), document.body.removeChild(n);
31
- } catch (f) {
32
- console.error("Error downloading image:", f);
34
+ const r = await (await fetch(i)).blob(), e = window.URL.createObjectURL(r), s = document.createElement("a");
35
+ s.href = e, s.download = i.split("/").pop() || "image", document.body.appendChild(s), s.click(), window.URL.revokeObjectURL(e), document.body.removeChild(s);
36
+ } catch (t) {
37
+ console.error("Error downloading image:", t);
33
38
  }
34
- }, z = () => {
35
- r(!1);
36
- }, M = () => {
37
- r(!1);
39
+ }, U = () => {
40
+ p(!1);
41
+ }, j = () => {
42
+ p(!1);
38
43
  };
39
- return B(() => {
40
- if (t)
41
- return document.addEventListener("touchmove", p, {
44
+ x(() => {
45
+ if (a)
46
+ return document.addEventListener("touchmove", C, {
42
47
  passive: !1
43
48
  }), () => {
44
- document.removeEventListener("touchmove", p);
49
+ document.removeEventListener("touchmove", C);
45
50
  };
46
- }, [t]), /* @__PURE__ */ e(
47
- S,
51
+ }, [a]);
52
+ const u = b(() => {
53
+ "vibrate" in navigator && navigator.vibrate([50, 50, 50]);
54
+ }, []);
55
+ return x(() => {
56
+ if (!a) return;
57
+ const i = (t) => {
58
+ const r = t.target;
59
+ if (!(r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.isContentEditable))
60
+ switch (t.key) {
61
+ case "ArrowLeft":
62
+ t.preventDefault(), g((e) => e > 0 ? e - 1 : (u(), e));
63
+ break;
64
+ case "ArrowRight":
65
+ t.preventDefault(), g((e) => e < o.length - 1 ? e + 1 : (u(), e));
66
+ break;
67
+ case "Escape":
68
+ t.preventDefault(), m();
69
+ break;
70
+ }
71
+ };
72
+ return document.addEventListener("keydown", i), () => {
73
+ document.removeEventListener("keydown", i);
74
+ };
75
+ }, [a, o.length, m, u]), /* @__PURE__ */ n(
76
+ z,
48
77
  {
49
- isOpen: t,
78
+ isOpen: a,
50
79
  size: "full",
51
80
  onClose: m,
52
81
  classNames: {
53
- wrapper: P("", v)
82
+ wrapper: X(I)
54
83
  },
55
- className: "bg-black/70",
84
+ className: "xiping-modal-overlay",
56
85
  hideCloseButton: !0,
57
86
  portalContainer: document.body,
58
- children: /* @__PURE__ */ e(D, { className: "overflow-hidden", children: /* @__PURE__ */ i("div", { className: "w-screen h-screen relative flex flex-col pt-safe-offset-0", children: [
59
- /* @__PURE__ */ i(
60
- "div",
61
- {
62
- className: c(
63
- "absolute top-4 right-4 flex gap-4 z-10",
64
- C
65
- ),
66
- children: [
67
- b && /* @__PURE__ */ e(
68
- T,
69
- {
70
- size: 24,
71
- className: c("text-white cursor-pointer", x),
72
- onClick: k
73
- }
74
- ),
75
- /* @__PURE__ */ e(
76
- H,
77
- {
78
- size: 24,
79
- className: c("text-white cursor-pointer", y),
80
- onClick: m
81
- }
82
- )
83
- ]
84
- }
85
- ),
86
- /* @__PURE__ */ i("div", { className: "flex-1 min-h-0 relative flex items-center justify-center image-viewer-main-content", children: [
87
- /* @__PURE__ */ e(U, { canRotate: !1, className: "w-full h-full", children: /* @__PURE__ */ e(V, { mode: "wait", children: /* @__PURE__ */ e(
88
- W.img,
87
+ children: /* @__PURE__ */ n(O, { className: "xiping-modal-content", children: /* @__PURE__ */ h("div", { className: "xiping-wrapper", children: [
88
+ /* @__PURE__ */ h("div", { className: f("xiping-tool-wrapper", k), children: [
89
+ y && /* @__PURE__ */ n(
90
+ B,
91
+ {
92
+ size: 24,
93
+ className: f("xiping-download-icon", L),
94
+ onClick: T
95
+ }
96
+ ),
97
+ /* @__PURE__ */ n(
98
+ K,
99
+ {
100
+ size: 24,
101
+ className: f("xiping-close-icon", E),
102
+ onClick: m
103
+ }
104
+ )
105
+ ] }),
106
+ /* @__PURE__ */ h("div", { className: "xiping-main-content", children: [
107
+ /* @__PURE__ */ n(P, { canRotate: !1, className: "xiping-pinch-content", children: /* @__PURE__ */ n(W, { mode: "wait", children: /* @__PURE__ */ n(
108
+ _.img,
89
109
  {
90
110
  draggable: "false",
91
- src: a[s],
111
+ src: o[l],
92
112
  alt: "",
93
- className: "w-screen h-full object-contain pointer-events-none",
94
- onLoad: z,
95
- onError: M,
113
+ className: "xiping-image",
114
+ onLoad: U,
115
+ onError: j,
96
116
  initial: { opacity: 0, scale: 0.95 },
97
117
  animate: { opacity: 1, scale: 1 },
98
118
  exit: { opacity: 0, scale: 1.05 },
@@ -101,37 +121,22 @@ const p = (o) => {
101
121
  ease: "easeInOut"
102
122
  }
103
123
  },
104
- s
124
+ l
105
125
  ) }) }),
106
- j && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-black/50", children: /* @__PURE__ */ e(O, { color: "white", size: "lg" }) })
126
+ M && /* @__PURE__ */ n("div", { className: "xiping-loading", children: /* @__PURE__ */ n(S, { color: "white", size: "lg" }) })
107
127
  ] }),
108
- /* @__PURE__ */ e(
109
- A,
128
+ /* @__PURE__ */ n(
129
+ V,
110
130
  {
111
- images: N,
112
- currentIndex: s,
113
- onImageSelect: E
131
+ images: A,
132
+ currentIndex: l,
133
+ onImageSelect: g
114
134
  }
115
135
  )
116
136
  ] }) })
117
137
  }
118
138
  );
119
- }, X = `
120
- .scrollbar-hide {
121
- -ms-overflow-style: none;
122
- scrollbar-width: none;
123
- }
124
- .scrollbar-hide::-webkit-scrollbar {
125
- display: none;
126
- }
127
- `;
128
- if (typeof document < "u") {
129
- const o = "image-viewer-scrollbar-hide";
130
- if (!document.getElementById(o)) {
131
- const t = document.createElement("style");
132
- t.id = o, t.textContent = X, document.head.appendChild(t);
133
- }
134
- }
139
+ };
135
140
  export {
136
- Z as default
141
+ ne as default
137
142
  };
@@ -13,6 +13,22 @@ export interface PinchContentProps {
13
13
  wheelZoomFactor?: number;
14
14
  rubberband?: boolean;
15
15
  style?: CSSProperties;
16
+ /** 外部控制的缩放值(受控模式) */
17
+ scale?: number;
18
+ /** 缩放值变化时的回调 */
19
+ onScaleChange?: (scale: number) => void;
16
20
  }
17
- declare const PinchContent: (props: PinchContentProps) => import("react/jsx-runtime").JSX.Element;
21
+ export interface PinchContentRef {
22
+ /** 放大 */
23
+ zoomIn: (factor?: number) => void;
24
+ /** 缩小 */
25
+ zoomOut: (factor?: number) => void;
26
+ /** 设置缩放值 */
27
+ setScale: (scale: number) => void;
28
+ /** 重置到初始状态 */
29
+ reset: () => void;
30
+ /** 获取当前缩放值 */
31
+ getScale: () => number;
32
+ }
33
+ declare const PinchContent: import('react').ForwardRefExoticComponent<PinchContentProps & import('react').RefAttributes<PinchContentRef>>;
18
34
  export default PinchContent;
@@ -1,86 +1,127 @@
1
- import { jsx as B } from "react/jsx-runtime";
2
- import { useSpring as C, animated as G } from "@react-spring/web";
3
- import { createUseGesture as N, dragAction as U, pinchAction as W, wheelAction as j } from "@use-gesture/react";
4
- import { useRef as F } from "react";
5
- import { useMount as k, useUnmount as q } from "ahooks";
6
- import z from "clsx";
7
- const H = N([U, W, j]), a = (c) => c.preventDefault(), V = (c) => {
8
- const {
9
- className: f,
10
- children: h,
11
- pinchWithoutMove: m = !1,
12
- canPinch: d = !0,
13
- canDrag: x = !0,
14
- canRotate: v = !0,
15
- scaleBounds: l = { min: 0.3, max: 10 },
16
- wheelZoomFactor: p = 1e-3,
17
- rubberband: y = !0
18
- } = c, e = F(null);
19
- k(() => {
20
- e.current?.addEventListener("gesturestart", a), e.current?.addEventListener("gesturechange", a), e.current?.addEventListener("gestureend", a);
21
- }), q(() => {
22
- e.current?.removeEventListener("gesturestart", a), e.current?.removeEventListener("gesturechange", a), e.current?.removeEventListener("gestureend", a);
23
- });
24
- const [t, g] = C(() => ({
25
- x: 0,
26
- y: 0,
27
- scale: 1,
28
- rotateZ: 0
29
- }));
30
- return H(
31
- {
32
- onWheel: ({ event: o, delta: [, r] }) => {
33
- if (!d) return;
34
- const n = t.scale.get() * (1 - r * p), i = Math.min(
35
- Math.max(n, l.min),
36
- l.max
1
+ import { jsx as U } from "react/jsx-runtime";
2
+ import { useSpring as W, animated as j } from "@react-spring/web";
3
+ import { createUseGesture as F, dragAction as H, pinchAction as O, wheelAction as k } from "@use-gesture/react";
4
+ import { forwardRef as q, useRef as J, useEffect as K, useImperativeHandle as Q } from "react";
5
+ import { useMount as T, useUnmount as V } from "ahooks";
6
+ import X from "clsx";
7
+ const Y = F([H, O, k]), i = (u) => u.preventDefault(), _ = q(
8
+ (u, x) => {
9
+ const {
10
+ className: p,
11
+ children: S,
12
+ pinchWithoutMove: v = !1,
13
+ canPinch: h = !0,
14
+ canDrag: y = !0,
15
+ canRotate: M = !0,
16
+ scaleBounds: r = { min: 0.3, max: 10 },
17
+ wheelZoomFactor: E = 1e-3,
18
+ rubberband: w = !0,
19
+ scale: m,
20
+ onScaleChange: d
21
+ } = u, a = J(null);
22
+ T(() => {
23
+ a.current?.addEventListener("gesturestart", i), a.current?.addEventListener("gesturechange", i), a.current?.addEventListener("gestureend", i);
24
+ }), V(() => {
25
+ a.current?.removeEventListener("gesturestart", i), a.current?.removeEventListener("gesturechange", i), a.current?.removeEventListener("gestureend", i);
26
+ });
27
+ const L = m ?? 1, [t, c] = W(() => ({
28
+ x: 0,
29
+ y: 0,
30
+ scale: L,
31
+ rotateZ: 0
32
+ }));
33
+ K(() => {
34
+ if (m !== void 0) {
35
+ const e = Math.min(
36
+ Math.max(m, r.min),
37
+ r.max
37
38
  );
38
- g.start({ scale: i });
39
+ c.start({ scale: e });
40
+ }
41
+ }, [m, r.min, r.max, c]);
42
+ const g = (e) => {
43
+ const n = Math.min(
44
+ Math.max(e, r.min),
45
+ r.max
46
+ );
47
+ c.start({ scale: n }), d?.(n);
48
+ };
49
+ return Q(x, () => ({
50
+ zoomIn: (e = 1.2) => {
51
+ const n = t.scale.get();
52
+ g(n * e);
53
+ },
54
+ zoomOut: (e = 1.2) => {
55
+ const n = t.scale.get();
56
+ g(n / e);
39
57
  },
40
- onDrag: ({ pinching: o, cancel: r, offset: [u, n], ...i }) => {
41
- if (!x || o) return r();
42
- g.start({ x: u, y: n });
58
+ setScale: (e) => {
59
+ g(e);
43
60
  },
44
- onPinch: ({
45
- origin: [o, r],
46
- first: u,
47
- movement: [n],
48
- offset: [i, E],
49
- memo: s,
50
- cancel: L
51
- }) => {
52
- if (!d) return L();
53
- if (u) {
54
- const { width: M, height: Z, x: A, y: D } = e.current.getBoundingClientRect(), P = o - (A + M / 2), R = r - (D + Z / 2);
55
- s = [t.x.get(), t.y.get(), P, R];
61
+ reset: () => {
62
+ c.start({ x: 0, y: 0, scale: 1, rotateZ: 0 }), d?.(1);
63
+ },
64
+ getScale: () => t.scale.get()
65
+ })), Y(
66
+ {
67
+ onWheel: ({ delta: [, e] }) => {
68
+ if (!h) return;
69
+ const l = t.scale.get() * (1 - e * E), s = Math.min(
70
+ Math.max(l, r.min),
71
+ r.max
72
+ );
73
+ c.start({ scale: s }), d?.(s);
74
+ },
75
+ onDrag: ({ pinching: e, cancel: n, offset: [l, s] }) => {
76
+ if (!y || e) return n();
77
+ c.start({ x: l, y: s });
78
+ },
79
+ onPinch: ({
80
+ origin: [e, n],
81
+ first: l,
82
+ movement: [s],
83
+ offset: [R, Z],
84
+ memo: o,
85
+ cancel: b
86
+ }) => {
87
+ if (!h) return b();
88
+ if (l) {
89
+ const { width: D, height: N, x: z, y: B } = a.current.getBoundingClientRect(), G = e - (z + D / 2), I = n - (B + N / 2);
90
+ o = [t.x.get(), t.y.get(), G, I];
91
+ }
92
+ const f = Math.min(
93
+ Math.max(R, r.min),
94
+ r.max
95
+ ), C = o[0] - (s - 1) * o[2], P = o[1] - (s - 1) * o[3], A = {
96
+ scale: f,
97
+ rotateZ: M ? Z : t.rotateZ.get(),
98
+ ...v ? { x: t.x.get(), y: t.y.get() } : { x: C, y: P }
99
+ };
100
+ return c.start(A), d?.(f), o;
56
101
  }
57
- const w = s[0] - (n - 1) * s[2], S = s[1] - (n - 1) * s[3], b = {
58
- scale: i,
59
- rotateZ: v ? E : t.rotateZ.get(),
60
- ...m ? { x: t.x.get(), y: t.y.get() } : { x: w, y: S }
61
- };
62
- return g.start(b), s;
63
- }
64
- },
65
- {
66
- target: e,
67
- drag: { from: () => [t.x.get(), t.y.get()] },
68
- pinch: { scaleBounds: l, rubberband: y },
69
- wheel: { enabled: !0 }
70
- }
71
- ), /* @__PURE__ */ B(
72
- G.div,
73
- {
74
- className: z("select-none", f),
75
- ref: e,
76
- style: {
77
- ...c.style,
78
- ...t
79
102
  },
80
- children: h
81
- }
82
- );
83
- };
103
+ {
104
+ target: a,
105
+ drag: { from: () => [t.x.get(), t.y.get()] },
106
+ pinch: { scaleBounds: r, rubberband: w },
107
+ wheel: { enabled: !0 }
108
+ }
109
+ ), /* @__PURE__ */ U(
110
+ j.div,
111
+ {
112
+ className: X(p),
113
+ ref: a,
114
+ style: {
115
+ userSelect: "none",
116
+ ...u.style,
117
+ ...t
118
+ },
119
+ children: S
120
+ }
121
+ );
122
+ }
123
+ );
124
+ _.displayName = "PinchContent";
84
125
  export {
85
- V as default
126
+ _ as default
86
127
  };