@xiping/react-components 1.0.23 → 1.0.25

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 (62) hide show
  1. package/dist/cjs/components/blur-fade/BlurFade.d.ts +23 -0
  2. package/dist/cjs/components/blur-fade/BlurFade.js +1 -0
  3. package/dist/cjs/components/blur-fade/index.d.ts +2 -0
  4. package/dist/cjs/components/button/Button.d.ts +3 -3
  5. package/dist/cjs/components/button/Button.js +1 -1
  6. package/dist/cjs/components/confetti-button/index.js +1 -1
  7. package/dist/cjs/components/dock/Duck.js +1 -1
  8. package/dist/cjs/components/hyper-text/index.d.ts +1 -1
  9. package/dist/cjs/components/hyper-text/index.js +1 -1
  10. package/dist/cjs/components/morphing-text/index.d.ts +1 -1
  11. package/dist/cjs/components/pinch-content/PinchContent.js +1 -1
  12. package/dist/cjs/components/pointer/Pointer.d.ts +13 -0
  13. package/dist/cjs/components/pointer/Pointer.js +1 -0
  14. package/dist/cjs/components/pointer/index.d.ts +2 -0
  15. package/dist/cjs/components/scratch-to-reveal/ScratchToReveal.d.ts +12 -0
  16. package/dist/cjs/components/scratch-to-reveal/index.d.ts +2 -0
  17. package/dist/cjs/components/sparkles-text/SparklesText.d.ts +43 -0
  18. package/dist/cjs/components/sparkles-text/SparklesText.js +1 -0
  19. package/dist/cjs/components/sparkles-text/index.d.ts +2 -0
  20. package/dist/cjs/components/txt-editor/TxtEditor.js +1 -1
  21. package/dist/cjs/components/txt-reader/TxtReader.js +1 -1
  22. package/dist/cjs/index.d.ts +3 -0
  23. package/dist/cjs/index.js +1 -1
  24. package/dist/cjs/node_modules/.pnpm/@monaco-editor_react@4.7.0_monaco-editor@0.52.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@monaco-editor/react/dist/index.js +1 -1
  25. package/dist/cjs/node_modules/.pnpm/react-force-graph-3d@1.28.0_react@19.1.0/node_modules/react-force-graph-3d/dist/react-force-graph-3d.js +1 -1
  26. package/dist/cjs/node_modules/.pnpm/three-forcegraph@1.43.0_three@0.178.0/node_modules/three-forcegraph/dist/three-forcegraph.js +1 -1
  27. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.module.js +1 -1
  28. package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.webgpu.js +1 -1
  29. package/dist/cjs/react-components.css +1 -1
  30. package/dist/es/components/blur-fade/BlurFade.d.ts +23 -0
  31. package/dist/es/components/blur-fade/BlurFade.js +51 -0
  32. package/dist/es/components/blur-fade/index.d.ts +2 -0
  33. package/dist/es/components/button/Button.d.ts +3 -3
  34. package/dist/es/components/button/Button.js +2 -2
  35. package/dist/es/components/confetti-button/index.js +33 -34
  36. package/dist/es/components/dock/Duck.js +31 -32
  37. package/dist/es/components/hyper-text/index.d.ts +1 -1
  38. package/dist/es/components/hyper-text/index.js +52 -50
  39. package/dist/es/components/morphing-text/index.d.ts +1 -1
  40. package/dist/es/components/pinch-content/PinchContent.js +27 -29
  41. package/dist/es/components/pointer/Pointer.d.ts +13 -0
  42. package/dist/es/components/pointer/Pointer.js +77 -0
  43. package/dist/es/components/pointer/index.d.ts +2 -0
  44. package/dist/es/components/scratch-to-reveal/ScratchToReveal.d.ts +12 -0
  45. package/dist/es/components/scratch-to-reveal/index.d.ts +2 -0
  46. package/dist/es/components/sparkles-text/SparklesText.d.ts +43 -0
  47. package/dist/es/components/sparkles-text/SparklesText.js +70 -0
  48. package/dist/es/components/sparkles-text/index.d.ts +2 -0
  49. package/dist/es/components/txt-editor/TxtEditor.js +29 -29
  50. package/dist/es/components/txt-reader/TxtReader.js +41 -41
  51. package/dist/es/index.d.ts +3 -0
  52. package/dist/es/index.js +26 -20
  53. package/dist/es/node_modules/.pnpm/@monaco-editor_react@4.7.0_monaco-editor@0.52.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@monaco-editor/react/dist/index.js +127 -142
  54. package/dist/es/node_modules/.pnpm/react-force-graph-3d@1.28.0_react@19.1.0/node_modules/react-force-graph-3d/dist/react-force-graph-3d.js +1 -1
  55. package/dist/es/node_modules/.pnpm/three-forcegraph@1.43.0_three@0.178.0/node_modules/three-forcegraph/dist/three-forcegraph.js +2 -2
  56. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.core.js +372 -372
  57. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.module.js +1 -1
  58. package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.webgpu.js +1 -1
  59. package/dist/es/react-components.css +1 -1
  60. package/package.json +19 -19
  61. /package/dist/cjs/node_modules/.pnpm/{3d-force-graph@1.78.2 → 3d-force-graph@1.78.3}/node_modules/3d-force-graph/dist/3d-force-graph.js +0 -0
  62. /package/dist/es/node_modules/.pnpm/{3d-force-graph@1.78.2 → 3d-force-graph@1.78.3}/node_modules/3d-force-graph/dist/3d-force-graph.js +0 -0
