UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
fix: changed typo in animated-grid-pattern component (#412)
Arghya Dasfeb559486b8e
diff --git a/public/r/index.json b/public/r/index.jsonindex 0ff58d7b..42259dcc 100644--- a/public/r/index.json+++ b/public/r/index.json@@ -51,7 +51,33 @@"path": "magicui/meteors.tsx","type": "registry:ui"}- ]+ ],+ "tailwind": {+ "config": {+ "theme": {+ "extend": {+ "animation": {+ "meteor": "meteor 5s linear infinite"+ },+ "keyframes": {+ "meteor": {+ "0%": {+ "transform": "rotate(215deg) translateX(0)",+ "opacity": "1"+ },+ "70%": {+ "opacity": "1"+ },+ "100%": {+ "transform": "rotate(215deg) translateX(-500px)",+ "opacity": "0"+ }+ }+ }+ }+ }+ }+ }},{"name": "grid-pattern",@@ -102,6 +128,10 @@{"name": "code-comparison","type": "registry:ui",+ "dependencies": [+ "shiki",+ "next-themes"+ ],"files": [{"path": "magicui/code-comparison.tsx",diff --git a/public/r/styles/default/animated-circular-progress-bar.json b/public/r/styles/default/animated-circular-progress-bar.jsonindex 2510b646..43fcb71c 100644--- a/public/r/styles/default/animated-circular-progress-bar.json+++ b/public/r/styles/default/animated-circular-progress-bar.json@@ -4,7 +4,7 @@"files": [{"path": "magicui/animated-circular-progress-bar.tsx",- "content": "import { cn } from \"@/lib/utils\";\n\ninterface Props {\n max: number;\n value: number;\n min: number;\n gaugePrimaryColor: string;\n gaugeSecondaryColor: string;\n className?: string;\n}\n\nexport default function AnimatedCircularProgressBar({\n max = 100,\n min = 0,\n value = 0,\n gaugePrimaryColor,\n gaugeSecondaryColor,\n className,\n}: Props) {\n const circumference = 2 * Math.PI * 45;\n const percentPx = circumference / 100;\n const currentPercent = ((value - min) / (max - min)) * 100;\n\n return (\n <div\n className={cn(\"relative size-40 text-2xl font-semibold\", className)}\n style={\n {\n \"--circle-size\": \"100px\",\n \"--circumference\": circumference,\n \"--percent-to-px\": `${percentPx}px`,\n \"--gap-percent\": \"5\",\n \"--offset-factor\": \"0\",\n \"--transition-length\": \"1s\",\n \"--transition-step\": \"200ms\",\n \"--delay\": \"0s\",\n \"--percent-to-deg\": \"3.6deg\",\n transform: \"translateZ(0)\",\n } as React.CSSProperties\n }\n >\n <svg\n fill=\"none\"\n className=\"size-full\"\n strokeWidth=\"2\"\n viewBox=\"0 0 100 100\"\n >\n {currentPercent <= 90 && currentPercent >= 0 && (\n <circle\n cx=\"50\"\n cy=\"50\"\n r=\"45\"\n strokeWidth=\"10\"\n strokeDashoffset=\"0\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\" opacity-100\"\n style={\n {\n stroke: gaugeSecondaryColor,\n \"--stroke-percent\": 90 - currentPercent,\n \"--offset-factor-secondary\": \"calc(1 - var(--offset-factor))\",\n strokeDasharray:\n \"calc(var(--stroke-percent) * var(--percent-to-px)) var(--circumference)\",\n transform:\n \"rotate(calc(1turn - 90deg - (var(--gap-percent) * var(--percent-to-deg) * var(--offset-factor-secondary)))) scaleY(-1)\",\n transition: \"all var(--transition-length) ease var(--delay)\",\n transformOrigin:\n \"calc(var(--circle-size) / 2) calc(var(--circle-size) / 2)\",\n } as React.CSSProperties\n }\n />\n )}\n <circle\n cx=\"50\"\n cy=\"50\"\n r=\"45\"\n strokeWidth=\"10\"\n strokeDashoffset=\"0\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"opacity-100\"\n style={\n {\n stroke: gaugePrimaryColor,\n \"--stroke-percent\": currentPercent,\n strokeDasharray:\n \"calc(var(--stroke-percent) * var(--percent-to-px)) var(--circumference)\",\n transition:\n \"var(--transition-length) ease var(--delay),stroke var(--transition-length) ease var(--delay)\",\n transitionProperty: \"stroke-dasharray,transform\",\n transform:\n \"rotate(calc(-90deg + var(--gap-percent) * var(--offset-factor) * var(--percent-to-deg)))\",\n transformOrigin:\n \"calc(var(--circle-size) / 2) calc(var(--circle-size) / 2)\",\n } as React.CSSProperties\n }\n />\n </svg>\n <span\n data-current-value={currentPercent}\n className=\"duration-[var(--transition-length)] delay-[var(--delay)] absolute inset-0 m-auto size-fit ease-linear animate-in fade-in\"\n >\n {currentPercent}\n </span>\n </div>\n );\n}\n",+ "content": "import { cn } from \"@/lib/utils\";\n\ninterface Props {\n max: number;\n value: number;\n min: number;\n gaugePrimaryColor: string;\n gaugeSecondaryColor: string;\n className?: string;\n}\n\nexport default function AnimatedCircularProgressBar({\n max = 100,\n min = 0,\n value = 0,\n gaugePrimaryColor,\n gaugeSecondaryColor,\n className,\n}: Props) {\n const circumference = 2 * Math.PI * 45;\n const percentPx = circumference / 100;\n const currentPercent = Math.round(((value - min) / (max - min)) * 100);\n\n return (\n <div\n className={cn(\"relative size-40 text-2xl font-semibold\", className)}\n style={\n {\n \"--circle-size\": \"100px\",\n \"--circumference\": circumference,\n \"--percent-to-px\": `${percentPx}px`,\n \"--gap-percent\": \"5\",\n \"--offset-factor\": \"0\",\n \"--transition-length\": \"1s\",\n \"--transition-step\": \"200ms\",\n \"--delay\": \"0s\",\n \"--percent-to-deg\": \"3.6deg\",\n transform: \"translateZ(0)\",\n } as React.CSSProperties\n }\n >\n <svg\n fill=\"none\"\n className=\"size-full\"\n strokeWidth=\"2\"\n viewBox=\"0 0 100 100\"\n >\n {currentPercent <= 90 && currentPercent >= 0 && (\n <circle\n cx=\"50\"\n cy=\"50\"\n r=\"45\"\n strokeWidth=\"10\"\n strokeDashoffset=\"0\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\" opacity-100\"\n style={\n {\n stroke: gaugeSecondaryColor,\n \"--stroke-percent\": 90 - currentPercent,\n \"--offset-factor-secondary\": \"calc(1 - var(--offset-factor))\",\n strokeDasharray:\n \"calc(var(--stroke-percent) * var(--percent-to-px)) var(--circumference)\",\n transform:\n \"rotate(calc(1turn - 90deg - (var(--gap-percent) * var(--percent-to-deg) * var(--offset-factor-secondary)))) scaleY(-1)\",\n transition: \"all var(--transition-length) ease var(--delay)\",\n transformOrigin:\n \"calc(var(--circle-size) / 2) calc(var(--circle-size) / 2)\",\n } as React.CSSProperties\n }\n />\n )}\n <circle\n cx=\"50\"\n cy=\"50\"\n r=\"45\"\n strokeWidth=\"10\"\n strokeDashoffset=\"0\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"opacity-100\"\n style={\n {\n stroke: gaugePrimaryColor,\n \"--stroke-percent\": currentPercent,\n strokeDasharray:\n \"calc(var(--stroke-percent) * var(--percent-to-px)) var(--circumference)\",\n transition:\n \"var(--transition-length) ease var(--delay),stroke var(--transition-length) ease var(--delay)\",\n transitionProperty: \"stroke-dasharray,transform\",\n transform:\n \"rotate(calc(-90deg + var(--gap-percent) * var(--offset-factor) * var(--percent-to-deg)))\",\n transformOrigin:\n \"calc(var(--circle-size) / 2) calc(var(--circle-size) / 2)\",\n } as React.CSSProperties\n }\n />\n </svg>\n <span\n data-current-value={currentPercent}\n className=\"duration-[var(--transition-length)] delay-[var(--delay)] absolute inset-0 m-auto size-fit ease-linear animate-in fade-in\"\n >\n {currentPercent}\n </span>\n </div>\n );\n}\n","type": "registry:ui","target": ""}diff --git a/public/r/styles/default/animated-grid-pattern.json b/public/r/styles/default/animated-grid-pattern.jsonindex a376a1df..f0a53d0e 100644--- a/public/r/styles/default/animated-grid-pattern.json+++ b/public/r/styles/default/animated-grid-pattern.json@@ -7,7 +7,7 @@"files": [{"path": "magicui/animated-grid-pattern.tsx",- "content": "\"use client\";\n\nimport { useEffect, useId, useRef, useState } from \"react\";\nimport { motion } from \"framer-motion\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface GridPatternProps {\n width?: number;\n height?: number;\n x?: number;\n y?: number;\n strokeDasharray?: any;\n numSquares?: number;\n className?: string;\n maxOpacity?: number;\n duration?: number;\n repeatDelay?: number;\n}\n\nexport function GridPattern({\n width = 40,\n height = 40,\n x = -1,\n y = -1,\n strokeDasharray = 0,\n numSquares = 50,\n className,\n maxOpacity = 0.5,\n duration = 4,\n repeatDelay = 0.5,\n ...props\n}: GridPatternProps) {\n const id = useId();\n const containerRef = useRef(null);\n const [dimensions, setDimensions] = useState({ width: 0, height: 0 });\n const [squares, setSquares] = useState(() => generateSquares(numSquares));\n\n function getPos() {\n return [\n Math.floor((Math.random() * dimensions.width) / width),\n Math.floor((Math.random() * dimensions.height) / height),\n ];\n }\n\n // Adjust the generateSquares function to return objects with an id, x, and y\n function generateSquares(count: number) {\n return Array.from({ length: count }, (_, i) => ({\n id: i,\n pos: getPos(),\n }));\n }\n\n // Function to update a single square's position\n const updateSquarePosition = (id: number) => {\n setSquares((currentSquares) =>\n currentSquares.map((sq) =>\n sq.id === id\n ? {\n ...sq,\n pos: getPos(),\n }\n : sq,\n ),\n );\n };\n\n // Update squares to animate in\n useEffect(() => {\n if (dimensions.width && dimensions.height) {\n setSquares(generateSquares(numSquares));\n }\n }, [dimensions, numSquares]);\n\n // Resize observer to update container dimensions\n useEffect(() => {\n const resizeObserver = new ResizeObserver((entries) => {\n for (let entry of entries) {\n setDimensions({\n width: entry.contentRect.width,\n height: entry.contentRect.height,\n });\n }\n });\n\n if (containerRef.current) {\n resizeObserver.observe(containerRef.current);\n }\n\n return () => {\n if (containerRef.current) {\n resizeObserver.unobserve(containerRef.current);\n }\n };\n }, [containerRef]);\n\n return (\n <svg\n ref={containerRef}\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute inset-0 h-full w-full fill-gray-400/30 stroke-gray-400/30\",\n className,\n )}\n {...props}\n >\n <defs>\n <pattern\n id={id}\n width={width}\n height={height}\n patternUnits=\"userSpaceOnUse\"\n x={x}\n y={y}\n >\n <path\n d={`M.5 ${height}V.5H${width}`}\n fill=\"none\"\n strokeDasharray={strokeDasharray}\n />\n </pattern>\n </defs>\n <rect width=\"100%\" height=\"100%\" fill={`url(#${id})`} />\n <svg x={x} y={y} className=\"overflow-visible\">\n {squares.map(({ pos: [x, y], id }, index) => (\n <motion.rect\n initial={{ opacity: 0 }}\n animate={{ opacity: maxOpacity }}\n transition={{\n duration,\n repeat: 1,\n delay: index * 0.1,\n repeatType: \"reverse\",\n }}\n onAnimationComplete={() => updateSquarePosition(id)}\n key={`${x}-${y}-${index}`}\n width={width - 1}\n height={height - 1}\n x={x * width + 1}\n y={y * height + 1}\n fill=\"currentColor\"\n strokeWidth=\"0\"\n />\n ))}\n </svg>\n </svg>\n );\n}\n\nexport default GridPattern;\n",+ "content": "\"use client\";\n\nimport { useEffect, useId, useRef, useState } from \"react\";\nimport { motion } from \"framer-motion\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface AnimatedGridPatternProps {\n width?: number;\n height?: number;\n x?: number;\n y?: number;\n strokeDasharray?: any;\n numSquares?: number;\n className?: string;\n maxOpacity?: number;\n duration?: number;\n repeatDelay?: number;\n}\n\nexport default function AnimatedGridPattern({\n width = 40,\n height = 40,\n x = -1,\n y = -1,\n strokeDasharray = 0,\n numSquares = 50,\n className,\n maxOpacity = 0.5,\n duration = 4,\n repeatDelay = 0.5,\n ...props\n}: AnimatedGridPatternProps) {\n const id = useId();\n const containerRef = useRef(null);\n const [dimensions, setDimensions] = useState({ width: 0, height: 0 });\n const [squares, setSquares] = useState(() => generateSquares(numSquares));\n\n function getPos() {\n return [\n Math.floor((Math.random() * dimensions.width) / width),\n Math.floor((Math.random() * dimensions.height) / height),\n ];\n }\n\n // Adjust the generateSquares function to return objects with an id, x, and y\n function generateSquares(count: number) {\n return Array.from({ length: count }, (_, i) => ({\n id: i,\n pos: getPos(),\n }));\n }\n\n // Function to update a single square's position\n const updateSquarePosition = (id: number) => {\n setSquares((currentSquares) =>\n currentSquares.map((sq) =>\n sq.id === id\n ? {\n ...sq,\n pos: getPos(),\n }\n : sq\n )\n );\n };\n\n // Update squares to animate in\n useEffect(() => {\n if (dimensions.width && dimensions.height) {\n setSquares(generateSquares(numSquares));\n }\n }, [dimensions, numSquares]);\n\n // Resize observer to update container dimensions\n useEffect(() => {\n const resizeObserver = new ResizeObserver((entries) => {\n for (let entry of entries) {\n setDimensions({\n width: entry.contentRect.width,\n height: entry.contentRect.height,\n });\n }\n });\n\n if (containerRef.current) {\n resizeObserver.observe(containerRef.current);\n }\n\n return () => {\n if (containerRef.current) {\n resizeObserver.unobserve(containerRef.current);\n }\n };\n }, [containerRef]);\n\n return (\n <svg\n ref={containerRef}\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute inset-0 h-full w-full fill-gray-400/30 stroke-gray-400/30\",\n className\n )}\n {...props}\n >\n <defs>\n <pattern\n id={id}\n width={width}\n height={height}\n patternUnits=\"userSpaceOnUse\"\n x={x}\n y={y}\n >\n <path\n d={`M.5 ${height}V.5H${width}`}\n fill=\"none\"\n strokeDasharray={strokeDasharray}\n />\n </pattern>\n </defs>\n <rect width=\"100%\" height=\"100%\" fill={`url(#${id})`} />\n <svg x={x} y={y} className=\"overflow-visible\">\n {squares.map(({ pos: [x, y], id }, index) => (\n <motion.rect\n initial={{ opacity: 0 }}\n animate={{ opacity: maxOpacity }}\n transition={{\n duration,\n repeat: 1,\n delay: index * 0.1,\n repeatType: \"reverse\",\n }}\n onAnimationComplete={() => updateSquarePosition(id)}\n key={`${x}-${y}-${index}`}\n width={width - 1}\n height={height - 1}\n x={x * width + 1}\n y={y * height + 1}\n fill=\"currentColor\"\n strokeWidth=\"0\"\n />\n ))}\n </svg>\n </svg>\n );\n}\n","type": "registry:ui","target": ""}diff --git a/public/r/styles/default/code-comparison.json b/public/r/styles/default/code-comparison.jsonindex b51269ac..c7f7618f 100644--- a/public/r/styles/default/code-comparison.json+++ b/public/r/styles/default/code-comparison.json@@ -1,10 +1,14 @@{"name": "code-comparison","type": "registry:ui",+ "dependencies": [+ "shiki",+ "next-themes"+ ],"files": [{"path": "magicui/code-comparison.tsx",- "content": "\"use client\";\n\nimport React, { useState, useEffect } from \"react\";\nimport { codeToHtml } from \"shiki\";\nimport { Card, CardContent } from \"@/components/ui/card\";\nimport { useTheme } from \"next-themes\";\n\ninterface CodeComparisonProps {\n beforeCode: string;\n afterCode: string;\n language: string;\n filename: string;\n lightTheme: string;\n darkTheme: string;\n}\n\nexport default function CodeComparison({\n beforeCode,\n afterCode,\n language,\n filename,\n lightTheme,\n darkTheme,\n}: CodeComparisonProps) {\n const { theme, systemTheme } = useTheme();\n const [highlightedBefore, setHighlightedBefore] = useState(\"\");\n const [highlightedAfter, setHighlightedAfter] = useState(\"\");\n\n useEffect(() => {\n const currentTheme = theme === \"system\" ? systemTheme : theme;\n const selectedTheme = currentTheme === \"dark\" ? darkTheme : lightTheme;\n\n async function highlightCode() {\n const before = await codeToHtml(beforeCode, {\n lang: language,\n theme: selectedTheme,\n });\n const after = await codeToHtml(afterCode, {\n lang: language,\n theme: selectedTheme,\n });\n setHighlightedBefore(before);\n setHighlightedAfter(after);\n }\n\n highlightCode();\n }, [\n theme,\n systemTheme,\n beforeCode,\n afterCode,\n language,\n lightTheme,\n darkTheme,\n ]);\n\n const renderCode = (code: string, highlighted: string) => {\n if (highlighted) {\n return (\n <div\n className=\"h-full font-mono text-sm [&>pre]:h-full [&>pre]:bg-[#1e1e1e] [&>pre]:p-4 [&_code]:whitespace-pre-wrap [&_code]:break-all\"\n dangerouslySetInnerHTML={{ __html: highlighted }}\n />\n );\n } else {\n return (\n <pre className=\"h-full whitespace-pre-wrap break-all bg-background p-4 font-mono text-sm text-foreground\">\n {code}\n </pre>\n );\n }\n };\n\n return (\n <div className=\"mx-auto w-full max-w-5xl\">\n <Card className=\"w-full\">\n <CardContent className=\"h-full p-0\">\n <div className=\"relative grid h-full overflow-hidden rounded-md md:grid-cols-2\">\n <div className=\"h-full border-r border-neutral-200 dark:border-neutral-800\">\n <div className=\"flex items-center bg-[#1e1e1e] p-2 font-mono text-sm text-white\">\n <svg\n className=\"mr-2 h-4 w-4\"\n fill=\"currentColor\"\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M3 3h18v18H3V3zm16 16V5H5v14h14zM7 7h4v4H7V7zm6 0h4v4h-4V7zm-6 6h4v4H7v-4zm6 0h4v4h-4v-4z\" />\n </svg>\n {filename}\n <span className=\"ml-auto\">before</span>\n </div>\n {renderCode(beforeCode, highlightedBefore)}\n </div>\n <div className=\"h-full\">\n <div className=\"flex items-center bg-[#1e1e1e] p-2 font-mono text-sm text-white\">\n <svg\n className=\"mr-2 h-4 w-4\"\n fill=\"currentColor\"\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M3 3h18v18H3V3zm16 16V5H5v14h14zM7 7h4v4H7V7zm6 0h4v4h-4V7zm-6 6h4v4H7v-4zm6 0h4v4h-4v-4z\" />\n </svg>\n {filename}\n <span className=\"ml-auto\">after</span>\n </div>\n {renderCode(afterCode, highlightedAfter)}\n </div>\n <div className=\"absolute left-1/2 top-1/2 flex h-8 w-8 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-md bg-neutral-700 text-sm text-white\">\n VS\n </div>\n </div>\n </CardContent>\n </Card>\n </div>\n );\n}\n",+ "content": "\"use client\";\n\nimport { FileIcon } from \"lucide-react\";\nimport { useTheme } from \"next-themes\";\nimport { useEffect, useState } from \"react\";\nimport { codeToHtml } from \"shiki\";\n\ninterface CodeComparisonProps {\n beforeCode: string;\n afterCode: string;\n language: string;\n filename: string;\n lightTheme: string;\n darkTheme: string;\n}\n\nexport default function CodeComparison({\n beforeCode,\n afterCode,\n language,\n filename,\n lightTheme,\n darkTheme,\n}: CodeComparisonProps) {\n const { theme, systemTheme } = useTheme();\n const [highlightedBefore, setHighlightedBefore] = useState(\"\");\n const [highlightedAfter, setHighlightedAfter] = useState(\"\");\n\n useEffect(() => {\n const currentTheme = theme === \"system\" ? systemTheme : theme;\n const selectedTheme = currentTheme === \"dark\" ? darkTheme : lightTheme;\n\n async function highlightCode() {\n const before = await codeToHtml(beforeCode, {\n lang: language,\n theme: selectedTheme,\n });\n const after = await codeToHtml(afterCode, {\n lang: language,\n theme: selectedTheme,\n });\n setHighlightedBefore(before);\n setHighlightedAfter(after);\n }\n\n highlightCode();\n }, [\n theme,\n systemTheme,\n beforeCode,\n afterCode,\n language,\n lightTheme,\n darkTheme,\n ]);\n\n const renderCode = (code: string, highlighted: string) => {\n if (highlighted) {\n return (\n <div\n className=\"h-full overflow-auto bg-background font-mono text-xs [&>pre]:h-full [&>pre]:!bg-transparent [&>pre]:p-4 [&_code]:break-all\"\n dangerouslySetInnerHTML={{ __html: highlighted }}\n />\n );\n } else {\n return (\n <pre className=\"h-full overflow-auto break-all bg-background p-4 font-mono text-xs text-foreground\">\n {code}\n </pre>\n );\n }\n };\n return (\n <div className=\"mx-auto w-full max-w-5xl\">\n <div className=\"relative w-full overflow-hidden rounded-xl border border-border\">\n <div className=\"relative grid md:grid-cols-2 md:divide-x md:divide-border\">\n <div>\n <div className=\"flex items-center bg-accent p-2 text-sm text-foreground\">\n <FileIcon className=\"mr-2 h-4 w-4\" />\n {filename}\n <span className=\"ml-auto\">before</span>\n </div>\n {renderCode(beforeCode, highlightedBefore)}\n </div>\n <div>\n <div className=\"flex items-center bg-accent p-2 text-sm text-foreground\">\n <FileIcon className=\"mr-2 h-4 w-4\" />\n {filename}\n <span className=\"ml-auto\">after</span>\n </div>\n {renderCode(afterCode, highlightedAfter)}\n </div>\n </div>\n <div className=\"absolute left-1/2 top-1/2 flex h-8 w-8 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-md bg-accent text-xs text-foreground\">\n VS\n </div>\n </div>\n </div>\n );\n}\n","type": "registry:ui","target": ""}diff --git a/public/r/styles/default/dock.json b/public/r/styles/default/dock.jsonindex 917586bc..7688592b 100644--- a/public/r/styles/default/dock.json+++ b/public/r/styles/default/dock.json@@ -7,7 +7,7 @@"files": [{"path": "magicui/dock.tsx",- "content": "\"use client\";\n\nimport React, { PropsWithChildren, useRef } from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { motion, useMotionValue, useSpring, useTransform } from \"framer-motion\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport interface DockProps extends VariantProps<typeof dockVariants> {\n className?: string;\n magnification?: number;\n distance?: number;\n direction?: \"top\" | \"middle\" | \"bottom\";\n children: React.ReactNode;\n}\n\nconst DEFAULT_MAGNIFICATION = 60;\nconst DEFAULT_DISTANCE = 140;\n\nconst dockVariants = cva(\n \"mx-auto w-max mt-8 h-[58px] p-2 flex gap-2 rounded-2xl border supports-backdrop-blur:bg-white/10 supports-backdrop-blur:dark:bg-black/10 backdrop-blur-md\",\n);\n\nconst Dock = React.forwardRef<HTMLDivElement, DockProps>(\n (\n {\n className,\n children,\n magnification = DEFAULT_MAGNIFICATION,\n distance = DEFAULT_DISTANCE,\n direction = \"bottom\",\n ...props\n },\n ref,\n ) => {\n const mouseX = useMotionValue(Infinity);\n\n const renderChildren = () => {\n return React.Children.map(children, (child: any) => {\n return React.cloneElement(child, {\n mouseX: mouseX,\n magnification: magnification,\n distance: distance,\n });\n });\n };\n\n return (\n <motion.div\n ref={ref}\n onMouseMove={(e) => mouseX.set(e.pageX)}\n onMouseLeave={() => mouseX.set(Infinity)}\n {...props}\n className={cn(dockVariants({ className }), {\n \"items-start\": direction === \"top\",\n \"items-center\": direction === \"middle\",\n \"items-end\": direction === \"bottom\",\n })}\n >\n {renderChildren()}\n </motion.div>\n );\n },\n);\n\nDock.displayName = \"Dock\";\n\nexport interface DockIconProps {\n size?: number;\n magnification?: number;\n distance?: number;\n mouseX?: any;\n className?: string;\n children?: React.ReactNode;\n props?: PropsWithChildren;\n}\n\nconst DockIcon = ({\n size,\n magnification = DEFAULT_MAGNIFICATION,\n distance = DEFAULT_DISTANCE,\n mouseX,\n className,\n children,\n ...props\n}: DockIconProps) => {\n const ref = useRef<HTMLDivElement>(null);\n\n const distanceCalc = useTransform(mouseX, (val: number) => {\n const bounds = ref.current?.getBoundingClientRect() ?? { x: 0, width: 0 };\n\n return val - bounds.x - bounds.width / 2;\n });\n\n let widthSync = useTransform(\n distanceCalc,\n [-distance, 0, distance],\n [40, magnification, 40],\n );\n\n let width = useSpring(widthSync, {\n mass: 0.1,\n stiffness: 150,\n damping: 12,\n });\n\n return (\n <motion.div\n ref={ref}\n style={{ width }}\n className={cn(\n \"flex aspect-square cursor-pointer items-center justify-center rounded-full\",\n className,\n )}\n {...props}\n >\n {children}\n </motion.div>\n );\n};\n\nDockIcon.displayName = \"DockIcon\";\n\nexport { Dock, DockIcon, dockVariants };\n",+ "content": "\"use client\";\n\nimport React, { PropsWithChildren, useRef } from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { motion, useMotionValue, useSpring, useTransform } from \"framer-motion\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport interface DockProps extends VariantProps<typeof dockVariants> {\n className?: string;\n magnification?: number;\n distance?: number;\n direction?: \"top\" | \"middle\" | \"bottom\";\n children: React.ReactNode;\n}\n\nconst DEFAULT_MAGNIFICATION = 60;\nconst DEFAULT_DISTANCE = 140;\n\nconst dockVariants = cva(\n \"supports-backdrop-blur:bg-white/10 supports-backdrop-blur:dark:bg-black/10 mx-auto mt-8 flex h-[58px] w-max gap-2 rounded-2xl border p-2 backdrop-blur-md\",\n);\n\nconst Dock = React.forwardRef<HTMLDivElement, DockProps>(\n (\n {\n className,\n children,\n magnification = DEFAULT_MAGNIFICATION,\n distance = DEFAULT_DISTANCE,\n direction = \"bottom\",\n ...props\n },\n ref,\n ) => {\n const mouseX = useMotionValue(Infinity);\n\n const renderChildren = () => {\n return React.Children.map(children, (child) => {\n if (React.isValidElement(child) && child.type === DockIcon) {\n return React.cloneElement(child, {\n ...child.props,\n mouseX: mouseX,\n magnification: magnification,\n distance: distance,\n });\n }\n return child;\n });\n };\n\n return (\n <motion.div\n ref={ref}\n onMouseMove={(e) => mouseX.set(e.pageX)}\n onMouseLeave={() => mouseX.set(Infinity)}\n {...props}\n className={cn(dockVariants({ className }), {\n \"items-start\": direction === \"top\",\n \"items-center\": direction === \"middle\",\n \"items-end\": direction === \"bottom\",\n })}\n >\n {renderChildren()}\n </motion.div>\n );\n },\n);\n\nDock.displayName = \"Dock\";\n\nexport interface DockIconProps {\n size?: number;\n magnification?: number;\n distance?: number;\n mouseX?: any;\n className?: string;\n children?: React.ReactNode;\n props?: PropsWithChildren;\n}\n\nconst DockIcon = ({\n size,\n magnification = DEFAULT_MAGNIFICATION,\n distance = DEFAULT_DISTANCE,\n mouseX,\n className,\n children,\n ...props\n}: DockIconProps) => {\n const ref = useRef<HTMLDivElement>(null);\n\n const distanceCalc = useTransform(mouseX, (val: number) => {\n const bounds = ref.current?.getBoundingClientRect() ?? { x: 0, width: 0 };\n\n return val - bounds.x - bounds.width / 2;\n });\n\n const widthSync = useTransform(\n distanceCalc,\n [-distance, 0, distance],\n [40, magnification, 40],\n );\n\n const width = useSpring(widthSync, {\n mass: 0.1,\n stiffness: 150,\n damping: 12,\n });\n\n return (\n <motion.div\n ref={ref}\n style={{ width }}\n className={cn(\n \"flex aspect-square cursor-pointer items-center justify-center rounded-full\",\n className,\n )}\n {...props}\n >\n {children}\n </motion.div>\n );\n};\n\nDockIcon.displayName = \"DockIcon\";\n\nexport { Dock, DockIcon, dockVariants };\n","type": "registry:ui","target": ""}diff --git a/public/r/styles/default/flip-text.json b/public/r/styles/default/flip-text.jsonindex bfe7b10c..36acf6ec 100644--- a/public/r/styles/default/flip-text.json+++ b/public/r/styles/default/flip-text.json@@ -7,7 +7,7 @@"files": [{"path": "magicui/flip-text.tsx",- "content": "\"use client\";\n\nimport { AnimatePresence, motion, Variants } from \"framer-motion\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface SlightFlipProps {\n word: string;\n duration?: number;\n delayMultiple?: number;\n framerProps?: Variants;\n className?: string;\n}\n\nexport default function SlightFlip({\n word,\n duration = 0.5,\n delayMultiple = 0.08,\n framerProps = {\n hidden: { rotateX: -90, opacity: 0 },\n visible: { rotateX: 0, opacity: 1 },\n },\n className,\n}: SlightFlipProps) {\n return (\n <div className=\"flex justify-center space-x-2\">\n <AnimatePresence mode=\"wait\">\n {word.split(\"\").map((char, i) => (\n <motion.span\n key={i}\n initial=\"hidden\"\n animate=\"visible\"\n exit=\"hidden\"\n variants={framerProps}\n transition={{ duration, delay: i * delayMultiple }}\n className={cn(\"origin-center drop-shadow-sm\", className)}\n >\n {char}\n </motion.span>\n ))}\n </AnimatePresence>\n </div>\n );\n}\n",+ "content": "\"use client\";\n\nimport { AnimatePresence, motion, Variants } from \"framer-motion\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface FlipTextProps {\n word: string;\n duration?: number;\n delayMultiple?: number;\n framerProps?: Variants;\n className?: string;\n}\n\nexport default function FlipText({\n word,\n duration = 0.5,\n delayMultiple = 0.08,\n framerProps = {\n hidden: { rotateX: -90, opacity: 0 },\n visible: { rotateX: 0, opacity: 1 },\n },\n className,\n}: FlipTextProps) {\n return (\n <div className=\"flex justify-center space-x-2\">\n <AnimatePresence mode=\"wait\">\n {word.split(\"\").map((char, i) => (\n <motion.span\n key={i}\n initial=\"hidden\"\n animate=\"visible\"\n exit=\"hidden\"\n variants={framerProps}\n transition={{ duration, delay: i * delayMultiple }}\n className={cn(\"origin-center drop-shadow-sm\", className)}\n >\n {char}\n </motion.span>\n ))}\n </AnimatePresence>\n </div>\n );\n}\n","type": "registry:ui","target": ""}diff --git a/public/r/styles/default/grid-pattern.json b/public/r/styles/default/grid-pattern.jsonindex 125140aa..e0b1b053 100644--- a/public/r/styles/default/grid-pattern.json+++ b/public/r/styles/default/grid-pattern.json@@ -4,7 +4,7 @@"files": [{"path": "magicui/grid-pattern.tsx",- "content": "import { useId } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface GridPatternProps {\n width?: any;\n height?: any;\n x?: any;\n y?: any;\n squares?: Array<[x: number, y: number]>;\n strokeDasharray?: any;\n className?: string;\n [key: string]: any;\n}\n\nexport function GridPattern({\n width = 40,\n height = 40,\n x = -1,\n y = -1,\n strokeDasharray = 0,\n squares,\n className,\n ...props\n}: GridPatternProps) {\n const id = useId();\n\n return (\n <svg\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute inset-0 h-full w-full fill-gray-400/30 stroke-gray-400/30\",\n className,\n )}\n {...props}\n >\n <defs>\n <pattern\n id={id}\n width={width}\n height={height}\n patternUnits=\"userSpaceOnUse\"\n x={x}\n y={y}\n >\n <path\n d={`M.5 ${height}V.5H${width}`}\n fill=\"none\"\n strokeDasharray={strokeDasharray}\n />\n </pattern>\n </defs>\n <rect width=\"100%\" height=\"100%\" strokeWidth={0} fill={`url(#${id})`} />\n {squares && (\n <svg x={x} y={y} className=\"overflow-visible\">\n {squares.map(([x, y]) => (\n <rect\n strokeWidth=\"0\"\n key={`${x}-${y}`}\n width={width - 1}\n height={height - 1}\n x={x * width + 1}\n y={y * height + 1}\n />\n ))}\n </svg>\n )}\n </svg>\n );\n}\n\nexport default GridPattern;\n",+ "content": "import { useId } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface GridPatternProps {\n width?: number;\n height?: number;\n x?: number;\n y?: number;\n squares?: Array<[x: number, y: number]>;\n strokeDasharray?: string;\n className?: string;\n [key: string]: unknown;\n}\n\nexport function GridPattern({\n width = 40,\n height = 40,\n x = -1,\n y = -1,\n strokeDasharray = \"0\",\n squares,\n className,\n ...props\n}: GridPatternProps) {\n const id = useId();\n\n return (\n <svg\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute inset-0 h-full w-full fill-gray-400/30 stroke-gray-400/30\",\n className,\n )}\n {...props}\n >\n <defs>\n <pattern\n id={id}\n width={width}\n height={height}\n patternUnits=\"userSpaceOnUse\"\n x={x}\n y={y}\n >\n <path\n d={`M.5 ${height}V.5H${width}`}\n fill=\"none\"\n strokeDasharray={strokeDasharray}\n />\n </pattern>\n </defs>\n <rect width=\"100%\" height=\"100%\" strokeWidth={0} fill={`url(#${id})`} />\n {squares && (\n <svg x={x} y={y} className=\"overflow-visible\">\n {squares.map(([x, y]) => (\n <rect\n strokeWidth=\"0\"\n key={`${x}-${y}`}\n width={width - 1}\n height={height - 1}\n x={x * width + 1}\n y={y * height + 1}\n />\n ))}\n </svg>\n )}\n </svg>\n );\n}\n\nexport default GridPattern;\n","type": "registry:ui","target": ""}diff --git a/public/r/styles/default/meteors.json b/public/r/styles/default/meteors.jsonindex 6caba146..e4c1ab23 100644--- a/public/r/styles/default/meteors.json+++ b/public/r/styles/default/meteors.json@@ -8,5 +8,31 @@"type": "registry:ui","target": ""}- ]+ ],+ "tailwind": {+ "config": {+ "theme": {+ "extend": {+ "animation": {+ "meteor": "meteor 5s linear infinite"+ },+ "keyframes": {+ "meteor": {+ "0%": {+ "transform": "rotate(215deg) translateX(0)",+ "opacity": "1"+ },+ "70%": {+ "opacity": "1"+ },+ "100%": {+ "transform": "rotate(215deg) translateX(-500px)",+ "opacity": "0"+ }+ }+ }+ }+ }+ }+ }}\ No newline at end of filediff --git a/public/r/styles/default/particles.json b/public/r/styles/default/particles.jsonindex 391a0e39..bdfb6201 100644--- a/public/r/styles/default/particles.json+++ b/public/r/styles/default/particles.json@@ -4,7 +4,7 @@"files": [{"path": "magicui/particles.tsx",- "content": "\"use client\";\n\nimport React, { useEffect, useRef, useState } from \"react\";\n\ninterface MousePosition {\n x: number;\n y: number;\n}\n\nfunction MousePosition(): MousePosition {\n const [mousePosition, setMousePosition] = useState<MousePosition>({\n x: 0,\n y: 0,\n });\n\n useEffect(() => {\n const handleMouseMove = (event: MouseEvent) => {\n setMousePosition({ x: event.clientX, y: event.clientY });\n };\n\n window.addEventListener(\"mousemove\", handleMouseMove);\n\n return () => {\n window.removeEventListener(\"mousemove\", handleMouseMove);\n };\n }, []);\n\n return mousePosition;\n}\n\ninterface ParticlesProps {\n className?: string;\n quantity?: number;\n staticity?: number;\n ease?: number;\n size?: number;\n refresh?: boolean;\n color?: string;\n vx?: number;\n vy?: number;\n}\nfunction hexToRgb(hex: string): number[] {\n hex = hex.replace(\"#\", \"\");\n\n if (hex.length === 3) {\n hex = hex\n .split(\"\")\n .map((char) => char + char)\n .join(\"\");\n }\n\n const hexInt = parseInt(hex, 16);\n const red = (hexInt >> 16) & 255;\n const green = (hexInt >> 8) & 255;\n const blue = hexInt & 255;\n return [red, green, blue];\n}\n\nconst Particles: React.FC<ParticlesProps> = ({\n className = \"\",\n quantity = 100,\n staticity = 50,\n ease = 50,\n size = 0.4,\n refresh = false,\n color = \"#ffffff\",\n vx = 0,\n vy = 0,\n}) => {\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const canvasContainerRef = useRef<HTMLDivElement>(null);\n const context = useRef<CanvasRenderingContext2D | null>(null);\n const circles = useRef<Circle[]>([]);\n const mousePosition = MousePosition();\n const mouse = useRef<{ x: number; y: number }>({ x: 0, y: 0 });\n const canvasSize = useRef<{ w: number; h: number }>({ w: 0, h: 0 });\n const dpr = typeof window !== \"undefined\" ? window.devicePixelRatio : 1;\n\n useEffect(() => {\n if (canvasRef.current) {\n context.current = canvasRef.current.getContext(\"2d\");\n }\n initCanvas();\n animate();\n window.addEventListener(\"resize\", initCanvas);\n\n return () => {\n window.removeEventListener(\"resize\", initCanvas);\n };\n }, [color]);\n\n useEffect(() => {\n onMouseMove();\n }, [mousePosition.x, mousePosition.y]);\n\n useEffect(() => {\n initCanvas();\n }, [refresh]);\n\n const initCanvas = () => {\n resizeCanvas();\n drawParticles();\n };\n\n const onMouseMove = () => {\n if (canvasRef.current) {\n const rect = canvasRef.current.getBoundingClientRect();\n const { w, h } = canvasSize.current;\n const x = mousePosition.x - rect.left - w / 2;\n const y = mousePosition.y - rect.top - h / 2;\n const inside = x < w / 2 && x > -w / 2 && y < h / 2 && y > -h / 2;\n if (inside) {\n mouse.current.x = x;\n mouse.current.y = y;\n }\n }\n };\n\n type Circle = {\n x: number;\n y: number;\n translateX: number;\n translateY: number;\n size: number;\n alpha: number;\n targetAlpha: number;\n dx: number;\n dy: number;\n magnetism: number;\n };\n\n const resizeCanvas = () => {\n if (canvasContainerRef.current && canvasRef.current && context.current) {\n circles.current.length = 0;\n canvasSize.current.w = canvasContainerRef.current.offsetWidth;\n canvasSize.current.h = canvasContainerRef.current.offsetHeight;\n canvasRef.current.width = canvasSize.current.w * dpr;\n canvasRef.current.height = canvasSize.current.h * dpr;\n canvasRef.current.style.width = `${canvasSize.current.w}px`;\n canvasRef.current.style.height = `${canvasSize.current.h}px`;\n context.current.scale(dpr, dpr);\n }\n };\n\n const circleParams = (): Circle => {\n const x = Math.floor(Math.random() * canvasSize.current.w);\n const y = Math.floor(Math.random() * canvasSize.current.h);\n const translateX = 0;\n const translateY = 0;\n const pSize = Math.floor(Math.random() * 2) + size;\n const alpha = 0;\n const targetAlpha = parseFloat((Math.random() * 0.6 + 0.1).toFixed(1));\n const dx = (Math.random() - 0.5) * 0.1;\n const dy = (Math.random() - 0.5) * 0.1;\n const magnetism = 0.1 + Math.random() * 4;\n return {\n x,\n y,\n translateX,\n translateY,\n size: pSize,\n alpha,\n targetAlpha,\n dx,\n dy,\n magnetism,\n };\n };\n\n const rgb = hexToRgb(color);\n\n const drawCircle = (circle: Circle, update = false) => {\n if (context.current) {\n const { x, y, translateX, translateY, size, alpha } = circle;\n context.current.translate(translateX, translateY);\n context.current.beginPath();\n context.current.arc(x, y, size, 0, 2 * Math.PI);\n context.current.fillStyle = `rgba(${rgb.join(\", \")}, ${alpha})`;\n context.current.fill();\n context.current.setTransform(dpr, 0, 0, dpr, 0, 0);\n\n if (!update) {\n circles.current.push(circle);\n }\n }\n };\n\n const clearContext = () => {\n if (context.current) {\n context.current.clearRect(\n 0,\n 0,\n canvasSize.current.w,\n canvasSize.current.h,\n );\n }\n };\n\n const drawParticles = () => {\n clearContext();\n const particleCount = quantity;\n for (let i = 0; i < particleCount; i++) {\n const circle = circleParams();\n drawCircle(circle);\n }\n };\n\n const remapValue = (\n value: number,\n start1: number,\n end1: number,\n start2: number,\n end2: number,\n ): number => {\n const remapped =\n ((value - start1) * (end2 - start2)) / (end1 - start1) + start2;\n return remapped > 0 ? remapped : 0;\n };\n\n const animate = () => {\n clearContext();\n circles.current.forEach((circle: Circle, i: number) => {\n // Handle the alpha value\n const edge = [\n circle.x + circle.translateX - circle.size, // distance from left edge\n canvasSize.current.w - circle.x - circle.translateX - circle.size, // distance from right edge\n circle.y + circle.translateY - circle.size, // distance from top edge\n canvasSize.current.h - circle.y - circle.translateY - circle.size, // distance from bottom edge\n ];\n const closestEdge = edge.reduce((a, b) => Math.min(a, b));\n const remapClosestEdge = parseFloat(\n remapValue(closestEdge, 0, 20, 0, 1).toFixed(2),\n );\n if (remapClosestEdge > 1) {\n circle.alpha += 0.02;\n if (circle.alpha > circle.targetAlpha) {\n circle.alpha = circle.targetAlpha;\n }\n } else {\n circle.alpha = circle.targetAlpha * remapClosestEdge;\n }\n circle.x += circle.dx + vx;\n circle.y += circle.dy + vy;\n circle.translateX +=\n (mouse.current.x / (staticity / circle.magnetism) - circle.translateX) /\n ease;\n circle.translateY +=\n (mouse.current.y / (staticity / circle.magnetism) - circle.translateY) /\n ease;\n\n drawCircle(circle, true);\n\n // circle gets out of the canvas\n if (\n circle.x < -circle.size ||\n circle.x > canvasSize.current.w + circle.size ||\n circle.y < -circle.size ||\n circle.y > canvasSize.current.h + circle.size\n ) {\n // remove the circle from the array\n circles.current.splice(i, 1);\n // create a new circle\n const newCircle = circleParams();\n drawCircle(newCircle);\n // update the circle position\n }\n });\n window.requestAnimationFrame(animate);\n };\n\n return (\n <div className={className} ref={canvasContainerRef} aria-hidden=\"true\">\n <canvas ref={canvasRef} className=\"size-full\" />\n </div>\n );\n};\n\nexport default Particles;\n",+ "content": "\"use client\";\n\nimport { cn } from \"@/lib/utils\";\nimport React, { useEffect, useRef, useState } from \"react\";\n\ninterface MousePosition {\n x: number;\n y: number;\n}\n\nfunction MousePosition(): MousePosition {\n const [mousePosition, setMousePosition] = useState<MousePosition>({\n x: 0,\n y: 0,\n });\n\n useEffect(() => {\n const handleMouseMove = (event: MouseEvent) => {\n setMousePosition({ x: event.clientX, y: event.clientY });\n };\n\n window.addEventListener(\"mousemove\", handleMouseMove);\n\n return () => {\n window.removeEventListener(\"mousemove\", handleMouseMove);\n };\n }, []);\n\n return mousePosition;\n}\n\ninterface ParticlesProps {\n className?: string;\n quantity?: number;\n staticity?: number;\n ease?: number;\n size?: number;\n refresh?: boolean;\n color?: string;\n vx?: number;\n vy?: number;\n}\nfunction hexToRgb(hex: string): number[] {\n hex = hex.replace(\"#\", \"\");\n\n if (hex.length === 3) {\n hex = hex\n .split(\"\")\n .map((char) => char + char)\n .join(\"\");\n }\n\n const hexInt = parseInt(hex, 16);\n const red = (hexInt >> 16) & 255;\n const green = (hexInt >> 8) & 255;\n const blue = hexInt & 255;\n return [red, green, blue];\n}\n\nconst Particles: React.FC<ParticlesProps> = ({\n className = \"\",\n quantity = 100,\n staticity = 50,\n ease = 50,\n size = 0.4,\n refresh = false,\n color = \"#ffffff\",\n vx = 0,\n vy = 0,\n}) => {\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const canvasContainerRef = useRef<HTMLDivElement>(null);\n const context = useRef<CanvasRenderingContext2D | null>(null);\n const circles = useRef<Circle[]>([]);\n const mousePosition = MousePosition();\n const mouse = useRef<{ x: number; y: number }>({ x: 0, y: 0 });\n const canvasSize = useRef<{ w: number; h: number }>({ w: 0, h: 0 });\n const dpr = typeof window !== \"undefined\" ? window.devicePixelRatio : 1;\n const rafID = useRef<number | null>(null);\n\n useEffect(() => {\n if (canvasRef.current) {\n context.current = canvasRef.current.getContext(\"2d\");\n }\n initCanvas();\n animate();\n window.addEventListener(\"resize\", initCanvas);\n\n return () => {\n if (rafID.current != null) {\n window.cancelAnimationFrame(rafID.current);\n }\n window.removeEventListener(\"resize\", initCanvas);\n };\n }, [color]);\n\n useEffect(() => {\n onMouseMove();\n }, [mousePosition.x, mousePosition.y]);\n\n useEffect(() => {\n initCanvas();\n }, [refresh]);\n\n const initCanvas = () => {\n resizeCanvas();\n drawParticles();\n };\n\n const onMouseMove = () => {\n if (canvasRef.current) {\n const rect = canvasRef.current.getBoundingClientRect();\n const { w, h } = canvasSize.current;\n const x = mousePosition.x - rect.left - w / 2;\n const y = mousePosition.y - rect.top - h / 2;\n const inside = x < w / 2 && x > -w / 2 && y < h / 2 && y > -h / 2;\n if (inside) {\n mouse.current.x = x;\n mouse.current.y = y;\n }\n }\n };\n\n type Circle = {\n x: number;\n y: number;\n translateX: number;\n translateY: number;\n size: number;\n alpha: number;\n targetAlpha: number;\n dx: number;\n dy: number;\n magnetism: number;\n };\n\n const resizeCanvas = () => {\n if (canvasContainerRef.current && canvasRef.current && context.current) {\n circles.current.length = 0;\n canvasSize.current.w = canvasContainerRef.current.offsetWidth;\n canvasSize.current.h = canvasContainerRef.current.offsetHeight;\n canvasRef.current.width = canvasSize.current.w * dpr;\n canvasRef.current.height = canvasSize.current.h * dpr;\n canvasRef.current.style.width = `${canvasSize.current.w}px`;\n canvasRef.current.style.height = `${canvasSize.current.h}px`;\n context.current.scale(dpr, dpr);\n }\n };\n\n const circleParams = (): Circle => {\n const x = Math.floor(Math.random() * canvasSize.current.w);\n const y = Math.floor(Math.random() * canvasSize.current.h);\n const translateX = 0;\n const translateY = 0;\n const pSize = Math.floor(Math.random() * 2) + size;\n const alpha = 0;\n const targetAlpha = parseFloat((Math.random() * 0.6 + 0.1).toFixed(1));\n const dx = (Math.random() - 0.5) * 0.1;\n const dy = (Math.random() - 0.5) * 0.1;\n const magnetism = 0.1 + Math.random() * 4;\n return {\n x,\n y,\n translateX,\n translateY,\n size: pSize,\n alpha,\n targetAlpha,\n dx,\n dy,\n magnetism,\n };\n };\n\n const rgb = hexToRgb(color);\n\n const drawCircle = (circle: Circle, update = false) => {\n if (context.current) {\n const { x, y, translateX, translateY, size, alpha } = circle;\n context.current.translate(translateX, translateY);\n context.current.beginPath();\n context.current.arc(x, y, size, 0, 2 * Math.PI);\n context.current.fillStyle = `rgba(${rgb.join(\", \")}, ${alpha})`;\n context.current.fill();\n context.current.setTransform(dpr, 0, 0, dpr, 0, 0);\n\n if (!update) {\n circles.current.push(circle);\n }\n }\n };\n\n const clearContext = () => {\n if (context.current) {\n context.current.clearRect(\n 0,\n 0,\n canvasSize.current.w,\n canvasSize.current.h,\n );\n }\n };\n\n const drawParticles = () => {\n clearContext();\n const particleCount = quantity;\n for (let i = 0; i < particleCount; i++) {\n const circle = circleParams();\n drawCircle(circle);\n }\n };\n\n const remapValue = (\n value: number,\n start1: number,\n end1: number,\n start2: number,\n end2: number,\n ): number => {\n const remapped =\n ((value - start1) * (end2 - start2)) / (end1 - start1) + start2;\n return remapped > 0 ? remapped : 0;\n };\n\n const animate = () => {\n clearContext();\n circles.current.forEach((circle: Circle, i: number) => {\n // Handle the alpha value\n const edge = [\n circle.x + circle.translateX - circle.size, // distance from left edge\n canvasSize.current.w - circle.x - circle.translateX - circle.size, // distance from right edge\n circle.y + circle.translateY - circle.size, // distance from top edge\n canvasSize.current.h - circle.y - circle.translateY - circle.size, // distance from bottom edge\n ];\n const closestEdge = edge.reduce((a, b) => Math.min(a, b));\n const remapClosestEdge = parseFloat(\n remapValue(closestEdge, 0, 20, 0, 1).toFixed(2),\n );\n if (remapClosestEdge > 1) {\n circle.alpha += 0.02;\n if (circle.alpha > circle.targetAlpha) {\n circle.alpha = circle.targetAlpha;\n }\n } else {\n circle.alpha = circle.targetAlpha * remapClosestEdge;\n }\n circle.x += circle.dx + vx;\n circle.y += circle.dy + vy;\n circle.translateX +=\n (mouse.current.x / (staticity / circle.magnetism) - circle.translateX) /\n ease;\n circle.translateY +=\n (mouse.current.y / (staticity / circle.magnetism) - circle.translateY) /\n ease;\n\n drawCircle(circle, true);\n\n // circle gets out of the canvas\n if (\n circle.x < -circle.size ||\n circle.x > canvasSize.current.w + circle.size ||\n circle.y < -circle.size ||\n circle.y > canvasSize.current.h + circle.size\n ) {\n // remove the circle from the array\n circles.current.splice(i, 1);\n // create a new circle\n const newCircle = circleParams();\n drawCircle(newCircle);\n // update the circle position\n }\n });\n rafID.current = window.requestAnimationFrame(animate);\n };\n\n return (\n <div\n className={cn(\"pointer-events-none\", className)}\n ref={canvasContainerRef}\n aria-hidden=\"true\"\n >\n <canvas ref={canvasRef} className=\"size-full\" />\n </div>\n );\n};\n\nexport default Particles;\n","type": "registry:ui","target": ""}diff --git a/public/r/styles/default/rainbow-button.json b/public/r/styles/default/rainbow-button.jsonindex 3fedddc7..528ac8c9 100644--- a/public/r/styles/default/rainbow-button.json+++ b/public/r/styles/default/rainbow-button.json@@ -4,7 +4,7 @@"files": [{"path": "magicui/rainbow-button.tsx",- "content": "import React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface RainbowButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {}\n\nexport function RainbowButton({ children, ...props }: RainbowButtonProps) {\n return (\n <button\n className={cn(\n \"h-11 px-8 py-2 inline-flex items-center justify-center rounded-xl font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 relative group animate-rainbow cursor-pointer border-0 bg-[length:200%] text-primary-foreground [background-clip:padding-box,border-box,border-box] [background-origin:border-box] [border:calc(0.08*1rem)_solid_transparent]\",\n\n // before styles\n \"before:absolute before:bottom-[-20%] before:left-1/2 before:z-0 before:h-1/5 before:w-3/5 before:-translate-x-1/2 before:animate-rainbow before:bg-[linear-gradient(90deg,hsl(var(--color-1)),hsl(var(--color-5)),hsl(var(--color-3)),hsl(var(--color-4)),hsl(var(--color-2)))] before:bg-[length:200%] before:[filter:blur(calc(0.8*1rem))]\",\n\n // light mode colors\n \"bg-[linear-gradient(#121213,#121213),linear-gradient(#121213_50%,rgba(18,18,19,0.6)_80%,rgba(18,18,19,0)),linear-gradient(90deg,hsl(var(--color-1)),hsl(var(--color-5)),hsl(var(--color-3)),hsl(var(--color-4)),hsl(var(--color-2)))]\",\n\n // dark mode colors\n \" dark:bg-[linear-gradient(#fff,#fff),linear-gradient(#fff_50%,rgba(255,255,255,0.6)_80%,rgba(0,0,0,0)),linear-gradient(90deg,hsl(var(--color-1)),hsl(var(--color-5)),hsl(var(--color-3)),hsl(var(--color-4)),hsl(var(--color-2)))]\",\n )}\n {...props}\n >\n {children}\n </button>\n );\n}\n",+ "content": "import React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\ninterface RainbowButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {}\n\nexport function RainbowButton({\n children,\n className,\n ...props\n}: RainbowButtonProps) {\n return (\n <button\n className={cn(\n \"group relative inline-flex h-11 animate-rainbow cursor-pointer items-center justify-center rounded-xl border-0 bg-[length:200%] px-8 py-2 font-medium text-primary-foreground transition-colors [background-clip:padding-box,border-box,border-box] [background-origin:border-box] [border:calc(0.08*1rem)_solid_transparent] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50\",\n\n // before styles\n \"before:absolute before:bottom-[-20%] before:left-1/2 before:z-0 before:h-1/5 before:w-3/5 before:-translate-x-1/2 before:animate-rainbow before:bg-[linear-gradient(90deg,hsl(var(--color-1)),hsl(var(--color-5)),hsl(var(--color-3)),hsl(var(--color-4)),hsl(var(--color-2)))] before:bg-[length:200%] before:[filter:blur(calc(0.8*1rem))]\",\n\n // light mode colors\n \"bg-[linear-gradient(#121213,#121213),linear-gradient(#121213_50%,rgba(18,18,19,0.6)_80%,rgba(18,18,19,0)),linear-gradient(90deg,hsl(var(--color-1)),hsl(var(--color-5)),hsl(var(--color-3)),hsl(var(--color-4)),hsl(var(--color-2)))]\",\n\n // dark mode colors\n \"dark:bg-[linear-gradient(#fff,#fff),linear-gradient(#fff_50%,rgba(255,255,255,0.6)_80%,rgba(0,0,0,0)),linear-gradient(90deg,hsl(var(--color-1)),hsl(var(--color-5)),hsl(var(--color-3)),hsl(var(--color-4)),hsl(var(--color-2)))]\",\n\n className,\n )}\n {...props}\n >\n {children}\n </button>\n );\n}\n","type": "registry:ui","target": ""}diff --git a/public/r/styles/default/ripple.json b/public/r/styles/default/ripple.jsonindex 86a2a729..be086362 100644--- a/public/r/styles/default/ripple.json+++ b/public/r/styles/default/ripple.json@@ -4,7 +4,7 @@"files": [{"path": "magicui/ripple.tsx",- "content": "import React, { CSSProperties } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface RippleProps {\n mainCircleSize?: number;\n mainCircleOpacity?: number;\n numCircles?: number;\n className?: string;\n}\n\nconst Ripple = React.memo(function Ripple({\n mainCircleSize = 210,\n mainCircleOpacity = 0.24,\n numCircles = 8,\n className,\n}: RippleProps) {\n return (\n <div\n className={cn(\n \"absolute inset-0 bg-white/5 [mask-image:linear-gradient(to_bottom,white,transparent)]\",\n className,\n )}\n >\n {Array.from({ length: numCircles }, (_, i) => {\n const size = mainCircleSize + i * 70;\n const opacity = mainCircleOpacity - i * 0.03;\n const animationDelay = `${i * 0.06}s`;\n const borderStyle = i === numCircles - 1 ? \"dashed\" : \"solid\";\n const borderOpacity = 5 + i * 5;\n\n return (\n <div\n key={i}\n className={`absolute animate-ripple rounded-full bg-foreground/25 shadow-xl border [--i:${i}]`}\n style={\n {\n width: `${size}px`,\n height: `${size}px`,\n opacity,\n animationDelay,\n borderStyle,\n borderWidth: \"1px\",\n borderColor: `hsl(var(--foreground), ${borderOpacity / 100})`,\n top: \"50%\",\n left: \"50%\",\n transform: \"translate(-50%, -50%) scale(1)\",\n } as CSSProperties\n }\n />\n );\n })}\n </div>\n );\n});\n\nRipple.displayName = \"Ripple\";\n\nexport default Ripple;\n",+ "content": "import React, { CSSProperties } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface RippleProps {\n mainCircleSize?: number;\n mainCircleOpacity?: number;\n numCircles?: number;\n className?: string;\n}\n\nconst Ripple = React.memo(function Ripple({\n mainCircleSize = 210,\n mainCircleOpacity = 0.24,\n numCircles = 8,\n className,\n}: RippleProps) {\n return (\n <div\n className={cn(\n \"pointer-events-none select-none absolute inset-0 [mask-image:linear-gradient(to_bottom,white,transparent)]\",\n className,\n )}\n >\n {Array.from({ length: numCircles }, (_, i) => {\n const size = mainCircleSize + i * 70;\n const opacity = mainCircleOpacity - i * 0.03;\n const animationDelay = `${i * 0.06}s`;\n const borderStyle = i === numCircles - 1 ? \"dashed\" : \"solid\";\n const borderOpacity = 5 + i * 5;\n\n return (\n <div\n key={i}\n className={`absolute animate-ripple rounded-full bg-foreground/25 shadow-xl border [--i:${i}]`}\n style={\n {\n width: `${size}px`,\n height: `${size}px`,\n opacity,\n animationDelay,\n borderStyle,\n borderWidth: \"1px\",\n borderColor: `hsl(var(--foreground), ${borderOpacity / 100})`,\n top: \"50%\",\n left: \"50%\",\n transform: \"translate(-50%, -50%) scale(1)\",\n } as CSSProperties\n }\n />\n );\n })}\n </div>\n );\n});\n\nRipple.displayName = \"Ripple\";\n\nexport default Ripple;\n","type": "registry:ui","target": ""}diff --git a/public/r/styles/default/shine-border.json b/public/r/styles/default/shine-border.jsonindex 1ae43101..7de0e015 100644--- a/public/r/styles/default/shine-border.json+++ b/public/r/styles/default/shine-border.json@@ -4,7 +4,7 @@"files": [{"path": "magicui/shine-border.tsx",- "content": "\"use client\";\n\nimport { cn } from \"@/lib/utils\";\n\ntype TColorProp = string | string[];\n\ninterface ShineBorderProps {\n borderRadius?: number;\n borderWidth?: number;\n duration?: number;\n color?: TColorProp;\n className?: string;\n children: React.ReactNode;\n}\n\n/**\n * @name Shine Border\n * @description It is an animated background border effect component with easy to use and configurable props.\n * @param borderRadius defines the radius of the border.\n * @param borderWidth defines the width of the border.\n * @param duration defines the animation duration to be applied on the shining border\n * @param color a string or string array to define border color.\n * @param className defines the class name to be applied to the component\n * @param children contains react node elements.\n */\nexport default function ShineBorder({\n borderRadius = 8,\n borderWidth = 1,\n duration = 14,\n color = \"#000000\",\n className,\n children,\n}: ShineBorderProps) {\n return (\n <div\n style={\n {\n \"--border-radius\": `${borderRadius}px`,\n } as React.CSSProperties\n }\n className={cn(\n \"relative grid min-h-[60px] w-fit min-w-[300px] place-items-center rounded-[--border-radius] bg-white p-3 text-black dark:bg-black dark:text-white\",\n className,\n )}\n >\n <div\n style={\n {\n \"--border-width\": `${borderWidth}px`,\n \"--border-radius\": `${borderRadius}px`,\n \"--duration\": `${duration}s`,\n \"--mask-linear-gradient\": `linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)`,\n \"--background-radial-gradient\": `radial-gradient(transparent,transparent, ${color instanceof Array ? color.join(\",\") : color},transparent,transparent)`,\n } as React.CSSProperties\n }\n className={`before:bg-shine-size before:absolute before:inset-0 before:aspect-square before:size-full before:rounded-[--border-radius] before:p-[--border-width] before:will-change-[background-position] before:content-[\"\"] before:![-webkit-mask-composite:xor] before:![mask-composite:exclude] before:[background-image:--background-radial-gradient] before:[background-size:300%_300%] before:[mask:--mask-linear-gradient] motion-safe:before:animate-shine`}\n ></div>\n {children}\n </div>\n );\n}\n",+ "content": "\"use client\";\n\nimport { cn } from \"@/lib/utils\";\n\ntype TColorProp = string | string[];\n\ninterface ShineBorderProps {\n borderRadius?: number;\n borderWidth?: number;\n duration?: number;\n color?: TColorProp;\n className?: string;\n children: React.ReactNode;\n}\n\n/**\n * @name Shine Border\n * @description It is an animated background border effect component with easy to use and configurable props.\n * @param borderRadius defines the radius of the border.\n * @param borderWidth defines the width of the border.\n * @param duration defines the animation duration to be applied on the shining border\n * @param color a string or string array to define border color.\n * @param className defines the class name to be applied to the component\n * @param children contains react node elements.\n */\nexport default function ShineBorder({\n borderRadius = 8,\n borderWidth = 1,\n duration = 14,\n color = \"#000000\",\n className,\n children,\n}: ShineBorderProps) {\n return (\n <div\n style={\n {\n \"--border-radius\": `${borderRadius}px`,\n } as React.CSSProperties\n }\n className={cn(\n \"relative grid min-h-[60px] w-fit min-w-[300px] place-items-center rounded-[--border-radius] bg-white p-3 text-black dark:bg-black dark:text-white\",\n className,\n )}\n >\n <div\n style={\n {\n \"--border-width\": `${borderWidth}px`,\n \"--border-radius\": `${borderRadius}px`,\n \"--duration\": `${duration}s`,\n \"--mask-linear-gradient\": `linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)`,\n \"--background-radial-gradient\": `radial-gradient(transparent,transparent, ${color instanceof Array ? color.join(\",\") : color},transparent,transparent)`,\n } as React.CSSProperties\n }\n className={`pointer-events-none before:bg-shine-size before:absolute before:inset-0 before:aspect-square before:size-full before:rounded-[--border-radius] before:p-[--border-width] before:will-change-[background-position] before:content-[\"\"] before:![-webkit-mask-composite:xor] before:![mask-composite:exclude] before:[background-image:--background-radial-gradient] before:[background-size:300%_300%] before:[mask:--mask-linear-gradient] motion-safe:before:animate-shine`}\n ></div>\n {children}\n </div>\n );\n}\n","type": "registry:ui","target": ""}diff --git a/public/r/styles/default/shiny-button.json b/public/r/styles/default/shiny-button.jsonindex f5af7323..0869648c 100644--- a/public/r/styles/default/shiny-button.json+++ b/public/r/styles/default/shiny-button.json@@ -7,7 +7,7 @@"files": [{"path": "magicui/shiny-button.tsx",- "content": "\"use client\";\n\nimport React from \"react\";\nimport { motion, type AnimationProps } from \"framer-motion\";\n\nimport { cn } from \"@/lib/utils\";\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;\ninterface ShinyButtonProps {\n children: React.ReactNode;\n className?: string;\n}\nconst ShinyButton = ({ children, className, ...props }: ShinyButtonProps) => {\n return (\n <motion.button\n {...animationProps}\n {...props}\n className={cn(\n \"relative rounded-lg px-6 py-2 font-medium backdrop-blur-xl transition-shadow duration-300 ease-in-out hover:shadow dark:bg-[radial-gradient(circle_at_50%_0%,hsl(var(--primary)/10%)_0%,transparent_60%)] dark:hover:shadow-[0_0_20px_hsl(var(--primary)/10%)]\",\n className,\n )}\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,hsl(var(--primary)) calc(var(--x) + 20%),transparent calc(var(--x) + 30%),hsl(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,linear-gradient(rgb(0,0,0), rgb(0,0,0))\",\n maskComposite: \"exclude\",\n }}\n className=\"absolute inset-0 z-10 block rounded-[inherit] bg-[linear-gradient(-75deg,hsl(var(--primary)/10%)_calc(var(--x)+20%),hsl(var(--primary)/50%)_calc(var(--x)+25%),hsl(var(--primary)/10%)_calc(var(--x)+100%))] p-px\"\n ></span>\n </motion.button>\n );\n};\n\nexport default ShinyButton;\n",+ "content": "\"use client\";\n\nimport React from \"react\";\nimport {\n motion,\n type AnimationProps,\n type HTMLMotionProps,\n} from \"framer-motion\";\nimport { cn } from \"@/lib/utils\";\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 extends HTMLMotionProps<\"button\"> {\n children: React.ReactNode;\n className?: string;\n}\n\nconst ShinyButton = React.forwardRef<HTMLButtonElement, ShinyButtonProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <motion.button\n ref={ref}\n {...animationProps}\n {...props}\n className={cn(\n \"relative rounded-lg px-6 py-2 font-medium backdrop-blur-xl transition-shadow duration-300 ease-in-out hover:shadow dark:bg-[radial-gradient(circle_at_50%_0%,hsl(var(--primary)/10%)_0%,transparent_60%)] dark:hover:shadow-[0_0_20px_hsl(var(--primary)/10%)]\",\n className,\n )}\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,hsl(var(--primary)) calc(var(--x) + 20%),transparent calc(var(--x) + 30%),hsl(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,linear-gradient(rgb(0,0,0), rgb(0,0,0))\",\n maskComposite: \"exclude\",\n }}\n className=\"absolute inset-0 z-10 block rounded-[inherit] bg-[linear-gradient(-75deg,hsl(var(--primary)/10%)_calc(var(--x)+20%),hsl(var(--primary)/50%)_calc(var(--x)+25%),hsl(var(--primary)/10%)_calc(var(--x)+100%))] p-px\"\n ></span>\n </motion.button>\n );\n },\n);\n\nShinyButton.displayName = \"ShinyButton\";\n\nexport default ShinyButton;\n","type": "registry:ui","target": ""}diff --git a/public/r/styles/default/text-reveal.json b/public/r/styles/default/text-reveal.jsonindex 5210084e..d2eb81dc 100644--- a/public/r/styles/default/text-reveal.json+++ b/public/r/styles/default/text-reveal.json@@ -7,7 +7,7 @@"files": [{"path": "magicui/text-reveal.tsx",- "content": "\"use client\";\n\nimport { FC, ReactNode, useRef } from \"react\";\nimport { motion, useScroll, useTransform } from \"framer-motion\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface TextRevealByWordProps {\n text: string;\n className?: string;\n}\n\nexport const TextRevealByWord: FC<TextRevealByWordProps> = ({\n text,\n className,\n}) => {\n const targetRef = useRef<HTMLDivElement | null>(null);\n\n const { scrollYProgress } = useScroll({\n target: targetRef,\n });\n const words = text.split(\" \");\n\n return (\n <div ref={targetRef} className={cn(\"relative z-0 h-[200vh]\", className)}>\n <div\n className={\n \"sticky top-0 mx-auto flex h-[50%] max-w-4xl items-center bg-transparent px-[1rem] py-[5rem]\"\n }\n >\n <p\n ref={targetRef}\n className={\n \"flex flex-wrap p-5 text-2xl font-bold text-black/20 dark:text-white/20 md:p-8 md:text-3xl lg:p-10 lg:text-4xl xl:text-5xl\"\n }\n >\n {words.map((word, i) => {\n const start = i / words.length;\n const end = start + 1 / words.length;\n return (\n <Word key={i} progress={scrollYProgress} range={[start, end]}>\n {word}\n </Word>\n );\n })}\n </p>\n </div>\n </div>\n );\n};\n\ninterface WordProps {\n children: ReactNode;\n progress: any;\n range: [number, number];\n}\n\nconst Word: FC<WordProps> = ({ children, progress, range }) => {\n const opacity = useTransform(progress, range, [0, 1]);\n return (\n <span className=\"xl:lg-3 relative mx-1 lg:mx-2.5\">\n <span className={\"absolute opacity-30\"}>{children}</span>\n <motion.span\n style={{ opacity: opacity }}\n className={\"text-black dark:text-white\"}\n >\n {children}\n </motion.span>\n </span>\n );\n};\n\nexport default TextRevealByWord;\n",+ "content": "\"use client\";\n\nimport { FC, ReactNode, useRef } from \"react\";\nimport { motion, MotionValue, useScroll, useTransform } from \"framer-motion\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface TextRevealByWordProps {\n text: string;\n className?: string;\n}\n\nexport const TextRevealByWord: FC<TextRevealByWordProps> = ({\n text,\n className,\n}) => {\n const targetRef = useRef<HTMLDivElement | null>(null);\n\n const { scrollYProgress } = useScroll({\n target: targetRef,\n });\n const words = text.split(\" \");\n\n return (\n <div ref={targetRef} className={cn(\"relative z-0 h-[200vh]\", className)}>\n <div\n className={\n \"sticky top-0 mx-auto flex h-[50%] max-w-4xl items-center bg-transparent px-[1rem] py-[5rem]\"\n }\n >\n <p\n ref={targetRef}\n className={\n \"flex flex-wrap p-5 text-2xl font-bold text-black/20 dark:text-white/20 md:p-8 md:text-3xl lg:p-10 lg:text-4xl xl:text-5xl\"\n }\n >\n {words.map((word, i) => {\n const start = i / words.length;\n const end = start + 1 / words.length;\n return (\n <Word key={i} progress={scrollYProgress} range={[start, end]}>\n {word}\n </Word>\n );\n })}\n </p>\n </div>\n </div>\n );\n};\n\ninterface WordProps {\n children: ReactNode;\n progress: MotionValue<number>;\n range: [number, number];\n}\n\nconst Word: FC<WordProps> = ({ children, progress, range }) => {\n const opacity = useTransform(progress, range, [0, 1]);\n return (\n <span className=\"xl:lg-3 relative mx-1 lg:mx-2.5\">\n <span className={\"absolute opacity-30\"}>{children}</span>\n <motion.span\n style={{ opacity: opacity }}\n className={\"text-black dark:text-white\"}\n >\n {children}\n </motion.span>\n </span>\n );\n};\n\nexport default TextRevealByWord;\n","type": "registry:ui","target": ""}diff --git a/public/r/styles/default/word-fade-in.json b/public/r/styles/default/word-fade-in.jsonindex 27a27022..703e7d0d 100644--- a/public/r/styles/default/word-fade-in.json+++ b/public/r/styles/default/word-fade-in.json@@ -7,7 +7,7 @@"files": [{"path": "magicui/word-fade-in.tsx",- "content": "\"use client\";\n\nimport { motion, Variants } from \"framer-motion\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface WordFadeInProps {\n words: string;\n className?: string;\n delay?: number;\n variants?: Variants;\n}\n\nexport default function WordFadeIn({\n words,\n delay = 0.15,\n variants = {\n hidden: { opacity: 0 },\n visible: (i: any) => ({\n y: 0,\n opacity: 1,\n transition: { delay: i * delay },\n }),\n },\n className,\n}: WordFadeInProps) {\n const _words = words.split(\" \");\n\n return (\n <motion.h1\n variants={variants}\n initial=\"hidden\"\n animate=\"visible\"\n className={cn(\n \"font-display text-center text-4xl font-bold tracking-[-0.02em] text-black drop-shadow-sm dark:text-white md:text-7xl md:leading-[5rem]\",\n className,\n )}\n >\n {_words.map((word, i) => (\n <motion.span key={word} variants={variants} custom={i}>\n {word}{\" \"}\n </motion.span>\n ))}\n </motion.h1>\n );\n}\n",+ "content": "\"use client\";\n\nimport { motion, Variants } from \"framer-motion\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface WordFadeInProps {\n words: string;\n className?: string;\n delay?: number;\n variants?: Variants;\n}\n\nexport default function WordFadeIn({\n words,\n delay = 0.15,\n variants = {\n hidden: { opacity: 0 },\n visible: (i: number) => ({\n y: 0,\n opacity: 1,\n transition: { delay: i * delay },\n }),\n },\n className,\n}: WordFadeInProps) {\n const _words = words.split(\" \");\n\n return (\n <motion.h1\n variants={variants}\n initial=\"hidden\"\n animate=\"visible\"\n className={cn(\n \"font-display text-center text-4xl font-bold tracking-[-0.02em] text-black drop-shadow-sm dark:text-white md:text-7xl md:leading-[5rem]\",\n className,\n )}\n >\n {_words.map((word, i) => (\n <motion.span key={word} variants={variants} custom={i}>\n {word}{\" \"}\n </motion.span>\n ))}\n </motion.h1>\n );\n}\n","type": "registry:ui","target": ""}diff --git a/registry/default/magicui/animated-grid-pattern.tsx b/registry/default/magicui/animated-grid-pattern.tsxindex b74dc0c5..0652f01b 100644--- a/registry/default/magicui/animated-grid-pattern.tsx+++ b/registry/default/magicui/animated-grid-pattern.tsx@@ -5,7 +5,7 @@ import { motion } from "framer-motion";import { cn } from "@/lib/utils";-interface GridPatternProps {+interface AnimatedGridPatternProps {width?: number;height?: number;x?: number;@@ -18,7 +18,7 @@ interface GridPatternProps {repeatDelay?: number;}-export function GridPattern({+export default function AnimatedGridPattern({width = 40,height = 40,x = -1,@@ -30,7 +30,7 @@ export function GridPattern({duration = 4,repeatDelay = 0.5,...props-}: GridPatternProps) {+}: AnimatedGridPatternProps) {const id = useId();const containerRef = useRef(null);const [dimensions, setDimensions] = useState({ width: 0, height: 0 });@@ -146,5 +146,3 @@ export function GridPattern({</svg>);}--export default GridPattern;