@xiping/react-components 1.0.22 → 1.0.24

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 (33) hide show
  1. package/dist/cjs/components/confetti-button/index.d.ts +4 -4
  2. package/dist/cjs/components/confetti-button/index.js +1 -1
  3. package/dist/cjs/components/dock/Duck.js +1 -1
  4. package/dist/cjs/components/pinch-content/PinchContent.js +1 -1
  5. package/dist/cjs/components/pointer/Pointer.d.ts +13 -0
  6. package/dist/cjs/components/pointer/Pointer.js +1 -0
  7. package/dist/cjs/components/pointer/index.d.ts +2 -0
  8. package/dist/cjs/components/sparkles-text/SparklesText.d.ts +43 -0
  9. package/dist/cjs/components/sparkles-text/SparklesText.js +1 -0
  10. package/dist/cjs/components/sparkles-text/index.d.ts +2 -0
  11. package/dist/cjs/components/txt-editor/TxtEditor.js +1 -1
  12. package/dist/cjs/components/txt-reader/TxtReader.js +1 -1
  13. package/dist/cjs/index.d.ts +2 -0
  14. package/dist/cjs/index.js +1 -1
  15. 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
  16. package/dist/cjs/react-components.css +1 -1
  17. package/dist/es/components/confetti-button/index.d.ts +4 -4
  18. package/dist/es/components/confetti-button/index.js +33 -33
  19. package/dist/es/components/dock/Duck.js +31 -32
  20. package/dist/es/components/pinch-content/PinchContent.js +27 -29
  21. package/dist/es/components/pointer/Pointer.d.ts +13 -0
  22. package/dist/es/components/pointer/Pointer.js +77 -0
  23. package/dist/es/components/pointer/index.d.ts +2 -0
  24. package/dist/es/components/sparkles-text/SparklesText.d.ts +43 -0
  25. package/dist/es/components/sparkles-text/SparklesText.js +70 -0
  26. package/dist/es/components/sparkles-text/index.d.ts +2 -0
  27. package/dist/es/components/txt-editor/TxtEditor.js +29 -29
  28. package/dist/es/components/txt-reader/TxtReader.js +41 -41
  29. package/dist/es/index.d.ts +2 -0
  30. package/dist/es/index.js +24 -18
  31. 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
  32. package/dist/es/react-components.css +1 -1
  33. package/package.json +9 -9
@@ -1,4 +1,4 @@
1
- import { GlobalOptions as ConfettiGlobalOptions, Options as ConfettiOptions } from 'canvas-confetti';
1
+ import { GlobalOptions as ConfettiGlobalOptions, Options as ConfettiOptions, default as confetti } from 'canvas-confetti';
2
2
  import { ReactNode, default as React } from 'react';