@@ -0,0 +1,23 @@
1
+ import { UseInViewOptions, MotionProps } from 'motion/react';
2
+ type MarginType = UseInViewOptions["margin"];
3
+ interface BlurFadeProps extends MotionProps {
4
+ children: React.ReactNode;
5
+ className?: string;
6
+ variant?: {
7
+ hidden: {
8
+ y: number;
9
+ };
10
+ visible: {
11
+ y: number;
12
+ };
13
+ };
14
+ duration?: number;
15
+ delay?: number;
16
+ offset?: number;
17
+ direction?: "up" | "down" | "left" | "right";
18
+ inView?: boolean;
19
+ inViewMargin?: MarginType;
20
+ blur?: string;
21
+ }
22
+ export declare function BlurFade({ children, className, variant, duration, delay, offset, direction, inView, inViewMargin, blur, ...props }: BlurFadeProps): import("react/jsx-runtime").JSX.Element;
23
+ export {};
@@ -0,0 +1,51 @@
1
+ "use client";
2
+ import { jsx as n } from "react/jsx-runtime";
3
+ import { useInView as b, AnimatePresence as w, motion as y } from "motion/react";
4
+ import { useRef as V } from "react";
5
+ function R({
6
+ children: r,
7
+ className: a,
8
+ variant: s,
9
+ duration: l = 0.4,
10
+ delay: o = 0,
11
+ offset: i = 6,
12
+ direction: e = "down",
13
+ inView: u = !1,
14
+ inViewMargin: d = "-50px",
15
+ blur: m = "6px",
16
+ ...f
17
+ }) {
18
+ const t = V(null), p = b(t, { once: !0, margin: d }), c = !u || p, h = {
19
+ hidden: {
20
+ [e === "left" || e === "right" ? "x" : "y"]: e === "right" || e === "down" ? -i : i,
21
+ opacity: 0,
22
+ filter: `blur(${m})`
23
+ },
24
+ visible: {
25
+ [e === "left" || e === "right" ? "x" : "y"]: 0,
26
+ opacity: 1,
27
+ filter: "blur(0px)"
28
+ }
29
+ }, x = s || h;
30
+ return /* @__PURE__ */ n(w, { children: /* @__PURE__ */ n(
31
+ y.div,
32
+ {
33
+ ref: t,
34
+ initial: "hidden",
35
+ animate: c ? "visible" : "hidden",
36
+ exit: "hidden",
37
+ variants: x,
38
+ transition: {
39
+ delay: 0.04 + o,
40
+ duration: l,
41
+ ease: "easeOut"
42
+ },
43
+ className: a,
44
+ ...f,
45
+ children: r
46
+ }
47
+ ) });
48
+ }
49
+ export {
50
+ R as BlurFade
51
+ };
@@ -0,0 +1,2 @@
1
+ import { BlurFade } from './BlurFade.tsx';
2
+ export { BlurFade };
@@ -1,7 +1,7 @@
1
1
  import { ReactNode, ButtonHTMLAttributes } from 'react';
