@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.
- package/dist/cjs/components/blur-fade/BlurFade.d.ts +23 -0
- package/dist/cjs/components/blur-fade/BlurFade.js +1 -0
- package/dist/cjs/components/blur-fade/index.d.ts +2 -0
- package/dist/cjs/components/button/Button.d.ts +3 -3
- package/dist/cjs/components/button/Button.js +1 -1
- package/dist/cjs/components/confetti-button/index.js +1 -1
- package/dist/cjs/components/dock/Duck.js +1 -1
- package/dist/cjs/components/hyper-text/index.d.ts +1 -1
- package/dist/cjs/components/hyper-text/index.js +1 -1
- package/dist/cjs/components/morphing-text/index.d.ts +1 -1
- package/dist/cjs/components/pinch-content/PinchContent.js +1 -1
- package/dist/cjs/components/pointer/Pointer.d.ts +13 -0
- package/dist/cjs/components/pointer/Pointer.js +1 -0
- package/dist/cjs/components/pointer/index.d.ts +2 -0
- package/dist/cjs/components/scratch-to-reveal/ScratchToReveal.d.ts +12 -0
- package/dist/cjs/components/scratch-to-reveal/index.d.ts +2 -0
- package/dist/cjs/components/sparkles-text/SparklesText.d.ts +43 -0
- package/dist/cjs/components/sparkles-text/SparklesText.js +1 -0
- package/dist/cjs/components/sparkles-text/index.d.ts +2 -0
- package/dist/cjs/components/txt-editor/TxtEditor.js +1 -1
- package/dist/cjs/components/txt-reader/TxtReader.js +1 -1
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +1 -1
- 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
- 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
- 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
- package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.module.js +1 -1
- package/dist/cjs/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.webgpu.js +1 -1
- package/dist/cjs/react-components.css +1 -1
- package/dist/es/components/blur-fade/BlurFade.d.ts +23 -0
- package/dist/es/components/blur-fade/BlurFade.js +51 -0
- package/dist/es/components/blur-fade/index.d.ts +2 -0
- package/dist/es/components/button/Button.d.ts +3 -3
- package/dist/es/components/button/Button.js +2 -2
- package/dist/es/components/confetti-button/index.js +33 -34
- package/dist/es/components/dock/Duck.js +31 -32
- package/dist/es/components/hyper-text/index.d.ts +1 -1
- package/dist/es/components/hyper-text/index.js +52 -50
- package/dist/es/components/morphing-text/index.d.ts +1 -1
- package/dist/es/components/pinch-content/PinchContent.js +27 -29
- package/dist/es/components/pointer/Pointer.d.ts +13 -0
- package/dist/es/components/pointer/Pointer.js +77 -0
- package/dist/es/components/pointer/index.d.ts +2 -0
- package/dist/es/components/scratch-to-reveal/ScratchToReveal.d.ts +12 -0
- package/dist/es/components/scratch-to-reveal/index.d.ts +2 -0
- package/dist/es/components/sparkles-text/SparklesText.d.ts +43 -0
- package/dist/es/components/sparkles-text/SparklesText.js +70 -0
- package/dist/es/components/sparkles-text/index.d.ts +2 -0
- package/dist/es/components/txt-editor/TxtEditor.js +29 -29
- package/dist/es/components/txt-reader/TxtReader.js +41 -41
- package/dist/es/index.d.ts +3 -0
- package/dist/es/index.js +26 -20
- 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
- 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
- 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
- package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.core.js +372 -372
- package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.module.js +1 -1
- package/dist/es/node_modules/.pnpm/three@0.178.0/node_modules/three/build/three.webgpu.js +1 -1
- package/dist/es/react-components.css +1 -1
- package/package.json +19 -19
- /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
- /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
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode, ButtonHTMLAttributes } from 'react';
|
|
2
|
-
export type ButtonVariant =
|
|
3
|
-
export type ButtonSize =
|
|
4
|
-
export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>,
|
|
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
|
|
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 =
|
|
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
|
|
3
|
-
import
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
const
|
|
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:
|
|
11
|
-
...
|
|
12
|
-
} = c,
|
|
10
|
+
children: t,
|
|
11
|
+
...f
|
|
12
|
+
} = c, e = x(null), h = u(
|
|
13
13
|
(r) => {
|
|
14
14
|
if (r !== null) {
|
|
15
|
-
if (
|
|
16
|
-
|
|
15
|
+
if (e.current) return;
|
|
16
|
+
e.current = d.create(r, {
|
|
17
17
|
...a,
|
|
18
18
|
resize: !0
|
|
19
19
|
});
|
|
20
20
|
} else
|
|
21
|
-
|
|
21
|
+
e.current && (e.current.reset(), e.current = null);
|
|
22
22
|
},
|
|
23
23
|
[a]
|
|
24
|
-
), i =
|
|
24
|
+
), i = u(
|
|
25
25
|
async (r = {}) => {
|
|
26
|
-
var f;
|
|
27
26
|
try {
|
|
28
|
-
await
|
|
29
|
-
} catch (
|
|
30
|
-
console.error("Confetti error:",
|
|
27
|
+
await e.current?.({ ...n, ...r });
|
|
28
|
+
} catch (y) {
|
|
29
|
+
console.error("Confetti error:", y);
|
|
31
30
|
}
|
|
32
31
|
},
|
|
33
32
|
[n]
|
|
34
|
-
),
|
|
33
|
+
), l = v(
|
|
35
34
|
() => ({
|
|
36
35
|
fire: i
|
|
37
36
|
}),
|
|
38
37
|
[i]
|
|
39
38
|
);
|
|
40
|
-
return
|
|
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__ */
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
|
|
47
|
+
}, [o, i]), /* @__PURE__ */ w(b.Provider, { value: l, children: [
|
|
48
|
+
/* @__PURE__ */ C("canvas", { ref: h, ...f }),
|
|
49
|
+
t
|
|
51
50
|
] });
|
|
52
51
|
});
|
|
53
|
-
|
|
54
|
-
const
|
|
52
|
+
m.displayName = "Confetti";
|
|
53
|
+
const N = m, p = ({
|
|
55
54
|
options: c,
|
|
56
55
|
children: s,
|
|
57
56
|
...n
|
|
58
|
-
}) => /* @__PURE__ */
|
|
57
|
+
}) => /* @__PURE__ */ C("div", { onClick: async (o) => {
|
|
59
58
|
try {
|
|
60
|
-
const
|
|
61
|
-
await
|
|
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:
|
|
65
|
-
y:
|
|
63
|
+
x: f / window.innerWidth,
|
|
64
|
+
y: e / window.innerHeight
|
|
66
65
|
}
|
|
67
66
|
});
|
|
68
|
-
} catch (
|
|
69
|
-
console.error("Confetti button error:",
|
|
67
|
+
} catch (t) {
|
|
68
|
+
console.error("Confetti button error:", t);
|
|
70
69
|
}
|
|
71
70
|
}, ...n, children: s });
|
|
72
|
-
|
|
73
|
-
const
|
|
71
|
+
p.displayName = "ConfettiButton";
|
|
72
|
+
const W = p;
|
|
74
73
|
export {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
|
3
|
-
import { cva as
|
|
4
|
-
import { useMotionValue as
|
|
5
|
-
import i, { useRef as
|
|
6
|
-
import { cn as
|
|
7
|
-
const
|
|
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
|
-
),
|
|
9
|
+
), C = i.forwardRef(
|
|
10
10
|
({
|
|
11
11
|
className: t,
|
|
12
12
|
children: a,
|
|
13
|
-
iconSize: s =
|
|
14
|
-
iconMagnification: c =
|
|
15
|
-
iconDistance: m =
|
|
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 =
|
|
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__ */
|
|
27
|
-
|
|
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:
|
|
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
|
-
|
|
44
|
-
const
|
|
45
|
-
size: t =
|
|
46
|
-
magnification: a =
|
|
47
|
-
distance: s =
|
|
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 =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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 =
|
|
60
|
+
), p = T(E, {
|
|
62
61
|
mass: 0.1,
|
|
63
62
|
stiffness: 150,
|
|
64
63
|
damping: 12
|
|
65
64
|
});
|
|
66
|
-
return /* @__PURE__ */
|
|
67
|
-
|
|
65
|
+
return /* @__PURE__ */ b(
|
|
66
|
+
x.div,
|
|
68
67
|
{
|
|
69
68
|
ref: r,
|
|
70
69
|
style: { width: p, height: p, padding: o },
|
|
71
|
-
className:
|
|
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
|
-
|
|
79
|
+
h.displayName = "DockIcon";
|
|
81
80
|
export {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
|
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
|
|
5
|
-
import { useState as
|
|
6
|
-
const
|
|
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
|
-
),
|
|
9
|
-
function
|
|
10
|
-
children:
|
|
11
|
-
className:
|
|
12
|
-
duration:
|
|
13
|
-
delay:
|
|
14
|
-
as:
|
|
15
|
-
startOnView:
|
|
16
|
-
animateOnHover:
|
|
17
|
-
characterSet:
|
|
18
|
-
...
|
|
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
|
|
20
|
+
const b = x.create(E, {
|
|
21
21
|
forwardMotionProps: !0
|
|
22
|
-
}), [
|
|
23
|
-
() =>
|
|
24
|
-
), [
|
|
25
|
-
|
|
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
|
|
28
|
-
if (!
|
|
29
|
-
const
|
|
27
|
+
return I(() => {
|
|
28
|
+
if (!p) {
|
|
29
|
+
const t = setTimeout(() => {
|
|
30
30
|
o(!0);
|
|
31
|
-
},
|
|
32
|
-
return () => clearTimeout(
|
|
31
|
+
}, r);
|
|
32
|
+
return () => clearTimeout(t);
|
|
33
33
|
}
|
|
34
|
-
const
|
|
35
|
-
([
|
|
36
|
-
|
|
34
|
+
const e = new IntersectionObserver(
|
|
35
|
+
([t]) => {
|
|
36
|
+
t.isIntersecting && (setTimeout(() => {
|
|
37
37
|
o(!0);
|
|
38
|
-
},
|
|
38
|
+
}, r), e.disconnect());
|
|
39
39
|
},
|
|
40
40
|
{ threshold: 0.1, rootMargin: "-30% 0px -30% 0px" }
|
|
41
41
|
);
|
|
42
|
-
return
|
|
43
|
-
}, [
|
|
44
|
-
if (!
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
),
|
|
51
|
-
}
|
|
52
|
-
return () =>
|
|
53
|
-
}, [
|
|
54
|
-
|
|
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:
|
|
57
|
-
className: g("overflow-hidden py-2 text-4xl font-bold",
|
|
59
|
+
ref: m,
|
|
60
|
+
className: g("overflow-hidden py-2 text-4xl font-bold", C),
|
|
58
61
|
onMouseEnter: D,
|
|
59
|
-
...
|
|
60
|
-
children: /* @__PURE__ */ u(
|
|
61
|
-
|
|
62
|
+
...R,
|
|
63
|
+
children: /* @__PURE__ */ u(U, { children: v.map((e, t) => /* @__PURE__ */ u(
|
|
64
|
+
x.span,
|
|
62
65
|
{
|
|
63
|
-
className: g("font-mono",
|
|
64
|
-
children:
|
|
66
|
+
className: g("font-mono", e === " " ? "w-3" : ""),
|
|
67
|
+
children: e.toUpperCase()
|
|
65
68
|
},
|
|
66
|
-
|
|
69
|
+
t
|
|
67
70
|
)) })
|
|
68
71
|
}
|
|
69
72
|
);
|
|
70
73
|
}
|
|
71
74
|
export {
|
|
72
|
-
|
|
73
|
-
L as default
|
|
75
|
+
z as HyperText
|
|
74
76
|
};
|
|
@@ -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]),
|
|
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
|
-
} =
|
|
18
|
+
} = c, e = F(null);
|
|
19
19
|
k(() => {
|
|
20
|
-
|
|
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
|
-
|
|
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 [
|
|
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:
|
|
32
|
+
onWheel: ({ event: o, delta: [, r] }) => {
|
|
35
33
|
if (!d) return;
|
|
36
|
-
const
|
|
37
|
-
Math.max(
|
|
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:
|
|
43
|
-
if (!x ||
|
|
44
|
-
g.start({ x:
|
|
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: [
|
|
48
|
-
first:
|
|
49
|
-
movement: [
|
|
45
|
+
origin: [o, r],
|
|
46
|
+
first: u,
|
|
47
|
+
movement: [n],
|
|
50
48
|
offset: [i, E],
|
|
51
|
-
memo:
|
|
49
|
+
memo: s,
|
|
52
50
|
cancel: L
|
|
53
51
|
}) => {
|
|
54
52
|
if (!d) return L();
|
|
55
|
-
if (
|
|
56
|
-
const { width: M, height: Z, x: A, y: D } =
|
|
57
|
-
|
|
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 =
|
|
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 :
|
|
62
|
-
...m ? { x:
|
|
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),
|
|
62
|
+
return g.start(b), s;
|
|
65
63
|
}
|
|
66
64
|
},
|
|
67
65
|
{
|
|
68
|
-
target:
|
|
69
|
-
drag: { from: () => [
|
|
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:
|
|
75
|
+
ref: e,
|
|
78
76
|
style: {
|
|
79
|
-
...
|
|
80
|
-
...
|
|
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 {};
|