3
3
  type Api = {
4
4
  fire: (options?: ConfettiOptions) => void;
@@ -10,15 +10,15 @@ type Props = React.ComponentPropsWithRef<"canvas"> & {
10
10
  children?: ReactNode;
11
11
  };
12
12
  export type ConfettiRef = Api | null;
13
- export declare const Confetti: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<Api>>;
13
+ declare const Confetti: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<Api>>;
14
14
  interface ConfettiButtonProps extends React.HTMLAttributes<HTMLDivElement> {
15
15
  options?: ConfettiOptions & ConfettiGlobalOptions & {
16
16
  canvas?: HTMLCanvasElement;
17
17
  };
18
18
  children?: React.ReactNode;
19
19
  }
20
- export declare const ConfettiButton: {
20
+ declare const ConfettiButton: {
21
21
  ({ options, children, ...props }: ConfettiButtonProps): import("react/jsx-runtime").JSX.Element;
22
22
  displayName: string;
23
23
  };
24
- export {};
24
+ export { confetti, ConfettiButton, Confetti };
@@ -1,43 +1,42 @@
1
1
  "use client";
2
- import { jsxs as g, jsx as d } 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,33 +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
74
+ N as Confetti,
75
+ W as ConfettiButton,
76
+ d as confetti
77
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
  };
@@ -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 {};
@@ -0,0 +1,77 @@
1
+ "use client";
2
+ import { jsxs as h, Fragment as E, jsx as t } from "react/jsx-runtime";
3
+ import { cn as w } from "../../utils/utils.js";
4
+ import { useMotionValue as m, AnimatePresence as x, motion as L } from "motion/react";
5
+ import { useState as y, useRef as g, useEffect as M } from "react";
6
+ function C({
7
+ className: u,
8
+ style: d,
9
+ children: v,
10
+ ...f
11
+ }) {
12
+ const n = m(0), o = m(0), [p, s] = y(!1), r = g(null);
13
+ return M(() => {
14
+ if (typeof window < "u" && r.current) {
15
+ const e = r.current.parentElement;
16
+ if (e) {
17
+ e.style.cursor = "none";
18
+ const i = (l) => {
19
+ n.set(l.clientX), o.set(l.clientY);
20
+ }, a = () => {
21
+ s(!0);
22
+ }, c = () => {
23
+ s(!1);
24
+ };
25
+ return e.addEventListener("mousemove", i), e.addEventListener("mouseenter", a), e.addEventListener("mouseleave", c), () => {
26
+ e.style.cursor = "", e.removeEventListener("mousemove", i), e.removeEventListener("mouseenter", a), e.removeEventListener("mouseleave", c);
27
+ };
28
+ }
29
+ }
30
+ }, [n, o]), /* @__PURE__ */ h(E, { children: [
31
+ /* @__PURE__ */ t("div", { ref: r }),
32
+ /* @__PURE__ */ t(x, { children: p && /* @__PURE__ */ t(
33
+ L.div,
34
+ {
35
+ className: "transform-[translate(-50%,-50%)] pointer-events-none fixed z-50",
36
+ style: {
37
+ top: o,
38
+ left: n,
39
+ ...d
40
+ },
41
+ initial: {
42
+ scale: 0,
43
+ opacity: 0
44
+ },
45
+ animate: {
46
+ scale: 1,
47
+ opacity: 1
48
+ },
49
+ exit: {
50
+ scale: 0,
51
+ opacity: 0
52
+ },
53
+ ...f,
54
+ children: v || /* @__PURE__ */ t(
55
+ "svg",
56
+ {
57
+ stroke: "currentColor",
58
+ fill: "currentColor",
59
+ strokeWidth: "1",
60
+ viewBox: "0 0 16 16",
61
+ height: "24",
62
+ width: "24",
63
+ xmlns: "http://www.w3.org/2000/svg",
64
+ className: w(
65
+ "rotate-[-70deg] stroke-white text-black",
66
+ u
67
+ ),
68
+ children: /* @__PURE__ */ t("path", { d: "M14.082 2.182a.5.5 0 0 1 .103.557L8.528 15.467a.5.5 0 0 1-.917-.007L5.57 10.694.803 8.652a.5.5 0 0 1-.006-.916l12.728-5.657a.5.5 0 0 1 .556.103z" })
69
+ }
70
+ )
71
+ }
72
+ ) })
73
+ ] });
74
+ }
75
+ export {
76
+ C as Pointer
77
+ };
@@ -0,0 +1,2 @@
1
+ import { Pointer } from './Pointer';
2
+ export { Pointer };
@@ -0,0 +1,43 @@
1
+ import { ReactElement } from 'react';
2
+ interface SparklesTextProps {
3
+ /**
4
+ * @default <div />
5
+ * @type ReactElement
6
+ * @description
7
+ * The component to be rendered as the text
8
+ * */
9
+ as?: ReactElement;
10
+ /**
11
+ * @default ""
12
+ * @type string
13
+ * @description
14
+ * The className of the text
15
+ */
16
+ className?: string;
17
+ /**
18
+ * @required
19
+ * @type ReactNode
20
+ * @description
21
+ * The content to be displayed
22
+ * */
23
+ children: React.ReactNode;
24
+ /**
25
+ * @default 10
26
+ * @type number
27
+ * @description
28
+ * The count of sparkles
29
+ * */
30
+ sparklesCount?: number;
31
+ /**
32
+ * @default "{first: '#9E7AFF', second: '#FE8BBB'}"
33
+ * @type string
34
+ * @description
35
+ * The colors of the sparkles
36
+ * */
37
+ colors?: {
38
+ first: string;
39
+ second: string;
40
+ };
41
+ }
42
+ export declare const SparklesText: React.FC<SparklesTextProps>;
43
+ export {};
@@ -0,0 +1,70 @@
1
+ "use client";
2
+ import { jsx as r, jsxs as x } from "react/jsx-runtime";
3
+ import { motion as L } from "motion/react";
4
+ import { useState as S, useEffect as y } from "react";
5
+ import { cn as M } from "../../utils/utils.js";
6
+ const $ = ({ id: o, x: t, y: i, color: s, delay: l, scale: c }) => /* @__PURE__ */ r(
7
+ L.svg,
8
+ {
9
+ className: "pointer-events-none absolute z-20",
10
+ initial: { opacity: 0, left: t, top: i },
11
+ animate: {
12
+ opacity: [0, 1, 0],
13
+ scale: [0, c, 0],
14
+ rotate: [75, 120, 150]
15
+ },
16
+ transition: { duration: 0.8, repeat: 1 / 0, delay: l },
17
+ width: "21",
18
+ height: "21",
19
+ viewBox: "0 0 21 21",
20
+ children: /* @__PURE__ */ r(
21
+ "path",
22
+ {
23
+ d: "M9.82531 0.843845C10.0553 0.215178 10.9446 0.215178 11.1746 0.843845L11.8618 2.72026C12.4006 4.19229 12.3916 6.39157 13.5 7.5C14.6084 8.60843 16.8077 8.59935 18.2797 9.13822L20.1561 9.82534C20.7858 10.0553 20.7858 10.9447 20.1561 11.1747L18.2797 11.8618C16.8077 12.4007 14.6084 12.3916 13.5 13.5C12.3916 14.6084 12.4006 16.8077 11.8618 18.2798L11.1746 20.1562C10.9446 20.7858 10.0553 20.7858 9.82531 20.1562L9.13819 18.2798C8.59932 16.8077 8.60843 14.6084 7.5 13.5C6.39157 12.3916 4.19225 12.4007 2.72023 11.8618L0.843814 11.1747C0.215148 10.9447 0.215148 10.0553 0.843814 9.82534L2.72023 9.13822C4.19225 8.59935 6.39157 8.60843 7.5 7.5C8.60843 6.39157 8.59932 4.19229 9.13819 2.72026L9.82531 0.843845Z",
24
+ fill: s
25
+ }
26
+ )
27
+ },
28
+ o
29
+ ), E = ({
30
+ children: o,
31
+ colors: t = { first: "#9E7AFF", second: "#FE8BBB" },
32
+ className: i,
33
+ sparklesCount: s = 10,
34
+ ...l
35
+ }) => {
36
+ const [c, d] = S([]);
37
+ return y(() => {
38
+ const a = () => {
39
+ const e = `${Math.random() * 100}%`, n = `${Math.random() * 100}%`, h = Math.random() > 0.5 ? t.first : t.second, u = Math.random() * 2, C = Math.random() * 1 + 0.3, v = Math.random() * 10 + 5;
40
+ return { id: `${e}-${n}-${Date.now()}`, x: e, y: n, color: h, delay: u, scale: C, lifespan: v };
41
+ }, p = () => {
42
+ const e = Array.from({ length: s }, a);
43
+ d(e);
44
+ }, m = () => {
45
+ d(
46
+ (e) => e.map((n) => n.lifespan <= 0 ? a() : { ...n, lifespan: n.lifespan - 0.1 })
47
+ );
48
+ };
49
+ p();
50
+ const f = setInterval(m, 100);
51
+ return () => clearInterval(f);
52
+ }, [t.first, t.second, s]), /* @__PURE__ */ r(
53
+ "div",
54
+ {
55
+ className: M("text-6xl font-bold", i),
56
+ ...l,
57
+ style: {
58
+ "--sparkles-first-color": `${t.first}`,
59
+ "--sparkles-second-color": `${t.second}`
60
+ },
61
+ children: /* @__PURE__ */ x("span", { className: "relative inline-block", children: [
62
+ c.map((a) => /* @__PURE__ */ r($, { ...a }, a.id)),
63
+ /* @__PURE__ */ r("strong", { children: o })
64
+ ] })
65
+ }
66
+ );
67
+ };
68
+ export {
69
+ E as SparklesText
70
+ };
@@ -0,0 +1,2 @@
1
+ import { SparklesText } from './SparklesText.tsx';
2
+ export { SparklesText };
@@ -1,31 +1,31 @@
1
- import { jsx as u } from "react/jsx-runtime";
2
- import c from "../../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";
3
- import { useRef as x } from "react";
4
- const D = ({
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import h from "../../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";
3
+ import { useRef as c } from "react";
4
+ const M = ({
5
5
  height: o = "500px",
6
- width: r = "100%",
7
- language: d = "plaintext",
8
- defaultValue: n,
9
- value: s,
10
- theme: a = "light",
11
- readOnly: l = !1,
12
- onChange: t,
13
- onMount: i,
14
- className: f
6
+ width: t = "100%",
7
+ language: i = "plaintext",
8
+ defaultValue: a,
9
+ value: l,
10
+ theme: r = "light",
11
+ readOnly: e = !1,
12
+ onChange: d,
13
+ onMount: s,
14
+ className: u
15
15
  }) => {
16
- const p = x(null);
17
- return /* @__PURE__ */ u(
18
- c,
16
+ const f = c(null);
17
+ return /* @__PURE__ */ m(
18
+ h,
19
19
  {
20
- className: f,
20
+ className: u,
21
21
  height: o,
22
- width: r,
23
- defaultLanguage: d,
24
- defaultValue: n,
25
- value: s,
26
- theme: a,
27
- onMount: (e, m) => {
28
- p.current = e, i == null || i(e, m), e.updateOptions({
22
+ width: t,
23
+ defaultLanguage: i,
24
+ defaultValue: a,
25
+ value: l,
26
+ theme: r,
27
+ onMount: (n, p) => {
28
+ f.current = n, s?.(n, p), n.updateOptions({
29
29
  minimap: { enabled: !1 },
30
30
  // 禁用小地图
31
31
  lineNumbers: "on",
@@ -34,21 +34,21 @@ const D = ({
34
34
  // 方形选区
35
35
  scrollBeyondLastLine: !1,
36
36
  // 禁止滚动到最后一行之后
37
- readOnly: l,
37
+ readOnly: e,
38
38
  // 是否只读
39
39
  fontSize: 14
40
40
  // 字体大小
41
41
  });
42
42
  },
43
- onChange: (e) => {
44
- t == null || t(e || "");
43
+ onChange: (n) => {
44
+ d?.(n || "");
45
45
  },
46
46
  options: {
47
- readOnly: l
47
+ readOnly: e
48
48
  }
49
49
  }
50
50
  );
51
51
  };
52
52
  export {
53
- D as TxtEditor
53
+ M as TxtEditor
54
54
  };