2
- export type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost';
3
- export type ButtonSize = 'small' | 'medium' | 'large';
4
- export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'disabled'> {
2
+ export type ButtonVariant = "primary" | "secondary" | "outline" | "ghost";
3
+ export type ButtonSize = "small" | "medium" | "large";
4
+ export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "disabled"> {
5
5
  /** Button variant that changes the visual style */
6
6
  variant?: ButtonVariant;
7
7
  /** Size of the button */
@@ -1,5 +1,5 @@
1
1
  import { jsxs as a, jsx as r } from "react/jsx-runtime";
2
- import x from "clsx";
2
+ import { cn as h } from "../../utils/utils.js";
3
3
  const w = ({
4
4
  variant: l = "primary",
5
5
  size: n = "medium",
@@ -22,7 +22,7 @@ const w = ({
22
22
  small: "px-3 py-1.5 text-sm",
23
23
  medium: "px-4 py-2 text-base",
24
24
  large: "px-6 py-3 text-lg"
25
- }, b = x(
25
+ }, b = h(
26
26
  y,
27
27
  p[l],
28
28
  f[n],
@@ -1,43 +1,42 @@
1
1
  "use client";
2
- import { jsx as d, jsxs as g } from "react/jsx-runtime";
3
- import m from "../../node_modules/.pnpm/canvas-confetti@1.9.3/node_modules/canvas-confetti/dist/confetti.module.js";
4
- import { forwardRef as x, useRef as v, useCallback as C, useMemo as k, useImperativeHandle as B, useEffect as b, createContext as R } from "react";
5
- const j = R({}), p = x((c, s) => {
2
+ import { jsx as C, jsxs as w } from "react/jsx-runtime";
3
+ import d from "../../node_modules/.pnpm/canvas-confetti@1.9.3/node_modules/canvas-confetti/dist/confetti.module.js";
4
+ import { forwardRef as g, useRef as x, useCallback as u, useMemo as v, useImperativeHandle as k, useEffect as R, createContext as B } from "react";
5
+ const b = B({}), m = g((c, s) => {
6
6
  const {
7
7
  options: n,
8
8
  globalOptions: a = { resize: !0, useWorker: !0 },
9
9
  manualstart: o = !1,
10
- children: e,
11
- ...l
12
- } = c, t = v(null), y = C(
10
+ children: t,
11
+ ...f
12
+ } = c, e = x(null), h = u(
13
13
  (r) => {
14
14
  if (r !== null) {
15
- if (t.current) return;
16
- t.current = m.create(r, {
15
+ if (e.current) return;
16
+ e.current = d.create(r, {
17
17
  ...a,
18
18
  resize: !0
19
19
  });
20
20
  } else
21
- t.current && (t.current.reset(), t.current = null);
21
+ e.current && (e.current.reset(), e.current = null);
22
22
  },
23
23
  [a]
24
- ), i = C(
24
+ ), i = u(
25
25
  async (r = {}) => {
26
- var f;
27
26
  try {
28
- await ((f = t.current) == null ? void 0 : f.call(t, { ...n, ...r }));
29
- } catch (w) {
30
- console.error("Confetti error:", w);
27
+ await e.current?.({ ...n, ...r });
28
+ } catch (y) {
29
+ console.error("Confetti error:", y);
31
30
  }
32
31
  },
33
32
  [n]
34
- ), u = k(
33
+ ), l = v(
35
34
  () => ({
36
35
  fire: i
37
36
  }),
38
37
  [i]
39
38
  );
40
- return B(s, () => u, [u]), b(() => {
39
+ return k(s, () => l, [l]), R(() => {
41
40
  o || (async () => {
42
41
  try {
43
42
  await i();
@@ -45,34 +44,34 @@ const j = R({}), p = x((c, s) => {
45
44
  console.error("Confetti effect error:", r);
46
45
  }
47
46
  })();
48
- }, [o, i]), /* @__PURE__ */ g(j.Provider, { value: u, children: [
49
- /* @__PURE__ */ d("canvas", { ref: y, ...l }),
50
- e
47
+ }, [o, i]), /* @__PURE__ */ w(b.Provider, { value: l, children: [
48
+ /* @__PURE__ */ C("canvas", { ref: h, ...f }),
49
+ t
51
50
  ] });
52
51
  });
53
- p.displayName = "Confetti";
54
- const W = p, h = ({
52
+ m.displayName = "Confetti";
53
+ const N = m, p = ({
55
54
  options: c,
56
55
  children: s,
57
56
  ...n
58
- }) => /* @__PURE__ */ d("div", { onClick: async (o) => {
57
+ }) => /* @__PURE__ */ C("div", { onClick: async (o) => {
59
58
  try {
60
- const e = o.currentTarget.getBoundingClientRect(), l = e.left + e.width / 2, t = e.top + e.height / 2;
61
- await m({
59
+ const t = o.currentTarget.getBoundingClientRect(), f = t.left + t.width / 2, e = t.top + t.height / 2;
60
+ await d({
62
61
  ...c,
63
62
  origin: {
64
- x: l / window.innerWidth,
65
- y: t / window.innerHeight
63
+ x: f / window.innerWidth,
64
+ y: e / window.innerHeight
66
65
  }
67
66
  });
68
- } catch (e) {
69
- console.error("Confetti button error:", e);
67
+ } catch (t) {
68
+ console.error("Confetti button error:", t);
70
69
  }
71
70
  }, ...n, children: s });
72
- h.displayName = "ConfettiButton";
73
- const E = h;
71
+ p.displayName = "ConfettiButton";
72
+ const W = p;
74
73
  export {
75
- W as Confetti,
76
- E as ConfettiButton,
77
- m as confetti
74
+ N as Confetti,
75
+ W as ConfettiButton,
76
+ d as confetti
78
77
  };
@@ -1,36 +1,36 @@
1
1
  "use client";
2
- import { jsx as g } from "react/jsx-runtime";
3
- import { cva as T } from "class-variance-authority";
4
- import { useMotionValue as x, motion as k, useTransform as b, useSpring as w } from "motion/react";
5
- import i, { useRef as A } from "react";
6
- import { cn as I } from "../../utils/utils.js";
7
- const y = 40, D = 60, h = 140, C = T(
2
+ import { jsx as b } from "react/jsx-runtime";
3
+ import { cva as N } from "class-variance-authority";
4
+ import { useMotionValue as g, motion as x, useTransform as f, useSpring as T } from "motion/react";
5
+ import i, { useRef as w } from "react";
6
+ import { cn as k } from "../../utils/utils.js";
7
+ const I = 40, y = 60, D = 140, A = N(
8
8
  "supports-backdrop-blur:bg-white/10 supports-backdrop-blur:dark:bg-black/10 mx-auto mt-8 flex h-[58px] w-max items-center justify-center gap-2 rounded-2xl border p-2 backdrop-blur-md"
9
- ), v = i.forwardRef(
9
+ ), C = i.forwardRef(
10
10
  ({
11
11
  className: t,
12
12
  children: a,
13
- iconSize: s = y,
14
- iconMagnification: c = D,
15
- iconDistance: m = h,
13
+ iconSize: s = I,
14
+ iconMagnification: c = y,
15
+ iconDistance: m = D,
16
16
  direction: n = "middle",
17
17
  ...u
18
18
  }, r) => {
19
- const o = x(1 / 0), d = () => i.Children.map(a, (e) => i.isValidElement(e) && e.type === E ? i.cloneElement(e, {
19
+ const o = g(1 / 0), d = () => i.Children.map(a, (e) => i.isValidElement(e) && e.type === h ? i.cloneElement(e, {
20
20
  ...e.props,
21
21
  mouseX: o,
22
22
  size: s,
23
23
  magnification: c,
24
24
  distance: m
25
25
  }) : e);
26
- return /* @__PURE__ */ g(
27
- k.div,
26
+ return /* @__PURE__ */ b(
27
+ x.div,
28
28
  {
29
29
  ref: r,
30
30
  onMouseMove: (e) => o.set(e.pageX),
31
31
  onMouseLeave: () => o.set(1 / 0),
32
32
  ...u,
33
- className: I(C({ className: t }), {
33
+ className: k(A({ className: t }), {
34
34
  "items-start": n === "top",
35
35
  "items-center": n === "middle",
36
36
  "items-end": n === "bottom"
@@ -40,35 +40,34 @@ const y = 40, D = 60, h = 140, C = T(
40
40
  );
41
41
  }
42
42
  );
43
- v.displayName = "Dock";
44
- const E = ({
45
- size: t = y,
46
- magnification: a = D,
47
- distance: s = h,
43
+ C.displayName = "Dock";
44
+ const h = ({
45
+ size: t = I,
46
+ magnification: a = y,
47
+ distance: s = D,
48
48
  mouseX: c,
49
49
  className: m,
50
50
  children: n,
51
51
  ...u
52
52
  }) => {
53
- const r = A(null), o = Math.max(6, t * 0.2), d = x(1 / 0), e = b(c ?? d, (N) => {
54
- var f;
55
- const l = ((f = r.current) == null ? void 0 : f.getBoundingClientRect()) ?? { x: 0, width: 0 };
56
- return N - l.x - l.width / 2;
57
- }), M = b(
53
+ const r = w(null), o = Math.max(6, t * 0.2), d = g(1 / 0), e = f(c ?? d, (M) => {
54
+ const l = r.current?.getBoundingClientRect() ?? { x: 0, width: 0 };
55
+ return M - l.x - l.width / 2;
56
+ }), E = f(
58
57
  e,
59
58
  [-s, 0, s],
60
59
  [t, a, t]
61
- ), p = w(M, {
60
+ ), p = T(E, {
62
61
  mass: 0.1,
63
62
  stiffness: 150,
64
63
  damping: 12
65
64
  });
66
- return /* @__PURE__ */ g(
67
- k.div,
65
+ return /* @__PURE__ */ b(
66
+ x.div,
68
67
  {
69
68
  ref: r,
70
69
  style: { width: p, height: p, padding: o },
71
- className: I(
70
+ className: k(
72
71
  "flex aspect-square cursor-pointer items-center justify-center rounded-full",
73
72
  m
74
73
  ),
@@ -77,9 +76,9 @@ const E = ({
77
76
  }
78
77
  );
79
78
  };
80
- E.displayName = "DockIcon";
79
+ h.displayName = "DockIcon";
81
80
  export {
82
- v as Dock,
83
- E as DockIcon,
84
- C as dockVariants
81
+ C as Dock,
82
+ h as DockIcon,
83
+ A as dockVariants
85
84
  };
@@ -19,4 +19,4 @@ interface HyperTextProps extends MotionProps {
19
19
  characterSet?: CharacterSet;
20
20
  }
21
21
  export declare function HyperText({ children, className, duration, delay, as: Component, startOnView, animateOnHover, characterSet, ...props }: HyperTextProps): import("react/jsx-runtime").JSX.Element;
22
- export default HyperText;
22
+ export {};
@@ -1,74 +1,76 @@
1
1
  "use client";
2
2
  import { jsx as u } from "react/jsx-runtime";
3
3
  import { cn as g } from "../../utils/utils.js";
4
- import { motion as v, AnimatePresence as H } from "motion/react";
5
- import { useState as x, useRef as I, useEffect as d } from "react";
6
- const N = Object.freeze(
4
+ import { motion as x, AnimatePresence as U } from "motion/react";
5
+ import { useState as M, useRef as h, useEffect as I } from "react";
6
+ const j = Object.freeze(
7
7
  "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("")
8
- ), P = (e) => Math.floor(Math.random() * e);
9
- function L({
10
- children: e,
11
- className: A,
12
- duration: l = 800,
13
- delay: s = 0,
14
- as: M = "div",
15
- startOnView: m = !1,
16
- animateOnHover: h = !0,
17
- characterSet: i = N,
18
- ...C
8
+ ), q = (n) => Math.floor(Math.random() * n);
9
+ function z({
10
+ children: n,
11
+ className: C,
12
+ duration: f = 800,
13
+ delay: r = 0,
14
+ as: E = "div",
15
+ startOnView: p = !1,
16
+ animateOnHover: F = !0,
17
+ characterSet: s = j,
18
+ ...R
19
19
  }) {
20
- const E = v.create(M, {
20
+ const b = x.create(E, {
21
21
  forwardMotionProps: !0
22
- }), [R, b] = x(
23
- () => e.split("")
24
- ), [a, o] = x(!1), r = I(0), c = I(null), D = () => {
25
- h && !a && (r.current = 0, o(!0));
22
+ }), [v, w] = M(
23
+ () => n.split("")
24
+ ), [i, o] = M(!1), a = h(0), m = h(null), D = () => {
25
+ F && !i && (a.current = 0, o(!0));
26
26
  };
27
- return d(() => {
28
- if (!m) {
29
- const n = setTimeout(() => {
27
+ return I(() => {
28
+ if (!p) {
29
+ const t = setTimeout(() => {
30
30
  o(!0);
31
- }, s);
32
- return () => clearTimeout(n);
31
+ }, r);
32
+ return () => clearTimeout(t);
33
33
  }
34
- const t = new IntersectionObserver(
35
- ([n]) => {
36
- n.isIntersecting && (setTimeout(() => {
34
+ const e = new IntersectionObserver(
35
+ ([t]) => {
36
+ t.isIntersecting && (setTimeout(() => {
37
37
  o(!0);
38
- }, s), t.disconnect());
38
+ }, r), e.disconnect());
39
39
  },
40
40
  { threshold: 0.1, rootMargin: "-30% 0px -30% 0px" }
41
41
  );
42
- return c.current && t.observe(c.current), () => t.disconnect();
43
- }, [s, m]), d(() => {
44
- if (!a) return;
45
- const t = l / (e.length * 10), n = e.length, f = setInterval(() => {
46
- r.current < n ? (b(
47
- (w) => w.map(
48
- (p, T) => p === " " ? p : T <= r.current ? e[T] : i[P(i.length)]
42
+ return m.current && e.observe(m.current), () => e.disconnect();
43
+ }, [r, p]), I(() => {
44
+ if (!i) return;
45
+ const e = n.length, t = performance.now();
46
+ let c;
47
+ const l = (H) => {
48
+ const N = H - t, T = Math.min(N / f, 1);
49
+ a.current = T * e, w(
50
+ (P) => P.map(
51
+ (A, d) => A === " " ? A : d <= a.current ? n[d] : s[q(s.length)]
49
52
  )
50
- ), r.current = r.current + 0.1) : (o(!1), clearInterval(f));
51
- }, t);
52
- return () => clearInterval(f);
53
- }, [e, l, a, i]), /* @__PURE__ */ u(
54
- E,
53
+ ), T < 1 ? c = requestAnimationFrame(l) : o(!1);
54
+ };
55
+ return c = requestAnimationFrame(l), () => cancelAnimationFrame(c);
56
+ }, [n, f, i, s]), /* @__PURE__ */ u(
57
+ b,
55
58
  {
56
- ref: c,
57
- className: g("overflow-hidden py-2 text-4xl font-bold", A),
59
+ ref: m,
60
+ className: g("overflow-hidden py-2 text-4xl font-bold", C),
58
61
  onMouseEnter: D,
59
- ...C,
60
- children: /* @__PURE__ */ u(H, { children: R.map((t, n) => /* @__PURE__ */ u(
61
- v.span,
62
+ ...R,
63
+ children: /* @__PURE__ */ u(U, { children: v.map((e, t) => /* @__PURE__ */ u(
64
+ x.span,
62
65
  {
63
- className: g("font-mono", t === " " ? "w-3" : ""),
64
- children: t.toUpperCase()
66
+ className: g("font-mono", e === " " ? "w-3" : ""),
67
+ children: e.toUpperCase()
65
68
  },
66
- n
69
+ t
67
70
  )) })
68
71
  }
69
72
  );
70
73
  }
71
74
  export {
72
- L as HyperText,
73
- L as default
75
+ z as HyperText
74
76
  };
@@ -3,4 +3,4 @@ interface MorphingTextProps {
3
3
  texts: string[];
4
4
  }
5
5
  export declare const MorphingText: React.FC<MorphingTextProps>;
6
- export default MorphingText;
6
+ export {};
@@ -4,7 +4,7 @@ import { createUseGesture as N, dragAction as U, pinchAction as W, wheelAction a
4
4
  import { useRef as F } from "react";
5
5
  import { useMount as k, useUnmount as q } from "ahooks";
6
6
  import z from "clsx";
7
- const H = N([U, W, j]), o = (u) => u.preventDefault(), V = (u) => {
7
+ const H = N([U, W, j]), a = (c) => c.preventDefault(), V = (c) => {
8
8
  const {
9
9
  className: f,
10
10
  children: h,
@@ -15,15 +15,13 @@ const H = N([U, W, j]), o = (u) => u.preventDefault(), V = (u) => {
15
15
  scaleBounds: l = { min: 0.3, max: 10 },
16
16
  wheelZoomFactor: p = 1e-3,
17
17
  rubberband: y = !0
18
- } = u, n = F(null);
18
+ } = c, e = F(null);
19
19
  k(() => {
20
- var t, e, r;
21
- (t = n.current) == null || t.addEventListener("gesturestart", o), (e = n.current) == null || e.addEventListener("gesturechange", o), (r = n.current) == null || r.addEventListener("gestureend", o);
20
+ e.current?.addEventListener("gesturestart", a), e.current?.addEventListener("gesturechange", a), e.current?.addEventListener("gestureend", a);
22
21
  }), q(() => {
23
- var t, e, r;
24
- (t = n.current) == null || t.removeEventListener("gesturestart", o), (e = n.current) == null || e.removeEventListener("gesturechange", o), (r = n.current) == null || r.removeEventListener("gestureend", o);
22
+ e.current?.removeEventListener("gesturestart", a), e.current?.removeEventListener("gesturechange", a), e.current?.removeEventListener("gestureend", a);
25
23
  });
26
- const [s, g] = C(() => ({
24
+ const [t, g] = C(() => ({
27
25
  x: 0,
28
26
  y: 0,
29
27
  scale: 1,
@@ -31,42 +29,42 @@ const H = N([U, W, j]), o = (u) => u.preventDefault(), V = (u) => {
31
29
  }));
32
30
  return H(
33
31
  {
34
- onWheel: ({ event: t, delta: [, e] }) => {
32
+ onWheel: ({ event: o, delta: [, r] }) => {
35
33
  if (!d) return;
36
- const a = s.scale.get() * (1 - e * p), i = Math.min(
37
- Math.max(a, l.min),
34
+ const n = t.scale.get() * (1 - r * p), i = Math.min(
35
+ Math.max(n, l.min),
38
36
  l.max
39
37
  );
40
38
  g.start({ scale: i });
41
39
  },
42
- onDrag: ({ pinching: t, cancel: e, offset: [r, a], ...i }) => {
43
- if (!x || t) return e();
44
- g.start({ x: r, y: a });
40
+ onDrag: ({ pinching: o, cancel: r, offset: [u, n], ...i }) => {
41
+ if (!x || o) return r();
42
+ g.start({ x: u, y: n });
45
43
  },
46
44
  onPinch: ({
47
- origin: [t, e],
48
- first: r,
49
- movement: [a],
45
+ origin: [o, r],
46
+ first: u,
47
+ movement: [n],
50
48
  offset: [i, E],
51
- memo: c,
49
+ memo: s,
52
50
  cancel: L
53
51
  }) => {
54
52
  if (!d) return L();
55
- if (r) {
56
- const { width: M, height: Z, x: A, y: D } = n.current.getBoundingClientRect(), P = t - (A + M / 2), R = e - (D + Z / 2);
57
- c = [s.x.get(), s.y.get(), P, R];
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];
58
56
  }
59
- const w = c[0] - (a - 1) * c[2], S = c[1] - (a - 1) * c[3], b = {
57
+ const w = s[0] - (n - 1) * s[2], S = s[1] - (n - 1) * s[3], b = {
60
58
  scale: i,
61
- rotateZ: v ? E : s.rotateZ.get(),
62
- ...m ? { x: s.x.get(), y: s.y.get() } : { x: w, y: S }
59
+ rotateZ: v ? E : t.rotateZ.get(),
60
+ ...m ? { x: t.x.get(), y: t.y.get() } : { x: w, y: S }
63
61
  };
64
- return g.start(b), c;
62
+ return g.start(b), s;
65
63
  }
66
64
  },
67
65
  {
68
- target: n,
69
- drag: { from: () => [s.x.get(), s.y.get()] },
66
+ target: e,
67
+ drag: { from: () => [t.x.get(), t.y.get()] },
70
68
  pinch: { scaleBounds: l, rubberband: y },
71
69
  wheel: { enabled: !0 }
72
70
  }
@@ -74,10 +72,10 @@ const H = N([U, W, j]), o = (u) => u.preventDefault(), V = (u) => {
74
72
  G.div,
75
73
  {
76
74
  className: z("select-none", f),
77
- ref: n,
75
+ ref: e,
78
76
  style: {
79
- ...u.style,
80
- ...s
77
+ ...c.style,
78
+ ...t
81
79
  },
82
80
  children: h
83
81
  }
@@ -0,0 +1,13 @@
1
+ import { HTMLMotionProps } from 'motion/react';
2
+ import { ReactNode } from 'react';
3
+ type PointerProps = Omit<HTMLMotionProps<"div">, "ref">;
4
+ /**
5
+ * A custom pointer component that displays an animated cursor.
6
+ * Add this as a child to any component to enable a custom pointer when hovering.
7
+ * You can pass custom children to render as the pointer.
8
+ *
9
+ * @component
10
+ * @param {PointerProps} props - The component props
11
+ */
12
+ export declare function Pointer({ className, style, children, ...props }: PointerProps): ReactNode;
13
+ export {};