UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
chore: fix build + update packages (#799)
Dillion Vermaa32f83279f74
diff --git a/apps/www/app/(blog)/blog/[slug]/page.tsx b/apps/www/app/(blog)/blog/[slug]/page.tsxindex dbad7d7b..3cd26868 100644--- a/apps/www/app/(blog)/blog/[slug]/page.tsx+++ b/apps/www/app/(blog)/blog/[slug]/page.tsx@@ -140,9 +140,10 @@ const components = {export async function generateMetadata({params,}: {- params: { slug: string[] };+ params: Promise<{ slug: string[] }>;}): Promise<Metadata> {- const postSlug = Array.isArray(params.slug) ? params.slug[0] : params.slug;+ const { slug } = await params;+ const postSlug = Array.isArray(slug) ? slug[0] : slug;const post = allBlogs.find((post) => post._meta.path === postSlug);if (!post) {@@ -175,8 +176,12 @@ export async function generateMetadata({};}-export default function BlogPage({ params }: { params: { slug: string[] } }) {- const { slug } = params;+export default async function BlogPage({+ params,+}: {+ params: Promise<{ slug: string[] }>;+}) {+ const { slug } = await params;const postSlug = Array.isArray(slug) ? slug[0] : slug;const currentIndex = allBlogs.findIndex(diff --git a/apps/www/app/(docs)/docs/[[...slug]]/page.tsx b/apps/www/app/(docs)/docs/[[...slug]]/page.tsxindex 0e578b5c..1ed029c6 100644--- a/apps/www/app/(docs)/docs/[[...slug]]/page.tsx+++ b/apps/www/app/(docs)/docs/[[...slug]]/page.tsx@@ -18,13 +18,14 @@ import { IconArrowLeft, IconArrowRight } from "@tabler/icons-react";import { Button } from "@/components/ui/button";interface DocPageProps {- params: {+ params: Promise<{slug: string[];- };+ }>;}async function getDocFromParams({ params }: DocPageProps) {- const slug = params.slug?.join("/") || "index";+ const { slug: slugArray } = await params;+ const slug = slugArray?.join("/") || "index";const doc = allDocs.find((doc) => doc.slugAsParams === slug);if (!doc) {@@ -69,9 +70,7 @@ export async function generateMetadata({};}-export async function generateStaticParams(): Promise<- DocPageProps["params"][]-> {+export async function generateStaticParams(): Promise<{ slug: string[] }[]> {return allDocs.map((doc) => ({slug: doc.slugAsParams.split("/"),}));diff --git a/apps/www/app/(marketing)/[...slug]/page.tsx b/apps/www/app/(marketing)/[...slug]/page.tsxindex 50d1bf9b..8189eba8 100644--- a/apps/www/app/(marketing)/[...slug]/page.tsx+++ b/apps/www/app/(marketing)/[...slug]/page.tsx@@ -7,17 +7,18 @@ import { Metadata } from "next";import { notFound } from "next/navigation";interface PageProps {- params: {+ params: Promise<{slug: string[];- };+ }>;}async function getPageFromParams(params: PageProps["params"]) {- const slug = params?.slug?.join("/");- const page = allPages.find((page) => page.slugAsParams === slug);+ const { slug } = await params;+ const slugString = slug?.join("/");+ const page = allPages.find((page) => page.slugAsParams === slugString);if (!page) {- null;+ return null;}return page;@@ -64,7 +65,7 @@ export async function generateMetadata({};}-export async function generateStaticParams(): Promise<PageProps["params"][]> {+export function generateStaticParams(): { slug: string[] }[] {return allPages.map((page) => ({slug: page.slugAsParams.split("/"),}));diff --git a/apps/www/app/(marketing)/showcase/[...slug]/page.tsx b/apps/www/app/(marketing)/showcase/[...slug]/page.tsxindex 942a6100..fd54b9e6 100644--- a/apps/www/app/(marketing)/showcase/[...slug]/page.tsx+++ b/apps/www/app/(marketing)/showcase/[...slug]/page.tsx@@ -8,23 +8,24 @@ import { absoluteUrl } from "@/lib/utils";import process from "process";interface PageProps {- params: {+ params: Promise<{slug: string[];- };+ }>;}-export async function generateStaticParams(): Promise<PageProps["params"][]> {+export function generateStaticParams(): { slug: string[] }[] {return allShowcases.map((page) => ({slug: page.slugAsParams.split("/"),}));}async function getPageFromParams(params: PageProps["params"]) {- const slug = params?.slug?.join("/");- const page = allShowcases.find((page) => page.slugAsParams === slug);+ const { slug } = await params;+ const slugString = slug?.join("/");+ const page = allShowcases.find((page) => page.slugAsParams === slugString);if (!page) {- null;+ return null;}return page;diff --git a/apps/www/app/sitemap.ts b/apps/www/app/sitemap.tsindex e9cfad4c..8c241d0b 100644--- a/apps/www/app/sitemap.ts+++ b/apps/www/app/sitemap.ts@@ -2,8 +2,8 @@ import { allBlogs, allDocs, allPages } from "content-collections";import type { MetadataRoute } from "next";import { headers } from "next/headers";-export default function sitemap(): MetadataRoute.Sitemap {- const headersList = headers();+export default async function sitemap(): Promise<MetadataRoute.Sitemap> {+ const headersList = await headers();const domain = headersList.get("host") as string;const protocol = "https";diff --git a/apps/www/components/contribute.tsx b/apps/www/components/contribute.tsxindex d6578530..79d3a205 100644--- a/apps/www/components/contribute.tsx+++ b/apps/www/components/contribute.tsx@@ -14,7 +14,7 @@ export function Contribute({ doc }: { doc: Doc }) {repo: "magicui",title: `[bug]: ${doc.slug}`,labels: ["bug", "documentation"],- template: "bug_report.md",+ template: "bug_report.yml",}),},{@@ -25,13 +25,17 @@ export function Contribute({ doc }: { doc: Doc }) {repo: "magicui",title: `[feat]: ${doc.slug}`,labels: ["enhancement"],- template: "feature_request.md",+ template: "feature_request.yml",}),},{text: "Edit this page",icon: PencilIcon,- href: getGithubFileUrl(doc.slug),+ href: getGithubFileUrl({+ owner: "magicuidesign",+ repo: "magicui",+ slug: doc.slug,+ }),},];diff --git a/apps/www/components/posthog-provider.tsx b/apps/www/components/posthog-provider.tsxindex 8a91dc74..4e5f97bc 100644--- a/apps/www/components/posthog-provider.tsx+++ b/apps/www/components/posthog-provider.tsx@@ -19,7 +19,7 @@ if (typeof window !== "undefined") {});}-export function PostHogPageview(): JSX.Element {+export function PostHogPageview(): React.ReactNode {const pathname = usePathname();const searchParams = useSearchParams();diff --git a/apps/www/components/tech-stack.tsx b/apps/www/components/tech-stack.tsxindex 948b1592..cdfa68e9 100644--- a/apps/www/components/tech-stack.tsx+++ b/apps/www/components/tech-stack.tsx@@ -7,7 +7,7 @@ import { cn } from "@/lib/utils";type TechComponentType = {name: string;- icon: JSX.Element;+ icon: React.ReactNode;};type TechComponents = Record<string, TechComponentType>;diff --git a/apps/www/content/docs/components/smooth-cursor.mdx b/apps/www/content/docs/components/smooth-cursor.mdxindex c654a543..f1161595 100644--- a/apps/www/content/docs/components/smooth-cursor.mdx+++ b/apps/www/content/docs/components/smooth-cursor.mdx@@ -102,10 +102,10 @@ select {## Props-| Prop | Type | Default | Description |-| -------------- | -------------- | ---------------------- | ------------------------------------------------------ |-| `cursor` | `JSX.Element` | `<DefaultCursorSVG />` | Custom cursor component to replace the default cursor |-| `springConfig` | `SpringConfig` | See below | Configuration object for the spring animation behavior |+| Prop | Type | Default | Description |+| -------------- | ----------------- | ---------------------- | ------------------------------------------------------ |+| `cursor` | `React.ReactNode` | `<DefaultCursorSVG />` | Custom cursor component to replace the default cursor |+| `springConfig` | `SpringConfig` | See below | Configuration object for the spring animation behavior |### SpringConfig Typediff --git a/apps/www/content/docs/components/spinning-text.mdx b/apps/www/content/docs/components/spinning-text.mdxindex c41c17f6..4a7bfa68 100644--- a/apps/www/content/docs/components/spinning-text.mdx+++ b/apps/www/content/docs/components/spinning-text.mdx@@ -66,7 +66,6 @@ import { SpinningText } from "@/components/magicui/spinning-text";| `duration` | `number` | `10` | The duration of the full circular rotation animation. || `className` | `string` | | A custom class name for the text container. || `reverse` | `boolean` | `false` | Determines if the animation should rotate in reverse. |-| `fontSize` | `number` | `1` | The font size of the text being animated in rem. || `radius` | `number` | `5` | The radius of the circular path for the text animation. || `transition` | `Transition` | | Custom transition effects for the animation. || `variants` | `{ container?: Variants; item?: Variants; }` | | Variants for container and item animations. |diff --git a/apps/www/lib/github.ts b/apps/www/lib/github.tsindex 1de5d6c2..f781c4a5 100644--- a/apps/www/lib/github.ts+++ b/apps/www/lib/github.ts@@ -42,8 +42,15 @@ export function getGitHubIssueUrl(params: GitHubIssueUrlParams): string {return `${baseUrl}?${urlParams.toString()}`;}-export function getGithubFileUrl(slug: string) {- return `https://github.com/magicuidesign/magicui/blob/main/content${+interface GithubFileUrlParams {+ owner: string;+ repo: string;+ slug: string;+}++export function getGithubFileUrl(params: GithubFileUrlParams) {+ const { owner, repo, slug } = params;+ return `https://github.com/${owner}/${repo}/blob/main/content${slug === "/docs" ? "/docs/index" : slug}.mdx`;}diff --git a/apps/www/lib/toc.ts b/apps/www/lib/toc.tsindex 48927c93..bf540207 100644--- a/apps/www/lib/toc.ts+++ b/apps/www/lib/toc.ts@@ -72,5 +72,5 @@ export async function getTableOfContents(): Promise<TableOfContents> {const result = await remark().use(getToc).process(content);- return result.data;+ return result.data as TableOfContents;}diff --git a/apps/www/next.config.mjs b/apps/www/next.config.mjsindex 2acc7285..a5f2551a 100644--- a/apps/www/next.config.mjs+++ b/apps/www/next.config.mjs@@ -4,7 +4,6 @@ import { withContentCollections } from "@content-collections/next";const nextConfig = {output: process.env.NODE_ENV === "production" ? "standalone" : undefined,reactStrictMode: true,- swcMinify: true,experimental: {optimizeCss: true,},@@ -46,7 +45,7 @@ const nextConfig = {source: "/docs/:path*.md",destination: "/llm/:path*",},- ]+ ];},};diff --git a/apps/www/public/llms-full.txt b/apps/www/public/llms-full.txtindex 58ba6bbc..538c2035 100644--- a/apps/www/public/llms-full.txt+++ b/apps/www/public/llms-full.txt@@ -2528,7 +2528,7 @@ Description: A list that animates each item in sequence with a delay. Used to sh"use client";import { cn } from "@/lib/utils";-import { AnimatePresence, motion } from "motion/react";+import { AnimatePresence, motion, MotionProps } from "motion/react";import React, {ComponentPropsWithoutRef,useEffect,@@ -2537,7 +2537,7 @@ import React, {} from "react";export function AnimatedListItem({ children }: { children: React.ReactNode }) {- const animations = {+ const animations: MotionProps = {initial: { scale: 0, opacity: 0 },animate: { scale: 1, opacity: 1, originY: 0 },exit: { scale: 0, opacity: 0 },@@ -4814,8 +4814,8 @@ Description: Sliding box animation that reveals text behind it.import { motion, useAnimation, useInView } from "motion/react";import { useEffect, useRef } from "react";-interface BoxRevealProps {- children: JSX.Element;+export interface BoxRevealProps {+ children: React.ReactNode;width?: "fit-content" | "100%";boxColor?: string;duration?: number;@@ -6034,7 +6034,7 @@ export const CoolMode: React.FC<CoolModeProps> = ({ children, options }) => {}}, [options]);- return React.cloneElement(children as React.ReactElement, { ref });+ return React.cloneElement(children as React.ReactElement);};@@ -9046,7 +9046,7 @@ export function IconCloud({ icons, images }: IconCloudProps) {startTime: number;duration: number;} | null>(null);- const animationFrameRef = useRef<number>();+ const animationFrameRef = useRef<number>(0);const rotationRef = useRef(rotation);const iconCanvasesRef = useRef<HTMLCanvasElement[]>([]);const imagesLoadedRef = useRef<boolean[]>([]);@@ -10230,6 +10230,8 @@ Title: Line Shadow TextDescription: A text component with a moving line shadow.--- file: registry/magicui/line-shadow-text.tsx ---+"use client";+import { cn } from "@/lib/utils";import { motion, MotionProps } from "motion/react";@@ -12367,7 +12369,7 @@ export function Pointer({style,children,...props-}: PointerProps): JSX.Element {+}: PointerProps): React.ReactNode {const x = useMotionValue(0);const y = useMotionValue(0);const [isActive, setIsActive] = useState<boolean>(false);@@ -14490,10 +14492,10 @@ Description: A shiny button component with dynamic styles in the dark mode or li"use client";import { cn } from "@/lib/utils";-import { motion, MotionProps, type AnimationProps } from "motion/react";+import { motion, type MotionProps } from "motion/react";import React from "react";-const animationProps = {+const animationProps: MotionProps = {initial: { "--x": "100%", scale: 0.8 },animate: { "--x": "-100%", scale: 1 },whileTap: { scale: 0.95 },@@ -14512,7 +14514,7 @@ const animationProps = {mass: 0.5,},},-} as AnimationProps;+};interface ShinyButtonPropsextends Omit<React.HTMLAttributes<HTMLElement>, keyof MotionProps>,@@ -14581,7 +14583,7 @@ Description: A customizable, physics-based smooth cursor animation component wit"use client";import { motion, useSpring } from "motion/react";-import { FC, JSX, useEffect, useRef, useState } from "react";+import { FC, useEffect, useRef, useState } from "react";interface Position {x: number;@@ -14589,7 +14591,7 @@ interface Position {}export interface SmoothCursorProps {- cursor?: JSX.Element;+ cursor?: React.ReactNode;springConfig?: {damping: number;stiffness: number;@@ -14981,6 +14983,7 @@ Description: The Spinning Text component animates text in a circular motion with--- file: registry/magicui/spinning-text.tsx ---"use client";+import { cn } from "@/lib/utils";import { motion, Transition, Variants } from "motion/react";import React, { CSSProperties } from "react";@@ -15000,12 +15003,12 @@ type SpinningTextProps = {};};-const BASE_TRANSITION = {+const BASE_TRANSITION: Transition = {repeat: Infinity,ease: "linear",};-const BASE_ITEM_VARIANTS = {+const BASE_ITEM_VARIANTS: Variants = {hidden: {opacity: 1,},@@ -15039,7 +15042,7 @@ export function SpinningText({const letters = children.split("");letters.push(" ");- const finalTransition = {+ const finalTransition: Transition = {...BASE_TRANSITION,...transition,duration: (transition as { duration?: number })?.duration ?? duration,diff --git a/apps/www/public/r/animated-list.json b/apps/www/public/r/animated-list.jsonindex abc1e74f..dd990f57 100644--- a/apps/www/public/r/animated-list.json+++ b/apps/www/public/r/animated-list.json@@ -10,7 +10,7 @@"files": [{"path": "registry/magicui/animated-list.tsx",- "content": "\"use client\";\n\nimport { cn } from \"@/lib/utils\";\nimport { AnimatePresence, motion } from \"motion/react\";\nimport React, {\n ComponentPropsWithoutRef,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\n\nexport function AnimatedListItem({ children }: { children: React.ReactNode }) {\n const animations = {\n initial: { scale: 0, opacity: 0 },\n animate: { scale: 1, opacity: 1, originY: 0 },\n exit: { scale: 0, opacity: 0 },\n transition: { type: \"spring\", stiffness: 350, damping: 40 },\n };\n\n return (\n <motion.div {...animations} layout className=\"mx-auto w-full\">\n {children}\n </motion.div>\n );\n}\n\nexport interface AnimatedListProps extends ComponentPropsWithoutRef<\"div\"> {\n children: React.ReactNode;\n delay?: number;\n}\n\nexport const AnimatedList = React.memo(\n ({ children, className, delay = 1000, ...props }: AnimatedListProps) => {\n const [index, setIndex] = useState(0);\n const childrenArray = useMemo(\n () => React.Children.toArray(children),\n [children],\n );\n\n useEffect(() => {\n if (index < childrenArray.length - 1) {\n const timeout = setTimeout(() => {\n setIndex((prevIndex) => (prevIndex + 1) % childrenArray.length);\n }, delay);\n\n return () => clearTimeout(timeout);\n }\n }, [index, delay, childrenArray.length]);\n\n const itemsToShow = useMemo(() => {\n const result = childrenArray.slice(0, index + 1).reverse();\n return result;\n }, [index, childrenArray]);\n\n return (\n <div\n className={cn(`flex flex-col items-center gap-4`, className)}\n {...props}\n >\n <AnimatePresence>\n {itemsToShow.map((item) => (\n <AnimatedListItem key={(item as React.ReactElement).key}>\n {item}\n </AnimatedListItem>\n ))}\n </AnimatePresence>\n </div>\n );\n },\n);\n\nAnimatedList.displayName = \"AnimatedList\";\n",+ "content": "\"use client\";\n\nimport { cn } from \"@/lib/utils\";\nimport { AnimatePresence, motion, MotionProps } from \"motion/react\";\nimport React, {\n ComponentPropsWithoutRef,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\n\nexport function AnimatedListItem({ children }: { children: React.ReactNode }) {\n const animations: MotionProps = {\n initial: { scale: 0, opacity: 0 },\n animate: { scale: 1, opacity: 1, originY: 0 },\n exit: { scale: 0, opacity: 0 },\n transition: { type: \"spring\", stiffness: 350, damping: 40 },\n };\n\n return (\n <motion.div {...animations} layout className=\"mx-auto w-full\">\n {children}\n </motion.div>\n );\n}\n\nexport interface AnimatedListProps extends ComponentPropsWithoutRef<\"div\"> {\n children: React.ReactNode;\n delay?: number;\n}\n\nexport const AnimatedList = React.memo(\n ({ children, className, delay = 1000, ...props }: AnimatedListProps) => {\n const [index, setIndex] = useState(0);\n const childrenArray = useMemo(\n () => React.Children.toArray(children),\n [children],\n );\n\n useEffect(() => {\n if (index < childrenArray.length - 1) {\n const timeout = setTimeout(() => {\n setIndex((prevIndex) => (prevIndex + 1) % childrenArray.length);\n }, delay);\n\n return () => clearTimeout(timeout);\n }\n }, [index, delay, childrenArray.length]);\n\n const itemsToShow = useMemo(() => {\n const result = childrenArray.slice(0, index + 1).reverse();\n return result;\n }, [index, childrenArray]);\n\n return (\n <div\n className={cn(`flex flex-col items-center gap-4`, className)}\n {...props}\n >\n <AnimatePresence>\n {itemsToShow.map((item) => (\n <AnimatedListItem key={(item as React.ReactElement).key}>\n {item}\n </AnimatedListItem>\n ))}\n </AnimatePresence>\n </div>\n );\n },\n);\n\nAnimatedList.displayName = \"AnimatedList\";\n","type": "registry:ui"}]diff --git a/apps/www/public/r/box-reveal.json b/apps/www/public/r/box-reveal.jsonindex 9b59e4fd..145669dc 100644--- a/apps/www/public/r/box-reveal.json+++ b/apps/www/public/r/box-reveal.json@@ -10,7 +10,7 @@"files": [{"path": "registry/magicui/box-reveal.tsx",- "content": "\"use client\";\n\nimport { motion, useAnimation, useInView } from \"motion/react\";\nimport { useEffect, useRef } from \"react\";\n\ninterface BoxRevealProps {\n children: JSX.Element;\n width?: \"fit-content\" | \"100%\";\n boxColor?: string;\n duration?: number;\n}\n\nexport const BoxReveal = ({\n children,\n width = \"fit-content\",\n boxColor = \"#5046e6\",\n duration,\n}: BoxRevealProps) => {\n const mainControls = useAnimation();\n const slideControls = useAnimation();\n\n const ref = useRef(null);\n const isInView = useInView(ref, { once: true });\n\n useEffect(() => {\n if (isInView) {\n slideControls.start(\"visible\");\n mainControls.start(\"visible\");\n } else {\n slideControls.start(\"hidden\");\n mainControls.start(\"hidden\");\n }\n }, [isInView, mainControls, slideControls]);\n\n return (\n <div ref={ref} style={{ position: \"relative\", width, overflow: \"hidden\" }}>\n <motion.div\n variants={{\n hidden: { opacity: 0, y: 75 },\n visible: { opacity: 1, y: 0 },\n }}\n initial=\"hidden\"\n animate={mainControls}\n transition={{ duration: duration ? duration : 0.5, delay: 0.25 }}\n >\n {children}\n </motion.div>\n\n <motion.div\n variants={{\n hidden: { left: 0 },\n visible: { left: \"100%\" },\n }}\n initial=\"hidden\"\n animate={slideControls}\n transition={{ duration: duration ? duration : 0.5, ease: \"easeIn\" }}\n style={{\n position: \"absolute\",\n top: 4,\n bottom: 4,\n left: 0,\n right: 0,\n zIndex: 20,\n background: boxColor,\n }}\n />\n </div>\n );\n};\n",+ "content": "\"use client\";\n\nimport { motion, useAnimation, useInView } from \"motion/react\";\nimport { useEffect, useRef } from \"react\";\n\nexport interface BoxRevealProps {\n children: React.ReactNode;\n width?: \"fit-content\" | \"100%\";\n boxColor?: string;\n duration?: number;\n}\n\nexport const BoxReveal = ({\n children,\n width = \"fit-content\",\n boxColor = \"#5046e6\",\n duration,\n}: BoxRevealProps) => {\n const mainControls = useAnimation();\n const slideControls = useAnimation();\n\n const ref = useRef(null);\n const isInView = useInView(ref, { once: true });\n\n useEffect(() => {\n if (isInView) {\n slideControls.start(\"visible\");\n mainControls.start(\"visible\");\n } else {\n slideControls.start(\"hidden\");\n mainControls.start(\"hidden\");\n }\n }, [isInView, mainControls, slideControls]);\n\n return (\n <div ref={ref} style={{ position: \"relative\", width, overflow: \"hidden\" }}>\n <motion.div\n variants={{\n hidden: { opacity: 0, y: 75 },\n visible: { opacity: 1, y: 0 },\n }}\n initial=\"hidden\"\n animate={mainControls}\n transition={{ duration: duration ? duration : 0.5, delay: 0.25 }}\n >\n {children}\n </motion.div>\n\n <motion.div\n variants={{\n hidden: { left: 0 },\n visible: { left: \"100%\" },\n }}\n initial=\"hidden\"\n animate={slideControls}\n transition={{ duration: duration ? duration : 0.5, ease: \"easeIn\" }}\n style={{\n position: \"absolute\",\n top: 4,\n bottom: 4,\n left: 0,\n right: 0,\n zIndex: 20,\n background: boxColor,\n }}\n />\n </div>\n );\n};\n","type": "registry:ui"}]diff --git a/apps/www/public/r/cool-mode.json b/apps/www/public/r/cool-mode.jsonindex 0a01645b..e821adcf 100644--- a/apps/www/public/r/cool-mode.json+++ b/apps/www/public/r/cool-mode.json@@ -7,7 +7,7 @@"files": [{"path": "registry/magicui/cool-mode.tsx",- "content": "\"use client\";\n\nimport React, { ReactNode, useEffect, useRef } from \"react\";\n\nexport interface BaseParticle {\n element: HTMLElement | SVGSVGElement;\n left: number;\n size: number;\n top: number;\n}\n\nexport interface BaseParticleOptions {\n particle?: string;\n size?: number;\n}\n\nexport interface CoolParticle extends BaseParticle {\n direction: number;\n speedHorz: number;\n speedUp: number;\n spinSpeed: number;\n spinVal: number;\n}\n\nexport interface CoolParticleOptions extends BaseParticleOptions {\n particleCount?: number;\n speedHorz?: number;\n speedUp?: number;\n}\n\nconst getContainer = () => {\n const id = \"_coolMode_effect\";\n let existingContainer = document.getElementById(id);\n\n if (existingContainer) {\n return existingContainer;\n }\n\n const container = document.createElement(\"div\");\n container.setAttribute(\"id\", id);\n container.setAttribute(\n \"style\",\n \"overflow:hidden; position:fixed; height:100%; top:0; left:0; right:0; bottom:0; pointer-events:none; z-index:2147483647\",\n );\n\n document.body.appendChild(container);\n\n return container;\n};\n\nlet instanceCounter = 0;\n\nconst applyParticleEffect = (\n element: HTMLElement,\n options?: CoolParticleOptions,\n): (() => void) => {\n instanceCounter++;\n\n const defaultParticle = \"circle\";\n const particleType = options?.particle || defaultParticle;\n const sizes = [15, 20, 25, 35, 45];\n const limit = 45;\n\n let particles: CoolParticle[] = [];\n let autoAddParticle = false;\n let mouseX = 0;\n let mouseY = 0;\n\n const container = getContainer();\n\n function generateParticle() {\n const size =\n options?.size || sizes[Math.floor(Math.random() * sizes.length)];\n const speedHorz = options?.speedHorz || Math.random() * 10;\n const speedUp = options?.speedUp || Math.random() * 25;\n const spinVal = Math.random() * 360;\n const spinSpeed = Math.random() * 35 * (Math.random() <= 0.5 ? -1 : 1);\n const top = mouseY - size / 2;\n const left = mouseX - size / 2;\n const direction = Math.random() <= 0.5 ? -1 : 1;\n\n const particle = document.createElement(\"div\");\n\n if (particleType === \"circle\") {\n const svgNS = \"http://www.w3.org/2000/svg\";\n const circleSVG = document.createElementNS(svgNS, \"svg\");\n const circle = document.createElementNS(svgNS, \"circle\");\n circle.setAttributeNS(null, \"cx\", (size / 2).toString());\n circle.setAttributeNS(null, \"cy\", (size / 2).toString());\n circle.setAttributeNS(null, \"r\", (size / 2).toString());\n circle.setAttributeNS(\n null,\n \"fill\",\n `hsl(${Math.random() * 360}, 70%, 50%)`,\n );\n\n circleSVG.appendChild(circle);\n circleSVG.setAttribute(\"width\", size.toString());\n circleSVG.setAttribute(\"height\", size.toString());\n\n particle.appendChild(circleSVG);\n } else if (\n particleType.startsWith(\"http\") ||\n particleType.startsWith(\"/\")\n ) {\n // Handle URL-based images\n particle.innerHTML = `<img src=\"${particleType}\" width=\"${size}\" height=\"${size}\" style=\"border-radius: 50%\">`;\n } else {\n // Handle emoji or text characters\n const fontSizeMultiplier = 3; // Make emojis 3x bigger\n const emojiSize = size * fontSizeMultiplier;\n particle.innerHTML = `<div style=\"font-size: ${emojiSize}px; line-height: 1; text-align: center; width: ${size}px; height: ${size}px; display: flex; align-items: center; justify-content: center; transform: scale(${fontSizeMultiplier}); transform-origin: center;\">${particleType}</div>`;\n }\n\n particle.style.position = \"absolute\";\n particle.style.transform = `translate3d(${left}px, ${top}px, 0px) rotate(${spinVal}deg)`;\n\n container.appendChild(particle);\n\n particles.push({\n direction,\n element: particle,\n left,\n size,\n speedHorz,\n speedUp,\n spinSpeed,\n spinVal,\n top,\n });\n }\n\n function refreshParticles() {\n particles.forEach((p) => {\n p.left = p.left - p.speedHorz * p.direction;\n p.top = p.top - p.speedUp;\n p.speedUp = Math.min(p.size, p.speedUp - 1);\n p.spinVal = p.spinVal + p.spinSpeed;\n\n if (\n p.top >=\n Math.max(window.innerHeight, document.body.clientHeight) + p.size\n ) {\n particles = particles.filter((o) => o !== p);\n p.element.remove();\n }\n\n p.element.setAttribute(\n \"style\",\n [\n \"position:absolute\",\n \"will-change:transform\",\n `top:${p.top}px`,\n `left:${p.left}px`,\n `transform:rotate(${p.spinVal}deg)`,\n ].join(\";\"),\n );\n });\n }\n\n let animationFrame: number | undefined;\n\n let lastParticleTimestamp = 0;\n const particleGenerationDelay = 30;\n\n function loop() {\n const currentTime = performance.now();\n if (\n autoAddParticle &&\n particles.length < limit &&\n currentTime - lastParticleTimestamp > particleGenerationDelay\n ) {\n generateParticle();\n lastParticleTimestamp = currentTime;\n }\n\n refreshParticles();\n animationFrame = requestAnimationFrame(loop);\n }\n\n loop();\n\n const isTouchInteraction = \"ontouchstart\" in window;\n\n const tap = isTouchInteraction ? \"touchstart\" : \"mousedown\";\n const tapEnd = isTouchInteraction ? \"touchend\" : \"mouseup\";\n const move = isTouchInteraction ? \"touchmove\" : \"mousemove\";\n\n const updateMousePosition = (e: MouseEvent | TouchEvent) => {\n if (\"touches\" in e) {\n mouseX = e.touches?.[0].clientX;\n mouseY = e.touches?.[0].clientY;\n } else {\n mouseX = e.clientX;\n mouseY = e.clientY;\n }\n };\n\n const tapHandler = (e: MouseEvent | TouchEvent) => {\n updateMousePosition(e);\n autoAddParticle = true;\n };\n\n const disableAutoAddParticle = () => {\n autoAddParticle = false;\n };\n\n element.addEventListener(move, updateMousePosition, { passive: true });\n element.addEventListener(tap, tapHandler, { passive: true });\n element.addEventListener(tapEnd, disableAutoAddParticle, { passive: true });\n element.addEventListener(\"mouseleave\", disableAutoAddParticle, {\n passive: true,\n });\n\n return () => {\n element.removeEventListener(move, updateMousePosition);\n element.removeEventListener(tap, tapHandler);\n element.removeEventListener(tapEnd, disableAutoAddParticle);\n element.removeEventListener(\"mouseleave\", disableAutoAddParticle);\n\n const interval = setInterval(() => {\n if (animationFrame && particles.length === 0) {\n cancelAnimationFrame(animationFrame);\n clearInterval(interval);\n\n if (--instanceCounter === 0) {\n container.remove();\n }\n }\n }, 500);\n };\n};\n\ninterface CoolModeProps {\n children: ReactNode;\n options?: CoolParticleOptions;\n}\n\nexport const CoolMode: React.FC<CoolModeProps> = ({ children, options }) => {\n const ref = useRef<HTMLElement>(null);\n\n useEffect(() => {\n if (ref.current) {\n return applyParticleEffect(ref.current, options);\n }\n }, [options]);\n\n return React.cloneElement(children as React.ReactElement, { ref });\n};\n",+ "content": "\"use client\";\n\nimport React, { ReactNode, useEffect, useRef } from \"react\";\n\nexport interface BaseParticle {\n element: HTMLElement | SVGSVGElement;\n left: number;\n size: number;\n top: number;\n}\n\nexport interface BaseParticleOptions {\n particle?: string;\n size?: number;\n}\n\nexport interface CoolParticle extends BaseParticle {\n direction: number;\n speedHorz: number;\n speedUp: number;\n spinSpeed: number;\n spinVal: number;\n}\n\nexport interface CoolParticleOptions extends BaseParticleOptions {\n particleCount?: number;\n speedHorz?: number;\n speedUp?: number;\n}\n\nconst getContainer = () => {\n const id = \"_coolMode_effect\";\n let existingContainer = document.getElementById(id);\n\n if (existingContainer) {\n return existingContainer;\n }\n\n const container = document.createElement(\"div\");\n container.setAttribute(\"id\", id);\n container.setAttribute(\n \"style\",\n \"overflow:hidden; position:fixed; height:100%; top:0; left:0; right:0; bottom:0; pointer-events:none; z-index:2147483647\",\n );\n\n document.body.appendChild(container);\n\n return container;\n};\n\nlet instanceCounter = 0;\n\nconst applyParticleEffect = (\n element: HTMLElement,\n options?: CoolParticleOptions,\n): (() => void) => {\n instanceCounter++;\n\n const defaultParticle = \"circle\";\n const particleType = options?.particle || defaultParticle;\n const sizes = [15, 20, 25, 35, 45];\n const limit = 45;\n\n let particles: CoolParticle[] = [];\n let autoAddParticle = false;\n let mouseX = 0;\n let mouseY = 0;\n\n const container = getContainer();\n\n function generateParticle() {\n const size =\n options?.size || sizes[Math.floor(Math.random() * sizes.length)];\n const speedHorz = options?.speedHorz || Math.random() * 10;\n const speedUp = options?.speedUp || Math.random() * 25;\n const spinVal = Math.random() * 360;\n const spinSpeed = Math.random() * 35 * (Math.random() <= 0.5 ? -1 : 1);\n const top = mouseY - size / 2;\n const left = mouseX - size / 2;\n const direction = Math.random() <= 0.5 ? -1 : 1;\n\n const particle = document.createElement(\"div\");\n\n if (particleType === \"circle\") {\n const svgNS = \"http://www.w3.org/2000/svg\";\n const circleSVG = document.createElementNS(svgNS, \"svg\");\n const circle = document.createElementNS(svgNS, \"circle\");\n circle.setAttributeNS(null, \"cx\", (size / 2).toString());\n circle.setAttributeNS(null, \"cy\", (size / 2).toString());\n circle.setAttributeNS(null, \"r\", (size / 2).toString());\n circle.setAttributeNS(\n null,\n \"fill\",\n `hsl(${Math.random() * 360}, 70%, 50%)`,\n );\n\n circleSVG.appendChild(circle);\n circleSVG.setAttribute(\"width\", size.toString());\n circleSVG.setAttribute(\"height\", size.toString());\n\n particle.appendChild(circleSVG);\n } else if (\n particleType.startsWith(\"http\") ||\n particleType.startsWith(\"/\")\n ) {\n // Handle URL-based images\n particle.innerHTML = `<img src=\"${particleType}\" width=\"${size}\" height=\"${size}\" style=\"border-radius: 50%\">`;\n } else {\n // Handle emoji or text characters\n const fontSizeMultiplier = 3; // Make emojis 3x bigger\n const emojiSize = size * fontSizeMultiplier;\n particle.innerHTML = `<div style=\"font-size: ${emojiSize}px; line-height: 1; text-align: center; width: ${size}px; height: ${size}px; display: flex; align-items: center; justify-content: center; transform: scale(${fontSizeMultiplier}); transform-origin: center;\">${particleType}</div>`;\n }\n\n particle.style.position = \"absolute\";\n particle.style.transform = `translate3d(${left}px, ${top}px, 0px) rotate(${spinVal}deg)`;\n\n container.appendChild(particle);\n\n particles.push({\n direction,\n element: particle,\n left,\n size,\n speedHorz,\n speedUp,\n spinSpeed,\n spinVal,\n top,\n });\n }\n\n function refreshParticles() {\n particles.forEach((p) => {\n p.left = p.left - p.speedHorz * p.direction;\n p.top = p.top - p.speedUp;\n p.speedUp = Math.min(p.size, p.speedUp - 1);\n p.spinVal = p.spinVal + p.spinSpeed;\n\n if (\n p.top >=\n Math.max(window.innerHeight, document.body.clientHeight) + p.size\n ) {\n particles = particles.filter((o) => o !== p);\n p.element.remove();\n }\n\n p.element.setAttribute(\n \"style\",\n [\n \"position:absolute\",\n \"will-change:transform\",\n `top:${p.top}px`,\n `left:${p.left}px`,\n `transform:rotate(${p.spinVal}deg)`,\n ].join(\";\"),\n );\n });\n }\n\n let animationFrame: number | undefined;\n\n let lastParticleTimestamp = 0;\n const particleGenerationDelay = 30;\n\n function loop() {\n const currentTime = performance.now();\n if (\n autoAddParticle &&\n particles.length < limit &&\n currentTime - lastParticleTimestamp > particleGenerationDelay\n ) {\n generateParticle();\n lastParticleTimestamp = currentTime;\n }\n\n refreshParticles();\n animationFrame = requestAnimationFrame(loop);\n }\n\n loop();\n\n const isTouchInteraction = \"ontouchstart\" in window;\n\n const tap = isTouchInteraction ? \"touchstart\" : \"mousedown\";\n const tapEnd = isTouchInteraction ? \"touchend\" : \"mouseup\";\n const move = isTouchInteraction ? \"touchmove\" : \"mousemove\";\n\n const updateMousePosition = (e: MouseEvent | TouchEvent) => {\n if (\"touches\" in e) {\n mouseX = e.touches?.[0].clientX;\n mouseY = e.touches?.[0].clientY;\n } else {\n mouseX = e.clientX;\n mouseY = e.clientY;\n }\n };\n\n const tapHandler = (e: MouseEvent | TouchEvent) => {\n updateMousePosition(e);\n autoAddParticle = true;\n };\n\n const disableAutoAddParticle = () => {\n autoAddParticle = false;\n };\n\n element.addEventListener(move, updateMousePosition, { passive: true });\n element.addEventListener(tap, tapHandler, { passive: true });\n element.addEventListener(tapEnd, disableAutoAddParticle, { passive: true });\n element.addEventListener(\"mouseleave\", disableAutoAddParticle, {\n passive: true,\n });\n\n return () => {\n element.removeEventListener(move, updateMousePosition);\n element.removeEventListener(tap, tapHandler);\n element.removeEventListener(tapEnd, disableAutoAddParticle);\n element.removeEventListener(\"mouseleave\", disableAutoAddParticle);\n\n const interval = setInterval(() => {\n if (animationFrame && particles.length === 0) {\n cancelAnimationFrame(animationFrame);\n clearInterval(interval);\n\n if (--instanceCounter === 0) {\n container.remove();\n }\n }\n }, 500);\n };\n};\n\ninterface CoolModeProps {\n children: ReactNode;\n options?: CoolParticleOptions;\n}\n\nexport const CoolMode: React.FC<CoolModeProps> = ({ children, options }) => {\n const ref = useRef<HTMLElement>(null);\n\n useEffect(() => {\n if (ref.current) {\n return applyParticleEffect(ref.current, options);\n }\n }, [options]);\n\n return React.cloneElement(children as React.ReactElement);\n};\n","type": "registry:ui"}]diff --git a/apps/www/public/r/icon-cloud.json b/apps/www/public/r/icon-cloud.jsonindex dc19c62a..e43b0680 100644--- a/apps/www/public/r/icon-cloud.json+++ b/apps/www/public/r/icon-cloud.json@@ -8,7 +8,7 @@"files": [{"path": "registry/magicui/icon-cloud.tsx",- "content": "\"use client\";\n\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { renderToString } from \"react-dom/server\";\n\ninterface Icon {\n x: number;\n y: number;\n z: number;\n scale: number;\n opacity: number;\n id: number;\n}\n\ninterface IconCloudProps {\n icons?: React.ReactNode[];\n images?: string[];\n}\n\nfunction easeOutCubic(t: number): number {\n return 1 - Math.pow(1 - t, 3);\n}\n\nexport function IconCloud({ icons, images }: IconCloudProps) {\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const [iconPositions, setIconPositions] = useState<Icon[]>([]);\n const [rotation, setRotation] = useState({ x: 0, y: 0 });\n const [isDragging, setIsDragging] = useState(false);\n const [lastMousePos, setLastMousePos] = useState({ x: 0, y: 0 });\n const [mousePos, setMousePos] = useState({ x: 0, y: 0 });\n const [targetRotation, setTargetRotation] = useState<{\n x: number;\n y: number;\n startX: number;\n startY: number;\n distance: number;\n startTime: number;\n duration: number;\n } | null>(null);\n const animationFrameRef = useRef<number>();\n const rotationRef = useRef(rotation);\n const iconCanvasesRef = useRef<HTMLCanvasElement[]>([]);\n const imagesLoadedRef = useRef<boolean[]>([]);\n\n // Create icon canvases once when icons/images change\n useEffect(() => {\n if (!icons && !images) return;\n\n const items = icons || images || [];\n imagesLoadedRef.current = new Array(items.length).fill(false);\n\n const newIconCanvases = items.map((item, index) => {\n const offscreen = document.createElement(\"canvas\");\n offscreen.width = 40;\n offscreen.height = 40;\n const offCtx = offscreen.getContext(\"2d\");\n\n if (offCtx) {\n if (images) {\n // Handle image URLs directly\n const img = new Image();\n img.crossOrigin = \"anonymous\";\n img.src = items[index] as string;\n img.onload = () => {\n offCtx.clearRect(0, 0, offscreen.width, offscreen.height);\n\n // Create circular clipping path\n offCtx.beginPath();\n offCtx.arc(20, 20, 20, 0, Math.PI * 2);\n offCtx.closePath();\n offCtx.clip();\n\n // Draw the image\n offCtx.drawImage(img, 0, 0, 40, 40);\n\n imagesLoadedRef.current[index] = true;\n };\n } else {\n // Handle SVG icons\n offCtx.scale(0.4, 0.4);\n const svgString = renderToString(item as React.ReactElement);\n const img = new Image();\n img.src = \"data:image/svg+xml;base64,\" + btoa(svgString);\n img.onload = () => {\n offCtx.clearRect(0, 0, offscreen.width, offscreen.height);\n offCtx.drawImage(img, 0, 0);\n imagesLoadedRef.current[index] = true;\n };\n }\n }\n return offscreen;\n });\n\n iconCanvasesRef.current = newIconCanvases;\n }, [icons, images]);\n\n // Generate initial icon positions on a sphere\n useEffect(() => {\n const items = icons || images || [];\n const newIcons: Icon[] = [];\n const numIcons = items.length || 20;\n\n // Fibonacci sphere parameters\n const offset = 2 / numIcons;\n const increment = Math.PI * (3 - Math.sqrt(5));\n\n for (let i = 0; i < numIcons; i++) {\n const y = i * offset - 1 + offset / 2;\n const r = Math.sqrt(1 - y * y);\n const phi = i * increment;\n\n const x = Math.cos(phi) * r;\n const z = Math.sin(phi) * r;\n\n newIcons.push({\n x: x * 100,\n y: y * 100,\n z: z * 100,\n scale: 1,\n opacity: 1,\n id: i,\n });\n }\n setIconPositions(newIcons);\n }, [icons, images]);\n\n // Handle mouse events\n const handleMouseDown = (e: React.MouseEvent<HTMLCanvasElement>) => {\n const rect = canvasRef.current?.getBoundingClientRect();\n if (!rect || !canvasRef.current) return;\n\n const x = e.clientX - rect.left;\n const y = e.clientY - rect.top;\n\n const ctx = canvasRef.current.getContext(\"2d\");\n if (!ctx) return;\n\n iconPositions.forEach((icon) => {\n const cosX = Math.cos(rotationRef.current.x);\n const sinX = Math.sin(rotationRef.current.x);\n const cosY = Math.cos(rotationRef.current.y);\n const sinY = Math.sin(rotationRef.current.y);\n\n const rotatedX = icon.x * cosY - icon.z * sinY;\n const rotatedZ = icon.x * sinY + icon.z * cosY;\n const rotatedY = icon.y * cosX + rotatedZ * sinX;\n\n const screenX = canvasRef.current!.width / 2 + rotatedX;\n const screenY = canvasRef.current!.height / 2 + rotatedY;\n\n const scale = (rotatedZ + 200) / 300;\n const radius = 20 * scale;\n const dx = x - screenX;\n const dy = y - screenY;\n\n if (dx * dx + dy * dy < radius * radius) {\n const targetX = -Math.atan2(\n icon.y,\n Math.sqrt(icon.x * icon.x + icon.z * icon.z),\n );\n const targetY = Math.atan2(icon.x, icon.z);\n\n const currentX = rotationRef.current.x;\n const currentY = rotationRef.current.y;\n const distance = Math.sqrt(\n Math.pow(targetX - currentX, 2) + Math.pow(targetY - currentY, 2),\n );\n\n const duration = Math.min(2000, Math.max(800, distance * 1000));\n\n setTargetRotation({\n x: targetX,\n y: targetY,\n startX: currentX,\n startY: currentY,\n distance,\n startTime: performance.now(),\n duration,\n });\n return;\n }\n });\n\n setIsDragging(true);\n setLastMousePos({ x: e.clientX, y: e.clientY });\n };\n\n const handleMouseMove = (e: React.MouseEvent<HTMLCanvasElement>) => {\n const rect = canvasRef.current?.getBoundingClientRect();\n if (rect) {\n const x = e.clientX - rect.left;\n const y = e.clientY - rect.top;\n setMousePos({ x, y });\n }\n\n if (isDragging) {\n const deltaX = e.clientX - lastMousePos.x;\n const deltaY = e.clientY - lastMousePos.y;\n\n rotationRef.current = {\n x: rotationRef.current.x + deltaY * 0.002,\n y: rotationRef.current.y + deltaX * 0.002,\n };\n\n setLastMousePos({ x: e.clientX, y: e.clientY });\n }\n };\n\n const handleMouseUp = () => {\n setIsDragging(false);\n };\n\n // Animation and rendering\n useEffect(() => {\n const canvas = canvasRef.current;\n const ctx = canvas?.getContext(\"2d\");\n if (!canvas || !ctx) return;\n\n const animate = () => {\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n\n const centerX = canvas.width / 2;\n const centerY = canvas.height / 2;\n const maxDistance = Math.sqrt(centerX * centerX + centerY * centerY);\n const dx = mousePos.x - centerX;\n const dy = mousePos.y - centerY;\n const distance = Math.sqrt(dx * dx + dy * dy);\n const speed = 0.003 + (distance / maxDistance) * 0.01;\n\n if (targetRotation) {\n const elapsed = performance.now() - targetRotation.startTime;\n const progress = Math.min(1, elapsed / targetRotation.duration);\n const easedProgress = easeOutCubic(progress);\n\n rotationRef.current = {\n x:\n targetRotation.startX +\n (targetRotation.x - targetRotation.startX) * easedProgress,\n y:\n targetRotation.startY +\n (targetRotation.y - targetRotation.startY) * easedProgress,\n };\n\n if (progress >= 1) {\n setTargetRotation(null);\n }\n } else if (!isDragging) {\n rotationRef.current = {\n x: rotationRef.current.x + (dy / canvas.height) * speed,\n y: rotationRef.current.y + (dx / canvas.width) * speed,\n };\n }\n\n iconPositions.forEach((icon, index) => {\n const cosX = Math.cos(rotationRef.current.x);\n const sinX = Math.sin(rotationRef.current.x);\n const cosY = Math.cos(rotationRef.current.y);\n const sinY = Math.sin(rotationRef.current.y);\n\n const rotatedX = icon.x * cosY - icon.z * sinY;\n const rotatedZ = icon.x * sinY + icon.z * cosY;\n const rotatedY = icon.y * cosX + rotatedZ * sinX;\n\n const scale = (rotatedZ + 200) / 300;\n const opacity = Math.max(0.2, Math.min(1, (rotatedZ + 150) / 200));\n\n ctx.save();\n ctx.translate(\n canvas.width / 2 + rotatedX,\n canvas.height / 2 + rotatedY,\n );\n ctx.scale(scale, scale);\n ctx.globalAlpha = opacity;\n\n if (icons || images) {\n // Only try to render icons/images if they exist\n if (\n iconCanvasesRef.current[index] &&\n imagesLoadedRef.current[index]\n ) {\n ctx.drawImage(iconCanvasesRef.current[index], -20, -20, 40, 40);\n }\n } else {\n // Show numbered circles if no icons/images are provided\n ctx.beginPath();\n ctx.arc(0, 0, 20, 0, Math.PI * 2);\n ctx.fillStyle = \"#4444ff\";\n ctx.fill();\n ctx.fillStyle = \"white\";\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n ctx.font = \"16px Arial\";\n ctx.fillText(`${icon.id + 1}`, 0, 0);\n }\n\n ctx.restore();\n });\n animationFrameRef.current = requestAnimationFrame(animate);\n };\n\n animate();\n\n return () => {\n if (animationFrameRef.current) {\n cancelAnimationFrame(animationFrameRef.current);\n }\n };\n }, [icons, images, iconPositions, isDragging, mousePos, targetRotation]);\n\n return (\n <canvas\n ref={canvasRef}\n width={400}\n height={400}\n onMouseDown={handleMouseDown}\n onMouseMove={handleMouseMove}\n onMouseUp={handleMouseUp}\n onMouseLeave={handleMouseUp}\n className=\"rounded-lg\"\n aria-label=\"Interactive 3D Icon Cloud\"\n role=\"img\"\n />\n );\n}\n",+ "content": "\"use client\";\n\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { renderToString } from \"react-dom/server\";\n\ninterface Icon {\n x: number;\n y: number;\n z: number;\n scale: number;\n opacity: number;\n id: number;\n}\n\ninterface IconCloudProps {\n icons?: React.ReactNode[];\n images?: string[];\n}\n\nfunction easeOutCubic(t: number): number {\n return 1 - Math.pow(1 - t, 3);\n}\n\nexport function IconCloud({ icons, images }: IconCloudProps) {\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const [iconPositions, setIconPositions] = useState<Icon[]>([]);\n const [rotation, setRotation] = useState({ x: 0, y: 0 });\n const [isDragging, setIsDragging] = useState(false);\n const [lastMousePos, setLastMousePos] = useState({ x: 0, y: 0 });\n const [mousePos, setMousePos] = useState({ x: 0, y: 0 });\n const [targetRotation, setTargetRotation] = useState<{\n x: number;\n y: number;\n startX: number;\n startY: number;\n distance: number;\n startTime: number;\n duration: number;\n } | null>(null);\n const animationFrameRef = useRef<number>(0);\n const rotationRef = useRef(rotation);\n const iconCanvasesRef = useRef<HTMLCanvasElement[]>([]);\n const imagesLoadedRef = useRef<boolean[]>([]);\n\n // Create icon canvases once when icons/images change\n useEffect(() => {\n if (!icons && !images) return;\n\n const items = icons || images || [];\n imagesLoadedRef.current = new Array(items.length).fill(false);\n\n const newIconCanvases = items.map((item, index) => {\n const offscreen = document.createElement(\"canvas\");\n offscreen.width = 40;\n offscreen.height = 40;\n const offCtx = offscreen.getContext(\"2d\");\n\n if (offCtx) {\n if (images) {\n // Handle image URLs directly\n const img = new Image();\n img.crossOrigin = \"anonymous\";\n img.src = items[index] as string;\n img.onload = () => {\n offCtx.clearRect(0, 0, offscreen.width, offscreen.height);\n\n // Create circular clipping path\n offCtx.beginPath();\n offCtx.arc(20, 20, 20, 0, Math.PI * 2);\n offCtx.closePath();\n offCtx.clip();\n\n // Draw the image\n offCtx.drawImage(img, 0, 0, 40, 40);\n\n imagesLoadedRef.current[index] = true;\n };\n } else {\n // Handle SVG icons\n offCtx.scale(0.4, 0.4);\n const svgString = renderToString(item as React.ReactElement);\n const img = new Image();\n img.src = \"data:image/svg+xml;base64,\" + btoa(svgString);\n img.onload = () => {\n offCtx.clearRect(0, 0, offscreen.width, offscreen.height);\n offCtx.drawImage(img, 0, 0);\n imagesLoadedRef.current[index] = true;\n };\n }\n }\n return offscreen;\n });\n\n iconCanvasesRef.current = newIconCanvases;\n }, [icons, images]);\n\n // Generate initial icon positions on a sphere\n useEffect(() => {\n const items = icons || images || [];\n const newIcons: Icon[] = [];\n const numIcons = items.length || 20;\n\n // Fibonacci sphere parameters\n const offset = 2 / numIcons;\n const increment = Math.PI * (3 - Math.sqrt(5));\n\n for (let i = 0; i < numIcons; i++) {\n const y = i * offset - 1 + offset / 2;\n const r = Math.sqrt(1 - y * y);\n const phi = i * increment;\n\n const x = Math.cos(phi) * r;\n const z = Math.sin(phi) * r;\n\n newIcons.push({\n x: x * 100,\n y: y * 100,\n z: z * 100,\n scale: 1,\n opacity: 1,\n id: i,\n });\n }\n setIconPositions(newIcons);\n }, [icons, images]);\n\n // Handle mouse events\n const handleMouseDown = (e: React.MouseEvent<HTMLCanvasElement>) => {\n const rect = canvasRef.current?.getBoundingClientRect();\n if (!rect || !canvasRef.current) return;\n\n const x = e.clientX - rect.left;\n const y = e.clientY - rect.top;\n\n const ctx = canvasRef.current.getContext(\"2d\");\n if (!ctx) return;\n\n iconPositions.forEach((icon) => {\n const cosX = Math.cos(rotationRef.current.x);\n const sinX = Math.sin(rotationRef.current.x);\n const cosY = Math.cos(rotationRef.current.y);\n const sinY = Math.sin(rotationRef.current.y);\n\n const rotatedX = icon.x * cosY - icon.z * sinY;\n const rotatedZ = icon.x * sinY + icon.z * cosY;\n const rotatedY = icon.y * cosX + rotatedZ * sinX;\n\n const screenX = canvasRef.current!.width / 2 + rotatedX;\n const screenY = canvasRef.current!.height / 2 + rotatedY;\n\n const scale = (rotatedZ + 200) / 300;\n const radius = 20 * scale;\n const dx = x - screenX;\n const dy = y - screenY;\n\n if (dx * dx + dy * dy < radius * radius) {\n const targetX = -Math.atan2(\n icon.y,\n Math.sqrt(icon.x * icon.x + icon.z * icon.z),\n );\n const targetY = Math.atan2(icon.x, icon.z);\n\n const currentX = rotationRef.current.x;\n const currentY = rotationRef.current.y;\n const distance = Math.sqrt(\n Math.pow(targetX - currentX, 2) + Math.pow(targetY - currentY, 2),\n );\n\n const duration = Math.min(2000, Math.max(800, distance * 1000));\n\n setTargetRotation({\n x: targetX,\n y: targetY,\n startX: currentX,\n startY: currentY,\n distance,\n startTime: performance.now(),\n duration,\n });\n return;\n }\n });\n\n setIsDragging(true);\n setLastMousePos({ x: e.clientX, y: e.clientY });\n };\n\n const handleMouseMove = (e: React.MouseEvent<HTMLCanvasElement>) => {\n const rect = canvasRef.current?.getBoundingClientRect();\n if (rect) {\n const x = e.clientX - rect.left;\n const y = e.clientY - rect.top;\n setMousePos({ x, y });\n }\n\n if (isDragging) {\n const deltaX = e.clientX - lastMousePos.x;\n const deltaY = e.clientY - lastMousePos.y;\n\n rotationRef.current = {\n x: rotationRef.current.x + deltaY * 0.002,\n y: rotationRef.current.y + deltaX * 0.002,\n };\n\n setLastMousePos({ x: e.clientX, y: e.clientY });\n }\n };\n\n const handleMouseUp = () => {\n setIsDragging(false);\n };\n\n // Animation and rendering\n useEffect(() => {\n const canvas = canvasRef.current;\n const ctx = canvas?.getContext(\"2d\");\n if (!canvas || !ctx) return;\n\n const animate = () => {\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n\n const centerX = canvas.width / 2;\n const centerY = canvas.height / 2;\n const maxDistance = Math.sqrt(centerX * centerX + centerY * centerY);\n const dx = mousePos.x - centerX;\n const dy = mousePos.y - centerY;\n const distance = Math.sqrt(dx * dx + dy * dy);\n const speed = 0.003 + (distance / maxDistance) * 0.01;\n\n if (targetRotation) {\n const elapsed = performance.now() - targetRotation.startTime;\n const progress = Math.min(1, elapsed / targetRotation.duration);\n const easedProgress = easeOutCubic(progress);\n\n rotationRef.current = {\n x:\n targetRotation.startX +\n (targetRotation.x - targetRotation.startX) * easedProgress,\n y:\n targetRotation.startY +\n (targetRotation.y - targetRotation.startY) * easedProgress,\n };\n\n if (progress >= 1) {\n setTargetRotation(null);\n }\n } else if (!isDragging) {\n rotationRef.current = {\n x: rotationRef.current.x + (dy / canvas.height) * speed,\n y: rotationRef.current.y + (dx / canvas.width) * speed,\n };\n }\n\n iconPositions.forEach((icon, index) => {\n const cosX = Math.cos(rotationRef.current.x);\n const sinX = Math.sin(rotationRef.current.x);\n const cosY = Math.cos(rotationRef.current.y);\n const sinY = Math.sin(rotationRef.current.y);\n\n const rotatedX = icon.x * cosY - icon.z * sinY;\n const rotatedZ = icon.x * sinY + icon.z * cosY;\n const rotatedY = icon.y * cosX + rotatedZ * sinX;\n\n const scale = (rotatedZ + 200) / 300;\n const opacity = Math.max(0.2, Math.min(1, (rotatedZ + 150) / 200));\n\n ctx.save();\n ctx.translate(\n canvas.width / 2 + rotatedX,\n canvas.height / 2 + rotatedY,\n );\n ctx.scale(scale, scale);\n ctx.globalAlpha = opacity;\n\n if (icons || images) {\n // Only try to render icons/images if they exist\n if (\n iconCanvasesRef.current[index] &&\n imagesLoadedRef.current[index]\n ) {\n ctx.drawImage(iconCanvasesRef.current[index], -20, -20, 40, 40);\n }\n } else {\n // Show numbered circles if no icons/images are provided\n ctx.beginPath();\n ctx.arc(0, 0, 20, 0, Math.PI * 2);\n ctx.fillStyle = \"#4444ff\";\n ctx.fill();\n ctx.fillStyle = \"white\";\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n ctx.font = \"16px Arial\";\n ctx.fillText(`${icon.id + 1}`, 0, 0);\n }\n\n ctx.restore();\n });\n animationFrameRef.current = requestAnimationFrame(animate);\n };\n\n animate();\n\n return () => {\n if (animationFrameRef.current) {\n cancelAnimationFrame(animationFrameRef.current);\n }\n };\n }, [icons, images, iconPositions, isDragging, mousePos, targetRotation]);\n\n return (\n <canvas\n ref={canvasRef}\n width={400}\n height={400}\n onMouseDown={handleMouseDown}\n onMouseMove={handleMouseMove}\n onMouseUp={handleMouseUp}\n onMouseLeave={handleMouseUp}\n className=\"rounded-lg\"\n aria-label=\"Interactive 3D Icon Cloud\"\n role=\"img\"\n />\n );\n}\n","type": "registry:ui"}]diff --git a/apps/www/public/r/line-shadow-text.json b/apps/www/public/r/line-shadow-text.jsonindex a58e5bd9..fe27ad62 100644--- a/apps/www/public/r/line-shadow-text.json+++ b/apps/www/public/r/line-shadow-text.json@@ -10,7 +10,7 @@"files": [{"path": "registry/magicui/line-shadow-text.tsx",- "content": "import { cn } from \"@/lib/utils\";\nimport { motion, MotionProps } from \"motion/react\";\n\ninterface LineShadowTextProps\n extends Omit<React.HTMLAttributes<HTMLElement>, keyof MotionProps>,\n MotionProps {\n shadowColor?: string;\n as?: React.ElementType;\n}\n\nexport function LineShadowText({\n children,\n shadowColor = \"black\",\n className,\n as: Component = \"span\",\n ...props\n}: LineShadowTextProps) {\n const MotionComponent = motion.create(Component);\n const content = typeof children === \"string\" ? children : null;\n\n if (!content) {\n throw new Error(\"LineShadowText only accepts string content\");\n }\n\n return (\n <MotionComponent\n style={{ \"--shadow-color\": shadowColor } as React.CSSProperties}\n className={cn(\n \"relative z-0 inline-flex\",\n \"after:absolute after:left-[0.04em] after:top-[0.04em] after:content-[attr(data-text)]\",\n \"after:bg-[linear-gradient(45deg,transparent_45%,var(--shadow-color)_45%,var(--shadow-color)_55%,transparent_0)]\",\n \"after:-z-10 after:bg-[length:0.06em_0.06em] after:bg-clip-text after:text-transparent\",\n \"after:animate-line-shadow\",\n className,\n )}\n data-text={content}\n {...props}\n >\n {content}\n </MotionComponent>\n );\n}\n",+ "content": "\"use client\";\n\nimport { cn } from \"@/lib/utils\";\nimport { motion, MotionProps } from \"motion/react\";\n\ninterface LineShadowTextProps\n extends Omit<React.HTMLAttributes<HTMLElement>, keyof MotionProps>,\n MotionProps {\n shadowColor?: string;\n as?: React.ElementType;\n}\n\nexport function LineShadowText({\n children,\n shadowColor = \"black\",\n className,\n as: Component = \"span\",\n ...props\n}: LineShadowTextProps) {\n const MotionComponent = motion.create(Component);\n const content = typeof children === \"string\" ? children : null;\n\n if (!content) {\n throw new Error(\"LineShadowText only accepts string content\");\n }\n\n return (\n <MotionComponent\n style={{ \"--shadow-color\": shadowColor } as React.CSSProperties}\n className={cn(\n \"relative z-0 inline-flex\",\n \"after:absolute after:left-[0.04em] after:top-[0.04em] after:content-[attr(data-text)]\",\n \"after:bg-[linear-gradient(45deg,transparent_45%,var(--shadow-color)_45%,var(--shadow-color)_55%,transparent_0)]\",\n \"after:-z-10 after:bg-[length:0.06em_0.06em] after:bg-clip-text after:text-transparent\",\n \"after:animate-line-shadow\",\n className,\n )}\n data-text={content}\n {...props}\n >\n {content}\n </MotionComponent>\n );\n}\n","type": "registry:ui"}],diff --git a/apps/www/public/r/pointer.json b/apps/www/public/r/pointer.jsonindex 7b482970..d05932f0 100644--- a/apps/www/public/r/pointer.json+++ b/apps/www/public/r/pointer.json@@ -10,7 +10,7 @@"files": [{"path": "registry/magicui/pointer.tsx",- "content": "\"use client\";\n\nimport { cn } from \"@/lib/utils\";\nimport {\n AnimatePresence,\n HTMLMotionProps,\n motion,\n useMotionValue,\n} from \"motion/react\";\nimport { useEffect, useRef, useState } from \"react\";\n\ninterface PointerProps extends Omit<HTMLMotionProps<\"div\">, \"ref\"> {}\n\n/**\n * A custom pointer component that displays an animated cursor.\n * Add this as a child to any component to enable a custom pointer when hovering.\n * You can pass custom children to render as the pointer.\n *\n * @component\n * @param {PointerProps} props - The component props\n */\nexport function Pointer({\n className,\n style,\n children,\n ...props\n}: PointerProps): JSX.Element {\n const x = useMotionValue(0);\n const y = useMotionValue(0);\n const [isActive, setIsActive] = useState<boolean>(false);\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (typeof window !== \"undefined\" && containerRef.current) {\n // Get the parent element directly from the ref\n const parentElement = containerRef.current.parentElement;\n\n if (parentElement) {\n // Add cursor-none to parent\n parentElement.style.cursor = \"none\";\n\n // Add event listeners to parent\n const handleMouseMove = (e: MouseEvent) => {\n x.set(e.clientX);\n y.set(e.clientY);\n };\n\n const handleMouseEnter = (e: MouseEvent) => {\n x.set(e.clientX);\n y.set(e.clientY);\n setIsActive(true);\n };\n\n const handleMouseLeave = () => {\n setIsActive(false);\n };\n\n parentElement.addEventListener(\"mousemove\", handleMouseMove);\n parentElement.addEventListener(\"mouseenter\", handleMouseEnter);\n parentElement.addEventListener(\"mouseleave\", handleMouseLeave);\n\n return () => {\n parentElement.style.cursor = \"\";\n parentElement.removeEventListener(\"mousemove\", handleMouseMove);\n parentElement.removeEventListener(\"mouseenter\", handleMouseEnter);\n parentElement.removeEventListener(\"mouseleave\", handleMouseLeave);\n };\n }\n }\n }, [x, y]);\n\n return (\n <>\n <div ref={containerRef} />\n <AnimatePresence>\n {isActive && (\n <motion.div\n className=\"transform-[translate(-50%,-50%)] pointer-events-none fixed z-50\"\n style={{\n top: y,\n left: x,\n ...style,\n }}\n initial={{\n scale: 0,\n opacity: 0,\n }}\n animate={{\n scale: 1,\n opacity: 1,\n }}\n exit={{\n scale: 0,\n opacity: 0,\n }}\n {...props}\n >\n {children || (\n <svg\n stroke=\"currentColor\"\n fill=\"currentColor\"\n strokeWidth=\"1\"\n viewBox=\"0 0 16 16\"\n height=\"24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={cn(\n \"rotate-[-70deg] stroke-white text-black\",\n className,\n )}\n >\n <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\" />\n </svg>\n )}\n </motion.div>\n )}\n </AnimatePresence>\n </>\n );\n}\n",+ "content": "\"use client\";\n\nimport { cn } from \"@/lib/utils\";\nimport {\n AnimatePresence,\n HTMLMotionProps,\n motion,\n useMotionValue,\n} from \"motion/react\";\nimport { useEffect, useRef, useState } from \"react\";\n\ninterface PointerProps extends Omit<HTMLMotionProps<\"div\">, \"ref\"> {}\n\n/**\n * A custom pointer component that displays an animated cursor.\n * Add this as a child to any component to enable a custom pointer when hovering.\n * You can pass custom children to render as the pointer.\n *\n * @component\n * @param {PointerProps} props - The component props\n */\nexport function Pointer({\n className,\n style,\n children,\n ...props\n}: PointerProps): React.ReactNode {\n const x = useMotionValue(0);\n const y = useMotionValue(0);\n const [isActive, setIsActive] = useState<boolean>(false);\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (typeof window !== \"undefined\" && containerRef.current) {\n // Get the parent element directly from the ref\n const parentElement = containerRef.current.parentElement;\n\n if (parentElement) {\n // Add cursor-none to parent\n parentElement.style.cursor = \"none\";\n\n // Add event listeners to parent\n const handleMouseMove = (e: MouseEvent) => {\n x.set(e.clientX);\n y.set(e.clientY);\n };\n\n const handleMouseEnter = (e: MouseEvent) => {\n x.set(e.clientX);\n y.set(e.clientY);\n setIsActive(true);\n };\n\n const handleMouseLeave = () => {\n setIsActive(false);\n };\n\n parentElement.addEventListener(\"mousemove\", handleMouseMove);\n parentElement.addEventListener(\"mouseenter\", handleMouseEnter);\n parentElement.addEventListener(\"mouseleave\", handleMouseLeave);\n\n return () => {\n parentElement.style.cursor = \"\";\n parentElement.removeEventListener(\"mousemove\", handleMouseMove);\n parentElement.removeEventListener(\"mouseenter\", handleMouseEnter);\n parentElement.removeEventListener(\"mouseleave\", handleMouseLeave);\n };\n }\n }\n }, [x, y]);\n\n return (\n <>\n <div ref={containerRef} />\n <AnimatePresence>\n {isActive && (\n <motion.div\n className=\"transform-[translate(-50%,-50%)] pointer-events-none fixed z-50\"\n style={{\n top: y,\n left: x,\n ...style,\n }}\n initial={{\n scale: 0,\n opacity: 0,\n }}\n animate={{\n scale: 1,\n opacity: 1,\n }}\n exit={{\n scale: 0,\n opacity: 0,\n }}\n {...props}\n >\n {children || (\n <svg\n stroke=\"currentColor\"\n fill=\"currentColor\"\n strokeWidth=\"1\"\n viewBox=\"0 0 16 16\"\n height=\"24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={cn(\n \"rotate-[-70deg] stroke-white text-black\",\n className,\n )}\n >\n <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\" />\n </svg>\n )}\n </motion.div>\n )}\n </AnimatePresence>\n </>\n );\n}\n","type": "registry:ui"}]diff --git a/apps/www/public/r/shiny-button.json b/apps/www/public/r/shiny-button.jsonindex 84571d3d..e833e9da 100644--- a/apps/www/public/r/shiny-button.json+++ b/apps/www/public/r/shiny-button.json@@ -10,7 +10,7 @@"files": [{"path": "registry/magicui/shiny-button.tsx",- "content": "\"use client\";\n\nimport { cn } from \"@/lib/utils\";\nimport { motion, MotionProps, type AnimationProps } from \"motion/react\";\nimport React from \"react\";\n\nconst animationProps = {\n initial: { \"--x\": \"100%\", scale: 0.8 },\n animate: { \"--x\": \"-100%\", scale: 1 },\n whileTap: { scale: 0.95 },\n transition: {\n repeat: Infinity,\n repeatType: \"loop\",\n repeatDelay: 1,\n type: \"spring\",\n stiffness: 20,\n damping: 15,\n mass: 2,\n scale: {\n type: \"spring\",\n stiffness: 200,\n damping: 5,\n mass: 0.5,\n },\n },\n} as AnimationProps;\n\ninterface ShinyButtonProps\n extends Omit<React.HTMLAttributes<HTMLElement>, keyof MotionProps>,\n MotionProps {\n children: React.ReactNode;\n className?: string;\n}\n\nexport const ShinyButton = React.forwardRef<\n HTMLButtonElement,\n ShinyButtonProps\n>(({ children, className, ...props }, ref) => {\n return (\n <motion.button\n ref={ref}\n className={cn(\n \"relative cursor-pointer rounded-lg px-6 py-2 font-medium backdrop-blur-xl border transition-shadow duration-300 ease-in-out hover:shadow dark:bg-[radial-gradient(circle_at_50%_0%,var(--primary)/10%_0%,transparent_60%)] dark:hover:shadow-[0_0_20px_var(--primary)/10%]\",\n className,\n )}\n {...animationProps}\n {...props}\n >\n <span\n className=\"relative block size-full text-sm uppercase tracking-wide text-[rgb(0,0,0,65%)] dark:font-light dark:text-[rgb(255,255,255,90%)]\"\n style={{\n maskImage:\n \"linear-gradient(-75deg,var(--primary) calc(var(--x) + 20%),transparent calc(var(--x) + 30%),var(--primary) calc(var(--x) + 100%))\",\n }}\n >\n {children}\n </span>\n <span\n style={{\n mask: \"linear-gradient(rgb(0,0,0), rgb(0,0,0)) content-box exclude,linear-gradient(rgb(0,0,0), rgb(0,0,0))\",\n WebkitMask:\n \"linear-gradient(rgb(0,0,0), rgb(0,0,0)) content-box exclude,linear-gradient(rgb(0,0,0), rgb(0,0,0))\",\n backgroundImage:\n \"linear-gradient(-75deg,var(--primary)/10% calc(var(--x)+20%),var(--primary)/50% calc(var(--x)+25%),var(--primary)/10% calc(var(--x)+100%))\",\n }}\n className=\"absolute inset-0 z-10 block rounded-[inherit] p-px\"\n />\n </motion.button>\n );\n});\n\nShinyButton.displayName = \"ShinyButton\";\n",+ "content": "\"use client\";\n\nimport { cn } from \"@/lib/utils\";\nimport { motion, type MotionProps } from \"motion/react\";\nimport React from \"react\";\n\nconst animationProps: MotionProps = {\n initial: { \"--x\": \"100%\", scale: 0.8 },\n animate: { \"--x\": \"-100%\", scale: 1 },\n whileTap: { scale: 0.95 },\n transition: {\n repeat: Infinity,\n repeatType: \"loop\",\n repeatDelay: 1,\n type: \"spring\",\n stiffness: 20,\n damping: 15,\n mass: 2,\n scale: {\n type: \"spring\",\n stiffness: 200,\n damping: 5,\n mass: 0.5,\n },\n },\n};\n\ninterface ShinyButtonProps\n extends Omit<React.HTMLAttributes<HTMLElement>, keyof MotionProps>,\n MotionProps {\n children: React.ReactNode;\n className?: string;\n}\n\nexport const ShinyButton = React.forwardRef<\n HTMLButtonElement,\n ShinyButtonProps\n>(({ children, className, ...props }, ref) => {\n return (\n <motion.button\n ref={ref}\n className={cn(\n \"relative cursor-pointer rounded-lg px-6 py-2 font-medium backdrop-blur-xl border transition-shadow duration-300 ease-in-out hover:shadow dark:bg-[radial-gradient(circle_at_50%_0%,var(--primary)/10%_0%,transparent_60%)] dark:hover:shadow-[0_0_20px_var(--primary)/10%]\",\n className,\n )}\n {...animationProps}\n {...props}\n >\n <span\n className=\"relative block size-full text-sm uppercase tracking-wide text-[rgb(0,0,0,65%)] dark:font-light dark:text-[rgb(255,255,255,90%)]\"\n style={{\n maskImage:\n \"linear-gradient(-75deg,var(--primary) calc(var(--x) + 20%),transparent calc(var(--x) + 30%),var(--primary) calc(var(--x) + 100%))\",\n }}\n >\n {children}\n </span>\n <span\n style={{\n mask: \"linear-gradient(rgb(0,0,0), rgb(0,0,0)) content-box exclude,linear-gradient(rgb(0,0,0), rgb(0,0,0))\",\n WebkitMask:\n \"linear-gradient(rgb(0,0,0), rgb(0,0,0)) content-box exclude,linear-gradient(rgb(0,0,0), rgb(0,0,0))\",\n backgroundImage:\n \"linear-gradient(-75deg,var(--primary)/10% calc(var(--x)+20%),var(--primary)/50% calc(var(--x)+25%),var(--primary)/10% calc(var(--x)+100%))\",\n }}\n className=\"absolute inset-0 z-10 block rounded-[inherit] p-px\"\n />\n </motion.button>\n );\n});\n\nShinyButton.displayName = \"ShinyButton\";\n","type": "registry:ui"}]diff --git a/apps/www/public/r/smooth-cursor.json b/apps/www/public/r/smooth-cursor.jsonindex bfa6977e..27aa949e 100644--- a/apps/www/public/r/smooth-cursor.json+++ b/apps/www/public/r/smooth-cursor.json@@ -9,7 +9,7 @@"files": [{"path": "registry/magicui/smooth-cursor.tsx",- "content": "\"use client\";\n\nimport { motion, useSpring } from \"motion/react\";\nimport { FC, JSX, useEffect, useRef, useState } from \"react\";\n\ninterface Position {\n x: number;\n y: number;\n}\n\nexport interface SmoothCursorProps {\n cursor?: JSX.Element;\n springConfig?: {\n damping: number;\n stiffness: number;\n mass: number;\n restDelta: number;\n };\n}\n\nconst DefaultCursorSVG: FC = () => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={50}\n height={54}\n viewBox=\"0 0 50 54\"\n fill=\"none\"\n style={{ scale: 0.5 }}\n >\n <g filter=\"url(#filter0_d_91_7928)\">\n <path\n d=\"M42.6817 41.1495L27.5103 6.79925C26.7269 5.02557 24.2082 5.02558 23.3927 6.79925L7.59814 41.1495C6.75833 42.9759 8.52712 44.8902 10.4125 44.1954L24.3757 39.0496C24.8829 38.8627 25.4385 38.8627 25.9422 39.0496L39.8121 44.1954C41.6849 44.8902 43.4884 42.9759 42.6817 41.1495Z\"\n fill=\"black\"\n />\n <path\n d=\"M43.7146 40.6933L28.5431 6.34306C27.3556 3.65428 23.5772 3.69516 22.3668 6.32755L6.57226 40.6778C5.3134 43.4156 7.97238 46.298 10.803 45.2549L24.7662 40.109C25.0221 40.0147 25.2999 40.0156 25.5494 40.1082L39.4193 45.254C42.2261 46.2953 44.9254 43.4347 43.7146 40.6933Z\"\n stroke=\"white\"\n strokeWidth={2.25825}\n />\n </g>\n <defs>\n <filter\n id=\"filter0_d_91_7928\"\n x={0.602397}\n y={0.952444}\n width={49.0584}\n height={52.428}\n filterUnits=\"userSpaceOnUse\"\n colorInterpolationFilters=\"sRGB\"\n >\n <feFlood floodOpacity={0} result=\"BackgroundImageFix\" />\n <feColorMatrix\n in=\"SourceAlpha\"\n type=\"matrix\"\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\"\n result=\"hardAlpha\"\n />\n <feOffset dy={2.25825} />\n <feGaussianBlur stdDeviation={2.25825} />\n <feComposite in2=\"hardAlpha\" operator=\"out\" />\n <feColorMatrix\n type=\"matrix\"\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.08 0\"\n />\n <feBlend\n mode=\"normal\"\n in2=\"BackgroundImageFix\"\n result=\"effect1_dropShadow_91_7928\"\n />\n <feBlend\n mode=\"normal\"\n in=\"SourceGraphic\"\n in2=\"effect1_dropShadow_91_7928\"\n result=\"shape\"\n />\n </filter>\n </defs>\n </svg>\n );\n};\n\nexport function SmoothCursor({\n cursor = <DefaultCursorSVG />,\n springConfig = {\n damping: 45,\n stiffness: 400,\n mass: 1,\n restDelta: 0.001,\n },\n}: SmoothCursorProps) {\n const [isMoving, setIsMoving] = useState(false);\n const lastMousePos = useRef<Position>({ x: 0, y: 0 });\n const velocity = useRef<Position>({ x: 0, y: 0 });\n const lastUpdateTime = useRef(Date.now());\n const previousAngle = useRef(0);\n const accumulatedRotation = useRef(0);\n\n const cursorX = useSpring(0, springConfig);\n const cursorY = useSpring(0, springConfig);\n const rotation = useSpring(0, {\n ...springConfig,\n damping: 60,\n stiffness: 300,\n });\n const scale = useSpring(1, {\n ...springConfig,\n stiffness: 500,\n damping: 35,\n });\n\n useEffect(() => {\n const updateVelocity = (currentPos: Position) => {\n const currentTime = Date.now();\n const deltaTime = currentTime - lastUpdateTime.current;\n\n if (deltaTime > 0) {\n velocity.current = {\n x: (currentPos.x - lastMousePos.current.x) / deltaTime,\n y: (currentPos.y - lastMousePos.current.y) / deltaTime,\n };\n }\n\n lastUpdateTime.current = currentTime;\n lastMousePos.current = currentPos;\n };\n\n const smoothMouseMove = (e: MouseEvent) => {\n const currentPos = { x: e.clientX, y: e.clientY };\n updateVelocity(currentPos);\n\n const speed = Math.sqrt(\n Math.pow(velocity.current.x, 2) + Math.pow(velocity.current.y, 2),\n );\n\n cursorX.set(currentPos.x);\n cursorY.set(currentPos.y);\n\n if (speed > 0.1) {\n const currentAngle =\n Math.atan2(velocity.current.y, velocity.current.x) * (180 / Math.PI) +\n 90;\n\n let angleDiff = currentAngle - previousAngle.current;\n if (angleDiff > 180) angleDiff -= 360;\n if (angleDiff < -180) angleDiff += 360;\n accumulatedRotation.current += angleDiff;\n rotation.set(accumulatedRotation.current);\n previousAngle.current = currentAngle;\n\n scale.set(0.95);\n setIsMoving(true);\n\n const timeout = setTimeout(() => {\n scale.set(1);\n setIsMoving(false);\n }, 150);\n\n return () => clearTimeout(timeout);\n }\n };\n\n let rafId: number;\n const throttledMouseMove = (e: MouseEvent) => {\n if (rafId) return;\n\n rafId = requestAnimationFrame(() => {\n smoothMouseMove(e);\n rafId = 0;\n });\n };\n\n document.body.style.cursor = \"none\";\n window.addEventListener(\"mousemove\", throttledMouseMove);\n\n return () => {\n window.removeEventListener(\"mousemove\", throttledMouseMove);\n document.body.style.cursor = \"auto\";\n if (rafId) cancelAnimationFrame(rafId);\n };\n }, [cursorX, cursorY, rotation, scale]);\n\n return (\n <motion.div\n style={{\n position: \"fixed\",\n left: cursorX,\n top: cursorY,\n translateX: \"-50%\",\n translateY: \"-50%\",\n rotate: rotation,\n scale: scale,\n zIndex: 100,\n pointerEvents: \"none\",\n willChange: \"transform\",\n }}\n initial={{ scale: 0 }}\n animate={{ scale: 1 }}\n transition={{\n type: \"spring\",\n stiffness: 400,\n damping: 30,\n }}\n >\n {cursor}\n </motion.div>\n );\n}\n",+ "content": "\"use client\";\n\nimport { motion, useSpring } from \"motion/react\";\nimport { FC, useEffect, useRef, useState } from \"react\";\n\ninterface Position {\n x: number;\n y: number;\n}\n\nexport interface SmoothCursorProps {\n cursor?: React.ReactNode;\n springConfig?: {\n damping: number;\n stiffness: number;\n mass: number;\n restDelta: number;\n };\n}\n\nconst DefaultCursorSVG: FC = () => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={50}\n height={54}\n viewBox=\"0 0 50 54\"\n fill=\"none\"\n style={{ scale: 0.5 }}\n >\n <g filter=\"url(#filter0_d_91_7928)\">\n <path\n d=\"M42.6817 41.1495L27.5103 6.79925C26.7269 5.02557 24.2082 5.02558 23.3927 6.79925L7.59814 41.1495C6.75833 42.9759 8.52712 44.8902 10.4125 44.1954L24.3757 39.0496C24.8829 38.8627 25.4385 38.8627 25.9422 39.0496L39.8121 44.1954C41.6849 44.8902 43.4884 42.9759 42.6817 41.1495Z\"\n fill=\"black\"\n />\n <path\n d=\"M43.7146 40.6933L28.5431 6.34306C27.3556 3.65428 23.5772 3.69516 22.3668 6.32755L6.57226 40.6778C5.3134 43.4156 7.97238 46.298 10.803 45.2549L24.7662 40.109C25.0221 40.0147 25.2999 40.0156 25.5494 40.1082L39.4193 45.254C42.2261 46.2953 44.9254 43.4347 43.7146 40.6933Z\"\n stroke=\"white\"\n strokeWidth={2.25825}\n />\n </g>\n <defs>\n <filter\n id=\"filter0_d_91_7928\"\n x={0.602397}\n y={0.952444}\n width={49.0584}\n height={52.428}\n filterUnits=\"userSpaceOnUse\"\n colorInterpolationFilters=\"sRGB\"\n >\n <feFlood floodOpacity={0} result=\"BackgroundImageFix\" />\n <feColorMatrix\n in=\"SourceAlpha\"\n type=\"matrix\"\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\"\n result=\"hardAlpha\"\n />\n <feOffset dy={2.25825} />\n <feGaussianBlur stdDeviation={2.25825} />\n <feComposite in2=\"hardAlpha\" operator=\"out\" />\n <feColorMatrix\n type=\"matrix\"\n values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.08 0\"\n />\n <feBlend\n mode=\"normal\"\n in2=\"BackgroundImageFix\"\n result=\"effect1_dropShadow_91_7928\"\n />\n <feBlend\n mode=\"normal\"\n in=\"SourceGraphic\"\n in2=\"effect1_dropShadow_91_7928\"\n result=\"shape\"\n />\n </filter>\n </defs>\n </svg>\n );\n};\n\nexport function SmoothCursor({\n cursor = <DefaultCursorSVG />,\n springConfig = {\n damping: 45,\n stiffness: 400,\n mass: 1,\n restDelta: 0.001,\n },\n}: SmoothCursorProps) {\n const [isMoving, setIsMoving] = useState(false);\n const lastMousePos = useRef<Position>({ x: 0, y: 0 });\n const velocity = useRef<Position>({ x: 0, y: 0 });\n const lastUpdateTime = useRef(Date.now());\n const previousAngle = useRef(0);\n const accumulatedRotation = useRef(0);\n\n const cursorX = useSpring(0, springConfig);\n const cursorY = useSpring(0, springConfig);\n const rotation = useSpring(0, {\n ...springConfig,\n damping: 60,\n stiffness: 300,\n });\n const scale = useSpring(1, {\n ...springConfig,\n stiffness: 500,\n damping: 35,\n });\n\n useEffect(() => {\n const updateVelocity = (currentPos: Position) => {\n const currentTime = Date.now();\n const deltaTime = currentTime - lastUpdateTime.current;\n\n if (deltaTime > 0) {\n velocity.current = {\n x: (currentPos.x - lastMousePos.current.x) / deltaTime,\n y: (currentPos.y - lastMousePos.current.y) / deltaTime,\n };\n }\n\n lastUpdateTime.current = currentTime;\n lastMousePos.current = currentPos;\n };\n\n const smoothMouseMove = (e: MouseEvent) => {\n const currentPos = { x: e.clientX, y: e.clientY };\n updateVelocity(currentPos);\n\n const speed = Math.sqrt(\n Math.pow(velocity.current.x, 2) + Math.pow(velocity.current.y, 2),\n );\n\n cursorX.set(currentPos.x);\n cursorY.set(currentPos.y);\n\n if (speed > 0.1) {\n const currentAngle =\n Math.atan2(velocity.current.y, velocity.current.x) * (180 / Math.PI) +\n 90;\n\n let angleDiff = currentAngle - previousAngle.current;\n if (angleDiff > 180) angleDiff -= 360;\n if (angleDiff < -180) angleDiff += 360;\n accumulatedRotation.current += angleDiff;\n rotation.set(accumulatedRotation.current);\n previousAngle.current = currentAngle;\n\n scale.set(0.95);\n setIsMoving(true);\n\n const timeout = setTimeout(() => {\n scale.set(1);\n setIsMoving(false);\n }, 150);\n\n return () => clearTimeout(timeout);\n }\n };\n\n let rafId: number;\n const throttledMouseMove = (e: MouseEvent) => {\n if (rafId) return;\n\n rafId = requestAnimationFrame(() => {\n smoothMouseMove(e);\n rafId = 0;\n });\n };\n\n document.body.style.cursor = \"none\";\n window.addEventListener(\"mousemove\", throttledMouseMove);\n\n return () => {\n window.removeEventListener(\"mousemove\", throttledMouseMove);\n document.body.style.cursor = \"auto\";\n if (rafId) cancelAnimationFrame(rafId);\n };\n }, [cursorX, cursorY, rotation, scale]);\n\n return (\n <motion.div\n style={{\n position: \"fixed\",\n left: cursorX,\n top: cursorY,\n translateX: \"-50%\",\n translateY: \"-50%\",\n rotate: rotation,\n scale: scale,\n zIndex: 100,\n pointerEvents: \"none\",\n willChange: \"transform\",\n }}\n initial={{ scale: 0 }}\n animate={{ scale: 1 }}\n transition={{\n type: \"spring\",\n stiffness: 400,\n damping: 30,\n }}\n >\n {cursor}\n </motion.div>\n );\n}\n","type": "registry:ui"}]diff --git a/apps/www/public/r/spinning-text.json b/apps/www/public/r/spinning-text.jsonindex a707e2ad..6e5900a2 100644--- a/apps/www/public/r/spinning-text.json+++ b/apps/www/public/r/spinning-text.json@@ -10,7 +10,7 @@"files": [{"path": "registry/magicui/spinning-text.tsx",- "content": "\"use client\";\nimport { cn } from \"@/lib/utils\";\nimport { motion, Transition, Variants } from \"motion/react\";\nimport React, { CSSProperties } from \"react\";\n\ntype SpinningTextProps = {\n children: string | string[];\n style?: CSSProperties;\n duration?: number;\n className?: string;\n reverse?: boolean;\n fontSize?: number;\n radius?: number;\n transition?: Transition;\n variants?: {\n container?: Variants;\n item?: Variants;\n };\n};\n\nconst BASE_TRANSITION = {\n repeat: Infinity,\n ease: \"linear\",\n};\n\nconst BASE_ITEM_VARIANTS = {\n hidden: {\n opacity: 1,\n },\n visible: {\n opacity: 1,\n },\n};\n\nexport function SpinningText({\n children,\n duration = 10,\n style,\n className,\n reverse = false,\n radius = 5,\n transition,\n variants,\n}: SpinningTextProps) {\n if (typeof children !== \"string\" && !Array.isArray(children)) {\n throw new Error(\"children must be a string or an array of strings\");\n }\n\n if (Array.isArray(children)) {\n // Validate all elements are strings\n if (!children.every((child) => typeof child === \"string\")) {\n throw new Error(\"all elements in children array must be strings\");\n }\n children = children.join(\"\");\n }\n\n const letters = children.split(\"\");\n letters.push(\" \");\n\n const finalTransition = {\n ...BASE_TRANSITION,\n ...transition,\n duration: (transition as { duration?: number })?.duration ?? duration,\n };\n\n const containerVariants = {\n visible: { rotate: reverse ? -360 : 360 },\n ...variants?.container,\n };\n\n const itemVariants = {\n ...BASE_ITEM_VARIANTS,\n ...variants?.item,\n };\n\n return (\n <motion.div\n className={cn(\"relative\", className)}\n style={{\n ...style,\n }}\n initial=\"hidden\"\n animate=\"visible\"\n variants={containerVariants}\n transition={finalTransition}\n >\n {letters.map((letter, index) => (\n <motion.span\n aria-hidden=\"true\"\n key={`${index}-${letter}`}\n variants={itemVariants}\n className=\"absolute left-1/2 top-1/2 inline-block\"\n style={\n {\n \"--index\": index,\n \"--total\": letters.length,\n \"--radius\": radius,\n transform: `\n translate(-50%, -50%)\n rotate(calc(360deg / var(--total) * var(--index)))\n translateY(calc(var(--radius, 5) * -1ch))\n `,\n transformOrigin: \"center\",\n } as React.CSSProperties\n }\n >\n {letter}\n </motion.span>\n ))}\n <span className=\"sr-only\">{children}</span>\n </motion.div>\n );\n}\n",+ "content": "\"use client\";\n\nimport { cn } from \"@/lib/utils\";\nimport { motion, Transition, Variants } from \"motion/react\";\nimport React, { CSSProperties } from \"react\";\n\ntype SpinningTextProps = {\n children: string | string[];\n style?: CSSProperties;\n duration?: number;\n className?: string;\n reverse?: boolean;\n fontSize?: number;\n radius?: number;\n transition?: Transition;\n variants?: {\n container?: Variants;\n item?: Variants;\n };\n};\n\nconst BASE_TRANSITION: Transition = {\n repeat: Infinity,\n ease: \"linear\",\n};\n\nconst BASE_ITEM_VARIANTS: Variants = {\n hidden: {\n opacity: 1,\n },\n visible: {\n opacity: 1,\n },\n};\n\nexport function SpinningText({\n children,\n duration = 10,\n style,\n className,\n reverse = false,\n radius = 5,\n transition,\n variants,\n}: SpinningTextProps) {\n if (typeof children !== \"string\" && !Array.isArray(children)) {\n throw new Error(\"children must be a string or an array of strings\");\n }\n\n if (Array.isArray(children)) {\n // Validate all elements are strings\n if (!children.every((child) => typeof child === \"string\")) {\n throw new Error(\"all elements in children array must be strings\");\n }\n children = children.join(\"\");\n }\n\n const letters = children.split(\"\");\n letters.push(\" \");\n\n const finalTransition: Transition = {\n ...BASE_TRANSITION,\n ...transition,\n duration: (transition as { duration?: number })?.duration ?? duration,\n };\n\n const containerVariants = {\n visible: { rotate: reverse ? -360 : 360 },\n ...variants?.container,\n };\n\n const itemVariants = {\n ...BASE_ITEM_VARIANTS,\n ...variants?.item,\n };\n\n return (\n <motion.div\n className={cn(\"relative\", className)}\n style={{\n ...style,\n }}\n initial=\"hidden\"\n animate=\"visible\"\n variants={containerVariants}\n transition={finalTransition}\n >\n {letters.map((letter, index) => (\n <motion.span\n aria-hidden=\"true\"\n key={`${index}-${letter}`}\n variants={itemVariants}\n className=\"absolute left-1/2 top-1/2 inline-block\"\n style={\n {\n \"--index\": index,\n \"--total\": letters.length,\n \"--radius\": radius,\n transform: `\n translate(-50%, -50%)\n rotate(calc(360deg / var(--total) * var(--index)))\n translateY(calc(var(--radius, 5) * -1ch))\n `,\n transformOrigin: \"center\",\n } as React.CSSProperties\n }\n >\n {letter}\n </motion.span>\n ))}\n <span className=\"sr-only\">{children}</span>\n </motion.div>\n );\n}\n","type": "registry:ui"}]diff --git a/apps/www/registry/magicui/animated-list.tsx b/apps/www/registry/magicui/animated-list.tsxindex 872365ba..1f1569f8 100644--- a/apps/www/registry/magicui/animated-list.tsx+++ b/apps/www/registry/magicui/animated-list.tsx@@ -1,7 +1,7 @@"use client";import { cn } from "@/lib/utils";-import { AnimatePresence, motion } from "motion/react";+import { AnimatePresence, motion, MotionProps } from "motion/react";import React, {ComponentPropsWithoutRef,useEffect,@@ -10,7 +10,7 @@ import React, {} from "react";export function AnimatedListItem({ children }: { children: React.ReactNode }) {- const animations = {+ const animations: MotionProps = {initial: { scale: 0, opacity: 0 },animate: { scale: 1, opacity: 1, originY: 0 },exit: { scale: 0, opacity: 0 },diff --git a/apps/www/registry/magicui/box-reveal.tsx b/apps/www/registry/magicui/box-reveal.tsxindex 9f9bcdee..d8f02790 100644--- a/apps/www/registry/magicui/box-reveal.tsx+++ b/apps/www/registry/magicui/box-reveal.tsx@@ -3,8 +3,8 @@import { motion, useAnimation, useInView } from "motion/react";import { useEffect, useRef } from "react";-interface BoxRevealProps {- children: JSX.Element;+export interface BoxRevealProps {+ children: React.ReactNode;width?: "fit-content" | "100%";boxColor?: string;duration?: number;diff --git a/apps/www/registry/magicui/cool-mode.tsx b/apps/www/registry/magicui/cool-mode.tsxindex 53eb117b..9ff9b876 100644--- a/apps/www/registry/magicui/cool-mode.tsx+++ b/apps/www/registry/magicui/cool-mode.tsx@@ -237,7 +237,7 @@ interface CoolModeProps {}export const CoolMode: React.FC<CoolModeProps> = ({ children, options }) => {- const ref = useRef<HTMLElement>(null);+ const ref = useRef<HTMLSpanElement>(null);useEffect(() => {if (ref.current) {@@ -245,5 +245,5 @@ export const CoolMode: React.FC<CoolModeProps> = ({ children, options }) => {}}, [options]);- return React.cloneElement(children as React.ReactElement, { ref });+ return <span ref={ref}>{children}</span>;};diff --git a/apps/www/registry/magicui/icon-cloud.tsx b/apps/www/registry/magicui/icon-cloud.tsxindex 1e9ffc2e..013e371f 100644--- a/apps/www/registry/magicui/icon-cloud.tsx+++ b/apps/www/registry/magicui/icon-cloud.tsx@@ -37,7 +37,7 @@ export function IconCloud({ icons, images }: IconCloudProps) {startTime: number;duration: number;} | null>(null);- const animationFrameRef = useRef<number>();+ const animationFrameRef = useRef<number>(0);const rotationRef = useRef(rotation);const iconCanvasesRef = useRef<HTMLCanvasElement[]>([]);const imagesLoadedRef = useRef<boolean[]>([]);diff --git a/apps/www/registry/magicui/line-shadow-text.tsx b/apps/www/registry/magicui/line-shadow-text.tsxindex 179d805e..e52ef8ee 100644--- a/apps/www/registry/magicui/line-shadow-text.tsx+++ b/apps/www/registry/magicui/line-shadow-text.tsx@@ -1,3 +1,5 @@+"use client";+import { cn } from "@/lib/utils";import { motion, MotionProps } from "motion/react";diff --git a/apps/www/registry/magicui/pointer.tsx b/apps/www/registry/magicui/pointer.tsxindex 841d398e..42b7c4b5 100644--- a/apps/www/registry/magicui/pointer.tsx+++ b/apps/www/registry/magicui/pointer.tsx@@ -24,7 +24,7 @@ export function Pointer({style,children,...props-}: PointerProps): JSX.Element {+}: PointerProps): React.ReactNode {const x = useMotionValue(0);const y = useMotionValue(0);const [isActive, setIsActive] = useState<boolean>(false);diff --git a/apps/www/registry/magicui/shiny-button.tsx b/apps/www/registry/magicui/shiny-button.tsxindex ea2dacde..de693c61 100644--- a/apps/www/registry/magicui/shiny-button.tsx+++ b/apps/www/registry/magicui/shiny-button.tsx@@ -1,10 +1,10 @@"use client";import { cn } from "@/lib/utils";-import { motion, MotionProps, type AnimationProps } from "motion/react";+import { motion, type MotionProps } from "motion/react";import React from "react";-const animationProps = {+const animationProps: MotionProps = {initial: { "--x": "100%", scale: 0.8 },animate: { "--x": "-100%", scale: 1 },whileTap: { scale: 0.95 },@@ -23,7 +23,7 @@ const animationProps = {mass: 0.5,},},-} as AnimationProps;+};interface ShinyButtonPropsextends Omit<React.HTMLAttributes<HTMLElement>, keyof MotionProps>,diff --git a/apps/www/registry/magicui/smooth-cursor.tsx b/apps/www/registry/magicui/smooth-cursor.tsxindex 6e71c800..aac1212b 100644--- a/apps/www/registry/magicui/smooth-cursor.tsx+++ b/apps/www/registry/magicui/smooth-cursor.tsx@@ -1,7 +1,7 @@"use client";import { motion, useSpring } from "motion/react";-import { FC, JSX, useEffect, useRef, useState } from "react";+import { FC, useEffect, useRef, useState } from "react";interface Position {x: number;@@ -9,7 +9,7 @@ interface Position {}export interface SmoothCursorProps {- cursor?: JSX.Element;+ cursor?: React.ReactNode;springConfig?: {damping: number;stiffness: number;diff --git a/apps/www/registry/magicui/spinning-text.tsx b/apps/www/registry/magicui/spinning-text.tsxindex 42b19a89..a65dea89 100644--- a/apps/www/registry/magicui/spinning-text.tsx+++ b/apps/www/registry/magicui/spinning-text.tsx@@ -1,29 +1,27 @@"use client";+import { cn } from "@/lib/utils";import { motion, Transition, Variants } from "motion/react";-import React, { CSSProperties } from "react";+import React, { ComponentPropsWithoutRef } from "react";-type SpinningTextProps = {+interface SpinningTextProps extends ComponentPropsWithoutRef<"div"> {children: string | string[];- style?: CSSProperties;duration?: number;- className?: string;reverse?: boolean;- fontSize?: number;radius?: number;transition?: Transition;variants?: {container?: Variants;item?: Variants;};-};+}-const BASE_TRANSITION = {+const BASE_TRANSITION: Transition = {repeat: Infinity,ease: "linear",};-const BASE_ITEM_VARIANTS = {+const BASE_ITEM_VARIANTS: Variants = {hidden: {opacity: 1,},@@ -35,12 +33,12 @@ const BASE_ITEM_VARIANTS = {export function SpinningText({children,duration = 10,- style,- className,reverse = false,radius = 5,transition,variants,+ className,+ style,}: SpinningTextProps) {if (typeof children !== "string" && !Array.isArray(children)) {throw new Error("children must be a string or an array of strings");@@ -57,18 +55,18 @@ export function SpinningText({const letters = children.split("");letters.push(" ");- const finalTransition = {+ const finalTransition: Transition = {...BASE_TRANSITION,...transition,duration: (transition as { duration?: number })?.duration ?? duration,};- const containerVariants = {+ const containerVariants: Variants = {visible: { rotate: reverse ? -360 : 360 },...variants?.container,};- const itemVariants = {+ const itemVariants: Variants = {...BASE_ITEM_VARIANTS,...variants?.item,};