Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

feat: migrate framer-motion to motion (#481)

Dillion Verma93912ec41ac7
diff --git a/components/sidebar-nav.tsx b/components/sidebar-nav.tsx
index 7d90e578..5e8d3c7e 100644
--- a/components/sidebar-nav.tsx
+++ b/components/sidebar-nav.tsx
@@ -2,7 +2,7 @@
import { SidebarNavItem } from "@/types";
import { ExternalLinkIcon } from "@radix-ui/react-icons";
-import { motion } from "framer-motion";
+import { motion } from "motion/react";
import Link from "next/link";
import { usePathname } from "next/navigation";
import posthog from "posthog-js";
diff --git a/content/docs/components/fade-text.mdx b/content/docs/components/fade-text.mdx
index e27367d5..739ad7eb 100644
--- a/content/docs/components/fade-text.mdx
+++ b/content/docs/components/fade-text.mdx
@@ -42,9 +42,9 @@ npx shadcn@latest add "https://magicui.design/r/fade-text"
## Props
-| Prop | Type | Description | Default |
-| ----------- | --------------- | -------------------------------------------------- | ------- |
-| className | string | The class name to be applied to the component | |
-| direction | string | Can be: "down" , "left", "right", "up" | "up" |
-| text | string | Text to animate | "" |
-| framerProps | HTMLMotionProps | An object containing framer-motion animation props | {} |
+| Prop | Type | Description | Default |
+| ----------- | --------------- | --------------------------------------------- | ------- |
+| className | string | The class name to be applied to the component | |
+| direction | string | Can be: "down" , "left", "right", "up" | "up" |
+| text | string | Text to animate | "" |
+| motionProps | HTMLMotionProps | An object containing a motion animation props | {} |
diff --git a/content/docs/components/flip-text.mdx b/content/docs/components/flip-text.mdx
index 87aa9456..94175b2d 100644
--- a/content/docs/components/flip-text.mdx
+++ b/content/docs/components/flip-text.mdx
@@ -42,10 +42,10 @@ npx shadcn@latest add "https://magicui.design/r/flip-text"
## Props
-| Prop | Type | Description | Default |
-| ------------- | --------------- | -------------------------------------------------- | ------- |
-| className | string | The class name to be applied to the component | |
-| duration | number | Duration of the animation | 0.2 |
-| delayMultiple | number | Transition delay multiplier. | 0.08 |
-| word | string | An array of words to rotate through | "" |
-| framerProps | HTMLMotionProps | An object containing framer-motion animation props | {} |
+| Prop | Type | Description | Default |
+| ------------- | --------------- | --------------------------------------------- | ------- |
+| className | string | The class name to be applied to the component | |
+| duration | number | Duration of the animation | 0.2 |
+| delayMultiple | number | Transition delay multiplier. | 0.08 |
+| word | string | An array of words to rotate through | "" |
+| motionProps | HTMLMotionProps | An object containing motion animation props | {} |
diff --git a/content/docs/components/gradual-spacing.mdx b/content/docs/components/gradual-spacing.mdx
index 2647f455..b5b00120 100644
--- a/content/docs/components/gradual-spacing.mdx
+++ b/content/docs/components/gradual-spacing.mdx
@@ -42,10 +42,10 @@ npx shadcn@latest add "https://magicui.design/r/gradual-spacing"
## Props
-| Prop | Type | Description | Default |
-| ------------- | --------------- | -------------------------------------------------- | ------- |
-| className | string | The class name to be applied to the component | |
-| duration | number | Duration of the animation | 0.5 |
-| delayMultiple | number | Transition delay multiplier. | 0.1 |
-| text | string | An array of words to rotate through | "" |
-| framerProps | HTMLMotionProps | An object containing framer-motion animation props | {} |
+| Prop | Type | Description | Default |
+| ------------- | --------------- | --------------------------------------------- | ------- |
+| className | string | The class name to be applied to the component | |
+| duration | number | Duration of the animation | 0.5 |
+| delayMultiple | number | Transition delay multiplier. | 0.1 |
+| text | string | An array of words to rotate through | "" |
+| motionProps | HTMLMotionProps | An object containing motion animation props | {} |
diff --git a/content/docs/components/hyper-text.mdx b/content/docs/components/hyper-text.mdx
index 4194325c..72cfa6fd 100644
--- a/content/docs/components/hyper-text.mdx
+++ b/content/docs/components/hyper-text.mdx
@@ -31,7 +31,7 @@ npx shadcn@latest add "https://magicui.design/r/hyper-text"
<Step>Install the following dependencies:</Step>
```bash
-npm install framer-motion
+npm install motion
```
<Step>Copy and paste the following code into your project.</Step>
diff --git a/content/docs/components/scroll-based-velocity.mdx b/content/docs/components/scroll-based-velocity.mdx
index 5c5db23f..6031dabe 100644
--- a/content/docs/components/scroll-based-velocity.mdx
+++ b/content/docs/components/scroll-based-velocity.mdx
@@ -31,7 +31,7 @@ npx shadcn@latest add "https://magicui.design/r/scroll-based-velocity"
<Step>Install the following dependencies:</Step>
```bash
-npm install framer-motion
+npm install motion
```
<Step>Copy and paste the following code into your project.</Step>
diff --git a/content/docs/components/word-fade-in.mdx b/content/docs/components/word-fade-in.mdx
index 884ab6f0..e33b25f2 100644
--- a/content/docs/components/word-fade-in.mdx
+++ b/content/docs/components/word-fade-in.mdx
@@ -42,9 +42,9 @@ npx shadcn@latest add "https://magicui.design/r/word-fade-in"
## Props
-| Prop | Type | Description | Default |
-| --------- | -------- | -------------------------------------------------- | -------------- |
-| className | string | The class name to be applied to the component | |
-| delay | number | The Delay between each word animation | 0.15 |
-| words | string | A Text that is animated word by word | "word fade in" |
-| variants | Variants | An object containing framer-motion animation props | {} |
+| Prop | Type | Description | Default |
+| --------- | -------- | --------------------------------------------- | -------------- |
+| className | string | The class name to be applied to the component | |
+| delay | number | The Delay between each word animation | 0.15 |
+| words | string | A Text that is animated word by word | "word fade in" |
+| variants | Variants | An object containing motion animation props | {} |
diff --git a/content/docs/components/word-rotate.mdx b/content/docs/components/word-rotate.mdx
index b00fd2f0..084a6079 100644
--- a/content/docs/components/word-rotate.mdx
+++ b/content/docs/components/word-rotate.mdx
@@ -31,7 +31,7 @@ npx shadcn@latest add "https://magicui.design/r/word-rotate"
<Step>Install the following dependencies:</Step>
```bash
-npm install framer-motion
+npm install motion
```
<Step>Copy and paste the following code into your project.</Step>
@@ -48,9 +48,9 @@ npm install framer-motion
## Props
-| Prop | Type | Description | Default |
-| ----------- | --------------- | -------------------------------------------------- | ------- |
-| className | string | The class name to be applied to the component | |
-| duration | number | Duration of the animation | 2500 |
-| words | string[] | An array of words to rotate through | "" |
-| framerProps | HTMLMotionProps | An object containing framer-motion animation props | {} |
+| Prop | Type | Description | Default |
+| ----------- | --------------- | --------------------------------------------- | ------- |
+| className | string | The class name to be applied to the component | |
+| duration | number | Duration of the animation | 2500 |
+| words | string[] | An array of words to rotate through | "" |
+| motionProps | HTMLMotionProps | An object containing motion animation props | {} |
diff --git a/package.json b/package.json
index 15543288..4538a40f 100644
--- a/package.json
+++ b/package.json
@@ -54,7 +54,6 @@
"crisp-sdk-web": "^1.0.25",
"critters": "^0.0.24",
"date-fns": "^2.30.0",
- "framer-motion": "^11.3.31",
"geist": "^1.2.2",
"gray-matter": "^4.0.3",
"jotai": "^2.10.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1e27c942..0bdd5443 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -98,9 +98,6 @@ importers:
date-fns:
specifier: ^2.30.0
version: 2.30.0
- framer-motion:
- specifier: ^11.3.31
geist:
specifier: ^1.2.2
@@ -2934,20 +2931,6 @@ packages:
react-dom:
optional: true
- resolution: {integrity: sha512-Xmxs08WBXnc2tNzNZbFSpquI33lvleJg4Y+hmZ+vFkn+laN9ZnR3gbZnNGKDtuz7c/x3u8dLg05OU3EhLobCsg==}
- peerDependencies:
- '@emotion/is-prop-valid': '*'
- react: ^18.0.0
- react-dom: ^18.0.0
- peerDependenciesMeta:
- '@emotion/is-prop-valid':
- optional: true
- react:
- optional: true
- react-dom:
- optional: true
-
resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==}
@@ -8169,14 +8152,6 @@ snapshots:
react: 18.3.1
react-dom: 18.3.1([email protected])
- dependencies:
- tslib: 2.6.2
- optionalDependencies:
- '@emotion/is-prop-valid': 0.8.8
- react: 18.3.1
- react-dom: 18.3.1([email protected])
-
diff --git a/public/r/index.json b/public/r/index.json
index c450f46d..75133afa 100644
--- a/public/r/index.json
+++ b/public/r/index.json
@@ -3,7 +3,7 @@
"name": "magic-card",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -26,7 +26,7 @@
"name": "warp-background",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -39,7 +39,7 @@
"name": "morphing-text",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -52,7 +52,7 @@
"name": "scroll-progress",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -152,7 +152,7 @@
"name": "flickering-grid",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -165,7 +165,7 @@
"name": "hero-video-dialog",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -192,7 +192,7 @@
"name": "script-copy-btn",
"type": "registry:ui",
"dependencies": [
- "framer-motion",
+ "motion",
"shiki",
"next-themes"
],
@@ -353,7 +353,7 @@
"name": "number-ticker",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -428,7 +428,7 @@
"name": "animated-list",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -472,7 +472,7 @@
"name": "animated-grid-pattern",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -513,7 +513,7 @@
"name": "animated-beam",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -526,7 +526,7 @@
"name": "text-reveal",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -611,7 +611,7 @@
"name": "dock",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -624,7 +624,7 @@
"name": "word-rotate",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -647,7 +647,7 @@
"name": "word-pull-up",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -673,7 +673,7 @@
"name": "blur-in",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -686,7 +686,7 @@
"name": "letter-pullup",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -699,7 +699,7 @@
"name": "sparkles-text",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -712,7 +712,7 @@
"name": "flip-text",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -739,7 +739,7 @@
"name": "gradual-spacing",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -752,7 +752,7 @@
"name": "word-fade-in",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -765,7 +765,7 @@
"name": "scroll-based-velocity",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -778,7 +778,7 @@
"name": "scratch-to-reveal",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -791,7 +791,7 @@
"name": "fade-text",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -804,7 +804,7 @@
"name": "shiny-button",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -817,7 +817,7 @@
"name": "box-reveal",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -888,7 +888,7 @@
"name": "animated-subscribe-button",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
@@ -984,7 +984,7 @@
"name": "blur-fade",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
diff --git a/public/r/styles/default/animated-beam.json b/public/r/styles/default/animated-beam.json
index b3229f52..77eba361 100644
--- a/public/r/styles/default/animated-beam.json
+++ b/public/r/styles/default/animated-beam.json
@@ -2,12 +2,12 @@
"name": "animated-beam",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/animated-beam.tsx",
- "content": "\"use client\";\n\nimport { RefObject, useEffect, useId, useState } from \"react\";\nimport { motion } from \"framer-motion\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport interface AnimatedBeamProps {\n className?: string;\n containerRef: RefObject<HTMLElement | null>; // Container ref\n fromRef: RefObject<HTMLElement | null>;\n toRef: RefObject<HTMLElement | null>;\n curvature?: number;\n reverse?: boolean;\n pathColor?: string;\n pathWidth?: number;\n pathOpacity?: number;\n gradientStartColor?: string;\n gradientStopColor?: string;\n delay?: number;\n duration?: number;\n startXOffset?: number;\n startYOffset?: number;\n endXOffset?: number;\n endYOffset?: number;\n}\n\nexport const AnimatedBeam: React.FC<AnimatedBeamProps> = ({\n className,\n containerRef,\n fromRef,\n toRef,\n curvature = 0,\n reverse = false, // Include the reverse prop\n duration = Math.random() * 3 + 4,\n delay = 0,\n pathColor = \"gray\",\n pathWidth = 2,\n pathOpacity = 0.2,\n gradientStartColor = \"#ffaa40\",\n gradientStopColor = \"#9c40ff\",\n startXOffset = 0,\n startYOffset = 0,\n endXOffset = 0,\n endYOffset = 0,\n}) => {\n const id = useId();\n const [pathD, setPathD] = useState(\"\");\n const [svgDimensions, setSvgDimensions] = useState({ width: 0, height: 0 });\n\n // Calculate the gradient coordinates based on the reverse prop\n const gradientCoordinates = reverse\n ? {\n x1: [\"90%\", \"-10%\"],\n x2: [\"100%\", \"0%\"],\n y1: [\"0%\", \"0%\"],\n y2: [\"0%\", \"0%\"],\n }\n : {\n x1: [\"10%\", \"110%\"],\n x2: [\"0%\", \"100%\"],\n y1: [\"0%\", \"0%\"],\n y2: [\"0%\", \"0%\"],\n };\n\n useEffect(() => {\n const updatePath = () => {\n if (containerRef.current && fromRef.current && toRef.current) {\n const containerRect = containerRef.current.getBoundingClientRect();\n const rectA = fromRef.current.getBoundingClientRect();\n const rectB = toRef.current.getBoundingClientRect();\n\n const svgWidth = containerRect.width;\n const svgHeight = containerRect.height;\n setSvgDimensions({ width: svgWidth, height: svgHeight });\n\n const startX =\n rectA.left - containerRect.left + rectA.width / 2 + startXOffset;\n const startY =\n rectA.top - containerRect.top + rectA.height / 2 + startYOffset;\n const endX =\n rectB.left - containerRect.left + rectB.width / 2 + endXOffset;\n const endY =\n rectB.top - containerRect.top + rectB.height / 2 + endYOffset;\n\n const controlY = startY - curvature;\n const d = `M ${startX},${startY} Q ${\n (startX + endX) / 2\n },${controlY} ${endX},${endY}`;\n setPathD(d);\n }\n };\n\n // Initialize ResizeObserver\n const resizeObserver = new ResizeObserver((entries) => {\n // For all entries, recalculate the path\n for (let entry of entries) {\n updatePath();\n }\n });\n\n // Observe the container element\n if (containerRef.current) {\n resizeObserver.observe(containerRef.current);\n }\n\n // Call the updatePath initially to set the initial path\n updatePath();\n\n // Clean up the observer on component unmount\n return () => {\n resizeObserver.disconnect();\n };\n }, [\n containerRef,\n fromRef,\n toRef,\n curvature,\n startXOffset,\n startYOffset,\n endXOffset,\n endYOffset,\n ]);\n\n return (\n <svg\n fill=\"none\"\n width={svgDimensions.width}\n height={svgDimensions.height}\n xmlns=\"http://www.w3.org/2000/svg\"\n className={cn(\n \"pointer-events-none absolute left-0 top-0 transform-gpu stroke-2\",\n className,\n )}\n viewBox={`0 0 ${svgDimensions.width} ${svgDimensions.height}`}\n >\n <path\n d={pathD}\n stroke={pathColor}\n strokeWidth={pathWidth}\n strokeOpacity={pathOpacity}\n strokeLinecap=\"round\"\n />\n <path\n d={pathD}\n strokeWidth={pathWidth}\n stroke={`url(#${id})`}\n strokeOpacity=\"1\"\n strokeLinecap=\"round\"\n />\n <defs>\n <motion.linearGradient\n className=\"transform-gpu\"\n id={id}\n gradientUnits={\"userSpaceOnUse\"}\n initial={{\n x1: \"0%\",\n x2: \"0%\",\n y1: \"0%\",\n y2: \"0%\",\n }}\n animate={{\n x1: gradientCoordinates.x1,\n x2: gradientCoordinates.x2,\n y1: gradientCoordinates.y1,\n y2: gradientCoordinates.y2,\n }}\n transition={{\n delay,\n duration,\n ease: [0.16, 1, 0.3, 1], // https://easings.net/#easeOutExpo\n repeat: Infinity,\n repeatDelay: 0,\n }}\n >\n <stop stopColor={gradientStartColor} stopOpacity=\"0\"></stop>\n <stop stopColor={gradientStartColor}></stop>\n <stop offset=\"32.5%\" stopColor={gradientStopColor}></stop>\n <stop\n offset=\"100%\"\n stopColor={gradientStopColor}\n stopOpacity=\"0\"\n ></stop>\n </motion.linearGradient>\n </defs>\n </svg>\n );\n};\n",
+ "content": "\"use client\";\n\nimport { motion } from \"motion/react\";\nimport { RefObject, useEffect, useId, useState } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport interface AnimatedBeamProps {\n className?: string;\n containerRef: RefObject<HTMLElement | null>; // Container ref\n fromRef: RefObject<HTMLElement | null>;\n toRef: RefObject<HTMLElement | null>;\n curvature?: number;\n reverse?: boolean;\n pathColor?: string;\n pathWidth?: number;\n pathOpacity?: number;\n gradientStartColor?: string;\n gradientStopColor?: string;\n delay?: number;\n duration?: number;\n startXOffset?: number;\n startYOffset?: number;\n endXOffset?: number;\n endYOffset?: number;\n}\n\nexport const AnimatedBeam: React.FC<AnimatedBeamProps> = ({\n className,\n containerRef,\n fromRef,\n toRef,\n curvature = 0,\n reverse = false, // Include the reverse prop\n duration = Math.random() * 3 + 4,\n delay = 0,\n pathColor = \"gray\",\n pathWidth = 2,\n pathOpacity = 0.2,\n gradientStartColor = \"#ffaa40\",\n gradientStopColor = \"#9c40ff\",\n startXOffset = 0,\n startYOffset = 0,\n endXOffset = 0,\n endYOffset = 0,\n}) => {\n const id = useId();\n const [pathD, setPathD] = useState(\"\");\n const [svgDimensions, setSvgDimensions] = useState({ width: 0, height: 0 });\n\n // Calculate the gradient coordinates based on the reverse prop\n const gradientCoordinates = reverse\n ? {\n x1: [\"90%\", \"-10%\"],\n x2: [\"100%\", \"0%\"],\n y1: [\"0%\", \"0%\"],\n y2: [\"0%\", \"0%\"],\n }\n : {\n x1: [\"10%\", \"110%\"],\n x2: [\"0%\", \"100%\"],\n y1: [\"0%\", \"0%\"],\n y2: [\"0%\", \"0%\"],\n };\n\n useEffect(() => {\n const updatePath = () => {\n if (containerRef.current && fromRef.current && toRef.current) {\n const containerRect = containerRef.current.getBoundingClientRect();\n const rectA = fromRef.current.getBoundingClientRect();\n const rectB = toRef.current.getBoundingClientRect();\n\n const svgWidth = containerRect.width;\n const svgHeight = containerRect.height;\n setSvgDimensions({ width: svgWidth, height: svgHeight });\n\n const startX =\n rectA.left - containerRect.left + rectA.width / 2 + startXOffset;\n const startY =\n rectA.top - containerRect.top + rectA.height / 2 + startYOffset;\n const endX =\n rectB.left - containerRect.left + rectB.width / 2 + endXOffset;\n const endY =\n rectB.top - containerRect.top + rectB.height / 2 + endYOffset;\n\n const controlY = startY - curvature;\n const d = `M ${startX},${startY} Q ${\n (startX + endX) / 2\n },${controlY} ${endX},${endY}`;\n setPathD(d);\n }\n };\n\n // Initialize ResizeObserver\n const resizeObserver = new ResizeObserver((entries) => {\n // For all entries, recalculate the path\n for (let entry of entries) {\n updatePath();\n }\n });\n\n // Observe the container element\n if (containerRef.current) {\n resizeObserver.observe(containerRef.current);\n }\n\n // Call the updatePath initially to set the initial path\n updatePath();\n\n // Clean up the observer on component unmount\n return () => {\n resizeObserver.disconnect();\n };\n }, [\n containerRef,\n fromRef,\n toRef,\n curvature,\n startXOffset,\n startYOffset,\n endXOffset,\n endYOffset,\n ]);\n\n return (\n <svg\n fill=\"none\"\n width={svgDimensions.width}\n height={svgDimensions.height}\n xmlns=\"http://www.w3.org/2000/svg\"\n className={cn(\n \"pointer-events-none absolute left-0 top-0 transform-gpu stroke-2\",\n className,\n )}\n viewBox={`0 0 ${svgDimensions.width} ${svgDimensions.height}`}\n >\n <path\n d={pathD}\n stroke={pathColor}\n strokeWidth={pathWidth}\n strokeOpacity={pathOpacity}\n strokeLinecap=\"round\"\n />\n <path\n d={pathD}\n strokeWidth={pathWidth}\n stroke={`url(#${id})`}\n strokeOpacity=\"1\"\n strokeLinecap=\"round\"\n />\n <defs>\n <motion.linearGradient\n className=\"transform-gpu\"\n id={id}\n gradientUnits={\"userSpaceOnUse\"}\n initial={{\n x1: \"0%\",\n x2: \"0%\",\n y1: \"0%\",\n y2: \"0%\",\n }}\n animate={{\n x1: gradientCoordinates.x1,\n x2: gradientCoordinates.x2,\n y1: gradientCoordinates.y1,\n y2: gradientCoordinates.y2,\n }}\n transition={{\n delay,\n duration,\n ease: [0.16, 1, 0.3, 1], // https://easings.net/#easeOutExpo\n repeat: Infinity,\n repeatDelay: 0,\n }}\n >\n <stop stopColor={gradientStartColor} stopOpacity=\"0\"></stop>\n <stop stopColor={gradientStartColor}></stop>\n <stop offset=\"32.5%\" stopColor={gradientStopColor}></stop>\n <stop\n offset=\"100%\"\n stopColor={gradientStopColor}\n stopOpacity=\"0\"\n ></stop>\n </motion.linearGradient>\n </defs>\n </svg>\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.json
index e49b6dbc..25c76b36 100644
--- a/public/r/styles/default/animated-grid-pattern.json
+++ b/public/r/styles/default/animated-grid-pattern.json
@@ -2,12 +2,12 @@
"name": "animated-grid-pattern",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"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 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",
+ "content": "\"use client\";\n\nimport { motion } from \"motion/react\";\nimport { useEffect, useId, useRef, useState } from \"react\";\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/animated-list.json b/public/r/styles/default/animated-list.json
index bc93de81..50a502f6 100644
--- a/public/r/styles/default/animated-list.json
+++ b/public/r/styles/default/animated-list.json
@@ -2,12 +2,12 @@
"name": "animated-list",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/animated-list.tsx",
- "content": "\"use client\";\n\nimport React, { ReactElement, useEffect, useMemo, useState } from \"react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\n\nexport interface AnimatedListProps {\n className?: string;\n children: React.ReactNode;\n delay?: number;\n}\n\nexport const AnimatedList = React.memo(\n ({ className, children, delay = 1000 }: 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);\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 className={`flex flex-col items-center gap-4 ${className}`}>\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\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",
+ "content": "\"use client\";\n\nimport { AnimatePresence, motion } from \"motion/react\";\nimport React, { useEffect, useMemo, useState } from \"react\";\n\nexport interface AnimatedListProps {\n className?: string;\n children: React.ReactNode;\n delay?: number;\n}\n\nexport const AnimatedList = React.memo(\n ({ className, children, delay = 1000 }: 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);\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 className={`flex flex-col items-center gap-4 ${className}`}>\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\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",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/animated-subscribe-button.json b/public/r/styles/default/animated-subscribe-button.json
index b9fd08ad..bddefac7 100644
--- a/public/r/styles/default/animated-subscribe-button.json
+++ b/public/r/styles/default/animated-subscribe-button.json
@@ -2,12 +2,12 @@
"name": "animated-subscribe-button",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/animated-subscribe-button.tsx",
- "content": "\"use client\";\n\nimport React, { useState } from \"react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\n\ninterface AnimatedSubscribeButtonProps {\n buttonColor: string;\n buttonTextColor?: string;\n subscribeStatus: boolean;\n initialText: React.ReactElement | string;\n changeText: React.ReactElement | string;\n}\n\nexport const AnimatedSubscribeButton: React.FC<\n AnimatedSubscribeButtonProps\n> = ({\n buttonColor,\n subscribeStatus,\n buttonTextColor,\n changeText,\n initialText,\n}) => {\n const [isSubscribed, setIsSubscribed] = useState<boolean>(subscribeStatus);\n\n return (\n <AnimatePresence mode=\"wait\">\n {isSubscribed ? (\n <motion.button\n className=\"relative flex h-10 w-[200px] items-center justify-center overflow-hidden rounded-md bg-white outline outline-1 outline-black\"\n onClick={() => setIsSubscribed(false)}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n >\n <motion.span\n key=\"action\"\n className=\"relative flex h-full w-full items-center justify-center font-semibold\"\n initial={{ y: -50 }}\n animate={{ y: 0 }}\n style={{ color: buttonColor }}\n >\n {changeText}\n </motion.span>\n </motion.button>\n ) : (\n <motion.button\n className=\"relative flex h-10 w-[200px] cursor-pointer items-center justify-center rounded-md border-none\"\n style={{ backgroundColor: buttonColor, color: buttonTextColor }}\n onClick={() => setIsSubscribed(true)}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n >\n <motion.span\n key=\"reaction\"\n className=\"relative flex items-center justify-center font-semibold\"\n initial={{ x: 0 }}\n exit={{ x: 50, transition: { duration: 0.1 } }}\n >\n {initialText}\n </motion.span>\n </motion.button>\n )}\n </AnimatePresence>\n );\n};\n",
+ "content": "\"use client\";\n\nimport { AnimatePresence, motion } from \"motion/react\";\nimport React, { useState } from \"react\";\n\ninterface AnimatedSubscribeButtonProps {\n buttonColor: string;\n buttonTextColor?: string;\n subscribeStatus: boolean;\n initialText: React.ReactElement | string;\n changeText: React.ReactElement | string;\n}\n\nexport const AnimatedSubscribeButton: React.FC<\n AnimatedSubscribeButtonProps\n> = ({\n buttonColor,\n subscribeStatus,\n buttonTextColor,\n changeText,\n initialText,\n}) => {\n const [isSubscribed, setIsSubscribed] = useState<boolean>(subscribeStatus);\n\n return (\n <AnimatePresence mode=\"wait\">\n {isSubscribed ? (\n <motion.button\n className=\"relative flex h-10 w-[200px] items-center justify-center overflow-hidden rounded-md bg-white outline outline-1 outline-black\"\n onClick={() => setIsSubscribed(false)}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n >\n <motion.span\n key=\"action\"\n className=\"relative flex h-full w-full items-center justify-center font-semibold\"\n initial={{ y: -50 }}\n animate={{ y: 0 }}\n style={{ color: buttonColor }}\n >\n {changeText}\n </motion.span>\n </motion.button>\n ) : (\n <motion.button\n className=\"relative flex h-10 w-[200px] cursor-pointer items-center justify-center rounded-md border-none\"\n style={{ backgroundColor: buttonColor, color: buttonTextColor }}\n onClick={() => setIsSubscribed(true)}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n >\n <motion.span\n key=\"reaction\"\n className=\"relative flex items-center justify-center font-semibold\"\n initial={{ x: 0 }}\n exit={{ x: 50, transition: { duration: 0.1 } }}\n >\n {initialText}\n </motion.span>\n </motion.button>\n )}\n </AnimatePresence>\n );\n};\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/bento-grid.json b/public/r/styles/default/bento-grid.json
index 3d64a53d..8e36e073 100644
--- a/public/r/styles/default/bento-grid.json
+++ b/public/r/styles/default/bento-grid.json
@@ -7,7 +7,7 @@
"files": [
{
"path": "magicui/bento-grid.tsx",
- "content": "import { ReactNode } from \"react\";\nimport { ArrowRightIcon } from \"@radix-ui/react-icons\";\n\nimport { cn } from \"@/lib/utils\";\nimport { Button } from \"@/components/ui/button\";\n\ntype BentoGridProps = {\n children: ReactNode;\n className?: string;\n};\n\ntype BentoCardProps = {\n name: string;\n className: string;\n background: ReactNode;\n Icon: any;\n description: string;\n href: string;\n cta: string;\n};\n\nconst BentoGrid = ({ children, className }: BentoGridProps) => {\n return (\n <div\n className={cn(\n \"grid w-full auto-rows-[22rem] grid-cols-3 gap-4\",\n className,\n )}\n >\n {children}\n </div>\n );\n};\n\nconst BentoCard = ({\n name,\n className,\n background,\n Icon,\n description,\n href,\n cta,\n}: BentoCardProps) => (\n <div\n key={name}\n className={cn(\n \"group relative col-span-3 flex flex-col justify-between overflow-hidden rounded-xl\",\n // light styles\n \"bg-white [box-shadow:0_0_0_1px_rgba(0,0,0,.03),0_2px_4px_rgba(0,0,0,.05),0_12px_24px_rgba(0,0,0,.05)]\",\n // dark styles\n \"transform-gpu dark:bg-black dark:[border:1px_solid_rgba(255,255,255,.1)] dark:[box-shadow:0_-20px_80px_-20px_#ffffff1f_inset]\",\n className,\n )}\n >\n <div>{background}</div>\n <div className=\"pointer-events-none z-10 flex transform-gpu flex-col gap-1 p-6 transition-all duration-300 group-hover:-translate-y-10\">\n <Icon className=\"h-12 w-12 origin-left transform-gpu text-neutral-700 transition-all duration-300 ease-in-out group-hover:scale-75\" />\n <h3 className=\"text-xl font-semibold text-neutral-700 dark:text-neutral-300\">\n {name}\n </h3>\n <p className=\"max-w-lg text-neutral-400\">{description}</p>\n </div>\n\n <div\n className={cn(\n \"pointer-events-none absolute bottom-0 flex w-full translate-y-10 transform-gpu flex-row items-center p-4 opacity-0 transition-all duration-300 group-hover:translate-y-0 group-hover:opacity-100\",\n )}\n >\n <Button variant=\"ghost\" asChild size=\"sm\" className=\"pointer-events-auto\">\n <a href={href}>\n {cta}\n <ArrowRightIcon className=\"ml-2 h-4 w-4\" />\n </a>\n </Button>\n </div>\n <div className=\"pointer-events-none absolute inset-0 transform-gpu transition-all duration-300 group-hover:bg-black/[.03] group-hover:dark:bg-neutral-800/10\" />\n </div>\n);\n\nexport { BentoCard, BentoGrid };\n",
+ "content": "import { ReactNode } from \"react\";\nimport { ArrowRightIcon } from \"@radix-ui/react-icons\";\n\nimport { cn } from \"@/lib/utils\";\nimport { Button } from \"@/components/ui/button\";\n\ntype BentoGridProps = {\n children: ReactNode;\n className?: string;\n};\n\ntype BentoCardProps = {\n name: string;\n className: string;\n background: ReactNode;\n Icon: React.ElementType;\n description: string;\n href: string;\n cta: string;\n};\n\nconst BentoGrid = ({ children, className }: BentoGridProps) => {\n return (\n <div\n className={cn(\n \"grid w-full auto-rows-[22rem] grid-cols-3 gap-4\",\n className,\n )}\n >\n {children}\n </div>\n );\n};\n\nconst BentoCard = ({\n name,\n className,\n background,\n Icon,\n description,\n href,\n cta,\n}: BentoCardProps) => (\n <div\n key={name}\n className={cn(\n \"group relative col-span-3 flex flex-col justify-between overflow-hidden rounded-xl\",\n // light styles\n \"bg-white [box-shadow:0_0_0_1px_rgba(0,0,0,.03),0_2px_4px_rgba(0,0,0,.05),0_12px_24px_rgba(0,0,0,.05)]\",\n // dark styles\n \"transform-gpu dark:bg-black dark:[border:1px_solid_rgba(255,255,255,.1)] dark:[box-shadow:0_-20px_80px_-20px_#ffffff1f_inset]\",\n className,\n )}\n >\n <div>{background}</div>\n <div className=\"pointer-events-none z-10 flex transform-gpu flex-col gap-1 p-6 transition-all duration-300 group-hover:-translate-y-10\">\n <Icon className=\"h-12 w-12 origin-left transform-gpu text-neutral-700 transition-all duration-300 ease-in-out group-hover:scale-75\" />\n <h3 className=\"text-xl font-semibold text-neutral-700 dark:text-neutral-300\">\n {name}\n </h3>\n <p className=\"max-w-lg text-neutral-400\">{description}</p>\n </div>\n\n <div\n className={cn(\n \"pointer-events-none absolute bottom-0 flex w-full translate-y-10 transform-gpu flex-row items-center p-4 opacity-0 transition-all duration-300 group-hover:translate-y-0 group-hover:opacity-100\",\n )}\n >\n <Button variant=\"ghost\" asChild size=\"sm\" className=\"pointer-events-auto\">\n <a href={href}>\n {cta}\n <ArrowRightIcon className=\"ml-2 h-4 w-4\" />\n </a>\n </Button>\n </div>\n <div className=\"pointer-events-none absolute inset-0 transform-gpu transition-all duration-300 group-hover:bg-black/[.03] group-hover:dark:bg-neutral-800/10\" />\n </div>\n);\n\nexport { BentoCard, BentoGrid };\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/blur-fade.json b/public/r/styles/default/blur-fade.json
index a6e87dd0..b0fd6aa1 100644
--- a/public/r/styles/default/blur-fade.json
+++ b/public/r/styles/default/blur-fade.json
@@ -2,12 +2,12 @@
"name": "blur-fade",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/blur-fade.tsx",
- "content": "\"use client\";\n\nimport { useRef } from \"react\";\nimport {\n AnimatePresence,\n motion,\n useInView,\n UseInViewOptions,\n Variants,\n} from \"framer-motion\";\n\ntype MarginType = UseInViewOptions[\"margin\"];\n\ninterface BlurFadeProps {\n children: React.ReactNode;\n className?: string;\n variant?: {\n hidden: { y: number };\n visible: { y: number };\n };\n duration?: number;\n delay?: number;\n offset?: number;\n direction?: \"up\" | \"down\" | \"left\" | \"right\";\n inView?: boolean;\n inViewMargin?: MarginType;\n blur?: string;\n}\n\nexport default function BlurFade({\n children,\n className,\n variant,\n duration = 0.4,\n delay = 0,\n offset = 6,\n direction = \"down\",\n inView = false,\n inViewMargin = \"-50px\",\n blur = \"6px\",\n}: BlurFadeProps) {\n const ref = useRef(null);\n const inViewResult = useInView(ref, { once: true, margin: inViewMargin });\n const isInView = !inView || inViewResult;\n const defaultVariants: Variants = {\n hidden: {\n [direction === \"left\" || direction === \"right\" ? \"x\" : \"y\"]:\n direction === \"right\" || direction === \"down\" ? -offset : offset,\n opacity: 0,\n filter: `blur(${blur})`,\n },\n visible: {\n [direction === \"left\" || direction === \"right\" ? \"x\" : \"y\"]: 0,\n opacity: 1,\n filter: `blur(0px)`,\n },\n };\n const combinedVariants = variant || defaultVariants;\n return (\n <AnimatePresence>\n <motion.div\n ref={ref}\n initial=\"hidden\"\n animate={isInView ? \"visible\" : \"hidden\"}\n exit=\"hidden\"\n variants={combinedVariants}\n transition={{\n delay: 0.04 + delay,\n duration,\n ease: \"easeOut\",\n }}\n className={className}\n >\n {children}\n </motion.div>\n </AnimatePresence>\n );\n}\n",
+ "content": "\"use client\";\n\nimport { useRef } from \"react\";\nimport {\n AnimatePresence,\n motion,\n useInView,\n UseInViewOptions,\n Variants,\n} from \"motion/react\";\n\ntype MarginType = UseInViewOptions[\"margin\"];\n\ninterface BlurFadeProps {\n children: React.ReactNode;\n className?: string;\n variant?: {\n hidden: { y: number };\n visible: { y: number };\n };\n duration?: number;\n delay?: number;\n offset?: number;\n direction?: \"up\" | \"down\" | \"left\" | \"right\";\n inView?: boolean;\n inViewMargin?: MarginType;\n blur?: string;\n}\n\nexport default function BlurFade({\n children,\n className,\n variant,\n duration = 0.4,\n delay = 0,\n offset = 6,\n direction = \"down\",\n inView = false,\n inViewMargin = \"-50px\",\n blur = \"6px\",\n}: BlurFadeProps) {\n const ref = useRef(null);\n const inViewResult = useInView(ref, { once: true, margin: inViewMargin });\n const isInView = !inView || inViewResult;\n const defaultVariants: Variants = {\n hidden: {\n [direction === \"left\" || direction === \"right\" ? \"x\" : \"y\"]:\n direction === \"right\" || direction === \"down\" ? -offset : offset,\n opacity: 0,\n filter: `blur(${blur})`,\n },\n visible: {\n [direction === \"left\" || direction === \"right\" ? \"x\" : \"y\"]: 0,\n opacity: 1,\n filter: `blur(0px)`,\n },\n };\n const combinedVariants = variant || defaultVariants;\n return (\n <AnimatePresence>\n <motion.div\n ref={ref}\n initial=\"hidden\"\n animate={isInView ? \"visible\" : \"hidden\"}\n exit=\"hidden\"\n variants={combinedVariants}\n transition={{\n delay: 0.04 + delay,\n duration,\n ease: \"easeOut\",\n }}\n className={className}\n >\n {children}\n </motion.div>\n </AnimatePresence>\n );\n}\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/blur-in.json b/public/r/styles/default/blur-in.json
index e6889275..03644fff 100644
--- a/public/r/styles/default/blur-in.json
+++ b/public/r/styles/default/blur-in.json
@@ -2,12 +2,12 @@
"name": "blur-in",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/blur-in.tsx",
- "content": "\"use client\";\n\nimport { motion } from \"framer-motion\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface BlurInProps {\n word: string;\n className?: string;\n variant?: {\n hidden: { filter: string; opacity: number };\n visible: { filter: string; opacity: number };\n };\n duration?: number;\n}\nconst BlurIn = ({ word, className, variant, duration = 1 }: BlurInProps) => {\n const defaultVariants = {\n hidden: { filter: \"blur(10px)\", opacity: 0 },\n visible: { filter: \"blur(0px)\", opacity: 1 },\n };\n const combinedVariants = variant || defaultVariants;\n\n return (\n <motion.h1\n initial=\"hidden\"\n animate=\"visible\"\n transition={{ duration }}\n variants={combinedVariants}\n className={cn(\n \"font-display text-center text-4xl font-bold tracking-[-0.02em] drop-shadow-sm md:text-7xl md:leading-[5rem]\",\n className,\n )}\n >\n {word}\n </motion.h1>\n );\n};\n\nexport default BlurIn;\n",
+ "content": "\"use client\";\n\nimport { motion } from \"motion/react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface BlurInProps {\n word: string;\n className?: string;\n variant?: {\n hidden: { filter: string; opacity: number };\n visible: { filter: string; opacity: number };\n };\n duration?: number;\n}\nconst BlurIn = ({ word, className, variant, duration = 1 }: BlurInProps) => {\n const defaultVariants = {\n hidden: { filter: \"blur(10px)\", opacity: 0 },\n visible: { filter: \"blur(0px)\", opacity: 1 },\n };\n const combinedVariants = variant || defaultVariants;\n\n return (\n <motion.h1\n initial=\"hidden\"\n animate=\"visible\"\n transition={{ duration }}\n variants={combinedVariants}\n className={cn(\n \"font-display text-center text-4xl font-bold tracking-[-0.02em] drop-shadow-sm md:text-7xl md:leading-[5rem]\",\n className,\n )}\n >\n {word}\n </motion.h1>\n );\n};\n\nexport default BlurIn;\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/box-reveal.json b/public/r/styles/default/box-reveal.json
index bed246b9..04d23e7c 100644
--- a/public/r/styles/default/box-reveal.json
+++ b/public/r/styles/default/box-reveal.json
@@ -2,12 +2,12 @@
"name": "box-reveal",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/box-reveal.tsx",
- "content": "\"use client\";\n\nimport { useEffect, useRef } from \"react\";\nimport { motion, useAnimation, useInView } from \"framer-motion\";\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,\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 ? boxColor : \"#5046e6\",\n }}\n />\n </div>\n );\n};\n\nexport default BoxReveal;\n",
+ "content": "\"use client\";\n\nimport { useEffect, useRef } from \"react\";\nimport { motion, useAnimation, useInView } from \"motion/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,\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 ? boxColor : \"#5046e6\",\n }}\n />\n </div>\n );\n};\n\nexport default BoxReveal;\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/dock.json b/public/r/styles/default/dock.json
index 78d1ff26..76c5190e 100644
--- a/public/r/styles/default/dock.json
+++ b/public/r/styles/default/dock.json
@@ -2,12 +2,12 @@
"name": "dock",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/dock.tsx",
- "content": "\"use client\";\n\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport {\n motion,\n MotionProps,\n MotionValue,\n useMotionValue,\n useSpring,\n useTransform,\n} from \"framer-motion\";\nimport React, { PropsWithChildren, useRef } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport interface DockProps extends VariantProps<typeof dockVariants> {\n className?: string;\n iconSize?: number;\n iconMagnification?: number;\n iconDistance?: number;\n direction?: \"top\" | \"middle\" | \"bottom\";\n children: React.ReactNode;\n}\n\nconst DEFAULT_SIZE = 40;\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 items-center justify-center 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 iconSize = DEFAULT_SIZE,\n iconMagnification = DEFAULT_MAGNIFICATION,\n iconDistance = DEFAULT_DISTANCE,\n direction = \"middle\",\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 size: iconSize,\n magnification: iconMagnification,\n distance: iconDistance,\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 extends Omit<MotionProps & React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n size?: number;\n magnification?: number;\n distance?: number;\n mouseX?: MotionValue<number>;\n className?: string;\n children?: React.ReactNode;\n props?: PropsWithChildren;\n}\n\nconst DockIcon = ({\n size = DEFAULT_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 const padding = Math.max(6, size * 0.2);\n const defaultMouseX = useMotionValue(Infinity);\n\n const distanceCalc = useTransform(mouseX ?? defaultMouseX, (val: number) => {\n const bounds = ref.current?.getBoundingClientRect() ?? { x: 0, width: 0 };\n return val - bounds.x - bounds.width / 2;\n });\n\n const sizeTransform = useTransform(\n distanceCalc,\n [-distance, 0, distance],\n [size, magnification, size],\n );\n\n const scaleSize = useSpring(sizeTransform, {\n mass: 0.1,\n stiffness: 150,\n damping: 12,\n });\n\n return (\n <motion.div\n ref={ref}\n style={{ width: scaleSize, height: scaleSize, padding }}\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 { cva, type VariantProps } from \"class-variance-authority\";\nimport {\n motion,\n MotionProps,\n MotionValue,\n useMotionValue,\n useSpring,\n useTransform,\n} from \"motion/react\";\nimport React, { PropsWithChildren, useRef } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport interface DockProps extends VariantProps<typeof dockVariants> {\n className?: string;\n iconSize?: number;\n iconMagnification?: number;\n iconDistance?: number;\n direction?: \"top\" | \"middle\" | \"bottom\";\n children: React.ReactNode;\n}\n\nconst DEFAULT_SIZE = 40;\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 items-center justify-center 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 iconSize = DEFAULT_SIZE,\n iconMagnification = DEFAULT_MAGNIFICATION,\n iconDistance = DEFAULT_DISTANCE,\n direction = \"middle\",\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 size: iconSize,\n magnification: iconMagnification,\n distance: iconDistance,\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 extends Omit<MotionProps & React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n size?: number;\n magnification?: number;\n distance?: number;\n mouseX?: MotionValue<number>;\n className?: string;\n children?: React.ReactNode;\n props?: PropsWithChildren;\n}\n\nconst DockIcon = ({\n size = DEFAULT_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 const padding = Math.max(6, size * 0.2);\n const defaultMouseX = useMotionValue(Infinity);\n\n const distanceCalc = useTransform(mouseX ?? defaultMouseX, (val: number) => {\n const bounds = ref.current?.getBoundingClientRect() ?? { x: 0, width: 0 };\n return val - bounds.x - bounds.width / 2;\n });\n\n const sizeTransform = useTransform(\n distanceCalc,\n [-distance, 0, distance],\n [size, magnification, size],\n );\n\n const scaleSize = useSpring(sizeTransform, {\n mass: 0.1,\n stiffness: 150,\n damping: 12,\n });\n\n return (\n <motion.div\n ref={ref}\n style={{ width: scaleSize, height: scaleSize, padding }}\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/dot-pattern.json b/public/r/styles/default/dot-pattern.json
index 1353c834..edd4796a 100644
--- a/public/r/styles/default/dot-pattern.json
+++ b/public/r/styles/default/dot-pattern.json
@@ -4,7 +4,7 @@
"files": [
{
"path": "magicui/dot-pattern.tsx",
- "content": "import { useId } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface DotPatternProps {\n width?: any;\n height?: any;\n x?: any;\n y?: any;\n cx?: any;\n cy?: any;\n cr?: any;\n className?: string;\n [key: string]: any;\n}\nexport function DotPattern({\n width = 16,\n height = 16,\n x = 0,\n y = 0,\n cx = 1,\n cy = 1,\n cr = 1,\n className,\n ...props\n}: DotPatternProps) {\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-neutral-400/80\",\n className,\n )}\n {...props}\n >\n <defs>\n <pattern\n id={id}\n width={width}\n height={height}\n patternUnits=\"userSpaceOnUse\"\n patternContentUnits=\"userSpaceOnUse\"\n x={x}\n y={y}\n >\n <circle id=\"pattern-circle\" cx={cx} cy={cy} r={cr} />\n </pattern>\n </defs>\n <rect width=\"100%\" height=\"100%\" strokeWidth={0} fill={`url(#${id})`} />\n </svg>\n );\n}\n\nexport default DotPattern;\n",
+ "content": "import { useId } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface DotPatternProps {\n width?: number;\n height?: number;\n x?: number;\n y?: number;\n cx?: number;\n cy?: number;\n cr?: number;\n className?: string;\n [key: string]: unknown;\n}\nexport function DotPattern({\n width = 16,\n height = 16,\n x = 0,\n y = 0,\n cx = 1,\n cy = 1,\n cr = 1,\n className,\n ...props\n}: DotPatternProps) {\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-neutral-400/80\",\n className,\n )}\n {...props}\n >\n <defs>\n <pattern\n id={id}\n width={width}\n height={height}\n patternUnits=\"userSpaceOnUse\"\n patternContentUnits=\"userSpaceOnUse\"\n x={x}\n y={y}\n >\n <circle id=\"pattern-circle\" cx={cx} cy={cy} r={cr} />\n </pattern>\n </defs>\n <rect width=\"100%\" height=\"100%\" strokeWidth={0} fill={`url(#${id})`} />\n </svg>\n );\n}\n\nexport default DotPattern;\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/fade-text.json b/public/r/styles/default/fade-text.json
index a8c4a96f..cb7dd9e4 100644
--- a/public/r/styles/default/fade-text.json
+++ b/public/r/styles/default/fade-text.json
@@ -2,12 +2,12 @@
"name": "fade-text",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/fade-text.tsx",
- "content": "\"use client\";\n\nimport { useMemo } from \"react\";\nimport { motion, Variants } from \"framer-motion\";\n\ntype FadeTextProps = {\n className?: string;\n direction?: \"up\" | \"down\" | \"left\" | \"right\";\n framerProps?: Variants;\n text: string;\n};\n\nexport function FadeText({\n direction = \"up\",\n className,\n framerProps = {\n hidden: { opacity: 0 },\n show: { opacity: 1, transition: { type: \"spring\" } },\n },\n text,\n}: FadeTextProps) {\n const directionOffset = useMemo(() => {\n const map = { up: 10, down: -10, left: -10, right: 10 };\n return map[direction];\n }, [direction]);\n\n const axis = direction === \"up\" || direction === \"down\" ? \"y\" : \"x\";\n\n const FADE_ANIMATION_VARIANTS = useMemo(() => {\n const { hidden, show, ...rest } = framerProps as {\n [name: string]: { [name: string]: number; opacity: number };\n };\n\n return {\n ...rest,\n hidden: {\n ...(hidden ?? {}),\n opacity: hidden?.opacity ?? 0,\n [axis]: hidden?.[axis] ?? directionOffset,\n },\n show: {\n ...(show ?? {}),\n opacity: show?.opacity ?? 1,\n [axis]: show?.[axis] ?? 0,\n },\n };\n }, [directionOffset, axis, framerProps]);\n\n return (\n <motion.div\n initial=\"hidden\"\n animate=\"show\"\n viewport={{ once: true }}\n variants={FADE_ANIMATION_VARIANTS}\n >\n <motion.span className={className}>{text}</motion.span>\n </motion.div>\n );\n}\n",
+ "content": "\"use client\";\n\nimport { useMemo } from \"react\";\nimport { motion, Variants } from \"motion/react\";\n\ntype FadeTextProps = {\n className?: string;\n direction?: \"up\" | \"down\" | \"left\" | \"right\";\n framerProps?: Variants;\n text: string;\n};\n\nexport function FadeText({\n direction = \"up\",\n className,\n framerProps = {\n hidden: { opacity: 0 },\n show: { opacity: 1, transition: { type: \"spring\" } },\n },\n text,\n}: FadeTextProps) {\n const directionOffset = useMemo(() => {\n const map = { up: 10, down: -10, left: -10, right: 10 };\n return map[direction];\n }, [direction]);\n\n const axis = direction === \"up\" || direction === \"down\" ? \"y\" : \"x\";\n\n const FADE_ANIMATION_VARIANTS = useMemo(() => {\n const { hidden, show, ...rest } = framerProps as {\n [name: string]: { [name: string]: number; opacity: number };\n };\n\n return {\n ...rest,\n hidden: {\n ...(hidden ?? {}),\n opacity: hidden?.opacity ?? 0,\n [axis]: hidden?.[axis] ?? directionOffset,\n },\n show: {\n ...(show ?? {}),\n opacity: show?.opacity ?? 1,\n [axis]: show?.[axis] ?? 0,\n },\n };\n }, [directionOffset, axis, framerProps]);\n\n return (\n <motion.div\n initial=\"hidden\"\n animate=\"show\"\n viewport={{ once: true }}\n variants={FADE_ANIMATION_VARIANTS}\n >\n <motion.span className={className}>{text}</motion.span>\n </motion.div>\n );\n}\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/flickering-grid.json b/public/r/styles/default/flickering-grid.json
index 716a646b..7fff2476 100644
--- a/public/r/styles/default/flickering-grid.json
+++ b/public/r/styles/default/flickering-grid.json
@@ -2,7 +2,7 @@
"name": "flickering-grid",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
diff --git a/public/r/styles/default/flip-text.json b/public/r/styles/default/flip-text.json
index 36acf6ec..5d03e092 100644
--- a/public/r/styles/default/flip-text.json
+++ b/public/r/styles/default/flip-text.json
@@ -2,12 +2,12 @@
"name": "flip-text",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"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 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",
+ "content": "\"use client\";\n\nimport { AnimatePresence, motion, Variants } from \"motion/react\";\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/gradual-spacing.json b/public/r/styles/default/gradual-spacing.json
index f1547291..15eb85fa 100644
--- a/public/r/styles/default/gradual-spacing.json
+++ b/public/r/styles/default/gradual-spacing.json
@@ -2,12 +2,12 @@
"name": "gradual-spacing",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/gradual-spacing.tsx",
- "content": "\"use client\";\n\nimport { AnimatePresence, motion, Variants } from \"framer-motion\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface GradualSpacingProps {\n text: string;\n duration?: number;\n delayMultiple?: number;\n framerProps?: Variants;\n className?: string;\n}\n\nexport default function GradualSpacing({\n text,\n duration = 0.5,\n delayMultiple = 0.04,\n framerProps = {\n hidden: { opacity: 0, x: -20 },\n visible: { opacity: 1, x: 0 },\n },\n className,\n}: GradualSpacingProps) {\n return (\n <div className=\"flex justify-center space-x-1\">\n <AnimatePresence>\n {text.split(\"\").map((char, i) => (\n <motion.h1\n key={i}\n initial=\"hidden\"\n animate=\"visible\"\n exit=\"hidden\"\n variants={framerProps}\n transition={{ duration, delay: i * delayMultiple }}\n className={cn(\"drop-shadow-sm \", className)}\n >\n {char === \" \" ? <span>&nbsp;</span> : char}\n </motion.h1>\n ))}\n </AnimatePresence>\n </div>\n );\n}\n",
+ "content": "\"use client\";\n\nimport { AnimatePresence, motion, Variants } from \"motion/react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface GradualSpacingProps {\n text: string;\n duration?: number;\n delayMultiple?: number;\n framerProps?: Variants;\n className?: string;\n}\n\nexport default function GradualSpacing({\n text,\n duration = 0.5,\n delayMultiple = 0.04,\n framerProps = {\n hidden: { opacity: 0, x: -20 },\n visible: { opacity: 1, x: 0 },\n },\n className,\n}: GradualSpacingProps) {\n return (\n <div className=\"flex justify-center space-x-1\">\n <AnimatePresence>\n {text.split(\"\").map((char, i) => (\n <motion.h1\n key={i}\n initial=\"hidden\"\n animate=\"visible\"\n exit=\"hidden\"\n variants={framerProps}\n transition={{ duration, delay: i * delayMultiple }}\n className={cn(\"drop-shadow-sm \", className)}\n >\n {char === \" \" ? <span>&nbsp;</span> : char}\n </motion.h1>\n ))}\n </AnimatePresence>\n </div>\n );\n}\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/hero-video-dialog.json b/public/r/styles/default/hero-video-dialog.json
index e26c5102..897659d3 100644
--- a/public/r/styles/default/hero-video-dialog.json
+++ b/public/r/styles/default/hero-video-dialog.json
@@ -2,12 +2,12 @@
"name": "hero-video-dialog",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/hero-video-dialog.tsx",
- "content": "\"use client\";\n\nimport { useState } from \"react\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport { Play, XIcon } from \"lucide-react\";\n\nimport { cn } from \"@/lib/utils\";\n\ntype AnimationStyle =\n | \"from-bottom\"\n | \"from-center\"\n | \"from-top\"\n | \"from-left\"\n | \"from-right\"\n | \"fade\"\n | \"top-in-bottom-out\"\n | \"left-in-right-out\";\n\ninterface HeroVideoProps {\n animationStyle?: AnimationStyle;\n videoSrc: string;\n thumbnailSrc: string;\n thumbnailAlt?: string;\n className?: string;\n}\n\nconst animationVariants = {\n \"from-bottom\": {\n initial: { y: \"100%\", opacity: 0 },\n animate: { y: 0, opacity: 1 },\n exit: { y: \"100%\", opacity: 0 },\n },\n \"from-center\": {\n initial: { scale: 0.5, opacity: 0 },\n animate: { scale: 1, opacity: 1 },\n exit: { scale: 0.5, opacity: 0 },\n },\n \"from-top\": {\n initial: { y: \"-100%\", opacity: 0 },\n animate: { y: 0, opacity: 1 },\n exit: { y: \"-100%\", opacity: 0 },\n },\n \"from-left\": {\n initial: { x: \"-100%\", opacity: 0 },\n animate: { x: 0, opacity: 1 },\n exit: { x: \"-100%\", opacity: 0 },\n },\n \"from-right\": {\n initial: { x: \"100%\", opacity: 0 },\n animate: { x: 0, opacity: 1 },\n exit: { x: \"100%\", opacity: 0 },\n },\n fade: {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n exit: { opacity: 0 },\n },\n \"top-in-bottom-out\": {\n initial: { y: \"-100%\", opacity: 0 },\n animate: { y: 0, opacity: 1 },\n exit: { y: \"100%\", opacity: 0 },\n },\n \"left-in-right-out\": {\n initial: { x: \"-100%\", opacity: 0 },\n animate: { x: 0, opacity: 1 },\n exit: { x: \"100%\", opacity: 0 },\n },\n};\n\nexport default function HeroVideoDialog({\n animationStyle = \"from-center\",\n videoSrc,\n thumbnailSrc,\n thumbnailAlt = \"Video thumbnail\",\n className,\n}: HeroVideoProps) {\n const [isVideoOpen, setIsVideoOpen] = useState(false);\n const selectedAnimation = animationVariants[animationStyle];\n\n return (\n <div className={cn(\"relative\", className)}>\n <div\n className=\"relative cursor-pointer group\"\n onClick={() => setIsVideoOpen(true)}\n >\n <img\n src={thumbnailSrc}\n alt={thumbnailAlt}\n width={1920}\n height={1080}\n className=\"w-full transition-all duration-200 group-hover:brightness-[0.8] ease-out rounded-md shadow-lg border\"\n />\n <div className=\"absolute inset-0 flex items-center justify-center group-hover:scale-100 scale-[0.9] transition-all duration-200 ease-out rounded-2xl\">\n <div className=\"bg-primary/10 flex items-center justify-center rounded-full backdrop-blur-md size-28\">\n <div\n className={`flex items-center justify-center bg-gradient-to-b from-primary/30 to-primary shadow-md rounded-full size-20 transition-all ease-out duration-200 relative group-hover:scale-[1.2] scale-100`}\n >\n <Play\n className=\"size-8 text-white fill-white group-hover:scale-105 scale-100 transition-transform duration-200 ease-out\"\n style={{\n filter:\n \"drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06))\",\n }}\n />\n </div>\n </div>\n </div>\n </div>\n <AnimatePresence>\n {isVideoOpen && (\n <motion.div\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n onClick={() => setIsVideoOpen(false)}\n exit={{ opacity: 0 }}\n className=\"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-md\"\n >\n <motion.div\n {...selectedAnimation}\n transition={{ type: \"spring\", damping: 30, stiffness: 300 }}\n className=\"relative w-full max-w-4xl aspect-video mx-4 md:mx-0\"\n >\n <motion.button className=\"absolute -top-16 right-0 text-white text-xl bg-neutral-900/50 ring-1 backdrop-blur-md rounded-full p-2 dark:bg-neutral-100/50 dark:text-black\">\n <XIcon className=\"size-5\" />\n </motion.button>\n <div className=\"size-full border-2 border-white rounded-2xl overflow-hidden isolate z-[1] relative\">\n <iframe\n src={videoSrc}\n className=\"size-full rounded-2xl\"\n allowFullScreen\n allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\"\n ></iframe>\n </div>\n </motion.div>\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n );\n}\n",
+ "content": "\"use client\";\n\nimport { useState } from \"react\";\nimport { AnimatePresence, motion } from \"motion/react\";\nimport { Play, XIcon } from \"lucide-react\";\n\nimport { cn } from \"@/lib/utils\";\n\ntype AnimationStyle =\n | \"from-bottom\"\n | \"from-center\"\n | \"from-top\"\n | \"from-left\"\n | \"from-right\"\n | \"fade\"\n | \"top-in-bottom-out\"\n | \"left-in-right-out\";\n\ninterface HeroVideoProps {\n animationStyle?: AnimationStyle;\n videoSrc: string;\n thumbnailSrc: string;\n thumbnailAlt?: string;\n className?: string;\n}\n\nconst animationVariants = {\n \"from-bottom\": {\n initial: { y: \"100%\", opacity: 0 },\n animate: { y: 0, opacity: 1 },\n exit: { y: \"100%\", opacity: 0 },\n },\n \"from-center\": {\n initial: { scale: 0.5, opacity: 0 },\n animate: { scale: 1, opacity: 1 },\n exit: { scale: 0.5, opacity: 0 },\n },\n \"from-top\": {\n initial: { y: \"-100%\", opacity: 0 },\n animate: { y: 0, opacity: 1 },\n exit: { y: \"-100%\", opacity: 0 },\n },\n \"from-left\": {\n initial: { x: \"-100%\", opacity: 0 },\n animate: { x: 0, opacity: 1 },\n exit: { x: \"-100%\", opacity: 0 },\n },\n \"from-right\": {\n initial: { x: \"100%\", opacity: 0 },\n animate: { x: 0, opacity: 1 },\n exit: { x: \"100%\", opacity: 0 },\n },\n fade: {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n exit: { opacity: 0 },\n },\n \"top-in-bottom-out\": {\n initial: { y: \"-100%\", opacity: 0 },\n animate: { y: 0, opacity: 1 },\n exit: { y: \"100%\", opacity: 0 },\n },\n \"left-in-right-out\": {\n initial: { x: \"-100%\", opacity: 0 },\n animate: { x: 0, opacity: 1 },\n exit: { x: \"100%\", opacity: 0 },\n },\n};\n\nexport default function HeroVideoDialog({\n animationStyle = \"from-center\",\n videoSrc,\n thumbnailSrc,\n thumbnailAlt = \"Video thumbnail\",\n className,\n}: HeroVideoProps) {\n const [isVideoOpen, setIsVideoOpen] = useState(false);\n const selectedAnimation = animationVariants[animationStyle];\n\n return (\n <div className={cn(\"relative\", className)}>\n <div\n className=\"group relative cursor-pointer\"\n onClick={() => setIsVideoOpen(true)}\n >\n <img\n src={thumbnailSrc}\n alt={thumbnailAlt}\n width={1920}\n height={1080}\n className=\"w-full rounded-md border shadow-lg transition-all duration-200 ease-out group-hover:brightness-[0.8]\"\n />\n <div className=\"absolute inset-0 flex scale-[0.9] items-center justify-center rounded-2xl transition-all duration-200 ease-out group-hover:scale-100\">\n <div className=\"flex size-28 items-center justify-center rounded-full bg-primary/10 backdrop-blur-md\">\n <div\n className={`relative flex size-20 scale-100 items-center justify-center rounded-full bg-gradient-to-b from-primary/30 to-primary shadow-md transition-all duration-200 ease-out group-hover:scale-[1.2]`}\n >\n <Play\n className=\"size-8 scale-100 fill-white text-white transition-transform duration-200 ease-out group-hover:scale-105\"\n style={{\n filter:\n \"drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06))\",\n }}\n />\n </div>\n </div>\n </div>\n </div>\n <AnimatePresence>\n {isVideoOpen && (\n <motion.div\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n onClick={() => setIsVideoOpen(false)}\n exit={{ opacity: 0 }}\n className=\"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-md\"\n >\n <motion.div\n {...selectedAnimation}\n transition={{ type: \"spring\", damping: 30, stiffness: 300 }}\n className=\"relative mx-4 aspect-video w-full max-w-4xl md:mx-0\"\n >\n <motion.button className=\"absolute -top-16 right-0 rounded-full bg-neutral-900/50 p-2 text-xl text-white ring-1 backdrop-blur-md dark:bg-neutral-100/50 dark:text-black\">\n <XIcon className=\"size-5\" />\n </motion.button>\n <div className=\"relative isolate z-[1] size-full overflow-hidden rounded-2xl border-2 border-white\">\n <iframe\n src={videoSrc}\n className=\"size-full rounded-2xl\"\n allowFullScreen\n allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\"\n ></iframe>\n </div>\n </motion.div>\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n );\n}\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/icon-cloud.json b/public/r/styles/default/icon-cloud.json
index e1e7a58e..285d895d 100644
--- a/public/r/styles/default/icon-cloud.json
+++ b/public/r/styles/default/icon-cloud.json
@@ -8,7 +8,7 @@
"files": [
{
"path": "magicui/icon-cloud.tsx",
- "content": "\"use client\";\n\nimport { useEffect, useMemo, useState } from \"react\";\nimport { useTheme } from \"next-themes\";\nimport {\n Cloud,\n fetchSimpleIcons,\n ICloud,\n renderSimpleIcon,\n SimpleIcon,\n} from \"react-icon-cloud\";\n\nexport type DynamicCloudProps = {\n iconSlugs?: string[]; // Made iconSlugs optional\n imageArray?: string[];\n};\n\nexport const cloudProps: Omit<ICloud, \"children\"> = {\n containerProps: {\n style: {\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n width: \"100%\",\n paddingTop: 40,\n },\n },\n options: {\n reverse: true,\n depth: 1,\n wheelZoom: false,\n imageScale: 2,\n activeCursor: \"default\",\n tooltip: \"native\",\n initial: [0.1, -0.1],\n clickToFront: 500,\n tooltipDelay: 0,\n outlineColour: \"#0000\",\n maxSpeed: 0.04,\n minSpeed: 0.02,\n // dragControl: false,\n },\n};\n\nexport const renderCustomIcon = (\n icon: SimpleIcon,\n theme: string,\n imageArray?: string[],\n) => {\n const bgHex = theme === \"light\" ? \"#f3f2ef\" : \"#080510\";\n const fallbackHex = theme === \"light\" ? \"#6e6e73\" : \"#ffffff\";\n const minContrastRatio = theme === \"dark\" ? 2 : 1.2;\n\n return renderSimpleIcon({\n icon,\n bgHex,\n fallbackHex,\n minContrastRatio,\n size: 42,\n aProps: {\n href: undefined,\n target: undefined,\n rel: undefined,\n onClick: (e: any) => e.preventDefault(),\n },\n });\n};\n\ntype IconData = Awaited<ReturnType<typeof fetchSimpleIcons>>;\n\nexport default function IconCloud({\n iconSlugs = [], // Default to an empty array if not provided\n imageArray,\n}: DynamicCloudProps) {\n const [data, setData] = useState<IconData | null>(null);\n const { theme } = useTheme();\n\n useEffect(() => {\n if (iconSlugs.length > 0) {\n // Check if iconSlugs is not empty\n fetchSimpleIcons({ slugs: iconSlugs }).then(setData);\n }\n }, [iconSlugs]);\n\n const renderedIcons = useMemo(() => {\n if (!data) return null;\n\n return Object.values(data.simpleIcons).map((icon) =>\n renderCustomIcon(icon, theme || \"light\"),\n );\n }, [data, theme]);\n\n return (\n // @ts-ignore\n <Cloud {...cloudProps}>\n <>\n <>{renderedIcons}</>\n {imageArray &&\n imageArray.length > 0 &&\n imageArray.map((image, index) => {\n return (\n <a key={index} href=\"#\" onClick={(e) => e.preventDefault()}>\n <img height=\"42\" width=\"42\" alt=\"A globe\" src={image} />\n </a>\n );\n })}\n </>\n </Cloud>\n );\n}\n",
+ "content": "\"use client\";\n\nimport { useEffect, useMemo, useState } from \"react\";\nimport { useTheme } from \"next-themes\";\nimport {\n Cloud,\n fetchSimpleIcons,\n ICloud,\n renderSimpleIcon,\n SimpleIcon,\n} from \"react-icon-cloud\";\n\nexport type DynamicCloudProps = {\n iconSlugs?: string[]; // Made iconSlugs optional\n imageArray?: string[];\n};\n\nexport const cloudProps: Omit<ICloud, \"children\"> = {\n containerProps: {\n style: {\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n width: \"100%\",\n paddingTop: 40,\n },\n },\n options: {\n reverse: true,\n depth: 1,\n wheelZoom: false,\n imageScale: 2,\n activeCursor: \"default\",\n tooltip: \"native\",\n initial: [0.1, -0.1],\n clickToFront: 500,\n tooltipDelay: 0,\n outlineColour: \"#0000\",\n maxSpeed: 0.04,\n minSpeed: 0.02,\n // dragControl: false,\n },\n};\n\nexport const renderCustomIcon = (\n icon: SimpleIcon,\n theme: string,\n imageArray?: string[],\n) => {\n const bgHex = theme === \"light\" ? \"#f3f2ef\" : \"#080510\";\n const fallbackHex = theme === \"light\" ? \"#6e6e73\" : \"#ffffff\";\n const minContrastRatio = theme === \"dark\" ? 2 : 1.2;\n\n return renderSimpleIcon({\n icon,\n bgHex,\n fallbackHex,\n minContrastRatio,\n size: 42,\n aProps: {\n href: undefined,\n target: undefined,\n rel: undefined,\n onClick: (e: React.MouseEvent<HTMLAnchorElement>) => e.preventDefault(),\n },\n });\n};\n\ntype IconData = Awaited<ReturnType<typeof fetchSimpleIcons>>;\n\nexport default function IconCloud({\n iconSlugs = [], // Default to an empty array if not provided\n imageArray,\n}: DynamicCloudProps) {\n const [data, setData] = useState<IconData | null>(null);\n const { theme } = useTheme();\n\n useEffect(() => {\n if (iconSlugs.length > 0) {\n // Check if iconSlugs is not empty\n fetchSimpleIcons({ slugs: iconSlugs }).then(setData);\n }\n }, [iconSlugs]);\n\n const renderedIcons = useMemo(() => {\n if (!data) return null;\n\n return Object.values(data.simpleIcons).map((icon) =>\n renderCustomIcon(icon, theme || \"light\"),\n );\n }, [data, theme]);\n\n return (\n // @ts-ignore\n <Cloud {...cloudProps}>\n <>\n <>{renderedIcons}</>\n {imageArray &&\n imageArray.length > 0 &&\n imageArray.map((image, index) => {\n return (\n <a key={index} href=\"#\" onClick={(e) => e.preventDefault()}>\n <img height=\"42\" width=\"42\" alt=\"A globe\" src={image} />\n </a>\n );\n })}\n </>\n </Cloud>\n );\n}\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/letter-pullup.json b/public/r/styles/default/letter-pullup.json
index 36f2f3d9..a79bda3a 100644
--- a/public/r/styles/default/letter-pullup.json
+++ b/public/r/styles/default/letter-pullup.json
@@ -2,12 +2,12 @@
"name": "letter-pullup",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/letter-pullup.tsx",
- "content": "\"use client\";\n\nimport { motion } from \"framer-motion\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface LetterPullupProps {\n className?: string;\n words: string;\n delay?: number;\n}\n\nexport default function LetterPullup({\n className,\n words,\n delay,\n}: LetterPullupProps) {\n const letters = words.split(\"\");\n\n const pullupVariant = {\n initial: { y: 100, opacity: 0 },\n animate: (i: any) => ({\n y: 0,\n opacity: 1,\n transition: {\n delay: i * (delay ? delay : 0.05), // By default, delay each letter's animation by 0.05 seconds\n },\n }),\n };\n\n return (\n <div className=\"flex justify-center\">\n {letters.map((letter, i) => (\n <motion.h1\n key={i}\n variants={pullupVariant}\n initial=\"initial\"\n animate=\"animate\"\n custom={i}\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-4xl md:leading-[5rem]\",\n className,\n )}\n >\n {letter === \" \" ? <span>&nbsp;</span> : letter}\n </motion.h1>\n ))}\n </div>\n );\n}\n",
+ "content": "\"use client\";\n\nimport { motion } from \"motion/react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface LetterPullupProps {\n className?: string;\n words: string;\n delay?: number;\n}\n\nexport default function LetterPullup({\n className,\n words,\n delay,\n}: LetterPullupProps) {\n const letters = words.split(\"\");\n\n const pullupVariant = {\n initial: { y: 100, opacity: 0 },\n animate: (i: number) => ({\n y: 0,\n opacity: 1,\n transition: {\n delay: i * (delay ? delay : 0.05), // By default, delay each letter's animation by 0.05 seconds\n },\n }),\n };\n\n return (\n <div className=\"flex justify-center\">\n {letters.map((letter, i) => (\n <motion.h1\n key={i}\n variants={pullupVariant}\n initial=\"initial\"\n animate=\"animate\"\n custom={i}\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-4xl md:leading-[5rem]\",\n className,\n )}\n >\n {letter === \" \" ? <span>&nbsp;</span> : letter}\n </motion.h1>\n ))}\n </div>\n );\n}\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/magic-card.json b/public/r/styles/default/magic-card.json
index 7fa1d6f9..8b662dbf 100644
--- a/public/r/styles/default/magic-card.json
+++ b/public/r/styles/default/magic-card.json
@@ -2,12 +2,12 @@
"name": "magic-card",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/magic-card.tsx",
- "content": "\"use client\";\n\nimport React, { useCallback, useEffect, useRef } from \"react\";\nimport { motion, useMotionTemplate, useMotionValue } from \"framer-motion\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport interface MagicCardProps extends React.HTMLAttributes<HTMLDivElement> {\n gradientSize?: number;\n gradientColor?: string;\n gradientOpacity?: number;\n gradientColors?: [string, string, string];\n}\n\nexport function MagicCard({\n children,\n className,\n gradientSize = 200,\n gradientColor = \"#262626\",\n gradientOpacity = 0.8,\n gradientColors = [\"#FF0080\", \"#4096FF\", \"#78FF78\"],\n}: MagicCardProps) {\n const cardRef = useRef<HTMLDivElement>(null);\n const mouseX = useMotionValue(-gradientSize);\n const mouseY = useMotionValue(-gradientSize);\n\n const handleMouseMove = useCallback(\n (e: MouseEvent) => {\n if (cardRef.current) {\n const { left, top } = cardRef.current.getBoundingClientRect();\n const clientX = e.clientX;\n const clientY = e.clientY;\n mouseX.set(clientX - left);\n mouseY.set(clientY - top);\n }\n },\n [mouseX, mouseY]\n );\n\n const handleMouseOut = useCallback(\n (e: MouseEvent) => {\n if (!e.relatedTarget) {\n document.removeEventListener(\"mousemove\", handleMouseMove);\n mouseX.set(-gradientSize);\n mouseY.set(-gradientSize);\n }\n },\n [handleMouseMove, mouseX, gradientSize, mouseY]\n );\n\n const handleMouseEnter = useCallback(() => {\n document.addEventListener(\"mousemove\", handleMouseMove);\n mouseX.set(-gradientSize);\n mouseY.set(-gradientSize);\n }, [handleMouseMove, mouseX, gradientSize, mouseY]);\n\n useEffect(() => {\n document.addEventListener(\"mousemove\", handleMouseMove);\n document.addEventListener(\"mouseout\", handleMouseOut);\n document.addEventListener(\"mouseenter\", handleMouseEnter);\n\n return () => {\n document.removeEventListener(\"mousemove\", handleMouseMove);\n document.removeEventListener(\"mouseout\", handleMouseOut);\n document.removeEventListener(\"mouseenter\", handleMouseEnter);\n };\n }, [handleMouseEnter, handleMouseMove, handleMouseOut]);\n\n useEffect(() => {\n mouseX.set(-gradientSize);\n mouseY.set(-gradientSize);\n }, [gradientSize, mouseX, mouseY]);\n\n return (\n <div\n ref={cardRef}\n className={cn(\n \"group relative flex size-full rounded-xl backdrop-blur-lg\",\n className\n )}\n >\n <div className=\"absolute inset-0.5 z-10 rounded-xl bg-neutral-100 dark:bg-neutral-900\" />\n <div className=\"relative z-30\">{children}</div>\n <motion.div\n className=\"pointer-events-none absolute inset-px z-10 rounded-xl opacity-0 transition-opacity duration-300 group-hover:opacity-100\"\n style={{\n background: useMotionTemplate`\n radial-gradient(${gradientSize}px circle at ${mouseX}px ${mouseY}px, ${gradientColor}, transparent 100%)\n `,\n opacity: gradientOpacity,\n }}\n />\n <motion.div\n className=\"pointer-events-none absolute inset-px rounded-xl duration-300 group-hover:opacity-100\"\n style={{\n background: useMotionTemplate`\n radial-gradient(${gradientSize}px circle at ${mouseX}px ${mouseY}px,\n ${gradientColors[0]}, \n ${gradientColors[1]}, \n ${gradientColors[2]}, \n transparent 100%\n )\n `,\n opacity: 1,\n }}\n />\n </div>\n );\n}\n",
+ "content": "\"use client\";\n\nimport { motion, useMotionTemplate, useMotionValue } from \"motion/react\";\nimport React, { useCallback, useEffect, useRef } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface MagicCardProps extends React.HTMLAttributes<HTMLDivElement> {\n gradientSize?: number;\n gradientColor?: string;\n gradientOpacity?: number;\n gradientFrom?: string;\n gradientTo?: string;\n}\n\nexport function MagicCard({\n children,\n className,\n gradientSize = 200,\n gradientColor = \"#262626\",\n gradientOpacity = 0.8,\n gradientFrom = \"#9E7AFF\",\n gradientTo = \"#FE8BBB\",\n}: MagicCardProps) {\n const cardRef = useRef<HTMLDivElement>(null);\n const mouseX = useMotionValue(-gradientSize);\n const mouseY = useMotionValue(-gradientSize);\n\n const handleMouseMove = useCallback(\n (e: MouseEvent) => {\n if (cardRef.current) {\n const { left, top } = cardRef.current.getBoundingClientRect();\n const clientX = e.clientX;\n const clientY = e.clientY;\n mouseX.set(clientX - left);\n mouseY.set(clientY - top);\n }\n },\n [mouseX, mouseY],\n );\n\n const handleMouseOut = useCallback(\n (e: MouseEvent) => {\n if (!e.relatedTarget) {\n document.removeEventListener(\"mousemove\", handleMouseMove);\n mouseX.set(-gradientSize);\n mouseY.set(-gradientSize);\n }\n },\n [handleMouseMove, mouseX, gradientSize, mouseY],\n );\n\n const handleMouseEnter = useCallback(() => {\n document.addEventListener(\"mousemove\", handleMouseMove);\n mouseX.set(-gradientSize);\n mouseY.set(-gradientSize);\n }, [handleMouseMove, mouseX, gradientSize, mouseY]);\n\n useEffect(() => {\n document.addEventListener(\"mousemove\", handleMouseMove);\n document.addEventListener(\"mouseout\", handleMouseOut);\n document.addEventListener(\"mouseenter\", handleMouseEnter);\n\n return () => {\n document.removeEventListener(\"mousemove\", handleMouseMove);\n document.removeEventListener(\"mouseout\", handleMouseOut);\n document.removeEventListener(\"mouseenter\", handleMouseEnter);\n };\n }, [handleMouseEnter, handleMouseMove, handleMouseOut]);\n\n useEffect(() => {\n mouseX.set(-gradientSize);\n mouseY.set(-gradientSize);\n }, [gradientSize, mouseX, mouseY]);\n\n return (\n <div\n ref={cardRef}\n className={cn(\"group relative flex size-full rounded-xl\", className)}\n >\n <div className=\"absolute inset-px z-10 rounded-xl bg-neutral-100 dark:bg-neutral-900\" />\n <div className=\"relative z-30\">{children}</div>\n <motion.div\n className=\"pointer-events-none absolute inset-px z-10 rounded-xl opacity-0 transition-opacity duration-300 group-hover:opacity-100\"\n style={{\n background: useMotionTemplate`\n radial-gradient(${gradientSize}px circle at ${mouseX}px ${mouseY}px, ${gradientColor}, transparent 100%)\n `,\n opacity: gradientOpacity,\n }}\n />\n <motion.div\n className=\"pointer-events-none absolute inset-0 rounded-xl duration-300 group-hover:opacity-100\"\n style={{\n background: useMotionTemplate`\n radial-gradient(${gradientSize}px circle at ${mouseX}px ${mouseY}px,\n ${gradientFrom}, \n ${gradientTo}, \n transparent 100%\n )\n `,\n }}\n />\n </div>\n );\n}\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/morphing-text.json b/public/r/styles/default/morphing-text.json
index f2b1a02b..3514e79c 100644
--- a/public/r/styles/default/morphing-text.json
+++ b/public/r/styles/default/morphing-text.json
@@ -2,12 +2,12 @@
"name": "morphing-text",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/morphing-text.tsx",
- "content": "\"use client\";\n\nimport { useCallback, useEffect, useRef } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nconst morphTime = 1.5;\nconst cooldownTime = 0.5;\n\nconst useMorphingText = (texts: string[]) => {\n const textIndexRef = useRef(0);\n const morphRef = useRef(0);\n const cooldownRef = useRef(0);\n const timeRef = useRef(new Date());\n\n const text1Ref = useRef<HTMLSpanElement>(null);\n const text2Ref = useRef<HTMLSpanElement>(null);\n\n const setStyles = useCallback(\n (fraction: number) => {\n const [current1, current2] = [text1Ref.current, text2Ref.current];\n if (!current1 || !current2) return;\n\n current2.style.filter = `blur(${Math.min(8 / fraction - 8, 100)}px)`;\n current2.style.opacity = `${Math.pow(fraction, 0.4) * 100}%`;\n\n const invertedFraction = 1 - fraction;\n current1.style.filter = `blur(${Math.min(8 / invertedFraction - 8, 100)}px)`;\n current1.style.opacity = `${Math.pow(invertedFraction, 0.4) * 100}%`;\n\n current1.textContent = texts[textIndexRef.current % texts.length];\n current2.textContent = texts[(textIndexRef.current + 1) % texts.length];\n },\n [texts],\n );\n\n const doMorph = useCallback(() => {\n morphRef.current -= cooldownRef.current;\n cooldownRef.current = 0;\n\n let fraction = morphRef.current / morphTime;\n\n if (fraction > 1) {\n cooldownRef.current = cooldownTime;\n fraction = 1;\n }\n\n setStyles(fraction);\n\n if (fraction === 1) {\n textIndexRef.current++;\n }\n }, [setStyles]);\n\n const doCooldown = useCallback(() => {\n morphRef.current = 0;\n const [current1, current2] = [text1Ref.current, text2Ref.current];\n if (current1 && current2) {\n current2.style.filter = \"none\";\n current2.style.opacity = \"100%\";\n current1.style.filter = \"none\";\n current1.style.opacity = \"0%\";\n }\n }, []);\n\n useEffect(() => {\n let animationFrameId: number;\n\n const animate = () => {\n animationFrameId = requestAnimationFrame(animate);\n\n const newTime = new Date();\n const dt = (newTime.getTime() - timeRef.current.getTime()) / 1000;\n timeRef.current = newTime;\n\n cooldownRef.current -= dt;\n\n if (cooldownRef.current <= 0) doMorph();\n else doCooldown();\n };\n\n animate();\n return () => {\n cancelAnimationFrame(animationFrameId);\n };\n }, [doMorph, doCooldown]);\n\n return { text1Ref, text2Ref };\n};\n\ninterface MorphingTextProps {\n className?: string;\n texts: string[];\n}\n\nconst Texts: React.FC<Pick<MorphingTextProps, \"texts\">> = ({ texts }) => {\n const { text1Ref, text2Ref } = useMorphingText(texts);\n return (\n <>\n <span\n className=\"absolute inset-x-0 top-0 m-auto inline-block w-full\"\n ref={text1Ref}\n />\n <span\n className=\"absolute inset-x-0 top-0 m-auto inline-block w-full\"\n ref={text2Ref}\n />\n </>\n );\n};\n\nconst SvgFilters: React.FC = () => (\n <svg id=\"filters\" className=\"hidden\" preserveAspectRatio=\"xMidYMid slice\">\n <defs>\n <filter id=\"threshold\">\n <feColorMatrix\n in=\"SourceGraphic\"\n type=\"matrix\"\n values=\"1 0 0 0 0\n 0 1 0 0 0\n 0 0 1 0 0\n 0 0 0 255 -140\"\n />\n </filter>\n </defs>\n </svg>\n);\n\nconst MorphingText: React.FC<MorphingTextProps> = ({ texts, className }) => (\n <div\n className={cn(\n \"relative mx-auto h-16 w-full max-w-screen-md text-center font-sans text-[40pt] font-bold leading-none [filter:url(#threshold)_blur(0.6px)] md:h-24 lg:text-[6rem]\",\n className,\n )}\n >\n <Texts texts={texts} />\n <SvgFilters />\n </div>\n);\n\nexport default MorphingText;\n",
+ "content": "\"use client\";\n\nimport { useCallback, useEffect, useRef } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nconst morphTime = 1.5;\nconst cooldownTime = 0.5;\n\nconst useMorphingText = (texts: string[]) => {\n const textIndexRef = useRef(0);\n const morphRef = useRef(0);\n const cooldownRef = useRef(0);\n const timeRef = useRef(new Date());\n\n const text1Ref = useRef<HTMLSpanElement>(null);\n const text2Ref = useRef<HTMLSpanElement>(null);\n\n const setStyles = useCallback(\n (fraction: number) => {\n const [current1, current2] = [text1Ref.current, text2Ref.current];\n if (!current1 || !current2) return;\n\n current2.style.filter = `blur(${Math.min(8 / fraction - 8, 100)}px)`;\n current2.style.opacity = `${Math.pow(fraction, 0.4) * 100}%`;\n\n const invertedFraction = 1 - fraction;\n current1.style.filter = `blur(${Math.min(8 / invertedFraction - 8, 100)}px)`;\n current1.style.opacity = `${Math.pow(invertedFraction, 0.4) * 100}%`;\n\n current1.textContent = texts[textIndexRef.current % texts.length];\n current2.textContent = texts[(textIndexRef.current + 1) % texts.length];\n },\n [texts],\n );\n\n const doMorph = useCallback(() => {\n morphRef.current -= cooldownRef.current;\n cooldownRef.current = 0;\n\n let fraction = morphRef.current / morphTime;\n\n if (fraction > 1) {\n cooldownRef.current = cooldownTime;\n fraction = 1;\n }\n\n setStyles(fraction);\n\n if (fraction === 1) {\n textIndexRef.current++;\n }\n }, [setStyles]);\n\n const doCooldown = useCallback(() => {\n morphRef.current = 0;\n const [current1, current2] = [text1Ref.current, text2Ref.current];\n if (current1 && current2) {\n current2.style.filter = \"none\";\n current2.style.opacity = \"100%\";\n current1.style.filter = \"none\";\n current1.style.opacity = \"0%\";\n }\n }, []);\n\n useEffect(() => {\n let animationFrameId: number;\n\n const animate = () => {\n animationFrameId = requestAnimationFrame(animate);\n\n const newTime = new Date();\n const dt = (newTime.getTime() - timeRef.current.getTime()) / 1000;\n timeRef.current = newTime;\n\n cooldownRef.current -= dt;\n\n if (cooldownRef.current <= 0) doMorph();\n else doCooldown();\n };\n\n animate();\n return () => {\n cancelAnimationFrame(animationFrameId);\n };\n }, [doMorph, doCooldown]);\n\n return { text1Ref, text2Ref };\n};\n\ninterface MorphingTextProps {\n className?: string;\n texts: string[];\n}\n\nconst Texts: React.FC<Pick<MorphingTextProps, \"texts\">> = ({ texts }) => {\n const { text1Ref, text2Ref } = useMorphingText(texts);\n return (\n <>\n <span\n className=\"absolute inset-x-0 top-0 m-auto inline-block w-full\"\n ref={text1Ref}\n />\n <span\n className=\"absolute inset-x-0 top-0 m-auto inline-block w-full\"\n ref={text2Ref}\n />\n </>\n );\n};\n\nconst SvgFilters: React.FC = () => (\n <svg\n id=\"filters\"\n className=\"fixed h-0 w-0\"\n preserveAspectRatio=\"xMidYMid slice\"\n >\n <defs>\n <filter id=\"threshold\">\n <feColorMatrix\n in=\"SourceGraphic\"\n type=\"matrix\"\n values=\"1 0 0 0 0\n 0 1 0 0 0\n 0 0 1 0 0\n 0 0 0 255 -140\"\n />\n </filter>\n </defs>\n </svg>\n);\n\nconst MorphingText: React.FC<MorphingTextProps> = ({ texts, className }) => (\n <div\n className={cn(\n \"relative mx-auto h-16 w-full max-w-screen-md text-center font-sans text-[40pt] font-bold leading-none [filter:url(#threshold)_blur(0.6px)] md:h-24 lg:text-[6rem]\",\n className,\n )}\n >\n <Texts texts={texts} />\n <SvgFilters />\n </div>\n);\n\nexport default MorphingText;\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/number-ticker.json b/public/r/styles/default/number-ticker.json
index 5187f29b..6dce0756 100644
--- a/public/r/styles/default/number-ticker.json
+++ b/public/r/styles/default/number-ticker.json
@@ -2,12 +2,12 @@
"name": "number-ticker",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/number-ticker.tsx",
- "content": "\"use client\";\n\nimport { useEffect, useRef } from \"react\";\nimport { useInView, useMotionValue, useSpring } from \"framer-motion\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport default function NumberTicker({\n value,\n direction = \"up\",\n delay = 0,\n className,\n decimalPlaces = 0,\n}: {\n value: number;\n direction?: \"up\" | \"down\";\n className?: string;\n delay?: number; // delay in s\n decimalPlaces?: number;\n}) {\n const ref = useRef<HTMLSpanElement>(null);\n const motionValue = useMotionValue(direction === \"down\" ? value : 0);\n const springValue = useSpring(motionValue, {\n damping: 60,\n stiffness: 100,\n });\n const isInView = useInView(ref, { once: true, margin: \"0px\" });\n\n useEffect(() => {\n isInView &&\n setTimeout(() => {\n motionValue.set(direction === \"down\" ? 0 : value);\n }, delay * 1000);\n }, [motionValue, isInView, delay, value, direction]);\n\n useEffect(\n () =>\n springValue.on(\"change\", (latest) => {\n if (ref.current) {\n ref.current.textContent = Intl.NumberFormat(\"en-US\", {\n minimumFractionDigits: decimalPlaces,\n maximumFractionDigits: decimalPlaces,\n }).format(Number(latest.toFixed(decimalPlaces)));\n }\n }),\n [springValue, decimalPlaces],\n );\n\n return (\n <span\n className={cn(\n \"inline-block tabular-nums text-black dark:text-white tracking-wider\",\n className,\n )}\n ref={ref}\n />\n );\n}\n",
+ "content": "\"use client\";\n\nimport { useEffect, useRef } from \"react\";\nimport { useInView, useMotionValue, useSpring } from \"motion/react\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport default function NumberTicker({\n value,\n direction = \"up\",\n delay = 0,\n className,\n decimalPlaces = 0,\n}: {\n value: number;\n direction?: \"up\" | \"down\";\n className?: string;\n delay?: number; // delay in s\n decimalPlaces?: number;\n}) {\n const ref = useRef<HTMLSpanElement>(null);\n const motionValue = useMotionValue(direction === \"down\" ? value : 0);\n const springValue = useSpring(motionValue, {\n damping: 60,\n stiffness: 100,\n });\n const isInView = useInView(ref, { once: true, margin: \"0px\" });\n\n useEffect(() => {\n isInView &&\n setTimeout(() => {\n motionValue.set(direction === \"down\" ? 0 : value);\n }, delay * 1000);\n }, [motionValue, isInView, delay, value, direction]);\n\n useEffect(\n () =>\n springValue.on(\"change\", (latest) => {\n if (ref.current) {\n ref.current.textContent = Intl.NumberFormat(\"en-US\", {\n minimumFractionDigits: decimalPlaces,\n maximumFractionDigits: decimalPlaces,\n }).format(Number(latest.toFixed(decimalPlaces)));\n }\n }),\n [springValue, decimalPlaces],\n );\n\n return (\n <span\n className={cn(\n \"inline-block tabular-nums tracking-wider text-black dark:text-white\",\n className,\n )}\n ref={ref}\n />\n );\n}\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/particles.json b/public/r/styles/default/particles.json
index bdfb6201..6f1b2ccd 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 { 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",
+ "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}\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\ntype 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\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 const resizeTimeout = useRef<NodeJS.Timeout>();\n\n useEffect(() => {\n if (canvasRef.current) {\n context.current = canvasRef.current.getContext(\"2d\");\n }\n initCanvas();\n animate();\n\n const handleResize = () => {\n if (resizeTimeout.current) {\n clearTimeout(resizeTimeout.current);\n }\n resizeTimeout.current = setTimeout(() => {\n initCanvas();\n }, 200);\n };\n\n window.addEventListener(\"resize\", handleResize);\n\n return () => {\n if (rafID.current != null) {\n window.cancelAnimationFrame(rafID.current);\n }\n if (resizeTimeout.current) {\n clearTimeout(resizeTimeout.current);\n }\n window.removeEventListener(\"resize\", handleResize);\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 const resizeCanvas = () => {\n if (canvasContainerRef.current && canvasRef.current && context.current) {\n canvasSize.current.w = canvasContainerRef.current.offsetWidth;\n canvasSize.current.h = canvasContainerRef.current.offsetHeight;\n\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 // Clear existing particles and create new ones with exact quantity\n circles.current = [];\n for (let i = 0; i < quantity; i++) {\n const circle = circleParams();\n drawCircle(circle);\n }\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 }\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/pulsating-button.json b/public/r/styles/default/pulsating-button.json
index e3e04f18..9d9cb995 100644
--- a/public/r/styles/default/pulsating-button.json
+++ b/public/r/styles/default/pulsating-button.json
@@ -4,7 +4,7 @@
"files": [
{
"path": "magicui/pulsating-button.tsx",
- "content": "\"use client\";\n\nimport React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface PulsatingButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n pulseColor?: string;\n duration?: string;\n}\n\nexport default function PulsatingButton({\n className,\n children,\n pulseColor = \"#0096ff\",\n duration = \"1.5s\",\n ...props\n}: PulsatingButtonProps) {\n return (\n <button\n className={cn(\n \"relative text-center cursor-pointer flex justify-center items-center rounded-lg text-white dark:text-black bg-blue-500 dark:bg-blue-500 px-4 py-2\",\n className,\n )}\n style={\n {\n \"--pulse-color\": pulseColor,\n \"--duration\": duration,\n } as React.CSSProperties\n }\n {...props}\n >\n <div className=\"relative z-10\">{children}</div>\n <div className=\"absolute top-1/2 left-1/2 size-full rounded-lg bg-inherit animate-pulse -translate-x-1/2 -translate-y-1/2\" />\n </button>\n );\n}\n",
+ "content": "\"use client\";\n\nimport React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface PulsatingButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n pulseColor?: string;\n duration?: string;\n}\n\nexport default function PulsatingButton({\n className,\n children,\n pulseColor = \"#0096ff\",\n duration = \"1.5s\",\n ...props\n}: PulsatingButtonProps) {\n return (\n <button\n className={cn(\n \"relative flex cursor-pointer items-center justify-center rounded-lg bg-blue-500 px-4 py-2 text-center text-white dark:bg-blue-500 dark:text-black\",\n className,\n )}\n style={\n {\n \"--pulse-color\": pulseColor,\n \"--duration\": duration,\n } as React.CSSProperties\n }\n {...props}\n >\n <div className=\"relative z-10\">{children}</div>\n <div className=\"absolute left-1/2 top-1/2 size-full -translate-x-1/2 -translate-y-1/2 animate-pulse rounded-lg bg-inherit\" />\n </button>\n );\n}\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/scratch-to-reveal.json b/public/r/styles/default/scratch-to-reveal.json
index 36509ac9..b7a2a764 100644
--- a/public/r/styles/default/scratch-to-reveal.json
+++ b/public/r/styles/default/scratch-to-reveal.json
@@ -1,15 +1,13 @@
{
"name": "scratch-to-reveal",
"type": "registry:ui",
- "dependencies": [
- "framer-motion"
- ],
+ "dependencies": ["motion"],
"files": [
{
"path": "magicui/scratch-to-reveal.tsx",
- "content": "import { cn } from \"@/lib/utils\";\nimport React, { useRef, useEffect, useState } from \"react\";\nimport { motion, useAnimation } from \"framer-motion\";\n\ninterface ScratchToRevealProps {\n children: React.ReactNode;\n width: number;\n height: number;\n minScratchPercentage?: number;\n className?: string;\n onComplete?: () => void;\n gradientColors?: [string, string, string];\n}\n\nconst ScratchToReveal: React.FC<ScratchToRevealProps> = ({\n width,\n height,\n minScratchPercentage = 50,\n onComplete,\n children,\n className,\n gradientColors = [\"#A97CF8\", \"#F38CB8\", \"#FDCC92\"],\n}) => {\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const [isScratching, setIsScratching] = useState(false);\n const [isComplete, setIsComplete] = useState(false);\n\n const controls = useAnimation();\n\n useEffect(() => {\n const canvas = canvasRef.current;\n const ctx = canvas?.getContext(\"2d\");\n if (canvas && ctx) {\n ctx.fillStyle = \"#ccc\";\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n const gradient = ctx.createLinearGradient(\n 0,\n 0,\n canvas.width,\n canvas.height,\n );\n gradient.addColorStop(0, gradientColors[0]);\n gradient.addColorStop(0.5, gradientColors[1]);\n gradient.addColorStop(1, gradientColors[2]);\n ctx.fillStyle = gradient;\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n }\n }, [gradientColors]);\n\n useEffect(() => {\n const handleDocumentMouseMove = (event: MouseEvent) => {\n if (!isScratching) return;\n scratch(event.clientX, event.clientY);\n };\n\n const handleDocumentTouchMove = (event: TouchEvent) => {\n if (!isScratching) return;\n const touch = event.touches[0];\n scratch(touch.clientX, touch.clientY);\n };\n\n const handleDocumentMouseUp = () => {\n setIsScratching(false);\n checkCompletion();\n };\n\n const handleDocumentTouchEnd = () => {\n setIsScratching(false);\n checkCompletion();\n };\n\n document.addEventListener(\"mousedown\", handleDocumentMouseMove);\n document.addEventListener(\"mousemove\", handleDocumentMouseMove);\n document.addEventListener(\"touchstart\", handleDocumentTouchMove);\n document.addEventListener(\"touchmove\", handleDocumentTouchMove);\n document.addEventListener(\"mouseup\", handleDocumentMouseUp);\n document.addEventListener(\"touchend\", handleDocumentTouchEnd);\n document.addEventListener(\"touchcancel\", handleDocumentTouchEnd);\n\n return () => {\n document.removeEventListener(\"mousedown\", handleDocumentMouseMove);\n document.removeEventListener(\"mousemove\", handleDocumentMouseMove);\n document.removeEventListener(\"touchstart\", handleDocumentTouchMove);\n document.removeEventListener(\"touchmove\", handleDocumentTouchMove);\n document.removeEventListener(\"mouseup\", handleDocumentMouseUp);\n document.removeEventListener(\"touchend\", handleDocumentTouchEnd);\n document.removeEventListener(\"touchcancel\", handleDocumentTouchEnd);\n };\n }, [isScratching]);\n\n const handleMouseDown = () => setIsScratching(true);\n\n const handleTouchStart = () => setIsScratching(true);\n\n const scratch = (clientX: number, clientY: number) => {\n const canvas = canvasRef.current;\n const ctx = canvas?.getContext(\"2d\");\n if (canvas && ctx) {\n const rect = canvas.getBoundingClientRect();\n const x = clientX - rect.left + 16;\n const y = clientY - rect.top + 16;\n ctx.globalCompositeOperation = \"destination-out\";\n ctx.beginPath();\n ctx.arc(x, y, 30, 0, Math.PI * 2);\n ctx.fill();\n }\n };\n\n const startAnimation = async () => {\n await controls.start({\n scale: [1, 1.5, 1],\n rotate: [0, 10, -10, 10, -10, 0],\n transition: { duration: 0.5 },\n });\n\n // Call onComplete after animation finishes\n if (onComplete) {\n onComplete();\n }\n };\n\n const checkCompletion = () => {\n if (isComplete) return;\n\n const canvas = canvasRef.current;\n const ctx = canvas?.getContext(\"2d\");\n if (canvas && ctx) {\n const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);\n const pixels = imageData.data;\n const totalPixels = pixels.length / 4;\n let clearPixels = 0;\n\n for (let i = 3; i < pixels.length; i += 4) {\n if (pixels[i] === 0) clearPixels++;\n }\n\n const percentage = (clearPixels / totalPixels) * 100;\n\n if (percentage >= minScratchPercentage) {\n setIsComplete(true);\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n startAnimation();\n }\n }\n };\n\n return (\n <motion.div\n className={cn(\"relative select-none\", className)}\n style={{\n width,\n height,\n cursor:\n \"url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIj4KICA8Y2lyY2xlIGN4PSIxNiIgY3k9IjE2IiByPSIxNSIgc3R5bGU9ImZpbGw6I2ZmZjtzdHJva2U6IzAwMDtzdHJva2Utd2lkdGg6MXB4OyIgLz4KPC9zdmc+'), auto\",\n }}\n animate={controls}\n >\n <canvas\n ref={canvasRef}\n width={width}\n height={height}\n className=\"absolute left-0 top-0\"\n onMouseDown={handleMouseDown}\n onTouchStart={handleTouchStart}\n ></canvas>\n {children}\n </motion.div>\n );\n};\n\nexport default ScratchToReveal;\n",
+ "content": "import { cn } from \"@/lib/utils\";\nimport React, { useRef, useEffect, useState } from \"react\";\nimport { motion, useAnimation } from \"motion/react\";\n\ninterface ScratchToRevealProps {\n children: React.ReactNode;\n width: number;\n height: number;\n minScratchPercentage?: number;\n className?: string;\n onComplete?: () => void;\n gradientColors?: [string, string, string];\n}\n\nconst ScratchToReveal: React.FC<ScratchToRevealProps> = ({\n width,\n height,\n minScratchPercentage = 50,\n onComplete,\n children,\n className,\n gradientColors = [\"#A97CF8\", \"#F38CB8\", \"#FDCC92\"],\n}) => {\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const [isScratching, setIsScratching] = useState(false);\n const [isComplete, setIsComplete] = useState(false);\n\n const controls = useAnimation();\n\n useEffect(() => {\n const canvas = canvasRef.current;\n const ctx = canvas?.getContext(\"2d\");\n if (canvas && ctx) {\n ctx.fillStyle = \"#ccc\";\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n const gradient = ctx.createLinearGradient(\n 0,\n 0,\n canvas.width,\n canvas.height,\n );\n gradient.addColorStop(0, gradientColors[0]);\n gradient.addColorStop(0.5, gradientColors[1]);\n gradient.addColorStop(1, gradientColors[2]);\n ctx.fillStyle = gradient;\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n }\n }, [gradientColors]);\n\n useEffect(() => {\n const handleDocumentMouseMove = (event: MouseEvent) => {\n if (!isScratching) return;\n scratch(event.clientX, event.clientY);\n };\n\n const handleDocumentTouchMove = (event: TouchEvent) => {\n if (!isScratching) return;\n const touch = event.touches[0];\n scratch(touch.clientX, touch.clientY);\n };\n\n const handleDocumentMouseUp = () => {\n setIsScratching(false);\n checkCompletion();\n };\n\n const handleDocumentTouchEnd = () => {\n setIsScratching(false);\n checkCompletion();\n };\n\n document.addEventListener(\"mousedown\", handleDocumentMouseMove);\n document.addEventListener(\"mousemove\", handleDocumentMouseMove);\n document.addEventListener(\"touchstart\", handleDocumentTouchMove);\n document.addEventListener(\"touchmove\", handleDocumentTouchMove);\n document.addEventListener(\"mouseup\", handleDocumentMouseUp);\n document.addEventListener(\"touchend\", handleDocumentTouchEnd);\n document.addEventListener(\"touchcancel\", handleDocumentTouchEnd);\n\n return () => {\n document.removeEventListener(\"mousedown\", handleDocumentMouseMove);\n document.removeEventListener(\"mousemove\", handleDocumentMouseMove);\n document.removeEventListener(\"touchstart\", handleDocumentTouchMove);\n document.removeEventListener(\"touchmove\", handleDocumentTouchMove);\n document.removeEventListener(\"mouseup\", handleDocumentMouseUp);\n document.removeEventListener(\"touchend\", handleDocumentTouchEnd);\n document.removeEventListener(\"touchcancel\", handleDocumentTouchEnd);\n };\n }, [isScratching]);\n\n const handleMouseDown = () => setIsScratching(true);\n\n const handleTouchStart = () => setIsScratching(true);\n\n const scratch = (clientX: number, clientY: number) => {\n const canvas = canvasRef.current;\n const ctx = canvas?.getContext(\"2d\");\n if (canvas && ctx) {\n const rect = canvas.getBoundingClientRect();\n const x = clientX - rect.left + 16;\n const y = clientY - rect.top + 16;\n ctx.globalCompositeOperation = \"destination-out\";\n ctx.beginPath();\n ctx.arc(x, y, 30, 0, Math.PI * 2);\n ctx.fill();\n }\n };\n\n const startAnimation = async () => {\n await controls.start({\n scale: [1, 1.5, 1],\n rotate: [0, 10, -10, 10, -10, 0],\n transition: { duration: 0.5 },\n });\n\n // Call onComplete after animation finishes\n if (onComplete) {\n onComplete();\n }\n };\n\n const checkCompletion = () => {\n if (isComplete) return;\n\n const canvas = canvasRef.current;\n const ctx = canvas?.getContext(\"2d\");\n if (canvas && ctx) {\n const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);\n const pixels = imageData.data;\n const totalPixels = pixels.length / 4;\n let clearPixels = 0;\n\n for (let i = 3; i < pixels.length; i += 4) {\n if (pixels[i] === 0) clearPixels++;\n }\n\n const percentage = (clearPixels / totalPixels) * 100;\n\n if (percentage >= minScratchPercentage) {\n setIsComplete(true);\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n startAnimation();\n }\n }\n };\n\n return (\n <motion.div\n className={cn(\"relative select-none\", className)}\n style={{\n width,\n height,\n cursor:\n \"url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIj4KICA8Y2lyY2xlIGN4PSIxNiIgY3k9IjE2IiByPSIxNSIgc3R5bGU9ImZpbGw6I2ZmZjtzdHJva2U6IzAwMDtzdHJva2Utd2lkdGg6MXB4OyIgLz4KPC9zdmc+'), auto\",\n }}\n animate={controls}\n >\n <canvas\n ref={canvasRef}\n width={width}\n height={height}\n className=\"absolute left-0 top-0\"\n onMouseDown={handleMouseDown}\n onTouchStart={handleTouchStart}\n ></canvas>\n {children}\n </motion.div>\n );\n};\n\nexport default ScratchToReveal;\n",
"type": "registry:ui",
"target": ""
}
]
-}
\ No newline at end of file
+}
diff --git a/public/r/styles/default/script-copy-btn.json b/public/r/styles/default/script-copy-btn.json
index aae3dc83..4ae15f5c 100644
--- a/public/r/styles/default/script-copy-btn.json
+++ b/public/r/styles/default/script-copy-btn.json
@@ -2,14 +2,14 @@
"name": "script-copy-btn",
"type": "registry:ui",
"dependencies": [
- "framer-motion",
+ "motion",
"shiki",
"next-themes"
],
"files": [
{
"path": "magicui/script-copy-btn.tsx",
- "content": "\"use client\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils\";\nimport { motion } from \"framer-motion\";\nimport { Check, Copy } from \"lucide-react\";\nimport { useTheme } from \"next-themes\";\nimport { HTMLAttributes, useEffect, useState } from \"react\";\nimport { codeToHtml } from \"shiki\";\n\ninterface ScriptCopyBtnProps extends HTMLAttributes<HTMLDivElement> {\n showMultiplePackageOptions?: boolean;\n codeLanguage: string;\n lightTheme: string;\n darkTheme: string;\n commandMap: Record<string, string>;\n className?: string;\n}\n\nexport default function ScriptCopyBtn({\n showMultiplePackageOptions = true,\n codeLanguage,\n lightTheme,\n darkTheme,\n commandMap,\n className,\n}: ScriptCopyBtnProps) {\n const packageManagers = Object.keys(commandMap);\n const [packageManager, setPackageManager] = useState(packageManagers[0]);\n const [copied, setCopied] = useState(false);\n const [highlightedCode, setHighlightedCode] = useState(\"\");\n const { theme } = useTheme();\n const command = commandMap[packageManager];\n\n useEffect(() => {\n async function loadHighlightedCode() {\n try {\n const highlighted = await codeToHtml(command, {\n lang: codeLanguage,\n themes: {\n light: lightTheme,\n dark: darkTheme,\n },\n defaultColor: theme === \"dark\" ? \"dark\" : \"light\",\n });\n setHighlightedCode(highlighted);\n } catch (error) {\n console.error(\"Error highlighting code:\", error);\n setHighlightedCode(`<pre>${command}</pre>`);\n }\n }\n\n loadHighlightedCode();\n }, [command, theme, codeLanguage, lightTheme, darkTheme]);\n\n const copyToClipboard = () => {\n navigator.clipboard.writeText(command);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n };\n\n return (\n <div\n className={cn(\n \"mx-auto flex max-w-md items-center justify-center\",\n className,\n )}\n >\n <div className=\"w-full space-y-2\">\n <div className=\"mb-2 flex items-center justify-between\">\n {showMultiplePackageOptions && (\n <div className=\"relative\">\n <div className=\"inline-flex overflow-hidden rounded-md border border-border text-xs\">\n {packageManagers.map((pm, index) => (\n <div key={pm} className=\"flex items-center\">\n {index > 0 && (\n <div className=\"h-4 w-px bg-border\" aria-hidden=\"true\" />\n )}\n <Button\n variant=\"ghost\"\n size=\"sm\"\n className={`relative rounded-none bg-background px-2 py-1 hover:bg-background ${\n packageManager === pm\n ? \"text-primary\"\n : \"text-muted-foreground\"\n }`}\n onClick={() => setPackageManager(pm)}\n >\n {pm}\n {packageManager === pm && (\n <motion.div\n className=\"absolute inset-x-0 bottom-[1px] mx-auto h-0.5 w-[90%] bg-primary\"\n layoutId=\"activeTab\"\n initial={false}\n transition={{\n type: \"spring\",\n stiffness: 500,\n damping: 30,\n }}\n />\n )}\n </Button>\n </div>\n ))}\n </div>\n </div>\n )}\n </div>\n <div className=\"relative flex items-center\">\n <div className=\"min-w-[300px] grow font-mono\">\n {highlightedCode ? (\n <div\n className={`[&>pre]:overflow-x-auto [&>pre]:rounded-md [&>pre]:p-2 [&>pre]:px-4 [&>pre]:font-mono ${\n theme === \"dark\" ? \"dark\" : \"light\"\n }`}\n dangerouslySetInnerHTML={{ __html: highlightedCode }}\n />\n ) : (\n <pre className=\"rounded-md border border-border bg-white p-2 px-4 font-mono dark:bg-black\">\n {command}\n </pre>\n )}\n </div>\n <Button\n variant=\"outline\"\n size=\"icon\"\n className=\"relative ml-2 rounded-md\"\n onClick={copyToClipboard}\n aria-label={copied ? \"Copied\" : \"Copy to clipboard\"}\n >\n <span className=\"sr-only\">{copied ? \"Copied\" : \"Copy\"}</span>\n <Copy\n className={`h-4 w-4 transition-all duration-300 ${\n copied ? \"scale-0\" : \"scale-100\"\n }`}\n />\n <Check\n className={`absolute inset-0 m-auto h-4 w-4 transition-all duration-300 ${\n copied ? \"scale-100\" : \"scale-0\"\n }`}\n />\n </Button>\n </div>\n </div>\n </div>\n );\n}\n",
+ "content": "\"use client\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils\";\nimport { motion } from \"motion/react\";\nimport { Check, Copy } from \"lucide-react\";\nimport { useTheme } from \"next-themes\";\nimport { HTMLAttributes, useEffect, useState } from \"react\";\nimport { codeToHtml } from \"shiki\";\n\ninterface ScriptCopyBtnProps extends HTMLAttributes<HTMLDivElement> {\n showMultiplePackageOptions?: boolean;\n codeLanguage: string;\n lightTheme: string;\n darkTheme: string;\n commandMap: Record<string, string>;\n className?: string;\n}\n\nexport default function ScriptCopyBtn({\n showMultiplePackageOptions = true,\n codeLanguage,\n lightTheme,\n darkTheme,\n commandMap,\n className,\n}: ScriptCopyBtnProps) {\n const packageManagers = Object.keys(commandMap);\n const [packageManager, setPackageManager] = useState(packageManagers[0]);\n const [copied, setCopied] = useState(false);\n const [highlightedCode, setHighlightedCode] = useState(\"\");\n const { theme } = useTheme();\n const command = commandMap[packageManager];\n\n useEffect(() => {\n async function loadHighlightedCode() {\n try {\n const highlighted = await codeToHtml(command, {\n lang: codeLanguage,\n themes: {\n light: lightTheme,\n dark: darkTheme,\n },\n defaultColor: theme === \"dark\" ? \"dark\" : \"light\",\n });\n setHighlightedCode(highlighted);\n } catch (error) {\n console.error(\"Error highlighting code:\", error);\n setHighlightedCode(`<pre>${command}</pre>`);\n }\n }\n\n loadHighlightedCode();\n }, [command, theme, codeLanguage, lightTheme, darkTheme]);\n\n const copyToClipboard = () => {\n navigator.clipboard.writeText(command);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n };\n\n return (\n <div\n className={cn(\n \"mx-auto flex max-w-md items-center justify-center\",\n className,\n )}\n >\n <div className=\"w-full space-y-2\">\n <div className=\"mb-2 flex items-center justify-between\">\n {showMultiplePackageOptions && (\n <div className=\"relative\">\n <div className=\"inline-flex overflow-hidden rounded-md border border-border text-xs\">\n {packageManagers.map((pm, index) => (\n <div key={pm} className=\"flex items-center\">\n {index > 0 && (\n <div className=\"h-4 w-px bg-border\" aria-hidden=\"true\" />\n )}\n <Button\n variant=\"ghost\"\n size=\"sm\"\n className={`relative rounded-none bg-background px-2 py-1 hover:bg-background ${\n packageManager === pm\n ? \"text-primary\"\n : \"text-muted-foreground\"\n }`}\n onClick={() => setPackageManager(pm)}\n >\n {pm}\n {packageManager === pm && (\n <motion.div\n className=\"absolute inset-x-0 bottom-[1px] mx-auto h-0.5 w-[90%] bg-primary\"\n layoutId=\"activeTab\"\n initial={false}\n transition={{\n type: \"spring\",\n stiffness: 500,\n damping: 30,\n }}\n />\n )}\n </Button>\n </div>\n ))}\n </div>\n </div>\n )}\n </div>\n <div className=\"relative flex items-center\">\n <div className=\"min-w-[300px] grow font-mono\">\n {highlightedCode ? (\n <div\n className={`[&>pre]:overflow-x-auto [&>pre]:rounded-md [&>pre]:p-2 [&>pre]:px-4 [&>pre]:font-mono ${\n theme === \"dark\" ? \"dark\" : \"light\"\n }`}\n dangerouslySetInnerHTML={{ __html: highlightedCode }}\n />\n ) : (\n <pre className=\"rounded-md border border-border bg-white p-2 px-4 font-mono dark:bg-black\">\n {command}\n </pre>\n )}\n </div>\n <Button\n variant=\"outline\"\n size=\"icon\"\n className=\"relative ml-2 rounded-md\"\n onClick={copyToClipboard}\n aria-label={copied ? \"Copied\" : \"Copy to clipboard\"}\n >\n <span className=\"sr-only\">{copied ? \"Copied\" : \"Copy\"}</span>\n <Copy\n className={`h-4 w-4 transition-all duration-300 ${\n copied ? \"scale-0\" : \"scale-100\"\n }`}\n />\n <Check\n className={`absolute inset-0 m-auto h-4 w-4 transition-all duration-300 ${\n copied ? \"scale-100\" : \"scale-0\"\n }`}\n />\n </Button>\n </div>\n </div>\n </div>\n );\n}\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/scroll-based-velocity.json b/public/r/styles/default/scroll-based-velocity.json
index 3d7644f1..964e3ef1 100644
--- a/public/r/styles/default/scroll-based-velocity.json
+++ b/public/r/styles/default/scroll-based-velocity.json
@@ -2,12 +2,12 @@
"name": "scroll-based-velocity",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/scroll-based-velocity.tsx",
- "content": "\"use client\";\n\nimport React, { useEffect, useRef, useState } from \"react\";\nimport {\n motion,\n useAnimationFrame,\n useMotionValue,\n useScroll,\n useSpring,\n useTransform,\n useVelocity,\n} from \"framer-motion\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface VelocityScrollProps {\n text: string;\n default_velocity?: number;\n className?: string;\n rowsAmount?: number;\n}\n\ninterface ParallaxProps {\n children: string;\n baseVelocity: number;\n className?: string;\n}\n\nexport const wrap = (min: number, max: number, v: number) => {\n const rangeSize = max - min;\n return ((((v - min) % rangeSize) + rangeSize) % rangeSize) + min;\n};\n\nexport function VelocityScroll({\n text,\n default_velocity = 5,\n className,\n rowsAmount = 1,\n}: VelocityScrollProps) {\n function ParallaxText({\n children,\n baseVelocity = 100,\n className,\n }: ParallaxProps) {\n const baseX = useMotionValue(0);\n const { scrollY } = useScroll();\n const scrollVelocity = useVelocity(scrollY);\n const smoothVelocity = useSpring(scrollVelocity, {\n damping: 50,\n stiffness: 400,\n });\n\n const velocityFactor = useTransform(smoothVelocity, [0, 1000], [0, 5], {\n clamp: false,\n });\n\n const [repetitions, setRepetitions] = useState(1);\n const containerRef = useRef<HTMLDivElement>(null);\n const textRef = useRef<HTMLSpanElement>(null);\n\n useEffect(() => {\n const calculateRepetitions = () => {\n if (containerRef.current && textRef.current) {\n const containerWidth = containerRef.current.offsetWidth;\n const textWidth = textRef.current.offsetWidth;\n const newRepetitions = Math.ceil(containerWidth / textWidth) + 2;\n setRepetitions(newRepetitions);\n }\n };\n\n calculateRepetitions();\n\n window.addEventListener(\"resize\", calculateRepetitions);\n return () => window.removeEventListener(\"resize\", calculateRepetitions);\n }, [children]);\n\n const x = useTransform(baseX, (v) => `${wrap(-100 / repetitions, 0, v)}%`);\n\n const directionFactor = React.useRef<number>(1);\n useAnimationFrame((t, delta) => {\n let moveBy = directionFactor.current * baseVelocity * (delta / 1000);\n\n if (velocityFactor.get() < 0) {\n directionFactor.current = -1;\n } else if (velocityFactor.get() > 0) {\n directionFactor.current = 1;\n }\n\n moveBy += directionFactor.current * moveBy * velocityFactor.get();\n\n baseX.set(baseX.get() + moveBy);\n });\n\n return (\n <div\n className=\"w-full overflow-hidden whitespace-nowrap\"\n ref={containerRef}\n >\n <motion.div className={cn(\"inline-block\", className)} style={{ x }}>\n {Array.from({ length: repetitions }).map((_, i) => (\n <span key={i} ref={i === 0 ? textRef : null}>\n {children}{\" \"}\n </span>\n ))}\n </motion.div>\n </div>\n );\n }\n\n return (\n <section className=\"relative w-full\">\n {Array.from({ length: rowsAmount }).map((_, i) => (\n <ParallaxText\n key={i}\n baseVelocity={default_velocity * (i % 2 === 0 ? 1 : -1)}\n className={className}\n >\n {text}\n </ParallaxText>\n ))}\n </section>\n );\n}\n",
+ "content": "\"use client\";\n\nimport {\n motion,\n useAnimationFrame,\n useMotionValue,\n useScroll,\n useSpring,\n useTransform,\n useVelocity,\n} from \"motion/react\";\nimport React, { useEffect, useRef, useState } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface VelocityScrollProps extends React.HTMLAttributes<HTMLDivElement> {\n defaultVelocity?: number;\n className?: string;\n numRows?: number;\n}\n\ninterface ParallaxProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n baseVelocity: number;\n}\n\nexport const wrap = (min: number, max: number, v: number) => {\n const rangeSize = max - min;\n return ((((v - min) % rangeSize) + rangeSize) % rangeSize) + min;\n};\n\nfunction ParallaxText({\n children,\n baseVelocity = 100,\n ...props\n}: ParallaxProps) {\n const baseX = useMotionValue(0);\n const { scrollY } = useScroll();\n const scrollVelocity = useVelocity(scrollY);\n const smoothVelocity = useSpring(scrollVelocity, {\n damping: 50,\n stiffness: 400,\n });\n\n const velocityFactor = useTransform(smoothVelocity, [0, 1000], [0, 5], {\n clamp: false,\n });\n\n const [repetitions, setRepetitions] = useState(1);\n const containerRef = useRef<HTMLDivElement>(null);\n const textRef = useRef<HTMLSpanElement>(null);\n\n useEffect(() => {\n const calculateRepetitions = () => {\n if (containerRef.current && textRef.current) {\n const containerWidth = containerRef.current.offsetWidth;\n const textWidth = textRef.current.offsetWidth;\n const newRepetitions = Math.ceil(containerWidth / textWidth) + 2;\n setRepetitions(newRepetitions);\n }\n };\n\n calculateRepetitions();\n\n window.addEventListener(\"resize\", calculateRepetitions);\n return () => window.removeEventListener(\"resize\", calculateRepetitions);\n }, [children]);\n\n const x = useTransform(baseX, (v) => `${wrap(-100 / repetitions, 0, v)}%`);\n\n const directionFactor = React.useRef<number>(1);\n useAnimationFrame((t, delta) => {\n let moveBy = directionFactor.current * baseVelocity * (delta / 1000);\n\n if (velocityFactor.get() < 0) {\n directionFactor.current = -1;\n } else if (velocityFactor.get() > 0) {\n directionFactor.current = 1;\n }\n\n moveBy += directionFactor.current * moveBy * velocityFactor.get();\n\n baseX.set(baseX.get() + moveBy);\n });\n\n return (\n <div\n ref={containerRef}\n className=\"w-full overflow-hidden whitespace-nowrap\"\n {...props}\n >\n <motion.div className=\"inline-block\" style={{ x }}>\n {Array.from({ length: repetitions }).map((_, i) => (\n <span key={i} ref={i === 0 ? textRef : null}>\n {children}{\" \"}\n </span>\n ))}\n </motion.div>\n </div>\n );\n}\n\nexport function VelocityScroll({\n defaultVelocity = 5,\n numRows = 2,\n children,\n className,\n ...props\n}: VelocityScrollProps) {\n return (\n <div\n className={cn(\n \"relative w-full text-4xl font-bold tracking-[-0.02em] md:text-7xl md:leading-[5rem]\",\n className,\n )}\n {...props}\n >\n {Array.from({ length: numRows }).map((_, i) => (\n <ParallaxText\n key={i}\n baseVelocity={defaultVelocity * (i % 2 === 0 ? 1 : -1)}\n >\n {children}\n </ParallaxText>\n ))}\n </div>\n );\n}\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/scroll-progress.json b/public/r/styles/default/scroll-progress.json
index 25681683..d77eef3d 100644
--- a/public/r/styles/default/scroll-progress.json
+++ b/public/r/styles/default/scroll-progress.json
@@ -2,12 +2,12 @@
"name": "scroll-progress",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/scroll-progress.tsx",
- "content": "import { cn } from \"@/lib/utils\";\nimport { motion, useScroll, useSpring } from \"framer-motion\";\n\ninterface ScrollProgressProps {\n className?: string;\n}\n\nexport default function ScrollProgress({ className }: ScrollProgressProps) {\n const { scrollYProgress } = useScroll();\n\n const scaleX = useSpring(scrollYProgress, {\n stiffness: 200,\n damping: 50,\n restDelta: 0.001,\n });\n\n return (\n <motion.div\n className={cn(\n \"fixed inset-x-0 top-0 z-[1000] h-1 origin-left bg-gradient-to-r from-[#A97CF8] via-[#F38CB8] to-[#FDCC92]\",\n className,\n )}\n style={{\n scaleX,\n }}\n />\n );\n}\n",
+ "content": "\"use client\";\n\nimport { cn } from \"@/lib/utils\";\nimport { motion, useScroll, useSpring } from \"motion/react\";\n\ninterface ScrollProgressProps {\n className?: string;\n}\n\nexport default function ScrollProgress({ className }: ScrollProgressProps) {\n const { scrollYProgress } = useScroll();\n\n const scaleX = useSpring(scrollYProgress, {\n stiffness: 200,\n damping: 50,\n restDelta: 0.001,\n });\n\n return (\n <motion.div\n className={cn(\n \"fixed inset-x-0 top-0 z-[1000] h-1 origin-left bg-gradient-to-r from-[#A97CF8] via-[#F38CB8] to-[#FDCC92]\",\n className,\n )}\n style={{\n scaleX,\n }}\n />\n );\n}\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/shimmer-button.json b/public/r/styles/default/shimmer-button.json
index e9341058..b90a50b6 100644
--- a/public/r/styles/default/shimmer-button.json
+++ b/public/r/styles/default/shimmer-button.json
@@ -4,7 +4,7 @@
"files": [
{
"path": "magicui/shimmer-button.tsx",
- "content": "import React, { CSSProperties } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport interface ShimmerButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n shimmerColor?: string;\n shimmerSize?: string;\n borderRadius?: string;\n shimmerDuration?: string;\n background?: string;\n className?: string;\n children?: React.ReactNode;\n}\n\nconst ShimmerButton = React.forwardRef<HTMLButtonElement, ShimmerButtonProps>(\n (\n {\n shimmerColor = \"#ffffff\",\n shimmerSize = \"0.05em\",\n shimmerDuration = \"3s\",\n borderRadius = \"100px\",\n background = \"rgba(0, 0, 0, 1)\",\n className,\n children,\n ...props\n },\n ref,\n ) => {\n return (\n <button\n style={\n {\n \"--spread\": \"90deg\",\n \"--shimmer-color\": shimmerColor,\n \"--radius\": borderRadius,\n \"--speed\": shimmerDuration,\n \"--cut\": shimmerSize,\n \"--bg\": background,\n } as CSSProperties\n }\n className={cn(\n \"group relative z-0 flex cursor-pointer items-center justify-center overflow-hidden whitespace-nowrap border border-white/10 px-6 py-3 text-white [background:var(--bg)] [border-radius:var(--radius)] dark:text-black\",\n \"transform-gpu transition-transform duration-300 ease-in-out active:translate-y-px\",\n className,\n )}\n ref={ref}\n {...props}\n >\n {/* spark container */}\n <div\n className={cn(\n \"-z-30 blur-[2px]\",\n \"absolute inset-0 overflow-visible [container-type:size]\",\n )}\n >\n {/* spark */}\n <div className=\"absolute inset-0 h-[100cqh] animate-shimmer-slide [aspect-ratio:1] [border-radius:0] [mask:none]\">\n {/* spark before */}\n <div className=\"animate-spin-around absolute -inset-full w-auto rotate-0 [background:conic-gradient(from_calc(270deg-(var(--spread)*0.5)),transparent_0,var(--shimmer-color)_var(--spread),transparent_var(--spread))] [translate:0_0]\" />\n </div>\n </div>\n {children}\n\n {/* Highlight */}\n <div\n className={cn(\n \"insert-0 absolute size-full\",\n\n \"rounded-2xl px-4 py-1.5 text-sm font-medium shadow-[inset_0_-8px_10px_#ffffff1f]\",\n\n // transition\n \"transform-gpu transition-all duration-300 ease-in-out\",\n\n // on hover\n \"group-hover:shadow-[inset_0_-6px_10px_#ffffff3f]\",\n\n // on click\n \"group-active:shadow-[inset_0_-10px_10px_#ffffff3f]\",\n )}\n />\n\n {/* backdrop */}\n <div\n className={cn(\n \"absolute -z-20 [background:var(--bg)] [border-radius:var(--radius)] [inset:var(--cut)]\",\n )}\n />\n </button>\n );\n },\n);\n\nShimmerButton.displayName = \"ShimmerButton\";\n\nexport default ShimmerButton;\n",
+ "content": "import React, { CSSProperties } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport interface ShimmerButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n shimmerColor?: string;\n shimmerSize?: string;\n borderRadius?: string;\n shimmerDuration?: string;\n background?: string;\n className?: string;\n children?: React.ReactNode;\n}\n\nconst ShimmerButton = React.forwardRef<HTMLButtonElement, ShimmerButtonProps>(\n (\n {\n shimmerColor = \"#ffffff\",\n shimmerSize = \"0.05em\",\n shimmerDuration = \"3s\",\n borderRadius = \"100px\",\n background = \"rgba(0, 0, 0, 1)\",\n className,\n children,\n ...props\n },\n ref,\n ) => {\n return (\n <button\n style={\n {\n \"--spread\": \"90deg\",\n \"--shimmer-color\": shimmerColor,\n \"--radius\": borderRadius,\n \"--speed\": shimmerDuration,\n \"--cut\": shimmerSize,\n \"--bg\": background,\n } as CSSProperties\n }\n className={cn(\n \"group relative z-0 flex cursor-pointer items-center justify-center overflow-hidden whitespace-nowrap border border-white/10 px-6 py-3 text-white [background:var(--bg)] [border-radius:var(--radius)] dark:text-black\",\n \"transform-gpu transition-transform duration-300 ease-in-out active:translate-y-px\",\n className,\n )}\n ref={ref}\n {...props}\n >\n {/* spark container */}\n <div\n className={cn(\n \"-z-30 blur-[2px]\",\n \"absolute inset-0 overflow-visible [container-type:size]\",\n )}\n >\n {/* spark */}\n <div className=\"absolute inset-0 h-[100cqh] animate-shimmer-slide [aspect-ratio:1] [border-radius:0] [mask:none]\">\n {/* spark before */}\n <div className=\"absolute -inset-full w-auto rotate-0 animate-spin-around [background:conic-gradient(from_calc(270deg-(var(--spread)*0.5)),transparent_0,var(--shimmer-color)_var(--spread),transparent_var(--spread))] [translate:0_0]\" />\n </div>\n </div>\n {children}\n\n {/* Highlight */}\n <div\n className={cn(\n \"insert-0 absolute size-full\",\n\n \"rounded-2xl px-4 py-1.5 text-sm font-medium shadow-[inset_0_-8px_10px_#ffffff1f]\",\n\n // transition\n \"transform-gpu transition-all duration-300 ease-in-out\",\n\n // on hover\n \"group-hover:shadow-[inset_0_-6px_10px_#ffffff3f]\",\n\n // on click\n \"group-active:shadow-[inset_0_-10px_10px_#ffffff3f]\",\n )}\n />\n\n {/* backdrop */}\n <div\n className={cn(\n \"absolute -z-20 [background:var(--bg)] [border-radius:var(--radius)] [inset:var(--cut)]\",\n )}\n />\n </button>\n );\n },\n);\n\nShimmerButton.displayName = \"ShimmerButton\";\n\nexport default ShimmerButton;\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/shiny-button.json b/public/r/styles/default/shiny-button.json
index 7a7eb8ed..51563e77 100644
--- a/public/r/styles/default/shiny-button.json
+++ b/public/r/styles/default/shiny-button.json
@@ -2,12 +2,12 @@
"name": "shiny-button",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/shiny-button.tsx",
- "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 ref?: React.Ref<HTMLButtonElement>;\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",
+ "content": "\"use client\";\n\nimport React from \"react\";\nimport {\n motion,\n type AnimationProps,\n type HTMLMotionProps,\n} from \"motion/react\";\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 ref?: React.Ref<HTMLButtonElement>;\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/sparkles-text.json b/public/r/styles/default/sparkles-text.json
index f628e33a..c360e3da 100644
--- a/public/r/styles/default/sparkles-text.json
+++ b/public/r/styles/default/sparkles-text.json
@@ -2,12 +2,12 @@
"name": "sparkles-text",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/sparkles-text.tsx",
- "content": "\"use client\";\n\nimport { CSSProperties, ReactElement, useEffect, useState } from \"react\";\nimport { motion } from \"framer-motion\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface Sparkle {\n id: string;\n x: string;\n y: string;\n color: string;\n delay: number;\n scale: number;\n lifespan: number;\n}\n\ninterface SparklesTextProps {\n /**\n * @default <div />\n * @type ReactElement\n * @description\n * The component to be rendered as the text\n * */\n as?: ReactElement;\n\n /**\n * @default \"\"\n * @type string\n * @description\n * The className of the text\n */\n className?: string;\n\n /**\n * @required\n * @type string\n * @description\n * The text to be displayed\n * */\n text: string;\n\n /**\n * @default 10\n * @type number\n * @description\n * The count of sparkles\n * */\n sparklesCount?: number;\n\n /**\n * @default \"{first: '#9E7AFF', second: '#FE8BBB'}\"\n * @type string\n * @description\n * The colors of the sparkles\n * */\n colors?: {\n first: string;\n second: string;\n };\n}\n\nconst SparklesText: React.FC<SparklesTextProps> = ({\n text,\n colors = { first: \"#9E7AFF\", second: \"#FE8BBB\" },\n className,\n sparklesCount = 10,\n ...props\n}) => {\n const [sparkles, setSparkles] = useState<Sparkle[]>([]);\n\n useEffect(() => {\n const generateStar = (): Sparkle => {\n const starX = `${Math.random() * 100}%`;\n const starY = `${Math.random() * 100}%`;\n const color = Math.random() > 0.5 ? colors.first : colors.second;\n const delay = Math.random() * 2;\n const scale = Math.random() * 1 + 0.3;\n const lifespan = Math.random() * 10 + 5;\n const id = `${starX}-${starY}-${Date.now()}`;\n return { id, x: starX, y: starY, color, delay, scale, lifespan };\n };\n\n const initializeStars = () => {\n const newSparkles = Array.from({ length: sparklesCount }, generateStar);\n setSparkles(newSparkles);\n };\n\n const updateStars = () => {\n setSparkles((currentSparkles) =>\n currentSparkles.map((star) => {\n if (star.lifespan <= 0) {\n return generateStar();\n } else {\n return { ...star, lifespan: star.lifespan - 0.1 };\n }\n }),\n );\n };\n\n initializeStars();\n const interval = setInterval(updateStars, 100);\n\n return () => clearInterval(interval);\n }, [colors.first, colors.second]);\n\n return (\n <div\n className={cn(\"text-6xl font-bold\", className)}\n {...props}\n style={\n {\n \"--sparkles-first-color\": `${colors.first}`,\n \"--sparkles-second-color\": `${colors.second}`,\n } as CSSProperties\n }\n >\n <span className=\"relative inline-block\">\n {sparkles.map((sparkle) => (\n <Sparkle key={sparkle.id} {...sparkle} />\n ))}\n <strong>{text}</strong>\n </span>\n </div>\n );\n};\n\nconst Sparkle: React.FC<Sparkle> = ({ id, x, y, color, delay, scale }) => {\n return (\n <motion.svg\n key={id}\n className=\"pointer-events-none absolute z-20\"\n initial={{ opacity: 0, left: x, top: y }}\n animate={{\n opacity: [0, 1, 0],\n scale: [0, scale, 0],\n rotate: [75, 120, 150],\n }}\n transition={{ duration: 0.8, repeat: Infinity, delay }}\n width=\"21\"\n height=\"21\"\n viewBox=\"0 0 21 21\"\n >\n <path\n d=\"M9.82531 0.843845C10.0553 0.215178 10.9446 0.215178 11.1746 0.843845L11.8618 2.72026C12.4006 4.19229 12.3916 6.39157 13.5 7.5C14.6084 8.60843 16.8077 8.59935 18.2797 9.13822L20.1561 9.82534C20.7858 10.0553 20.7858 10.9447 20.1561 11.1747L18.2797 11.8618C16.8077 12.4007 14.6084 12.3916 13.5 13.5C12.3916 14.6084 12.4006 16.8077 11.8618 18.2798L11.1746 20.1562C10.9446 20.7858 10.0553 20.7858 9.82531 20.1562L9.13819 18.2798C8.59932 16.8077 8.60843 14.6084 7.5 13.5C6.39157 12.3916 4.19225 12.4007 2.72023 11.8618L0.843814 11.1747C0.215148 10.9447 0.215148 10.0553 0.843814 9.82534L2.72023 9.13822C4.19225 8.59935 6.39157 8.60843 7.5 7.5C8.60843 6.39157 8.59932 4.19229 9.13819 2.72026L9.82531 0.843845Z\"\n fill={color}\n />\n </motion.svg>\n );\n};\n\nexport default SparklesText;\n",
+ "content": "\"use client\";\n\nimport { CSSProperties, ReactElement, useEffect, useState } from \"react\";\nimport { motion } from \"motion/react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface Sparkle {\n id: string;\n x: string;\n y: string;\n color: string;\n delay: number;\n scale: number;\n lifespan: number;\n}\n\ninterface SparklesTextProps {\n /**\n * @default <div />\n * @type ReactElement\n * @description\n * The component to be rendered as the text\n * */\n as?: ReactElement;\n\n /**\n * @default \"\"\n * @type string\n * @description\n * The className of the text\n */\n className?: string;\n\n /**\n * @required\n * @type string\n * @description\n * The text to be displayed\n * */\n text: string;\n\n /**\n * @default 10\n * @type number\n * @description\n * The count of sparkles\n * */\n sparklesCount?: number;\n\n /**\n * @default \"{first: '#9E7AFF', second: '#FE8BBB'}\"\n * @type string\n * @description\n * The colors of the sparkles\n * */\n colors?: {\n first: string;\n second: string;\n };\n}\n\nconst SparklesText: React.FC<SparklesTextProps> = ({\n text,\n colors = { first: \"#9E7AFF\", second: \"#FE8BBB\" },\n className,\n sparklesCount = 10,\n ...props\n}) => {\n const [sparkles, setSparkles] = useState<Sparkle[]>([]);\n\n useEffect(() => {\n const generateStar = (): Sparkle => {\n const starX = `${Math.random() * 100}%`;\n const starY = `${Math.random() * 100}%`;\n const color = Math.random() > 0.5 ? colors.first : colors.second;\n const delay = Math.random() * 2;\n const scale = Math.random() * 1 + 0.3;\n const lifespan = Math.random() * 10 + 5;\n const id = `${starX}-${starY}-${Date.now()}`;\n return { id, x: starX, y: starY, color, delay, scale, lifespan };\n };\n\n const initializeStars = () => {\n const newSparkles = Array.from({ length: sparklesCount }, generateStar);\n setSparkles(newSparkles);\n };\n\n const updateStars = () => {\n setSparkles((currentSparkles) =>\n currentSparkles.map((star) => {\n if (star.lifespan <= 0) {\n return generateStar();\n } else {\n return { ...star, lifespan: star.lifespan - 0.1 };\n }\n }),\n );\n };\n\n initializeStars();\n const interval = setInterval(updateStars, 100);\n\n return () => clearInterval(interval);\n }, [colors.first, colors.second, sparklesCount]);\n\n return (\n <div\n className={cn(\"text-6xl font-bold\", className)}\n {...props}\n style={\n {\n \"--sparkles-first-color\": `${colors.first}`,\n \"--sparkles-second-color\": `${colors.second}`,\n } as CSSProperties\n }\n >\n <span className=\"relative inline-block\">\n {sparkles.map((sparkle) => (\n <Sparkle key={sparkle.id} {...sparkle} />\n ))}\n <strong>{text}</strong>\n </span>\n </div>\n );\n};\n\nconst Sparkle: React.FC<Sparkle> = ({ id, x, y, color, delay, scale }) => {\n return (\n <motion.svg\n key={id}\n className=\"pointer-events-none absolute z-20\"\n initial={{ opacity: 0, left: x, top: y }}\n animate={{\n opacity: [0, 1, 0],\n scale: [0, scale, 0],\n rotate: [75, 120, 150],\n }}\n transition={{ duration: 0.8, repeat: Infinity, delay }}\n width=\"21\"\n height=\"21\"\n viewBox=\"0 0 21 21\"\n >\n <path\n d=\"M9.82531 0.843845C10.0553 0.215178 10.9446 0.215178 11.1746 0.843845L11.8618 2.72026C12.4006 4.19229 12.3916 6.39157 13.5 7.5C14.6084 8.60843 16.8077 8.59935 18.2797 9.13822L20.1561 9.82534C20.7858 10.0553 20.7858 10.9447 20.1561 11.1747L18.2797 11.8618C16.8077 12.4007 14.6084 12.3916 13.5 13.5C12.3916 14.6084 12.4006 16.8077 11.8618 18.2798L11.1746 20.1562C10.9446 20.7858 10.0553 20.7858 9.82531 20.1562L9.13819 18.2798C8.59932 16.8077 8.60843 14.6084 7.5 13.5C6.39157 12.3916 4.19225 12.4007 2.72023 11.8618L0.843814 11.1747C0.215148 10.9447 0.215148 10.0553 0.843814 9.82534L2.72023 9.13822C4.19225 8.59935 6.39157 8.60843 7.5 7.5C8.60843 6.39157 8.59932 4.19229 9.13819 2.72026L9.82531 0.843845Z\"\n fill={color}\n />\n </motion.svg>\n );\n};\n\nexport default SparklesText;\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/text-reveal.json b/public/r/styles/default/text-reveal.json
index d2eb81dc..4a71a248 100644
--- a/public/r/styles/default/text-reveal.json
+++ b/public/r/styles/default/text-reveal.json
@@ -2,12 +2,12 @@
"name": "text-reveal",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/text-reveal.tsx",
- "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",
+ "content": "\"use client\";\n\nimport { FC, ReactNode, useRef } from \"react\";\nimport { motion, MotionValue, useScroll, useTransform } from \"motion/react\";\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/tweet-card.json b/public/r/styles/default/tweet-card.json
index 4b9ee487..7f6e42e8 100644
--- a/public/r/styles/default/tweet-card.json
+++ b/public/r/styles/default/tweet-card.json
@@ -7,7 +7,7 @@
"files": [
{
"path": "magicui/tweet-card.tsx",
- "content": "import { Suspense } from \"react\";\nimport {\n enrichTweet,\n type EnrichedTweet,\n type TweetProps,\n type TwitterComponents,\n} from \"react-tweet\";\nimport { getTweet, type Tweet } from \"react-tweet/api\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface TwitterIconProps {\n className?: string;\n [key: string]: any;\n}\nconst Twitter = ({ className, ...props }: TwitterIconProps) => (\n <svg\n stroke=\"currentColor\"\n fill=\"currentColor\"\n strokeWidth=\"0\"\n viewBox=\"0 0 24 24\"\n height=\"1em\"\n width=\"1em\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={className}\n {...props}\n >\n <g>\n <path fill=\"none\" d=\"M0 0h24v24H0z\"></path>\n <path d=\"M22.162 5.656a8.384 8.384 0 0 1-2.402.658A4.196 4.196 0 0 0 21.6 4c-.82.488-1.719.83-2.656 1.015a4.182 4.182 0 0 0-7.126 3.814 11.874 11.874 0 0 1-8.62-4.37 4.168 4.168 0 0 0-.566 2.103c0 1.45.738 2.731 1.86 3.481a4.168 4.168 0 0 1-1.894-.523v.052a4.185 4.185 0 0 0 3.355 4.101 4.21 4.21 0 0 1-1.89.072A4.185 4.185 0 0 0 7.97 16.65a8.394 8.394 0 0 1-6.191 1.732 11.83 11.83 0 0 0 6.41 1.88c7.693 0 11.9-6.373 11.9-11.9 0-.18-.005-.362-.013-.54a8.496 8.496 0 0 0 2.087-2.165z\"></path>\n </g>\n </svg>\n);\n\nconst Verified = ({ className, ...props }: TwitterIconProps) => (\n <svg\n aria-label=\"Verified Account\"\n viewBox=\"0 0 24 24\"\n className={className}\n {...props}\n >\n <g fill=\"currentColor\">\n <path d=\"M22.5 12.5c0-1.58-.875-2.95-2.148-3.6.154-.435.238-.905.238-1.4 0-2.21-1.71-3.998-3.818-3.998-.47 0-.92.084-1.336.25C14.818 2.415 13.51 1.5 12 1.5s-2.816.917-3.437 2.25c-.415-.165-.866-.25-1.336-.25-2.11 0-3.818 1.79-3.818 4 0 .494.083.964.237 1.4-1.272.65-2.147 2.018-2.147 3.6 0 1.495.782 2.798 1.942 3.486-.02.17-.032.34-.032.514 0 2.21 1.708 4 3.818 4 .47 0 .92-.086 1.335-.25.62 1.334 1.926 2.25 3.437 2.25 1.512 0 2.818-.916 3.437-2.25.415.163.865.248 1.336.248 2.11 0 3.818-1.79 3.818-4 0-.174-.012-.344-.033-.513 1.158-.687 1.943-1.99 1.943-3.484zm-6.616-3.334l-4.334 6.5c-.145.217-.382.334-.625.334-.143 0-.288-.04-.416-.126l-.115-.094-2.415-2.415c-.293-.293-.293-.768 0-1.06s.768-.294 1.06 0l1.77 1.767 3.825-5.74c.23-.345.696-.436 1.04-.207.346.23.44.696.21 1.04z\" />\n </g>\n </svg>\n);\n\nexport const truncate = (str: string | null, length: number) => {\n if (!str || str.length <= length) return str;\n return `${str.slice(0, length - 3)}...`;\n};\n\nconst Skeleton = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => {\n return (\n <div className={cn(\"rounded-md bg-primary/10\", className)} {...props} />\n );\n};\n\nexport const TweetSkeleton = ({\n className,\n ...props\n}: {\n className?: string;\n [key: string]: any;\n}) => (\n <div\n className={cn(\n \"flex size-full max-h-max min-w-72 flex-col gap-2 rounded-lg border p-4\",\n className,\n )}\n {...props}\n >\n <div className=\"flex flex-row gap-2\">\n <Skeleton className=\"size-10 shrink-0 rounded-full\" />\n <Skeleton className=\"h-10 w-full\" />\n </div>\n <Skeleton className=\"h-20 w-full\" />\n </div>\n);\n\nexport const TweetNotFound = ({\n className,\n ...props\n}: {\n className?: string;\n [key: string]: any;\n}) => (\n <div\n className={cn(\n \"flex size-full flex-col items-center justify-center gap-2 rounded-lg border p-4\",\n className,\n )}\n {...props}\n >\n <h3>Tweet not found</h3>\n </div>\n);\n\nexport const TweetHeader = ({ tweet }: { tweet: EnrichedTweet }) => (\n <div className=\"flex flex-row justify-between tracking-tight\">\n <div className=\"flex items-center space-x-2\">\n <a href={tweet.user.url} target=\"_blank\" rel=\"noreferrer\">\n <img\n title={`Profile picture of ${tweet.user.name}`}\n alt={tweet.user.screen_name}\n height={48}\n width={48}\n src={tweet.user.profile_image_url_https}\n className=\"overflow-hidden rounded-full border border-transparent\"\n />\n </a>\n <div>\n <a\n href={tweet.user.url}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"flex items-center whitespace-nowrap font-semibold\"\n >\n {truncate(tweet.user.name, 20)}\n {tweet.user.verified ||\n (tweet.user.is_blue_verified && (\n <Verified className=\"ml-1 inline size-4 text-blue-500\" />\n ))}\n </a>\n <div className=\"flex items-center space-x-1\">\n <a\n href={tweet.user.url}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"text-sm text-gray-500 transition-all duration-75\"\n >\n @{truncate(tweet.user.screen_name, 16)}\n </a>\n </div>\n </div>\n </div>\n <a href={tweet.url} target=\"_blank\" rel=\"noreferrer\">\n <span className=\"sr-only\">Link to tweet</span>\n <Twitter className=\"size-5 items-start text-[#3BA9EE] transition-all ease-in-out hover:scale-105\" />\n </a>\n </div>\n);\n\nexport const TweetBody = ({ tweet }: { tweet: EnrichedTweet }) => (\n <div className=\"break-words leading-normal tracking-tighter\">\n {tweet.entities.map((entity, idx) => {\n switch (entity.type) {\n case \"url\":\n case \"symbol\":\n case \"hashtag\":\n case \"mention\":\n return (\n <a\n key={idx}\n href={entity.href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"text-sm font-normal text-gray-500\"\n >\n <span>{entity.text}</span>\n </a>\n );\n case \"text\":\n return (\n <span\n key={idx}\n className=\"text-sm font-normal\"\n dangerouslySetInnerHTML={{ __html: entity.text }}\n />\n );\n }\n })}\n </div>\n);\n\nexport const TweetMedia = ({ tweet }: { tweet: EnrichedTweet }) => (\n <div className=\"flex flex-1 items-center justify-center\">\n {tweet.video && (\n <video\n poster={tweet.video.poster}\n autoPlay\n loop\n muted\n playsInline\n className=\"rounded-xl border shadow-sm\"\n >\n <source src={tweet.video.variants[0].src} type=\"video/mp4\" />\n Your browser does not support the video tag.\n </video>\n )}\n {tweet.photos && (\n <div className=\"relative flex transform-gpu snap-x snap-mandatory gap-4 overflow-x-auto\">\n <div className=\"shrink-0 snap-center sm:w-2\" />\n {tweet.photos.map((photo) => (\n <img\n key={photo.url}\n src={photo.url}\n title={\"Photo by \" + tweet.user.name}\n alt={tweet.text}\n className=\"h-64 w-5/6 shrink-0 snap-center snap-always rounded-xl border object-cover shadow-sm\"\n />\n ))}\n <div className=\"shrink-0 snap-center sm:w-2\" />\n </div>\n )}\n {!tweet.video &&\n !tweet.photos &&\n // @ts-ignore\n tweet?.card?.binding_values?.thumbnail_image_large?.image_value.url && (\n <img\n // @ts-ignore\n src={tweet.card.binding_values.thumbnail_image_large.image_value.url}\n className=\"h-64 rounded-xl border object-cover shadow-sm\"\n />\n )}\n </div>\n);\n\nexport const MagicTweet = ({\n tweet,\n components,\n className,\n ...props\n}: {\n tweet: Tweet;\n components?: TwitterComponents;\n className?: string;\n}) => {\n const enrichedTweet = enrichTweet(tweet);\n return (\n <div\n className={cn(\n \"relative flex size-full max-w-lg flex-col gap-2 overflow-hidden rounded-lg border p-4 backdrop-blur-md\",\n className,\n )}\n {...props}\n >\n <TweetHeader tweet={enrichedTweet} />\n <TweetBody tweet={enrichedTweet} />\n <TweetMedia tweet={enrichedTweet} />\n </div>\n );\n};\n\n/**\n * TweetCard (Server Side Only)\n */\nexport const TweetCard = async ({\n id,\n components,\n fallback = <TweetSkeleton />,\n onError,\n ...props\n}: TweetProps & {\n className?: string;\n}) => {\n const tweet = id\n ? await getTweet(id).catch((err) => {\n if (onError) {\n onError(err);\n } else {\n console.error(err);\n }\n })\n : undefined;\n\n if (!tweet) {\n const NotFound = components?.TweetNotFound || TweetNotFound;\n return <NotFound {...props} />;\n }\n\n return (\n <Suspense fallback={fallback}>\n <MagicTweet tweet={tweet} {...props} />\n </Suspense>\n );\n};\n\nexport default TweetCard;\n",
+ "content": "import { Suspense } from \"react\";\nimport {\n enrichTweet,\n type EnrichedTweet,\n type TweetProps,\n type TwitterComponents,\n} from \"react-tweet\";\nimport { getTweet, type Tweet } from \"react-tweet/api\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface TwitterIconProps {\n className?: string;\n [key: string]: unknown;\n}\nconst Twitter = ({ className, ...props }: TwitterIconProps) => (\n <svg\n stroke=\"currentColor\"\n fill=\"currentColor\"\n strokeWidth=\"0\"\n viewBox=\"0 0 24 24\"\n height=\"1em\"\n width=\"1em\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={className}\n {...props}\n >\n <g>\n <path fill=\"none\" d=\"M0 0h24v24H0z\"></path>\n <path d=\"M22.162 5.656a8.384 8.384 0 0 1-2.402.658A4.196 4.196 0 0 0 21.6 4c-.82.488-1.719.83-2.656 1.015a4.182 4.182 0 0 0-7.126 3.814 11.874 11.874 0 0 1-8.62-4.37 4.168 4.168 0 0 0-.566 2.103c0 1.45.738 2.731 1.86 3.481a4.168 4.168 0 0 1-1.894-.523v.052a4.185 4.185 0 0 0 3.355 4.101 4.21 4.21 0 0 1-1.89.072A4.185 4.185 0 0 0 7.97 16.65a8.394 8.394 0 0 1-6.191 1.732 11.83 11.83 0 0 0 6.41 1.88c7.693 0 11.9-6.373 11.9-11.9 0-.18-.005-.362-.013-.54a8.496 8.496 0 0 0 2.087-2.165z\"></path>\n </g>\n </svg>\n);\n\nconst Verified = ({ className, ...props }: TwitterIconProps) => (\n <svg\n aria-label=\"Verified Account\"\n viewBox=\"0 0 24 24\"\n className={className}\n {...props}\n >\n <g fill=\"currentColor\">\n <path d=\"M22.5 12.5c0-1.58-.875-2.95-2.148-3.6.154-.435.238-.905.238-1.4 0-2.21-1.71-3.998-3.818-3.998-.47 0-.92.084-1.336.25C14.818 2.415 13.51 1.5 12 1.5s-2.816.917-3.437 2.25c-.415-.165-.866-.25-1.336-.25-2.11 0-3.818 1.79-3.818 4 0 .494.083.964.237 1.4-1.272.65-2.147 2.018-2.147 3.6 0 1.495.782 2.798 1.942 3.486-.02.17-.032.34-.032.514 0 2.21 1.708 4 3.818 4 .47 0 .92-.086 1.335-.25.62 1.334 1.926 2.25 3.437 2.25 1.512 0 2.818-.916 3.437-2.25.415.163.865.248 1.336.248 2.11 0 3.818-1.79 3.818-4 0-.174-.012-.344-.033-.513 1.158-.687 1.943-1.99 1.943-3.484zm-6.616-3.334l-4.334 6.5c-.145.217-.382.334-.625.334-.143 0-.288-.04-.416-.126l-.115-.094-2.415-2.415c-.293-.293-.293-.768 0-1.06s.768-.294 1.06 0l1.77 1.767 3.825-5.74c.23-.345.696-.436 1.04-.207.346.23.44.696.21 1.04z\" />\n </g>\n </svg>\n);\n\nexport const truncate = (str: string | null, length: number) => {\n if (!str || str.length <= length) return str;\n return `${str.slice(0, length - 3)}...`;\n};\n\nconst Skeleton = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => {\n return (\n <div className={cn(\"rounded-md bg-primary/10\", className)} {...props} />\n );\n};\n\nexport const TweetSkeleton = ({\n className,\n ...props\n}: {\n className?: string;\n [key: string]: unknown;\n}) => (\n <div\n className={cn(\n \"flex size-full max-h-max min-w-72 flex-col gap-2 rounded-lg border p-4\",\n className,\n )}\n {...props}\n >\n <div className=\"flex flex-row gap-2\">\n <Skeleton className=\"size-10 shrink-0 rounded-full\" />\n <Skeleton className=\"h-10 w-full\" />\n </div>\n <Skeleton className=\"h-20 w-full\" />\n </div>\n);\n\nexport const TweetNotFound = ({\n className,\n ...props\n}: {\n className?: string;\n [key: string]: unknown;\n}) => (\n <div\n className={cn(\n \"flex size-full flex-col items-center justify-center gap-2 rounded-lg border p-4\",\n className,\n )}\n {...props}\n >\n <h3>Tweet not found</h3>\n </div>\n);\n\nexport const TweetHeader = ({ tweet }: { tweet: EnrichedTweet }) => (\n <div className=\"flex flex-row justify-between tracking-tight\">\n <div className=\"flex items-center space-x-2\">\n <a href={tweet.user.url} target=\"_blank\" rel=\"noreferrer\">\n <img\n title={`Profile picture of ${tweet.user.name}`}\n alt={tweet.user.screen_name}\n height={48}\n width={48}\n src={tweet.user.profile_image_url_https}\n className=\"overflow-hidden rounded-full border border-transparent\"\n />\n </a>\n <div>\n <a\n href={tweet.user.url}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"flex items-center whitespace-nowrap font-semibold\"\n >\n {truncate(tweet.user.name, 20)}\n {tweet.user.verified ||\n (tweet.user.is_blue_verified && (\n <Verified className=\"ml-1 inline size-4 text-blue-500\" />\n ))}\n </a>\n <div className=\"flex items-center space-x-1\">\n <a\n href={tweet.user.url}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"text-sm text-gray-500 transition-all duration-75\"\n >\n @{truncate(tweet.user.screen_name, 16)}\n </a>\n </div>\n </div>\n </div>\n <a href={tweet.url} target=\"_blank\" rel=\"noreferrer\">\n <span className=\"sr-only\">Link to tweet</span>\n <Twitter className=\"size-5 items-start text-[#3BA9EE] transition-all ease-in-out hover:scale-105\" />\n </a>\n </div>\n);\n\nexport const TweetBody = ({ tweet }: { tweet: EnrichedTweet }) => (\n <div className=\"break-words leading-normal tracking-tighter\">\n {tweet.entities.map((entity, idx) => {\n switch (entity.type) {\n case \"url\":\n case \"symbol\":\n case \"hashtag\":\n case \"mention\":\n return (\n <a\n key={idx}\n href={entity.href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"text-sm font-normal text-gray-500\"\n >\n <span>{entity.text}</span>\n </a>\n );\n case \"text\":\n return (\n <span\n key={idx}\n className=\"text-sm font-normal\"\n dangerouslySetInnerHTML={{ __html: entity.text }}\n />\n );\n }\n })}\n </div>\n);\n\nexport const TweetMedia = ({ tweet }: { tweet: EnrichedTweet }) => (\n <div className=\"flex flex-1 items-center justify-center\">\n {tweet.video && (\n <video\n poster={tweet.video.poster}\n autoPlay\n loop\n muted\n playsInline\n className=\"rounded-xl border shadow-sm\"\n >\n <source src={tweet.video.variants[0].src} type=\"video/mp4\" />\n Your browser does not support the video tag.\n </video>\n )}\n {tweet.photos && (\n <div className=\"relative flex transform-gpu snap-x snap-mandatory gap-4 overflow-x-auto\">\n <div className=\"shrink-0 snap-center sm:w-2\" />\n {tweet.photos.map((photo) => (\n <img\n key={photo.url}\n src={photo.url}\n title={\"Photo by \" + tweet.user.name}\n alt={tweet.text}\n className=\"h-64 w-5/6 shrink-0 snap-center snap-always rounded-xl border object-cover shadow-sm\"\n />\n ))}\n <div className=\"shrink-0 snap-center sm:w-2\" />\n </div>\n )}\n {!tweet.video &&\n !tweet.photos &&\n // @ts-ignore\n tweet?.card?.binding_values?.thumbnail_image_large?.image_value.url && (\n <img\n // @ts-ignore\n src={tweet.card.binding_values.thumbnail_image_large.image_value.url}\n className=\"h-64 rounded-xl border object-cover shadow-sm\"\n alt={tweet.text}\n />\n )}\n </div>\n);\n\nexport const MagicTweet = ({\n tweet,\n components,\n className,\n ...props\n}: {\n tweet: Tweet;\n components?: TwitterComponents;\n className?: string;\n}) => {\n const enrichedTweet = enrichTweet(tweet);\n return (\n <div\n className={cn(\n \"relative flex size-full max-w-lg flex-col gap-2 overflow-hidden rounded-lg border p-4 backdrop-blur-md\",\n className,\n )}\n {...props}\n >\n <TweetHeader tweet={enrichedTweet} />\n <TweetBody tweet={enrichedTweet} />\n <TweetMedia tweet={enrichedTweet} />\n </div>\n );\n};\n\n/**\n * TweetCard (Server Side Only)\n */\nexport const TweetCard = async ({\n id,\n components,\n fallback = <TweetSkeleton />,\n onError,\n ...props\n}: TweetProps & {\n className?: string;\n}) => {\n const tweet = id\n ? await getTweet(id).catch((err) => {\n if (onError) {\n onError(err);\n } else {\n console.error(err);\n }\n })\n : undefined;\n\n if (!tweet) {\n const NotFound = components?.TweetNotFound || TweetNotFound;\n return <NotFound {...props} />;\n }\n\n return (\n <Suspense fallback={fallback}>\n <MagicTweet tweet={tweet} {...props} />\n </Suspense>\n );\n};\n\nexport default TweetCard;\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/warp-background.json b/public/r/styles/default/warp-background.json
index 7750209a..508f9b7b 100644
--- a/public/r/styles/default/warp-background.json
+++ b/public/r/styles/default/warp-background.json
@@ -2,12 +2,12 @@
"name": "warp-background",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/warp-background.tsx",
- "content": "import { cn } from \"@/lib/utils\";\nimport { motion } from \"framer-motion\";\nimport React, { HTMLAttributes, useCallback, useMemo } from \"react\";\n\ninterface WarpBackgroundProps extends HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n perspective?: number;\n beamsPerSide?: number;\n beamSize?: number;\n beamDelayMax?: number;\n beamDelayMin?: number;\n beamDuration?: number;\n gridColor?: string;\n}\n\nconst Beam = ({\n width,\n x,\n delay,\n duration,\n}: {\n width: string | number;\n x: string | number;\n delay: number;\n duration: number;\n}) => {\n const hue = Math.floor(Math.random() * 360);\n const ar = Math.floor(Math.random() * 10) + 1;\n\n return (\n <motion.div\n style={\n {\n \"--x\": `${x}`,\n \"--width\": `${width}`,\n \"--aspect-ratio\": `${ar}`,\n \"--background\": `linear-gradient(hsl(${hue} 80% 60%), transparent)`,\n } as React.CSSProperties\n }\n className={`absolute left-[var(--x)] top-0 [aspect-ratio:1/var(--aspect-ratio)] [background:var(--background)] [width:var(--width)]`}\n initial={{ y: \"100cqmax\", x: \"-50%\" }}\n animate={{ y: \"-100%\", x: \"-50%\" }}\n transition={{\n duration,\n delay,\n repeat: Infinity,\n ease: \"linear\",\n }}\n />\n );\n};\n\nexport const WarpBackground: React.FC<WarpBackgroundProps> = ({\n children,\n perspective = 100,\n className,\n beamsPerSide = 3,\n beamSize = 5,\n beamDelayMax = 3,\n beamDelayMin = 0,\n beamDuration = 3,\n gridColor = \"hsl(var(--border))\",\n ...props\n}) => {\n const generateBeams = useCallback(() => {\n const beams = [];\n const cellsPerSide = Math.floor(100 / beamSize);\n const step = cellsPerSide / beamsPerSide;\n\n for (let i = 0; i < beamsPerSide; i++) {\n const x = Math.floor(i * step);\n const delay =\n Math.random() * (beamDelayMax - beamDelayMin) + beamDelayMin;\n beams.push({ x, delay });\n }\n return beams;\n }, [beamsPerSide, beamSize, beamDelayMax, beamDelayMin]);\n\n const topBeams = useMemo(() => generateBeams(), [generateBeams]);\n const rightBeams = useMemo(() => generateBeams(), [generateBeams]);\n const bottomBeams = useMemo(() => generateBeams(), [generateBeams]);\n const leftBeams = useMemo(() => generateBeams(), [generateBeams]);\n\n return (\n <div className={cn(\"relative rounded border p-20\", className)} {...props}>\n <div\n style={\n {\n \"--perspective\": `${perspective}px`,\n \"--grid-color\": gridColor,\n \"--beam-size\": `${beamSize}%`,\n } as React.CSSProperties\n }\n className={\n \"pointer-events-none absolute left-0 top-0 size-full overflow-hidden [clip-path:inset(0)] [container-type:size] [perspective:var(--perspective)] [transform-style:preserve-3d]\"\n }\n >\n {/* top side */}\n <div className=\"absolute [transform-style:preserve-3d] [background-size:var(--beam-size)_var(--beam-size)] [background:linear-gradient(var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_-0.5px_/var(--beam-size)_var(--beam-size),linear-gradient(90deg,_var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_50%_/var(--beam-size)_var(--beam-size)] [container-type:inline-size] [height:100cqmax] [transform-origin:50%_0%] [transform:rotateX(-90deg)] [width:100cqi]\">\n {topBeams.map((beam, index) => (\n <Beam\n key={`top-${index}`}\n width={`${beamSize}%`}\n x={`${beam.x * beamSize}%`}\n delay={beam.delay}\n duration={beamDuration}\n />\n ))}\n </div>\n {/* bottom side */}\n <div className=\"absolute top-full [transform-style:preserve-3d] [background-size:var(--beam-size)_var(--beam-size)] [background:linear-gradient(var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_-0.5px_/var(--beam-size)_var(--beam-size),linear-gradient(90deg,_var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_50%_/var(--beam-size)_var(--beam-size)] [container-type:inline-size] [height:100cqmax] [transform-origin:50%_0%] [transform:rotateX(-90deg)] [width:100cqi]\">\n {bottomBeams.map((beam, index) => (\n <Beam\n key={`bottom-${index}`}\n width={`${beamSize}%`}\n x={`${beam.x * beamSize}%`}\n delay={beam.delay}\n duration={beamDuration}\n />\n ))}\n </div>\n {/* left side */}\n <div className=\"absolute left-0 top-0 [transform-style:preserve-3d] [background-size:var(--beam-size)_var(--beam-size)] [background:linear-gradient(var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_-0.5px_/var(--beam-size)_var(--beam-size),linear-gradient(90deg,_var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_50%_/var(--beam-size)_var(--beam-size)] [container-type:inline-size] [height:100cqmax] [transform-origin:0%_0%] [transform:rotate(90deg)_rotateX(-90deg)] [width:100cqh]\">\n {leftBeams.map((beam, index) => (\n <Beam\n key={`left-${index}`}\n width={`${beamSize}%`}\n x={`${beam.x * beamSize}%`}\n delay={beam.delay}\n duration={beamDuration}\n />\n ))}\n </div>\n {/* right side */}\n <div className=\"absolute right-0 top-0 [transform-style:preserve-3d] [background-size:var(--beam-size)_var(--beam-size)] [background:linear-gradient(var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_-0.5px_/var(--beam-size)_var(--beam-size),linear-gradient(90deg,_var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_50%_/var(--beam-size)_var(--beam-size)] [container-type:inline-size] [height:100cqmax] [width:100cqh] [transform-origin:100%_0%] [transform:rotate(-90deg)_rotateX(-90deg)]\">\n {rightBeams.map((beam, index) => (\n <Beam\n key={`right-${index}`}\n width={`${beamSize}%`}\n x={`${beam.x * beamSize}%`}\n delay={beam.delay}\n duration={beamDuration}\n />\n ))}\n </div>\n </div>\n <div className=\"relative\">{children}</div>\n </div>\n );\n};\n",
+ "content": "import { cn } from \"@/lib/utils\";\nimport { motion } from \"motion/react\";\nimport React, { HTMLAttributes, useCallback, useMemo } from \"react\";\n\ninterface WarpBackgroundProps extends HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n perspective?: number;\n beamsPerSide?: number;\n beamSize?: number;\n beamDelayMax?: number;\n beamDelayMin?: number;\n beamDuration?: number;\n gridColor?: string;\n}\n\nconst Beam = ({\n width,\n x,\n delay,\n duration,\n}: {\n width: string | number;\n x: string | number;\n delay: number;\n duration: number;\n}) => {\n const hue = Math.floor(Math.random() * 360);\n const ar = Math.floor(Math.random() * 10) + 1;\n\n return (\n <motion.div\n style={\n {\n \"--x\": `${x}`,\n \"--width\": `${width}`,\n \"--aspect-ratio\": `${ar}`,\n \"--background\": `linear-gradient(hsl(${hue} 80% 60%), transparent)`,\n } as React.CSSProperties\n }\n className={`absolute left-[var(--x)] top-0 [aspect-ratio:1/var(--aspect-ratio)] [background:var(--background)] [width:var(--width)]`}\n initial={{ y: \"100cqmax\", x: \"-50%\" }}\n animate={{ y: \"-100%\", x: \"-50%\" }}\n transition={{\n duration,\n delay,\n repeat: Infinity,\n ease: \"linear\",\n }}\n />\n );\n};\n\nexport const WarpBackground: React.FC<WarpBackgroundProps> = ({\n children,\n perspective = 100,\n className,\n beamsPerSide = 3,\n beamSize = 5,\n beamDelayMax = 3,\n beamDelayMin = 0,\n beamDuration = 3,\n gridColor = \"hsl(var(--border))\",\n ...props\n}) => {\n const generateBeams = useCallback(() => {\n const beams = [];\n const cellsPerSide = Math.floor(100 / beamSize);\n const step = cellsPerSide / beamsPerSide;\n\n for (let i = 0; i < beamsPerSide; i++) {\n const x = Math.floor(i * step);\n const delay =\n Math.random() * (beamDelayMax - beamDelayMin) + beamDelayMin;\n beams.push({ x, delay });\n }\n return beams;\n }, [beamsPerSide, beamSize, beamDelayMax, beamDelayMin]);\n\n const topBeams = useMemo(() => generateBeams(), [generateBeams]);\n const rightBeams = useMemo(() => generateBeams(), [generateBeams]);\n const bottomBeams = useMemo(() => generateBeams(), [generateBeams]);\n const leftBeams = useMemo(() => generateBeams(), [generateBeams]);\n\n return (\n <div className={cn(\"relative rounded border p-20\", className)} {...props}>\n <div\n style={\n {\n \"--perspective\": `${perspective}px`,\n \"--grid-color\": gridColor,\n \"--beam-size\": `${beamSize}%`,\n } as React.CSSProperties\n }\n className={\n \"pointer-events-none absolute left-0 top-0 size-full overflow-hidden [clip-path:inset(0)] [container-type:size] [perspective:var(--perspective)] [transform-style:preserve-3d]\"\n }\n >\n {/* top side */}\n <div className=\"absolute [transform-style:preserve-3d] [background-size:var(--beam-size)_var(--beam-size)] [background:linear-gradient(var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_-0.5px_/var(--beam-size)_var(--beam-size),linear-gradient(90deg,_var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_50%_/var(--beam-size)_var(--beam-size)] [container-type:inline-size] [height:100cqmax] [transform-origin:50%_0%] [transform:rotateX(-90deg)] [width:100cqi]\">\n {topBeams.map((beam, index) => (\n <Beam\n key={`top-${index}`}\n width={`${beamSize}%`}\n x={`${beam.x * beamSize}%`}\n delay={beam.delay}\n duration={beamDuration}\n />\n ))}\n </div>\n {/* bottom side */}\n <div className=\"absolute top-full [transform-style:preserve-3d] [background-size:var(--beam-size)_var(--beam-size)] [background:linear-gradient(var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_-0.5px_/var(--beam-size)_var(--beam-size),linear-gradient(90deg,_var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_50%_/var(--beam-size)_var(--beam-size)] [container-type:inline-size] [height:100cqmax] [transform-origin:50%_0%] [transform:rotateX(-90deg)] [width:100cqi]\">\n {bottomBeams.map((beam, index) => (\n <Beam\n key={`bottom-${index}`}\n width={`${beamSize}%`}\n x={`${beam.x * beamSize}%`}\n delay={beam.delay}\n duration={beamDuration}\n />\n ))}\n </div>\n {/* left side */}\n <div className=\"absolute left-0 top-0 [transform-style:preserve-3d] [background-size:var(--beam-size)_var(--beam-size)] [background:linear-gradient(var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_-0.5px_/var(--beam-size)_var(--beam-size),linear-gradient(90deg,_var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_50%_/var(--beam-size)_var(--beam-size)] [container-type:inline-size] [height:100cqmax] [transform-origin:0%_0%] [transform:rotate(90deg)_rotateX(-90deg)] [width:100cqh]\">\n {leftBeams.map((beam, index) => (\n <Beam\n key={`left-${index}`}\n width={`${beamSize}%`}\n x={`${beam.x * beamSize}%`}\n delay={beam.delay}\n duration={beamDuration}\n />\n ))}\n </div>\n {/* right side */}\n <div className=\"absolute right-0 top-0 [transform-style:preserve-3d] [background-size:var(--beam-size)_var(--beam-size)] [background:linear-gradient(var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_-0.5px_/var(--beam-size)_var(--beam-size),linear-gradient(90deg,_var(--grid-color)_0_1px,_transparent_1px_var(--beam-size))_50%_50%_/var(--beam-size)_var(--beam-size)] [container-type:inline-size] [height:100cqmax] [width:100cqh] [transform-origin:100%_0%] [transform:rotate(-90deg)_rotateX(-90deg)]\">\n {rightBeams.map((beam, index) => (\n <Beam\n key={`right-${index}`}\n width={`${beamSize}%`}\n x={`${beam.x * beamSize}%`}\n delay={beam.delay}\n duration={beamDuration}\n />\n ))}\n </div>\n </div>\n <div className=\"relative\">{children}</div>\n </div>\n );\n};\n",
"type": "registry:ui",
"target": ""
}
diff --git a/public/r/styles/default/word-fade-in.json b/public/r/styles/default/word-fade-in.json
index 703e7d0d..2600d5be 100644
--- a/public/r/styles/default/word-fade-in.json
+++ b/public/r/styles/default/word-fade-in.json
@@ -2,12 +2,12 @@
"name": "word-fade-in",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"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: 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",
+ "content": "\"use client\";\n\nimport { motion, Variants } from \"motion/react\";\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/public/r/styles/default/word-pull-up.json b/public/r/styles/default/word-pull-up.json
index 125100b1..7d91bbcd 100644
--- a/public/r/styles/default/word-pull-up.json
+++ b/public/r/styles/default/word-pull-up.json
@@ -2,7 +2,7 @@
"name": "word-pull-up",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
diff --git a/public/r/styles/default/word-rotate.json b/public/r/styles/default/word-rotate.json
index 6d0915ea..ab2469a3 100644
--- a/public/r/styles/default/word-rotate.json
+++ b/public/r/styles/default/word-rotate.json
@@ -2,12 +2,12 @@
"name": "word-rotate",
"type": "registry:ui",
"dependencies": [
- "framer-motion"
+ "motion"
],
"files": [
{
"path": "magicui/word-rotate.tsx",
- "content": "\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { AnimatePresence, motion, MotionProps } from \"framer-motion\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface WordRotateProps {\n words: string[];\n duration?: number;\n framerProps?: MotionProps;\n className?: string;\n}\n\nexport default function WordRotate({\n words,\n duration = 2500,\n framerProps = {\n initial: { opacity: 0, y: -50 },\n animate: { opacity: 1, y: 0 },\n exit: { opacity: 0, y: 50 },\n transition: { duration: 0.25, ease: \"easeOut\" },\n },\n className,\n}: WordRotateProps) {\n const [index, setIndex] = useState(0);\n\n useEffect(() => {\n const interval = setInterval(() => {\n setIndex((prevIndex) => (prevIndex + 1) % words.length);\n }, duration);\n\n // Clean up interval on unmount\n return () => clearInterval(interval);\n }, [words, duration]);\n\n return (\n <div className=\"overflow-hidden py-2\">\n <AnimatePresence mode=\"wait\">\n <motion.h1\n key={words[index]}\n className={cn(className)}\n {...framerProps}\n >\n {words[index]}\n </motion.h1>\n </AnimatePresence>\n </div>\n );\n}\n",
+ "content": "\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { AnimatePresence, motion, MotionProps } from \"motion/react\";\n\nimport { cn } from \"@/lib/utils\";\n\ninterface WordRotateProps {\n words: string[];\n duration?: number;\n framerProps?: MotionProps;\n className?: string;\n}\n\nexport default function WordRotate({\n words,\n duration = 2500,\n framerProps = {\n initial: { opacity: 0, y: -50 },\n animate: { opacity: 1, y: 0 },\n exit: { opacity: 0, y: 50 },\n transition: { duration: 0.25, ease: \"easeOut\" },\n },\n className,\n}: WordRotateProps) {\n const [index, setIndex] = useState(0);\n\n useEffect(() => {\n const interval = setInterval(() => {\n setIndex((prevIndex) => (prevIndex + 1) % words.length);\n }, duration);\n\n // Clean up interval on unmount\n return () => clearInterval(interval);\n }, [words, duration]);\n\n return (\n <div className=\"overflow-hidden py-2\">\n <AnimatePresence mode=\"wait\">\n <motion.h1\n key={words[index]}\n className={cn(className)}\n {...framerProps}\n >\n {words[index]}\n </motion.h1>\n </AnimatePresence>\n </div>\n );\n}\n",
"type": "registry:ui",
"target": ""
}
diff --git a/registry/default/magicui/animated-beam.tsx b/registry/default/magicui/animated-beam.tsx
index 3015cb6b..4dd04a70 100644
--- a/registry/default/magicui/animated-beam.tsx
+++ b/registry/default/magicui/animated-beam.tsx
@@ -1,7 +1,7 @@
"use client";
+import { motion } from "motion/react";
import { RefObject, useEffect, useId, useState } from "react";
-import { motion } from "framer-motion";
import { cn } from "@/lib/utils";
diff --git a/registry/default/magicui/animated-grid-pattern.tsx b/registry/default/magicui/animated-grid-pattern.tsx
index 0652f01b..8c6504a5 100644
--- a/registry/default/magicui/animated-grid-pattern.tsx
+++ b/registry/default/magicui/animated-grid-pattern.tsx
@@ -1,7 +1,7 @@
"use client";
+import { motion } from "motion/react";
import { useEffect, useId, useRef, useState } from "react";
-import { motion } from "framer-motion";
import { cn } from "@/lib/utils";
diff --git a/registry/default/magicui/animated-list.tsx b/registry/default/magicui/animated-list.tsx
index 79bc0d64..66a730bf 100644
--- a/registry/default/magicui/animated-list.tsx
+++ b/registry/default/magicui/animated-list.tsx
@@ -1,7 +1,7 @@
"use client";
-import React, { ReactElement, useEffect, useMemo, useState } from "react";
-import { AnimatePresence, motion } from "framer-motion";
+import { AnimatePresence, motion } from "motion/react";
+import React, { useEffect, useMemo, useState } from "react";
export interface AnimatedListProps {
className?: string;
diff --git a/registry/default/magicui/animated-subscribe-button.tsx b/registry/default/magicui/animated-subscribe-button.tsx
index 5d1b8236..4531bb24 100644
--- a/registry/default/magicui/animated-subscribe-button.tsx
+++ b/registry/default/magicui/animated-subscribe-button.tsx
@@ -1,7 +1,7 @@
"use client";
+import { AnimatePresence, motion } from "motion/react";
import React, { useState } from "react";
-import { AnimatePresence, motion } from "framer-motion";
interface AnimatedSubscribeButtonProps {
buttonColor: string;
diff --git a/registry/default/magicui/blur-fade.tsx b/registry/default/magicui/blur-fade.tsx
index e7216e10..8aa61859 100644
--- a/registry/default/magicui/blur-fade.tsx
+++ b/registry/default/magicui/blur-fade.tsx
@@ -7,7 +7,7 @@ import {
useInView,
UseInViewOptions,
Variants,
-} from "framer-motion";
+} from "motion/react";
type MarginType = UseInViewOptions["margin"];
diff --git a/registry/default/magicui/blur-in.tsx b/registry/default/magicui/blur-in.tsx
index fcdd3e08..606e2b2d 100644
--- a/registry/default/magicui/blur-in.tsx
+++ b/registry/default/magicui/blur-in.tsx
@@ -1,6 +1,6 @@
"use client";
-import { motion } from "framer-motion";
+import { motion } from "motion/react";
import { cn } from "@/lib/utils";
diff --git a/registry/default/magicui/box-reveal.tsx b/registry/default/magicui/box-reveal.tsx
index b3535416..03e67fc2 100644
--- a/registry/default/magicui/box-reveal.tsx
+++ b/registry/default/magicui/box-reveal.tsx
@@ -1,7 +1,7 @@
"use client";
import { useEffect, useRef } from "react";
-import { motion, useAnimation, useInView } from "framer-motion";
+import { motion, useAnimation, useInView } from "motion/react";
interface BoxRevealProps {
children: JSX.Element;
diff --git a/registry/default/magicui/dock.tsx b/registry/default/magicui/dock.tsx
index b712c2ac..0618c854 100644
--- a/registry/default/magicui/dock.tsx
+++ b/registry/default/magicui/dock.tsx
@@ -8,7 +8,7 @@ import {
useMotionValue,
useSpring,
useTransform,
-} from "framer-motion";
+} from "motion/react";
import React, { PropsWithChildren, useRef } from "react";
import { cn } from "@/lib/utils";
diff --git a/registry/default/magicui/fade-text.tsx b/registry/default/magicui/fade-text.tsx
index b322a838..04f291f3 100644
--- a/registry/default/magicui/fade-text.tsx
+++ b/registry/default/magicui/fade-text.tsx
@@ -1,7 +1,7 @@
"use client";
import { useMemo } from "react";
-import { motion, Variants } from "framer-motion";
+import { motion, Variants } from "motion/react";
type FadeTextProps = {
className?: string;
diff --git a/registry/default/magicui/flip-text.tsx b/registry/default/magicui/flip-text.tsx
index e51695d3..7b1116df 100644
--- a/registry/default/magicui/flip-text.tsx
+++ b/registry/default/magicui/flip-text.tsx
@@ -1,6 +1,6 @@
"use client";
-import { AnimatePresence, motion, Variants } from "framer-motion";
+import { AnimatePresence, motion, Variants } from "motion/react";
import { cn } from "@/lib/utils";
diff --git a/registry/default/magicui/gradual-spacing.tsx b/registry/default/magicui/gradual-spacing.tsx
index 9f620602..55206614 100644
--- a/registry/default/magicui/gradual-spacing.tsx
+++ b/registry/default/magicui/gradual-spacing.tsx
@@ -1,6 +1,6 @@
"use client";
-import { AnimatePresence, motion, Variants } from "framer-motion";
+import { AnimatePresence, motion, Variants } from "motion/react";
import { cn } from "@/lib/utils";
diff --git a/registry/default/magicui/hero-video-dialog.tsx b/registry/default/magicui/hero-video-dialog.tsx
index 6f96a634..4a5cb5ea 100644
--- a/registry/default/magicui/hero-video-dialog.tsx
+++ b/registry/default/magicui/hero-video-dialog.tsx
@@ -2,7 +2,7 @@
"use client";
import { useState } from "react";
-import { AnimatePresence, motion } from "framer-motion";
+import { AnimatePresence, motion } from "motion/react";
import { Play, XIcon } from "lucide-react";
import { cn } from "@/lib/utils";
diff --git a/registry/default/magicui/letter-pullup.tsx b/registry/default/magicui/letter-pullup.tsx
index fa234b78..8ada1e17 100644
--- a/registry/default/magicui/letter-pullup.tsx
+++ b/registry/default/magicui/letter-pullup.tsx
@@ -1,6 +1,6 @@
"use client";
-import { motion } from "framer-motion";
+import { motion } from "motion/react";
import { cn } from "@/lib/utils";
diff --git a/registry/default/magicui/number-ticker.tsx b/registry/default/magicui/number-ticker.tsx
index 5221ef51..f69d0bf9 100644
--- a/registry/default/magicui/number-ticker.tsx
+++ b/registry/default/magicui/number-ticker.tsx
@@ -1,7 +1,7 @@
"use client";
import { useEffect, useRef } from "react";
-import { useInView, useMotionValue, useSpring } from "framer-motion";
+import { useInView, useMotionValue, useSpring } from "motion/react";
import { cn } from "@/lib/utils";
diff --git a/registry/default/magicui/scratch-to-reveal.tsx b/registry/default/magicui/scratch-to-reveal.tsx
index 22d4d8a5..582bbd18 100644
--- a/registry/default/magicui/scratch-to-reveal.tsx
+++ b/registry/default/magicui/scratch-to-reveal.tsx
@@ -1,6 +1,6 @@
import { cn } from "@/lib/utils";
import React, { useRef, useEffect, useState } from "react";
-import { motion, useAnimation } from "framer-motion";
+import { motion, useAnimation } from "motion/react";
interface ScratchToRevealProps {
children: React.ReactNode;
diff --git a/registry/default/magicui/script-copy-btn.tsx b/registry/default/magicui/script-copy-btn.tsx
index 00d30009..fbc8137b 100644
--- a/registry/default/magicui/script-copy-btn.tsx
+++ b/registry/default/magicui/script-copy-btn.tsx
@@ -2,7 +2,7 @@
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
-import { motion } from "framer-motion";
+import { motion } from "motion/react";
import { Check, Copy } from "lucide-react";
import { useTheme } from "next-themes";
import { HTMLAttributes, useEffect, useState } from "react";
diff --git a/registry/default/magicui/scroll-based-velocity.tsx b/registry/default/magicui/scroll-based-velocity.tsx
index f27fcbca..f77db99c 100644
--- a/registry/default/magicui/scroll-based-velocity.tsx
+++ b/registry/default/magicui/scroll-based-velocity.tsx
@@ -8,7 +8,7 @@ import {
useSpring,
useTransform,
useVelocity,
-} from "framer-motion";
+} from "motion/react";
import React, { useEffect, useRef, useState } from "react";
import { cn } from "@/lib/utils";
diff --git a/registry/default/magicui/scroll-progress.tsx b/registry/default/magicui/scroll-progress.tsx
index 0bc2f0e0..c883361b 100644
--- a/registry/default/magicui/scroll-progress.tsx
+++ b/registry/default/magicui/scroll-progress.tsx
@@ -1,7 +1,7 @@
"use client";
import { cn } from "@/lib/utils";
-import { motion, useScroll, useSpring } from "framer-motion";
+import { motion, useScroll, useSpring } from "motion/react";
interface ScrollProgressProps {
className?: string;
diff --git a/registry/default/magicui/shiny-button.tsx b/registry/default/magicui/shiny-button.tsx
index 375bd436..bd8455f3 100644
--- a/registry/default/magicui/shiny-button.tsx
+++ b/registry/default/magicui/shiny-button.tsx
@@ -5,7 +5,7 @@ import {
motion,
type AnimationProps,
type HTMLMotionProps,
-} from "framer-motion";
+} from "motion/react";
import { cn } from "@/lib/utils";
const animationProps = {
diff --git a/registry/default/magicui/sparkles-text.tsx b/registry/default/magicui/sparkles-text.tsx
index f564f160..99d29638 100644
--- a/registry/default/magicui/sparkles-text.tsx
+++ b/registry/default/magicui/sparkles-text.tsx
@@ -1,7 +1,7 @@
"use client";
import { CSSProperties, ReactElement, useEffect, useState } from "react";
-import { motion } from "framer-motion";
+import { motion } from "motion/react";
import { cn } from "@/lib/utils";
diff --git a/registry/default/magicui/text-reveal.tsx b/registry/default/magicui/text-reveal.tsx
index 3d0d647d..08edc163 100644
--- a/registry/default/magicui/text-reveal.tsx
+++ b/registry/default/magicui/text-reveal.tsx
@@ -1,7 +1,7 @@
"use client";
import { FC, ReactNode, useRef } from "react";
-import { motion, MotionValue, useScroll, useTransform } from "framer-motion";
+import { motion, MotionValue, useScroll, useTransform } from "motion/react";
import { cn } from "@/lib/utils";
diff --git a/registry/default/magicui/warp-background.tsx b/registry/default/magicui/warp-background.tsx
index 966f1ef2..731449b9 100644
--- a/registry/default/magicui/warp-background.tsx
+++ b/registry/default/magicui/warp-background.tsx
@@ -1,5 +1,5 @@
import { cn } from "@/lib/utils";
-import { motion } from "framer-motion";
+import { motion } from "motion/react";
import React, { HTMLAttributes, useCallback, useMemo } from "react";
interface WarpBackgroundProps extends HTMLAttributes<HTMLDivElement> {
diff --git a/registry/default/magicui/word-fade-in.tsx b/registry/default/magicui/word-fade-in.tsx
index 82bc7d5d..9364f599 100644
--- a/registry/default/magicui/word-fade-in.tsx
+++ b/registry/default/magicui/word-fade-in.tsx
@@ -1,6 +1,6 @@
"use client";
-import { motion, Variants } from "framer-motion";
+import { motion, Variants } from "motion/react";
import { cn } from "@/lib/utils";
diff --git a/registry/default/magicui/word-rotate.tsx b/registry/default/magicui/word-rotate.tsx
index 119b8a85..3282f7f8 100644
--- a/registry/default/magicui/word-rotate.tsx
+++ b/registry/default/magicui/word-rotate.tsx
@@ -1,7 +1,7 @@
"use client";
import { useEffect, useState } from "react";
-import { AnimatePresence, motion, MotionProps } from "framer-motion";
+import { AnimatePresence, motion, MotionProps } from "motion/react";
import { cn } from "@/lib/utils";
diff --git a/registry/registry-ui.ts b/registry/registry-ui.ts
index 089b7122..81607055 100644
--- a/registry/registry-ui.ts
+++ b/registry/registry-ui.ts
@@ -4,7 +4,7 @@ export const ui: Registry = [
{
name: "magic-card",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/magic-card.tsx"],
},
{
@@ -15,19 +15,19 @@ export const ui: Registry = [
{
name: "warp-background",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/warp-background.tsx"],
},
{
name: "morphing-text",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/morphing-text.tsx"],
},
{
name: "scroll-progress",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/scroll-progress.tsx"],
},
{
@@ -95,13 +95,13 @@ export const ui: Registry = [
{
name: "flickering-grid",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/flickering-grid.tsx"],
},
{
name: "hero-video-dialog",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/hero-video-dialog.tsx"],
},
{
@@ -113,7 +113,7 @@ export const ui: Registry = [
{
name: "script-copy-btn",
type: "registry:ui",
- dependencies: ["framer-motion", "shiki", "next-themes"],
+ dependencies: ["motion", "shiki", "next-themes"],
files: ["magicui/script-copy-btn.tsx"],
},
{
@@ -216,7 +216,7 @@ export const ui: Registry = [
{
name: "number-ticker",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/number-ticker.tsx"],
},
{
@@ -271,7 +271,7 @@ export const ui: Registry = [
{
name: "animated-list",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/animated-list.tsx"],
},
{
@@ -303,7 +303,7 @@ export const ui: Registry = [
{
name: "animated-grid-pattern",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/animated-grid-pattern.tsx"],
},
{
@@ -333,13 +333,13 @@ export const ui: Registry = [
{
name: "animated-beam",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/animated-beam.tsx"],
},
{
name: "text-reveal",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/text-reveal.tsx"],
},
{
@@ -402,13 +402,13 @@ export const ui: Registry = [
{
name: "dock",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/dock.tsx"],
},
{
name: "word-rotate",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/word-rotate.tsx"],
},
{
@@ -419,7 +419,7 @@ export const ui: Registry = [
{
name: "word-pull-up",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/word-pull-up.tsx"],
},
{
@@ -431,25 +431,25 @@ export const ui: Registry = [
{
name: "blur-in",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/blur-in.tsx"],
},
{
name: "letter-pullup",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/letter-pullup.tsx"],
},
{
name: "sparkles-text",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/sparkles-text.tsx"],
},
{
name: "flip-text",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/flip-text.tsx"],
},
{
@@ -461,43 +461,43 @@ export const ui: Registry = [
{
name: "gradual-spacing",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/gradual-spacing.tsx"],
},
{
name: "word-fade-in",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/word-fade-in.tsx"],
},
{
name: "scroll-based-velocity",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/scroll-based-velocity.tsx"],
},
{
name: "scratch-to-reveal",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/scratch-to-reveal.tsx"],
},
{
name: "fade-text",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/fade-text.tsx"],
},
{
name: "shiny-button",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/shiny-button.tsx"],
},
{
name: "box-reveal",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/box-reveal.tsx"],
},
{
@@ -543,7 +543,7 @@ export const ui: Registry = [
{
name: "animated-subscribe-button",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/animated-subscribe-button.tsx"],
},
{
@@ -608,7 +608,7 @@ export const ui: Registry = [
{
name: "blur-fade",
type: "registry:ui",
- dependencies: ["framer-motion"],
+ dependencies: ["motion"],
files: ["magicui/blur-fade.tsx"],
},
{